Async JavaScript - Version 2.18.03.15

Version Description

  • bugfix: only load asyncjs' JS & CSS on own settings page as reported by Marat Petrov
  • bugfix: check if jQuery chosen is correctly loaded before using it (based on same report, thanks Marat!)
  • update jQuery Chosen lib
  • small readme tweaks
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 Async JavaScript
Version 2.18.03.15
Comparing to
See all releases

Code changes from version 2.18.03.10 to 2.18.03.15

Files changed (31) hide show
  1. assets/lib/chosen/bower.json +42 -0
  2. assets/lib/{chosen_v1.4.2 → chosen}/chosen-sprite.png +0 -0
  3. assets/lib/{chosen_v1.4.2 → chosen}/chosen-sprite@2x.png +0 -0
  4. assets/lib/{chosen_v1.4.2 → chosen}/chosen.css +109 -63
  5. assets/lib/{chosen_v1.4.2 → chosen}/chosen.jquery.js +432 -333
  6. assets/lib/chosen/chosen.jquery.min.js +3 -0
  7. assets/lib/chosen/chosen.min.css +11 -0
  8. assets/lib/{chosen_v1.4.2 → chosen}/chosen.proto.js +470 -348
  9. assets/lib/chosen/chosen.proto.min.js +3 -0
  10. assets/lib/{chosen_v1.4.2 → chosen}/docsupport/chosen.png +0 -0
  11. assets/lib/chosen/docsupport/init.js +11 -0
  12. assets/lib/chosen/docsupport/init.proto.js +16 -0
  13. assets/lib/chosen/docsupport/jquery-1.12.4.min.js +5 -0
  14. assets/lib/chosen/docsupport/jquery-3.2.1.min.js +4 -0
  15. assets/lib/{chosen_v1.4.2 → chosen}/docsupport/oss-credit.png +0 -0
  16. assets/lib/{chosen_v1.4.2 → chosen}/docsupport/prism.css +0 -0
  17. assets/lib/{chosen_v1.4.2 → chosen}/docsupport/prism.js +0 -0
  18. assets/lib/chosen/docsupport/prototype-1.7.0.0.js +6082 -0
  19. assets/lib/{chosen_v1.4.2 → chosen}/docsupport/style.css +15 -0
  20. assets/lib/{chosen_v1.4.2 → chosen}/index.html +39 -45
  21. assets/lib/{chosen_v1.4.2 → chosen}/index.proto.html +42 -53
  22. assets/lib/{chosen_v1.4.2 → chosen}/options.html +40 -5
  23. assets/lib/{chosen_v1.4.2/bower.json → chosen/package.json} +21 -24
  24. assets/lib/chosen_v1.4.2/chosen.jquery.min.js +0 -2
  25. assets/lib/chosen_v1.4.2/chosen.min.css +0 -3
  26. assets/lib/chosen_v1.4.2/chosen.proto.min.js +0 -2
  27. async-javascript.php +2 -2
  28. asyncjsBackendClass.php +4 -4
  29. js/admin.js +337 -1
  30. js/admin.min.js +1 -1
  31. readme.txt +10 -3
assets/lib/chosen/bower.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "chosen",
3
+ "description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
4
+ "keywords": [
5
+ "select",
6
+ "multiselect",
7
+ "dropdown",
8
+ "form",
9
+ "input",
10
+ "ui"
11
+ ],
12
+ "homepage": "https://harvesthq.github.io/chosen/",
13
+ "license": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md",
14
+ "authors": [
15
+ {
16
+ "name": "Patrick Filler",
17
+ "url": "https://github.com/pfiller"
18
+ },
19
+ {
20
+ "name": "Christophe Coevoet",
21
+ "url": "https://github.com/stof"
22
+ },
23
+ {
24
+ "name": "Ken Earley",
25
+ "url": "https://github.com/kenearley"
26
+ },
27
+ {
28
+ "name": "Koen Punt",
29
+ "url": "https://github.com/koenpunt"
30
+ }
31
+ ],
32
+ "dependencies": {},
33
+ "main": [
34
+ "chosen.jquery.js",
35
+ "chosen.css"
36
+ ],
37
+ "ignore": [],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/harvesthq/chosen.git"
41
+ }
42
+ }
assets/lib/{chosen_v1.4.2 → chosen}/chosen-sprite.png RENAMED
File without changes
assets/lib/{chosen_v1.4.2 → chosen}/chosen-sprite@2x.png RENAMED
File without changes
assets/lib/{chosen_v1.4.2 → chosen}/chosen.css RENAMED
@@ -2,9 +2,9 @@
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
- Version 1.4.2
6
  Full source at https://github.com/harvesthq/chosen
7
- Copyright (c) 2011-2015 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
@@ -16,34 +16,38 @@ This file is generated by `grunt build`, do not edit it by hand.
16
  display: inline-block;
17
  vertical-align: middle;
18
  font-size: 13px;
19
- zoom: 1;
20
- *display: inline;
21
  -webkit-user-select: none;
22
- -moz-user-select: none;
23
- user-select: none;
 
24
  }
 
25
  .chosen-container * {
26
  -webkit-box-sizing: border-box;
27
- -moz-box-sizing: border-box;
28
- box-sizing: border-box;
29
  }
 
30
  .chosen-container .chosen-drop {
31
  position: absolute;
32
  top: 100%;
33
- left: -9999px;
34
  z-index: 1010;
35
  width: 100%;
36
  border: 1px solid #aaa;
37
  border-top: 0;
38
  background: #fff;
39
- box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
 
 
40
  }
 
41
  .chosen-container.chosen-with-drop .chosen-drop {
42
- left: 0;
43
  }
 
44
  .chosen-container a {
45
  cursor: pointer;
46
  }
 
47
  .chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
48
  margin-right: 4px;
49
  overflow: hidden;
@@ -52,6 +56,7 @@ This file is generated by `grunt build`, do not edit it by hand.
52
  font-weight: normal;
53
  color: #999999;
54
  }
 
55
  .chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
56
  content: ":";
57
  padding-left: 2px;
@@ -69,21 +74,27 @@ This file is generated by `grunt build`, do not edit it by hand.
69
  border: 1px solid #aaa;
70
  border-radius: 5px;
71
  background-color: #fff;
72
- background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
73
- background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
74
- background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
75
- background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
76
- background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
77
  background-clip: padding-box;
78
- box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
 
79
  color: #444;
80
  text-decoration: none;
81
  white-space: nowrap;
82
  line-height: 24px;
83
  }
 
 
 
 
 
 
 
84
  .chosen-container-single .chosen-default {
85
  color: #999;
86
  }
 
87
  .chosen-container-single .chosen-single span {
88
  display: block;
89
  overflow: hidden;
@@ -91,9 +102,11 @@ This file is generated by `grunt build`, do not edit it by hand.
91
  text-overflow: ellipsis;
92
  white-space: nowrap;
93
  }
 
94
  .chosen-container-single .chosen-single-with-deselect span {
95
  margin-right: 38px;
96
  }
 
97
  .chosen-container-single .chosen-single abbr {
98
  position: absolute;
99
  top: 6px;
@@ -101,15 +114,18 @@ This file is generated by `grunt build`, do not edit it by hand.
101
  display: block;
102
  width: 12px;
103
  height: 12px;
104
- background: url('chosen-sprite.png') -42px 1px no-repeat;
105
  font-size: 1px;
106
  }
 
107
  .chosen-container-single .chosen-single abbr:hover {
108
  background-position: -42px -10px;
109
  }
 
110
  .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
111
  background-position: -42px -10px;
112
  }
 
113
  .chosen-container-single .chosen-single div {
114
  position: absolute;
115
  top: 0;
@@ -118,12 +134,14 @@ This file is generated by `grunt build`, do not edit it by hand.
118
  width: 18px;
119
  height: 100%;
120
  }
 
121
  .chosen-container-single .chosen-single div b {
122
  display: block;
123
  width: 100%;
124
  height: 100%;
125
- background: url('chosen-sprite.png') no-repeat 0px 2px;
126
  }
 
127
  .chosen-container-single .chosen-search {
128
  position: relative;
129
  z-index: 1010;
@@ -131,6 +149,7 @@ This file is generated by `grunt build`, do not edit it by hand.
131
  padding: 3px 4px;
132
  white-space: nowrap;
133
  }
 
134
  .chosen-container-single .chosen-search input[type="text"] {
135
  margin: 1px 0;
136
  padding: 4px 20px 4px 5px;
@@ -138,21 +157,22 @@ This file is generated by `grunt build`, do not edit it by hand.
138
  height: auto;
139
  outline: 0;
140
  border: 1px solid #aaa;
141
- background: white url('chosen-sprite.png') no-repeat 100% -20px;
142
- background: url('chosen-sprite.png') no-repeat 100% -20px;
143
  font-size: 1em;
144
  font-family: sans-serif;
145
  line-height: normal;
146
  border-radius: 0;
147
  }
 
148
  .chosen-container-single .chosen-drop {
149
  margin-top: -1px;
150
  border-radius: 0 0 4px 4px;
151
  background-clip: padding-box;
152
  }
 
153
  .chosen-container-single.chosen-container-single-nosearch .chosen-search {
154
  position: absolute;
155
- left: -9999px;
156
  }
157
 
158
  /* @end */
@@ -167,6 +187,7 @@ This file is generated by `grunt build`, do not edit it by hand.
167
  max-height: 240px;
168
  -webkit-overflow-scrolling: touch;
169
  }
 
170
  .chosen-container .chosen-results li {
171
  display: none;
172
  margin: 0;
@@ -176,37 +197,41 @@ This file is generated by `grunt build`, do not edit it by hand.
176
  word-wrap: break-word;
177
  -webkit-touch-callout: none;
178
  }
 
179
  .chosen-container .chosen-results li.active-result {
180
  display: list-item;
181
  cursor: pointer;
182
  }
 
183
  .chosen-container .chosen-results li.disabled-result {
184
  display: list-item;
185
  color: #ccc;
186
  cursor: default;
187
  }
 
188
  .chosen-container .chosen-results li.highlighted {
189
  background-color: #3875d7;
190
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
191
- background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
192
- background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
193
- background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
194
  background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
195
  color: #fff;
196
  }
 
197
  .chosen-container .chosen-results li.no-results {
198
  color: #777;
199
  display: list-item;
200
  background: #f4f4f4;
201
  }
 
202
  .chosen-container .chosen-results li.group-result {
203
  display: list-item;
204
  font-weight: bold;
205
  cursor: default;
206
  }
 
207
  .chosen-container .chosen-results li.group-option {
208
  padding-left: 15px;
209
  }
 
210
  .chosen-container .chosen-results li em {
211
  font-style: normal;
212
  text-decoration: underline;
@@ -220,26 +245,25 @@ This file is generated by `grunt build`, do not edit it by hand.
220
  margin: 0;
221
  padding: 0 5px;
222
  width: 100%;
223
- height: auto !important;
224
- height: 1%;
225
  border: 1px solid #aaa;
226
  background-color: #fff;
227
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
228
- background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
229
- background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
230
- background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
231
- background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
232
  cursor: text;
233
  }
 
234
  .chosen-container-multi .chosen-choices li {
235
  float: left;
236
  list-style: none;
237
  }
 
238
  .chosen-container-multi .chosen-choices li.search-field {
239
  margin: 0;
240
  padding: 0;
241
  white-space: nowrap;
242
  }
 
243
  .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
244
  margin: 1px 0;
245
  padding: 0;
@@ -247,13 +271,16 @@ This file is generated by `grunt build`, do not edit it by hand.
247
  outline: 0;
248
  border: 0 !important;
249
  background: transparent !important;
250
- box-shadow: none;
 
251
  color: #999;
252
  font-size: 100%;
253
  font-family: sans-serif;
254
  line-height: normal;
255
  border-radius: 0;
 
256
  }
 
257
  .chosen-container-multi .chosen-choices li.search-choice {
258
  position: relative;
259
  margin: 3px 5px 3px 0;
@@ -262,22 +289,22 @@ This file is generated by `grunt build`, do not edit it by hand.
262
  max-width: 100%;
263
  border-radius: 3px;
264
  background-color: #eeeeee;
265
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
266
- background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
267
- background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
268
- background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
269
- background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
270
  background-size: 100% 19px;
271
  background-repeat: repeat-x;
272
  background-clip: padding-box;
273
- box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
 
274
  color: #333;
275
  line-height: 13px;
276
  cursor: default;
277
  }
 
278
  .chosen-container-multi .chosen-choices li.search-choice span {
279
  word-wrap: break-word;
280
  }
 
281
  .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
282
  position: absolute;
283
  top: 4px;
@@ -285,33 +312,36 @@ This file is generated by `grunt build`, do not edit it by hand.
285
  display: block;
286
  width: 12px;
287
  height: 12px;
288
- background: url('chosen-sprite.png') -42px 1px no-repeat;
289
  font-size: 1px;
290
  }
 
291
  .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
292
  background-position: -42px -10px;
293
  }
 
294
  .chosen-container-multi .chosen-choices li.search-choice-disabled {
295
  padding-right: 5px;
296
  border: 1px solid #ccc;
297
  background-color: #e4e4e4;
298
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
299
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
300
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
301
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
302
- background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
303
  color: #666;
304
  }
 
305
  .chosen-container-multi .chosen-choices li.search-choice-focus {
306
  background: #d4d4d4;
307
  }
 
308
  .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
309
  background-position: -42px -10px;
310
  }
 
311
  .chosen-container-multi .chosen-results {
312
  margin: 0;
313
  padding: 0;
314
  }
 
315
  .chosen-container-multi .chosen-drop .result-selected {
316
  display: list-item;
317
  color: #ccc;
@@ -322,32 +352,35 @@ This file is generated by `grunt build`, do not edit it by hand.
322
  /* @group Active */
323
  .chosen-container-active .chosen-single {
324
  border: 1px solid #5897fb;
325
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
 
326
  }
 
327
  .chosen-container-active.chosen-with-drop .chosen-single {
328
  border: 1px solid #aaa;
329
- -moz-border-radius-bottomright: 0;
330
  border-bottom-right-radius: 0;
331
- -moz-border-radius-bottomleft: 0;
332
  border-bottom-left-radius: 0;
333
- background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
334
- background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
335
- background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
336
- background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
337
- background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
338
- box-shadow: 0 1px 0 #fff inset;
339
  }
 
340
  .chosen-container-active.chosen-with-drop .chosen-single div {
341
  border-left: none;
342
  background: transparent;
343
  }
 
344
  .chosen-container-active.chosen-with-drop .chosen-single div b {
345
  background-position: -18px 2px;
346
  }
 
347
  .chosen-container-active .chosen-choices {
348
  border: 1px solid #5897fb;
349
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
 
350
  }
 
351
  .chosen-container-active .chosen-choices li.search-field input[type="text"] {
352
  color: #222 !important;
353
  }
@@ -358,9 +391,11 @@ This file is generated by `grunt build`, do not edit it by hand.
358
  opacity: 0.5 !important;
359
  cursor: default;
360
  }
 
361
  .chosen-disabled .chosen-single {
362
  cursor: default;
363
  }
 
364
  .chosen-disabled .chosen-choices .search-choice .search-choice-close {
365
  cursor: default;
366
  }
@@ -370,64 +405,74 @@ This file is generated by `grunt build`, do not edit it by hand.
370
  .chosen-rtl {
371
  text-align: right;
372
  }
 
373
  .chosen-rtl .chosen-single {
374
  overflow: visible;
375
  padding: 0 8px 0 0;
376
  }
 
377
  .chosen-rtl .chosen-single span {
378
  margin-right: 0;
379
  margin-left: 26px;
380
  direction: rtl;
381
  }
 
382
  .chosen-rtl .chosen-single-with-deselect span {
383
  margin-left: 38px;
384
  }
 
385
  .chosen-rtl .chosen-single div {
386
  right: auto;
387
  left: 3px;
388
  }
 
389
  .chosen-rtl .chosen-single abbr {
390
  right: auto;
391
  left: 26px;
392
  }
 
393
  .chosen-rtl .chosen-choices li {
394
  float: right;
395
  }
 
396
  .chosen-rtl .chosen-choices li.search-field input[type="text"] {
397
  direction: rtl;
398
  }
 
399
  .chosen-rtl .chosen-choices li.search-choice {
400
  margin: 3px 5px 3px 0;
401
  padding: 3px 5px 3px 19px;
402
  }
 
403
  .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
404
  right: auto;
405
  left: 4px;
406
  }
407
- .chosen-rtl.chosen-container-single-nosearch .chosen-search,
408
- .chosen-rtl .chosen-drop {
409
- left: 9999px;
410
- }
411
  .chosen-rtl.chosen-container-single .chosen-results {
412
  margin: 0 0 4px 4px;
413
  padding: 0 4px 0 0;
414
  }
 
415
  .chosen-rtl .chosen-results li.group-option {
416
  padding-right: 15px;
417
  padding-left: 0;
418
  }
 
419
  .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
420
  border-right: none;
421
  }
 
422
  .chosen-rtl .chosen-search input[type="text"] {
423
  padding: 4px 5px 4px 20px;
424
- background: white url('chosen-sprite.png') no-repeat -30px -20px;
425
- background: url('chosen-sprite.png') no-repeat -30px -20px;
426
  direction: rtl;
427
  }
 
428
  .chosen-rtl.chosen-container-single .chosen-single div b {
429
  background-position: 6px 2px;
430
  }
 
431
  .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
432
  background-position: -12px 2px;
433
  }
@@ -442,9 +487,10 @@ This file is generated by `grunt build`, do not edit it by hand.
442
  .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
443
  .chosen-container .chosen-results-scroll-down span,
444
  .chosen-container .chosen-results-scroll-up span {
445
- background-image: url('chosen-sprite@2x.png') !important;
446
  background-size: 52px 37px !important;
447
  background-repeat: no-repeat !important;
448
  }
449
  }
 
450
  /* @end */
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
+ Version 1.8.3
6
  Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
16
  display: inline-block;
17
  vertical-align: middle;
18
  font-size: 13px;
 
 
19
  -webkit-user-select: none;
20
+ -moz-user-select: none;
21
+ -ms-user-select: none;
22
+ user-select: none;
23
  }
24
+
25
  .chosen-container * {
26
  -webkit-box-sizing: border-box;
27
+ box-sizing: border-box;
 
28
  }
29
+
30
  .chosen-container .chosen-drop {
31
  position: absolute;
32
  top: 100%;
 
33
  z-index: 1010;
34
  width: 100%;
35
  border: 1px solid #aaa;
36
  border-top: 0;
37
  background: #fff;
38
+ -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
39
+ box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
40
+ display: none;
41
  }
42
+
43
  .chosen-container.chosen-with-drop .chosen-drop {
44
+ display: block;
45
  }
46
+
47
  .chosen-container a {
48
  cursor: pointer;
49
  }
50
+
51
  .chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
52
  margin-right: 4px;
53
  overflow: hidden;
56
  font-weight: normal;
57
  color: #999999;
58
  }
59
+
60
  .chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
61
  content: ":";
62
  padding-left: 2px;
74
  border: 1px solid #aaa;
75
  border-radius: 5px;
76
  background-color: #fff;
77
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #fff), color-stop(50%, #f6f6f6), color-stop(52%, #eee), to(#f4f4f4));
78
+ background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
 
 
 
79
  background-clip: padding-box;
80
+ -webkit-box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
81
+ box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
82
  color: #444;
83
  text-decoration: none;
84
  white-space: nowrap;
85
  line-height: 24px;
86
  }
87
+
88
+ .chosen-container-single .chosen-single input[type="text"] {
89
+ cursor: pointer;
90
+ opacity: 0;
91
+ position: absolute;
92
+ }
93
+
94
  .chosen-container-single .chosen-default {
95
  color: #999;
96
  }
97
+
98
  .chosen-container-single .chosen-single span {
99
  display: block;
100
  overflow: hidden;
102
  text-overflow: ellipsis;
103
  white-space: nowrap;
104
  }
105
+
106
  .chosen-container-single .chosen-single-with-deselect span {
107
  margin-right: 38px;
108
  }
109
+
110
  .chosen-container-single .chosen-single abbr {
111
  position: absolute;
112
  top: 6px;
114
  display: block;
115
  width: 12px;
116
  height: 12px;
117
+ background: url("chosen-sprite.png") -42px 1px no-repeat;
118
  font-size: 1px;
119
  }
120
+
121
  .chosen-container-single .chosen-single abbr:hover {
122
  background-position: -42px -10px;
123
  }
124
+
125
  .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
126
  background-position: -42px -10px;
127
  }
128
+
129
  .chosen-container-single .chosen-single div {
130
  position: absolute;
131
  top: 0;
134
  width: 18px;
135
  height: 100%;
136
  }
137
+
138
  .chosen-container-single .chosen-single div b {
139
  display: block;
140
  width: 100%;
141
  height: 100%;
142
+ background: url("chosen-sprite.png") no-repeat 0px 2px;
143
  }
144
+
145
  .chosen-container-single .chosen-search {
146
  position: relative;
147
  z-index: 1010;
149
  padding: 3px 4px;
150
  white-space: nowrap;
151
  }
152
+
153
  .chosen-container-single .chosen-search input[type="text"] {
154
  margin: 1px 0;
155
  padding: 4px 20px 4px 5px;
157
  height: auto;
158
  outline: 0;
159
  border: 1px solid #aaa;
160
+ background: url("chosen-sprite.png") no-repeat 100% -20px;
 
161
  font-size: 1em;
162
  font-family: sans-serif;
163
  line-height: normal;
164
  border-radius: 0;
165
  }
166
+
167
  .chosen-container-single .chosen-drop {
168
  margin-top: -1px;
169
  border-radius: 0 0 4px 4px;
170
  background-clip: padding-box;
171
  }
172
+
173
  .chosen-container-single.chosen-container-single-nosearch .chosen-search {
174
  position: absolute;
175
+ clip: rect(0, 0, 0, 0);
176
  }
177
 
178
  /* @end */
187
  max-height: 240px;
188
  -webkit-overflow-scrolling: touch;
189
  }
190
+
191
  .chosen-container .chosen-results li {
192
  display: none;
193
  margin: 0;
197
  word-wrap: break-word;
198
  -webkit-touch-callout: none;
199
  }
200
+
201
  .chosen-container .chosen-results li.active-result {
202
  display: list-item;
203
  cursor: pointer;
204
  }
205
+
206
  .chosen-container .chosen-results li.disabled-result {
207
  display: list-item;
208
  color: #ccc;
209
  cursor: default;
210
  }
211
+
212
  .chosen-container .chosen-results li.highlighted {
213
  background-color: #3875d7;
214
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
 
 
 
215
  background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
216
  color: #fff;
217
  }
218
+
219
  .chosen-container .chosen-results li.no-results {
220
  color: #777;
221
  display: list-item;
222
  background: #f4f4f4;
223
  }
224
+
225
  .chosen-container .chosen-results li.group-result {
226
  display: list-item;
227
  font-weight: bold;
228
  cursor: default;
229
  }
230
+
231
  .chosen-container .chosen-results li.group-option {
232
  padding-left: 15px;
233
  }
234
+
235
  .chosen-container .chosen-results li em {
236
  font-style: normal;
237
  text-decoration: underline;
245
  margin: 0;
246
  padding: 0 5px;
247
  width: 100%;
248
+ height: auto;
 
249
  border: 1px solid #aaa;
250
  background-color: #fff;
251
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #eee), color-stop(15%, #fff));
252
+ background-image: linear-gradient(#eee 1%, #fff 15%);
 
 
 
253
  cursor: text;
254
  }
255
+
256
  .chosen-container-multi .chosen-choices li {
257
  float: left;
258
  list-style: none;
259
  }
260
+
261
  .chosen-container-multi .chosen-choices li.search-field {
262
  margin: 0;
263
  padding: 0;
264
  white-space: nowrap;
265
  }
266
+
267
  .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
268
  margin: 1px 0;
269
  padding: 0;
271
  outline: 0;
272
  border: 0 !important;
273
  background: transparent !important;
274
+ -webkit-box-shadow: none;
275
+ box-shadow: none;
276
  color: #999;
277
  font-size: 100%;
278
  font-family: sans-serif;
279
  line-height: normal;
280
  border-radius: 0;
281
+ width: 25px;
282
  }
283
+
284
  .chosen-container-multi .chosen-choices li.search-choice {
285
  position: relative;
286
  margin: 3px 5px 3px 0;
289
  max-width: 100%;
290
  border-radius: 3px;
291
  background-color: #eeeeee;
292
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
293
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
 
 
 
294
  background-size: 100% 19px;
295
  background-repeat: repeat-x;
296
  background-clip: padding-box;
297
+ -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
298
+ box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
299
  color: #333;
300
  line-height: 13px;
301
  cursor: default;
302
  }
303
+
304
  .chosen-container-multi .chosen-choices li.search-choice span {
305
  word-wrap: break-word;
306
  }
307
+
308
  .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
309
  position: absolute;
310
  top: 4px;
312
  display: block;
313
  width: 12px;
314
  height: 12px;
315
+ background: url("chosen-sprite.png") -42px 1px no-repeat;
316
  font-size: 1px;
317
  }
318
+
319
  .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
320
  background-position: -42px -10px;
321
  }
322
+
323
  .chosen-container-multi .chosen-choices li.search-choice-disabled {
324
  padding-right: 5px;
325
  border: 1px solid #ccc;
326
  background-color: #e4e4e4;
327
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
328
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
 
 
 
329
  color: #666;
330
  }
331
+
332
  .chosen-container-multi .chosen-choices li.search-choice-focus {
333
  background: #d4d4d4;
334
  }
335
+
336
  .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
337
  background-position: -42px -10px;
338
  }
339
+
340
  .chosen-container-multi .chosen-results {
341
  margin: 0;
342
  padding: 0;
343
  }
344
+
345
  .chosen-container-multi .chosen-drop .result-selected {
346
  display: list-item;
347
  color: #ccc;
352
  /* @group Active */
353
  .chosen-container-active .chosen-single {
354
  border: 1px solid #5897fb;
355
+ -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
356
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
357
  }
358
+
359
  .chosen-container-active.chosen-with-drop .chosen-single {
360
  border: 1px solid #aaa;
 
361
  border-bottom-right-radius: 0;
 
362
  border-bottom-left-radius: 0;
363
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #eee), color-stop(80%, #fff));
364
+ background-image: linear-gradient(#eee 20%, #fff 80%);
365
+ -webkit-box-shadow: 0 1px 0 #fff inset;
366
+ box-shadow: 0 1px 0 #fff inset;
 
 
367
  }
368
+
369
  .chosen-container-active.chosen-with-drop .chosen-single div {
370
  border-left: none;
371
  background: transparent;
372
  }
373
+
374
  .chosen-container-active.chosen-with-drop .chosen-single div b {
375
  background-position: -18px 2px;
376
  }
377
+
378
  .chosen-container-active .chosen-choices {
379
  border: 1px solid #5897fb;
380
+ -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
381
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
382
  }
383
+
384
  .chosen-container-active .chosen-choices li.search-field input[type="text"] {
385
  color: #222 !important;
386
  }
391
  opacity: 0.5 !important;
392
  cursor: default;
393
  }
394
+
395
  .chosen-disabled .chosen-single {
396
  cursor: default;
397
  }
398
+
399
  .chosen-disabled .chosen-choices .search-choice .search-choice-close {
400
  cursor: default;
401
  }
405
  .chosen-rtl {
406
  text-align: right;
407
  }
408
+
409
  .chosen-rtl .chosen-single {
410
  overflow: visible;
411
  padding: 0 8px 0 0;
412
  }
413
+
414
  .chosen-rtl .chosen-single span {
415
  margin-right: 0;
416
  margin-left: 26px;
417
  direction: rtl;
418
  }
419
+
420
  .chosen-rtl .chosen-single-with-deselect span {
421
  margin-left: 38px;
422
  }
423
+
424
  .chosen-rtl .chosen-single div {
425
  right: auto;
426
  left: 3px;
427
  }
428
+
429
  .chosen-rtl .chosen-single abbr {
430
  right: auto;
431
  left: 26px;
432
  }
433
+
434
  .chosen-rtl .chosen-choices li {
435
  float: right;
436
  }
437
+
438
  .chosen-rtl .chosen-choices li.search-field input[type="text"] {
439
  direction: rtl;
440
  }
441
+
442
  .chosen-rtl .chosen-choices li.search-choice {
443
  margin: 3px 5px 3px 0;
444
  padding: 3px 5px 3px 19px;
445
  }
446
+
447
  .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
448
  right: auto;
449
  left: 4px;
450
  }
451
+
 
 
 
452
  .chosen-rtl.chosen-container-single .chosen-results {
453
  margin: 0 0 4px 4px;
454
  padding: 0 4px 0 0;
455
  }
456
+
457
  .chosen-rtl .chosen-results li.group-option {
458
  padding-right: 15px;
459
  padding-left: 0;
460
  }
461
+
462
  .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
463
  border-right: none;
464
  }
465
+
466
  .chosen-rtl .chosen-search input[type="text"] {
467
  padding: 4px 5px 4px 20px;
468
+ background: url("chosen-sprite.png") no-repeat -30px -20px;
 
469
  direction: rtl;
470
  }
471
+
472
  .chosen-rtl.chosen-container-single .chosen-single div b {
473
  background-position: 6px 2px;
474
  }
475
+
476
  .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
477
  background-position: -12px 2px;
478
  }
487
  .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
488
  .chosen-container .chosen-results-scroll-down span,
489
  .chosen-container .chosen-results-scroll-up span {
490
+ background-image: url("chosen-sprite@2x.png") !important;
491
  background-size: 52px 37px !important;
492
  background-repeat: no-repeat !important;
493
  }
494
  }
495
+
496
  /* @end */
assets/lib/{chosen_v1.4.2 → chosen}/chosen.jquery.js RENAMED
@@ -2,18 +2,19 @@
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
- Version 1.4.2
6
  Full source at https://github.com/harvesthq/chosen
7
- Copyright (c) 2011-2015 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
11
  */
12
 
13
  (function() {
14
- var $, AbstractChosen, Chosen, SelectParser, _ref,
15
- __hasProp = {}.hasOwnProperty,
16
- __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; };
 
17
 
18
  SelectParser = (function() {
19
  function SelectParser() {
@@ -30,24 +31,24 @@ This file is generated by `grunt build`, do not edit it by hand.
30
  };
31
 
32
  SelectParser.prototype.add_group = function(group) {
33
- var group_position, option, _i, _len, _ref, _results;
34
  group_position = this.parsed.length;
35
  this.parsed.push({
36
  array_index: group_position,
37
  group: true,
38
- label: this.escapeExpression(group.label),
39
  title: group.title ? group.title : void 0,
40
  children: 0,
41
  disabled: group.disabled,
42
  classes: group.className
43
  });
44
- _ref = group.childNodes;
45
- _results = [];
46
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
47
- option = _ref[_i];
48
- _results.push(this.add_option(option, group_position, group.disabled));
49
  }
50
- return _results;
51
  };
52
 
53
  SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
@@ -81,46 +82,26 @@ This file is generated by `grunt build`, do not edit it by hand.
81
  }
82
  };
83
 
84
- SelectParser.prototype.escapeExpression = function(text) {
85
- var map, unsafe_chars;
86
- if ((text == null) || text === false) {
87
- return "";
88
- }
89
- if (!/[\&\<\>\"\'\`]/.test(text)) {
90
- return text;
91
- }
92
- map = {
93
- "<": "&lt;",
94
- ">": "&gt;",
95
- '"': "&quot;",
96
- "'": "&#x27;",
97
- "`": "&#x60;"
98
- };
99
- unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
100
- return text.replace(unsafe_chars, function(chr) {
101
- return map[chr] || "&amp;";
102
- });
103
- };
104
-
105
  return SelectParser;
106
 
107
  })();
108
 
109
  SelectParser.select_to_array = function(select) {
110
- var child, parser, _i, _len, _ref;
111
  parser = new SelectParser();
112
- _ref = select.childNodes;
113
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
114
- child = _ref[_i];
115
  parser.add_node(child);
116
  }
117
  return parser.parsed;
118
  };
119
 
120
  AbstractChosen = (function() {
121
- function AbstractChosen(form_field, options) {
122
  this.form_field = form_field;
123
- this.options = options != null ? options : {};
 
124
  if (!AbstractChosen.browser_is_supported()) {
125
  return;
126
  }
@@ -134,17 +115,21 @@ This file is generated by `grunt build`, do not edit it by hand.
134
  }
135
 
136
  AbstractChosen.prototype.set_default_values = function() {
137
- var _this = this;
138
- this.click_test_action = function(evt) {
139
- return _this.test_active_click(evt);
140
- };
141
- this.activate_action = function(evt) {
142
- return _this.activate_field(evt);
143
- };
 
 
 
144
  this.active_field = false;
145
  this.mouse_on_container = false;
146
  this.results_showing = false;
147
  this.result_highlighted = null;
 
148
  this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
149
  this.disable_search_threshold = this.options.disable_search_threshold || 0;
150
  this.disable_search = this.options.disable_search || false;
@@ -156,7 +141,10 @@ This file is generated by `grunt build`, do not edit it by hand.
156
  this.inherit_select_classes = this.options.inherit_select_classes || false;
157
  this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
158
  this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
159
- return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
 
 
 
160
  };
161
 
162
  AbstractChosen.prototype.set_default_text = function() {
@@ -167,6 +155,7 @@ This file is generated by `grunt build`, do not edit it by hand.
167
  } else {
168
  this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
169
  }
 
170
  return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
171
  };
172
 
@@ -187,12 +176,13 @@ This file is generated by `grunt build`, do not edit it by hand.
187
  };
188
 
189
  AbstractChosen.prototype.input_focus = function(evt) {
190
- var _this = this;
191
  if (this.is_multiple) {
192
  if (!this.active_field) {
193
- return setTimeout((function() {
194
- return _this.container_mousedown();
195
- }), 50);
 
 
196
  }
197
  } else {
198
  if (!this.active_field) {
@@ -202,25 +192,40 @@ This file is generated by `grunt build`, do not edit it by hand.
202
  };
203
 
204
  AbstractChosen.prototype.input_blur = function(evt) {
205
- var _this = this;
206
  if (!this.mouse_on_container) {
207
  this.active_field = false;
208
- return setTimeout((function() {
209
- return _this.blur_test();
210
- }), 100);
 
 
 
 
 
 
 
 
 
 
211
  }
212
  };
213
 
214
  AbstractChosen.prototype.results_option_build = function(options) {
215
- var content, data, _i, _len, _ref;
216
  content = '';
217
- _ref = this.results_data;
218
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
219
- data = _ref[_i];
 
 
220
  if (data.group) {
221
- content += this.result_add_group(data);
222
  } else {
223
- content += this.result_add_option(data);
 
 
 
 
224
  }
225
  if (options != null ? options.first : void 0) {
226
  if (data.selected && this.is_multiple) {
@@ -229,6 +234,9 @@ This file is generated by `grunt build`, do not edit it by hand.
229
  this.single_set_selected_text(this.choice_label(data));
230
  }
231
  }
 
 
 
232
  }
233
  return content;
234
  };
@@ -261,7 +269,7 @@ This file is generated by `grunt build`, do not edit it by hand.
261
  option_el.className = classes.join(" ");
262
  option_el.style.cssText = option.style;
263
  option_el.setAttribute("data-option-array-index", option.array_index);
264
- option_el.innerHTML = option.search_text;
265
  if (option.title) {
266
  option_el.title = option.title;
267
  }
@@ -283,7 +291,7 @@ This file is generated by `grunt build`, do not edit it by hand.
283
  }
284
  group_el = document.createElement("li");
285
  group_el.className = classes.join(" ");
286
- group_el.innerHTML = group.search_text;
287
  if (group.title) {
288
  group_el.title = group.title;
289
  }
@@ -303,18 +311,18 @@ This file is generated by `grunt build`, do not edit it by hand.
303
  };
304
 
305
  AbstractChosen.prototype.reset_single_select_options = function() {
306
- var result, _i, _len, _ref, _results;
307
- _ref = this.results_data;
308
- _results = [];
309
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
310
- result = _ref[_i];
311
  if (result.selected) {
312
- _results.push(result.selected = false);
313
  } else {
314
- _results.push(void 0);
315
  }
316
  }
317
- return _results;
318
  };
319
 
320
  AbstractChosen.prototype.results_toggle = function() {
@@ -334,18 +342,19 @@ This file is generated by `grunt build`, do not edit it by hand.
334
  };
335
 
336
  AbstractChosen.prototype.winnow_results = function() {
337
- var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
338
  this.no_results_clear();
339
  results = 0;
340
- searchText = this.get_search_text();
341
- escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
342
- zregex = new RegExp(escapedSearchText, 'i');
343
- regex = this.get_search_regex(escapedSearchText);
344
- _ref = this.results_data;
345
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
346
- option = _ref[_i];
347
  option.search_match = false;
348
  results_group = null;
 
 
349
  if (this.include_option_in_results(option)) {
350
  if (option.group) {
351
  option.group_match = false;
@@ -358,17 +367,20 @@ This file is generated by `grunt build`, do not edit it by hand.
358
  }
359
  results_group.active_options += 1;
360
  }
361
- option.search_text = option.group ? option.label : option.html;
362
  if (!(option.group && !this.group_search)) {
363
- option.search_match = this.search_string_match(option.search_text, regex);
 
364
  if (option.search_match && !option.group) {
365
  results += 1;
366
  }
367
  if (option.search_match) {
368
- if (searchText.length) {
369
- startpos = option.search_text.search(zregex);
370
- text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
371
- option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
 
 
372
  }
373
  if (results_group != null) {
374
  results_group.group_match = true;
@@ -380,9 +392,9 @@ This file is generated by `grunt build`, do not edit it by hand.
380
  }
381
  }
382
  this.result_clear_highlight();
383
- if (results < 1 && searchText.length) {
384
  this.update_results_content("");
385
- return this.no_results(searchText);
386
  } else {
387
  this.update_results_content(this.results_option_build());
388
  return this.winnow_results_set_highlight();
@@ -390,37 +402,33 @@ This file is generated by `grunt build`, do not edit it by hand.
390
  };
391
 
392
  AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
393
- var regex_anchor;
394
- regex_anchor = this.search_contains ? "" : "^";
395
- return new RegExp(regex_anchor + escaped_search_string, 'i');
 
 
 
 
396
  };
397
 
398
  AbstractChosen.prototype.search_string_match = function(search_string, regex) {
399
- var part, parts, _i, _len;
400
- if (regex.test(search_string)) {
401
- return true;
402
- } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
403
- parts = search_string.replace(/\[|\]/g, "").split(" ");
404
- if (parts.length) {
405
- for (_i = 0, _len = parts.length; _i < _len; _i++) {
406
- part = parts[_i];
407
- if (regex.test(part)) {
408
- return true;
409
- }
410
- }
411
- }
412
  }
 
413
  };
414
 
415
  AbstractChosen.prototype.choices_count = function() {
416
- var option, _i, _len, _ref;
417
  if (this.selected_option_count != null) {
418
  return this.selected_option_count;
419
  }
420
  this.selected_option_count = 0;
421
- _ref = this.form_field.options;
422
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
423
- option = _ref[_i];
424
  if (option.selected) {
425
  this.selected_option_count += 1;
426
  }
@@ -430,59 +438,109 @@ This file is generated by `grunt build`, do not edit it by hand.
430
 
431
  AbstractChosen.prototype.choices_click = function(evt) {
432
  evt.preventDefault();
 
433
  if (!(this.results_showing || this.is_disabled)) {
434
  return this.results_show();
435
  }
436
  };
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  AbstractChosen.prototype.keyup_checker = function(evt) {
439
- var stroke, _ref;
440
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
441
  this.search_field_scale();
442
  switch (stroke) {
443
  case 8:
444
  if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
445
- return this.keydown_backstroke();
446
  } else if (!this.pending_backstroke) {
447
  this.result_clear_highlight();
448
- return this.results_search();
449
  }
450
  break;
451
  case 13:
452
  evt.preventDefault();
453
  if (this.results_showing) {
454
- return this.result_select(evt);
455
  }
456
  break;
457
  case 27:
458
  if (this.results_showing) {
459
  this.results_hide();
460
  }
461
- return true;
462
  case 9:
 
 
 
463
  case 38:
464
  case 40:
465
- case 16:
466
  case 91:
467
- case 17:
468
  break;
469
  default:
470
- return this.results_search();
 
471
  }
472
  };
473
 
474
  AbstractChosen.prototype.clipboard_event_checker = function(evt) {
475
- var _this = this;
476
- return setTimeout((function() {
477
- return _this.results_search();
478
- }), 50);
 
 
 
 
479
  };
480
 
481
  AbstractChosen.prototype.container_width = function() {
482
  if (this.options.width != null) {
483
  return this.options.width;
484
  } else {
485
- return "" + this.form_field.offsetWidth + "px";
486
  }
487
  };
488
 
@@ -525,18 +583,25 @@ This file is generated by `grunt build`, do not edit it by hand.
525
  return tmp.innerHTML;
526
  };
527
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  AbstractChosen.browser_is_supported = function() {
529
- if (window.navigator.appName === "Microsoft Internet Explorer") {
530
  return document.documentMode >= 8;
531
  }
532
- if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
533
  return false;
534
  }
535
- if (/Android/i.test(window.navigator.userAgent)) {
536
- if (/Mobile/i.test(window.navigator.userAgent)) {
537
- return false;
538
- }
539
- }
540
  return true;
541
  };
542
 
@@ -561,27 +626,29 @@ This file is generated by `grunt build`, do not edit it by hand.
561
  var $this, chosen;
562
  $this = $(this);
563
  chosen = $this.data('chosen');
564
- if (options === 'destroy' && chosen instanceof Chosen) {
565
- chosen.destroy();
566
- } else if (!(chosen instanceof Chosen)) {
 
 
 
 
567
  $this.data('chosen', new Chosen(this, options));
568
  }
569
  });
570
  }
571
  });
572
 
573
- Chosen = (function(_super) {
574
- __extends(Chosen, _super);
575
 
576
  function Chosen() {
577
- _ref = Chosen.__super__.constructor.apply(this, arguments);
578
- return _ref;
579
  }
580
 
581
  Chosen.prototype.setup = function() {
582
  this.form_field_jq = $(this.form_field);
583
- this.current_selectedIndex = this.form_field.selectedIndex;
584
- return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
585
  };
586
 
587
  Chosen.prototype.set_up_html = function() {
@@ -596,17 +663,17 @@ This file is generated by `grunt build`, do not edit it by hand.
596
  }
597
  container_props = {
598
  'class': container_classes.join(' '),
599
- 'style': "width: " + (this.container_width()) + ";",
600
  'title': this.form_field.title
601
  };
602
  if (this.form_field.id.length) {
603
  container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
604
  }
605
  this.container = $("<div />", container_props);
 
606
  if (this.is_multiple) {
607
- this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
608
  } else {
609
- this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
610
  }
611
  this.form_field_jq.hide().after(this.container);
612
  this.dropdown = this.container.find('div.chosen-drop').first();
@@ -633,91 +700,139 @@ This file is generated by `grunt build`, do not edit it by hand.
633
  };
634
 
635
  Chosen.prototype.register_observers = function() {
636
- var _this = this;
637
- this.container.bind('touchstart.chosen', function(evt) {
638
- _this.container_mousedown(evt);
639
- return evt.preventDefault();
640
- });
641
- this.container.bind('touchend.chosen', function(evt) {
642
- _this.container_mouseup(evt);
643
- return evt.preventDefault();
644
- });
645
- this.container.bind('mousedown.chosen', function(evt) {
646
- _this.container_mousedown(evt);
647
- });
648
- this.container.bind('mouseup.chosen', function(evt) {
649
- _this.container_mouseup(evt);
650
- });
651
- this.container.bind('mouseenter.chosen', function(evt) {
652
- _this.mouse_enter(evt);
653
- });
654
- this.container.bind('mouseleave.chosen', function(evt) {
655
- _this.mouse_leave(evt);
656
- });
657
- this.search_results.bind('mouseup.chosen', function(evt) {
658
- _this.search_results_mouseup(evt);
659
- });
660
- this.search_results.bind('mouseover.chosen', function(evt) {
661
- _this.search_results_mouseover(evt);
662
- });
663
- this.search_results.bind('mouseout.chosen', function(evt) {
664
- _this.search_results_mouseout(evt);
665
- });
666
- this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
667
- _this.search_results_mousewheel(evt);
668
- });
669
- this.search_results.bind('touchstart.chosen', function(evt) {
670
- _this.search_results_touchstart(evt);
671
- });
672
- this.search_results.bind('touchmove.chosen', function(evt) {
673
- _this.search_results_touchmove(evt);
674
- });
675
- this.search_results.bind('touchend.chosen', function(evt) {
676
- _this.search_results_touchend(evt);
677
- });
678
- this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
679
- _this.results_update_field(evt);
680
- });
681
- this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
682
- _this.activate_field(evt);
683
- });
684
- this.form_field_jq.bind("chosen:open.chosen", function(evt) {
685
- _this.container_mousedown(evt);
686
- });
687
- this.form_field_jq.bind("chosen:close.chosen", function(evt) {
688
- _this.input_blur(evt);
689
- });
690
- this.search_field.bind('blur.chosen', function(evt) {
691
- _this.input_blur(evt);
692
- });
693
- this.search_field.bind('keyup.chosen', function(evt) {
694
- _this.keyup_checker(evt);
695
- });
696
- this.search_field.bind('keydown.chosen', function(evt) {
697
- _this.keydown_checker(evt);
698
- });
699
- this.search_field.bind('focus.chosen', function(evt) {
700
- _this.input_focus(evt);
701
- });
702
- this.search_field.bind('cut.chosen', function(evt) {
703
- _this.clipboard_event_checker(evt);
704
- });
705
- this.search_field.bind('paste.chosen', function(evt) {
706
- _this.clipboard_event_checker(evt);
707
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  if (this.is_multiple) {
709
- return this.search_choices.bind('click.chosen', function(evt) {
710
- _this.choices_click(evt);
711
- });
 
 
712
  } else {
713
- return this.container.bind('click.chosen', function(evt) {
714
  evt.preventDefault();
715
  });
716
  }
717
  };
718
 
719
  Chosen.prototype.destroy = function() {
720
- $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
 
 
 
721
  if (this.search_field[0].tabIndex) {
722
  this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
723
  }
@@ -727,41 +842,39 @@ This file is generated by `grunt build`, do not edit it by hand.
727
  };
728
 
729
  Chosen.prototype.search_field_disabled = function() {
730
- this.is_disabled = this.form_field_jq[0].disabled;
 
 
 
 
 
731
  if (this.is_disabled) {
732
- this.container.addClass('chosen-disabled');
733
- this.search_field[0].disabled = true;
734
- if (!this.is_multiple) {
735
- this.selected_item.unbind("focus.chosen", this.activate_action);
736
- }
737
  return this.close_field();
738
- } else {
739
- this.container.removeClass('chosen-disabled');
740
- this.search_field[0].disabled = false;
741
- if (!this.is_multiple) {
742
- return this.selected_item.bind("focus.chosen", this.activate_action);
743
- }
744
  }
745
  };
746
 
747
  Chosen.prototype.container_mousedown = function(evt) {
748
- if (!this.is_disabled) {
749
- if (evt && evt.type === "mousedown" && !this.results_showing) {
750
- evt.preventDefault();
751
- }
752
- if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
753
- if (!this.active_field) {
754
- if (this.is_multiple) {
755
- this.search_field.val("");
756
- }
757
- $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
758
- this.results_show();
759
- } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
760
- evt.preventDefault();
761
- this.results_toggle();
762
  }
763
- return this.activate_field();
 
 
 
 
764
  }
 
765
  }
766
  };
767
 
@@ -792,16 +905,20 @@ This file is generated by `grunt build`, do not edit it by hand.
792
  };
793
 
794
  Chosen.prototype.close_field = function() {
795
- $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
796
  this.active_field = false;
797
  this.results_hide();
798
  this.container.removeClass("chosen-container-active");
799
  this.clear_backstroke();
800
  this.show_search_field_default();
801
- return this.search_field_scale();
 
802
  };
803
 
804
  Chosen.prototype.activate_field = function() {
 
 
 
805
  this.container.addClass("chosen-container-active");
806
  this.active_field = true;
807
  this.search_field.val(this.search_field.val());
@@ -876,10 +993,13 @@ This file is generated by `grunt build`, do not edit it by hand.
876
  });
877
  return false;
878
  }
 
 
 
879
  this.container.addClass("chosen-with-drop");
880
  this.results_showing = true;
881
  this.search_field.focus();
882
- this.search_field.val(this.search_field.val());
883
  this.winnow_results();
884
  return this.form_field_jq.trigger("chosen:showing_dropdown", {
885
  chosen: this
@@ -893,6 +1013,10 @@ This file is generated by `grunt build`, do not edit it by hand.
893
  Chosen.prototype.results_hide = function() {
894
  if (this.results_showing) {
895
  this.result_clear_highlight();
 
 
 
 
896
  this.container.removeClass("chosen-with-drop");
897
  this.form_field_jq.trigger("chosen:hiding_dropdown", {
898
  chosen: this
@@ -911,19 +1035,12 @@ This file is generated by `grunt build`, do not edit it by hand.
911
  };
912
 
913
  Chosen.prototype.set_label_behavior = function() {
914
- var _this = this;
915
  this.form_field_label = this.form_field_jq.parents("label");
916
  if (!this.form_field_label.length && this.form_field.id.length) {
917
  this.form_field_label = $("label[for='" + this.form_field.id + "']");
918
  }
919
  if (this.form_field_label.length > 0) {
920
- return this.form_field_label.bind('click.chosen', function(evt) {
921
- if (_this.is_multiple) {
922
- return _this.container_mousedown(evt);
923
- } else {
924
- return _this.activate_field();
925
- }
926
- });
927
  }
928
  };
929
 
@@ -956,14 +1073,13 @@ This file is generated by `grunt build`, do not edit it by hand.
956
  };
957
 
958
  Chosen.prototype.search_results_mouseout = function(evt) {
959
- if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
960
  return this.result_clear_highlight();
961
  }
962
  };
963
 
964
  Chosen.prototype.choice_build = function(item) {
965
- var choice, close_link,
966
- _this = this;
967
  choice = $('<li />', {
968
  "class": "search-choice"
969
  }).html("<span>" + (this.choice_label(item)) + "</span>");
@@ -974,9 +1090,11 @@ This file is generated by `grunt build`, do not edit it by hand.
974
  "class": 'search-choice-close',
975
  'data-option-array-index': item.array_index
976
  });
977
- close_link.bind('click.chosen', function(evt) {
978
- return _this.choice_destroy_link_click(evt);
979
- });
 
 
980
  choice.append(close_link);
981
  }
982
  return this.search_container.before(choice);
@@ -992,8 +1110,12 @@ This file is generated by `grunt build`, do not edit it by hand.
992
 
993
  Chosen.prototype.choice_destroy = function(link) {
994
  if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
995
- this.show_search_field_default();
996
- if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
 
 
 
 
997
  this.results_hide();
998
  }
999
  link.parents('li').first().remove();
@@ -1007,7 +1129,7 @@ This file is generated by `grunt build`, do not edit it by hand.
1007
  this.single_set_selected_text();
1008
  this.show_search_field_default();
1009
  this.results_reset_cleanup();
1010
- this.form_field_jq.trigger("change");
1011
  if (this.active_field) {
1012
  return this.results_hide();
1013
  }
@@ -1039,18 +1161,21 @@ This file is generated by `grunt build`, do not edit it by hand.
1039
  item.selected = true;
1040
  this.form_field.options[item.options_index].selected = true;
1041
  this.selected_option_count = null;
 
1042
  if (this.is_multiple) {
1043
  this.choice_build(item);
1044
  } else {
1045
  this.single_set_selected_text(this.choice_label(item));
1046
  }
1047
- if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
 
 
1048
  this.results_hide();
 
1049
  }
1050
- this.search_field.val("");
1051
  if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1052
- this.form_field_jq.trigger("change", {
1053
- 'selected': this.form_field.options[item.options_index].value
1054
  });
1055
  }
1056
  this.current_selectedIndex = this.form_field.selectedIndex;
@@ -1083,7 +1208,7 @@ This file is generated by `grunt build`, do not edit it by hand.
1083
  if (this.results_showing) {
1084
  this.winnow_results();
1085
  }
1086
- this.form_field_jq.trigger("change", {
1087
  deselected: this.form_field.options[result_data.options_index].value
1088
  });
1089
  this.search_field_scale();
@@ -1103,8 +1228,16 @@ This file is generated by `grunt build`, do not edit it by hand.
1103
  return this.selected_item.addClass("chosen-single-with-deselect");
1104
  };
1105
 
 
 
 
 
1106
  Chosen.prototype.get_search_text = function() {
1107
- return $('<div/>').text($.trim(this.search_field.val())).html();
 
 
 
 
1108
  };
1109
 
1110
  Chosen.prototype.winnow_results_set_highlight = function() {
@@ -1118,8 +1251,7 @@ This file is generated by `grunt build`, do not edit it by hand.
1118
 
1119
  Chosen.prototype.no_results = function(terms) {
1120
  var no_results_html;
1121
- no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
1122
- no_results_html.find("span").first().html(terms);
1123
  this.search_results.append(no_results_html);
1124
  return this.form_field_jq.trigger("chosen:no_results", {
1125
  chosen: this
@@ -1184,70 +1316,37 @@ This file is generated by `grunt build`, do not edit it by hand.
1184
  return this.pending_backstroke = null;
1185
  };
1186
 
1187
- Chosen.prototype.keydown_checker = function(evt) {
1188
- var stroke, _ref1;
1189
- stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1190
- this.search_field_scale();
1191
- if (stroke !== 8 && this.pending_backstroke) {
1192
- this.clear_backstroke();
1193
  }
1194
- switch (stroke) {
1195
- case 8:
1196
- this.backstroke_length = this.search_field.val().length;
1197
- break;
1198
- case 9:
1199
- if (this.results_showing && !this.is_multiple) {
1200
- this.result_select(evt);
1201
- }
1202
- this.mouse_on_container = false;
1203
- break;
1204
- case 13:
1205
- if (this.results_showing) {
1206
- evt.preventDefault();
1207
- }
1208
- break;
1209
- case 32:
1210
- if (this.disable_search) {
1211
- evt.preventDefault();
1212
- }
1213
- break;
1214
- case 38:
1215
- evt.preventDefault();
1216
- this.keyup_arrow();
1217
- break;
1218
- case 40:
1219
- evt.preventDefault();
1220
- this.keydown_arrow();
1221
- break;
1222
  }
 
1223
  };
1224
 
1225
- Chosen.prototype.search_field_scale = function() {
1226
- var div, f_width, h, style, style_block, styles, w, _i, _len;
1227
- if (this.is_multiple) {
1228
- h = 0;
1229
- w = 0;
1230
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1231
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1232
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
1233
- style = styles[_i];
1234
- style_block += style + ":" + this.search_field.css(style) + ";";
1235
- }
1236
- div = $('<div />', {
1237
- 'style': style_block
1238
- });
1239
- div.text(this.search_field.val());
1240
- $('body').append(div);
1241
- w = div.width() + 25;
1242
- div.remove();
1243
- f_width = this.container.outerWidth();
1244
- if (w > f_width - 10) {
1245
- w = f_width - 10;
1246
- }
1247
- return this.search_field.css({
1248
- 'width': w + 'px'
1249
- });
1250
- }
1251
  };
1252
 
1253
  return Chosen;
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
+ Version 1.8.3
6
  Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
11
  */
12
 
13
  (function() {
14
+ var $, AbstractChosen, Chosen, SelectParser,
15
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
16
+ extend = 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; },
17
+ hasProp = {}.hasOwnProperty;
18
 
19
  SelectParser = (function() {
20
  function SelectParser() {
31
  };
32
 
33
  SelectParser.prototype.add_group = function(group) {
34
+ var group_position, i, len, option, ref, results1;
35
  group_position = this.parsed.length;
36
  this.parsed.push({
37
  array_index: group_position,
38
  group: true,
39
+ label: group.label,
40
  title: group.title ? group.title : void 0,
41
  children: 0,
42
  disabled: group.disabled,
43
  classes: group.className
44
  });
45
+ ref = group.childNodes;
46
+ results1 = [];
47
+ for (i = 0, len = ref.length; i < len; i++) {
48
+ option = ref[i];
49
+ results1.push(this.add_option(option, group_position, group.disabled));
50
  }
51
+ return results1;
52
  };
53
 
54
  SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
82
  }
83
  };
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  return SelectParser;
86
 
87
  })();
88
 
89
  SelectParser.select_to_array = function(select) {
90
+ var child, i, len, parser, ref;
91
  parser = new SelectParser();
92
+ ref = select.childNodes;
93
+ for (i = 0, len = ref.length; i < len; i++) {
94
+ child = ref[i];
95
  parser.add_node(child);
96
  }
97
  return parser.parsed;
98
  };
99
 
100
  AbstractChosen = (function() {
101
+ function AbstractChosen(form_field, options1) {
102
  this.form_field = form_field;
103
+ this.options = options1 != null ? options1 : {};
104
+ this.label_click_handler = bind(this.label_click_handler, this);
105
  if (!AbstractChosen.browser_is_supported()) {
106
  return;
107
  }
115
  }
116
 
117
  AbstractChosen.prototype.set_default_values = function() {
118
+ this.click_test_action = (function(_this) {
119
+ return function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ })(this);
123
+ this.activate_action = (function(_this) {
124
+ return function(evt) {
125
+ return _this.activate_field(evt);
126
+ };
127
+ })(this);
128
  this.active_field = false;
129
  this.mouse_on_container = false;
130
  this.results_showing = false;
131
  this.result_highlighted = null;
132
+ this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
133
  this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
134
  this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
  this.disable_search = this.options.disable_search || false;
141
  this.inherit_select_classes = this.options.inherit_select_classes || false;
142
  this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
143
  this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
144
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
145
+ this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
146
+ this.case_sensitive_search = this.options.case_sensitive_search || false;
147
+ return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
148
  };
149
 
150
  AbstractChosen.prototype.set_default_text = function() {
155
  } else {
156
  this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
157
  }
158
+ this.default_text = this.escape_html(this.default_text);
159
  return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
160
  };
161
 
176
  };
177
 
178
  AbstractChosen.prototype.input_focus = function(evt) {
 
179
  if (this.is_multiple) {
180
  if (!this.active_field) {
181
+ return setTimeout(((function(_this) {
182
+ return function() {
183
+ return _this.container_mousedown();
184
+ };
185
+ })(this)), 50);
186
  }
187
  } else {
188
  if (!this.active_field) {
192
  };
193
 
194
  AbstractChosen.prototype.input_blur = function(evt) {
 
195
  if (!this.mouse_on_container) {
196
  this.active_field = false;
197
+ return setTimeout(((function(_this) {
198
+ return function() {
199
+ return _this.blur_test();
200
+ };
201
+ })(this)), 100);
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.label_click_handler = function(evt) {
206
+ if (this.is_multiple) {
207
+ return this.container_mousedown(evt);
208
+ } else {
209
+ return this.activate_field();
210
  }
211
  };
212
 
213
  AbstractChosen.prototype.results_option_build = function(options) {
214
+ var content, data, data_content, i, len, ref, shown_results;
215
  content = '';
216
+ shown_results = 0;
217
+ ref = this.results_data;
218
+ for (i = 0, len = ref.length; i < len; i++) {
219
+ data = ref[i];
220
+ data_content = '';
221
  if (data.group) {
222
+ data_content = this.result_add_group(data);
223
  } else {
224
+ data_content = this.result_add_option(data);
225
+ }
226
+ if (data_content !== '') {
227
+ shown_results++;
228
+ content += data_content;
229
  }
230
  if (options != null ? options.first : void 0) {
231
  if (data.selected && this.is_multiple) {
234
  this.single_set_selected_text(this.choice_label(data));
235
  }
236
  }
237
+ if (shown_results >= this.max_shown_results) {
238
+ break;
239
+ }
240
  }
241
  return content;
242
  };
269
  option_el.className = classes.join(" ");
270
  option_el.style.cssText = option.style;
271
  option_el.setAttribute("data-option-array-index", option.array_index);
272
+ option_el.innerHTML = option.highlighted_html || option.html;
273
  if (option.title) {
274
  option_el.title = option.title;
275
  }
291
  }
292
  group_el = document.createElement("li");
293
  group_el.className = classes.join(" ");
294
+ group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
295
  if (group.title) {
296
  group_el.title = group.title;
297
  }
311
  };
312
 
313
  AbstractChosen.prototype.reset_single_select_options = function() {
314
+ var i, len, ref, result, results1;
315
+ ref = this.results_data;
316
+ results1 = [];
317
+ for (i = 0, len = ref.length; i < len; i++) {
318
+ result = ref[i];
319
  if (result.selected) {
320
+ results1.push(result.selected = false);
321
  } else {
322
+ results1.push(void 0);
323
  }
324
  }
325
+ return results1;
326
  };
327
 
328
  AbstractChosen.prototype.results_toggle = function() {
342
  };
343
 
344
  AbstractChosen.prototype.winnow_results = function() {
345
+ var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
346
  this.no_results_clear();
347
  results = 0;
348
+ query = this.get_search_text();
349
+ escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
350
+ regex = this.get_search_regex(escapedQuery);
351
+ ref = this.results_data;
352
+ for (i = 0, len = ref.length; i < len; i++) {
353
+ option = ref[i];
 
354
  option.search_match = false;
355
  results_group = null;
356
+ search_match = null;
357
+ option.highlighted_html = '';
358
  if (this.include_option_in_results(option)) {
359
  if (option.group) {
360
  option.group_match = false;
367
  }
368
  results_group.active_options += 1;
369
  }
370
+ text = option.group ? option.label : option.text;
371
  if (!(option.group && !this.group_search)) {
372
+ search_match = this.search_string_match(text, regex);
373
+ option.search_match = search_match != null;
374
  if (option.search_match && !option.group) {
375
  results += 1;
376
  }
377
  if (option.search_match) {
378
+ if (query.length) {
379
+ startpos = search_match.index;
380
+ prefix = text.slice(0, startpos);
381
+ fix = text.slice(startpos, startpos + query.length);
382
+ suffix = text.slice(startpos + query.length);
383
+ option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
384
  }
385
  if (results_group != null) {
386
  results_group.group_match = true;
392
  }
393
  }
394
  this.result_clear_highlight();
395
+ if (results < 1 && query.length) {
396
  this.update_results_content("");
397
+ return this.no_results(query);
398
  } else {
399
  this.update_results_content(this.results_option_build());
400
  return this.winnow_results_set_highlight();
402
  };
403
 
404
  AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
405
+ var regex_flag, regex_string;
406
+ regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
407
+ if (!(this.enable_split_word_search || this.search_contains)) {
408
+ regex_string = "^" + regex_string;
409
+ }
410
+ regex_flag = this.case_sensitive_search ? "" : "i";
411
+ return new RegExp(regex_string, regex_flag);
412
  };
413
 
414
  AbstractChosen.prototype.search_string_match = function(search_string, regex) {
415
+ var match;
416
+ match = regex.exec(search_string);
417
+ if (!this.search_contains && (match != null ? match[1] : void 0)) {
418
+ match.index += 1;
 
 
 
 
 
 
 
 
 
419
  }
420
+ return match;
421
  };
422
 
423
  AbstractChosen.prototype.choices_count = function() {
424
+ var i, len, option, ref;
425
  if (this.selected_option_count != null) {
426
  return this.selected_option_count;
427
  }
428
  this.selected_option_count = 0;
429
+ ref = this.form_field.options;
430
+ for (i = 0, len = ref.length; i < len; i++) {
431
+ option = ref[i];
432
  if (option.selected) {
433
  this.selected_option_count += 1;
434
  }
438
 
439
  AbstractChosen.prototype.choices_click = function(evt) {
440
  evt.preventDefault();
441
+ this.activate_field();
442
  if (!(this.results_showing || this.is_disabled)) {
443
  return this.results_show();
444
  }
445
  };
446
 
447
+ AbstractChosen.prototype.keydown_checker = function(evt) {
448
+ var ref, stroke;
449
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
450
+ this.search_field_scale();
451
+ if (stroke !== 8 && this.pending_backstroke) {
452
+ this.clear_backstroke();
453
+ }
454
+ switch (stroke) {
455
+ case 8:
456
+ this.backstroke_length = this.get_search_field_value().length;
457
+ break;
458
+ case 9:
459
+ if (this.results_showing && !this.is_multiple) {
460
+ this.result_select(evt);
461
+ }
462
+ this.mouse_on_container = false;
463
+ break;
464
+ case 13:
465
+ if (this.results_showing) {
466
+ evt.preventDefault();
467
+ }
468
+ break;
469
+ case 27:
470
+ if (this.results_showing) {
471
+ evt.preventDefault();
472
+ }
473
+ break;
474
+ case 32:
475
+ if (this.disable_search) {
476
+ evt.preventDefault();
477
+ }
478
+ break;
479
+ case 38:
480
+ evt.preventDefault();
481
+ this.keyup_arrow();
482
+ break;
483
+ case 40:
484
+ evt.preventDefault();
485
+ this.keydown_arrow();
486
+ break;
487
+ }
488
+ };
489
+
490
  AbstractChosen.prototype.keyup_checker = function(evt) {
491
+ var ref, stroke;
492
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
493
  this.search_field_scale();
494
  switch (stroke) {
495
  case 8:
496
  if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
497
+ this.keydown_backstroke();
498
  } else if (!this.pending_backstroke) {
499
  this.result_clear_highlight();
500
+ this.results_search();
501
  }
502
  break;
503
  case 13:
504
  evt.preventDefault();
505
  if (this.results_showing) {
506
+ this.result_select(evt);
507
  }
508
  break;
509
  case 27:
510
  if (this.results_showing) {
511
  this.results_hide();
512
  }
513
+ break;
514
  case 9:
515
+ case 16:
516
+ case 17:
517
+ case 18:
518
  case 38:
519
  case 40:
 
520
  case 91:
 
521
  break;
522
  default:
523
+ this.results_search();
524
+ break;
525
  }
526
  };
527
 
528
  AbstractChosen.prototype.clipboard_event_checker = function(evt) {
529
+ if (this.is_disabled) {
530
+ return;
531
+ }
532
+ return setTimeout(((function(_this) {
533
+ return function() {
534
+ return _this.results_search();
535
+ };
536
+ })(this)), 50);
537
  };
538
 
539
  AbstractChosen.prototype.container_width = function() {
540
  if (this.options.width != null) {
541
  return this.options.width;
542
  } else {
543
+ return this.form_field.offsetWidth + "px";
544
  }
545
  };
546
 
583
  return tmp.innerHTML;
584
  };
585
 
586
+ AbstractChosen.prototype.get_single_html = function() {
587
+ return "<a class=\"chosen-single chosen-default\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n <span>" + this.default_text + "</span>\n <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n <div class=\"chosen-search\">\n </div>\n <ul class=\"chosen-results\"></ul>\n</div>";
588
+ };
589
+
590
+ AbstractChosen.prototype.get_multi_html = function() {
591
+ return "<ul class=\"chosen-choices\">\n <li class=\"search-field\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n </li>\n</ul>\n<div class=\"chosen-drop\">\n <ul class=\"chosen-results\"></ul>\n</div>";
592
+ };
593
+
594
+ AbstractChosen.prototype.get_no_results_html = function(terms) {
595
+ return "<li class=\"no-results\">\n " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
596
+ };
597
+
598
  AbstractChosen.browser_is_supported = function() {
599
+ if ("Microsoft Internet Explorer" === window.navigator.appName) {
600
  return document.documentMode >= 8;
601
  }
602
+ if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
603
  return false;
604
  }
 
 
 
 
 
605
  return true;
606
  };
607
 
626
  var $this, chosen;
627
  $this = $(this);
628
  chosen = $this.data('chosen');
629
+ if (options === 'destroy') {
630
+ if (chosen instanceof Chosen) {
631
+ chosen.destroy();
632
+ }
633
+ return;
634
+ }
635
+ if (!(chosen instanceof Chosen)) {
636
  $this.data('chosen', new Chosen(this, options));
637
  }
638
  });
639
  }
640
  });
641
 
642
+ Chosen = (function(superClass) {
643
+ extend(Chosen, superClass);
644
 
645
  function Chosen() {
646
+ return Chosen.__super__.constructor.apply(this, arguments);
 
647
  }
648
 
649
  Chosen.prototype.setup = function() {
650
  this.form_field_jq = $(this.form_field);
651
+ return this.current_selectedIndex = this.form_field.selectedIndex;
 
652
  };
653
 
654
  Chosen.prototype.set_up_html = function() {
663
  }
664
  container_props = {
665
  'class': container_classes.join(' '),
 
666
  'title': this.form_field.title
667
  };
668
  if (this.form_field.id.length) {
669
  container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
670
  }
671
  this.container = $("<div />", container_props);
672
+ this.container.width(this.container_width());
673
  if (this.is_multiple) {
674
+ this.container.html(this.get_multi_html());
675
  } else {
676
+ this.container.html(this.get_single_html());
677
  }
678
  this.form_field_jq.hide().after(this.container);
679
  this.dropdown = this.container.find('div.chosen-drop').first();
700
  };
701
 
702
  Chosen.prototype.register_observers = function() {
703
+ this.container.on('touchstart.chosen', (function(_this) {
704
+ return function(evt) {
705
+ _this.container_mousedown(evt);
706
+ };
707
+ })(this));
708
+ this.container.on('touchend.chosen', (function(_this) {
709
+ return function(evt) {
710
+ _this.container_mouseup(evt);
711
+ };
712
+ })(this));
713
+ this.container.on('mousedown.chosen', (function(_this) {
714
+ return function(evt) {
715
+ _this.container_mousedown(evt);
716
+ };
717
+ })(this));
718
+ this.container.on('mouseup.chosen', (function(_this) {
719
+ return function(evt) {
720
+ _this.container_mouseup(evt);
721
+ };
722
+ })(this));
723
+ this.container.on('mouseenter.chosen', (function(_this) {
724
+ return function(evt) {
725
+ _this.mouse_enter(evt);
726
+ };
727
+ })(this));
728
+ this.container.on('mouseleave.chosen', (function(_this) {
729
+ return function(evt) {
730
+ _this.mouse_leave(evt);
731
+ };
732
+ })(this));
733
+ this.search_results.on('mouseup.chosen', (function(_this) {
734
+ return function(evt) {
735
+ _this.search_results_mouseup(evt);
736
+ };
737
+ })(this));
738
+ this.search_results.on('mouseover.chosen', (function(_this) {
739
+ return function(evt) {
740
+ _this.search_results_mouseover(evt);
741
+ };
742
+ })(this));
743
+ this.search_results.on('mouseout.chosen', (function(_this) {
744
+ return function(evt) {
745
+ _this.search_results_mouseout(evt);
746
+ };
747
+ })(this));
748
+ this.search_results.on('mousewheel.chosen DOMMouseScroll.chosen', (function(_this) {
749
+ return function(evt) {
750
+ _this.search_results_mousewheel(evt);
751
+ };
752
+ })(this));
753
+ this.search_results.on('touchstart.chosen', (function(_this) {
754
+ return function(evt) {
755
+ _this.search_results_touchstart(evt);
756
+ };
757
+ })(this));
758
+ this.search_results.on('touchmove.chosen', (function(_this) {
759
+ return function(evt) {
760
+ _this.search_results_touchmove(evt);
761
+ };
762
+ })(this));
763
+ this.search_results.on('touchend.chosen', (function(_this) {
764
+ return function(evt) {
765
+ _this.search_results_touchend(evt);
766
+ };
767
+ })(this));
768
+ this.form_field_jq.on("chosen:updated.chosen", (function(_this) {
769
+ return function(evt) {
770
+ _this.results_update_field(evt);
771
+ };
772
+ })(this));
773
+ this.form_field_jq.on("chosen:activate.chosen", (function(_this) {
774
+ return function(evt) {
775
+ _this.activate_field(evt);
776
+ };
777
+ })(this));
778
+ this.form_field_jq.on("chosen:open.chosen", (function(_this) {
779
+ return function(evt) {
780
+ _this.container_mousedown(evt);
781
+ };
782
+ })(this));
783
+ this.form_field_jq.on("chosen:close.chosen", (function(_this) {
784
+ return function(evt) {
785
+ _this.close_field(evt);
786
+ };
787
+ })(this));
788
+ this.search_field.on('blur.chosen', (function(_this) {
789
+ return function(evt) {
790
+ _this.input_blur(evt);
791
+ };
792
+ })(this));
793
+ this.search_field.on('keyup.chosen', (function(_this) {
794
+ return function(evt) {
795
+ _this.keyup_checker(evt);
796
+ };
797
+ })(this));
798
+ this.search_field.on('keydown.chosen', (function(_this) {
799
+ return function(evt) {
800
+ _this.keydown_checker(evt);
801
+ };
802
+ })(this));
803
+ this.search_field.on('focus.chosen', (function(_this) {
804
+ return function(evt) {
805
+ _this.input_focus(evt);
806
+ };
807
+ })(this));
808
+ this.search_field.on('cut.chosen', (function(_this) {
809
+ return function(evt) {
810
+ _this.clipboard_event_checker(evt);
811
+ };
812
+ })(this));
813
+ this.search_field.on('paste.chosen', (function(_this) {
814
+ return function(evt) {
815
+ _this.clipboard_event_checker(evt);
816
+ };
817
+ })(this));
818
  if (this.is_multiple) {
819
+ return this.search_choices.on('click.chosen', (function(_this) {
820
+ return function(evt) {
821
+ _this.choices_click(evt);
822
+ };
823
+ })(this));
824
  } else {
825
+ return this.container.on('click.chosen', function(evt) {
826
  evt.preventDefault();
827
  });
828
  }
829
  };
830
 
831
  Chosen.prototype.destroy = function() {
832
+ $(this.container[0].ownerDocument).off('click.chosen', this.click_test_action);
833
+ if (this.form_field_label.length > 0) {
834
+ this.form_field_label.off('click.chosen');
835
+ }
836
  if (this.search_field[0].tabIndex) {
837
  this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
838
  }
842
  };
843
 
844
  Chosen.prototype.search_field_disabled = function() {
845
+ this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled');
846
+ this.container.toggleClass('chosen-disabled', this.is_disabled);
847
+ this.search_field[0].disabled = this.is_disabled;
848
+ if (!this.is_multiple) {
849
+ this.selected_item.off('focus.chosen', this.activate_field);
850
+ }
851
  if (this.is_disabled) {
 
 
 
 
 
852
  return this.close_field();
853
+ } else if (!this.is_multiple) {
854
+ return this.selected_item.on('focus.chosen', this.activate_field);
 
 
 
 
855
  }
856
  };
857
 
858
  Chosen.prototype.container_mousedown = function(evt) {
859
+ var ref;
860
+ if (this.is_disabled) {
861
+ return;
862
+ }
863
+ if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
864
+ evt.preventDefault();
865
+ }
866
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
867
+ if (!this.active_field) {
868
+ if (this.is_multiple) {
869
+ this.search_field.val("");
 
 
 
870
  }
871
+ $(this.container[0].ownerDocument).on('click.chosen', this.click_test_action);
872
+ this.results_show();
873
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
874
+ evt.preventDefault();
875
+ this.results_toggle();
876
  }
877
+ return this.activate_field();
878
  }
879
  };
880
 
905
  };
906
 
907
  Chosen.prototype.close_field = function() {
908
+ $(this.container[0].ownerDocument).off("click.chosen", this.click_test_action);
909
  this.active_field = false;
910
  this.results_hide();
911
  this.container.removeClass("chosen-container-active");
912
  this.clear_backstroke();
913
  this.show_search_field_default();
914
+ this.search_field_scale();
915
+ return this.search_field.blur();
916
  };
917
 
918
  Chosen.prototype.activate_field = function() {
919
+ if (this.is_disabled) {
920
+ return;
921
+ }
922
  this.container.addClass("chosen-container-active");
923
  this.active_field = true;
924
  this.search_field.val(this.search_field.val());
993
  });
994
  return false;
995
  }
996
+ if (!this.is_multiple) {
997
+ this.search_container.append(this.search_field);
998
+ }
999
  this.container.addClass("chosen-with-drop");
1000
  this.results_showing = true;
1001
  this.search_field.focus();
1002
+ this.search_field.val(this.get_search_field_value());
1003
  this.winnow_results();
1004
  return this.form_field_jq.trigger("chosen:showing_dropdown", {
1005
  chosen: this
1013
  Chosen.prototype.results_hide = function() {
1014
  if (this.results_showing) {
1015
  this.result_clear_highlight();
1016
+ if (!this.is_multiple) {
1017
+ this.selected_item.prepend(this.search_field);
1018
+ this.search_field.focus();
1019
+ }
1020
  this.container.removeClass("chosen-with-drop");
1021
  this.form_field_jq.trigger("chosen:hiding_dropdown", {
1022
  chosen: this
1035
  };
1036
 
1037
  Chosen.prototype.set_label_behavior = function() {
 
1038
  this.form_field_label = this.form_field_jq.parents("label");
1039
  if (!this.form_field_label.length && this.form_field.id.length) {
1040
  this.form_field_label = $("label[for='" + this.form_field.id + "']");
1041
  }
1042
  if (this.form_field_label.length > 0) {
1043
+ return this.form_field_label.on('click.chosen', this.label_click_handler);
 
 
 
 
 
 
1044
  }
1045
  };
1046
 
1073
  };
1074
 
1075
  Chosen.prototype.search_results_mouseout = function(evt) {
1076
+ if ($(evt.target).hasClass("active-result") || $(evt.target).parents('.active-result').first()) {
1077
  return this.result_clear_highlight();
1078
  }
1079
  };
1080
 
1081
  Chosen.prototype.choice_build = function(item) {
1082
+ var choice, close_link;
 
1083
  choice = $('<li />', {
1084
  "class": "search-choice"
1085
  }).html("<span>" + (this.choice_label(item)) + "</span>");
1090
  "class": 'search-choice-close',
1091
  'data-option-array-index': item.array_index
1092
  });
1093
+ close_link.on('click.chosen', (function(_this) {
1094
+ return function(evt) {
1095
+ return _this.choice_destroy_link_click(evt);
1096
+ };
1097
+ })(this));
1098
  choice.append(close_link);
1099
  }
1100
  return this.search_container.before(choice);
1110
 
1111
  Chosen.prototype.choice_destroy = function(link) {
1112
  if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
1113
+ if (this.active_field) {
1114
+ this.search_field.focus();
1115
+ } else {
1116
+ this.show_search_field_default();
1117
+ }
1118
+ if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
1119
  this.results_hide();
1120
  }
1121
  link.parents('li').first().remove();
1129
  this.single_set_selected_text();
1130
  this.show_search_field_default();
1131
  this.results_reset_cleanup();
1132
+ this.trigger_form_field_change();
1133
  if (this.active_field) {
1134
  return this.results_hide();
1135
  }
1161
  item.selected = true;
1162
  this.form_field.options[item.options_index].selected = true;
1163
  this.selected_option_count = null;
1164
+ this.search_field.val("");
1165
  if (this.is_multiple) {
1166
  this.choice_build(item);
1167
  } else {
1168
  this.single_set_selected_text(this.choice_label(item));
1169
  }
1170
+ if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
1171
+ this.winnow_results();
1172
+ } else {
1173
  this.results_hide();
1174
+ this.show_search_field_default();
1175
  }
 
1176
  if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1177
+ this.trigger_form_field_change({
1178
+ selected: this.form_field.options[item.options_index].value
1179
  });
1180
  }
1181
  this.current_selectedIndex = this.form_field.selectedIndex;
1208
  if (this.results_showing) {
1209
  this.winnow_results();
1210
  }
1211
+ this.trigger_form_field_change({
1212
  deselected: this.form_field.options[result_data.options_index].value
1213
  });
1214
  this.search_field_scale();
1228
  return this.selected_item.addClass("chosen-single-with-deselect");
1229
  };
1230
 
1231
+ Chosen.prototype.get_search_field_value = function() {
1232
+ return this.search_field.val();
1233
+ };
1234
+
1235
  Chosen.prototype.get_search_text = function() {
1236
+ return $.trim(this.get_search_field_value());
1237
+ };
1238
+
1239
+ Chosen.prototype.escape_html = function(text) {
1240
+ return $('<div/>').text(text).html();
1241
  };
1242
 
1243
  Chosen.prototype.winnow_results_set_highlight = function() {
1251
 
1252
  Chosen.prototype.no_results = function(terms) {
1253
  var no_results_html;
1254
+ no_results_html = this.get_no_results_html(terms);
 
1255
  this.search_results.append(no_results_html);
1256
  return this.form_field_jq.trigger("chosen:no_results", {
1257
  chosen: this
1316
  return this.pending_backstroke = null;
1317
  };
1318
 
1319
+ Chosen.prototype.search_field_scale = function() {
1320
+ var div, i, len, style, style_block, styles, width;
1321
+ if (!this.is_multiple) {
1322
+ return;
 
 
1323
  }
1324
+ style_block = {
1325
+ position: 'absolute',
1326
+ left: '-1000px',
1327
+ top: '-1000px',
1328
+ display: 'none',
1329
+ whiteSpace: 'pre'
1330
+ };
1331
+ styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
1332
+ for (i = 0, len = styles.length; i < len; i++) {
1333
+ style = styles[i];
1334
+ style_block[style] = this.search_field.css(style);
1335
+ }
1336
+ div = $('<div />').css(style_block);
1337
+ div.text(this.get_search_field_value());
1338
+ $('body').append(div);
1339
+ width = div.width() + 25;
1340
+ div.remove();
1341
+ if (this.container.is(':visible')) {
1342
+ width = Math.min(this.container.outerWidth() - 10, width);
 
 
 
 
 
 
 
 
 
1343
  }
1344
+ return this.search_field.width(width);
1345
  };
1346
 
1347
+ Chosen.prototype.trigger_form_field_change = function(extra) {
1348
+ this.form_field_jq.trigger("input", extra);
1349
+ return this.form_field_jq.trigger("change", extra);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  };
1351
 
1352
  return Chosen;
assets/lib/chosen/chosen.jquery.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /* Chosen v1.8.3 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+
3
+ (function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s<i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&&!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&&!n.group&&(c+=1),n.search_match?(o.length&&(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(e)+"</em>"+this.escape_html(d)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple||this.search_container.append(this.search_field),this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.is_multiple||(this.selected_item.prepend(this.search_field),this.search_field.focus()),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
assets/lib/chosen/chosen.min.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.3
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);display:none}.chosen-container.chosen-with-drop .chosen-drop{display:block}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-single input[type=text]{cursor:pointer;opacity:0;position:absolute}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
assets/lib/{chosen_v1.4.2 → chosen}/chosen.proto.js RENAMED
@@ -2,18 +2,19 @@
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
- Version 1.4.2
6
  Full source at https://github.com/harvesthq/chosen
7
- Copyright (c) 2011-2015 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
11
  */
12
 
13
  (function() {
14
- var AbstractChosen, SelectParser, _ref,
15
- __hasProp = {}.hasOwnProperty,
16
- __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; };
 
17
 
18
  SelectParser = (function() {
19
  function SelectParser() {
@@ -30,24 +31,24 @@ This file is generated by `grunt build`, do not edit it by hand.
30
  };
31
 
32
  SelectParser.prototype.add_group = function(group) {
33
- var group_position, option, _i, _len, _ref, _results;
34
  group_position = this.parsed.length;
35
  this.parsed.push({
36
  array_index: group_position,
37
  group: true,
38
- label: this.escapeExpression(group.label),
39
  title: group.title ? group.title : void 0,
40
  children: 0,
41
  disabled: group.disabled,
42
  classes: group.className
43
  });
44
- _ref = group.childNodes;
45
- _results = [];
46
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
47
- option = _ref[_i];
48
- _results.push(this.add_option(option, group_position, group.disabled));
49
  }
50
- return _results;
51
  };
52
 
53
  SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
@@ -81,46 +82,26 @@ This file is generated by `grunt build`, do not edit it by hand.
81
  }
82
  };
83
 
84
- SelectParser.prototype.escapeExpression = function(text) {
85
- var map, unsafe_chars;
86
- if ((text == null) || text === false) {
87
- return "";
88
- }
89
- if (!/[\&\<\>\"\'\`]/.test(text)) {
90
- return text;
91
- }
92
- map = {
93
- "<": "&lt;",
94
- ">": "&gt;",
95
- '"': "&quot;",
96
- "'": "&#x27;",
97
- "`": "&#x60;"
98
- };
99
- unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
100
- return text.replace(unsafe_chars, function(chr) {
101
- return map[chr] || "&amp;";
102
- });
103
- };
104
-
105
  return SelectParser;
106
 
107
  })();
108
 
109
  SelectParser.select_to_array = function(select) {
110
- var child, parser, _i, _len, _ref;
111
  parser = new SelectParser();
112
- _ref = select.childNodes;
113
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
114
- child = _ref[_i];
115
  parser.add_node(child);
116
  }
117
  return parser.parsed;
118
  };
119
 
120
  AbstractChosen = (function() {
121
- function AbstractChosen(form_field, options) {
122
  this.form_field = form_field;
123
- this.options = options != null ? options : {};
 
124
  if (!AbstractChosen.browser_is_supported()) {
125
  return;
126
  }
@@ -134,17 +115,21 @@ This file is generated by `grunt build`, do not edit it by hand.
134
  }
135
 
136
  AbstractChosen.prototype.set_default_values = function() {
137
- var _this = this;
138
- this.click_test_action = function(evt) {
139
- return _this.test_active_click(evt);
140
- };
141
- this.activate_action = function(evt) {
142
- return _this.activate_field(evt);
143
- };
 
 
 
144
  this.active_field = false;
145
  this.mouse_on_container = false;
146
  this.results_showing = false;
147
  this.result_highlighted = null;
 
148
  this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
149
  this.disable_search_threshold = this.options.disable_search_threshold || 0;
150
  this.disable_search = this.options.disable_search || false;
@@ -156,7 +141,10 @@ This file is generated by `grunt build`, do not edit it by hand.
156
  this.inherit_select_classes = this.options.inherit_select_classes || false;
157
  this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
158
  this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
159
- return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
 
 
 
160
  };
161
 
162
  AbstractChosen.prototype.set_default_text = function() {
@@ -167,6 +155,7 @@ This file is generated by `grunt build`, do not edit it by hand.
167
  } else {
168
  this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
169
  }
 
170
  return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
171
  };
172
 
@@ -187,12 +176,13 @@ This file is generated by `grunt build`, do not edit it by hand.
187
  };
188
 
189
  AbstractChosen.prototype.input_focus = function(evt) {
190
- var _this = this;
191
  if (this.is_multiple) {
192
  if (!this.active_field) {
193
- return setTimeout((function() {
194
- return _this.container_mousedown();
195
- }), 50);
 
 
196
  }
197
  } else {
198
  if (!this.active_field) {
@@ -202,25 +192,40 @@ This file is generated by `grunt build`, do not edit it by hand.
202
  };
203
 
204
  AbstractChosen.prototype.input_blur = function(evt) {
205
- var _this = this;
206
  if (!this.mouse_on_container) {
207
  this.active_field = false;
208
- return setTimeout((function() {
209
- return _this.blur_test();
210
- }), 100);
 
 
 
 
 
 
 
 
 
 
211
  }
212
  };
213
 
214
  AbstractChosen.prototype.results_option_build = function(options) {
215
- var content, data, _i, _len, _ref;
216
  content = '';
217
- _ref = this.results_data;
218
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
219
- data = _ref[_i];
 
 
220
  if (data.group) {
221
- content += this.result_add_group(data);
222
  } else {
223
- content += this.result_add_option(data);
 
 
 
 
224
  }
225
  if (options != null ? options.first : void 0) {
226
  if (data.selected && this.is_multiple) {
@@ -229,6 +234,9 @@ This file is generated by `grunt build`, do not edit it by hand.
229
  this.single_set_selected_text(this.choice_label(data));
230
  }
231
  }
 
 
 
232
  }
233
  return content;
234
  };
@@ -261,7 +269,7 @@ This file is generated by `grunt build`, do not edit it by hand.
261
  option_el.className = classes.join(" ");
262
  option_el.style.cssText = option.style;
263
  option_el.setAttribute("data-option-array-index", option.array_index);
264
- option_el.innerHTML = option.search_text;
265
  if (option.title) {
266
  option_el.title = option.title;
267
  }
@@ -283,7 +291,7 @@ This file is generated by `grunt build`, do not edit it by hand.
283
  }
284
  group_el = document.createElement("li");
285
  group_el.className = classes.join(" ");
286
- group_el.innerHTML = group.search_text;
287
  if (group.title) {
288
  group_el.title = group.title;
289
  }
@@ -303,18 +311,18 @@ This file is generated by `grunt build`, do not edit it by hand.
303
  };
304
 
305
  AbstractChosen.prototype.reset_single_select_options = function() {
306
- var result, _i, _len, _ref, _results;
307
- _ref = this.results_data;
308
- _results = [];
309
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
310
- result = _ref[_i];
311
  if (result.selected) {
312
- _results.push(result.selected = false);
313
  } else {
314
- _results.push(void 0);
315
  }
316
  }
317
- return _results;
318
  };
319
 
320
  AbstractChosen.prototype.results_toggle = function() {
@@ -334,18 +342,19 @@ This file is generated by `grunt build`, do not edit it by hand.
334
  };
335
 
336
  AbstractChosen.prototype.winnow_results = function() {
337
- var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
338
  this.no_results_clear();
339
  results = 0;
340
- searchText = this.get_search_text();
341
- escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
342
- zregex = new RegExp(escapedSearchText, 'i');
343
- regex = this.get_search_regex(escapedSearchText);
344
- _ref = this.results_data;
345
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
346
- option = _ref[_i];
347
  option.search_match = false;
348
  results_group = null;
 
 
349
  if (this.include_option_in_results(option)) {
350
  if (option.group) {
351
  option.group_match = false;
@@ -358,17 +367,20 @@ This file is generated by `grunt build`, do not edit it by hand.
358
  }
359
  results_group.active_options += 1;
360
  }
361
- option.search_text = option.group ? option.label : option.html;
362
  if (!(option.group && !this.group_search)) {
363
- option.search_match = this.search_string_match(option.search_text, regex);
 
364
  if (option.search_match && !option.group) {
365
  results += 1;
366
  }
367
  if (option.search_match) {
368
- if (searchText.length) {
369
- startpos = option.search_text.search(zregex);
370
- text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
371
- option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
 
 
372
  }
373
  if (results_group != null) {
374
  results_group.group_match = true;
@@ -380,9 +392,9 @@ This file is generated by `grunt build`, do not edit it by hand.
380
  }
381
  }
382
  this.result_clear_highlight();
383
- if (results < 1 && searchText.length) {
384
  this.update_results_content("");
385
- return this.no_results(searchText);
386
  } else {
387
  this.update_results_content(this.results_option_build());
388
  return this.winnow_results_set_highlight();
@@ -390,37 +402,33 @@ This file is generated by `grunt build`, do not edit it by hand.
390
  };
391
 
392
  AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
393
- var regex_anchor;
394
- regex_anchor = this.search_contains ? "" : "^";
395
- return new RegExp(regex_anchor + escaped_search_string, 'i');
 
 
 
 
396
  };
397
 
398
  AbstractChosen.prototype.search_string_match = function(search_string, regex) {
399
- var part, parts, _i, _len;
400
- if (regex.test(search_string)) {
401
- return true;
402
- } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
403
- parts = search_string.replace(/\[|\]/g, "").split(" ");
404
- if (parts.length) {
405
- for (_i = 0, _len = parts.length; _i < _len; _i++) {
406
- part = parts[_i];
407
- if (regex.test(part)) {
408
- return true;
409
- }
410
- }
411
- }
412
  }
 
413
  };
414
 
415
  AbstractChosen.prototype.choices_count = function() {
416
- var option, _i, _len, _ref;
417
  if (this.selected_option_count != null) {
418
  return this.selected_option_count;
419
  }
420
  this.selected_option_count = 0;
421
- _ref = this.form_field.options;
422
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
423
- option = _ref[_i];
424
  if (option.selected) {
425
  this.selected_option_count += 1;
426
  }
@@ -430,59 +438,109 @@ This file is generated by `grunt build`, do not edit it by hand.
430
 
431
  AbstractChosen.prototype.choices_click = function(evt) {
432
  evt.preventDefault();
 
433
  if (!(this.results_showing || this.is_disabled)) {
434
  return this.results_show();
435
  }
436
  };
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  AbstractChosen.prototype.keyup_checker = function(evt) {
439
- var stroke, _ref;
440
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
441
  this.search_field_scale();
442
  switch (stroke) {
443
  case 8:
444
  if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
445
- return this.keydown_backstroke();
446
  } else if (!this.pending_backstroke) {
447
  this.result_clear_highlight();
448
- return this.results_search();
449
  }
450
  break;
451
  case 13:
452
  evt.preventDefault();
453
  if (this.results_showing) {
454
- return this.result_select(evt);
455
  }
456
  break;
457
  case 27:
458
  if (this.results_showing) {
459
  this.results_hide();
460
  }
461
- return true;
462
  case 9:
 
 
 
463
  case 38:
464
  case 40:
465
- case 16:
466
  case 91:
467
- case 17:
468
  break;
469
  default:
470
- return this.results_search();
 
471
  }
472
  };
473
 
474
  AbstractChosen.prototype.clipboard_event_checker = function(evt) {
475
- var _this = this;
476
- return setTimeout((function() {
477
- return _this.results_search();
478
- }), 50);
 
 
 
 
479
  };
480
 
481
  AbstractChosen.prototype.container_width = function() {
482
  if (this.options.width != null) {
483
  return this.options.width;
484
  } else {
485
- return "" + this.form_field.offsetWidth + "px";
486
  }
487
  };
488
 
@@ -525,18 +583,25 @@ This file is generated by `grunt build`, do not edit it by hand.
525
  return tmp.innerHTML;
526
  };
527
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  AbstractChosen.browser_is_supported = function() {
529
- if (window.navigator.appName === "Microsoft Internet Explorer") {
530
  return document.documentMode >= 8;
531
  }
532
- if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
533
  return false;
534
  }
535
- if (/Android/i.test(window.navigator.userAgent)) {
536
- if (/Mobile/i.test(window.navigator.userAgent)) {
537
- return false;
538
- }
539
- }
540
  return true;
541
  };
542
 
@@ -550,24 +615,17 @@ This file is generated by `grunt build`, do not edit it by hand.
550
 
551
  })();
552
 
553
- this.Chosen = (function(_super) {
554
- __extends(Chosen, _super);
 
 
555
 
556
  function Chosen() {
557
- _ref = Chosen.__super__.constructor.apply(this, arguments);
558
- return _ref;
559
  }
560
 
561
  Chosen.prototype.setup = function() {
562
- this.current_selectedIndex = this.form_field.selectedIndex;
563
- return this.is_rtl = this.form_field.hasClassName("chosen-rtl");
564
- };
565
-
566
- Chosen.prototype.set_default_values = function() {
567
- Chosen.__super__.set_default_values.call(this);
568
- this.single_temp = new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
569
- this.multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
570
- return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
571
  };
572
 
573
  Chosen.prototype.set_up_html = function() {
@@ -582,17 +640,20 @@ This file is generated by `grunt build`, do not edit it by hand.
582
  }
583
  container_props = {
584
  'class': container_classes.join(' '),
585
- 'style': "width: " + (this.container_width()) + ";",
586
  'title': this.form_field.title
587
  };
588
  if (this.form_field.id.length) {
589
  container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
590
  }
591
- this.container = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
592
- "default": this.default_text
593
- })) : new Element('div', container_props).update(this.single_temp.evaluate({
594
- "default": this.default_text
595
- }));
 
 
 
 
596
  this.form_field.hide().insert({
597
  after: this.container
598
  });
@@ -620,95 +681,149 @@ This file is generated by `grunt build`, do not edit it by hand.
620
  };
621
 
622
  Chosen.prototype.register_observers = function() {
623
- var _this = this;
624
- this.container.observe("touchstart", function(evt) {
625
- _this.container_mousedown(evt);
626
- return evt.preventDefault();
627
- });
628
- this.container.observe("touchend", function(evt) {
629
- _this.container_mouseup(evt);
630
- return evt.preventDefault();
631
- });
632
- this.container.observe("mousedown", function(evt) {
633
- return _this.container_mousedown(evt);
634
- });
635
- this.container.observe("mouseup", function(evt) {
636
- return _this.container_mouseup(evt);
637
- });
638
- this.container.observe("mouseenter", function(evt) {
639
- return _this.mouse_enter(evt);
640
- });
641
- this.container.observe("mouseleave", function(evt) {
642
- return _this.mouse_leave(evt);
643
- });
644
- this.search_results.observe("mouseup", function(evt) {
645
- return _this.search_results_mouseup(evt);
646
- });
647
- this.search_results.observe("mouseover", function(evt) {
648
- return _this.search_results_mouseover(evt);
649
- });
650
- this.search_results.observe("mouseout", function(evt) {
651
- return _this.search_results_mouseout(evt);
652
- });
653
- this.search_results.observe("mousewheel", function(evt) {
654
- return _this.search_results_mousewheel(evt);
655
- });
656
- this.search_results.observe("DOMMouseScroll", function(evt) {
657
- return _this.search_results_mousewheel(evt);
658
- });
659
- this.search_results.observe("touchstart", function(evt) {
660
- return _this.search_results_touchstart(evt);
661
- });
662
- this.search_results.observe("touchmove", function(evt) {
663
- return _this.search_results_touchmove(evt);
664
- });
665
- this.search_results.observe("touchend", function(evt) {
666
- return _this.search_results_touchend(evt);
667
- });
668
- this.form_field.observe("chosen:updated", function(evt) {
669
- return _this.results_update_field(evt);
670
- });
671
- this.form_field.observe("chosen:activate", function(evt) {
672
- return _this.activate_field(evt);
673
- });
674
- this.form_field.observe("chosen:open", function(evt) {
675
- return _this.container_mousedown(evt);
676
- });
677
- this.form_field.observe("chosen:close", function(evt) {
678
- return _this.input_blur(evt);
679
- });
680
- this.search_field.observe("blur", function(evt) {
681
- return _this.input_blur(evt);
682
- });
683
- this.search_field.observe("keyup", function(evt) {
684
- return _this.keyup_checker(evt);
685
- });
686
- this.search_field.observe("keydown", function(evt) {
687
- return _this.keydown_checker(evt);
688
- });
689
- this.search_field.observe("focus", function(evt) {
690
- return _this.input_focus(evt);
691
- });
692
- this.search_field.observe("cut", function(evt) {
693
- return _this.clipboard_event_checker(evt);
694
- });
695
- this.search_field.observe("paste", function(evt) {
696
- return _this.clipboard_event_checker(evt);
697
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
  if (this.is_multiple) {
699
- return this.search_choices.observe("click", function(evt) {
700
- return _this.choices_click(evt);
701
- });
 
 
702
  } else {
703
- return this.container.observe("click", function(evt) {
704
- return evt.preventDefault();
705
- });
 
 
706
  }
707
  };
708
 
709
  Chosen.prototype.destroy = function() {
 
710
  this.container.ownerDocument.stopObserving("click", this.click_test_action);
711
- this.form_field.stopObserving();
 
 
 
 
712
  this.container.stopObserving();
713
  this.search_results.stopObserving();
714
  this.search_field.stopObserving();
@@ -731,40 +846,43 @@ This file is generated by `grunt build`, do not edit it by hand.
731
  };
732
 
733
  Chosen.prototype.search_field_disabled = function() {
734
- this.is_disabled = this.form_field.disabled;
 
735
  if (this.is_disabled) {
736
  this.container.addClassName('chosen-disabled');
737
- this.search_field.disabled = true;
738
- if (!this.is_multiple) {
739
- this.selected_item.stopObserving("focus", this.activate_action);
740
- }
741
- return this.close_field();
742
  } else {
743
  this.container.removeClassName('chosen-disabled');
744
- this.search_field.disabled = false;
745
- if (!this.is_multiple) {
746
- return this.selected_item.observe("focus", this.activate_action);
747
- }
 
 
 
 
 
748
  }
749
  };
750
 
751
  Chosen.prototype.container_mousedown = function(evt) {
752
- if (!this.is_disabled) {
753
- if (evt && evt.type === "mousedown" && !this.results_showing) {
754
- evt.stop();
755
- }
756
- if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
757
- if (!this.active_field) {
758
- if (this.is_multiple) {
759
- this.search_field.clear();
760
- }
761
- this.container.ownerDocument.observe("click", this.click_test_action);
762
- this.results_show();
763
- } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
764
- this.results_toggle();
765
  }
766
- return this.activate_field();
 
 
 
767
  }
 
768
  }
769
  };
770
 
@@ -799,13 +917,17 @@ This file is generated by `grunt build`, do not edit it by hand.
799
  this.container.removeClassName("chosen-container-active");
800
  this.clear_backstroke();
801
  this.show_search_field_default();
802
- return this.search_field_scale();
 
803
  };
804
 
805
  Chosen.prototype.activate_field = function() {
 
 
 
806
  this.container.addClassName("chosen-container-active");
807
  this.active_field = true;
808
- this.search_field.value = this.search_field.value;
809
  return this.search_field.focus();
810
  };
811
 
@@ -873,10 +995,13 @@ This file is generated by `grunt build`, do not edit it by hand.
873
  });
874
  return false;
875
  }
 
 
 
876
  this.container.addClassName("chosen-with-drop");
877
  this.results_showing = true;
878
  this.search_field.focus();
879
- this.search_field.value = this.search_field.value;
880
  this.winnow_results();
881
  return this.form_field.fire("chosen:showing_dropdown", {
882
  chosen: this
@@ -890,6 +1015,12 @@ This file is generated by `grunt build`, do not edit it by hand.
890
  Chosen.prototype.results_hide = function() {
891
  if (this.results_showing) {
892
  this.result_clear_highlight();
 
 
 
 
 
 
893
  this.container.removeClassName("chosen-with-drop");
894
  this.form_field.fire("chosen:hiding_dropdown", {
895
  chosen: this
@@ -908,19 +1039,12 @@ This file is generated by `grunt build`, do not edit it by hand.
908
  };
909
 
910
  Chosen.prototype.set_label_behavior = function() {
911
- var _this = this;
912
  this.form_field_label = this.form_field.up("label");
913
  if (this.form_field_label == null) {
914
  this.form_field_label = $$("label[for='" + this.form_field.id + "']").first();
915
  }
916
  if (this.form_field_label != null) {
917
- return this.form_field_label.observe("click", function(evt) {
918
- if (_this.is_multiple) {
919
- return _this.container_mousedown(evt);
920
- } else {
921
- return _this.activate_field();
922
- }
923
- });
924
  }
925
  };
926
 
@@ -959,8 +1083,7 @@ This file is generated by `grunt build`, do not edit it by hand.
959
  };
960
 
961
  Chosen.prototype.choice_build = function(item) {
962
- var choice, close_link,
963
- _this = this;
964
  choice = new Element('li', {
965
  "class": "search-choice"
966
  }).update("<span>" + (this.choice_label(item)) + "</span>");
@@ -972,9 +1095,11 @@ This file is generated by `grunt build`, do not edit it by hand.
972
  "class": 'search-choice-close',
973
  rel: item.array_index
974
  });
975
- close_link.observe("click", function(evt) {
976
- return _this.choice_destroy_link_click(evt);
977
- });
 
 
978
  choice.insert(close_link);
979
  }
980
  return this.search_container.insert({
@@ -992,8 +1117,12 @@ This file is generated by `grunt build`, do not edit it by hand.
992
 
993
  Chosen.prototype.choice_destroy = function(link) {
994
  if (this.result_deselect(link.readAttribute("rel"))) {
995
- this.show_search_field_default();
996
- if (this.is_multiple && this.choices_count() > 0 && this.search_field.value.length < 1) {
 
 
 
 
997
  this.results_hide();
998
  }
999
  link.up('li').remove();
@@ -1007,9 +1136,7 @@ This file is generated by `grunt build`, do not edit it by hand.
1007
  this.single_set_selected_text();
1008
  this.show_search_field_default();
1009
  this.results_reset_cleanup();
1010
- if (typeof Event.simulate === 'function') {
1011
- this.form_field.simulate("change");
1012
- }
1013
  if (this.active_field) {
1014
  return this.results_hide();
1015
  }
@@ -1045,17 +1172,20 @@ This file is generated by `grunt build`, do not edit it by hand.
1045
  item.selected = true;
1046
  this.form_field.options[item.options_index].selected = true;
1047
  this.selected_option_count = null;
 
1048
  if (this.is_multiple) {
1049
  this.choice_build(item);
1050
  } else {
1051
  this.single_set_selected_text(this.choice_label(item));
1052
  }
1053
- if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
 
 
1054
  this.results_hide();
 
1055
  }
1056
- this.search_field.value = "";
1057
- if (typeof Event.simulate === 'function' && (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex)) {
1058
- this.form_field.simulate("change");
1059
  }
1060
  this.current_selectedIndex = this.form_field.selectedIndex;
1061
  evt.preventDefault();
@@ -1087,9 +1217,7 @@ This file is generated by `grunt build`, do not edit it by hand.
1087
  if (this.results_showing) {
1088
  this.winnow_results();
1089
  }
1090
- if (typeof Event.simulate === 'function') {
1091
- this.form_field.simulate("change");
1092
- }
1093
  this.search_field_scale();
1094
  return true;
1095
  } else {
@@ -1109,8 +1237,16 @@ This file is generated by `grunt build`, do not edit it by hand.
1109
  return this.selected_item.addClassName("chosen-single-with-deselect");
1110
  };
1111
 
 
 
 
 
1112
  Chosen.prototype.get_search_text = function() {
1113
- return this.search_field.value.strip().escapeHTML();
 
 
 
 
1114
  };
1115
 
1116
  Chosen.prototype.winnow_results_set_highlight = function() {
@@ -1127,22 +1263,20 @@ This file is generated by `grunt build`, do not edit it by hand.
1127
  };
1128
 
1129
  Chosen.prototype.no_results = function(terms) {
1130
- this.search_results.insert(this.no_results_temp.evaluate({
1131
- terms: terms
1132
- }));
1133
  return this.form_field.fire("chosen:no_results", {
1134
  chosen: this
1135
  });
1136
  };
1137
 
1138
  Chosen.prototype.no_results_clear = function() {
1139
- var nr, _results;
1140
  nr = null;
1141
- _results = [];
1142
  while (nr = this.search_results.down(".no-results")) {
1143
- _results.push(nr.remove());
1144
  }
1145
- return _results;
1146
  };
1147
 
1148
  Chosen.prototype.keydown_arrow = function() {
@@ -1204,68 +1338,56 @@ This file is generated by `grunt build`, do not edit it by hand.
1204
  return this.pending_backstroke = null;
1205
  };
1206
 
1207
- Chosen.prototype.keydown_checker = function(evt) {
1208
- var stroke, _ref1;
1209
- stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1210
- this.search_field_scale();
1211
- if (stroke !== 8 && this.pending_backstroke) {
1212
- this.clear_backstroke();
1213
- }
1214
- switch (stroke) {
1215
- case 8:
1216
- this.backstroke_length = this.search_field.value.length;
1217
- break;
1218
- case 9:
1219
- if (this.results_showing && !this.is_multiple) {
1220
- this.result_select(evt);
1221
- }
1222
- this.mouse_on_container = false;
1223
- break;
1224
- case 13:
1225
- if (this.results_showing) {
1226
- evt.preventDefault();
1227
- }
1228
- break;
1229
- case 32:
1230
- if (this.disable_search) {
1231
- evt.preventDefault();
1232
- }
1233
- break;
1234
- case 38:
1235
- evt.preventDefault();
1236
- this.keyup_arrow();
1237
- break;
1238
- case 40:
1239
- evt.preventDefault();
1240
- this.keydown_arrow();
1241
- break;
1242
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1243
  };
1244
 
1245
- Chosen.prototype.search_field_scale = function() {
1246
- var div, f_width, h, style, style_block, styles, w, _i, _len;
1247
- if (this.is_multiple) {
1248
- h = 0;
1249
- w = 0;
1250
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1251
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1252
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
1253
- style = styles[_i];
1254
- style_block += style + ":" + this.search_field.getStyle(style) + ";";
1255
- }
1256
- div = new Element('div', {
1257
- 'style': style_block
1258
- }).update(this.search_field.value.escapeHTML());
1259
- document.body.appendChild(div);
1260
- w = Element.measure(div, 'width') + 25;
1261
- div.remove();
1262
- f_width = this.container.getWidth();
1263
- if (w > f_width - 10) {
1264
- w = f_width - 10;
1265
  }
1266
- return this.search_field.setStyle({
1267
- 'width': w + 'px'
1268
- });
1269
  }
1270
  };
1271
 
2
  Chosen, a Select Box Enhancer for jQuery and Prototype
3
  by Patrick Filler for Harvest, http://getharvest.com
4
 
5
+ Version 1.8.3
6
  Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
 
9
  MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
  This file is generated by `grunt build`, do not edit it by hand.
11
  */
12
 
13
  (function() {
14
+ var AbstractChosen, SelectParser,
15
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
16
+ extend = 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; },
17
+ hasProp = {}.hasOwnProperty;
18
 
19
  SelectParser = (function() {
20
  function SelectParser() {
31
  };
32
 
33
  SelectParser.prototype.add_group = function(group) {
34
+ var group_position, i, len, option, ref, results1;
35
  group_position = this.parsed.length;
36
  this.parsed.push({
37
  array_index: group_position,
38
  group: true,
39
+ label: group.label,
40
  title: group.title ? group.title : void 0,
41
  children: 0,
42
  disabled: group.disabled,
43
  classes: group.className
44
  });
45
+ ref = group.childNodes;
46
+ results1 = [];
47
+ for (i = 0, len = ref.length; i < len; i++) {
48
+ option = ref[i];
49
+ results1.push(this.add_option(option, group_position, group.disabled));
50
  }
51
+ return results1;
52
  };
53
 
54
  SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
82
  }
83
  };
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  return SelectParser;
86
 
87
  })();
88
 
89
  SelectParser.select_to_array = function(select) {
90
+ var child, i, len, parser, ref;
91
  parser = new SelectParser();
92
+ ref = select.childNodes;
93
+ for (i = 0, len = ref.length; i < len; i++) {
94
+ child = ref[i];
95
  parser.add_node(child);
96
  }
97
  return parser.parsed;
98
  };
99
 
100
  AbstractChosen = (function() {
101
+ function AbstractChosen(form_field, options1) {
102
  this.form_field = form_field;
103
+ this.options = options1 != null ? options1 : {};
104
+ this.label_click_handler = bind(this.label_click_handler, this);
105
  if (!AbstractChosen.browser_is_supported()) {
106
  return;
107
  }
115
  }
116
 
117
  AbstractChosen.prototype.set_default_values = function() {
118
+ this.click_test_action = (function(_this) {
119
+ return function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ })(this);
123
+ this.activate_action = (function(_this) {
124
+ return function(evt) {
125
+ return _this.activate_field(evt);
126
+ };
127
+ })(this);
128
  this.active_field = false;
129
  this.mouse_on_container = false;
130
  this.results_showing = false;
131
  this.result_highlighted = null;
132
+ this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
133
  this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
134
  this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
  this.disable_search = this.options.disable_search || false;
141
  this.inherit_select_classes = this.options.inherit_select_classes || false;
142
  this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
143
  this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
144
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
145
+ this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
146
+ this.case_sensitive_search = this.options.case_sensitive_search || false;
147
+ return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
148
  };
149
 
150
  AbstractChosen.prototype.set_default_text = function() {
155
  } else {
156
  this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
157
  }
158
+ this.default_text = this.escape_html(this.default_text);
159
  return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
160
  };
161
 
176
  };
177
 
178
  AbstractChosen.prototype.input_focus = function(evt) {
 
179
  if (this.is_multiple) {
180
  if (!this.active_field) {
181
+ return setTimeout(((function(_this) {
182
+ return function() {
183
+ return _this.container_mousedown();
184
+ };
185
+ })(this)), 50);
186
  }
187
  } else {
188
  if (!this.active_field) {
192
  };
193
 
194
  AbstractChosen.prototype.input_blur = function(evt) {
 
195
  if (!this.mouse_on_container) {
196
  this.active_field = false;
197
+ return setTimeout(((function(_this) {
198
+ return function() {
199
+ return _this.blur_test();
200
+ };
201
+ })(this)), 100);
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.label_click_handler = function(evt) {
206
+ if (this.is_multiple) {
207
+ return this.container_mousedown(evt);
208
+ } else {
209
+ return this.activate_field();
210
  }
211
  };
212
 
213
  AbstractChosen.prototype.results_option_build = function(options) {
214
+ var content, data, data_content, i, len, ref, shown_results;
215
  content = '';
216
+ shown_results = 0;
217
+ ref = this.results_data;
218
+ for (i = 0, len = ref.length; i < len; i++) {
219
+ data = ref[i];
220
+ data_content = '';
221
  if (data.group) {
222
+ data_content = this.result_add_group(data);
223
  } else {
224
+ data_content = this.result_add_option(data);
225
+ }
226
+ if (data_content !== '') {
227
+ shown_results++;
228
+ content += data_content;
229
  }
230
  if (options != null ? options.first : void 0) {
231
  if (data.selected && this.is_multiple) {
234
  this.single_set_selected_text(this.choice_label(data));
235
  }
236
  }
237
+ if (shown_results >= this.max_shown_results) {
238
+ break;
239
+ }
240
  }
241
  return content;
242
  };
269
  option_el.className = classes.join(" ");
270
  option_el.style.cssText = option.style;
271
  option_el.setAttribute("data-option-array-index", option.array_index);
272
+ option_el.innerHTML = option.highlighted_html || option.html;
273
  if (option.title) {
274
  option_el.title = option.title;
275
  }
291
  }
292
  group_el = document.createElement("li");
293
  group_el.className = classes.join(" ");
294
+ group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
295
  if (group.title) {
296
  group_el.title = group.title;
297
  }
311
  };
312
 
313
  AbstractChosen.prototype.reset_single_select_options = function() {
314
+ var i, len, ref, result, results1;
315
+ ref = this.results_data;
316
+ results1 = [];
317
+ for (i = 0, len = ref.length; i < len; i++) {
318
+ result = ref[i];
319
  if (result.selected) {
320
+ results1.push(result.selected = false);
321
  } else {
322
+ results1.push(void 0);
323
  }
324
  }
325
+ return results1;
326
  };
327
 
328
  AbstractChosen.prototype.results_toggle = function() {
342
  };
343
 
344
  AbstractChosen.prototype.winnow_results = function() {
345
+ var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
346
  this.no_results_clear();
347
  results = 0;
348
+ query = this.get_search_text();
349
+ escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
350
+ regex = this.get_search_regex(escapedQuery);
351
+ ref = this.results_data;
352
+ for (i = 0, len = ref.length; i < len; i++) {
353
+ option = ref[i];
 
354
  option.search_match = false;
355
  results_group = null;
356
+ search_match = null;
357
+ option.highlighted_html = '';
358
  if (this.include_option_in_results(option)) {
359
  if (option.group) {
360
  option.group_match = false;
367
  }
368
  results_group.active_options += 1;
369
  }
370
+ text = option.group ? option.label : option.text;
371
  if (!(option.group && !this.group_search)) {
372
+ search_match = this.search_string_match(text, regex);
373
+ option.search_match = search_match != null;
374
  if (option.search_match && !option.group) {
375
  results += 1;
376
  }
377
  if (option.search_match) {
378
+ if (query.length) {
379
+ startpos = search_match.index;
380
+ prefix = text.slice(0, startpos);
381
+ fix = text.slice(startpos, startpos + query.length);
382
+ suffix = text.slice(startpos + query.length);
383
+ option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
384
  }
385
  if (results_group != null) {
386
  results_group.group_match = true;
392
  }
393
  }
394
  this.result_clear_highlight();
395
+ if (results < 1 && query.length) {
396
  this.update_results_content("");
397
+ return this.no_results(query);
398
  } else {
399
  this.update_results_content(this.results_option_build());
400
  return this.winnow_results_set_highlight();
402
  };
403
 
404
  AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
405
+ var regex_flag, regex_string;
406
+ regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
407
+ if (!(this.enable_split_word_search || this.search_contains)) {
408
+ regex_string = "^" + regex_string;
409
+ }
410
+ regex_flag = this.case_sensitive_search ? "" : "i";
411
+ return new RegExp(regex_string, regex_flag);
412
  };
413
 
414
  AbstractChosen.prototype.search_string_match = function(search_string, regex) {
415
+ var match;
416
+ match = regex.exec(search_string);
417
+ if (!this.search_contains && (match != null ? match[1] : void 0)) {
418
+ match.index += 1;
 
 
 
 
 
 
 
 
 
419
  }
420
+ return match;
421
  };
422
 
423
  AbstractChosen.prototype.choices_count = function() {
424
+ var i, len, option, ref;
425
  if (this.selected_option_count != null) {
426
  return this.selected_option_count;
427
  }
428
  this.selected_option_count = 0;
429
+ ref = this.form_field.options;
430
+ for (i = 0, len = ref.length; i < len; i++) {
431
+ option = ref[i];
432
  if (option.selected) {
433
  this.selected_option_count += 1;
434
  }
438
 
439
  AbstractChosen.prototype.choices_click = function(evt) {
440
  evt.preventDefault();
441
+ this.activate_field();
442
  if (!(this.results_showing || this.is_disabled)) {
443
  return this.results_show();
444
  }
445
  };
446
 
447
+ AbstractChosen.prototype.keydown_checker = function(evt) {
448
+ var ref, stroke;
449
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
450
+ this.search_field_scale();
451
+ if (stroke !== 8 && this.pending_backstroke) {
452
+ this.clear_backstroke();
453
+ }
454
+ switch (stroke) {
455
+ case 8:
456
+ this.backstroke_length = this.get_search_field_value().length;
457
+ break;
458
+ case 9:
459
+ if (this.results_showing && !this.is_multiple) {
460
+ this.result_select(evt);
461
+ }
462
+ this.mouse_on_container = false;
463
+ break;
464
+ case 13:
465
+ if (this.results_showing) {
466
+ evt.preventDefault();
467
+ }
468
+ break;
469
+ case 27:
470
+ if (this.results_showing) {
471
+ evt.preventDefault();
472
+ }
473
+ break;
474
+ case 32:
475
+ if (this.disable_search) {
476
+ evt.preventDefault();
477
+ }
478
+ break;
479
+ case 38:
480
+ evt.preventDefault();
481
+ this.keyup_arrow();
482
+ break;
483
+ case 40:
484
+ evt.preventDefault();
485
+ this.keydown_arrow();
486
+ break;
487
+ }
488
+ };
489
+
490
  AbstractChosen.prototype.keyup_checker = function(evt) {
491
+ var ref, stroke;
492
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
493
  this.search_field_scale();
494
  switch (stroke) {
495
  case 8:
496
  if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
497
+ this.keydown_backstroke();
498
  } else if (!this.pending_backstroke) {
499
  this.result_clear_highlight();
500
+ this.results_search();
501
  }
502
  break;
503
  case 13:
504
  evt.preventDefault();
505
  if (this.results_showing) {
506
+ this.result_select(evt);
507
  }
508
  break;
509
  case 27:
510
  if (this.results_showing) {
511
  this.results_hide();
512
  }
513
+ break;
514
  case 9:
515
+ case 16:
516
+ case 17:
517
+ case 18:
518
  case 38:
519
  case 40:
 
520
  case 91:
 
521
  break;
522
  default:
523
+ this.results_search();
524
+ break;
525
  }
526
  };
527
 
528
  AbstractChosen.prototype.clipboard_event_checker = function(evt) {
529
+ if (this.is_disabled) {
530
+ return;
531
+ }
532
+ return setTimeout(((function(_this) {
533
+ return function() {
534
+ return _this.results_search();
535
+ };
536
+ })(this)), 50);
537
  };
538
 
539
  AbstractChosen.prototype.container_width = function() {
540
  if (this.options.width != null) {
541
  return this.options.width;
542
  } else {
543
+ return this.form_field.offsetWidth + "px";
544
  }
545
  };
546
 
583
  return tmp.innerHTML;
584
  };
585
 
586
+ AbstractChosen.prototype.get_single_html = function() {
587
+ return "<a class=\"chosen-single chosen-default\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n <span>" + this.default_text + "</span>\n <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n <div class=\"chosen-search\">\n </div>\n <ul class=\"chosen-results\"></ul>\n</div>";
588
+ };
589
+
590
+ AbstractChosen.prototype.get_multi_html = function() {
591
+ return "<ul class=\"chosen-choices\">\n <li class=\"search-field\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n </li>\n</ul>\n<div class=\"chosen-drop\">\n <ul class=\"chosen-results\"></ul>\n</div>";
592
+ };
593
+
594
+ AbstractChosen.prototype.get_no_results_html = function(terms) {
595
+ return "<li class=\"no-results\">\n " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
596
+ };
597
+
598
  AbstractChosen.browser_is_supported = function() {
599
+ if ("Microsoft Internet Explorer" === window.navigator.appName) {
600
  return document.documentMode >= 8;
601
  }
602
+ if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
603
  return false;
604
  }
 
 
 
 
 
605
  return true;
606
  };
607
 
615
 
616
  })();
617
 
618
+ this.Chosen = (function(superClass) {
619
+ var triggerHtmlEvent;
620
+
621
+ extend(Chosen, superClass);
622
 
623
  function Chosen() {
624
+ return Chosen.__super__.constructor.apply(this, arguments);
 
625
  }
626
 
627
  Chosen.prototype.setup = function() {
628
+ return this.current_selectedIndex = this.form_field.selectedIndex;
 
 
 
 
 
 
 
 
629
  };
630
 
631
  Chosen.prototype.set_up_html = function() {
640
  }
641
  container_props = {
642
  'class': container_classes.join(' '),
 
643
  'title': this.form_field.title
644
  };
645
  if (this.form_field.id.length) {
646
  container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
647
  }
648
+ this.container = new Element('div', container_props);
649
+ this.container.setStyle({
650
+ width: this.container_width()
651
+ });
652
+ if (this.is_multiple) {
653
+ this.container.update(this.get_multi_html());
654
+ } else {
655
+ this.container.update(this.get_single_html());
656
+ }
657
  this.form_field.hide().insert({
658
  after: this.container
659
  });
681
  };
682
 
683
  Chosen.prototype.register_observers = function() {
684
+ this.container.observe("touchstart", (function(_this) {
685
+ return function(evt) {
686
+ return _this.container_mousedown(evt);
687
+ };
688
+ })(this));
689
+ this.container.observe("touchend", (function(_this) {
690
+ return function(evt) {
691
+ return _this.container_mouseup(evt);
692
+ };
693
+ })(this));
694
+ this.container.observe("mousedown", (function(_this) {
695
+ return function(evt) {
696
+ return _this.container_mousedown(evt);
697
+ };
698
+ })(this));
699
+ this.container.observe("mouseup", (function(_this) {
700
+ return function(evt) {
701
+ return _this.container_mouseup(evt);
702
+ };
703
+ })(this));
704
+ this.container.observe("mouseenter", (function(_this) {
705
+ return function(evt) {
706
+ return _this.mouse_enter(evt);
707
+ };
708
+ })(this));
709
+ this.container.observe("mouseleave", (function(_this) {
710
+ return function(evt) {
711
+ return _this.mouse_leave(evt);
712
+ };
713
+ })(this));
714
+ this.search_results.observe("mouseup", (function(_this) {
715
+ return function(evt) {
716
+ return _this.search_results_mouseup(evt);
717
+ };
718
+ })(this));
719
+ this.search_results.observe("mouseover", (function(_this) {
720
+ return function(evt) {
721
+ return _this.search_results_mouseover(evt);
722
+ };
723
+ })(this));
724
+ this.search_results.observe("mouseout", (function(_this) {
725
+ return function(evt) {
726
+ return _this.search_results_mouseout(evt);
727
+ };
728
+ })(this));
729
+ this.search_results.observe("mousewheel", (function(_this) {
730
+ return function(evt) {
731
+ return _this.search_results_mousewheel(evt);
732
+ };
733
+ })(this));
734
+ this.search_results.observe("DOMMouseScroll", (function(_this) {
735
+ return function(evt) {
736
+ return _this.search_results_mousewheel(evt);
737
+ };
738
+ })(this));
739
+ this.search_results.observe("touchstart", (function(_this) {
740
+ return function(evt) {
741
+ return _this.search_results_touchstart(evt);
742
+ };
743
+ })(this));
744
+ this.search_results.observe("touchmove", (function(_this) {
745
+ return function(evt) {
746
+ return _this.search_results_touchmove(evt);
747
+ };
748
+ })(this));
749
+ this.search_results.observe("touchend", (function(_this) {
750
+ return function(evt) {
751
+ return _this.search_results_touchend(evt);
752
+ };
753
+ })(this));
754
+ this.form_field.observe("chosen:updated", (function(_this) {
755
+ return function(evt) {
756
+ return _this.results_update_field(evt);
757
+ };
758
+ })(this));
759
+ this.form_field.observe("chosen:activate", (function(_this) {
760
+ return function(evt) {
761
+ return _this.activate_field(evt);
762
+ };
763
+ })(this));
764
+ this.form_field.observe("chosen:open", (function(_this) {
765
+ return function(evt) {
766
+ return _this.container_mousedown(evt);
767
+ };
768
+ })(this));
769
+ this.form_field.observe("chosen:close", (function(_this) {
770
+ return function(evt) {
771
+ return _this.close_field(evt);
772
+ };
773
+ })(this));
774
+ this.search_field.observe("blur", (function(_this) {
775
+ return function(evt) {
776
+ return _this.input_blur(evt);
777
+ };
778
+ })(this));
779
+ this.search_field.observe("keyup", (function(_this) {
780
+ return function(evt) {
781
+ return _this.keyup_checker(evt);
782
+ };
783
+ })(this));
784
+ this.search_field.observe("keydown", (function(_this) {
785
+ return function(evt) {
786
+ return _this.keydown_checker(evt);
787
+ };
788
+ })(this));
789
+ this.search_field.observe("focus", (function(_this) {
790
+ return function(evt) {
791
+ return _this.input_focus(evt);
792
+ };
793
+ })(this));
794
+ this.search_field.observe("cut", (function(_this) {
795
+ return function(evt) {
796
+ return _this.clipboard_event_checker(evt);
797
+ };
798
+ })(this));
799
+ this.search_field.observe("paste", (function(_this) {
800
+ return function(evt) {
801
+ return _this.clipboard_event_checker(evt);
802
+ };
803
+ })(this));
804
  if (this.is_multiple) {
805
+ return this.search_choices.observe("click", (function(_this) {
806
+ return function(evt) {
807
+ return _this.choices_click(evt);
808
+ };
809
+ })(this));
810
  } else {
811
+ return this.container.observe("click", (function(_this) {
812
+ return function(evt) {
813
+ return evt.preventDefault();
814
+ };
815
+ })(this));
816
  }
817
  };
818
 
819
  Chosen.prototype.destroy = function() {
820
+ var event, i, len, ref;
821
  this.container.ownerDocument.stopObserving("click", this.click_test_action);
822
+ ref = ['chosen:updated', 'chosen:activate', 'chosen:open', 'chosen:close'];
823
+ for (i = 0, len = ref.length; i < len; i++) {
824
+ event = ref[i];
825
+ this.form_field.stopObserving(event);
826
+ }
827
  this.container.stopObserving();
828
  this.search_results.stopObserving();
829
  this.search_field.stopObserving();
846
  };
847
 
848
  Chosen.prototype.search_field_disabled = function() {
849
+ var ref;
850
+ this.is_disabled = this.form_field.disabled || ((ref = this.form_field.up('fieldset')) != null ? ref.disabled : void 0) || false;
851
  if (this.is_disabled) {
852
  this.container.addClassName('chosen-disabled');
 
 
 
 
 
853
  } else {
854
  this.container.removeClassName('chosen-disabled');
855
+ }
856
+ this.search_field.disabled = this.is_disabled;
857
+ if (!this.is_multiple) {
858
+ this.selected_item.stopObserving('focus', this.activate_field);
859
+ }
860
+ if (this.is_disabled) {
861
+ return this.close_field();
862
+ } else if (!this.is_multiple) {
863
+ return this.selected_item.observe('focus', this.activate_field);
864
  }
865
  };
866
 
867
  Chosen.prototype.container_mousedown = function(evt) {
868
+ var ref;
869
+ if (this.is_disabled) {
870
+ return;
871
+ }
872
+ if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
873
+ evt.preventDefault();
874
+ }
875
+ if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
876
+ if (!this.active_field) {
877
+ if (this.is_multiple) {
878
+ this.search_field.clear();
 
 
879
  }
880
+ this.container.ownerDocument.observe("click", this.click_test_action);
881
+ this.results_show();
882
+ } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
883
+ this.results_toggle();
884
  }
885
+ return this.activate_field();
886
  }
887
  };
888
 
917
  this.container.removeClassName("chosen-container-active");
918
  this.clear_backstroke();
919
  this.show_search_field_default();
920
+ this.search_field_scale();
921
+ return this.search_field.blur();
922
  };
923
 
924
  Chosen.prototype.activate_field = function() {
925
+ if (this.is_disabled) {
926
+ return;
927
+ }
928
  this.container.addClassName("chosen-container-active");
929
  this.active_field = true;
930
+ this.search_field.value = this.get_search_field_value();
931
  return this.search_field.focus();
932
  };
933
 
995
  });
996
  return false;
997
  }
998
+ if (!this.is_multiple) {
999
+ this.search_container.insert(this.search_field);
1000
+ }
1001
  this.container.addClassName("chosen-with-drop");
1002
  this.results_showing = true;
1003
  this.search_field.focus();
1004
+ this.search_field.value = this.get_search_field_value();
1005
  this.winnow_results();
1006
  return this.form_field.fire("chosen:showing_dropdown", {
1007
  chosen: this
1015
  Chosen.prototype.results_hide = function() {
1016
  if (this.results_showing) {
1017
  this.result_clear_highlight();
1018
+ if (!this.is_multiple) {
1019
+ this.selected_item.insert({
1020
+ top: this.search_field
1021
+ });
1022
+ this.search_field.focus();
1023
+ }
1024
  this.container.removeClassName("chosen-with-drop");
1025
  this.form_field.fire("chosen:hiding_dropdown", {
1026
  chosen: this
1039
  };
1040
 
1041
  Chosen.prototype.set_label_behavior = function() {
 
1042
  this.form_field_label = this.form_field.up("label");
1043
  if (this.form_field_label == null) {
1044
  this.form_field_label = $$("label[for='" + this.form_field.id + "']").first();
1045
  }
1046
  if (this.form_field_label != null) {
1047
+ return this.form_field_label.observe("click", this.label_click_handler);
 
 
 
 
 
 
1048
  }
1049
  };
1050
 
1083
  };
1084
 
1085
  Chosen.prototype.choice_build = function(item) {
1086
+ var choice, close_link;
 
1087
  choice = new Element('li', {
1088
  "class": "search-choice"
1089
  }).update("<span>" + (this.choice_label(item)) + "</span>");
1095
  "class": 'search-choice-close',
1096
  rel: item.array_index
1097
  });
1098
+ close_link.observe("click", (function(_this) {
1099
+ return function(evt) {
1100
+ return _this.choice_destroy_link_click(evt);
1101
+ };
1102
+ })(this));
1103
  choice.insert(close_link);
1104
  }
1105
  return this.search_container.insert({
1117
 
1118
  Chosen.prototype.choice_destroy = function(link) {
1119
  if (this.result_deselect(link.readAttribute("rel"))) {
1120
+ if (this.active_field) {
1121
+ this.search_field.focus();
1122
+ } else {
1123
+ this.show_search_field_default();
1124
+ }
1125
+ if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
1126
  this.results_hide();
1127
  }
1128
  link.up('li').remove();
1136
  this.single_set_selected_text();
1137
  this.show_search_field_default();
1138
  this.results_reset_cleanup();
1139
+ this.trigger_form_field_change();
 
 
1140
  if (this.active_field) {
1141
  return this.results_hide();
1142
  }
1172
  item.selected = true;
1173
  this.form_field.options[item.options_index].selected = true;
1174
  this.selected_option_count = null;
1175
+ this.search_field.value = "";
1176
  if (this.is_multiple) {
1177
  this.choice_build(item);
1178
  } else {
1179
  this.single_set_selected_text(this.choice_label(item));
1180
  }
1181
+ if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
1182
+ this.winnow_results();
1183
+ } else {
1184
  this.results_hide();
1185
+ this.show_search_field_default();
1186
  }
1187
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1188
+ this.trigger_form_field_change();
 
1189
  }
1190
  this.current_selectedIndex = this.form_field.selectedIndex;
1191
  evt.preventDefault();
1217
  if (this.results_showing) {
1218
  this.winnow_results();
1219
  }
1220
+ this.trigger_form_field_change();
 
 
1221
  this.search_field_scale();
1222
  return true;
1223
  } else {
1237
  return this.selected_item.addClassName("chosen-single-with-deselect");
1238
  };
1239
 
1240
+ Chosen.prototype.get_search_field_value = function() {
1241
+ return this.search_field.value;
1242
+ };
1243
+
1244
  Chosen.prototype.get_search_text = function() {
1245
+ return this.get_search_field_value().strip();
1246
+ };
1247
+
1248
+ Chosen.prototype.escape_html = function(text) {
1249
+ return text.escapeHTML();
1250
  };
1251
 
1252
  Chosen.prototype.winnow_results_set_highlight = function() {
1263
  };
1264
 
1265
  Chosen.prototype.no_results = function(terms) {
1266
+ this.search_results.insert(this.get_no_results_html(terms));
 
 
1267
  return this.form_field.fire("chosen:no_results", {
1268
  chosen: this
1269
  });
1270
  };
1271
 
1272
  Chosen.prototype.no_results_clear = function() {
1273
+ var nr, results1;
1274
  nr = null;
1275
+ results1 = [];
1276
  while (nr = this.search_results.down(".no-results")) {
1277
+ results1.push(nr.remove());
1278
  }
1279
+ return results1;
1280
  };
1281
 
1282
  Chosen.prototype.keydown_arrow = function() {
1338
  return this.pending_backstroke = null;
1339
  };
1340
 
1341
+ Chosen.prototype.search_field_scale = function() {
1342
+ var container_width, div, i, len, style, style_block, styles, width;
1343
+ if (!this.is_multiple) {
1344
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1345
  }
1346
+ style_block = {
1347
+ position: 'absolute',
1348
+ left: '-1000px',
1349
+ top: '-1000px',
1350
+ display: 'none',
1351
+ whiteSpace: 'pre'
1352
+ };
1353
+ styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
1354
+ for (i = 0, len = styles.length; i < len; i++) {
1355
+ style = styles[i];
1356
+ style_block[style] = this.search_field.getStyle(style);
1357
+ }
1358
+ div = new Element('div').update(this.escape_html(this.get_search_field_value()));
1359
+ div.setStyle(style_block);
1360
+ document.body.appendChild(div);
1361
+ width = div.measure('width') + 25;
1362
+ div.remove();
1363
+ if (container_width = this.container.getWidth()) {
1364
+ width = Math.min(container_width - 10, width);
1365
+ }
1366
+ return this.search_field.setStyle({
1367
+ width: width + 'px'
1368
+ });
1369
  };
1370
 
1371
+ Chosen.prototype.trigger_form_field_change = function() {
1372
+ triggerHtmlEvent(this.form_field, 'input');
1373
+ return triggerHtmlEvent(this.form_field, 'change');
1374
+ };
1375
+
1376
+ triggerHtmlEvent = function(element, eventType) {
1377
+ var error, evt;
1378
+ if (element.dispatchEvent) {
1379
+ try {
1380
+ evt = new Event(eventType, {
1381
+ bubbles: true,
1382
+ cancelable: true
1383
+ });
1384
+ } catch (error) {
1385
+ evt = document.createEvent('HTMLEvents');
1386
+ evt.initEvent(eventType, true, true);
 
 
 
 
1387
  }
1388
+ return element.dispatchEvent(evt);
1389
+ } else {
1390
+ return element.fireEvent("on" + eventType, document.createEventObject());
1391
  }
1392
  };
1393
 
assets/lib/chosen/chosen.proto.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /* Chosen v1.8.3 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+
3
+ (function(){var e,t,s=function(e,t){return function(){return e.apply(t,arguments)}},i=function(e,t){function s(){this.constructor=e}for(var i in t)r.call(t,i)&&(e[i]=t[i]);return s.prototype=t.prototype,e.prototype=new s,e.__super__=t.prototype,e},r={}.hasOwnProperty;(t=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,s,i,r,n,o;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,title:e.title?e.title:void 0,children:0,disabled:e.disabled,classes:e.className}),o=[],s=0,i=(n=e.childNodes).length;s<i;s++)r=n[s],o.push(this.add_option(r,t,e.disabled));return o},e.prototype.add_option=function(e,t,s){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,title:e.title?e.title:void 0,selected:e.selected,disabled:!0===s?s:e.disabled,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}()).select_to_array=function(e){var s,i,r,n,o;for(n=new t,i=0,r=(o=e.childNodes).length;i<r;i++)s=o[i],n.add_node(s);return n.parsed},e=function(){function e(t,i){this.form_field=t,this.options=null!=i?i:{},this.label_click_handler=s(this.label_click_handler,this),e.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return e.prototype.set_default_values=function(){return this.click_test_action=function(e){return function(t){return e.test_active_click(t)}}(this),this.activate_action=function(e){return function(t){return e.activate_field(t)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||e.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||e.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text},e.prototype.choice_label=function(e){return this.include_group_label_in_selected&&null!=e.group_label?"<b class='group-name'>"+e.group_label+"</b>"+e.html:e.html},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){if(this.is_multiple){if(!this.active_field)return setTimeout(function(e){return function(){return e.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(e){return function(){return e.blur_test()}}(this),100)},e.prototype.label_click_handler=function(e){return this.is_multiple?this.container_mousedown(e):this.activate_field()},e.prototype.results_option_build=function(e){var t,s,i,r,n,o,l;for(t="",l=0,r=0,n=(o=this.results_data).length;r<n&&(s=o[r],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(l++,t+=i),(null!=e?e.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(l>=this.max_shown_results));r++);return t},e.prototype.result_add_option=function(e){var t,s;return e.search_match&&this.include_option_in_results(e)?(t=[],e.disabled||e.selected&&this.is_multiple||t.push("active-result"),!e.disabled||e.selected&&this.is_multiple||t.push("disabled-result"),e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.push(e.classes),s=document.createElement("li"),s.className=t.join(" "),s.style.cssText=e.style,s.setAttribute("data-option-array-index",e.array_index),s.innerHTML=e.highlighted_html||e.html,e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.result_add_group=function(e){var t,s;return(e.search_match||e.group_match)&&e.active_options>0?((t=[]).push("group-result"),e.classes&&t.push(e.classes),s=document.createElement("li"),s.className=t.join(" "),s.innerHTML=e.highlighted_html||this.escape_html(e.label),e.title&&(s.title=e.title),this.outerHTML(s)):""},e.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},e.prototype.reset_single_select_options=function(){var e,t,s,i,r;for(r=[],e=0,t=(s=this.results_data).length;e<t;e++)(i=s[e]).selected?r.push(i.selected=!1):r.push(void 0);return r},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.winnow_results=function(){var e,t,s,i,r,n,o,l,h,c,a,_,u,d,p;for(this.no_results_clear(),c=0,e=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),h=this.get_search_regex(e),s=0,i=(l=this.results_data).length;s<i;s++)(r=l[s]).search_match=!1,a=null,_=null,r.highlighted_html="",this.include_option_in_results(r)&&(r.group&&(r.group_match=!1,r.active_options=0),null!=r.group_array_index&&this.results_data[r.group_array_index]&&(0===(a=this.results_data[r.group_array_index]).active_options&&a.search_match&&(c+=1),a.active_options+=1),p=r.group?r.label:r.text,r.group&&!this.group_search||(_=this.search_string_match(p,h),r.search_match=null!=_,r.search_match&&!r.group&&(c+=1),r.search_match?(o.length&&(u=_.index,n=p.slice(0,u),t=p.slice(u,u+o.length),d=p.slice(u+o.length),r.highlighted_html=this.escape_html(n)+"<em>"+this.escape_html(t)+"</em>"+this.escape_html(d)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},e.prototype.get_search_regex=function(e){var t,s;return s=this.search_contains?e:"(^|\\s|\\b)"+e+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),t=this.case_sensitive_search?"":"i",new RegExp(s,t)},e.prototype.search_string_match=function(e,t){var s;return s=t.exec(e),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},e.prototype.choices_count=function(){var e,t,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,e=0,t=(s=this.form_field.options).length;e<t;e++)s[e].selected&&(this.selected_option_count+=1);return this.selected_option_count},e.prototype.choices_click=function(e){if(e.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},e.prototype.keydown_checker=function(e){var t,s;switch(s=null!=(t=e.which)?t:e.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&e.preventDefault();break;case 32:this.disable_search&&e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}},e.prototype.keyup_checker=function(e){var t,s;switch(s=null!=(t=e.which)?t:e.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:e.preventDefault(),this.results_showing&&this.result_select(e);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},e.prototype.clipboard_event_checker=function(e){if(!this.is_disabled)return setTimeout(function(e){return function(){return e.results_search()}}(this),50)},e.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},e.prototype.include_option_in_results=function(e){return!(this.is_multiple&&!this.display_selected_options&&e.selected)&&(!(!this.display_disabled_options&&e.disabled)&&!e.empty)},e.prototype.search_results_touchstart=function(e){return this.touch_started=!0,this.search_results_mouseover(e)},e.prototype.search_results_touchmove=function(e){return this.touch_started=!1,this.search_results_mouseout(e)},e.prototype.search_results_touchend=function(e){if(this.touch_started)return this.search_results_mouseup(e)},e.prototype.outerHTML=function(e){var t;return e.outerHTML?e.outerHTML:((t=document.createElement("div")).appendChild(e),t.innerHTML)},e.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n </div>\n <ul class="chosen-results"></ul>\n</div>'},e.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},e.prototype.get_no_results_html=function(e){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(e)+"</span>\n</li>"},e.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},e.default_multiple_text="Select Some Options",e.default_single_text="Select an Option",e.default_no_result_text="No results match",e}(),this.Chosen=function(s){function r(){return r.__super__.constructor.apply(this,arguments)}var n;return i(r,e),r.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex},r.prototype.set_up_html=function(){var e,t;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),t={class:e.join(" "),title:this.form_field.title},this.form_field.id.length&&(t.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=new Element("div",t),this.container.setStyle({width:this.container_width()}),this.is_multiple?this.container.update(this.get_multi_html()):this.container.update(this.get_single_html()),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},r.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},r.prototype.register_observers=function(){return this.container.observe("touchstart",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.container.observe("touchend",function(e){return function(t){return e.container_mouseup(t)}}(this)),this.container.observe("mousedown",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.container.observe("mouseup",function(e){return function(t){return e.container_mouseup(t)}}(this)),this.container.observe("mouseenter",function(e){return function(t){return e.mouse_enter(t)}}(this)),this.container.observe("mouseleave",function(e){return function(t){return e.mouse_leave(t)}}(this)),this.search_results.observe("mouseup",function(e){return function(t){return e.search_results_mouseup(t)}}(this)),this.search_results.observe("mouseover",function(e){return function(t){return e.search_results_mouseover(t)}}(this)),this.search_results.observe("mouseout",function(e){return function(t){return e.search_results_mouseout(t)}}(this)),this.search_results.observe("mousewheel",function(e){return function(t){return e.search_results_mousewheel(t)}}(this)),this.search_results.observe("DOMMouseScroll",function(e){return function(t){return e.search_results_mousewheel(t)}}(this)),this.search_results.observe("touchstart",function(e){return function(t){return e.search_results_touchstart(t)}}(this)),this.search_results.observe("touchmove",function(e){return function(t){return e.search_results_touchmove(t)}}(this)),this.search_results.observe("touchend",function(e){return function(t){return e.search_results_touchend(t)}}(this)),this.form_field.observe("chosen:updated",function(e){return function(t){return e.results_update_field(t)}}(this)),this.form_field.observe("chosen:activate",function(e){return function(t){return e.activate_field(t)}}(this)),this.form_field.observe("chosen:open",function(e){return function(t){return e.container_mousedown(t)}}(this)),this.form_field.observe("chosen:close",function(e){return function(t){return e.close_field(t)}}(this)),this.search_field.observe("blur",function(e){return function(t){return e.input_blur(t)}}(this)),this.search_field.observe("keyup",function(e){return function(t){return e.keyup_checker(t)}}(this)),this.search_field.observe("keydown",function(e){return function(t){return e.keydown_checker(t)}}(this)),this.search_field.observe("focus",function(e){return function(t){return e.input_focus(t)}}(this)),this.search_field.observe("cut",function(e){return function(t){return e.clipboard_event_checker(t)}}(this)),this.search_field.observe("paste",function(e){return function(t){return e.clipboard_event_checker(t)}}(this)),this.is_multiple?this.search_choices.observe("click",function(e){return function(t){return e.choices_click(t)}}(this)):this.container.observe("click",function(e){return e.preventDefault()})},r.prototype.destroy=function(){var e,t,s,i;for(this.container.ownerDocument.stopObserving("click",this.click_test_action),t=0,s=(i=["chosen:updated","chosen:activate","chosen:open","chosen:close"]).length;t<s;t++)e=i[t],this.form_field.stopObserving(e);return this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(e){return e.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},r.prototype.search_field_disabled=function(){var e;return this.is_disabled=this.form_field.disabled||(null!=(e=this.form_field.up("fieldset"))?e.disabled:void 0)||!1,this.is_disabled?this.container.addClassName("chosen-disabled"):this.container.removeClassName("chosen-disabled"),this.search_field.disabled=this.is_disabled,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_field)},r.prototype.container_mousedown=function(e){var t;if(!this.is_disabled)return!e||"mousedown"!==(t=e.type)&&"touchstart"!==t||this.results_showing||e.preventDefault(),null!=e&&e.target.hasClassName("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||e.target!==this.selected_item&&!e.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},r.prototype.container_mouseup=function(e){if("ABBR"===e.target.nodeName&&!this.is_disabled)return this.results_reset(e)},r.prototype.search_results_mousewheel=function(e){var t;if(null!=(t=e.deltaY||-e.wheelDelta||e.detail))return e.preventDefault(),"DOMMouseScroll"===e.type&&(t*=40),this.search_results.scrollTop=t+this.search_results.scrollTop},r.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClassName("chosen-container-active"))return this.close_field()},r.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},r.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.get_search_field_value(),this.search_field.focus()},r.prototype.test_active_click=function(e){return e.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},r.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=t.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},r.prototype.result_do_highlight=function(e){var t,s,i,r,n;return this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClassName("highlighted"),i=parseInt(this.search_results.getStyle("maxHeight"),10),n=this.search_results.scrollTop,r=i+n,s=this.result_highlight.positionedOffset().top,(t=s+this.result_highlight.getHeight())>=r?this.search_results.scrollTop=t-i>0?t-i:0:s<n?this.search_results.scrollTop=s:void 0},r.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},r.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple||this.search_container.insert(this.search_field),this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.get_search_field_value(),this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},r.prototype.update_results_content=function(e){return this.search_results.update(e)},r.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.is_multiple||(this.selected_item.insert({top:this.search_field}),this.search_field.focus()),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},r.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=t},r.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label)return this.form_field_label.observe("click",this.label_click_handler)},r.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},r.prototype.search_results_mouseup=function(e){var t;if(t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result"))return this.result_highlight=t,this.result_select(e),this.search_field.focus()},r.prototype.search_results_mouseover=function(e){var t;if(t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result"))return this.result_do_highlight(t)},r.prototype.search_results_mouseout=function(e){if(e.target.hasClassName("active-result")||e.target.up(".active-result"))return this.result_clear_highlight()},r.prototype.choice_build=function(e){var t,s;return t=new Element("li",{class:"search-choice"}).update("<span>"+this.choice_label(e)+"</span>"),e.disabled?t.addClassName("search-choice-disabled"):((s=new Element("a",{href:"#",class:"search-choice-close",rel:e.array_index})).observe("click",function(e){return function(t){return e.choice_destroy_link_click(t)}}(this)),t.insert(s)),this.search_container.insert({before:t})},r.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(e.target)},r.prototype.choice_destroy=function(e){if(this.result_deselect(e.readAttribute("rel")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),e.up("li").remove(),this.search_field_scale()},r.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},r.prototype.results_reset_cleanup=function(){var e;if(this.current_selectedIndex=this.form_field.selectedIndex,e=this.selected_item.down("abbr"))return e.remove()},r.prototype.result_select=function(e){var t,s;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?t.removeClassName("active-result"):this.reset_single_select_options(),t.addClassName("result-selected"),s=this.results_data[t.getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.value="",this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||e.metaKey||e.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change(),this.current_selectedIndex=this.form_field.selectedIndex,e.preventDefault(),this.search_field_scale())},r.prototype.single_set_selected_text=function(e){return null==e&&(e=this.default_text),e===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(e)},r.prototype.result_deselect=function(e){var t;return t=this.results_data[e],!this.form_field.options[t.options_index].disabled&&(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change(),this.search_field_scale(),!0)},r.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")},r.prototype.get_search_field_value=function(){return this.search_field.value},r.prototype.get_search_text=function(){return this.get_search_field_value().strip()},r.prototype.escape_html=function(e){return e.escapeHTML()},r.prototype.winnow_results_set_highlight=function(){var e;if(this.is_multiple||(e=this.search_results.down(".result-selected.active-result")),null==e&&(e=this.search_results.down(".active-result")),null!=e)return this.result_do_highlight(e)},r.prototype.no_results=function(e){return this.search_results.insert(this.get_no_results_html(e)),this.form_field.fire("chosen:no_results",{chosen:this})},r.prototype.no_results_clear=function(){var e,t;for(e=null,t=[];e=this.search_results.down(".no-results");)t.push(e.remove());return t},r.prototype.keydown_arrow=function(){var e;return this.results_showing&&this.result_highlight?(e=this.result_highlight.next(".active-result"))?this.result_do_highlight(e):void 0:this.results_show()},r.prototype.keyup_arrow=function(){var e,t,s;return this.results_showing||this.is_multiple?this.result_highlight?(s=this.result_highlight.previousSiblings(),e=this.search_results.select("li.active-result"),(t=s.intersect(e)).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},r.prototype.keydown_backstroke=function(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(e=this.search_container.siblings().last())&&e.hasClassName("search-choice")&&!e.hasClassName("search-choice-disabled")?(this.pending_backstroke=e,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0},r.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},r.prototype.search_field_scale=function(){var e,t,s,i,r,n,o,l;if(this.is_multiple){for(n={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)n[r=o[s]]=this.search_field.getStyle(r);return(t=new Element("div").update(this.escape_html(this.get_search_field_value()))).setStyle(n),document.body.appendChild(t),l=t.measure("width")+25,t.remove(),(e=this.container.getWidth())&&(l=Math.min(e-10,l)),this.search_field.setStyle({width:l+"px"})}},r.prototype.trigger_form_field_change=function(){return n(this.form_field,"input"),n(this.form_field,"change")},n=function(e,t){var s;if(e.dispatchEvent){try{s=new Event(t,{bubbles:!0,cancelable:!0})}catch(e){(s=document.createEvent("HTMLEvents")).initEvent(t,!0,!0)}return e.dispatchEvent(s)}return e.fireEvent("on"+t,document.createEventObject())},r}()}).call(this);
assets/lib/{chosen_v1.4.2 → chosen}/docsupport/chosen.png RENAMED
File without changes
assets/lib/chosen/docsupport/init.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ var config = {
2
+ '.chosen-select' : {},
3
+ '.chosen-select-deselect' : { allow_single_deselect: true },
4
+ '.chosen-select-no-single' : { disable_search_threshold: 10 },
5
+ '.chosen-select-no-results': { no_results_text: 'Oops, nothing found!' },
6
+ '.chosen-select-rtl' : { rtl: true },
7
+ '.chosen-select-width' : { width: '95%' }
8
+ }
9
+ for (var selector in config) {
10
+ $(selector).chosen(config[selector]);
11
+ }
assets/lib/chosen/docsupport/init.proto.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.observe('dom:loaded', function(evt) {
2
+ var config = {
3
+ '.chosen-select' : {},
4
+ '.chosen-select-deselect' : { allow_single_deselect: true },
5
+ '.chosen-select-no-single' : { disable_search_threshold: 10 },
6
+ '.chosen-select-no-results': { no_results_text: 'Oops, nothing found!' },
7
+ '.chosen-select-rtl' : { rtl: true },
8
+ '.chosen-select-width' : { width: '95%' }
9
+ }
10
+
11
+ for (var selector in config) {
12
+ $$(selector).each(function(element) {
13
+ new Chosen(element, config[selector]);
14
+ });
15
+ }
16
+ });
assets/lib/chosen/docsupport/jquery-1.12.4.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
2
+ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0;
3
+ }return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)Y(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|&#?\w+;/,ha=/<tbody/i;function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0;o>r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?"<table>"!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ma.test(f)?this.mouseHooks:la.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ra()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ra()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&("undefined"==typeof a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?pa:qa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:qa,isPropagationStopped:qa,isImmediatePropagationStopped:qa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=pa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=pa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=pa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){return ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ka.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!ka.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return sa(this,a,b,c,d)},one:function(a,b,c,d){return sa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=qa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ta=/ jQuery\d+="(?:null|\d+)"/g,ua=new RegExp("<(?:"+ba+")[\\s/>]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/<script|<style|<link/i,xa=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/^true\/(.*)/,za=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Aa=ca(d),Ba=Aa.appendChild(d.createElement("div"));function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Da(b).text=a.text,Ea(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Z.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&xa.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(o&&(k=ja(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(ea(k,"script"),Da),h=i.length;o>m;m++)g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,ea(g,"script"))),c.call(a[m],g,m);if(h)for(j=i[i.length-1].ownerDocument,n.map(i,Ea),m=0;h>m;m++)g=i[m],_.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(za,"")));k=e=null}return a}function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(ea(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&fa(ea(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(va,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Ba.innerHTML=a.outerHTML,Ba.removeChild(f=Ba.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=ea(f),h=ea(a),g=0;null!=(e=h[g]);++g)d[g]&&Ga(e,d[g]);if(b)if(c)for(h=h||ea(a),d=d||ea(f),g=0;null!=(e=h[g]);g++)Fa(e,d[g]);else Fa(a,f);return d=ea(f,"script"),d.length>0&&fa(d,!i&&ea(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++)if((b||M(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k||"undefined"==typeof d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}),n.fn.extend({domManip:Ha,detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return Y(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(ea(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return Y(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(ta,""):void 0;if("string"==typeof a&&!wa.test(a)&&(l.htmlSerialize||!ua.test(a))&&(l.leadingWhitespace||!aa.test(a))&&!da[($.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ea(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(ea(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get());return this.pushStack(e)}});var Ja,Ka={HTML:"block",BODY:"block"};function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(Ja||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ja[0].contentWindow||Ja[0].contentDocument).document,b.write(),b.close(),c=La(a,b),Ja.detach()),Ka[a]=c),c}var Na=/^margin/,Oa=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Pa=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Qa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");if(j.style){j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}});function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",f=0===k[0].offsetHeight,f&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}}}();var Ra,Sa,Ta=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Oa.test(g)&&Na.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0===g?g:g+""}):Qa.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Oa.test(g)&&!Ta.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Ua(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Va=/alpha\([^)]*\)/i,Wa=/opacity\s*=\s*([^)]*)/i,Xa=/^(none|table(?!-c[ea]).+)/,Ya=new RegExp("^("+T+")(.*)$","i"),Za={position:"absolute",visibility:"hidden",display:"block"},$a={letterSpacing:"0",fontWeight:"400"},_a=["Webkit","O","Moz","ms"],ab=d.createElement("div").style;function bb(a){if(a in ab)return a;var b=a.charAt(0).toUpperCase()+a.slice(1),c=_a.length;while(c--)if(a=_a[c]+b,a in ab)return a}function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&W(d)&&(f[g]=n._data(d,"olddisplay",Ma(d.nodeName)))):(e=W(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+V[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+V[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+V[f]+"Width",!0,e))):(g+=n.css(a,"padding"+V[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+V[f]+"Width",!0,e)));return g}function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Sa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Oa.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+eb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=U.exec(c))&&e[1]&&(c=X(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Sa(a,b,d)),"normal"===f&&b in $a&&(f=$a[b]),""===c||c?(e=parseFloat(f),c===!0||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Xa.test(n.css(a,"display"))&&0===a.offsetWidth?Pa(a,Za,function(){return fb(a,b,d)}):fb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return db(a,c,d?eb(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Wa.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Va,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Va.test(f)?f.replace(Va,e):f+" "+e)}}),n.cssHooks.marginRight=Ua(l.reliableMarginRight,function(a,b){return b?Pa(a,{display:"inline-block"},Sa,[a,"marginRight"]):void 0}),n.cssHooks.marginLeft=Ua(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Sa(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Pa(a,{
4
+ marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+V[d]+b]=f[d]||f[d-2]||f[0];return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(pb(k,j.opts.specialEasing);g>f;f++)if(d=qb.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,nb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(qb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return X(c.elem,a,U.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],qb.tweeners[c]=qb.tweeners[c]||[],qb.tweeners[c].unshift(b)},prefilters:[ob],prefilter:function(a,b){b?qb.prefilters.unshift(a):qb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(W).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=qb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&kb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(mb(b,!0),a,d,e)}}),n.each({slideDown:mb("show"),slideUp:mb("hide"),slideToggle:mb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(hb=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),hb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ib||(ib=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(ib),ib=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var rb=/\r/g,sb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(sb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var tb,ub,vb=n.expr.attrHandle,wb=/^(?:checked|selected)$/i,xb=l.getSetAttribute,yb=l.input;n.fn.extend({attr:function(a,b){return Y(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ub:tb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?yb&&xb||!wb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(xb?c:d)}}),ub={set:function(a,b,c){return b===!1?n.removeAttr(a,c):yb&&xb||!wb.test(c)?a.setAttribute(!xb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=vb[b]||n.find.attr;yb&&xb||!wb.test(b)?vb[b]=function(a,b,d){var e,f;return d||(f=vb[b],vb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,vb[b]=f),e}:vb[b]=function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),yb&&xb||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):tb&&tb.set(a,b,c)}}),xb||(tb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},vb.id=vb.name=vb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:tb.set},n.attrHooks.contenteditable={set:function(a,b,c){tb.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var zb=/^(?:input|select|textarea|button|object)$/i,Ab=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return Y(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):zb.test(a.nodeName)||Ab.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Bb=/[\t\r\n\f]/g;function Cb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,Cb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,Cb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Cb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=Cb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||a===!1?"":n._data(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+Cb(c)+" ").replace(Bb," ").indexOf(b)>-1)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Db=a.location,Eb=n.now(),Fb=/\?/,Gb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Gb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Hb=/#.*$/,Ib=/([?&])_=[^&]*/,Jb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Kb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lb=/^(?:GET|HEAD)$/,Mb=/^\/\//,Nb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ob={},Pb={},Qb="*/".concat("*"),Rb=Db.href,Sb=Nb.exec(Rb.toLowerCase())||[];function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rb,type:"GET",isLocal:Kb.test(Sb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Vb(Vb(a,n.ajaxSettings),b):Vb(n.ajaxSettings,a)},ajaxPrefilter:Tb(Ob),ajaxTransport:Tb(Pb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Jb.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return j&&j.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Rb)+"").replace(Hb,"").replace(Mb,Sb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(G)||[""],null==l.crossDomain&&(d=Nb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Sb[1]&&d[2]===Sb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Sb[3]||("http:"===Sb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Ub(Ob,l,c,w),2===u)return w;i=n.event&&l.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Lb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Fb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ib.test(f)?f.replace(Ib,"$1_="+Eb++):f+(Fb.test(f)?"&":"?")+"_="+Eb++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Qb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)w.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(e in{success:1,error:1,complete:1})w[e](l[e]);if(j=Ub(Pb,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&300>b||304===b,d&&(v=Wb(l,w,d)),v=Xb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),x=w.getResponseHeader("etag"),x&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Yb(a){return a.style&&a.style.display||n.css(a,"display")}function Zb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1===a.nodeType){if("none"===Yb(a)||"hidden"===a.type)return!0;a=a.parentNode}return!1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Zb(a)},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var $b=/%20/g,_b=/\[\]$/,ac=/\r?\n/g,bc=/^(?:submit|button|image|reset|file)$/i,cc=/^(?:input|select|textarea|keygen)/i;function dc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||_b.test(a)?d(a,e):dc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)dc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)dc(c,a[c],b,e);return d.join("&").replace($b,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&cc.test(this.nodeName)&&!bc.test(a)&&(this.checked||!Z.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(ac,"\r\n")}}):{name:b.name,value:c.replace(ac,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?ic():d.documentMode>8?hc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&hc()||ic()}:hc;var ec=0,fc={},gc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in fc)fc[a](void 0,!0)}),l.cors=!!gc&&"withCredentials"in gc,gc=l.ajax=!!gc,gc&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++ec;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(f in b.xhrFields)g[f]=b.xhrFields[f];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)void 0!==d[f]&&g.setRequestHeader(f,d[f]+"");g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState))if(delete fc[h],c=void 0,g.onreadystatechange=n.noop,d)4!==g.readyState&&g.abort();else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=fc[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function hc(){try{return new a.XMLHttpRequest}catch(b){}}function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var jc=[],kc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=jc.pop()||n.expando+"_"+Eb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(kc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&kc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(kc,"$1"+e):b.jsonp!==!1&&(b.url+=(Fb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,jc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ja([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var lc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&lc)return lc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?("undefined"!=typeof e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=mc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Qa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return Y(this,function(a,d,e){var f=mc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ua(l.pixelPosition,function(a,c){return c?(c=Sa(a,b),Oa.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({
5
+ padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});
assets/lib/chosen/docsupport/jquery-3.2.1.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
2
+ !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,N,e),g(f,c,O,e)):(f++,j.call(a,g(f,c,N,e),g(f,c,O,e),g(f,c,N,c.notifyWith))):(d!==N&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S),
3
+ a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Z,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")([a-z%]*)$","i"),ca=["Top","Right","Bottom","Left"],da=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&ba.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ga[d]=e,e)}function ia(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=W.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&da(d)&&(e[f]=ha(d))):"none"!==c&&(e[f]="none",W.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ia(this,!0)},hide:function(){return ia(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){da(this)?r(this).show():r(this).hide()})}});var ja=/^(?:checkbox|radio)$/i,ka=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c<d;c++)W.set(a[c],"globalEval",!b||W.get(b[c],"globalEval"))}var pa=/<|&#?\w+;/;function qa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(pa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ka.exec(f)||["",""])[1].toLowerCase(),i=ma[h]||ma._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==xa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===xa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&B(this,"input"))return this.click(),!1},_default:function(a){return B(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?va:wa,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:wa,isPropagationStopped:wa,isImmediatePropagationStopped:wa,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=va,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=va,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=va,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&sa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ta.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return ya(this,a,b,c,d)},one:function(a,b,c,d){return ya(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=wa),this.each(function(){r.event.remove(this,a,c,b)})}});var za=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/<script|<style|<link/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,Ca=/^true\/(.*)/,Da=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}X.hasData(a)&&(h=X.access(a),i=r.extend({},h),X.set(b,i))}}function Ia(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ja.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ja(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,na(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ga),l=0;l<i;l++)j=h[l],la.test(j.type||"")&&!W.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Da,""),k))}return a}function Ka(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(na(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&oa(na(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(za,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d<e;d++)Ia(f[d],g[d]);if(b)if(c)for(f=f||na(a),g=g||na(h),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);else Ha(a,h);return g=na(h,"script"),g.length>0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(na(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ja(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(na(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var La=/^margin/,Ma=new RegExp("^("+aa+")(?!px)[a-z%]+$","i"),Na=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",ra.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,ra.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Oa(a,b,c){var d,e,f,g,h=a.style;return c=c||Na(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ma.test(g)&&La.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Pa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Qa=/^(none|table(?!-c[ea]).+)/,Ra=/^--/,Sa={position:"absolute",visibility:"hidden",display:"block"},Ta={letterSpacing:"0",fontWeight:"400"},Ua=["Webkit","Moz","ms"],Va=d.createElement("div").style;function Wa(a){if(a in Va)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ua.length;while(c--)if(a=Ua[c]+b,a in Va)return a}function Xa(a){var b=r.cssProps[a];return b||(b=r.cssProps[a]=Wa(a)||a),b}function Ya(a,b,c){var d=ba.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Za(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ca[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ca[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ca[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ca[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ca[f]+"Width",!0,e)));return g}function $a(a,b,c){var d,e=Na(a),f=Oa(a,b,e),g="border-box"===r.css(a,"boxSizing",!1,e);return Ma.test(f)?f:(d=g&&(o.boxSizingReliable()||f===a.style[b]),"auto"===f&&(f=a["offset"+b[0].toUpperCase()+b.slice(1)]),f=parseFloat(f)||0,f+Za(a,b,c||(g?"border":"content"),d,e)+"px")}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Oa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=Ra.test(b),j=a.style;return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:j[b]:(f=typeof c,"string"===f&&(e=ba.exec(c))&&e[1]&&(c=fa(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(j[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i?j.setProperty(b,c):j[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b),i=Ra.test(b);return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Oa(a,b,d)),"normal"===e&&b in Ta&&(e=Ta[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Qa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?$a(a,b,d):ea(a,Sa,function(){return $a(a,b,d)})},set:function(a,c,d){var e,f=d&&Na(a),g=d&&Za(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=ba.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ya(a,c,g)}}}),r.cssHooks.marginLeft=Pa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Oa(a,"marginLeft"))||a.getBoundingClientRect().left-ea(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ca[d]+b]=f[d]||f[d-2]||f[0];return e}},La.test(a)||(r.cssHooks[a+b].set=Ya)}),r.fn.extend({css:function(a,b){return T(this,function(a,b,c){var d,e,f={},g=0;if(Array.isArray(b)){for(d=Na(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&da(a),q=W.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],cb.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=W.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ia([a],!0),j=a.style.display||j,k=r.css(a,"display"),ia([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=W.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ia([a],!0),m.done(function(){p||ia([a]),W.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=hb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],Array.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=kb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ab||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(i||h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:ab||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);f<g;f++)if(d=kb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,hb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j}r.Animation=r.extend(kb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return fa(c.elem,a,ba.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(L);for(var c,d=0,e=a.length;d<e;d++)c=a[d],kb.tweeners[c]=kb.tweeners[c]||[],kb.tweeners[c].unshift(b)},prefilters:[ib],prefilter:function(a,b){b?kb.prefilters.unshift(a):kb.prefilters.push(a)}}),r.speed=function(a,b,c){var d=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off?d.duration=0:"number"!=typeof d.duration&&(d.duration in r.fx.speeds?d.duration=r.fx.speeds[d.duration]:d.duration=r.fx.speeds._default),null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){r.isFunction(d.old)&&d.old.call(this),d.queue&&r.dequeue(this,d.queue)},d},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(da).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=kb(this,r.extend({},a),f);(e||W.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=W.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&db.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=W.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),r.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(ab=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),ab=void 0},r.fx.timer=function(a){r.timers.push(a),r.fx.start()},r.fx.interval=13,r.fx.start=function(){bb||(bb=!0,eb())},r.fx.stop=function(){bb=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var lb,mb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return T(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),
4
+ null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!B(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Tb=[],Ub=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Tb.pop()||r.expando+"_"+ub++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ub.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ub.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ub,"$1"+e):b.jsonp!==!1&&(b.url+=(vb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Tb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=C.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=qa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=pb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length},r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),b=f.ownerDocument,c=b.documentElement,e=b.defaultView,{top:d.top+e.pageYOffset-c.clientTop,left:d.left+e.pageXOffset-c.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),B(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||ra})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return T(this,function(a,d,e){var f;return r.isWindow(a)?f=a:9===a.nodeType&&(f=a.defaultView),void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Pa(o.pixelPosition,function(a,c){if(c)return c=Oa(a,b),Ma.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return T(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.holdReady=function(a){a?r.readyWait++:r.ready(!0)},r.isArray=Array.isArray,r.parseJSON=JSON.parse,r.nodeName=B,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Vb=a.jQuery,Wb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Wb),b&&a.jQuery===r&&(a.jQuery=Vb),r},b||(a.jQuery=a.$=r),r});
assets/lib/{chosen_v1.4.2 → chosen}/docsupport/oss-credit.png RENAMED
File without changes
assets/lib/{chosen_v1.4.2 → chosen}/docsupport/prism.css RENAMED
File without changes
assets/lib/{chosen_v1.4.2 → chosen}/docsupport/prism.js RENAMED
File without changes
assets/lib/chosen/docsupport/prototype-1.7.0.0.js ADDED
@@ -0,0 +1,6082 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Prototype JavaScript framework, version 1.7
2
+ * (c) 2005-2010 Sam Stephenson
3
+ *
4
+ * Prototype is freely distributable under the terms of an MIT-style license.
5
+ * For details, see the Prototype web site: http://www.prototypejs.org/
6
+ *
7
+ *--------------------------------------------------------------------------*/
8
+
9
+ var Prototype = {
10
+
11
+ Version: '1.7',
12
+
13
+ Browser: (function(){
14
+ var ua = navigator.userAgent;
15
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
16
+ return {
17
+ IE: !!window.attachEvent && !isOpera,
18
+ Opera: isOpera,
19
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
20
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
21
+ MobileSafari: /Apple.*Mobile/.test(ua)
22
+ }
23
+ })(),
24
+
25
+ BrowserFeatures: {
26
+ XPath: !!document.evaluate,
27
+
28
+ SelectorsAPI: !!document.querySelector,
29
+
30
+ ElementExtensions: (function() {
31
+ var constructor = window.Element || window.HTMLElement;
32
+ return !!(constructor && constructor.prototype);
33
+ })(),
34
+ SpecificElementExtensions: (function() {
35
+ if (typeof window.HTMLDivElement !== 'undefined')
36
+ return true;
37
+
38
+ var div = document.createElement('div'),
39
+ form = document.createElement('form'),
40
+ isSupported = false;
41
+
42
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
43
+ isSupported = true;
44
+ }
45
+
46
+ div = form = null;
47
+
48
+ return isSupported;
49
+ })()
50
+ },
51
+
52
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
53
+ JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
54
+
55
+ emptyFunction: function() { },
56
+
57
+ K: function(x) { return x }
58
+ };
59
+
60
+ if (Prototype.Browser.MobileSafari)
61
+ Prototype.BrowserFeatures.SpecificElementExtensions = false;
62
+
63
+
64
+ var Abstract = { };
65
+
66
+
67
+ var Try = {
68
+ these: function() {
69
+ var returnValue;
70
+
71
+ for (var i = 0, length = arguments.length; i < length; i++) {
72
+ var lambda = arguments[i];
73
+ try {
74
+ returnValue = lambda();
75
+ break;
76
+ } catch (e) { }
77
+ }
78
+
79
+ return returnValue;
80
+ }
81
+ };
82
+
83
+ /* Based on Alex Arnell's inheritance implementation. */
84
+
85
+ var Class = (function() {
86
+
87
+ var IS_DONTENUM_BUGGY = (function(){
88
+ for (var p in { toString: 1 }) {
89
+ if (p === 'toString') return false;
90
+ }
91
+ return true;
92
+ })();
93
+
94
+ function subclass() {};
95
+ function create() {
96
+ var parent = null, properties = $A(arguments);
97
+ if (Object.isFunction(properties[0]))
98
+ parent = properties.shift();
99
+
100
+ function klass() {
101
+ this.initialize.apply(this, arguments);
102
+ }
103
+
104
+ Object.extend(klass, Class.Methods);
105
+ klass.superclass = parent;
106
+ klass.subclasses = [];
107
+
108
+ if (parent) {
109
+ subclass.prototype = parent.prototype;
110
+ klass.prototype = new subclass;
111
+ parent.subclasses.push(klass);
112
+ }
113
+
114
+ for (var i = 0, length = properties.length; i < length; i++)
115
+ klass.addMethods(properties[i]);
116
+
117
+ if (!klass.prototype.initialize)
118
+ klass.prototype.initialize = Prototype.emptyFunction;
119
+
120
+ klass.prototype.constructor = klass;
121
+ return klass;
122
+ }
123
+
124
+ function addMethods(source) {
125
+ var ancestor = this.superclass && this.superclass.prototype,
126
+ properties = Object.keys(source);
127
+
128
+ if (IS_DONTENUM_BUGGY) {
129
+ if (source.toString != Object.prototype.toString)
130
+ properties.push("toString");
131
+ if (source.valueOf != Object.prototype.valueOf)
132
+ properties.push("valueOf");
133
+ }
134
+
135
+ for (var i = 0, length = properties.length; i < length; i++) {
136
+ var property = properties[i], value = source[property];
137
+ if (ancestor && Object.isFunction(value) &&
138
+ value.argumentNames()[0] == "$super") {
139
+ var method = value;
140
+ value = (function(m) {
141
+ return function() { return ancestor[m].apply(this, arguments); };
142
+ })(property).wrap(method);
143
+
144
+ value.valueOf = method.valueOf.bind(method);
145
+ value.toString = method.toString.bind(method);
146
+ }
147
+ this.prototype[property] = value;
148
+ }
149
+
150
+ return this;
151
+ }
152
+
153
+ return {
154
+ create: create,
155
+ Methods: {
156
+ addMethods: addMethods
157
+ }
158
+ };
159
+ })();
160
+ (function() {
161
+
162
+ var _toString = Object.prototype.toString,
163
+ NULL_TYPE = 'Null',
164
+ UNDEFINED_TYPE = 'Undefined',
165
+ BOOLEAN_TYPE = 'Boolean',
166
+ NUMBER_TYPE = 'Number',
167
+ STRING_TYPE = 'String',
168
+ OBJECT_TYPE = 'Object',
169
+ FUNCTION_CLASS = '[object Function]',
170
+ BOOLEAN_CLASS = '[object Boolean]',
171
+ NUMBER_CLASS = '[object Number]',
172
+ STRING_CLASS = '[object String]',
173
+ ARRAY_CLASS = '[object Array]',
174
+ DATE_CLASS = '[object Date]',
175
+ NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON &&
176
+ typeof JSON.stringify === 'function' &&
177
+ JSON.stringify(0) === '0' &&
178
+ typeof JSON.stringify(Prototype.K) === 'undefined';
179
+
180
+ function Type(o) {
181
+ switch(o) {
182
+ case null: return NULL_TYPE;
183
+ case (void 0): return UNDEFINED_TYPE;
184
+ }
185
+ var type = typeof o;
186
+ switch(type) {
187
+ case 'boolean': return BOOLEAN_TYPE;
188
+ case 'number': return NUMBER_TYPE;
189
+ case 'string': return STRING_TYPE;
190
+ }
191
+ return OBJECT_TYPE;
192
+ }
193
+
194
+ function extend(destination, source) {
195
+ for (var property in source)
196
+ destination[property] = source[property];
197
+ return destination;
198
+ }
199
+
200
+ function inspect(object) {
201
+ try {
202
+ if (isUndefined(object)) return 'undefined';
203
+ if (object === null) return 'null';
204
+ return object.inspect ? object.inspect() : String(object);
205
+ } catch (e) {
206
+ if (e instanceof RangeError) return '...';
207
+ throw e;
208
+ }
209
+ }
210
+
211
+ function toJSON(value) {
212
+ return Str('', { '': value }, []);
213
+ }
214
+
215
+ function Str(key, holder, stack) {
216
+ var value = holder[key],
217
+ type = typeof value;
218
+
219
+ if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
220
+ value = value.toJSON(key);
221
+ }
222
+
223
+ var _class = _toString.call(value);
224
+
225
+ switch (_class) {
226
+ case NUMBER_CLASS:
227
+ case BOOLEAN_CLASS:
228
+ case STRING_CLASS:
229
+ value = value.valueOf();
230
+ }
231
+
232
+ switch (value) {
233
+ case null: return 'null';
234
+ case true: return 'true';
235
+ case false: return 'false';
236
+ }
237
+
238
+ type = typeof value;
239
+ switch (type) {
240
+ case 'string':
241
+ return value.inspect(true);
242
+ case 'number':
243
+ return isFinite(value) ? String(value) : 'null';
244
+ case 'object':
245
+
246
+ for (var i = 0, length = stack.length; i < length; i++) {
247
+ if (stack[i] === value) { throw new TypeError(); }
248
+ }
249
+ stack.push(value);
250
+
251
+ var partial = [];
252
+ if (_class === ARRAY_CLASS) {
253
+ for (var i = 0, length = value.length; i < length; i++) {
254
+ var str = Str(i, value, stack);
255
+ partial.push(typeof str === 'undefined' ? 'null' : str);
256
+ }
257
+ partial = '[' + partial.join(',') + ']';
258
+ } else {
259
+ var keys = Object.keys(value);
260
+ for (var i = 0, length = keys.length; i < length; i++) {
261
+ var key = keys[i], str = Str(key, value, stack);
262
+ if (typeof str !== "undefined") {
263
+ partial.push(key.inspect(true)+ ':' + str);
264
+ }
265
+ }
266
+ partial = '{' + partial.join(',') + '}';
267
+ }
268
+ stack.pop();
269
+ return partial;
270
+ }
271
+ }
272
+
273
+ function stringify(object) {
274
+ return JSON.stringify(object);
275
+ }
276
+
277
+ function toQueryString(object) {
278
+ return $H(object).toQueryString();
279
+ }
280
+
281
+ function toHTML(object) {
282
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
283
+ }
284
+
285
+ function keys(object) {
286
+ if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); }
287
+ var results = [];
288
+ for (var property in object) {
289
+ if (object.hasOwnProperty(property)) {
290
+ results.push(property);
291
+ }
292
+ }
293
+ return results;
294
+ }
295
+
296
+ function values(object) {
297
+ var results = [];
298
+ for (var property in object)
299
+ results.push(object[property]);
300
+ return results;
301
+ }
302
+
303
+ function clone(object) {
304
+ return extend({ }, object);
305
+ }
306
+
307
+ function isElement(object) {
308
+ return !!(object && object.nodeType == 1);
309
+ }
310
+
311
+ function isArray(object) {
312
+ return _toString.call(object) === ARRAY_CLASS;
313
+ }
314
+
315
+ var hasNativeIsArray = (typeof Array.isArray == 'function')
316
+ && Array.isArray([]) && !Array.isArray({});
317
+
318
+ if (hasNativeIsArray) {
319
+ isArray = Array.isArray;
320
+ }
321
+
322
+ function isHash(object) {
323
+ return object instanceof Hash;
324
+ }
325
+
326
+ function isFunction(object) {
327
+ return _toString.call(object) === FUNCTION_CLASS;
328
+ }
329
+
330
+ function isString(object) {
331
+ return _toString.call(object) === STRING_CLASS;
332
+ }
333
+
334
+ function isNumber(object) {
335
+ return _toString.call(object) === NUMBER_CLASS;
336
+ }
337
+
338
+ function isDate(object) {
339
+ return _toString.call(object) === DATE_CLASS;
340
+ }
341
+
342
+ function isUndefined(object) {
343
+ return typeof object === "undefined";
344
+ }
345
+
346
+ extend(Object, {
347
+ extend: extend,
348
+ inspect: inspect,
349
+ toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON,
350
+ toQueryString: toQueryString,
351
+ toHTML: toHTML,
352
+ keys: Object.keys || keys,
353
+ values: values,
354
+ clone: clone,
355
+ isElement: isElement,
356
+ isArray: isArray,
357
+ isHash: isHash,
358
+ isFunction: isFunction,
359
+ isString: isString,
360
+ isNumber: isNumber,
361
+ isDate: isDate,
362
+ isUndefined: isUndefined
363
+ });
364
+ })();
365
+ Object.extend(Function.prototype, (function() {
366
+ var slice = Array.prototype.slice;
367
+
368
+ function update(array, args) {
369
+ var arrayLength = array.length, length = args.length;
370
+ while (length--) array[arrayLength + length] = args[length];
371
+ return array;
372
+ }
373
+
374
+ function merge(array, args) {
375
+ array = slice.call(array, 0);
376
+ return update(array, args);
377
+ }
378
+
379
+ function argumentNames() {
380
+ var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
381
+ .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
382
+ .replace(/\s+/g, '').split(',');
383
+ return names.length == 1 && !names[0] ? [] : names;
384
+ }
385
+
386
+ function bind(context) {
387
+ if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
388
+ var __method = this, args = slice.call(arguments, 1);
389
+ return function() {
390
+ var a = merge(args, arguments);
391
+ return __method.apply(context, a);
392
+ }
393
+ }
394
+
395
+ function bindAsEventListener(context) {
396
+ var __method = this, args = slice.call(arguments, 1);
397
+ return function(event) {
398
+ var a = update([event || window.event], args);
399
+ return __method.apply(context, a);
400
+ }
401
+ }
402
+
403
+ function curry() {
404
+ if (!arguments.length) return this;
405
+ var __method = this, args = slice.call(arguments, 0);
406
+ return function() {
407
+ var a = merge(args, arguments);
408
+ return __method.apply(this, a);
409
+ }
410
+ }
411
+
412
+ function delay(timeout) {
413
+ var __method = this, args = slice.call(arguments, 1);
414
+ timeout = timeout * 1000;
415
+ return window.setTimeout(function() {
416
+ return __method.apply(__method, args);
417
+ }, timeout);
418
+ }
419
+
420
+ function defer() {
421
+ var args = update([0.01], arguments);
422
+ return this.delay.apply(this, args);
423
+ }
424
+
425
+ function wrap(wrapper) {
426
+ var __method = this;
427
+ return function() {
428
+ var a = update([__method.bind(this)], arguments);
429
+ return wrapper.apply(this, a);
430
+ }
431
+ }
432
+
433
+ function methodize() {
434
+ if (this._methodized) return this._methodized;
435
+ var __method = this;
436
+ return this._methodized = function() {
437
+ var a = update([this], arguments);
438
+ return __method.apply(null, a);
439
+ };
440
+ }
441
+
442
+ return {
443
+ argumentNames: argumentNames,
444
+ bind: bind,
445
+ bindAsEventListener: bindAsEventListener,
446
+ curry: curry,
447
+ delay: delay,
448
+ defer: defer,
449
+ wrap: wrap,
450
+ methodize: methodize
451
+ }
452
+ })());
453
+
454
+
455
+
456
+ (function(proto) {
457
+
458
+
459
+ function toISOString() {
460
+ return this.getUTCFullYear() + '-' +
461
+ (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
462
+ this.getUTCDate().toPaddedString(2) + 'T' +
463
+ this.getUTCHours().toPaddedString(2) + ':' +
464
+ this.getUTCMinutes().toPaddedString(2) + ':' +
465
+ this.getUTCSeconds().toPaddedString(2) + 'Z';
466
+ }
467
+
468
+
469
+ function toJSON() {
470
+ return this.toISOString();
471
+ }
472
+
473
+ if (!proto.toISOString) proto.toISOString = toISOString;
474
+ if (!proto.toJSON) proto.toJSON = toJSON;
475
+
476
+ })(Date.prototype);
477
+
478
+
479
+ RegExp.prototype.match = RegExp.prototype.test;
480
+
481
+ RegExp.escape = function(str) {
482
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
483
+ };
484
+ var PeriodicalExecuter = Class.create({
485
+ initialize: function(callback, frequency) {
486
+ this.callback = callback;
487
+ this.frequency = frequency;
488
+ this.currentlyExecuting = false;
489
+
490
+ this.registerCallback();
491
+ },
492
+
493
+ registerCallback: function() {
494
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
495
+ },
496
+
497
+ execute: function() {
498
+ this.callback(this);
499
+ },
500
+
501
+ stop: function() {
502
+ if (!this.timer) return;
503
+ clearInterval(this.timer);
504
+ this.timer = null;
505
+ },
506
+
507
+ onTimerEvent: function() {
508
+ if (!this.currentlyExecuting) {
509
+ try {
510
+ this.currentlyExecuting = true;
511
+ this.execute();
512
+ this.currentlyExecuting = false;
513
+ } catch(e) {
514
+ this.currentlyExecuting = false;
515
+ throw e;
516
+ }
517
+ }
518
+ }
519
+ });
520
+ Object.extend(String, {
521
+ interpret: function(value) {
522
+ return value == null ? '' : String(value);
523
+ },
524
+ specialChar: {
525
+ '\b': '\\b',
526
+ '\t': '\\t',
527
+ '\n': '\\n',
528
+ '\f': '\\f',
529
+ '\r': '\\r',
530
+ '\\': '\\\\'
531
+ }
532
+ });
533
+
534
+ Object.extend(String.prototype, (function() {
535
+ var NATIVE_JSON_PARSE_SUPPORT = window.JSON &&
536
+ typeof JSON.parse === 'function' &&
537
+ JSON.parse('{"test": true}').test;
538
+
539
+ function prepareReplacement(replacement) {
540
+ if (Object.isFunction(replacement)) return replacement;
541
+ var template = new Template(replacement);
542
+ return function(match) { return template.evaluate(match) };
543
+ }
544
+
545
+ function gsub(pattern, replacement) {
546
+ var result = '', source = this, match;
547
+ replacement = prepareReplacement(replacement);
548
+
549
+ if (Object.isString(pattern))
550
+ pattern = RegExp.escape(pattern);
551
+
552
+ if (!(pattern.length || pattern.source)) {
553
+ replacement = replacement('');
554
+ return replacement + source.split('').join(replacement) + replacement;
555
+ }
556
+
557
+ while (source.length > 0) {
558
+ if (match = source.match(pattern)) {
559
+ result += source.slice(0, match.index);
560
+ result += String.interpret(replacement(match));
561
+ source = source.slice(match.index + match[0].length);
562
+ } else {
563
+ result += source, source = '';
564
+ }
565
+ }
566
+ return result;
567
+ }
568
+
569
+ function sub(pattern, replacement, count) {
570
+ replacement = prepareReplacement(replacement);
571
+ count = Object.isUndefined(count) ? 1 : count;
572
+
573
+ return this.gsub(pattern, function(match) {
574
+ if (--count < 0) return match[0];
575
+ return replacement(match);
576
+ });
577
+ }
578
+
579
+ function scan(pattern, iterator) {
580
+ this.gsub(pattern, iterator);
581
+ return String(this);
582
+ }
583
+
584
+ function truncate(length, truncation) {
585
+ length = length || 30;
586
+ truncation = Object.isUndefined(truncation) ? '...' : truncation;
587
+ return this.length > length ?
588
+ this.slice(0, length - truncation.length) + truncation : String(this);
589
+ }
590
+
591
+ function strip() {
592
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
593
+ }
594
+
595
+ function stripTags() {
596
+ return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
597
+ }
598
+
599
+ function stripScripts() {
600
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
601
+ }
602
+
603
+ function extractScripts() {
604
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img'),
605
+ matchOne = new RegExp(Prototype.ScriptFragment, 'im');
606
+ return (this.match(matchAll) || []).map(function(scriptTag) {
607
+ return (scriptTag.match(matchOne) || ['', ''])[1];
608
+ });
609
+ }
610
+
611
+ function evalScripts() {
612
+ return this.extractScripts().map(function(script) { return eval(script) });
613
+ }
614
+
615
+ function escapeHTML() {
616
+ return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
617
+ }
618
+
619
+ function unescapeHTML() {
620
+ return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
621
+ }
622
+
623
+
624
+ function toQueryParams(separator) {
625
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
626
+ if (!match) return { };
627
+
628
+ return match[1].split(separator || '&').inject({ }, function(hash, pair) {
629
+ if ((pair = pair.split('='))[0]) {
630
+ var key = decodeURIComponent(pair.shift()),
631
+ value = pair.length > 1 ? pair.join('=') : pair[0];
632
+
633
+ if (value != undefined) value = decodeURIComponent(value);
634
+
635
+ if (key in hash) {
636
+ if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
637
+ hash[key].push(value);
638
+ }
639
+ else hash[key] = value;
640
+ }
641
+ return hash;
642
+ });
643
+ }
644
+
645
+ function toArray() {
646
+ return this.split('');
647
+ }
648
+
649
+ function succ() {
650
+ return this.slice(0, this.length - 1) +
651
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
652
+ }
653
+
654
+ function times(count) {
655
+ return count < 1 ? '' : new Array(count + 1).join(this);
656
+ }
657
+
658
+ function camelize() {
659
+ return this.replace(/-+(.)?/g, function(match, chr) {
660
+ return chr ? chr.toUpperCase() : '';
661
+ });
662
+ }
663
+
664
+ function capitalize() {
665
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
666
+ }
667
+
668
+ function underscore() {
669
+ return this.replace(/::/g, '/')
670
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
671
+ .replace(/([a-z\d])([A-Z])/g, '$1_$2')
672
+ .replace(/-/g, '_')
673
+ .toLowerCase();
674
+ }
675
+
676
+ function dasherize() {
677
+ return this.replace(/_/g, '-');
678
+ }
679
+
680
+ function inspect(useDoubleQuotes) {
681
+ var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
682
+ if (character in String.specialChar) {
683
+ return String.specialChar[character];
684
+ }
685
+ return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
686
+ });
687
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
688
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
689
+ }
690
+
691
+ function unfilterJSON(filter) {
692
+ return this.replace(filter || Prototype.JSONFilter, '$1');
693
+ }
694
+
695
+ function isJSON() {
696
+ var str = this;
697
+ if (str.blank()) return false;
698
+ str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@');
699
+ str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
700
+ str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
701
+ return (/^[\],:{}\s]*$/).test(str);
702
+ }
703
+
704
+ function evalJSON(sanitize) {
705
+ var json = this.unfilterJSON(),
706
+ cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
707
+ if (cx.test(json)) {
708
+ json = json.replace(cx, function (a) {
709
+ return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
710
+ });
711
+ }
712
+ try {
713
+ if (!sanitize || json.isJSON()) return eval('(' + json + ')');
714
+ } catch (e) { }
715
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
716
+ }
717
+
718
+ function parseJSON() {
719
+ var json = this.unfilterJSON();
720
+ return JSON.parse(json);
721
+ }
722
+
723
+ function include(pattern) {
724
+ return this.indexOf(pattern) > -1;
725
+ }
726
+
727
+ function startsWith(pattern) {
728
+ return this.lastIndexOf(pattern, 0) === 0;
729
+ }
730
+
731
+ function endsWith(pattern) {
732
+ var d = this.length - pattern.length;
733
+ return d >= 0 && this.indexOf(pattern, d) === d;
734
+ }
735
+
736
+ function empty() {
737
+ return this == '';
738
+ }
739
+
740
+ function blank() {
741
+ return /^\s*$/.test(this);
742
+ }
743
+
744
+ function interpolate(object, pattern) {
745
+ return new Template(this, pattern).evaluate(object);
746
+ }
747
+
748
+ return {
749
+ gsub: gsub,
750
+ sub: sub,
751
+ scan: scan,
752
+ truncate: truncate,
753
+ strip: String.prototype.trim || strip,
754
+ stripTags: stripTags,
755
+ stripScripts: stripScripts,
756
+ extractScripts: extractScripts,
757
+ evalScripts: evalScripts,
758
+ escapeHTML: escapeHTML,
759
+ unescapeHTML: unescapeHTML,
760
+ toQueryParams: toQueryParams,
761
+ parseQuery: toQueryParams,
762
+ toArray: toArray,
763
+ succ: succ,
764
+ times: times,
765
+ camelize: camelize,
766
+ capitalize: capitalize,
767
+ underscore: underscore,
768
+ dasherize: dasherize,
769
+ inspect: inspect,
770
+ unfilterJSON: unfilterJSON,
771
+ isJSON: isJSON,
772
+ evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON,
773
+ include: include,
774
+ startsWith: startsWith,
775
+ endsWith: endsWith,
776
+ empty: empty,
777
+ blank: blank,
778
+ interpolate: interpolate
779
+ };
780
+ })());
781
+
782
+ var Template = Class.create({
783
+ initialize: function(template, pattern) {
784
+ this.template = template.toString();
785
+ this.pattern = pattern || Template.Pattern;
786
+ },
787
+
788
+ evaluate: function(object) {
789
+ if (object && Object.isFunction(object.toTemplateReplacements))
790
+ object = object.toTemplateReplacements();
791
+
792
+ return this.template.gsub(this.pattern, function(match) {
793
+ if (object == null) return (match[1] + '');
794
+
795
+ var before = match[1] || '';
796
+ if (before == '\\') return match[2];
797
+
798
+ var ctx = object, expr = match[3],
799
+ pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
800
+
801
+ match = pattern.exec(expr);
802
+ if (match == null) return before;
803
+
804
+ while (match != null) {
805
+ var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
806
+ ctx = ctx[comp];
807
+ if (null == ctx || '' == match[3]) break;
808
+ expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
809
+ match = pattern.exec(expr);
810
+ }
811
+
812
+ return before + String.interpret(ctx);
813
+ });
814
+ }
815
+ });
816
+ Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
817
+
818
+ var $break = { };
819
+
820
+ var Enumerable = (function() {
821
+ function each(iterator, context) {
822
+ var index = 0;
823
+ try {
824
+ this._each(function(value) {
825
+ iterator.call(context, value, index++);
826
+ });
827
+ } catch (e) {
828
+ if (e != $break) throw e;
829
+ }
830
+ return this;
831
+ }
832
+
833
+ function eachSlice(number, iterator, context) {
834
+ var index = -number, slices = [], array = this.toArray();
835
+ if (number < 1) return array;
836
+ while ((index += number) < array.length)
837
+ slices.push(array.slice(index, index+number));
838
+ return slices.collect(iterator, context);
839
+ }
840
+
841
+ function all(iterator, context) {
842
+ iterator = iterator || Prototype.K;
843
+ var result = true;
844
+ this.each(function(value, index) {
845
+ result = result && !!iterator.call(context, value, index);
846
+ if (!result) throw $break;
847
+ });
848
+ return result;
849
+ }
850
+
851
+ function any(iterator, context) {
852
+ iterator = iterator || Prototype.K;
853
+ var result = false;
854
+ this.each(function(value, index) {
855
+ if (result = !!iterator.call(context, value, index))
856
+ throw $break;
857
+ });
858
+ return result;
859
+ }
860
+
861
+ function collect(iterator, context) {
862
+ iterator = iterator || Prototype.K;
863
+ var results = [];
864
+ this.each(function(value, index) {
865
+ results.push(iterator.call(context, value, index));
866
+ });
867
+ return results;
868
+ }
869
+
870
+ function detect(iterator, context) {
871
+ var result;
872
+ this.each(function(value, index) {
873
+ if (iterator.call(context, value, index)) {
874
+ result = value;
875
+ throw $break;
876
+ }
877
+ });
878
+ return result;
879
+ }
880
+
881
+ function findAll(iterator, context) {
882
+ var results = [];
883
+ this.each(function(value, index) {
884
+ if (iterator.call(context, value, index))
885
+ results.push(value);
886
+ });
887
+ return results;
888
+ }
889
+
890
+ function grep(filter, iterator, context) {
891
+ iterator = iterator || Prototype.K;
892
+ var results = [];
893
+
894
+ if (Object.isString(filter))
895
+ filter = new RegExp(RegExp.escape(filter));
896
+
897
+ this.each(function(value, index) {
898
+ if (filter.match(value))
899
+ results.push(iterator.call(context, value, index));
900
+ });
901
+ return results;
902
+ }
903
+
904
+ function include(object) {
905
+ if (Object.isFunction(this.indexOf))
906
+ if (this.indexOf(object) != -1) return true;
907
+
908
+ var found = false;
909
+ this.each(function(value) {
910
+ if (value == object) {
911
+ found = true;
912
+ throw $break;
913
+ }
914
+ });
915
+ return found;
916
+ }
917
+
918
+ function inGroupsOf(number, fillWith) {
919
+ fillWith = Object.isUndefined(fillWith) ? null : fillWith;
920
+ return this.eachSlice(number, function(slice) {
921
+ while(slice.length < number) slice.push(fillWith);
922
+ return slice;
923
+ });
924
+ }
925
+
926
+ function inject(memo, iterator, context) {
927
+ this.each(function(value, index) {
928
+ memo = iterator.call(context, memo, value, index);
929
+ });
930
+ return memo;
931
+ }
932
+
933
+ function invoke(method) {
934
+ var args = $A(arguments).slice(1);
935
+ return this.map(function(value) {
936
+ return value[method].apply(value, args);
937
+ });
938
+ }
939
+
940
+ function max(iterator, context) {
941
+ iterator = iterator || Prototype.K;
942
+ var result;
943
+ this.each(function(value, index) {
944
+ value = iterator.call(context, value, index);
945
+ if (result == null || value >= result)
946
+ result = value;
947
+ });
948
+ return result;
949
+ }
950
+
951
+ function min(iterator, context) {
952
+ iterator = iterator || Prototype.K;
953
+ var result;
954
+ this.each(function(value, index) {
955
+ value = iterator.call(context, value, index);
956
+ if (result == null || value < result)
957
+ result = value;
958
+ });
959
+ return result;
960
+ }
961
+
962
+ function partition(iterator, context) {
963
+ iterator = iterator || Prototype.K;
964
+ var trues = [], falses = [];
965
+ this.each(function(value, index) {
966
+ (iterator.call(context, value, index) ?
967
+ trues : falses).push(value);
968
+ });
969
+ return [trues, falses];
970
+ }
971
+
972
+ function pluck(property) {
973
+ var results = [];
974
+ this.each(function(value) {
975
+ results.push(value[property]);
976
+ });
977
+ return results;
978
+ }
979
+
980
+ function reject(iterator, context) {
981
+ var results = [];
982
+ this.each(function(value, index) {
983
+ if (!iterator.call(context, value, index))
984
+ results.push(value);
985
+ });
986
+ return results;
987
+ }
988
+
989
+ function sortBy(iterator, context) {
990
+ return this.map(function(value, index) {
991
+ return {
992
+ value: value,
993
+ criteria: iterator.call(context, value, index)
994
+ };
995
+ }).sort(function(left, right) {
996
+ var a = left.criteria, b = right.criteria;
997
+ return a < b ? -1 : a > b ? 1 : 0;
998
+ }).pluck('value');
999
+ }
1000
+
1001
+ function toArray() {
1002
+ return this.map();
1003
+ }
1004
+
1005
+ function zip() {
1006
+ var iterator = Prototype.K, args = $A(arguments);
1007
+ if (Object.isFunction(args.last()))
1008
+ iterator = args.pop();
1009
+
1010
+ var collections = [this].concat(args).map($A);
1011
+ return this.map(function(value, index) {
1012
+ return iterator(collections.pluck(index));
1013
+ });
1014
+ }
1015
+
1016
+ function size() {
1017
+ return this.toArray().length;
1018
+ }
1019
+
1020
+ function inspect() {
1021
+ return '#<Enumerable:' + this.toArray().inspect() + '>';
1022
+ }
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+ return {
1033
+ each: each,
1034
+ eachSlice: eachSlice,
1035
+ all: all,
1036
+ every: all,
1037
+ any: any,
1038
+ some: any,
1039
+ collect: collect,
1040
+ map: collect,
1041
+ detect: detect,
1042
+ findAll: findAll,
1043
+ select: findAll,
1044
+ filter: findAll,
1045
+ grep: grep,
1046
+ include: include,
1047
+ member: include,
1048
+ inGroupsOf: inGroupsOf,
1049
+ inject: inject,
1050
+ invoke: invoke,
1051
+ max: max,
1052
+ min: min,
1053
+ partition: partition,
1054
+ pluck: pluck,
1055
+ reject: reject,
1056
+ sortBy: sortBy,
1057
+ toArray: toArray,
1058
+ entries: toArray,
1059
+ zip: zip,
1060
+ size: size,
1061
+ inspect: inspect,
1062
+ find: detect
1063
+ };
1064
+ })();
1065
+
1066
+ function $A(iterable) {
1067
+ if (!iterable) return [];
1068
+ if ('toArray' in Object(iterable)) return iterable.toArray();
1069
+ var length = iterable.length || 0, results = new Array(length);
1070
+ while (length--) results[length] = iterable[length];
1071
+ return results;
1072
+ }
1073
+
1074
+
1075
+ function $w(string) {
1076
+ if (!Object.isString(string)) return [];
1077
+ string = string.strip();
1078
+ return string ? string.split(/\s+/) : [];
1079
+ }
1080
+
1081
+ Array.from = $A;
1082
+
1083
+
1084
+ (function() {
1085
+ var arrayProto = Array.prototype,
1086
+ slice = arrayProto.slice,
1087
+ _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
1088
+
1089
+ function each(iterator, context) {
1090
+ for (var i = 0, length = this.length >>> 0; i < length; i++) {
1091
+ if (i in this) iterator.call(context, this[i], i, this);
1092
+ }
1093
+ }
1094
+ if (!_each) _each = each;
1095
+
1096
+ function clear() {
1097
+ this.length = 0;
1098
+ return this;
1099
+ }
1100
+
1101
+ function first() {
1102
+ return this[0];
1103
+ }
1104
+
1105
+ function last() {
1106
+ return this[this.length - 1];
1107
+ }
1108
+
1109
+ function compact() {
1110
+ return this.select(function(value) {
1111
+ return value != null;
1112
+ });
1113
+ }
1114
+
1115
+ function flatten() {
1116
+ return this.inject([], function(array, value) {
1117
+ if (Object.isArray(value))
1118
+ return array.concat(value.flatten());
1119
+ array.push(value);
1120
+ return array;
1121
+ });
1122
+ }
1123
+
1124
+ function without() {
1125
+ var values = slice.call(arguments, 0);
1126
+ return this.select(function(value) {
1127
+ return !values.include(value);
1128
+ });
1129
+ }
1130
+
1131
+ function reverse(inline) {
1132
+ return (inline === false ? this.toArray() : this)._reverse();
1133
+ }
1134
+
1135
+ function uniq(sorted) {
1136
+ return this.inject([], function(array, value, index) {
1137
+ if (0 == index || (sorted ? array.last() != value : !array.include(value)))
1138
+ array.push(value);
1139
+ return array;
1140
+ });
1141
+ }
1142
+
1143
+ function intersect(array) {
1144
+ return this.uniq().findAll(function(item) {
1145
+ return array.detect(function(value) { return item === value });
1146
+ });
1147
+ }
1148
+
1149
+
1150
+ function clone() {
1151
+ return slice.call(this, 0);
1152
+ }
1153
+
1154
+ function size() {
1155
+ return this.length;
1156
+ }
1157
+
1158
+ function inspect() {
1159
+ return '[' + this.map(Object.inspect).join(', ') + ']';
1160
+ }
1161
+
1162
+ function indexOf(item, i) {
1163
+ i || (i = 0);
1164
+ var length = this.length;
1165
+ if (i < 0) i = length + i;
1166
+ for (; i < length; i++)
1167
+ if (this[i] === item) return i;
1168
+ return -1;
1169
+ }
1170
+
1171
+ function lastIndexOf(item, i) {
1172
+ i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
1173
+ var n = this.slice(0, i).reverse().indexOf(item);
1174
+ return (n < 0) ? n : i - n - 1;
1175
+ }
1176
+
1177
+ function concat() {
1178
+ var array = slice.call(this, 0), item;
1179
+ for (var i = 0, length = arguments.length; i < length; i++) {
1180
+ item = arguments[i];
1181
+ if (Object.isArray(item) && !('callee' in item)) {
1182
+ for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
1183
+ array.push(item[j]);
1184
+ } else {
1185
+ array.push(item);
1186
+ }
1187
+ }
1188
+ return array;
1189
+ }
1190
+
1191
+ Object.extend(arrayProto, Enumerable);
1192
+
1193
+ if (!arrayProto._reverse)
1194
+ arrayProto._reverse = arrayProto.reverse;
1195
+
1196
+ Object.extend(arrayProto, {
1197
+ _each: _each,
1198
+ clear: clear,
1199
+ first: first,
1200
+ last: last,
1201
+ compact: compact,
1202
+ flatten: flatten,
1203
+ without: without,
1204
+ reverse: reverse,
1205
+ uniq: uniq,
1206
+ intersect: intersect,
1207
+ clone: clone,
1208
+ toArray: clone,
1209
+ size: size,
1210
+ inspect: inspect
1211
+ });
1212
+
1213
+ var CONCAT_ARGUMENTS_BUGGY = (function() {
1214
+ return [].concat(arguments)[0][0] !== 1;
1215
+ })(1,2)
1216
+
1217
+ if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
1218
+
1219
+ if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
1220
+ if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
1221
+ })();
1222
+ function $H(object) {
1223
+ return new Hash(object);
1224
+ };
1225
+
1226
+ var Hash = Class.create(Enumerable, (function() {
1227
+ function initialize(object) {
1228
+ this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
1229
+ }
1230
+
1231
+
1232
+ function _each(iterator) {
1233
+ for (var key in this._object) {
1234
+ var value = this._object[key], pair = [key, value];
1235
+ pair.key = key;
1236
+ pair.value = value;
1237
+ iterator(pair);
1238
+ }
1239
+ }
1240
+
1241
+ function set(key, value) {
1242
+ return this._object[key] = value;
1243
+ }
1244
+
1245
+ function get(key) {
1246
+ if (this._object[key] !== Object.prototype[key])
1247
+ return this._object[key];
1248
+ }
1249
+
1250
+ function unset(key) {
1251
+ var value = this._object[key];
1252
+ delete this._object[key];
1253
+ return value;
1254
+ }
1255
+
1256
+ function toObject() {
1257
+ return Object.clone(this._object);
1258
+ }
1259
+
1260
+
1261
+
1262
+ function keys() {
1263
+ return this.pluck('key');
1264
+ }
1265
+
1266
+ function values() {
1267
+ return this.pluck('value');
1268
+ }
1269
+
1270
+ function index(value) {
1271
+ var match = this.detect(function(pair) {
1272
+ return pair.value === value;
1273
+ });
1274
+ return match && match.key;
1275
+ }
1276
+
1277
+ function merge(object) {
1278
+ return this.clone().update(object);
1279
+ }
1280
+
1281
+ function update(object) {
1282
+ return new Hash(object).inject(this, function(result, pair) {
1283
+ result.set(pair.key, pair.value);
1284
+ return result;
1285
+ });
1286
+ }
1287
+
1288
+ function toQueryPair(key, value) {
1289
+ if (Object.isUndefined(value)) return key;
1290
+ return key + '=' + encodeURIComponent(String.interpret(value));
1291
+ }
1292
+
1293
+ function toQueryString() {
1294
+ return this.inject([], function(results, pair) {
1295
+ var key = encodeURIComponent(pair.key), values = pair.value;
1296
+
1297
+ if (values && typeof values == 'object') {
1298
+ if (Object.isArray(values)) {
1299
+ var queryValues = [];
1300
+ for (var i = 0, len = values.length, value; i < len; i++) {
1301
+ value = values[i];
1302
+ queryValues.push(toQueryPair(key, value));
1303
+ }
1304
+ return results.concat(queryValues);
1305
+ }
1306
+ } else results.push(toQueryPair(key, values));
1307
+ return results;
1308
+ }).join('&');
1309
+ }
1310
+
1311
+ function inspect() {
1312
+ return '#<Hash:{' + this.map(function(pair) {
1313
+ return pair.map(Object.inspect).join(': ');
1314
+ }).join(', ') + '}>';
1315
+ }
1316
+
1317
+ function clone() {
1318
+ return new Hash(this);
1319
+ }
1320
+
1321
+ return {
1322
+ initialize: initialize,
1323
+ _each: _each,
1324
+ set: set,
1325
+ get: get,
1326
+ unset: unset,
1327
+ toObject: toObject,
1328
+ toTemplateReplacements: toObject,
1329
+ keys: keys,
1330
+ values: values,
1331
+ index: index,
1332
+ merge: merge,
1333
+ update: update,
1334
+ toQueryString: toQueryString,
1335
+ inspect: inspect,
1336
+ toJSON: toObject,
1337
+ clone: clone
1338
+ };
1339
+ })());
1340
+
1341
+ Hash.from = $H;
1342
+ Object.extend(Number.prototype, (function() {
1343
+ function toColorPart() {
1344
+ return this.toPaddedString(2, 16);
1345
+ }
1346
+
1347
+ function succ() {
1348
+ return this + 1;
1349
+ }
1350
+
1351
+ function times(iterator, context) {
1352
+ $R(0, this, true).each(iterator, context);
1353
+ return this;
1354
+ }
1355
+
1356
+ function toPaddedString(length, radix) {
1357
+ var string = this.toString(radix || 10);
1358
+ return '0'.times(length - string.length) + string;
1359
+ }
1360
+
1361
+ function abs() {
1362
+ return Math.abs(this);
1363
+ }
1364
+
1365
+ function round() {
1366
+ return Math.round(this);
1367
+ }
1368
+
1369
+ function ceil() {
1370
+ return Math.ceil(this);
1371
+ }
1372
+
1373
+ function floor() {
1374
+ return Math.floor(this);
1375
+ }
1376
+
1377
+ return {
1378
+ toColorPart: toColorPart,
1379
+ succ: succ,
1380
+ times: times,
1381
+ toPaddedString: toPaddedString,
1382
+ abs: abs,
1383
+ round: round,
1384
+ ceil: ceil,
1385
+ floor: floor
1386
+ };
1387
+ })());
1388
+
1389
+ function $R(start, end, exclusive) {
1390
+ return new ObjectRange(start, end, exclusive);
1391
+ }
1392
+
1393
+ var ObjectRange = Class.create(Enumerable, (function() {
1394
+ function initialize(start, end, exclusive) {
1395
+ this.start = start;
1396
+ this.end = end;
1397
+ this.exclusive = exclusive;
1398
+ }
1399
+
1400
+ function _each(iterator) {
1401
+ var value = this.start;
1402
+ while (this.include(value)) {
1403
+ iterator(value);
1404
+ value = value.succ();
1405
+ }
1406
+ }
1407
+
1408
+ function include(value) {
1409
+ if (value < this.start)
1410
+ return false;
1411
+ if (this.exclusive)
1412
+ return value < this.end;
1413
+ return value <= this.end;
1414
+ }
1415
+
1416
+ return {
1417
+ initialize: initialize,
1418
+ _each: _each,
1419
+ include: include
1420
+ };
1421
+ })());
1422
+
1423
+
1424
+
1425
+ var Ajax = {
1426
+ getTransport: function() {
1427
+ return Try.these(
1428
+ function() {return new XMLHttpRequest()},
1429
+ function() {return new ActiveXObject('Msxml2.XMLHTTP')},
1430
+ function() {return new ActiveXObject('Microsoft.XMLHTTP')}
1431
+ ) || false;
1432
+ },
1433
+
1434
+ activeRequestCount: 0
1435
+ };
1436
+
1437
+ Ajax.Responders = {
1438
+ responders: [],
1439
+
1440
+ _each: function(iterator) {
1441
+ this.responders._each(iterator);
1442
+ },
1443
+
1444
+ register: function(responder) {
1445
+ if (!this.include(responder))
1446
+ this.responders.push(responder);
1447
+ },
1448
+
1449
+ unregister: function(responder) {
1450
+ this.responders = this.responders.without(responder);
1451
+ },
1452
+
1453
+ dispatch: function(callback, request, transport, json) {
1454
+ this.each(function(responder) {
1455
+ if (Object.isFunction(responder[callback])) {
1456
+ try {
1457
+ responder[callback].apply(responder, [request, transport, json]);
1458
+ } catch (e) { }
1459
+ }
1460
+ });
1461
+ }
1462
+ };
1463
+
1464
+ Object.extend(Ajax.Responders, Enumerable);
1465
+
1466
+ Ajax.Responders.register({
1467
+ onCreate: function() { Ajax.activeRequestCount++ },
1468
+ onComplete: function() { Ajax.activeRequestCount-- }
1469
+ });
1470
+ Ajax.Base = Class.create({
1471
+ initialize: function(options) {
1472
+ this.options = {
1473
+ method: 'post',
1474
+ asynchronous: true,
1475
+ contentType: 'application/x-www-form-urlencoded',
1476
+ encoding: 'UTF-8',
1477
+ parameters: '',
1478
+ evalJSON: true,
1479
+ evalJS: true
1480
+ };
1481
+ Object.extend(this.options, options || { });
1482
+
1483
+ this.options.method = this.options.method.toLowerCase();
1484
+
1485
+ if (Object.isHash(this.options.parameters))
1486
+ this.options.parameters = this.options.parameters.toObject();
1487
+ }
1488
+ });
1489
+ Ajax.Request = Class.create(Ajax.Base, {
1490
+ _complete: false,
1491
+
1492
+ initialize: function($super, url, options) {
1493
+ $super(options);
1494
+ this.transport = Ajax.getTransport();
1495
+ this.request(url);
1496
+ },
1497
+
1498
+ request: function(url) {
1499
+ this.url = url;
1500
+ this.method = this.options.method;
1501
+ var params = Object.isString(this.options.parameters) ?
1502
+ this.options.parameters :
1503
+ Object.toQueryString(this.options.parameters);
1504
+
1505
+ if (!['get', 'post'].include(this.method)) {
1506
+ params += (params ? '&' : '') + "_method=" + this.method;
1507
+ this.method = 'post';
1508
+ }
1509
+
1510
+ if (params && this.method === 'get') {
1511
+ this.url += (this.url.include('?') ? '&' : '?') + params;
1512
+ }
1513
+
1514
+ this.parameters = params.toQueryParams();
1515
+
1516
+ try {
1517
+ var response = new Ajax.Response(this);
1518
+ if (this.options.onCreate) this.options.onCreate(response);
1519
+ Ajax.Responders.dispatch('onCreate', this, response);
1520
+
1521
+ this.transport.open(this.method.toUpperCase(), this.url,
1522
+ this.options.asynchronous);
1523
+
1524
+ if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
1525
+
1526
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
1527
+ this.setRequestHeaders();
1528
+
1529
+ this.body = this.method == 'post' ? (this.options.postBody || params) : null;
1530
+ this.transport.send(this.body);
1531
+
1532
+ /* Force Firefox to handle ready state 4 for synchronous requests */
1533
+ if (!this.options.asynchronous && this.transport.overrideMimeType)
1534
+ this.onStateChange();
1535
+
1536
+ }
1537
+ catch (e) {
1538
+ this.dispatchException(e);
1539
+ }
1540
+ },
1541
+
1542
+ onStateChange: function() {
1543
+ var readyState = this.transport.readyState;
1544
+ if (readyState > 1 && !((readyState == 4) && this._complete))
1545
+ this.respondToReadyState(this.transport.readyState);
1546
+ },
1547
+
1548
+ setRequestHeaders: function() {
1549
+ var headers = {
1550
+ 'X-Requested-With': 'XMLHttpRequest',
1551
+ 'X-Prototype-Version': Prototype.Version,
1552
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
1553
+ };
1554
+
1555
+ if (this.method == 'post') {
1556
+ headers['Content-type'] = this.options.contentType +
1557
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
1558
+
1559
+ /* Force "Connection: close" for older Mozilla browsers to work
1560
+ * around a bug where XMLHttpRequest sends an incorrect
1561
+ * Content-length header. See Mozilla Bugzilla #246651.
1562
+ */
1563
+ if (this.transport.overrideMimeType &&
1564
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
1565
+ headers['Connection'] = 'close';
1566
+ }
1567
+
1568
+ if (typeof this.options.requestHeaders == 'object') {
1569
+ var extras = this.options.requestHeaders;
1570
+
1571
+ if (Object.isFunction(extras.push))
1572
+ for (var i = 0, length = extras.length; i < length; i += 2)
1573
+ headers[extras[i]] = extras[i+1];
1574
+ else
1575
+ $H(extras).each(function(pair) { headers[pair.key] = pair.value });
1576
+ }
1577
+
1578
+ for (var name in headers)
1579
+ this.transport.setRequestHeader(name, headers[name]);
1580
+ },
1581
+
1582
+ success: function() {
1583
+ var status = this.getStatus();
1584
+ return !status || (status >= 200 && status < 300) || status == 304;
1585
+ },
1586
+
1587
+ getStatus: function() {
1588
+ try {
1589
+ if (this.transport.status === 1223) return 204;
1590
+ return this.transport.status || 0;
1591
+ } catch (e) { return 0 }
1592
+ },
1593
+
1594
+ respondToReadyState: function(readyState) {
1595
+ var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
1596
+
1597
+ if (state == 'Complete') {
1598
+ try {
1599
+ this._complete = true;
1600
+ (this.options['on' + response.status]
1601
+ || this.options['on' + (this.success() ? 'Success' : 'Failure')]
1602
+ || Prototype.emptyFunction)(response, response.headerJSON);
1603
+ } catch (e) {
1604
+ this.dispatchException(e);
1605
+ }
1606
+
1607
+ var contentType = response.getHeader('Content-type');
1608
+ if (this.options.evalJS == 'force'
1609
+ || (this.options.evalJS && this.isSameOrigin() && contentType
1610
+ && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
1611
+ this.evalResponse();
1612
+ }
1613
+
1614
+ try {
1615
+ (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
1616
+ Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
1617
+ } catch (e) {
1618
+ this.dispatchException(e);
1619
+ }
1620
+
1621
+ if (state == 'Complete') {
1622
+ this.transport.onreadystatechange = Prototype.emptyFunction;
1623
+ }
1624
+ },
1625
+
1626
+ isSameOrigin: function() {
1627
+ var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
1628
+ return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
1629
+ protocol: location.protocol,
1630
+ domain: document.domain,
1631
+ port: location.port ? ':' + location.port : ''
1632
+ }));
1633
+ },
1634
+
1635
+ getHeader: function(name) {
1636
+ try {
1637
+ return this.transport.getResponseHeader(name) || null;
1638
+ } catch (e) { return null; }
1639
+ },
1640
+
1641
+ evalResponse: function() {
1642
+ try {
1643
+ return eval((this.transport.responseText || '').unfilterJSON());
1644
+ } catch (e) {
1645
+ this.dispatchException(e);
1646
+ }
1647
+ },
1648
+
1649
+ dispatchException: function(exception) {
1650
+ (this.options.onException || Prototype.emptyFunction)(this, exception);
1651
+ Ajax.Responders.dispatch('onException', this, exception);
1652
+ }
1653
+ });
1654
+
1655
+ Ajax.Request.Events =
1656
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
1657
+
1658
+
1659
+
1660
+
1661
+
1662
+
1663
+
1664
+
1665
+ Ajax.Response = Class.create({
1666
+ initialize: function(request){
1667
+ this.request = request;
1668
+ var transport = this.transport = request.transport,
1669
+ readyState = this.readyState = transport.readyState;
1670
+
1671
+ if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
1672
+ this.status = this.getStatus();
1673
+ this.statusText = this.getStatusText();
1674
+ this.responseText = String.interpret(transport.responseText);
1675
+ this.headerJSON = this._getHeaderJSON();
1676
+ }
1677
+
1678
+ if (readyState == 4) {
1679
+ var xml = transport.responseXML;
1680
+ this.responseXML = Object.isUndefined(xml) ? null : xml;
1681
+ this.responseJSON = this._getResponseJSON();
1682
+ }
1683
+ },
1684
+
1685
+ status: 0,
1686
+
1687
+ statusText: '',
1688
+
1689
+ getStatus: Ajax.Request.prototype.getStatus,
1690
+
1691
+ getStatusText: function() {
1692
+ try {
1693
+ return this.transport.statusText || '';
1694
+ } catch (e) { return '' }
1695
+ },
1696
+
1697
+ getHeader: Ajax.Request.prototype.getHeader,
1698
+
1699
+ getAllHeaders: function() {
1700
+ try {
1701
+ return this.getAllResponseHeaders();
1702
+ } catch (e) { return null }
1703
+ },
1704
+
1705
+ getResponseHeader: function(name) {
1706
+ return this.transport.getResponseHeader(name);
1707
+ },
1708
+
1709
+ getAllResponseHeaders: function() {
1710
+ return this.transport.getAllResponseHeaders();
1711
+ },
1712
+
1713
+ _getHeaderJSON: function() {
1714
+ var json = this.getHeader('X-JSON');
1715
+ if (!json) return null;
1716
+ json = decodeURIComponent(escape(json));
1717
+ try {
1718
+ return json.evalJSON(this.request.options.sanitizeJSON ||
1719
+ !this.request.isSameOrigin());
1720
+ } catch (e) {
1721
+ this.request.dispatchException(e);
1722
+ }
1723
+ },
1724
+
1725
+ _getResponseJSON: function() {
1726
+ var options = this.request.options;
1727
+ if (!options.evalJSON || (options.evalJSON != 'force' &&
1728
+ !(this.getHeader('Content-type') || '').include('application/json')) ||
1729
+ this.responseText.blank())
1730
+ return null;
1731
+ try {
1732
+ return this.responseText.evalJSON(options.sanitizeJSON ||
1733
+ !this.request.isSameOrigin());
1734
+ } catch (e) {
1735
+ this.request.dispatchException(e);
1736
+ }
1737
+ }
1738
+ });
1739
+
1740
+ Ajax.Updater = Class.create(Ajax.Request, {
1741
+ initialize: function($super, container, url, options) {
1742
+ this.container = {
1743
+ success: (container.success || container),
1744
+ failure: (container.failure || (container.success ? null : container))
1745
+ };
1746
+
1747
+ options = Object.clone(options);
1748
+ var onComplete = options.onComplete;
1749
+ options.onComplete = (function(response, json) {
1750
+ this.updateContent(response.responseText);
1751
+ if (Object.isFunction(onComplete)) onComplete(response, json);
1752
+ }).bind(this);
1753
+
1754
+ $super(url, options);
1755
+ },
1756
+
1757
+ updateContent: function(responseText) {
1758
+ var receiver = this.container[this.success() ? 'success' : 'failure'],
1759
+ options = this.options;
1760
+
1761
+ if (!options.evalScripts) responseText = responseText.stripScripts();
1762
+
1763
+ if (receiver = $(receiver)) {
1764
+ if (options.insertion) {
1765
+ if (Object.isString(options.insertion)) {
1766
+ var insertion = { }; insertion[options.insertion] = responseText;
1767
+ receiver.insert(insertion);
1768
+ }
1769
+ else options.insertion(receiver, responseText);
1770
+ }
1771
+ else receiver.update(responseText);
1772
+ }
1773
+ }
1774
+ });
1775
+
1776
+ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
1777
+ initialize: function($super, container, url, options) {
1778
+ $super(options);
1779
+ this.onComplete = this.options.onComplete;
1780
+
1781
+ this.frequency = (this.options.frequency || 2);
1782
+ this.decay = (this.options.decay || 1);
1783
+
1784
+ this.updater = { };
1785
+ this.container = container;
1786
+ this.url = url;
1787
+
1788
+ this.start();
1789
+ },
1790
+
1791
+ start: function() {
1792
+ this.options.onComplete = this.updateComplete.bind(this);
1793
+ this.onTimerEvent();
1794
+ },
1795
+
1796
+ stop: function() {
1797
+ this.updater.options.onComplete = undefined;
1798
+ clearTimeout(this.timer);
1799
+ (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
1800
+ },
1801
+
1802
+ updateComplete: function(response) {
1803
+ if (this.options.decay) {
1804
+ this.decay = (response.responseText == this.lastText ?
1805
+ this.decay * this.options.decay : 1);
1806
+
1807
+ this.lastText = response.responseText;
1808
+ }
1809
+ this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
1810
+ },
1811
+
1812
+ onTimerEvent: function() {
1813
+ this.updater = new Ajax.Updater(this.container, this.url, this.options);
1814
+ }
1815
+ });
1816
+
1817
+
1818
+ function $(element) {
1819
+ if (arguments.length > 1) {
1820
+ for (var i = 0, elements = [], length = arguments.length; i < length; i++)
1821
+ elements.push($(arguments[i]));
1822
+ return elements;
1823
+ }
1824
+ if (Object.isString(element))
1825
+ element = document.getElementById(element);
1826
+ return Element.extend(element);
1827
+ }
1828
+
1829
+ if (Prototype.BrowserFeatures.XPath) {
1830
+ document._getElementsByXPath = function(expression, parentElement) {
1831
+ var results = [];
1832
+ var query = document.evaluate(expression, $(parentElement) || document,
1833
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1834
+ for (var i = 0, length = query.snapshotLength; i < length; i++)
1835
+ results.push(Element.extend(query.snapshotItem(i)));
1836
+ return results;
1837
+ };
1838
+ }
1839
+
1840
+ /*--------------------------------------------------------------------------*/
1841
+
1842
+ if (!Node) var Node = { };
1843
+
1844
+ if (!Node.ELEMENT_NODE) {
1845
+ Object.extend(Node, {
1846
+ ELEMENT_NODE: 1,
1847
+ ATTRIBUTE_NODE: 2,
1848
+ TEXT_NODE: 3,
1849
+ CDATA_SECTION_NODE: 4,
1850
+ ENTITY_REFERENCE_NODE: 5,
1851
+ ENTITY_NODE: 6,
1852
+ PROCESSING_INSTRUCTION_NODE: 7,
1853
+ COMMENT_NODE: 8,
1854
+ DOCUMENT_NODE: 9,
1855
+ DOCUMENT_TYPE_NODE: 10,
1856
+ DOCUMENT_FRAGMENT_NODE: 11,
1857
+ NOTATION_NODE: 12
1858
+ });
1859
+ }
1860
+
1861
+
1862
+
1863
+ (function(global) {
1864
+ function shouldUseCache(tagName, attributes) {
1865
+ if (tagName === 'select') return false;
1866
+ if ('type' in attributes) return false;
1867
+ return true;
1868
+ }
1869
+
1870
+ var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){
1871
+ try {
1872
+ var el = document.createElement('<input name="x">');
1873
+ return el.tagName.toLowerCase() === 'input' && el.name === 'x';
1874
+ }
1875
+ catch(err) {
1876
+ return false;
1877
+ }
1878
+ })();
1879
+
1880
+ var element = global.Element;
1881
+
1882
+ global.Element = function(tagName, attributes) {
1883
+ attributes = attributes || { };
1884
+ tagName = tagName.toLowerCase();
1885
+ var cache = Element.cache;
1886
+
1887
+ if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) {
1888
+ tagName = '<' + tagName + ' name="' + attributes.name + '">';
1889
+ delete attributes.name;
1890
+ return Element.writeAttribute(document.createElement(tagName), attributes);
1891
+ }
1892
+
1893
+ if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
1894
+
1895
+ var node = shouldUseCache(tagName, attributes) ?
1896
+ cache[tagName].cloneNode(false) : document.createElement(tagName);
1897
+
1898
+ return Element.writeAttribute(node, attributes);
1899
+ };
1900
+
1901
+ Object.extend(global.Element, element || { });
1902
+ if (element) global.Element.prototype = element.prototype;
1903
+
1904
+ })(this);
1905
+
1906
+ Element.idCounter = 1;
1907
+ Element.cache = { };
1908
+
1909
+ Element._purgeElement = function(element) {
1910
+ var uid = element._prototypeUID;
1911
+ if (uid) {
1912
+ Element.stopObserving(element);
1913
+ element._prototypeUID = void 0;
1914
+ delete Element.Storage[uid];
1915
+ }
1916
+ }
1917
+
1918
+ Element.Methods = {
1919
+ visible: function(element) {
1920
+ return $(element).style.display != 'none';
1921
+ },
1922
+
1923
+ toggle: function(element) {
1924
+ element = $(element);
1925
+ Element[Element.visible(element) ? 'hide' : 'show'](element);
1926
+ return element;
1927
+ },
1928
+
1929
+ hide: function(element) {
1930
+ element = $(element);
1931
+ element.style.display = 'none';
1932
+ return element;
1933
+ },
1934
+
1935
+ show: function(element) {
1936
+ element = $(element);
1937
+ element.style.display = '';
1938
+ return element;
1939
+ },
1940
+
1941
+ remove: function(element) {
1942
+ element = $(element);
1943
+ element.parentNode.removeChild(element);
1944
+ return element;
1945
+ },
1946
+
1947
+ update: (function(){
1948
+
1949
+ var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
1950
+ var el = document.createElement("select"),
1951
+ isBuggy = true;
1952
+ el.innerHTML = "<option value=\"test\">test</option>";
1953
+ if (el.options && el.options[0]) {
1954
+ isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
1955
+ }
1956
+ el = null;
1957
+ return isBuggy;
1958
+ })();
1959
+
1960
+ var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
1961
+ try {
1962
+ var el = document.createElement("table");
1963
+ if (el && el.tBodies) {
1964
+ el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
1965
+ var isBuggy = typeof el.tBodies[0] == "undefined";
1966
+ el = null;
1967
+ return isBuggy;
1968
+ }
1969
+ } catch (e) {
1970
+ return true;
1971
+ }
1972
+ })();
1973
+
1974
+ var LINK_ELEMENT_INNERHTML_BUGGY = (function() {
1975
+ try {
1976
+ var el = document.createElement('div');
1977
+ el.innerHTML = "<link>";
1978
+ var isBuggy = (el.childNodes.length === 0);
1979
+ el = null;
1980
+ return isBuggy;
1981
+ } catch(e) {
1982
+ return true;
1983
+ }
1984
+ })();
1985
+
1986
+ var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY ||
1987
+ TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY;
1988
+
1989
+ var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
1990
+ var s = document.createElement("script"),
1991
+ isBuggy = false;
1992
+ try {
1993
+ s.appendChild(document.createTextNode(""));
1994
+ isBuggy = !s.firstChild ||
1995
+ s.firstChild && s.firstChild.nodeType !== 3;
1996
+ } catch (e) {
1997
+ isBuggy = true;
1998
+ }
1999
+ s = null;
2000
+ return isBuggy;
2001
+ })();
2002
+
2003
+
2004
+ function update(element, content) {
2005
+ element = $(element);
2006
+ var purgeElement = Element._purgeElement;
2007
+
2008
+ var descendants = element.getElementsByTagName('*'),
2009
+ i = descendants.length;
2010
+ while (i--) purgeElement(descendants[i]);
2011
+
2012
+ if (content && content.toElement)
2013
+ content = content.toElement();
2014
+
2015
+ if (Object.isElement(content))
2016
+ return element.update().insert(content);
2017
+
2018
+ content = Object.toHTML(content);
2019
+
2020
+ var tagName = element.tagName.toUpperCase();
2021
+
2022
+ if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
2023
+ element.text = content;
2024
+ return element;
2025
+ }
2026
+
2027
+ if (ANY_INNERHTML_BUGGY) {
2028
+ if (tagName in Element._insertionTranslations.tags) {
2029
+ while (element.firstChild) {
2030
+ element.removeChild(element.firstChild);
2031
+ }
2032
+ Element._getContentFromAnonymousElement(tagName, content.stripScripts())
2033
+ .each(function(node) {
2034
+ element.appendChild(node)
2035
+ });
2036
+ } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf('<link') > -1) {
2037
+ while (element.firstChild) {
2038
+ element.removeChild(element.firstChild);
2039
+ }
2040
+ var nodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts(), true);
2041
+ nodes.each(function(node) { element.appendChild(node) });
2042
+ }
2043
+ else {
2044
+ element.innerHTML = content.stripScripts();
2045
+ }
2046
+ }
2047
+ else {
2048
+ element.innerHTML = content.stripScripts();
2049
+ }
2050
+
2051
+ content.evalScripts.bind(content).defer();
2052
+ return element;
2053
+ }
2054
+
2055
+ return update;
2056
+ })(),
2057
+
2058
+ replace: function(element, content) {
2059
+ element = $(element);
2060
+ if (content && content.toElement) content = content.toElement();
2061
+ else if (!Object.isElement(content)) {
2062
+ content = Object.toHTML(content);
2063
+ var range = element.ownerDocument.createRange();
2064
+ range.selectNode(element);
2065
+ content.evalScripts.bind(content).defer();
2066
+ content = range.createContextualFragment(content.stripScripts());
2067
+ }
2068
+ element.parentNode.replaceChild(content, element);
2069
+ return element;
2070
+ },
2071
+
2072
+ insert: function(element, insertions) {
2073
+ element = $(element);
2074
+
2075
+ if (Object.isString(insertions) || Object.isNumber(insertions) ||
2076
+ Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
2077
+ insertions = {bottom:insertions};
2078
+
2079
+ var content, insert, tagName, childNodes;
2080
+
2081
+ for (var position in insertions) {
2082
+ content = insertions[position];
2083
+ position = position.toLowerCase();
2084
+ insert = Element._insertionTranslations[position];
2085
+
2086
+ if (content && content.toElement) content = content.toElement();
2087
+ if (Object.isElement(content)) {
2088
+ insert(element, content);
2089
+ continue;
2090
+ }
2091
+
2092
+ content = Object.toHTML(content);
2093
+
2094
+ tagName = ((position == 'before' || position == 'after')
2095
+ ? element.parentNode : element).tagName.toUpperCase();
2096
+
2097
+ childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
2098
+
2099
+ if (position == 'top' || position == 'after') childNodes.reverse();
2100
+ childNodes.each(insert.curry(element));
2101
+
2102
+ content.evalScripts.bind(content).defer();
2103
+ }
2104
+
2105
+ return element;
2106
+ },
2107
+
2108
+ wrap: function(element, wrapper, attributes) {
2109
+ element = $(element);
2110
+ if (Object.isElement(wrapper))
2111
+ $(wrapper).writeAttribute(attributes || { });
2112
+ else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
2113
+ else wrapper = new Element('div', wrapper);
2114
+ if (element.parentNode)
2115
+ element.parentNode.replaceChild(wrapper, element);
2116
+ wrapper.appendChild(element);
2117
+ return wrapper;
2118
+ },
2119
+
2120
+ inspect: function(element) {
2121
+ element = $(element);
2122
+ var result = '<' + element.tagName.toLowerCase();
2123
+ $H({'id': 'id', 'className': 'class'}).each(function(pair) {
2124
+ var property = pair.first(),
2125
+ attribute = pair.last(),
2126
+ value = (element[property] || '').toString();
2127
+ if (value) result += ' ' + attribute + '=' + value.inspect(true);
2128
+ });
2129
+ return result + '>';
2130
+ },
2131
+
2132
+ recursivelyCollect: function(element, property, maximumLength) {
2133
+ element = $(element);
2134
+ maximumLength = maximumLength || -1;
2135
+ var elements = [];
2136
+
2137
+ while (element = element[property]) {
2138
+ if (element.nodeType == 1)
2139
+ elements.push(Element.extend(element));
2140
+ if (elements.length == maximumLength)
2141
+ break;
2142
+ }
2143
+
2144
+ return elements;
2145
+ },
2146
+
2147
+ ancestors: function(element) {
2148
+ return Element.recursivelyCollect(element, 'parentNode');
2149
+ },
2150
+
2151
+ descendants: function(element) {
2152
+ return Element.select(element, "*");
2153
+ },
2154
+
2155
+ firstDescendant: function(element) {
2156
+ element = $(element).firstChild;
2157
+ while (element && element.nodeType != 1) element = element.nextSibling;
2158
+ return $(element);
2159
+ },
2160
+
2161
+ immediateDescendants: function(element) {
2162
+ var results = [], child = $(element).firstChild;
2163
+ while (child) {
2164
+ if (child.nodeType === 1) {
2165
+ results.push(Element.extend(child));
2166
+ }
2167
+ child = child.nextSibling;
2168
+ }
2169
+ return results;
2170
+ },
2171
+
2172
+ previousSiblings: function(element, maximumLength) {
2173
+ return Element.recursivelyCollect(element, 'previousSibling');
2174
+ },
2175
+
2176
+ nextSiblings: function(element) {
2177
+ return Element.recursivelyCollect(element, 'nextSibling');
2178
+ },
2179
+
2180
+ siblings: function(element) {
2181
+ element = $(element);
2182
+ return Element.previousSiblings(element).reverse()
2183
+ .concat(Element.nextSiblings(element));
2184
+ },
2185
+
2186
+ match: function(element, selector) {
2187
+ element = $(element);
2188
+ if (Object.isString(selector))
2189
+ return Prototype.Selector.match(element, selector);
2190
+ return selector.match(element);
2191
+ },
2192
+
2193
+ up: function(element, expression, index) {
2194
+ element = $(element);
2195
+ if (arguments.length == 1) return $(element.parentNode);
2196
+ var ancestors = Element.ancestors(element);
2197
+ return Object.isNumber(expression) ? ancestors[expression] :
2198
+ Prototype.Selector.find(ancestors, expression, index);
2199
+ },
2200
+
2201
+ down: function(element, expression, index) {
2202
+ element = $(element);
2203
+ if (arguments.length == 1) return Element.firstDescendant(element);
2204
+ return Object.isNumber(expression) ? Element.descendants(element)[expression] :
2205
+ Element.select(element, expression)[index || 0];
2206
+ },
2207
+
2208
+ previous: function(element, expression, index) {
2209
+ element = $(element);
2210
+ if (Object.isNumber(expression)) index = expression, expression = false;
2211
+ if (!Object.isNumber(index)) index = 0;
2212
+
2213
+ if (expression) {
2214
+ return Prototype.Selector.find(element.previousSiblings(), expression, index);
2215
+ } else {
2216
+ return element.recursivelyCollect("previousSibling", index + 1)[index];
2217
+ }
2218
+ },
2219
+
2220
+ next: function(element, expression, index) {
2221
+ element = $(element);
2222
+ if (Object.isNumber(expression)) index = expression, expression = false;
2223
+ if (!Object.isNumber(index)) index = 0;
2224
+
2225
+ if (expression) {
2226
+ return Prototype.Selector.find(element.nextSiblings(), expression, index);
2227
+ } else {
2228
+ var maximumLength = Object.isNumber(index) ? index + 1 : 1;
2229
+ return element.recursivelyCollect("nextSibling", index + 1)[index];
2230
+ }
2231
+ },
2232
+
2233
+
2234
+ select: function(element) {
2235
+ element = $(element);
2236
+ var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
2237
+ return Prototype.Selector.select(expressions, element);
2238
+ },
2239
+
2240
+ adjacent: function(element) {
2241
+ element = $(element);
2242
+ var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
2243
+ return Prototype.Selector.select(expressions, element.parentNode).without(element);
2244
+ },
2245
+
2246
+ identify: function(element) {
2247
+ element = $(element);
2248
+ var id = Element.readAttribute(element, 'id');
2249
+ if (id) return id;
2250
+ do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
2251
+ Element.writeAttribute(element, 'id', id);
2252
+ return id;
2253
+ },
2254
+
2255
+ readAttribute: function(element, name) {
2256
+ element = $(element);
2257
+ if (Prototype.Browser.IE) {
2258
+ var t = Element._attributeTranslations.read;
2259
+ if (t.values[name]) return t.values[name](element, name);
2260
+ if (t.names[name]) name = t.names[name];
2261
+ if (name.include(':')) {
2262
+ return (!element.attributes || !element.attributes[name]) ? null :
2263
+ element.attributes[name].value;
2264
+ }
2265
+ }
2266
+ return element.getAttribute(name);
2267
+ },
2268
+
2269
+ writeAttribute: function(element, name, value) {
2270
+ element = $(element);
2271
+ var attributes = { }, t = Element._attributeTranslations.write;
2272
+
2273
+ if (typeof name == 'object') attributes = name;
2274
+ else attributes[name] = Object.isUndefined(value) ? true : value;
2275
+
2276
+ for (var attr in attributes) {
2277
+ name = t.names[attr] || attr;
2278
+ value = attributes[attr];
2279
+ if (t.values[attr]) name = t.values[attr](element, value);
2280
+ if (value === false || value === null)
2281
+ element.removeAttribute(name);
2282
+ else if (value === true)
2283
+ element.setAttribute(name, name);
2284
+ else element.setAttribute(name, value);
2285
+ }
2286
+ return element;
2287
+ },
2288
+
2289
+ getHeight: function(element) {
2290
+ return Element.getDimensions(element).height;
2291
+ },
2292
+
2293
+ getWidth: function(element) {
2294
+ return Element.getDimensions(element).width;
2295
+ },
2296
+
2297
+ classNames: function(element) {
2298
+ return new Element.ClassNames(element);
2299
+ },
2300
+
2301
+ hasClassName: function(element, className) {
2302
+ if (!(element = $(element))) return;
2303
+ var elementClassName = element.className;
2304
+ return (elementClassName.length > 0 && (elementClassName == className ||
2305
+ new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
2306
+ },
2307
+
2308
+ addClassName: function(element, className) {
2309
+ if (!(element = $(element))) return;
2310
+ if (!Element.hasClassName(element, className))
2311
+ element.className += (element.className ? ' ' : '') + className;
2312
+ return element;
2313
+ },
2314
+
2315
+ removeClassName: function(element, className) {
2316
+ if (!(element = $(element))) return;
2317
+ element.className = element.className.replace(
2318
+ new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
2319
+ return element;
2320
+ },
2321
+
2322
+ toggleClassName: function(element, className) {
2323
+ if (!(element = $(element))) return;
2324
+ return Element[Element.hasClassName(element, className) ?
2325
+ 'removeClassName' : 'addClassName'](element, className);
2326
+ },
2327
+
2328
+ cleanWhitespace: function(element) {
2329
+ element = $(element);
2330
+ var node = element.firstChild;
2331
+ while (node) {
2332
+ var nextNode = node.nextSibling;
2333
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
2334
+ element.removeChild(node);
2335
+ node = nextNode;
2336
+ }
2337
+ return element;
2338
+ },
2339
+
2340
+ empty: function(element) {
2341
+ return $(element).innerHTML.blank();
2342
+ },
2343
+
2344
+ descendantOf: function(element, ancestor) {
2345
+ element = $(element), ancestor = $(ancestor);
2346
+
2347
+ if (element.compareDocumentPosition)
2348
+ return (element.compareDocumentPosition(ancestor) & 8) === 8;
2349
+
2350
+ if (ancestor.contains)
2351
+ return ancestor.contains(element) && ancestor !== element;
2352
+
2353
+ while (element = element.parentNode)
2354
+ if (element == ancestor) return true;
2355
+
2356
+ return false;
2357
+ },
2358
+
2359
+ scrollTo: function(element) {
2360
+ element = $(element);
2361
+ var pos = Element.cumulativeOffset(element);
2362
+ window.scrollTo(pos[0], pos[1]);
2363
+ return element;
2364
+ },
2365
+
2366
+ getStyle: function(element, style) {
2367
+ element = $(element);
2368
+ style = style == 'float' ? 'cssFloat' : style.camelize();
2369
+ var value = element.style[style];
2370
+ if (!value || value == 'auto') {
2371
+ var css = document.defaultView.getComputedStyle(element, null);
2372
+ value = css ? css[style] : null;
2373
+ }
2374
+ if (style == 'opacity') return value ? parseFloat(value) : 1.0;
2375
+ return value == 'auto' ? null : value;
2376
+ },
2377
+
2378
+ getOpacity: function(element) {
2379
+ return $(element).getStyle('opacity');
2380
+ },
2381
+
2382
+ setStyle: function(element, styles) {
2383
+ element = $(element);
2384
+ var elementStyle = element.style, match;
2385
+ if (Object.isString(styles)) {
2386
+ element.style.cssText += ';' + styles;
2387
+ return styles.include('opacity') ?
2388
+ element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
2389
+ }
2390
+ for (var property in styles)
2391
+ if (property == 'opacity') element.setOpacity(styles[property]);
2392
+ else
2393
+ elementStyle[(property == 'float' || property == 'cssFloat') ?
2394
+ (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
2395
+ property] = styles[property];
2396
+
2397
+ return element;
2398
+ },
2399
+
2400
+ setOpacity: function(element, value) {
2401
+ element = $(element);
2402
+ element.style.opacity = (value == 1 || value === '') ? '' :
2403
+ (value < 0.00001) ? 0 : value;
2404
+ return element;
2405
+ },
2406
+
2407
+ makePositioned: function(element) {
2408
+ element = $(element);
2409
+ var pos = Element.getStyle(element, 'position');
2410
+ if (pos == 'static' || !pos) {
2411
+ element._madePositioned = true;
2412
+ element.style.position = 'relative';
2413
+ if (Prototype.Browser.Opera) {
2414
+ element.style.top = 0;
2415
+ element.style.left = 0;
2416
+ }
2417
+ }
2418
+ return element;
2419
+ },
2420
+
2421
+ undoPositioned: function(element) {
2422
+ element = $(element);
2423
+ if (element._madePositioned) {
2424
+ element._madePositioned = undefined;
2425
+ element.style.position =
2426
+ element.style.top =
2427
+ element.style.left =
2428
+ element.style.bottom =
2429
+ element.style.right = '';
2430
+ }
2431
+ return element;
2432
+ },
2433
+
2434
+ makeClipping: function(element) {
2435
+ element = $(element);
2436
+ if (element._overflow) return element;
2437
+ element._overflow = Element.getStyle(element, 'overflow') || 'auto';
2438
+ if (element._overflow !== 'hidden')
2439
+ element.style.overflow = 'hidden';
2440
+ return element;
2441
+ },
2442
+
2443
+ undoClipping: function(element) {
2444
+ element = $(element);
2445
+ if (!element._overflow) return element;
2446
+ element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
2447
+ element._overflow = null;
2448
+ return element;
2449
+ },
2450
+
2451
+ clonePosition: function(element, source) {
2452
+ var options = Object.extend({
2453
+ setLeft: true,
2454
+ setTop: true,
2455
+ setWidth: true,
2456
+ setHeight: true,
2457
+ offsetTop: 0,
2458
+ offsetLeft: 0
2459
+ }, arguments[2] || { });
2460
+
2461
+ source = $(source);
2462
+ var p = Element.viewportOffset(source), delta = [0, 0], parent = null;
2463
+
2464
+ element = $(element);
2465
+
2466
+ if (Element.getStyle(element, 'position') == 'absolute') {
2467
+ parent = Element.getOffsetParent(element);
2468
+ delta = Element.viewportOffset(parent);
2469
+ }
2470
+
2471
+ if (parent == document.body) {
2472
+ delta[0] -= document.body.offsetLeft;
2473
+ delta[1] -= document.body.offsetTop;
2474
+ }
2475
+
2476
+ if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
2477
+ if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
2478
+ if (options.setWidth) element.style.width = source.offsetWidth + 'px';
2479
+ if (options.setHeight) element.style.height = source.offsetHeight + 'px';
2480
+ return element;
2481
+ }
2482
+ };
2483
+
2484
+ Object.extend(Element.Methods, {
2485
+ getElementsBySelector: Element.Methods.select,
2486
+
2487
+ childElements: Element.Methods.immediateDescendants
2488
+ });
2489
+
2490
+ Element._attributeTranslations = {
2491
+ write: {
2492
+ names: {
2493
+ className: 'class',
2494
+ htmlFor: 'for'
2495
+ },
2496
+ values: { }
2497
+ }
2498
+ };
2499
+
2500
+ if (Prototype.Browser.Opera) {
2501
+ Element.Methods.getStyle = Element.Methods.getStyle.wrap(
2502
+ function(proceed, element, style) {
2503
+ switch (style) {
2504
+ case 'height': case 'width':
2505
+ if (!Element.visible(element)) return null;
2506
+
2507
+ var dim = parseInt(proceed(element, style), 10);
2508
+
2509
+ if (dim !== element['offset' + style.capitalize()])
2510
+ return dim + 'px';
2511
+
2512
+ var properties;
2513
+ if (style === 'height') {
2514
+ properties = ['border-top-width', 'padding-top',
2515
+ 'padding-bottom', 'border-bottom-width'];
2516
+ }
2517
+ else {
2518
+ properties = ['border-left-width', 'padding-left',
2519
+ 'padding-right', 'border-right-width'];
2520
+ }
2521
+ return properties.inject(dim, function(memo, property) {
2522
+ var val = proceed(element, property);
2523
+ return val === null ? memo : memo - parseInt(val, 10);
2524
+ }) + 'px';
2525
+ default: return proceed(element, style);
2526
+ }
2527
+ }
2528
+ );
2529
+
2530
+ Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
2531
+ function(proceed, element, attribute) {
2532
+ if (attribute === 'title') return element.title;
2533
+ return proceed(element, attribute);
2534
+ }
2535
+ );
2536
+ }
2537
+
2538
+ else if (Prototype.Browser.IE) {
2539
+ Element.Methods.getStyle = function(element, style) {
2540
+ element = $(element);
2541
+ style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
2542
+ var value = element.style[style];
2543
+ if (!value && element.currentStyle) value = element.currentStyle[style];
2544
+
2545
+ if (style == 'opacity') {
2546
+ if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
2547
+ if (value[1]) return parseFloat(value[1]) / 100;
2548
+ return 1.0;
2549
+ }
2550
+
2551
+ if (value == 'auto') {
2552
+ if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
2553
+ return element['offset' + style.capitalize()] + 'px';
2554
+ return null;
2555
+ }
2556
+ return value;
2557
+ };
2558
+
2559
+ Element.Methods.setOpacity = function(element, value) {
2560
+ function stripAlpha(filter){
2561
+ return filter.replace(/alpha\([^\)]*\)/gi,'');
2562
+ }
2563
+ element = $(element);
2564
+ var currentStyle = element.currentStyle;
2565
+ if ((currentStyle && !currentStyle.hasLayout) ||
2566
+ (!currentStyle && element.style.zoom == 'normal'))
2567
+ element.style.zoom = 1;
2568
+
2569
+ var filter = element.getStyle('filter'), style = element.style;
2570
+ if (value == 1 || value === '') {
2571
+ (filter = stripAlpha(filter)) ?
2572
+ style.filter = filter : style.removeAttribute('filter');
2573
+ return element;
2574
+ } else if (value < 0.00001) value = 0;
2575
+ style.filter = stripAlpha(filter) +
2576
+ 'alpha(opacity=' + (value * 100) + ')';
2577
+ return element;
2578
+ };
2579
+
2580
+ Element._attributeTranslations = (function(){
2581
+
2582
+ var classProp = 'className',
2583
+ forProp = 'for',
2584
+ el = document.createElement('div');
2585
+
2586
+ el.setAttribute(classProp, 'x');
2587
+
2588
+ if (el.className !== 'x') {
2589
+ el.setAttribute('class', 'x');
2590
+ if (el.className === 'x') {
2591
+ classProp = 'class';
2592
+ }
2593
+ }
2594
+ el = null;
2595
+
2596
+ el = document.createElement('label');
2597
+ el.setAttribute(forProp, 'x');
2598
+ if (el.htmlFor !== 'x') {
2599
+ el.setAttribute('htmlFor', 'x');
2600
+ if (el.htmlFor === 'x') {
2601
+ forProp = 'htmlFor';
2602
+ }
2603
+ }
2604
+ el = null;
2605
+
2606
+ return {
2607
+ read: {
2608
+ names: {
2609
+ 'class': classProp,
2610
+ 'className': classProp,
2611
+ 'for': forProp,
2612
+ 'htmlFor': forProp
2613
+ },
2614
+ values: {
2615
+ _getAttr: function(element, attribute) {
2616
+ return element.getAttribute(attribute);
2617
+ },
2618
+ _getAttr2: function(element, attribute) {
2619
+ return element.getAttribute(attribute, 2);
2620
+ },
2621
+ _getAttrNode: function(element, attribute) {
2622
+ var node = element.getAttributeNode(attribute);
2623
+ return node ? node.value : "";
2624
+ },
2625
+ _getEv: (function(){
2626
+
2627
+ var el = document.createElement('div'), f;
2628
+ el.onclick = Prototype.emptyFunction;
2629
+ var value = el.getAttribute('onclick');
2630
+
2631
+ if (String(value).indexOf('{') > -1) {
2632
+ f = function(element, attribute) {
2633
+ attribute = element.getAttribute(attribute);
2634
+ if (!attribute) return null;
2635
+ attribute = attribute.toString();
2636
+ attribute = attribute.split('{')[1];
2637
+ attribute = attribute.split('}')[0];
2638
+ return attribute.strip();
2639
+ };
2640
+ }
2641
+ else if (value === '') {
2642
+ f = function(element, attribute) {
2643
+ attribute = element.getAttribute(attribute);
2644
+ if (!attribute) return null;
2645
+ return attribute.strip();
2646
+ };
2647
+ }
2648
+ el = null;
2649
+ return f;
2650
+ })(),
2651
+ _flag: function(element, attribute) {
2652
+ return $(element).hasAttribute(attribute) ? attribute : null;
2653
+ },
2654
+ style: function(element) {
2655
+ return element.style.cssText.toLowerCase();
2656
+ },
2657
+ title: function(element) {
2658
+ return element.title;
2659
+ }
2660
+ }
2661
+ }
2662
+ }
2663
+ })();
2664
+
2665
+ Element._attributeTranslations.write = {
2666
+ names: Object.extend({
2667
+ cellpadding: 'cellPadding',
2668
+ cellspacing: 'cellSpacing'
2669
+ }, Element._attributeTranslations.read.names),
2670
+ values: {
2671
+ checked: function(element, value) {
2672
+ element.checked = !!value;
2673
+ },
2674
+
2675
+ style: function(element, value) {
2676
+ element.style.cssText = value ? value : '';
2677
+ }
2678
+ }
2679
+ };
2680
+
2681
+ Element._attributeTranslations.has = {};
2682
+
2683
+ $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
2684
+ 'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
2685
+ Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
2686
+ Element._attributeTranslations.has[attr.toLowerCase()] = attr;
2687
+ });
2688
+
2689
+ (function(v) {
2690
+ Object.extend(v, {
2691
+ href: v._getAttr2,
2692
+ src: v._getAttr2,
2693
+ type: v._getAttr,
2694
+ action: v._getAttrNode,
2695
+ disabled: v._flag,
2696
+ checked: v._flag,
2697
+ readonly: v._flag,
2698
+ multiple: v._flag,
2699
+ onload: v._getEv,
2700
+ onunload: v._getEv,
2701
+ onclick: v._getEv,
2702
+ ondblclick: v._getEv,
2703
+ onmousedown: v._getEv,
2704
+ onmouseup: v._getEv,
2705
+ onmouseover: v._getEv,
2706
+ onmousemove: v._getEv,
2707
+ onmouseout: v._getEv,
2708
+ onfocus: v._getEv,
2709
+ onblur: v._getEv,
2710
+ onkeypress: v._getEv,
2711
+ onkeydown: v._getEv,
2712
+ onkeyup: v._getEv,
2713
+ onsubmit: v._getEv,
2714
+ onreset: v._getEv,
2715
+ onselect: v._getEv,
2716
+ onchange: v._getEv
2717
+ });
2718
+ })(Element._attributeTranslations.read.values);
2719
+
2720
+ if (Prototype.BrowserFeatures.ElementExtensions) {
2721
+ (function() {
2722
+ function _descendants(element) {
2723
+ var nodes = element.getElementsByTagName('*'), results = [];
2724
+ for (var i = 0, node; node = nodes[i]; i++)
2725
+ if (node.tagName !== "!") // Filter out comment nodes.
2726
+ results.push(node);
2727
+ return results;
2728
+ }
2729
+
2730
+ Element.Methods.down = function(element, expression, index) {
2731
+ element = $(element);
2732
+ if (arguments.length == 1) return element.firstDescendant();
2733
+ return Object.isNumber(expression) ? _descendants(element)[expression] :
2734
+ Element.select(element, expression)[index || 0];
2735
+ }
2736
+ })();
2737
+ }
2738
+
2739
+ }
2740
+
2741
+ else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
2742
+ Element.Methods.setOpacity = function(element, value) {
2743
+ element = $(element);
2744
+ element.style.opacity = (value == 1) ? 0.999999 :
2745
+ (value === '') ? '' : (value < 0.00001) ? 0 : value;
2746
+ return element;
2747
+ };
2748
+ }
2749
+
2750
+ else if (Prototype.Browser.WebKit) {
2751
+ Element.Methods.setOpacity = function(element, value) {
2752
+ element = $(element);
2753
+ element.style.opacity = (value == 1 || value === '') ? '' :
2754
+ (value < 0.00001) ? 0 : value;
2755
+
2756
+ if (value == 1)
2757
+ if (element.tagName.toUpperCase() == 'IMG' && element.width) {
2758
+ element.width++; element.width--;
2759
+ } else try {
2760
+ var n = document.createTextNode(' ');
2761
+ element.appendChild(n);
2762
+ element.removeChild(n);
2763
+ } catch (e) { }
2764
+
2765
+ return element;
2766
+ };
2767
+ }
2768
+
2769
+ if ('outerHTML' in document.documentElement) {
2770
+ Element.Methods.replace = function(element, content) {
2771
+ element = $(element);
2772
+
2773
+ if (content && content.toElement) content = content.toElement();
2774
+ if (Object.isElement(content)) {
2775
+ element.parentNode.replaceChild(content, element);
2776
+ return element;
2777
+ }
2778
+
2779
+ content = Object.toHTML(content);
2780
+ var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
2781
+
2782
+ if (Element._insertionTranslations.tags[tagName]) {
2783
+ var nextSibling = element.next(),
2784
+ fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
2785
+ parent.removeChild(element);
2786
+ if (nextSibling)
2787
+ fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
2788
+ else
2789
+ fragments.each(function(node) { parent.appendChild(node) });
2790
+ }
2791
+ else element.outerHTML = content.stripScripts();
2792
+
2793
+ content.evalScripts.bind(content).defer();
2794
+ return element;
2795
+ };
2796
+ }
2797
+
2798
+ Element._returnOffset = function(l, t) {
2799
+ var result = [l, t];
2800
+ result.left = l;
2801
+ result.top = t;
2802
+ return result;
2803
+ };
2804
+
2805
+ Element._getContentFromAnonymousElement = function(tagName, html, force) {
2806
+ var div = new Element('div'),
2807
+ t = Element._insertionTranslations.tags[tagName];
2808
+
2809
+ var workaround = false;
2810
+ if (t) workaround = true;
2811
+ else if (force) {
2812
+ workaround = true;
2813
+ t = ['', '', 0];
2814
+ }
2815
+
2816
+ if (workaround) {
2817
+ div.innerHTML = '&nbsp;' + t[0] + html + t[1];
2818
+ div.removeChild(div.firstChild);
2819
+ for (var i = t[2]; i--; ) {
2820
+ div = div.firstChild;
2821
+ }
2822
+ }
2823
+ else {
2824
+ div.innerHTML = html;
2825
+ }
2826
+ return $A(div.childNodes);
2827
+ };
2828
+
2829
+ Element._insertionTranslations = {
2830
+ before: function(element, node) {
2831
+ element.parentNode.insertBefore(node, element);
2832
+ },
2833
+ top: function(element, node) {
2834
+ element.insertBefore(node, element.firstChild);
2835
+ },
2836
+ bottom: function(element, node) {
2837
+ element.appendChild(node);
2838
+ },
2839
+ after: function(element, node) {
2840
+ element.parentNode.insertBefore(node, element.nextSibling);
2841
+ },
2842
+ tags: {
2843
+ TABLE: ['<table>', '</table>', 1],
2844
+ TBODY: ['<table><tbody>', '</tbody></table>', 2],
2845
+ TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
2846
+ TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
2847
+ SELECT: ['<select>', '</select>', 1]
2848
+ }
2849
+ };
2850
+
2851
+ (function() {
2852
+ var tags = Element._insertionTranslations.tags;
2853
+ Object.extend(tags, {
2854
+ THEAD: tags.TBODY,
2855
+ TFOOT: tags.TBODY,
2856
+ TH: tags.TD
2857
+ });
2858
+ })();
2859
+
2860
+ Element.Methods.Simulated = {
2861
+ hasAttribute: function(element, attribute) {
2862
+ attribute = Element._attributeTranslations.has[attribute] || attribute;
2863
+ var node = $(element).getAttributeNode(attribute);
2864
+ return !!(node && node.specified);
2865
+ }
2866
+ };
2867
+
2868
+ Element.Methods.ByTag = { };
2869
+
2870
+ Object.extend(Element, Element.Methods);
2871
+
2872
+ (function(div) {
2873
+
2874
+ if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
2875
+ window.HTMLElement = { };
2876
+ window.HTMLElement.prototype = div['__proto__'];
2877
+ Prototype.BrowserFeatures.ElementExtensions = true;
2878
+ }
2879
+
2880
+ div = null;
2881
+
2882
+ })(document.createElement('div'));
2883
+
2884
+ Element.extend = (function() {
2885
+
2886
+ function checkDeficiency(tagName) {
2887
+ if (typeof window.Element != 'undefined') {
2888
+ var proto = window.Element.prototype;
2889
+ if (proto) {
2890
+ var id = '_' + (Math.random()+'').slice(2),
2891
+ el = document.createElement(tagName);
2892
+ proto[id] = 'x';
2893
+ var isBuggy = (el[id] !== 'x');
2894
+ delete proto[id];
2895
+ el = null;
2896
+ return isBuggy;
2897
+ }
2898
+ }
2899
+ return false;
2900
+ }
2901
+
2902
+ function extendElementWith(element, methods) {
2903
+ for (var property in methods) {
2904
+ var value = methods[property];
2905
+ if (Object.isFunction(value) && !(property in element))
2906
+ element[property] = value.methodize();
2907
+ }
2908
+ }
2909
+
2910
+ var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
2911
+
2912
+ if (Prototype.BrowserFeatures.SpecificElementExtensions) {
2913
+ if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
2914
+ return function(element) {
2915
+ if (element && typeof element._extendedByPrototype == 'undefined') {
2916
+ var t = element.tagName;
2917
+ if (t && (/^(?:object|applet|embed)$/i.test(t))) {
2918
+ extendElementWith(element, Element.Methods);
2919
+ extendElementWith(element, Element.Methods.Simulated);
2920
+ extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
2921
+ }
2922
+ }
2923
+ return element;
2924
+ }
2925
+ }
2926
+ return Prototype.K;
2927
+ }
2928
+
2929
+ var Methods = { }, ByTag = Element.Methods.ByTag;
2930
+
2931
+ var extend = Object.extend(function(element) {
2932
+ if (!element || typeof element._extendedByPrototype != 'undefined' ||
2933
+ element.nodeType != 1 || element == window) return element;
2934
+
2935
+ var methods = Object.clone(Methods),
2936
+ tagName = element.tagName.toUpperCase();
2937
+
2938
+ if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
2939
+
2940
+ extendElementWith(element, methods);
2941
+
2942
+ element._extendedByPrototype = Prototype.emptyFunction;
2943
+ return element;
2944
+
2945
+ }, {
2946
+ refresh: function() {
2947
+ if (!Prototype.BrowserFeatures.ElementExtensions) {
2948
+ Object.extend(Methods, Element.Methods);
2949
+ Object.extend(Methods, Element.Methods.Simulated);
2950
+ }
2951
+ }
2952
+ });
2953
+
2954
+ extend.refresh();
2955
+ return extend;
2956
+ })();
2957
+
2958
+ if (document.documentElement.hasAttribute) {
2959
+ Element.hasAttribute = function(element, attribute) {
2960
+ return element.hasAttribute(attribute);
2961
+ };
2962
+ }
2963
+ else {
2964
+ Element.hasAttribute = Element.Methods.Simulated.hasAttribute;
2965
+ }
2966
+
2967
+ Element.addMethods = function(methods) {
2968
+ var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
2969
+
2970
+ if (!methods) {
2971
+ Object.extend(Form, Form.Methods);
2972
+ Object.extend(Form.Element, Form.Element.Methods);
2973
+ Object.extend(Element.Methods.ByTag, {
2974
+ "FORM": Object.clone(Form.Methods),
2975
+ "INPUT": Object.clone(Form.Element.Methods),
2976
+ "SELECT": Object.clone(Form.Element.Methods),
2977
+ "TEXTAREA": Object.clone(Form.Element.Methods),
2978
+ "BUTTON": Object.clone(Form.Element.Methods)
2979
+ });
2980
+ }
2981
+
2982
+ if (arguments.length == 2) {
2983
+ var tagName = methods;
2984
+ methods = arguments[1];
2985
+ }
2986
+
2987
+ if (!tagName) Object.extend(Element.Methods, methods || { });
2988
+ else {
2989
+ if (Object.isArray(tagName)) tagName.each(extend);
2990
+ else extend(tagName);
2991
+ }
2992
+
2993
+ function extend(tagName) {
2994
+ tagName = tagName.toUpperCase();
2995
+ if (!Element.Methods.ByTag[tagName])
2996
+ Element.Methods.ByTag[tagName] = { };
2997
+ Object.extend(Element.Methods.ByTag[tagName], methods);
2998
+ }
2999
+
3000
+ function copy(methods, destination, onlyIfAbsent) {
3001
+ onlyIfAbsent = onlyIfAbsent || false;
3002
+ for (var property in methods) {
3003
+ var value = methods[property];
3004
+ if (!Object.isFunction(value)) continue;
3005
+ if (!onlyIfAbsent || !(property in destination))
3006
+ destination[property] = value.methodize();
3007
+ }
3008
+ }
3009
+
3010
+ function findDOMClass(tagName) {
3011
+ var klass;
3012
+ var trans = {
3013
+ "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
3014
+ "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
3015
+ "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
3016
+ "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
3017
+ "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
3018
+ "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
3019
+ "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
3020
+ "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
3021
+ "FrameSet", "IFRAME": "IFrame"
3022
+ };
3023
+ if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
3024
+ if (window[klass]) return window[klass];
3025
+ klass = 'HTML' + tagName + 'Element';
3026
+ if (window[klass]) return window[klass];
3027
+ klass = 'HTML' + tagName.capitalize() + 'Element';
3028
+ if (window[klass]) return window[klass];
3029
+
3030
+ var element = document.createElement(tagName),
3031
+ proto = element['__proto__'] || element.constructor.prototype;
3032
+
3033
+ element = null;
3034
+ return proto;
3035
+ }
3036
+
3037
+ var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
3038
+ Element.prototype;
3039
+
3040
+ if (F.ElementExtensions) {
3041
+ copy(Element.Methods, elementPrototype);
3042
+ copy(Element.Methods.Simulated, elementPrototype, true);
3043
+ }
3044
+
3045
+ if (F.SpecificElementExtensions) {
3046
+ for (var tag in Element.Methods.ByTag) {
3047
+ var klass = findDOMClass(tag);
3048
+ if (Object.isUndefined(klass)) continue;
3049
+ copy(T[tag], klass.prototype);
3050
+ }
3051
+ }
3052
+
3053
+ Object.extend(Element, Element.Methods);
3054
+ delete Element.ByTag;
3055
+
3056
+ if (Element.extend.refresh) Element.extend.refresh();
3057
+ Element.cache = { };
3058
+ };
3059
+
3060
+
3061
+ document.viewport = {
3062
+
3063
+ getDimensions: function() {
3064
+ return { width: this.getWidth(), height: this.getHeight() };
3065
+ },
3066
+
3067
+ getScrollOffsets: function() {
3068
+ return Element._returnOffset(
3069
+ window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
3070
+ window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
3071
+ }
3072
+ };
3073
+
3074
+ (function(viewport) {
3075
+ var B = Prototype.Browser, doc = document, element, property = {};
3076
+
3077
+ function getRootElement() {
3078
+ if (B.WebKit && !doc.evaluate)
3079
+ return document;
3080
+
3081
+ if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
3082
+ return document.body;
3083
+
3084
+ return document.documentElement;
3085
+ }
3086
+
3087
+ function define(D) {
3088
+ if (!element) element = getRootElement();
3089
+
3090
+ property[D] = 'client' + D;
3091
+
3092
+ viewport['get' + D] = function() { return element[property[D]] };
3093
+ return viewport['get' + D]();
3094
+ }
3095
+
3096
+ viewport.getWidth = define.curry('Width');
3097
+
3098
+ viewport.getHeight = define.curry('Height');
3099
+ })(document.viewport);
3100
+
3101
+
3102
+ Element.Storage = {
3103
+ UID: 1
3104
+ };
3105
+
3106
+ Element.addMethods({
3107
+ getStorage: function(element) {
3108
+ if (!(element = $(element))) return;
3109
+
3110
+ var uid;
3111
+ if (element === window) {
3112
+ uid = 0;
3113
+ } else {
3114
+ if (typeof element._prototypeUID === "undefined")
3115
+ element._prototypeUID = Element.Storage.UID++;
3116
+ uid = element._prototypeUID;
3117
+ }
3118
+
3119
+ if (!Element.Storage[uid])
3120
+ Element.Storage[uid] = $H();
3121
+
3122
+ return Element.Storage[uid];
3123
+ },
3124
+
3125
+ store: function(element, key, value) {
3126
+ if (!(element = $(element))) return;
3127
+
3128
+ if (arguments.length === 2) {
3129
+ Element.getStorage(element).update(key);
3130
+ } else {
3131
+ Element.getStorage(element).set(key, value);
3132
+ }
3133
+
3134
+ return element;
3135
+ },
3136
+
3137
+ retrieve: function(element, key, defaultValue) {
3138
+ if (!(element = $(element))) return;
3139
+ var hash = Element.getStorage(element), value = hash.get(key);
3140
+
3141
+ if (Object.isUndefined(value)) {
3142
+ hash.set(key, defaultValue);
3143
+ value = defaultValue;
3144
+ }
3145
+
3146
+ return value;
3147
+ },
3148
+
3149
+ clone: function(element, deep) {
3150
+ if (!(element = $(element))) return;
3151
+ var clone = element.cloneNode(deep);
3152
+ clone._prototypeUID = void 0;
3153
+ if (deep) {
3154
+ var descendants = Element.select(clone, '*'),
3155
+ i = descendants.length;
3156
+ while (i--) {
3157
+ descendants[i]._prototypeUID = void 0;
3158
+ }
3159
+ }
3160
+ return Element.extend(clone);
3161
+ },
3162
+
3163
+ purge: function(element) {
3164
+ if (!(element = $(element))) return;
3165
+ var purgeElement = Element._purgeElement;
3166
+
3167
+ purgeElement(element);
3168
+
3169
+ var descendants = element.getElementsByTagName('*'),
3170
+ i = descendants.length;
3171
+
3172
+ while (i--) purgeElement(descendants[i]);
3173
+
3174
+ return null;
3175
+ }
3176
+ });
3177
+
3178
+ (function() {
3179
+
3180
+ function toDecimal(pctString) {
3181
+ var match = pctString.match(/^(\d+)%?$/i);
3182
+ if (!match) return null;
3183
+ return (Number(match[1]) / 100);
3184
+ }
3185
+
3186
+ function getPixelValue(value, property, context) {
3187
+ var element = null;
3188
+ if (Object.isElement(value)) {
3189
+ element = value;
3190
+ value = element.getStyle(property);
3191
+ }
3192
+
3193
+ if (value === null) {
3194
+ return null;
3195
+ }
3196
+
3197
+ if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) {
3198
+ return window.parseFloat(value);
3199
+ }
3200
+
3201
+ var isPercentage = value.include('%'), isViewport = (context === document.viewport);
3202
+
3203
+ if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) {
3204
+ var style = element.style.left, rStyle = element.runtimeStyle.left;
3205
+ element.runtimeStyle.left = element.currentStyle.left;
3206
+ element.style.left = value || 0;
3207
+ value = element.style.pixelLeft;
3208
+ element.style.left = style;
3209
+ element.runtimeStyle.left = rStyle;
3210
+
3211
+ return value;
3212
+ }
3213
+
3214
+ if (element && isPercentage) {
3215
+ context = context || element.parentNode;
3216
+ var decimal = toDecimal(value);
3217
+ var whole = null;
3218
+ var position = element.getStyle('position');
3219
+
3220
+ var isHorizontal = property.include('left') || property.include('right') ||
3221
+ property.include('width');
3222
+
3223
+ var isVertical = property.include('top') || property.include('bottom') ||
3224
+ property.include('height');
3225
+
3226
+ if (context === document.viewport) {
3227
+ if (isHorizontal) {
3228
+ whole = document.viewport.getWidth();
3229
+ } else if (isVertical) {
3230
+ whole = document.viewport.getHeight();
3231
+ }
3232
+ } else {
3233
+ if (isHorizontal) {
3234
+ whole = $(context).measure('width');
3235
+ } else if (isVertical) {
3236
+ whole = $(context).measure('height');
3237
+ }
3238
+ }
3239
+
3240
+ return (whole === null) ? 0 : whole * decimal;
3241
+ }
3242
+
3243
+ return 0;
3244
+ }
3245
+
3246
+ function toCSSPixels(number) {
3247
+ if (Object.isString(number) && number.endsWith('px')) {
3248
+ return number;
3249
+ }
3250
+ return number + 'px';
3251
+ }
3252
+
3253
+ function isDisplayed(element) {
3254
+ var originalElement = element;
3255
+ while (element && element.parentNode) {
3256
+ var display = element.getStyle('display');
3257
+ if (display === 'none') {
3258
+ return false;
3259
+ }
3260
+ element = $(element.parentNode);
3261
+ }
3262
+ return true;
3263
+ }
3264
+
3265
+ var hasLayout = Prototype.K;
3266
+ if ('currentStyle' in document.documentElement) {
3267
+ hasLayout = function(element) {
3268
+ if (!element.currentStyle.hasLayout) {
3269
+ element.style.zoom = 1;
3270
+ }
3271
+ return element;
3272
+ };
3273
+ }
3274
+
3275
+ function cssNameFor(key) {
3276
+ if (key.include('border')) key = key + '-width';
3277
+ return key.camelize();
3278
+ }
3279
+
3280
+ Element.Layout = Class.create(Hash, {
3281
+ initialize: function($super, element, preCompute) {
3282
+ $super();
3283
+ this.element = $(element);
3284
+
3285
+ Element.Layout.PROPERTIES.each( function(property) {
3286
+ this._set(property, null);
3287
+ }, this);
3288
+
3289
+ if (preCompute) {
3290
+ this._preComputing = true;
3291
+ this._begin();
3292
+ Element.Layout.PROPERTIES.each( this._compute, this );
3293
+ this._end();
3294
+ this._preComputing = false;
3295
+ }
3296
+ },
3297
+
3298
+ _set: function(property, value) {
3299
+ return Hash.prototype.set.call(this, property, value);
3300
+ },
3301
+
3302
+ set: function(property, value) {
3303
+ throw "Properties of Element.Layout are read-only.";
3304
+ },
3305
+
3306
+ get: function($super, property) {
3307
+ var value = $super(property);
3308
+ return value === null ? this._compute(property) : value;
3309
+ },
3310
+
3311
+ _begin: function() {
3312
+ if (this._prepared) return;
3313
+
3314
+ var element = this.element;
3315
+ if (isDisplayed(element)) {
3316
+ this._prepared = true;
3317
+ return;
3318
+ }
3319
+
3320
+ var originalStyles = {
3321
+ position: element.style.position || '',
3322
+ width: element.style.width || '',
3323
+ visibility: element.style.visibility || '',
3324
+ display: element.style.display || ''
3325
+ };
3326
+
3327
+ element.store('prototype_original_styles', originalStyles);
3328
+
3329
+ var position = element.getStyle('position'),
3330
+ width = element.getStyle('width');
3331
+
3332
+ if (width === "0px" || width === null) {
3333
+ element.style.display = 'block';
3334
+ width = element.getStyle('width');
3335
+ }
3336
+
3337
+ var context = (position === 'fixed') ? document.viewport :
3338
+ element.parentNode;
3339
+
3340
+ element.setStyle({
3341
+ position: 'absolute',
3342
+ visibility: 'hidden',
3343
+ display: 'block'
3344
+ });
3345
+
3346
+ var positionedWidth = element.getStyle('width');
3347
+
3348
+ var newWidth;
3349
+ if (width && (positionedWidth === width)) {
3350
+ newWidth = getPixelValue(element, 'width', context);
3351
+ } else if (position === 'absolute' || position === 'fixed') {
3352
+ newWidth = getPixelValue(element, 'width', context);
3353
+ } else {
3354
+ var parent = element.parentNode, pLayout = $(parent).getLayout();
3355
+
3356
+ newWidth = pLayout.get('width') -
3357
+ this.get('margin-left') -
3358
+ this.get('border-left') -
3359
+ this.get('padding-left') -
3360
+ this.get('padding-right') -
3361
+ this.get('border-right') -
3362
+ this.get('margin-right');
3363
+ }
3364
+
3365
+ element.setStyle({ width: newWidth + 'px' });
3366
+
3367
+ this._prepared = true;
3368
+ },
3369
+
3370
+ _end: function() {
3371
+ var element = this.element;
3372
+ var originalStyles = element.retrieve('prototype_original_styles');
3373
+ element.store('prototype_original_styles', null);
3374
+ element.setStyle(originalStyles);
3375
+ this._prepared = false;
3376
+ },
3377
+
3378
+ _compute: function(property) {
3379
+ var COMPUTATIONS = Element.Layout.COMPUTATIONS;
3380
+ if (!(property in COMPUTATIONS)) {
3381
+ throw "Property not found.";
3382
+ }
3383
+
3384
+ return this._set(property, COMPUTATIONS[property].call(this, this.element));
3385
+ },
3386
+
3387
+ toObject: function() {
3388
+ var args = $A(arguments);
3389
+ var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
3390
+ args.join(' ').split(' ');
3391
+ var obj = {};
3392
+ keys.each( function(key) {
3393
+ if (!Element.Layout.PROPERTIES.include(key)) return;
3394
+ var value = this.get(key);
3395
+ if (value != null) obj[key] = value;
3396
+ }, this);
3397
+ return obj;
3398
+ },
3399
+
3400
+ toHash: function() {
3401
+ var obj = this.toObject.apply(this, arguments);
3402
+ return new Hash(obj);
3403
+ },
3404
+
3405
+ toCSS: function() {
3406
+ var args = $A(arguments);
3407
+ var keys = (args.length === 0) ? Element.Layout.PROPERTIES :
3408
+ args.join(' ').split(' ');
3409
+ var css = {};
3410
+
3411
+ keys.each( function(key) {
3412
+ if (!Element.Layout.PROPERTIES.include(key)) return;
3413
+ if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return;
3414
+
3415
+ var value = this.get(key);
3416
+ if (value != null) css[cssNameFor(key)] = value + 'px';
3417
+ }, this);
3418
+ return css;
3419
+ },
3420
+
3421
+ inspect: function() {
3422
+ return "#<Element.Layout>";
3423
+ }
3424
+ });
3425
+
3426
+ Object.extend(Element.Layout, {
3427
+ PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'),
3428
+
3429
+ COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'),
3430
+
3431
+ COMPUTATIONS: {
3432
+ 'height': function(element) {
3433
+ if (!this._preComputing) this._begin();
3434
+
3435
+ var bHeight = this.get('border-box-height');
3436
+ if (bHeight <= 0) {
3437
+ if (!this._preComputing) this._end();
3438
+ return 0;
3439
+ }
3440
+
3441
+ var bTop = this.get('border-top'),
3442
+ bBottom = this.get('border-bottom');
3443
+
3444
+ var pTop = this.get('padding-top'),
3445
+ pBottom = this.get('padding-bottom');
3446
+
3447
+ if (!this._preComputing) this._end();
3448
+
3449
+ return bHeight - bTop - bBottom - pTop - pBottom;
3450
+ },
3451
+
3452
+ 'width': function(element) {
3453
+ if (!this._preComputing) this._begin();
3454
+
3455
+ var bWidth = this.get('border-box-width');
3456
+ if (bWidth <= 0) {
3457
+ if (!this._preComputing) this._end();
3458
+ return 0;
3459
+ }
3460
+
3461
+ var bLeft = this.get('border-left'),
3462
+ bRight = this.get('border-right');
3463
+
3464
+ var pLeft = this.get('padding-left'),
3465
+ pRight = this.get('padding-right');
3466
+
3467
+ if (!this._preComputing) this._end();
3468
+
3469
+ return bWidth - bLeft - bRight - pLeft - pRight;
3470
+ },
3471
+
3472
+ 'padding-box-height': function(element) {
3473
+ var height = this.get('height'),
3474
+ pTop = this.get('padding-top'),
3475
+ pBottom = this.get('padding-bottom');
3476
+
3477
+ return height + pTop + pBottom;
3478
+ },
3479
+
3480
+ 'padding-box-width': function(element) {
3481
+ var width = this.get('width'),
3482
+ pLeft = this.get('padding-left'),
3483
+ pRight = this.get('padding-right');
3484
+
3485
+ return width + pLeft + pRight;
3486
+ },
3487
+
3488
+ 'border-box-height': function(element) {
3489
+ if (!this._preComputing) this._begin();
3490
+ var height = element.offsetHeight;
3491
+ if (!this._preComputing) this._end();
3492
+ return height;
3493
+ },
3494
+
3495
+ 'border-box-width': function(element) {
3496
+ if (!this._preComputing) this._begin();
3497
+ var width = element.offsetWidth;
3498
+ if (!this._preComputing) this._end();
3499
+ return width;
3500
+ },
3501
+
3502
+ 'margin-box-height': function(element) {
3503
+ var bHeight = this.get('border-box-height'),
3504
+ mTop = this.get('margin-top'),
3505
+ mBottom = this.get('margin-bottom');
3506
+
3507
+ if (bHeight <= 0) return 0;
3508
+
3509
+ return bHeight + mTop + mBottom;
3510
+ },
3511
+
3512
+ 'margin-box-width': function(element) {
3513
+ var bWidth = this.get('border-box-width'),
3514
+ mLeft = this.get('margin-left'),
3515
+ mRight = this.get('margin-right');
3516
+
3517
+ if (bWidth <= 0) return 0;
3518
+
3519
+ return bWidth + mLeft + mRight;
3520
+ },
3521
+
3522
+ 'top': function(element) {
3523
+ var offset = element.positionedOffset();
3524
+ return offset.top;
3525
+ },
3526
+
3527
+ 'bottom': function(element) {
3528
+ var offset = element.positionedOffset(),
3529
+ parent = element.getOffsetParent(),
3530
+ pHeight = parent.measure('height');
3531
+
3532
+ var mHeight = this.get('border-box-height');
3533
+
3534
+ return pHeight - mHeight - offset.top;
3535
+ },
3536
+
3537
+ 'left': function(element) {
3538
+ var offset = element.positionedOffset();
3539
+ return offset.left;
3540
+ },
3541
+
3542
+ 'right': function(element) {
3543
+ var offset = element.positionedOffset(),
3544
+ parent = element.getOffsetParent(),
3545
+ pWidth = parent.measure('width');
3546
+
3547
+ var mWidth = this.get('border-box-width');
3548
+
3549
+ return pWidth - mWidth - offset.left;
3550
+ },
3551
+
3552
+ 'padding-top': function(element) {
3553
+ return getPixelValue(element, 'paddingTop');
3554
+ },
3555
+
3556
+ 'padding-bottom': function(element) {
3557
+ return getPixelValue(element, 'paddingBottom');
3558
+ },
3559
+
3560
+ 'padding-left': function(element) {
3561
+ return getPixelValue(element, 'paddingLeft');
3562
+ },
3563
+
3564
+ 'padding-right': function(element) {
3565
+ return getPixelValue(element, 'paddingRight');
3566
+ },
3567
+
3568
+ 'border-top': function(element) {
3569
+ return getPixelValue(element, 'borderTopWidth');
3570
+ },
3571
+
3572
+ 'border-bottom': function(element) {
3573
+ return getPixelValue(element, 'borderBottomWidth');
3574
+ },
3575
+
3576
+ 'border-left': function(element) {
3577
+ return getPixelValue(element, 'borderLeftWidth');
3578
+ },
3579
+
3580
+ 'border-right': function(element) {
3581
+ return getPixelValue(element, 'borderRightWidth');
3582
+ },
3583
+
3584
+ 'margin-top': function(element) {
3585
+ return getPixelValue(element, 'marginTop');
3586
+ },
3587
+
3588
+ 'margin-bottom': function(element) {
3589
+ return getPixelValue(element, 'marginBottom');
3590
+ },
3591
+
3592
+ 'margin-left': function(element) {
3593
+ return getPixelValue(element, 'marginLeft');
3594
+ },
3595
+
3596
+ 'margin-right': function(element) {
3597
+ return getPixelValue(element, 'marginRight');
3598
+ }
3599
+ }
3600
+ });
3601
+
3602
+ if ('getBoundingClientRect' in document.documentElement) {
3603
+ Object.extend(Element.Layout.COMPUTATIONS, {
3604
+ 'right': function(element) {
3605
+ var parent = hasLayout(element.getOffsetParent());
3606
+ var rect = element.getBoundingClientRect(),
3607
+ pRect = parent.getBoundingClientRect();
3608
+
3609
+ return (pRect.right - rect.right).round();
3610
+ },
3611
+
3612
+ 'bottom': function(element) {
3613
+ var parent = hasLayout(element.getOffsetParent());
3614
+ var rect = element.getBoundingClientRect(),
3615
+ pRect = parent.getBoundingClientRect();
3616
+
3617
+ return (pRect.bottom - rect.bottom).round();
3618
+ }
3619
+ });
3620
+ }
3621
+
3622
+ Element.Offset = Class.create({
3623
+ initialize: function(left, top) {
3624
+ this.left = left.round();
3625
+ this.top = top.round();
3626
+
3627
+ this[0] = this.left;
3628
+ this[1] = this.top;
3629
+ },
3630
+
3631
+ relativeTo: function(offset) {
3632
+ return new Element.Offset(
3633
+ this.left - offset.left,
3634
+ this.top - offset.top
3635
+ );
3636
+ },
3637
+
3638
+ inspect: function() {
3639
+ return "#<Element.Offset left: #{left} top: #{top}>".interpolate(this);
3640
+ },
3641
+
3642
+ toString: function() {
3643
+ return "[#{left}, #{top}]".interpolate(this);
3644
+ },
3645
+
3646
+ toArray: function() {
3647
+ return [this.left, this.top];
3648
+ }
3649
+ });
3650
+
3651
+ function getLayout(element, preCompute) {
3652
+ return new Element.Layout(element, preCompute);
3653
+ }
3654
+
3655
+ function measure(element, property) {
3656
+ return $(element).getLayout().get(property);
3657
+ }
3658
+
3659
+ function getDimensions(element) {
3660
+ element = $(element);
3661
+ var display = Element.getStyle(element, 'display');
3662
+
3663
+ if (display && display !== 'none') {
3664
+ return { width: element.offsetWidth, height: element.offsetHeight };
3665
+ }
3666
+
3667
+ var style = element.style;
3668
+ var originalStyles = {
3669
+ visibility: style.visibility,
3670
+ position: style.position,
3671
+ display: style.display
3672
+ };
3673
+
3674
+ var newStyles = {
3675
+ visibility: 'hidden',
3676
+ display: 'block'
3677
+ };
3678
+
3679
+ if (originalStyles.position !== 'fixed')
3680
+ newStyles.position = 'absolute';
3681
+
3682
+ Element.setStyle(element, newStyles);
3683
+
3684
+ var dimensions = {
3685
+ width: element.offsetWidth,
3686
+ height: element.offsetHeight
3687
+ };
3688
+
3689
+ Element.setStyle(element, originalStyles);
3690
+
3691
+ return dimensions;
3692
+ }
3693
+
3694
+ function getOffsetParent(element) {
3695
+ element = $(element);
3696
+
3697
+ if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
3698
+ return $(document.body);
3699
+
3700
+ var isInline = (Element.getStyle(element, 'display') === 'inline');
3701
+ if (!isInline && element.offsetParent) return $(element.offsetParent);
3702
+
3703
+ while ((element = element.parentNode) && element !== document.body) {
3704
+ if (Element.getStyle(element, 'position') !== 'static') {
3705
+ return isHtml(element) ? $(document.body) : $(element);
3706
+ }
3707
+ }
3708
+
3709
+ return $(document.body);
3710
+ }
3711
+
3712
+
3713
+ function cumulativeOffset(element) {
3714
+ element = $(element);
3715
+ var valueT = 0, valueL = 0;
3716
+ if (element.parentNode) {
3717
+ do {
3718
+ valueT += element.offsetTop || 0;
3719
+ valueL += element.offsetLeft || 0;
3720
+ element = element.offsetParent;
3721
+ } while (element);
3722
+ }
3723
+ return new Element.Offset(valueL, valueT);
3724
+ }
3725
+
3726
+ function positionedOffset(element) {
3727
+ element = $(element);
3728
+
3729
+ var layout = element.getLayout();
3730
+
3731
+ var valueT = 0, valueL = 0;
3732
+ do {
3733
+ valueT += element.offsetTop || 0;
3734
+ valueL += element.offsetLeft || 0;
3735
+ element = element.offsetParent;
3736
+ if (element) {
3737
+ if (isBody(element)) break;
3738
+ var p = Element.getStyle(element, 'position');
3739
+ if (p !== 'static') break;
3740
+ }
3741
+ } while (element);
3742
+
3743
+ valueL -= layout.get('margin-top');
3744
+ valueT -= layout.get('margin-left');
3745
+
3746
+ return new Element.Offset(valueL, valueT);
3747
+ }
3748
+
3749
+ function cumulativeScrollOffset(element) {
3750
+ var valueT = 0, valueL = 0;
3751
+ do {
3752
+ valueT += element.scrollTop || 0;
3753
+ valueL += element.scrollLeft || 0;
3754
+ element = element.parentNode;
3755
+ } while (element);
3756
+ return new Element.Offset(valueL, valueT);
3757
+ }
3758
+
3759
+ function viewportOffset(forElement) {
3760
+ element = $(element);
3761
+ var valueT = 0, valueL = 0, docBody = document.body;
3762
+
3763
+ var element = forElement;
3764
+ do {
3765
+ valueT += element.offsetTop || 0;
3766
+ valueL += element.offsetLeft || 0;
3767
+ if (element.offsetParent == docBody &&
3768
+ Element.getStyle(element, 'position') == 'absolute') break;
3769
+ } while (element = element.offsetParent);
3770
+
3771
+ element = forElement;
3772
+ do {
3773
+ if (element != docBody) {
3774
+ valueT -= element.scrollTop || 0;
3775
+ valueL -= element.scrollLeft || 0;
3776
+ }
3777
+ } while (element = element.parentNode);
3778
+ return new Element.Offset(valueL, valueT);
3779
+ }
3780
+
3781
+ function absolutize(element) {
3782
+ element = $(element);
3783
+
3784
+ if (Element.getStyle(element, 'position') === 'absolute') {
3785
+ return element;
3786
+ }
3787
+
3788
+ var offsetParent = getOffsetParent(element);
3789
+ var eOffset = element.viewportOffset(),
3790
+ pOffset = offsetParent.viewportOffset();
3791
+
3792
+ var offset = eOffset.relativeTo(pOffset);
3793
+ var layout = element.getLayout();
3794
+
3795
+ element.store('prototype_absolutize_original_styles', {
3796
+ left: element.getStyle('left'),
3797
+ top: element.getStyle('top'),
3798
+ width: element.getStyle('width'),
3799
+ height: element.getStyle('height')
3800
+ });
3801
+
3802
+ element.setStyle({
3803
+ position: 'absolute',
3804
+ top: offset.top + 'px',
3805
+ left: offset.left + 'px',
3806
+ width: layout.get('width') + 'px',
3807
+ height: layout.get('height') + 'px'
3808
+ });
3809
+
3810
+ return element;
3811
+ }
3812
+
3813
+ function relativize(element) {
3814
+ element = $(element);
3815
+ if (Element.getStyle(element, 'position') === 'relative') {
3816
+ return element;
3817
+ }
3818
+
3819
+ var originalStyles =
3820
+ element.retrieve('prototype_absolutize_original_styles');
3821
+
3822
+ if (originalStyles) element.setStyle(originalStyles);
3823
+ return element;
3824
+ }
3825
+
3826
+ if (Prototype.Browser.IE) {
3827
+ getOffsetParent = getOffsetParent.wrap(
3828
+ function(proceed, element) {
3829
+ element = $(element);
3830
+
3831
+ if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
3832
+ return $(document.body);
3833
+
3834
+ var position = element.getStyle('position');
3835
+ if (position !== 'static') return proceed(element);
3836
+
3837
+ element.setStyle({ position: 'relative' });
3838
+ var value = proceed(element);
3839
+ element.setStyle({ position: position });
3840
+ return value;
3841
+ }
3842
+ );
3843
+
3844
+ positionedOffset = positionedOffset.wrap(function(proceed, element) {
3845
+ element = $(element);
3846
+ if (!element.parentNode) return new Element.Offset(0, 0);
3847
+ var position = element.getStyle('position');
3848
+ if (position !== 'static') return proceed(element);
3849
+
3850
+ var offsetParent = element.getOffsetParent();
3851
+ if (offsetParent && offsetParent.getStyle('position') === 'fixed')
3852
+ hasLayout(offsetParent);
3853
+
3854
+ element.setStyle({ position: 'relative' });
3855
+ var value = proceed(element);
3856
+ element.setStyle({ position: position });
3857
+ return value;
3858
+ });
3859
+ } else if (Prototype.Browser.Webkit) {
3860
+ cumulativeOffset = function(element) {
3861
+ element = $(element);
3862
+ var valueT = 0, valueL = 0;
3863
+ do {
3864
+ valueT += element.offsetTop || 0;
3865
+ valueL += element.offsetLeft || 0;
3866
+ if (element.offsetParent == document.body)
3867
+ if (Element.getStyle(element, 'position') == 'absolute') break;
3868
+
3869
+ element = element.offsetParent;
3870
+ } while (element);
3871
+
3872
+ return new Element.Offset(valueL, valueT);
3873
+ };
3874
+ }
3875
+
3876
+
3877
+ Element.addMethods({
3878
+ getLayout: getLayout,
3879
+ measure: measure,
3880
+ getDimensions: getDimensions,
3881
+ getOffsetParent: getOffsetParent,
3882
+ cumulativeOffset: cumulativeOffset,
3883
+ positionedOffset: positionedOffset,
3884
+ cumulativeScrollOffset: cumulativeScrollOffset,
3885
+ viewportOffset: viewportOffset,
3886
+ absolutize: absolutize,
3887
+ relativize: relativize
3888
+ });
3889
+
3890
+ function isBody(element) {
3891
+ return element.nodeName.toUpperCase() === 'BODY';
3892
+ }
3893
+
3894
+ function isHtml(element) {
3895
+ return element.nodeName.toUpperCase() === 'HTML';
3896
+ }
3897
+
3898
+ function isDocument(element) {
3899
+ return element.nodeType === Node.DOCUMENT_NODE;
3900
+ }
3901
+
3902
+ function isDetached(element) {
3903
+ return element !== document.body &&
3904
+ !Element.descendantOf(element, document.body);
3905
+ }
3906
+
3907
+ if ('getBoundingClientRect' in document.documentElement) {
3908
+ Element.addMethods({
3909
+ viewportOffset: function(element) {
3910
+ element = $(element);
3911
+ if (isDetached(element)) return new Element.Offset(0, 0);
3912
+
3913
+ var rect = element.getBoundingClientRect(),
3914
+ docEl = document.documentElement;
3915
+ return new Element.Offset(rect.left - docEl.clientLeft,
3916
+ rect.top - docEl.clientTop);
3917
+ }
3918
+ });
3919
+ }
3920
+ })();
3921
+ window.$$ = function() {
3922
+ var expression = $A(arguments).join(', ');
3923
+ return Prototype.Selector.select(expression, document);
3924
+ };
3925
+
3926
+ Prototype.Selector = (function() {
3927
+
3928
+ function select() {
3929
+ throw new Error('Method "Prototype.Selector.select" must be defined.');
3930
+ }
3931
+
3932
+ function match() {
3933
+ throw new Error('Method "Prototype.Selector.match" must be defined.');
3934
+ }
3935
+
3936
+ function find(elements, expression, index) {
3937
+ index = index || 0;
3938
+ var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i;
3939
+
3940
+ for (i = 0; i < length; i++) {
3941
+ if (match(elements[i], expression) && index == matchIndex++) {
3942
+ return Element.extend(elements[i]);
3943
+ }
3944
+ }
3945
+ }
3946
+
3947
+ function extendElements(elements) {
3948
+ for (var i = 0, length = elements.length; i < length; i++) {
3949
+ Element.extend(elements[i]);
3950
+ }
3951
+ return elements;
3952
+ }
3953
+
3954
+
3955
+ var K = Prototype.K;
3956
+
3957
+ return {
3958
+ select: select,
3959
+ match: match,
3960
+ find: find,
3961
+ extendElements: (Element.extend === K) ? K : extendElements,
3962
+ extendElement: Element.extend
3963
+ };
3964
+ })();
3965
+ Prototype._original_property = window.Sizzle;
3966
+ /*!
3967
+ * Sizzle CSS Selector Engine - v1.0
3968
+ * Copyright 2009, The Dojo Foundation
3969
+ * Released under the MIT, BSD, and GPL Licenses.
3970
+ * More information: http://sizzlejs.com/
3971
+ */
3972
+ (function(){
3973
+
3974
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
3975
+ done = 0,
3976
+ toString = Object.prototype.toString,
3977
+ hasDuplicate = false,
3978
+ baseHasDuplicate = true;
3979
+
3980
+ [0, 0].sort(function(){
3981
+ baseHasDuplicate = false;
3982
+ return 0;
3983
+ });
3984
+
3985
+ var Sizzle = function(selector, context, results, seed) {
3986
+ results = results || [];
3987
+ var origContext = context = context || document;
3988
+
3989
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
3990
+ return [];
3991
+ }
3992
+
3993
+ if ( !selector || typeof selector !== "string" ) {
3994
+ return results;
3995
+ }
3996
+
3997
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context),
3998
+ soFar = selector;
3999
+
4000
+ while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
4001
+ soFar = m[3];
4002
+
4003
+ parts.push( m[1] );
4004
+
4005
+ if ( m[2] ) {
4006
+ extra = m[3];
4007
+ break;
4008
+ }
4009
+ }
4010
+
4011
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
4012
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
4013
+ set = posProcess( parts[0] + parts[1], context );
4014
+ } else {
4015
+ set = Expr.relative[ parts[0] ] ?
4016
+ [ context ] :
4017
+ Sizzle( parts.shift(), context );
4018
+
4019
+ while ( parts.length ) {
4020
+ selector = parts.shift();
4021
+
4022
+ if ( Expr.relative[ selector ] )
4023
+ selector += parts.shift();
4024
+
4025
+ set = posProcess( selector, set );
4026
+ }
4027
+ }
4028
+ } else {
4029
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
4030
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
4031
+ var ret = Sizzle.find( parts.shift(), context, contextXML );
4032
+ context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
4033
+ }
4034
+
4035
+ if ( context ) {
4036
+ var ret = seed ?
4037
+ { expr: parts.pop(), set: makeArray(seed) } :
4038
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
4039
+ set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
4040
+
4041
+ if ( parts.length > 0 ) {
4042
+ checkSet = makeArray(set);
4043
+ } else {
4044
+ prune = false;
4045
+ }
4046
+
4047
+ while ( parts.length ) {
4048
+ var cur = parts.pop(), pop = cur;
4049
+
4050
+ if ( !Expr.relative[ cur ] ) {
4051
+ cur = "";
4052
+ } else {
4053
+ pop = parts.pop();
4054
+ }
4055
+
4056
+ if ( pop == null ) {
4057
+ pop = context;
4058
+ }
4059
+
4060
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
4061
+ }
4062
+ } else {
4063
+ checkSet = parts = [];
4064
+ }
4065
+ }
4066
+
4067
+ if ( !checkSet ) {
4068
+ checkSet = set;
4069
+ }
4070
+
4071
+ if ( !checkSet ) {
4072
+ throw "Syntax error, unrecognized expression: " + (cur || selector);
4073
+ }
4074
+
4075
+ if ( toString.call(checkSet) === "[object Array]" ) {
4076
+ if ( !prune ) {
4077
+ results.push.apply( results, checkSet );
4078
+ } else if ( context && context.nodeType === 1 ) {
4079
+ for ( var i = 0; checkSet[i] != null; i++ ) {
4080
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
4081
+ results.push( set[i] );
4082
+ }
4083
+ }
4084
+ } else {
4085
+ for ( var i = 0; checkSet[i] != null; i++ ) {
4086
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
4087
+ results.push( set[i] );
4088
+ }
4089
+ }
4090
+ }
4091
+ } else {
4092
+ makeArray( checkSet, results );
4093
+ }
4094
+
4095
+ if ( extra ) {
4096
+ Sizzle( extra, origContext, results, seed );
4097
+ Sizzle.uniqueSort( results );
4098
+ }
4099
+
4100
+ return results;
4101
+ };
4102
+
4103
+ Sizzle.uniqueSort = function(results){
4104
+ if ( sortOrder ) {
4105
+ hasDuplicate = baseHasDuplicate;
4106
+ results.sort(sortOrder);
4107
+
4108
+ if ( hasDuplicate ) {
4109
+ for ( var i = 1; i < results.length; i++ ) {
4110
+ if ( results[i] === results[i-1] ) {
4111
+ results.splice(i--, 1);
4112
+ }
4113
+ }
4114
+ }
4115
+ }
4116
+
4117
+ return results;
4118
+ };
4119
+
4120
+ Sizzle.matches = function(expr, set){
4121
+ return Sizzle(expr, null, null, set);
4122
+ };
4123
+
4124
+ Sizzle.find = function(expr, context, isXML){
4125
+ var set, match;
4126
+
4127
+ if ( !expr ) {
4128
+ return [];
4129
+ }
4130
+
4131
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
4132
+ var type = Expr.order[i], match;
4133
+
4134
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
4135
+ var left = match[1];
4136
+ match.splice(1,1);
4137
+
4138
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
4139
+ match[1] = (match[1] || "").replace(/\\/g, "");
4140
+ set = Expr.find[ type ]( match, context, isXML );
4141
+ if ( set != null ) {
4142
+ expr = expr.replace( Expr.match[ type ], "" );
4143
+ break;
4144
+ }
4145
+ }
4146
+ }
4147
+ }
4148
+
4149
+ if ( !set ) {
4150
+ set = context.getElementsByTagName("*");
4151
+ }
4152
+
4153
+ return {set: set, expr: expr};
4154
+ };
4155
+
4156
+ Sizzle.filter = function(expr, set, inplace, not){
4157
+ var old = expr, result = [], curLoop = set, match, anyFound,
4158
+ isXMLFilter = set && set[0] && isXML(set[0]);
4159
+
4160
+ while ( expr && set.length ) {
4161
+ for ( var type in Expr.filter ) {
4162
+ if ( (match = Expr.match[ type ].exec( expr )) != null ) {
4163
+ var filter = Expr.filter[ type ], found, item;
4164
+ anyFound = false;
4165
+
4166
+ if ( curLoop == result ) {
4167
+ result = [];
4168
+ }
4169
+
4170
+ if ( Expr.preFilter[ type ] ) {
4171
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
4172
+
4173
+ if ( !match ) {
4174
+ anyFound = found = true;
4175
+ } else if ( match === true ) {
4176
+ continue;
4177
+ }
4178
+ }
4179
+
4180
+ if ( match ) {
4181
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
4182
+ if ( item ) {
4183
+ found = filter( item, match, i, curLoop );
4184
+ var pass = not ^ !!found;
4185
+
4186
+ if ( inplace && found != null ) {
4187
+ if ( pass ) {
4188
+ anyFound = true;
4189
+ } else {
4190
+ curLoop[i] = false;
4191
+ }
4192
+ } else if ( pass ) {
4193
+ result.push( item );
4194
+ anyFound = true;
4195
+ }
4196
+ }
4197
+ }
4198
+ }
4199
+
4200
+ if ( found !== undefined ) {
4201
+ if ( !inplace ) {
4202
+ curLoop = result;
4203
+ }
4204
+
4205
+ expr = expr.replace( Expr.match[ type ], "" );
4206
+
4207
+ if ( !anyFound ) {
4208
+ return [];
4209
+ }
4210
+
4211
+ break;
4212
+ }
4213
+ }
4214
+ }
4215
+
4216
+ if ( expr == old ) {
4217
+ if ( anyFound == null ) {
4218
+ throw "Syntax error, unrecognized expression: " + expr;
4219
+ } else {
4220
+ break;
4221
+ }
4222
+ }
4223
+
4224
+ old = expr;
4225
+ }
4226
+
4227
+ return curLoop;
4228
+ };
4229
+
4230
+ var Expr = Sizzle.selectors = {
4231
+ order: [ "ID", "NAME", "TAG" ],
4232
+ match: {
4233
+ ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
4234
+ CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
4235
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
4236
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
4237
+ TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
4238
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
4239
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
4240
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
4241
+ },
4242
+ leftMatch: {},
4243
+ attrMap: {
4244
+ "class": "className",
4245
+ "for": "htmlFor"
4246
+ },
4247
+ attrHandle: {
4248
+ href: function(elem){
4249
+ return elem.getAttribute("href");
4250
+ }
4251
+ },
4252
+ relative: {
4253
+ "+": function(checkSet, part, isXML){
4254
+ var isPartStr = typeof part === "string",
4255
+ isTag = isPartStr && !/\W/.test(part),
4256
+ isPartStrNotTag = isPartStr && !isTag;
4257
+
4258
+ if ( isTag && !isXML ) {
4259
+ part = part.toUpperCase();
4260
+ }
4261
+
4262
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
4263
+ if ( (elem = checkSet[i]) ) {
4264
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
4265
+
4266
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
4267
+ elem || false :
4268
+ elem === part;
4269
+ }
4270
+ }
4271
+
4272
+ if ( isPartStrNotTag ) {
4273
+ Sizzle.filter( part, checkSet, true );
4274
+ }
4275
+ },
4276
+ ">": function(checkSet, part, isXML){
4277
+ var isPartStr = typeof part === "string";
4278
+
4279
+ if ( isPartStr && !/\W/.test(part) ) {
4280
+ part = isXML ? part : part.toUpperCase();
4281
+
4282
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4283
+ var elem = checkSet[i];
4284
+ if ( elem ) {
4285
+ var parent = elem.parentNode;
4286
+ checkSet[i] = parent.nodeName === part ? parent : false;
4287
+ }
4288
+ }
4289
+ } else {
4290
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4291
+ var elem = checkSet[i];
4292
+ if ( elem ) {
4293
+ checkSet[i] = isPartStr ?
4294
+ elem.parentNode :
4295
+ elem.parentNode === part;
4296
+ }
4297
+ }
4298
+
4299
+ if ( isPartStr ) {
4300
+ Sizzle.filter( part, checkSet, true );
4301
+ }
4302
+ }
4303
+ },
4304
+ "": function(checkSet, part, isXML){
4305
+ var doneName = done++, checkFn = dirCheck;
4306
+
4307
+ if ( !/\W/.test(part) ) {
4308
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
4309
+ checkFn = dirNodeCheck;
4310
+ }
4311
+
4312
+ checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
4313
+ },
4314
+ "~": function(checkSet, part, isXML){
4315
+ var doneName = done++, checkFn = dirCheck;
4316
+
4317
+ if ( typeof part === "string" && !/\W/.test(part) ) {
4318
+ var nodeCheck = part = isXML ? part : part.toUpperCase();
4319
+ checkFn = dirNodeCheck;
4320
+ }
4321
+
4322
+ checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
4323
+ }
4324
+ },
4325
+ find: {
4326
+ ID: function(match, context, isXML){
4327
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
4328
+ var m = context.getElementById(match[1]);
4329
+ return m ? [m] : [];
4330
+ }
4331
+ },
4332
+ NAME: function(match, context, isXML){
4333
+ if ( typeof context.getElementsByName !== "undefined" ) {
4334
+ var ret = [], results = context.getElementsByName(match[1]);
4335
+
4336
+ for ( var i = 0, l = results.length; i < l; i++ ) {
4337
+ if ( results[i].getAttribute("name") === match[1] ) {
4338
+ ret.push( results[i] );
4339
+ }
4340
+ }
4341
+
4342
+ return ret.length === 0 ? null : ret;
4343
+ }
4344
+ },
4345
+ TAG: function(match, context){
4346
+ return context.getElementsByTagName(match[1]);
4347
+ }
4348
+ },
4349
+ preFilter: {
4350
+ CLASS: function(match, curLoop, inplace, result, not, isXML){
4351
+ match = " " + match[1].replace(/\\/g, "") + " ";
4352
+
4353
+ if ( isXML ) {
4354
+ return match;
4355
+ }
4356
+
4357
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
4358
+ if ( elem ) {
4359
+ if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
4360
+ if ( !inplace )
4361
+ result.push( elem );
4362
+ } else if ( inplace ) {
4363
+ curLoop[i] = false;
4364
+ }
4365
+ }
4366
+ }
4367
+
4368
+ return false;
4369
+ },
4370
+ ID: function(match){
4371
+ return match[1].replace(/\\/g, "");
4372
+ },
4373
+ TAG: function(match, curLoop){
4374
+ for ( var i = 0; curLoop[i] === false; i++ ){}
4375
+ return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
4376
+ },
4377
+ CHILD: function(match){
4378
+ if ( match[1] == "nth" ) {
4379
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
4380
+ match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
4381
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
4382
+
4383
+ match[2] = (test[1] + (test[2] || 1)) - 0;
4384
+ match[3] = test[3] - 0;
4385
+ }
4386
+
4387
+ match[0] = done++;
4388
+
4389
+ return match;
4390
+ },
4391
+ ATTR: function(match, curLoop, inplace, result, not, isXML){
4392
+ var name = match[1].replace(/\\/g, "");
4393
+
4394
+ if ( !isXML && Expr.attrMap[name] ) {
4395
+ match[1] = Expr.attrMap[name];
4396
+ }
4397
+
4398
+ if ( match[2] === "~=" ) {
4399
+ match[4] = " " + match[4] + " ";
4400
+ }
4401
+
4402
+ return match;
4403
+ },
4404
+ PSEUDO: function(match, curLoop, inplace, result, not){
4405
+ if ( match[1] === "not" ) {
4406
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
4407
+ match[3] = Sizzle(match[3], null, null, curLoop);
4408
+ } else {
4409
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
4410
+ if ( !inplace ) {
4411
+ result.push.apply( result, ret );
4412
+ }
4413
+ return false;
4414
+ }
4415
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
4416
+ return true;
4417
+ }
4418
+
4419
+ return match;
4420
+ },
4421
+ POS: function(match){
4422
+ match.unshift( true );
4423
+ return match;
4424
+ }
4425
+ },
4426
+ filters: {
4427
+ enabled: function(elem){
4428
+ return elem.disabled === false && elem.type !== "hidden";
4429
+ },
4430
+ disabled: function(elem){
4431
+ return elem.disabled === true;
4432
+ },
4433
+ checked: function(elem){
4434
+ return elem.checked === true;
4435
+ },
4436
+ selected: function(elem){
4437
+ elem.parentNode.selectedIndex;
4438
+ return elem.selected === true;
4439
+ },
4440
+ parent: function(elem){
4441
+ return !!elem.firstChild;
4442
+ },
4443
+ empty: function(elem){
4444
+ return !elem.firstChild;
4445
+ },
4446
+ has: function(elem, i, match){
4447
+ return !!Sizzle( match[3], elem ).length;
4448
+ },
4449
+ header: function(elem){
4450
+ return /h\d/i.test( elem.nodeName );
4451
+ },
4452
+ text: function(elem){
4453
+ return "text" === elem.type;
4454
+ },
4455
+ radio: function(elem){
4456
+ return "radio" === elem.type;
4457
+ },
4458
+ checkbox: function(elem){
4459
+ return "checkbox" === elem.type;
4460
+ },
4461
+ file: function(elem){
4462
+ return "file" === elem.type;
4463
+ },
4464
+ password: function(elem){
4465
+ return "password" === elem.type;
4466
+ },
4467
+ submit: function(elem){
4468
+ return "submit" === elem.type;
4469
+ },
4470
+ image: function(elem){
4471
+ return "image" === elem.type;
4472
+ },
4473
+ reset: function(elem){
4474
+ return "reset" === elem.type;
4475
+ },
4476
+ button: function(elem){
4477
+ return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
4478
+ },
4479
+ input: function(elem){
4480
+ return /input|select|textarea|button/i.test(elem.nodeName);
4481
+ }
4482
+ },
4483
+ setFilters: {
4484
+ first: function(elem, i){
4485
+ return i === 0;
4486
+ },
4487
+ last: function(elem, i, match, array){
4488
+ return i === array.length - 1;
4489
+ },
4490
+ even: function(elem, i){
4491
+ return i % 2 === 0;
4492
+ },
4493
+ odd: function(elem, i){
4494
+ return i % 2 === 1;
4495
+ },
4496
+ lt: function(elem, i, match){
4497
+ return i < match[3] - 0;
4498
+ },
4499
+ gt: function(elem, i, match){
4500
+ return i > match[3] - 0;
4501
+ },
4502
+ nth: function(elem, i, match){
4503
+ return match[3] - 0 == i;
4504
+ },
4505
+ eq: function(elem, i, match){
4506
+ return match[3] - 0 == i;
4507
+ }
4508
+ },
4509
+ filter: {
4510
+ PSEUDO: function(elem, match, i, array){
4511
+ var name = match[1], filter = Expr.filters[ name ];
4512
+
4513
+ if ( filter ) {
4514
+ return filter( elem, i, match, array );
4515
+ } else if ( name === "contains" ) {
4516
+ return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
4517
+ } else if ( name === "not" ) {
4518
+ var not = match[3];
4519
+
4520
+ for ( var i = 0, l = not.length; i < l; i++ ) {
4521
+ if ( not[i] === elem ) {
4522
+ return false;
4523
+ }
4524
+ }
4525
+
4526
+ return true;
4527
+ }
4528
+ },
4529
+ CHILD: function(elem, match){
4530
+ var type = match[1], node = elem;
4531
+ switch (type) {
4532
+ case 'only':
4533
+ case 'first':
4534
+ while ( (node = node.previousSibling) ) {
4535
+ if ( node.nodeType === 1 ) return false;
4536
+ }
4537
+ if ( type == 'first') return true;
4538
+ node = elem;
4539
+ case 'last':
4540
+ while ( (node = node.nextSibling) ) {
4541
+ if ( node.nodeType === 1 ) return false;
4542
+ }
4543
+ return true;
4544
+ case 'nth':
4545
+ var first = match[2], last = match[3];
4546
+
4547
+ if ( first == 1 && last == 0 ) {
4548
+ return true;
4549
+ }
4550
+
4551
+ var doneName = match[0],
4552
+ parent = elem.parentNode;
4553
+
4554
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
4555
+ var count = 0;
4556
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
4557
+ if ( node.nodeType === 1 ) {
4558
+ node.nodeIndex = ++count;
4559
+ }
4560
+ }
4561
+ parent.sizcache = doneName;
4562
+ }
4563
+
4564
+ var diff = elem.nodeIndex - last;
4565
+ if ( first == 0 ) {
4566
+ return diff == 0;
4567
+ } else {
4568
+ return ( diff % first == 0 && diff / first >= 0 );
4569
+ }
4570
+ }
4571
+ },
4572
+ ID: function(elem, match){
4573
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
4574
+ },
4575
+ TAG: function(elem, match){
4576
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
4577
+ },
4578
+ CLASS: function(elem, match){
4579
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
4580
+ .indexOf( match ) > -1;
4581
+ },
4582
+ ATTR: function(elem, match){
4583
+ var name = match[1],
4584
+ result = Expr.attrHandle[ name ] ?
4585
+ Expr.attrHandle[ name ]( elem ) :
4586
+ elem[ name ] != null ?
4587
+ elem[ name ] :
4588
+ elem.getAttribute( name ),
4589
+ value = result + "",
4590
+ type = match[2],
4591
+ check = match[4];
4592
+
4593
+ return result == null ?
4594
+ type === "!=" :
4595
+ type === "=" ?
4596
+ value === check :
4597
+ type === "*=" ?
4598
+ value.indexOf(check) >= 0 :
4599
+ type === "~=" ?
4600
+ (" " + value + " ").indexOf(check) >= 0 :
4601
+ !check ?
4602
+ value && result !== false :
4603
+ type === "!=" ?
4604
+ value != check :
4605
+ type === "^=" ?
4606
+ value.indexOf(check) === 0 :
4607
+ type === "$=" ?
4608
+ value.substr(value.length - check.length) === check :
4609
+ type === "|=" ?
4610
+ value === check || value.substr(0, check.length + 1) === check + "-" :
4611
+ false;
4612
+ },
4613
+ POS: function(elem, match, i, array){
4614
+ var name = match[2], filter = Expr.setFilters[ name ];
4615
+
4616
+ if ( filter ) {
4617
+ return filter( elem, i, match, array );
4618
+ }
4619
+ }
4620
+ }
4621
+ };
4622
+
4623
+ var origPOS = Expr.match.POS;
4624
+
4625
+ for ( var type in Expr.match ) {
4626
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
4627
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source );
4628
+ }
4629
+
4630
+ var makeArray = function(array, results) {
4631
+ array = Array.prototype.slice.call( array, 0 );
4632
+
4633
+ if ( results ) {
4634
+ results.push.apply( results, array );
4635
+ return results;
4636
+ }
4637
+
4638
+ return array;
4639
+ };
4640
+
4641
+ try {
4642
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 );
4643
+
4644
+ } catch(e){
4645
+ makeArray = function(array, results) {
4646
+ var ret = results || [];
4647
+
4648
+ if ( toString.call(array) === "[object Array]" ) {
4649
+ Array.prototype.push.apply( ret, array );
4650
+ } else {
4651
+ if ( typeof array.length === "number" ) {
4652
+ for ( var i = 0, l = array.length; i < l; i++ ) {
4653
+ ret.push( array[i] );
4654
+ }
4655
+ } else {
4656
+ for ( var i = 0; array[i]; i++ ) {
4657
+ ret.push( array[i] );
4658
+ }
4659
+ }
4660
+ }
4661
+
4662
+ return ret;
4663
+ };
4664
+ }
4665
+
4666
+ var sortOrder;
4667
+
4668
+ if ( document.documentElement.compareDocumentPosition ) {
4669
+ sortOrder = function( a, b ) {
4670
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
4671
+ if ( a == b ) {
4672
+ hasDuplicate = true;
4673
+ }
4674
+ return 0;
4675
+ }
4676
+
4677
+ var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
4678
+ if ( ret === 0 ) {
4679
+ hasDuplicate = true;
4680
+ }
4681
+ return ret;
4682
+ };
4683
+ } else if ( "sourceIndex" in document.documentElement ) {
4684
+ sortOrder = function( a, b ) {
4685
+ if ( !a.sourceIndex || !b.sourceIndex ) {
4686
+ if ( a == b ) {
4687
+ hasDuplicate = true;
4688
+ }
4689
+ return 0;
4690
+ }
4691
+
4692
+ var ret = a.sourceIndex - b.sourceIndex;
4693
+ if ( ret === 0 ) {
4694
+ hasDuplicate = true;
4695
+ }
4696
+ return ret;
4697
+ };
4698
+ } else if ( document.createRange ) {
4699
+ sortOrder = function( a, b ) {
4700
+ if ( !a.ownerDocument || !b.ownerDocument ) {
4701
+ if ( a == b ) {
4702
+ hasDuplicate = true;
4703
+ }
4704
+ return 0;
4705
+ }
4706
+
4707
+ var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
4708
+ aRange.setStart(a, 0);
4709
+ aRange.setEnd(a, 0);
4710
+ bRange.setStart(b, 0);
4711
+ bRange.setEnd(b, 0);
4712
+ var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
4713
+ if ( ret === 0 ) {
4714
+ hasDuplicate = true;
4715
+ }
4716
+ return ret;
4717
+ };
4718
+ }
4719
+
4720
+ (function(){
4721
+ var form = document.createElement("div"),
4722
+ id = "script" + (new Date).getTime();
4723
+ form.innerHTML = "<a name='" + id + "'/>";
4724
+
4725
+ var root = document.documentElement;
4726
+ root.insertBefore( form, root.firstChild );
4727
+
4728
+ if ( !!document.getElementById( id ) ) {
4729
+ Expr.find.ID = function(match, context, isXML){
4730
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
4731
+ var m = context.getElementById(match[1]);
4732
+ return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
4733
+ }
4734
+ };
4735
+
4736
+ Expr.filter.ID = function(elem, match){
4737
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4738
+ return elem.nodeType === 1 && node && node.nodeValue === match;
4739
+ };
4740
+ }
4741
+
4742
+ root.removeChild( form );
4743
+ root = form = null; // release memory in IE
4744
+ })();
4745
+
4746
+ (function(){
4747
+
4748
+ var div = document.createElement("div");
4749
+ div.appendChild( document.createComment("") );
4750
+
4751
+ if ( div.getElementsByTagName("*").length > 0 ) {
4752
+ Expr.find.TAG = function(match, context){
4753
+ var results = context.getElementsByTagName(match[1]);
4754
+
4755
+ if ( match[1] === "*" ) {
4756
+ var tmp = [];
4757
+
4758
+ for ( var i = 0; results[i]; i++ ) {
4759
+ if ( results[i].nodeType === 1 ) {
4760
+ tmp.push( results[i] );
4761
+ }
4762
+ }
4763
+
4764
+ results = tmp;
4765
+ }
4766
+
4767
+ return results;
4768
+ };
4769
+ }
4770
+
4771
+ div.innerHTML = "<a href='#'></a>";
4772
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
4773
+ div.firstChild.getAttribute("href") !== "#" ) {
4774
+ Expr.attrHandle.href = function(elem){
4775
+ return elem.getAttribute("href", 2);
4776
+ };
4777
+ }
4778
+
4779
+ div = null; // release memory in IE
4780
+ })();
4781
+
4782
+ if ( document.querySelectorAll ) (function(){
4783
+ var oldSizzle = Sizzle, div = document.createElement("div");
4784
+ div.innerHTML = "<p class='TEST'></p>";
4785
+
4786
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
4787
+ return;
4788
+ }
4789
+
4790
+ Sizzle = function(query, context, extra, seed){
4791
+ context = context || document;
4792
+
4793
+ if ( !seed && context.nodeType === 9 && !isXML(context) ) {
4794
+ try {
4795
+ return makeArray( context.querySelectorAll(query), extra );
4796
+ } catch(e){}
4797
+ }
4798
+
4799
+ return oldSizzle(query, context, extra, seed);
4800
+ };
4801
+
4802
+ for ( var prop in oldSizzle ) {
4803
+ Sizzle[ prop ] = oldSizzle[ prop ];
4804
+ }
4805
+
4806
+ div = null; // release memory in IE
4807
+ })();
4808
+
4809
+ if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
4810
+ var div = document.createElement("div");
4811
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
4812
+
4813
+ if ( div.getElementsByClassName("e").length === 0 )
4814
+ return;
4815
+
4816
+ div.lastChild.className = "e";
4817
+
4818
+ if ( div.getElementsByClassName("e").length === 1 )
4819
+ return;
4820
+
4821
+ Expr.order.splice(1, 0, "CLASS");
4822
+ Expr.find.CLASS = function(match, context, isXML) {
4823
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
4824
+ return context.getElementsByClassName(match[1]);
4825
+ }
4826
+ };
4827
+
4828
+ div = null; // release memory in IE
4829
+ })();
4830
+
4831
+ function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4832
+ var sibDir = dir == "previousSibling" && !isXML;
4833
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4834
+ var elem = checkSet[i];
4835
+ if ( elem ) {
4836
+ if ( sibDir && elem.nodeType === 1 ){
4837
+ elem.sizcache = doneName;
4838
+ elem.sizset = i;
4839
+ }
4840
+ elem = elem[dir];
4841
+ var match = false;
4842
+
4843
+ while ( elem ) {
4844
+ if ( elem.sizcache === doneName ) {
4845
+ match = checkSet[elem.sizset];
4846
+ break;
4847
+ }
4848
+
4849
+ if ( elem.nodeType === 1 && !isXML ){
4850
+ elem.sizcache = doneName;
4851
+ elem.sizset = i;
4852
+ }
4853
+
4854
+ if ( elem.nodeName === cur ) {
4855
+ match = elem;
4856
+ break;
4857
+ }
4858
+
4859
+ elem = elem[dir];
4860
+ }
4861
+
4862
+ checkSet[i] = match;
4863
+ }
4864
+ }
4865
+ }
4866
+
4867
+ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
4868
+ var sibDir = dir == "previousSibling" && !isXML;
4869
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
4870
+ var elem = checkSet[i];
4871
+ if ( elem ) {
4872
+ if ( sibDir && elem.nodeType === 1 ) {
4873
+ elem.sizcache = doneName;
4874
+ elem.sizset = i;
4875
+ }
4876
+ elem = elem[dir];
4877
+ var match = false;
4878
+
4879
+ while ( elem ) {
4880
+ if ( elem.sizcache === doneName ) {
4881
+ match = checkSet[elem.sizset];
4882
+ break;
4883
+ }
4884
+
4885
+ if ( elem.nodeType === 1 ) {
4886
+ if ( !isXML ) {
4887
+ elem.sizcache = doneName;
4888
+ elem.sizset = i;
4889
+ }
4890
+ if ( typeof cur !== "string" ) {
4891
+ if ( elem === cur ) {
4892
+ match = true;
4893
+ break;
4894
+ }
4895
+
4896
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
4897
+ match = elem;
4898
+ break;
4899
+ }
4900
+ }
4901
+
4902
+ elem = elem[dir];
4903
+ }
4904
+
4905
+ checkSet[i] = match;
4906
+ }
4907
+ }
4908
+ }
4909
+
4910
+ var contains = document.compareDocumentPosition ? function(a, b){
4911
+ return a.compareDocumentPosition(b) & 16;
4912
+ } : function(a, b){
4913
+ return a !== b && (a.contains ? a.contains(b) : true);
4914
+ };
4915
+
4916
+ var isXML = function(elem){
4917
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
4918
+ !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
4919
+ };
4920
+
4921
+ var posProcess = function(selector, context){
4922
+ var tmpSet = [], later = "", match,
4923
+ root = context.nodeType ? [context] : context;
4924
+
4925
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
4926
+ later += match[0];
4927
+ selector = selector.replace( Expr.match.PSEUDO, "" );
4928
+ }
4929
+
4930
+ selector = Expr.relative[selector] ? selector + "*" : selector;
4931
+
4932
+ for ( var i = 0, l = root.length; i < l; i++ ) {
4933
+ Sizzle( selector, root[i], tmpSet );
4934
+ }
4935
+
4936
+ return Sizzle.filter( later, tmpSet );
4937
+ };
4938
+
4939
+
4940
+ window.Sizzle = Sizzle;
4941
+
4942
+ })();
4943
+
4944
+ ;(function(engine) {
4945
+ var extendElements = Prototype.Selector.extendElements;
4946
+
4947
+ function select(selector, scope) {
4948
+ return extendElements(engine(selector, scope || document));
4949
+ }
4950
+
4951
+ function match(element, selector) {
4952
+ return engine.matches(selector, [element]).length == 1;
4953
+ }
4954
+
4955
+ Prototype.Selector.engine = engine;
4956
+ Prototype.Selector.select = select;
4957
+ Prototype.Selector.match = match;
4958
+ })(Sizzle);
4959
+
4960
+ window.Sizzle = Prototype._original_property;
4961
+ delete Prototype._original_property;
4962
+
4963
+ var Form = {
4964
+ reset: function(form) {
4965
+ form = $(form);
4966
+ form.reset();
4967
+ return form;
4968
+ },
4969
+
4970
+ serializeElements: function(elements, options) {
4971
+ if (typeof options != 'object') options = { hash: !!options };
4972
+ else if (Object.isUndefined(options.hash)) options.hash = true;
4973
+ var key, value, submitted = false, submit = options.submit, accumulator, initial;
4974
+
4975
+ if (options.hash) {
4976
+ initial = {};
4977
+ accumulator = function(result, key, value) {
4978
+ if (key in result) {
4979
+ if (!Object.isArray(result[key])) result[key] = [result[key]];
4980
+ result[key].push(value);
4981
+ } else result[key] = value;
4982
+ return result;
4983
+ };
4984
+ } else {
4985
+ initial = '';
4986
+ accumulator = function(result, key, value) {
4987
+ return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + encodeURIComponent(value);
4988
+ }
4989
+ }
4990
+
4991
+ return elements.inject(initial, function(result, element) {
4992
+ if (!element.disabled && element.name) {
4993
+ key = element.name; value = $(element).getValue();
4994
+ if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
4995
+ submit !== false && (!submit || key == submit) && (submitted = true)))) {
4996
+ result = accumulator(result, key, value);
4997
+ }
4998
+ }
4999
+ return result;
5000
+ });
5001
+ }
5002
+ };
5003
+
5004
+ Form.Methods = {
5005
+ serialize: function(form, options) {
5006
+ return Form.serializeElements(Form.getElements(form), options);
5007
+ },
5008
+
5009
+ getElements: function(form) {
5010
+ var elements = $(form).getElementsByTagName('*'),
5011
+ element,
5012
+ arr = [ ],
5013
+ serializers = Form.Element.Serializers;
5014
+ for (var i = 0; element = elements[i]; i++) {
5015
+ arr.push(element);
5016
+ }
5017
+ return arr.inject([], function(elements, child) {
5018
+ if (serializers[child.tagName.toLowerCase()])
5019
+ elements.push(Element.extend(child));
5020
+ return elements;
5021
+ })
5022
+ },
5023
+
5024
+ getInputs: function(form, typeName, name) {
5025
+ form = $(form);
5026
+ var inputs = form.getElementsByTagName('input');
5027
+
5028
+ if (!typeName && !name) return $A(inputs).map(Element.extend);
5029
+
5030
+ for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
5031
+ var input = inputs[i];
5032
+ if ((typeName && input.type != typeName) || (name && input.name != name))
5033
+ continue;
5034
+ matchingInputs.push(Element.extend(input));
5035
+ }
5036
+
5037
+ return matchingInputs;
5038
+ },
5039
+
5040
+ disable: function(form) {
5041
+ form = $(form);
5042
+ Form.getElements(form).invoke('disable');
5043
+ return form;
5044
+ },
5045
+
5046
+ enable: function(form) {
5047
+ form = $(form);
5048
+ Form.getElements(form).invoke('enable');
5049
+ return form;
5050
+ },
5051
+
5052
+ findFirstElement: function(form) {
5053
+ var elements = $(form).getElements().findAll(function(element) {
5054
+ return 'hidden' != element.type && !element.disabled;
5055
+ });
5056
+ var firstByIndex = elements.findAll(function(element) {
5057
+ return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
5058
+ }).sortBy(function(element) { return element.tabIndex }).first();
5059
+
5060
+ return firstByIndex ? firstByIndex : elements.find(function(element) {
5061
+ return /^(?:input|select|textarea)$/i.test(element.tagName);
5062
+ });
5063
+ },
5064
+
5065
+ focusFirstElement: function(form) {
5066
+ form = $(form);
5067
+ var element = form.findFirstElement();
5068
+ if (element) element.activate();
5069
+ return form;
5070
+ },
5071
+
5072
+ request: function(form, options) {
5073
+ form = $(form), options = Object.clone(options || { });
5074
+
5075
+ var params = options.parameters, action = form.readAttribute('action') || '';
5076
+ if (action.blank()) action = window.location.href;
5077
+ options.parameters = form.serialize(true);
5078
+
5079
+ if (params) {
5080
+ if (Object.isString(params)) params = params.toQueryParams();
5081
+ Object.extend(options.parameters, params);
5082
+ }
5083
+
5084
+ if (form.hasAttribute('method') && !options.method)
5085
+ options.method = form.method;
5086
+
5087
+ return new Ajax.Request(action, options);
5088
+ }
5089
+ };
5090
+
5091
+ /*--------------------------------------------------------------------------*/
5092
+
5093
+
5094
+ Form.Element = {
5095
+ focus: function(element) {
5096
+ $(element).focus();
5097
+ return element;
5098
+ },
5099
+
5100
+ select: function(element) {
5101
+ $(element).select();
5102
+ return element;
5103
+ }
5104
+ };
5105
+
5106
+ Form.Element.Methods = {
5107
+
5108
+ serialize: function(element) {
5109
+ element = $(element);
5110
+ if (!element.disabled && element.name) {
5111
+ var value = element.getValue();
5112
+ if (value != undefined) {
5113
+ var pair = { };
5114
+ pair[element.name] = value;
5115
+ return Object.toQueryString(pair);
5116
+ }
5117
+ }
5118
+ return '';
5119
+ },
5120
+
5121
+ getValue: function(element) {
5122
+ element = $(element);
5123
+ var method = element.tagName.toLowerCase();
5124
+ return Form.Element.Serializers[method](element);
5125
+ },
5126
+
5127
+ setValue: function(element, value) {
5128
+ element = $(element);
5129
+ var method = element.tagName.toLowerCase();
5130
+ Form.Element.Serializers[method](element, value);
5131
+ return element;
5132
+ },
5133
+
5134
+ clear: function(element) {
5135
+ $(element).value = '';
5136
+ return element;
5137
+ },
5138
+
5139
+ present: function(element) {
5140
+ return $(element).value != '';
5141
+ },
5142
+
5143
+ activate: function(element) {
5144
+ element = $(element);
5145
+ try {
5146
+ element.focus();
5147
+ if (element.select && (element.tagName.toLowerCase() != 'input' ||
5148
+ !(/^(?:button|reset|submit)$/i.test(element.type))))
5149
+ element.select();
5150
+ } catch (e) { }
5151
+ return element;
5152
+ },
5153
+
5154
+ disable: function(element) {
5155
+ element = $(element);
5156
+ element.disabled = true;
5157
+ return element;
5158
+ },
5159
+
5160
+ enable: function(element) {
5161
+ element = $(element);
5162
+ element.disabled = false;
5163
+ return element;
5164
+ }
5165
+ };
5166
+
5167
+ /*--------------------------------------------------------------------------*/
5168
+
5169
+ var Field = Form.Element;
5170
+
5171
+ var $F = Form.Element.Methods.getValue;
5172
+
5173
+ /*--------------------------------------------------------------------------*/
5174
+
5175
+ Form.Element.Serializers = (function() {
5176
+ function input(element, value) {
5177
+ switch (element.type.toLowerCase()) {
5178
+ case 'checkbox':
5179
+ case 'radio':
5180
+ return inputSelector(element, value);
5181
+ default:
5182
+ return valueSelector(element, value);
5183
+ }
5184
+ }
5185
+
5186
+ function inputSelector(element, value) {
5187
+ if (Object.isUndefined(value))
5188
+ return element.checked ? element.value : null;
5189
+ else element.checked = !!value;
5190
+ }
5191
+
5192
+ function valueSelector(element, value) {
5193
+ if (Object.isUndefined(value)) return element.value;
5194
+ else element.value = value;
5195
+ }
5196
+
5197
+ function select(element, value) {
5198
+ if (Object.isUndefined(value))
5199
+ return (element.type === 'select-one' ? selectOne : selectMany)(element);
5200
+
5201
+ var opt, currentValue, single = !Object.isArray(value);
5202
+ for (var i = 0, length = element.length; i < length; i++) {
5203
+ opt = element.options[i];
5204
+ currentValue = this.optionValue(opt);
5205
+ if (single) {
5206
+ if (currentValue == value) {
5207
+ opt.selected = true;
5208
+ return;
5209
+ }
5210
+ }
5211
+ else opt.selected = value.include(currentValue);
5212
+ }
5213
+ }
5214
+
5215
+ function selectOne(element) {
5216
+ var index = element.selectedIndex;
5217
+ return index >= 0 ? optionValue(element.options[index]) : null;
5218
+ }
5219
+
5220
+ function selectMany(element) {
5221
+ var values, length = element.length;
5222
+ if (!length) return null;
5223
+
5224
+ for (var i = 0, values = []; i < length; i++) {
5225
+ var opt = element.options[i];
5226
+ if (opt.selected) values.push(optionValue(opt));
5227
+ }
5228
+ return values;
5229
+ }
5230
+
5231
+ function optionValue(opt) {
5232
+ return Element.hasAttribute(opt, 'value') ? opt.value : opt.text;
5233
+ }
5234
+
5235
+ return {
5236
+ input: input,
5237
+ inputSelector: inputSelector,
5238
+ textarea: valueSelector,
5239
+ select: select,
5240
+ selectOne: selectOne,
5241
+ selectMany: selectMany,
5242
+ optionValue: optionValue,
5243
+ button: valueSelector
5244
+ };
5245
+ })();
5246
+
5247
+ /*--------------------------------------------------------------------------*/
5248
+
5249
+
5250
+ Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
5251
+ initialize: function($super, element, frequency, callback) {
5252
+ $super(callback, frequency);
5253
+ this.element = $(element);
5254
+ this.lastValue = this.getValue();
5255
+ },
5256
+
5257
+ execute: function() {
5258
+ var value = this.getValue();
5259
+ if (Object.isString(this.lastValue) && Object.isString(value) ?
5260
+ this.lastValue != value : String(this.lastValue) != String(value)) {
5261
+ this.callback(this.element, value);
5262
+ this.lastValue = value;
5263
+ }
5264
+ }
5265
+ });
5266
+
5267
+ Form.Element.Observer = Class.create(Abstract.TimedObserver, {
5268
+ getValue: function() {
5269
+ return Form.Element.getValue(this.element);
5270
+ }
5271
+ });
5272
+
5273
+ Form.Observer = Class.create(Abstract.TimedObserver, {
5274
+ getValue: function() {
5275
+ return Form.serialize(this.element);
5276
+ }
5277
+ });
5278
+
5279
+ /*--------------------------------------------------------------------------*/
5280
+
5281
+ Abstract.EventObserver = Class.create({
5282
+ initialize: function(element, callback) {
5283
+ this.element = $(element);
5284
+ this.callback = callback;
5285
+
5286
+ this.lastValue = this.getValue();
5287
+ if (this.element.tagName.toLowerCase() == 'form')
5288
+ this.registerFormCallbacks();
5289
+ else
5290
+ this.registerCallback(this.element);
5291
+ },
5292
+
5293
+ onElementEvent: function() {
5294
+ var value = this.getValue();
5295
+ if (this.lastValue != value) {
5296
+ this.callback(this.element, value);
5297
+ this.lastValue = value;
5298
+ }
5299
+ },
5300
+
5301
+ registerFormCallbacks: function() {
5302
+ Form.getElements(this.element).each(this.registerCallback, this);
5303
+ },
5304
+
5305
+ registerCallback: function(element) {
5306
+ if (element.type) {
5307
+ switch (element.type.toLowerCase()) {
5308
+ case 'checkbox':
5309
+ case 'radio':
5310
+ Event.observe(element, 'click', this.onElementEvent.bind(this));
5311
+ break;
5312
+ default:
5313
+ Event.observe(element, 'change', this.onElementEvent.bind(this));
5314
+ break;
5315
+ }
5316
+ }
5317
+ }
5318
+ });
5319
+
5320
+ Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
5321
+ getValue: function() {
5322
+ return Form.Element.getValue(this.element);
5323
+ }
5324
+ });
5325
+
5326
+ Form.EventObserver = Class.create(Abstract.EventObserver, {
5327
+ getValue: function() {
5328
+ return Form.serialize(this.element);
5329
+ }
5330
+ });
5331
+ (function() {
5332
+
5333
+ var Event = {
5334
+ KEY_BACKSPACE: 8,
5335
+ KEY_TAB: 9,
5336
+ KEY_RETURN: 13,
5337
+ KEY_ESC: 27,
5338
+ KEY_LEFT: 37,
5339
+ KEY_UP: 38,
5340
+ KEY_RIGHT: 39,
5341
+ KEY_DOWN: 40,
5342
+ KEY_DELETE: 46,
5343
+ KEY_HOME: 36,
5344
+ KEY_END: 35,
5345
+ KEY_PAGEUP: 33,
5346
+ KEY_PAGEDOWN: 34,
5347
+ KEY_INSERT: 45,
5348
+
5349
+ cache: {}
5350
+ };
5351
+
5352
+ var docEl = document.documentElement;
5353
+ var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
5354
+ && 'onmouseleave' in docEl;
5355
+
5356
+
5357
+
5358
+ var isIELegacyEvent = function(event) { return false; };
5359
+
5360
+ if (window.attachEvent) {
5361
+ if (window.addEventListener) {
5362
+ isIELegacyEvent = function(event) {
5363
+ return !(event instanceof window.Event);
5364
+ };
5365
+ } else {
5366
+ isIELegacyEvent = function(event) { return true; };
5367
+ }
5368
+ }
5369
+
5370
+ var _isButton;
5371
+
5372
+ function _isButtonForDOMEvents(event, code) {
5373
+ return event.which ? (event.which === code + 1) : (event.button === code);
5374
+ }
5375
+
5376
+ var legacyButtonMap = { 0: 1, 1: 4, 2: 2 };
5377
+ function _isButtonForLegacyEvents(event, code) {
5378
+ return event.button === legacyButtonMap[code];
5379
+ }
5380
+
5381
+ function _isButtonForWebKit(event, code) {
5382
+ switch (code) {
5383
+ case 0: return event.which == 1 && !event.metaKey;
5384
+ case 1: return event.which == 2 || (event.which == 1 && event.metaKey);
5385
+ case 2: return event.which == 3;
5386
+ default: return false;
5387
+ }
5388
+ }
5389
+
5390
+ if (window.attachEvent) {
5391
+ if (!window.addEventListener) {
5392
+ _isButton = _isButtonForLegacyEvents;
5393
+ } else {
5394
+ _isButton = function(event, code) {
5395
+ return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) :
5396
+ _isButtonForDOMEvents(event, code);
5397
+ }
5398
+ }
5399
+ } else if (Prototype.Browser.WebKit) {
5400
+ _isButton = _isButtonForWebKit;
5401
+ } else {
5402
+ _isButton = _isButtonForDOMEvents;
5403
+ }
5404
+
5405
+ function isLeftClick(event) { return _isButton(event, 0) }
5406
+
5407
+ function isMiddleClick(event) { return _isButton(event, 1) }
5408
+
5409
+ function isRightClick(event) { return _isButton(event, 2) }
5410
+
5411
+ function element(event) {
5412
+ event = Event.extend(event);
5413
+
5414
+ var node = event.target, type = event.type,
5415
+ currentTarget = event.currentTarget;
5416
+
5417
+ if (currentTarget && currentTarget.tagName) {
5418
+ if (type === 'load' || type === 'error' ||
5419
+ (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
5420
+ && currentTarget.type === 'radio'))
5421
+ node = currentTarget;
5422
+ }
5423
+
5424
+ if (node.nodeType == Node.TEXT_NODE)
5425
+ node = node.parentNode;
5426
+
5427
+ return Element.extend(node);
5428
+ }
5429
+
5430
+ function findElement(event, expression) {
5431
+ var element = Event.element(event);
5432
+
5433
+ if (!expression) return element;
5434
+ while (element) {
5435
+ if (Object.isElement(element) && Prototype.Selector.match(element, expression)) {
5436
+ return Element.extend(element);
5437
+ }
5438
+ element = element.parentNode;
5439
+ }
5440
+ }
5441
+
5442
+ function pointer(event) {
5443
+ return { x: pointerX(event), y: pointerY(event) };
5444
+ }
5445
+
5446
+ function pointerX(event) {
5447
+ var docElement = document.documentElement,
5448
+ body = document.body || { scrollLeft: 0 };
5449
+
5450
+ return event.pageX || (event.clientX +
5451
+ (docElement.scrollLeft || body.scrollLeft) -
5452
+ (docElement.clientLeft || 0));
5453
+ }
5454
+
5455
+ function pointerY(event) {
5456
+ var docElement = document.documentElement,
5457
+ body = document.body || { scrollTop: 0 };
5458
+
5459
+ return event.pageY || (event.clientY +
5460
+ (docElement.scrollTop || body.scrollTop) -
5461
+ (docElement.clientTop || 0));
5462
+ }
5463
+
5464
+
5465
+ function stop(event) {
5466
+ Event.extend(event);
5467
+ event.preventDefault();
5468
+ event.stopPropagation();
5469
+
5470
+ event.stopped = true;
5471
+ }
5472
+
5473
+
5474
+ Event.Methods = {
5475
+ isLeftClick: isLeftClick,
5476
+ isMiddleClick: isMiddleClick,
5477
+ isRightClick: isRightClick,
5478
+
5479
+ element: element,
5480
+ findElement: findElement,
5481
+
5482
+ pointer: pointer,
5483
+ pointerX: pointerX,
5484
+ pointerY: pointerY,
5485
+
5486
+ stop: stop
5487
+ };
5488
+
5489
+ var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
5490
+ m[name] = Event.Methods[name].methodize();
5491
+ return m;
5492
+ });
5493
+
5494
+ if (window.attachEvent) {
5495
+ function _relatedTarget(event) {
5496
+ var element;
5497
+ switch (event.type) {
5498
+ case 'mouseover':
5499
+ case 'mouseenter':
5500
+ element = event.fromElement;
5501
+ break;
5502
+ case 'mouseout':
5503
+ case 'mouseleave':
5504
+ element = event.toElement;
5505
+ break;
5506
+ default:
5507
+ return null;
5508
+ }
5509
+ return Element.extend(element);
5510
+ }
5511
+
5512
+ var additionalMethods = {
5513
+ stopPropagation: function() { this.cancelBubble = true },
5514
+ preventDefault: function() { this.returnValue = false },
5515
+ inspect: function() { return '[object Event]' }
5516
+ };
5517
+
5518
+ Event.extend = function(event, element) {
5519
+ if (!event) return false;
5520
+
5521
+ if (!isIELegacyEvent(event)) return event;
5522
+
5523
+ if (event._extendedByPrototype) return event;
5524
+ event._extendedByPrototype = Prototype.emptyFunction;
5525
+
5526
+ var pointer = Event.pointer(event);
5527
+
5528
+ Object.extend(event, {
5529
+ target: event.srcElement || element,
5530
+ relatedTarget: _relatedTarget(event),
5531
+ pageX: pointer.x,
5532
+ pageY: pointer.y
5533
+ });
5534
+
5535
+ Object.extend(event, methods);
5536
+ Object.extend(event, additionalMethods);
5537
+
5538
+ return event;
5539
+ };
5540
+ } else {
5541
+ Event.extend = Prototype.K;
5542
+ }
5543
+
5544
+ if (window.addEventListener) {
5545
+ Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
5546
+ Object.extend(Event.prototype, methods);
5547
+ }
5548
+
5549
+ function _createResponder(element, eventName, handler) {
5550
+ var registry = Element.retrieve(element, 'prototype_event_registry');
5551
+
5552
+ if (Object.isUndefined(registry)) {
5553
+ CACHE.push(element);
5554
+ registry = Element.retrieve(element, 'prototype_event_registry', $H());
5555
+ }
5556
+
5557
+ var respondersForEvent = registry.get(eventName);
5558
+ if (Object.isUndefined(respondersForEvent)) {
5559
+ respondersForEvent = [];
5560
+ registry.set(eventName, respondersForEvent);
5561
+ }
5562
+
5563
+ if (respondersForEvent.pluck('handler').include(handler)) return false;
5564
+
5565
+ var responder;
5566
+ if (eventName.include(":")) {
5567
+ responder = function(event) {
5568
+ if (Object.isUndefined(event.eventName))
5569
+ return false;
5570
+
5571
+ if (event.eventName !== eventName)
5572
+ return false;
5573
+
5574
+ Event.extend(event, element);
5575
+ handler.call(element, event);
5576
+ };
5577
+ } else {
5578
+ if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
5579
+ (eventName === "mouseenter" || eventName === "mouseleave")) {
5580
+ if (eventName === "mouseenter" || eventName === "mouseleave") {
5581
+ responder = function(event) {
5582
+ Event.extend(event, element);
5583
+
5584
+ var parent = event.relatedTarget;
5585
+ while (parent && parent !== element) {
5586
+ try { parent = parent.parentNode; }
5587
+ catch(e) { parent = element; }
5588
+ }
5589
+
5590
+ if (parent === element) return;
5591
+
5592
+ handler.call(element, event);
5593
+ };
5594
+ }
5595
+ } else {
5596
+ responder = function(event) {
5597
+ Event.extend(event, element);
5598
+ handler.call(element, event);
5599
+ };
5600
+ }
5601
+ }
5602
+
5603
+ responder.handler = handler;
5604
+ respondersForEvent.push(responder);
5605
+ return responder;
5606
+ }
5607
+
5608
+ function _destroyCache() {
5609
+ for (var i = 0, length = CACHE.length; i < length; i++) {
5610
+ Event.stopObserving(CACHE[i]);
5611
+ CACHE[i] = null;
5612
+ }
5613
+ }
5614
+
5615
+ var CACHE = [];
5616
+
5617
+ if (Prototype.Browser.IE)
5618
+ window.attachEvent('onunload', _destroyCache);
5619
+
5620
+ if (Prototype.Browser.WebKit)
5621
+ window.addEventListener('unload', Prototype.emptyFunction, false);
5622
+
5623
+
5624
+ var _getDOMEventName = Prototype.K,
5625
+ translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
5626
+
5627
+ if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
5628
+ _getDOMEventName = function(eventName) {
5629
+ return (translations[eventName] || eventName);
5630
+ };
5631
+ }
5632
+
5633
+ function observe(element, eventName, handler) {
5634
+ element = $(element);
5635
+
5636
+ var responder = _createResponder(element, eventName, handler);
5637
+
5638
+ if (!responder) return element;
5639
+
5640
+ if (eventName.include(':')) {
5641
+ if (element.addEventListener)
5642
+ element.addEventListener("dataavailable", responder, false);
5643
+ else {
5644
+ element.attachEvent("ondataavailable", responder);
5645
+ element.attachEvent("onlosecapture", responder);
5646
+ }
5647
+ } else {
5648
+ var actualEventName = _getDOMEventName(eventName);
5649
+
5650
+ if (element.addEventListener)
5651
+ element.addEventListener(actualEventName, responder, false);
5652
+ else
5653
+ element.attachEvent("on" + actualEventName, responder);
5654
+ }
5655
+
5656
+ return element;
5657
+ }
5658
+
5659
+ function stopObserving(element, eventName, handler) {
5660
+ element = $(element);
5661
+
5662
+ var registry = Element.retrieve(element, 'prototype_event_registry');
5663
+ if (!registry) return element;
5664
+
5665
+ if (!eventName) {
5666
+ registry.each( function(pair) {
5667
+ var eventName = pair.key;
5668
+ stopObserving(element, eventName);
5669
+ });
5670
+ return element;
5671
+ }
5672
+
5673
+ var responders = registry.get(eventName);
5674
+ if (!responders) return element;
5675
+
5676
+ if (!handler) {
5677
+ responders.each(function(r) {
5678
+ stopObserving(element, eventName, r.handler);
5679
+ });
5680
+ return element;
5681
+ }
5682
+
5683
+ var i = responders.length, responder;
5684
+ while (i--) {
5685
+ if (responders[i].handler === handler) {
5686
+ responder = responders[i];
5687
+ break;
5688
+ }
5689
+ }
5690
+ if (!responder) return element;
5691
+
5692
+ if (eventName.include(':')) {
5693
+ if (element.removeEventListener)
5694
+ element.removeEventListener("dataavailable", responder, false);
5695
+ else {
5696
+ element.detachEvent("ondataavailable", responder);
5697
+ element.detachEvent("onlosecapture", responder);
5698
+ }
5699
+ } else {
5700
+ var actualEventName = _getDOMEventName(eventName);
5701
+ if (element.removeEventListener)
5702
+ element.removeEventListener(actualEventName, responder, false);
5703
+ else
5704
+ element.detachEvent('on' + actualEventName, responder);
5705
+ }
5706
+
5707
+ registry.set(eventName, responders.without(responder));
5708
+
5709
+ return element;
5710
+ }
5711
+
5712
+ function fire(element, eventName, memo, bubble) {
5713
+ element = $(element);
5714
+
5715
+ if (Object.isUndefined(bubble))
5716
+ bubble = true;
5717
+
5718
+ if (element == document && document.createEvent && !element.dispatchEvent)
5719
+ element = document.documentElement;
5720
+
5721
+ var event;
5722
+ if (document.createEvent) {
5723
+ event = document.createEvent('HTMLEvents');
5724
+ event.initEvent('dataavailable', bubble, true);
5725
+ } else {
5726
+ event = document.createEventObject();
5727
+ event.eventType = bubble ? 'ondataavailable' : 'onlosecapture';
5728
+ }
5729
+
5730
+ event.eventName = eventName;
5731
+ event.memo = memo || { };
5732
+
5733
+ if (document.createEvent)
5734
+ element.dispatchEvent(event);
5735
+ else
5736
+ element.fireEvent(event.eventType, event);
5737
+
5738
+ return Event.extend(event);
5739
+ }
5740
+
5741
+ Event.Handler = Class.create({
5742
+ initialize: function(element, eventName, selector, callback) {
5743
+ this.element = $(element);
5744
+ this.eventName = eventName;
5745
+ this.selector = selector;
5746
+ this.callback = callback;
5747
+ this.handler = this.handleEvent.bind(this);
5748
+ },
5749
+
5750
+ start: function() {
5751
+ Event.observe(this.element, this.eventName, this.handler);
5752
+ return this;
5753
+ },
5754
+
5755
+ stop: function() {
5756
+ Event.stopObserving(this.element, this.eventName, this.handler);
5757
+ return this;
5758
+ },
5759
+
5760
+ handleEvent: function(event) {
5761
+ var element = Event.findElement(event, this.selector);
5762
+ if (element) this.callback.call(this.element, event, element);
5763
+ }
5764
+ });
5765
+
5766
+ function on(element, eventName, selector, callback) {
5767
+ element = $(element);
5768
+ if (Object.isFunction(selector) && Object.isUndefined(callback)) {
5769
+ callback = selector, selector = null;
5770
+ }
5771
+
5772
+ return new Event.Handler(element, eventName, selector, callback).start();
5773
+ }
5774
+
5775
+ Object.extend(Event, Event.Methods);
5776
+
5777
+ Object.extend(Event, {
5778
+ fire: fire,
5779
+ observe: observe,
5780
+ stopObserving: stopObserving,
5781
+ on: on
5782
+ });
5783
+
5784
+ Element.addMethods({
5785
+ fire: fire,
5786
+
5787
+ observe: observe,
5788
+
5789
+ stopObserving: stopObserving,
5790
+
5791
+ on: on
5792
+ });
5793
+
5794
+ Object.extend(document, {
5795
+ fire: fire.methodize(),
5796
+
5797
+ observe: observe.methodize(),
5798
+
5799
+ stopObserving: stopObserving.methodize(),
5800
+
5801
+ on: on.methodize(),
5802
+
5803
+ loaded: false
5804
+ });
5805
+
5806
+ if (window.Event) Object.extend(window.Event, Event);
5807
+ else window.Event = Event;
5808
+ })();
5809
+
5810
+ (function() {
5811
+ /* Support for the DOMContentLoaded event is based on work by Dan Webb,
5812
+ Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
5813
+
5814
+ var timer;
5815
+
5816
+ function fireContentLoadedEvent() {
5817
+ if (document.loaded) return;
5818
+ if (timer) window.clearTimeout(timer);
5819
+ document.loaded = true;
5820
+ document.fire('dom:loaded');
5821
+ }
5822
+
5823
+ function checkReadyState() {
5824
+ if (document.readyState === 'complete') {
5825
+ document.stopObserving('readystatechange', checkReadyState);
5826
+ fireContentLoadedEvent();
5827
+ }
5828
+ }
5829
+
5830
+ function pollDoScroll() {
5831
+ try { document.documentElement.doScroll('left'); }
5832
+ catch(e) {
5833
+ timer = pollDoScroll.defer();
5834
+ return;
5835
+ }
5836
+ fireContentLoadedEvent();
5837
+ }
5838
+
5839
+ if (document.addEventListener) {
5840
+ document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
5841
+ } else {
5842
+ document.observe('readystatechange', checkReadyState);
5843
+ if (window == top)
5844
+ timer = pollDoScroll.defer();
5845
+ }
5846
+
5847
+ Event.observe(window, 'load', fireContentLoadedEvent);
5848
+ })();
5849
+
5850
+ Element.addMethods();
5851
+
5852
+ /*------------------------------- DEPRECATED -------------------------------*/
5853
+
5854
+ Hash.toQueryString = Object.toQueryString;
5855
+
5856
+ var Toggle = { display: Element.toggle };
5857
+
5858
+ Element.Methods.childOf = Element.Methods.descendantOf;
5859
+
5860
+ var Insertion = {
5861
+ Before: function(element, content) {
5862
+ return Element.insert(element, {before:content});
5863
+ },
5864
+
5865
+ Top: function(element, content) {
5866
+ return Element.insert(element, {top:content});
5867
+ },
5868
+
5869
+ Bottom: function(element, content) {
5870
+ return Element.insert(element, {bottom:content});
5871
+ },
5872
+
5873
+ After: function(element, content) {
5874
+ return Element.insert(element, {after:content});
5875
+ }
5876
+ };
5877
+
5878
+ var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
5879
+
5880
+ var Position = {
5881
+ includeScrollOffsets: false,
5882
+
5883
+ prepare: function() {
5884
+ this.deltaX = window.pageXOffset
5885
+ || document.documentElement.scrollLeft
5886
+ || document.body.scrollLeft
5887
+ || 0;
5888
+ this.deltaY = window.pageYOffset
5889
+ || document.documentElement.scrollTop
5890
+ || document.body.scrollTop
5891
+ || 0;
5892
+ },
5893
+
5894
+ within: function(element, x, y) {
5895
+ if (this.includeScrollOffsets)
5896
+ return this.withinIncludingScrolloffsets(element, x, y);
5897
+ this.xcomp = x;
5898
+ this.ycomp = y;
5899
+ this.offset = Element.cumulativeOffset(element);
5900
+
5901
+ return (y >= this.offset[1] &&
5902
+ y < this.offset[1] + element.offsetHeight &&
5903
+ x >= this.offset[0] &&
5904
+ x < this.offset[0] + element.offsetWidth);
5905
+ },
5906
+
5907
+ withinIncludingScrolloffsets: function(element, x, y) {
5908
+ var offsetcache = Element.cumulativeScrollOffset(element);
5909
+
5910
+ this.xcomp = x + offsetcache[0] - this.deltaX;
5911
+ this.ycomp = y + offsetcache[1] - this.deltaY;
5912
+ this.offset = Element.cumulativeOffset(element);
5913
+
5914
+ return (this.ycomp >= this.offset[1] &&
5915
+ this.ycomp < this.offset[1] + element.offsetHeight &&
5916
+ this.xcomp >= this.offset[0] &&
5917
+ this.xcomp < this.offset[0] + element.offsetWidth);
5918
+ },
5919
+
5920
+ overlap: function(mode, element) {
5921
+ if (!mode) return 0;
5922
+ if (mode == 'vertical')
5923
+ return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
5924
+ element.offsetHeight;
5925
+ if (mode == 'horizontal')
5926
+ return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
5927
+ element.offsetWidth;
5928
+ },
5929
+
5930
+
5931
+ cumulativeOffset: Element.Methods.cumulativeOffset,
5932
+
5933
+ positionedOffset: Element.Methods.positionedOffset,
5934
+
5935
+ absolutize: function(element) {
5936
+ Position.prepare();
5937
+ return Element.absolutize(element);
5938
+ },
5939
+
5940
+ relativize: function(element) {
5941
+ Position.prepare();
5942
+ return Element.relativize(element);
5943
+ },
5944
+
5945
+ realOffset: Element.Methods.cumulativeScrollOffset,
5946
+
5947
+ offsetParent: Element.Methods.getOffsetParent,
5948
+
5949
+ page: Element.Methods.viewportOffset,
5950
+
5951
+ clone: function(source, target, options) {
5952
+ options = options || { };
5953
+ return Element.clonePosition(target, source, options);
5954
+ }
5955
+ };
5956
+
5957
+ /*--------------------------------------------------------------------------*/
5958
+
5959
+ if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
5960
+ function iter(name) {
5961
+ return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
5962
+ }
5963
+
5964
+ instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
5965
+ function(element, className) {
5966
+ className = className.toString().strip();
5967
+ var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
5968
+ return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
5969
+ } : function(element, className) {
5970
+ className = className.toString().strip();
5971
+ var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
5972
+ if (!classNames && !className) return elements;
5973
+
5974
+ var nodes = $(element).getElementsByTagName('*');
5975
+ className = ' ' + className + ' ';
5976
+
5977
+ for (var i = 0, child, cn; child = nodes[i]; i++) {
5978
+ if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
5979
+ (classNames && classNames.all(function(name) {
5980
+ return !name.toString().blank() && cn.include(' ' + name + ' ');
5981
+ }))))
5982
+ elements.push(Element.extend(child));
5983
+ }
5984
+ return elements;
5985
+ };
5986
+
5987
+ return function(className, parentElement) {
5988
+ return $(parentElement || document.body).getElementsByClassName(className);
5989
+ };
5990
+ }(Element.Methods);
5991
+
5992
+ /*--------------------------------------------------------------------------*/
5993
+
5994
+ Element.ClassNames = Class.create();
5995
+ Element.ClassNames.prototype = {
5996
+ initialize: function(element) {
5997
+ this.element = $(element);
5998
+ },
5999
+
6000
+ _each: function(iterator) {
6001
+ this.element.className.split(/\s+/).select(function(name) {
6002
+ return name.length > 0;
6003
+ })._each(iterator);
6004
+ },
6005
+
6006
+ set: function(className) {
6007
+ this.element.className = className;
6008
+ },
6009
+
6010
+ add: function(classNameToAdd) {
6011
+ if (this.include(classNameToAdd)) return;
6012
+ this.set($A(this).concat(classNameToAdd).join(' '));
6013
+ },
6014
+
6015
+ remove: function(classNameToRemove) {
6016
+ if (!this.include(classNameToRemove)) return;
6017
+ this.set($A(this).without(classNameToRemove).join(' '));
6018
+ },
6019
+
6020
+ toString: function() {
6021
+ return $A(this).join(' ');
6022
+ }
6023
+ };
6024
+
6025
+ Object.extend(Element.ClassNames.prototype, Enumerable);
6026
+
6027
+ /*--------------------------------------------------------------------------*/
6028
+
6029
+ (function() {
6030
+ window.Selector = Class.create({
6031
+ initialize: function(expression) {
6032
+ this.expression = expression.strip();
6033
+ },
6034
+
6035
+ findElements: function(rootElement) {
6036
+ return Prototype.Selector.select(this.expression, rootElement);
6037
+ },
6038
+
6039
+ match: function(element) {
6040
+ return Prototype.Selector.match(element, this.expression);
6041
+ },
6042
+
6043
+ toString: function() {
6044
+ return this.expression;
6045
+ },
6046
+
6047
+ inspect: function() {
6048
+ return "#<Selector: " + this.expression + ">";
6049
+ }
6050
+ });
6051
+
6052
+ Object.extend(Selector, {
6053
+ matchElements: function(elements, expression) {
6054
+ var match = Prototype.Selector.match,
6055
+ results = [];
6056
+
6057
+ for (var i = 0, length = elements.length; i < length; i++) {
6058
+ var element = elements[i];
6059
+ if (match(element, expression)) {
6060
+ results.push(Element.extend(element));
6061
+ }
6062
+ }
6063
+ return results;
6064
+ },
6065
+
6066
+ findElement: function(elements, expression, index) {
6067
+ index = index || 0;
6068
+ var matchIndex = 0, element;
6069
+ for (var i = 0, length = elements.length; i < length; i++) {
6070
+ element = elements[i];
6071
+ if (Prototype.Selector.match(element, expression) && index === matchIndex++) {
6072
+ return Element.extend(element);
6073
+ }
6074
+ }
6075
+ },
6076
+
6077
+ findChildElements: function(element, expressions) {
6078
+ var selector = expressions.toArray().join(', ');
6079
+ return Prototype.Selector.select(selector, element || document);
6080
+ }
6081
+ });
6082
+ })();
assets/lib/{chosen_v1.4.2 → chosen}/docsupport/style.css RENAMED
@@ -202,3 +202,18 @@ i { font-style: italic; }
202
  padding-left: 27px;
203
  text-decoration: none;
204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  padding-left: 27px;
203
  text-decoration: none;
204
  }
205
+
206
+ .select,
207
+ .chosen-select,
208
+ .chosen-select-no-single,
209
+ .chosen-select-no-results,
210
+ .chosen-select-deselect,
211
+ .chosen-select-rtl,
212
+ .chosen-select-width {
213
+ width: 350px;
214
+ }
215
+
216
+ .jquery-version-refer {
217
+ margin-top: 40px;
218
+ font-style: italic;
219
+ }
assets/lib/{chosen_v1.4.2 → chosen}/index.html RENAMED
@@ -6,17 +6,16 @@
6
  <link rel="stylesheet" href="docsupport/style.css">
7
  <link rel="stylesheet" href="docsupport/prism.css">
8
  <link rel="stylesheet" href="chosen.css">
9
- <style type="text/css" media="all">
10
- /* fix rtl for demo */
11
- .chosen-rtl .chosen-drop { left: -9000px; }
12
- </style>
13
  </head>
14
  <body>
15
  <form>
16
  <div id="container">
17
  <div id="content">
18
  <header>
19
- <h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
20
  </header>
21
  <p>Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.</p>
22
 
@@ -30,7 +29,7 @@
30
  <div class="side-by-side clearfix">
31
  <div>
32
  <em>Turns This</em>
33
- <select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
34
  <option value=""></option>
35
  <option value="United States">United States</option>
36
  <option value="United Kingdom">United Kingdom</option>
@@ -287,7 +286,7 @@
287
  </div>
288
  <div>
289
  <em>Into This</em>
290
- <select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
291
  <option value=""></option>
292
  <option value="United States">United States</option>
293
  <option value="United Kingdom">United Kingdom</option>
@@ -548,7 +547,7 @@
548
  <div class="side-by-side clearfix">
549
  <div>
550
  <em>Turns This</em>
551
- <select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
552
  <option value=""></option>
553
  <option value="United States">United States</option>
554
  <option value="United Kingdom">United Kingdom</option>
@@ -805,7 +804,7 @@
805
  </div>
806
  <div>
807
  <em>Into This</em>
808
- <select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
809
  <option value=""></option>
810
  <option value="United States">United States</option>
811
  <option value="United Kingdom">United Kingdom</option>
@@ -1066,7 +1065,7 @@
1066
  <div class="side-by-side clearfix">
1067
  <div>
1068
  <em>Single Select with Groups</em>
1069
- <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
1070
  <option value=""></option>
1071
  <optgroup label="NFC EAST">
1072
  <option>Dallas Cowboys</option>
@@ -1120,7 +1119,7 @@
1120
  </div>
1121
  <div>
1122
  <em>Multiple Select with Groups</em>
1123
- <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
1124
  <option value=""></option>
1125
  <optgroup label="NFC EAST">
1126
  <option>Dallas Cowboys</option>
@@ -1179,7 +1178,7 @@
1179
  <p>Chosen automatically highlights selected options and removes disabled options.</p>
1180
  <div>
1181
  <em>Single Select</em>
1182
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
1183
  <option value=""></option>
1184
  <option>American Black Bear</option>
1185
  <option>Asiatic Black Bear</option>
@@ -1193,7 +1192,7 @@
1193
  </div>
1194
  <div>
1195
  <em>Multiple Select</em>
1196
- <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
1197
  <option value=""></option>
1198
  <option>American Black Bear</option>
1199
  <option>Asiatic Black Bear</option>
@@ -1209,11 +1208,11 @@
1209
 
1210
  <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
1211
  <div class="side-by-side clearfix">
1212
- <p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
1213
  <pre><code class="language-javascript">$(".chosen-select").chosen({disable_search_threshold: 10});</code></pre>
1214
  <p></p>
1215
  <div>
1216
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
1217
  <option value=""></option>
1218
  <option>American Black Bear</option>
1219
  <option>Asiatic Black Bear</option>
@@ -1231,7 +1230,7 @@
1231
  <h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
1232
  <div class="side-by-side clearfix">
1233
  <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1234
- <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"&gt;</code></pre>
1235
  <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1236
  </div>
1237
 
@@ -1242,7 +1241,7 @@
1242
  <p></p>
1243
  <div>
1244
  <em>Single Select</em>
1245
- <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
1246
  <option value=""></option>
1247
  <option>American Black Bear</option>
1248
  <option>Asiatic Black Bear</option>
@@ -1256,7 +1255,7 @@
1256
  </div>
1257
  <div>
1258
  <em>Multiple Select</em>
1259
- <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
1260
  <option value=""></option>
1261
  <option>American Black Bear</option>
1262
  <option>Asiatic Black Bear</option>
@@ -1282,7 +1281,7 @@
1282
  <div class="side-by-side clearfix">
1283
  <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
1284
  <div class="side-by-side clearfix">
1285
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
1286
  <option value=""></option>
1287
  <option>American Black Bear</option>
1288
  <option>Asiatic Black Bear</option>
@@ -1296,13 +1295,14 @@
1296
  </div>
1297
  </div>
1298
 
1299
- <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
1300
  <div class="side-by-side clearfix">
1301
- <p>Chosen supports right to left select boxes too. just add <code class="language-javascript">"chosen-rtl"</code> in addition to <code class="language-javascript">"chosen-select"</code> to your select tags and you are good to go.</p>
1302
- <pre><code class="language-markup">&lt;select class="chosen-select <strong>chosen-rtl</strong>"&gt;</code></pre>
 
1303
  <div>
1304
- <em>Single right to left select</em>
1305
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
1306
  <option value=""></option>
1307
  <option>American Black Bear</option>
1308
  <option>Asiatic Black Bear</option>
@@ -1313,8 +1313,8 @@
1313
  </select>
1314
  </div>
1315
  <div>
1316
- <em>Multiple right to left select</em>
1317
- <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select chosen-rtl" tabindex="14">
1318
  <option value=""></option>
1319
  <option>American Black Bear</option>
1320
  <option>Asiatic Black Bear</option>
@@ -1326,12 +1326,12 @@
1326
  </div>
1327
  </div>
1328
 
1329
- <h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
1330
  <div class="side-by-side clearfix">
1331
  <ul>
1332
  <li>
1333
- <h3>Form Field Change</h3>
1334
- <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
1335
  <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
1336
  </li>
1337
  <li>
@@ -1339,6 +1339,11 @@
1339
  <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
1340
  <pre><code class="language-javascript">$("#form_field").trigger("chosen:updated");</code></pre>
1341
  </li>
 
 
 
 
 
1342
  </ul>
1343
  </div>
1344
 
@@ -1382,7 +1387,7 @@
1382
  <p></p>
1383
  <div>
1384
  <em><label for="single-label-example">Click to Highlight Single Select</label></em>
1385
- <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
1386
  <option value=""></option>
1387
  <option selected>American Black Bear</option>
1388
  <option>Asiatic Black Bear</option>
@@ -1396,7 +1401,7 @@
1396
  </div>
1397
  <div>
1398
  <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
1399
- <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
1400
  <option value=""></option>
1401
  <option>American Black Bear</option>
1402
  <option>Asiatic Black Bear</option>
@@ -1448,26 +1453,15 @@
1448
  </ul>
1449
 
1450
  <footer>
1451
- &copy; 2011&ndash;2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
1452
  </footer>
1453
 
1454
  </div>
1455
  </div>
1456
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
1457
  <script src="chosen.jquery.js" type="text/javascript"></script>
1458
  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
1459
- <script type="text/javascript">
1460
- var config = {
1461
- '.chosen-select' : {},
1462
- '.chosen-select-deselect' : {allow_single_deselect:true},
1463
- '.chosen-select-no-single' : {disable_search_threshold:10},
1464
- '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
1465
- '.chosen-select-width' : {width:"95%"}
1466
- }
1467
- for (var selector in config) {
1468
- $(selector).chosen(config[selector]);
1469
- }
1470
- </script>
1471
  </form>
1472
  <div class="oss-bar">
1473
  <ul>
6
  <link rel="stylesheet" href="docsupport/style.css">
7
  <link rel="stylesheet" href="docsupport/prism.css">
8
  <link rel="stylesheet" href="chosen.css">
9
+
10
+ <meta http-equiv="Content-Security-Policy" content="default-src &apos;self&apos;; script-src &apos;self&apos; https://ajax.googleapis.com; style-src &apos;self&apos;; img-src &apos;self&apos; data:">
11
+
 
12
  </head>
13
  <body>
14
  <form>
15
  <div id="container">
16
  <div id="content">
17
  <header>
18
+ <h1>Chosen <small>(<span id="latest-version">v1.8.3</span>)</small></h1>
19
  </header>
20
  <p>Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.</p>
21
 
29
  <div class="side-by-side clearfix">
30
  <div>
31
  <em>Turns This</em>
32
+ <select data-placeholder="Choose a Country..." class="select" tabindex="1">
33
  <option value=""></option>
34
  <option value="United States">United States</option>
35
  <option value="United Kingdom">United Kingdom</option>
286
  </div>
287
  <div>
288
  <em>Into This</em>
289
+ <select data-placeholder="Choose a Country..." class="chosen-select" tabindex="2">
290
  <option value=""></option>
291
  <option value="United States">United States</option>
292
  <option value="United Kingdom">United Kingdom</option>
547
  <div class="side-by-side clearfix">
548
  <div>
549
  <em>Turns This</em>
550
+ <select data-placeholder="Choose a Country..." class="select" multiple tabindex="3">
551
  <option value=""></option>
552
  <option value="United States">United States</option>
553
  <option value="United Kingdom">United Kingdom</option>
804
  </div>
805
  <div>
806
  <em>Into This</em>
807
+ <select data-placeholder="Choose a Country..." class="chosen-select" multiple tabindex="4">
808
  <option value=""></option>
809
  <option value="United States">United States</option>
810
  <option value="United Kingdom">United Kingdom</option>
1065
  <div class="side-by-side clearfix">
1066
  <div>
1067
  <em>Single Select with Groups</em>
1068
+ <select data-placeholder="Your Favorite Football Team" class="chosen-select" tabindex="5">
1069
  <option value=""></option>
1070
  <optgroup label="NFC EAST">
1071
  <option>Dallas Cowboys</option>
1119
  </div>
1120
  <div>
1121
  <em>Multiple Select with Groups</em>
1122
+ <select data-placeholder="Your Favorite Football Team" class="chosen-select" multiple tabindex="6">
1123
  <option value=""></option>
1124
  <optgroup label="NFC EAST">
1125
  <option>Dallas Cowboys</option>
1178
  <p>Chosen automatically highlights selected options and removes disabled options.</p>
1179
  <div>
1180
  <em>Single Select</em>
1181
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select" tabindex="7">
1182
  <option value=""></option>
1183
  <option>American Black Bear</option>
1184
  <option>Asiatic Black Bear</option>
1192
  </div>
1193
  <div>
1194
  <em>Multiple Select</em>
1195
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="8">
1196
  <option value=""></option>
1197
  <option>American Black Bear</option>
1198
  <option>Asiatic Black Bear</option>
1208
 
1209
  <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
1210
  <div class="side-by-side clearfix">
1211
+ <p>The <code>disable_search_threshold</code> option can be specified to hide the search input on single selects if there are <i>n</i> or fewer options.</p>
1212
  <pre><code class="language-javascript">$(".chosen-select").chosen({disable_search_threshold: 10});</code></pre>
1213
  <p></p>
1214
  <div>
1215
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-no-single" tabindex="9">
1216
  <option value=""></option>
1217
  <option>American Black Bear</option>
1218
  <option>Asiatic Black Bear</option>
1230
  <h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
1231
  <div class="side-by-side clearfix">
1232
  <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1233
+ <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"&gt;</code></pre>
1234
  <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1235
  </div>
1236
 
1241
  <p></p>
1242
  <div>
1243
  <em>Single Select</em>
1244
+ <select data-placeholder="Type &apos;C&apos; to view" class="chosen-select-no-results" tabindex="10">
1245
  <option value=""></option>
1246
  <option>American Black Bear</option>
1247
  <option>Asiatic Black Bear</option>
1255
  </div>
1256
  <div>
1257
  <em>Multiple Select</em>
1258
+ <select data-placeholder="Type &apos;C&apos; to view" multiple class="chosen-select-no-results" tabindex="11">
1259
  <option value=""></option>
1260
  <option>American Black Bear</option>
1261
  <option>Asiatic Black Bear</option>
1281
  <div class="side-by-side clearfix">
1282
  <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
1283
  <div class="side-by-side clearfix">
1284
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-deselect" tabindex="12">
1285
  <option value=""></option>
1286
  <option>American Black Bear</option>
1287
  <option>Asiatic Black Bear</option>
1295
  </div>
1296
  </div>
1297
 
1298
+ <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right-to-Left Support</a></h2>
1299
  <div class="side-by-side clearfix">
1300
+ <p>You can set right-to-left text by setting <code class="language-javascript">rtl: true</code></p>
1301
+ <pre><code class="language-javascript"> $(".chosen-select").chosen({rtl: true}); </code></pre>
1302
+
1303
  <div>
1304
+ <em>Single Right-to-Left Select</em>
1305
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-rtl" tabindex="13">
1306
  <option value=""></option>
1307
  <option>American Black Bear</option>
1308
  <option>Asiatic Black Bear</option>
1313
  </select>
1314
  </div>
1315
  <div>
1316
+ <em>Multiple Right-to-Left Select</em>
1317
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-rtl" tabindex="14">
1318
  <option value=""></option>
1319
  <option>American Black Bear</option>
1320
  <option>Asiatic Black Bear</option>
1326
  </div>
1327
  </div>
1328
 
1329
+ <h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
1330
  <div class="side-by-side clearfix">
1331
  <ul>
1332
  <li>
1333
+ <h3>Observing Form Field Changes</h3>
1334
+ <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That lets you do something like this:</p>
1335
  <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
1336
  </li>
1337
  <li>
1339
  <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
1340
  <pre><code class="language-javascript">$("#form_field").trigger("chosen:updated");</code></pre>
1341
  </li>
1342
+ <li>
1343
+ <h3>Destroying Chosen</h3>
1344
+ <p>To destroy Chosen and revert back to the native select:</p>
1345
+ <pre><code class="language-javascript">$("#form_field").chosen("destroy");</code></pre>
1346
+ </li>
1347
  </ul>
1348
  </div>
1349
 
1387
  <p></p>
1388
  <div>
1389
  <em><label for="single-label-example">Click to Highlight Single Select</label></em>
1390
+ <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" tabindex="17" id="single-label-example">
1391
  <option value=""></option>
1392
  <option selected>American Black Bear</option>
1393
  <option>Asiatic Black Bear</option>
1401
  </div>
1402
  <div>
1403
  <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
1404
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="18" id="multiple-label-example">
1405
  <option value=""></option>
1406
  <option>American Black Bear</option>
1407
  <option>Asiatic Black Bear</option>
1453
  </ul>
1454
 
1455
  <footer>
1456
+ &copy; 2011&ndash;2016 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
1457
  </footer>
1458
 
1459
  </div>
1460
  </div>
1461
+ <script src="docsupport/jquery-3.2.1.min.js" type="text/javascript"></script>
1462
  <script src="chosen.jquery.js" type="text/javascript"></script>
1463
  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
1464
+ <script src="docsupport/init.js" type="text/javascript" charset="utf-8"></script>
 
 
 
 
 
 
 
 
 
 
 
1465
  </form>
1466
  <div class="oss-bar">
1467
  <ul>
assets/lib/{chosen_v1.4.2 → chosen}/index.proto.html RENAMED
@@ -6,16 +6,15 @@
6
  <link rel="stylesheet" href="docsupport/style.css">
7
  <link rel="stylesheet" href="docsupport/prism.css">
8
  <link rel="stylesheet" href="chosen.css">
9
- <style type="text/css" media="all">
10
- /* fix rtl for demo */
11
- .chosen-rtl .chosen-drop { left: -9000px; }
12
- </style>
13
  </head>
14
  <body>
15
  <div id="container">
16
  <div id="content">
17
  <header>
18
- <h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
19
  </header>
20
  <p>Chosen is a Prototype plugin that makes long, unwieldy select boxes much more user-friendly.</p>
21
 
@@ -25,13 +24,13 @@
25
  <a class="button" href="https://github.com/harvesthq/chosen/blob/master/contributing.md">Contribute</a>
26
  </p>
27
 
28
- <p style="margin-top: 40px; font-style: italic;">Looking for the <a href="index.html">jQuery version?</a></p>
29
 
30
  <h2><a name="standard-select" class="anchor" href="#standard-select">Standard Select</a></h2>
31
  <div class="side-by-side clearfix">
32
  <div>
33
  <em>Turns This</em>
34
- <select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
35
  <option value=""></option>
36
  <option value="United States">United States</option>
37
  <option value="United Kingdom">United Kingdom</option>
@@ -288,7 +287,7 @@
288
  </div>
289
  <div>
290
  <em>Into This</em>
291
- <select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
292
  <option value=""></option>
293
  <option value="United States">United States</option>
294
  <option value="United Kingdom">United Kingdom</option>
@@ -549,7 +548,7 @@
549
  <div class="side-by-side clearfix">
550
  <div>
551
  <em>Turns This</em>
552
- <select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
553
  <option value=""></option>
554
  <option value="United States">United States</option>
555
  <option value="United Kingdom">United Kingdom</option>
@@ -806,7 +805,7 @@
806
  </div>
807
  <div>
808
  <em>Into This</em>
809
- <select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
810
  <option value=""></option>
811
  <option value="United States">United States</option>
812
  <option value="United Kingdom">United Kingdom</option>
@@ -1067,7 +1066,7 @@
1067
  <div class="side-by-side clearfix">
1068
  <div>
1069
  <em>Single Select with Groups</em>
1070
- <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
1071
  <option value=""></option>
1072
  <optgroup label="NFC EAST">
1073
  <option>Dallas Cowboys</option>
@@ -1121,7 +1120,7 @@
1121
  </div>
1122
  <div>
1123
  <em>Multiple Select with Groups</em>
1124
- <select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
1125
  <option value=""></option>
1126
  <optgroup label="NFC EAST">
1127
  <option>Dallas Cowboys</option>
@@ -1180,7 +1179,7 @@
1180
  <p>Chosen automatically highlights selected options and removes disabled options.</p>
1181
  <div>
1182
  <em>Single Select</em>
1183
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
1184
  <option value=""></option>
1185
  <option>American Black Bear</option>
1186
  <option>Asiatic Black Bear</option>
@@ -1194,7 +1193,7 @@
1194
  </div>
1195
  <div>
1196
  <em>Multiple Select</em>
1197
- <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
1198
  <option value=""></option>
1199
  <option>American Black Bear</option>
1200
  <option>Asiatic Black Bear</option>
@@ -1210,11 +1209,11 @@
1210
 
1211
  <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
1212
  <div class="side-by-side clearfix">
1213
- <p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
1214
  <pre><code class="language-javascript"> new Chosen($("chosen_select_field"),{disable_search_threshold: 10}); </code></pre>
1215
  <p></p>
1216
  <div>
1217
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
1218
  <option value=""></option>
1219
  <option>American Black Bear</option>
1220
  <option>Asiatic Black Bear</option>
@@ -1232,7 +1231,7 @@
1232
  <h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
1233
  <div class="side-by-side clearfix">
1234
  <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1235
- <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"&gt;</code></pre>
1236
  <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1237
  </div>
1238
 
@@ -1243,7 +1242,7 @@
1243
 
1244
  <div>
1245
  <em>Single Select</em>
1246
- <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
1247
  <option value=""></option>
1248
  <option>American Black Bear</option>
1249
  <option>Asiatic Black Bear</option>
@@ -1257,7 +1256,7 @@
1257
  </div>
1258
  <div>
1259
  <em>Multiple Select</em>
1260
- <select data-placeholder="Type &apos;C&apos; to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
1261
  <option value=""></option>
1262
  <option>American Black Bear</option>
1263
  <option>Asiatic Black Bear</option>
@@ -1283,7 +1282,7 @@
1283
  <div class="side-by-side clearfix">
1284
  <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
1285
  <div class="side-by-side clearfix">
1286
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
1287
  <option value=""></option>
1288
  <option>American Black Bear</option>
1289
  <option>Asiatic Black Bear</option>
@@ -1297,13 +1296,13 @@
1297
  </div>
1298
  </div>
1299
 
1300
- <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
1301
  <div class="side-by-side clearfix">
1302
- <p>Chosen supports right to left select boxes too. just add <code class="language-markup">"chosen-rtl"</code> in addition to <code class="language-markup">"chosen-select"</code> to your select tags and you are good to go.</p>
1303
- <pre><code class="language-markup">&lt;select class="chosen-select <strong>chosen-rtl</strong>"&gt;</code></pre>
1304
  <div>
1305
- <em>Single right to left select</em>
1306
- <select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
1307
  <option value=""></option>
1308
  <option>American Black Bear</option>
1309
  <option>Asiatic Black Bear</option>
@@ -1314,8 +1313,8 @@
1314
  </select>
1315
  </div>
1316
  <div>
1317
- <em>Multiple right to left select</em>
1318
- <select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select chosen-rtl" tabindex="14">
1319
  <option value=""></option>
1320
  <option>American Black Bear</option>
1321
  <option>Asiatic Black Bear</option>
@@ -1327,12 +1326,12 @@
1327
  </div>
1328
  </div>
1329
 
1330
- <h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
1331
  <div class="side-by-side clearfix">
1332
  <ul>
1333
  <li>
1334
- <h3>Form Field Change</h3>
1335
- <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
1336
  <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
1337
  <p><strong>Note:</strong> Prototype doesn't offer support for triggering standard browser events. <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> is required to trigger the change event when using the Prototype version.</p>
1338
  </li>
@@ -1341,6 +1340,14 @@
1341
  <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
1342
  <pre><code class="language-javascript">Event.fire($("form_field"), "chosen:updated");</code></pre>
1343
  </li>
 
 
 
 
 
 
 
 
1344
  </ul>
1345
  </div>
1346
 
@@ -1384,7 +1391,7 @@
1384
  <p></p>
1385
  <div>
1386
  <em><label for="single-label-example">Click to Highlight Single Select</label></em>
1387
- <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
1388
  <option value=""></option>
1389
  <option selected>American Black Bear</option>
1390
  <option>Asiatic Black Bear</option>
@@ -1398,7 +1405,7 @@
1398
  </div>
1399
  <div>
1400
  <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
1401
- <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
1402
  <option value=""></option>
1403
  <option>American Black Bear</option>
1404
  <option>Asiatic Black Bear</option>
@@ -1446,33 +1453,15 @@
1446
  </ul>
1447
 
1448
  <footer>
1449
- &copy; 2011&ndash;2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
1450
  </footer>
1451
 
1452
  </div>
1453
  </div>
1454
- <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
1455
  <script src="chosen.proto.js" type="text/javascript"></script>
1456
  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
1457
- <script type="text/javascript">
1458
- document.observe('dom:loaded', function(evt) {
1459
- var config = {
1460
- '.chosen-select' : {},
1461
- '.chosen-select-deselect' : {allow_single_deselect:true},
1462
- '.chosen-select-no-single' : {disable_search_threshold:10},
1463
- '.chosen-select-no-results': {no_results_text: "Oops, nothing found!"},
1464
- '.chosen-select-width' : {width: "95%"}
1465
- }
1466
- var results = [];
1467
- for (var selector in config) {
1468
- var elements = $$(selector);
1469
- for (var i = 0; i < elements.length; i++) {
1470
- results.push(new Chosen(elements[i],config[selector]));
1471
- }
1472
- }
1473
- return results;
1474
- });
1475
- </script>
1476
  <div class="oss-bar">
1477
  <ul>
1478
  <li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
6
  <link rel="stylesheet" href="docsupport/style.css">
7
  <link rel="stylesheet" href="docsupport/prism.css">
8
  <link rel="stylesheet" href="chosen.css">
9
+
10
+ <meta http-equiv="Content-Security-Policy" content="default-src &apos;self&apos;; script-src &apos;self&apos; https://ajax.googleapis.com; style-src &apos;self&apos;; img-src &apos;self&apos; data:">
11
+
 
12
  </head>
13
  <body>
14
  <div id="container">
15
  <div id="content">
16
  <header>
17
+ <h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.8.3</span>)</small></h1>
18
  </header>
19
  <p>Chosen is a Prototype plugin that makes long, unwieldy select boxes much more user-friendly.</p>
20
 
24
  <a class="button" href="https://github.com/harvesthq/chosen/blob/master/contributing.md">Contribute</a>
25
  </p>
26
 
27
+ <p class="jquery-version-refer">Looking for the <a href="index.html">jQuery version?</a></p>
28
 
29
  <h2><a name="standard-select" class="anchor" href="#standard-select">Standard Select</a></h2>
30
  <div class="side-by-side clearfix">
31
  <div>
32
  <em>Turns This</em>
33
+ <select data-placeholder="Choose a Country..." class="select" tabindex="1">
34
  <option value=""></option>
35
  <option value="United States">United States</option>
36
  <option value="United Kingdom">United Kingdom</option>
287
  </div>
288
  <div>
289
  <em>Into This</em>
290
+ <select data-placeholder="Choose a Country..." class="chosen-select" tabindex="2">
291
  <option value=""></option>
292
  <option value="United States">United States</option>
293
  <option value="United Kingdom">United Kingdom</option>
548
  <div class="side-by-side clearfix">
549
  <div>
550
  <em>Turns This</em>
551
+ <select data-placeholder="Choose a Country..." class="select" multiple tabindex="3">
552
  <option value=""></option>
553
  <option value="United States">United States</option>
554
  <option value="United Kingdom">United Kingdom</option>
805
  </div>
806
  <div>
807
  <em>Into This</em>
808
+ <select data-placeholder="Choose a Country..." class="chosen-select" multiple tabindex="4">
809
  <option value=""></option>
810
  <option value="United States">United States</option>
811
  <option value="United Kingdom">United Kingdom</option>
1066
  <div class="side-by-side clearfix">
1067
  <div>
1068
  <em>Single Select with Groups</em>
1069
+ <select data-placeholder="Your Favorite Football Team" class="chosen-select" tabindex="5">
1070
  <option value=""></option>
1071
  <optgroup label="NFC EAST">
1072
  <option>Dallas Cowboys</option>
1120
  </div>
1121
  <div>
1122
  <em>Multiple Select with Groups</em>
1123
+ <select data-placeholder="Your Favorite Football Team" class="chosen-select" multiple tabindex="6">
1124
  <option value=""></option>
1125
  <optgroup label="NFC EAST">
1126
  <option>Dallas Cowboys</option>
1179
  <p>Chosen automatically highlights selected options and removes disabled options.</p>
1180
  <div>
1181
  <em>Single Select</em>
1182
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select" tabindex="7">
1183
  <option value=""></option>
1184
  <option>American Black Bear</option>
1185
  <option>Asiatic Black Bear</option>
1193
  </div>
1194
  <div>
1195
  <em>Multiple Select</em>
1196
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="8">
1197
  <option value=""></option>
1198
  <option>American Black Bear</option>
1199
  <option>Asiatic Black Bear</option>
1209
 
1210
  <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
1211
  <div class="side-by-side clearfix">
1212
+ <p>The <code>disable_search_threshold</code> option can be specified to hide the search input on single selects if there are <i>n</i> or fewer options.</p>
1213
  <pre><code class="language-javascript"> new Chosen($("chosen_select_field"),{disable_search_threshold: 10}); </code></pre>
1214
  <p></p>
1215
  <div>
1216
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-no-single" tabindex="9">
1217
  <option value=""></option>
1218
  <option>American Black Bear</option>
1219
  <option>Asiatic Black Bear</option>
1231
  <h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
1232
  <div class="side-by-side clearfix">
1233
  <p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1234
+ <pre><code class="language-markup">&lt;select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"&gt;</code></pre>
1235
  <p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1236
  </div>
1237
 
1242
 
1243
  <div>
1244
  <em>Single Select</em>
1245
+ <select data-placeholder="Type &apos;C&apos; to view" class="chosen-select-no-results" tabindex="10">
1246
  <option value=""></option>
1247
  <option>American Black Bear</option>
1248
  <option>Asiatic Black Bear</option>
1256
  </div>
1257
  <div>
1258
  <em>Multiple Select</em>
1259
+ <select data-placeholder="Type &apos;C&apos; to view" multiple class="chosen-select-no-results" tabindex="11">
1260
  <option value=""></option>
1261
  <option>American Black Bear</option>
1262
  <option>Asiatic Black Bear</option>
1282
  <div class="side-by-side clearfix">
1283
  <p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
1284
  <div class="side-by-side clearfix">
1285
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-deselect" tabindex="12">
1286
  <option value=""></option>
1287
  <option>American Black Bear</option>
1288
  <option>Asiatic Black Bear</option>
1296
  </div>
1297
  </div>
1298
 
1299
+ <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right-to-Left Support</a></h2>
1300
  <div class="side-by-side clearfix">
1301
+ <p>You can set right-to-left text by setting <code class="language-javascript">rtl: true</code></p>
1302
+ <pre><code class="language-javascript"> $(".chosen-select").chosen({rtl: true}); </code></pre>
1303
  <div>
1304
+ <em>Single Right-to-Left Select</em>
1305
+ <select data-placeholder="Your Favorite Type of Bear" class="chosen-select-rtl" tabindex="13">
1306
  <option value=""></option>
1307
  <option>American Black Bear</option>
1308
  <option>Asiatic Black Bear</option>
1313
  </select>
1314
  </div>
1315
  <div>
1316
+ <em>Multiple Right-to-Left Select</em>
1317
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-rtl" tabindex="14">
1318
  <option value=""></option>
1319
  <option>American Black Bear</option>
1320
  <option>Asiatic Black Bear</option>
1326
  </div>
1327
  </div>
1328
 
1329
+ <h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
1330
  <div class="side-by-side clearfix">
1331
  <ul>
1332
  <li>
1333
+ <h3>Observing Form Field Changes</h3>
1334
+ <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That lets you do something like this:</p>
1335
  <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
1336
  <p><strong>Note:</strong> Prototype doesn't offer support for triggering standard browser events. <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> is required to trigger the change event when using the Prototype version.</p>
1337
  </li>
1340
  <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
1341
  <pre><code class="language-javascript">Event.fire($("form_field"), "chosen:updated");</code></pre>
1342
  </li>
1343
+ <li>
1344
+ <h3>Destroying Chosen</h3>
1345
+ <p>To destroy Chosen and revert back to the native select, call <code class="language-javascript">destroy</code> on the Chosen instance:</p>
1346
+ <pre><code class="language-javascript">chosen = new Chosen($("form_field"));
1347
+
1348
+ // ...later
1349
+ chosen.destroy();</code></pre>
1350
+ </li>
1351
  </ul>
1352
  </div>
1353
 
1391
  <p></p>
1392
  <div>
1393
  <em><label for="single-label-example">Click to Highlight Single Select</label></em>
1394
+ <select data-placeholder="Your Favorite Types of Bear" class="chosen-select" tabindex="17" id="single-label-example">
1395
  <option value=""></option>
1396
  <option selected>American Black Bear</option>
1397
  <option>Asiatic Black Bear</option>
1405
  </div>
1406
  <div>
1407
  <em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
1408
+ <select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" tabindex="18" id="multiple-label-example">
1409
  <option value=""></option>
1410
  <option>American Black Bear</option>
1411
  <option>Asiatic Black Bear</option>
1453
  </ul>
1454
 
1455
  <footer>
1456
+ &copy; 2011&ndash;2016 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
1457
  </footer>
1458
 
1459
  </div>
1460
  </div>
1461
+ <script src="docsupport/prototype-1.7.0.0.js" type="text/javascript"></script>
1462
  <script src="chosen.proto.js" type="text/javascript"></script>
1463
  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
1464
+ <script src="docsupport/init.proto.js" type="text/javascript" charset="utf-8"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1465
  <div class="oss-bar">
1466
  <ul>
1467
  <li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
assets/lib/{chosen_v1.4.2 → chosen}/options.html RENAMED
@@ -15,7 +15,7 @@
15
  <div id="container">
16
  <div id="content">
17
  <header>
18
- <h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
19
  </header>
20
  <p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>
21
 
@@ -48,7 +48,7 @@
48
  <tr>
49
  <td>disable_search_threshold</td>
50
  <td>0</td>
51
- <td>Hide the search input on single selects if there are fewer than (n) options.</td>
52
  </tr>
53
  <tr>
54
  <td>enable_split_word_search</td>
@@ -86,6 +86,11 @@
86
  <td>false</td>
87
  <td>By default, Chosen’s search matches starting at the beginning of a word. Setting this option to <code class="language-javascript">true</code> allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.</td>
88
  </tr>
 
 
 
 
 
89
  <tr>
90
  <td>single_backstroke_delete</td>
91
  <td>true</td>
@@ -116,6 +121,35 @@
116
  <p>By default, Chosen only shows the text of a selected option. Setting this option to <code class="language-javascript">true</code> will show the text and group (if any) of the selected option.</p>
117
  </td>
118
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  </table>
120
 
121
  <h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
@@ -175,6 +209,7 @@
175
  <td>
176
  <p>Chosen supports right-to-left text in select boxes. Add the class <code class="language-html">chosen-rtl</code> to your select tag to support right-to-left text options.</p>
177
  <p><strong>Note:</strong> The <code class="language-html">chosen-rtl</code> class will pass through to the Chosen select even when the <code class="language-javascript">inherit_select_classes</code> option is set to <code class="language-javascript">false</code>.</p>
 
178
  </td>
179
  </tr>
180
  </table>
@@ -198,7 +233,7 @@
198
  <td>change</td>
199
  <td>
200
  <p>Chosen triggers the standard DOM event whenever a selection is made (it also sends a <code class="language-javascript">selected</code> or <code class="language-javascript">deselected</code> parameter that tells you which option was changed).</p>
201
- <p><strong>Note:</strong> in order to use change in the Prototype version, you have to include the <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> class. The selected and deselected parameters are not available for Prototype.</p>
202
  </td>
203
  </tr>
204
  <tr>
@@ -224,7 +259,7 @@
224
  </table>
225
 
226
  <p>
227
- <strong>Note:</strong> all custom Chosen events (those that being with <code class="language-javascript">chosen:</code>) also include the <code class="language-javascript">chosen</code> object as a parameter.
228
  </p>
229
 
230
  <h2><a name="triggerable-events" class="anchor" href="#triggerable-events">Triggerable Events</a></h2>
@@ -260,7 +295,7 @@
260
  </table>
261
 
262
  <footer>
263
- &copy; 2011&ndash;2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
264
  </footer>
265
 
266
  </div>
15
  <div id="container">
16
  <div id="content">
17
  <header>
18
+ <h1>Chosen <small>(<span id="latest-version">v1.8.3</span>)</small></h1>
19
  </header>
20
  <p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>
21
 
48
  <tr>
49
  <td>disable_search_threshold</td>
50
  <td>0</td>
51
+ <td>Hide the search input on single selects if there are <i>n</i> or fewer options.</td>
52
  </tr>
53
  <tr>
54
  <td>enable_split_word_search</td>
86
  <td>false</td>
87
  <td>By default, Chosen’s search matches starting at the beginning of a word. Setting this option to <code class="language-javascript">true</code> allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.</td>
88
  </tr>
89
+ <tr>
90
+ <td>group_search</td>
91
+ <td>true</td>
92
+ <td>By default, Chosen will search group labels as well as options, and filter to show all options below matching groups. Set this to <code class="language-javascript">false</code> to search only in the options.</td>
93
+ </tr>
94
  <tr>
95
  <td>single_backstroke_delete</td>
96
  <td>true</td>
121
  <p>By default, Chosen only shows the text of a selected option. Setting this option to <code class="language-javascript">true</code> will show the text and group (if any) of the selected option.</p>
122
  </td>
123
  </tr>
124
+ <tr>
125
+ <td>max_shown_results</td>
126
+ <td>Infinity</td>
127
+ <td>
128
+ <p>Only show the first (n) matching options in the results. This can be used to increase performance for selects with very many options.</p>
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <td>case_sensitive_search</td>
133
+ <td>false</td>
134
+ <td>
135
+ <p>By default, Chosen's search is case-insensitive. Setting this option to <code class="language-javascript">true</code> makes the search case-sensitive.</p>
136
+ </td>
137
+ </tr>
138
+ <tr>
139
+ <td>hide_results_on_select</td>
140
+ <td>true</td>
141
+ <td>
142
+ <p>By default, Chosen's results are hidden after a option is selected. Setting this option to <code class="language-javascript">false</code> will keep the results open after selection. This only applies to multiple selects.</p>
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <td>rtl</td>
147
+ <td>false</td>
148
+ <td>
149
+ <p>Chosen supports right-to-left text in select boxes. Set this option to <code class="language-javascript">true</code> to support right-to-left text options.</p>
150
+ <p><strong>Note:</strong> <a href="#classes">the <code class="language-javascript">chosen-rtl</code> class</a> on the select has precedence over this option. However, the classname approach is deprecated and will be removed in future versions of Chosen.</p>
151
+ </td>
152
+ </tr>
153
  </table>
154
 
155
  <h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
209
  <td>
210
  <p>Chosen supports right-to-left text in select boxes. Add the class <code class="language-html">chosen-rtl</code> to your select tag to support right-to-left text options.</p>
211
  <p><strong>Note:</strong> The <code class="language-html">chosen-rtl</code> class will pass through to the Chosen select even when the <code class="language-javascript">inherit_select_classes</code> option is set to <code class="language-javascript">false</code>.</p>
212
+ <p><strong>Note:</strong> This is deprecated in favor of using the <code class="language-javascript">rtl: true</code> option (see the <a href="#options">Options section</a>).</p>
213
  </td>
214
  </tr>
215
  </table>
233
  <td>change</td>
234
  <td>
235
  <p>Chosen triggers the standard DOM event whenever a selection is made (it also sends a <code class="language-javascript">selected</code> or <code class="language-javascript">deselected</code> parameter that tells you which option was changed).</p>
236
+ <p><strong>Note:</strong> The selected and deselected parameters are not available for Prototype.</p>
237
  </td>
238
  </tr>
239
  <tr>
259
  </table>
260
 
261
  <p>
262
+ <strong>Note:</strong> all custom Chosen events (those that begin with <code class="language-javascript">chosen:</code>) also include the <code class="language-javascript">chosen</code> object as a parameter.
263
  </p>
264
 
265
  <h2><a name="triggerable-events" class="anchor" href="#triggerable-events">Triggerable Events</a></h2>
295
  </table>
296
 
297
  <footer>
298
+ &copy; 2011&ndash;2016 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
299
  </footer>
300
 
301
  </div>
assets/lib/{chosen_v1.4.2/bower.json → chosen/package.json} RENAMED
@@ -1,20 +1,7 @@
1
  {
2
- "name": "chosen",
3
- "description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
4
- "version": "1.4.2",
5
- "main": [
6
- "chosen.jquery.min.js",
7
- "chosen.css",
8
- "chosen-sprite@2x.png",
9
- "chosen-sprite.png"
10
- ],
11
- "license": [
12
- {
13
- "type": "MIT",
14
- "url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md"
15
- }
16
- ],
17
- "ignore": [],
18
  "keywords": [
19
  "select",
20
  "multiselect",
@@ -23,7 +10,10 @@
23
  "input",
24
  "ui"
25
  ],
26
- "authors": [
 
 
 
27
  {
28
  "name": "Patrick Filler",
29
  "url": "https://github.com/pfiller"
@@ -41,13 +31,20 @@
41
  "url": "https://github.com/koenpunt"
42
  }
43
  ],
44
- "homepage": "http://harvesthq.github.io/chosen/",
 
 
 
 
 
 
 
 
 
 
 
45
  "repository": {
46
  "type": "git",
47
- "url": "https://github.com/harvesthq/chosen"
48
- },
49
- "dependencies": {
50
- "jquery": ">=1.4.4"
51
- },
52
- "devDependencies": []
53
  }
1
  {
2
+ "name": "chosen-js",
3
+ "version": "1.8.2",
4
+ "description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  "keywords": [
6
  "select",
7
  "multiselect",
10
  "input",
11
  "ui"
12
  ],
13
+ "homepage": "https://harvesthq.github.io/chosen/",
14
+ "bugs": "https://github.com/harvesthq/chosen/issues",
15
+ "license": "MIT",
16
+ "contributors": [
17
  {
18
  "name": "Patrick Filler",
19
  "url": "https://github.com/pfiller"
31
  "url": "https://github.com/koenpunt"
32
  }
33
  ],
34
+ "dependencies": {},
35
+ "files": [
36
+ "chosen.jquery.js",
37
+ "chosen.jquery.min.js",
38
+ "chosen.proto.js",
39
+ "chosen.proto.min.js",
40
+ "chosen.css",
41
+ "chosen.min.css",
42
+ "chosen-sprite@2x.png",
43
+ "chosen-sprite.png"
44
+ ],
45
+ "main": "chosen.jquery.js",
46
  "repository": {
47
  "type": "git",
48
+ "url": "https://github.com/harvesthq/chosen.git"
49
+ }
 
 
 
 
50
  }
assets/lib/chosen_v1.4.2/chosen.jquery.min.js DELETED
@@ -1,2 +0,0 @@
1
- /* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- (function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
 
 
assets/lib/chosen_v1.4.2/chosen.min.css DELETED
@@ -1,3 +0,0 @@
1
- /* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
-
3
- .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
 
 
 
assets/lib/chosen_v1.4.2/chosen.proto.min.js DELETED
@@ -1,2 +0,0 @@
1
- /* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- (function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.observe("touchend",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+this.choice_label(a)+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.value="","function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}).call(this);
 
 
async-javascript.php CHANGED
@@ -3,10 +3,10 @@
3
  * Plugin Name: Async JavaScript
4
  * Plugin URI: https://autoptimize.com/
5
  * Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
6
- * Version: 2.18.03.10
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
- * Text Domain: async-javascript
10
  * License: GNU General Public License v2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
3
  * Plugin Name: Async JavaScript
4
  * Plugin URI: https://autoptimize.com/
5
  * Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
6
+ * Version: 2.18.03.15
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
+ * Text Domain: asyncjs
10
  * License: GNU General Public License v2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
asyncjsBackendClass.php CHANGED
@@ -19,7 +19,6 @@ class AsyncJavaScriptBackend {
19
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
20
  define( 'AJ_VERSION', '2.18.03.10' );
21
  define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://autoptimize.com/)' );
22
- add_action( 'admin_enqueue_scripts', array( $this, 'aj_enqueue_scripts' ) );
23
  add_action( 'plugins_loaded', array( $this, 'aj_admin_init' ) );
24
  add_action( 'admin_init', array( $this, 'aj_disable_pro' ) );
25
  }
@@ -88,8 +87,8 @@ class AsyncJavaScriptBackend {
88
  */
89
  public function aj_enqueue_scripts() {
90
  // chosen
91
- wp_enqueue_style('chosen', plugins_url( 'assets/lib/chosen_v1.4.2/chosen.min.css', __FILE__ ));
92
- wp_enqueue_script('chosen', plugins_url( 'assets/lib/chosen_v1.4.2/chosen.jquery.min.js', __FILE__ ), array( 'jquery' ), AJ_VERSION, true);
93
 
94
  // own JS & CSS
95
  wp_enqueue_style('aj_admin_styles', plugins_url( '/css/admin.min.css', __FILE__ ));
@@ -225,7 +224,7 @@ class AsyncJavaScriptBackend {
225
  * @return n/a
226
  */
227
  public function async_javascript_menu() {
228
- add_submenu_page(
229
  'options-general.php',
230
  AJ_TITLE . ' Admin',
231
  AJ_TITLE,
@@ -233,6 +232,7 @@ class AsyncJavaScriptBackend {
233
  'async-javascript',
234
  array( $this, 'async_javascript_admin' )
235
  );
 
236
  }
237
 
238
  /**
19
  define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
20
  define( 'AJ_VERSION', '2.18.03.10' );
21
  define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://autoptimize.com/)' );
 
22
  add_action( 'plugins_loaded', array( $this, 'aj_admin_init' ) );
23
  add_action( 'admin_init', array( $this, 'aj_disable_pro' ) );
24
  }
87
  */
88
  public function aj_enqueue_scripts() {
89
  // chosen
90
+ wp_enqueue_style('chosen', plugins_url( 'assets/lib/chosen/chosen.min.css', __FILE__ ));
91
+ wp_enqueue_script('chosen', plugins_url( 'assets/lib/chosen/chosen.jquery.min.js', __FILE__ ), array( 'jquery' ), AJ_VERSION, true);
92
 
93
  // own JS & CSS
94
  wp_enqueue_style('aj_admin_styles', plugins_url( '/css/admin.min.css', __FILE__ ));
224
  * @return n/a
225
  */
226
  public function async_javascript_menu() {
227
+ $asj_page = add_submenu_page(
228
  'options-general.php',
229
  AJ_TITLE . ' Admin',
230
  AJ_TITLE,
232
  'async-javascript',
233
  array( $this, 'async_javascript_admin' )
234
  );
235
+ add_action( 'admin_print_scripts-'.$asj_page, array( $this, 'aj_enqueue_scripts' ) );
236
  }
237
 
238
  /**
js/admin.js CHANGED
@@ -1 +1,337 @@
1
- function aj_step( theStep ) {
2
  * functions and actions to load after document ready
3
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  * functions and actions to load after document ready
2
  */
3
+ function aj_step( theStep ) {
4
+ var aj_nonce = jQuery( '#aj_nonce' ).val();
5
+ var aj_gtmetrix_username = jQuery( '#aj_gtmetrix_username' ).val();
6
+ var aj_gtmetrix_api_key = jQuery( '#aj_gtmetrix_api_key' ).val();
7
+ var aj_gtmetrix_server = jQuery( '#aj_gtmetrix_server' ).val();
8
+ if ( theStep == 'aj_step_results' ) {
9
+ var data = {
10
+ 'action': 'aj_steps',
11
+ 'sub_action': theStep,
12
+ 'site_url': aj_localize_admin.siteurl,
13
+ 'aj_gtmetrix_username': aj_gtmetrix_username,
14
+ 'aj_gtmetrix_api_key': aj_gtmetrix_api_key,
15
+ 'aj_gtmetrix_server': aj_gtmetrix_server,
16
+ 'security': aj_nonce
17
+ };
18
+ jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
19
+ try {
20
+ response = jQuery.parseJSON( response );
21
+ if ( response.status !== false ) {
22
+ var baseline_pagespeed = response.baseline_pagespeed;
23
+ var baseline_yslow = response.baseline_yslow;
24
+ var pagespeed = response.results.pagespeed_score;
25
+ var yslow = response.results.yslow_score;
26
+ var aj_gtmetrix_config = response.name;
27
+ var flt = parseFloat( response.results.fully_loaded_time / 1000 ).toFixed( 2 );
28
+ var url = response.url;
29
+ jQuery( '.aj_gtmetrix_config' ).html( aj_gtmetrix_config );
30
+ if ( pagespeed > baseline_pagespeed ) {
31
+ jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'an increase' );
32
+ } else if ( pagespeed < baseline_pagespeed ) {
33
+ jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'a decrease' );
34
+ } else {
35
+ jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'no change' );
36
+ }
37
+ if ( yslow > baseline_yslow ) {
38
+ jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'an increase' );
39
+ } else if ( yslow < baseline_yslow ) {
40
+ jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'a decrease' );
41
+ } else {
42
+ jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'no change' );
43
+ }
44
+ jQuery( '#aj_gtmetrix_baseline_pagespeed' ).html( baseline_pagespeed + '%' );
45
+ jQuery( '#aj_gtmetrix_best_pagespeed' ).html( pagespeed + '%' );
46
+ jQuery( '#aj_gtmetrix_baseline_yslow' ).html( baseline_yslow + '%' );
47
+ jQuery( '#aj_gtmetrix_best_yslow' ).html( yslow + '%' );
48
+ jQuery( '#aj_gtmetrix_best_fullyloaded' ).html( flt + 's' );
49
+ jQuery( '#aj_gtmetrix_best_url' ).attr( 'href', url ).html( url );
50
+ if ( response.id == 'aj_step2b' || response.id == 'aj_step2c' ) {
51
+ jQuery( '#aj_step4_jquery_excluded' ).hide();
52
+ jQuery( '#aj_step4_jquery_not_excluded' ).show();
53
+ } else if ( response.id == 'aj_step2d' || response.id == 'aj_step2e' ) {
54
+ jQuery( '#aj_step4_jquery_excluded' ).show();
55
+ jQuery( '#aj_step4_jquery_not_excluded' ).hide();
56
+ }
57
+ jQuery( '.aj_gtmetrix_credits' ).html( response.credits );
58
+ jQuery( '#aj_step_results' ).show();
59
+ } else {
60
+ console.log(response);
61
+ }
62
+ }
63
+ catch( err ) {
64
+ console.log( err );
65
+ }
66
+ });
67
+ } else {
68
+ var data = {
69
+ 'action': 'aj_steps',
70
+ 'sub_action': theStep,
71
+ 'site_url': aj_localize_admin.siteurl,
72
+ 'aj_gtmetrix_username': aj_gtmetrix_username,
73
+ 'aj_gtmetrix_api_key': aj_gtmetrix_api_key,
74
+ 'aj_gtmetrix_server': aj_gtmetrix_server,
75
+ 'security': aj_nonce
76
+ };
77
+ jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
78
+ try {
79
+ response = jQuery.parseJSON( response );
80
+ if ( response.status !== false ) {
81
+ var screenshot = response.results.report_url + '/screenshot.jpg';
82
+ var pagespeed = response.results.pagespeed_score;
83
+ var yslow = response.results.yslow_score;
84
+ var flt = parseFloat( response.results.fully_loaded_time / 1000 ).toFixed( 2 );
85
+ var tps = Math.floor( response.results.page_bytes / 1024 );
86
+ if ( tps > 1024 ) {
87
+ tps = tps / 1024 + 'MB';
88
+ } else {
89
+ tps = tps + 'KB';
90
+ }
91
+ var requests = response.results.page_elements;
92
+ var report = '<a href="' + response.results.report_url + '" target="_blank">' + response.results.report_url + '</a>';
93
+ var report_url = report.replace( 'https://', 'https://' + aj_gtmetrix_username + ':' + aj_gtmetrix_api_key + '@' );
94
+ var step_name = response.name;
95
+ var step_url = response.url;
96
+ var pr = 255 * ( 1 - ( pagespeed / 100 ) );
97
+ var yr = 255 * ( 1 - ( yslow / 100 ) );
98
+ var pg = 255 * ( pagespeed / 100 );
99
+ var yg = 255 * ( yslow / 100 );
100
+ var prgb = 'rgb(' + Math.floor( pr ) + ',' + Math.floor( pg ) + ',0 )';
101
+ var yrgb = 'rgb(' + Math.floor( yr ) + ',' + Math.floor( yg ) + ',0 )';
102
+ if ( theStep == 'aj_gtmetrix_test' ) {
103
+ theStep = 'aj_latest';
104
+ }
105
+ jQuery( '#' + theStep + '_please_wait' ).hide();
106
+ jQuery( '.' + theStep + '_screenshot' ).attr( 'src', screenshot );
107
+ jQuery( '.' + theStep + '_pagespeed' ).html( pagespeed + '%' ).css( { color: prgb } );
108
+ jQuery( '.' + theStep + '_yslow' ).html( yslow + '%' ).css( { color: yrgb } );
109
+ jQuery( '.' + theStep + '_flt' ).html( flt + 's' );
110
+ jQuery( '.' + theStep + '_tps' ).html( tps );
111
+ jQuery( '.' + theStep + '_requests' ).html( requests );
112
+ jQuery( '.' + theStep + '_report' ).html( report_url );
113
+ jQuery( '#' + theStep + '_gtmetrix_results' ).show();
114
+ jQuery( '.' + theStep + '_gtmetrix' ).html( step_name );
115
+ jQuery( '.' + theStep + '_url' ).attr( 'href', step_url ).html( step_url );
116
+ jQuery( '.aj_gtmetrix_credits' ).html( response.credits );
117
+ if ( theStep == 'aj_step2' ) {
118
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
119
+ jQuery( '#aj_step2b' ).show();
120
+ jQuery( 'html, body' ).animate({
121
+ scrollTop: jQuery( "#aj_step2b" ).offset().top
122
+ }, 1000 );
123
+ aj_step( 'aj_step2b' );
124
+ } else if ( theStep == 'aj_step2b' ) {
125
+ jQuery( '#aj_step2c' ).show();
126
+ jQuery( 'html, body' ).animate({
127
+ scrollTop: jQuery( "#aj_step2c" ).offset().top
128
+ }, 1000 );
129
+ aj_step( 'aj_step2c' );
130
+ } else if ( theStep == 'aj_step2c' ) {
131
+ jQuery( '#aj_step2d' ).show();
132
+ jQuery( 'html, body' ).animate({
133
+ scrollTop: jQuery( "#aj_step2d" ).offset().top
134
+ }, 1000 );
135
+ aj_step( 'aj_step2d' );
136
+ } else if ( theStep == 'aj_step2d' ) {
137
+ jQuery( '#aj_step2e' ).show();
138
+ jQuery( 'html, body' ).animate({
139
+ scrollTop: jQuery( "#aj_step2e" ).offset().top
140
+ }, 1000 );
141
+ aj_step( 'aj_step2e' );
142
+ } else if ( theStep == 'aj_step2e' ) {
143
+ jQuery( '#aj_step_results' ).show();
144
+ jQuery( 'html, body' ).animate({
145
+ scrollTop: jQuery( "#aj_step_results" ).offset().top
146
+ }, 1000 );
147
+ aj_step( 'aj_step_results' );
148
+ } else if ( theStep == 'aj_latest' ) {
149
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
150
+ jQuery( '#aj_latest_gtmetrix_results' ).show();
151
+ jQuery( '#aj_latest_please_wait' ).hide();
152
+ jQuery( 'html, body' ).animate({
153
+ scrollTop: jQuery( "#aj_latest_please_wait" ).offset().top
154
+ }, 1000 );
155
+ }
156
+ } else {
157
+ console.log(response);
158
+ }
159
+ }
160
+ catch( err ) {
161
+ console.log( err );
162
+ }
163
+ });
164
+ }
165
+ }
166
+
167
+ /**
168
+ * functions and actions to load after document ready
169
+ */
170
+ jQuery( document ).ready( function() {
171
+ if ( typeof jQuery( '.aj_chosen' ).chosen === "function" ) {
172
+ jQuery( '.aj_chosen' ).chosen();
173
+ }
174
+
175
+ jQuery( document ).on( 'click', '.aj-upgrade-notice .notice-dismiss', function() {
176
+ var aj_nonce = jQuery( '#aj_nonce' ).val();
177
+ var notice_id = jQuery( '.aj-upgrade-notice' ).attr( 'data-id' );
178
+ jQuery.ajax({
179
+ url: aj.ajaxurl,
180
+ data: {
181
+ 'action': 'async_javascript_dismiss_upgrade',
182
+ 'notice_id': notice_id,
183
+ 'security': aj_nonce
184
+ }
185
+ });
186
+ });
187
+
188
+ jQuery( document ).on( 'click', '.aj_steps_button', function(e) {
189
+ e.preventDefault();
190
+ var aj_nonce = jQuery( '#aj_nonce' ).val();
191
+ var theStep = jQuery( this ).attr( 'data-id' );
192
+ if ( theStep == 'aj_goto_settings' ) {
193
+ var newURL = aj_localize_admin.ajadminurl + '&tab=settings';
194
+ window.location.href = newURL;
195
+ } else if ( theStep == 'aj_apply_settings' || theStep == 'aj_step2b_apply' || theStep == 'aj_step2c_apply' || theStep == 'aj_step2d_apply' || theStep == 'aj_step2e_apply') {
196
+ if ( theStep != 'aj_apply_settings' ) {
197
+ var settings = theStep.replace( '_apply', '' );
198
+ } else {
199
+ var settings = '';
200
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
201
+ }
202
+ var data = {
203
+ 'action': 'aj_steps',
204
+ 'sub_action': 'aj_apply_settings',
205
+ 'settings': settings,
206
+ 'site_url': aj_localize_admin.siteurl,
207
+ 'security': aj_nonce
208
+ };
209
+ jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
210
+ try {
211
+ response = jQuery.parseJSON( response );
212
+ if ( response.status !== false ) {
213
+ if ( jQuery( '#aj_step4' ).length ) {
214
+ jQuery( '#aj_step5' ).show();
215
+ jQuery( 'html, body' ).animate({
216
+ scrollTop: jQuery( "#aj_step5" ).offset().top
217
+ }, 1000 );
218
+ if ( settings != '' ) {
219
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
220
+ }
221
+ } else {
222
+ if ( settings != '' ) {
223
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
224
+ var newURL = aj_localize_admin.ajadminurl + '&tab=settings';
225
+ window.location.href = newURL;
226
+ }
227
+ }
228
+ } else {
229
+ console.log(response);
230
+ }
231
+ }
232
+ catch( err ) {
233
+ console.log( err );
234
+ }
235
+ });
236
+ } else if ( theStep == 'aj_save_settings' ) {
237
+ if ( jQuery( '#aj_enabled' ).is( ':checked' ) ) {
238
+ var aj_enabled = 1;
239
+ } else {
240
+ var aj_enabled = 0;
241
+ }
242
+ var aj_method = jQuery( 'input[type=radio][name=aj_method]:checked' ).val();
243
+ var aj_jquery = jQuery( 'input[type=radio][name=aj_jquery]:checked' ).val();
244
+ var aj_async = jQuery( '#aj_async' ).val();
245
+ var aj_defer = jQuery( '#aj_defer' ).val();
246
+ var aj_exclusions = jQuery( '#aj_exclusions' ).val();
247
+
248
+ if ( typeof jQuery( '.aj_chosen' ).chosen === "function" ) {
249
+ var aj_plugin_exclusions = jQuery( '#aj_plugin_exclusions' ).chosen().val();
250
+ var aj_theme_exclusions = jQuery( '#aj_theme_exclusions' ).chosen().val();
251
+ } else {
252
+ var aj_plugin_exclusions = jQuery( '#aj_plugin_exclusions' ).val();
253
+ var aj_theme_exclusions = jQuery( '#aj_theme_exclusions' ).val();
254
+ }
255
+
256
+ if ( jQuery( '#aj_autoptimize_enabled' ).is( ':visible' ) ) {
257
+ if ( jQuery( '#aj_autoptimize_enabled' ).is( ':checked' ) ) {
258
+ var aj_autoptimize_enabled = 1;
259
+ var aj_autoptimize_method = jQuery( 'input[type=radio][name=aj_autoptimize_method]:checked' ).val();
260
+ } else {
261
+ var aj_autoptimize_enabled = 0;
262
+ var aj_autoptimize_method = jQuery( 'input[type=radio][name=aj_autoptimize_method]:checked' ).val();
263
+ }
264
+ } else {
265
+ var aj_autoptimize_enabled = 0;
266
+ var aj_autoptimize_method = 'async';
267
+ }
268
+ var data = {
269
+ 'action': 'aj_steps',
270
+ 'sub_action': 'aj_save_settings',
271
+ 'aj_enabled': aj_enabled,
272
+ 'aj_method': aj_method,
273
+ 'aj_jquery': aj_jquery,
274
+ 'aj_async': aj_async,
275
+ 'aj_defer': aj_defer,
276
+ 'aj_exclusions': aj_exclusions,
277
+ 'aj_plugin_exclusions': aj_plugin_exclusions,
278
+ 'aj_theme_exclusions': aj_theme_exclusions,
279
+ 'aj_autoptimize_enabled': aj_autoptimize_enabled,
280
+ 'aj_autoptimize_method': aj_autoptimize_method,
281
+ 'security': aj_nonce
282
+ };
283
+ jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
284
+ try {
285
+ response = jQuery.parseJSON( response );
286
+ if ( response.status !== false ) {
287
+ jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
288
+ } else {
289
+ console.log(response);
290
+ }
291
+ }
292
+ catch( err ) {
293
+ console.log( err );
294
+ }
295
+ });
296
+ } else {
297
+ var aj_gtmetrix_username = jQuery( '#aj_gtmetrix_username' ).val();
298
+ var aj_gtmetrix_api_key = jQuery( '#aj_gtmetrix_api_key' ).val();
299
+ var aj_gtmetrix_server = jQuery( '#aj_gtmetrix_server' ).val();
300
+ var isError = false;
301
+ if ( aj_gtmetrix_username == '' ) {
302
+ jQuery( '#aj_gtmetrix_username' ).addClass( 'aj_field_error' );
303
+ isError = true;
304
+ }
305
+ if ( aj_gtmetrix_api_key == '' ) {
306
+ jQuery( '#aj_gtmetrix_api_key' ).addClass( 'aj_field_error' );
307
+ isError = true;
308
+ }
309
+ if ( isError === false ) {
310
+ if ( theStep != 'aj_gtmetrix_test' ) {
311
+ jQuery( this ).hide();
312
+ jQuery( '#' + theStep ).show();
313
+ } else {
314
+ jQuery( '#aj_latest_please_wait' ).show();
315
+ }
316
+ aj_step( theStep );
317
+ } else {
318
+ return false;
319
+ }
320
+ }
321
+ });
322
+
323
+ jQuery( document ).on( 'change', 'input[type=radio][name=aj_step4_check]', function() {
324
+ var aj_nonce = jQuery( '#aj_nonce' ).val();
325
+ var theSelection = jQuery( this ).val();
326
+ if ( theSelection == 'y' ) {
327
+ jQuery( '#aj_step4_y' ).show();
328
+ jQuery( '#aj_step4_n' ).hide();
329
+ } else {
330
+ jQuery( '#aj_step4_n' ).show();
331
+ jQuery( '#aj_step4_y' ).hide();
332
+ }
333
+ });
334
+
335
+ jQuery( document ).on( 'click', '.aj_dismiss', function() {
336
+ var aj_nonce = jQuery( '#aj_nonce' ).val();
337
+ jQuery( '#aj_notification' ).fadeOut( 'slow' );
338
+ });
339
+ });
js/admin.min.js CHANGED
@@ -1 +1 @@
1
- function aj_step(e){var a=jQuery("#aj_nonce").val(),t=jQuery("#aj_gtmetrix_username").val(),s=jQuery("#aj_gtmetrix_api_key").val(),r=jQuery("#aj_gtmetrix_server").val();if("aj_step_results"==e){var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(e=jQuery.parseJSON(e),e.status!==!1){var a=e.baseline_pagespeed,t=e.baseline_yslow,s=e.results.pagespeed_score,r=e.results.yslow_score,_=e.name,i=parseFloat(e.results.fully_loaded_time/1e3).toFixed(2),j=e.url;jQuery(".aj_gtmetrix_config").html(_),s>a?jQuery("#aj_gtmetrix_inde_pagespeed").html("an increase"):a>s?jQuery("#aj_gtmetrix_inde_pagespeed").html("a decrease"):jQuery("#aj_gtmetrix_inde_pagespeed").html("no change"),r>t?jQuery("#aj_gtmetrix_inde_yslow").html("an increase"):t>r?jQuery("#aj_gtmetrix_inde_yslow").html("a decrease"):jQuery("#aj_gtmetrix_inde_yslow").html("no change"),jQuery("#aj_gtmetrix_baseline_pagespeed").html(a+"%"),jQuery("#aj_gtmetrix_best_pagespeed").html(s+"%"),jQuery("#aj_gtmetrix_baseline_yslow").html(t+"%"),jQuery("#aj_gtmetrix_best_yslow").html(r+"%"),jQuery("#aj_gtmetrix_best_fullyloaded").html(i+"s"),jQuery("#aj_gtmetrix_best_url").attr("href",j).html(j),"aj_step2b"==e.id||"aj_step2c"==e.id?(jQuery("#aj_step4_jquery_excluded").hide(),jQuery("#aj_step4_jquery_not_excluded").show()):("aj_step2d"==e.id||"aj_step2e"==e.id)&&(jQuery("#aj_step4_jquery_excluded").show(),jQuery("#aj_step4_jquery_not_excluded").hide()),jQuery(".aj_gtmetrix_credits").html(e.credits),jQuery("#aj_step_results").show()}else console.log(e)}catch(l){console.log(l)}})}else{var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(a){try{if(a=jQuery.parseJSON(a),a.status!==!1){var r=a.results.report_url+"/screenshot.jpg",_=a.results.pagespeed_score,i=a.results.yslow_score,j=parseFloat(a.results.fully_loaded_time/1e3).toFixed(2),l=Math.floor(a.results.page_bytes/1024);l>1024?l=l/1024+"MB":l+="KB";var o=a.results.page_elements,u='<a href="'+a.results.report_url+'" target="_blank">'+a.results.report_url+"</a>",n=u.replace("https://","https://"+t+":"+s+"@"),y=a.name,p=a.url,c=255*(1-_/100),d=255*(1-i/100),m=255*(_/100),Q=255*(i/100),h="rgb("+Math.floor(c)+","+Math.floor(m)+",0 )",g="rgb("+Math.floor(d)+","+Math.floor(Q)+",0 )";"aj_gtmetrix_test"==e&&(e="aj_latest"),jQuery("#"+e+"_please_wait").hide(),jQuery("."+e+"_screenshot").attr("src",r),jQuery("."+e+"_pagespeed").html(_+"%").css({color:h}),jQuery("."+e+"_yslow").html(i+"%").css({color:g}),jQuery("."+e+"_flt").html(j+"s"),jQuery("."+e+"_tps").html(l),jQuery("."+e+"_requests").html(o),jQuery("."+e+"_report").html(n),jQuery("#"+e+"_gtmetrix_results").show(),jQuery("."+e+"_gtmetrix").html(y),jQuery("."+e+"_url").attr("href",p).html(p),jQuery(".aj_gtmetrix_credits").html(a.credits),"aj_step2"==e?(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_step2b").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2b").offset().top},1e3),aj_step("aj_step2b")):"aj_step2b"==e?(jQuery("#aj_step2c").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2c").offset().top},1e3),aj_step("aj_step2c")):"aj_step2c"==e?(jQuery("#aj_step2d").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2d").offset().top},1e3),aj_step("aj_step2d")):"aj_step2d"==e?(jQuery("#aj_step2e").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2e").offset().top},1e3),aj_step("aj_step2e")):"aj_step2e"==e?(jQuery("#aj_step_results").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step_results").offset().top},1e3),aj_step("aj_step_results")):"aj_latest"==e&&(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_latest_gtmetrix_results").show(),jQuery("#aj_latest_please_wait").hide(),jQuery("html, body").animate({scrollTop:jQuery("#aj_latest_please_wait").offset().top},1e3))}else console.log(a)}catch(f){console.log(f)}})}}jQuery(document).ready(function(){jQuery(".aj_chosen").chosen(),jQuery(document).on("click",".aj-upgrade-notice .notice-dismiss",function(){var e=jQuery("#aj_nonce").val(),a=jQuery(".aj-upgrade-notice").attr("data-id");jQuery.ajax({url:aj.ajaxurl,data:{action:"async_javascript_dismiss_upgrade",notice_id:a,security:e}})}),jQuery(document).on("click",".aj_steps_button",function(e){e.preventDefault();var a=jQuery("#aj_nonce").val(),t=jQuery(this).attr("data-id");if("aj_goto_settings"==t){var s=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=s}else if("aj_apply_settings"==t||"aj_step2b_apply"==t||"aj_step2c_apply"==t||"aj_step2d_apply"==t||"aj_step2e_apply"==t){if("aj_apply_settings"!=t)var r=t.replace("_apply","");else{var r="";jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>')}var _={action:"aj_steps",sub_action:"aj_apply_settings",settings:r,site_url:aj_localize_admin.siteurl,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(e=jQuery.parseJSON(e),e.status!==!1){if(jQuery("#aj_step4").length)jQuery("#aj_step5").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step5").offset().top},1e3),""!=r&&jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');else if(""!=r){jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');var a=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=a}}else console.log(e)}catch(t){console.log(t)}})}else if("aj_save_settings"==t){if(jQuery("#aj_enabled").is(":checked"))var i=1;else var i=0;var j=jQuery("input[type=radio][name=aj_method]:checked").val(),l=jQuery("input[type=radio][name=aj_jquery]:checked").val(),o=jQuery("#aj_async").val(),u=jQuery("#aj_defer").val(),n=jQuery("#aj_exclusions").val(),y=jQuery("#aj_plugin_exclusions").chosen().val(),p=jQuery("#aj_theme_exclusions").chosen().val();if(jQuery("#aj_autoptimize_enabled").is(":visible"))if(jQuery("#aj_autoptimize_enabled").is(":checked"))var c=1,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var c=0,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var c=0,d="async";var _={action:"aj_steps",sub_action:"aj_save_settings",aj_enabled:i,aj_method:j,aj_jquery:l,aj_async:o,aj_defer:u,aj_exclusions:n,aj_plugin_exclusions:y,aj_theme_exclusions:p,aj_autoptimize_enabled:c,aj_autoptimize_method:d,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{e=jQuery.parseJSON(e),e.status!==!1?jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'):console.log(e)}catch(a){console.log(a)}})}else{var m=jQuery("#aj_gtmetrix_username").val(),Q=jQuery("#aj_gtmetrix_api_key").val(),h=(jQuery("#aj_gtmetrix_server").val(),!1);if(""==m&&(jQuery("#aj_gtmetrix_username").addClass("aj_field_error"),h=!0),""==Q&&(jQuery("#aj_gtmetrix_api_key").addClass("aj_field_error"),h=!0),h!==!1)return!1;"aj_gtmetrix_test"!=t?(jQuery(this).hide(),jQuery("#"+t).show()):jQuery("#aj_latest_please_wait").show(),aj_step(t)}}),jQuery(document).on("change","input[type=radio][name=aj_step4_check]",function(){var e=(jQuery("#aj_nonce").val(),jQuery(this).val());"y"==e?(jQuery("#aj_step4_y").show(),jQuery("#aj_step4_n").hide()):(jQuery("#aj_step4_n").show(),jQuery("#aj_step4_y").hide())}),jQuery(document).on("click",".aj_dismiss",function(){jQuery("#aj_nonce").val();jQuery("#aj_notification").fadeOut("slow")})});
1
+ function aj_step(e){var a=jQuery("#aj_nonce").val(),t=jQuery("#aj_gtmetrix_username").val(),s=jQuery("#aj_gtmetrix_api_key").val(),r=jQuery("#aj_gtmetrix_server").val();if("aj_step_results"==e){var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(!1!==(e=jQuery.parseJSON(e)).status){var a=e.baseline_pagespeed,t=e.baseline_yslow,s=e.results.pagespeed_score,r=e.results.yslow_score,_=e.name,i=parseFloat(e.results.fully_loaded_time/1e3).toFixed(2),j=e.url;jQuery(".aj_gtmetrix_config").html(_),s>a?jQuery("#aj_gtmetrix_inde_pagespeed").html("an increase"):s<a?jQuery("#aj_gtmetrix_inde_pagespeed").html("a decrease"):jQuery("#aj_gtmetrix_inde_pagespeed").html("no change"),r>t?jQuery("#aj_gtmetrix_inde_yslow").html("an increase"):r<t?jQuery("#aj_gtmetrix_inde_yslow").html("a decrease"):jQuery("#aj_gtmetrix_inde_yslow").html("no change"),jQuery("#aj_gtmetrix_baseline_pagespeed").html(a+"%"),jQuery("#aj_gtmetrix_best_pagespeed").html(s+"%"),jQuery("#aj_gtmetrix_baseline_yslow").html(t+"%"),jQuery("#aj_gtmetrix_best_yslow").html(r+"%"),jQuery("#aj_gtmetrix_best_fullyloaded").html(i+"s"),jQuery("#aj_gtmetrix_best_url").attr("href",j).html(j),"aj_step2b"==e.id||"aj_step2c"==e.id?(jQuery("#aj_step4_jquery_excluded").hide(),jQuery("#aj_step4_jquery_not_excluded").show()):"aj_step2d"!=e.id&&"aj_step2e"!=e.id||(jQuery("#aj_step4_jquery_excluded").show(),jQuery("#aj_step4_jquery_not_excluded").hide()),jQuery(".aj_gtmetrix_credits").html(e.credits),jQuery("#aj_step_results").show()}else console.log(e)}catch(e){console.log(e)}})}else{_={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(a){try{if(!1!==(a=jQuery.parseJSON(a)).status){var r=a.results.report_url+"/screenshot.jpg",_=a.results.pagespeed_score,i=a.results.yslow_score,j=parseFloat(a.results.fully_loaded_time/1e3).toFixed(2),l=Math.floor(a.results.page_bytes/1024);l>1024?l=l/1024+"MB":l+="KB";var o=a.results.page_elements,u=('<a href="'+a.results.report_url+'" target="_blank">'+a.results.report_url+"</a>").replace("https://","https://"+t+":"+s+"@"),n=a.name,y=a.url,p=255*(1-_/100),c=255*(1-i/100),d=_/100*255,m=i/100*255,Q="rgb("+Math.floor(p)+","+Math.floor(d)+",0 )",h="rgb("+Math.floor(c)+","+Math.floor(m)+",0 )";"aj_gtmetrix_test"==e&&(e="aj_latest"),jQuery("#"+e+"_please_wait").hide(),jQuery("."+e+"_screenshot").attr("src",r),jQuery("."+e+"_pagespeed").html(_+"%").css({color:Q}),jQuery("."+e+"_yslow").html(i+"%").css({color:h}),jQuery("."+e+"_flt").html(j+"s"),jQuery("."+e+"_tps").html(l),jQuery("."+e+"_requests").html(o),jQuery("."+e+"_report").html(u),jQuery("#"+e+"_gtmetrix_results").show(),jQuery("."+e+"_gtmetrix").html(n),jQuery("."+e+"_url").attr("href",y).html(y),jQuery(".aj_gtmetrix_credits").html(a.credits),"aj_step2"==e?(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_step2b").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2b").offset().top},1e3),aj_step("aj_step2b")):"aj_step2b"==e?(jQuery("#aj_step2c").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2c").offset().top},1e3),aj_step("aj_step2c")):"aj_step2c"==e?(jQuery("#aj_step2d").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2d").offset().top},1e3),aj_step("aj_step2d")):"aj_step2d"==e?(jQuery("#aj_step2e").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2e").offset().top},1e3),aj_step("aj_step2e")):"aj_step2e"==e?(jQuery("#aj_step_results").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step_results").offset().top},1e3),aj_step("aj_step_results")):"aj_latest"==e&&(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_latest_gtmetrix_results").show(),jQuery("#aj_latest_please_wait").hide(),jQuery("html, body").animate({scrollTop:jQuery("#aj_latest_please_wait").offset().top},1e3))}else console.log(a)}catch(e){console.log(e)}})}}jQuery(document).ready(function(){"function"==typeof jQuery(".aj_chosen").chosen&&jQuery(".aj_chosen").chosen(),jQuery(document).on("click",".aj-upgrade-notice .notice-dismiss",function(){var e=jQuery("#aj_nonce").val(),a=jQuery(".aj-upgrade-notice").attr("data-id");jQuery.ajax({url:aj.ajaxurl,data:{action:"async_javascript_dismiss_upgrade",notice_id:a,security:e}})}),jQuery(document).on("click",".aj_steps_button",function(e){e.preventDefault();var a=jQuery("#aj_nonce").val(),t=jQuery(this).attr("data-id");if("aj_goto_settings"==t){var s=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=s}else if("aj_apply_settings"==t||"aj_step2b_apply"==t||"aj_step2c_apply"==t||"aj_step2d_apply"==t||"aj_step2e_apply"==t){if("aj_apply_settings"!=t)var r=t.replace("_apply","");else{r="";jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>')}var _={action:"aj_steps",sub_action:"aj_apply_settings",settings:r,site_url:aj_localize_admin.siteurl,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(!1!==(e=jQuery.parseJSON(e)).status){if(jQuery("#aj_step4").length)jQuery("#aj_step5").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step5").offset().top},1e3),""!=r&&jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');else if(""!=r){jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');var a=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=a}}else console.log(e)}catch(e){console.log(e)}})}else if("aj_save_settings"==t){if(jQuery("#aj_enabled").is(":checked"))var i=1;else i=0;var j=jQuery("input[type=radio][name=aj_method]:checked").val(),l=jQuery("input[type=radio][name=aj_jquery]:checked").val(),o=jQuery("#aj_async").val(),u=jQuery("#aj_defer").val(),n=jQuery("#aj_exclusions").val();if("function"==typeof jQuery(".aj_chosen").chosen)var y=jQuery("#aj_plugin_exclusions").chosen().val(),p=jQuery("#aj_theme_exclusions").chosen().val();else y=jQuery("#aj_plugin_exclusions").val(),p=jQuery("#aj_theme_exclusions").val();if(jQuery("#aj_autoptimize_enabled").is(":visible"))if(jQuery("#aj_autoptimize_enabled").is(":checked"))var c=1,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else c=0,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else c=0,d="async";_={action:"aj_steps",sub_action:"aj_save_settings",aj_enabled:i,aj_method:j,aj_jquery:l,aj_async:o,aj_defer:u,aj_exclusions:n,aj_plugin_exclusions:y,aj_theme_exclusions:p,aj_autoptimize_enabled:c,aj_autoptimize_method:d,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{!1!==(e=jQuery.parseJSON(e)).status?jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'):console.log(e)}catch(e){console.log(e)}})}else{var m=jQuery("#aj_gtmetrix_username").val(),Q=jQuery("#aj_gtmetrix_api_key").val(),h=(jQuery("#aj_gtmetrix_server").val(),!1);if(""==m&&(jQuery("#aj_gtmetrix_username").addClass("aj_field_error"),h=!0),""==Q&&(jQuery("#aj_gtmetrix_api_key").addClass("aj_field_error"),h=!0),!1!==h)return!1;"aj_gtmetrix_test"!=t?(jQuery(this).hide(),jQuery("#"+t).show()):jQuery("#aj_latest_please_wait").show(),aj_step(t)}}),jQuery(document).on("change","input[type=radio][name=aj_step4_check]",function(){jQuery("#aj_nonce").val();"y"==jQuery(this).val()?(jQuery("#aj_step4_y").show(),jQuery("#aj_step4_n").hide()):(jQuery("#aj_step4_n").show(),jQuery("#aj_step4_y").hide())}),jQuery(document).on("click",".aj_dismiss",function(){jQuery("#aj_nonce").val();jQuery("#aj_notification").fadeOut("slow")})});
readme.txt CHANGED
@@ -2,13 +2,13 @@
2
  Contributors: (cloughit), optimizingmatters, futtta
3
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
4
  Tags: async, javascript, pagespeed, performance, render blocking
5
- Requires at least: 4.4
6
  Tested up to: 4.9
7
- Stable tag: 2.18.03.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Async Javascript gives you lets you add 'async' or 'defer' attribute to scripts to exclude to help increase the performance of your WordPress website.
12
 
13
  == Description ==
14
  Eliminate Render-blocking Javascript in above-the-fold content with Async Javascript.
@@ -61,6 +61,13 @@ Coming soon!
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
 
 
64
  = 2.18.03.10 =
65
 
66
  * ASync JS is now maintained by Frank Goossens (Optimizing Matters), thanks for the great job done David!
2
  Contributors: (cloughit), optimizingmatters, futtta
3
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
4
  Tags: async, javascript, pagespeed, performance, render blocking
5
+ Requires at least: 4.6
6
  Tested up to: 4.9
7
+ Stable tag: 2.18.03.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Async Javascript lets you add 'async' or 'defer' attribute to scripts to exclude to help increase the performance of your WordPress website.
12
 
13
  == Description ==
14
  Eliminate Render-blocking Javascript in above-the-fold content with Async Javascript.
61
 
62
  == Changelog ==
63
 
64
+ = 2.18.03.15 =
65
+
66
+ * bugfix: only load asyncjs' JS & CSS on own settings page [as reported by Marat Petrov](https://wordpress.org/support/topic/error-after-update-117/)
67
+ * bugfix: check if jQuery chosen is correctly loaded before using it (based on same report, thanks Marat!)
68
+ * update jQuery Chosen lib
69
+ * small readme tweaks
70
+
71
  = 2.18.03.10 =
72
 
73
  * ASync JS is now maintained by Frank Goossens (Optimizing Matters), thanks for the great job done David!