View | Details | Raw Unified | Return to bug 14458
Collapse All | Expand All

(-)a/api/v1/doc/css/reset.css (+125 lines)
Line 0 Link Here
1
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
2
html,
3
body,
4
div,
5
span,
6
applet,
7
object,
8
iframe,
9
h1,
10
h2,
11
h3,
12
h4,
13
h5,
14
h6,
15
p,
16
blockquote,
17
pre,
18
a,
19
abbr,
20
acronym,
21
address,
22
big,
23
cite,
24
code,
25
del,
26
dfn,
27
em,
28
img,
29
ins,
30
kbd,
31
q,
32
s,
33
samp,
34
small,
35
strike,
36
strong,
37
sub,
38
sup,
39
tt,
40
var,
41
b,
42
u,
43
i,
44
center,
45
dl,
46
dt,
47
dd,
48
ol,
49
ul,
50
li,
51
fieldset,
52
form,
53
label,
54
legend,
55
table,
56
caption,
57
tbody,
58
tfoot,
59
thead,
60
tr,
61
th,
62
td,
63
article,
64
aside,
65
canvas,
66
details,
67
embed,
68
figure,
69
figcaption,
70
footer,
71
header,
72
hgroup,
73
menu,
74
nav,
75
output,
76
ruby,
77
section,
78
summary,
79
time,
80
mark,
81
audio,
82
video {
83
  margin: 0;
84
  padding: 0;
85
  border: 0;
86
  font-size: 100%;
87
  font: inherit;
88
  vertical-align: baseline;
89
}
90
/* HTML5 display-role reset for older browsers */
91
article,
92
aside,
93
details,
94
figcaption,
95
figure,
96
footer,
97
header,
98
hgroup,
99
menu,
100
nav,
101
section {
102
  display: block;
103
}
104
body {
105
  line-height: 1;
106
}
107
ol,
108
ul {
109
  list-style: none;
110
}
111
blockquote,
112
q {
113
  quotes: none;
114
}
115
blockquote:before,
116
blockquote:after,
117
q:before,
118
q:after {
119
  content: '';
120
  content: none;
121
}
122
table {
123
  border-collapse: collapse;
124
  border-spacing: 0;
125
}
(-)a/api/v1/doc/css/screen.css (+1279 lines)
Line 0 Link Here
1
/* Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org> */
2
.swagger-section pre code {
3
  display: block;
4
  padding: 0.5em;
5
  background: #F0F0F0;
6
}
7
.swagger-section pre code,
8
.swagger-section pre .subst,
9
.swagger-section pre .tag .title,
10
.swagger-section pre .lisp .title,
11
.swagger-section pre .clojure .built_in,
12
.swagger-section pre .nginx .title {
13
  color: black;
14
}
15
.swagger-section pre .string,
16
.swagger-section pre .title,
17
.swagger-section pre .constant,
18
.swagger-section pre .parent,
19
.swagger-section pre .tag .value,
20
.swagger-section pre .rules .value,
21
.swagger-section pre .rules .value .number,
22
.swagger-section pre .preprocessor,
23
.swagger-section pre .ruby .symbol,
24
.swagger-section pre .ruby .symbol .string,
25
.swagger-section pre .aggregate,
26
.swagger-section pre .template_tag,
27
.swagger-section pre .django .variable,
28
.swagger-section pre .smalltalk .class,
29
.swagger-section pre .addition,
30
.swagger-section pre .flow,
31
.swagger-section pre .stream,
32
.swagger-section pre .bash .variable,
33
.swagger-section pre .apache .tag,
34
.swagger-section pre .apache .cbracket,
35
.swagger-section pre .tex .command,
36
.swagger-section pre .tex .special,
37
.swagger-section pre .erlang_repl .function_or_atom,
38
.swagger-section pre .markdown .header {
39
  color: #800;
40
}
41
.swagger-section pre .comment,
42
.swagger-section pre .annotation,
43
.swagger-section pre .template_comment,
44
.swagger-section pre .diff .header,
45
.swagger-section pre .chunk,
46
.swagger-section pre .markdown .blockquote {
47
  color: #888;
48
}
49
.swagger-section pre .number,
50
.swagger-section pre .date,
51
.swagger-section pre .regexp,
52
.swagger-section pre .literal,
53
.swagger-section pre .smalltalk .symbol,
54
.swagger-section pre .smalltalk .char,
55
.swagger-section pre .go .constant,
56
.swagger-section pre .change,
57
.swagger-section pre .markdown .bullet,
58
.swagger-section pre .markdown .link_url {
59
  color: #080;
60
}
61
.swagger-section pre .label,
62
.swagger-section pre .javadoc,
63
.swagger-section pre .ruby .string,
64
.swagger-section pre .decorator,
65
.swagger-section pre .filter .argument,
66
.swagger-section pre .localvars,
67
.swagger-section pre .array,
68
.swagger-section pre .attr_selector,
69
.swagger-section pre .important,
70
.swagger-section pre .pseudo,
71
.swagger-section pre .pi,
72
.swagger-section pre .doctype,
73
.swagger-section pre .deletion,
74
.swagger-section pre .envvar,
75
.swagger-section pre .shebang,
76
.swagger-section pre .apache .sqbracket,
77
.swagger-section pre .nginx .built_in,
78
.swagger-section pre .tex .formula,
79
.swagger-section pre .erlang_repl .reserved,
80
.swagger-section pre .prompt,
81
.swagger-section pre .markdown .link_label,
82
.swagger-section pre .vhdl .attribute,
83
.swagger-section pre .clojure .attribute,
84
.swagger-section pre .coffeescript .property {
85
  color: #8888ff;
86
}
87
.swagger-section pre .keyword,
88
.swagger-section pre .id,
89
.swagger-section pre .phpdoc,
90
.swagger-section pre .title,
91
.swagger-section pre .built_in,
92
.swagger-section pre .aggregate,
93
.swagger-section pre .css .tag,
94
.swagger-section pre .javadoctag,
95
.swagger-section pre .phpdoc,
96
.swagger-section pre .yardoctag,
97
.swagger-section pre .smalltalk .class,
98
.swagger-section pre .winutils,
99
.swagger-section pre .bash .variable,
100
.swagger-section pre .apache .tag,
101
.swagger-section pre .go .typename,
102
.swagger-section pre .tex .command,
103
.swagger-section pre .markdown .strong,
104
.swagger-section pre .request,
105
.swagger-section pre .status {
106
  font-weight: bold;
107
}
108
.swagger-section pre .markdown .emphasis {
109
  font-style: italic;
110
}
111
.swagger-section pre .nginx .built_in {
112
  font-weight: normal;
113
}
114
.swagger-section pre .coffeescript .javascript,
115
.swagger-section pre .javascript .xml,
116
.swagger-section pre .tex .formula,
117
.swagger-section pre .xml .javascript,
118
.swagger-section pre .xml .vbscript,
119
.swagger-section pre .xml .css,
120
.swagger-section pre .xml .cdata {
121
  opacity: 0.5;
122
}
123
.swagger-section .swagger-ui-wrap {
124
  line-height: 1;
125
  font-family: "Droid Sans", sans-serif;
126
  max-width: 960px;
127
  margin-left: auto;
128
  margin-right: auto;
129
}
130
.swagger-section .swagger-ui-wrap b,
131
.swagger-section .swagger-ui-wrap strong {
132
  font-family: "Droid Sans", sans-serif;
133
  font-weight: bold;
134
}
135
.swagger-section .swagger-ui-wrap q,
136
.swagger-section .swagger-ui-wrap blockquote {
137
  quotes: none;
138
}
139
.swagger-section .swagger-ui-wrap p {
140
  line-height: 1.4em;
141
  padding: 0 0 10px;
142
  color: #333333;
143
}
144
.swagger-section .swagger-ui-wrap q:before,
145
.swagger-section .swagger-ui-wrap q:after,
146
.swagger-section .swagger-ui-wrap blockquote:before,
147
.swagger-section .swagger-ui-wrap blockquote:after {
148
  content: none;
149
}
150
.swagger-section .swagger-ui-wrap .heading_with_menu h1,
151
.swagger-section .swagger-ui-wrap .heading_with_menu h2,
152
.swagger-section .swagger-ui-wrap .heading_with_menu h3,
153
.swagger-section .swagger-ui-wrap .heading_with_menu h4,
154
.swagger-section .swagger-ui-wrap .heading_with_menu h5,
155
.swagger-section .swagger-ui-wrap .heading_with_menu h6 {
156
  display: block;
157
  clear: none;
158
  float: left;
159
  -moz-box-sizing: border-box;
160
  -webkit-box-sizing: border-box;
161
  -ms-box-sizing: border-box;
162
  box-sizing: border-box;
163
  width: 60%;
164
}
165
.swagger-section .swagger-ui-wrap table {
166
  border-collapse: collapse;
167
  border-spacing: 0;
168
}
169
.swagger-section .swagger-ui-wrap table thead tr th {
170
  padding: 5px;
171
  font-size: 0.9em;
172
  color: #666666;
173
  border-bottom: 1px solid #999999;
174
}
175
.swagger-section .swagger-ui-wrap table tbody tr:last-child td {
176
  border-bottom: none;
177
}
178
.swagger-section .swagger-ui-wrap table tbody tr.offset {
179
  background-color: #f0f0f0;
180
}
181
.swagger-section .swagger-ui-wrap table tbody tr td {
182
  padding: 6px;
183
  font-size: 0.9em;
184
  border-bottom: 1px solid #cccccc;
185
  vertical-align: top;
186
  line-height: 1.3em;
187
}
188
.swagger-section .swagger-ui-wrap ol {
189
  margin: 0px 0 10px;
190
  padding: 0 0 0 18px;
191
  list-style-type: decimal;
192
}
193
.swagger-section .swagger-ui-wrap ol li {
194
  padding: 5px 0px;
195
  font-size: 0.9em;
196
  color: #333333;
197
}
198
.swagger-section .swagger-ui-wrap ol,
199
.swagger-section .swagger-ui-wrap ul {
200
  list-style: none;
201
}
202
.swagger-section .swagger-ui-wrap h1 a,
203
.swagger-section .swagger-ui-wrap h2 a,
204
.swagger-section .swagger-ui-wrap h3 a,
205
.swagger-section .swagger-ui-wrap h4 a,
206
.swagger-section .swagger-ui-wrap h5 a,
207
.swagger-section .swagger-ui-wrap h6 a {
208
  text-decoration: none;
209
}
210
.swagger-section .swagger-ui-wrap h1 a:hover,
211
.swagger-section .swagger-ui-wrap h2 a:hover,
212
.swagger-section .swagger-ui-wrap h3 a:hover,
213
.swagger-section .swagger-ui-wrap h4 a:hover,
214
.swagger-section .swagger-ui-wrap h5 a:hover,
215
.swagger-section .swagger-ui-wrap h6 a:hover {
216
  text-decoration: underline;
217
}
218
.swagger-section .swagger-ui-wrap h1 span.divider,
219
.swagger-section .swagger-ui-wrap h2 span.divider,
220
.swagger-section .swagger-ui-wrap h3 span.divider,
221
.swagger-section .swagger-ui-wrap h4 span.divider,
222
.swagger-section .swagger-ui-wrap h5 span.divider,
223
.swagger-section .swagger-ui-wrap h6 span.divider {
224
  color: #aaaaaa;
225
}
226
.swagger-section .swagger-ui-wrap a {
227
  color: #547f00;
228
}
229
.swagger-section .swagger-ui-wrap a img {
230
  border: none;
231
}
232
.swagger-section .swagger-ui-wrap article,
233
.swagger-section .swagger-ui-wrap aside,
234
.swagger-section .swagger-ui-wrap details,
235
.swagger-section .swagger-ui-wrap figcaption,
236
.swagger-section .swagger-ui-wrap figure,
237
.swagger-section .swagger-ui-wrap footer,
238
.swagger-section .swagger-ui-wrap header,
239
.swagger-section .swagger-ui-wrap hgroup,
240
.swagger-section .swagger-ui-wrap menu,
241
.swagger-section .swagger-ui-wrap nav,
242
.swagger-section .swagger-ui-wrap section,
243
.swagger-section .swagger-ui-wrap summary {
244
  display: block;
245
}
246
.swagger-section .swagger-ui-wrap pre {
247
  font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
248
  background-color: #fcf6db;
249
  border: 1px solid #e5e0c6;
250
  padding: 10px;
251
}
252
.swagger-section .swagger-ui-wrap pre code {
253
  line-height: 1.6em;
254
  background: none;
255
}
256
.swagger-section .swagger-ui-wrap .content > .content-type > div > label {
257
  clear: both;
258
  display: block;
259
  color: #0F6AB4;
260
  font-size: 1.1em;
261
  margin: 0;
262
  padding: 15px 0 5px;
263
}
264
.swagger-section .swagger-ui-wrap .content pre {
265
  font-size: 12px;
266
  margin-top: 5px;
267
  padding: 5px;
268
}
269
.swagger-section .swagger-ui-wrap .icon-btn {
270
  cursor: pointer;
271
}
272
.swagger-section .swagger-ui-wrap .info_title {
273
  padding-bottom: 10px;
274
  font-weight: bold;
275
  font-size: 25px;
276
}
277
.swagger-section .swagger-ui-wrap .footer {
278
  margin-top: 20px;
279
}
280
.swagger-section .swagger-ui-wrap p.big,
281
.swagger-section .swagger-ui-wrap div.big p {
282
  font-size: 1em;
283
  margin-bottom: 10px;
284
}
285
.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input,
286
.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input,
287
.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea,
288
.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input {
289
  width: 500px !important;
290
}
291
.swagger-section .swagger-ui-wrap .info_license {
292
  padding-bottom: 5px;
293
}
294
.swagger-section .swagger-ui-wrap .info_tos {
295
  padding-bottom: 5px;
296
}
297
.swagger-section .swagger-ui-wrap .message-fail {
298
  color: #cc0000;
299
}
300
.swagger-section .swagger-ui-wrap .info_url {
301
  padding-bottom: 5px;
302
}
303
.swagger-section .swagger-ui-wrap .info_email {
304
  padding-bottom: 5px;
305
}
306
.swagger-section .swagger-ui-wrap .info_name {
307
  padding-bottom: 5px;
308
}
309
.swagger-section .swagger-ui-wrap .info_description {
310
  padding-bottom: 10px;
311
  font-size: 15px;
312
}
313
.swagger-section .swagger-ui-wrap .markdown ol li,
314
.swagger-section .swagger-ui-wrap .markdown ul li {
315
  padding: 3px 0px;
316
  line-height: 1.4em;
317
  color: #333333;
318
}
319
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input,
320
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input,
321
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input {
322
  display: block;
323
  padding: 4px;
324
  width: auto;
325
  clear: both;
326
}
327
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title,
328
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title,
329
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title {
330
  font-size: 1.3em;
331
}
332
.swagger-section .swagger-ui-wrap table.fullwidth {
333
  width: 100%;
334
}
335
.swagger-section .swagger-ui-wrap .model-signature {
336
  font-family: "Droid Sans", sans-serif;
337
  font-size: 1em;
338
  line-height: 1.5em;
339
}
340
.swagger-section .swagger-ui-wrap .model-signature .signature-nav a {
341
  text-decoration: none;
342
  color: #AAA;
343
}
344
.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover {
345
  text-decoration: underline;
346
  color: black;
347
}
348
.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected {
349
  color: black;
350
  text-decoration: none;
351
}
352
.swagger-section .swagger-ui-wrap .model-signature .propType {
353
  color: #5555aa;
354
}
355
.swagger-section .swagger-ui-wrap .model-signature pre:hover {
356
  background-color: #ffffdd;
357
}
358
.swagger-section .swagger-ui-wrap .model-signature pre {
359
  font-size: .85em;
360
  line-height: 1.2em;
361
  overflow: auto;
362
  max-height: 200px;
363
  cursor: pointer;
364
}
365
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav {
366
  display: block;
367
  margin: 0;
368
  padding: 0;
369
}
370
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child {
371
  padding-right: 0;
372
  border-right: none;
373
}
374
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li {
375
  float: left;
376
  margin: 0 5px 5px 0;
377
  padding: 2px 5px 2px 0;
378
  border-right: 1px solid #ddd;
379
}
380
.swagger-section .swagger-ui-wrap .model-signature .propOpt {
381
  color: #555;
382
}
383
.swagger-section .swagger-ui-wrap .model-signature .snippet small {
384
  font-size: 0.75em;
385
}
386
.swagger-section .swagger-ui-wrap .model-signature .propOptKey {
387
  font-style: italic;
388
}
389
.swagger-section .swagger-ui-wrap .model-signature .description .strong {
390
  font-weight: bold;
391
  color: #000;
392
  font-size: .9em;
393
}
394
.swagger-section .swagger-ui-wrap .model-signature .description div {
395
  font-size: 0.9em;
396
  line-height: 1.5em;
397
  margin-left: 1em;
398
}
399
.swagger-section .swagger-ui-wrap .model-signature .description .stronger {
400
  font-weight: bold;
401
  color: #000;
402
}
403
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper {
404
  border-spacing: 0;
405
  position: absolute;
406
  background-color: #ffffff;
407
  border: 1px solid #bbbbbb;
408
  display: none;
409
  font-size: 11px;
410
  max-width: 400px;
411
  line-height: 30px;
412
  color: black;
413
  padding: 5px;
414
  margin-left: 10px;
415
}
416
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th {
417
  text-align: center;
418
  background-color: #eeeeee;
419
  border: 1px solid #bbbbbb;
420
  font-size: 11px;
421
  color: #666666;
422
  font-weight: bold;
423
  padding: 5px;
424
  line-height: 15px;
425
}
426
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName {
427
  font-weight: bold;
428
}
429
.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown > p:first-child,
430
.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown > p:last-child {
431
  display: inline;
432
}
433
.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown > p:not(:first-child):before {
434
  display: block;
435
  content: '';
436
}
437
.swagger-section .swagger-ui-wrap .model-signature .description span:last-of-type.propDesc.markdown > p:only-child {
438
  margin-right: -3px;
439
}
440
.swagger-section .swagger-ui-wrap .model-signature .propName {
441
  font-weight: bold;
442
}
443
.swagger-section .swagger-ui-wrap .model-signature .signature-container {
444
  clear: both;
445
}
446
.swagger-section .swagger-ui-wrap .body-textarea {
447
  width: 300px;
448
  height: 100px;
449
  border: 1px solid #aaa;
450
}
451
.swagger-section .swagger-ui-wrap .markdown p code,
452
.swagger-section .swagger-ui-wrap .markdown li code {
453
  font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
454
  background-color: #f0f0f0;
455
  color: black;
456
  padding: 1px 3px;
457
}
458
.swagger-section .swagger-ui-wrap .required {
459
  font-weight: bold;
460
}
461
.swagger-section .swagger-ui-wrap input.parameter {
462
  width: 300px;
463
  border: 1px solid #aaa;
464
}
465
.swagger-section .swagger-ui-wrap h1 {
466
  color: black;
467
  font-size: 1.5em;
468
  line-height: 1.3em;
469
  padding: 10px 0 10px 0;
470
  font-family: "Droid Sans", sans-serif;
471
  font-weight: bold;
472
}
473
.swagger-section .swagger-ui-wrap .heading_with_menu {
474
  float: none;
475
  clear: both;
476
  overflow: hidden;
477
  display: block;
478
}
479
.swagger-section .swagger-ui-wrap .heading_with_menu ul {
480
  display: block;
481
  clear: none;
482
  float: right;
483
  -moz-box-sizing: border-box;
484
  -webkit-box-sizing: border-box;
485
  -ms-box-sizing: border-box;
486
  box-sizing: border-box;
487
  margin-top: 10px;
488
}
489
.swagger-section .swagger-ui-wrap h2 {
490
  color: black;
491
  font-size: 1.3em;
492
  padding: 10px 0 10px 0;
493
}
494
.swagger-section .swagger-ui-wrap h2 a {
495
  color: black;
496
}
497
.swagger-section .swagger-ui-wrap h2 span.sub {
498
  font-size: 0.7em;
499
  color: #999999;
500
  font-style: italic;
501
}
502
.swagger-section .swagger-ui-wrap h2 span.sub a {
503
  color: #777777;
504
}
505
.swagger-section .swagger-ui-wrap span.weak {
506
  color: #666666;
507
}
508
.swagger-section .swagger-ui-wrap .message-success {
509
  color: #89BF04;
510
}
511
.swagger-section .swagger-ui-wrap caption,
512
.swagger-section .swagger-ui-wrap th,
513
.swagger-section .swagger-ui-wrap td {
514
  text-align: left;
515
  font-weight: normal;
516
  vertical-align: middle;
517
}
518
.swagger-section .swagger-ui-wrap .code {
519
  font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
520
}
521
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea {
522
  font-family: "Droid Sans", sans-serif;
523
  height: 250px;
524
  padding: 4px;
525
  display: block;
526
  clear: both;
527
}
528
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select {
529
  display: block;
530
  clear: both;
531
}
532
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean {
533
  float: none;
534
  clear: both;
535
  overflow: hidden;
536
  display: block;
537
}
538
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label {
539
  display: block;
540
  float: left;
541
  clear: none;
542
  margin: 0;
543
  padding: 0;
544
}
545
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input {
546
  display: block;
547
  float: left;
548
  clear: none;
549
  margin: 0 5px 0 0;
550
}
551
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label {
552
  color: black;
553
}
554
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label {
555
  display: block;
556
  clear: both;
557
  width: auto;
558
  padding: 0 0 3px;
559
  color: #666666;
560
}
561
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr {
562
  padding-left: 3px;
563
  color: #888888;
564
}
565
.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints {
566
  margin-left: 0;
567
  font-style: italic;
568
  font-size: 0.9em;
569
  margin: 0;
570
}
571
.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons {
572
  margin: 0;
573
  padding: 0;
574
}
575
.swagger-section .swagger-ui-wrap span.blank,
576
.swagger-section .swagger-ui-wrap span.empty {
577
  color: #888888;
578
  font-style: italic;
579
}
580
.swagger-section .swagger-ui-wrap .markdown h3 {
581
  color: #547f00;
582
}
583
.swagger-section .swagger-ui-wrap .markdown h4 {
584
  color: #666666;
585
}
586
.swagger-section .swagger-ui-wrap .markdown pre {
587
  font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
588
  background-color: #fcf6db;
589
  border: 1px solid #e5e0c6;
590
  padding: 10px;
591
  margin: 0 0 10px 0;
592
}
593
.swagger-section .swagger-ui-wrap .markdown pre code {
594
  line-height: 1.6em;
595
}
596
.swagger-section .swagger-ui-wrap div.gist {
597
  margin: 20px 0 25px 0 !important;
598
}
599
.swagger-section .swagger-ui-wrap ul#resources {
600
  font-family: "Droid Sans", sans-serif;
601
  font-size: 0.9em;
602
}
603
.swagger-section .swagger-ui-wrap ul#resources li.resource {
604
  border-bottom: 1px solid #dddddd;
605
}
606
.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a,
607
.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a {
608
  color: black;
609
}
610
.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a,
611
.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a {
612
  color: #555555;
613
}
614
.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child {
615
  border-bottom: none;
616
}
617
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading {
618
  border: 1px solid transparent;
619
  float: none;
620
  clear: both;
621
  overflow: hidden;
622
  display: block;
623
}
624
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options {
625
  overflow: hidden;
626
  padding: 0;
627
  display: block;
628
  clear: none;
629
  float: right;
630
  margin: 14px 10px 0 0;
631
}
632
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li {
633
  float: left;
634
  clear: none;
635
  margin: 0;
636
  padding: 2px 10px;
637
  border-right: 1px solid #dddddd;
638
  color: #666666;
639
  font-size: 0.9em;
640
}
641
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a {
642
  color: #aaaaaa;
643
  text-decoration: none;
644
}
645
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover {
646
  text-decoration: underline;
647
  color: black;
648
}
649
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover,
650
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active,
651
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active {
652
  text-decoration: underline;
653
}
654
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child,
655
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first {
656
  padding-left: 0;
657
}
658
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child,
659
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last {
660
  padding-right: 0;
661
  border-right: none;
662
}
663
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child,
664
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first {
665
  padding-left: 0;
666
}
667
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 {
668
  color: #999999;
669
  padding-left: 0;
670
  display: block;
671
  clear: none;
672
  float: left;
673
  font-family: "Droid Sans", sans-serif;
674
  font-weight: bold;
675
}
676
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a {
677
  color: #999999;
678
}
679
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover {
680
  color: black;
681
}
682
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation {
683
  float: none;
684
  clear: both;
685
  overflow: hidden;
686
  display: block;
687
  margin: 0 0 10px;
688
  padding: 0;
689
}
690
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading {
691
  float: none;
692
  clear: both;
693
  overflow: hidden;
694
  display: block;
695
  margin: 0;
696
  padding: 0;
697
}
698
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 {
699
  display: block;
700
  clear: none;
701
  float: left;
702
  width: auto;
703
  margin: 0;
704
  padding: 0;
705
  line-height: 1.1em;
706
  color: black;
707
}
708
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path {
709
  padding-left: 10px;
710
}
711
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a {
712
  color: black;
713
  text-decoration: none;
714
}
715
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover {
716
  text-decoration: underline;
717
}
718
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a {
719
  text-transform: uppercase;
720
  text-decoration: none;
721
  color: white;
722
  display: inline-block;
723
  width: 50px;
724
  font-size: 0.7em;
725
  text-align: center;
726
  padding: 7px 0 4px;
727
  -moz-border-radius: 2px;
728
  -webkit-border-radius: 2px;
729
  -o-border-radius: 2px;
730
  -ms-border-radius: 2px;
731
  -khtml-border-radius: 2px;
732
  border-radius: 2px;
733
}
734
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span {
735
  margin: 0;
736
  padding: 0;
737
}
738
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options {
739
  overflow: hidden;
740
  padding: 0;
741
  display: block;
742
  clear: none;
743
  float: right;
744
  margin: 6px 10px 0 0;
745
}
746
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li {
747
  float: left;
748
  clear: none;
749
  margin: 0;
750
  padding: 2px 10px;
751
  font-size: 0.9em;
752
}
753
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a {
754
  text-decoration: none;
755
}
756
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
757
  color: black;
758
}
759
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content {
760
  border-top: none;
761
  padding: 10px;
762
  -moz-border-radius-bottomleft: 6px;
763
  -webkit-border-bottom-left-radius: 6px;
764
  -o-border-bottom-left-radius: 6px;
765
  -ms-border-bottom-left-radius: 6px;
766
  -khtml-border-bottom-left-radius: 6px;
767
  border-bottom-left-radius: 6px;
768
  -moz-border-radius-bottomright: 6px;
769
  -webkit-border-bottom-right-radius: 6px;
770
  -o-border-bottom-right-radius: 6px;
771
  -ms-border-bottom-right-radius: 6px;
772
  -khtml-border-bottom-right-radius: 6px;
773
  border-bottom-right-radius: 6px;
774
  margin: 0 0 20px;
775
}
776
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4 {
777
  font-size: 1.1em;
778
  margin: 0;
779
  padding: 15px 0 5px;
780
}
781
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header {
782
  float: none;
783
  clear: both;
784
  overflow: hidden;
785
  display: block;
786
}
787
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a {
788
  padding: 4px 0 0 10px;
789
  display: inline-block;
790
  font-size: 0.9em;
791
}
792
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit {
793
  display: block;
794
  clear: none;
795
  float: left;
796
  padding: 6px 8px;
797
}
798
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber {
799
  background-image: url('../images/throbber.gif');
800
  width: 128px;
801
  height: 16px;
802
  display: block;
803
  clear: none;
804
  float: right;
805
}
806
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error {
807
  outline: 2px solid black;
808
  outline-color: #cc0000;
809
}
810
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre {
811
  font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
812
  padding: 10px;
813
  font-size: 0.9em;
814
  max-height: 400px;
815
  overflow-y: auto;
816
}
817
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading {
818
  background-color: #f9f2e9;
819
  border: 1px solid #f0e0ca;
820
}
821
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a {
822
  background-color: #c5862b;
823
}
824
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li {
825
  border-right: 1px solid #dddddd;
826
  border-right-color: #f0e0ca;
827
  color: #c5862b;
828
}
829
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a {
830
  color: #c5862b;
831
}
832
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content {
833
  background-color: #faf5ee;
834
  border: 1px solid #f0e0ca;
835
}
836
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4 {
837
  color: #c5862b;
838
}
839
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a {
840
  color: #dcb67f;
841
}
842
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading {
843
  background-color: #fcffcd;
844
  border: 1px solid black;
845
  border-color: #ffd20f;
846
}
847
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a {
848
  text-transform: uppercase;
849
  background-color: #ffd20f;
850
}
851
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li {
852
  border-right: 1px solid #dddddd;
853
  border-right-color: #ffd20f;
854
  color: #ffd20f;
855
}
856
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a {
857
  color: #ffd20f;
858
}
859
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content {
860
  background-color: #fcffcd;
861
  border: 1px solid black;
862
  border-color: #ffd20f;
863
}
864
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4 {
865
  color: #ffd20f;
866
}
867
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a {
868
  color: #6fc992;
869
}
870
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading {
871
  background-color: #f5e8e8;
872
  border: 1px solid #e8c6c7;
873
}
874
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a {
875
  text-transform: uppercase;
876
  background-color: #a41e22;
877
}
878
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li {
879
  border-right: 1px solid #dddddd;
880
  border-right-color: #e8c6c7;
881
  color: #a41e22;
882
}
883
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a {
884
  color: #a41e22;
885
}
886
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content {
887
  background-color: #f7eded;
888
  border: 1px solid #e8c6c7;
889
}
890
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4 {
891
  color: #a41e22;
892
}
893
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a {
894
  color: #c8787a;
895
}
896
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading {
897
  background-color: #e7f6ec;
898
  border: 1px solid #c3e8d1;
899
}
900
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a {
901
  background-color: #10a54a;
902
}
903
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li {
904
  border-right: 1px solid #dddddd;
905
  border-right-color: #c3e8d1;
906
  color: #10a54a;
907
}
908
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a {
909
  color: #10a54a;
910
}
911
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content {
912
  background-color: #ebf7f0;
913
  border: 1px solid #c3e8d1;
914
}
915
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4 {
916
  color: #10a54a;
917
}
918
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a {
919
  color: #6fc992;
920
}
921
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading {
922
  background-color: #FCE9E3;
923
  border: 1px solid #F5D5C3;
924
}
925
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a {
926
  background-color: #D38042;
927
}
928
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li {
929
  border-right: 1px solid #dddddd;
930
  border-right-color: #f0cecb;
931
  color: #D38042;
932
}
933
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a {
934
  color: #D38042;
935
}
936
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content {
937
  background-color: #faf0ef;
938
  border: 1px solid #f0cecb;
939
}
940
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4 {
941
  color: #D38042;
942
}
943
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a {
944
  color: #dcb67f;
945
}
946
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading {
947
  background-color: #e7f0f7;
948
  border: 1px solid #c3d9ec;
949
}
950
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a {
951
  background-color: #0f6ab4;
952
}
953
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li {
954
  border-right: 1px solid #dddddd;
955
  border-right-color: #c3d9ec;
956
  color: #0f6ab4;
957
}
958
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a {
959
  color: #0f6ab4;
960
}
961
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content {
962
  background-color: #ebf3f9;
963
  border: 1px solid #c3d9ec;
964
}
965
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4 {
966
  color: #0f6ab4;
967
}
968
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a {
969
  color: #6fa5d2;
970
}
971
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading {
972
  background-color: #e7f0f7;
973
  border: 1px solid #c3d9ec;
974
}
975
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a {
976
  background-color: #0f6ab4;
977
}
978
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li {
979
  border-right: 1px solid #dddddd;
980
  border-right-color: #c3d9ec;
981
  color: #0f6ab4;
982
}
983
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a {
984
  color: #0f6ab4;
985
}
986
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content {
987
  background-color: #ebf3f9;
988
  border: 1px solid #c3d9ec;
989
}
990
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4 {
991
  color: #0f6ab4;
992
}
993
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a {
994
  color: #6fa5d2;
995
}
996
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content,
997
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content,
998
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content,
999
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content,
1000
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content,
1001
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content {
1002
  border-top: none;
1003
}
1004
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child,
1005
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child,
1006
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child,
1007
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child,
1008
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child,
1009
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child,
1010
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last,
1011
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last,
1012
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last,
1013
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last,
1014
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last,
1015
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last {
1016
  padding-right: 0;
1017
  border-right: none;
1018
}
1019
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover,
1020
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,
1021
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active {
1022
  text-decoration: underline;
1023
}
1024
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child,
1025
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first {
1026
  padding-left: 0;
1027
}
1028
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child,
1029
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first {
1030
  padding-left: 0;
1031
}
1032
.swagger-section .swagger-ui-wrap p#colophon {
1033
  margin: 0 15px 40px 15px;
1034
  padding: 10px 0;
1035
  font-size: 0.8em;
1036
  border-top: 1px solid #dddddd;
1037
  font-family: "Droid Sans", sans-serif;
1038
  color: #999999;
1039
  font-style: italic;
1040
}
1041
.swagger-section .swagger-ui-wrap p#colophon a {
1042
  text-decoration: none;
1043
  color: #547f00;
1044
}
1045
.swagger-section .swagger-ui-wrap h3 {
1046
  color: black;
1047
  font-size: 1.1em;
1048
  padding: 10px 0 10px 0;
1049
}
1050
.swagger-section .swagger-ui-wrap .markdown ol,
1051
.swagger-section .swagger-ui-wrap .markdown ul {
1052
  font-family: "Droid Sans", sans-serif;
1053
  margin: 5px 0 10px;
1054
  padding: 0 0 0 18px;
1055
  list-style-type: disc;
1056
}
1057
.swagger-section .swagger-ui-wrap form.form_box {
1058
  background-color: #ebf3f9;
1059
  border: 1px solid #c3d9ec;
1060
  padding: 10px;
1061
}
1062
.swagger-section .swagger-ui-wrap form.form_box label {
1063
  color: #0f6ab4 !important;
1064
}
1065
.swagger-section .swagger-ui-wrap form.form_box input[type=submit] {
1066
  display: block;
1067
  padding: 10px;
1068
}
1069
.swagger-section .swagger-ui-wrap form.form_box p.weak {
1070
  font-size: 0.8em;
1071
}
1072
.swagger-section .swagger-ui-wrap form.form_box p {
1073
  font-size: 0.9em;
1074
  padding: 0 0 15px;
1075
  color: #7e7b6d;
1076
}
1077
.swagger-section .swagger-ui-wrap form.form_box p a {
1078
  color: #646257;
1079
}
1080
.swagger-section .swagger-ui-wrap form.form_box p strong {
1081
  color: black;
1082
}
1083
.swagger-section .swagger-ui-wrap .operation-status td.markdown > p:last-child {
1084
  padding-bottom: 0;
1085
}
1086
.swagger-section .title {
1087
  font-style: bold;
1088
}
1089
.swagger-section .secondary_form {
1090
  display: none;
1091
}
1092
.swagger-section .main_image {
1093
  display: block;
1094
  margin-left: auto;
1095
  margin-right: auto;
1096
}
1097
.swagger-section .oauth_body {
1098
  margin-left: 100px;
1099
  margin-right: 100px;
1100
}
1101
.swagger-section .oauth_submit {
1102
  text-align: center;
1103
}
1104
.swagger-section .api-popup-dialog {
1105
  z-index: 10000;
1106
  position: absolute;
1107
  width: 500px;
1108
  background: #FFF;
1109
  padding: 20px;
1110
  border: 1px solid #ccc;
1111
  border-radius: 5px;
1112
  display: none;
1113
  font-size: 13px;
1114
  color: #777;
1115
}
1116
.swagger-section .api-popup-dialog .api-popup-title {
1117
  font-size: 24px;
1118
  padding: 10px 0;
1119
}
1120
.swagger-section .api-popup-dialog .api-popup-title {
1121
  font-size: 24px;
1122
  padding: 10px 0;
1123
}
1124
.swagger-section .api-popup-dialog p.error-msg {
1125
  padding-left: 5px;
1126
  padding-bottom: 5px;
1127
}
1128
.swagger-section .api-popup-dialog button.api-popup-authbtn {
1129
  height: 30px;
1130
}
1131
.swagger-section .api-popup-dialog button.api-popup-cancel {
1132
  height: 30px;
1133
}
1134
.swagger-section .api-popup-scopes {
1135
  padding: 10px 20px;
1136
}
1137
.swagger-section .api-popup-scopes li {
1138
  padding: 5px 0;
1139
  line-height: 20px;
1140
}
1141
.swagger-section .api-popup-scopes .api-scope-desc {
1142
  padding-left: 20px;
1143
  font-style: italic;
1144
}
1145
.swagger-section .api-popup-scopes li input {
1146
  position: relative;
1147
  top: 2px;
1148
}
1149
.swagger-section .api-popup-actions {
1150
  padding-top: 10px;
1151
}
1152
.swagger-section .access {
1153
  float: right;
1154
}
1155
.swagger-section .auth {
1156
  float: right;
1157
}
1158
.swagger-section .api-ic {
1159
  height: 18px;
1160
  vertical-align: middle;
1161
  display: inline-block;
1162
  background: url(../images/explorer_icons.png) no-repeat;
1163
}
1164
.swagger-section .api-ic .api_information_panel {
1165
  position: relative;
1166
  margin-top: 20px;
1167
  margin-left: -5px;
1168
  background: #FFF;
1169
  border: 1px solid #ccc;
1170
  border-radius: 5px;
1171
  display: none;
1172
  font-size: 13px;
1173
  max-width: 300px;
1174
  line-height: 30px;
1175
  color: black;
1176
  padding: 5px;
1177
}
1178
.swagger-section .api-ic .api_information_panel p .api-msg-enabled {
1179
  color: green;
1180
}
1181
.swagger-section .api-ic .api_information_panel p .api-msg-disabled {
1182
  color: red;
1183
}
1184
.swagger-section .api-ic:hover .api_information_panel {
1185
  position: absolute;
1186
  display: block;
1187
}
1188
.swagger-section .ic-info {
1189
  background-position: 0 0;
1190
  width: 18px;
1191
  margin-top: -6px;
1192
  margin-left: 4px;
1193
}
1194
.swagger-section .ic-warning {
1195
  background-position: -60px 0;
1196
  width: 18px;
1197
  margin-top: -6px;
1198
  margin-left: 4px;
1199
}
1200
.swagger-section .ic-error {
1201
  background-position: -30px 0;
1202
  width: 18px;
1203
  margin-top: -6px;
1204
  margin-left: 4px;
1205
}
1206
.swagger-section .ic-off {
1207
  background-position: -90px 0;
1208
  width: 58px;
1209
  margin-top: -4px;
1210
  cursor: pointer;
1211
}
1212
.swagger-section .ic-on {
1213
  background-position: -160px 0;
1214
  width: 58px;
1215
  margin-top: -4px;
1216
  cursor: pointer;
1217
}
1218
.swagger-section #header {
1219
  background-color: #89bf04;
1220
  padding: 14px;
1221
}
1222
.swagger-section #header a#logo {
1223
  font-size: 1.5em;
1224
  font-weight: bold;
1225
  text-decoration: none;
1226
  background: transparent url(../images/logo_small.png) no-repeat left center;
1227
  padding: 20px 0 20px 40px;
1228
  color: white;
1229
}
1230
.swagger-section #header form#api_selector {
1231
  display: block;
1232
  clear: none;
1233
  float: right;
1234
}
1235
.swagger-section #header form#api_selector .input {
1236
  display: block;
1237
  clear: none;
1238
  float: left;
1239
  margin: 0 10px 0 0;
1240
}
1241
.swagger-section #header form#api_selector .input input#input_apiKey {
1242
  width: 200px;
1243
}
1244
.swagger-section #header form#api_selector .input input#input_baseUrl {
1245
  width: 400px;
1246
}
1247
.swagger-section #header form#api_selector .input a#explore {
1248
  display: block;
1249
  text-decoration: none;
1250
  font-weight: bold;
1251
  padding: 6px 8px;
1252
  font-size: 0.9em;
1253
  color: white;
1254
  background-color: #547f00;
1255
  -moz-border-radius: 4px;
1256
  -webkit-border-radius: 4px;
1257
  -o-border-radius: 4px;
1258
  -ms-border-radius: 4px;
1259
  -khtml-border-radius: 4px;
1260
  border-radius: 4px;
1261
}
1262
.swagger-section #header form#api_selector .input a#explore:hover {
1263
  background-color: #547f00;
1264
}
1265
.swagger-section #header form#api_selector .input input {
1266
  font-size: 0.9em;
1267
  padding: 3px;
1268
  margin: 0;
1269
}
1270
.swagger-section #content_message {
1271
  margin: 10px 15px;
1272
  font-style: italic;
1273
  color: #999999;
1274
}
1275
.swagger-section #message-bar {
1276
  min-height: 30px;
1277
  text-align: center;
1278
  padding-top: 10px;
1279
}
(-)a/api/v1/doc/css/typography.css (+26 lines)
Line 0 Link Here
1
/* droid-sans-regular - latin */
2
@font-face {
3
  font-family: 'Droid Sans';
4
  font-style: normal;
5
  font-weight: 400;
6
  src: url('../fonts/droid-sans-v6-latin-regular.eot'); /* IE9 Compat Modes */
7
  src: local('Droid Sans'), local('DroidSans'),
8
       url('../fonts/droid-sans-v6-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
9
       url('../fonts/droid-sans-v6-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
10
       url('../fonts/droid-sans-v6-latin-regular.woff') format('woff'), /* Modern Browsers */
11
       url('../fonts/droid-sans-v6-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
12
       url('../fonts/droid-sans-v6-latin-regular.svg#DroidSans') format('svg'); /* Legacy iOS */
13
}
14
/* droid-sans-700 - latin */
15
@font-face {
16
  font-family: 'Droid Sans';
17
  font-style: normal;
18
  font-weight: 700;
19
  src: url('../fonts/droid-sans-v6-latin-700.eot'); /* IE9 Compat Modes */
20
  src: local('Droid Sans Bold'), local('DroidSans-Bold'),
21
       url('../fonts/droid-sans-v6-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
22
       url('../fonts/droid-sans-v6-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
23
       url('../fonts/droid-sans-v6-latin-700.woff') format('woff'), /* Modern Browsers */
24
       url('../fonts/droid-sans-v6-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
25
       url('../fonts/droid-sans-v6-latin-700.svg#DroidSans') format('svg'); /* Legacy iOS */
26
}
(-)a/api/v1/doc/fonts/droid-sans-v6-latin-700.svg (+411 lines)
Line 0 Link Here
1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
<svg xmlns="http://www.w3.org/2000/svg">
4
<defs >
5
<font id="DroidSans" horiz-adv-x="1123" ><font-face
6
    font-family="Droid Sans"
7
    units-per-em="2048"
8
    panose-1="2 11 8 6 3 8 4 2 2 4"
9
    ascent="1907"
10
    descent="-492"
11
    alphabetic="0" />
12
<glyph unicode=" " glyph-name="space" horiz-adv-x="532" />
13
<glyph unicode="!" glyph-name="exclam" horiz-adv-x="586" d="M416 485H172L121 1462H467L416 485ZM117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131
14
66T117 143Z" />
15
<glyph unicode="&quot;" glyph-name="quotedbl" horiz-adv-x="967" d="M412 1462L371 934H174L133 1462H412ZM834 1462L793 934H596L555 1462H834Z" />
16
<glyph unicode="#" glyph-name="numbersign" horiz-adv-x="1323" d="M999 844L952 612H1210V406H913L836 0H616L694 406H500L424 0H209L283 406H45V612H322L369 844H117V1053H406L483 1460H702L625 1053H823L901 1460H1116L1038 1053H1278V844H999ZM539 612H735L782
17
844H586L539 612Z" />
18
<glyph unicode="$" glyph-name="dollar" horiz-adv-x="1128" d="M1061 457Q1061 382 1035 318T956 206T825 127T645 86V-119H508V82Q442 84 386 90T281 107T188 133T100 168V432Q142 411 191 392T294 358T401 331T508 317V635Q500 638 491 642Q483 645 475 648T461
19
653Q370 688 302 726T189 811T121 915T98 1044Q98 1119 126 1180T208 1287T337 1361T508 1399V1556H645V1405Q732 1400 823 1380T1014 1317L913 1083Q848 1109 778 1129T645 1155V862L684 848Q779 813 850 776T968 693T1038 590T1061 457ZM760 451Q760 475 754
20
493T733 526T698 553T645 580V328Q704 337 732 367T760 451ZM399 1051Q399 1004 425 973T508 920V1153Q454 1147 427 1123T399 1051Z" />
21
<glyph unicode="%" glyph-name="percent" horiz-adv-x="1804" d="M315 1024Q315 897 337 835T410 772Q459 772 482 834T506 1024Q506 1274 410 1274Q360 1274 338 1213T315 1024ZM758 1026Q758 918 738 832T674 687T565 597T408 565Q323 565 259 596T151 687T85
22
832T63 1026Q63 1134 83 1219T145 1362T253 1452T408 1483Q494 1483 559 1452T669 1363T735 1219T758 1026ZM1425 1462L614 0H375L1186 1462H1425ZM1298 440Q1298 313 1320 251T1393 188Q1442 188 1465 250T1489 440Q1489 690 1393 690Q1343 690 1321 629T1298
23
440ZM1741 442Q1741 334 1721 249T1657 104T1548 14T1391 -18Q1306 -18 1242 13T1135 104T1069 248T1047 442Q1047 550 1067 635T1129 778T1236 868T1391 899Q1477 899 1542 868T1652 779T1718 635T1741 442Z" />
24
<glyph unicode="&amp;" glyph-name="ampersand" horiz-adv-x="1479" d="M1475 0H1098L1001 100Q921 45 825 13T612 -20Q492 -20 395 10T228 94T120 225T82 395Q82 472 100 532T153 642T235 731T344 807Q306 853 280 895T237 979T214 1062T207 1149Q207 1227 237
25
1288T322 1393T452 1460T618 1483Q704 1483 776 1462T901 1401T984 1301T1014 1165Q1014 1096 992 1039T931 932T842 842T731 766L991 498Q1026 564 1052 637T1098 784H1415Q1400 727 1380 664T1332 538T1270 411T1192 291L1475 0ZM403 424Q403 380 419 345T463
26
286T530 249T614 236Q674 236 725 251T819 295L510 625Q459 583 431 535T403 424ZM731 1124Q731 1155 721 1176T695 1212T658 1232T616 1239Q594 1239 572 1233T531 1214T501 1178T489 1122Q489 1070 512 1024T575 932Q652 976 691 1020T731 1124Z" />
27
<glyph unicode="&apos;" glyph-name="quotesingle" horiz-adv-x="545" d="M412 1462L371 934H174L133 1462H412Z" />
28
<glyph unicode="(" glyph-name="parenleft" horiz-adv-x="694" d="M82 561Q82 686 100 807T155 1043T248 1263T383 1462H633Q492 1269 420 1038T348 563Q348 444 366 326T420 95T509 -124T631 -324H383Q305 -234 249 -131T155 84T100 317T82 561Z" />
29
<glyph unicode=")" glyph-name="parenright" horiz-adv-x="694" d="M612 561Q612 437 594 317T539 85T446 -131T311 -324H63Q132 -230 185 -124T274 95T328 326T346 563Q346 807 274 1038T61 1462H311Q389 1369 445 1264T539 1044T594 808T612 561Z" />
30
<glyph unicode="*" glyph-name="asterisk" horiz-adv-x="1116" d="M688 1556L647 1188L1020 1292L1053 1040L713 1016L936 719L709 598L553 911L416 600L180 719L401 1016L63 1042L102 1292L467 1188L426 1556H688Z" />
31
<glyph unicode="+" glyph-name="plus" horiz-adv-x="1128" d="M455 612H88V831H455V1200H674V831H1040V612H674V248H455V612Z" />
32
<glyph unicode="," glyph-name="comma" horiz-adv-x="594" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215Z" />
33
<glyph unicode="-" glyph-name="hyphen" horiz-adv-x="659" d="M61 424V674H598V424H61Z" />
34
<glyph unicode="." glyph-name="period" horiz-adv-x="584" d="M117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131 66T117 143Z" />
35
<glyph unicode="/" glyph-name="slash" horiz-adv-x="846" d="M836 1462L291 0H14L559 1462H836Z" />
36
<glyph unicode="0" glyph-name="zero" horiz-adv-x="1128" d="M1065 731Q1065 554 1038 415T950 179T794 31T563 -20Q436 -20 342 31T186 179T94 415T63 731Q63 908 90 1048T178 1285T333 1433T563 1485Q689 1485 783 1434T940 1286T1034 1049T1065 731ZM371 731Q371
37
481 414 355T563 229Q667 229 712 354T758 731Q758 982 713 1108T563 1235Q510 1235 474 1203T414 1108T381 951T371 731Z" />
38
<glyph unicode="1" glyph-name="one" horiz-adv-x="1128" d="M817 0H508V846Q508 872 508 908T510 984T513 1064T516 1137Q511 1131 499 1119T472 1093T441 1063T410 1036L242 901L92 1087L563 1462H817V0Z" />
39
<glyph unicode="2" glyph-name="two" horiz-adv-x="1128" d="M1063 0H82V215L426 586Q491 656 544 715T635 830T694 944T715 1069Q715 1143 671 1184T551 1225Q472 1225 399 1186T246 1075L78 1274Q123 1315 172 1352T280 1419T410 1465T569 1483Q674 1483 757
40
1454T900 1372T990 1242T1022 1071Q1022 985 992 907T910 753T790 603T643 451L467 274V260H1063V0Z" />
41
<glyph unicode="3" glyph-name="three" horiz-adv-x="1128" d="M1006 1135Q1006 1059 982 999T915 893T815 817T690 770V764Q867 742 958 657T1049 426Q1049 330 1015 249T909 107T729 14T473 -20Q355 -20 251 -1T57 59V322Q102 298 152 280T252 250T350 231T442
42
225Q528 225 585 241T676 286T724 355T739 444Q739 489 721 525T661 587T552 627T387 641H283V858H385Q477 858 538 874T635 919T687 986T702 1067Q702 1145 654 1189T500 1233Q452 1233 411 1224T334 1200T269 1168T215 1133L59 1339Q101 1370 150 1396T258 1441T383
43
1472T526 1483Q634 1483 722 1460T874 1392T971 1283T1006 1135Z" />
44
<glyph unicode="4" glyph-name="four" horiz-adv-x="1128" d="M1085 303H909V0H608V303H4V518L625 1462H909V543H1085V303ZM608 543V791Q608 804 608 828T610 884T612 948T615 1011T618 1063T621 1096H612Q594 1054 572 1007T520 913L276 543H608Z" />
45
<glyph unicode="5" glyph-name="five" horiz-adv-x="1128" d="M598 934Q692 934 773 905T914 820T1008 681T1042 489Q1042 370 1005 276T896 116T718 15T473 -20Q418 -20 364 -15T261 -1T167 24T86 59V326Q121 306 167 289T262 259T362 239T457 231Q591 231 661
46
286T731 463Q731 571 663 627T451 684Q425 684 396 681T338 673T283 663T238 651L115 717L170 1462H942V1200H438L414 913Q446 920 488 927T598 934Z" />
47
<glyph unicode="6" glyph-name="six" horiz-adv-x="1128" d="M76 621Q76 726 87 830T128 1029T208 1207T336 1349T522 1444T776 1479Q797 1479 822 1478T872 1476T922 1471T965 1464V1217Q927 1226 885 1231T799 1237Q664 1237 577 1204T439 1110T367 966T340
48
780H352Q372 816 400 847T467 901T552 937T659 950Q754 950 830 919T958 829T1039 684T1067 487Q1067 368 1034 274T938 115T788 15T590 -20Q482 -20 388 18T225 136T116 335T76 621ZM584 227Q625 227 658 242T716 289T754 369T768 483Q768 590 724 651T588 713Q542
49
713 504 695T439 648T398 583T383 510Q383 459 395 409T433 318T496 252T584 227Z" />
50
<glyph unicode="7" glyph-name="seven" horiz-adv-x="1128" d="M207 0L727 1200H55V1460H1063V1266L530 0H207Z" />
51
<glyph unicode="8" glyph-name="eight" horiz-adv-x="1128" d="M565 1481Q656 1481 737 1459T879 1393T976 1283T1012 1128Q1012 1062 992 1009T937 912T854 834T750 772Q808 741 863 703T962 618T1031 511T1057 379Q1057 288 1021 214T920 88T765 8T565 -20Q447
52
-20 355 7T200 84T105 207T72 371Q72 446 94 506T154 614T243 699T352 764Q303 795 260 831T186 912T136 1011T117 1130Q117 1217 153 1282T252 1392T395 1459T565 1481ZM358 389Q358 349 371 316T409 258T473 221T561 207Q666 207 718 256T770 387Q770 429 753
53
462T708 524T645 577T575 623L553 637Q509 615 473 590T412 534T372 467T358 389ZM563 1255Q530 1255 502 1245T453 1216T420 1169T408 1106Q408 1064 420 1034T454 980T504 938T565 901Q596 917 624 936T673 979T708 1035T721 1106Q721 1141 709 1169T676 1216T626
54
1245T563 1255Z" />
55
<glyph unicode="9" glyph-name="nine" horiz-adv-x="1128" d="M1055 838Q1055 733 1044 629T1003 429T923 252T795 109T609 15T354 -20Q333 -20 308 -19T258 -17T208 -13T166 -6V242Q203 232 245 227T332 221Q467 221 554 254T692 348T764 493T791 678H778Q758
56
642 730 611T664 557T578 521T471 508Q376 508 300 539T172 629T91 774T63 971Q63 1090 96 1184T192 1343T342 1444T541 1479Q649 1479 743 1441T906 1323T1015 1123T1055 838ZM547 1231Q506 1231 472 1216T414 1170T376 1090T362 975Q362 869 407 807T543 745Q589
57
745 627 763T692 810T733 875T748 948Q748 999 736 1049T698 1140T635 1206T547 1231Z" />
58
<glyph unicode=":" glyph-name="colon" horiz-adv-x="584" d="M117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131 66T117 143ZM117 969Q117 1016
59
130 1048T168 1101T224 1130T293 1139Q328 1139 359 1130T415 1101T453 1049T467 969Q467 924 453 892T415 839T360 809T293 799Q256 799 224 808T168 838T131 891T117 969Z" />
60
<glyph unicode=";" glyph-name="semicolon" horiz-adv-x="594" d="M444 238L459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444ZM117 969Q117 1016 130 1048T168 1101T224 1130T293 1139Q328 1139 359 1130T415
61
1101T453 1049T467 969Q467 924 453 892T415 839T360 809T293 799Q256 799 224 808T168 838T131 891T117 969Z" />
62
<glyph unicode="&lt;" glyph-name="less" horiz-adv-x="1128" d="M1040 203L88 641V784L1040 1280V1040L397 723L1040 442V203Z" />
63
<glyph unicode="=" glyph-name="equal" horiz-adv-x="1128" d="M88 807V1024H1040V807H88ZM88 418V637H1040V418H88Z" />
64
<glyph unicode="&gt;" glyph-name="greater" horiz-adv-x="1128" d="M88 442L731 723L88 1040V1280L1040 784V641L88 203V442Z" />
65
<glyph unicode="?" glyph-name="question" horiz-adv-x="940" d="M264 485V559Q264 610 274 651T306 730T362 803T444 877Q486 910 515 936T562 987T588 1041T596 1106Q596 1163 558 1200T440 1237Q371 1237 292 1208T127 1137L25 1358Q68 1383 118 1405T223 1445T334
66
1473T444 1483Q546 1483 628 1459T767 1387T854 1273T885 1120Q885 1057 871 1008T830 916T761 834T664 750Q622 717 596 693T554 646T534 601T528 545V485H264ZM231 143Q231 190 244 222T282 275T338 304T408 313Q443 313 474 304T530 275T568 223T582 143Q582
67
98 568 66T530 13T475 -17T408 -27Q371 -27 339 -18T282 13T245 66T231 143Z" />
68
<glyph unicode="@" glyph-name="at" horiz-adv-x="1774" d="M1673 752Q1673 657 1651 564T1582 398T1467 279T1303 233Q1265 233 1232 242T1170 269T1122 310T1090 362H1075Q1056 337 1031 314T975 272T907 244T825 233Q742 233 678 261T569 342T502 468T479 631Q479
69
734 510 820T599 968T740 1065T926 1100Q971 1100 1019 1095T1111 1082T1195 1064T1262 1044L1241 625Q1239 603 1239 582T1239 555Q1239 513 1245 486T1262 444T1286 422T1315 416Q1350 416 1376 443T1419 516T1445 623T1454 754Q1454 882 1416 982T1311 1151T1150
70
1256T948 1292Q795 1292 679 1241T484 1099T365 882T324 608Q324 470 359 364T463 185T633 75T866 37Q922 37 981 44T1098 63T1213 92T1321 129V-63Q1227 -105 1113 -129T868 -154Q687 -154 545 -103T304 46T154 283T102 602Q102 726 129 839T207 1050T331 1227T499
71
1363T706 1450T948 1481Q1106 1481 1239 1431T1468 1286T1619 1056T1673 752ZM711 627Q711 515 749 466T850 416Q892 416 922 435T972 490T1002 575T1016 686L1028 907Q1008 912 981 915T926 918Q867 918 826 893T760 827T723 734T711 627Z" />
72
<glyph unicode="A" glyph-name="A" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489 608H846Z" />
73
<glyph unicode="B" glyph-name="B" horiz-adv-x="1315" d="M184 1462H612Q750 1462 854 1443T1028 1380T1133 1266T1169 1092Q1169 1030 1154 976T1110 881T1040 813T944 776V766Q999 754 1046 732T1129 670T1185 570T1206 424Q1206 324 1171 246T1071 113T912
74
29T700 0H184V1462ZM494 883H655Q713 883 752 893T815 925T849 977T860 1051Q860 1135 808 1171T641 1208H494V883ZM494 637V256H676Q737 256 778 270T845 310T882 373T893 455Q893 496 882 529T845 587T775 624T668 637H494Z" />
75
<glyph unicode="C" glyph-name="C" horiz-adv-x="1305" d="M805 1225Q716 1225 648 1191T533 1092T462 935T438 727Q438 610 459 519T525 366T639 271T805 238Q894 238 983 258T1178 315V55Q1130 35 1083 21T987 -2T887 -15T776 -20Q607 -20 483 34T278 186T158
76
422T119 729Q119 895 164 1033T296 1272T511 1427T805 1483Q914 1483 1023 1456T1233 1380L1133 1128Q1051 1167 968 1196T805 1225Z" />
77
<glyph unicode="D" glyph-name="D" horiz-adv-x="1434" d="M1315 745Q1315 560 1265 421T1119 188T885 47T569 0H184V1462H612Q773 1462 902 1416T1124 1280T1265 1055T1315 745ZM1001 737Q1001 859 977 947T906 1094T792 1180T637 1208H494V256H608Q804 256 902
78
376T1001 737Z" />
79
<glyph unicode="E" glyph-name="E" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0Z" />
80
<glyph unicode="F" glyph-name="F" horiz-adv-x="1124" d="M489 0H184V1462H1022V1208H489V831H985V578H489V0Z" />
81
<glyph unicode="G" glyph-name="G" horiz-adv-x="1483" d="M739 821H1319V63Q1261 44 1202 29T1080 3T947 -14T799 -20Q635 -20 509 28T296 172T164 408T119 733Q119 905 169 1044T316 1280T556 1430T883 1483Q1000 1483 1112 1458T1317 1393L1214 1145Q1146 1179
82
1061 1202T881 1225Q779 1225 698 1190T558 1089T469 932T438 727Q438 619 459 530T527 375T645 274T819 238Q885 238 930 244T1016 258V563H739V821Z" />
83
<glyph unicode="H" glyph-name="H" horiz-adv-x="1485" d="M1300 0H991V631H494V0H184V1462H494V889H991V1462H1300V0Z" />
84
<glyph unicode="I" glyph-name="I" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0Z" />
85
<glyph unicode="J" glyph-name="J" horiz-adv-x="678" d="M-2 -430Q-67 -430 -116 -424T-199 -408V-150Q-162 -158 -122 -164T-33 -170Q13 -170 52 -160T121 -126T167 -60T184 43V1462H494V53Q494 -73 458 -164T356 -314T199 -402T-2 -430Z" />
86
<glyph unicode="K" glyph-name="K" horiz-adv-x="1298" d="M1298 0H946L610 608L494 522V0H184V1462H494V758L616 965L950 1462H1294L827 803L1298 0Z" />
87
<glyph unicode="L" glyph-name="L" horiz-adv-x="1096" d="M184 0V1462H494V256H1026V0H184Z" />
88
<glyph unicode="M" glyph-name="M" horiz-adv-x="1870" d="M772 0L451 1147H442Q448 1055 452 969Q454 932 455 893T458 816T460 743T461 680V0H184V1462H606L922 344H928L1264 1462H1686V0H1397V692Q1397 718 1397 751T1399 821T1401 896T1404 970Q1408 1054
89
1411 1145H1403L1057 0H772Z" />
90
<glyph unicode="N" glyph-name="N" horiz-adv-x="1604" d="M1419 0H1026L451 1106H442Q448 1029 452 953Q456 888 458 817T461 688V0H184V1462H575L1149 367H1155Q1152 443 1148 517Q1147 549 1146 582T1143 649T1142 714T1141 770V1462H1419V0Z" />
91
<glyph unicode="O" glyph-name="O" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430 733ZM438
92
733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733Z" />
93
<glyph unicode="P" glyph-name="P" horiz-adv-x="1225" d="M494 774H555Q686 774 752 826T819 995Q819 1104 760 1156T573 1208H494V774ZM1133 1006Q1133 910 1104 822T1009 667T834 560T565 520H494V0H184V1462H590Q731 1462 833 1431T1002 1341T1101 1198T1133 1006Z" />
94
<glyph unicode="Q" glyph-name="Q" horiz-adv-x="1548" d="M1430 733Q1430 614 1411 510T1352 319T1253 166T1112 55L1473 -348H1075L807 -18Q800 -18 794 -19Q789 -20 784 -20T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483
95
1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430 733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733Z"
96
/>
97
<glyph unicode="R" glyph-name="R" horiz-adv-x="1290" d="M494 813H578Q707 813 763 864T819 1016Q819 1120 759 1164T573 1208H494V813ZM494 561V0H184V1462H584Q865 1462 999 1354T1133 1024Q1133 949 1113 888T1060 780T983 697T891 637Q1002 459 1090 319Q1128
98
259 1163 202T1227 100T1273 28L1290 0H946L629 561H494Z" />
99
<glyph unicode="S" glyph-name="S" horiz-adv-x="1073" d="M985 406Q985 308 952 230T854 96T696 10T481 -20Q375 -20 277 2T94 68V356Q142 333 191 312T290 273T391 246T492 236Q543 236 579 247T638 279T671 328T682 391Q682 432 665 463T616 522T540 576T440
100
631Q394 655 337 689T230 773T145 895T111 1067Q111 1165 143 1242T236 1373T381 1455T573 1483Q626 1483 676 1476T776 1456T876 1424T979 1380L879 1139Q834 1160 795 1176T719 1203T647 1219T575 1225Q497 1225 456 1184T414 1073Q414 1036 426 1008T466 954T537
101
903T643 844Q718 804 781 763T889 671T960 556T985 406Z" />
102
<glyph unicode="T" glyph-name="T" horiz-adv-x="1124" d="M717 0H408V1204H41V1462H1083V1204H717V0Z" />
103
<glyph unicode="U" glyph-name="U" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292Z" />
104
<glyph unicode="V" glyph-name="V" horiz-adv-x="1249" d="M936 1462H1249L793 0H455L0 1462H313L561 582Q566 565 574 525T592 437T611 341T625 260Q630 293 639 341T658 436T677 524T692 582L936 1462Z" />
105
<glyph unicode="W" glyph-name="W" horiz-adv-x="1898" d="M1546 0H1194L1014 721Q1010 736 1005 763T992 824T978 895T965 967T955 1031T948 1079Q946 1061 942 1032T931 968T919 896T906 825T893 763T883 719L705 0H352L0 1462H305L471 664Q474 648 479 618T492
106
549T506 469T521 387T534 313T543 256Q546 278 551 312T563 384T576 464T590 540T601 603T610 643L813 1462H1085L1288 643Q1291 631 1296 604T1308 541T1322 464T1335 385T1347 312T1356 256Q1359 278 1364 312T1377 387T1391 469T1406 549T1418 617T1427 664L1593
107
1462H1898L1546 0Z" />
108
<glyph unicode="X" glyph-name="X" horiz-adv-x="1284" d="M1284 0H930L631 553L332 0H0L444 754L31 1462H373L647 936L915 1462H1249L831 737L1284 0Z" />
109
<glyph unicode="Y" glyph-name="Y" horiz-adv-x="1196" d="M598 860L862 1462H1196L752 569V0H444V559L0 1462H336L598 860Z" />
110
<glyph unicode="Z" glyph-name="Z" horiz-adv-x="1104" d="M1055 0H49V201L668 1206H68V1462H1036V1262L418 256H1055V0Z" />
111
<glyph unicode="[" glyph-name="bracketleft" horiz-adv-x="678" d="M627 -324H143V1462H627V1251H403V-113H627V-324Z" />
112
<glyph unicode="\" glyph-name="backslash" horiz-adv-x="846" d="M289 1462L834 0H557L12 1462H289Z" />
113
<glyph unicode="]" glyph-name="bracketright" horiz-adv-x="678" d="M51 -113H274V1251H51V1462H535V-324H51V-113Z" />
114
<glyph unicode="^" glyph-name="asciicircum" horiz-adv-x="1090" d="M8 520L446 1470H590L1085 520H846L524 1163Q455 1002 384 839T244 520H8Z" />
115
<glyph unicode="_" glyph-name="underscore" horiz-adv-x="842" d="M846 -324H-4V-184H846V-324Z" />
116
<glyph unicode="`" glyph-name="grave" horiz-adv-x="1182" d="M645 1241Q611 1269 564 1310T470 1396T386 1480T332 1548V1569H674Q690 1535 711 1495T756 1414T803 1335T848 1268V1241H645Z" />
117
<glyph unicode="a" glyph-name="a" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190 1040Q274
118
1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518Z" />
119
<glyph unicode="b" glyph-name="b" horiz-adv-x="1245" d="M756 1139Q842 1139 913 1102T1035 992T1114 811T1143 561Q1143 417 1115 309T1034 127T909 17T748 -20Q692 -20 649 -8T571 24T512 69T465 123H444L393 0H160V1556H465V1194Q465 1161 463 1123T459 1051Q456
120
1012 453 973H465Q486 1008 513 1038T575 1090T656 1126T756 1139ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z" />
121
<glyph unicode="c" glyph-name="c" horiz-adv-x="1022" d="M625 -20Q505 -20 409 13T244 115T139 293T102 553Q102 720 139 832T245 1013T410 1110T625 1139Q711 1139 796 1118T956 1059L868 827Q802 856 741 874T625 893Q514 893 464 809T414 555Q414 387 464
122
307T621 227Q708 227 779 249T924 307V53Q887 35 852 21T782 -2T708 -15T625 -20Z" />
123
<glyph unicode="d" glyph-name="d" horiz-adv-x="1245" d="M489 -20Q403 -20 332 17T210 126T131 307T102 557Q102 701 130 809T211 991T337 1102T498 1139Q552 1139 597 1127T678 1092T742 1040T793 975H803Q797 1014 792 1054Q787 1088 784 1126T780 1198V1556H1085V0H852L793
124
145H780Q759 111 732 81T670 28T590 -7T489 -20ZM600 223Q654 223 692 241T753 297T788 391T801 522V555Q801 636 791 699T758 804T696 869T598 891Q502 891 457 805T412 553Q412 388 457 306T600 223Z" />
125
<glyph unicode="e" glyph-name="e" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139 810 1106T962
126
1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20Z" />
127
<glyph unicode="f" glyph-name="f" horiz-adv-x="793" d="M741 889H514V0H209V889H41V1036L209 1118V1200Q209 1307 235 1377T309 1490T425 1549T578 1567Q670 1567 733 1553T840 1520L768 1296Q737 1307 703 1316T623 1325Q563 1325 539 1287T514 1188V1118H741V889Z" />
128
<glyph unicode="g" glyph-name="g" horiz-adv-x="1130" d="M1085 1116V950L922 899Q942 865 950 829T958 750Q958 665 931 595T851 474T718 397T532 369Q509 369 482 371T442 377Q422 360 411 342T399 297Q399 276 412 264T446 244T495 234T553 231H727Q808 231
129
872 213T980 156T1049 60T1073 -80Q1073 -175 1035 -251T922 -381T734 -463T475 -492Q361 -492 276 -471T134 -409T49 -311T20 -182Q20 -121 41 -76T97 1T176 53T268 84Q247 93 227 109T190 146T163 192T152 246Q152 278 161 304T189 352T234 395T295 436Q207 474
130
156 558T104 756Q104 846 132 917T214 1037T348 1113T532 1139Q552 1139 577 1137T626 1131T672 1123T705 1116H1085ZM285 -158Q285 -183 295 -206T330 -248T393 -276T489 -287Q645 -287 724 -243T803 -125Q803 -62 754 -41T602 -20H461Q434 -20 403 -26T346 -49T303
131
-91T285 -158ZM395 752Q395 661 429 611T532 561Q604 561 636 611T668 752Q668 842 637 895T532 948Q395 948 395 752Z" />
132
<glyph unicode="h" glyph-name="h" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 788 834T672 895Q613 895 573 871T509 800T475 684T465 526V0H160V1556H465V1239Q465 1197 463 1151T458 1065Q454 1019 451 975H467Q516 1062 592 1100T764 1139Q847 1139 914
133
1116T1030 1042T1104 915T1130 729V0Z" />
134
<glyph unicode="i" glyph-name="i" horiz-adv-x="625" d="M147 1407Q147 1450 160 1478T195 1524T248 1549T313 1556Q347 1556 377 1549T429 1525T465 1479T479 1407Q479 1365 466 1336T430 1290T377 1265T313 1257Q279 1257 249 1264T196 1289T160 1336T147 1407ZM465
135
0H160V1118H465V0Z" />
136
<glyph unicode="j" glyph-name="j" horiz-adv-x="625" d="M102 -492Q54 -492 3 -485T-82 -467V-227Q-51 -237 -24 -241T37 -246Q62 -246 84 -239T123 -212T150 -160T160 -76V1118H465V-121Q465 -198 446 -265T383 -383T270 -463T102 -492ZM147 1407Q147 1450 160
137
1478T195 1524T248 1549T313 1556Q347 1556 377 1549T429 1525T465 1479T479 1407Q479 1365 466 1336T430 1290T377 1265T313 1257Q279 1257 249 1264T196 1289T160 1336T147 1407Z" />
138
<glyph unicode="k" glyph-name="k" horiz-adv-x="1208" d="M453 608L565 778L838 1118H1182L778 633L1208 0H856L584 430L465 348V0H160V1556H465V862L449 608H453Z" />
139
<glyph unicode="l" glyph-name="l" horiz-adv-x="625" d="M465 0H160V1556H465V0Z" />
140
<glyph unicode="m" glyph-name="m" horiz-adv-x="1929" d="M1120 0H815V653Q815 774 779 834T666 895Q608 895 570 871T508 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 508 1049T582 1100T667 1129T758 1139Q873 1139 953 1100T1077 975H1102Q1126
141
1018 1160 1049T1235 1100T1321 1129T1413 1139Q1593 1139 1684 1042T1776 729V0H1470V653Q1470 774 1434 834T1321 895Q1212 895 1166 809T1120 561V0Z" />
142
<glyph unicode="n" glyph-name="n" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 789 834T672 895Q612 895 572 871T509 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 509 1049T585 1100T672 1129T766 1139Q848 1139 915 1116T1030 1042T1104
143
915T1130 729V0Z" />
144
<glyph unicode="o" glyph-name="o" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246 131T140 313T102
145
561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561Z" />
146
<glyph unicode="p" glyph-name="p" horiz-adv-x="1245" d="M748 -20Q693 -20 650 -8T572 24T512 69T465 123H449Q453 88 457 57Q460 31 462 4T465 -39V-492H160V1118H408L451 973H465Q486 1007 513 1037T575 1089T656 1125T756 1139Q843 1139 914 1102T1036 992T1115
147
811T1143 561Q1143 418 1114 310T1033 128T908 17T748 -20ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z" />
148
<glyph unicode="q" glyph-name="q" horiz-adv-x="1245" d="M602 219Q657 219 694 237T755 293T789 386T801 518V555Q801 636 792 699T759 804T697 869T600 891Q504 891 459 805T414 553Q414 385 459 302T602 219ZM489 -20Q402 -20 331 17T209 126T130 307T102
149
557Q102 700 130 808T211 990T337 1101T498 1139Q554 1139 599 1127T680 1092T745 1040T795 975H803L827 1118H1085V-492H780V-23Q780 -4 782 24T787 80Q790 112 793 145H780Q760 111 733 81T671 28T590 -7T489 -20Z" />
150
<glyph unicode="r" glyph-name="r" horiz-adv-x="889" d="M743 1139Q755 1139 769 1139T797 1137T822 1134T840 1130V844Q832 846 818 848T789 851T758 853T733 854Q674 854 625 839T540 791T485 703T465 569V0H160V1118H391L436 950H451Q475 993 503 1028T565
151
1087T643 1125T743 1139Z" />
152
<glyph unicode="s" glyph-name="s" horiz-adv-x="985" d="M905 332Q905 244 873 178T782 68T639 2T451 -20Q396 -20 349 -17T260 -5T179 15T100 45V297Q142 276 188 259T281 230T370 210T451 203Q492 203 521 210T568 231T595 263T604 303Q604 324 598 340T568
153
375T501 417T381 475Q308 508 255 540T167 613T115 704T98 827Q98 905 128 963T213 1061T345 1119T518 1139Q618 1139 708 1116T893 1047L801 831Q725 867 656 890T518 913Q456 913 429 891T401 831Q401 811 408 796T436 764T495 728T594 680Q665 649 722 619T820
154
549T883 458T905 332Z" />
155
<glyph unicode="t" glyph-name="t" horiz-adv-x="848" d="M614 223Q659 223 699 233T782 258V31Q739 9 676 -5T537 -20Q464 -20 401 -3T292 56T220 170T193 350V889H47V1018L215 1120L303 1356H498V1118H770V889H498V350Q498 285 530 254T614 223Z" />
156
<glyph unicode="u" glyph-name="u" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891Z" />
157
<glyph unicode="v" glyph-name="v" horiz-adv-x="1104" d="M395 0L0 1118H319L504 481Q521 424 533 363T549 252H555Q558 305 570 364T600 481L784 1118H1104L709 0H395Z" />
158
<glyph unicode="w" glyph-name="w" horiz-adv-x="1651" d="M1014 0L928 391Q924 408 918 439T903 510T887 594T869 683Q849 786 825 905H819Q796 786 777 682Q769 638 761 593T744 509T730 437T719 387L629 0H301L0 1118H303L416 623Q425 584 434 530T452 420T468
159
315T479 236H485Q486 255 489 285T498 351T508 422T519 491T529 547T537 582L659 1118H995L1112 582Q1117 560 1125 514T1141 416T1156 314T1163 236H1169Q1172 261 1179 310T1196 415T1215 528T1235 623L1352 1118H1651L1346 0H1014Z" />
160
<glyph unicode="x" glyph-name="x" horiz-adv-x="1122" d="M389 571L29 1118H375L561 782L750 1118H1096L731 571L1112 0H766L561 362L356 0H10L389 571Z" />
161
<glyph unicode="y" glyph-name="y" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91 -238 123 -242T190
162
-246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118Z" />
163
<glyph unicode="z" glyph-name="z" horiz-adv-x="936" d="M877 0H55V180L512 885H86V1118H858V920L416 233H877V0Z" />
164
<glyph unicode="{" glyph-name="braceleft" horiz-adv-x="745" d="M287 367T222 408T31 449V688Q93 688 141 697T223 728T272 784T287 866V1184Q287 1258 306 1310T374 1396T509 1446T725 1462V1237Q685 1236 653 1230T598 1209T563 1166T551 1096V797Q545 610
165
317 575V563Q432 546 493 491T551 342V43Q551 0 563 -27T597 -69T652 -91T725 -98V-324Q594 -324 509 -308T375 -259T306 -172T287 -45V270Q287 367 222 408Z" />
166
<glyph unicode="|" glyph-name="bar" horiz-adv-x="1128" d="M455 1550H674V-465H455V1550Z" />
167
<glyph unicode="}" glyph-name="braceright" horiz-adv-x="745" d="M469 -45Q469 -119 450 -172T382 -258T247 -308T31 -324V-98Q71 -97 103 -91T157 -70T192 -27T205 43V342Q202 436 263 491T438 563V575Q211 610 205 797V1096Q205 1139 193 1166T158 1208T103
168
1230T31 1237V1462Q162 1462 247 1446T381 1397T450 1311T469 1184V866Q468 818 484 784T533 729T614 698T725 688V449Q600 449 535 408T469 270V-45Z" />
169
<glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1128" d="M528 616Q491 632 463 643T411 660T366 669T322 672Q293 672 262 663T201 637T143 598T88 551V782Q139 836 202 863T344 891Q374 891 399 889T453 879T517 860T600 827Q638 811 666 801T719
170
784T764 775T807 772Q836 772 867 781T928 807T986 845T1040 893V662Q939 553 784 553Q754 553 729 555T675 564T611 583T528 616Z" />
171
<glyph unicode="&#xa0;" glyph-name="nbspace" horiz-adv-x="532" />
172
<glyph unicode="&#xa1;" glyph-name="exclamdown" horiz-adv-x="586" d="M168 606H412L463 -369H117L168 606ZM467 948Q467 901 454 869T416 816T360 787T291 778Q256 778 225 787T169 816T131 868T117 948Q117 993 131 1025T169 1078T224 1108T291 1118Q328 1118
173
360 1109T416 1079T453 1026T467 948Z" />
174
<glyph unicode="&#xa2;" glyph-name="cent" horiz-adv-x="1128" d="M543 -20V186Q451 199 377 236T251 340T171 506T143 743Q143 884 171 985T251 1155T378 1260T543 1311V1483H721V1319Q759 1318 797 1313T870 1299T937 1281T993 1260L907 1034Q886 1044 860
175
1053T805 1070T750 1082T698 1087Q632 1087 586 1067T511 1006T468 901T455 750Q455 579 512 500T698 420Q774 420 844 438T965 481V242Q914 213 852 198T721 180V-20H543Z" />
176
<glyph unicode="&#xa3;" glyph-name="sterling" horiz-adv-x="1128" d="M680 1483Q790 1483 879 1459T1049 1401L956 1171Q885 1200 827 1217T705 1235Q638 1235 601 1197T563 1063V870H897V651H563V508Q563 453 550 413T514 343T466 294T412 260H1090V0H82V248Q124
177
266 157 287T214 337T250 407T262 506V651H84V870H262V1065Q262 1178 293 1257T380 1387T512 1460T680 1483Z" />
178
<glyph unicode="&#xa4;" glyph-name="currency" horiz-adv-x="1128" d="M168 723Q168 777 182 826T221 920L92 1047L240 1194L367 1067Q410 1092 461 1106T563 1120Q617 1120 665 1107T760 1065L887 1194L1036 1051L907 922Q932 880 946 829T961 723Q961 667 947
179
618T907 524L1032 399L887 254L760 379Q716 356 667 342T563 328Q507 328 458 340T365 379L240 256L94 401L221 526Q168 617 168 723ZM375 723Q375 684 390 650T430 590T490 550T563 535Q603 535 638 549T699 589T741 649T756 723Q756 763 741 797T700 857T638
180
898T563 913Q524 913 490 898T431 858T390 798T375 723Z" />
181
<glyph unicode="&#xa5;" glyph-name="yen" horiz-adv-x="1128" d="M565 860L809 1462H1122L760 715H954V537H709V399H954V221H709V0H422V221H174V399H422V537H174V715H365L8 1462H324L565 860Z" />
182
<glyph unicode="&#xa6;" glyph-name="brokenbar" horiz-adv-x="1128" d="M455 1550H674V735H455V1550ZM455 350H674V-465H455V350Z" />
183
<glyph unicode="&#xa7;" glyph-name="section" horiz-adv-x="995" d="M121 805Q121 849 131 886T160 955T203 1012T254 1055Q191 1095 156 1154T121 1288Q121 1353 150 1406T232 1498T360 1556T526 1577Q628 1577 716 1554T889 1493L807 1303Q739 1335 669 1360T520
184
1386Q439 1386 402 1363T365 1292Q365 1267 377 1246T415 1206T481 1167T578 1124Q649 1096 707 1062T807 987T872 895T895 782Q895 682 861 621T770 522Q832 482 863 430T895 303Q895 229 864 170T776 68T638 3T455 -20Q345 -20 261 0T106 59V266Q145 246 190
185
229T281 198T371 176T455 168Q511 168 548 177T607 202T639 239T649 285Q649 310 642 329T612 368T549 408T442 457Q366 489 306 521T205 593T143 685T121 805ZM344 827Q344 764 400 716T575 616L590 610Q605 621 619 635T644 668T661 708T668 756Q668 788 658
186
815T621 867T550 917T434 967Q416 960 400 947T372 915T352 875T344 827Z" />
187
<glyph unicode="&#xa8;" glyph-name="dieresis" horiz-adv-x="1182" d="M248 1405Q248 1440 259 1465T288 1507T332 1532T387 1540Q416 1540 441 1532T486 1508T516 1466T528 1405Q528 1371 517 1346T486 1305T442 1280T387 1272Q358 1272 333 1280T289 1304T259
188
1346T248 1405ZM651 1405Q651 1440 662 1465T692 1507T737 1532T793 1540Q821 1540 846 1532T891 1508T922 1466T934 1405Q934 1371 923 1346T892 1305T847 1280T793 1272Q733 1272 692 1305T651 1405Z" />
189
<glyph unicode="&#xa9;" glyph-name="copyright" horiz-adv-x="1704" d="M895 1010Q798 1010 745 936T692 731Q692 596 740 524T895 451Q952 451 1018 466T1141 510V319Q1084 292 1025 277T889 262Q782 262 702 296T569 392T488 540T461 733Q461 836 487 921T565
190
1068T697 1164T881 1198Q964 1198 1041 1176T1186 1120L1112 952Q999 1010 895 1010ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384
191
200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM242 731Q242 604 290 493T420 300T614 169T852 121Q979 121 1090 169T1283 299T1414 493T1462 731Q1462 858 1414 969T1284 1162T1090 1293T852 1341Q725 1341 614 1293T421
192
1163T290 969T242 731Z" />
193
<glyph unicode="&#xaa;" glyph-name="ordfeminine" horiz-adv-x="743" d="M520 764L489 874Q449 816 393 784T268 752Q218 752 178 765T108 806T63 876T47 975Q47 1035 68 1076T130 1144T230 1184T365 1202L455 1206Q455 1269 426 1296T342 1323Q302 1323 253
194
1306T152 1262L86 1397Q148 1429 222 1454T387 1479Q455 1479 505 1460T589 1405T638 1319T655 1206V764H520ZM373 1081Q335 1078 312 1068T275 1044T257 1012T252 977Q252 939 271 921T317 903Q349 903 374 914T418 944T445 991T455 1051V1087L373 1081Z" />
195
<glyph unicode="&#xab;" glyph-name="guillemotleft" horiz-adv-x="1198" d="M82 573L391 1028L610 909L393 561L610 213L391 94L82 547V573ZM588 573L897 1028L1116 909L899 561L1116 213L897 94L588 547V573Z" />
196
<glyph unicode="&#xac;" glyph-name="logicalnot" horiz-adv-x="1128" d="M1040 248H821V612H88V831H1040V248Z" />
197
<glyph unicode="&#xad;" glyph-name="uni00AD" horiz-adv-x="659" d="M61 424V674H598V424H61Z" />
198
<glyph unicode="&#xae;" glyph-name="registered" horiz-adv-x="1704" d="M1157 905Q1157 811 1119 756T1014 672L1251 272H997L819 610H772V272H543V1188H807Q989 1188 1073 1118T1157 905ZM772 778H803Q869 778 897 806T926 901Q926 936 919 959T896 995T857
199
1014T801 1020H772V778ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384 200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320
200
199T203 351T127 531T100 731ZM242 731Q242 604 290 493T420 300T614 169T852 121Q979 121 1090 169T1283 299T1414 493T1462 731Q1462 858 1414 969T1284 1162T1090 1293T852 1341Q725 1341 614 1293T421 1163T290 969T242 731Z" />
201
<glyph unicode="&#xaf;" glyph-name="overscore" horiz-adv-x="1024" d="M1030 1556H-6V1757H1030V1556Z" />
202
<glyph unicode="&#xb0;" glyph-name="degree" horiz-adv-x="877" d="M92 1137Q92 1208 119 1271T193 1381T303 1455T438 1483Q510 1483 573 1456T683 1381T757 1271T784 1137Q784 1065 757 1002T684 893T574 820T438 793Q366 793 303 819T193 892T119 1002T92
203
1137ZM283 1137Q283 1106 295 1078T328 1029T377 996T438 983Q470 983 498 995T548 1029T581 1078T594 1137Q594 1169 582 1197T548 1247T499 1281T438 1294Q406 1294 378 1282T328 1248T295 1198T283 1137Z" />
204
<glyph unicode="&#xb1;" glyph-name="plusminus" horiz-adv-x="1128" d="M455 674H88V893H455V1262H674V893H1040V674H674V309H455V674ZM88 0V219H1040V0H88Z" />
205
<glyph unicode="&#xb2;" glyph-name="twosuperior" horiz-adv-x="776" d="M702 586H55V754L279 973Q325 1018 355 1051T404 1111T430 1161T438 1212Q438 1250 414 1270T350 1290Q310 1290 267 1270T170 1202L47 1354Q112 1411 193 1447T383 1483Q449 1483 503
206
1467T596 1419T656 1341T678 1233Q678 1187 666 1147T626 1065T557 980T455 881L350 786H702V586Z" />
207
<glyph unicode="&#xb3;" glyph-name="threesuperior" horiz-adv-x="776" d="M666 1249Q666 1180 626 1130T496 1051V1038Q547 1028 584 1007T645 959T682 898T694 829Q694 708 606 639T332 569Q256 569 190 586T59 639V829Q125 789 191 764T330 739Q404 739 438
208
766T473 846Q473 867 465 886T438 919T387 943T307 952H195V1112H287Q339 1112 371 1121T421 1145T445 1180T451 1221Q451 1259 426 1284T350 1309Q303 1309 261 1290T162 1231L61 1372Q123 1419 198 1450T377 1481Q439 1481 492 1465T583 1418T644 1345T666 1249Z"
209
/>
210
<glyph unicode="&#xb4;" glyph-name="acute" horiz-adv-x="1182" d="M332 1241V1268Q353 1297 377 1335T424 1413T469 1494T506 1569H848V1548Q837 1530 816 1506T768 1453T710 1396T648 1338T587 1285T535 1241H332Z" />
211
<glyph unicode="&#xb5;" glyph-name="mu" horiz-adv-x="1290" d="M465 465Q465 344 502 284T621 223Q679 223 718 247T781 318T815 434T825 592V1118H1130V0H897L854 150H842Q807 65 755 23T627 -20Q573 -20 528 3T455 70Q457 28 460 -15Q462 -52 463 -94T465
212
-172V-492H160V1118H465V465Z" />
213
<glyph unicode="&#xb6;" glyph-name="paragraph" horiz-adv-x="1341" d="M1167 -260H1006V1356H840V-260H678V559Q617 541 532 541Q437 541 360 566T228 651T143 806T113 1042Q113 1189 145 1287T237 1446T380 1531T563 1556H1167V-260Z" />
214
<glyph unicode="&#xb7;" glyph-name="middot" horiz-adv-x="584" d="M117 723Q117 770 130 802T168 855T224 884T293 893Q328 893 359 884T415 855T453 803T467 723Q467 678 453 646T415 593T360 563T293 553Q256 553 224 562T168 592T131 645T117 723Z" />
215
<glyph unicode="&#xb8;" glyph-name="cedilla" horiz-adv-x="420" d="M418 -250Q418 -307 403 -352T351 -428T256 -475T109 -492Q64 -492 28 -486T-37 -471V-303Q-22 -307 -4 -310T34 -317T72 -322T106 -324Q135 -324 156 -311T178 -262Q178 -225 141 -197T12
216
-154L90 0H283L256 -61Q287 -71 316 -88T367 -128T404 -182T418 -250Z" />
217
<glyph unicode="&#xb9;" glyph-name="onesuperior" horiz-adv-x="776" d="M584 586H346V1032Q346 1052 346 1082T348 1144T351 1201T354 1239Q348 1231 339 1221T319 1199T298 1178T279 1161L201 1100L92 1227L393 1462H584V586Z" />
218
<glyph unicode="&#xba;" glyph-name="ordmasculine" horiz-adv-x="754" d="M696 1116Q696 1029 674 962T609 848T508 777T375 752Q306 752 248 776T147 847T81 961T57 1116Q57 1203 79 1270T143 1384T244 1455T379 1479Q447 1479 504 1455T605 1385T672 1271T696
219
1116ZM260 1116Q260 1016 287 966T377 915Q437 915 464 965T492 1116Q492 1216 465 1265T377 1315Q315 1315 288 1266T260 1116Z" />
220
<glyph unicode="&#xbb;" glyph-name="guillemotright" horiz-adv-x="1198" d="M1118 547L809 94L590 213L807 561L590 909L809 1028L1118 573V547ZM612 547L303 94L84 213L301 561L84 909L303 1028L612 573V547Z" />
221
<glyph unicode="&#xbc;" glyph-name="onequarter" horiz-adv-x="1804" d="M1370 1462L559 0H320L1131 1462H1370ZM794 586H556V1032Q556 1052 556 1082T558 1144T561 1201T564 1239Q558 1231 549 1221T529 1199T508 1178T489 1161L411 1100L302 1227L603 1462H794V586ZM1682
222
152H1557V1H1319V152H936V306L1321 883H1557V320H1682V152ZM1319 320V484Q1319 526 1320 572T1325 668Q1320 655 1311 634T1290 590T1268 546T1248 511L1121 320H1319Z" />
223
<glyph unicode="&#xbd;" glyph-name="onehalf" horiz-adv-x="1804" d="M1370 1462L559 0H320L1131 1462H1370ZM794 586H556V1032Q556 1052 556 1082T558 1144T561 1201T564 1239Q558 1231 549 1221T529 1199T508 1178T489 1161L411 1100L302 1227L603 1462H794V586ZM1716
224
1H1069V169L1293 388Q1339 433 1369 466T1418 526T1444 576T1452 627Q1452 665 1428 685T1364 705Q1324 705 1281 685T1184 617L1061 769Q1126 826 1207 862T1397 898Q1463 898 1517 882T1610 834T1670 756T1692 648Q1692 602 1680 562T1640 480T1571 395T1469
225
296L1364 201H1716V1Z" />
226
<glyph unicode="&#xbe;" glyph-name="threequarters" horiz-adv-x="1804" d="M1441 1462L630 0H391L1202 1462H1441ZM1712 152H1587V1H1349V152H966V306L1351 883H1587V320H1712V152ZM1349 320V484Q1349 526 1350 572T1355 668Q1350 655 1341 634T1320 590T1298
227
546T1278 511L1151 320H1349ZM697 1249Q697 1180 657 1130T527 1051V1038Q578 1028 615 1007T676 959T713 898T725 829Q725 708 637 639T363 569Q287 569 221 586T90 639V829Q156 789 222 764T361 739Q435 739 469 766T504 846Q504 867 496 886T469 919T418 943T338
228
952H226V1112H318Q370 1112 402 1121T452 1145T476 1180T482 1221Q482 1259 457 1284T381 1309Q334 1309 292 1290T193 1231L92 1372Q154 1419 229 1450T408 1481Q470 1481 523 1465T614 1418T675 1345T697 1249Z" />
229
<glyph unicode="&#xbf;" glyph-name="questiondown" horiz-adv-x="940" d="M686 606V532Q686 481 676 440T644 361T588 288T506 215Q464 182 435 156T388 105T362 51T354 -14Q354 -71 393 -108T510 -145Q579 -145 659 -116T823 -45L926 -266Q883 -292 832 -314T727
230
-354T616 -381T506 -391Q404 -391 323 -367T184 -296T97 -182T66 -29Q66 34 79 83T121 175T190 258T287 342Q328 375 354 399T396 446T416 492T422 547V606H686ZM719 948Q719 901 706 869T668 816T612 787T543 778Q508 778 477 787T421 816T383 868T369 948Q369
231
993 383 1025T421 1078T476 1108T543 1118Q580 1118 612 1109T668 1079T705 1026T719 948Z" />
232
<glyph unicode="&#xc0;" glyph-name="Agrave" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
233
608H846ZM632 1579Q598 1607 551 1648T457 1734T373 1818T319 1886V1907H661Q677 1873 698 1833T743 1752T790 1673T835 1606V1579H632Z" />
234
<glyph unicode="&#xc1;" glyph-name="Aacute" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
235
608H846ZM494 1579V1606Q515 1635 539 1673T586 1751T631 1832T668 1907H1010V1886Q999 1868 978 1844T930 1791T872 1734T810 1676T749 1623T697 1579H494Z" />
236
<glyph unicode="&#xc2;" glyph-name="Acircumflex" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582
237
928L489 608H846ZM879 1579Q828 1613 773 1656T666 1755Q612 1699 560 1656T457 1579H254V1606Q280 1635 311 1673T375 1751T438 1832T490 1907H846Q867 1873 897 1833T959 1752T1024 1673T1082 1606V1579H879Z" />
238
<glyph unicode="&#xc3;" glyph-name="Atilde" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
239
608H846ZM504 1684Q473 1684 455 1658T424 1577H275Q281 1657 301 1715T353 1811T430 1867T527 1886Q568 1886 607 1870T684 1835T760 1799T834 1782Q865 1782 883 1808T914 1888H1063Q1057 1809 1037 1751T983 1655T907 1598T811 1579Q771 1579 731 1595T653 1631T578
240
1667T504 1684Z" />
241
<glyph unicode="&#xc4;" glyph-name="Adieresis" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
242
608H846ZM324 1743Q324 1778 335 1803T364 1845T408 1870T463 1878Q492 1878 517 1870T562 1846T592 1804T604 1743Q604 1709 593 1684T562 1643T518 1618T463 1610Q434 1610 409 1618T365 1642T335 1684T324 1743ZM727 1743Q727 1778 738 1803T768 1845T813 1870T869
243
1878Q897 1878 922 1870T967 1846T998 1804T1010 1743Q1010 1709 999 1684T968 1643T923 1618T869 1610Q809 1610 768 1643T727 1743Z" />
244
<glyph unicode="&#xc5;" glyph-name="Aring" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
245
608H846ZM918 1567Q918 1511 899 1467T845 1391T764 1344T664 1327Q609 1327 563 1343T485 1390T434 1465T416 1565Q416 1620 434 1664T484 1738T563 1785T664 1802Q717 1802 763 1786T843 1739T898 1665T918 1567ZM760 1565Q760 1610 733 1635T664 1661Q622 1661
246
595 1636T568 1565Q568 1520 592 1494T664 1468Q706 1468 733 1494T760 1565Z" />
247
<glyph unicode="&#xc6;" glyph-name="AE" horiz-adv-x="1888" d="M1767 0H926V348H465L315 0H0L655 1462H1767V1208H1235V887H1731V633H1235V256H1767V0ZM578 608H926V1198H829L578 608Z" />
248
<glyph unicode="&#xc7;" glyph-name="Ccedilla" horiz-adv-x="1305" d="M805 1225Q716 1225 648 1191T533 1092T462 935T438 727Q438 610 459 519T525 366T639 271T805 238Q894 238 983 258T1178 315V55Q1130 35 1083 21T987 -2T887 -15T776 -20Q607 -20 483 34T278
249
186T158 422T119 729Q119 895 164 1033T296 1272T511 1427T805 1483Q914 1483 1023 1456T1233 1380L1133 1128Q1051 1167 968 1196T805 1225ZM926 -250Q926 -307 911 -352T859 -428T764 -475T617 -492Q572 -492 536 -486T471 -471V-303Q486 -307 504 -310T542 -317T580
250
-322T614 -324Q643 -324 664 -311T686 -262Q686 -225 649 -197T520 -154L598 0H791L764 -61Q795 -71 824 -88T875 -128T912 -182T926 -250Z" />
251
<glyph unicode="&#xc8;" glyph-name="Egrave" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM572 1579Q538 1607 491 1648T397 1734T313 1818T259 1886V1907H601Q617 1873 638 1833T683 1752T730 1673T775 1606V1579H572Z" />
252
<glyph unicode="&#xc9;" glyph-name="Eacute" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM424 1579V1606Q445 1635 469 1673T516 1751T561 1832T598 1907H940V1886Q929 1868 908 1844T860 1791T802 1734T740 1676T679
253
1623T627 1579H424Z" />
254
<glyph unicode="&#xca;" glyph-name="Ecircumflex" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM832 1579Q781 1613 726 1656T619 1755Q565 1699 513 1656T410 1579H207V1606Q233 1635 264 1673T328 1751T391 1832T443
255
1907H799Q820 1873 850 1833T912 1752T977 1673T1035 1606V1579H832Z" />
256
<glyph unicode="&#xcb;" glyph-name="Edieresis" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM273 1743Q273 1778 284 1803T313 1845T357 1870T412 1878Q441 1878 466 1870T511 1846T541 1804T553 1743Q553 1709 542 1684T511
257
1643T467 1618T412 1610Q383 1610 358 1618T314 1642T284 1684T273 1743ZM676 1743Q676 1778 687 1803T717 1845T762 1870T818 1878Q846 1878 871 1870T916 1846T947 1804T959 1743Q959 1709 948 1684T917 1643T872 1618T818 1610Q758 1610 717 1643T676 1743Z"
258
/>
259
<glyph unicode="&#xcc;" glyph-name="Igrave" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM355 1579Q321 1607 274 1648T180 1734T96 1818T42 1886V1907H384Q400 1873 421 1833T466 1752T513 1673T558 1606V1579H355Z"
260
/>
261
<glyph unicode="&#xcd;" glyph-name="Iacute" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM237 1579V1606Q258 1635 282 1673T329 1751T374 1832T411 1907H753V1886Q742 1868 721 1844T673 1791T615 1734T553
262
1676T492 1623T440 1579H237Z" />
263
<glyph unicode="&#xce;" glyph-name="Icircumflex" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM609 1579Q558 1613 503 1656T396 1755Q342 1699 290 1656T187 1579H-16V1606Q10 1635 41 1673T105 1751T168
264
1832T220 1907H576Q597 1873 627 1833T689 1752T754 1673T812 1606V1579H609Z" />
265
<glyph unicode="&#xcf;" glyph-name="Idieresis" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM54 1743Q54 1778 65 1803T94 1845T138 1870T193 1878Q222 1878 247 1870T292 1846T322 1804T334 1743Q334 1709
266
323 1684T292 1643T248 1618T193 1610Q164 1610 139 1618T95 1642T65 1684T54 1743ZM457 1743Q457 1778 468 1803T498 1845T543 1870T599 1878Q627 1878 652 1870T697 1846T728 1804T740 1743Q740 1709 729 1684T698 1643T653 1618T599 1610Q539 1610 498 1643T457
267
1743Z" />
268
<glyph unicode="&#xd0;" glyph-name="Eth" horiz-adv-x="1434" d="M47 850H184V1462H612Q773 1462 902 1416T1124 1280T1265 1055T1315 745Q1315 560 1265 421T1119 188T885 47T569 0H184V596H47V850ZM1001 737Q1001 859 977 947T906 1094T792 1180T637 1208H494V850H731V596H494V256H608Q804
269
256 902 376T1001 737Z" />
270
<glyph unicode="&#xd1;" glyph-name="Ntilde" horiz-adv-x="1604" d="M1419 0H1026L451 1106H442Q448 1029 452 953Q456 888 458 817T461 688V0H184V1462H575L1149 367H1155Q1152 443 1148 517Q1147 549 1146 582T1143 649T1142 714T1141 770V1462H1419V0ZM623
271
1684Q592 1684 574 1658T543 1577H394Q400 1657 420 1715T472 1811T549 1867T646 1886Q687 1886 726 1870T803 1835T879 1799T953 1782Q984 1782 1002 1808T1033 1888H1182Q1176 1809 1156 1751T1102 1655T1026 1598T930 1579Q890 1579 850 1595T772 1631T697 1667T623
272
1684Z" />
273
<glyph unicode="&#xd2;" glyph-name="Ograve" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
274
733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM729 1579Q695 1607 648 1648T554 1734T470 1818T416 1886V1907H758Q774
275
1873 795 1833T840 1752T887 1673T932 1606V1579H729Z" />
276
<glyph unicode="&#xd3;" glyph-name="Oacute" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
277
733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM590 1579V1606Q611 1635 635 1673T682 1751T727 1832T764 1907H1106V1886Q1095
278
1868 1074 1844T1026 1791T968 1734T906 1676T845 1623T793 1579H590Z" />
279
<glyph unicode="&#xd4;" glyph-name="Ocircumflex" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390
280
1043T1430 733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM975 1579Q924 1613 869 1656T762 1755Q708 1699
281
656 1656T553 1579H350V1606Q376 1635 407 1673T471 1751T534 1832T586 1907H942Q963 1873 993 1833T1055 1752T1120 1673T1178 1606V1579H975Z" />
282
<glyph unicode="&#xd5;" glyph-name="Otilde" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
283
733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM612 1684Q581 1684 563 1658T532 1577H383Q389 1657 409 1715T461
284
1811T538 1867T635 1886Q676 1886 715 1870T792 1835T868 1799T942 1782Q973 1782 991 1808T1022 1888H1171Q1165 1809 1145 1751T1091 1655T1015 1598T919 1579Q879 1579 839 1595T761 1631T686 1667T612 1684Z" />
285
<glyph unicode="&#xd6;" glyph-name="Odieresis" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
286
733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM428 1743Q428 1778 439 1803T468 1845T512 1870T567 1878Q596
287
1878 621 1870T666 1846T696 1804T708 1743Q708 1709 697 1684T666 1643T622 1618T567 1610Q538 1610 513 1618T469 1642T439 1684T428 1743ZM831 1743Q831 1778 842 1803T872 1845T917 1870T973 1878Q1001 1878 1026 1870T1071 1846T1102 1804T1114 1743Q1114
288
1709 1103 1684T1072 1643T1027 1618T973 1610Q913 1610 872 1643T831 1743Z" />
289
<glyph unicode="&#xd7;" glyph-name="multiply" horiz-adv-x="1128" d="M408 723L109 1024L260 1178L561 879L866 1178L1020 1028L715 723L1016 420L866 268L561 569L260 270L111 422L408 723Z" />
290
<glyph unicode="&#xd8;" glyph-name="Oslash" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q595 -20 467 41L395 -76L227 18L309 152Q212 252 166 400T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q867 1485 944 1469T1087
291
1421L1157 1532L1323 1436L1243 1307Q1337 1208 1383 1063T1430 733ZM438 733Q438 553 485 438L942 1184Q873 1227 776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM1110 733Q1110 904 1067 1020L612 279Q646 260 686 250T774 240Q863 240 926 274T1030
292
371T1090 526T1110 733Z" />
293
<glyph unicode="&#xd9;" glyph-name="Ugrave" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM706
294
1579Q672 1607 625 1648T531 1734T447 1818T393 1886V1907H735Q751 1873 772 1833T817 1752T864 1673T909 1606V1579H706Z" />
295
<glyph unicode="&#xda;" glyph-name="Uacute" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM570
296
1579V1606Q591 1635 615 1673T662 1751T707 1832T744 1907H1086V1886Q1075 1868 1054 1844T1006 1791T948 1734T886 1676T825 1623T773 1579H570Z" />
297
<glyph unicode="&#xdb;" glyph-name="Ucircumflex" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM942
298
1579Q891 1613 836 1656T729 1755Q675 1699 623 1656T520 1579H317V1606Q343 1635 374 1673T438 1751T501 1832T553 1907H909Q930 1873 960 1833T1022 1752T1087 1673T1145 1606V1579H942Z" />
299
<glyph unicode="&#xdc;" glyph-name="Udieresis" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM393
300
1743Q393 1778 404 1803T433 1845T477 1870T532 1878Q561 1878 586 1870T631 1846T661 1804T673 1743Q673 1709 662 1684T631 1643T587 1618T532 1610Q503 1610 478 1618T434 1642T404 1684T393 1743ZM796 1743Q796 1778 807 1803T837 1845T882 1870T938 1878Q966
301
1878 991 1870T1036 1846T1067 1804T1079 1743Q1079 1709 1068 1684T1037 1643T992 1618T938 1610Q878 1610 837 1643T796 1743Z" />
302
<glyph unicode="&#xdd;" glyph-name="Yacute" horiz-adv-x="1196" d="M598 860L862 1462H1196L752 569V0H444V559L0 1462H336L598 860ZM422 1579V1606Q443 1635 467 1673T514 1751T559 1832T596 1907H938V1886Q927 1868 906 1844T858 1791T800 1734T738 1676T677
303
1623T625 1579H422Z" />
304
<glyph unicode="&#xde;" glyph-name="Thorn" horiz-adv-x="1225" d="M1133 770Q1133 676 1108 590T1024 438T870 333T633 293H494V0H184V1462H494V1233H655Q779 1233 869 1200T1017 1107T1104 961T1133 770ZM494 543H578Q699 543 759 595T819 770Q819 878 766
305
929T598 981H494V543Z" />
306
<glyph unicode="&#xdf;" glyph-name="germandbls" horiz-adv-x="1395" d="M1188 1241Q1188 1177 1167 1129T1114 1042T1045 975T976 922T923 877T901 834Q901 814 913 797T952 760T1020 715T1118 651Q1167 620 1205 588T1269 517T1309 432T1323 326Q1323 154 1206
307
67T862 -20Q764 -20 692 -6T559 43V285Q583 269 617 254T690 226T768 207T842 199Q922 199 966 229T1010 322Q1010 349 1003 370T976 412T918 457T821 516Q758 552 716 584T647 647T609 713T598 788Q598 841 618 880T670 950T737 1007T805 1059T856 1117T877 1188Q877
308
1251 827 1290T680 1329Q572 1329 519 1281T465 1128V0H160V1139Q160 1248 197 1328T302 1462T467 1541T680 1567Q795 1567 889 1546T1049 1483T1152 1380T1188 1241Z" />
309
<glyph unicode="&#xe0;" glyph-name="agrave" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
310
1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM808 1241Q774 1269 727 1310T633 1396T549 1480T495 1548V1569H837Q853
311
1535 874 1495T919 1414T966 1335T1011 1268V1241H808Z" />
312
<glyph unicode="&#xe1;" glyph-name="aacute" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
313
1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM441 1241V1268Q462 1297 486 1335T533 1413T578 1494T615
314
1569H957V1548Q946 1530 925 1506T877 1453T819 1396T757 1338T696 1285T644 1241H441Z" />
315
<glyph unicode="&#xe2;" glyph-name="acircumflex" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289
316
838L190 1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM801 1496Q750 1530 695 1573T588 1672Q534 1616
317
482 1573T379 1496H176V1523Q202 1552 233 1590T297 1668T360 1749T412 1824H768Q789 1790 819 1750T881 1669T946 1590T1004 1523V1496H801Z" />
318
<glyph unicode="&#xe3;" glyph-name="atilde" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
319
1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM681 1346Q650 1346 632 1320T601 1239H452Q458 1319 478
320
1377T530 1473T607 1529T704 1548Q745 1548 784 1532T861 1497T937 1461T1011 1444Q1042 1444 1060 1470T1091 1550H1240Q1234 1471 1214 1413T1160 1317T1084 1260T988 1241Q948 1241 908 1257T830 1293T755 1329T681 1346Z" />
321
<glyph unicode="&#xe4;" glyph-name="adieresis" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289
322
838L190 1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM254 1405Q254 1440 265 1465T294 1507T338 1532T393
323
1540Q422 1540 447 1532T492 1508T522 1466T534 1405Q534 1371 523 1346T492 1305T448 1280T393 1272Q364 1272 339 1280T295 1304T265 1346T254 1405ZM657 1405Q657 1440 668 1465T698 1507T743 1532T799 1540Q827 1540 852 1532T897 1508T928 1466T940 1405Q940
324
1371 929 1346T898 1305T853 1280T799 1272Q739 1272 698 1305T657 1405Z" />
325
<glyph unicode="&#xe5;" glyph-name="aring" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
326
1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM842 1479Q842 1423 823 1379T769 1303T688 1256T588 1239Q533
327
1239 487 1255T409 1302T358 1377T340 1477Q340 1532 358 1576T408 1650T487 1697T588 1714Q641 1714 687 1698T767 1651T822 1577T842 1479ZM684 1477Q684 1522 657 1547T588 1573Q546 1573 519 1548T492 1477Q492 1432 516 1406T588 1380Q630 1380 657 1406T684
328
1477Z" />
329
<glyph unicode="&#xe6;" glyph-name="ae" horiz-adv-x="1806" d="M1268 -20Q1137 -20 1030 30T854 186Q811 132 769 94T678 30T568 -8T424 -20Q356 -20 295 1T187 66T113 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427
330
894T289 838L190 1040Q274 1087 376 1114T590 1141Q804 1141 913 1010Q1039 1139 1227 1139Q1338 1139 1427 1106T1579 1007T1674 848T1708 631V483H1026Q1028 419 1046 368T1098 281T1179 226T1288 207Q1382 207 1469 228T1645 295V59Q1605 38 1565 24T1479 -1T1382
331
-15T1268 -20ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM1229 922Q1147 922 1094 865T1032 686H1421Q1420 737 1408 780T1373 854T1313 904T1229 922Z" />
332
<glyph unicode="&#xe7;" glyph-name="ccedilla" horiz-adv-x="1022" d="M625 -20Q505 -20 409 13T244 115T139 293T102 553Q102 720 139 832T245 1013T410 1110T625 1139Q711 1139 796 1118T956 1059L868 827Q802 856 741 874T625 893Q514 893 464 809T414 555Q414
333
387 464 307T621 227Q708 227 779 249T924 307V53Q887 35 852 21T782 -2T708 -15T625 -20ZM778 -250Q778 -307 763 -352T711 -428T616 -475T469 -492Q424 -492 388 -486T323 -471V-303Q338 -307 356 -310T394 -317T432 -322T466 -324Q495 -324 516 -311T538 -262Q538
334
-225 501 -197T372 -154L450 0H643L616 -61Q647 -71 676 -88T727 -128T764 -182T778 -250Z" />
335
<glyph unicode="&#xe8;" glyph-name="egrave" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
336
810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM834 1241Q800 1269 753 1310T659 1396T575 1480T521 1548V1569H863Q879 1535 900
337
1495T945 1414T992 1335T1037 1268V1241H834Z" />
338
<glyph unicode="&#xe9;" glyph-name="eacute" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
339
810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM447 1241V1268Q468 1297 492 1335T539 1413T584 1494T621 1569H963V1548Q952 1530
340
931 1506T883 1453T825 1396T763 1338T702 1285T650 1241H447Z" />
341
<glyph unicode="&#xea;" glyph-name="ecircumflex" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721
342
1139 810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM819 1241Q768 1275 713 1318T606 1417Q552 1361 500 1318T397 1241H194V1268Q220
343
1297 251 1335T315 1413T378 1494T430 1569H786Q807 1535 837 1495T899 1414T964 1335T1022 1268V1241H819Z" />
344
<glyph unicode="&#xeb;" glyph-name="edieresis" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
345
810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM266 1405Q266 1440 277 1465T306 1507T350 1532T405 1540Q434 1540 459 1532T504
346
1508T534 1466T546 1405Q546 1371 535 1346T504 1305T460 1280T405 1272Q376 1272 351 1280T307 1304T277 1346T266 1405ZM669 1405Q669 1440 680 1465T710 1507T755 1532T811 1540Q839 1540 864 1532T909 1508T940 1466T952 1405Q952 1371 941 1346T910 1305T865
347
1280T811 1272Q751 1272 710 1305T669 1405Z" />
348
<glyph unicode="&#xec;" glyph-name="igrave" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM269 1241Q235 1269 188 1310T94 1396T10 1480T-44 1548V1569H298Q314 1535 335 1495T380 1414T427 1335T472 1268V1241H269Z" />
349
<glyph unicode="&#xed;" glyph-name="iacute" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM145 1241V1268Q166 1297 190 1335T237 1413T282 1494T319 1569H661V1548Q650 1530 629 1506T581 1453T523 1396T461 1338T400 1285T348 1241H145Z" />
350
<glyph unicode="&#xee;" glyph-name="icircumflex" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM521 1241Q470 1275 415 1318T308 1417Q254 1361 202 1318T99 1241H-104V1268Q-78 1297 -47 1335T17 1413T80 1494T132 1569H488Q509 1535 539 1495T601 1414T666
351
1335T724 1268V1241H521Z" />
352
<glyph unicode="&#xef;" glyph-name="idieresis" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM-32 1405Q-32 1440 -21 1465T8 1507T52 1532T107 1540Q136 1540 161 1532T206 1508T236 1466T248 1405Q248 1371 237 1346T206 1305T162 1280T107 1272Q78 1272 53
353
1280T9 1304T-21 1346T-32 1405ZM371 1405Q371 1440 382 1465T412 1507T457 1532T513 1540Q541 1540 566 1532T611 1508T642 1466T654 1405Q654 1371 643 1346T612 1305T567 1280T513 1272Q453 1272 412 1305T371 1405Z" />
354
<glyph unicode="&#xf0;" glyph-name="eth" horiz-adv-x="1182" d="M457 1309Q423 1330 384 1354T303 1401L399 1571Q472 1537 536 1503T657 1430L883 1569L983 1415L809 1309Q881 1240 935 1162T1024 993T1078 798T1096 573Q1096 431 1060 321T957 135T795 20T582
355
-20Q471 -20 378 14T218 113T112 272T74 489Q74 611 106 705T197 863T337 961T516 995Q612 995 680 964T780 883L801 885Q773 973 723 1050T606 1184L375 1040L274 1196L457 1309ZM784 532Q784 579 773 622T737 698T675 750T586 770Q478 770 432 700T385 487Q385
356
424 396 372T432 283T495 226T586 205Q692 205 738 286T784 532Z" />
357
<glyph unicode="&#xf1;" glyph-name="ntilde" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 789 834T672 895Q612 895 572 871T509 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 509 1049T585 1100T672 1129T766 1139Q848 1139 915 1116T1030
358
1042T1104 915T1130 729V0ZM477 1346Q446 1346 428 1320T397 1239H248Q254 1319 274 1377T326 1473T403 1529T500 1548Q541 1548 580 1532T657 1497T733 1461T807 1444Q838 1444 856 1470T887 1550H1036Q1030 1471 1010 1413T956 1317T880 1260T784 1241Q744 1241
359
704 1257T626 1293T551 1329T477 1346Z" />
360
<glyph unicode="&#xf2;" glyph-name="ograve" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
361
131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM841 1241Q807 1269 760 1310T666 1396T582 1480T528 1548V1569H870Q886 1535 907 1495T952 1414T999 1335T1044 1268V1241H841Z" />
362
<glyph unicode="&#xf3;" glyph-name="oacute" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
363
131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM434 1241V1268Q455 1297 479 1335T526 1413T571 1494T608 1569H950V1548Q939 1530 918 1506T870 1453T812 1396T750 1338T689 1285T637 1241H434Z"
364
/>
365
<glyph unicode="&#xf4;" glyph-name="ocircumflex" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
366
131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM821 1241Q770 1275 715 1318T608 1417Q554 1361 502 1318T399 1241H196V1268Q222 1297 253 1335T317 1413T380 1494T432 1569H788Q809 1535 839
367
1495T901 1414T966 1335T1024 1268V1241H821Z" />
368
<glyph unicode="&#xf5;" glyph-name="otilde" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
369
131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM444 1346Q413 1346 395 1320T364 1239H215Q221 1319 241 1377T293 1473T370 1529T467 1548Q508 1548 547 1532T624 1497T700 1461T774 1444Q805
370
1444 823 1470T854 1550H1003Q997 1471 977 1413T923 1317T847 1260T751 1241Q711 1241 671 1257T593 1293T518 1329T444 1346Z" />
371
<glyph unicode="&#xf6;" glyph-name="odieresis" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
372
131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM266 1405Q266 1440 277 1465T306 1507T350 1532T405 1540Q434 1540 459 1532T504 1508T534 1466T546 1405Q546 1371 535 1346T504 1305T460 1280T405
373
1272Q376 1272 351 1280T307 1304T277 1346T266 1405ZM669 1405Q669 1440 680 1465T710 1507T755 1532T811 1540Q839 1540 864 1532T909 1508T940 1466T952 1405Q952 1371 941 1346T910 1305T865 1280T811 1272Q751 1272 710 1305T669 1405Z" />
374
<glyph unicode="&#xf7;" glyph-name="divide" horiz-adv-x="1128" d="M88 612V831H1040V612H88ZM424 373Q424 415 435 444T465 490T509 516T563 524Q591 524 616 516T660 491T690 444T702 373Q702 333 691 304T660 257T616 230T563 221Q535 221 510 229T465 256T435
375
304T424 373ZM424 1071Q424 1113 435 1142T465 1189T509 1215T563 1223Q591 1223 616 1215T660 1189T690 1142T702 1071Q702 1031 691 1003T660 956T616 929T563 920Q535 920 510 928T465 955T435 1002T424 1071Z" />
376
<glyph unicode="&#xf8;" glyph-name="oslash" horiz-adv-x="1227" d="M1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q553 -20 501 -10T401 18L344 -76L182 14L250 125Q181 199 142 308T102 561Q102 700 137 808T239 989T401 1101T616 1139Q678 1139 735
377
1126T844 1090L893 1169L1053 1073L991 975Q1054 903 1089 799T1124 561ZM414 561Q414 475 426 410L709 868Q669 893 612 893Q507 893 461 811T414 561ZM813 561Q813 625 807 674L539 240Q556 232 574 229T614 225Q719 225 766 310T813 561Z" />
378
<glyph unicode="&#xf9;" glyph-name="ugrave" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM839
379
1241Q805 1269 758 1310T664 1396T580 1480T526 1548V1569H868Q884 1535 905 1495T950 1414T997 1335T1042 1268V1241H839Z" />
380
<glyph unicode="&#xfa;" glyph-name="uacute" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM461
381
1241V1268Q482 1297 506 1335T553 1413T598 1494T635 1569H977V1548Q966 1530 945 1506T897 1453T839 1396T777 1338T716 1285T664 1241H461Z" />
382
<glyph unicode="&#xfb;" glyph-name="ucircumflex" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM842
383
1241Q791 1275 736 1318T629 1417Q575 1361 523 1318T420 1241H217V1268Q243 1297 274 1335T338 1413T401 1494T453 1569H809Q830 1535 860 1495T922 1414T987 1335T1045 1268V1241H842Z" />
384
<glyph unicode="&#xfc;" glyph-name="udieresis" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM295
385
1405Q295 1440 306 1465T335 1507T379 1532T434 1540Q463 1540 488 1532T533 1508T563 1466T575 1405Q575 1371 564 1346T533 1305T489 1280T434 1272Q405 1272 380 1280T336 1304T306 1346T295 1405ZM698 1405Q698 1440 709 1465T739 1507T784 1532T840 1540Q868
386
1540 893 1532T938 1508T969 1466T981 1405Q981 1371 970 1346T939 1305T894 1280T840 1272Q780 1272 739 1305T698 1405Z" />
387
<glyph unicode="&#xfd;" glyph-name="yacute" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91 -238
388
123 -242T190 -246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118ZM393 1241V1268Q414 1297 438 1335T485 1413T530 1494T567 1569H909V1548Q898 1530 877 1506T829 1453T771 1396T709 1338T648 1285T596 1241H393Z" />
389
<glyph unicode="&#xfe;" glyph-name="thorn" horiz-adv-x="1245" d="M465 973Q485 1008 512 1038T576 1090T656 1126T756 1139Q842 1139 913 1102T1035 992T1114 811T1143 561Q1143 418 1115 310T1036 128T914 17T756 -20Q701 -20 656 -10T576 20T513 64T465 117H451Q454
390
85 458 55Q461 29 463 3T465 -39V-492H160V1556H465V1165Q465 1141 463 1108T458 1045Q454 1010 451 973H465ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z"
391
/>
392
<glyph unicode="&#xff;" glyph-name="ydieresis" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91
393
-238 123 -242T190 -246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118ZM466 1405Q466 1440 477 1465T506 1507T550 1532T605 1540Q634 1540 659 1532T704 1508T734 1466T746 1405Q746 1371 735 1346T704 1305T660 1280T605 1272Q576 1272 551 1280T507
394
1304T477 1346T466 1405ZM869 1405Q869 1440 880 1465T910 1507T955 1532T1011 1540Q1039 1540 1064 1532T1109 1508T1140 1466T1152 1405Q1152 1371 1141 1346T1110 1305T1065 1280T1011 1272Q951 1272 910 1305T869 1405Z" />
395
<glyph unicode="&#x2013;" glyph-name="endash" horiz-adv-x="1024" d="M82 436V666H942V436H82Z" />
396
<glyph unicode="&#x2014;" glyph-name="emdash" horiz-adv-x="2048" d="M82 436V666H1966V436H82Z" />
397
<glyph unicode="&#x2018;" glyph-name="quoteleft" horiz-adv-x="440" d="M37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H418Q403 1401 389 1335T361 1204T336 1076T317 961H37Z" />
398
<glyph unicode="&#x2019;" glyph-name="quoteright" horiz-adv-x="440" d="M403 1462L418 1440Q404 1385 385 1325T342 1202T293 1078T242 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H403Z" />
399
<glyph unicode="&#x201a;" glyph-name="quotesinglbase" horiz-adv-x="594" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215Z" />
400
<glyph unicode="&#x201c;" glyph-name="quotedblleft" horiz-adv-x="907" d="M489 983Q503 1037 523 1098T566 1221T615 1344T666 1462H885Q870 1401 856 1335T828 1204T803 1076T784 961H504L489 983ZM23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H418Q403
401
1401 389 1335T361 1204T336 1076T317 961H37L23 983Z" />
402
<glyph unicode="&#x201d;" glyph-name="quotedblright" horiz-adv-x="907" d="M418 1440Q404 1385 385 1325T342 1202T293 1078T242 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H403L418 1440ZM885 1440Q871 1385 852 1325T809 1202T760 1078T709 961H489Q504
403
1021 518 1087T546 1219T571 1347T590 1462H870L885 1440Z" />
404
<glyph unicode="&#x201e;" glyph-name="quotedblbase" horiz-adv-x="1061" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215ZM926 215Q912 161 893 100T850 -23T801 -146T750 -264H530Q545 -203
405
559 -137T587 -6T612 122T631 238H911L926 215Z" />
406
<glyph unicode="&#x2022;" glyph-name="bullet" horiz-adv-x="770" d="M98 748Q98 834 120 894T180 992T271 1047T385 1065Q444 1065 496 1048T588 992T649 894T672 748Q672 663 650 603T588 505T497 448T385 430Q324 430 272 448T181 504T120 603T98 748Z" />
407
<glyph unicode="&#x2039;" glyph-name="guilsinglleft" horiz-adv-x="692" d="M82 573L391 1028L610 909L393 561L610 213L391 94L82 547V573Z" />
408
<glyph unicode="&#x203a;" glyph-name="guilsinglright" horiz-adv-x="692" d="M610 547L301 94L82 213L299 561L82 909L301 1028L610 573V547Z" />
409
</font>
410
</defs>
411
</svg>
(-)a/api/v1/doc/fonts/droid-sans-v6-latin-regular.svg (+403 lines)
Line 0 Link Here
1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
<svg xmlns="http://www.w3.org/2000/svg">
4
<defs >
5
<font id="DroidSans" horiz-adv-x="1062" ><font-face
6
    font-family="Droid Sans"
7
    units-per-em="2048"
8
    panose-1="2 11 6 6 3 8 4 2 2 4"
9
    ascent="1907"
10
    descent="-492"
11
    alphabetic="0" />
12
<glyph unicode=" " glyph-name="space" horiz-adv-x="532" />
13
<glyph unicode="!" glyph-name="exclam" horiz-adv-x="551" d="M336 414H215L164 1462H387L336 414ZM147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157
14
47T147 111Z" />
15
<glyph unicode="&quot;" glyph-name="quotedbl" horiz-adv-x="823" d="M330 1462L289 934H174L133 1462H330ZM690 1462L649 934H535L494 1462H690Z" />
16
<glyph unicode="#" glyph-name="numbersign" horiz-adv-x="1323" d="M983 893L920 565H1200V428H893L811 0H664L748 428H457L375 0H231L309 428H51V565H336L401 893H127V1030H426L508 1462H655L573 1030H866L950 1462H1094L1010 1030H1272V893H983ZM483 565H774L838
17
893H547L483 565Z" />
18
<glyph unicode="$" glyph-name="dollar" horiz-adv-x="1128" d="M985 446Q985 376 960 319T889 220T776 151T625 111V-119H487V102Q437 102 386 106T287 120T197 142T123 172V344Q156 328 199 312T291 282T389 261T487 252V686Q398 716 333 749T224 824T160 922T139
19
1051Q139 1118 163 1173T233 1270T343 1338T487 1374V1554H625V1378Q725 1373 809 1352T961 1300L895 1155Q839 1180 769 1200T625 1227V805Q713 774 780 741T893 667T962 572T985 446ZM809 446Q809 479 799 506T768 556T711 598T625 635V262Q718 276 763 325T809
20
446ZM315 1049Q315 1013 323 985T352 933T405 890T487 854V1223Q398 1207 357 1163T315 1049Z" />
21
<glyph unicode="%" glyph-name="percent" horiz-adv-x="1690" d="M250 1026Q250 861 285 779T401 696Q557 696 557 1026Q557 1354 401 1354Q321 1354 286 1273T250 1026ZM705 1026Q705 918 687 832T632 687T538 597T401 565Q328 565 272 596T178 687T121 832T102
22
1026Q102 1134 119 1219T173 1362T266 1452T401 1483Q476 1483 532 1452T627 1363T685 1219T705 1026ZM1133 440Q1133 275 1168 193T1284 111Q1440 111 1440 440Q1440 768 1284 768Q1204 768 1169 687T1133 440ZM1587 440Q1587 332 1570 247T1515 102T1421 12T1284
23
-20Q1210 -20 1154 11T1061 102T1004 246T985 440Q985 548 1002 633T1056 776T1149 866T1284 897Q1359 897 1415 866T1510 777T1567 633T1587 440ZM1331 1462L520 0H362L1174 1462H1331Z" />
24
<glyph unicode="&amp;" glyph-name="ampersand" horiz-adv-x="1438" d="M422 1165Q422 1131 430 1099T454 1034T497 968T559 897Q618 932 661 963T732 1026T774 1093T788 1169Q788 1205 776 1235T740 1288T683 1322T608 1335Q522 1335 472 1291T422 1165ZM557
25
141Q615 141 664 152T755 184T833 231T901 289L514 696Q462 663 422 632T355 564T313 486T299 387Q299 333 316 288T367 210T448 159T557 141ZM109 381Q109 459 129 520T187 631T281 724T408 809Q377 845 347 883T295 965T258 1058T244 1165Q244 1240 269 1299T341
26
1400T457 1463T614 1485Q697 1485 762 1464T873 1401T943 1300T967 1165Q967 1101 942 1047T875 946T779 860T664 784L1016 412Q1043 441 1064 471T1103 535T1133 608T1157 694H1341Q1326 628 1306 573T1259 468T1200 377T1128 293L1405 0H1180L1012 172Q963 127
27
915 92T813 32T697 -6T557 -20Q452 -20 369 6T228 84T140 210T109 381Z" />
28
<glyph unicode="&apos;" glyph-name="quotesingle" horiz-adv-x="463" d="M330 1462L289 934H174L133 1462H330Z" />
29
<glyph unicode="(" glyph-name="parenleft" horiz-adv-x="616" d="M82 561Q82 686 100 807T155 1043T248 1263T383 1462H555Q415 1269 343 1038T270 563Q270 444 288 326T342 95T431 -124T553 -324H383Q305 -234 249 -131T155 84T100 317T82 561Z" />
30
<glyph unicode=")" glyph-name="parenright" horiz-adv-x="616" d="M535 561Q535 437 517 317T462 85T368 -131T233 -324H63Q132 -230 185 -124T274 95T328 326T346 563Q346 807 274 1038T61 1462H233Q311 1369 367 1264T461 1044T517 808T535 561Z" />
31
<glyph unicode="*" glyph-name="asterisk" horiz-adv-x="1128" d="M664 1556L621 1163L1018 1274L1044 1081L666 1053L911 727L733 631L557 989L399 631L215 727L457 1053L82 1081L111 1274L502 1163L459 1556H664Z" />
32
<glyph unicode="+" glyph-name="plus" horiz-adv-x="1128" d="M489 647H102V797H489V1186H639V797H1026V647H639V262H489V647Z" />
33
<glyph unicode="," glyph-name="comma" horiz-adv-x="512" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362Z" />
34
<glyph unicode="-" glyph-name="hyphen" horiz-adv-x="659" d="M82 465V633H578V465H82Z" />
35
<glyph unicode="." glyph-name="period" horiz-adv-x="549" d="M147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157 47T147 111Z" />
36
<glyph unicode="/" glyph-name="slash" horiz-adv-x="764" d="M743 1462L199 0H20L565 1462H743Z" />
37
<glyph unicode="0" glyph-name="zero" horiz-adv-x="1128" d="M1032 733Q1032 556 1007 416T925 179T779 31T563 -20Q445 -20 358 31T213 179T127 416T98 733Q98 910 123 1050T204 1286T348 1434T563 1485Q682 1485 770 1435T916 1288T1003 1051T1032 733ZM283
38
733Q283 583 298 471T346 285T432 173T563 135Q640 135 694 172T782 283T832 469T848 733Q848 883 833 995T783 1181T694 1292T563 1329Q486 1329 433 1292T346 1181T298 995T283 733Z" />
39
<glyph unicode="1" glyph-name="one" horiz-adv-x="1128" d="M711 0H535V913Q535 956 535 1005T537 1102T540 1195T543 1274Q526 1256 513 1243T487 1218T458 1193T422 1161L274 1040L178 1163L561 1462H711V0Z" />
40
<glyph unicode="2" glyph-name="two" horiz-adv-x="1128" d="M1008 0H96V156L446 537Q521 618 580 685T680 816T744 944T766 1085Q766 1144 749 1189T701 1265T626 1313T530 1329Q435 1329 359 1291T213 1192L111 1311Q151 1347 197 1378T296 1433T408 1469T532
41
1483Q628 1483 705 1456T837 1379T920 1256T950 1092Q950 1007 924 930T851 779T740 629T600 473L319 174V166H1008V0Z" />
42
<glyph unicode="3" glyph-name="three" horiz-adv-x="1128" d="M961 1120Q961 1047 938 987T874 883T774 811T645 770V764Q822 742 914 652T1006 416Q1006 320 974 240T875 102T708 12T469 -20Q360 -20 264 -3T82 59V229Q169 183 270 158T465 133Q557 133 624
43
153T734 210T798 301T819 422Q819 490 793 538T717 618T598 665T438 680H305V831H438Q519 831 582 851T687 908T752 996T774 1108Q774 1160 756 1201T705 1270T626 1314T524 1329Q417 1329 336 1296T180 1208L88 1333Q126 1364 172 1391T274 1438T391 1471T524
44
1483Q632 1483 713 1456T850 1381T933 1266T961 1120Z" />
45
<glyph unicode="4" glyph-name="four" horiz-adv-x="1128" d="M1087 328H874V0H698V328H23V487L686 1470H874V494H1087V328ZM698 494V850Q698 906 699 967T703 1087T707 1197T711 1282H702Q695 1262 685 1238T662 1189T636 1141T612 1102L201 494H698Z" />
46
<glyph unicode="5" glyph-name="five" horiz-adv-x="1128" d="M545 897Q644 897 729 870T878 788T978 654T1014 469Q1014 355 980 264T879 110T714 14T487 -20Q436 -20 387 -15T292 -1T205 24T131 59V231Q164 208 208 190T302 160T400 142T492 135Q571 135 633
47
153T738 211T804 309T827 449Q827 592 739 667T483 743Q456 743 425 741T362 734T302 726T252 717L162 774L217 1462H907V1296H375L336 877Q368 883 420 890T545 897Z" />
48
<glyph unicode="6" glyph-name="six" horiz-adv-x="1128" d="M113 625Q113 730 123 834T160 1033T233 1211T350 1353T520 1448T752 1483Q771 1483 794 1482T840 1479T885 1473T924 1464V1309Q889 1321 845 1327T758 1333Q668 1333 600 1312T481 1251T398 1158T343
49
1039T312 899T299 745H311Q331 781 359 812T426 866T511 902T618 915Q713 915 790 886T921 799T1004 660T1034 471Q1034 357 1003 266T914 112T774 14T590 -20Q490 -20 403 19T251 138T150 339T113 625ZM588 133Q648 133 697 153T783 215T838 320T858 471Q858 541
50
842 596T792 691T710 751T594 772Q527 772 472 749T377 688T317 602T295 506Q295 439 313 373T368 253T460 167T588 133Z" />
51
<glyph unicode="7" glyph-name="seven" horiz-adv-x="1128" d="M281 0L844 1296H90V1462H1030V1317L475 0H281Z" />
52
<glyph unicode="8" glyph-name="eight" horiz-adv-x="1128" d="M565 1485Q649 1485 723 1463T854 1397T944 1287T977 1133Q977 1066 957 1012T902 915T819 837T715 774Q773 743 828 705T927 620T997 513T1024 381Q1024 289 991 215T897 88T752 8T565 -20Q455 -20
53
370 7T226 84T137 208T106 373Q106 448 128 508T189 616T279 701T389 766Q340 797 297 833T223 915T173 1014T154 1135Q154 1222 187 1287T278 1397T409 1463T565 1485ZM285 371Q285 318 301 274T351 198T437 149T561 131Q631 131 684 148T774 198T828 277T846
54
379Q846 431 827 473T771 551T683 619T569 682L539 696Q413 636 349 559T285 371ZM563 1333Q457 1333 395 1280T332 1126Q332 1069 349 1028T398 955T472 898T567 848Q615 870 657 896T731 955T781 1030T799 1126Q799 1227 736 1280T563 1333Z" />
55
<glyph unicode="9" glyph-name="nine" horiz-adv-x="1128" d="M1028 838Q1028 733 1018 629T981 429T908 252T791 109T621 15T389 -20Q370 -20 347 -19T301 -16T256 -10T217 -2V154Q252 141 296 135T383 129Q518 129 605 176T743 303T815 491T842 717H829Q809
56
681 781 650T715 596T629 560T522 547Q427 547 350 576T219 663T136 802T106 991Q106 1105 137 1196T226 1351T366 1449T551 1483Q652 1483 739 1444T890 1325T991 1124T1028 838ZM553 1329Q493 1329 444 1309T358 1247T303 1142T283 991Q283 921 299 866T349 771T431
57
711T547 690Q615 690 670 713T764 774T824 860T846 956Q846 1023 828 1089T773 1209T681 1296T553 1329Z" />
58
<glyph unicode=":" glyph-name="colon" horiz-adv-x="549" d="M147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157 47T147 111ZM147 987Q147 1026 157
59
1052T184 1095T224 1119T274 1126Q300 1126 323 1119T364 1096T391 1053T401 987Q401 950 391 924T364 881T324 856T274 848Q247 848 224 856T184 881T157 924T147 987Z" />
60
<glyph unicode=";" glyph-name="semicolon" horiz-adv-x="549" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362ZM147 987Q147 1026 157 1052T184 1095T224 1119T274 1126Q300 1126 323 1119T364
61
1096T391 1053T401 987Q401 950 391 924T364 881T324 856T274 848Q247 848 224 856T184 881T157 924T147 987Z" />
62
<glyph unicode="&lt;" glyph-name="less" horiz-adv-x="1128" d="M1026 238L102 662V764L1026 1245V1085L291 721L1026 399V238Z" />
63
<glyph unicode="=" glyph-name="equal" horiz-adv-x="1128" d="M102 852V1001H1026V852H102ZM102 442V592H1026V442H102Z" />
64
<glyph unicode="&gt;" glyph-name="greater" horiz-adv-x="1128" d="M102 399L838 721L102 1085V1245L1026 764V662L102 238V399Z" />
65
<glyph unicode="?" glyph-name="question" horiz-adv-x="872" d="M281 414V451Q281 508 288 554T315 640T368 718T451 799Q499 840 533 873T588 941T620 1015T631 1108Q631 1156 616 1195T573 1263T502 1307T403 1323Q320 1323 245 1297T100 1237L37 1382Q118
66
1424 212 1453T403 1483Q496 1483 570 1458T697 1384T777 1267T805 1110Q805 1043 792 991T751 893T684 806T590 717Q538 672 505 639T453 574T427 509T420 432V414H281ZM233 111Q233 149 243 175T270 218T310 242T360 250Q386 250 409 243T450 219T477 176T487
67
111Q487 74 477 48T450 4T410 -21T360 -29Q333 -29 310 -21T270 4T243 47T233 111Z" />
68
<glyph unicode="@" glyph-name="at" horiz-adv-x="1774" d="M1665 731Q1665 669 1656 607T1628 488T1581 383T1514 298T1428 242T1321 221Q1276 221 1240 236T1177 276T1135 333T1112 401H1108Q1090 364 1063 331T1001 274T921 235T823 221Q746 221 687 249T586
69
327T524 449T502 606Q502 707 531 791T616 936T751 1031T928 1065Q973 1065 1018 1061T1104 1050T1179 1035T1237 1018L1214 602Q1213 580 1213 567T1212 545T1212 533T1212 526Q1212 473 1222 439T1250 385T1288 358T1333 350Q1379 350 1414 380T1472 463T1508
70
585T1520 733Q1520 875 1477 985T1358 1172T1178 1287T950 1327Q781 1327 652 1272T436 1117T303 881T258 582Q258 431 297 314T413 117T603 -4T864 -45Q925 -45 984 -38T1099 -19T1205 8T1298 41V-100Q1212 -138 1104 -160T866 -182Q687 -182 547 -131T309 17T160
71
255T109 575Q109 763 168 925T336 1207T601 1394T950 1462Q1106 1462 1237 1412T1463 1267T1612 1037T1665 731ZM662 602Q662 469 712 410T848 350Q903 350 942 372T1006 436T1044 535T1061 662L1075 915Q1047 923 1009 929T928 936Q854 936 804 907T722 831T676
72
724T662 602Z" />
73
<glyph unicode="A" glyph-name="A" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836Z" />
74
<glyph unicode="B" glyph-name="B" horiz-adv-x="1272" d="M199 1462H598Q726 1462 823 1443T986 1380T1085 1266T1118 1092Q1118 1030 1099 976T1042 881T951 813T827 776V766Q896 754 956 732T1062 670T1133 570T1159 424Q1159 324 1127 246T1033 113T883 29T684
75
0H199V1462ZM385 842H629Q713 842 770 857T862 901T912 975T928 1079Q928 1199 851 1251T608 1303H385V842ZM385 686V158H651Q739 158 798 178T894 234T947 320T963 432Q963 488 947 535T893 615T793 667T639 686H385Z" />
76
<glyph unicode="C" glyph-name="C" horiz-adv-x="1235" d="M793 1319Q686 1319 599 1279T451 1162T356 977T322 731Q322 590 351 481T440 296T587 182T793 143Q882 143 962 160T1120 201V39Q1081 24 1042 13T961 -6T870 -16T762 -20Q598 -20 478 34T280 187T163
77
425T125 733Q125 899 168 1037T296 1274T506 1428T793 1483Q901 1483 999 1461T1176 1397L1098 1241Q1035 1273 961 1296T793 1319Z" />
78
<glyph unicode="D" glyph-name="D" horiz-adv-x="1401" d="M1276 745Q1276 560 1228 421T1089 188T866 47T565 0H199V1462H606Q759 1462 883 1416T1094 1280T1228 1055T1276 745ZM1079 739Q1079 885 1046 991T950 1167T795 1269T586 1303H385V160H547Q811 160
79
945 306T1079 739Z" />
80
<glyph unicode="E" glyph-name="E" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0Z" />
81
<glyph unicode="F" glyph-name="F" horiz-adv-x="1006" d="M385 0H199V1462H958V1298H385V782H920V618H385V0Z" />
82
<glyph unicode="G" glyph-name="G" horiz-adv-x="1413" d="M782 772H1266V55Q1211 37 1155 23T1040 0T916 -15T776 -20Q619 -20 498 32T294 182T168 419T125 733Q125 905 172 1044T311 1280T535 1430T840 1483Q951 1483 1053 1461T1243 1397L1171 1235Q1135 1252
83
1094 1267T1008 1293T918 1312T825 1319Q703 1319 609 1279T452 1162T355 977T322 731Q322 601 349 493T437 307T592 186T821 143Q865 143 901 145T969 152T1027 161T1081 172V608H782V772Z" />
84
<glyph unicode="H" glyph-name="H" horiz-adv-x="1436" d="M1237 0H1051V682H385V0H199V1462H385V846H1051V1462H1237V0Z" />
85
<glyph unicode="I" glyph-name="I" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0Z" />
86
<glyph unicode="J" glyph-name="J" horiz-adv-x="555" d="M-29 -389Q-80 -389 -118 -383T-184 -365V-205Q-150 -214 -111 -219T-27 -225Q10 -225 47 -216T115 -181T165 -112T184 0V1462H371V20Q371 -85 342 -162T260 -289T134 -364T-29 -389Z" />
87
<glyph unicode="K" glyph-name="K" horiz-adv-x="1186" d="M1186 0H975L524 698L385 584V0H199V1462H385V731L506 899L958 1462H1167L647 825L1186 0Z" />
88
<glyph unicode="L" glyph-name="L" horiz-adv-x="1006" d="M199 0V1462H385V166H958V0H199Z" />
89
<glyph unicode="M" glyph-name="M" horiz-adv-x="1782" d="M803 0L360 1280H352Q358 1206 362 1133Q366 1070 368 1001T371 874V0H199V1462H475L887 270H893L1307 1462H1583V0H1397V887Q1397 939 1399 1006T1404 1134Q1408 1205 1411 1278H1403L956 0H803Z" />
90
<glyph unicode="N" glyph-name="N" horiz-adv-x="1493" d="M1294 0H1079L360 1210H352Q358 1133 362 1057Q366 992 368 921T371 793V0H199V1462H412L1128 258H1135Q1132 334 1128 408Q1127 440 1126 473T1123 540T1121 605T1120 662V1462H1294V0Z" />
91
<glyph unicode="O" glyph-name="O" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393 733ZM322
92
733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733Z" />
93
<glyph unicode="P" glyph-name="P" horiz-adv-x="1180" d="M1075 1034Q1075 943 1048 859T957 711T791 608T535 569H385V0H199V1462H561Q695 1462 792 1434T952 1351T1045 1216T1075 1034ZM385 727H514Q607 727 676 743T791 794T860 886T883 1024Q883 1166 801
94
1234T545 1303H385V727Z" />
95
<glyph unicode="Q" glyph-name="Q" horiz-adv-x="1518" d="M1393 733Q1393 602 1369 489T1297 286T1178 129T1014 25Q1057 -69 1125 -140T1284 -272L1163 -414Q1060 -341 974 -242T836 -16Q819 -18 799 -19T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125
96
905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393 733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428
97
1165T348 980T322 733Z" />
98
<glyph unicode="R" glyph-name="R" horiz-adv-x="1208" d="M385 604V0H199V1462H555Q821 1462 948 1359T1075 1047Q1075 960 1051 895T986 784T893 706T786 655L1184 0H965L614 604H385ZM385 762H549Q639 762 702 779T805 831T864 917T883 1038Q883 1110 863 1160T801
99
1242T696 1288T545 1303H385V762Z" />
100
<glyph unicode="S" glyph-name="S" horiz-adv-x="1063" d="M969 391Q969 294 935 218T836 88T680 8T473 -20Q362 -20 266 -3T104 49V227Q138 211 181 196T273 168T372 149T473 141Q633 141 709 201T786 373Q786 427 772 467T721 540T623 605T469 674Q380 709 315
101
750T207 844T144 962T123 1112Q123 1200 155 1269T245 1385T383 1458T561 1483Q680 1483 775 1461T944 1403L877 1247Q812 1276 730 1297T559 1319Q437 1319 370 1263T303 1110Q303 1053 318 1012T368 937T460 874T602 811Q693 775 761 737T876 651T945 540T969
102
391Z" />
103
<glyph unicode="T" glyph-name="T" horiz-adv-x="1063" d="M625 0H438V1298H20V1462H1042V1298H625V0Z" />
104
<glyph unicode="U" glyph-name="U" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245Z" />
105
<glyph unicode="V" glyph-name="V" horiz-adv-x="1163" d="M965 1462H1163L674 0H487L0 1462H197L492 535Q521 444 542 360T580 201Q595 275 618 359T672 541L965 1462Z" />
106
<glyph unicode="W" glyph-name="W" horiz-adv-x="1810" d="M809 1462H1006L1235 606Q1250 550 1264 494T1291 386T1313 286T1329 201Q1333 239 1339 284T1353 378T1370 479T1391 580L1591 1462H1790L1423 0H1235L981 938Q967 989 954 1043T930 1144Q918 1199 907
107
1251Q896 1200 885 1145Q875 1098 863 1042T836 932L594 0H406L20 1462H217L440 573Q452 527 462 478T480 379T496 285T508 201Q513 238 520 287T538 390T559 499T584 604L809 1462Z" />
108
<glyph unicode="X" glyph-name="X" horiz-adv-x="1120" d="M1120 0H909L555 635L188 0H0L453 764L31 1462H229L561 903L895 1462H1085L664 770L1120 0Z" />
109
<glyph unicode="Y" glyph-name="Y" horiz-adv-x="1079" d="M539 723L879 1462H1079L633 569V0H446V559L0 1462H203L539 723Z" />
110
<glyph unicode="Z" glyph-name="Z" horiz-adv-x="1104" d="M1022 0H82V145L793 1296H102V1462H1001V1317L291 166H1022V0Z" />
111
<glyph unicode="[" glyph-name="bracketleft" horiz-adv-x="621" d="M569 -324H164V1462H569V1313H346V-174H569V-324Z" />
112
<glyph unicode="\" glyph-name="backslash" horiz-adv-x="764" d="M201 1462L745 0H567L23 1462H201Z" />
113
<glyph unicode="]" glyph-name="bracketright" horiz-adv-x="621" d="M51 -174H274V1313H51V1462H457V-324H51V-174Z" />
114
<glyph unicode="^" glyph-name="asciicircum" horiz-adv-x="1090" d="M41 549L500 1473H602L1049 549H888L551 1284L202 549H41Z" />
115
<glyph unicode="_" glyph-name="underscore" horiz-adv-x="842" d="M846 -324H-4V-184H846V-324Z" />
116
<glyph unicode="`" glyph-name="grave" horiz-adv-x="1182" d="M786 1241H666Q631 1269 590 1310T511 1396T441 1480T393 1548V1569H612Q628 1535 649 1495T694 1414T741 1335T786 1268V1241Z" />
117
<glyph unicode="a" glyph-name="a" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967 374 943T236
118
885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127Z" />
119
<glyph unicode="b" glyph-name="b" horiz-adv-x="1200" d="M670 1118Q764 1118 841 1082T972 975T1057 797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20Q611 -20 563 -7T477 27T409 78T356 139H344L307 0H174V1556H356V1180Q356 1145 355 1106T352 1032Q350
120
992 348 954H356Q379 989 408 1019T475 1071T562 1105T670 1118ZM635 967Q555 967 502 942T416 864T370 734T356 551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
121
<glyph unicode="c" glyph-name="c" horiz-adv-x="948" d="M594 -20Q493 -20 405 11T252 111T150 286T113 543Q113 700 151 809T255 987T411 1087T602 1118Q680 1118 754 1101T879 1059L825 905Q802 915 774 924T716 941T657 953T602 958Q445 958 373 858T301 545Q301
122
334 373 237T594 139Q675 139 740 157T860 201V39Q806 10 745 -5T594 -20Z" />
123
<glyph unicode="d" glyph-name="d" horiz-adv-x="1200" d="M852 147H844Q822 113 793 83T725 29T638 -7T530 -20Q437 -20 360 16T228 123T143 301T113 547Q113 688 143 794T228 973T360 1081T530 1118Q589 1118 637 1105T723 1070T792 1019T844 958H856Q853 992
124
850 1023Q848 1049 846 1076T844 1120V1556H1026V0H879L852 147ZM565 131Q641 131 693 154T778 224T826 341T844 506V547Q844 648 831 726T785 858T698 939T563 967Q428 967 365 858T301 545Q301 336 364 234T565 131Z" />
125
<glyph unicode="e" glyph-name="e" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704 144T788 158T867
126
182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967Z" />
127
<glyph unicode="f" glyph-name="f" horiz-adv-x="674" d="M651 961H406V0H223V961H29V1036L223 1104V1200Q223 1307 245 1377T310 1490T415 1549T555 1567Q614 1567 663 1556T752 1530L705 1389Q674 1400 638 1408T561 1417Q521 1417 492 1408T444 1374T416 1309T406
128
1202V1098H651V961Z" />
129
<glyph unicode="g" glyph-name="g" horiz-adv-x="1061" d="M1020 1098V985L823 958Q851 923 870 869T889 745Q889 669 866 605T795 493T677 420T514 393Q492 393 470 393T434 397Q417 387 401 375T371 346T349 310T340 266Q340 239 352 223T384 197T433 185T492
130
182H668Q761 182 825 159T929 95T988 1T1006 -115Q1006 -203 974 -273T874 -391T705 -466T463 -492Q356 -492 276 -471T143 -410T64 -314T37 -186Q37 -126 56 -81T109 -2T185 52T276 84Q234 103 207 144T180 238Q180 299 212 343T313 430Q270 448 235 479T175 551T137
131
640T123 739Q123 828 148 898T222 1017T344 1092T514 1118Q551 1118 590 1113T657 1098H1020ZM209 -180Q209 -217 222 -249T264 -304T342 -340T463 -354Q649 -354 741 -297T834 -131Q834 -85 822 -56T783 -11T710 12T600 18H424Q389 18 351 10T282 -20T230 -80T209
132
-180ZM301 745Q301 630 355 574T508 518Q608 518 659 573T711 748Q711 871 659 929T506 987Q407 987 354 927T301 745Z" />
133
<glyph unicode="h" glyph-name="h" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1556H356V1094L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860Z" />
134
<glyph unicode="i" glyph-name="i" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM160 1395Q160 1455 190 1482T266 1509Q288 1509 307 1503T341 1482T364 1447T373 1395Q373 1337 342 1309T266 1280Q221 1280 191 1308T160 1395Z" />
135
<glyph unicode="j" glyph-name="j" horiz-adv-x="530" d="M66 -492Q18 -492 -13 -485T-68 -467V-319Q-42 -329 -15 -334T47 -340Q74 -340 97 -333T137 -306T164 -254T174 -170V1098H356V-158Q356 -235 339 -296T286 -401T196 -468T66 -492ZM160 1395Q160 1455
136
190 1482T266 1509Q288 1509 307 1503T341 1482T364 1447T373 1395Q373 1337 342 1309T266 1280Q221 1280 191 1308T160 1395Z" />
137
<glyph unicode="k" glyph-name="k" horiz-adv-x="1016" d="M342 567L477 737L770 1098H981L580 623L1008 0H799L463 504L354 422V0H174V1556H354V842L338 567H342Z" />
138
<glyph unicode="l" glyph-name="l" horiz-adv-x="530" d="M356 0H174V1556H356V0Z" />
139
<glyph unicode="m" glyph-name="m" horiz-adv-x="1835" d="M1489 0V707Q1489 837 1439 902T1284 967Q1211 967 1160 944T1077 875T1029 762T1014 606V0H831V707Q831 837 782 902T627 967Q550 967 498 941T415 864T370 739T356 569V0H174V1098H322L348 950H358Q382
140
993 415 1024T487 1077T571 1108T662 1118Q782 1118 861 1074T979 936H987Q1013 983 1049 1017T1129 1073T1221 1107T1319 1118Q1494 1118 1582 1023T1671 717V0H1489Z" />
141
<glyph unicode="n" glyph-name="n" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1098H322L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860Z" />
142
<glyph unicode="o" glyph-name="o" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301 551Q301
143
342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551Z" />
144
<glyph unicode="p" glyph-name="p" horiz-adv-x="1200" d="M670 -20Q611 -20 563 -7T477 27T409 78T356 139H344Q347 105 350 74Q352 48 354 21T356 -23V-492H174V1098H322L348 950H356Q379 985 408 1015T475 1068T562 1104T670 1118Q764 1118 841 1082T972 975T1057
145
797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20ZM635 967Q559 967 507 944T422 874T374 757T356 592V551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
146
<glyph unicode="q" glyph-name="q" horiz-adv-x="1200" d="M565 131Q641 131 693 154T778 224T826 341T844 506V547Q844 648 831 726T785 858T698 939T563 967Q428 967 365 858T301 545Q301 336 364 234T565 131ZM530 -20Q437 -20 360 16T228 123T143 301T113
147
547Q113 688 143 794T228 973T360 1081T530 1118Q589 1118 637 1105T723 1069T791 1016T844 950H852L879 1098H1026V-492H844V-23Q844 -4 846 25T850 81Q853 113 856 147H844Q822 113 793 83T725 29T638 -7T530 -20Z" />
148
<glyph unicode="r" glyph-name="r" horiz-adv-x="817" d="M649 1118Q678 1118 714 1116T776 1108L752 940Q724 945 695 948T639 952Q576 952 524 927T435 854T377 740T356 592V0H174V1098H322L344 897H352Q377 940 405 980T469 1050T549 1099T649 1118Z" />
149
<glyph unicode="s" glyph-name="s" horiz-adv-x="924" d="M831 301Q831 221 802 161T719 61T587 0T414 -20Q305 -20 227 -3T90 49V215Q121 199 159 184T239 156T325 137T414 129Q479 129 524 140T598 171T640 221T653 287Q653 318 643 343T607 392T534 442T416
150
498Q344 529 287 559T189 626T128 711T106 827Q106 897 133 951T211 1043T331 1099T487 1118Q584 1118 664 1097T817 1042L754 895Q689 924 621 945T481 967Q379 967 330 934T281 838Q281 803 292 777T332 728T407 682T524 629Q596 599 652 569T749 502T810 416T831
151
301Z" />
152
<glyph unicode="t" glyph-name="t" horiz-adv-x="694" d="M506 129Q524 129 546 131T590 136T628 143T655 150V12Q642 6 622 0T578 -10T528 -17T477 -20Q415 -20 362 -4T271 51T210 156T188 324V961H33V1042L188 1120L266 1350H371V1098H647V961H371V324Q371 227
153
402 178T506 129Z" />
154
<glyph unicode="u" glyph-name="u" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885Z" />
155
<glyph unicode="v" glyph-name="v" horiz-adv-x="981" d="M375 0L0 1098H188L387 487Q398 454 413 402T443 296T470 194T487 121H494Q499 146 511 194T538 296T568 402T594 487L793 1098H981L606 0H375Z" />
156
<glyph unicode="w" glyph-name="w" horiz-adv-x="1528" d="M1008 0L840 616Q836 634 830 656T818 704T806 755T793 806Q779 864 764 926H758Q744 863 731 805Q720 755 708 702T684 612L512 0H301L20 1098H211L342 514Q352 469 362 417T381 313T397 216T408 141H414Q419
157
167 427 210T446 302T468 398T489 479L668 1098H864L1036 479Q1045 445 1056 399T1079 306T1099 214T1112 141H1118Q1121 167 1127 210T1143 306T1162 412T1184 514L1321 1098H1507L1223 0H1008Z" />
158
<glyph unicode="x" glyph-name="x" horiz-adv-x="1024" d="M408 563L55 1098H262L512 688L762 1098H969L614 563L987 0H780L512 436L242 0H35L408 563Z" />
159
<glyph unicode="y" glyph-name="y" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130 -492 92 -487T27
160
-475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098Z" />
161
<glyph unicode="z" glyph-name="z" horiz-adv-x="903" d="M821 0H82V125L618 961H115V1098H803V952L279 137H821V0Z" />
162
<glyph unicode="{" glyph-name="braceleft" horiz-adv-x="725" d="M500 -16Q500 -64 512 -94T546 -142T601 -166T674 -174V-324Q597 -323 532 -307T419 -255T344 -164T317 -31V303Q317 406 252 449T61 492V647Q186 647 251 690T317 836V1169Q317 1247 344 1302T418
163
1392T531 1444T674 1462V1313Q634 1312 602 1306T547 1282T512 1234T500 1155V823Q500 718 441 657T266 575V563Q381 543 440 482T500 315V-16Z" />
164
<glyph unicode="|" glyph-name="bar" horiz-adv-x="1128" d="M489 1556H639V-492H489V1556Z" />
165
<glyph unicode="}" glyph-name="braceright" horiz-adv-x="725" d="M225 315Q225 421 284 482T459 563V575Q344 595 285 656T225 823V1155Q225 1203 213 1233T179 1281T124 1305T51 1313V1462Q128 1461 193 1445T306 1393T381 1302T408 1169V836Q408 784 424 748T473
166
690T554 657T664 647V492Q539 492 474 449T408 303V-31Q408 -109 381 -164T307 -254T194 -306T51 -324V-174Q91 -173 123 -167T178 -143T213 -95T225 -16V315Z" />
167
<glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1128" d="M530 651Q493 667 466 678T416 695T373 704T330 707Q302 707 272 698T213 672T155 633T102 586V748Q202 856 350 856Q379 856 404 854T456 845T517 826T598 793Q635 777 662 766T713 749T757
168
740T799 737Q827 737 857 746T916 772T974 811T1026 858V696Q927 588 778 588Q749 588 724 590T672 599T611 618T530 651Z" />
169
<glyph unicode="&#xa0;" glyph-name="nbspace" horiz-adv-x="532" />
170
<glyph unicode="&#xa1;" glyph-name="exclamdown" horiz-adv-x="551" d="M213 676H334L385 -373H162L213 676ZM401 979Q401 941 392 915T365 872T324 848T274 840Q248 840 225 847T185 871T157 914T147 979Q147 1016 157 1042T184 1085T225 1110T274 1118Q301
171
1118 324 1110T364 1085T391 1042T401 979Z" />
172
<glyph unicode="&#xa2;" glyph-name="cent" horiz-adv-x="1128" d="M886 212T831 197T700 180V-20H563V186Q476 199 407 236T289 340T214 506T188 743Q188 884 214 985T289 1155T407 1260T563 1311V1483H700V1319Q772 1316 840 1300T954 1260L901 1106Q878 1116
173
850 1125T792 1142T733 1154T678 1159Q521 1159 449 1058T377 745Q377 535 449 438T670 340Q751 340 816 358T936 401V240Q886 212 831 197Z" />
174
<glyph unicode="&#xa3;" glyph-name="sterling" horiz-adv-x="1128" d="M666 1481Q772 1481 859 1459T1012 1401L946 1257Q890 1286 820 1307T674 1329Q626 1329 585 1316T514 1273T468 1196T451 1083V788H827V651H451V440Q451 378 440 334T409 257T364 204T311
175
166H1059V0H68V154Q112 165 148 185T211 240T253 322T268 438V651H70V788H268V1112Q268 1199 297 1267T379 1383T505 1456T666 1481Z" />
176
<glyph unicode="&#xa4;" glyph-name="currency" horiz-adv-x="1128" d="M186 723Q186 782 203 835T252 936L123 1065L221 1163L348 1034Q395 1066 449 1084T563 1102Q623 1102 676 1084T776 1034L905 1163L1004 1067L874 938Q905 892 923 838T942 723Q942 663
177
925 608T874 508L1001 381L905 285L776 412Q730 381 677 364T563 346Q503 346 448 364T348 414L221 287L125 383L252 510Q221 555 204 609T186 723ZM324 723Q324 673 342 630T393 554T469 502T563 483Q614 483 658 502T736 553T788 629T807 723Q807 774 788 818T736
178
896T659 948T563 967Q513 967 470 948T394 896T343 819T324 723Z" />
179
<glyph unicode="&#xa5;" glyph-name="yen" horiz-adv-x="1128" d="M563 723L909 1462H1100L715 694H954V557H653V399H954V262H653V0H475V262H174V399H475V557H174V694H408L29 1462H221L563 723Z" />
180
<glyph unicode="&#xa6;" glyph-name="brokenbar" horiz-adv-x="1128" d="M489 1556H639V776H489V1556ZM489 289H639V-492H489V289Z" />
181
<glyph unicode="&#xa7;" glyph-name="section" horiz-adv-x="995" d="M137 809Q137 860 150 901T185 975T237 1029T297 1067Q222 1105 180 1162T137 1303Q137 1364 164 1413T242 1496T362 1548T518 1567Q615 1567 693 1547T844 1495L788 1356Q723 1384 653 1403T512
182
1423Q413 1423 362 1394T311 1307Q311 1280 323 1257T363 1212T439 1167T557 1114Q629 1086 685 1054T781 982T841 895T862 784Q862 732 850 690T818 613T771 555T717 514Q786 476 824 422T862 289Q862 218 833 163T749 69T618 10T444 -10Q336 -10 258 6T121 55V213Q152
183
198 190 183T270 157T356 138T444 131Q513 131 559 143T633 174T672 219T684 272Q684 301 676 323T642 368T569 415T446 471Q373 502 316 533T218 603T158 692T137 809ZM291 831Q291 794 305 763T350 702T432 646T555 588L590 573Q610 586 630 604T667 645T694
184
696T705 758Q705 796 692 828T647 889T560 947T424 1006Q399 998 376 983T333 945T303 893T291 831Z" />
185
<glyph unicode="&#xa8;" glyph-name="dieresis" horiz-adv-x="1182" d="M307 1395Q307 1449 335 1473T403 1497Q442 1497 471 1473T500 1395Q500 1342 471 1317T403 1292Q363 1292 335 1317T307 1395ZM682 1395Q682 1449 710 1473T778 1497Q797 1497 814 1491T845
186
1473T866 1441T874 1395Q874 1342 845 1317T778 1292Q738 1292 710 1317T682 1395Z" />
187
<glyph unicode="&#xa9;" glyph-name="copyright" horiz-adv-x="1704" d="M891 1053Q830 1053 783 1031T704 968T656 866T639 731Q639 653 653 593T698 492T776 430T891 408Q914 408 941 411T996 421T1053 435T1106 453V322Q1082 311 1058 302T1007 286T950 276T885
188
272Q783 272 707 305T581 399T505 545T479 733Q479 834 506 917T585 1061T714 1154T891 1188Q954 1188 1020 1172T1145 1126L1083 999Q1031 1025 983 1039T891 1053ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231
189
1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384 200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM209 731Q209 598 259 481T397 277T602 139T852 88Q985 88 1102 138T1306 276T1444 481T1495
190
731Q1495 864 1445 981T1307 1185T1102 1323T852 1374Q719 1374 602 1324T398 1186T260 981T209 731Z" />
191
<glyph unicode="&#xaa;" glyph-name="ordfeminine" horiz-adv-x="678" d="M487 797L459 879Q441 857 422 840T379 810T327 791T264 784Q221 784 185 797T123 835T83 899T68 989Q68 1091 138 1145T352 1204L451 1208V1239Q451 1311 421 1339T334 1368Q286 1368
192
241 1354T154 1317L106 1417Q157 1443 215 1461T334 1479Q459 1479 518 1426T578 1251V797H487ZM377 1110Q326 1107 292 1098T238 1074T208 1038T199 987Q199 936 224 914T291 891Q325 891 354 901T404 934T438 988T451 1065V1114L377 1110Z" />
193
<glyph unicode="&#xab;" glyph-name="guillemotleft" horiz-adv-x="997" d="M82 553L391 967L508 889L270 541L508 193L391 115L82 526V553ZM489 553L799 967L915 889L678 541L915 193L799 115L489 526V553Z" />
194
<glyph unicode="&#xac;" glyph-name="logicalnot" horiz-adv-x="1128" d="M1026 797V262H877V647H102V797H1026Z" />
195
<glyph unicode="&#xad;" glyph-name="uni00AD" horiz-adv-x="659" d="M82 465V633H578V465H82Z" />
196
<glyph unicode="&#xae;" glyph-name="registered" horiz-adv-x="1704" d="M743 768H815Q906 768 945 804T985 909Q985 983 944 1012T813 1042H743V768ZM1145 913Q1145 865 1132 828T1096 762T1045 713T985 680Q1052 570 1105 483Q1128 446 1149 411T1186 347T1213
197
302L1223 285H1044L838 637H743V285H586V1178H819Q987 1178 1066 1113T1145 913ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384
198
200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM209 731Q209 598 259 481T397 277T602 139T852 88Q985 88 1102 138T1306 276T1444 481T1495 731Q1495 864 1445 981T1307 1185T1102 1323T852 1374Q719 1374 602 1324T398 1186T260
199
981T209 731Z" />
200
<glyph unicode="&#xaf;" glyph-name="overscore" horiz-adv-x="1024" d="M1030 1556H-6V1696H1030V1556Z" />
201
<glyph unicode="&#xb0;" glyph-name="degree" horiz-adv-x="877" d="M123 1167Q123 1232 148 1289T215 1390T315 1458T438 1483Q503 1483 560 1458T661 1390T729 1290T754 1167Q754 1102 729 1045T661 946T561 879T438 854Q373 854 316 878T216 945T148 1045T123
202
1167ZM246 1167Q246 1128 261 1094T302 1033T363 992T438 977Q478 977 513 992T574 1033T616 1093T631 1167Q631 1207 616 1242T575 1304T513 1346T438 1362Q398 1362 363 1347T302 1305T261 1243T246 1167Z" />
203
<glyph unicode="&#xb1;" glyph-name="plusminus" horiz-adv-x="1128" d="M489 647H102V797H489V1186H639V797H1026V647H639V262H489V647ZM102 0V150H1026V0H102Z" />
204
<glyph unicode="&#xb2;" glyph-name="twosuperior" horiz-adv-x="678" d="M621 586H49V698L258 926Q315 988 351 1030T407 1106T434 1169T442 1233Q442 1298 409 1330T322 1362Q271 1362 225 1337T133 1274L55 1368Q109 1416 175 1448T324 1481Q384 1481 432 1465T515
205
1417T567 1340T586 1237Q586 1187 572 1144T530 1059T464 971T373 870L225 713H621V586Z" />
206
<glyph unicode="&#xb3;" glyph-name="threesuperior" horiz-adv-x="678" d="M590 1255Q590 1177 550 1124T440 1047Q528 1024 572 971T616 840Q616 780 596 730T535 645T430 589T281 569Q211 569 150 581T31 625V758Q94 724 160 705T279 686Q377 686 421 727T465
207
842Q465 916 412 949T262 983H164V1096H262Q354 1096 396 1135T438 1239Q438 1271 428 1294T401 1333T360 1355T309 1362Q250 1362 202 1342T102 1284L33 1380Q62 1403 92 1421T157 1453T229 1473T311 1481Q380 1481 432 1464T520 1417T572 1346T590 1255Z" />
208
<glyph unicode="&#xb4;" glyph-name="acute" horiz-adv-x="1182" d="M393 1268Q415 1297 438 1335T485 1413T530 1494T567 1569H786V1548Q770 1521 739 1481T669 1396T590 1311T514 1241H393V1268Z" />
209
<glyph unicode="&#xb5;" glyph-name="mu" horiz-adv-x="1217" d="M356 391Q356 261 409 196T573 131Q655 131 710 157T798 233T846 358T860 528V1098H1042V0H895L868 147H858Q810 64 738 22T563 -20Q491 -20 438 3T350 68Q351 30 353 -10Q355 -45 355 -87T356
210
-172V-492H174V1098H356V391Z" />
211
<glyph unicode="&#xb6;" glyph-name="paragraph" horiz-adv-x="1341" d="M1126 -260H1006V1397H799V-260H678V559Q617 541 532 541Q437 541 360 566T228 651T143 806T113 1042Q113 1189 145 1287T237 1446T380 1531T563 1556H1126V-260Z" />
212
<glyph unicode="&#xb7;" glyph-name="middot" horiz-adv-x="549" d="M147 723Q147 761 157 787T184 830T224 854T274 862Q300 862 323 855T364 831T391 788T401 723Q401 686 391 660T364 617T324 592T274 584Q247 584 224 592T184 617T157 660T147 723Z" />
213
<glyph unicode="&#xb8;" glyph-name="cedilla" horiz-adv-x="420" d="M408 -287Q408 -384 338 -438T117 -492Q95 -492 73 -489T35 -483V-375Q50 -378 74 -379T115 -381Q186 -381 226 -360T266 -289Q266 -265 253 -248T217 -217T163 -195T94 -176L184 0H305L248
214
-115Q282 -123 311 -136T361 -169T395 -219T408 -287Z" />
215
<glyph unicode="&#xb9;" glyph-name="onesuperior" horiz-adv-x="678" d="M307 1462H442V586H297V1102Q297 1127 297 1157T299 1217T302 1275T305 1325Q291 1308 272 1288T231 1251L137 1178L63 1274L307 1462Z" />
216
<glyph unicode="&#xba;" glyph-name="ordmasculine" horiz-adv-x="717" d="M651 1133Q651 1050 631 985T572 876T479 808T356 784Q293 784 240 807T148 875T88 985T66 1133Q66 1216 86 1280T145 1389T237 1456T360 1479Q422 1479 475 1456T568 1389T629 1281T651
217
1133ZM197 1133Q197 1014 234 954T358 893Q443 893 480 953T518 1133Q518 1253 481 1310T358 1368Q272 1368 235 1311T197 1133Z" />
218
<glyph unicode="&#xbb;" glyph-name="guillemotright" horiz-adv-x="997" d="M918 526L608 115L492 193L729 541L492 889L608 967L918 553V526ZM510 526L201 115L84 193L322 541L84 889L201 967L510 553V526Z" />
219
<glyph unicode="&#xbc;" glyph-name="onequarter" horiz-adv-x="1509" d="M307 1462H442V586H297V1102Q297 1127 297 1157T299 1217T302 1275T305 1325Q291 1308 272 1288T231 1251L137 1178L63 1274L307 1462ZM1202 1462L391 0H234L1045 1462H1202ZM1419 193H1294V1H1151V193H776V304L1153
220
883H1294V320H1419V193ZM1151 320V515Q1151 557 1152 606T1157 705Q1152 694 1142 676T1121 636T1098 595T1077 560L922 320H1151Z" />
221
<glyph unicode="&#xbd;" glyph-name="onehalf" horiz-adv-x="1509" d="M544 1462H679V586H534V1102Q534 1127 534 1157T536 1217T539 1275T542 1325Q528 1308 509 1288T468 1251L374 1178L300 1274L544 1462ZM1181 1462L370 0H213L1024 1462H1181ZM1440 1H868V113L1077
222
341Q1134 403 1170 445T1226 521T1253 584T1261 648Q1261 713 1228 745T1141 777Q1090 777 1044 752T952 689L874 783Q928 831 994 863T1143 896Q1203 896 1251 880T1334 832T1386 755T1405 652Q1405 602 1391 559T1349 474T1283 386T1192 285L1044 128H1440V1Z"
223
/>
224
<glyph unicode="&#xbe;" glyph-name="threequarters" horiz-adv-x="1509" d="M590 1255Q590 1177 550 1124T440 1047Q528 1024 572 971T616 840Q616 780 596 730T535 645T430 589T281 569Q211 569 150 581T31 625V758Q94 724 160 705T279 686Q377 686 421 727T465
225
842Q465 916 412 949T262 983H164V1096H262Q354 1096 396 1135T438 1239Q438 1271 428 1294T401 1333T360 1355T309 1362Q250 1362 202 1342T102 1284L33 1380Q62 1403 92 1421T157 1453T229 1473T311 1481Q380 1481 432 1464T520 1417T572 1346T590 1255ZM1296
226
1462L485 0H328L1139 1462H1296ZM1486 193H1361V1H1218V193H843V304L1220 883H1361V320H1486V193ZM1218 320V515Q1218 557 1219 606T1224 705Q1219 694 1209 676T1188 636T1165 595T1144 560L989 320H1218Z" />
227
<glyph unicode="&#xbf;" glyph-name="questiondown" horiz-adv-x="872" d="M592 676V639Q592 581 584 536T557 450T505 371T422 291Q374 250 340 217T285 149T253 75T242 -18Q242 -66 257 -105T300 -173T371 -217T469 -233Q553 -233 628 -208T772 -147L836 -293Q754
228
-335 660 -364T469 -393Q376 -393 302 -368T176 -294T96 -177T68 -20Q68 48 81 100T121 197T188 284T283 373Q335 418 368 451T420 516T446 580T453 657V676H592ZM639 979Q639 941 630 915T603 872T562 848T512 840Q486 840 463 847T423 871T395 914T385 979Q385
229
1016 395 1042T422 1085T463 1110T512 1118Q539 1118 562 1110T602 1085T629 1042T639 979Z" />
230
<glyph unicode="&#xc0;" glyph-name="Agrave" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM719
231
1579H599Q564 1607 523 1648T444 1734T374 1818T326 1886V1907H545Q561 1873 582 1833T627 1752T674 1673T719 1606V1579Z" />
232
<glyph unicode="&#xc1;" glyph-name="Aacute" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM534
233
1606Q556 1635 579 1673T626 1751T671 1832T708 1907H927V1886Q911 1859 880 1819T810 1734T731 1649T655 1579H534V1606Z" />
234
<glyph unicode="&#xc2;" glyph-name="Acircumflex" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM953
235
1579H832Q781 1613 727 1661T621 1765Q567 1710 514 1662T410 1579H289V1606Q315 1635 349 1673T416 1751T479 1832T525 1907H717Q733 1873 762 1833T825 1752T893 1673T953 1606V1579Z" />
236
<glyph unicode="&#xc3;" glyph-name="Atilde" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM772
237
1581Q732 1581 693 1598T615 1637T542 1676T475 1694Q430 1694 406 1668T368 1579H264Q269 1639 285 1688T328 1771T392 1824T475 1843Q517 1843 557 1826T636 1787T708 1749T772 1731Q817 1731 840 1757T878 1845H983Q978 1785 962 1737T919 1654T855 1600T772
238
1581Z" />
239
<glyph unicode="&#xc4;" glyph-name="Adieresis" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM340
240
1733Q340 1787 368 1811T436 1835Q475 1835 504 1811T533 1733Q533 1680 504 1655T436 1630Q396 1630 368 1655T340 1733ZM715 1733Q715 1787 743 1811T811 1835Q830 1835 847 1829T878 1811T899 1779T907 1733Q907 1680 878 1655T811 1630Q771 1630 743 1655T715
241
1733Z" />
242
<glyph unicode="&#xc5;" glyph-name="Aring" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM848
243
1583Q848 1532 831 1492T783 1423T710 1381T619 1366Q569 1366 528 1380T458 1423T412 1490T396 1581Q396 1632 412 1671T457 1739T528 1781T619 1796Q667 1796 709 1782T782 1740T830 1673T848 1583ZM731 1581Q731 1634 700 1664T619 1694Q569 1694 538 1664T506
244
1581Q506 1528 534 1498T619 1468Q668 1468 699 1498T731 1581Z" />
245
<glyph unicode="&#xc6;" glyph-name="AE" horiz-adv-x="1745" d="M1622 0H862V453H387L184 0H-2L653 1462H1622V1298H1049V846H1583V684H1049V164H1622V0ZM459 618H862V1298H754L459 618Z" />
246
<glyph unicode="&#xc7;" glyph-name="Ccedilla" horiz-adv-x="1235" d="M793 1319Q686 1319 599 1279T451 1162T356 977T322 731Q322 590 351 481T440 296T587 182T793 143Q882 143 962 160T1120 201V39Q1081 24 1042 13T961 -6T870 -16T762 -20Q598 -20 478 34T280
247
187T163 425T125 733Q125 899 168 1037T296 1274T506 1428T793 1483Q901 1483 999 1461T1176 1397L1098 1241Q1035 1273 961 1296T793 1319ZM916 -287Q916 -384 846 -438T625 -492Q603 -492 581 -489T543 -483V-375Q558 -378 582 -379T623 -381Q694 -381 734 -360T774
248
-289Q774 -265 761 -248T725 -217T671 -195T602 -176L692 0H813L756 -115Q790 -123 819 -136T869 -169T903 -219T916 -287Z" />
249
<glyph unicode="&#xc8;" glyph-name="Egrave" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM713 1579H593Q558 1607 517 1648T438 1734T368 1818T320 1886V1907H539Q555 1873 576 1833T621 1752T668 1673T713 1606V1579Z" />
250
<glyph unicode="&#xc9;" glyph-name="Eacute" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM456 1606Q478 1635 501 1673T548 1751T593 1832T630 1907H849V1886Q833 1859 802 1819T732 1734T653 1649T577 1579H456V1606Z" />
251
<glyph unicode="&#xca;" glyph-name="Ecircumflex" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM907 1579H786Q735 1613 681 1661T575 1765Q521 1710 468 1662T364 1579H243V1606Q269 1635 303 1673T370 1751T433 1832T479
252
1907H671Q687 1873 716 1833T779 1752T847 1673T907 1606V1579Z" />
253
<glyph unicode="&#xcb;" glyph-name="Edieresis" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM296 1733Q296 1787 324 1811T392 1835Q431 1835 460 1811T489 1733Q489 1680 460 1655T392 1630Q352 1630 324 1655T296 1733ZM671
254
1733Q671 1787 699 1811T767 1835Q786 1835 803 1829T834 1811T855 1779T863 1733Q863 1680 834 1655T767 1630Q727 1630 699 1655T671 1733Z" />
255
<glyph unicode="&#xcc;" glyph-name="Igrave" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM455 1579H335Q300 1607 259 1648T180 1734T110 1818T62 1886V1907H281Q297 1873 318 1833T363 1752T410 1673T455
256
1606V1579Z" />
257
<glyph unicode="&#xcd;" glyph-name="Iacute" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM257 1606Q279 1635 302 1673T349 1751T394 1832T431 1907H650V1886Q634 1859 603 1819T533 1734T454 1649T378
258
1579H257V1606Z" />
259
<glyph unicode="&#xce;" glyph-name="Icircumflex" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM681 1579H560Q509 1613 455 1661T349 1765Q295 1710 242 1662T138 1579H17V1606Q43 1635 77 1673T144 1751T207
260
1832T253 1907H445Q461 1873 490 1833T553 1752T621 1673T681 1606V1579Z" />
261
<glyph unicode="&#xcf;" glyph-name="Idieresis" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM64 1733Q64 1787 92 1811T160 1835Q199 1835 228 1811T257 1733Q257 1680 228 1655T160 1630Q120 1630 92 1655T64
262
1733ZM439 1733Q439 1787 467 1811T535 1835Q554 1835 571 1829T602 1811T623 1779T631 1733Q631 1680 602 1655T535 1630Q495 1630 467 1655T439 1733Z" />
263
<glyph unicode="&#xd0;" glyph-name="Eth" horiz-adv-x="1401" d="M47 805H199V1462H606Q759 1462 883 1416T1094 1280T1228 1055T1276 745Q1276 560 1228 421T1089 188T866 47T565 0H199V643H47V805ZM1079 739Q1079 885 1046 991T950 1167T795 1269T586 1303H385V805H721V643H385V160H547Q811
264
160 945 306T1079 739Z" />
265
<glyph unicode="&#xd1;" glyph-name="Ntilde" horiz-adv-x="1493" d="M1294 0H1079L360 1210H352Q358 1133 362 1057Q366 992 368 921T371 793V0H199V1462H412L1128 258H1135Q1132 334 1128 408Q1127 440 1126 473T1123 540T1121 605T1120 662V1462H1294V0ZM905
266
1581Q865 1581 826 1598T748 1637T675 1676T608 1694Q563 1694 539 1668T501 1579H397Q402 1639 418 1688T461 1771T525 1824T608 1843Q650 1843 690 1826T769 1787T841 1749T905 1731Q950 1731 973 1757T1011 1845H1116Q1111 1785 1095 1737T1052 1654T988 1600T905
267
1581Z" />
268
<glyph unicode="&#xd2;" glyph-name="Ograve" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
269
733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM870 1579H750Q715 1607 674 1648T595 1734T525 1818T477 1886V1907H696Q712
270
1873 733 1833T778 1752T825 1673T870 1606V1579Z" />
271
<glyph unicode="&#xd3;" glyph-name="Oacute" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
272
733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM651 1606Q673 1635 696 1673T743 1751T788 1832T825 1907H1044V1886Q1028
273
1859 997 1819T927 1734T848 1649T772 1579H651V1606Z" />
274
<glyph unicode="&#xd4;" glyph-name="Ocircumflex" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352
275
1043T1393 733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM1096 1579H975Q924 1613 870 1661T764 1765Q710
276
1710 657 1662T553 1579H432V1606Q458 1635 492 1673T559 1751T622 1832T668 1907H860Q876 1873 905 1833T968 1752T1036 1673T1096 1606V1579Z" />
277
<glyph unicode="&#xd5;" glyph-name="Otilde" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
278
733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM891 1581Q851 1581 812 1598T734 1637T661 1676T594 1694Q549
279
1694 525 1668T487 1579H383Q388 1639 404 1688T447 1771T511 1824T594 1843Q636 1843 676 1826T755 1787T827 1749T891 1731Q936 1731 959 1757T997 1845H1102Q1097 1785 1081 1737T1038 1654T974 1600T891 1581Z" />
280
<glyph unicode="&#xd6;" glyph-name="Odieresis" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
281
733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM477 1733Q477 1787 505 1811T573 1835Q612 1835 641 1811T670
282
1733Q670 1680 641 1655T573 1630Q533 1630 505 1655T477 1733ZM852 1733Q852 1787 880 1811T948 1835Q967 1835 984 1829T1015 1811T1036 1779T1044 1733Q1044 1680 1015 1655T948 1630Q908 1630 880 1655T852 1733Z" />
283
<glyph unicode="&#xd7;" glyph-name="multiply" horiz-adv-x="1128" d="M459 723L141 1042L246 1147L563 829L885 1147L989 1044L668 723L987 403L885 301L563 618L246 303L143 406L459 723Z" />
284
<glyph unicode="&#xd8;" glyph-name="Oslash" horiz-adv-x="1520" d="M1300 1454L1208 1305Q1299 1206 1346 1061T1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q571 -20 438 51L360 -76L223 2L313 147Q216 247 171 396T125 735Q125 905 163 1043T280
285
1280T479 1431T762 1485Q856 1485 936 1464T1083 1405L1163 1532L1300 1454ZM322 733Q322 602 345 498T416 315L995 1260Q947 1289 890 1305T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM1196 733Q1196 990 1108 1141L530 201Q577 173 634 158T760 143Q874
286
143 956 183T1092 300T1171 486T1196 733Z" />
287
<glyph unicode="&#xd9;" glyph-name="Ugrave" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM847
288
1579H727Q692 1607 651 1648T572 1734T502 1818T454 1886V1907H673Q689 1873 710 1833T755 1752T802 1673T847 1606V1579Z" />
289
<glyph unicode="&#xda;" glyph-name="Uacute" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM590
290
1606Q612 1635 635 1673T682 1751T727 1832T764 1907H983V1886Q967 1859 936 1819T866 1734T787 1649T711 1579H590V1606Z" />
291
<glyph unicode="&#xdb;" glyph-name="Ucircumflex" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059
292
512V1464H1245ZM1043 1579H922Q871 1613 817 1661T711 1765Q657 1710 604 1662T500 1579H379V1606Q405 1635 439 1673T506 1751T569 1832T615 1907H807Q823 1873 852 1833T915 1752T983 1673T1043 1606V1579Z" />
293
<glyph unicode="&#xdc;" glyph-name="Udieresis" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM432
294
1733Q432 1787 460 1811T528 1835Q567 1835 596 1811T625 1733Q625 1680 596 1655T528 1630Q488 1630 460 1655T432 1733ZM807 1733Q807 1787 835 1811T903 1835Q922 1835 939 1829T970 1811T991 1779T999 1733Q999 1680 970 1655T903 1630Q863 1630 835 1655T807
295
1733Z" />
296
<glyph unicode="&#xdd;" glyph-name="Yacute" horiz-adv-x="1079" d="M539 723L879 1462H1079L633 569V0H446V559L0 1462H203L539 723ZM442 1606Q464 1635 487 1673T534 1751T579 1832T616 1907H835V1886Q819 1859 788 1819T718 1734T639 1649T563 1579H442V1606Z" />
297
<glyph unicode="&#xde;" glyph-name="Thorn" horiz-adv-x="1180" d="M1075 782Q1075 691 1048 607T957 459T791 356T535 317H385V0H199V1462H385V1210H561Q695 1210 792 1182T952 1099T1045 964T1075 782ZM385 475H514Q607 475 676 491T791 542T860 634T883 772Q883
298
915 801 983T545 1051H385V475Z" />
299
<glyph unicode="&#xdf;" glyph-name="germandbls" horiz-adv-x="1233" d="M1010 1260Q1010 1203 989 1159T936 1078T867 1011T798 954T745 899T723 842Q723 821 730 805T756 769T811 725T903 662Q959 625 1003 589T1077 512T1124 423T1141 313Q1141 226 1113 163T1035
300
60T914 0T758 -20Q661 -20 592 -3T469 49V215Q495 199 527 184T596 156T670 137T745 129Q801 129 841 141T908 176T946 231T958 303Q958 339 950 368T920 426T862 483T770 547Q707 587 665 621T596 688T558 757T547 834Q547 888 567 927T619 998T686 1057T753 1113T804
301
1175T825 1253Q825 1295 809 1326T762 1377T691 1407T598 1417Q549 1417 505 1408T428 1374T376 1309T356 1202V0H174V1200Q174 1304 205 1374T293 1487T428 1548T598 1567Q690 1567 766 1548T896 1491T980 1395T1010 1260Z" />
302
<glyph unicode="&#xe0;" glyph-name="agrave" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
303
374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM934 1241H814Q779
304
1269 738 1310T659 1396T589 1480T541 1548V1569H760Q776 1535 797 1495T842 1414T889 1335T934 1268V1241Z" />
305
<glyph unicode="&#xe1;" glyph-name="aacute" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
306
374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM446 1268Q468 1297
307
491 1335T538 1413T583 1494T620 1569H839V1548Q823 1521 792 1481T722 1396T643 1311T567 1241H446V1268Z" />
308
<glyph unicode="&#xe2;" glyph-name="acircumflex" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445
309
967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM1148 1241H1027Q976
310
1275 922 1323T816 1427Q762 1372 709 1324T605 1241H484V1268Q510 1297 544 1335T611 1413T674 1494T720 1569H912Q928 1535 957 1495T1020 1414T1088 1335T1148 1268V1241Z" />
311
<glyph unicode="&#xe3;" glyph-name="atilde" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
312
374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM955 1243Q915 1243
313
876 1260T798 1299T725 1338T658 1356Q613 1356 589 1330T551 1241H447Q452 1301 468 1350T511 1433T575 1486T658 1505Q700 1505 740 1488T819 1449T891 1411T955 1393Q1000 1393 1023 1419T1061 1507H1166Q1161 1447 1145 1399T1102 1316T1038 1262T955 1243Z"
314
/>
315
<glyph unicode="&#xe4;" glyph-name="adieresis" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445
316
967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM529 1395Q529
317
1449 557 1473T625 1497Q664 1497 693 1473T722 1395Q722 1342 693 1317T625 1292Q585 1292 557 1317T529 1395ZM904 1395Q904 1449 932 1473T1000 1497Q1019 1497 1036 1491T1067 1473T1088 1441T1096 1395Q1096 1342 1067 1317T1000 1292Q960 1292 932 1317T904
318
1395Z" />
319
<glyph unicode="&#xe5;" glyph-name="aring" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
320
374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM1039 1458Q1039
321
1407 1022 1367T974 1298T901 1256T810 1241Q760 1241 719 1255T649 1298T603 1365T587 1456Q587 1507 603 1546T648 1614T719 1656T810 1671Q858 1671 900 1657T973 1615T1021 1548T1039 1458ZM922 1456Q922 1509 891 1539T810 1569Q760 1569 729 1539T697 1456Q697
322
1403 725 1373T810 1343Q859 1343 890 1373T922 1456Z" />
323
<glyph unicode="&#xe6;" glyph-name="ae" horiz-adv-x="1706" d="M94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q659 1118 742 1076T868 940Q919 1025 1002
324
1071T1188 1118Q1285 1118 1362 1083T1493 983T1575 828T1604 627V514H932Q937 321 1010 230T1231 139Q1280 139 1322 144T1404 158T1480 182T1554 215V53Q1515 34 1478 20T1401 -3T1319 -16T1227 -20Q1089 -20 988 37T825 209Q791 155 753 113T668 41T562 -4T430
325
-20Q359 -20 298 -1T191 59T120 161T94 307ZM283 305Q283 213 331 170T459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305ZM1184 967Q1074 967 1011 889T936 662H1407Q1407 730 1394 786T1354 883T1284 945T1184
326
967Z" />
327
<glyph unicode="&#xe7;" glyph-name="ccedilla" horiz-adv-x="948" d="M594 -20Q493 -20 405 11T252 111T150 286T113 543Q113 700 151 809T255 987T411 1087T602 1118Q680 1118 754 1101T879 1059L825 905Q802 915 774 924T716 941T657 953T602 958Q445 958 373
328
858T301 545Q301 334 373 237T594 139Q675 139 740 157T860 201V39Q806 10 745 -5T594 -20ZM730 -287Q730 -384 660 -438T439 -492Q417 -492 395 -489T357 -483V-375Q372 -378 396 -379T437 -381Q508 -381 548 -360T588 -289Q588 -265 575 -248T539 -217T485 -195T416
329
-176L506 0H627L570 -115Q604 -123 633 -136T683 -169T717 -219T730 -287Z" />
330
<glyph unicode="&#xe8;" glyph-name="egrave" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704
331
144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM934 1241H814Q779 1269 738 1310T659 1396T589 1480T541 1548V1569H760Q776 1535 797 1495T842 1414T889
332
1335T934 1268V1241Z" />
333
<glyph unicode="&#xe9;" glyph-name="eacute" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704
334
144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM475 1268Q497 1297 520 1335T567 1413T612 1494T649 1569H868V1548Q852 1521 821 1481T751 1396T672 1311T596
335
1241H475V1268Z" />
336
<glyph unicode="&#xea;" glyph-name="ecircumflex" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139
337
704 144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM1144 1241H1023Q972 1275 918 1323T812 1427Q758 1372 705 1324T601 1241H480V1268Q506 1297 540
338
1335T607 1413T670 1494T716 1569H908Q924 1535 953 1495T1016 1414T1084 1335T1144 1268V1241Z" />
339
<glyph unicode="&#xeb;" glyph-name="edieresis" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139
340
704 144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM525 1395Q525 1449 553 1473T621 1497Q660 1497 689 1473T718 1395Q718 1342 689 1317T621 1292Q581
341
1292 553 1317T525 1395ZM900 1395Q900 1449 928 1473T996 1497Q1015 1497 1032 1491T1063 1473T1084 1441T1092 1395Q1092 1342 1063 1317T996 1292Q956 1292 928 1317T900 1395Z" />
342
<glyph unicode="&#xec;" glyph-name="igrave" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM359 1241H239Q204 1269 163 1310T84 1396T14 1480T-34 1548V1569H185Q201 1535 222 1495T267 1414T314 1335T359 1268V1241Z" />
343
<glyph unicode="&#xed;" glyph-name="iacute" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM185 1268Q207 1297 230 1335T277 1413T322 1494T359 1569H578V1548Q562 1521 531 1481T461 1396T382 1311T306 1241H185V1268Z" />
344
<glyph unicode="&#xee;" glyph-name="icircumflex" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM597 1241H476Q425 1275 371 1323T265 1427Q211 1372 158 1324T54 1241H-67V1268Q-41 1297 -7 1335T60 1413T123 1494T169 1569H361Q377 1535 406 1495T469 1414T537
345
1335T597 1268V1241Z" />
346
<glyph unicode="&#xef;" glyph-name="idieresis" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM-18 1395Q-18 1449 10 1473T78 1497Q117 1497 146 1473T175 1395Q175 1342 146 1317T78 1292Q38 1292 10 1317T-18 1395ZM357 1395Q357 1449 385 1473T453 1497Q472
347
1497 489 1491T520 1473T541 1441T549 1395Q549 1342 520 1317T453 1292Q413 1292 385 1317T357 1395Z" />
348
<glyph unicode="&#xf0;" glyph-name="eth" horiz-adv-x="1182" d="M1069 573Q1069 431 1036 321T940 135T788 20T588 -20Q484 -20 397 13T246 109T147 265T111 477Q111 596 142 688T233 843T376 938T565 971Q667 971 744 942T864 852L872 856Q841 974 781 1070T631
349
1247L375 1094L301 1208L518 1339Q478 1367 436 1394T346 1448L416 1571Q481 1539 542 1503T662 1423L889 1561L963 1448L768 1331Q835 1266 890 1188T985 1017T1047 813T1069 573ZM881 526Q881 582 864 635T812 730T722 796T592 821Q515 821 461 798T371 731T320
350
622T303 471Q303 395 319 333T371 225T461 156T592 131Q746 131 813 230T881 526Z" />
351
<glyph unicode="&#xf1;" glyph-name="ntilde" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1098H322L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860ZM1015
352
1243Q975 1243 936 1260T858 1299T785 1338T718 1356Q673 1356 649 1330T611 1241H507Q512 1301 528 1350T571 1433T635 1486T718 1505Q760 1505 800 1488T879 1449T951 1411T1015 1393Q1060 1393 1083 1419T1121 1507H1226Q1221 1447 1205 1399T1162 1316T1098
353
1262T1015 1243Z" />
354
<glyph unicode="&#xf2;" glyph-name="ograve" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
355
551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM1002 1241H882Q847 1269 806 1310T727 1396T657 1480T609 1548V1569H828Q844 1535 865 1495T910 1414T957 1335T1002 1268V1241Z" />
356
<glyph unicode="&#xf3;" glyph-name="oacute" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
357
551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM473 1268Q495 1297 518 1335T565 1413T610 1494T647 1569H866V1548Q850 1521 819 1481T749 1396T670 1311T594 1241H473V1268Z" />
358
<glyph unicode="&#xf4;" glyph-name="ocircumflex" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069
359
551ZM301 551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM1173 1241H1052Q1001 1275 947 1323T841 1427Q787 1372 734 1324T630 1241H509V1268Q535 1297 569 1335T636 1413T699 1494T745 1569H937Q953
360
1535 982 1495T1045 1414T1113 1335T1173 1268V1241Z" />
361
<glyph unicode="&#xf5;" glyph-name="otilde" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
362
551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM992 1243Q952 1243 913 1260T835 1299T762 1338T695 1356Q650 1356 626 1330T588 1241H484Q489 1301 505 1350T548 1433T612 1486T695 1505Q737 1505 777
363
1488T856 1449T928 1411T992 1393Q1037 1393 1060 1419T1098 1507H1203Q1198 1447 1182 1399T1139 1316T1075 1262T992 1243Z" />
364
<glyph unicode="&#xf6;" glyph-name="odieresis" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069
365
551ZM301 551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM556 1395Q556 1449 584 1473T652 1497Q691 1497 720 1473T749 1395Q749 1342 720 1317T652 1292Q612 1292 584 1317T556 1395ZM931 1395Q931
366
1449 959 1473T1027 1497Q1046 1497 1063 1491T1094 1473T1115 1441T1123 1395Q1123 1342 1094 1317T1027 1292Q987 1292 959 1317T931 1395Z" />
367
<glyph unicode="&#xf7;" glyph-name="divide" horiz-adv-x="1128" d="M102 647V797H1026V647H102ZM449 373Q449 408 458 431T482 470T518 491T563 498Q586 498 607 492T644 470T669 432T678 373Q678 340 669 317T644 278T607 255T563 248Q539 248 519 255T483
368
277T458 316T449 373ZM449 1071Q449 1106 458 1129T482 1168T518 1189T563 1196Q586 1196 607 1190T644 1168T669 1130T678 1071Q678 1038 669 1015T644 976T607 953T563 946Q539 946 519 953T483 975T458 1014T449 1071Z" />
369
<glyph unicode="&#xf8;" glyph-name="oslash" horiz-adv-x="1182" d="M1071 551Q1071 414 1038 308T942 129T790 18T590 -20Q465 -20 367 33L299 -76L168 -2L248 129Q185 201 150 307T115 551Q115 687 148 792T244 970T395 1080T596 1118Q659 1118 715 1104T821
370
1061L889 1169L1020 1096L940 967Q1002 894 1036 790T1071 551ZM303 551Q303 467 312 402T344 285L741 932Q712 949 675 958T592 967Q438 967 371 864T303 551ZM883 551Q883 710 844 809L446 164Q477 147 513 139T594 131Q748 131 815 236T883 551Z" />
371
<glyph unicode="&#xf9;" glyph-name="ugrave" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM949
372
1241H829Q794 1269 753 1310T674 1396T604 1480T556 1548V1569H775Q791 1535 812 1495T857 1414T904 1335T949 1268V1241Z" />
373
<glyph unicode="&#xfa;" glyph-name="uacute" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM489
374
1268Q511 1297 534 1335T581 1413T626 1494T663 1569H882V1548Q866 1521 835 1481T765 1396T686 1311T610 1241H489V1268Z" />
375
<glyph unicode="&#xfb;" glyph-name="ucircumflex" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM930
376
1241H809Q758 1275 704 1323T598 1427Q544 1372 491 1324T387 1241H266V1268Q292 1297 326 1335T393 1413T456 1494T502 1569H694Q710 1535 739 1495T802 1414T870 1335T930 1268V1241Z" />
377
<glyph unicode="&#xfc;" glyph-name="udieresis" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM309
378
1395Q309 1449 337 1473T405 1497Q444 1497 473 1473T502 1395Q502 1342 473 1317T405 1292Q365 1292 337 1317T309 1395ZM684 1395Q684 1449 712 1473T780 1497Q799 1497 816 1491T847 1473T868 1441T876 1395Q876 1342 847 1317T780 1292Q740 1292 712 1317T684
379
1395Z" />
380
<glyph unicode="&#xfd;" glyph-name="yacute" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130
381
-492 92 -487T27 -475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098ZM407 1268Q429 1297 452 1335T499 1413T544 1494T581 1569H800V1548Q784 1521 753 1481T683 1396T604 1311T528 1241H407V1268Z" />
382
<glyph unicode="&#xfe;" glyph-name="thorn" horiz-adv-x="1200" d="M356 950Q379 985 408 1015T475 1068T562 1104T670 1118Q764 1118 841 1082T972 975T1057 797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20Q611 -20 563 -7T477 27T409 78T356 139H344Q347
383
105 350 74Q352 48 354 21T356 -23V-492H174V1556H356V1098L348 950H356ZM635 967Q559 967 507 944T422 874T374 757T356 592V551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
384
<glyph unicode="&#xff;" glyph-name="ydieresis" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130
385
-492 92 -487T27 -475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098ZM484 1395Q484 1449 512 1473T580 1497Q619 1497 648 1473T677 1395Q677 1342 648 1317T580 1292Q540 1292 512 1317T484 1395ZM859 1395Q859
386
1449 887 1473T955 1497Q974 1497 991 1491T1022 1473T1043 1441T1051 1395Q1051 1342 1022 1317T955 1292Q915 1292 887 1317T859 1395Z" />
387
<glyph unicode="&#x2013;" glyph-name="endash" horiz-adv-x="1024" d="M82 465V633H942V465H82Z" />
388
<glyph unicode="&#x2014;" glyph-name="emdash" horiz-adv-x="2048" d="M82 465V633H1966V465H82Z" />
389
<glyph unicode="&#x2018;" glyph-name="quoteleft" horiz-adv-x="358" d="M37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H336Q321 1401 307 1335T279 1204T255 1076T236 961H37Z" />
390
<glyph unicode="&#x2019;" glyph-name="quoteright" horiz-adv-x="358" d="M322 1462L336 1440Q322 1385 303 1325T260 1202T211 1078T160 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H322Z" />
391
<glyph unicode="&#x201a;" glyph-name="quotesinglbase" horiz-adv-x="512" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362Z" />
392
<glyph unicode="&#x201c;" glyph-name="quotedblleft" horiz-adv-x="743" d="M422 961L408 983Q422 1037 441 1098T484 1221T533 1344T584 1462H721Q706 1401 692 1335T664 1204T640 1076T621 961H422ZM37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H336Q321
393
1401 307 1335T279 1204T255 1076T236 961H37Z" />
394
<glyph unicode="&#x201d;" glyph-name="quotedblright" horiz-adv-x="743" d="M322 1462L336 1440Q322 1385 303 1325T260 1202T211 1078T160 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H322ZM707 1462L721 1440Q707 1385 688 1325T645 1202T596 1078T545
395
961H408Q422 1021 436 1087T464 1219T489 1347T508 1462H707Z" />
396
<glyph unicode="&#x201e;" glyph-name="quotedblbase" horiz-adv-x="897" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362ZM748 238L762 215Q748 161 729 100T686 -23T637 -146T586 -264H449Q463
397
-203 477 -137T505 -6T530 122T549 238H748Z" />
398
<glyph unicode="&#x2022;" glyph-name="bullet" horiz-adv-x="770" d="M150 748Q150 819 168 869T217 950T292 996T385 1010Q434 1010 477 996T552 951T602 869T621 748Q621 678 603 628T552 547T477 500T385 485Q335 485 292 500T218 546T168 628T150 748Z" />
399
<glyph unicode="&#x2039;" glyph-name="guilsinglleft" horiz-adv-x="590" d="M82 553L391 967L508 889L270 541L508 193L391 115L82 526V553Z" />
400
<glyph unicode="&#x203a;" glyph-name="guilsinglright" horiz-adv-x="590" d="M508 526L199 115L82 193L319 541L82 889L199 967L508 553V526Z" />
401
</font>
402
</defs>
403
</svg>
(-)a/api/v1/doc/index.html (+243 lines)
Line 0 Link Here
1
<!DOCTYPE html>
2
<html>
3
<head>
4
  <meta charset="UTF-8">
5
  <title>Swagger UI</title>
6
  <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
7
  <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
8
  <link href='css/koha.css' media='screen' rel='stylesheet' type='text/css'/>
9
  <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
10
  <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
11
  <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
12
  <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
13
  <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
14
  <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
15
  <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
16
  <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
17
  <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
18
  <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
19
  <script src='lib/underscore-min.js' type='text/javascript'></script>
20
  <script src='lib/backbone-min.js' type='text/javascript'></script>
21
  <script src='swagger-ui.js' type='text/javascript'></script>
22
  <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
23
  <script src='lib/marked.js' type='text/javascript'></script>
24
  <script src='lib/swagger-oauth.js' type='text/javascript'></script>
25
  <script src="lib/sha256.js" type="text/javascript"></script>
26
27
28
  <!-- Some basic translations -->
29
  <!-- <script src='lang/translator.js' type='text/javascript'></script> -->
30
  <!-- <script src='lang/ru.js' type='text/javascript'></script> -->
31
  <!-- <script src='lang/en.js' type='text/javascript'></script> -->
32
33
  <script type="text/javascript">
34
    $(function () {
35
      var url = window.location.search.match(/url=([^&]+)/);
36
      if (url && url.length > 1) {
37
        url = decodeURIComponent(url[1]);
38
      } else {
39
        url = "/v1/swagger.json"
40
      }
41
42
      // Pre load translate...
43
      if(window.SwaggerTranslator) {
44
        window.SwaggerTranslator.translate();
45
      }
46
      window.swaggerUi = new SwaggerUi({
47
        url: url,
48
        validatorUrl: null,
49
        showRequestHeaders: true,
50
        dom_id: "swagger-ui-container",
51
        supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
52
        onComplete: function(swaggerApi, swaggerUi){
53
          if(typeof initOAuth == "function") {
54
            initOAuth({
55
              clientId: "your-client-id",
56
              clientSecret: "your-client-secret",
57
              realm: "your-realms",
58
              appName: "your-app-name", 
59
              scopeSeparator: ","
60
            });
61
          }
62
63
          if(window.SwaggerTranslator) {
64
            window.SwaggerTranslator.translate();
65
          }
66
67
          $('pre code').each(function(i, e) {
68
            hljs.highlightBlock(e)
69
          });
70
71
          createSubmitTriggersToInjectAuthorizationHeader();
72
        },
73
        onFailure: function(data) {
74
          log("Unable to Load SwaggerUI");
75
        },
76
        docExpansion: "none",
77
        apisSorter: "alpha",
78
        showRequestHeaders: false
79
      });
80
81
      $('#input_apiKey').change(addApiKeyAuthorization);
82
83
      // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
84
      var apiUserid = "1";
85
      $('#input_apiUserid').val(apiUserid);
86
      var apiKey = "NCXF3acaCuvriMhj0tvnQfYBS46uJSdN";
87
      $('#input_apiKey').val(apiKey);
88
89
      // Keep updating the Date header used in authenticating.
90
      var dateHeaderUpdateTimer = window.setInterval(function() {
91
              var d = new Date();
92
              $("#dateHeaderInput").val(d.toGMTString());
93
          },
94
          1000
95
      );
96
97
98
      window.swaggerUi.load();
99
100
      function log() {
101
        if ('console' in window) {
102
          console.log.apply(console, arguments);
103
        }
104
      }
105
  });
106
function createSubmitTriggersToInjectAuthorizationHeader() {
107
    //Create the Authorization-header just before sending the ajax request.
108
    $("input[value='Try it out!']").click(function () {
109
        //Get relevant (and easy to extract) data elements
110
        var operationObjectBaseElement = $(this).parents("li.operation")[0];
111
        var httpVerb = $(operationObjectBaseElement).find("span.http_method > a").text();
112
        var userid = $("#input_apiUserid").val();
113
        var date = $("#dateHeaderInput").val();
114
        var apikey = $("#input_apiKey").val();
115
  
116
        //Create the HMAC SHA-256 hash
117
        var shaObj = new jsSHA("SHA-256", "TEXT");
118
        shaObj.setHMACKey(apikey, "TEXT");
119
        var message = httpVerb.toUpperCase() + " " + userid + " " + date;
120
        shaObj.update(message);
121
  
122
        var authorizationHeader = "Koha " + userid + ":" + shaObj.getHMAC("HEX");
123
        addApiKeyAuthorization(authorizationHeader);
124
        addDateAuthorization();
125
    });
126
}
127
function addApiKeyAuthorization(headerValue){
128
    if(headerValue && headerValue.trim() != "") {
129
        var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", headerValue, "header");
130
        window.swaggerUi.api.clientAuthorizations.add("Authorization", apiKeyAuth);
131
    }
132
}
133
function addDateAuthorization(){
134
  var key = $('#dateHeaderInput')[0].value;
135
  if(key && key.trim() != "") {
136
      var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("X-Koha-Date", key, "header");
137
      window.swaggerUi.api.clientAuthorizations.add("X-Koha-Date", apiKeyAuth);
138
  }
139
}
140
  </script>
141
</head>
142
<body class="swagger-section">
143
<div id='header'>
144
  <div class="swagger-ui-wrap">
145
    <a id="logo" href="http://swagger.io">swagger</a>
146
    <br /><br />
147
    <form id='api_selector' style="background-color: #89BF04; float: none;">
148
      <table style="width: 100%;" style="">
149
        <tr class="border">
150
          <td><label for="input_baseUrl">Swagger specification url:</label></td>
151
          <td><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text" style="width:100%"/></td>
152
        </tr>
153
        <tr>
154
          <td colspan="2"><h2>Koha API Authentication parameters</h2></td>
155
        </tr>
156
        <tr class="border">
157
          <td colspan="2"><p>You need to have a library card to consume our API, then you can add a new API Key for yourself from the OPAC.</p><p>You also need specific permissions to access most of these resources. Ask us!</p></td>
158
        </tr>
159
        <tr>
160
          <td colspan="2"><h3>Authorization-header</h3></td>
161
        </tr>
162
        <tr>
163
          <td><label for="input_apiUserid">Userid:</label></td>
164
          <td><input placeholder="api_userid" id="input_apiUserid" name="apiUserid" type="text" style="width:100%"/></td>
165
        </tr>
166
        <tr class="border">
167
          <td><label for="input_apiKey">Api key:</label></td>
168
          <td><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text" style="width:100%"/></td>
169
        </tr>
170
        <tr>
171
          <td colspan="2"><h3>Date-header</h3></td>
172
        </tr>
173
        <tr>
174
          <td><label for="dateHeaderInput">Date RFC 1123:</label></td>
175
          <td><input placeholder="date RFC 1123" id="dateHeaderInput" name="dateHeaderInput" type="text" style="width:100%"/></td>
176
        </tr>
177
        <tr>
178
          <td colspan="2">
179
            <a href="#authentication"><h2>Authentication system explained:</h2></a>
180
          </td>
181
        </tr>
182
      </table>
183
    </form>
184
  </div>
185
</div>
186
187
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
188
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
189
190
<div id='header'>
191
  <div class="swagger-ui-wrap">
192
    <a id="logo" href="http://swagger.io">swagger</a>
193
    <br /><br />
194
      <table style="width: 100%;" style="">
195
        <tr>
196
          <td colspan="2">
197
            <h2>Authentication system explained:</h2>
198
            <div id="authentication">
199
            <p>For authentication to succeed, the client have to send 2 HTTP headers:</p>
200
            <ul>
201
              <li> X-Koha-Date: the standard HTTP Date header complying to RFC 1123, simply wrapped to X-Koha-Date, since the w3-specification forbids setting the Date-header from javascript.</li>
202
              <li> Authorization: the standard HTTP Authorization header, see below for how it is constructed.</li>
203
            </ul>
204
            <h3>HTTP Request example</h3>
205
            <pre>
206
  GET /api/v1/borrowers/12 HTTP/1.1
207
  Host: api.yourkohadomain.fi
208
  X-Koha-Date: Mon, 26 Mar 2007 19:37:58 +0000
209
  Authorization: Koha admin69:frJIUN8DYpKDtOLCwo//yllqDzg=
210
            </pre>
211
            <h3>Constructing the Authorization header</h3>
212
            <ul>
213
              <li>You brand the authorization header with "Koha"</li>
214
              <li>Then you give the userid/cardnumber of the user authenticating.</li>
215
              <li>Then the hashed signature.</li>
216
            </ul>
217
            <h3>Signature</h3>
218
            <p>The signature is a HMAC-SHA256-HEX hash of several elements of the request, separated by spaces:</p>
219
            <ul>
220
              <li>HTTP method (uppercase)</li>
221
              <li>userid/cardnumber</li>
222
              <li>X-Koha-Date-header</li>
223
            </ul>
224
            <p>Signed with the Borrowers API key</p>
225
            <p>The server then tries to rebuild the signature with each of the user's API keys. If one matches the received signature, then authentication is almost OK.</p>
226
            <p>To avoid requests to be replayed, the last request's X-Koha-Date-header is stored in database and the authentication succeeds only if the stored Date is lesser than the X-Koha-Date-header.</p>
227
            <h3>Constructing the signature example</h3>
228
            <pre>
229
  Signature = HMAC-SHA256-HEX("HTTPS" + " " +
230
                              "/api/v1/borrowers/12?howdoyoudo=voodoo" + " " +
231
                              "admin69" + " " +
232
                              "760818212" + " " +
233
                              "frJIUN8DYpKDtOLCwo//yllqDzg="
234
                             );
235
            </pre>
236
            </div>
237
          </td>
238
        </tr>
239
      </table>
240
  </div>
241
</div>
242
</body>
243
</html>
(-)a/api/v1/doc/lib/backbone-min.js (+15 lines)
Line 0 Link Here
1
// Backbone.js 1.1.2
2
3
(function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
4
5
// From http://stackoverflow.com/a/19431552
6
// Compatibility override - Backbone 1.1 got rid of the 'options' binding
7
// automatically to views in the constructor - we need to keep that.
8
Backbone.View = (function(View) {
9
   return View.extend({
10
        constructor: function(options) {
11
            this.options = options || {};
12
            View.apply(this, arguments);
13
        }
14
    });
15
})(Backbone.View);
(-)a/api/v1/doc/lib/handlebars-2.0.0.js (+28 lines)
Line 0 Link Here
1
/*!
2
3
 handlebars v2.0.0
4
5
Copyright (C) 2011-2014 by Yehuda Katz
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
THE SOFTWARE.
24
25
@license
26
*/
27
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Handlebars=a.Handlebars||b()}(this,function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return i[a]}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a){return a instanceof h?a.toString():null==a?"":a?(a=""+a,k.test(a)?a.replace(j,b):a):a+""}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return(a?a+".":"")+b}var g={},h=a,i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},j=/[&<>"'`]/g,k=/[&<>"'`]/;g.extend=c;var l=Object.prototype.toString;g.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;g.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return g.isArray=n,g.escapeExpression=d,g.isEmpty=e,g.appendContextPath=f,g}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new g("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(k(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=f.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){if(!b)throw new g("Must pass iterator to #each");var c,d,e=b.fn,h=b.inverse,i=0,j="";if(b.data&&b.ids&&(d=f.appendContextPath(b.data.contextPath,b.ids[0])+"."),l(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(k(a))for(var m=a.length;m>i;i++)c&&(c.index=i,c.first=0===i,c.last=i===a.length-1,d&&(c.contextPath=d+i)),j+=e(a[i],{data:c});else for(var n in a)a.hasOwnProperty(n)&&(c&&(c.key=n,c.index=i,c.first=0===i,d&&(c.contextPath=d+n)),j+=e(a[n],{data:c}),i++);return 0===i&&(j=h(this)),j}),a.registerHelper("if",function(a,b){return l(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||f.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){l(a)&&(a=a.call(this));var c=b.fn;if(f.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=q(b.data);d.contextPath=f.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var e={},f=a,g=b,h="2.0.0";e.VERSION=h;var i=6;e.COMPILER_REVISION=i;var j={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};e.REVISION_CHANGES=j;var k=f.isArray,l=f.isFunction,m=f.toString,n="[object Object]";e.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:o,log:p,registerHelper:function(a,b){if(m.call(a)===n){if(b)throw new g("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){m.call(a)===n?f.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(o.level<=a){var c=o.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};e.logger=o;var p=o.log;e.log=p;var q=function(a){var b=f.extend({},a);return b._parent=a,b};return e.createFrame=q,e}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");if(!a||!a.main)throw new l("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,e,f,g,h,i,j,m){g&&(f=k.extend({},f,g));var n=b.VM.invokePartial.call(this,c,e,f,h,i,j,m);if(null==n&&b.compile){var o={helpers:h,partials:i,data:j,depths:m};i[e]=b.compile(c,{data:void 0!==j,compat:a.compat},b),n=i[e](f,o)}if(null!=n){if(d){for(var p=n.split("\n"),q=0,r=p.length;r>q&&(p[q]||q+1!==r);q++)p[q]=d+p[q];n=p.join("\n")}return n}throw new l("The partial "+e+" could not be compiled when running in runtime-only mode")},d={lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c){var d=this.programs[a],e=this.fn(a);return b||c?d=f(this,a,e,b,c):d||(d=this.programs[a]=f(this,a,e)),d},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(b,c){c=c||{};var f=c.data;e._setup(c),!c.partial&&a.useData&&(f=i(b,f));var g;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,f,g)};return e.isTop=!0,e._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},e._child=function(b,c,e){if(a.useDepths&&!e)throw new l("must pass parent depths");return f(d,b,a[b],c,e)},e}function f(a,b,c,d,e){var f=function(b,f){return f=f||{},c.call(a,b,a.helpers,a.partials,f.data||d,e&&[b].concat(e))};return f.program=b,f.depth=e?e.length:0,f}function g(a,b,c,d,e,f,g){var h={partial:!0,helpers:d,partials:e,data:f,depths:g};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,h):void 0}function h(){return""}function i(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;return j.checkRevision=d,j.template=e,j.program=f,j.invokePartial=g,j.noop=h,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,m["default"]=m,f=m}(d,a,c,b,e),g=function(a){"use strict";function b(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var c,d=a,e={ProgramNode:function(a,c,d){b.call(this,d),this.type="program",this.statements=a,this.strip=c},MustacheNode:function(a,c,d,f,g){if(b.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,c),this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,c,d){b.call(this,d),this.type="sexpr",this.hash=c;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=!(!f.length&&!c),this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,c,d,e,f){b.call(this,f),this.type="partial",this.partialName=a,this.context=c,this.hash=d,this.strip=e,this.strip.inlineStandalone=!0},BlockNode:function(a,c,d,e,f){b.call(this,f),this.type="block",this.mustache=a,this.program=c,this.inverse=d,this.strip=e,d&&!c&&(this.isInverse=!0)},RawBlockNode:function(a,c,f,g){if(b.call(this,g),a.sexpr.id.original!==f)throw new d(a.sexpr.id.original+" doesn't match "+f,this);c=new e.ContentNode(c,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([c],{},g)},ContentNode:function(a,c){b.call(this,c),this.type="content",this.original=this.string=a},HashNode:function(a,c){b.call(this,c),this.type="hash",this.pairs=a},IdNode:function(a,c){b.call(this,c),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new d("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,c){b.call(this,c),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,c){b.call(this,c),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,c){b.call(this,c),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,c){b.call(this,c),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,c){b.call(this,c),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,c){b.call(this,c),this.type="comment",this.comment=a,this.strip={inlineStandalone:!0}}};return c=e}(c),h=function(){"use strict";var a,b=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return d.prepareProgram(f[g-1].statements,!0),f[g-1];case 2:this.$=new d.ProgramNode(d.prepareProgram(f[g]),{},this._$);break;case 3:this.$=f[g];break;case 4:this.$=f[g];break;case 5:this.$=f[g];break;case 6:this.$=f[g];break;case 7:this.$=new d.ContentNode(f[g],this._$);break;case 8:this.$=new d.CommentNode(f[g],this._$);break;case 9:this.$=new d.RawBlockNode(f[g-2],f[g-1],f[g],this._$);break;case 10:this.$=new d.MustacheNode(f[g-1],null,"","",this._$);break;case 11:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!1,this._$);break;case 12:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!0,this._$);break;case 13:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 14:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 15:this.$={strip:d.stripFlags(f[g-1],f[g-1]),program:f[g]};break;case 16:this.$={path:f[g-1],strip:d.stripFlags(f[g-2],f[g])};break;case 17:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 18:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 19:this.$=new d.PartialNode(f[g-3],f[g-2],f[g-1],d.stripFlags(f[g-4],f[g]),this._$);break;case 20:this.$=new d.PartialNode(f[g-2],void 0,f[g-1],d.stripFlags(f[g-3],f[g]),this._$);break;case 21:this.$=new d.SexprNode([f[g-2]].concat(f[g-1]),f[g],this._$);break;case 22:this.$=new d.SexprNode([f[g]],null,this._$);break;case 23:this.$=f[g];break;case 24:this.$=new d.StringNode(f[g],this._$);break;case 25:this.$=new d.NumberNode(f[g],this._$);break;case 26:this.$=new d.BooleanNode(f[g],this._$);break;case 27:this.$=f[g];break;case 28:f[g-1].isHelper=!0,this.$=f[g-1];break;case 29:this.$=new d.HashNode(f[g],this._$);break;case 30:this.$=[f[g-2],f[g]];break;case 31:this.$=new d.PartialNameNode(f[g],this._$);break;case 32:this.$=new d.PartialNameNode(new d.StringNode(f[g],this._$),this._$);break;case 33:this.$=new d.PartialNameNode(new d.NumberNode(f[g],this._$));break;case 34:this.$=new d.DataNode(f[g],this._$);break;case 35:this.$=new d.IdNode(f[g],this._$);break;case 36:f[g-2].push({part:f[g],separator:f[g-1]}),this.$=f[g-2];break;case 37:this.$=[{part:f[g]}];break;case 38:this.$=[];break;case 39:f[g-1].push(f[g]);break;case 48:this.$=[];break;case 49:f[g-1].push(f[g]);break;case 52:this.$=[f[g]];break;case 53:f[g-1].push(f[g])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),15;case 4:return 12;case 5:return e(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this.popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState(),this.begin("com");break;case 20:return e(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 26:break;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return b.yytext=e(1,2).replace(/\\"/g,'"'),42;case 30:return b.yytext=e(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return b.yytext=e(1,2),50;case 37:return"INVALID";case 38:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();return a=b}(),i=function(a){"use strict";function b(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(b.length-3)}}function c(a,b,c,d,i,k){if(a.sexpr.id.original!==d.path.original)throw new j(a.sexpr.id.original+" doesn't match "+d.path.original,a);var l=c&&c.program,m={left:a.strip.left,right:d.strip.right,openStandalone:f(b.statements),closeStandalone:e((l||b).statements)};if(a.strip.right&&g(b.statements,null,!0),l){var n=c.strip;n.left&&h(b.statements,null,!0),n.right&&g(l.statements,null,!0),d.strip.left&&h(l.statements,null,!0),e(b.statements)&&f(l.statements)&&(h(b.statements),g(l.statements))}else d.strip.left&&h(b.statements,null,!0);return i?new this.BlockNode(a,l,b,m,k):new this.BlockNode(a,b,l,m,k)}function d(a,b){for(var c=0,d=a.length;d>c;c++){var i=a[c],j=i.strip;if(j){var k=e(a,c,b,"partial"===i.type),l=f(a,c,b),m=j.openStandalone&&k,n=j.closeStandalone&&l,o=j.inlineStandalone&&k&&l;j.right&&g(a,c,!0),j.left&&h(a,c,!0),o&&(g(a,c),h(a,c)&&"partial"===i.type&&(i.indent=/([ \t]+$)/.exec(a[c-1].original)?RegExp.$1:"")),m&&(g((i.program||i.inverse).statements),h(a,c)),n&&(g(a,c),h((i.inverse||i.program).statements))}}return a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"content"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"content"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"content"===d.type&&(c||!d.rightStripped)){var e=d.string;d.string=d.string.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.string!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"content"===d.type&&(c||!d.leftStripped)){var e=d.string;return d.string=d.string.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.string!==e,d.leftStripped}}var i={},j=a;return i.stripFlags=b,i.prepareBlock=c,i.prepareProgram=d,i}(c),j=function(a,b,c,d){"use strict";function e(a){return a.constructor===h.ProgramNode?a:(g.yy=k,g.parse(a))}var f={},g=a,h=b,i=c,j=d.extend;f.parser=g;var k={};return j(k,i,h),f.parse=e,f}(h,g,i,b),k=function(a,b){"use strict";function c(){}function d(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function e(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var e,f=function(a,b){return e||(e=d()),e.call(this,a,b)};return f._setup=function(a){return e||(e=d()),e._setup(a)},f._child=function(a,b,c){return e||(e=d()),e._child(a,b,c)},f}function f(a,b){if(a===b)return!0;if(i(a)&&i(b)&&a.length===b.length){for(var c=0;c<a.length;c++)if(!f(a[c],b[c]))return!1;return!0}}var g={},h=a,i=b.isArray,j=[].slice;return g.Compiler=c,c.prototype={compiler:c,equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!f(d.args,e.args))return!1}for(b=this.children.length,c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){return this[a.type](a)},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;
28
this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c,d=a.pairs;for(this.opcode("pushHash"),b=0,c=d.length;c>b;b++)this.pushParam(d[b][1]);for(;b--;)this.opcode("assignToHash",d[b][0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):(this.opcode("getContext",0),this.opcode("pushContext")),this.opcode("invokePartial",b.name,a.indent||""),this.opcode("append")},content:function(a){a.string&&this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.ID(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new h("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.falsy=!0,this.ID(e),this.opcode("invokeHelper",d.length,e.original,e.isSimple)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts,a.falsy,a.isScoped):this.opcode("pushContext")},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth,a.id.parts)},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:j.call(arguments,1)})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;c>b;b++)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},g.precompile=d,g.compile=e,g}(c,b),l=function(a,b){"use strict";function c(a){this.value=a}function d(){}var e,f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=b;d.prototype={nameLookup:function(a,b){return d.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']"},depthedLookup:function(a){return this.aliases.lookup="this.lookup",'lookup(depths, "'+a+'")'},compilerInfo:function(){var a=f,b=g[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.depths.list.length||this.options.compat;var e,f,g,i=a.opcodes;for(f=0,g=i.length;g>f;f++)e=i[f],this[e.opcode].apply(this,e.args);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new h("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j},l=this.context.programs;for(f=0,g=l.length;g>f;f++)l[f]&&(k[f]=l[f]);return this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),this.useDepths&&(k.useDepths=!0),this.options.compat&&(k.compat=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);var e=["depth0","helpers","partials","data"];this.useDepths&&e.push("depths");var f=this.mergeSource(b);return a?(e.push(f),Function.apply(this,e)):"function("+e.join(",")+") {\n  "+f+"}"},mergeSource:function(a){for(var b,c,d="",e=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?b=b?b+"\n    + "+h.content:h.content:(b&&(d?d+="buffer += "+b+";\n  ":(c=!0,d=b+";\n  "),b=void 0),d+=h+"\n  ",this.environment.isSimple||(e=!1))}return e?(b||!d)&&(d+="return "+(b||'""')+";\n"):(a+=", buffer = "+(c?"":this.initializeBuffer()),d+=b?"return buffer + "+b+";\n":"return buffer;\n"),a&&(d="var "+a.substring(2)+(c?"":";\n  ")+d),d},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=[this.contextName(0)];this.setupParams(a,0,b);var c=this.popStack();b.splice(1,0,c),this.push("blockHelperMissing.call("+b.join(", ")+")")},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=[this.contextName(0)];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.pendingContent=a},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if ("+a+" != null) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c){var d=0,e=a.length;for(c||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[d++]));e>d;d++)this.replaceStack(function(c){var e=this.nameLookup(c,a[d],"context");return b?" && "+e:" != null ? "+e+" : "+c})},lookupData:function(a,b){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data");for(var c=b.length,d=0;c>d;d++)this.replaceStack(function(a){return" && "+this.nameLookup(a,b[d],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda",this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n    "+a.values.join(",\n    ")+"\n  }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing";var d=this.popStack(),e=this.setupHelper(a,b),f=(c?e.name+" || ":"")+d+" || helperMissing";this.push("(("+f+").call("+e.callParams+"))")},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper");this.push("((helper = (helper = "+e+" || "+c+") != null ? helper : helperMissing"+(d.paramsInit?"),("+d.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+d.callParams+") : helper))")},invokePartial:function(a,b){var c=[this.nameLookup("partials",a,"partial"),"'"+b+"'","'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?c.push("data"):this.options.compat&&c.push("undefined"),this.options.compat&&c.push("depths"),this.push("this.invokePartial("+c.join(", ")+")")},assignToHash:function(a){var b,c,d,e=this.popStack();this.trackIds&&(d=this.popStack()),this.stringParams&&(c=this.popStack(),b=this.popStack());var f=this.hash;b&&f.contexts.push("'"+a+"': "+b),c&&f.types.push("'"+a+"': "+c),d&&f.ids.push("'"+a+"': "+d),f.values.push("'"+a+"': ("+e+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:d,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context,!this.precompile),this.context.environments[h]=c,this.useDepths=this.useDepths||d.useDepths):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){var b=this.environment.children[a],c=(b.depths.list,this.useDepths),d=[b.index,"data"];return c&&d.push("depths"),"this.program("+d.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){{var b,d,e,f="";this.isInline()}if(!this.isInline())throw new h("replaceStack on non-inline");var g=this.popStack(!0);if(g instanceof c)f=b=g.value,e=!0;else{d=!this.stackSlot;var i=d?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+g+")",b=this.topStack()}var j=a.call(this,b);e||this.popStack(),d&&this.stackSlot--,this.push("("+f+j+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,d=a.length;d>b;b++){var e=a[b];e instanceof c?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),d=(b?this.inlineStack:this.compileStack).pop();if(!a&&d instanceof c)return d.value;if(!b){if(!this.stackSlot)throw new h("Invalid stack pop");this.stackSlot--}return d},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof c?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:[this.contextName(0)].concat(d).join(", ")}},setupOptions:function(a,b,c){var d,e,f,g={},h=[],i=[],j=[];g.name=this.quotedString(a),g.hash=this.popStack(),this.trackIds&&(g.hashIds=this.popStack()),this.stringParams&&(g.hashTypes=this.popStack(),g.hashContexts=this.popStack()),e=this.popStack(),f=this.popStack(),(f||e)&&(f||(f="this.noop"),e||(e="this.noop"),g.fn=f,g.inverse=e);for(var k=b;k--;)d=this.popStack(),c[k]=d,this.trackIds&&(j[k]=this.popStack()),this.stringParams&&(i[k]=this.popStack(),h[k]=this.popStack());return this.trackIds&&(g.ids="["+j.join(",")+"]"),this.stringParams&&(g.types="["+i.join(",")+"]",g.contexts="["+h.join(",")+"]"),this.options.data&&(g.data="data"),g},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),j=d.RESERVED_WORDS={},k=0,l=i.length;l>k;k++)j[i[k]]=!0;return d.isValidJavaScriptVariableName=function(a){return!d.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},e=d}(d,c),m=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,g["default"]=g,f=g}(f,g,j,k,l);return m});
(-)a/api/v1/doc/lib/highlight.7.3.pack.js (+1 lines)
Line 0 Link Here
1
var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(D,E){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=F.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function G(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);
(-)a/api/v1/doc/lib/jquery-1.8.0.min.js (+2 lines)
Line 0 Link Here
1
/*! jQuery v@1.8.0 jquery.com | jquery.org/license */
2
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bX(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bV.length;while(e--){b=bV[e]+c;if(b in a)return b}return d}function bY(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function bZ(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bY(c)&&(e[f]=p._data(c,"olddisplay",cb(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b$(a,b,c){var d=bO.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function b_(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bU[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bU[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bU[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bU[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bU[e]+"Width"))||0));return f}function ca(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bP.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+b_(a,b,c||(f?"border":"content"),e)+"px"}function cb(a){if(bR[a])return bR[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cz(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cu;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cz(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cz(a,c,d,e,"*",g)),h}function cA(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cB(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cC(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cK(){try{return new a.XMLHttpRequest}catch(b){}}function cL(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cT(){return setTimeout(function(){cM=b},0),cM=p.now()}function cU(a,b){p.each(b,function(b,c){var d=(cS[b]||[]).concat(cS["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cV(a,b,c){var d,e=0,f=0,g=cR.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cM||cT(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cM||cT(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cW(k,j.opts.specialEasing);for(;e<g;e++){d=cR[e].call(j,a,k,j.opts);if(d)return d}return cU(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cW(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(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 cX(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bY(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cb(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cO.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cY(a,b,c,d,e){return new cY.prototype.init(a,b,c,d,e)}function cZ(a,b){var c,d={height:a},e=0;for(;e<4;e+=2-b)c=bU[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function c_(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=r.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete"||e.readyState!=="loading"&&e.addEventListener)setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){p.isFunction(c)&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)(d=p._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=[].slice.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click")){g=p(this),g.context=this;for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){i={},k=[],g[0]=f;for(d=0;d<q;d++)l=o[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&u.push({elem:f,matches:k})}}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){j=u[d],c.currentTarget=j.elem;for(e=0;e<j.matches.length&&!c.isImmediatePropagationStopped();e++){l=j.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,h=((p.event.special[l.origType]||{}).handle||l.handler).apply(j.elem,r),h!==b&&(c.result=h,h===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{ready:{setup:p.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.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){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)Z(a,b[e],c,d)}function be(a,b,c,d,e,f){var g,h=$.setFilters[b.toLowerCase()];return h||Z.error(b),(a||!(g=e))&&bd(a||"*",d,g=[],e),g.length>0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(g[a]=b)};for(;p<q;p++){s.exec(""),a=f[p],j=[],i=0,k=e;while(g=s.exec(a)){n=s.lastIndex=g.index+g[0].length;if(n>i){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="<a name='"+q+"'></a><div name='"+q+"'></div>",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};$.setFilters.nth=$.setFilters.eq,$.filters=$.pseudos,X||($.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),V&&($.order.push("NAME"),$.find.NAME=function(a,b){if(typeof b.getElementsByName!==j)return b.getElementsByName(a)}),Y&&($.order.splice(1,0,"CLASS"),$.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!==j&&!c)return b.getElementsByClassName(a)});try{n.call(i.childNodes,0)[0].nodeType}catch(_){n=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}var ba=Z.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},bb=Z.contains=i.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc=Z.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=bc(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=bc(b);return c};Z.attr=function(a,b){var c,d=ba(a);return d||(b=b.toLowerCase()),$.attrHandle[b]?$.attrHandle[b](a):U||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},Z.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return l=0}),i.compareDocumentPosition?e=function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:(e=function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],g=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return f(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)g.unshift(j),j=j.parentNode;c=e.length,d=g.length;for(var l=0;l<c&&l<d;l++)if(e[l]!==g[l])return f(e[l],g[l]);return l===c?f(a,g[l],-1):f(e[l],b,1)},f=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),Z.uniqueSort=function(a){var b,c=1;if(e){k=l,a.sort(e);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1)}return a};var bl=Z.compile=function(a,b,c){var d,e,f,g=O[a];if(g&&g.context===b)return g;e=bg(a,b,c);for(f=0;d=e[f];f++)e[f]=bj(d,b,c);return g=O[a]=bk(e),g.context=b,g.runs=g.dirruns=0,P.push(a),P.length>$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j<k;j++){p=$.order[j];if(s=L[p].exec(m)){h=$.find[p]((s[1]||"").replace(K,""),q,g);if(h==null)continue;m===r&&(a=a.slice(0,a.length-r.length)+m.replace(L[p],""),a||o.apply(e,n.call(h,0)));break}}}if(a){i=bl(a,b,g),d=i.dirruns++,h==null&&(h=$.find.TAG("*",G.test(a)&&b.parentNode||b));for(j=0;l=h[j];j++)c=i.runs++,i(l,b)&&e.push(l)}return e};h.querySelectorAll&&function(){var a,b=bm,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=i.matchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||i.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=(c[0]||c).ownerDocument||c[0]||c,typeof c.createDocumentFragment=="undefined"&&(c=e),a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.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=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cS[c]=cS[c]||[],cS[c].unshift(b)},prefilter:function(a,b){b?cR.unshift(a):cR.push(a)}}),p.Tween=cY,cY.prototype={constructor:cY,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cY.propHooks[this.prop];return a&&a.get?a.get(this):cY.propHooks._default.get(this)},run:function(a){var b,c=cY.propHooks[this.prop];return this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration),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):cY.propHooks._default.set(this),this}},cY.prototype.init.prototype=cY.prototype,cY.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cY.propHooks.scrollTop=cY.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(cZ(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bY).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cV(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cQ.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:cZ("show"),slideUp:cZ("hide"),slideToggle:cZ("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cY.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cN&&(cN=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cN),cN=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c$=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=c_(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
(-)a/api/v1/doc/lib/jquery.ba-bbq.min.js (+18 lines)
Line 0 Link Here
1
/*
2
 * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
3
 * http://benalman.com/projects/jquery-bbq-plugin/
4
 * 
5
 * Copyright (c) 2010 "Cowboy" Ben Alman
6
 * Dual licensed under the MIT and GPL licenses.
7
 * http://benalman.com/about/license/
8
 */
9
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
10
/*
11
 * jQuery hashchange event - v1.2 - 2/11/2010
12
 * http://benalman.com/projects/jquery-hashchange-plugin/
13
 * 
14
 * Copyright (c) 2010 "Cowboy" Ben Alman
15
 * Dual licensed under the MIT and GPL licenses.
16
 * http://benalman.com/about/license/
17
 */
18
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
(-)a/api/v1/doc/lib/jquery.slideto.min.js (+1 lines)
Line 0 Link Here
1
(function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery);
(-)a/api/v1/doc/lib/jquery.wiggle.min.js (+8 lines)
Line 0 Link Here
1
/*
2
jQuery Wiggle
3
Author: WonderGroup, Jordan Thomas
4
URL: http://labs.wondergroup.com/demos/mini-ui/index.html
5
License: MIT (http://en.wikipedia.org/wiki/MIT_License)
6
*/
7
jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);}
8
if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});};
(-)a/api/v1/doc/lib/marked.js (+1272 lines)
Line 0 Link Here
1
/**
2
 * marked - a markdown parser
3
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
4
 * https://github.com/chjj/marked
5
 */
6
7
;(function() {
8
9
/**
10
 * Block-Level Grammar
11
 */
12
13
var block = {
14
  newline: /^\n+/,
15
  code: /^( {4}[^\n]+\n*)+/,
16
  fences: noop,
17
  hr: /^( *[-*_]){3,} *(?:\n+|$)/,
18
  heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
19
  nptable: noop,
20
  lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
21
  blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
22
  list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
23
  html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
24
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
25
  table: noop,
26
  paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
27
  text: /^[^\n]+/
28
};
29
30
block.bullet = /(?:[*+-]|\d+\.)/;
31
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
32
block.item = replace(block.item, 'gm')
33
  (/bull/g, block.bullet)
34
  ();
35
36
block.list = replace(block.list)
37
  (/bull/g, block.bullet)
38
  ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
39
  ('def', '\\n+(?=' + block.def.source + ')')
40
  ();
41
42
block.blockquote = replace(block.blockquote)
43
  ('def', block.def)
44
  ();
45
46
block._tag = '(?!(?:'
47
  + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
48
  + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
49
  + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
50
51
block.html = replace(block.html)
52
  ('comment', /<!--[\s\S]*?-->/)
53
  ('closed', /<(tag)[\s\S]+?<\/\1>/)
54
  ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
55
  (/tag/g, block._tag)
56
  ();
57
58
block.paragraph = replace(block.paragraph)
59
  ('hr', block.hr)
60
  ('heading', block.heading)
61
  ('lheading', block.lheading)
62
  ('blockquote', block.blockquote)
63
  ('tag', '<' + block._tag)
64
  ('def', block.def)
65
  ();
66
67
/**
68
 * Normal Block Grammar
69
 */
70
71
block.normal = merge({}, block);
72
73
/**
74
 * GFM Block Grammar
75
 */
76
77
block.gfm = merge({}, block.normal, {
78
  fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
79
  paragraph: /^/
80
});
81
82
block.gfm.paragraph = replace(block.paragraph)
83
  ('(?!', '(?!'
84
    + block.gfm.fences.source.replace('\\1', '\\2') + '|'
85
    + block.list.source.replace('\\1', '\\3') + '|')
86
  ();
87
88
/**
89
 * GFM + Tables Block Grammar
90
 */
91
92
block.tables = merge({}, block.gfm, {
93
  nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
94
  table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
95
});
96
97
/**
98
 * Block Lexer
99
 */
100
101
function Lexer(options) {
102
  this.tokens = [];
103
  this.tokens.links = {};
104
  this.options = options || marked.defaults;
105
  this.rules = block.normal;
106
107
  if (this.options.gfm) {
108
    if (this.options.tables) {
109
      this.rules = block.tables;
110
    } else {
111
      this.rules = block.gfm;
112
    }
113
  }
114
}
115
116
/**
117
 * Expose Block Rules
118
 */
119
120
Lexer.rules = block;
121
122
/**
123
 * Static Lex Method
124
 */
125
126
Lexer.lex = function(src, options) {
127
  var lexer = new Lexer(options);
128
  return lexer.lex(src);
129
};
130
131
/**
132
 * Preprocessing
133
 */
134
135
Lexer.prototype.lex = function(src) {
136
  src = src
137
    .replace(/\r\n|\r/g, '\n')
138
    .replace(/\t/g, '    ')
139
    .replace(/\u00a0/g, ' ')
140
    .replace(/\u2424/g, '\n');
141
142
  return this.token(src, true);
143
};
144
145
/**
146
 * Lexing
147
 */
148
149
Lexer.prototype.token = function(src, top, bq) {
150
  var src = src.replace(/^ +$/gm, '')
151
    , next
152
    , loose
153
    , cap
154
    , bull
155
    , b
156
    , item
157
    , space
158
    , i
159
    , l;
160
161
  while (src) {
162
    // newline
163
    if (cap = this.rules.newline.exec(src)) {
164
      src = src.substring(cap[0].length);
165
      if (cap[0].length > 1) {
166
        this.tokens.push({
167
          type: 'space'
168
        });
169
      }
170
    }
171
172
    // code
173
    if (cap = this.rules.code.exec(src)) {
174
      src = src.substring(cap[0].length);
175
      cap = cap[0].replace(/^ {4}/gm, '');
176
      this.tokens.push({
177
        type: 'code',
178
        text: !this.options.pedantic
179
          ? cap.replace(/\n+$/, '')
180
          : cap
181
      });
182
      continue;
183
    }
184
185
    // fences (gfm)
186
    if (cap = this.rules.fences.exec(src)) {
187
      src = src.substring(cap[0].length);
188
      this.tokens.push({
189
        type: 'code',
190
        lang: cap[2],
191
        text: cap[3]
192
      });
193
      continue;
194
    }
195
196
    // heading
197
    if (cap = this.rules.heading.exec(src)) {
198
      src = src.substring(cap[0].length);
199
      this.tokens.push({
200
        type: 'heading',
201
        depth: cap[1].length,
202
        text: cap[2]
203
      });
204
      continue;
205
    }
206
207
    // table no leading pipe (gfm)
208
    if (top && (cap = this.rules.nptable.exec(src))) {
209
      src = src.substring(cap[0].length);
210
211
      item = {
212
        type: 'table',
213
        header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
214
        align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
215
        cells: cap[3].replace(/\n$/, '').split('\n')
216
      };
217
218
      for (i = 0; i < item.align.length; i++) {
219
        if (/^ *-+: *$/.test(item.align[i])) {
220
          item.align[i] = 'right';
221
        } else if (/^ *:-+: *$/.test(item.align[i])) {
222
          item.align[i] = 'center';
223
        } else if (/^ *:-+ *$/.test(item.align[i])) {
224
          item.align[i] = 'left';
225
        } else {
226
          item.align[i] = null;
227
        }
228
      }
229
230
      for (i = 0; i < item.cells.length; i++) {
231
        item.cells[i] = item.cells[i].split(/ *\| */);
232
      }
233
234
      this.tokens.push(item);
235
236
      continue;
237
    }
238
239
    // lheading
240
    if (cap = this.rules.lheading.exec(src)) {
241
      src = src.substring(cap[0].length);
242
      this.tokens.push({
243
        type: 'heading',
244
        depth: cap[2] === '=' ? 1 : 2,
245
        text: cap[1]
246
      });
247
      continue;
248
    }
249
250
    // hr
251
    if (cap = this.rules.hr.exec(src)) {
252
      src = src.substring(cap[0].length);
253
      this.tokens.push({
254
        type: 'hr'
255
      });
256
      continue;
257
    }
258
259
    // blockquote
260
    if (cap = this.rules.blockquote.exec(src)) {
261
      src = src.substring(cap[0].length);
262
263
      this.tokens.push({
264
        type: 'blockquote_start'
265
      });
266
267
      cap = cap[0].replace(/^ *> ?/gm, '');
268
269
      // Pass `top` to keep the current
270
      // "toplevel" state. This is exactly
271
      // how markdown.pl works.
272
      this.token(cap, top, true);
273
274
      this.tokens.push({
275
        type: 'blockquote_end'
276
      });
277
278
      continue;
279
    }
280
281
    // list
282
    if (cap = this.rules.list.exec(src)) {
283
      src = src.substring(cap[0].length);
284
      bull = cap[2];
285
286
      this.tokens.push({
287
        type: 'list_start',
288
        ordered: bull.length > 1
289
      });
290
291
      // Get each top-level item.
292
      cap = cap[0].match(this.rules.item);
293
294
      next = false;
295
      l = cap.length;
296
      i = 0;
297
298
      for (; i < l; i++) {
299
        item = cap[i];
300
301
        // Remove the list item's bullet
302
        // so it is seen as the next token.
303
        space = item.length;
304
        item = item.replace(/^ *([*+-]|\d+\.) +/, '');
305
306
        // Outdent whatever the
307
        // list item contains. Hacky.
308
        if (~item.indexOf('\n ')) {
309
          space -= item.length;
310
          item = !this.options.pedantic
311
            ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
312
            : item.replace(/^ {1,4}/gm, '');
313
        }
314
315
        // Determine whether the next list item belongs here.
316
        // Backpedal if it does not belong in this list.
317
        if (this.options.smartLists && i !== l - 1) {
318
          b = block.bullet.exec(cap[i + 1])[0];
319
          if (bull !== b && !(bull.length > 1 && b.length > 1)) {
320
            src = cap.slice(i + 1).join('\n') + src;
321
            i = l - 1;
322
          }
323
        }
324
325
        // Determine whether item is loose or not.
326
        // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
327
        // for discount behavior.
328
        loose = next || /\n\n(?!\s*$)/.test(item);
329
        if (i !== l - 1) {
330
          next = item.charAt(item.length - 1) === '\n';
331
          if (!loose) loose = next;
332
        }
333
334
        this.tokens.push({
335
          type: loose
336
            ? 'loose_item_start'
337
            : 'list_item_start'
338
        });
339
340
        // Recurse.
341
        this.token(item, false, bq);
342
343
        this.tokens.push({
344
          type: 'list_item_end'
345
        });
346
      }
347
348
      this.tokens.push({
349
        type: 'list_end'
350
      });
351
352
      continue;
353
    }
354
355
    // html
356
    if (cap = this.rules.html.exec(src)) {
357
      src = src.substring(cap[0].length);
358
      this.tokens.push({
359
        type: this.options.sanitize
360
          ? 'paragraph'
361
          : 'html',
362
        pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
363
        text: cap[0]
364
      });
365
      continue;
366
    }
367
368
    // def
369
    if ((!bq && top) && (cap = this.rules.def.exec(src))) {
370
      src = src.substring(cap[0].length);
371
      this.tokens.links[cap[1].toLowerCase()] = {
372
        href: cap[2],
373
        title: cap[3]
374
      };
375
      continue;
376
    }
377
378
    // table (gfm)
379
    if (top && (cap = this.rules.table.exec(src))) {
380
      src = src.substring(cap[0].length);
381
382
      item = {
383
        type: 'table',
384
        header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
385
        align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
386
        cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
387
      };
388
389
      for (i = 0; i < item.align.length; i++) {
390
        if (/^ *-+: *$/.test(item.align[i])) {
391
          item.align[i] = 'right';
392
        } else if (/^ *:-+: *$/.test(item.align[i])) {
393
          item.align[i] = 'center';
394
        } else if (/^ *:-+ *$/.test(item.align[i])) {
395
          item.align[i] = 'left';
396
        } else {
397
          item.align[i] = null;
398
        }
399
      }
400
401
      for (i = 0; i < item.cells.length; i++) {
402
        item.cells[i] = item.cells[i]
403
          .replace(/^ *\| *| *\| *$/g, '')
404
          .split(/ *\| */);
405
      }
406
407
      this.tokens.push(item);
408
409
      continue;
410
    }
411
412
    // top-level paragraph
413
    if (top && (cap = this.rules.paragraph.exec(src))) {
414
      src = src.substring(cap[0].length);
415
      this.tokens.push({
416
        type: 'paragraph',
417
        text: cap[1].charAt(cap[1].length - 1) === '\n'
418
          ? cap[1].slice(0, -1)
419
          : cap[1]
420
      });
421
      continue;
422
    }
423
424
    // text
425
    if (cap = this.rules.text.exec(src)) {
426
      // Top-level should never reach here.
427
      src = src.substring(cap[0].length);
428
      this.tokens.push({
429
        type: 'text',
430
        text: cap[0]
431
      });
432
      continue;
433
    }
434
435
    if (src) {
436
      throw new
437
        Error('Infinite loop on byte: ' + src.charCodeAt(0));
438
    }
439
  }
440
441
  return this.tokens;
442
};
443
444
/**
445
 * Inline-Level Grammar
446
 */
447
448
var inline = {
449
  escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
450
  autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
451
  url: noop,
452
  tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
453
  link: /^!?\[(inside)\]\(href\)/,
454
  reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
455
  nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
456
  strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
457
  em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
458
  code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
459
  br: /^ {2,}\n(?!\s*$)/,
460
  del: noop,
461
  text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
462
};
463
464
inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
465
inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
466
467
inline.link = replace(inline.link)
468
  ('inside', inline._inside)
469
  ('href', inline._href)
470
  ();
471
472
inline.reflink = replace(inline.reflink)
473
  ('inside', inline._inside)
474
  ();
475
476
/**
477
 * Normal Inline Grammar
478
 */
479
480
inline.normal = merge({}, inline);
481
482
/**
483
 * Pedantic Inline Grammar
484
 */
485
486
inline.pedantic = merge({}, inline.normal, {
487
  strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
488
  em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
489
});
490
491
/**
492
 * GFM Inline Grammar
493
 */
494
495
inline.gfm = merge({}, inline.normal, {
496
  escape: replace(inline.escape)('])', '~|])')(),
497
  url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
498
  del: /^~~(?=\S)([\s\S]*?\S)~~/,
499
  text: replace(inline.text)
500
    (']|', '~]|')
501
    ('|', '|https?://|')
502
    ()
503
});
504
505
/**
506
 * GFM + Line Breaks Inline Grammar
507
 */
508
509
inline.breaks = merge({}, inline.gfm, {
510
  br: replace(inline.br)('{2,}', '*')(),
511
  text: replace(inline.gfm.text)('{2,}', '*')()
512
});
513
514
/**
515
 * Inline Lexer & Compiler
516
 */
517
518
function InlineLexer(links, options) {
519
  this.options = options || marked.defaults;
520
  this.links = links;
521
  this.rules = inline.normal;
522
  this.renderer = this.options.renderer || new Renderer;
523
  this.renderer.options = this.options;
524
525
  if (!this.links) {
526
    throw new
527
      Error('Tokens array requires a `links` property.');
528
  }
529
530
  if (this.options.gfm) {
531
    if (this.options.breaks) {
532
      this.rules = inline.breaks;
533
    } else {
534
      this.rules = inline.gfm;
535
    }
536
  } else if (this.options.pedantic) {
537
    this.rules = inline.pedantic;
538
  }
539
}
540
541
/**
542
 * Expose Inline Rules
543
 */
544
545
InlineLexer.rules = inline;
546
547
/**
548
 * Static Lexing/Compiling Method
549
 */
550
551
InlineLexer.output = function(src, links, options) {
552
  var inline = new InlineLexer(links, options);
553
  return inline.output(src);
554
};
555
556
/**
557
 * Lexing/Compiling
558
 */
559
560
InlineLexer.prototype.output = function(src) {
561
  var out = ''
562
    , link
563
    , text
564
    , href
565
    , cap;
566
567
  while (src) {
568
    // escape
569
    if (cap = this.rules.escape.exec(src)) {
570
      src = src.substring(cap[0].length);
571
      out += cap[1];
572
      continue;
573
    }
574
575
    // autolink
576
    if (cap = this.rules.autolink.exec(src)) {
577
      src = src.substring(cap[0].length);
578
      if (cap[2] === '@') {
579
        text = cap[1].charAt(6) === ':'
580
          ? this.mangle(cap[1].substring(7))
581
          : this.mangle(cap[1]);
582
        href = this.mangle('mailto:') + text;
583
      } else {
584
        text = escape(cap[1]);
585
        href = text;
586
      }
587
      out += this.renderer.link(href, null, text);
588
      continue;
589
    }
590
591
    // url (gfm)
592
    if (!this.inLink && (cap = this.rules.url.exec(src))) {
593
      src = src.substring(cap[0].length);
594
      text = escape(cap[1]);
595
      href = text;
596
      out += this.renderer.link(href, null, text);
597
      continue;
598
    }
599
600
    // tag
601
    if (cap = this.rules.tag.exec(src)) {
602
      if (!this.inLink && /^<a /i.test(cap[0])) {
603
        this.inLink = true;
604
      } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
605
        this.inLink = false;
606
      }
607
      src = src.substring(cap[0].length);
608
      out += this.options.sanitize
609
        ? escape(cap[0])
610
        : cap[0];
611
      continue;
612
    }
613
614
    // link
615
    if (cap = this.rules.link.exec(src)) {
616
      src = src.substring(cap[0].length);
617
      this.inLink = true;
618
      out += this.outputLink(cap, {
619
        href: cap[2],
620
        title: cap[3]
621
      });
622
      this.inLink = false;
623
      continue;
624
    }
625
626
    // reflink, nolink
627
    if ((cap = this.rules.reflink.exec(src))
628
        || (cap = this.rules.nolink.exec(src))) {
629
      src = src.substring(cap[0].length);
630
      link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
631
      link = this.links[link.toLowerCase()];
632
      if (!link || !link.href) {
633
        out += cap[0].charAt(0);
634
        src = cap[0].substring(1) + src;
635
        continue;
636
      }
637
      this.inLink = true;
638
      out += this.outputLink(cap, link);
639
      this.inLink = false;
640
      continue;
641
    }
642
643
    // strong
644
    if (cap = this.rules.strong.exec(src)) {
645
      src = src.substring(cap[0].length);
646
      out += this.renderer.strong(this.output(cap[2] || cap[1]));
647
      continue;
648
    }
649
650
    // em
651
    if (cap = this.rules.em.exec(src)) {
652
      src = src.substring(cap[0].length);
653
      out += this.renderer.em(this.output(cap[2] || cap[1]));
654
      continue;
655
    }
656
657
    // code
658
    if (cap = this.rules.code.exec(src)) {
659
      src = src.substring(cap[0].length);
660
      out += this.renderer.codespan(escape(cap[2], true));
661
      continue;
662
    }
663
664
    // br
665
    if (cap = this.rules.br.exec(src)) {
666
      src = src.substring(cap[0].length);
667
      out += this.renderer.br();
668
      continue;
669
    }
670
671
    // del (gfm)
672
    if (cap = this.rules.del.exec(src)) {
673
      src = src.substring(cap[0].length);
674
      out += this.renderer.del(this.output(cap[1]));
675
      continue;
676
    }
677
678
    // text
679
    if (cap = this.rules.text.exec(src)) {
680
      src = src.substring(cap[0].length);
681
      out += escape(this.smartypants(cap[0]));
682
      continue;
683
    }
684
685
    if (src) {
686
      throw new
687
        Error('Infinite loop on byte: ' + src.charCodeAt(0));
688
    }
689
  }
690
691
  return out;
692
};
693
694
/**
695
 * Compile Link
696
 */
697
698
InlineLexer.prototype.outputLink = function(cap, link) {
699
  var href = escape(link.href)
700
    , title = link.title ? escape(link.title) : null;
701
702
  return cap[0].charAt(0) !== '!'
703
    ? this.renderer.link(href, title, this.output(cap[1]))
704
    : this.renderer.image(href, title, escape(cap[1]));
705
};
706
707
/**
708
 * Smartypants Transformations
709
 */
710
711
InlineLexer.prototype.smartypants = function(text) {
712
  if (!this.options.smartypants) return text;
713
  return text
714
    // em-dashes
715
    .replace(/--/g, '\u2014')
716
    // opening singles
717
    .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
718
    // closing singles & apostrophes
719
    .replace(/'/g, '\u2019')
720
    // opening doubles
721
    .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
722
    // closing doubles
723
    .replace(/"/g, '\u201d')
724
    // ellipses
725
    .replace(/\.{3}/g, '\u2026');
726
};
727
728
/**
729
 * Mangle Links
730
 */
731
732
InlineLexer.prototype.mangle = function(text) {
733
  var out = ''
734
    , l = text.length
735
    , i = 0
736
    , ch;
737
738
  for (; i < l; i++) {
739
    ch = text.charCodeAt(i);
740
    if (Math.random() > 0.5) {
741
      ch = 'x' + ch.toString(16);
742
    }
743
    out += '&#' + ch + ';';
744
  }
745
746
  return out;
747
};
748
749
/**
750
 * Renderer
751
 */
752
753
function Renderer(options) {
754
  this.options = options || {};
755
}
756
757
Renderer.prototype.code = function(code, lang, escaped) {
758
  if (this.options.highlight) {
759
    var out = this.options.highlight(code, lang);
760
    if (out != null && out !== code) {
761
      escaped = true;
762
      code = out;
763
    }
764
  }
765
766
  if (!lang) {
767
    return '<pre><code>'
768
      + (escaped ? code : escape(code, true))
769
      + '\n</code></pre>';
770
  }
771
772
  return '<pre><code class="'
773
    + this.options.langPrefix
774
    + escape(lang, true)
775
    + '">'
776
    + (escaped ? code : escape(code, true))
777
    + '\n</code></pre>\n';
778
};
779
780
Renderer.prototype.blockquote = function(quote) {
781
  return '<blockquote>\n' + quote + '</blockquote>\n';
782
};
783
784
Renderer.prototype.html = function(html) {
785
  return html;
786
};
787
788
Renderer.prototype.heading = function(text, level, raw) {
789
  return '<h'
790
    + level
791
    + ' id="'
792
    + this.options.headerPrefix
793
    + raw.toLowerCase().replace(/[^\w]+/g, '-')
794
    + '">'
795
    + text
796
    + '</h'
797
    + level
798
    + '>\n';
799
};
800
801
Renderer.prototype.hr = function() {
802
  return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
803
};
804
805
Renderer.prototype.list = function(body, ordered) {
806
  var type = ordered ? 'ol' : 'ul';
807
  return '<' + type + '>\n' + body + '</' + type + '>\n';
808
};
809
810
Renderer.prototype.listitem = function(text) {
811
  return '<li>' + text + '</li>\n';
812
};
813
814
Renderer.prototype.paragraph = function(text) {
815
  return '<p>' + text + '</p>\n';
816
};
817
818
Renderer.prototype.table = function(header, body) {
819
  return '<table>\n'
820
    + '<thead>\n'
821
    + header
822
    + '</thead>\n'
823
    + '<tbody>\n'
824
    + body
825
    + '</tbody>\n'
826
    + '</table>\n';
827
};
828
829
Renderer.prototype.tablerow = function(content) {
830
  return '<tr>\n' + content + '</tr>\n';
831
};
832
833
Renderer.prototype.tablecell = function(content, flags) {
834
  var type = flags.header ? 'th' : 'td';
835
  var tag = flags.align
836
    ? '<' + type + ' style="text-align:' + flags.align + '">'
837
    : '<' + type + '>';
838
  return tag + content + '</' + type + '>\n';
839
};
840
841
// span level renderer
842
Renderer.prototype.strong = function(text) {
843
  return '<strong>' + text + '</strong>';
844
};
845
846
Renderer.prototype.em = function(text) {
847
  return '<em>' + text + '</em>';
848
};
849
850
Renderer.prototype.codespan = function(text) {
851
  return '<code>' + text + '</code>';
852
};
853
854
Renderer.prototype.br = function() {
855
  return this.options.xhtml ? '<br/>' : '<br>';
856
};
857
858
Renderer.prototype.del = function(text) {
859
  return '<del>' + text + '</del>';
860
};
861
862
Renderer.prototype.link = function(href, title, text) {
863
  if (this.options.sanitize) {
864
    try {
865
      var prot = decodeURIComponent(unescape(href))
866
        .replace(/[^\w:]/g, '')
867
        .toLowerCase();
868
    } catch (e) {
869
      return '';
870
    }
871
    if (prot.indexOf('javascript:') === 0) {
872
      return '';
873
    }
874
  }
875
  var out = '<a href="' + href + '"';
876
  if (title) {
877
    out += ' title="' + title + '"';
878
  }
879
  out += '>' + text + '</a>';
880
  return out;
881
};
882
883
Renderer.prototype.image = function(href, title, text) {
884
  var out = '<img src="' + href + '" alt="' + text + '"';
885
  if (title) {
886
    out += ' title="' + title + '"';
887
  }
888
  out += this.options.xhtml ? '/>' : '>';
889
  return out;
890
};
891
892
/**
893
 * Parsing & Compiling
894
 */
895
896
function Parser(options) {
897
  this.tokens = [];
898
  this.token = null;
899
  this.options = options || marked.defaults;
900
  this.options.renderer = this.options.renderer || new Renderer;
901
  this.renderer = this.options.renderer;
902
  this.renderer.options = this.options;
903
}
904
905
/**
906
 * Static Parse Method
907
 */
908
909
Parser.parse = function(src, options, renderer) {
910
  var parser = new Parser(options, renderer);
911
  return parser.parse(src);
912
};
913
914
/**
915
 * Parse Loop
916
 */
917
918
Parser.prototype.parse = function(src) {
919
  this.inline = new InlineLexer(src.links, this.options, this.renderer);
920
  this.tokens = src.reverse();
921
922
  var out = '';
923
  while (this.next()) {
924
    out += this.tok();
925
  }
926
927
  return out;
928
};
929
930
/**
931
 * Next Token
932
 */
933
934
Parser.prototype.next = function() {
935
  return this.token = this.tokens.pop();
936
};
937
938
/**
939
 * Preview Next Token
940
 */
941
942
Parser.prototype.peek = function() {
943
  return this.tokens[this.tokens.length - 1] || 0;
944
};
945
946
/**
947
 * Parse Text Tokens
948
 */
949
950
Parser.prototype.parseText = function() {
951
  var body = this.token.text;
952
953
  while (this.peek().type === 'text') {
954
    body += '\n' + this.next().text;
955
  }
956
957
  return this.inline.output(body);
958
};
959
960
/**
961
 * Parse Current Token
962
 */
963
964
Parser.prototype.tok = function() {
965
  switch (this.token.type) {
966
    case 'space': {
967
      return '';
968
    }
969
    case 'hr': {
970
      return this.renderer.hr();
971
    }
972
    case 'heading': {
973
      return this.renderer.heading(
974
        this.inline.output(this.token.text),
975
        this.token.depth,
976
        this.token.text);
977
    }
978
    case 'code': {
979
      return this.renderer.code(this.token.text,
980
        this.token.lang,
981
        this.token.escaped);
982
    }
983
    case 'table': {
984
      var header = ''
985
        , body = ''
986
        , i
987
        , row
988
        , cell
989
        , flags
990
        , j;
991
992
      // header
993
      cell = '';
994
      for (i = 0; i < this.token.header.length; i++) {
995
        flags = { header: true, align: this.token.align[i] };
996
        cell += this.renderer.tablecell(
997
          this.inline.output(this.token.header[i]),
998
          { header: true, align: this.token.align[i] }
999
        );
1000
      }
1001
      header += this.renderer.tablerow(cell);
1002
1003
      for (i = 0; i < this.token.cells.length; i++) {
1004
        row = this.token.cells[i];
1005
1006
        cell = '';
1007
        for (j = 0; j < row.length; j++) {
1008
          cell += this.renderer.tablecell(
1009
            this.inline.output(row[j]),
1010
            { header: false, align: this.token.align[j] }
1011
          );
1012
        }
1013
1014
        body += this.renderer.tablerow(cell);
1015
      }
1016
      return this.renderer.table(header, body);
1017
    }
1018
    case 'blockquote_start': {
1019
      var body = '';
1020
1021
      while (this.next().type !== 'blockquote_end') {
1022
        body += this.tok();
1023
      }
1024
1025
      return this.renderer.blockquote(body);
1026
    }
1027
    case 'list_start': {
1028
      var body = ''
1029
        , ordered = this.token.ordered;
1030
1031
      while (this.next().type !== 'list_end') {
1032
        body += this.tok();
1033
      }
1034
1035
      return this.renderer.list(body, ordered);
1036
    }
1037
    case 'list_item_start': {
1038
      var body = '';
1039
1040
      while (this.next().type !== 'list_item_end') {
1041
        body += this.token.type === 'text'
1042
          ? this.parseText()
1043
          : this.tok();
1044
      }
1045
1046
      return this.renderer.listitem(body);
1047
    }
1048
    case 'loose_item_start': {
1049
      var body = '';
1050
1051
      while (this.next().type !== 'list_item_end') {
1052
        body += this.tok();
1053
      }
1054
1055
      return this.renderer.listitem(body);
1056
    }
1057
    case 'html': {
1058
      var html = !this.token.pre && !this.options.pedantic
1059
        ? this.inline.output(this.token.text)
1060
        : this.token.text;
1061
      return this.renderer.html(html);
1062
    }
1063
    case 'paragraph': {
1064
      return this.renderer.paragraph(this.inline.output(this.token.text));
1065
    }
1066
    case 'text': {
1067
      return this.renderer.paragraph(this.parseText());
1068
    }
1069
  }
1070
};
1071
1072
/**
1073
 * Helpers
1074
 */
1075
1076
function escape(html, encode) {
1077
  return html
1078
    .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
1079
    .replace(/</g, '&lt;')
1080
    .replace(/>/g, '&gt;')
1081
    .replace(/"/g, '&quot;')
1082
    .replace(/'/g, '&#39;');
1083
}
1084
1085
function unescape(html) {
1086
  return html.replace(/&([#\w]+);/g, function(_, n) {
1087
    n = n.toLowerCase();
1088
    if (n === 'colon') return ':';
1089
    if (n.charAt(0) === '#') {
1090
      return n.charAt(1) === 'x'
1091
        ? String.fromCharCode(parseInt(n.substring(2), 16))
1092
        : String.fromCharCode(+n.substring(1));
1093
    }
1094
    return '';
1095
  });
1096
}
1097
1098
function replace(regex, opt) {
1099
  regex = regex.source;
1100
  opt = opt || '';
1101
  return function self(name, val) {
1102
    if (!name) return new RegExp(regex, opt);
1103
    val = val.source || val;
1104
    val = val.replace(/(^|[^\[])\^/g, '$1');
1105
    regex = regex.replace(name, val);
1106
    return self;
1107
  };
1108
}
1109
1110
function noop() {}
1111
noop.exec = noop;
1112
1113
function merge(obj) {
1114
  var i = 1
1115
    , target
1116
    , key;
1117
1118
  for (; i < arguments.length; i++) {
1119
    target = arguments[i];
1120
    for (key in target) {
1121
      if (Object.prototype.hasOwnProperty.call(target, key)) {
1122
        obj[key] = target[key];
1123
      }
1124
    }
1125
  }
1126
1127
  return obj;
1128
}
1129
1130
1131
/**
1132
 * Marked
1133
 */
1134
1135
function marked(src, opt, callback) {
1136
  if (callback || typeof opt === 'function') {
1137
    if (!callback) {
1138
      callback = opt;
1139
      opt = null;
1140
    }
1141
1142
    opt = merge({}, marked.defaults, opt || {});
1143
1144
    var highlight = opt.highlight
1145
      , tokens
1146
      , pending
1147
      , i = 0;
1148
1149
    try {
1150
      tokens = Lexer.lex(src, opt)
1151
    } catch (e) {
1152
      return callback(e);
1153
    }
1154
1155
    pending = tokens.length;
1156
1157
    var done = function(err) {
1158
      if (err) {
1159
        opt.highlight = highlight;
1160
        return callback(err);
1161
      }
1162
1163
      var out;
1164
1165
      try {
1166
        out = Parser.parse(tokens, opt);
1167
      } catch (e) {
1168
        err = e;
1169
      }
1170
1171
      opt.highlight = highlight;
1172
1173
      return err
1174
        ? callback(err)
1175
        : callback(null, out);
1176
    };
1177
1178
    if (!highlight || highlight.length < 3) {
1179
      return done();
1180
    }
1181
1182
    delete opt.highlight;
1183
1184
    if (!pending) return done();
1185
1186
    for (; i < tokens.length; i++) {
1187
      (function(token) {
1188
        if (token.type !== 'code') {
1189
          return --pending || done();
1190
        }
1191
        return highlight(token.text, token.lang, function(err, code) {
1192
          if (err) return done(err);
1193
          if (code == null || code === token.text) {
1194
            return --pending || done();
1195
          }
1196
          token.text = code;
1197
          token.escaped = true;
1198
          --pending || done();
1199
        });
1200
      })(tokens[i]);
1201
    }
1202
1203
    return;
1204
  }
1205
  try {
1206
    if (opt) opt = merge({}, marked.defaults, opt);
1207
    return Parser.parse(Lexer.lex(src, opt), opt);
1208
  } catch (e) {
1209
    e.message += '\nPlease report this to https://github.com/chjj/marked.';
1210
    if ((opt || marked.defaults).silent) {
1211
      return '<p>An error occured:</p><pre>'
1212
        + escape(e.message + '', true)
1213
        + '</pre>';
1214
    }
1215
    throw e;
1216
  }
1217
}
1218
1219
/**
1220
 * Options
1221
 */
1222
1223
marked.options =
1224
marked.setOptions = function(opt) {
1225
  merge(marked.defaults, opt);
1226
  return marked;
1227
};
1228
1229
marked.defaults = {
1230
  gfm: true,
1231
  tables: true,
1232
  breaks: false,
1233
  pedantic: false,
1234
  sanitize: false,
1235
  smartLists: false,
1236
  silent: false,
1237
  highlight: null,
1238
  langPrefix: 'lang-',
1239
  smartypants: false,
1240
  headerPrefix: '',
1241
  renderer: new Renderer,
1242
  xhtml: false
1243
};
1244
1245
/**
1246
 * Expose
1247
 */
1248
1249
marked.Parser = Parser;
1250
marked.parser = Parser.parse;
1251
1252
marked.Renderer = Renderer;
1253
1254
marked.Lexer = Lexer;
1255
marked.lexer = Lexer.lex;
1256
1257
marked.InlineLexer = InlineLexer;
1258
marked.inlineLexer = InlineLexer.output;
1259
1260
marked.parse = marked;
1261
1262
if (typeof module !== 'undefined' && typeof exports === 'object') {
1263
  module.exports = marked;
1264
} else if (typeof define === 'function' && define.amd) {
1265
  define(function() { return marked; });
1266
} else {
1267
  this.marked = marked;
1268
}
1269
1270
}).call(function() {
1271
  return this || (typeof window !== 'undefined' ? window : global);
1272
}());
(-)a/api/v1/doc/lib/shred.bundle.js (+2765 lines)
Line 0 Link Here
1
var require = function (file, cwd) {
2
    var resolved = require.resolve(file, cwd || '/');
3
    var mod = require.modules[resolved];
4
    if (!mod) throw new Error(
5
        'Failed to resolve module ' + file + ', tried ' + resolved
6
    );
7
    var res = mod._cached ? mod._cached : mod();
8
    return res;
9
}
10
11
require.paths = [];
12
require.modules = {};
13
require.extensions = [".js",".coffee"];
14
15
require._core = {
16
    'assert': true,
17
    'events': true,
18
    'fs': true,
19
    'path': true,
20
    'vm': true
21
};
22
23
require.resolve = (function () {
24
    return function (x, cwd) {
25
        if (!cwd) cwd = '/';
26
27
        if (require._core[x]) return x;
28
        var path = require.modules.path();
29
        var y = cwd || '.';
30
31
        if (x.match(/^(?:\.\.?\/|\/)/)) {
32
            var m = loadAsFileSync(path.resolve(y, x))
33
                || loadAsDirectorySync(path.resolve(y, x));
34
            if (m) return m;
35
        }
36
37
        var n = loadNodeModulesSync(x, y);
38
        if (n) return n;
39
40
        throw new Error("Cannot find module '" + x + "'");
41
42
        function loadAsFileSync (x) {
43
            if (require.modules[x]) {
44
                return x;
45
            }
46
47
            for (var i = 0; i < require.extensions.length; i++) {
48
                var ext = require.extensions[i];
49
                if (require.modules[x + ext]) return x + ext;
50
            }
51
        }
52
53
        function loadAsDirectorySync (x) {
54
            x = x.replace(/\/+$/, '');
55
            var pkgfile = x + '/package.json';
56
            if (require.modules[pkgfile]) {
57
                var pkg = require.modules[pkgfile]();
58
                var b = pkg.browserify;
59
                if (typeof b === 'object' && b.main) {
60
                    var m = loadAsFileSync(path.resolve(x, b.main));
61
                    if (m) return m;
62
                }
63
                else if (typeof b === 'string') {
64
                    var m = loadAsFileSync(path.resolve(x, b));
65
                    if (m) return m;
66
                }
67
                else if (pkg.main) {
68
                    var m = loadAsFileSync(path.resolve(x, pkg.main));
69
                    if (m) return m;
70
                }
71
            }
72
73
            return loadAsFileSync(x + '/index');
74
        }
75
76
        function loadNodeModulesSync (x, start) {
77
            var dirs = nodeModulesPathsSync(start);
78
            for (var i = 0; i < dirs.length; i++) {
79
                var dir = dirs[i];
80
                var m = loadAsFileSync(dir + '/' + x);
81
                if (m) return m;
82
                var n = loadAsDirectorySync(dir + '/' + x);
83
                if (n) return n;
84
            }
85
86
            var m = loadAsFileSync(x);
87
            if (m) return m;
88
        }
89
90
        function nodeModulesPathsSync (start) {
91
            var parts;
92
            if (start === '/') parts = [ '' ];
93
            else parts = path.normalize(start).split('/');
94
95
            var dirs = [];
96
            for (var i = parts.length - 1; i >= 0; i--) {
97
                if (parts[i] === 'node_modules') continue;
98
                var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
99
                dirs.push(dir);
100
            }
101
102
            return dirs;
103
        }
104
    };
105
})();
106
107
require.alias = function (from, to) {
108
    var path = require.modules.path();
109
    var res = null;
110
    try {
111
        res = require.resolve(from + '/package.json', '/');
112
    }
113
    catch (err) {
114
        res = require.resolve(from, '/');
115
    }
116
    var basedir = path.dirname(res);
117
118
    var keys = (Object.keys || function (obj) {
119
        var res = [];
120
        for (var key in obj) res.push(key)
121
        return res;
122
    })(require.modules);
123
124
    for (var i = 0; i < keys.length; i++) {
125
        var key = keys[i];
126
        if (key.slice(0, basedir.length + 1) === basedir + '/') {
127
            var f = key.slice(basedir.length);
128
            require.modules[to + f] = require.modules[basedir + f];
129
        }
130
        else if (key === basedir) {
131
            require.modules[to] = require.modules[basedir];
132
        }
133
    }
134
};
135
136
require.define = function (filename, fn) {
137
    var dirname = require._core[filename]
138
        ? ''
139
        : require.modules.path().dirname(filename)
140
    ;
141
142
    var require_ = function (file) {
143
        return require(file, dirname)
144
    };
145
    require_.resolve = function (name) {
146
        return require.resolve(name, dirname);
147
    };
148
    require_.modules = require.modules;
149
    require_.define = require.define;
150
    var module_ = { exports : {} };
151
152
    require.modules[filename] = function () {
153
        require.modules[filename]._cached = module_.exports;
154
        fn.call(
155
            module_.exports,
156
            require_,
157
            module_,
158
            module_.exports,
159
            dirname,
160
            filename
161
        );
162
        require.modules[filename]._cached = module_.exports;
163
        return module_.exports;
164
    };
165
};
166
167
if (typeof process === 'undefined') process = {};
168
169
if (!process.nextTick) process.nextTick = (function () {
170
    var queue = [];
171
    var canPost = typeof window !== 'undefined'
172
        && window.postMessage && window.addEventListener
173
    ;
174
175
    if (canPost) {
176
        window.addEventListener('message', function (ev) {
177
            if (ev.source === window && ev.data === 'browserify-tick') {
178
                ev.stopPropagation();
179
                if (queue.length > 0) {
180
                    var fn = queue.shift();
181
                    fn();
182
                }
183
            }
184
        }, true);
185
    }
186
187
    return function (fn) {
188
        if (canPost) {
189
            queue.push(fn);
190
            window.postMessage('browserify-tick', '*');
191
        }
192
        else setTimeout(fn, 0);
193
    };
194
})();
195
196
if (!process.title) process.title = 'browser';
197
198
if (!process.binding) process.binding = function (name) {
199
    if (name === 'evals') return require('vm')
200
    else throw new Error('No such module')
201
};
202
203
if (!process.cwd) process.cwd = function () { return '.' };
204
205
require.define("path", function (require, module, exports, __dirname, __filename) {
206
    function filter (xs, fn) {
207
    var res = [];
208
    for (var i = 0; i < xs.length; i++) {
209
        if (fn(xs[i], i, xs)) res.push(xs[i]);
210
    }
211
    return res;
212
}
213
214
// resolves . and .. elements in a path array with directory names there
215
// must be no slashes, empty elements, or device names (c:\) in the array
216
// (so also no leading and trailing slashes - it does not distinguish
217
// relative and absolute paths)
218
function normalizeArray(parts, allowAboveRoot) {
219
  // if the path tries to go above the root, `up` ends up > 0
220
  var up = 0;
221
  for (var i = parts.length; i >= 0; i--) {
222
    var last = parts[i];
223
    if (last == '.') {
224
      parts.splice(i, 1);
225
    } else if (last === '..') {
226
      parts.splice(i, 1);
227
      up++;
228
    } else if (up) {
229
      parts.splice(i, 1);
230
      up--;
231
    }
232
  }
233
234
  // if the path is allowed to go above the root, restore leading ..s
235
  if (allowAboveRoot) {
236
    for (; up--; up) {
237
      parts.unshift('..');
238
    }
239
  }
240
241
  return parts;
242
}
243
244
// Regex to split a filename into [*, dir, basename, ext]
245
// posix version
246
var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
247
248
// path.resolve([from ...], to)
249
// posix version
250
exports.resolve = function() {
251
var resolvedPath = '',
252
    resolvedAbsolute = false;
253
254
for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
255
  var path = (i >= 0)
256
      ? arguments[i]
257
      : process.cwd();
258
259
  // Skip empty and invalid entries
260
  if (typeof path !== 'string' || !path) {
261
    continue;
262
  }
263
264
  resolvedPath = path + '/' + resolvedPath;
265
  resolvedAbsolute = path.charAt(0) === '/';
266
}
267
268
// At this point the path should be resolved to a full absolute path, but
269
// handle relative paths to be safe (might happen when process.cwd() fails)
270
271
// Normalize the path
272
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
273
    return !!p;
274
  }), !resolvedAbsolute).join('/');
275
276
  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
277
};
278
279
// path.normalize(path)
280
// posix version
281
exports.normalize = function(path) {
282
var isAbsolute = path.charAt(0) === '/',
283
    trailingSlash = path.slice(-1) === '/';
284
285
// Normalize the path
286
path = normalizeArray(filter(path.split('/'), function(p) {
287
    return !!p;
288
  }), !isAbsolute).join('/');
289
290
  if (!path && !isAbsolute) {
291
    path = '.';
292
  }
293
  if (path && trailingSlash) {
294
    path += '/';
295
  }
296
297
  return (isAbsolute ? '/' : '') + path;
298
};
299
300
301
// posix version
302
exports.join = function() {
303
  var paths = Array.prototype.slice.call(arguments, 0);
304
  return exports.normalize(filter(paths, function(p, index) {
305
    return p && typeof p === 'string';
306
  }).join('/'));
307
};
308
309
310
exports.dirname = function(path) {
311
  var dir = splitPathRe.exec(path)[1] || '';
312
  var isWindows = false;
313
  if (!dir) {
314
    // No dirname
315
    return '.';
316
  } else if (dir.length === 1 ||
317
      (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
318
    // It is just a slash or a drive letter with a slash
319
    return dir;
320
  } else {
321
    // It is a full dirname, strip trailing slash
322
    return dir.substring(0, dir.length - 1);
323
  }
324
};
325
326
327
exports.basename = function(path, ext) {
328
  var f = splitPathRe.exec(path)[2] || '';
329
  // TODO: make this comparison case-insensitive on windows?
330
  if (ext && f.substr(-1 * ext.length) === ext) {
331
    f = f.substr(0, f.length - ext.length);
332
  }
333
  return f;
334
};
335
336
337
exports.extname = function(path) {
338
  return splitPathRe.exec(path)[3] || '';
339
};
340
341
});
342
343
require.define("/shred.js", function (require, module, exports, __dirname, __filename) {
344
    // Shred is an HTTP client library intended to simplify the use of Node's
345
// built-in HTTP library. In particular, we wanted to make it easier to interact
346
// with HTTP-based APIs.
347
//
348
// See the [examples](./examples.html) for more details.
349
350
// Ax is a nice logging library we wrote. You can use any logger, providing it
351
// has `info`, `warn`, `debug`, and `error` methods that take a string.
352
var Ax = require("ax")
353
  , CookieJarLib = require( "cookiejar" )
354
  , CookieJar = CookieJarLib.CookieJar
355
;
356
357
// Shred takes some options, including a logger and request defaults.
358
359
var Shred = function(options) {
360
  options = (options||{});
361
  this.agent = options.agent;
362
  this.defaults = options.defaults||{};
363
  this.log = options.logger||(new Ax({ level: "info" }));
364
  this._sharedCookieJar = new CookieJar();
365
  this.logCurl = options.logCurl || false;
366
};
367
368
// Most of the real work is done in the request and reponse classes.
369
370
Shred.Request = require("./shred/request");
371
Shred.Response = require("./shred/response");
372
373
// The `request` method kicks off a new request, instantiating a new `Request`
374
// object and passing along whatever default options we were given.
375
376
Shred.prototype = {
377
  request: function(options) {
378
    options.logger = this.log;
379
    options.logCurl = options.logCurl || this.logCurl;
380
    options.cookieJar = ( 'cookieJar' in options ) ? options.cookieJar : this._sharedCookieJar; // let them set cookieJar = null
381
    options.agent = options.agent || this.agent;
382
    // fill in default options
383
    for (var key in this.defaults) {
384
      if (this.defaults.hasOwnProperty(key) && !options[key]) {
385
        options[key] = this.defaults[key]
386
      }
387
    }
388
    return new Shred.Request(options);
389
  }
390
};
391
392
// Define a bunch of convenience methods so that you don't have to include
393
// a `method` property in your request options.
394
395
"get put post delete".split(" ").forEach(function(method) {
396
  Shred.prototype[method] = function(options) {
397
    options.method = method;
398
    return this.request(options);
399
  };
400
});
401
402
403
module.exports = Shred;
404
405
});
406
407
require.define("/node_modules/ax/package.json", function (require, module, exports, __dirname, __filename) {
408
    module.exports = {"main":"./lib/ax.js"}
409
});
410
411
require.define("/node_modules/ax/lib/ax.js", function (require, module, exports, __dirname, __filename) {
412
    var inspect = require("util").inspect
413
  , fs = require("fs")
414
;
415
416
417
// this is a quick-and-dirty logger. there are other nicer loggers out there
418
// but the ones i found were also somewhat involved. this one has a Ruby
419
// logger type interface
420
//
421
// we can easily replace this, provide the info, debug, etc. methods are the
422
// same. or, we can change Haiku to use a more standard node.js interface
423
424
var format = function(level,message) {
425
  var debug = (level=="debug"||level=="error");
426
  if (!message) { return message.toString(); }
427
  if (typeof(message) == "object") {
428
    if (message instanceof Error && debug) {
429
      return message.stack;
430
    } else {
431
      return inspect(message);
432
    }
433
  } else {
434
    return message.toString();
435
  }
436
};
437
438
var noOp = function(message) { return this; }
439
var makeLogger = function(level,fn) {
440
  return function(message) {
441
    this.stream.write(this.format(level, message)+"\n");
442
    return this;
443
  }
444
};
445
446
var Logger = function(options) {
447
  var logger = this;
448
  var options = options||{};
449
450
  // Default options
451
  options.level = options.level || "info";
452
  options.timestamp = options.timestamp || true;
453
  options.prefix = options.prefix || "";
454
  logger.options = options;
455
456
  // Allows a prefix to be added to the message.
457
  //
458
  //    var logger = new Ax({ module: 'Haiku' })
459
  //    logger.warn('this is going to be awesome!');
460
  //    //=> Haiku: this is going to be awesome!
461
  //
462
  if (logger.options.module){
463
    logger.options.prefix = logger.options.module;
464
  }
465
466
  // Write to stderr or a file
467
  if (logger.options.file){
468
    logger.stream = fs.createWriteStream(logger.options.file, {"flags": "a"});
469
  } else {
470
      if(process.title === "node")
471
    logger.stream = process.stderr;
472
      else if(process.title === "browser")
473
    logger.stream = function () {
474
      // Work around weird console context issue: http://code.google.com/p/chromium/issues/detail?id=48662
475
      return console[logger.options.level].apply(console, arguments);
476
    };
477
  }
478
479
  switch(logger.options.level){
480
    case 'debug':
481
      ['debug', 'info', 'warn'].forEach(function (level) {
482
        logger[level] = Logger.writer(level);
483
      });
484
    case 'info':
485
      ['info', 'warn'].forEach(function (level) {
486
        logger[level] = Logger.writer(level);
487
      });
488
    case 'warn':
489
      logger.warn = Logger.writer('warn');
490
  }
491
}
492
493
// Used to define logger methods
494
Logger.writer = function(level){
495
  return function(message){
496
    var logger = this;
497
498
    if(process.title === "node")
499
  logger.stream.write(logger.format(level, message) + '\n');
500
    else if(process.title === "browser")
501
  logger.stream(logger.format(level, message) + '\n');
502
503
  };
504
}
505
506
507
Logger.prototype = {
508
  info: function(){},
509
  debug: function(){},
510
  warn: function(){},
511
  error: Logger.writer('error'),
512
  format: function(level, message){
513
    if (! message) return '';
514
515
    var logger = this
516
      , prefix = logger.options.prefix
517
      , timestamp = logger.options.timestamp ? " " + (new Date().toISOString()) : ""
518
    ;
519
520
    return (prefix + timestamp + ": " + message);
521
  }
522
};
523
524
module.exports = Logger;
525
526
});
527
528
require.define("util", function (require, module, exports, __dirname, __filename) {
529
    // todo
530
531
});
532
533
require.define("fs", function (require, module, exports, __dirname, __filename) {
534
    // nothing to see here... no file methods for the browser
535
536
});
537
538
require.define("/node_modules/cookiejar/package.json", function (require, module, exports, __dirname, __filename) {
539
    module.exports = {"main":"cookiejar.js"}
540
});
541
542
require.define("/node_modules/cookiejar/cookiejar.js", function (require, module, exports, __dirname, __filename) {
543
    exports.CookieAccessInfo=CookieAccessInfo=function CookieAccessInfo(domain,path,secure,script) {
544
    if(this instanceof CookieAccessInfo) {
545
      this.domain=domain||undefined;
546
      this.path=path||"/";
547
      this.secure=!!secure;
548
      this.script=!!script;
549
      return this;
550
    }
551
    else {
552
        return new CookieAccessInfo(domain,path,secure,script)
553
    }
554
}
555
556
exports.Cookie=Cookie=function Cookie(cookiestr) {
557
  if(cookiestr instanceof Cookie) {
558
    return cookiestr;
559
  }
560
    else {
561
        if(this instanceof Cookie) {
562
          this.name = null;
563
          this.value = null;
564
          this.expiration_date = Infinity;
565
          this.path = "/";
566
          this.domain = null;
567
          this.secure = false; //how to define?
568
          this.noscript = false; //httponly
569
          if(cookiestr) {
570
            this.parse(cookiestr)
571
          }
572
          return this;
573
        }
574
        return new Cookie(cookiestr)
575
    }
576
}
577
578
Cookie.prototype.toString = function toString() {
579
  var str=[this.name+"="+this.value];
580
  if(this.expiration_date !== Infinity) {
581
    str.push("expires="+(new Date(this.expiration_date)).toGMTString());
582
  }
583
  if(this.domain) {
584
    str.push("domain="+this.domain);
585
  }
586
  if(this.path) {
587
    str.push("path="+this.path);
588
  }
589
  if(this.secure) {
590
    str.push("secure");
591
  }
592
  if(this.noscript) {
593
    str.push("httponly");
594
  }
595
  return str.join("; ");
596
}
597
598
Cookie.prototype.toValueString = function toValueString() {
599
  return this.name+"="+this.value;
600
}
601
602
var cookie_str_splitter=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g
603
Cookie.prototype.parse = function parse(str) {
604
  if(this instanceof Cookie) {
605
      var parts=str.split(";")
606
      , pair=parts[0].match(/([^=]+)=((?:.|\n)*)/)
607
      , key=pair[1]
608
      , value=pair[2];
609
      this.name = key;
610
      this.value = value;
611
612
      for(var i=1;i<parts.length;i++) {
613
        pair=parts[i].match(/([^=]+)(?:=((?:.|\n)*))?/)
614
        , key=pair[1].trim().toLowerCase()
615
        , value=pair[2];
616
        switch(key) {
617
          case "httponly":
618
            this.noscript = true;
619
          break;
620
          case "expires":
621
            this.expiration_date = value
622
              ? Number(Date.parse(value))
623
              : Infinity;
624
          break;
625
          case "path":
626
            this.path = value
627
              ? value.trim()
628
              : "";
629
          break;
630
          case "domain":
631
            this.domain = value
632
              ? value.trim()
633
              : "";
634
          break;
635
          case "secure":
636
            this.secure = true;
637
          break
638
        }
639
      }
640
641
      return this;
642
  }
643
    return new Cookie().parse(str)
644
}
645
646
Cookie.prototype.matches = function matches(access_info) {
647
  if(this.noscript && access_info.script
648
  || this.secure && !access_info.secure
649
  || !this.collidesWith(access_info)) {
650
    return false
651
  }
652
  return true;
653
}
654
655
Cookie.prototype.collidesWith = function collidesWith(access_info) {
656
  if((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
657
    return false
658
  }
659
  if(this.path && access_info.path.indexOf(this.path) !== 0) {
660
    return false;
661
  }
662
  if (this.domain===access_info.domain) {
663
    return true;
664
  }
665
  else if(this.domain && this.domain.charAt(0)===".")
666
  {
667
    var wildcard=access_info.domain.indexOf(this.domain.slice(1))
668
    if(wildcard===-1 || wildcard!==access_info.domain.length-this.domain.length+1) {
669
      return false;
670
    }
671
  }
672
  else if(this.domain){
673
    return false
674
  }
675
  return true;
676
}
677
678
exports.CookieJar=CookieJar=function CookieJar() {
679
  if(this instanceof CookieJar) {
680
      var cookies = {} //name: [Cookie]
681
682
      this.setCookie = function setCookie(cookie) {
683
        cookie = Cookie(cookie);
684
        //Delete the cookie if the set is past the current time
685
        var remove = cookie.expiration_date <= Date.now();
686
        if(cookie.name in cookies) {
687
          var cookies_list = cookies[cookie.name];
688
          for(var i=0;i<cookies_list.length;i++) {
689
            var collidable_cookie = cookies_list[i];
690
            if(collidable_cookie.collidesWith(cookie)) {
691
              if(remove) {
692
                cookies_list.splice(i,1);
693
                if(cookies_list.length===0) {
694
                  delete cookies[cookie.name]
695
                }
696
                return false;
697
              }
698
              else {
699
                return cookies_list[i]=cookie;
700
              }
701
            }
702
          }
703
          if(remove) {
704
            return false;
705
          }
706
          cookies_list.push(cookie);
707
          return cookie;
708
        }
709
        else if(remove){
710
          return false;
711
        }
712
        else {
713
          return cookies[cookie.name]=[cookie];
714
        }
715
      }
716
      //returns a cookie
717
      this.getCookie = function getCookie(cookie_name,access_info) {
718
        var cookies_list = cookies[cookie_name];
719
        for(var i=0;i<cookies_list.length;i++) {
720
          var cookie = cookies_list[i];
721
          if(cookie.expiration_date <= Date.now()) {
722
            if(cookies_list.length===0) {
723
              delete cookies[cookie.name]
724
            }
725
            continue;
726
          }
727
          if(cookie.matches(access_info)) {
728
            return cookie;
729
          }
730
        }
731
      }
732
      //returns a list of cookies
733
      this.getCookies = function getCookies(access_info) {
734
        var matches=[];
735
        for(var cookie_name in cookies) {
736
          var cookie=this.getCookie(cookie_name,access_info);
737
          if (cookie) {
738
            matches.push(cookie);
739
          }
740
        }
741
        matches.toString=function toString(){return matches.join(":");}
742
            matches.toValueString=function() {return matches.map(function(c){return c.toValueString();}).join(';');}
743
        return matches;
744
      }
745
746
      return this;
747
  }
748
    return new CookieJar()
749
}
750
751
752
//returns list of cookies that were set correctly
753
CookieJar.prototype.setCookies = function setCookies(cookies) {
754
  cookies=Array.isArray(cookies)
755
    ?cookies
756
    :cookies.split(cookie_str_splitter);
757
  var successful=[]
758
  for(var i=0;i<cookies.length;i++) {
759
    var cookie = Cookie(cookies[i]);
760
    if(this.setCookie(cookie)) {
761
      successful.push(cookie);
762
    }
763
  }
764
  return successful;
765
}
766
767
});
768
769
require.define("/shred/request.js", function (require, module, exports, __dirname, __filename) {
770
    // The request object encapsulates a request, creating a Node.js HTTP request and
771
// then handling the response.
772
773
var HTTP = require("http")
774
  , HTTPS = require("https")
775
  , parseUri = require("./parseUri")
776
  , Emitter = require('events').EventEmitter
777
  , sprintf = require("sprintf").sprintf
778
  , Response = require("./response")
779
  , HeaderMixins = require("./mixins/headers")
780
  , Content = require("./content")
781
;
782
783
var STATUS_CODES = HTTP.STATUS_CODES || {
784
    100 : 'Continue',
785
    101 : 'Switching Protocols',
786
    102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
787
    200 : 'OK',
788
    201 : 'Created',
789
    202 : 'Accepted',
790
    203 : 'Non-Authoritative Information',
791
    204 : 'No Content',
792
    205 : 'Reset Content',
793
    206 : 'Partial Content',
794
    207 : 'Multi-Status', // RFC 4918
795
    300 : 'Multiple Choices',
796
    301 : 'Moved Permanently',
797
    302 : 'Moved Temporarily',
798
    303 : 'See Other',
799
    304 : 'Not Modified',
800
    305 : 'Use Proxy',
801
    307 : 'Temporary Redirect',
802
    400 : 'Bad Request',
803
    401 : 'Unauthorized',
804
    402 : 'Payment Required',
805
    403 : 'Forbidden',
806
    404 : 'Not Found',
807
    405 : 'Method Not Allowed',
808
    406 : 'Not Acceptable',
809
    407 : 'Proxy Authentication Required',
810
    408 : 'Request Time-out',
811
    409 : 'Conflict',
812
    410 : 'Gone',
813
    411 : 'Length Required',
814
    412 : 'Precondition Failed',
815
    413 : 'Request Entity Too Large',
816
    414 : 'Request-URI Too Large',
817
    415 : 'Unsupported Media Type',
818
    416 : 'Requested Range Not Satisfiable',
819
    417 : 'Expectation Failed',
820
    418 : 'I\'m a teapot', // RFC 2324
821
    422 : 'Unprocessable Entity', // RFC 4918
822
    423 : 'Locked', // RFC 4918
823
    424 : 'Failed Dependency', // RFC 4918
824
    425 : 'Unordered Collection', // RFC 4918
825
    426 : 'Upgrade Required', // RFC 2817
826
    500 : 'Internal Server Error',
827
    501 : 'Not Implemented',
828
    502 : 'Bad Gateway',
829
    503 : 'Service Unavailable',
830
    504 : 'Gateway Time-out',
831
    505 : 'HTTP Version not supported',
832
    506 : 'Variant Also Negotiates', // RFC 2295
833
    507 : 'Insufficient Storage', // RFC 4918
834
    509 : 'Bandwidth Limit Exceeded',
835
    510 : 'Not Extended' // RFC 2774
836
};
837
838
// The Shred object itself constructs the `Request` object. You should rarely
839
// need to do this directly.
840
841
var Request = function(options) {
842
  this.log = options.logger;
843
  this.cookieJar = options.cookieJar;
844
  this.encoding = options.encoding;
845
  this.logCurl = options.logCurl;
846
  processOptions(this,options||{});
847
  createRequest(this);
848
};
849
850
// A `Request` has a number of properties, many of which help with details like
851
// URL parsing or defaulting the port for the request.
852
853
Object.defineProperties(Request.prototype, {
854
855
// - **url**. You can set the `url` property with a valid URL string and all the
856
//   URL-related properties (host, port, etc.) will be automatically set on the
857
//   request object.
858
859
  url: {
860
    get: function() {
861
      if (!this.scheme) { return null; }
862
      return sprintf("%s://%s:%s%s",
863
          this.scheme, this.host, this.port,
864
          (this.proxy ? "/" : this.path) +
865
          (this.query ? ("?" + this.query) : ""));
866
    },
867
    set: function(_url) {
868
      _url = parseUri(_url);
869
      this.scheme = _url.protocol;
870
      this.host = _url.host;
871
      this.port = _url.port;
872
      this.path = _url.path;
873
      this.query = _url.query;
874
      return this;
875
    },
876
    enumerable: true
877
  },
878
879
// - **headers**. Returns a hash representing the request headers. You can't set
880
//   this directly, only get it. You can add or modify headers by using the
881
//   `setHeader` or `setHeaders` method. This ensures that the headers are
882
//   normalized - that is, you don't accidentally send `Content-Type` and
883
//   `content-type` headers. Keep in mind that if you modify the returned hash,
884
//   it will *not* modify the request headers.
885
886
  headers: {
887
    get: function() {
888
      return this.getHeaders();
889
    },
890
    enumerable: true
891
  },
892
893
// - **port**. Unless you set the `port` explicitly or include it in the URL, it
894
//   will default based on the scheme.
895
896
  port: {
897
    get: function() {
898
      if (!this._port) {
899
        switch(this.scheme) {
900
          case "https": return this._port = 443;
901
          case "http":
902
          default: return this._port = 80;
903
        }
904
      }
905
      return this._port;
906
    },
907
    set: function(value) { this._port = value; return this; },
908
    enumerable: true
909
  },
910
911
// - **method**. The request method - `get`, `put`, `post`, etc. that will be
912
//   used to make the request. Defaults to `get`.
913
914
  method: {
915
    get: function() {
916
      return this._method = (this._method||"GET");
917
    },
918
    set: function(value) {
919
      this._method = value; return this;
920
    },
921
    enumerable: true
922
  },
923
924
// - **query**. Can be set either with a query string or a hash (object). Get
925
//   will always return a properly escaped query string or null if there is no
926
//   query component for the request.
927
928
  query: {
929
    get: function() {return this._query;},
930
    set: function(value) {
931
      var stringify = function (hash) {
932
        var query = "";
933
        for (var key in hash) {
934
          query += encodeURIComponent(key) + '=' + encodeURIComponent(hash[key]) + '&';
935
        }
936
        // Remove the last '&'
937
        query = query.slice(0, -1);
938
        return query;
939
      }
940
941
      if (value) {
942
        if (typeof value === 'object') {
943
          value = stringify(value);
944
        }
945
        this._query = value;
946
      } else {
947
        this._query = "";
948
      }
949
      return this;
950
    },
951
    enumerable: true
952
  },
953
954
// - **parameters**. This will return the query parameters in the form of a hash
955
//   (object).
956
957
  parameters: {
958
    get: function() { return QueryString.parse(this._query||""); },
959
    enumerable: true
960
  },
961
962
// - **content**. (Aliased as `body`.) Set this to add a content entity to the
963
//   request. Attempts to use the `content-type` header to determine what to do
964
//   with the content value. Get this to get back a [`Content`
965
//   object](./content.html).
966
967
  body: {
968
    get: function() { return this._body; },
969
    set: function(value) {
970
      this._body = new Content({
971
        data: value,
972
        type: this.getHeader("Content-Type")
973
      });
974
      this.setHeader("Content-Type",this.content.type);
975
      this.setHeader("Content-Length",this.content.length);
976
      return this;
977
    },
978
    enumerable: true
979
  },
980
981
// - **timeout**. Used to determine how long to wait for a response. Does not
982
//   distinguish between connect timeouts versus request timeouts. Set either in
983
//   milliseconds or with an object with temporal attributes (hours, minutes,
984
//   seconds) and convert it into milliseconds. Get will always return
985
//   milliseconds.
986
987
  timeout: {
988
    get: function() { return this._timeout; }, // in milliseconds
989
    set: function(timeout) {
990
      var request = this
991
        , milliseconds = 0;
992
      ;
993
      if (!timeout) return this;
994
      if (typeof timeout==="number") { milliseconds = timeout; }
995
      else {
996
        milliseconds = (timeout.milliseconds||0) +
997
          (1000 * ((timeout.seconds||0) +
998
              (60 * ((timeout.minutes||0) +
999
                (60 * (timeout.hours||0))))));
1000
      }
1001
      this._timeout = milliseconds;
1002
      return this;
1003
    },
1004
    enumerable: true
1005
  }
1006
});
1007
1008
// Alias `body` property to `content`. Since the [content object](./content.html)
1009
// has a `body` attribute, it's preferable to use `content` since you can then
1010
// access the raw content data using `content.body`.
1011
1012
Object.defineProperty(Request.prototype,"content",
1013
    Object.getOwnPropertyDescriptor(Request.prototype, "body"));
1014
1015
// The `Request` object can be pretty overwhelming to view using the built-in
1016
// Node.js inspect method. We want to make it a bit more manageable. This
1017
// probably goes [too far in the other
1018
// direction](https://github.com/spire-io/shred/issues/2).
1019
1020
Request.prototype.inspect = function () {
1021
  var request = this;
1022
  var headers = this.format_headers();
1023
  var summary = ["<Shred Request> ", request.method.toUpperCase(),
1024
      request.url].join(" ")
1025
  return [ summary, "- Headers:", headers].join("\n");
1026
};
1027
1028
Request.prototype.format_headers = function () {
1029
  var array = []
1030
  var headers = this._headers
1031
  for (var key in headers) {
1032
    if (headers.hasOwnProperty(key)) {
1033
      var value = headers[key]
1034
      array.push("\t" + key + ": " + value);
1035
    }
1036
  }
1037
  return array.join("\n");
1038
};
1039
1040
// Allow chainable 'on's:  shred.get({ ... }).on( ... ).  You can pass in a
1041
// single function, a pair (event, function), or a hash:
1042
// { event: function, event: function }
1043
Request.prototype.on = function (eventOrHash, listener) {
1044
  var emitter = this.emitter;
1045
  // Pass in a single argument as a function then make it the default response handler
1046
  if (arguments.length === 1 && typeof(eventOrHash) === 'function') {
1047
    emitter.on('response', eventOrHash);
1048
  } else if (arguments.length === 1 && typeof(eventOrHash) === 'object') {
1049
    for (var key in eventOrHash) {
1050
      if (eventOrHash.hasOwnProperty(key)) {
1051
        emitter.on(key, eventOrHash[key]);
1052
      }
1053
    }
1054
  } else {
1055
    emitter.on(eventOrHash, listener);
1056
  }
1057
  return this;
1058
};
1059
1060
// Add in the header methods. Again, these ensure we don't get the same header
1061
// multiple times with different case conventions.
1062
HeaderMixins.gettersAndSetters(Request);
1063
1064
// `processOptions` is called from the constructor to handle all the work
1065
// associated with making sure we do our best to ensure we have a valid request.
1066
1067
var processOptions = function(request,options) {
1068
1069
  request.log.debug("Processing request options ..");
1070
1071
  // We'll use `request.emitter` to manage the `on` event handlers.
1072
  request.emitter = (new Emitter);
1073
1074
  request.agent = options.agent;
1075
1076
  // Set up the handlers ...
1077
  if (options.on) {
1078
    for (var key in options.on) {
1079
      if (options.on.hasOwnProperty(key)) {
1080
        request.emitter.on(key, options.on[key]);
1081
      }
1082
    }
1083
  }
1084
1085
  // Make sure we were give a URL or a host
1086
  if (!options.url && !options.host) {
1087
    request.emitter.emit("request_error",
1088
        new Error("No url or url options (host, port, etc.)"));
1089
    return;
1090
  }
1091
1092
  // Allow for the [use of a proxy](http://www.jmarshall.com/easy/http/#proxies).
1093
1094
  if (options.url) {
1095
    if (options.proxy) {
1096
      request.url = options.proxy;
1097
      request.path = options.url;
1098
    } else {
1099
      request.url = options.url;
1100
    }
1101
  }
1102
1103
  // Set the remaining options.
1104
  request.query = options.query||options.parameters||request.query ;
1105
  request.method = options.method;
1106
  request.setHeader("user-agent",options.agent||"Shred");
1107
  request.setHeaders(options.headers);
1108
1109
  if (request.cookieJar) {
1110
    var cookies = request.cookieJar.getCookies( CookieAccessInfo( request.host, request.path ) );
1111
    if (cookies.length) {
1112
      var cookieString = request.getHeader('cookie')||'';
1113
      for (var cookieIndex = 0; cookieIndex < cookies.length; ++cookieIndex) {
1114
          if ( cookieString.length && cookieString[ cookieString.length - 1 ] != ';' )
1115
          {
1116
              cookieString += ';';
1117
          }
1118
          cookieString += cookies[ cookieIndex ].name + '=' + cookies[ cookieIndex ].value + ';';
1119
      }
1120
      request.setHeader("cookie", cookieString);
1121
    }
1122
  }
1123
1124
  // The content entity can be set either using the `body` or `content` attributes.
1125
  if (options.body||options.content) {
1126
    request.content = options.body||options.content;
1127
  }
1128
  request.timeout = options.timeout;
1129
1130
};
1131
1132
// `createRequest` is also called by the constructor, after `processOptions`.
1133
// This actually makes the request and processes the response, so `createRequest`
1134
// is a bit of a misnomer.
1135
1136
var createRequest = function(request) {
1137
  var timeout ;
1138
1139
  request.log.debug("Creating request ..");
1140
  request.log.debug(request);
1141
1142
  var reqParams = {
1143
    host: request.host,
1144
    port: request.port,
1145
    method: request.method,
1146
    path: request.path + (request.query ? '?'+request.query : ""),
1147
    headers: request.getHeaders(),
1148
    // Node's HTTP/S modules will ignore this, but we are using the
1149
    // browserify-http module in the browser for both HTTP and HTTPS, and this
1150
    // is how you differentiate the two.
1151
    scheme: request.scheme,
1152
    // Use a provided agent.  'Undefined' is the default, which uses a global
1153
    // agent.
1154
    agent: request.agent
1155
  };
1156
1157
  if (request.logCurl) {
1158
    logCurl(request);
1159
  }
1160
1161
  var http = request.scheme == "http" ? HTTP : HTTPS;
1162
1163
  // Set up the real request using the selected library. The request won't be
1164
  // sent until we call `.end()`.
1165
  request._raw = http.request(reqParams, function(response) {
1166
    request.log.debug("Received response ..");
1167
1168
    // We haven't timed out and we have a response, so make sure we clear the
1169
    // timeout so it doesn't fire while we're processing the response.
1170
    clearTimeout(timeout);
1171
1172
    // Construct a Shred `Response` object from the response. This will stream
1173
    // the response, thus the need for the callback. We can access the response
1174
    // entity safely once we're in the callback.
1175
    response = new Response(response, request, function(response) {
1176
1177
      // Set up some event magic. The precedence is given first to
1178
      // status-specific handlers, then to responses for a given event, and then
1179
      // finally to the more general `response` handler. In the last case, we
1180
      // need to first make sure we're not dealing with a a redirect.
1181
      var emit = function(event) {
1182
        var emitter = request.emitter;
1183
        var textStatus = STATUS_CODES[response.status] ? STATUS_CODES[response.status].toLowerCase() : null;
1184
        if (emitter.listeners(response.status).length > 0 || emitter.listeners(textStatus).length > 0) {
1185
          emitter.emit(response.status, response);
1186
          emitter.emit(textStatus, response);
1187
        } else {
1188
          if (emitter.listeners(event).length>0) {
1189
            emitter.emit(event, response);
1190
          } else if (!response.isRedirect) {
1191
            emitter.emit("response", response);
1192
            //console.warn("Request has no event listener for status code " + response.status);
1193
          }
1194
        }
1195
      };
1196
1197
      // Next, check for a redirect. We simply repeat the request with the URL
1198
      // given in the `Location` header. We fire a `redirect` event.
1199
      if (response.isRedirect) {
1200
        request.log.debug("Redirecting to "
1201
            + response.getHeader("Location"));
1202
        request.url = response.getHeader("Location");
1203
        emit("redirect");
1204
        createRequest(request);
1205
1206
      // Okay, it's not a redirect. Is it an error of some kind?
1207
      } else if (response.isError) {
1208
        emit("error");
1209
      } else {
1210
      // It looks like we're good shape. Trigger the `success` event.
1211
        emit("success");
1212
      }
1213
    });
1214
  });
1215
1216
  // We're still setting up the request. Next, we're going to handle error cases
1217
  // where we have no response. We don't emit an error event because that event
1218
  // takes a response. We don't response handlers to have to check for a null
1219
  // value. However, we [should introduce a different event
1220
  // type](https://github.com/spire-io/shred/issues/3) for this type of error.
1221
  request._raw.on("error", function(error) {
1222
    request.emitter.emit("request_error", error);
1223
  });
1224
1225
  request._raw.on("socket", function(socket) {
1226
    request.emitter.emit("socket", socket);
1227
  });
1228
1229
  // TCP timeouts should also trigger the "response_error" event.
1230
  request._raw.on('socket', function () {
1231
    request._raw.socket.on('timeout', function () {
1232
      // This should trigger the "error" event on the raw request, which will
1233
      // trigger the "response_error" on the shred request.
1234
      request._raw.abort();
1235
    });
1236
  });
1237
1238
1239
  // We're almost there. Next, we need to write the request entity to the
1240
  // underlying request object.
1241
  if (request.content) {
1242
    request.log.debug("Streaming body: '" +
1243
        request.content.data.slice(0,59) + "' ... ");
1244
    request._raw.write(request.content.data);
1245
  }
1246
1247
  // Finally, we need to set up the timeout. We do this last so that we don't
1248
  // start the clock ticking until the last possible moment.
1249
  if (request.timeout) {
1250
    timeout = setTimeout(function() {
1251
      request.log.debug("Timeout fired, aborting request ...");
1252
      request._raw.abort();
1253
      request.emitter.emit("timeout", request);
1254
    },request.timeout);
1255
  }
1256
1257
  // The `.end()` method will cause the request to fire. Technically, it might
1258
  // have already sent the headers and body.
1259
  request.log.debug("Sending request ...");
1260
  request._raw.end();
1261
};
1262
1263
// Logs the curl command for the request.
1264
var logCurl = function (req) {
1265
  var headers = req.getHeaders();
1266
  var headerString = "";
1267
1268
  for (var key in headers) {
1269
    headerString += '-H "' + key + ": " + headers[key] + '" ';
1270
  }
1271
1272
  var bodyString = ""
1273
1274
  if (req.content) {
1275
    bodyString += "-d '" + req.content.body + "' ";
1276
  }
1277
1278
  var query = req.query ? '?' + req.query : "";
1279
1280
  console.log("curl " +
1281
    "-X " + req.method.toUpperCase() + " " +
1282
    req.scheme + "://" + req.host + ":" + req.port + req.path + query + " " +
1283
    headerString +
1284
    bodyString
1285
  );
1286
};
1287
1288
1289
module.exports = Request;
1290
1291
});
1292
1293
require.define("http", function (require, module, exports, __dirname, __filename) {
1294
    // todo
1295
1296
});
1297
1298
require.define("https", function (require, module, exports, __dirname, __filename) {
1299
    // todo
1300
1301
});
1302
1303
require.define("/shred/parseUri.js", function (require, module, exports, __dirname, __filename) {
1304
    // parseUri 1.2.2
1305
// (c) Steven Levithan <stevenlevithan.com>
1306
// MIT License
1307
1308
function parseUri (str) {
1309
  var o   = parseUri.options,
1310
    m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
1311
    uri = {},
1312
    i   = 14;
1313
1314
  while (i--) uri[o.key[i]] = m[i] || "";
1315
1316
  uri[o.q.name] = {};
1317
  uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
1318
    if ($1) uri[o.q.name][$1] = $2;
1319
  });
1320
1321
  return uri;
1322
};
1323
1324
parseUri.options = {
1325
  strictMode: false,
1326
  key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
1327
  q:   {
1328
    name:   "queryKey",
1329
    parser: /(?:^|&)([^&=]*)=?([^&]*)/g
1330
  },
1331
  parser: {
1332
    strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
1333
    loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
1334
  }
1335
};
1336
1337
module.exports = parseUri;
1338
1339
});
1340
1341
require.define("events", function (require, module, exports, __dirname, __filename) {
1342
    if (!process.EventEmitter) process.EventEmitter = function () {};
1343
1344
var EventEmitter = exports.EventEmitter = process.EventEmitter;
1345
var isArray = typeof Array.isArray === 'function'
1346
    ? Array.isArray
1347
    : function (xs) {
1348
        return Object.toString.call(xs) === '[object Array]'
1349
    }
1350
;
1351
1352
// By default EventEmitters will print a warning if more than
1353
// 10 listeners are added to it. This is a useful default which
1354
// helps finding memory leaks.
1355
//
1356
// Obviously not all Emitters should be limited to 10. This function allows
1357
// that to be increased. Set to zero for unlimited.
1358
var defaultMaxListeners = 10;
1359
EventEmitter.prototype.setMaxListeners = function(n) {
1360
  if (!this._events) this._events = {};
1361
  this._events.maxListeners = n;
1362
};
1363
1364
1365
EventEmitter.prototype.emit = function(type) {
1366
  // If there is no 'error' event listener then throw.
1367
  if (type === 'error') {
1368
    if (!this._events || !this._events.error ||
1369
        (isArray(this._events.error) && !this._events.error.length))
1370
    {
1371
      if (arguments[1] instanceof Error) {
1372
        throw arguments[1]; // Unhandled 'error' event
1373
      } else {
1374
        throw new Error("Uncaught, unspecified 'error' event.");
1375
      }
1376
      return false;
1377
    }
1378
  }
1379
1380
  if (!this._events) return false;
1381
  var handler = this._events[type];
1382
  if (!handler) return false;
1383
1384
  if (typeof handler == 'function') {
1385
    switch (arguments.length) {
1386
      // fast cases
1387
      case 1:
1388
        handler.call(this);
1389
        break;
1390
      case 2:
1391
        handler.call(this, arguments[1]);
1392
        break;
1393
      case 3:
1394
        handler.call(this, arguments[1], arguments[2]);
1395
        break;
1396
      // slower
1397
      default:
1398
        var args = Array.prototype.slice.call(arguments, 1);
1399
        handler.apply(this, args);
1400
    }
1401
    return true;
1402
1403
  } else if (isArray(handler)) {
1404
    var args = Array.prototype.slice.call(arguments, 1);
1405
1406
    var listeners = handler.slice();
1407
    for (var i = 0, l = listeners.length; i < l; i++) {
1408
      listeners[i].apply(this, args);
1409
    }
1410
    return true;
1411
1412
  } else {
1413
    return false;
1414
  }
1415
};
1416
1417
// EventEmitter is defined in src/node_events.cc
1418
// EventEmitter.prototype.emit() is also defined there.
1419
EventEmitter.prototype.addListener = function(type, listener) {
1420
  if ('function' !== typeof listener) {
1421
    throw new Error('addListener only takes instances of Function');
1422
  }
1423
1424
  if (!this._events) this._events = {};
1425
1426
  // To avoid recursion in the case that type == "newListeners"! Before
1427
  // adding it to the listeners, first emit "newListeners".
1428
  this.emit('newListener', type, listener);
1429
1430
  if (!this._events[type]) {
1431
    // Optimize the case of one listener. Don't need the extra array object.
1432
    this._events[type] = listener;
1433
  } else if (isArray(this._events[type])) {
1434
1435
    // Check for listener leak
1436
    if (!this._events[type].warned) {
1437
      var m;
1438
      if (this._events.maxListeners !== undefined) {
1439
        m = this._events.maxListeners;
1440
      } else {
1441
        m = defaultMaxListeners;
1442
      }
1443
1444
      if (m && m > 0 && this._events[type].length > m) {
1445
        this._events[type].warned = true;
1446
        console.error('(node) warning: possible EventEmitter memory ' +
1447
                      'leak detected. %d listeners added. ' +
1448
                      'Use emitter.setMaxListeners() to increase limit.',
1449
                      this._events[type].length);
1450
        console.trace();
1451
      }
1452
    }
1453
1454
    // If we've already got an array, just append.
1455
    this._events[type].push(listener);
1456
  } else {
1457
    // Adding the second element, need to change to array.
1458
    this._events[type] = [this._events[type], listener];
1459
  }
1460
1461
  return this;
1462
};
1463
1464
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
1465
1466
EventEmitter.prototype.once = function(type, listener) {
1467
  var self = this;
1468
  self.on(type, function g() {
1469
    self.removeListener(type, g);
1470
    listener.apply(this, arguments);
1471
  });
1472
1473
  return this;
1474
};
1475
1476
EventEmitter.prototype.removeListener = function(type, listener) {
1477
  if ('function' !== typeof listener) {
1478
    throw new Error('removeListener only takes instances of Function');
1479
  }
1480
1481
  // does not use listeners(), so no side effect of creating _events[type]
1482
  if (!this._events || !this._events[type]) return this;
1483
1484
  var list = this._events[type];
1485
1486
  if (isArray(list)) {
1487
    var i = list.indexOf(listener);
1488
    if (i < 0) return this;
1489
    list.splice(i, 1);
1490
    if (list.length == 0)
1491
      delete this._events[type];
1492
  } else if (this._events[type] === listener) {
1493
    delete this._events[type];
1494
  }
1495
1496
  return this;
1497
};
1498
1499
EventEmitter.prototype.removeAllListeners = function(type) {
1500
  // does not use listeners(), so no side effect of creating _events[type]
1501
  if (type && this._events && this._events[type]) this._events[type] = null;
1502
  return this;
1503
};
1504
1505
EventEmitter.prototype.listeners = function(type) {
1506
  if (!this._events) this._events = {};
1507
  if (!this._events[type]) this._events[type] = [];
1508
  if (!isArray(this._events[type])) {
1509
    this._events[type] = [this._events[type]];
1510
  }
1511
  return this._events[type];
1512
};
1513
1514
});
1515
1516
require.define("/node_modules/sprintf/package.json", function (require, module, exports, __dirname, __filename) {
1517
    module.exports = {"main":"./lib/sprintf"}
1518
});
1519
1520
require.define("/node_modules/sprintf/lib/sprintf.js", function (require, module, exports, __dirname, __filename) {
1521
    /**
1522
sprintf() for JavaScript 0.7-beta1
1523
http://www.diveintojavascript.com/projects/javascript-sprintf
1524
1525
Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
1526
All rights reserved.
1527
1528
Redistribution and use in source and binary forms, with or without
1529
modification, are permitted provided that the following conditions are met:
1530
    * Redistributions of source code must retain the above copyright
1531
      notice, this list of conditions and the following disclaimer.
1532
    * Redistributions in binary form must reproduce the above copyright
1533
      notice, this list of conditions and the following disclaimer in the
1534
      documentation and/or other materials provided with the distribution.
1535
    * Neither the name of sprintf() for JavaScript nor the
1536
      names of its contributors may be used to endorse or promote products
1537
      derived from this software without specific prior written permission.
1538
1539
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1540
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1541
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1542
DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
1543
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1544
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1545
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1546
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1547
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1548
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1549
1550
1551
Changelog:
1552
2010.11.07 - 0.7-beta1-node
1553
  - converted it to a node.js compatible module
1554
1555
2010.09.06 - 0.7-beta1
1556
  - features: vsprintf, support for named placeholders
1557
  - enhancements: format cache, reduced global namespace pollution
1558
1559
2010.05.22 - 0.6:
1560
 - reverted to 0.4 and fixed the bug regarding the sign of the number 0
1561
 Note:
1562
 Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
1563
 who warned me about a bug in 0.5, I discovered that the last update was
1564
 a regress. I appologize for that.
1565
1566
2010.05.09 - 0.5:
1567
 - bug fix: 0 is now preceeded with a + sign
1568
 - bug fix: the sign was not at the right position on padded results (Kamal Abdali)
1569
 - switched from GPL to BSD license
1570
1571
2007.10.21 - 0.4:
1572
 - unit test and patch (David Baird)
1573
1574
2007.09.17 - 0.3:
1575
 - bug fix: no longer throws exception on empty paramenters (Hans Pufal)
1576
1577
2007.09.11 - 0.2:
1578
 - feature: added argument swapping
1579
1580
2007.04.03 - 0.1:
1581
 - initial release
1582
**/
1583
1584
var sprintf = (function() {
1585
  function get_type(variable) {
1586
    return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
1587
  }
1588
  function str_repeat(input, multiplier) {
1589
    for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
1590
    return output.join('');
1591
  }
1592
1593
  var str_format = function() {
1594
    if (!str_format.cache.hasOwnProperty(arguments[0])) {
1595
      str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
1596
    }
1597
    return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
1598
  };
1599
1600
  str_format.format = function(parse_tree, argv) {
1601
    var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
1602
    for (i = 0; i < tree_length; i++) {
1603
      node_type = get_type(parse_tree[i]);
1604
      if (node_type === 'string') {
1605
        output.push(parse_tree[i]);
1606
      }
1607
      else if (node_type === 'array') {
1608
        match = parse_tree[i]; // convenience purposes only
1609
        if (match[2]) { // keyword argument
1610
          arg = argv[cursor];
1611
          for (k = 0; k < match[2].length; k++) {
1612
            if (!arg.hasOwnProperty(match[2][k])) {
1613
              throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
1614
            }
1615
            arg = arg[match[2][k]];
1616
          }
1617
        }
1618
        else if (match[1]) { // positional argument (explicit)
1619
          arg = argv[match[1]];
1620
        }
1621
        else { // positional argument (implicit)
1622
          arg = argv[cursor++];
1623
        }
1624
1625
        if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
1626
          throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
1627
        }
1628
        switch (match[8]) {
1629
          case 'b': arg = arg.toString(2); break;
1630
          case 'c': arg = String.fromCharCode(arg); break;
1631
          case 'd': arg = parseInt(arg, 10); break;
1632
          case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
1633
          case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
1634
          case 'o': arg = arg.toString(8); break;
1635
          case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
1636
          case 'u': arg = Math.abs(arg); break;
1637
          case 'x': arg = arg.toString(16); break;
1638
          case 'X': arg = arg.toString(16).toUpperCase(); break;
1639
        }
1640
        arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
1641
        pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
1642
        pad_length = match[6] - String(arg).length;
1643
        pad = match[6] ? str_repeat(pad_character, pad_length) : '';
1644
        output.push(match[5] ? arg + pad : pad + arg);
1645
      }
1646
    }
1647
    return output.join('');
1648
  };
1649
1650
  str_format.cache = {};
1651
1652
  str_format.parse = function(fmt) {
1653
    var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
1654
    while (_fmt) {
1655
      if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
1656
        parse_tree.push(match[0]);
1657
      }
1658
      else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
1659
        parse_tree.push('%');
1660
      }
1661
      else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
1662
        if (match[2]) {
1663
          arg_names |= 1;
1664
          var field_list = [], replacement_field = match[2], field_match = [];
1665
          if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
1666
            field_list.push(field_match[1]);
1667
            while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
1668
              if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
1669
                field_list.push(field_match[1]);
1670
              }
1671
              else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
1672
                field_list.push(field_match[1]);
1673
              }
1674
              else {
1675
                throw('[sprintf] huh?');
1676
              }
1677
            }
1678
          }
1679
          else {
1680
            throw('[sprintf] huh?');
1681
          }
1682
          match[2] = field_list;
1683
        }
1684
        else {
1685
          arg_names |= 2;
1686
        }
1687
        if (arg_names === 3) {
1688
          throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
1689
        }
1690
        parse_tree.push(match);
1691
      }
1692
      else {
1693
        throw('[sprintf] huh?');
1694
      }
1695
      _fmt = _fmt.substring(match[0].length);
1696
    }
1697
    return parse_tree;
1698
  };
1699
1700
  return str_format;
1701
})();
1702
1703
var vsprintf = function(fmt, argv) {
1704
  argv.unshift(fmt);
1705
  return sprintf.apply(null, argv);
1706
};
1707
1708
exports.sprintf = sprintf;
1709
exports.vsprintf = vsprintf;
1710
});
1711
1712
require.define("/shred/response.js", function (require, module, exports, __dirname, __filename) {
1713
    // The `Response object` encapsulates a Node.js HTTP response.
1714
1715
var Content = require("./content")
1716
  , HeaderMixins = require("./mixins/headers")
1717
  , CookieJarLib = require( "cookiejar" )
1718
  , Cookie = CookieJarLib.Cookie
1719
;
1720
1721
// Browser doesn't have zlib.
1722
var zlib = null;
1723
try {
1724
  zlib = require('zlib');
1725
} catch (e) {
1726
  // console.warn("no zlib library");
1727
}
1728
1729
// Iconv doesn't work in browser
1730
var Iconv = null;
1731
try {
1732
  Iconv = require('iconv-lite');
1733
} catch (e) {
1734
  // console.warn("no iconv library");
1735
}
1736
1737
// Construct a `Response` object. You should never have to do this directly. The
1738
// `Request` object handles this, getting the raw response object and passing it
1739
// in here, along with the request. The callback allows us to stream the response
1740
// and then use the callback to let the request know when it's ready.
1741
var Response = function(raw, request, callback) {
1742
  var response = this;
1743
  this._raw = raw;
1744
1745
  // The `._setHeaders` method is "private"; you can't otherwise set headers on
1746
  // the response.
1747
  this._setHeaders.call(this,raw.headers);
1748
1749
  // store any cookies
1750
  if (request.cookieJar && this.getHeader('set-cookie')) {
1751
    var cookieStrings = this.getHeader('set-cookie');
1752
    var cookieObjs = []
1753
      , cookie;
1754
1755
    for (var i = 0; i < cookieStrings.length; i++) {
1756
      var cookieString = cookieStrings[i];
1757
      if (!cookieString) {
1758
        continue;
1759
      }
1760
1761
      if (!cookieString.match(/domain\=/i)) {
1762
        cookieString += '; domain=' + request.host;
1763
      }
1764
1765
      if (!cookieString.match(/path\=/i)) {
1766
        cookieString += '; path=' + request.path;
1767
      }
1768
1769
      try {
1770
        cookie = new Cookie(cookieString);
1771
        if (cookie) {
1772
          cookieObjs.push(cookie);
1773
        }
1774
      } catch (e) {
1775
        console.warn("Tried to set bad cookie: " + cookieString);
1776
      }
1777
    }
1778
1779
    request.cookieJar.setCookies(cookieObjs);
1780
  }
1781
1782
  this.request = request;
1783
  this.client = request.client;
1784
  this.log = this.request.log;
1785
1786
  // Stream the response content entity and fire the callback when we're done.
1787
  // Store the incoming data in a array of Buffers which we concatinate into one
1788
  // buffer at the end.  We need to use buffers instead of strings here in order
1789
  // to preserve binary data.
1790
  var chunkBuffers = [];
1791
  var dataLength = 0;
1792
  raw.on("data", function(chunk) {
1793
    chunkBuffers.push(chunk);
1794
    dataLength += chunk.length;
1795
  });
1796
  raw.on("end", function() {
1797
    var body;
1798
    if (typeof Buffer === 'undefined') {
1799
      // Just concatinate into a string
1800
      body = chunkBuffers.join('');
1801
    } else {
1802
      // Initialize new buffer and add the chunks one-at-a-time.
1803
      body = new Buffer(dataLength);
1804
      for (var i = 0, pos = 0; i < chunkBuffers.length; i++) {
1805
        chunkBuffers[i].copy(body, pos);
1806
        pos += chunkBuffers[i].length;
1807
      }
1808
    }
1809
1810
    var setBodyAndFinish = function (body) {
1811
      response._body = new Content({
1812
        body: body,
1813
        type: response.getHeader("Content-Type")
1814
      });
1815
      callback(response);
1816
    }
1817
1818
    if (zlib && response.getHeader("Content-Encoding") === 'gzip'){
1819
      zlib.gunzip(body, function (err, gunzippedBody) {
1820
        if (Iconv && response.request.encoding){
1821
          body = Iconv.fromEncoding(gunzippedBody,response.request.encoding);
1822
        } else {
1823
          body = gunzippedBody.toString();
1824
        }
1825
        setBodyAndFinish(body);
1826
      })
1827
    }
1828
    else{
1829
       if (response.request.encoding){
1830
            body = Iconv.fromEncoding(body,response.request.encoding);
1831
        }
1832
      setBodyAndFinish(body);
1833
    }
1834
  });
1835
};
1836
1837
// The `Response` object can be pretty overwhelming to view using the built-in
1838
// Node.js inspect method. We want to make it a bit more manageable. This
1839
// probably goes [too far in the other
1840
// direction](https://github.com/spire-io/shred/issues/2).
1841
1842
Response.prototype = {
1843
  inspect: function() {
1844
    var response = this;
1845
    var headers = this.format_headers();
1846
    var summary = ["<Shred Response> ", response.status].join(" ")
1847
    return [ summary, "- Headers:", headers].join("\n");
1848
  },
1849
  format_headers: function () {
1850
    var array = []
1851
    var headers = this._headers
1852
    for (var key in headers) {
1853
      if (headers.hasOwnProperty(key)) {
1854
        var value = headers[key]
1855
        array.push("\t" + key + ": " + value);
1856
      }
1857
    }
1858
    return array.join("\n");
1859
  }
1860
};
1861
1862
// `Response` object properties, all of which are read-only:
1863
Object.defineProperties(Response.prototype, {
1864
1865
// - **status**. The HTTP status code for the response.
1866
  status: {
1867
    get: function() { return this._raw.statusCode; },
1868
    enumerable: true
1869
  },
1870
1871
// - **content**. The HTTP content entity, if any. Provided as a [content
1872
//   object](./content.html), which will attempt to convert the entity based upon
1873
//   the `content-type` header. The converted value is available as
1874
//   `content.data`. The original raw content entity is available as
1875
//   `content.body`.
1876
  body: {
1877
    get: function() { return this._body; }
1878
  },
1879
  content: {
1880
    get: function() { return this.body; },
1881
    enumerable: true
1882
  },
1883
1884
// - **isRedirect**. Is the response a redirect? These are responses with 3xx
1885
//   status and a `Location` header.
1886
  isRedirect: {
1887
    get: function() {
1888
      return (this.status>299
1889
          &&this.status<400
1890
          &&this.getHeader("Location"));
1891
    },
1892
    enumerable: true
1893
  },
1894
1895
// - **isError**. Is the response an error? These are responses with status of
1896
//   400 or greater.
1897
  isError: {
1898
    get: function() {
1899
      return (this.status === 0 || this.status > 399)
1900
    },
1901
    enumerable: true
1902
  }
1903
});
1904
1905
// Add in the [getters for accessing the normalized headers](./headers.js).
1906
HeaderMixins.getters(Response);
1907
HeaderMixins.privateSetters(Response);
1908
1909
// Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
1910
// getAllResponseHeaders() to return {} if the response is a CORS request.
1911
// xhr.getHeader still works correctly.
1912
var getHeader = Response.prototype.getHeader;
1913
Response.prototype.getHeader = function (name) {
1914
  return (getHeader.call(this,name) ||
1915
    (typeof this._raw.getHeader === 'function' && this._raw.getHeader(name)));
1916
};
1917
1918
module.exports = Response;
1919
1920
});
1921
1922
require.define("/shred/content.js", function (require, module, exports, __dirname, __filename) {
1923
1924
// The purpose of the `Content` object is to abstract away the data conversions
1925
// to and from raw content entities as strings. For example, you want to be able
1926
// to pass in a Javascript object and have it be automatically converted into a
1927
// JSON string if the `content-type` is set to a JSON-based media type.
1928
// Conversely, you want to be able to transparently get back a Javascript object
1929
// in the response if the `content-type` is a JSON-based media-type.
1930
1931
// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
1932
1933
// The `Content` constructor takes an options object, which *must* have either a
1934
// `body` or `data` property and *may* have a `type` property indicating the
1935
// media type. If there is no `type` attribute, a default will be inferred.
1936
var Content = function(options) {
1937
  this.body = options.body;
1938
  this.data = options.data;
1939
  this.type = options.type;
1940
};
1941
1942
Content.prototype = {
1943
  // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
1944
  //
1945
  //     toString: function() { return this.body; }
1946
  //
1947
  // Commented out, but I've forgotten why. :/
1948
};
1949
1950
1951
// `Content` objects have the following attributes:
1952
Object.defineProperties(Content.prototype,{
1953
1954
// - **type**. Typically accessed as `content.type`, reflects the `content-type`
1955
//   header associated with the request or response. If not passed as an options
1956
//   to the constructor or set explicitly, it will infer the type the `data`
1957
//   attribute, if possible, and, failing that, will default to `text/plain`.
1958
  type: {
1959
    get: function() {
1960
      if (this._type) {
1961
        return this._type;
1962
      } else {
1963
        if (this._data) {
1964
          switch(typeof this._data) {
1965
            case "string": return "text/plain";
1966
            case "object": return "application/json";
1967
          }
1968
        }
1969
      }
1970
      return "text/plain";
1971
    },
1972
    set: function(value) {
1973
      this._type = value;
1974
      return this;
1975
    },
1976
    enumerable: true
1977
  },
1978
1979
// - **data**. Typically accessed as `content.data`, reflects the content entity
1980
//   converted into Javascript data. This can be a string, if the `type` is, say,
1981
//   `text/plain`, but can also be a Javascript object. The conversion applied is
1982
//   based on the `processor` attribute. The `data` attribute can also be set
1983
//   directly, in which case the conversion will be done the other way, to infer
1984
//   the `body` attribute.
1985
  data: {
1986
    get: function() {
1987
      if (this._body) {
1988
        return this.processor.parser(this._body);
1989
      } else {
1990
        return this._data;
1991
      }
1992
    },
1993
    set: function(data) {
1994
      if (this._body&&data) Errors.setDataWithBody(this);
1995
      this._data = data;
1996
      return this;
1997
    },
1998
    enumerable: true
1999
  },
2000
2001
// - **body**. Typically accessed as `content.body`, reflects the content entity
2002
//   as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
2003
//   `data` attribute, the `body` attribute will be inferred and vice-versa. If
2004
//   you attempt to set both, an exception is raised.
2005
  body: {
2006
    get: function() {
2007
      if (this._data) {
2008
        return this.processor.stringify(this._data);
2009
      } else {
2010
        return this.processor.stringify(this._body);
2011
      }
2012
    },
2013
    set: function(body) {
2014
      if (this._data&&body) Errors.setBodyWithData(this);
2015
      this._body = body;
2016
      return this;
2017
    },
2018
    enumerable: true
2019
  },
2020
2021
// - **processor**. The functions that will be used to convert to/from `data` and
2022
//   `body` attributes. You can add processors. The two that are built-in are for
2023
//   `text/plain`, which is basically an identity transformation and
2024
//   `application/json` and other JSON-based media types (including custom media
2025
//   types with `+json`). You can add your own processors. See below.
2026
  processor: {
2027
    get: function() {
2028
      var processor = Content.processors[this.type];
2029
      if (processor) {
2030
        return processor;
2031
      } else {
2032
        // Return the first processor that matches any part of the
2033
        // content type. ex: application/vnd.foobar.baz+json will match json.
2034
        var main = this.type.split(";")[0];
2035
        var parts = main.split(/\+|\//);
2036
        for (var i=0, l=parts.length; i < l; i++) {
2037
          processor = Content.processors[parts[i]]
2038
        }
2039
        return processor || {parser:identity,stringify:toString};
2040
      }
2041
    },
2042
    enumerable: true
2043
  },
2044
2045
// - **length**. Typically accessed as `content.length`, returns the length in
2046
//   bytes of the raw content entity.
2047
  length: {
2048
    get: function() {
2049
      if (typeof Buffer !== 'undefined') {
2050
        return Buffer.byteLength(this.body);
2051
      }
2052
      return this.body.length;
2053
    }
2054
  }
2055
});
2056
2057
Content.processors = {};
2058
2059
// The `registerProcessor` function allows you to add your own processors to
2060
// convert content entities. Each processor consists of a Javascript object with
2061
// two properties:
2062
// - **parser**. The function used to parse a raw content entity and convert it
2063
//   into a Javascript data type.
2064
// - **stringify**. The function used to convert a Javascript data type into a
2065
//   raw content entity.
2066
Content.registerProcessor = function(types,processor) {
2067
2068
// You can pass an array of types that will trigger this processor, or just one.
2069
// We determine the array via duck-typing here.
2070
  if (types.forEach) {
2071
    types.forEach(function(type) {
2072
      Content.processors[type] = processor;
2073
    });
2074
  } else {
2075
    // If you didn't pass an array, we just use what you pass in.
2076
    Content.processors[types] = processor;
2077
  }
2078
};
2079
2080
// Register the identity processor, which is used for text-based media types.
2081
var identity = function(x) { return x; }
2082
  , toString = function(x) { return x.toString(); }
2083
Content.registerProcessor(
2084
  ["text/html","text/plain","text"],
2085
  { parser: identity, stringify: toString });
2086
2087
// Register the JSON processor, which is used for JSON-based media types.
2088
Content.registerProcessor(
2089
  ["application/json; charset=utf-8","application/json","json"],
2090
  {
2091
    parser: function(string) {
2092
      return JSON.parse(string);
2093
    },
2094
    stringify: function(data) {
2095
      return JSON.stringify(data); }});
2096
2097
// Error functions are defined separately here in an attempt to make the code
2098
// easier to read.
2099
var Errors = {
2100
  setDataWithBody: function(object) {
2101
    throw new Error("Attempt to set data attribute of a content object " +
2102
        "when the body attributes was already set.");
2103
  },
2104
  setBodyWithData: function(object) {
2105
    throw new Error("Attempt to set body attribute of a content object " +
2106
        "when the data attributes was already set.");
2107
  }
2108
}
2109
module.exports = Content;
2110
2111
});
2112
2113
require.define("/shred/mixins/headers.js", function (require, module, exports, __dirname, __filename) {
2114
    // The header mixins allow you to add HTTP header support to any object. This
2115
// might seem pointless: why not simply use a hash? The main reason is that, per
2116
// the [HTTP spec](http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2),
2117
// headers are case-insensitive. So, for example, `content-type` is the same as
2118
// `CONTENT-TYPE` which is the same as `Content-Type`. Since there is no way to
2119
// overload the index operator in Javascript, using a hash to represent the
2120
// headers means it's possible to have two conflicting values for a single
2121
// header.
2122
//
2123
// The solution to this is to provide explicit methods to set or get headers.
2124
// This also has the benefit of allowing us to introduce additional variations,
2125
// including snake case, which we automatically convert to what Matthew King has
2126
// dubbed "corset case" - the hyphen-separated names with initial caps:
2127
// `Content-Type`. We use corset-case just in case we're dealing with servers
2128
// that haven't properly implemented the spec.
2129
2130
// Convert headers to corset-case. **Example:** `CONTENT-TYPE` will be converted
2131
// to `Content-Type`.
2132
2133
var corsetCase = function(string) {
2134
  return string;//.toLowerCase()
2135
      //.replace("_","-")
2136
      // .replace(/(^|-)(\w)/g,
2137
          // function(s) { return s.toUpperCase(); });
2138
};
2139
2140
// We suspect that `initializeHeaders` was once more complicated ...
2141
var initializeHeaders = function(object) {
2142
  return {};
2143
};
2144
2145
// Access the `_headers` property using lazy initialization. **Warning:** If you
2146
// mix this into an object that is using the `_headers` property already, you're
2147
// going to have trouble.
2148
var $H = function(object) {
2149
  return object._headers||(object._headers=initializeHeaders(object));
2150
};
2151
2152
// Hide the implementations as private functions, separate from how we expose them.
2153
2154
// The "real" `getHeader` function: get the header after normalizing the name.
2155
var getHeader = function(object,name) {
2156
  return $H(object)[corsetCase(name)];
2157
};
2158
2159
// The "real" `getHeader` function: get one or more headers, or all of them
2160
// if you don't ask for any specifics.
2161
var getHeaders = function(object,names) {
2162
  var keys = (names && names.length>0) ? names : Object.keys($H(object));
2163
  var hash = keys.reduce(function(hash,key) {
2164
    hash[key] = getHeader(object,key);
2165
    return hash;
2166
  },{});
2167
  // Freeze the resulting hash so you don't mistakenly think you're modifying
2168
  // the real headers.
2169
  Object.freeze(hash);
2170
  return hash;
2171
};
2172
2173
// The "real" `setHeader` function: set a header, after normalizing the name.
2174
var setHeader = function(object,name,value) {
2175
  $H(object)[corsetCase(name)] = value;
2176
  return object;
2177
};
2178
2179
// The "real" `setHeaders` function: set multiple headers based on a hash.
2180
var setHeaders = function(object,hash) {
2181
  for( var key in hash ) { setHeader(object,key,hash[key]); };
2182
  return this;
2183
};
2184
2185
// Here's where we actually bind the functionality to an object. These mixins work by
2186
// exposing mixin functions. Each function mixes in a specific batch of features.
2187
module.exports = {
2188
2189
  // Add getters.
2190
  getters: function(constructor) {
2191
    constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
2192
    constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
2193
  },
2194
  // Add setters but as "private" methods.
2195
  privateSetters: function(constructor) {
2196
    constructor.prototype._setHeader = function(key,value) { return setHeader(this,key,value); };
2197
    constructor.prototype._setHeaders = function(hash) { return setHeaders(this,hash); };
2198
  },
2199
  // Add setters.
2200
  setters: function(constructor) {
2201
    constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
2202
    constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
2203
  },
2204
  // Add both getters and setters.
2205
  gettersAndSetters: function(constructor) {
2206
    constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
2207
    constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
2208
    constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
2209
    constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
2210
  }
2211
};
2212
2213
});
2214
2215
require.define("/node_modules/iconv-lite/package.json", function (require, module, exports, __dirname, __filename) {
2216
    module.exports = {}
2217
});
2218
2219
require.define("/node_modules/iconv-lite/index.js", function (require, module, exports, __dirname, __filename) {
2220
    // Module exports
2221
var iconv = module.exports = {
2222
    toEncoding: function(str, encoding) {
2223
        return iconv.getCodec(encoding).toEncoding(str);
2224
    },
2225
    fromEncoding: function(buf, encoding) {
2226
        return iconv.getCodec(encoding).fromEncoding(buf);
2227
    },
2228
2229
    defaultCharUnicode: '�',
2230
    defaultCharSingleByte: '?',
2231
2232
    // Get correct codec for given encoding.
2233
    getCodec: function(encoding) {
2234
        var enc = encoding || "utf8";
2235
        var codecOptions = undefined;
2236
        while (1) {
2237
            if (getType(enc) === "String")
2238
                enc = enc.replace(/[- ]/g, "").toLowerCase();
2239
            var codec = iconv.encodings[enc];
2240
            var type = getType(codec);
2241
            if (type === "String") {
2242
                // Link to other encoding.
2243
                codecOptions = {originalEncoding: enc};
2244
                enc = codec;
2245
            }
2246
            else if (type === "Object" && codec.type != undefined) {
2247
                // Options for other encoding.
2248
                codecOptions = codec;
2249
                enc = codec.type;
2250
            }
2251
            else if (type === "Function")
2252
                // Codec itself.
2253
                return codec(codecOptions);
2254
            else
2255
                throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
2256
        }
2257
    },
2258
2259
    // Define basic encodings
2260
    encodings: {
2261
        internal: function(options) {
2262
            return {
2263
                toEncoding: function(str) {
2264
                    return new Buffer(ensureString(str), options.originalEncoding);
2265
                },
2266
                fromEncoding: function(buf) {
2267
                    return ensureBuffer(buf).toString(options.originalEncoding);
2268
                }
2269
            };
2270
        },
2271
        utf8: "internal",
2272
        ucs2: "internal",
2273
        binary: "internal",
2274
        ascii: "internal",
2275
        base64: "internal",
2276
2277
        // Codepage single-byte encodings.
2278
        singlebyte: function(options) {
2279
            // Prepare chars if needed
2280
            if (!options.chars || (options.chars.length !== 128 && options.chars.length !== 256))
2281
                throw new Error("Encoding '"+options.type+"' has incorrect 'chars' (must be of len 128 or 256)");
2282
2283
            if (options.chars.length === 128)
2284
                options.chars = asciiString + options.chars;
2285
2286
            if (!options.charsBuf) {
2287
                options.charsBuf = new Buffer(options.chars, 'ucs2');
2288
            }
2289
2290
            if (!options.revCharsBuf) {
2291
                options.revCharsBuf = new Buffer(65536);
2292
                var defChar = iconv.defaultCharSingleByte.charCodeAt(0);
2293
                for (var i = 0; i < options.revCharsBuf.length; i++)
2294
                    options.revCharsBuf[i] = defChar;
2295
                for (var i = 0; i < options.chars.length; i++)
2296
                    options.revCharsBuf[options.chars.charCodeAt(i)] = i;
2297
            }
2298
2299
            return {
2300
                toEncoding: function(str) {
2301
                    str = ensureString(str);
2302
2303
                    var buf = new Buffer(str.length);
2304
                    var revCharsBuf = options.revCharsBuf;
2305
                    for (var i = 0; i < str.length; i++)
2306
                        buf[i] = revCharsBuf[str.charCodeAt(i)];
2307
2308
                    return buf;
2309
                },
2310
                fromEncoding: function(buf) {
2311
                    buf = ensureBuffer(buf);
2312
2313
                    // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
2314
                    var charsBuf = options.charsBuf;
2315
                    var newBuf = new Buffer(buf.length*2);
2316
                    var idx1 = 0, idx2 = 0;
2317
                    for (var i = 0, _len = buf.length; i < _len; i++) {
2318
                        idx1 = buf[i]*2; idx2 = i*2;
2319
                        newBuf[idx2] = charsBuf[idx1];
2320
                        newBuf[idx2+1] = charsBuf[idx1+1];
2321
                    }
2322
                    return newBuf.toString('ucs2');
2323
                }
2324
            };
2325
        },
2326
2327
        // Codepage double-byte encodings.
2328
        table: function(options) {
2329
            var table = options.table, key, revCharsTable = options.revCharsTable;
2330
            if (!table) {
2331
                throw new Error("Encoding '" + options.type +"' has incorect 'table' option");
2332
            }
2333
            if(!revCharsTable) {
2334
                revCharsTable = options.revCharsTable = {};
2335
                for (key in table) {
2336
                    revCharsTable[table[key]] = parseInt(key);
2337
                }
2338
            }
2339
2340
            return {
2341
                toEncoding: function(str) {
2342
                    str = ensureString(str);
2343
                    var strLen = str.length;
2344
                    var bufLen = strLen;
2345
                    for (var i = 0; i < strLen; i++)
2346
                        if (str.charCodeAt(i) >> 7)
2347
                            bufLen++;
2348
2349
                    var newBuf = new Buffer(bufLen), gbkcode, unicode,
2350
                        defaultChar = revCharsTable[iconv.defaultCharUnicode.charCodeAt(0)];
2351
2352
                    for (var i = 0, j = 0; i < strLen; i++) {
2353
                        unicode = str.charCodeAt(i);
2354
                        if (unicode >> 7) {
2355
                            gbkcode = revCharsTable[unicode] || defaultChar;
2356
                            newBuf[j++] = gbkcode >> 8; //high byte;
2357
                            newBuf[j++] = gbkcode & 0xFF; //low byte
2358
                        } else {//ascii
2359
                            newBuf[j++] = unicode;
2360
                        }
2361
                    }
2362
                    return newBuf;
2363
                },
2364
                fromEncoding: function(buf) {
2365
                    buf = ensureBuffer(buf);
2366
                    var bufLen = buf.length, strLen = 0;
2367
                    for (var i = 0; i < bufLen; i++) {
2368
                        strLen++;
2369
                        if (buf[i] & 0x80) //the high bit is 1, so this byte is gbkcode's high byte.skip next byte
2370
                            i++;
2371
                    }
2372
                    var newBuf = new Buffer(strLen*2), unicode, gbkcode,
2373
                        defaultChar = iconv.defaultCharUnicode.charCodeAt(0);
2374
2375
                    for (var i = 0, j = 0; i < bufLen; i++, j+=2) {
2376
                        gbkcode = buf[i];
2377
                        if (gbkcode & 0x80) {
2378
                            gbkcode = (gbkcode << 8) + buf[++i];
2379
                            unicode = table[gbkcode] || defaultChar;
2380
                        } else {
2381
                            unicode = gbkcode;
2382
                        }
2383
                        newBuf[j] = unicode & 0xFF; //low byte
2384
                        newBuf[j+1] = unicode >> 8; //high byte
2385
                    }
2386
                    return newBuf.toString('ucs2');
2387
                }
2388
            }
2389
        }
2390
    }
2391
};
2392
2393
// Add aliases to convert functions
2394
iconv.encode = iconv.toEncoding;
2395
iconv.decode = iconv.fromEncoding;
2396
2397
// Load other encodings from files in /encodings dir.
2398
var encodingsDir = __dirname+"/encodings/",
2399
    fs = require('fs');
2400
fs.readdirSync(encodingsDir).forEach(function(file) {
2401
    if(fs.statSync(encodingsDir + file).isDirectory()) return;
2402
    var encodings = require(encodingsDir + file)
2403
    for (var key in encodings)
2404
        iconv.encodings[key] = encodings[key]
2405
});
2406
2407
// Utilities
2408
var asciiString = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'+
2409
              ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f';
2410
2411
var ensureBuffer = function(buf) {
2412
    buf = buf || new Buffer(0);
2413
    return (buf instanceof Buffer) ? buf : new Buffer(buf.toString(), "utf8");
2414
}
2415
2416
var ensureString = function(str) {
2417
    str = str || "";
2418
    return (str instanceof String) ? str : str.toString((str instanceof Buffer) ? 'utf8' : undefined);
2419
}
2420
2421
var getType = function(obj) {
2422
    return Object.prototype.toString.call(obj).slice(8, -1);
2423
}
2424
2425
2426
});
2427
2428
require.define("/node_modules/http-browserify/package.json", function (require, module, exports, __dirname, __filename) {
2429
    module.exports = {"main":"index.js","browserify":"browser.js"}
2430
});
2431
2432
require.define("/node_modules/http-browserify/browser.js", function (require, module, exports, __dirname, __filename) {
2433
    var http = module.exports;
2434
var EventEmitter = require('events').EventEmitter;
2435
var Request = require('./lib/request');
2436
2437
http.request = function (params, cb) {
2438
    if (!params) params = {};
2439
    if (!params.host) params.host = window.location.host.split(':')[0];
2440
    if (!params.port) params.port = window.location.port;
2441
2442
    var req = new Request(new xhrHttp, params);
2443
    if (cb) req.on('response', cb);
2444
    return req;
2445
};
2446
2447
http.get = function (params, cb) {
2448
    params.method = 'GET';
2449
    var req = http.request(params, cb);
2450
    req.end();
2451
    return req;
2452
};
2453
2454
var xhrHttp = (function () {
2455
    if (typeof window === 'undefined') {
2456
        throw new Error('no window object present');
2457
    }
2458
    else if (window.XMLHttpRequest) {
2459
        return window.XMLHttpRequest;
2460
    }
2461
    else if (window.ActiveXObject) {
2462
        var axs = [
2463
            'Msxml2.XMLHTTP.6.0',
2464
            'Msxml2.XMLHTTP.3.0',
2465
            'Microsoft.XMLHTTP'
2466
        ];
2467
        for (var i = 0; i < axs.length; i++) {
2468
            try {
2469
                var ax = new(window.ActiveXObject)(axs[i]);
2470
                return function () {
2471
                    if (ax) {
2472
                        var ax_ = ax;
2473
                        ax = null;
2474
                        return ax_;
2475
                    }
2476
                    else {
2477
                        return new(window.ActiveXObject)(axs[i]);
2478
                    }
2479
                };
2480
            }
2481
            catch (e) {}
2482
        }
2483
        throw new Error('ajax not supported in this browser')
2484
    }
2485
    else {
2486
        throw new Error('ajax not supported in this browser');
2487
    }
2488
})();
2489
2490
http.STATUS_CODES = {
2491
    100 : 'Continue',
2492
    101 : 'Switching Protocols',
2493
    102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
2494
    200 : 'OK',
2495
    201 : 'Created',
2496
    202 : 'Accepted',
2497
    203 : 'Non-Authoritative Information',
2498
    204 : 'No Content',
2499
    205 : 'Reset Content',
2500
    206 : 'Partial Content',
2501
    207 : 'Multi-Status', // RFC 4918
2502
    300 : 'Multiple Choices',
2503
    301 : 'Moved Permanently',
2504
    302 : 'Moved Temporarily',
2505
    303 : 'See Other',
2506
    304 : 'Not Modified',
2507
    305 : 'Use Proxy',
2508
    307 : 'Temporary Redirect',
2509
    400 : 'Bad Request',
2510
    401 : 'Unauthorized',
2511
    402 : 'Payment Required',
2512
    403 : 'Forbidden',
2513
    404 : 'Not Found',
2514
    405 : 'Method Not Allowed',
2515
    406 : 'Not Acceptable',
2516
    407 : 'Proxy Authentication Required',
2517
    408 : 'Request Time-out',
2518
    409 : 'Conflict',
2519
    410 : 'Gone',
2520
    411 : 'Length Required',
2521
    412 : 'Precondition Failed',
2522
    413 : 'Request Entity Too Large',
2523
    414 : 'Request-URI Too Large',
2524
    415 : 'Unsupported Media Type',
2525
    416 : 'Requested Range Not Satisfiable',
2526
    417 : 'Expectation Failed',
2527
    418 : 'I\'m a teapot', // RFC 2324
2528
    422 : 'Unprocessable Entity', // RFC 4918
2529
    423 : 'Locked', // RFC 4918
2530
    424 : 'Failed Dependency', // RFC 4918
2531
    425 : 'Unordered Collection', // RFC 4918
2532
    426 : 'Upgrade Required', // RFC 2817
2533
    500 : 'Internal Server Error',
2534
    501 : 'Not Implemented',
2535
    502 : 'Bad Gateway',
2536
    503 : 'Service Unavailable',
2537
    504 : 'Gateway Time-out',
2538
    505 : 'HTTP Version not supported',
2539
    506 : 'Variant Also Negotiates', // RFC 2295
2540
    507 : 'Insufficient Storage', // RFC 4918
2541
    509 : 'Bandwidth Limit Exceeded',
2542
    510 : 'Not Extended' // RFC 2774
2543
};
2544
2545
});
2546
2547
require.define("/node_modules/http-browserify/lib/request.js", function (require, module, exports, __dirname, __filename) {
2548
    var EventEmitter = require('events').EventEmitter;
2549
var Response = require('./response');
2550
var isSafeHeader = require('./isSafeHeader');
2551
2552
var Request = module.exports = function (xhr, params) {
2553
    var self = this;
2554
    self.xhr = xhr;
2555
    self.body = '';
2556
2557
    var uri = params.host + ':' + params.port + (params.path || '/');
2558
2559
    xhr.open(
2560
        params.method || 'GET',
2561
        (params.scheme || 'http') + '://' + uri,
2562
        true
2563
    );
2564
2565
    if (params.headers) {
2566
        Object.keys(params.headers).forEach(function (key) {
2567
            if (!isSafeHeader(key)) return;
2568
            var value = params.headers[key];
2569
            if (Array.isArray(value)) {
2570
                value.forEach(function (v) {
2571
                    xhr.setRequestHeader(key, v);
2572
                });
2573
            }
2574
            else xhr.setRequestHeader(key, value)
2575
        });
2576
    }
2577
2578
    var res = new Response(xhr);
2579
    res.on('ready', function () {
2580
        self.emit('response', res);
2581
    });
2582
2583
    xhr.onreadystatechange = function () {
2584
        res.handle(xhr);
2585
    };
2586
};
2587
2588
Request.prototype = new EventEmitter;
2589
2590
Request.prototype.setHeader = function (key, value) {
2591
    if ((Array.isArray && Array.isArray(value))
2592
    || value instanceof Array) {
2593
        for (var i = 0; i < value.length; i++) {
2594
            this.xhr.setRequestHeader(key, value[i]);
2595
        }
2596
    }
2597
    else {
2598
        this.xhr.setRequestHeader(key, value);
2599
    }
2600
};
2601
2602
Request.prototype.write = function (s) {
2603
    this.body += s;
2604
};
2605
2606
Request.prototype.end = function (s) {
2607
    if (s !== undefined) this.write(s);
2608
    this.xhr.send(this.body);
2609
};
2610
2611
});
2612
2613
require.define("/node_modules/http-browserify/lib/response.js", function (require, module, exports, __dirname, __filename) {
2614
    var EventEmitter = require('events').EventEmitter;
2615
var isSafeHeader = require('./isSafeHeader');
2616
2617
var Response = module.exports = function (xhr) {
2618
    this.xhr = xhr;
2619
    this.offset = 0;
2620
};
2621
2622
Response.prototype = new EventEmitter;
2623
2624
var capable = {
2625
    streaming : true,
2626
    status2 : true
2627
};
2628
2629
function parseHeaders (xhr) {
2630
    var lines = xhr.getAllResponseHeaders().split(/\r?\n/);
2631
    var headers = {};
2632
    for (var i = 0; i < lines.length; i++) {
2633
        var line = lines[i];
2634
        if (line === '') continue;
2635
2636
        var m = line.match(/^([^:]+):\s*(.*)/);
2637
        if (m) {
2638
            var key = m[1].toLowerCase(), value = m[2];
2639
2640
            if (headers[key] !== undefined) {
2641
                if ((Array.isArray && Array.isArray(headers[key]))
2642
                || headers[key] instanceof Array) {
2643
                    headers[key].push(value);
2644
                }
2645
                else {
2646
                    headers[key] = [ headers[key], value ];
2647
                }
2648
            }
2649
            else {
2650
                headers[key] = value;
2651
            }
2652
        }
2653
        else {
2654
            headers[line] = true;
2655
        }
2656
    }
2657
    return headers;
2658
}
2659
2660
Response.prototype.getHeader = function (key) {
2661
    var header = this.headers ? this.headers[key.toLowerCase()] : null;
2662
    if (header) return header;
2663
2664
    // Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
2665
    // getAllResponseHeaders() to return {} if the response is a CORS request.
2666
    // xhr.getHeader still works correctly.
2667
    if (isSafeHeader(key)) {
2668
      return this.xhr.getResponseHeader(key);
2669
    }
2670
    return null;
2671
};
2672
2673
Response.prototype.handle = function () {
2674
    var xhr = this.xhr;
2675
    if (xhr.readyState === 2 && capable.status2) {
2676
        try {
2677
            this.statusCode = xhr.status;
2678
            this.headers = parseHeaders(xhr);
2679
        }
2680
        catch (err) {
2681
            capable.status2 = false;
2682
        }
2683
2684
        if (capable.status2) {
2685
            this.emit('ready');
2686
        }
2687
    }
2688
    else if (capable.streaming && xhr.readyState === 3) {
2689
        try {
2690
            if (!this.statusCode) {
2691
                this.statusCode = xhr.status;
2692
                this.headers = parseHeaders(xhr);
2693
                this.emit('ready');
2694
            }
2695
        }
2696
        catch (err) {}
2697
2698
        try {
2699
            this.write();
2700
        }
2701
        catch (err) {
2702
            capable.streaming = false;
2703
        }
2704
    }
2705
    else if (xhr.readyState === 4) {
2706
        if (!this.statusCode) {
2707
            this.statusCode = xhr.status;
2708
            this.emit('ready');
2709
        }
2710
        this.write();
2711
2712
        if (xhr.error) {
2713
            this.emit('error', xhr.responseText);
2714
        }
2715
        else this.emit('end');
2716
    }
2717
};
2718
2719
Response.prototype.write = function () {
2720
    var xhr = this.xhr;
2721
    if (xhr.responseText.length > this.offset) {
2722
        this.emit('data', xhr.responseText.slice(this.offset));
2723
        this.offset = xhr.responseText.length;
2724
    }
2725
};
2726
2727
});
2728
2729
require.define("/node_modules/http-browserify/lib/isSafeHeader.js", function (require, module, exports, __dirname, __filename) {
2730
    // Taken from http://dxr.mozilla.org/mozilla/mozilla-central/content/base/src/nsXMLHttpRequest.cpp.html
2731
var unsafeHeaders = [
2732
    "accept-charset",
2733
    "accept-encoding",
2734
    "access-control-request-headers",
2735
    "access-control-request-method",
2736
    "connection",
2737
    "content-length",
2738
    "cookie",
2739
    "cookie2",
2740
    "content-transfer-encoding",
2741
    "date",
2742
    "expect",
2743
    "host",
2744
    "keep-alive",
2745
    "origin",
2746
    "referer",
2747
    "set-cookie",
2748
    "te",
2749
    "trailer",
2750
    "transfer-encoding",
2751
    "upgrade",
2752
    "user-agent",
2753
    "via"
2754
];
2755
2756
module.exports = function (headerName) {
2757
    if (!headerName) return false;
2758
    return (unsafeHeaders.indexOf(headerName.toLowerCase()) === -1)
2759
};
2760
2761
});
2762
2763
require.alias("http-browserify", "/node_modules/http");
2764
2765
require.alias("http-browserify", "/node_modules/https");
(-)a/api/v1/doc/lib/shred/content.js (+193 lines)
Line 0 Link Here
1
2
// The purpose of the `Content` object is to abstract away the data conversions
3
// to and from raw content entities as strings. For example, you want to be able
4
// to pass in a Javascript object and have it be automatically converted into a
5
// JSON string if the `content-type` is set to a JSON-based media type.
6
// Conversely, you want to be able to transparently get back a Javascript object
7
// in the response if the `content-type` is a JSON-based media-type.
8
9
// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
10
11
// The `Content` constructor takes an options object, which *must* have either a
12
// `body` or `data` property and *may* have a `type` property indicating the
13
// media type. If there is no `type` attribute, a default will be inferred.
14
var Content = function(options) {
15
  this.body = options.body;
16
  this.data = options.data;
17
  this.type = options.type;
18
};
19
20
Content.prototype = {
21
  // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
22
  //
23
  //     toString: function() { return this.body; }
24
  //
25
  // Commented out, but I've forgotten why. :/
26
};
27
28
29
// `Content` objects have the following attributes:
30
Object.defineProperties(Content.prototype,{
31
32
// - **type**. Typically accessed as `content.type`, reflects the `content-type`
33
//   header associated with the request or response. If not passed as an options
34
//   to the constructor or set explicitly, it will infer the type the `data`
35
//   attribute, if possible, and, failing that, will default to `text/plain`.
36
  type: {
37
    get: function() {
38
      if (this._type) {
39
        return this._type;
40
      } else {
41
        if (this._data) {
42
          switch(typeof this._data) {
43
            case "string": return "text/plain";
44
            case "object": return "application/json";
45
          }
46
        }
47
      }
48
      return "text/plain";
49
    },
50
    set: function(value) {
51
      this._type = value;
52
      return this;
53
    },
54
    enumerable: true
55
  },
56
57
// - **data**. Typically accessed as `content.data`, reflects the content entity
58
//   converted into Javascript data. This can be a string, if the `type` is, say,
59
//   `text/plain`, but can also be a Javascript object. The conversion applied is
60
//   based on the `processor` attribute. The `data` attribute can also be set
61
//   directly, in which case the conversion will be done the other way, to infer
62
//   the `body` attribute.
63
  data: {
64
    get: function() {
65
      if (this._body) {
66
        return this.processor.parser(this._body);
67
      } else {
68
        return this._data;
69
      }
70
    },
71
    set: function(data) {
72
      if (this._body&&data) Errors.setDataWithBody(this);
73
      this._data = data;
74
      return this;
75
    },
76
    enumerable: true
77
  },
78
79
// - **body**. Typically accessed as `content.body`, reflects the content entity
80
//   as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
81
//   `data` attribute, the `body` attribute will be inferred and vice-versa. If
82
//   you attempt to set both, an exception is raised.
83
  body: {
84
    get: function() {
85
      if (this._data) {
86
        return this.processor.stringify(this._data);
87
      } else {
88
        return this._body.toString();
89
      }
90
    },
91
    set: function(body) {
92
      if (this._data&&body) Errors.setBodyWithData(this);
93
      this._body = body;
94
      return this;
95
    },
96
    enumerable: true
97
  },
98
99
// - **processor**. The functions that will be used to convert to/from `data` and
100
//   `body` attributes. You can add processors. The two that are built-in are for
101
//   `text/plain`, which is basically an identity transformation and
102
//   `application/json` and other JSON-based media types (including custom media
103
//   types with `+json`). You can add your own processors. See below.
104
  processor: {
105
    get: function() {
106
      var processor = Content.processors[this.type];
107
      if (processor) {
108
        return processor;
109
      } else {
110
        // Return the first processor that matches any part of the
111
        // content type. ex: application/vnd.foobar.baz+json will match json.
112
        var main = this.type.split(";")[0];
113
        var parts = main.split(/\+|\//);
114
        for (var i=0, l=parts.length; i < l; i++) {
115
          processor = Content.processors[parts[i]]
116
        }
117
        return processor || {parser:identity,stringify:toString};
118
      }
119
    },
120
    enumerable: true
121
  },
122
123
// - **length**. Typically accessed as `content.length`, returns the length in
124
//   bytes of the raw content entity.
125
  length: {
126
    get: function() {
127
      if (typeof Buffer !== 'undefined') {
128
        return Buffer.byteLength(this.body);
129
      }
130
      return this.body.length;
131
    }
132
  }
133
});
134
135
Content.processors = {};
136
137
// The `registerProcessor` function allows you to add your own processors to
138
// convert content entities. Each processor consists of a Javascript object with
139
// two properties:
140
// - **parser**. The function used to parse a raw content entity and convert it
141
//   into a Javascript data type.
142
// - **stringify**. The function used to convert a Javascript data type into a
143
//   raw content entity.
144
Content.registerProcessor = function(types,processor) {
145
146
// You can pass an array of types that will trigger this processor, or just one.
147
// We determine the array via duck-typing here.
148
  if (types.forEach) {
149
    types.forEach(function(type) {
150
      Content.processors[type] = processor;
151
    });
152
  } else {
153
    // If you didn't pass an array, we just use what you pass in.
154
    Content.processors[types] = processor;
155
  }
156
};
157
158
// Register the identity processor, which is used for text-based media types.
159
var identity = function(x) { return x; }
160
  , toString = function(x) { return x.toString(); }
161
Content.registerProcessor(
162
  ["text/html","text/plain","text"],
163
  { parser: identity, stringify: toString });
164
165
// Register the JSON processor, which is used for JSON-based media types.
166
Content.registerProcessor(
167
  ["application/json; charset=utf-8","application/json","json"],
168
  {
169
    parser: function(string) {
170
      return JSON.parse(string);
171
    },
172
    stringify: function(data) {
173
      return JSON.stringify(data); }});
174
175
var qs = require('querystring');
176
// Register the post processor, which is used for JSON-based media types.
177
Content.registerProcessor(
178
  ["application/x-www-form-urlencoded"],
179
  { parser : qs.parse, stringify : qs.stringify });
180
181
// Error functions are defined separately here in an attempt to make the code
182
// easier to read.
183
var Errors = {
184
  setDataWithBody: function(object) {
185
    throw new Error("Attempt to set data attribute of a content object " +
186
        "when the body attributes was already set.");
187
  },
188
  setBodyWithData: function(object) {
189
    throw new Error("Attempt to set body attribute of a content object " +
190
        "when the data attributes was already set.");
191
  }
192
}
193
module.exports = Content;
(-)a/api/v1/doc/lib/swagger-client.js (+3294 lines)
Line 0 Link Here
1
/**
2
 * swagger-client - swagger.js is a javascript client for use with swaggering APIs.
3
 * @version v2.1.9-M1
4
 * @link http://swagger.io
5
 * @license apache 2.0
6
 */
7
(function(){
8
var ArrayModel = function(definition) {
9
  this.name = "arrayModel";
10
  this.definition = definition || {};
11
  this.properties = [];
12
13
  var requiredFields = definition.enum || [];
14
  var innerType = definition.items;
15
  if(innerType) {
16
    if(innerType.type) {
17
      this.type = typeFromJsonSchema(innerType.type, innerType.format);
18
    }
19
    else {
20
      this.ref = innerType.$ref;
21
    }
22
  }
23
  return this;
24
};
25
26
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
27
  var result;
28
  modelsToIgnore = (modelsToIgnore||{});
29
  if(this.type) {
30
    result = this.type;
31
  }
32
  else if (this.ref) {
33
    var name = simpleRef(this.ref);
34
    if(typeof modelsToIgnore[name] === 'undefined') {
35
      modelsToIgnore[name] = this;
36
      result = models[name].createJSONSample(modelsToIgnore);
37
    }
38
    else {
39
      return name;
40
    }
41
  }
42
  return [ result ];
43
};
44
45
ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
46
  var result;
47
  modelsToIgnore = (modelsToIgnore || {});
48
  if(this.type) {
49
    result = type;
50
  }
51
  else if (this.ref) {
52
    var name = simpleRef(this.ref);
53
    result = models[name].getSampleValue(modelsToIgnore);
54
  }
55
  return [ result ];
56
};
57
58
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
59
  var propertiesStr = [];
60
  var i, prop;
61
  for (i = 0; i < this.properties.length; i++) {
62
    prop = this.properties[i];
63
    propertiesStr.push(prop.toString());
64
  }
65
66
  var strong = '<span class="strong">';
67
  var stronger = '<span class="stronger">';
68
  var strongClose = '</span>';
69
  var classOpen = strong + 'array' + ' {' + strongClose;
70
  var classClose = strong + '}' + strongClose;
71
  var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
72
73
  if (!modelsToIgnore)
74
    modelsToIgnore = {};
75
  modelsToIgnore[this.name] = this;
76
  for (i = 0; i < this.properties.length; i++) {
77
    prop = this.properties[i];
78
    var ref = prop.$ref;
79
    var model = models[ref];
80
    if (model && typeof modelsToIgnore[ref] === 'undefined') {
81
      returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
82
    }
83
  }
84
  return returnVal;
85
};
86
87
88
/**
89
 * SwaggerAuthorizations applys the correct authorization to an operation being executed
90
 */
91
var SwaggerAuthorizations = function() {
92
  this.authz = {};
93
};
94
95
SwaggerAuthorizations.prototype.add = function(name, auth) {
96
  this.authz[name] = auth;
97
  return auth;
98
};
99
100
SwaggerAuthorizations.prototype.remove = function(name) {
101
  return delete this.authz[name];
102
};
103
104
SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
105
  var status = null;
106
  var key, name, value, result;
107
108
  // if the "authorizations" key is undefined, or has an empty array, add all keys
109
  if (typeof authorizations === 'undefined' || Object.keys(authorizations).length === 0) {
110
    for (key in this.authz) {
111
      value = this.authz[key];
112
      result = value.apply(obj, authorizations);
113
      if (result === true)
114
        status = true;
115
    }
116
  }
117
  else {
118
    // 2.0 support
119
    if (Array.isArray(authorizations)) {
120
121
      for (var i = 0; i < authorizations.length; i++) {
122
        var auth = authorizations[i];
123
        for (name in auth) {
124
          for (key in this.authz) {
125
            if (key == name) {
126
              value = this.authz[key];
127
              result = value.apply(obj, authorizations);
128
              if (result === true)
129
                status = true;
130
            }
131
          }
132
        }
133
      }
134
    }
135
    else {
136
      // 1.2 support
137
      for (name in authorizations) {
138
        for (key in this.authz) {
139
          if (key == name) {
140
            value = this.authz[key];
141
            result = value.apply(obj, authorizations);
142
            if (result === true)
143
              status = true;
144
          }
145
        }
146
      }
147
    }
148
  }
149
150
  return status;
151
};
152
153
/**
154
 * ApiKeyAuthorization allows a query param or header to be injected
155
 */
156
var ApiKeyAuthorization = function(name, value, type) {
157
  this.name = name;
158
  this.value = value;
159
  this.type = type;
160
};
161
162
ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
163
  if (this.type === "query") {
164
    if (obj.url.indexOf('?') > 0)
165
      obj.url = obj.url + "&" + this.name + "=" + this.value;
166
    else
167
      obj.url = obj.url + "?" + this.name + "=" + this.value;
168
    return true;
169
  } else if (this.type === "header") {
170
    obj.headers[this.name] = this.value;
171
    return true;
172
  }
173
};
174
175
var CookieAuthorization = function(cookie) {
176
  this.cookie = cookie;
177
};
178
179
CookieAuthorization.prototype.apply = function(obj, authorizations) {
180
  obj.cookieJar = obj.cookieJar || CookieJar();
181
  obj.cookieJar.setCookie(this.cookie);
182
  return true;
183
};
184
185
/**
186
 * Password Authorization is a basic auth implementation
187
 */
188
var PasswordAuthorization = function(name, username, password) {
189
  this.name = name;
190
  this.username = username;
191
  this.password = password;
192
  this._btoa = null;
193
  if (typeof window !== 'undefined')
194
    this._btoa = btoa;
195
  else
196
    this._btoa = require("btoa");
197
};
198
199
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
200
  var base64encoder = this._btoa;
201
  obj.headers.Authorization = "Basic " + base64encoder(this.username + ":" + this.password);
202
  return true;
203
};
204
var __bind = function(fn, me){
205
  return function(){
206
    return fn.apply(me, arguments);
207
  };
208
};
209
210
fail = function(message) {
211
  log(message);
212
};
213
214
log = function(){
215
  log.history = log.history || [];
216
  log.history.push(arguments);
217
  if(this.console){
218
    console.log( Array.prototype.slice.call(arguments)[0] );
219
  }
220
};
221
222
if (!Array.prototype.indexOf) {
223
  Array.prototype.indexOf = function(obj, start) {
224
    for (var i = (start || 0), j = this.length; i < j; i++) {
225
      if (this[i] === obj) { return i; }
226
    }
227
    return -1;
228
  };
229
}
230
231
/**
232
 * allows override of the default value based on the parameter being
233
 * supplied
234
 **/
235
var applyParameterMacro = function (operation, parameter) {
236
  var e = (typeof window !== 'undefined' ? window : exports);
237
  if(e.parameterMacro)
238
    return e.parameterMacro(operation, parameter);
239
  else
240
    return parameter.defaultValue;
241
};
242
243
/**
244
 * allows overriding the default value of an model property
245
 **/
246
var applyModelPropertyMacro = function (model, property) {
247
  var e = (typeof window !== 'undefined' ? window : exports);
248
  if(e.modelPropertyMacro)
249
    return e.modelPropertyMacro(model, property);
250
  else
251
    return property.defaultValue;
252
};
253
254
/**
255
 * PrimitiveModel
256
 **/
257
var PrimitiveModel = function(definition) {
258
  this.name = "name";
259
  this.definition = definition || {};
260
  this.properties = [];
261
262
  var requiredFields = definition.enum || [];
263
  this.type = typeFromJsonSchema(definition.type, definition.format);
264
};
265
266
PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
267
  var result = this.type;
268
  return result;
269
};
270
271
PrimitiveModel.prototype.getSampleValue = function() {
272
  var result = this.type;
273
  return null;
274
};
275
276
PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
277
  var propertiesStr = [];
278
  var i, prop;
279
  for (i = 0; i < this.properties.length; i++) {
280
    prop = this.properties[i];
281
    propertiesStr.push(prop.toString());
282
  }
283
284
  var strong = '<span class="strong">';
285
  var stronger = '<span class="stronger">';
286
  var strongClose = '</span>';
287
  var classOpen = strong + this.name + ' {' + strongClose;
288
  var classClose = strong + '}' + strongClose;
289
  var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
290
291
  if (!modelsToIgnore)
292
    modelsToIgnore = {};
293
  modelsToIgnore[this.name] = this;
294
  for (i = 0; i < this.properties.length; i++) {
295
    prop = this.properties[i];
296
    var ref = prop.$ref;
297
    var model = models[ref];
298
    if (model && typeof modelsToIgnore[ref] === 'undefined') {
299
      returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
300
    }
301
  }
302
  return returnVal;
303
};
304
/**
305
 * Resolves a spec's remote references
306
 */
307
var Resolver = function (){};
308
309
Resolver.prototype.resolve = function(spec, callback, scope) {
310
  this.scope = (scope || this);
311
  var host, name, path, property, propertyName, type;
312
  var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {};
313
314
  // store objects for dereferencing
315
  var resolutionTable = {};
316
317
  // models
318
  for(name in spec.definitions) {
319
    var model = spec.definitions[name];
320
    for(propertyName in model.properties) {
321
      property = model.properties[propertyName];
322
      this.resolveTo(property, resolutionTable);
323
    }
324
  }
325
  // operations
326
  for(name in spec.paths) {
327
    var method, operation, responseCode;
328
    path = spec.paths[name];
329
    for(method in path) {
330
      operation = path[method];
331
      var i, parameters = operation.parameters;
332
      for(i in parameters) {
333
        var parameter = parameters[i];
334
        if(parameter.in === 'body' && parameter.schema) {
335
          this.resolveTo(parameter.schema, resolutionTable);
336
        }
337
        if(parameter.$ref) {
338
          this.resolveInline(spec, parameter, resolutionTable, unresolvedRefs);
339
        }
340
      }
341
      for(responseCode in operation.responses) {
342
        var response = operation.responses[responseCode];
343
        if(response.schema) {
344
          this.resolveTo(response.schema, resolutionTable);
345
        }
346
      }
347
    }
348
  }
349
  // get hosts
350
  var opts = {}, expectedCalls = 0;
351
  for(name in resolutionTable) {
352
    var parts = name.split('#');
353
    if(parts.length == 2) {
354
      host = parts[0]; path = parts[1];
355
      if(!Array.isArray(opts[host])) {
356
        opts[host] = [];
357
        expectedCalls += 1;
358
      }
359
      opts[host].push(path);
360
    }
361
  }
362
363
  for(name in opts) {
364
    var self = this, opt = opts[name];
365
    host = name;
366
367
    var obj = {
368
      useJQuery: false,  // TODO
369
      url: host,
370
      method: "get",
371
      headers: {
372
        accept: this.scope.swaggerRequestHeaders || 'application/json'
373
      },
374
      on: {
375
        error: function(response) {
376
          processedCalls += 1;
377
          var i;
378
          for(i = 0; i < opt.length; i++) {
379
            // fail all of these
380
            var resolved = host + '#' + opt[i];
381
            unresolvedRefs[resolved] = null;
382
          }
383
          if(processedCalls === expectedCalls)
384
            self.finish(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback);
385
        },
386
        response: function(response) {
387
          var i, j, swagger = response.obj;
388
          processedCalls += 1;
389
          for(i = 0; i < opt.length; i++) {
390
            var location = swagger, path = opt[i], parts = path.split('/');
391
            for(j = 0; j < parts.length; j++) {
392
              var segment = parts[j];
393
              if(typeof location === 'undefined')
394
                break;
395
              if(segment.length > 0)
396
                location = location[segment];
397
            }
398
            var resolved = host + '#' + path, resolvedName = parts[j-1];
399
            if(typeof location !== 'undefined') {
400
              resolvedRefs[resolved] = {
401
                name: resolvedName,
402
                obj: location
403
              };
404
            }
405
            else unresolvedRefs[resolved] = null;
406
          }
407
          if(processedCalls === expectedCalls)
408
            self.finish(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback);
409
        }
410
      }
411
    };
412
    authorizations.apply(obj);
413
    new SwaggerHttp().execute(obj);
414
  }
415
  if(Object.keys(opts).length === 0)
416
    callback.call(this.scope, spec, unresolvedRefs);
417
};
418
419
Resolver.prototype.finish = function(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback) {
420
  // walk resolution table and replace with resolved refs
421
  var ref;
422
  for(ref in resolutionTable) {
423
    var i, locations = resolutionTable[ref];
424
    for(i = 0; i < locations.length; i++) {
425
      var resolvedTo = resolvedRefs[locations[i].obj.$ref];
426
      if(resolvedTo) {
427
        if(!spec.definitions)
428
          spec.definitions = {};
429
        if(locations[i].resolveAs === '$ref') {
430
          spec.definitions[resolvedTo.name] = resolvedTo.obj;
431
          locations[i].obj.$ref = '#/definitions/' + resolvedTo.name;
432
        }
433
        else if (locations[i].resolveAs === 'inline') {
434
          var key;
435
          var targetObj = locations[i].obj;
436
          delete targetObj.$ref;
437
          for(key in resolvedTo.obj) {
438
            targetObj[key] = resolvedTo.obj[key];
439
          }
440
        }
441
      }
442
    }
443
  }
444
  callback.call(this.scope, spec, unresolvedRefs);
445
};
446
447
/**
448
 * immediately in-lines local refs, queues remote refs
449
 * for inline resolution
450
 */
451
Resolver.prototype.resolveInline = function (spec, property, objs, unresolvedRefs) {
452
  var ref = property.$ref;
453
  if(ref) {
454
    if(ref.indexOf('http') === 0) {
455
      if(Array.isArray(objs[ref])) {
456
        objs[ref].push({obj: property, resolveAs: 'inline'});
457
      }
458
      else {
459
        objs[ref] = [{obj: property, resolveAs: 'inline'}];
460
      }
461
    }
462
    else if (ref.indexOf('#') === 0) {
463
      // local resolve
464
      var shortenedRef = ref.substring(1);
465
      var i, parts = shortenedRef.split('/'), location = spec;
466
      for(i = 0; i < parts.length; i++) {
467
        var part = parts[i];
468
        if(part.length > 0) {
469
          location = location[part];
470
        }
471
      }
472
      if(location) {
473
        delete property.$ref;
474
        var key;
475
        for(key in location) {
476
          property[key] = location[key];
477
        }
478
      }
479
      else unresolvedRefs[ref] = null;
480
    }
481
  }
482
  else if(property.type === 'array') {
483
    this.resolveTo(property.items, objs);
484
  }
485
};
486
487
Resolver.prototype.resolveTo = function (property, objs) {
488
  var ref = property.$ref;
489
  if(ref) {
490
    if(ref.indexOf('http') === 0) {
491
      if(Array.isArray(objs[ref])) {
492
        objs[ref].push({obj: property, resolveAs: '$ref'});
493
      }
494
      else {
495
        objs[ref] = [{obj: property, resolveAs: '$ref'}];
496
      }
497
    }
498
  }
499
  else if(property.type === 'array') {
500
    var items = property.items;
501
    this.resolveTo(items, objs);
502
  }
503
};
504
var addModel = function(name, model) {
505
  models[name] = model;
506
};
507
508
var SwaggerClient = function(url, options) {
509
  this.isBuilt = false;
510
  this.url = null;
511
  this.debug = false;
512
  this.basePath = null;
513
  this.modelsArray = [];
514
  this.authorizations = null;
515
  this.authorizationScheme = null;
516
  this.isValid = false;
517
  this.info = null;
518
  this.useJQuery = false;
519
  this.resourceCount = 0;
520
521
  if(typeof url !== 'undefined')
522
    return this.initialize(url, options);
523
};
524
525
SwaggerClient.prototype.initialize = function (url, options) {
526
  this.models = models = {};
527
528
  options = (options||{});
529
530
  if(typeof url === 'string')
531
    this.url = url;
532
  else if(typeof url === 'object') {
533
    options = url;
534
    this.url = options.url;
535
  }
536
  this.swaggerRequstHeaders = options.swaggerRequstHeaders || 'application/json;charset=utf-8,*/*';
537
  this.defaultSuccessCallback = options.defaultSuccessCallback || null;
538
  this.defaultErrorCallback = options.defaultErrorCallback || null;
539
540
  if (typeof options.success === 'function')
541
    this.success = options.success;
542
543
  if (options.useJQuery)
544
    this.useJQuery = options.useJQuery;
545
546
  if (options.authorizations) {
547
    this.clientAuthorizations = options.authorizations;
548
  } else {
549
    this.clientAuthorizations = authorizations;
550
  }
551
552
  this.supportedSubmitMethods = options.supportedSubmitMethods || [];
553
  this.failure = options.failure || function() {};
554
  this.progress = options.progress || function() {};
555
  this.spec = options.spec;
556
  this.options = options;
557
558
  if (typeof options.success === 'function') {
559
    this.ready = true;
560
    this.build();
561
  }
562
};
563
564
SwaggerClient.prototype.build = function(mock) {
565
  if (this.isBuilt) return this;
566
  var self = this;
567
  this.progress('fetching resource list: ' + this.url);
568
  var obj = {
569
    useJQuery: this.useJQuery,
570
    url: this.url,
571
    method: "get",
572
    headers: {
573
      accept: this.swaggerRequstHeaders
574
    },
575
    on: {
576
      error: function(response) {
577
        if (self.url.substring(0, 4) !== 'http')
578
          return self.fail('Please specify the protocol for ' + self.url);
579
        else if (response.status === 0)
580
          return self.fail('Can\'t read from server.  It may not have the appropriate access-control-origin settings.');
581
        else if (response.status === 404)
582
          return self.fail('Can\'t read swagger JSON from ' + self.url);
583
        else
584
          return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
585
      },
586
      response: function(resp) {
587
        var responseObj = resp.obj || JSON.parse(resp.data);
588
        self.swaggerVersion = responseObj.swaggerVersion;
589
590
        if(responseObj.swagger && parseInt(responseObj.swagger) === 2) {
591
          self.swaggerVersion = responseObj.swagger;
592
          new Resolver().resolve(responseObj, self.buildFromSpec, self);
593
          self.isValid = true;
594
        }
595
        else {
596
          if (self.swaggerVersion === '1.2') {
597
            return self.buildFrom1_2Spec(responseObj);
598
          } else {
599
            return self.buildFrom1_1Spec(responseObj);
600
          }
601
        }
602
      }
603
    }
604
  };
605
  if(this.spec) {
606
    setTimeout(function() {
607
      new Resolver().resolve(self.spec, self.buildFromSpec, self);
608
   }, 10);
609
  }
610
  else {
611
    authorizations.apply(obj);
612
    if(mock)
613
      return obj;
614
    new SwaggerHttp().execute(obj);
615
  }
616
  return this;
617
};
618
619
SwaggerClient.prototype.buildFromSpec = function(response) {
620
  if(this.isBuilt) return this;
621
622
  this.info = response.info || {};
623
  this.title = response.title || '';
624
  this.host = response.host || '';
625
  this.schemes = response.schemes || [];
626
  this.basePath = response.basePath || '';
627
  this.apis = {};
628
  this.apisArray = [];
629
  this.consumes = response.consumes;
630
  this.produces = response.produces;
631
  this.securityDefinitions = response.securityDefinitions;
632
633
  // legacy support
634
  this.authSchemes = response.securityDefinitions;
635
636
  var definedTags = {};
637
  if(Array.isArray(response.tags)) {
638
    definedTags = {};
639
    for(k = 0; k < response.tags.length; k++) {
640
      var t = response.tags[k];
641
      definedTags[t.name] = t;
642
    }
643
  }
644
645
  var location;
646
  if(typeof this.url === 'string') {
647
    location = this.parseUri(this.url);
648
  }
649
650
  if(typeof this.schemes === 'undefined' || this.schemes.length === 0) {
651
    this.scheme = location.scheme || 'http';
652
  }
653
  else {
654
    this.scheme = this.schemes[0];
655
  }
656
657
  if(typeof this.host === 'undefined' || this.host === '') {
658
    this.host = location.host;
659
    if (location.port) {
660
      this.host = this.host + ':' + location.port;
661
    }
662
  }
663
664
  this.definitions = response.definitions;
665
  var key;
666
  for(key in this.definitions) {
667
    var model = new Model(key, this.definitions[key]);
668
    if(model) {
669
      models[key] = model;
670
    }
671
  }
672
673
  // get paths, create functions for each operationId
674
  var path;
675
  var operations = [];
676
  for(path in response.paths) {
677
    if(typeof response.paths[path] === 'object') {
678
      var httpMethod;
679
      for(httpMethod in response.paths[path]) {
680
        if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) {
681
          continue;
682
        }
683
        var operation = response.paths[path][httpMethod];
684
        var tags = operation.tags;
685
        if(typeof tags === 'undefined') {
686
          operation.tags = [ 'default' ];
687
          tags = operation.tags;
688
        }
689
        var operationId = this.idFromOp(path, httpMethod, operation);
690
        var operationObject = new Operation (
691
          this,
692
          operation.scheme,
693
          operationId,
694
          httpMethod,
695
          path,
696
          operation,
697
          this.definitions
698
        );
699
        // bind this operation's execute command to the api
700
        if(tags.length > 0) {
701
          var i;
702
          for(i = 0; i < tags.length; i++) {
703
            var tag = this.tagFromLabel(tags[i]);
704
            var operationGroup = this[tag];
705
            if(typeof this.apis[tag] === 'undefined')
706
              this.apis[tag] = {};
707
            if(typeof operationGroup === 'undefined') {
708
              this[tag] = [];
709
              operationGroup = this[tag];
710
              operationGroup.operations = {};
711
              operationGroup.label = tag;
712
              operationGroup.apis = [];
713
              var tagObject = definedTags[tag];
714
              if(typeof tagObject === 'object') {
715
                operationGroup.description = tagObject.description;
716
                operationGroup.externalDocs = tagObject.externalDocs;
717
              }
718
              this[tag].help = this.help.bind(operationGroup);
719
              this.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
720
            }
721
            if(typeof this.apis[tag].help !== 'function')
722
              this.apis[tag].help = this.help.bind(operationGroup);
723
            // bind to the apis object
724
            this.apis[tag][operationId] = operationObject.execute.bind(operationObject);
725
            this.apis[tag][operationId].help = operationObject.help.bind(operationObject);
726
            this.apis[tag][operationId].asCurl = operationObject.asCurl.bind(operationObject);
727
            operationGroup[operationId] = operationObject.execute.bind(operationObject);
728
            operationGroup[operationId].help = operationObject.help.bind(operationObject);
729
            operationGroup[operationId].asCurl = operationObject.asCurl.bind(operationObject);
730
731
            operationGroup.apis.push(operationObject);
732
            operationGroup.operations[operationId] = operationObject;
733
734
            // legacy UI feature
735
            var j;
736
            var api;
737
            for(j = 0; j < this.apisArray.length; j++) {
738
              if(this.apisArray[j].tag === tag) {
739
                api = this.apisArray[j];
740
              }
741
            }
742
            if(api) {
743
              api.operationsArray.push(operationObject);
744
            }
745
          }
746
        }
747
        else {
748
          log('no group to bind to');
749
        }
750
      }
751
    }
752
  }
753
  this.isBuilt = true;
754
  if (this.success) {
755
    this.isValid = true;
756
    this.isBuilt = true;
757
    this.success();
758
  }
759
  return this;
760
};
761
762
SwaggerClient.prototype.parseUri = function(uri) {
763
  var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
764
  var parts = urlParseRE.exec(uri);
765
  return {
766
    scheme: parts[4].replace(':',''),
767
    host: parts[11],
768
    port: parts[12],
769
    path: parts[15]
770
  };
771
};
772
773
SwaggerClient.prototype.help = function(dontPrint) {
774
  var i;
775
  var output = 'operations for the "' + this.label + '" tag';
776
  for(i = 0; i < this.apis.length; i++) {
777
    var api = this.apis[i];
778
    output += '\n  * ' + api.nickname + ': ' + api.operation.summary;
779
  }
780
  if(dontPrint)
781
    return output;
782
  else {
783
    log(output);
784
    return output;
785
  }
786
};
787
788
SwaggerClient.prototype.tagFromLabel = function(label) {
789
  return label;
790
};
791
792
SwaggerClient.prototype.idFromOp = function(path, httpMethod, op) {
793
  var opId = op.operationId || (path.substring(1) + '_' + httpMethod);
794
  return opId.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()\+\s]/g,'_');
795
};
796
797
SwaggerClient.prototype.fail = function(message) {
798
  this.failure(message);
799
  throw message;
800
};
801
802
var OperationGroup = function(tag, description, externalDocs, operation) {
803
  this.tag = tag;
804
  this.path = tag;
805
  this.description = description;
806
  this.externalDocs = externalDocs;
807
  this.name = tag;
808
  this.operation = operation;
809
  this.operationsArray = [];
810
};
811
812
var Operation = function(parent, scheme, operationId, httpMethod, path, args, definitions) {
813
  var errors = [];
814
  parent = parent||{};
815
  args = args||{};
816
817
  this.operations = {};
818
  this.operation = args;
819
  this.deprecated = args.deprecated;
820
  this.consumes = args.consumes;
821
  this.produces = args.produces;
822
  this.parent = parent;
823
  this.host = parent.host || 'localhost';
824
  this.schemes = parent.schemes;
825
  this.scheme = scheme || parent.scheme || 'http';
826
  this.basePath = parent.basePath || '/';
827
  this.nickname = (operationId||errors.push('Operations must have a nickname.'));
828
  this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
829
  this.path = (path||errors.push('Operation ' + this.nickname + ' is missing path.'));
830
  this.parameters = args !== null ? (args.parameters||[]) : {};
831
  this.summary = args.summary || '';
832
  this.responses = (args.responses||{});
833
  this.type = null;
834
  this.security = args.security;
835
  this.authorizations = args.security;
836
  this.description = args.description;
837
  this.useJQuery = parent.useJQuery;
838
839
  if(typeof this.deprecated === 'string') {
840
    switch(this.deprecated.toLowerCase()) {
841
      case 'true': case 'yes': case '1': {
842
        this.deprecated = true;
843
        break;
844
      }
845
      case 'false': case 'no': case '0': case null: {
846
        this.deprecated = false;
847
        break;
848
      }
849
      default: this.deprecated = Boolean(this.deprecated);
850
    }
851
  }
852
853
  var i, model;
854
855
  if(definitions) {
856
    // add to global models
857
    var key;
858
    for(key in this.definitions) {
859
      model = new Model(key, definitions[key]);
860
      if(model) {
861
        models[key] = model;
862
      }
863
    }
864
  }
865
  for(i = 0; i < this.parameters.length; i++) {
866
    var param = this.parameters[i];
867
    if(param.type === 'array') {
868
      param.isList = true;
869
      param.allowMultiple = true;
870
    }
871
    var innerType = this.getType(param);
872
    if(innerType && innerType.toString().toLowerCase() === 'boolean') {
873
      param.allowableValues = {};
874
      param.isList = true;
875
      param['enum'] = ["true", "false"];
876
    }
877
    if(typeof param['enum'] !== 'undefined') {
878
      var id;
879
      param.allowableValues = {};
880
      param.allowableValues.values = [];
881
      param.allowableValues.descriptiveValues = [];
882
      for(id = 0; id < param['enum'].length; id++) {
883
        var value = param['enum'][id];
884
        var isDefault = (value === param.default) ? true : false;
885
        param.allowableValues.values.push(value);
886
        param.allowableValues.descriptiveValues.push({value : value, isDefault: isDefault});
887
      }
888
    }
889
    if(param.type === 'array') {
890
      innerType = [innerType];
891
      if(typeof param.allowableValues === 'undefined') {
892
        // can't show as a list if no values to select from
893
        delete param.isList;
894
        delete param.allowMultiple;
895
      }
896
    }
897
    param.signature = this.getModelSignature(innerType, models).toString();
898
    param.sampleJSON = this.getModelSampleJSON(innerType, models);
899
    param.responseClassSignature = param.signature;
900
  }
901
902
  var defaultResponseCode, response, responses = this.responses;
903
904
  if(responses['200']) {
905
    response = responses['200'];
906
    defaultResponseCode = '200';
907
  }
908
  else if(responses['201']) {
909
    response = responses['201'];
910
    defaultResponseCode = '201';
911
  }
912
  else if(responses['202']) {
913
    response = responses['202'];
914
    defaultResponseCode = '202';
915
  }
916
  else if(responses['203']) {
917
    response = responses['203'];
918
    defaultResponseCode = '203';
919
  }
920
  else if(responses['204']) {
921
    response = responses['204'];
922
    defaultResponseCode = '204';
923
  }
924
  else if(responses['205']) {
925
    response = responses['205'];
926
    defaultResponseCode = '205';
927
  }
928
  else if(responses['206']) {
929
    response = responses['206'];
930
    defaultResponseCode = '206';
931
  }
932
  else if(responses['default']) {
933
    response = responses['default'];
934
    defaultResponseCode = 'default';
935
  }
936
937
  if(response && response.schema) {
938
    var resolvedModel = this.resolveModel(response.schema, definitions);
939
    delete responses[defaultResponseCode];
940
    if(resolvedModel) {
941
      this.successResponse = {};
942
      this.successResponse[defaultResponseCode] = resolvedModel;
943
    }
944
    else {
945
      this.successResponse = {};
946
      this.successResponse[defaultResponseCode] = response.schema.type;
947
    }
948
    this.type = response;
949
  }
950
951
  if (errors.length > 0) {
952
    if(this.resource && this.resource.api && this.resource.api.fail)
953
      this.resource.api.fail(errors);
954
  }
955
956
  return this;
957
};
958
959
OperationGroup.prototype.sort = function(sorter) {
960
961
};
962
963
Operation.prototype.getType = function (param) {
964
  var type = param.type;
965
  var format = param.format;
966
  var isArray = false;
967
  var str;
968
  if(type === 'integer' && format === 'int32')
969
    str = 'integer';
970
  else if(type === 'integer' && format === 'int64')
971
    str = 'long';
972
  else if(type === 'integer')
973
    str = 'integer';
974
  else if(type === 'string') {
975
    if(format === 'date-time')
976
      str = 'date-time';
977
    else if(format === 'date')
978
      str = 'date';
979
    else
980
      str = 'string';
981
  }
982
  else if(type === 'number' && format === 'float')
983
    str = 'float';
984
  else if(type === 'number' && format === 'double')
985
    str = 'double';
986
  else if(type === 'number')
987
    str = 'double';
988
  else if(type === 'boolean')
989
    str = 'boolean';
990
  else if(type === 'array') {
991
    isArray = true;
992
    if(param.items)
993
      str = this.getType(param.items);
994
  }
995
  if(param.$ref)
996
    str = param.$ref;
997
998
  var schema = param.schema;
999
  if(schema) {
1000
    var ref = schema.$ref;
1001
    if(ref) {
1002
      ref = simpleRef(ref);
1003
      if(isArray)
1004
        return [ ref ];
1005
      else
1006
        return ref;
1007
    }
1008
    else
1009
      return this.getType(schema);
1010
  }
1011
  if(isArray)
1012
    return [ str ];
1013
  else
1014
    return str;
1015
};
1016
1017
Operation.prototype.resolveModel = function (schema, definitions) {
1018
  if(typeof schema.$ref !== 'undefined') {
1019
    var ref = schema.$ref;
1020
    if(ref.indexOf('#/definitions/') === 0)
1021
      ref = ref.substring('#/definitions/'.length);
1022
    if(definitions[ref]) {
1023
      return new Model(ref, definitions[ref]);
1024
    }
1025
  }
1026
  if(schema.type === 'array')
1027
    return new ArrayModel(schema);
1028
  else
1029
    return null;
1030
};
1031
1032
Operation.prototype.help = function(dontPrint) {
1033
  var out = this.nickname + ': ' + this.summary + '\n';
1034
  for(var i = 0; i < this.parameters.length; i++) {
1035
    var param = this.parameters[i];
1036
    var typeInfo = param.signature;
1037
    out += '\n  * ' + param.name + ' (' + typeInfo + '): ' + param.description;
1038
  }
1039
  if(typeof dontPrint === 'undefined')
1040
    log(out);
1041
  return out;
1042
};
1043
1044
Operation.prototype.getModelSignature = function(type, definitions) {
1045
  var isPrimitive, listType;
1046
1047
  if(type instanceof Array) {
1048
    listType = true;
1049
    type = type[0];
1050
  }
1051
  else if(typeof type === 'undefined')
1052
    type = 'undefined';
1053
1054
  if(type === 'string')
1055
    isPrimitive = true;
1056
  else
1057
    isPrimitive = (listType && definitions[listType]) || (definitions[type]) ? false : true;
1058
  if (isPrimitive) {
1059
    if(listType)
1060
      return 'Array[' + type + ']';
1061
    else
1062
      return type.toString();
1063
  } else {
1064
    if (listType)
1065
      return 'Array[' + definitions[type].getMockSignature() + ']';
1066
    else
1067
      return definitions[type].getMockSignature();
1068
  }
1069
};
1070
1071
Operation.prototype.supportHeaderParams = function () {
1072
  return true;
1073
};
1074
1075
Operation.prototype.supportedSubmitMethods = function () {
1076
  return this.parent.supportedSubmitMethods;
1077
};
1078
1079
Operation.prototype.getHeaderParams = function (args) {
1080
  var headers = this.setContentTypes(args, {});
1081
  for(var i = 0; i < this.parameters.length; i++) {
1082
    var param = this.parameters[i];
1083
    if(typeof args[param.name] !== 'undefined') {
1084
      if (param.in === 'header') {
1085
        var value = args[param.name];
1086
        if(Array.isArray(value))
1087
          value = value.toString();
1088
        headers[param.name] = value;
1089
      }
1090
    }
1091
  }
1092
  return headers;
1093
};
1094
1095
Operation.prototype.urlify = function (args) {
1096
  var formParams = {};
1097
  var requestUrl = this.path;
1098
1099
  // grab params from the args, build the querystring along the way
1100
  var querystring = '';
1101
  for(var i = 0; i < this.parameters.length; i++) {
1102
    var param = this.parameters[i];
1103
    if(typeof args[param.name] !== 'undefined') {
1104
      if(param.in === 'path') {
1105
        var reg = new RegExp('\{' + param.name + '\}', 'gi');
1106
        var value = args[param.name];
1107
        if(Array.isArray(value))
1108
          value = this.encodePathCollection(param.collectionFormat, param.name, value);
1109
        else
1110
          value = this.encodePathParam(value);
1111
        requestUrl = requestUrl.replace(reg, value);
1112
      }
1113
      else if (param.in === 'query' && typeof args[param.name] !== 'undefined') {
1114
        if(querystring === '')
1115
          querystring += '?';
1116
        else
1117
          querystring += '&';
1118
        if(typeof param.collectionFormat !== 'undefined') {
1119
          var qp = args[param.name];
1120
          if(Array.isArray(qp))
1121
            querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp);
1122
          else
1123
            querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
1124
        }
1125
        else
1126
          querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
1127
      }
1128
      else if (param.in === 'formData')
1129
        formParams[param.name] = args[param.name];
1130
    }
1131
  }
1132
  var url = this.scheme + '://' + this.host;
1133
1134
  if(this.basePath !== '/')
1135
    url += this.basePath;
1136
1137
  return url + requestUrl + querystring;
1138
};
1139
1140
Operation.prototype.getMissingParams = function(args) {
1141
  var missingParams = [];
1142
  // check required params, track the ones that are missing
1143
  var i;
1144
  for(i = 0; i < this.parameters.length; i++) {
1145
    var param = this.parameters[i];
1146
    if(param.required === true) {
1147
      if(typeof args[param.name] === 'undefined')
1148
        missingParams = param.name;
1149
    }
1150
  }
1151
  return missingParams;
1152
};
1153
1154
Operation.prototype.getBody = function(headers, args, opts) {
1155
  var formParams = {}, body, key;
1156
1157
  for(var i = 0; i < this.parameters.length; i++) {
1158
    var param = this.parameters[i];
1159
    if(typeof args[param.name] !== 'undefined') {
1160
      if (param.in === 'body') {
1161
        body = args[param.name];
1162
      } else if(param.in === 'formData') {
1163
        formParams[param.name] = args[param.name];
1164
      }
1165
    }
1166
  }
1167
1168
  // handle form params
1169
  if(headers['Content-Type'] === 'application/x-www-form-urlencoded') {
1170
    var encoded = "";
1171
    for(key in formParams) {
1172
      value = formParams[key];
1173
      if(typeof value !== 'undefined'){
1174
        if(encoded !== "")
1175
          encoded += "&";
1176
        encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
1177
      }
1178
    }
1179
    body = encoded;
1180
  }
1181
  else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
1182
    if(opts.useJQuery) {
1183
      var bodyParam = new FormData();
1184
      bodyParam.type = 'formData';
1185
      for (key in formParams) {
1186
        value = args[key];
1187
        if (typeof value !== 'undefined') {
1188
          // required for jquery file upload
1189
          if(value.type === 'file' && value.value) {
1190
            delete headers['Content-Type'];
1191
            bodyParam.append(key, value.value);
1192
          }
1193
          else
1194
            bodyParam.append(key, value);
1195
        }
1196
      }
1197
      body = bodyParam;
1198
    }
1199
  }
1200
1201
  return body;
1202
};
1203
1204
/**
1205
 * gets sample response for a single operation
1206
 **/
1207
Operation.prototype.getModelSampleJSON = function(type, models) {
1208
  var isPrimitive, listType, sampleJson;
1209
1210
  listType = (type instanceof Array);
1211
  isPrimitive = models[type] ? false : true;
1212
  sampleJson = isPrimitive ? void 0 : models[type].createJSONSample();
1213
  if (sampleJson) {
1214
    sampleJson = listType ? [sampleJson] : sampleJson;
1215
    if(typeof sampleJson == 'string')
1216
      return sampleJson;
1217
    else if(typeof sampleJson === 'object') {
1218
      var t = sampleJson;
1219
      if(sampleJson instanceof Array && sampleJson.length > 0) {
1220
        t = sampleJson[0];
1221
      }
1222
      if(t.nodeName) {
1223
        var xmlString = new XMLSerializer().serializeToString(t);
1224
        return this.formatXml(xmlString);
1225
      }
1226
      else
1227
        return JSON.stringify(sampleJson, null, 2);
1228
    }
1229
    else
1230
      return sampleJson;
1231
  }
1232
};
1233
1234
/**
1235
 * legacy binding
1236
 **/
1237
Operation.prototype["do"] = function(args, opts, callback, error, parent) {
1238
  return this.execute(args, opts, callback, error, parent);
1239
};
1240
1241
1242
/**
1243
 * executes an operation
1244
 **/
1245
Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
1246
  var args = arg1 || {};
1247
  var opts = {}, success, error;
1248
  if(typeof arg2 === 'object') {
1249
    opts = arg2;
1250
    success = arg3;
1251
    error = arg4;
1252
  }
1253
1254
  if(typeof arg2 === 'function') {
1255
    success = arg2;
1256
    error = arg3;
1257
  }
1258
1259
  success = (success||log);
1260
  error = (error||log);
1261
1262
  if(opts.useJQuery)
1263
    this.useJQuery = opts.useJQuery;
1264
1265
  var missingParams = this.getMissingParams(args);
1266
  if(missingParams.length > 0) {
1267
    var message = 'missing required params: ' + missingParams;
1268
    fail(message);
1269
    return;
1270
  }
1271
  var allHeaders = this.getHeaderParams(args);
1272
  var contentTypeHeaders = this.setContentTypes(args, opts);
1273
1274
  var headers = {}, attrname;
1275
  for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
1276
  for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
1277
1278
  var body = this.getBody(headers, args, opts);
1279
  var url = this.urlify(args);
1280
1281
  var obj = {
1282
    url: url,
1283
    method: this.method.toUpperCase(),
1284
    body: body,
1285
    useJQuery: this.useJQuery,
1286
    headers: headers,
1287
    on: {
1288
      response: function(response) {
1289
        return success(response, parent);
1290
      },
1291
      error: function(response) {
1292
        return error(response, parent);
1293
      }
1294
    }
1295
  };
1296
  var status = authorizations.apply(obj, this.operation.security);
1297
  if(opts.mock === true)
1298
    return obj;
1299
  else
1300
    new SwaggerHttp().execute(obj, opts);
1301
};
1302
1303
Operation.prototype.setContentTypes = function(args, opts) {
1304
  // default type
1305
  var accepts = 'application/json';
1306
  var consumes = args.parameterContentType || 'application/json';
1307
  var allDefinedParams = this.parameters;
1308
  var definedFormParams = [];
1309
  var definedFileParams = [];
1310
  var body;
1311
  var headers = {};
1312
1313
  // get params from the operation and set them in definedFileParams, definedFormParams, headers
1314
  var i;
1315
  for(i = 0; i < allDefinedParams.length; i++) {
1316
    var param = allDefinedParams[i];
1317
    if(param.in === 'formData') {
1318
      if(param.type === 'file')
1319
        definedFileParams.push(param);
1320
      else
1321
        definedFormParams.push(param);
1322
    }
1323
    else if(param.in === 'header' && opts) {
1324
      var key = param.name;
1325
      var headerValue = opts[param.name];
1326
      if(typeof opts[param.name] !== 'undefined')
1327
        headers[key] = headerValue;
1328
    }
1329
    else if(param.in === 'body' && typeof args[param.name] !== 'undefined') {
1330
      body = args[param.name];
1331
    }
1332
  }
1333
1334
  // if there's a body, need to set the consumes header via requestContentType
1335
  if (body && (this.method === 'post' || this.method === 'put' || this.method === 'patch' || this.method === 'delete')) {
1336
    if (opts.requestContentType)
1337
      consumes = opts.requestContentType;
1338
  } else {
1339
    // if any form params, content type must be set
1340
    if(definedFormParams.length > 0) {
1341
      if(opts.requestContentType)           // override if set
1342
        consumes = opts.requestContentType;
1343
      else if(definedFileParams.length > 0) // if a file, must be multipart/form-data
1344
        consumes = 'multipart/form-data';
1345
      else                                  // default to x-www-from-urlencoded
1346
        consumes = 'application/x-www-form-urlencoded';
1347
    }
1348
    else if (this.type == 'DELETE')
1349
      body = '{}';
1350
    else if (this.type != 'DELETE')
1351
      consumes = null;
1352
  }
1353
1354
  if (consumes && this.consumes) {
1355
    if (this.consumes.indexOf(consumes) === -1) {
1356
      log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes));
1357
    }
1358
  }
1359
1360
  if (opts.responseContentType) {
1361
    accepts = opts.responseContentType;
1362
  } else {
1363
    accepts = 'application/json';
1364
  }
1365
  if (accepts && this.produces) {
1366
    if (this.produces.indexOf(accepts) === -1) {
1367
      log('server can\'t produce ' + accepts);
1368
    }
1369
  }
1370
1371
  if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded'))
1372
    headers['Content-Type'] = consumes;
1373
  if (accepts)
1374
    headers.Accept = accepts;
1375
  return headers;
1376
};
1377
1378
Operation.prototype.asCurl = function (args) {
1379
  var obj = this.execute(args, {mock: true});
1380
  authorizations.apply(obj);
1381
  var results = [];
1382
  results.push('-X ' + this.method.toUpperCase());
1383
  if (obj.headers) {
1384
    var key;
1385
    for (key in obj.headers)
1386
      results.push('--header "' + key + ': ' + obj.headers[key] + '"');
1387
  }
1388
  if(obj.body) {
1389
    var body;
1390
    if(typeof obj.body === 'object')
1391
      body = JSON.stringify(obj.body);
1392
    else
1393
      body = obj.body;
1394
    results.push('-d "' + body.replace(/"/g, '\\"') + '"');
1395
  }
1396
  return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
1397
};
1398
1399
Operation.prototype.encodePathCollection = function(type, name, value) {
1400
  var encoded = '';
1401
  var i;
1402
  var separator = '';
1403
  if(type === 'ssv')
1404
    separator = '%20';
1405
  else if(type === 'tsv')
1406
    separator = '\\t';
1407
  else if(type === 'pipes')
1408
    separator = '|';
1409
  else
1410
    separator = ',';
1411
1412
  for(i = 0; i < value.length; i++) {
1413
    if(i === 0)
1414
      encoded = this.encodeQueryParam(value[i]);
1415
    else
1416
      encoded += separator + this.encodeQueryParam(value[i]);
1417
  }
1418
  return encoded;
1419
};
1420
1421
Operation.prototype.encodeQueryCollection = function(type, name, value) {
1422
  var encoded = '';
1423
  var i;
1424
  if(type === 'default' || type === 'multi') {
1425
    for(i = 0; i < value.length; i++) {
1426
      if(i > 0) encoded += '&';
1427
      encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
1428
    }
1429
  }
1430
  else {
1431
    var separator = '';
1432
    if(type === 'csv')
1433
      separator = ',';
1434
    else if(type === 'ssv')
1435
      separator = '%20';
1436
    else if(type === 'tsv')
1437
      separator = '\\t';
1438
    else if(type === 'pipes')
1439
      separator = '|';
1440
    else if(type === 'brackets') {
1441
      for(i = 0; i < value.length; i++) {
1442
        if(i !== 0)
1443
          encoded += '&';
1444
        encoded += this.encodeQueryParam(name) + '[]=' + this.encodeQueryParam(value[i]);
1445
      }
1446
    }
1447
    if(separator !== '') {
1448
      for(i = 0; i < value.length; i++) {
1449
        if(i === 0)
1450
          encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
1451
        else
1452
          encoded += separator + this.encodeQueryParam(value[i]);
1453
      }
1454
    }
1455
  }
1456
  return encoded;
1457
};
1458
1459
Operation.prototype.encodeQueryParam = function(arg) {
1460
  return encodeURIComponent(arg);
1461
};
1462
1463
/**
1464
 * TODO revisit, might not want to leave '/'
1465
 **/
1466
Operation.prototype.encodePathParam = function(pathParam) {
1467
  var encParts, part, parts, i, len;
1468
  pathParam = pathParam.toString();
1469
  if (pathParam.indexOf('/') === -1) {
1470
    return encodeURIComponent(pathParam);
1471
  } else {
1472
    parts = pathParam.split('/');
1473
    encParts = [];
1474
    for (i = 0, len = parts.length; i < len; i++) {
1475
      encParts.push(encodeURIComponent(parts[i]));
1476
    }
1477
    return encParts.join('/');
1478
  }
1479
};
1480
1481
var Model = function(name, definition) {
1482
  this.name = name;
1483
  this.definition = definition || {};
1484
  this.properties = [];
1485
  var requiredFields = definition.required || [];
1486
  if(definition.type === 'array') {
1487
    var out = new ArrayModel(definition);
1488
    return out;
1489
  }
1490
  var key;
1491
  var props = definition.properties;
1492
  if(props) {
1493
    for(key in props) {
1494
      var required = false;
1495
      var property = props[key];
1496
      if(requiredFields.indexOf(key) >= 0)
1497
        required = true;
1498
      this.properties.push(new Property(key, property, required));
1499
    }
1500
  }
1501
};
1502
1503
Model.prototype.createJSONSample = function(modelsToIgnore) {
1504
  var i, result = {}, representations = {};
1505
  modelsToIgnore = (modelsToIgnore||{});
1506
  modelsToIgnore[this.name] = this;
1507
  for (i = 0; i < this.properties.length; i++) {
1508
    prop = this.properties[i];
1509
    var sample = prop.getSampleValue(modelsToIgnore, representations);
1510
    result[prop.name] = sample;
1511
  }
1512
  delete modelsToIgnore[this.name];
1513
  return result;
1514
};
1515
1516
Model.prototype.getSampleValue = function(modelsToIgnore) {
1517
  var i, obj = {}, representations = {};
1518
  for(i = 0; i < this.properties.length; i++ ) {
1519
    var property = this.properties[i];
1520
    obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
1521
  }
1522
  return obj;
1523
};
1524
1525
Model.prototype.getMockSignature = function(modelsToIgnore) {
1526
  var i, prop, propertiesStr = [];
1527
  for (i = 0; i < this.properties.length; i++) {
1528
    prop = this.properties[i];
1529
    propertiesStr.push(prop.toString());
1530
  }
1531
  var strong = '<span class="strong">';
1532
  var stronger = '<span class="stronger">';
1533
  var strongClose = '</span>';
1534
  var classOpen = strong + this.name + ' {' + strongClose;
1535
  var classClose = strong + '}' + strongClose;
1536
  var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
1537
  if (!modelsToIgnore)
1538
    modelsToIgnore = {};
1539
1540
  modelsToIgnore[this.name] = this;
1541
  for (i = 0; i < this.properties.length; i++) {
1542
    prop = this.properties[i];
1543
    var ref = prop.$ref;
1544
    var model = models[ref];
1545
    if (model && typeof modelsToIgnore[model.name] === 'undefined') {
1546
      returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
1547
    }
1548
  }
1549
  return returnVal;
1550
};
1551
1552
var Property = function(name, obj, required) {
1553
  this.schema = obj;
1554
  this.required = required;
1555
  if(obj.$ref)
1556
    this.$ref = simpleRef(obj.$ref);
1557
  else if (obj.type === 'array' && obj.items) {
1558
    if(obj.items.$ref)
1559
      this.$ref = simpleRef(obj.items.$ref);
1560
    else
1561
      obj = obj.items;
1562
  }
1563
  this.name = name;
1564
  this.description = obj.description;
1565
  this.obj = obj;
1566
  this.optional = true;
1567
  this.optional = !required;
1568
  this.default = obj.default || null;
1569
  this.example = obj.example !== undefined ? obj.example : null;
1570
  this.collectionFormat = obj.collectionFormat || null;
1571
  this.maximum = obj.maximum || null;
1572
  this.exclusiveMaximum = obj.exclusiveMaximum || null;
1573
  this.minimum = obj.minimum || null;
1574
  this.exclusiveMinimum = obj.exclusiveMinimum || null;
1575
  this.maxLength = obj.maxLength || null;
1576
  this.minLength = obj.minLength || null;
1577
  this.pattern = obj.pattern || null;
1578
  this.maxItems = obj.maxItems || null;
1579
  this.minItems = obj.minItems || null;
1580
  this.uniqueItems = obj.uniqueItems || null;
1581
  this['enum'] = obj['enum'] || null;
1582
  this.multipleOf = obj.multipleOf || null;
1583
};
1584
1585
Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
1586
  return this.sampleValue(false, modelsToIgnore, representations);
1587
};
1588
1589
Property.prototype.isArray = function () {
1590
  var schema = this.schema;
1591
  if(schema.type === 'array')
1592
    return true;
1593
  else
1594
    return false;
1595
};
1596
1597
Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
1598
  isArray = (isArray || this.isArray());
1599
  ignoredModels = (ignoredModels || {});
1600
  // representations = (representations || {});
1601
1602
  var type = getStringSignature(this.obj, true);
1603
  var output;
1604
1605
  if(this.$ref) {
1606
    var refModelName = simpleRef(this.$ref);
1607
    var refModel = models[refModelName];
1608
    if(typeof representations[type] !== 'undefined') {
1609
      return representations[type];
1610
    }
1611
    else
1612
1613
    if(refModel && typeof ignoredModels[type] === 'undefined') {
1614
      ignoredModels[type] = this;
1615
      output = refModel.getSampleValue(ignoredModels, representations);
1616
      representations[type] = output;
1617
    }
1618
    else {
1619
      output = (representations[type] || refModelName);
1620
    }
1621
  }
1622
  else if(this.example)
1623
    output = this.example;
1624
  else if(this.default)
1625
    output = this.default;
1626
  else if(type === 'date-time')
1627
    output = new Date().toISOString();
1628
  else if(type === 'date')
1629
    output = new Date().toISOString().split("T")[0];
1630
  else if(type === 'string')
1631
    output = 'string';
1632
  else if(type === 'integer')
1633
    output = 0;
1634
  else if(type === 'long')
1635
    output = 0;
1636
  else if(type === 'float')
1637
    output = 0.0;
1638
  else if(type === 'double')
1639
    output = 0.0;
1640
  else if(type === 'boolean')
1641
    output = true;
1642
  else
1643
    output = {};
1644
  ignoredModels[type] = output;
1645
  if(isArray)
1646
    return [output];
1647
  else
1648
    return output;
1649
};
1650
1651
getStringSignature = function(obj, baseComponent) {
1652
  var str = '';
1653
  if(typeof obj.$ref !== 'undefined')
1654
    str += simpleRef(obj.$ref);
1655
  else if(typeof obj.type === 'undefined')
1656
    str += 'object';
1657
  else if(obj.type === 'array') {
1658
    if(baseComponent)
1659
      str += getStringSignature((obj.items || obj.$ref || {}));
1660
    else {
1661
      str += 'Array[';
1662
      str += getStringSignature((obj.items || obj.$ref || {}));
1663
      str += ']';
1664
    }
1665
  }
1666
  else if(obj.type === 'integer' && obj.format === 'int32')
1667
    str += 'integer';
1668
  else if(obj.type === 'integer' && obj.format === 'int64')
1669
    str += 'long';
1670
  else if(obj.type === 'integer' && typeof obj.format === 'undefined')
1671
    str += 'long';
1672
  else if(obj.type === 'string' && obj.format === 'date-time')
1673
    str += 'date-time';
1674
  else if(obj.type === 'string' && obj.format === 'date')
1675
    str += 'date';
1676
  else if(obj.type === 'string' && typeof obj.format === 'undefined')
1677
    str += 'string';
1678
  else if(obj.type === 'number' && obj.format === 'float')
1679
    str += 'float';
1680
  else if(obj.type === 'number' && obj.format === 'double')
1681
    str += 'double';
1682
  else if(obj.type === 'number' && typeof obj.format === 'undefined')
1683
    str += 'double';
1684
  else if(obj.type === 'boolean')
1685
    str += 'boolean';
1686
  else if(obj.$ref)
1687
    str += simpleRef(obj.$ref);
1688
  else
1689
    str += obj.type;
1690
  return str;
1691
};
1692
1693
simpleRef = function(name) {
1694
  if(typeof name === 'undefined')
1695
    return null;
1696
  if(name.indexOf("#/definitions/") === 0)
1697
    return name.substring('#/definitions/'.length);
1698
  else
1699
    return name;
1700
};
1701
1702
Property.prototype.toString = function() {
1703
  var str = getStringSignature(this.obj);
1704
  if(str !== '') {
1705
    str = '<span class="propName ' + this.required + '">' + this.name + '</span> (<span class="propType">' + str + '</span>';
1706
    if(!this.required)
1707
      str += ', <span class="propOptKey">optional</span>';
1708
    str += ')';
1709
  }
1710
  else
1711
    str = this.name + ' (' + JSON.stringify(this.obj) + ')';
1712
1713
  if(typeof this.description !== 'undefined')
1714
    str += ': ' + this.description;
1715
1716
  if (this['enum']) {
1717
    str += ' = <span class="propVals">[\'' + this['enum'].join('\' or \'') + '\']</span>';
1718
  }
1719
  if (this.descr) {
1720
    str += ': <span class="propDesc">' + this.descr + '</span>';
1721
  }
1722
1723
1724
  var options = '';
1725
  var isArray = this.schema.type === 'array';
1726
  var type;
1727
1728
  if(isArray) {
1729
    if(this.schema.items)
1730
      type = this.schema.items.type;
1731
    else
1732
      type = '';
1733
  }
1734
  else {
1735
    type = this.schema.type;
1736
  }
1737
1738
  if (this.default)
1739
    options += optionHtml('Default', this.default);
1740
1741
  switch (type) {
1742
    case 'string':
1743
      if (this.minLength)
1744
        options += optionHtml('Min. Length', this.minLength);
1745
      if (this.maxLength)
1746
        options += optionHtml('Max. Length', this.maxLength);
1747
      if (this.pattern)
1748
        options += optionHtml('Reg. Exp.', this.pattern);
1749
      break;
1750
    case 'integer':
1751
    case 'number':
1752
      if (this.minimum)
1753
        options += optionHtml('Min. Value', this.minimum);
1754
      if (this.exclusiveMinimum)
1755
        options += optionHtml('Exclusive Min.', "true");
1756
      if (this.maximum)
1757
        options += optionHtml('Max. Value', this.maximum);
1758
      if (this.exclusiveMaximum)
1759
        options += optionHtml('Exclusive Max.', "true");
1760
      if (this.multipleOf)
1761
        options += optionHtml('Multiple Of', this.multipleOf);
1762
      break;
1763
  }
1764
1765
  if (isArray) {
1766
    if (this.minItems)
1767
      options += optionHtml('Min. Items', this.minItems);
1768
    if (this.maxItems)
1769
      options += optionHtml('Max. Items', this.maxItems);
1770
    if (this.uniqueItems)
1771
      options += optionHtml('Unique Items', "true");
1772
    if (this.collectionFormat)
1773
      options += optionHtml('Coll. Format', this.collectionFormat);
1774
  }
1775
1776
  if (this['enum']) {
1777
    var enumString;
1778
1779
    if (type === 'number' || type === 'integer')
1780
      enumString = this['enum'].join(', ');
1781
    else {
1782
      enumString = '"' + this['enum'].join('", "') + '"';
1783
    }
1784
1785
    options += optionHtml('Enum', enumString);
1786
  }
1787
1788
  if (options.length > 0)
1789
    str = '<span class="propWrap">' + str + '<table class="optionsWrapper"><tr><th colspan="2">' + this.name + '</th></tr>' + options + '</table></span>';
1790
1791
  return str;
1792
};
1793
1794
optionHtml = function(label, value) {
1795
  return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
1796
};
1797
1798
typeFromJsonSchema = function(type, format) {
1799
  var str;
1800
  if(type === 'integer' && format === 'int32')
1801
    str = 'integer';
1802
  else if(type === 'integer' && format === 'int64')
1803
    str = 'long';
1804
  else if(type === 'integer' && typeof format === 'undefined')
1805
    str = 'long';
1806
  else if(type === 'string' && format === 'date-time')
1807
    str = 'date-time';
1808
  else if(type === 'string' && format === 'date')
1809
    str = 'date';
1810
  else if(type === 'number' && format === 'float')
1811
    str = 'float';
1812
  else if(type === 'number' && format === 'double')
1813
    str = 'double';
1814
  else if(type === 'number' && typeof format === 'undefined')
1815
    str = 'double';
1816
  else if(type === 'boolean')
1817
    str = 'boolean';
1818
  else if(type === 'string')
1819
    str = 'string';
1820
1821
  return str;
1822
};
1823
1824
var sampleModels = {};
1825
var cookies = {};
1826
var models = {};
1827
1828
SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
1829
  if (response.apiVersion !== null) {
1830
    this.apiVersion = response.apiVersion;
1831
  }
1832
  this.apis = {};
1833
  this.apisArray = [];
1834
  this.consumes = response.consumes;
1835
  this.produces = response.produces;
1836
  this.authSchemes = response.authorizations;
1837
  this.info = this.convertInfo(response.info);
1838
1839
  var isApi = false, i, res;
1840
  for (i = 0; i < response.apis.length; i++) {
1841
    var api = response.apis[i];
1842
    if (api.operations) {
1843
      var j;
1844
      for (j = 0; j < api.operations.length; j++) {
1845
        operation = api.operations[j];
1846
        isApi = true;
1847
      }
1848
    }
1849
  }
1850
  if (response.basePath)
1851
    this.basePath = response.basePath;
1852
  else if (this.url.indexOf('?') > 0)
1853
    this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
1854
  else
1855
    this.basePath = this.url;
1856
1857
  if (isApi) {
1858
    var newName = response.resourcePath.replace(/\//g, '');
1859
    this.resourcePath = response.resourcePath;
1860
    res = new SwaggerResource(response, this);
1861
    this.apis[newName] = res;
1862
    this.apisArray.push(res);
1863
    this.finish();
1864
  } else {
1865
    var k;
1866
    this.expectedResourceCount = response.apis.length;
1867
    for (k = 0; k < response.apis.length; k++) {
1868
      var resource = response.apis[k];
1869
      res = new SwaggerResource(resource, this);
1870
      this.apis[res.name] = res;
1871
      this.apisArray.push(res);
1872
    }
1873
  }
1874
  this.isValid = true;
1875
  return this;
1876
};
1877
1878
SwaggerClient.prototype.finish = function() {
1879
  if (typeof this.success === 'function') {
1880
    this.isValid = true;
1881
    this.ready = true;
1882
    this.isBuilt = true;
1883
    this.selfReflect();
1884
    this.success();
1885
  }
1886
};
1887
1888
SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
1889
  log('This API is using a deprecated version of Swagger!  Please see http://github.com/wordnik/swagger-core/wiki for more info');
1890
  if (response.apiVersion !== null)
1891
    this.apiVersion = response.apiVersion;
1892
  this.apis = {};
1893
  this.apisArray = [];
1894
  this.produces = response.produces;
1895
  this.info = this.convertInfo(response.info);
1896
  var isApi = false, res;
1897
  for (var i = 0; i < response.apis.length; i++) {
1898
    var api = response.apis[i];
1899
    if (api.operations) {
1900
      for (var j = 0; j < api.operations.length; j++) {
1901
        operation = api.operations[j];
1902
        isApi = true;
1903
      }
1904
    }
1905
  }
1906
  if (response.basePath) {
1907
    this.basePath = response.basePath;
1908
  } else if (this.url.indexOf('?') > 0) {
1909
    this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
1910
  } else {
1911
    this.basePath = this.url;
1912
  }
1913
  if (isApi) {
1914
    var newName = response.resourcePath.replace(/\//g, '');
1915
    this.resourcePath = response.resourcePath;
1916
    res = new SwaggerResource(response, this);
1917
    this.apis[newName] = res;
1918
    this.apisArray.push(res);
1919
    this.finish();
1920
  } else {
1921
    this.expectedResourceCount = response.apis.length;
1922
    for (k = 0; k < response.apis.length; k++) {
1923
      resource = response.apis[k];
1924
      res = new SwaggerResource(resource, this);
1925
      this.apis[res.name] = res;
1926
      this.apisArray.push(res);
1927
    }
1928
  }
1929
  this.isValid = true;
1930
  return this;
1931
};
1932
1933
SwaggerClient.prototype.convertInfo = function (resp) {
1934
  if(typeof resp == 'object') {
1935
    var info = {};
1936
1937
    info.title = resp.title;
1938
    info.description = resp.description;
1939
    info.termsOfService = resp.termsOfServiceUrl;
1940
    info.contact = {};
1941
    info.contact.name = resp.contact;
1942
    info.license = {};
1943
    info.license.name = resp.license;
1944
    info.license.url = resp.licenseUrl;
1945
1946
    return info;
1947
  }
1948
};
1949
1950
SwaggerClient.prototype.selfReflect = function () {
1951
  var resource, tag, ref;
1952
  if (this.apis === null) {
1953
    return false;
1954
  }
1955
  ref = this.apis;
1956
  for (tag in ref) {
1957
    api = ref[tag];
1958
    if (api.ready === null) {
1959
      return false;
1960
    }
1961
    this[tag] = api;
1962
    this[tag].help = __bind(api.help, api);
1963
  }
1964
  this.setConsolidatedModels();
1965
  this.ready = true;
1966
};
1967
1968
SwaggerClient.prototype.setConsolidatedModels = function () {
1969
  var model, modelName, resource, resource_name, i, apis, models, results;
1970
  this.models = {};
1971
  apis = this.apis;
1972
  for (resource_name in apis) {
1973
    resource = apis[resource_name];
1974
    for (modelName in resource.models) {
1975
      if (typeof this.models[modelName] === 'undefined') {
1976
        this.models[modelName] = resource.models[modelName];
1977
        this.modelsArray.push(resource.models[modelName]);
1978
      }
1979
    }
1980
  }
1981
  models = this.modelsArray;
1982
  results = [];
1983
  for (i = 0; i < models.length; i++) {
1984
    model = models[i];
1985
    results.push(model.setReferencedModels(this.models));
1986
  }
1987
  return results;
1988
};
1989
1990
var SwaggerResource = function (resourceObj, api) {
1991
  var _this = this;
1992
  this.api = api;
1993
  this.swaggerRequstHeaders = api.swaggerRequstHeaders;
1994
  this.path = (typeof this.api.resourcePath === 'string') ? this.api.resourcePath : resourceObj.path;
1995
  this.description = resourceObj.description;
1996
  this.authorizations = (resourceObj.authorizations || {});
1997
1998
  var parts = this.path.split('/');
1999
  this.name = parts[parts.length - 1].replace('.{format}', '');
2000
  this.basePath = this.api.basePath;
2001
  this.operations = {};
2002
  this.operationsArray = [];
2003
  this.modelsArray = [];
2004
  this.models = api.models || {};
2005
  this.rawModels = {};
2006
  this.useJQuery = (typeof api.useJQuery !== 'undefined') ? api.useJQuery : null;
2007
2008
  if ((resourceObj.apis) && this.api.resourcePath) {
2009
    this.addApiDeclaration(resourceObj);
2010
  } else {
2011
    if (typeof this.path === 'undefined') {
2012
      this.api.fail('SwaggerResources must have a path.');
2013
    }
2014
    if (this.path.substring(0, 4) === 'http') {
2015
      this.url = this.path.replace('{format}', 'json');
2016
    } else {
2017
      this.url = this.api.basePath + this.path.replace('{format}', 'json');
2018
    }
2019
    this.api.progress('fetching resource ' + this.name + ': ' + this.url);
2020
    var obj = {
2021
      url: this.url,
2022
      method: 'GET',
2023
      useJQuery: this.useJQuery,
2024
      headers: {
2025
        accept: this.swaggerRequstHeaders
2026
      },
2027
      on: {
2028
        response: function (resp) {
2029
          var responseObj = resp.obj || JSON.parse(resp.data);
2030
          _this.api.resourceCount += 1;
2031
          return _this.addApiDeclaration(responseObj);
2032
        },
2033
        error: function (response) {
2034
          _this.api.resourceCount += 1;
2035
          return _this.api.fail('Unable to read api \'' +
2036
          _this.name + '\' from path ' + _this.url + ' (server returned ' + response.statusText + ')');
2037
        }
2038
      }
2039
    };
2040
    var e = typeof window !== 'undefined' ? window : exports;
2041
    e.authorizations.apply(obj);
2042
    new SwaggerHttp().execute(obj);
2043
  }
2044
};
2045
2046
SwaggerResource.prototype.help = function (dontPrint) {
2047
  var i;
2048
  var output = 'operations for the "' + this.name + '" tag';
2049
  for(i = 0; i < this.operationsArray.length; i++) {
2050
    var api = this.operationsArray[i];
2051
    output += '\n  * ' + api.nickname + ': ' + api.description;
2052
  }
2053
  if(dontPrint)
2054
    return output;
2055
  else {
2056
    log(output);
2057
    return output;
2058
  }
2059
};
2060
2061
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
2062
  var pos, url;
2063
  url = this.api.basePath;
2064
  pos = url.lastIndexOf(relativeBasePath);
2065
  var parts = url.split('/');
2066
  var rootUrl = parts[0] + '//' + parts[2];
2067
2068
  if (relativeBasePath.indexOf('http') === 0)
2069
    return relativeBasePath;
2070
  if (relativeBasePath === '/')
2071
    return rootUrl;
2072
  if (relativeBasePath.substring(0, 1) == '/') {
2073
    // use root + relative
2074
    return rootUrl + relativeBasePath;
2075
  }
2076
  else {
2077
    pos = this.basePath.lastIndexOf('/');
2078
    var base = this.basePath.substring(0, pos);
2079
    if (base.substring(base.length - 1) == '/')
2080
      return base + relativeBasePath;
2081
    else
2082
      return base + '/' + relativeBasePath;
2083
  }
2084
};
2085
2086
SwaggerResource.prototype.addApiDeclaration = function (response) {
2087
  if (typeof response.produces === 'string')
2088
    this.produces = response.produces;
2089
  if (typeof response.consumes === 'string')
2090
    this.consumes = response.consumes;
2091
  if ((typeof response.basePath === 'string') && response.basePath.replace(/\s/g, '').length > 0)
2092
    this.basePath = response.basePath.indexOf('http') === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath;
2093
  this.resourcePath = response.resourcePath;
2094
  this.addModels(response.models);
2095
  if (response.apis) {
2096
    for (var i = 0 ; i < response.apis.length; i++) {
2097
      var endpoint = response.apis[i];
2098
      this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces);
2099
    }
2100
  }
2101
  this.api[this.name] = this;
2102
  this.ready = true;
2103
  if(this.api.resourceCount === this.api.expectedResourceCount)
2104
    this.api.finish();
2105
  return this;
2106
};
2107
2108
SwaggerResource.prototype.addModels = function (models) {
2109
  if (typeof models === 'object') {
2110
    var modelName;
2111
    for (modelName in models) {
2112
      if (typeof this.models[modelName] === 'undefined') {
2113
        var swaggerModel = new SwaggerModel(modelName, models[modelName]);
2114
        this.modelsArray.push(swaggerModel);
2115
        this.models[modelName] = swaggerModel;
2116
        this.rawModels[modelName] = models[modelName];
2117
      }
2118
    }
2119
    var output = [];
2120
    for (var i = 0; i < this.modelsArray.length; i++) {
2121
      var model = this.modelsArray[i];
2122
      output.push(model.setReferencedModels(this.models));
2123
    }
2124
    return output;
2125
  }
2126
};
2127
2128
SwaggerResource.prototype.addOperations = function (resource_path, ops, consumes, produces) {
2129
  if (ops) {
2130
    var output = [];
2131
    for (var i = 0; i < ops.length; i++) {
2132
      var o = ops[i];
2133
      consumes = this.consumes;
2134
      produces = this.produces;
2135
      if (typeof o.consumes !== 'undefined')
2136
        consumes = o.consumes;
2137
      else
2138
        consumes = this.consumes;
2139
2140
      if (typeof o.produces !== 'undefined')
2141
        produces = o.produces;
2142
      else
2143
        produces = this.produces;
2144
      var type = (o.type || o.responseClass);
2145
2146
      if (type === 'array') {
2147
        ref = null;
2148
        if (o.items)
2149
          ref = o.items.type || o.items.$ref;
2150
        type = 'array[' + ref + ']';
2151
      }
2152
      var responseMessages = o.responseMessages;
2153
      var method = o.method;
2154
      if (o.httpMethod) {
2155
        method = o.httpMethod;
2156
      }
2157
      if (o.supportedContentTypes) {
2158
        consumes = o.supportedContentTypes;
2159
      }
2160
      if (o.errorResponses) {
2161
        responseMessages = o.errorResponses;
2162
        for (var j = 0; j < responseMessages.length; j++) {
2163
          r = responseMessages[j];
2164
          r.message = r.reason;
2165
          r.reason = null;
2166
        }
2167
      }
2168
      o.nickname = this.sanitize(o.nickname);
2169
      var op = new SwaggerOperation(o.nickname,
2170
          resource_path,
2171
          method,
2172
          o.parameters,
2173
          o.summary,
2174
          o.notes,
2175
          type,
2176
          responseMessages,
2177
          this,
2178
          consumes,
2179
          produces,
2180
          o.authorizations,
2181
          o.deprecated);
2182
2183
      this.operations[op.nickname] = op;
2184
      output.push(this.operationsArray.push(op));
2185
    }
2186
    return output;
2187
  }
2188
};
2189
2190
SwaggerResource.prototype.sanitize = function (nickname) {
2191
  var op;
2192
  op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_');
2193
  op = op.replace(/((_){2,})/g, '_');
2194
  op = op.replace(/^(_)*/g, '');
2195
  op = op.replace(/([_])*$/g, '');
2196
  return op;
2197
};
2198
2199
var SwaggerModel = function (modelName, obj) {
2200
  this.name = typeof obj.id !== 'undefined' ? obj.id : modelName;
2201
  this.properties = [];
2202
  var propertyName;
2203
  for (propertyName in obj.properties) {
2204
    if (obj.required) {
2205
      var value;
2206
      for (value in obj.required) {
2207
        if (propertyName === obj.required[value]) {
2208
          obj.properties[propertyName].required = true;
2209
        }
2210
      }
2211
    }
2212
    var prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName], this);
2213
    this.properties.push(prop);
2214
  }
2215
};
2216
2217
SwaggerModel.prototype.setReferencedModels = function (allModels) {
2218
  var results = [];
2219
  for (var i = 0; i < this.properties.length; i++) {
2220
    var property = this.properties[i];
2221
    var type = property.type || property.dataType;
2222
    if (allModels[type])
2223
      results.push(property.refModel = allModels[type]);
2224
    else if ((property.refDataType) && (allModels[property.refDataType]))
2225
      results.push(property.refModel = allModels[property.refDataType]);
2226
    else
2227
      results.push(void 0);
2228
  }
2229
  return results;
2230
};
2231
2232
SwaggerModel.prototype.getMockSignature = function (modelsToIgnore) {
2233
  var i, prop, propertiesStr = [];
2234
  for (i = 0; i < this.properties.length; i++) {
2235
    prop = this.properties[i];
2236
    propertiesStr.push(prop.toString());
2237
  }
2238
2239
  var strong = '<span class="strong">';
2240
  var strongClose = '</span>';
2241
  var classOpen = strong + this.name + ' {' + strongClose;
2242
  var classClose = strong + '}' + strongClose;
2243
  var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
2244
  if (!modelsToIgnore)
2245
    modelsToIgnore = [];
2246
  modelsToIgnore.push(this.name);
2247
2248
  for (i = 0; i < this.properties.length; i++) {
2249
    prop = this.properties[i];
2250
    if ((prop.refModel) && modelsToIgnore.indexOf(prop.refModel.name) === -1) {
2251
      returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
2252
    }
2253
  }
2254
  return returnVal;
2255
};
2256
2257
SwaggerModel.prototype.createJSONSample = function (modelsToIgnore) {
2258
  if (sampleModels[this.name]) {
2259
    return sampleModels[this.name];
2260
  }
2261
  else {
2262
    var result = {};
2263
    modelsToIgnore = (modelsToIgnore || []);
2264
    modelsToIgnore.push(this.name);
2265
    for (var i = 0; i < this.properties.length; i++) {
2266
      var prop = this.properties[i];
2267
      result[prop.name] = prop.getSampleValue(modelsToIgnore);
2268
    }
2269
    modelsToIgnore.pop(this.name);
2270
    return result;
2271
  }
2272
};
2273
2274
var SwaggerModelProperty = function (name, obj, model) {
2275
  this.name = name;
2276
  this.dataType = obj.type || obj.dataType || obj.$ref;
2277
  this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
2278
  this.descr = obj.description;
2279
  this.required = obj.required;
2280
  this.defaultValue = applyModelPropertyMacro(obj, model);
2281
  if (obj.items) {
2282
    if (obj.items.type) {
2283
      this.refDataType = obj.items.type;
2284
    }
2285
    if (obj.items.$ref) {
2286
      this.refDataType = obj.items.$ref;
2287
    }
2288
  }
2289
  this.dataTypeWithRef = this.refDataType ? (this.dataType + '[' + this.refDataType + ']') : this.dataType;
2290
  if (obj.allowableValues) {
2291
    this.valueType = obj.allowableValues.valueType;
2292
    this.values = obj.allowableValues.values;
2293
    if (this.values) {
2294
      this.valuesString = '\'' + this.values.join('\' or \'') + '\'';
2295
    }
2296
  }
2297
  if (obj['enum']) {
2298
    this.valueType = 'string';
2299
    this.values = obj['enum'];
2300
    if (this.values) {
2301
      this.valueString = '\'' + this.values.join('\' or \'') + '\'';
2302
    }
2303
  }
2304
};
2305
2306
SwaggerModelProperty.prototype.getSampleValue = function (modelsToIgnore) {
2307
  var result;
2308
  if ((this.refModel) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) {
2309
    result = this.refModel.createJSONSample(modelsToIgnore);
2310
  } else {
2311
    if (this.isCollection) {
2312
      result = this.toSampleValue(this.refDataType);
2313
    } else {
2314
      result = this.toSampleValue(this.dataType);
2315
    }
2316
  }
2317
  if (this.isCollection) {
2318
    return [result];
2319
  } else {
2320
    return result;
2321
  }
2322
};
2323
2324
SwaggerModelProperty.prototype.toSampleValue = function (value) {
2325
  var result;
2326
  if ((typeof this.defaultValue !== 'undefined') && this.defaultValue) {
2327
    result = this.defaultValue;
2328
  } else if (value === 'integer') {
2329
    result = 0;
2330
  } else if (value === 'boolean') {
2331
    result = false;
2332
  } else if (value === 'double' || value === 'number') {
2333
    result = 0.0;
2334
  } else if (value === 'string') {
2335
    result = '';
2336
  } else {
2337
    result = value;
2338
  }
2339
  return result;
2340
};
2341
2342
SwaggerModelProperty.prototype.toString = function () {
2343
  var req = this.required ? 'propReq' : 'propOpt';
2344
  var str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>';
2345
  if (!this.required) {
2346
    str += ', <span class="propOptKey">optional</span>';
2347
  }
2348
  str += ')';
2349
  if (this.values) {
2350
    str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
2351
  }
2352
  if (this.descr) {
2353
    str += ': <span class="propDesc">' + this.descr + '</span>';
2354
  }
2355
  return str;
2356
};
2357
2358
var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations, deprecated) {
2359
  var _this = this;
2360
2361
  var errors = [];
2362
  this.nickname = (nickname || errors.push('SwaggerOperations must have a nickname.'));
2363
  this.path = (path || errors.push('SwaggerOperation ' + nickname + ' is missing path.'));
2364
  this.method = (method || errors.push('SwaggerOperation ' + nickname + ' is missing method.'));
2365
  this.parameters = parameters ? parameters : [];
2366
  this.summary = summary;
2367
  this.notes = notes;
2368
  this.type = type;
2369
  this.responseMessages = (responseMessages || []);
2370
  this.resource = (resource || errors.push('Resource is required'));
2371
  this.consumes = consumes;
2372
  this.produces = produces;
2373
  this.authorizations = typeof authorizations !== 'undefined' ? authorizations : resource.authorizations;
2374
  this.deprecated = deprecated;
2375
  this['do'] = __bind(this['do'], this);
2376
2377
2378
  if(typeof this.deprecated === 'string') {
2379
    switch(this.deprecated.toLowerCase()) {
2380
      case 'true': case 'yes': case '1': {
2381
        this.deprecated = true;
2382
        break;
2383
      }
2384
      case 'false': case 'no': case '0': case null: {
2385
        this.deprecated = false;
2386
        break;
2387
      }
2388
      default: this.deprecated = Boolean(this.deprecated);
2389
    }
2390
  }
2391
2392
  if (errors.length > 0) {
2393
    console.error('SwaggerOperation errors', errors, arguments);
2394
    this.resource.api.fail(errors);
2395
  }
2396
2397
  this.path = this.path.replace('{format}', 'json');
2398
  this.method = this.method.toLowerCase();
2399
  this.isGetMethod = this.method === 'get';
2400
2401
  var i, j, v;
2402
  this.resourceName = this.resource.name;
2403
  if (typeof this.type !== 'undefined' && this.type === 'void')
2404
    this.type = null;
2405
  else {
2406
    this.responseClassSignature = this.getSignature(this.type, this.resource.models);
2407
    this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models);
2408
  }
2409
2410
  for (i = 0; i < this.parameters.length; i++) {
2411
    var param = this.parameters[i];
2412
    // might take this away
2413
    param.name = param.name || param.type || param.dataType;
2414
    // for 1.1 compatibility
2415
    type = param.type || param.dataType;
2416
    if (type === 'array') {
2417
      type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
2418
    }
2419
    param.type = type;
2420
2421
    if (type && type.toLowerCase() === 'boolean') {
2422
      param.allowableValues = {};
2423
      param.allowableValues.values = ['true', 'false'];
2424
    }
2425
    param.signature = this.getSignature(type, this.resource.models);
2426
    param.sampleJSON = this.getSampleJSON(type, this.resource.models);
2427
2428
    var enumValue = param['enum'];
2429
    if (typeof enumValue !== 'undefined') {
2430
      param.isList = true;
2431
      param.allowableValues = {};
2432
      param.allowableValues.descriptiveValues = [];
2433
2434
      for (j = 0; j < enumValue.length; j++) {
2435
        v = enumValue[j];
2436
        if (param.defaultValue) {
2437
          param.allowableValues.descriptiveValues.push({
2438
            value: String(v),
2439
            isDefault: (v === param.defaultValue)
2440
          });
2441
        }
2442
        else {
2443
          param.allowableValues.descriptiveValues.push({
2444
            value: String(v),
2445
            isDefault: false
2446
          });
2447
        }
2448
      }
2449
    }
2450
    else if (param.allowableValues) {
2451
      if (param.allowableValues.valueType === 'RANGE')
2452
        param.isRange = true;
2453
      else
2454
        param.isList = true;
2455
      if (param.allowableValues) {
2456
        param.allowableValues.descriptiveValues = [];
2457
        if (param.allowableValues.values) {
2458
          for (j = 0; j < param.allowableValues.values.length; j++) {
2459
            v = param.allowableValues.values[j];
2460
            if (param.defaultValue !== null) {
2461
              param.allowableValues.descriptiveValues.push({
2462
                value: String(v),
2463
                isDefault: (v === param.defaultValue)
2464
              });
2465
            }
2466
            else {
2467
              param.allowableValues.descriptiveValues.push({
2468
                value: String(v),
2469
                isDefault: false
2470
              });
2471
            }
2472
          }
2473
        }
2474
      }
2475
    }
2476
    param.defaultValue = applyParameterMacro(this, param);
2477
  }
2478
  var defaultSuccessCallback = this.resource.api.defaultSuccessCallback || null;
2479
  var defaultErrorCallback = this.resource.api.defaultErrorCallback || null;
2480
2481
  this.resource[this.nickname] = function (args, opts, callback, error) {
2482
    var arg1, arg2, arg3, arg4;
2483
    if(typeof args === 'function') {  // right shift 3
2484
      arg1 = {}; arg2 = {}; arg3 = args; arg4 = opts;
2485
    }
2486
    else if(typeof args === 'object' && typeof opts === 'function') { // right shift 2
2487
      arg1 = args; arg2 = {}; arg3 = opts; arg4 = callback;
2488
    }
2489
    else {
2490
      arg1 = args; arg2 = opts; arg3 = callback; arg4 = error;
2491
    }
2492
    return _this['do'](arg1 || {}, arg2 || {}, arg3 || defaultSuccessCallback, arg4 || defaultErrorCallback);
2493
  };
2494
2495
  this.resource[this.nickname].help = function (dontPrint) {
2496
    return _this.help(dontPrint);
2497
  };
2498
  this.resource[this.nickname].asCurl = function (args) {
2499
    return _this.asCurl(args);
2500
  };
2501
};
2502
2503
SwaggerOperation.prototype.isListType = function (type) {
2504
  if (type && type.indexOf('[') >= 0) {
2505
    return type.substring(type.indexOf('[') + 1, type.indexOf(']'));
2506
  } else {
2507
    return void 0;
2508
  }
2509
};
2510
2511
SwaggerOperation.prototype.getSignature = function (type, models) {
2512
  var isPrimitive, listType;
2513
  listType = this.isListType(type);
2514
  isPrimitive = ((typeof listType !== 'undefined') && models[listType]) || (typeof models[type] !== 'undefined') ? false : true;
2515
  if (isPrimitive) {
2516
    return type;
2517
  } else {
2518
    if (typeof listType !== 'undefined') {
2519
      return models[listType].getMockSignature();
2520
    } else {
2521
      return models[type].getMockSignature();
2522
    }
2523
  }
2524
};
2525
2526
SwaggerOperation.prototype.getSampleJSON = function (type, models) {
2527
  var isPrimitive, listType, val;
2528
  listType = this.isListType(type);
2529
  isPrimitive = ((typeof listType !== 'undefined') && models[listType]) || (typeof models[type] !== 'undefined') ? false : true;
2530
  val = isPrimitive ? void 0 : (listType ? models[listType].createJSONSample() : models[type].createJSONSample());
2531
  if (val) {
2532
    val = listType ? [val] : val;
2533
    if (typeof val == 'string')
2534
      return val;
2535
    else if (typeof val === 'object') {
2536
      var t = val;
2537
      if (val instanceof Array && val.length > 0) {
2538
        t = val[0];
2539
      }
2540
      if (t.nodeName) {
2541
        var xmlString = new XMLSerializer().serializeToString(t);
2542
        return this.formatXml(xmlString);
2543
      }
2544
      else
2545
        return JSON.stringify(val, null, 2);
2546
    }
2547
    else
2548
      return val;
2549
  }
2550
};
2551
2552
SwaggerOperation.prototype['do'] = function (args, opts, callback, error) {
2553
  var key, param, params, possibleParams = [], req, value;
2554
2555
  if (typeof error !== 'function') {
2556
    error = function (xhr, textStatus, error) {
2557
      return log(xhr, textStatus, error);
2558
    };
2559
  }
2560
2561
  if (typeof callback !== 'function') {
2562
    callback = function (response) {
2563
      var content;
2564
      content = null;
2565
      if (response !== null) {
2566
        content = response.data;
2567
      } else {
2568
        content = 'no data';
2569
      }
2570
      return log('default callback: ' + content);
2571
    };
2572
  }
2573
2574
  params = {};
2575
  params.headers = [];
2576
  if (args.headers) {
2577
    params.headers = args.headers;
2578
    delete args.headers;
2579
  }
2580
  // allow override from the opts
2581
  if(opts && opts.responseContentType) {
2582
    params.headers['Content-Type'] = opts.responseContentType;
2583
  }
2584
  if(opts && opts.requestContentType) {
2585
    params.headers.Accept = opts.requestContentType;
2586
  }
2587
2588
  for (var i = 0; i < this.parameters.length; i++) {
2589
    param = this.parameters[i];
2590
    if (param.paramType === 'header') {
2591
      if (typeof args[param.name] !== 'undefined')
2592
        params.headers[param.name] = args[param.name];
2593
    }
2594
    else if (param.paramType === 'form' || param.paramType.toLowerCase() === 'file')
2595
      possibleParams.push(param);
2596
    else if (param.paramType === 'body' && param.name !== 'body' && typeof args[param.name] !== 'undefined') {
2597
      if (args.body) {
2598
        throw new Error('Saw two body params in an API listing; expecting a max of one.');
2599
      }
2600
      args.body = args[param.name];
2601
    }
2602
  }
2603
2604
  if (typeof args.body !== 'undefined') {
2605
    params.body = args.body;
2606
    delete args.body;
2607
  }
2608
2609
  if (possibleParams) {
2610
    for (key in possibleParams) {
2611
      value = possibleParams[key];
2612
      if (args[value.name]) {
2613
        params[value.name] = args[value.name];
2614
      }
2615
    }
2616
  }
2617
2618
  req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this);
2619
  if (opts.mock) {
2620
    return req;
2621
  } else {
2622
    return true;
2623
  }
2624
};
2625
2626
SwaggerOperation.prototype.pathJson = function () {
2627
  return this.path.replace('{format}', 'json');
2628
};
2629
2630
SwaggerOperation.prototype.pathXml = function () {
2631
  return this.path.replace('{format}', 'xml');
2632
};
2633
2634
SwaggerOperation.prototype.encodePathParam = function (pathParam) {
2635
  var encParts, part, parts, _i, _len;
2636
  pathParam = pathParam.toString();
2637
  if (pathParam.indexOf('/') === -1) {
2638
    return encodeURIComponent(pathParam);
2639
  } else {
2640
    parts = pathParam.split('/');
2641
    encParts = [];
2642
    for (_i = 0, _len = parts.length; _i < _len; _i++) {
2643
      part = parts[_i];
2644
      encParts.push(encodeURIComponent(part));
2645
    }
2646
    return encParts.join('/');
2647
  }
2648
};
2649
2650
SwaggerOperation.prototype.urlify = function (args) {
2651
  var i, j, param, url;
2652
  // ensure no double slashing...
2653
  if(this.resource.basePath.length > 1 && this.resource.basePath.slice(-1) === '/' && this.pathJson().charAt(0) === '/')
2654
    url = this.resource.basePath + this.pathJson().substring(1);
2655
  else
2656
    url = this.resource.basePath + this.pathJson();
2657
  var params = this.parameters;
2658
  for (i = 0; i < params.length; i++) {
2659
    param = params[i];
2660
    if (param.paramType === 'path') {
2661
      if (typeof args[param.name] !== 'undefined') {
2662
        // apply path params and remove from args
2663
        var reg = new RegExp('\\{\\s*?' + param.name + '[^\\{\\}\\/]*(?:\\{.*?\\}[^\\{\\}\\/]*)*\\}(?=(\\/?|$))', 'gi');
2664
        url = url.replace(reg, this.encodePathParam(args[param.name]));
2665
        delete args[param.name];
2666
      }
2667
      else
2668
        throw '' + param.name + ' is a required path param.';
2669
    }
2670
  }
2671
2672
  var queryParams = '';
2673
  for (i = 0; i < params.length; i++) {
2674
    param = params[i];
2675
    if(param.paramType === 'query') {
2676
      if (queryParams !== '')
2677
        queryParams += '&';
2678
      if (Array.isArray(param)) {
2679
        var output = '';
2680
        for(j = 0; j < param.length; j++) {
2681
          if(j > 0)
2682
            output += ',';
2683
          output += encodeURIComponent(param[j]);
2684
        }
2685
        queryParams += encodeURIComponent(param.name) + '=' + output;
2686
      }
2687
      else {
2688
        if (typeof args[param.name] !== 'undefined') {
2689
          queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
2690
        } else {
2691
          if (param.required)
2692
            throw '' + param.name + ' is a required query param.';
2693
        }
2694
      }
2695
    }
2696
  }
2697
  if ((queryParams) && queryParams.length > 0)
2698
    url += '?' + queryParams;
2699
  return url;
2700
};
2701
2702
SwaggerOperation.prototype.supportHeaderParams = function () {
2703
  return this.resource.api.supportHeaderParams;
2704
};
2705
2706
SwaggerOperation.prototype.supportedSubmitMethods = function () {
2707
  return this.resource.api.supportedSubmitMethods;
2708
};
2709
2710
SwaggerOperation.prototype.getQueryParams = function (args) {
2711
  return this.getMatchingParams(['query'], args);
2712
};
2713
2714
SwaggerOperation.prototype.getHeaderParams = function (args) {
2715
  return this.getMatchingParams(['header'], args);
2716
};
2717
2718
SwaggerOperation.prototype.getMatchingParams = function (paramTypes, args) {
2719
  var matchingParams = {};
2720
  var params = this.parameters;
2721
  for (var i = 0; i < params.length; i++) {
2722
    param = params[i];
2723
    if (args && args[param.name])
2724
      matchingParams[param.name] = args[param.name];
2725
  }
2726
  var headers = this.resource.api.headers;
2727
  var name;
2728
  for (name in headers) {
2729
    var value = headers[name];
2730
    matchingParams[name] = value;
2731
  }
2732
  return matchingParams;
2733
};
2734
2735
SwaggerOperation.prototype.help = function (dontPrint) {
2736
  var msg = this.nickname + ': ' + this.summary;
2737
  var params = this.parameters;
2738
  for (var i = 0; i < params.length; i++) {
2739
    var param = params[i];
2740
    msg += '\n* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
2741
  }
2742
  if(dontPrint)
2743
    return msg;
2744
  else {
2745
    console.log(msg);
2746
    return msg;
2747
  }
2748
};
2749
2750
SwaggerOperation.prototype.asCurl = function (args) {
2751
  var results = [];
2752
  var i;
2753
2754
  var headers = SwaggerRequest.prototype.setHeaders(args, {}, this);
2755
  for(i = 0; i < this.parameters.length; i++) {
2756
    var param = this.parameters[i];
2757
    if(param.paramType && param.paramType === 'header' && args[param.name]) {
2758
      headers[param.name] = args[param.name];
2759
    }
2760
  }
2761
2762
  var key;
2763
  for (key in headers) {
2764
    results.push('--header "' + key + ': ' + headers[key] + '"');
2765
  }
2766
  return 'curl ' + (results.join(' ')) + ' ' + this.urlify(args);
2767
};
2768
2769
SwaggerOperation.prototype.formatXml = function (xml) {
2770
  var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
2771
  reg = /(>)(<)(\/*)/g;
2772
  wsexp = /[ ]*(.*)[ ]+\n/g;
2773
  contexp = /(<.+>)(.+\n)/g;
2774
  xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
2775
  pad = 0;
2776
  formatted = '';
2777
  lines = xml.split('\n');
2778
  indent = 0;
2779
  lastType = 'other';
2780
  transitions = {
2781
    'single->single': 0,
2782
    'single->closing': -1,
2783
    'single->opening': 0,
2784
    'single->other': 0,
2785
    'closing->single': 0,
2786
    'closing->closing': -1,
2787
    'closing->opening': 0,
2788
    'closing->other': 0,
2789
    'opening->single': 1,
2790
    'opening->closing': 0,
2791
    'opening->opening': 1,
2792
    'opening->other': 1,
2793
    'other->single': 0,
2794
    'other->closing': -1,
2795
    'other->opening': 0,
2796
    'other->other': 0
2797
  };
2798
  _fn = function (ln) {
2799
    var fromTo, j, key, padding, type, types, value;
2800
    types = {
2801
      single: Boolean(ln.match(/<.+\/>/)),
2802
      closing: Boolean(ln.match(/<\/.+>/)),
2803
      opening: Boolean(ln.match(/<[^!?].*>/))
2804
    };
2805
    type = ((function () {
2806
      var _results;
2807
      _results = [];
2808
      for (key in types) {
2809
        value = types[key];
2810
        if (value) {
2811
          _results.push(key);
2812
        }
2813
      }
2814
      return _results;
2815
    })())[0];
2816
    type = type === void 0 ? 'other' : type;
2817
    fromTo = lastType + '->' + type;
2818
    lastType = type;
2819
    padding = '';
2820
    indent += transitions[fromTo];
2821
    padding = ((function () {
2822
      var _j, _ref5, _results;
2823
      _results = [];
2824
      for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
2825
        _results.push('  ');
2826
      }
2827
      return _results;
2828
    })()).join('');
2829
    if (fromTo === 'opening->closing') {
2830
      formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
2831
    } else {
2832
      formatted += padding + ln + '\n';
2833
    }
2834
  };
2835
  for (_i = 0, _len = lines.length; _i < _len; _i++) {
2836
    ln = lines[_i];
2837
    _fn(ln);
2838
  }
2839
  return formatted;
2840
};
2841
2842
var SwaggerRequest = function (type, url, params, opts, successCallback, errorCallback, operation, execution) {
2843
  var _this = this;
2844
  var errors = [];
2845
2846
  this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
2847
  this.type = (type || errors.push('SwaggerRequest type is required (get/post/put/delete/patch/options).'));
2848
  this.url = (url || errors.push('SwaggerRequest url is required.'));
2849
  this.params = params;
2850
  this.opts = opts;
2851
  this.successCallback = (successCallback || errors.push('SwaggerRequest successCallback is required.'));
2852
  this.errorCallback = (errorCallback || errors.push('SwaggerRequest error callback is required.'));
2853
  this.operation = (operation || errors.push('SwaggerRequest operation is required.'));
2854
  this.execution = execution;
2855
  this.headers = (params.headers || {});
2856
2857
  if (errors.length > 0) {
2858
    throw errors;
2859
  }
2860
2861
  this.type = this.type.toUpperCase();
2862
2863
  // set request, response content type headers
2864
  var headers = this.setHeaders(params, opts, this.operation);
2865
  var body = params.body;
2866
2867
  // encode the body for form submits
2868
  if (headers['Content-Type']) {
2869
    var key, value, values = {}, i;
2870
    var operationParams = this.operation.parameters;
2871
    for (i = 0; i < operationParams.length; i++) {
2872
      var param = operationParams[i];
2873
      if (param.paramType === 'form')
2874
        values[param.name] = param;
2875
    }
2876
2877
    if (headers['Content-Type'].indexOf('application/x-www-form-urlencoded') === 0) {
2878
      var encoded = '';
2879
      for (key in values) {
2880
        value = this.params[key];
2881
        if (typeof value !== 'undefined') {
2882
          if (encoded !== '')
2883
            encoded += '&';
2884
          encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
2885
        }
2886
      }
2887
      body = encoded;
2888
    }
2889
    else if (headers['Content-Type'].indexOf('multipart/form-data') === 0) {
2890
      // encode the body for form submits
2891
      var data = '';
2892
      var boundary = '----SwaggerFormBoundary' + Date.now();
2893
      for (key in values) {
2894
        value = this.params[key];
2895
        if (typeof value !== 'undefined') {
2896
          data += '--' + boundary + '\n';
2897
          data += 'Content-Disposition: form-data; name="' + key + '"';
2898
          data += '\n\n';
2899
          data += value + '\n';
2900
        }
2901
      }
2902
      data += '--' + boundary + '--\n';
2903
      headers['Content-Type'] = 'multipart/form-data; boundary=' + boundary;
2904
      body = data;
2905
    }
2906
  }
2907
2908
  var obj;
2909
  if (!((this.headers) && (this.headers.mock))) {
2910
    obj = {
2911
      url: this.url,
2912
      method: this.type,
2913
      headers: headers,
2914
      body: body,
2915
      useJQuery: this.useJQuery,
2916
      on: {
2917
        error: function (response) {
2918
          return _this.errorCallback(response, _this.opts.parent);
2919
        },
2920
        redirect: function (response) {
2921
          return _this.successCallback(response, _this.opts.parent);
2922
        },
2923
        307: function (response) {
2924
          return _this.successCallback(response, _this.opts.parent);
2925
        },
2926
        response: function (response) {
2927
          return _this.successCallback(response, _this.opts.parent);
2928
        }
2929
      }
2930
    };
2931
2932
    var status = false;
2933
    if (this.operation.resource && this.operation.resource.api && this.operation.resource.api.clientAuthorizations) {
2934
      // Get the client authorizations from the resource declaration
2935
      status = this.operation.resource.api.clientAuthorizations.apply(obj, this.operation.authorizations);
2936
    } else {
2937
      // Get the client authorization from the default authorization declaration
2938
      var e;
2939
      if (typeof window !== 'undefined') {
2940
        e = window;
2941
      } else {
2942
        e = exports;
2943
      }
2944
      status = e.authorizations.apply(obj, this.operation.authorizations);
2945
    }
2946
2947
    if (!opts.mock) {
2948
      if (status !== false) {
2949
        new SwaggerHttp().execute(obj);
2950
      } else {
2951
        obj.canceled = true;
2952
      }
2953
    } else {
2954
      return obj;
2955
    }
2956
  }
2957
  return obj;
2958
};
2959
2960
SwaggerRequest.prototype.setHeaders = function (params, opts, operation) {
2961
  // default type
2962
  var accepts = opts.responseContentType || 'application/json';
2963
  var consumes = opts.requestContentType || 'application/json';
2964
2965
  var allDefinedParams = operation.parameters;
2966
  var definedFormParams = [];
2967
  var definedFileParams = [];
2968
  var body = params.body;
2969
  var headers = {};
2970
2971
  // get params from the operation and set them in definedFileParams, definedFormParams, headers
2972
  var i;
2973
  for (i = 0; i < allDefinedParams.length; i++) {
2974
    var param = allDefinedParams[i];
2975
    if (param.paramType === 'form')
2976
      definedFormParams.push(param);
2977
    else if (param.paramType === 'file')
2978
      definedFileParams.push(param);
2979
    else if (param.paramType === 'header' && this.params.headers) {
2980
      var key = param.name;
2981
      var headerValue = this.params.headers[param.name];
2982
      if (typeof this.params.headers[param.name] !== 'undefined')
2983
        headers[key] = headerValue;
2984
    }
2985
  }
2986
2987
  // if there's a body, need to set the accepts header via requestContentType
2988
  if (body && (this.type === 'POST' || this.type === 'PUT' || this.type === 'PATCH' || this.type === 'DELETE')) {
2989
    if (this.opts.requestContentType)
2990
      consumes = this.opts.requestContentType;
2991
  } else {
2992
    // if any form params, content type must be set
2993
    if (definedFormParams.length > 0) {
2994
      if (definedFileParams.length > 0)
2995
        consumes = 'multipart/form-data';
2996
      else
2997
        consumes = 'application/x-www-form-urlencoded';
2998
    }
2999
    else if (this.type === 'DELETE')
3000
      body = '{}';
3001
    else if (this.type != 'DELETE')
3002
      consumes = null;
3003
  }
3004
3005
  if (consumes && this.operation.consumes) {
3006
    if (this.operation.consumes.indexOf(consumes) === -1) {
3007
      log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.operation.consumes));
3008
    }
3009
  }
3010
3011
  if (this.opts && this.opts.responseContentType) {
3012
    accepts = this.opts.responseContentType;
3013
  } else {
3014
    accepts = 'application/json';
3015
  }
3016
  if (accepts && operation.produces) {
3017
    if (operation.produces.indexOf(accepts) === -1) {
3018
      log('server can\'t produce ' + accepts);
3019
    }
3020
  }
3021
3022
  if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded'))
3023
    headers['Content-Type'] = consumes;
3024
  if (accepts)
3025
    headers.Accept = accepts;
3026
  return headers;
3027
};
3028
3029
/**
3030
 * SwaggerHttp is a wrapper for executing requests
3031
 */
3032
var SwaggerHttp = function() {};
3033
3034
SwaggerHttp.prototype.execute = function(obj, opts) {
3035
  if(obj && (typeof obj.useJQuery === 'boolean'))
3036
    this.useJQuery = obj.useJQuery;
3037
  else
3038
    this.useJQuery = this.isIE8();
3039
3040
  if(obj && typeof obj.body === 'object') {
3041
    if(obj.body.type && obj.body.type !== 'formData')
3042
      obj.body = JSON.stringify(obj.body);
3043
    else {
3044
      obj.contentType = false;
3045
      obj.processData = false;
3046
      // delete obj.cache;
3047
      delete obj.headers['Content-Type'];
3048
    }
3049
  }
3050
3051
  if(this.useJQuery)
3052
    return new JQueryHttpClient(opts).execute(obj);
3053
  else
3054
    return new ShredHttpClient(opts).execute(obj);
3055
};
3056
3057
SwaggerHttp.prototype.isIE8 = function() {
3058
  var detectedIE = false;
3059
  if (typeof navigator !== 'undefined' && navigator.userAgent) {
3060
    nav = navigator.userAgent.toLowerCase();
3061
    if (nav.indexOf('msie') !== -1) {
3062
      var version = parseInt(nav.split('msie')[1]);
3063
      if (version <= 8) {
3064
        detectedIE = true;
3065
      }
3066
    }
3067
  }
3068
  return detectedIE;
3069
};
3070
3071
/*
3072
 * JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
3073
 * NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
3074
 *       Since we are using closures here we need to alias it for internal use.
3075
 */
3076
var JQueryHttpClient = function(options) {
3077
  "use strict";
3078
  if(!jQuery){
3079
    var jQuery = window.jQuery;
3080
  }
3081
};
3082
3083
JQueryHttpClient.prototype.execute = function(obj) {
3084
  var cb = obj.on;
3085
  var request = obj;
3086
3087
  obj.type = obj.method;
3088
  obj.cache = false;
3089
  delete obj.useJQuery;
3090
3091
  /*
3092
  obj.beforeSend = function(xhr) {
3093
    var key, results;
3094
    if (obj.headers) {
3095
      results = [];
3096
      for (key in obj.headers) {
3097
        if (key.toLowerCase() === "content-type") {
3098
          results.push(obj.contentType = obj.headers[key]);
3099
        } else if (key.toLowerCase() === "accept") {
3100
          results.push(obj.accepts = obj.headers[key]);
3101
        } else {
3102
          results.push(xhr.setRequestHeader(key, obj.headers[key]));
3103
        }
3104
      }
3105
      return results;
3106
    }
3107
  };*/
3108
3109
  obj.data = obj.body;
3110
  delete obj.body;
3111
  obj.complete = function(response, textStatus, opts) {
3112
    var headers = {},
3113
      headerArray = response.getAllResponseHeaders().split("\n");
3114
3115
    for(var i = 0; i < headerArray.length; i++) {
3116
      var toSplit = headerArray[i].trim();
3117
      if(toSplit.length === 0)
3118
        continue;
3119
      var separator = toSplit.indexOf(":");
3120
      if(separator === -1) {
3121
        // Name but no value in the header
3122
        headers[toSplit] = null;
3123
        continue;
3124
      }
3125
      var name = toSplit.substring(0, separator).trim(),
3126
        value = toSplit.substring(separator + 1).trim();
3127
      headers[name] = value;
3128
    }
3129
3130
    var out = {
3131
      url: request.url,
3132
      method: request.method,
3133
      status: response.status,
3134
      statusText: response.statusText,
3135
      data: response.responseText,
3136
      headers: headers
3137
    };
3138
3139
    var contentType = (headers["content-type"]||headers["Content-Type"]||null);
3140
    if(contentType) {
3141
      if(contentType.indexOf("application/json") === 0 || contentType.indexOf("+json") > 0) {
3142
        try {
3143
          out.obj = response.responseJSON || JSON.parse(out.data) || {};
3144
        } catch (ex) {
3145
          // do not set out.obj
3146
          log("unable to parse JSON content");
3147
        }
3148
      }
3149
    }
3150
3151
    if(response.status >= 200 && response.status < 300)
3152
      cb.response(out);
3153
    else if(response.status === 0 || (response.status >= 400 && response.status < 599))
3154
      cb.error(out);
3155
    else
3156
      return cb.response(out);
3157
  };
3158
3159
  jQuery.support.cors = true;
3160
  return jQuery.ajax(obj);
3161
};
3162
3163
/*
3164
 * ShredHttpClient is a light-weight, node or browser HTTP client
3165
 */
3166
var ShredHttpClient = function(opts) {
3167
  this.opts = (opts||{});
3168
  this.isInitialized = false;
3169
3170
  var identity, toString;
3171
3172
  if (typeof window !== 'undefined') {
3173
    this.Shred = require("./shred");
3174
    this.content = require("./shred/content");
3175
  }
3176
  else
3177
    this.Shred = require("shred");
3178
  this.shred = new this.Shred(opts);
3179
};
3180
3181
ShredHttpClient.prototype.initShred = function () {
3182
  this.isInitialized = true;
3183
  this.registerProcessors(this.shred);
3184
};
3185
3186
ShredHttpClient.prototype.registerProcessors = function(shred) {
3187
  var identity = function(x) {
3188
    return x;
3189
  };
3190
  var toString = function(x) {
3191
    return x.toString();
3192
  };
3193
3194
  if (typeof window !== 'undefined') {
3195
    this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
3196
      parser: identity,
3197
      stringify: toString
3198
    });
3199
  } else {
3200
    this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
3201
      parser: identity,
3202
      stringify: toString
3203
    });
3204
  }
3205
};
3206
3207
ShredHttpClient.prototype.execute = function(obj) {
3208
  if(!this.isInitialized)
3209
    this.initShred();
3210
3211
  var cb = obj.on, res;
3212
  var transform = function(response) {
3213
    var out = {
3214
      headers: response._headers,
3215
      url: response.request.url,
3216
      method: response.request.method,
3217
      status: response.status,
3218
      data: response.content.data
3219
    };
3220
3221
    var headers = response._headers.normalized || response._headers;
3222
    var contentType = (headers["content-type"]||headers["Content-Type"]||null);
3223
3224
    if(contentType) {
3225
      if(contentType.indexOf("application/json") === 0 || contentType.indexOf("+json") > 0) {
3226
        if(response.content.data && response.content.data !== "")
3227
          try{
3228
            out.obj = JSON.parse(response.content.data);
3229
          }
3230
          catch (e) {
3231
            // unable to parse
3232
          }
3233
        else
3234
          out.obj = {};
3235
      }
3236
    }
3237
    return out;
3238
  };
3239
3240
  // Transform an error into a usable response-like object
3241
  var transformError = function (error) {
3242
    var out = {
3243
      // Default to a status of 0 - The client will treat this as a generic permissions sort of error
3244
      status: 0,
3245
      data: error.message || error
3246
    };
3247
3248
    if (error.code) {
3249
      out.obj = error;
3250
3251
      if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
3252
        // We can tell the client that this should be treated as a missing resource and not as a permissions thing
3253
        out.status = 404;
3254
      }
3255
    }
3256
    return out;
3257
  };
3258
3259
  res = {
3260
    error: function (response) {
3261
      if (obj)
3262
        return cb.error(transform(response));
3263
    },
3264
    // Catch the Shred error raised when the request errors as it is made (i.e. No Response is coming)
3265
    request_error: function (err) {
3266
      if (obj)
3267
        return cb.error(transformError(err));
3268
    },
3269
    response: function (response) {
3270
      if (obj) {
3271
        return cb.response(transform(response));
3272
      }
3273
    }
3274
  };
3275
  if (obj) {
3276
    obj.on = res;
3277
  }
3278
  return this.shred.request(obj);
3279
};
3280
3281
3282
var e = (typeof window !== 'undefined' ? window : exports);
3283
3284
e.authorizations = authorizations = new SwaggerAuthorizations();
3285
e.ApiKeyAuthorization = ApiKeyAuthorization;
3286
e.PasswordAuthorization = PasswordAuthorization;
3287
e.CookieAuthorization = CookieAuthorization;
3288
e.SwaggerClient = SwaggerClient;
3289
e.SwaggerApi = SwaggerClient;
3290
e.Operation = Operation;
3291
e.Model = Model;
3292
e.addModel = addModel;
3293
e.Resolver = Resolver;
3294
})();
(-)a/api/v1/doc/lib/swagger-oauth.js (+290 lines)
Line 0 Link Here
1
var appName;
2
var popupMask;
3
var popupDialog;
4
var clientId;
5
var realm;
6
var oauth2KeyName;
7
var redirect_uri;
8
var clientSecret;
9
var scopeSeparator;
10
11
function handleLogin() {
12
  var scopes = [];
13
14
  var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
15
  if(auths) {
16
    var key;
17
    var defs = auths;
18
    for(key in defs) {
19
      var auth = defs[key];
20
      if(auth.type === 'oauth2' && auth.scopes) {
21
        oauth2KeyName = key;
22
        var scope;
23
        if(Array.isArray(auth.scopes)) {
24
          // 1.2 support
25
          var i;
26
          for(i = 0; i < auth.scopes.length; i++) {
27
            scopes.push(auth.scopes[i]);
28
          }
29
        }
30
        else {
31
          // 2.0 support
32
          for(scope in auth.scopes) {
33
            scopes.push({scope: scope, description: auth.scopes[scope]});
34
          }
35
        }
36
      }
37
    }
38
  }
39
40
  if(window.swaggerUi.api
41
    && window.swaggerUi.api.info) {
42
    appName = window.swaggerUi.api.info.title;
43
  }
44
45
  $('.api-popup-dialog').remove(); 
46
  popupDialog = $(
47
    [
48
      '<div class="api-popup-dialog">',
49
      '<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
50
      '<div class="api-popup-content">',
51
        '<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
52
          '<a href="#">Learn how to use</a>',
53
        '</p>',
54
        '<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
55
        '<ul class="api-popup-scopes">',
56
        '</ul>',
57
        '<p class="error-msg"></p>',
58
        '<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
59
      '</div>',
60
      '</div>'].join(''));
61
  $(document.body).append(popupDialog);
62
63
  popup = popupDialog.find('ul.api-popup-scopes').empty();
64
  for (i = 0; i < scopes.length; i ++) {
65
    scope = scopes[i];
66
    str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
67
    if (scope.description) {
68
      str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
69
    }
70
    str += '</label></li>';
71
    popup.append(str);
72
  }
73
74
  var $win = $(window),
75
    dw = $win.width(),
76
    dh = $win.height(),
77
    st = $win.scrollTop(),
78
    dlgWd = popupDialog.outerWidth(),
79
    dlgHt = popupDialog.outerHeight(),
80
    top = (dh -dlgHt)/2 + st,
81
    left = (dw - dlgWd)/2;
82
83
  popupDialog.css({
84
    top: (top < 0? 0 : top) + 'px',
85
    left: (left < 0? 0 : left) + 'px'
86
  });
87
88
  popupDialog.find('button.api-popup-cancel').click(function() {
89
    popupMask.hide();
90
    popupDialog.hide();
91
    popupDialog.empty();
92
    popupDialog = [];
93
  });
94
95
  $('button.api-popup-authbtn').unbind();
96
  popupDialog.find('button.api-popup-authbtn').click(function() {
97
    popupMask.hide();
98
    popupDialog.hide();
99
100
    var authSchemes = window.swaggerUi.api.authSchemes;
101
    var host = window.location;
102
    var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
103
    var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
104
    var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
105
    var url = null;
106
107
    for (var key in authSchemes) {
108
      if (authSchemes.hasOwnProperty(key)) {
109
        var flow = authSchemes[key].flow;
110
111
        if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
112
          var dets = authSchemes[key];
113
          url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
114
          window.swaggerUi.tokenName = dets.tokenName || 'access_token';
115
          window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
116
        }
117
        else if(authSchemes[key].grantTypes) {
118
          // 1.2 support
119
          var o = authSchemes[key].grantTypes;
120
          for(var t in o) {
121
            if(o.hasOwnProperty(t) && t === 'implicit') {
122
              var dets = o[t];
123
              var ep = dets.loginEndpoint.url;
124
              url = dets.loginEndpoint.url + '?response_type=token';
125
              window.swaggerUi.tokenName = dets.tokenName;
126
            }
127
            else if (o.hasOwnProperty(t) && t === 'accessCode') {
128
              var dets = o[t];
129
              var ep = dets.tokenRequestEndpoint.url;
130
              url = dets.tokenRequestEndpoint.url + '?response_type=code';
131
              window.swaggerUi.tokenName = dets.tokenName;
132
            }
133
          }
134
        }
135
      }
136
    }
137
    var scopes = []
138
    var o = $('.api-popup-scopes').find('input:checked');
139
140
    for(k =0; k < o.length; k++) {
141
      var scope = $(o[k]).attr('scope');
142
143
      if (scopes.indexOf(scope) === -1)
144
        scopes.push(scope);
145
    }
146
147
    // Implicit auth recommends a state parameter.
148
    var state = Math.random ();
149
150
    window.enabledScopes=scopes;
151
152
    redirect_uri = redirectUrl;
153
154
    url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
155
    url += '&realm=' + encodeURIComponent(realm);
156
    url += '&client_id=' + encodeURIComponent(clientId);
157
    url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
158
    url += '&state=' + encodeURIComponent(state);
159
160
    window.open(url);
161
  });
162
163
  popupMask.show();
164
  popupDialog.show();
165
  return;
166
}
167
168
169
function handleLogout() {
170
  for(key in window.authorizations.authz){
171
    window.authorizations.remove(key)
172
  }
173
  window.enabledScopes = null;
174
  $('.api-ic.ic-on').addClass('ic-off');
175
  $('.api-ic.ic-on').removeClass('ic-on');
176
177
  // set the info box
178
  $('.api-ic.ic-warning').addClass('ic-error');
179
  $('.api-ic.ic-warning').removeClass('ic-warning');
180
}
181
182
function initOAuth(opts) {
183
  var o = (opts||{});
184
  var errors = [];
185
186
  appName = (o.appName||errors.push('missing appName'));
187
  popupMask = (o.popupMask||$('#api-common-mask'));
188
  popupDialog = (o.popupDialog||$('.api-popup-dialog'));
189
  clientId = (o.clientId||errors.push('missing client id'));
190
  clientSecret = (o.clientSecret||errors.push('missing client secret'));
191
  realm = (o.realm||errors.push('missing realm'));
192
  scopeSeparator = (o.scopeSeparator||' ');
193
194
  if(errors.length > 0){
195
    log('auth unable initialize oauth: ' + errors);
196
    return;
197
  }
198
199
  $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
200
  $('.api-ic').unbind();
201
  $('.api-ic').click(function(s) {
202
    if($(s.target).hasClass('ic-off'))
203
      handleLogin();
204
    else {
205
      handleLogout();
206
    }
207
    false;
208
  });
209
}
210
211
window.processOAuthCode = function processOAuthCode(data) {
212
  var params = {
213
    'client_id': clientId,
214
    'client_secret': clientSecret,
215
    'code': data.code,
216
    'grant_type': 'authorization_code',
217
    'redirect_uri': redirect_uri
218
  }
219
  $.ajax(
220
  {
221
    url : window.swaggerUi.tokenUrl,
222
    type: "POST",
223
    data: params,
224
    success:function(data, textStatus, jqXHR)
225
    {
226
      onOAuthComplete(data);
227
    },
228
    error: function(jqXHR, textStatus, errorThrown)
229
    {
230
      onOAuthComplete("");
231
    }
232
  });
233
}
234
235
window.onOAuthComplete = function onOAuthComplete(token) {
236
  if(token) {
237
    if(token.error) {
238
      var checkbox = $('input[type=checkbox],.secured')
239
      checkbox.each(function(pos){
240
        checkbox[pos].checked = false;
241
      });
242
      alert(token.error);
243
    }
244
    else {
245
      var b = token[window.swaggerUi.tokenName];
246
      if(b){
247
        // if all roles are satisfied
248
        var o = null;
249
        $.each($('.auth .api-ic .api_information_panel'), function(k, v) {
250
          var children = v;
251
          if(children && children.childNodes) {
252
            var requiredScopes = [];
253
            $.each((children.childNodes), function (k1, v1){
254
              var inner = v1.innerHTML;
255
              if(inner)
256
                requiredScopes.push(inner);
257
            });
258
            var diff = [];
259
            for(var i=0; i < requiredScopes.length; i++) {
260
              var s = requiredScopes[i];
261
              if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
262
                diff.push(s);
263
              }
264
            }
265
            if(diff.length > 0){
266
              o = v.parentNode.parentNode;
267
              $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
268
              $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
269
270
              // sorry, not all scopes are satisfied
271
              $(o).find('.api-ic').addClass('ic-warning');
272
              $(o).find('.api-ic').removeClass('ic-error');
273
            }
274
            else {
275
              o = v.parentNode.parentNode;
276
              $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
277
              $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
278
279
              // all scopes are satisfied
280
              $(o).find('.api-ic').addClass('ic-info');
281
              $(o).find('.api-ic').removeClass('ic-warning');
282
              $(o).find('.api-ic').removeClass('ic-error');
283
            }
284
          }
285
        });
286
        window.swaggerUi.api.clientAuthorizations.add(oauth2KeyName, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
287
      }
288
    }
289
  }
290
}
(-)a/api/v1/doc/lib/underscore-min.js (+6 lines)
Line 0 Link Here
1
//     Underscore.js 1.7.0
2
//     http://underscorejs.org
3
//     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
//     Underscore may be freely distributed under the MIT license.
5
(function(){var n=this,t=n._,r=Array.prototype,e=Object.prototype,u=Function.prototype,i=r.push,a=r.slice,o=r.concat,l=e.toString,c=e.hasOwnProperty,f=Array.isArray,s=Object.keys,p=u.bind,h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=h),exports._=h):n._=h,h.VERSION="1.7.0";var g=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}};h.iteratee=function(n,t,r){return null==n?h.identity:h.isFunction(n)?g(n,t,r):h.isObject(n)?h.matches(n):h.property(n)},h.each=h.forEach=function(n,t,r){if(null==n)return n;t=g(t,r);var e,u=n.length;if(u===+u)for(e=0;u>e;e++)t(n[e],e,n);else{var i=h.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},h.map=h.collect=function(n,t,r){if(null==n)return[];t=h.iteratee(t,r);for(var e,u=n.length!==+n.length&&h.keys(n),i=(u||n).length,a=Array(i),o=0;i>o;o++)e=u?u[o]:o,a[o]=t(n[e],e,n);return a};var v="Reduce of empty array with no initial value";h.reduce=h.foldl=h.inject=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length,o=0;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[o++]:o++]}for(;a>o;o++)u=i?i[o]:o,r=t(r,n[u],u,n);return r},h.reduceRight=h.foldr=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[--a]:--a]}for(;a--;)u=i?i[a]:a,r=t(r,n[u],u,n);return r},h.find=h.detect=function(n,t,r){var e;return t=h.iteratee(t,r),h.some(n,function(n,r,u){return t(n,r,u)?(e=n,!0):void 0}),e},h.filter=h.select=function(n,t,r){var e=[];return null==n?e:(t=h.iteratee(t,r),h.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e)},h.reject=function(n,t,r){return h.filter(n,h.negate(h.iteratee(t)),r)},h.every=h.all=function(n,t,r){if(null==n)return!0;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,!t(n[u],u,n))return!1;return!0},h.some=h.any=function(n,t,r){if(null==n)return!1;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,t(n[u],u,n))return!0;return!1},h.contains=h.include=function(n,t){return null==n?!1:(n.length!==+n.length&&(n=h.values(n)),h.indexOf(n,t)>=0)},h.invoke=function(n,t){var r=a.call(arguments,2),e=h.isFunction(t);return h.map(n,function(n){return(e?t:n[t]).apply(n,r)})},h.pluck=function(n,t){return h.map(n,h.property(t))},h.where=function(n,t){return h.filter(n,h.matches(t))},h.findWhere=function(n,t){return h.find(n,h.matches(t))},h.max=function(n,t,r){var e,u,i=-1/0,a=-1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],e>i&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(u>a||u===-1/0&&i===-1/0)&&(i=n,a=u)});return i},h.min=function(n,t,r){var e,u,i=1/0,a=1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],i>e&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(a>u||1/0===u&&1/0===i)&&(i=n,a=u)});return i},h.shuffle=function(n){for(var t,r=n&&n.length===+n.length?n:h.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=h.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},h.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=h.values(n)),n[h.random(n.length-1)]):h.shuffle(n).slice(0,Math.max(0,t))},h.sortBy=function(n,t,r){return t=h.iteratee(t,r),h.pluck(h.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var m=function(n){return function(t,r,e){var u={};return r=h.iteratee(r,e),h.each(t,function(e,i){var a=r(e,i,t);n(u,e,a)}),u}};h.groupBy=m(function(n,t,r){h.has(n,r)?n[r].push(t):n[r]=[t]}),h.indexBy=m(function(n,t,r){n[r]=t}),h.countBy=m(function(n,t,r){h.has(n,r)?n[r]++:n[r]=1}),h.sortedIndex=function(n,t,r,e){r=h.iteratee(r,e,1);for(var u=r(t),i=0,a=n.length;a>i;){var o=i+a>>>1;r(n[o])<u?i=o+1:a=o}return i},h.toArray=function(n){return n?h.isArray(n)?a.call(n):n.length===+n.length?h.map(n,h.identity):h.values(n):[]},h.size=function(n){return null==n?0:n.length===+n.length?n.length:h.keys(n).length},h.partition=function(n,t,r){t=h.iteratee(t,r);var e=[],u=[];return h.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},h.first=h.head=h.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:a.call(n,0,t)},h.initial=function(n,t,r){return a.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},h.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:a.call(n,Math.max(n.length-t,0))},h.rest=h.tail=h.drop=function(n,t,r){return a.call(n,null==t||r?1:t)},h.compact=function(n){return h.filter(n,h.identity)};var y=function(n,t,r,e){if(t&&h.every(n,h.isArray))return o.apply(e,n);for(var u=0,a=n.length;a>u;u++){var l=n[u];h.isArray(l)||h.isArguments(l)?t?i.apply(e,l):y(l,t,r,e):r||e.push(l)}return e};h.flatten=function(n,t){return y(n,t,!1,[])},h.without=function(n){return h.difference(n,a.call(arguments,1))},h.uniq=h.unique=function(n,t,r,e){if(null==n)return[];h.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=h.iteratee(r,e));for(var u=[],i=[],a=0,o=n.length;o>a;a++){var l=n[a];if(t)a&&i===l||u.push(l),i=l;else if(r){var c=r(l,a,n);h.indexOf(i,c)<0&&(i.push(c),u.push(l))}else h.indexOf(u,l)<0&&u.push(l)}return u},h.union=function(){return h.uniq(y(arguments,!0,!0,[]))},h.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!h.contains(t,i)){for(var a=1;r>a&&h.contains(arguments[a],i);a++);a===r&&t.push(i)}}return t},h.difference=function(n){var t=y(a.call(arguments,1),!0,!0,[]);return h.filter(n,function(n){return!h.contains(t,n)})},h.zip=function(n){if(null==n)return[];for(var t=h.max(arguments,"length").length,r=Array(t),e=0;t>e;e++)r[e]=h.pluck(arguments,e);return r},h.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},h.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=h.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}for(;u>e;e++)if(n[e]===t)return e;return-1},h.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},h.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var d=function(){};h.bind=function(n,t){var r,e;if(p&&n.bind===p)return p.apply(n,a.call(arguments,1));if(!h.isFunction(n))throw new TypeError("Bind must be called on a function");return r=a.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(a.call(arguments)));d.prototype=n.prototype;var u=new d;d.prototype=null;var i=n.apply(u,r.concat(a.call(arguments)));return h.isObject(i)?i:u}},h.partial=function(n){var t=a.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===h&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},h.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=h.bind(n[r],n);return n},h.memoize=function(n,t){var r=function(e){var u=r.cache,i=t?t.apply(this,arguments):e;return h.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},h.delay=function(n,t){var r=a.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},h.defer=function(n){return h.delay.apply(h,[n,1].concat(a.call(arguments,1)))},h.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var l=function(){o=r.leading===!1?0:h.now(),a=null,i=n.apply(e,u),a||(e=u=null)};return function(){var c=h.now();o||r.leading!==!1||(o=c);var f=t-(c-o);return e=this,u=arguments,0>=f||f>t?(clearTimeout(a),a=null,o=c,i=n.apply(e,u),a||(e=u=null)):a||r.trailing===!1||(a=setTimeout(l,f)),i}},h.debounce=function(n,t,r){var e,u,i,a,o,l=function(){var c=h.now()-a;t>c&&c>0?e=setTimeout(l,t-c):(e=null,r||(o=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,a=h.now();var c=r&&!e;return e||(e=setTimeout(l,t)),c&&(o=n.apply(i,u),i=u=null),o}},h.wrap=function(n,t){return h.partial(t,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},h.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},h.before=function(n,t){var r;return function(){return--n>0?r=t.apply(this,arguments):t=null,r}},h.once=h.partial(h.before,2),h.keys=function(n){if(!h.isObject(n))return[];if(s)return s(n);var t=[];for(var r in n)h.has(n,r)&&t.push(r);return t},h.values=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},h.pairs=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},h.invert=function(n){for(var t={},r=h.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},h.functions=h.methods=function(n){var t=[];for(var r in n)h.isFunction(n[r])&&t.push(r);return t.sort()},h.extend=function(n){if(!h.isObject(n))return n;for(var t,r,e=1,u=arguments.length;u>e;e++){t=arguments[e];for(r in t)c.call(t,r)&&(n[r]=t[r])}return n},h.pick=function(n,t,r){var e,u={};if(null==n)return u;if(h.isFunction(t)){t=g(t,r);for(e in n){var i=n[e];t(i,e,n)&&(u[e]=i)}}else{var l=o.apply([],a.call(arguments,1));n=new Object(n);for(var c=0,f=l.length;f>c;c++)e=l[c],e in n&&(u[e]=n[e])}return u},h.omit=function(n,t,r){if(h.isFunction(t))t=h.negate(t);else{var e=h.map(o.apply([],a.call(arguments,1)),String);t=function(n,t){return!h.contains(e,t)}}return h.pick(n,t,r)},h.defaults=function(n){if(!h.isObject(n))return n;for(var t=1,r=arguments.length;r>t;t++){var e=arguments[t];for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,t){return t(n),n};var b=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof h&&(n=n._wrapped),t instanceof h&&(t=t._wrapped);var u=l.call(n);if(u!==l.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]===n)return e[i]===t;var a=n.constructor,o=t.constructor;if(a!==o&&"constructor"in n&&"constructor"in t&&!(h.isFunction(a)&&a instanceof a&&h.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c,f;if("[object Array]"===u){if(c=n.length,f=c===t.length)for(;c--&&(f=b(n[c],t[c],r,e)););}else{var s,p=h.keys(n);if(c=p.length,f=h.keys(t).length===c)for(;c--&&(s=p[c],f=h.has(t,s)&&b(n[s],t[s],r,e)););}return r.pop(),e.pop(),f};h.isEqual=function(n,t){return b(n,t,[],[])},h.isEmpty=function(n){if(null==n)return!0;if(h.isArray(n)||h.isString(n)||h.isArguments(n))return 0===n.length;for(var t in n)if(h.has(n,t))return!1;return!0},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=f||function(n){return"[object Array]"===l.call(n)},h.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(n){h["is"+n]=function(t){return l.call(t)==="[object "+n+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return h.has(n,"callee")}),"function"!=typeof/./&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&n!==+n},h.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===l.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return n===void 0},h.has=function(n,t){return null!=n&&c.call(n,t)},h.noConflict=function(){return n._=t,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(n){return function(t){return t[n]}},h.matches=function(n){var t=h.pairs(n),r=t.length;return function(n){if(null==n)return!r;n=new Object(n);for(var e=0;r>e;e++){var u=t[e],i=u[0];if(u[1]!==n[i]||!(i in n))return!1}return!0}},h.times=function(n,t,r){var e=Array(Math.max(0,n));t=g(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},h.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var _={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},w=h.invert(_),j=function(n){var t=function(t){return n[t]},r="(?:"+h.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};h.escape=j(_),h.unescape=j(w),h.result=function(n,t){if(null==n)return void 0;var r=n[t];return h.isFunction(r)?n[t]():r};var x=0;h.uniqueId=function(n){var t=++x+"";return n?n+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,k={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,F=function(n){return"\\"+k[n]};h.template=function(n,t,r){!t&&r&&(t=r),t=h.defaults({},t,h.templateSettings);var e=RegExp([(t.escape||A).source,(t.interpolate||A).source,(t.evaluate||A).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(O,F),u=o+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":a&&(i+="';\n"+a+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=new Function(t.variable||"obj","_",i)}catch(o){throw o.source=i,o}var l=function(n){return a.call(this,n,h)},c=t.variable||"obj";return l.source="function("+c+"){\n"+i+"}",l},h.chain=function(n){var t=h(n);return t._chain=!0,t};var E=function(n){return this._chain?h(n).chain():n};h.mixin=function(n){h.each(h.functions(n),function(t){var r=h[t]=n[t];h.prototype[t]=function(){var n=[this._wrapped];return i.apply(n,arguments),E.call(this,r.apply(h,n))}})},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=r[n];h.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],E.call(this,r)}}),h.each(["concat","join","slice"],function(n){var t=r[n];h.prototype[n]=function(){return E.call(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}).call(this);
6
//# sourceMappingURL=underscore-min.map
(-)a/api/v1/doc/o2c.html (+20 lines)
Line 0 Link Here
1
<script>
2
var qp = null;
3
if(window.location.hash) {
4
  qp = location.hash.substring(1);
5
}
6
else {
7
  qp = location.search.substring(1);
8
}
9
qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
10
  function(key, value) {
11
    return key===""?value:decodeURIComponent(value) }
12
  ):{}
13
14
if (window.opener.swaggerUi.tokenUrl)
15
    window.opener.processOAuthCode(qp);
16
else
17
    window.opener.onOAuthComplete(qp);
18
19
window.close();
20
</script>
(-)a/api/v1/doc/swagger-ui.js (+32183 lines)
Line 0 Link Here
1
/**
2
 * swagger-ui - Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
3
 * @version v2.1.1
4
 * @link http://swagger.io
5
 * @license Apache-2.0
6
 */
7
(function(){this["Handlebars"] = this["Handlebars"] || {};
8
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
9
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
10
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
11
  return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n  <div class='key_input_container'>\n    <div class='auth_label'><label for='input_apiKey_entry'>"
12
    + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
13
    + "</label></div>\n    <input placeholder='api_key' class='auth_input' id='input_apiKey_entry' name='apiKey' type='text'/>\n    <div class='auth_submit'><a class='auth_submit_button' id='apply_api_key' href='#' data-sw-translate>apply</a></div>\n  </div>\n</div>\n";
14
},"useData":true});
15
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
16
  return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n  <div class='key_input_container'>\n    <div class=\"auth_label\"><label for=\"input_username\" data-sw-translate>Username</label></div>\n    <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n    <div class=\"auth_label\"><label for=\"password\" data-sw-translate>Password</label></div>\n    <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
17
  },"useData":true});
18
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
19
  var stack1, buffer = "";
20
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
21
  if (stack1 != null) { buffer += stack1; }
22
  return buffer;
23
},"2":function(depth0,helpers,partials,data) {
24
  var stack1, lambda=this.lambda, buffer = "	<option value=\"";
25
  stack1 = lambda(depth0, depth0);
26
  if (stack1 != null) { buffer += stack1; }
27
  buffer += "\">";
28
  stack1 = lambda(depth0, depth0);
29
  if (stack1 != null) { buffer += stack1; }
30
  return buffer + "</option>\n";
31
},"4":function(depth0,helpers,partials,data) {
32
  return "  <option value=\"application/json\">application/json</option>\n";
33
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
34
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
35
    + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
36
    + "\">Response Content Type</label>\n<select name=\"contentType\" id=\""
37
    + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
38
    + "\">\n";
39
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
40
  if (stack1 != null) { buffer += stack1; }
41
  return buffer + "</select>\n";
42
},"useData":true});
43
'use strict';
44
45
46
$(function() {
47
48
	// Helper function for vertically aligning DOM elements
49
	// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
50
	$.fn.vAlign = function() {
51
		return this.each(function(){
52
			var ah = $(this).height();
53
			var ph = $(this).parent().height();
54
			var mh = (ph - ah) / 2;
55
			$(this).css('margin-top', mh);
56
		});
57
	};
58
59
	$.fn.stretchFormtasticInputWidthToParent = function() {
60
		return this.each(function(){
61
			var p_width = $(this).closest("form").innerWidth();
62
			var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10);
63
			var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
64
			$(this).css('width', p_width - p_padding - this_padding);
65
		});
66
	};
67
68
	$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
69
70
	// Vertically center these paragraphs
71
	// Parent may need a min-height for this to work..
72
	$('ul.downplayed li div.content p').vAlign();
73
74
	// When a sandbox form is submitted..
75
	$("form.sandbox").submit(function(){
76
77
		var error_free = true;
78
79
		// Cycle through the forms required inputs
80
 		$(this).find("input.required").each(function() {
81
82
			// Remove any existing error styles from the input
83
			$(this).removeClass('error');
84
85
			// Tack the error style on if the input is empty..
86
			if ($(this).val() === '') {
87
				$(this).addClass('error');
88
				$(this).wiggle();
89
				error_free = false;
90
			}
91
92
		});
93
94
		return error_free;
95
	});
96
97
});
98
99
function clippyCopiedCallback() {
100
  $('#api_key_copied').fadeIn().delay(1000).fadeOut();
101
102
  // var b = $("#clippy_tooltip_" + a);
103
  // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
104
  //   b.attr("title", "copy to clipboard")
105
  // },
106
  // 500))
107
}
108
109
// Logging function that accounts for browsers that don't have window.console
110
function log(){
111
  log.history = log.history || [];
112
  log.history.push(arguments);
113
  if(this.console){
114
    console.log( Array.prototype.slice.call(arguments)[0] );
115
  }
116
}
117
118
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
119
if (Function.prototype.bind && console && typeof console.log === "object") {
120
    [
121
      "log","info","warn","error","assert","dir","clear","profile","profileEnd"
122
    ].forEach(function (method) {
123
        console[method] = this.bind(console[method], console);
124
    }, Function.prototype.call);
125
}
126
127
window.Docs = {
128
129
	shebang: function() {
130
131
		// If shebang has an operation nickname in it..
132
		// e.g. /docs/#!/words/get_search
133
		var fragments = $.param.fragment().split('/');
134
		fragments.shift(); // get rid of the bang
135
136
		switch (fragments.length) {
137
			case 1:
138
        if (fragments[0].length > 0) { // prevent matching "#/"
139
          // Expand all operations for the resource and scroll to it
140
          var dom_id = 'resource_' + fragments[0];
141
142
          Docs.expandEndpointListForResource(fragments[0]);
143
          $("#"+dom_id).slideto({highlight: false});
144
        }
145
				break;
146
			case 2:
147
				// Refer to the endpoint DOM element, e.g. #words_get_search
148
149
        // Expand Resource
150
        Docs.expandEndpointListForResource(fragments[0]);
151
        $("#"+dom_id).slideto({highlight: false});
152
153
        // Expand operation
154
				var li_dom_id = fragments.join('_');
155
				var li_content_dom_id = li_dom_id + "_content";
156
157
158
				Docs.expandOperation($('#'+li_content_dom_id));
159
				$('#'+li_dom_id).slideto({highlight: false});
160
				break;
161
		}
162
163
	},
164
165
	toggleEndpointListForResource: function(resource) {
166
		var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
167
		if (elem.is(':visible')) {
168
			Docs.collapseEndpointListForResource(resource);
169
		} else {
170
			Docs.expandEndpointListForResource(resource);
171
		}
172
	},
173
174
	// Expand resource
175
	expandEndpointListForResource: function(resource) {
176
		var resource = Docs.escapeResourceName(resource);
177
		if (resource == '') {
178
			$('.resource ul.endpoints').slideDown();
179
			return;
180
		}
181
182
		$('li#resource_' + resource).addClass('active');
183
184
		var elem = $('li#resource_' + resource + ' ul.endpoints');
185
		elem.slideDown();
186
	},
187
188
	// Collapse resource and mark as explicitly closed
189
	collapseEndpointListForResource: function(resource) {
190
		var resource = Docs.escapeResourceName(resource);
191
		if (resource == '') {
192
			$('.resource ul.endpoints').slideUp();
193
			return;
194
		}
195
196
		$('li#resource_' + resource).removeClass('active');
197
198
		var elem = $('li#resource_' + resource + ' ul.endpoints');
199
		elem.slideUp();
200
	},
201
202
	expandOperationsForResource: function(resource) {
203
		// Make sure the resource container is open..
204
		Docs.expandEndpointListForResource(resource);
205
206
		if (resource == '') {
207
			$('.resource ul.endpoints li.operation div.content').slideDown();
208
			return;
209
		}
210
211
		$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
212
			Docs.expandOperation($(this));
213
		});
214
	},
215
216
	collapseOperationsForResource: function(resource) {
217
		// Make sure the resource container is open..
218
		Docs.expandEndpointListForResource(resource);
219
220
		if (resource == '') {
221
			$('.resource ul.endpoints li.operation div.content').slideUp();
222
			return;
223
		}
224
225
		$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
226
			Docs.collapseOperation($(this));
227
		});
228
	},
229
230
	escapeResourceName: function(resource) {
231
		return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
232
	},
233
234
	expandOperation: function(elem) {
235
		elem.slideDown();
236
	},
237
238
	collapseOperation: function(elem) {
239
		elem.slideUp();
240
	}
241
};
242
243
'use strict';
244
245
Handlebars.registerHelper('sanitize', function(html) {
246
    // Strip the script tags from the html, and return it as a Handlebars.SafeString
247
    html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
248
    return new Handlebars.SafeString(html);
249
});
250
251
Handlebars.registerHelper('renderTextParam', function(param) {
252
    var result, type = 'text', idAtt = '';
253
    var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple;
254
    var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default;
255
256
    var dataVendorExtensions = Object.keys(param).filter(function(property) {
257
        // filter X-data- properties
258
        return property.match(/^X-data-/i) !== null;
259
    }).reduce(function(result, property) {
260
        // remove X- from property name, so it results in html attributes like data-foo='bar'
261
        return result += ' ' + property.substring(2, property.length) + '=\'' + param[property] + '\'';
262
    }, '');
263
264
    if (typeof defaultValue === 'undefined') {
265
        defaultValue = '';
266
    }
267
268
    if(param.format && param.format === 'password') {
269
        type = 'password';
270
    }
271
272
    if(param.valueId) {
273
        idAtt = ' id=\'' + param.valueId + '\'';
274
    }
275
276
    if(isArray) {
277
        result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt + dataVendorExtensions;
278
        result += ' placeholder=\'Provide multiple values in new lines' + (param.required ? ' (at least one required).' : '.') + '\'>';
279
        result += defaultValue + '</textarea>';
280
    } else {
281
        var parameterClass = 'parameter';
282
        if(param.required) {
283
          parameterClass += ' required';
284
        }
285
        result = '<input class=\'' + parameterClass + '\' minlength=\'' + (param.required ? 1 : 0) + '\'';
286
        result += ' name=\'' + param.name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions;
287
        result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
288
    }
289
    return new Handlebars.SafeString(result);
290
});
291
292
this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
293
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "  <div class=\"info_title\">"
294
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
295
    + "</div>\n  <div class=\"info_description markdown\">";
296
  stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
297
  if (stack1 != null) { buffer += stack1; }
298
  buffer += "</div>\n";
299
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
300
  if (stack1 != null) { buffer += stack1; }
301
  buffer += "  ";
302
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
303
  if (stack1 != null) { buffer += stack1; }
304
  buffer += "\n  ";
305
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
306
  if (stack1 != null) { buffer += stack1; }
307
  buffer += "\n  ";
308
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
309
  if (stack1 != null) { buffer += stack1; }
310
  buffer += "\n  ";
311
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
312
  if (stack1 != null) { buffer += stack1; }
313
  buffer += "\n  ";
314
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
315
  if (stack1 != null) { buffer += stack1; }
316
  return buffer + "\n";
317
},"2":function(depth0,helpers,partials,data) {
318
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
319
  return "  <p>"
320
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.description : stack1), depth0))
321
    + "</p>\n  <a href=\""
322
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
323
    + "\" target=\"_blank\">"
324
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
325
    + "</a>\n";
326
},"4":function(depth0,helpers,partials,data) {
327
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
328
  return "<div class=\"info_tos\"><a href=\""
329
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
330
    + "\" data-sw-translate>Terms of service</a></div>";
331
},"6":function(depth0,helpers,partials,data) {
332
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
333
  return "<div class='info_name' data-sw-translate>Created by "
334
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
335
    + "</div>";
336
},"8":function(depth0,helpers,partials,data) {
337
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
338
  return "<div class='info_url' data-sw-translate>See more at <a href=\""
339
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
340
    + "\">"
341
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
342
    + "</a></div>";
343
},"10":function(depth0,helpers,partials,data) {
344
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
345
  return "<div class='info_email'><a href=\"mailto:"
346
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
347
    + "?subject="
348
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
349
    + "\" data-sw-translate>Contact the developer</a></div>";
350
},"12":function(depth0,helpers,partials,data) {
351
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
352
  return "<div class='info_license'><a href='"
353
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
354
    + "'>"
355
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
356
    + "</a></div>";
357
},"14":function(depth0,helpers,partials,data) {
358
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
359
  return "  , <span style=\"font-variant: small-caps\" data-sw-translate>api version</span>: "
360
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
361
    + "\n    ";
362
},"16":function(depth0,helpers,partials,data) {
363
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
364
  return "    <span style=\"float:right\"><a href=\""
365
    + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
366
    + "/debug?url="
367
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
368
    + "\"><img id=\"validator\" src=\""
369
    + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
370
    + "?url="
371
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
372
    + "\"></a>\n    </span>\n";
373
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
374
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
375
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
376
  if (stack1 != null) { buffer += stack1; }
377
  buffer += "</div>\n<div class='container' id='resources_container'>\n  <ul id='resources'></ul>\n\n  <div class=\"footer\">\n    <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
378
    + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
379
    + "\n";
380
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
381
  if (stack1 != null) { buffer += stack1; }
382
  buffer += "]\n";
383
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
384
  if (stack1 != null) { buffer += stack1; }
385
  return buffer + "    </h4>\n    </div>\n</div>\n";
386
},"useData":true});
387
this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
388
  return "deprecated";
389
  },"3":function(depth0,helpers,partials,data) {
390
  return "            <h4>Warning: Deprecated</h4>\n";
391
  },"5":function(depth0,helpers,partials,data) {
392
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "        <h4>Implementation Notes</h4>\n        <div class=\"markdown\">";
393
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
394
  if (stack1 != null) { buffer += stack1; }
395
  return buffer + "</div>\n";
396
},"7":function(depth0,helpers,partials,data) {
397
  return "        <div class=\"auth\">\n        <span class=\"api-ic ic-error\">";
398
  },"9":function(depth0,helpers,partials,data) {
399
  var stack1, buffer = "          <div class=\"api_information_panel\">\n";
400
  stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
401
  if (stack1 != null) { buffer += stack1; }
402
  return buffer + "          </div>\n";
403
},"10":function(depth0,helpers,partials,data) {
404
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "            <div title='";
405
  stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
406
  if (stack1 != null) { buffer += stack1; }
407
  return buffer + "'>"
408
    + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
409
    + "</div>\n";
410
},"12":function(depth0,helpers,partials,data) {
411
  return "</span></div>";
412
  },"14":function(depth0,helpers,partials,data) {
413
  return "        <div class='access'>\n          <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n        </div>\n";
414
  },"16":function(depth0,helpers,partials,data) {
415
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
416
  return "          <h4><span data-sw-translate>Response Class</span> (<span data-sw-translate>Status</span> "
417
    + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
418
    + ")</h4>\n          <p><span class=\"model-signature\" /></p>\n          <br/>\n          <div class=\"response-content-type\" />\n";
419
},"18":function(depth0,helpers,partials,data) {
420
  return "          <h4 data-sw-translate>Parameters</h4>\n          <table class='fullwidth'>\n          <thead>\n            <tr>\n            <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter</th>\n            <th style=\"width: 310px; max-width: 310px\" data-sw-translate>Value</th>\n            <th style=\"width: 200px; max-width: 200px\" data-sw-translate>Description</th>\n            <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter Type</th>\n            <th style=\"width: 220px; max-width: 230px\" data-sw-translate>Data Type</th>\n            </tr>\n          </thead>\n          <tbody class=\"operation-params\">\n\n          </tbody>\n          </table>\n";
421
  },"20":function(depth0,helpers,partials,data) {
422
  return "          <div style='margin:0;padding:0;display:inline'></div>\n          <h4 data-sw-translate>Response Messages</h4>\n          <table class='fullwidth'>\n            <thead>\n            <tr>\n              <th data-sw-translate>HTTP Status Code</th>\n              <th data-sw-translate>Reason</th>\n              <th data-sw-translate>Response Model</th>\n              <th data-sw-translate>Headers</th>\n            </tr>\n            </thead>\n            <tbody class=\"operation-status\">\n\n            </tbody>\n          </table>\n";
423
  },"22":function(depth0,helpers,partials,data) {
424
  return "";
425
},"24":function(depth0,helpers,partials,data) {
426
  return "          <div class='sandbox_header'>\n            <input class='submit' type='button' value='Try it out!' data-sw-translate/>\n            <a href='#' class='response_hider' style='display:none' data-sw-translate>Hide Response</a>\n            <span class='response_throbber' style='display:none'></span>\n          </div>\n";
427
  },"26":function(depth0,helpers,partials,data) {
428
  return "          <h4 data-sw-translate>Request Headers</h4>\n          <div class='block request_headers'></div>\n";
429
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
430
  var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n  <ul class='operations' >\n    <li class='"
431
    + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
432
    + " operation' id='"
433
    + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
434
    + "_"
435
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
436
    + "'>\n      <div class='heading'>\n        <h3>\n          <span class='http_method'>\n          <a href='#!/"
437
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
438
    + "/"
439
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
440
    + "' class=\"toggleOperation\">"
441
    + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
442
    + "</a>\n          </span>\n          <span class='path'>\n          <a href='#!/"
443
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
444
    + "/"
445
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
446
    + "' class=\"toggleOperation ";
447
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
448
  if (stack1 != null) { buffer += stack1; }
449
  buffer += "\">"
450
    + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
451
    + "</a>\n          </span>\n        </h3>\n        <ul class='options'>\n          <li>\n          <a href='#!/"
452
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
453
    + "/"
454
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
455
    + "' class=\"toggleOperation\">";
456
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
457
  if (stack1 != null) { buffer += stack1; }
458
  buffer += "</a>\n          </li>\n        </ul>\n      </div>\n      <div class='content' id='"
459
    + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
460
    + "_"
461
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
462
    + "_content' style='display:none'>\n";
463
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
464
  if (stack1 != null) { buffer += stack1; }
465
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
466
  if (stack1 != null) { buffer += stack1; }
467
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
468
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
469
  if (stack1 != null) { buffer += stack1; }
470
  buffer += "\n";
471
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
472
  if (stack1 != null) { buffer += stack1; }
473
  buffer += "        ";
474
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
475
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
476
  if (stack1 != null) { buffer += stack1; }
477
  buffer += "\n";
478
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
479
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
480
  if (stack1 != null) { buffer += stack1; }
481
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
482
  if (stack1 != null) { buffer += stack1; }
483
  buffer += "        <form accept-charset='UTF-8' class='sandbox'>\n          <div style='margin:0;padding:0;display:inline'></div>\n";
484
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
485
  if (stack1 != null) { buffer += stack1; }
486
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
487
  if (stack1 != null) { buffer += stack1; }
488
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
489
  if (stack1 != null) { buffer += stack1; }
490
  buffer += "        </form>\n        <div class='response' style='display:none'>\n          <h4>Curl</h4>\n          <div class='block curl'></div>\n          <h4 data-sw-translate>Request URL</h4>\n          <div class='block request_url'></div>\n";
491
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showRequestHeaders : depth0), {"name":"if","hash":{},"fn":this.program(26, data),"inverse":this.noop,"data":data});
492
  if (stack1 != null) { buffer += stack1; }
493
  return buffer + "          <h4 data-sw-translate>Response Body</h4>\n          <div class='block response_body'></div>\n          <h4 data-sw-translate>Response Code</h4>\n          <div class='block response_code'></div>\n          <h4 data-sw-translate>Response Headers</h4>\n          <div class='block response_headers'></div>\n        </div>\n      </div>\n    </li>\n  </ul>\n";
494
},"useData":true});
495
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
496
  return " required";
497
  },"3":function(depth0,helpers,partials,data) {
498
  return " multiple=\"multiple\"";
499
  },"5":function(depth0,helpers,partials,data) {
500
  return " required ";
501
  },"7":function(depth0,helpers,partials,data) {
502
  var stack1, buffer = "      <option ";
503
  stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.hasDefault : depth0), {"name":"unless","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
504
  if (stack1 != null) { buffer += stack1; }
505
  return buffer + " value=''></option>\n";
506
},"8":function(depth0,helpers,partials,data) {
507
  return "  selected=\"\" ";
508
  },"10":function(depth0,helpers,partials,data) {
509
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "\n      <option ";
510
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data});
511
  if (stack1 != null) { buffer += stack1; }
512
  buffer += "  value='"
513
    + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
514
    + "'> "
515
    + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
516
    + " ";
517
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data});
518
  if (stack1 != null) { buffer += stack1; }
519
  return buffer + " </option>\n\n";
520
},"11":function(depth0,helpers,partials,data) {
521
  return " selected=\"\"  ";
522
  },"13":function(depth0,helpers,partials,data) {
523
  return " (default) ";
524
  },"15":function(depth0,helpers,partials,data) {
525
  return "<strong>";
526
  },"17":function(depth0,helpers,partials,data) {
527
  return "</strong>";
528
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
529
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code";
530
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
531
  if (stack1 != null) { buffer += stack1; }
532
  buffer += "'><label for='"
533
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
534
    + "'>"
535
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
536
    + "</label></td>\n<td>\n  <select ";
537
  stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}));
538
  if (stack1 != null) { buffer += stack1; }
539
  buffer += " class=\"parameter ";
540
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
541
  if (stack1 != null) { buffer += stack1; }
542
  buffer += "\" name=\""
543
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
544
    + "\" id=\""
545
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
546
    + "\">\n\n";
547
  stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"unless","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data});
548
  if (stack1 != null) { buffer += stack1; }
549
  buffer += "\n";
550
  stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
551
  if (stack1 != null) { buffer += stack1; }
552
  buffer += "\n  </select>\n</td>\n<td class=\"markdown\">";
553
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(15, data),"inverse":this.noop,"data":data});
554
  if (stack1 != null) { buffer += stack1; }
555
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
556
  if (stack1 != null) { buffer += stack1; }
557
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(17, data),"inverse":this.noop,"data":data});
558
  if (stack1 != null) { buffer += stack1; }
559
  buffer += "</td>\n<td>";
560
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
561
  if (stack1 != null) { buffer += stack1; }
562
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
563
},"useData":true});
564
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
565
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
566
  return "        <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
567
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
568
    + "' id='"
569
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
570
    + "'>"
571
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
572
    + "</textarea>\n";
573
},"3":function(depth0,helpers,partials,data) {
574
  var stack1, buffer = "";
575
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
576
  if (stack1 != null) { buffer += stack1; }
577
  return buffer;
578
},"4":function(depth0,helpers,partials,data) {
579
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
580
  return "            "
581
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
582
    + "\n";
583
},"6":function(depth0,helpers,partials,data) {
584
  return "            (empty)\n";
585
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
586
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
587
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
588
    + "'>"
589
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
590
    + "</label></td>\n<td>\n";
591
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
592
  if (stack1 != null) { buffer += stack1; }
593
  buffer += "</td>\n<td class=\"markdown\">";
594
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
595
  if (stack1 != null) { buffer += stack1; }
596
  buffer += "</td>\n<td>";
597
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
598
  if (stack1 != null) { buffer += stack1; }
599
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
600
},"useData":true});
601
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
602
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
603
  return "        <textarea class='body-textarea' readonly='readonly' name='"
604
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
605
    + "' id='"
606
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
607
    + "'>"
608
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
609
    + "</textarea>\n";
610
},"3":function(depth0,helpers,partials,data) {
611
  var stack1, buffer = "";
612
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
613
  if (stack1 != null) { buffer += stack1; }
614
  return buffer;
615
},"4":function(depth0,helpers,partials,data) {
616
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
617
  return "            "
618
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
619
    + "\n";
620
},"6":function(depth0,helpers,partials,data) {
621
  return "            (empty)\n";
622
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
623
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
624
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
625
    + "'>"
626
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
627
    + "</label></td>\n<td>\n";
628
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
629
  if (stack1 != null) { buffer += stack1; }
630
  buffer += "</td>\n<td class=\"markdown\">";
631
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
632
  if (stack1 != null) { buffer += stack1; }
633
  buffer += "</td>\n<td>";
634
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
635
  if (stack1 != null) { buffer += stack1; }
636
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
637
},"useData":true});
638
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
639
  var stack1, buffer = "";
640
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
641
  if (stack1 != null) { buffer += stack1; }
642
  return buffer;
643
},"2":function(depth0,helpers,partials,data) {
644
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
645
  return "			<input type=\"file\" name='"
646
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
647
    + "' id='"
648
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
649
    + "'/>\n";
650
},"4":function(depth0,helpers,partials,data) {
651
  var stack1, buffer = "";
652
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
653
  if (stack1 != null) { buffer += stack1; }
654
  return buffer;
655
},"5":function(depth0,helpers,partials,data) {
656
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
657
  return "				<textarea class='body-textarea required' placeholder='(required)' name='"
658
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
659
    + "' id=\""
660
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
661
    + "\">"
662
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
663
    + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
664
},"7":function(depth0,helpers,partials,data) {
665
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
666
  return "				<textarea class='body-textarea required' placeholder='(required)' name='"
667
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
668
    + "' id='"
669
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
670
    + "'></textarea>\n				<br />\n				<div class=\"parameter-content-type\" />\n";
671
},"9":function(depth0,helpers,partials,data) {
672
  var stack1, buffer = "";
673
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
674
  if (stack1 != null) { buffer += stack1; }
675
  return buffer;
676
},"10":function(depth0,helpers,partials,data) {
677
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
678
  return "			<input class='parameter' class='required' type='file' name='"
679
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
680
    + "' id='"
681
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
682
    + "'/>\n";
683
},"12":function(depth0,helpers,partials,data) {
684
  var stack1, helperMissing=helpers.helperMissing, buffer = "";
685
  stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data}));
686
  if (stack1 != null) { buffer += stack1; }
687
  return buffer;
688
},"13":function(depth0,helpers,partials,data) {
689
  return "";
690
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
691
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
692
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
693
    + "'>"
694
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
695
    + "</label></td>\n<td>\n";
696
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
697
  if (stack1 != null) { buffer += stack1; }
698
  buffer += "</td>\n<td>\n	<strong><span class=\"markdown\">";
699
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
700
  if (stack1 != null) { buffer += stack1; }
701
  buffer += "</span></strong>\n</td>\n<td>";
702
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
703
  if (stack1 != null) { buffer += stack1; }
704
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
705
},"useData":true});
706
this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
707
  var stack1, buffer = "";
708
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
709
  if (stack1 != null) { buffer += stack1; }
710
  return buffer;
711
},"2":function(depth0,helpers,partials,data) {
712
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
713
  return "			<input type=\"file\" name='"
714
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
715
    + "' id='"
716
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
717
    + "'/>\n			<div class=\"parameter-content-type\" />\n";
718
},"4":function(depth0,helpers,partials,data) {
719
  var stack1, buffer = "";
720
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
721
  if (stack1 != null) { buffer += stack1; }
722
  return buffer;
723
},"5":function(depth0,helpers,partials,data) {
724
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
725
  return "				<textarea class='body-textarea' name='"
726
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
727
    + "' id='"
728
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
729
    + "'>"
730
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
731
    + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
732
},"7":function(depth0,helpers,partials,data) {
733
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
734
  return "				<textarea class='body-textarea' name='"
735
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
736
    + "' id='"
737
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
738
    + "'></textarea>\n				<br />\n				<div class=\"parameter-content-type\" />\n";
739
},"9":function(depth0,helpers,partials,data) {
740
  var stack1, buffer = "";
741
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
742
  if (stack1 != null) { buffer += stack1; }
743
  return buffer;
744
},"10":function(depth0,helpers,partials,data) {
745
  var stack1, helperMissing=helpers.helperMissing, buffer = "";
746
  stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data}));
747
  if (stack1 != null) { buffer += stack1; }
748
  return buffer;
749
},"11":function(depth0,helpers,partials,data) {
750
  return "";
751
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
752
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
753
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
754
    + "'>"
755
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
756
    + "</label></td>\n<td>\n\n";
757
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
758
  if (stack1 != null) { buffer += stack1; }
759
  buffer += "\n</td>\n<td class=\"markdown\">";
760
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
761
  if (stack1 != null) { buffer += stack1; }
762
  buffer += "</td>\n<td>";
763
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
764
  if (stack1 != null) { buffer += stack1; }
765
  return buffer + "</td>\n<td>\n	<span class=\"model-signature\"></span>\n</td>\n";
766
},"useData":true});
767
this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
768
  var stack1, buffer = "";
769
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
770
  if (stack1 != null) { buffer += stack1; }
771
  return buffer;
772
},"2":function(depth0,helpers,partials,data) {
773
  var stack1, lambda=this.lambda, buffer = "  <option value=\"";
774
  stack1 = lambda(depth0, depth0);
775
  if (stack1 != null) { buffer += stack1; }
776
  buffer += "\">";
777
  stack1 = lambda(depth0, depth0);
778
  if (stack1 != null) { buffer += stack1; }
779
  return buffer + "</option>\n";
780
},"4":function(depth0,helpers,partials,data) {
781
  return "  <option value=\"application/json\">application/json</option>\n";
782
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
783
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label for=\""
784
    + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
785
    + "\">Parameter content type:</label>\n<select name=\"parameterContentType\" id=\""
786
    + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
787
    + "\">\n";
788
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
789
  if (stack1 != null) { buffer += stack1; }
790
  return buffer + "</select>\n";
791
},"useData":true});
792
this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
793
  return " : ";
794
  },"3":function(depth0,helpers,partials,data) {
795
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
796
  return "    <li>\n      <a href='"
797
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
798
    + "' data-sw-translate>Raw</a>\n    </li>\n";
799
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
800
  var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n  <h2>\n    <a href='#!/"
801
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
802
    + "' class=\"toggleEndpointList\" data-id=\""
803
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
804
    + "\">"
805
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
806
    + "</a> ";
807
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
808
  if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
809
  if (stack1 != null) { buffer += stack1; }
810
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
811
  if (stack1 != null) { buffer += stack1; }
812
  buffer += "\n  </h2>\n  <ul class='options'>\n    <li>\n      <a href='#!/"
813
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
814
    + "' id='endpointListTogger_"
815
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
816
    + "' class=\"toggleEndpointList\" data-id=\""
817
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
818
    + "\" data-sw-translate>Show/Hide</a>\n    </li>\n    <li>\n      <a href='#' class=\"collapseResource\" data-id=\""
819
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
820
    + "\" data-sw-translate>\n        List Operations\n      </a>\n    </li>\n    <li>\n      <a href='#' class=\"expandResource\" data-id=\""
821
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
822
    + "\" data-sw-translate>\n        Expand Operations\n      </a>\n    </li>\n";
823
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.url : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
824
  if (stack1 != null) { buffer += stack1; }
825
  return buffer + "  </ul>\n</div>\n<ul class='endpoints' id='"
826
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
827
    + "_endpoint_list' style='display:none'>\n\n</ul>\n";
828
},"useData":true});
829
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
830
  var stack1, buffer = "";
831
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
832
  if (stack1 != null) { buffer += stack1; }
833
  return buffer;
834
},"2":function(depth0,helpers,partials,data) {
835
  var stack1, lambda=this.lambda, buffer = "  <option value=\"";
836
  stack1 = lambda(depth0, depth0);
837
  if (stack1 != null) { buffer += stack1; }
838
  buffer += "\">";
839
  stack1 = lambda(depth0, depth0);
840
  if (stack1 != null) { buffer += stack1; }
841
  return buffer + "</option>\n";
842
},"4":function(depth0,helpers,partials,data) {
843
  return "  <option value=\"application/json\">application/json</option>\n";
844
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
845
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
846
    + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
847
    + "\">Response Content Type</label>\n<select name=\"responseContentType\" id=\""
848
    + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
849
    + "\">\n";
850
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
851
  if (stack1 != null) { buffer += stack1; }
852
  return buffer + "</select>\n";
853
},"useData":true});
854
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
855
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n  <li><a class=\"description-link\" href=\"#\" data-sw-translate>Model</a></li>\n  <li><a class=\"snippet-link\" href=\"#\" data-sw-translate>Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n  <div class=\"description\">\n    ";
856
  stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
857
  if (stack1 != null) { buffer += stack1; }
858
  return buffer + "\n  </div>\n\n  <div class=\"snippet\">\n    <pre><code>"
859
    + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
860
    + "</code></pre>\n    <small class=\"notice\"></small>\n  </div>\n</div>\n\n";
861
},"useData":true});
862
this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
863
  var lambda=this.lambda, escapeExpression=this.escapeExpression;
864
  return "      <tr>\n        <td>"
865
    + escapeExpression(lambda((data && data.key), depth0))
866
    + "</td>\n        <td>"
867
    + escapeExpression(lambda((depth0 != null ? depth0.description : depth0), depth0))
868
    + "</td>\n        <td>"
869
    + escapeExpression(lambda((depth0 != null ? depth0.type : depth0), depth0))
870
    + "</td>\n      </tr>\n";
871
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
872
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
873
    + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
874
    + "</td>\n<td class=\"markdown\">";
875
  stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
876
  if (stack1 != null) { buffer += stack1; }
877
  buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>\n<td class=\"headers\">\n  <table>\n    <tbody>\n";
878
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
879
  if (stack1 != null) { buffer += stack1; }
880
  return buffer + "    </tbody>\n  </table>\n</td>";
881
},"useData":true});
882
/**
883
 * swagger-client - swagger-client is a javascript client for use with swaggering APIs.
884
 * @version v2.1.2
885
 * @link http://swagger.io
886
 * @license Apache-2.0
887
 */
888
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SwaggerClient = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
889
'use strict';
890
891
var auth = require('./lib/auth');
892
var helpers = require('./lib/helpers');
893
var SwaggerClient = require('./lib/client');
894
var deprecationWrapper = function (url, options) {
895
  helpers.log('This is deprecated, use "new SwaggerClient" instead.');
896
897
  return new SwaggerClient(url, options);
898
};
899
900
/* Here for IE8 Support */
901
if (!Array.prototype.indexOf) {
902
  Array.prototype.indexOf = function(obj, start) {
903
    for (var i = (start || 0), j = this.length; i < j; i++) {
904
      if (this[i] === obj) { return i; }
905
    }
906
    return -1;
907
  };
908
}
909
910
/* Here for IE8 Support */
911
if (!String.prototype.trim) {
912
  String.prototype.trim = function () {
913
    return this.replace(/^\s+|\s+$/g, '');
914
  };
915
}
916
917
/* Here for node 10.x support */
918
if (!String.prototype.endsWith) {
919
  String.prototype.endsWith = function(suffix) {
920
    return this.indexOf(suffix, this.length - suffix.length) !== -1;
921
  };
922
}
923
924
module.exports = SwaggerClient;
925
926
SwaggerClient.ApiKeyAuthorization = auth.ApiKeyAuthorization;
927
SwaggerClient.PasswordAuthorization = auth.PasswordAuthorization;
928
SwaggerClient.CookieAuthorization = auth.CookieAuthorization;
929
SwaggerClient.SwaggerApi = deprecationWrapper;
930
SwaggerClient.SwaggerClient = deprecationWrapper;
931
SwaggerClient.SchemaMarkup = require('./lib/schema-markup');
932
933
},{"./lib/auth":2,"./lib/client":3,"./lib/helpers":4,"./lib/schema-markup":7}],2:[function(require,module,exports){
934
'use strict';
935
936
var helpers = require('./helpers');
937
var btoa = require('btoa'); // jshint ignore:line
938
var CookieJar = require('cookiejar');
939
var _ = {
940
  each: require('lodash-compat/collection/each'),
941
  includes: require('lodash-compat/collection/includes'),
942
  isObject: require('lodash-compat/lang/isObject'),
943
  isArray: require('lodash-compat/lang/isArray')
944
};
945
946
/**
947
 * SwaggerAuthorizations applys the correct authorization to an operation being executed
948
 */
949
var SwaggerAuthorizations = module.exports.SwaggerAuthorizations = function (authz) {
950
  this.authz = authz || {};
951
};
952
953
/**
954
 * Add auths to the hash
955
 * Will overwrite any existing
956
 *
957
 */
958
SwaggerAuthorizations.prototype.add = function (name, auth) {
959
  if(_.isObject(name)) {
960
    for (var key in name) {
961
      this.authz[key] = name[key];
962
    }
963
  } else if(typeof name === 'string' ){
964
    this.authz[name] = auth;
965
  }
966
967
  return auth;
968
};
969
970
SwaggerAuthorizations.prototype.remove = function (name) {
971
  return delete this.authz[name];
972
};
973
974
SwaggerAuthorizations.prototype.apply = function (obj, securities) {
975
  var status = true;
976
  var applyAll = !securities;
977
  var flattenedSecurities = [];
978
979
  // Securities could be [ {} ]
980
  _.each(securities, function (obj, key) {
981
982
    // Make sure we account for securities being [ str ]
983
    if(typeof key === 'string') {
984
      flattenedSecurities.push(key);
985
    }
986
987
    // Flatten keys in to our array
988
    _.each(obj, function (val, key) {
989
      flattenedSecurities.push(key);
990
    });
991
  });
992
993
  _.each(this.authz, function (auth, authName) {
994
    if(applyAll || _.includes(flattenedSecurities, authName)) {
995
      var newStatus = auth.apply(obj);
996
      status = status && !!newStatus; // logical ORs regarding status
997
    }
998
  });
999
1000
  return status;
1001
};
1002
1003
/**
1004
 * ApiKeyAuthorization allows a query param or header to be injected
1005
 */
1006
var ApiKeyAuthorization = module.exports.ApiKeyAuthorization = function (name, value, type) {
1007
  this.name = name;
1008
  this.value = value;
1009
  this.type = type;
1010
};
1011
1012
ApiKeyAuthorization.prototype.apply = function (obj) {
1013
  if (this.type === 'query') {
1014
    if (obj.url.indexOf('?') > 0) {
1015
      obj.url = obj.url + '&' + this.name + '=' + this.value;
1016
    } else {
1017
      obj.url = obj.url + '?' + this.name + '=' + this.value;
1018
    }
1019
1020
    return true;
1021
  } else if (this.type === 'header') {
1022
    if(typeof obj.headers[this.name] === 'undefined') {
1023
      obj.headers[this.name] = this.value;
1024
    }
1025
1026
    return true;
1027
  }
1028
};
1029
1030
var CookieAuthorization = module.exports.CookieAuthorization = function (cookie) {
1031
  this.cookie = cookie;
1032
};
1033
1034
CookieAuthorization.prototype.apply = function (obj) {
1035
  obj.cookieJar = obj.cookieJar || new CookieJar();
1036
  obj.cookieJar.setCookie(this.cookie);
1037
1038
  return true;
1039
};
1040
1041
/**
1042
 * Password Authorization is a basic auth implementation
1043
 */
1044
var PasswordAuthorization = module.exports.PasswordAuthorization = function (username, password) {
1045
  if (arguments.length === 3) {
1046
    helpers.log('PasswordAuthorization: the \'name\' argument has been removed, pass only username and password');
1047
    username = arguments[1];
1048
    password = arguments[2];
1049
  }
1050
  this.username = username;
1051
  this.password = password;
1052
};
1053
1054
PasswordAuthorization.prototype.apply = function (obj) {
1055
  if(typeof obj.headers.Authorization === 'undefined') {
1056
    obj.headers.Authorization = 'Basic ' + btoa(this.username + ':' + this.password);
1057
  }
1058
1059
  return true;
1060
};
1061
1062
},{"./helpers":4,"btoa":18,"cookiejar":19,"lodash-compat/collection/each":55,"lodash-compat/collection/includes":58,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isObject":147}],3:[function(require,module,exports){
1063
'use strict';
1064
1065
var _ = {
1066
  bind: require('lodash-compat/function/bind'),
1067
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
1068
  find: require('lodash-compat/collection/find'),
1069
  forEach: require('lodash-compat/collection/forEach'),
1070
  indexOf: require('lodash-compat/array/indexOf'),
1071
  isArray: require('lodash-compat/lang/isArray'),
1072
  isObject: require('lodash-compat/lang/isObject'),
1073
  isFunction: require('lodash-compat/lang/isFunction'),
1074
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
1075
  isUndefined: require('lodash-compat/lang/isUndefined')
1076
};
1077
var auth = require('./auth');
1078
var helpers = require('./helpers');
1079
var Model = require('./types/model');
1080
var Operation = require('./types/operation');
1081
var OperationGroup = require('./types/operationGroup');
1082
var Resolver = require('./resolver');
1083
var SwaggerHttp = require('./http');
1084
var SwaggerSpecConverter = require('./spec-converter');
1085
1086
// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1087
// following usage: 'client.{tagName}'
1088
var reservedClientTags = [
1089
  'apis',
1090
  'authorizationScheme',
1091
  'authorizations',
1092
  'basePath',
1093
  'build',
1094
  'buildFrom1_1Spec',
1095
  'buildFrom1_2Spec',
1096
  'buildFromSpec',
1097
  'clientAuthorizations',
1098
  'convertInfo',
1099
  'debug',
1100
  'defaultErrorCallback',
1101
  'defaultSuccessCallback',
1102
  'fail',
1103
  'failure',
1104
  'finish',
1105
  'help',
1106
  'idFromOp',
1107
  'info',
1108
  'initialize',
1109
  'isBuilt',
1110
  'isValid',
1111
  'modelPropertyMacro',
1112
  'models',
1113
  'modelsArray',
1114
  'options',
1115
  'parameterMacro',
1116
  'parseUri',
1117
  'progress',
1118
  'resourceCount',
1119
  'sampleModels',
1120
  'selfReflect',
1121
  'setConsolidatedModels',
1122
  'spec',
1123
  'supportedSubmitMethods',
1124
  'swaggerRequestHeaders',
1125
  'tagFromLabel',
1126
  'url',
1127
  'useJQuery'
1128
];
1129
// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1130
// following usage: 'client.apis.{tagName}'
1131
var reservedApiTags = [
1132
  'apis',
1133
  'asCurl',
1134
  'description',
1135
  'externalDocs',
1136
  'help',
1137
  'label',
1138
  'name',
1139
  'operation',
1140
  'operations',
1141
  'operationsArray',
1142
  'path',
1143
  'tag'
1144
];
1145
var supportedOperationMethods = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put'];
1146
var SwaggerClient = module.exports = function (url, options) {
1147
  this.authorizations = null;
1148
  this.authorizationScheme = null;
1149
  this.basePath = null;
1150
  this.debug = false;
1151
  this.info = null;
1152
  this.isBuilt = false;
1153
  this.isValid = false;
1154
  this.modelsArray = [];
1155
  this.resourceCount = 0;
1156
  this.url = null;
1157
  this.useJQuery = false;
1158
  this.swaggerObject = {}
1159
1160
  this.clientAuthorizations = new auth.SwaggerAuthorizations();
1161
1162
  if (typeof url !== 'undefined') {
1163
    return this.initialize(url, options);
1164
  } else {
1165
    return this;
1166
  }
1167
};
1168
1169
SwaggerClient.prototype.initialize = function (url, options) {
1170
  this.models = {};
1171
  this.sampleModels = {};
1172
1173
  if (typeof url === 'string') {
1174
    this.url = url;
1175
  } else if (_.isObject(url)) {
1176
    options = url;
1177
    this.url = options.url;
1178
  }
1179
1180
  options = options || {};
1181
  this.clientAuthorizations.add(options.authorizations);
1182
  this.swaggerRequestHeaders = options.swaggerRequestHeaders || 'application/json;charset=utf-8,*/*';
1183
  this.defaultSuccessCallback = options.defaultSuccessCallback || null;
1184
  this.defaultErrorCallback = options.defaultErrorCallback || null;
1185
  this.modelPropertyMacro = options.modelPropertyMacro || null;
1186
  this.parameterMacro = options.modelPropertyMacro || null;
1187
1188
  if (typeof options.success === 'function') {
1189
    this.success = options.success;
1190
  }
1191
1192
  if (options.useJQuery) {
1193
    this.useJQuery = options.useJQuery;
1194
  }
1195
1196
  this.options = options || {};
1197
1198
  this.supportedSubmitMethods = options.supportedSubmitMethods || [];
1199
  this.failure = options.failure || function () {};
1200
  this.progress = options.progress || function () {};
1201
  this.spec = _.cloneDeep(options.spec); // Clone so we do not alter the provided document
1202
1203
  if (typeof options.success === 'function') {
1204
    this.ready = true;
1205
    this.build();
1206
  }
1207
};
1208
1209
SwaggerClient.prototype.build = function (mock) {
1210
  if (this.isBuilt) {
1211
    return this;
1212
  }
1213
1214
  var self = this;
1215
1216
  this.progress('fetching resource list: ' + this.url);
1217
1218
  var obj = {
1219
    useJQuery: this.useJQuery,
1220
    url: this.url,
1221
    method: 'get',
1222
    headers: {
1223
      accept: this.swaggerRequestHeaders
1224
    },
1225
    on: {
1226
      error: function (response) {
1227
        if (self.url.substring(0, 4) !== 'http') {
1228
          return self.fail('Please specify the protocol for ' + self.url);
1229
        } else if (response.status === 0) {
1230
          return self.fail('Can\'t read from server.  It may not have the appropriate access-control-origin settings.');
1231
        } else if (response.status === 404) {
1232
          return self.fail('Can\'t read swagger JSON from ' + self.url);
1233
        } else {
1234
          return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
1235
        }
1236
      },
1237
      response: function (resp) {
1238
1239
        var responseObj = resp.obj;
1240
        if(!responseObj) {
1241
          return self.fail('failed to parse JSON/YAML response');
1242
        }
1243
1244
        self.swaggerVersion = responseObj.swaggerVersion;
1245
        self.swaggerObject = responseObj
1246
1247
        if (responseObj.swagger && parseInt(responseObj.swagger) === 2) {
1248
          self.swaggerVersion = responseObj.swagger;
1249
1250
          new Resolver().resolve(responseObj, self.url, self.buildFromSpec, self);
1251
1252
          self.isValid = true;
1253
        } else {
1254
          var converter = new SwaggerSpecConverter();
1255
          self.oldSwaggerObject = self.swaggerObject
1256
1257
          converter.setDocumentationLocation(self.url);
1258
          converter.convert(responseObj, self.clientAuthorizations, function(spec) {
1259
            self.swaggerObject = spec
1260
            new Resolver().resolve(spec, self.url, self.buildFromSpec, self);
1261
            self.isValid = true;
1262
          });
1263
        }
1264
      }
1265
    }
1266
  };
1267
1268
  if (this.spec) {
1269
    self.swaggerObject = this.spec
1270
    setTimeout(function () {
1271
      new Resolver().resolve(self.spec, self.buildFromSpec, self);
1272
    }, 10);
1273
  } else {
1274
    this.clientAuthorizations.apply(obj);
1275
1276
    if (mock) {
1277
      return obj;
1278
    }
1279
1280
    new SwaggerHttp().execute(obj, this.options);
1281
  }
1282
1283
  return this;
1284
};
1285
1286
SwaggerClient.prototype.buildFromSpec = function (response) {
1287
  if (this.isBuilt) {
1288
    return this;
1289
  }
1290
1291
  this.apis = {};
1292
  this.apisArray = [];
1293
  this.basePath = response.basePath || '';
1294
  this.consumes = response.consumes;
1295
  this.host = response.host || '';
1296
  this.info = response.info || {};
1297
  this.produces = response.produces;
1298
  this.schemes = response.schemes || [];
1299
  this.securityDefinitions = response.securityDefinitions;
1300
  this.title = response.title || '';
1301
1302
  if (response.externalDocs) {
1303
    this.externalDocs = response.externalDocs;
1304
  }
1305
1306
  // legacy support
1307
  this.authSchemes = response.securityDefinitions;
1308
1309
  var definedTags = {};
1310
  var k;
1311
1312
  if (Array.isArray(response.tags)) {
1313
    definedTags = {};
1314
1315
    for (k = 0; k < response.tags.length; k++) {
1316
      var t = response.tags[k];
1317
      definedTags[t.name] = t;
1318
    }
1319
  }
1320
1321
  var location;
1322
1323
  if (typeof this.url === 'string') {
1324
    location = this.parseUri(this.url);
1325
    if (typeof this.schemes === 'undefined' || this.schemes.length === 0) {
1326
      this.scheme = location.scheme || 'http';
1327
    } else {
1328
      this.scheme = this.schemes[0];
1329
    }
1330
1331
    if (typeof this.host === 'undefined' || this.host === '') {
1332
      this.host = location.host;
1333
1334
      if (location.port) {
1335
        this.host = this.host + ':' + location.port;
1336
      }
1337
    }
1338
  }
1339
  else {
1340
    if (typeof this.schemes === 'undefined' || this.schemes.length === 0) {
1341
      this.scheme = 'http';
1342
    }
1343
    else {
1344
      this.scheme = this.schemes[0];
1345
    }
1346
  }
1347
1348
  this.definitions = response.definitions;
1349
1350
  var key;
1351
1352
  for (key in this.definitions) {
1353
    var model = new Model(key, this.definitions[key], this.models, this.modelPropertyMacro);
1354
1355
    if (model) {
1356
      this.models[key] = model;
1357
    }
1358
  }
1359
1360
  // get paths, create functions for each operationId
1361
  var self = this;
1362
1363
  // Bind help to 'client.apis'
1364
  self.apis.help = _.bind(self.help, self);
1365
1366
  _.forEach(response.paths, function (pathObj, path) {
1367
    // Only process a path if it's an object
1368
    if (!_.isPlainObject(pathObj)) {
1369
      return;
1370
    }
1371
1372
    _.forEach(supportedOperationMethods, function (method) {
1373
      var operation = pathObj[method];
1374
1375
      if (_.isUndefined(operation)) {
1376
        // Operation does not exist
1377
        return;
1378
      } else if (!_.isPlainObject(operation)) {
1379
        // Operation exists but it is not an Operation Object.  Since this is invalid, log it.
1380
        helpers.log('The \'' + method + '\' operation for \'' + path + '\' path is not an Operation Object');
1381
1382
        return;
1383
      }
1384
1385
      var tags = operation.tags;
1386
1387
      if (_.isUndefined(tags) || !_.isArray(tags) || tags.length === 0) {
1388
        tags = operation.tags = [ 'default' ];
1389
      }
1390
1391
      var operationId = self.idFromOp(path, method, operation);
1392
      var operationObject = new Operation(self,
1393
        operation.scheme,
1394
        operationId,
1395
        method,
1396
        path,
1397
        operation,
1398
        self.definitions,
1399
        self.models,
1400
        self.clientAuthorizations);
1401
1402
      // bind self operation's execute command to the api
1403
      _.forEach(tags, function (tag) {
1404
        var clientProperty = _.indexOf(reservedClientTags, tag) > -1 ? '_' + tag : tag;
1405
        var apiProperty = _.indexOf(reservedApiTags, tag) > -1 ? '_' + tag : tag;
1406
        var operationGroup = self[clientProperty];
1407
1408
        if (clientProperty !== tag) {
1409
          helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient function/property name.  Use \'client.' +
1410
                      clientProperty + '\' or \'client.apis.' + tag + '\' instead of \'client.' + tag + '\'.');
1411
        }
1412
1413
        if (apiProperty !== tag) {
1414
          helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient operation function/property name.  Use ' +
1415
                      '\'client.apis.' + apiProperty + '\' instead of \'client.apis.' + tag + '\'.');
1416
        }
1417
1418
        if (_.indexOf(reservedApiTags, operationId) > -1) {
1419
          helpers.log('The \'' + operationId + '\' operationId conflicts with a SwaggerClient operation ' +
1420
                      'function/property name.  Use \'client.apis.' + apiProperty + '._' + operationId +
1421
                      '\' instead of \'client.apis.' + apiProperty + '.' + operationId + '\'.');
1422
1423
          operationId = '_' + operationId;
1424
          operationObject.nickname = operationId; // So 'client.apis.[tag].operationId.help() works properly
1425
        }
1426
1427
        if (_.isUndefined(operationGroup)) {
1428
          operationGroup = self[clientProperty] = self.apis[apiProperty] = {};
1429
1430
          operationGroup.operations = {};
1431
          operationGroup.label = apiProperty;
1432
          operationGroup.apis = {};
1433
1434
          var tagDef = definedTags[tag];
1435
1436
          if (!_.isUndefined(tagDef)) {
1437
            operationGroup.description = tagDef.description;
1438
            operationGroup.externalDocs = tagDef.externalDocs;
1439
          }
1440
1441
          self[clientProperty].help = _.bind(self.help, operationGroup);
1442
          self.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
1443
        }
1444
1445
        // Bind tag help
1446
        if (!_.isFunction(operationGroup.help)) {
1447
          operationGroup.help = _.bind(self.help, operationGroup);
1448
        }
1449
1450
        // bind to the apis object
1451
        self.apis[apiProperty][operationId] = operationGroup[operationId] = _.bind(operationObject.execute,
1452
                                                                                  operationObject);
1453
        self.apis[apiProperty][operationId].help = operationGroup[operationId].help = _.bind(operationObject.help,
1454
                                                                                             operationObject);
1455
        self.apis[apiProperty][operationId].asCurl = operationGroup[operationId].asCurl = _.bind(operationObject.asCurl,
1456
                                                                                                 operationObject);
1457
1458
        operationGroup.apis[operationId] = operationGroup.operations[operationId] = operationObject;
1459
1460
        // legacy UI feature
1461
        var api = _.find(self.apisArray, function (api) {
1462
          return api.tag === tag;
1463
        });
1464
1465
        if (api) {
1466
          api.operationsArray.push(operationObject);
1467
        }
1468
      });
1469
    });
1470
  });
1471
1472
  this.isBuilt = true;
1473
1474
  if (this.success) {
1475
    this.isValid = true;
1476
    this.isBuilt = true;
1477
    this.success();
1478
  }
1479
1480
  return this;
1481
};
1482
1483
SwaggerClient.prototype.parseUri = function (uri) {
1484
  var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
1485
  var parts = urlParseRE.exec(uri);
1486
1487
  return {
1488
    scheme: parts[4].replace(':',''),
1489
    host: parts[11],
1490
    port: parts[12],
1491
    path: parts[15]
1492
  };
1493
};
1494
1495
SwaggerClient.prototype.help = function (dontPrint) {
1496
  var output = '';
1497
1498
  if (this instanceof SwaggerClient) {
1499
    _.forEach(this.apis, function (api, name) {
1500
      if (_.isPlainObject(api)) {
1501
        output += 'operations for the \'' + name + '\' tag\n';
1502
1503
        _.forEach(api.operations, function (operation, name) {
1504
          output += '  * ' + name + ': ' + operation.summary + '\n';
1505
        });
1506
      }
1507
    });
1508
  } else if (this instanceof OperationGroup || _.isPlainObject(this)) {
1509
    output += 'operations for the \'' + this.label + '\' tag\n';
1510
1511
    _.forEach(this.apis, function (operation, name) {
1512
      output += '  * ' + name + ': ' + operation.summary + '\n';
1513
    });
1514
  }
1515
1516
  if (dontPrint) {
1517
    return output;
1518
  } else {
1519
    helpers.log(output);
1520
1521
    return output;
1522
  }
1523
};
1524
1525
SwaggerClient.prototype.tagFromLabel = function (label) {
1526
  return label;
1527
};
1528
1529
SwaggerClient.prototype.idFromOp = function (path, httpMethod, op) {
1530
  if(!op || !op.operationId) {
1531
    op = op || {};
1532
    op.operationId = httpMethod + '_' + path;
1533
  }
1534
  var opId = op.operationId.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_') || (path.substring(1) + '_' + httpMethod);
1535
1536
  opId = opId.replace(/((_){2,})/g, '_');
1537
  opId = opId.replace(/^(_)*/g, '');
1538
  opId = opId.replace(/([_])*$/g, '');
1539
  return opId;
1540
};
1541
1542
SwaggerClient.prototype.setHost = function (host) {
1543
  this.host = host;
1544
1545
  if(this.apis) {
1546
    _.forEach(this.apis, function(api) {
1547
      if(api.operations) {
1548
        _.forEach(api.operations, function(operation) {
1549
          operation.host = host;
1550
        });
1551
      }
1552
    });
1553
  }
1554
};
1555
1556
SwaggerClient.prototype.setBasePath = function (basePath) {
1557
  this.basePath = basePath;
1558
1559
  if(this.apis) {
1560
    _.forEach(this.apis, function(api) {
1561
      if(api.operations) {
1562
        _.forEach(api.operations, function(operation) {
1563
          operation.basePath = basePath;
1564
        });
1565
      }
1566
    });
1567
  }
1568
};
1569
1570
SwaggerClient.prototype.fail = function (message) {
1571
  this.failure(message);
1572
1573
  throw message;
1574
};
1575
},{"./auth":2,"./helpers":4,"./http":5,"./resolver":6,"./spec-converter":8,"./types/model":9,"./types/operation":10,"./types/operationGroup":11,"lodash-compat/array/indexOf":52,"lodash-compat/collection/find":56,"lodash-compat/collection/forEach":57,"lodash-compat/function/bind":61,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isFunction":145,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isUndefined":151}],4:[function(require,module,exports){
1576
(function (process){
1577
'use strict';
1578
1579
var _ = {
1580
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
1581
  indexOf: require('lodash-compat/array/indexOf')
1582
};
1583
1584
module.exports.__bind = function (fn, me) {
1585
  return function(){
1586
    return fn.apply(me, arguments);
1587
  };
1588
};
1589
1590
var log = module.exports.log = function() {
1591
  // Only log if available and we're not testing
1592
  if (console && process.env.NODE_ENV !== 'test') {
1593
    console.log(Array.prototype.slice.call(arguments)[0]);
1594
  }
1595
};
1596
1597
module.exports.fail = function (message) {
1598
  log(message);
1599
};
1600
1601
var optionHtml = module.exports.optionHtml = function (label, value) {
1602
  return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
1603
};
1604
1605
var resolveSchema = module.exports.resolveSchema = function (schema) {
1606
  if (_.isPlainObject(schema.schema)) {
1607
    schema = resolveSchema(schema.schema);
1608
  }
1609
1610
  return schema;
1611
};
1612
1613
var simpleRef = module.exports.simpleRef = function (name) {
1614
  if (typeof name === 'undefined') {
1615
    return null;
1616
  }
1617
1618
  if (name.indexOf('#/definitions/') === 0) {
1619
    return name.substring('#/definitions/'.length);
1620
  } else {
1621
    return name;
1622
  }
1623
};
1624
1625
1626
}).call(this,require('_process'))
1627
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9oZWxwZXJzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgXyA9IHtcbiAgaXNQbGFpbk9iamVjdDogcmVxdWlyZSgnbG9kYXNoLWNvbXBhdC9sYW5nL2lzUGxhaW5PYmplY3QnKSxcbiAgaW5kZXhPZjogcmVxdWlyZSgnbG9kYXNoLWNvbXBhdC9hcnJheS9pbmRleE9mJylcbn07XG5cbm1vZHVsZS5leHBvcnRzLl9fYmluZCA9IGZ1bmN0aW9uIChmbiwgbWUpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uKCl7XG4gICAgcmV0dXJuIGZuLmFwcGx5KG1lLCBhcmd1bWVudHMpO1xuICB9O1xufTtcblxudmFyIGxvZyA9IG1vZHVsZS5leHBvcnRzLmxvZyA9IGZ1bmN0aW9uKCkge1xuICAvLyBPbmx5IGxvZyBpZiBhdmFpbGFib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0dXJuIG5hbWU7XG4gIH1cbn07XG5cbiJdfQ==
1628
},{"_process":17,"lodash-compat/array/indexOf":52,"lodash-compat/lang/isPlainObject":148}],5:[function(require,module,exports){
1629
'use strict';
1630
1631
var helpers = require('./helpers');
1632
var jQuery = require('jquery');
1633
var request = require('superagent');
1634
var jsyaml = require('js-yaml');
1635
var _ = {
1636
  isObject: require('lodash-compat/lang/isObject')
1637
};
1638
1639
/*
1640
 * JQueryHttpClient is a light-weight, node or browser HTTP client
1641
 */
1642
var JQueryHttpClient = function () {};
1643
1644
/*
1645
 * SuperagentHttpClient is a light-weight, node or browser HTTP client
1646
 */
1647
var SuperagentHttpClient = function () {};
1648
1649
/**
1650
 * SwaggerHttp is a wrapper for executing requests
1651
 */
1652
var SwaggerHttp = module.exports = function () {};
1653
1654
SwaggerHttp.prototype.execute = function (obj, opts) {
1655
  var client;
1656
1657
  if(opts && opts.client) {
1658
    client = opts.client;
1659
  }
1660
  else {
1661
    client = new SuperagentHttpClient(opts);
1662
  }
1663
1664
  // legacy support
1665
  if ((obj && obj.useJQuery === true) || this.isInternetExplorer()) {
1666
    client = new JQueryHttpClient(opts);
1667
  }
1668
1669
  var success = obj.on.response;
1670
1671
  var responseInterceptor = function(data) {
1672
    if(opts && opts.responseInterceptor) {
1673
      data = opts.responseInterceptor.apply(data);
1674
    }
1675
    success(data);
1676
  };
1677
1678
  obj.on.response = function(data) {
1679
    responseInterceptor(data);
1680
  };
1681
1682
1683
  if (_.isObject(obj) && _.isObject(obj.body)) {
1684
    // special processing for file uploads via jquery
1685
    if (obj.body.type && obj.body.type === 'formData'){
1686
      obj.contentType = false;
1687
      obj.processData = false;
1688
1689
      delete obj.headers['Content-Type'];
1690
    } else {
1691
      obj.body = JSON.stringify(obj.body);
1692
    }
1693
  }
1694
  client.execute(obj);
1695
};
1696
1697
SwaggerHttp.prototype.isInternetExplorer = function () {
1698
  var detectedIE = false;
1699
1700
  if (typeof navigator !== 'undefined' && navigator.userAgent) {
1701
    var nav = navigator.userAgent.toLowerCase();
1702
1703
    if (nav.indexOf('msie') !== -1) {
1704
      var version = parseInt(nav.split('msie')[1]);
1705
1706
      if (version <= 8) {
1707
        detectedIE = true;
1708
      }
1709
    }
1710
  }
1711
1712
  return detectedIE;
1713
};
1714
1715
JQueryHttpClient.prototype.execute = function (obj) {
1716
  var cb = obj.on;
1717
  var request = obj;
1718
1719
  obj.type = obj.method;
1720
  obj.cache = false;
1721
  delete obj.useJQuery;
1722
1723
  /*
1724
  obj.beforeSend = function (xhr) {
1725
    var key, results;
1726
    if (obj.headers) {
1727
      results = [];
1728
      for (key in obj.headers) {
1729
        if (key.toLowerCase() === 'content-type') {
1730
          results.push(obj.contentType = obj.headers[key]);
1731
        } else if (key.toLowerCase() === 'accept') {
1732
          results.push(obj.accepts = obj.headers[key]);
1733
        } else {
1734
          results.push(xhr.setRequestHeader(key, obj.headers[key]));
1735
        }
1736
      }
1737
      return results;
1738
    }
1739
  };*/
1740
1741
  obj.data = obj.body;
1742
1743
  delete obj.body;
1744
1745
  obj.complete = function (response) {
1746
    var headers = {};
1747
    var headerArray = response.getAllResponseHeaders().split('\n');
1748
1749
    for (var i = 0; i < headerArray.length; i++) {
1750
      var toSplit = headerArray[i].trim();
1751
1752
      if (toSplit.length === 0) {
1753
        continue;
1754
      }
1755
1756
      var separator = toSplit.indexOf(':');
1757
1758
      if (separator === -1) {
1759
        // Name but no value in the header
1760
        headers[toSplit] = null;
1761
1762
        continue;
1763
      }
1764
1765
      var name = toSplit.substring(0, separator).trim();
1766
      var value = toSplit.substring(separator + 1).trim();
1767
1768
      headers[name] = value;
1769
    }
1770
1771
    var out = {
1772
      url: request.url,
1773
      method: request.method,
1774
      status: response.status,
1775
      statusText: response.statusText,
1776
      data: response.responseText,
1777
      headers: headers
1778
    };
1779
1780
    try {
1781
      var possibleObj =  response.responseJSON || jsyaml.safeLoad(response.responseText);
1782
      out.obj = (typeof possibleObj === 'string') ? {} : possibleObj;
1783
    } catch (ex) {
1784
      // do not set out.obj
1785
      helpers.log('unable to parse JSON/YAML content');
1786
    }
1787
1788
    // I can throw, or parse null?
1789
    out.obj = out.obj || null;
1790
1791
    if (response.status >= 200 && response.status < 300) {
1792
      cb.response(out);
1793
    } else if (response.status === 0 || (response.status >= 400 && response.status < 599)) {
1794
      cb.error(out);
1795
    } else {
1796
      return cb.response(out);
1797
    }
1798
  };
1799
1800
  jQuery.support.cors = true;
1801
1802
  return jQuery.ajax(obj);
1803
};
1804
1805
SuperagentHttpClient.prototype.execute = function (obj) {
1806
  var method = obj.method.toLowerCase();
1807
1808
  if (method === 'delete') {
1809
    method = 'del';
1810
  }
1811
  var headers = obj.headers || {};
1812
  var r = request[method](obj.url);
1813
  var name;
1814
  for (name in headers) {
1815
    r.set(name, headers[name]);
1816
  }
1817
1818
  if (obj.body) {
1819
    r.send(obj.body);
1820
  }
1821
1822
  if(typeof r.buffer === 'function') {
1823
    r.buffer(); // force superagent to populate res.text with the raw response data
1824
  }
1825
1826
  r.end(function (err, res) {
1827
    res = res || {
1828
      status: 0,
1829
      headers: {error: 'no response from server'}
1830
    };
1831
    var response = {
1832
      url: obj.url,
1833
      method: obj.method,
1834
      headers: res.headers
1835
    };
1836
    var cb;
1837
1838
    if (!err && res.error) {
1839
      err = res.error;
1840
    }
1841
1842
    if (err && obj.on && obj.on.error) {
1843
      response.obj = err;
1844
      response.status = res ? res.status : 500;
1845
      response.statusText = res ? res.text : err.message;
1846
      cb = obj.on.error;
1847
    } else if (res && obj.on && obj.on.response) {
1848
      var possibleObj;
1849
1850
      // Already parsed by by superagent?
1851
      if(res.body && Object.keys(res.body).length > 0) {
1852
        possibleObj = res.body;
1853
      } else {
1854
          try {
1855
            possibleObj = jsyaml.safeLoad(res.text);
1856
            // can parse into a string... which we don't need running around in the system
1857
            possibleObj = (typeof possibleObj === 'string') ? null : possibleObj;
1858
          } catch(e) {
1859
            helpers.log('cannot parse JSON/YAML content');
1860
          }
1861
      }
1862
1863
      // null means we can't parse into object
1864
      response.obj = possibleObj || null;
1865
1866
      response.status = res.status;
1867
      response.statusText = res.text;
1868
      cb = obj.on.response;
1869
    }
1870
    response.data = response.statusText;
1871
1872
    if (cb) {
1873
      cb(response);
1874
    }
1875
  });
1876
};
1877
1878
},{"./helpers":4,"jquery":20,"js-yaml":21,"lodash-compat/lang/isObject":147,"superagent":160}],6:[function(require,module,exports){
1879
'use strict';
1880
1881
var SwaggerHttp = require('./http');
1882
var _ = {
1883
  isObject: require('lodash-compat/lang/isObject'),
1884
  isArray: require('lodash-compat/lang/isArray')
1885
};
1886
1887
1888
/**
1889
 * Resolves a spec's remote references
1890
 */
1891
var Resolver = module.exports = function () {};
1892
1893
Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
1894
  var root = arg1, callback = arg2, scope = arg3, location, i;
1895
  if(typeof arg1 === 'function') {
1896
    root = null;
1897
    callback = arg1;
1898
    scope = arg2;
1899
  }
1900
  var _root = root;
1901
  this.scope = (scope || this);
1902
  this.iteration = this.iteration || 0;
1903
1904
  var name, path, property, propertyName;
1905
  var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {};
1906
  var resolutionTable = []; // store objects for dereferencing
1907
1908
  // definitions
1909
  for (name in spec.definitions) {
1910
    var definition = spec.definitions[name];
1911
    for (propertyName in definition.properties) {
1912
      property = definition.properties[propertyName];
1913
      this.resolveTo(root, property, resolutionTable, '/definitions');
1914
    }
1915
1916
    if(definition.allOf) {
1917
      definition['x-resolved-from'] = [ '#/definitions/' + name ];
1918
      var allOf = definition.allOf;
1919
      // the refs go first
1920
      allOf.sort(function(a, b) {
1921
        if(a.$ref && b.$ref) { return 0; }
1922
        else if(a.$ref) { return -1; }
1923
        else { return 1; }
1924
      });
1925
      for (i = 0; i < allOf.length; i++) {
1926
        property = allOf[i];
1927
        location = '/definitions/' + name + '/allOf';
1928
        this.resolveInline(null, spec, property, resolutionTable, unresolvedRefs, location);
1929
      }
1930
    }
1931
  }
1932
1933
  // operations
1934
  for (name in spec.paths) {
1935
    var method, operation, responseCode;
1936
    path = spec.paths[name];
1937
1938
    for (method in path) {
1939
      // operation reference
1940
      if(method === '$ref') {
1941
        // location = path[method];
1942
        location = '/paths' + name;
1943
        this.resolveInline(root, spec, path, resolutionTable, unresolvedRefs, location);
1944
      }
1945
      else {
1946
        operation = path[method];
1947
1948
        var parameters = operation.parameters;
1949
        for (i in parameters) {
1950
          var parameter = parameters[i];
1951
          location = '/paths' + name + '/' + method + '/parameters';
1952
1953
          if (parameter.in === 'body' && parameter.schema) {
1954
            this.resolveTo(root, parameter.schema, resolutionTable, location);
1955
          }
1956
1957
          if (parameter.$ref) {
1958
            // parameter reference
1959
            this.resolveInline(root, spec, parameter, resolutionTable, unresolvedRefs, parameter.$ref);
1960
          }
1961
        }
1962
1963
        for (responseCode in operation.responses) {
1964
          var response = operation.responses[responseCode];
1965
          location = '/paths' + name + '/' + method + '/responses/' + responseCode;
1966
1967
          if(_.isObject(response)) {
1968
            if(response.$ref) {
1969
              // response reference
1970
              this.resolveInline(root, spec, response, resolutionTable, unresolvedRefs, location);
1971
            }
1972
            if (response.schema) {
1973
              this.resolveTo(root, response.schema, resolutionTable, location);
1974
            }
1975
          }
1976
        }
1977
      }
1978
    }
1979
  }
1980
1981
  var expectedCalls = 0, toResolve = [];
1982
  // if the root is same as obj[i].root we can resolve locally
1983
  var all = resolutionTable;
1984
1985
  for(i = 0; i < all.length; i++) {
1986
    var a = all[i];
1987
    if(root === a.root) {
1988
      if(a.resolveAs === 'ref') {
1989
        // resolve any path walking
1990
        var joined = ((a.root || '') + '/' + a.key).split('/');
1991
        var normalized = [];
1992
        var url = '';
1993
        var k;
1994
1995
        if(a.key.indexOf('../') >= 0) {
1996
          for(var j = 0; j < joined.length; j++) {
1997
            if(joined[j] === '..') {
1998
              normalized = normalized.slice(0, normalized.length-1);
1999
            }
2000
            else {
2001
              normalized.push(joined[j]);
2002
            }
2003
          }
2004
          for(k = 0; k < normalized.length; k ++) {
2005
            if(k > 0) {
2006
              url += '/';
2007
            }
2008
            url += normalized[k];
2009
          }
2010
          // we now have to remote resolve this because the path has changed
2011
          a.root = url;
2012
          toResolve.push(a);
2013
        }
2014
        else {
2015
          var parts = a.key.split('#');
2016
          if(parts.length === 2) {
2017
            if(parts[0].indexOf('http://') === 0 || parts[0].indexOf('https://') === 0) {
2018
              a.root = parts[0];
2019
            }
2020
            location = parts[1].split('/');
2021
            var r;
2022
            var s = spec;
2023
            for(k = 0; k < location.length; k++) {
2024
              var part = location[k];
2025
              if(part !== '') {
2026
                s = s[part];
2027
                if(typeof s !== 'undefined') {
2028
                  r = s;
2029
                }
2030
                else {
2031
                  r = null;
2032
                  break;
2033
                }
2034
              }
2035
            }
2036
            if(r === null) {
2037
              // must resolve this too
2038
              toResolve.push(a);
2039
            }
2040
          }
2041
        }
2042
      }
2043
      else {
2044
        if (a.resolveAs === 'inline') {
2045
          toResolve.push(a);
2046
        }
2047
      }
2048
    }
2049
    else {
2050
      toResolve.push(a);
2051
    }
2052
  }
2053
  expectedCalls = toResolve.length;
2054
2055
  // resolve anything that is local
2056
  for(var ii = 0; ii < toResolve.length; ii++) {
2057
    (function(item, self) {
2058
      if(item.root === null) {
2059
        // local resolve
2060
        self.resolveItem(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, item);
2061
        processedCalls += 1;
2062
2063
        if(processedCalls === expectedCalls) {
2064
          self.finish(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2065
        }
2066
      }
2067
      else {
2068
        var obj = {
2069
          useJQuery: false,  // TODO
2070
          url: item.root,
2071
          method: 'get',
2072
          headers: {
2073
            accept: self.scope.swaggerRequestHeaders || 'application/json'
2074
          },
2075
          on: {
2076
            error: function () {
2077
              processedCalls += 1;
2078
              unresolvedRefs[item.key] = null;
2079
2080
              if (processedCalls === expectedCalls) {
2081
                self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2082
              }
2083
            },  // jshint ignore:line
2084
            response: function (response) {
2085
              var swagger = response.obj;
2086
              self.resolveItem(swagger, _root, resolutionTable, resolvedRefs, unresolvedRefs, item);
2087
              processedCalls += 1;
2088
2089
              if (processedCalls === expectedCalls) {
2090
                self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2091
              }
2092
            }
2093
          } // jshint ignore:line
2094
        };
2095
2096
        if (scope && scope.clientAuthorizations) {
2097
          scope.clientAuthorizations.apply(obj);
2098
        }
2099
        new SwaggerHttp().execute(obj);
2100
      }
2101
    }(toResolve[ii], this));
2102
  }
2103
2104
  if (Object.keys(toResolve).length === 0) {
2105
    this.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2106
  }
2107
};
2108
2109
Resolver.prototype.resolveItem = function(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, item) {
2110
  var path = item.location;
2111
  var location = spec, parts = path.split('/');
2112
  for (var j = 0; j < parts.length; j++) {
2113
    var segment = parts[j];
2114
    if(segment.indexOf('~1') !== -1) {
2115
      segment = parts[j].replace(/~0/g, '~').replace(/~1/g, '/');
2116
      if(segment.charAt(0) !== '/') {
2117
        segment = '/' + segment;
2118
      }
2119
    }
2120
    if (typeof location === 'undefined' || location === null) {
2121
      break;
2122
    }
2123
    if(segment === '' && j === (parts.length - 1)  && parts.length > 1) {
2124
      location = null;
2125
      break;
2126
    }
2127
    if (segment.length > 0) {
2128
      location = location[segment];
2129
    }
2130
  }
2131
  var resolved = item.key;
2132
  parts = item.key.split('/');
2133
  var resolvedName = parts[parts.length-1];
2134
2135
  if(resolvedName.indexOf('#') >= 0) {
2136
    resolvedName = resolvedName.split('#')[1];
2137
  }
2138
2139
  if (location !== null && typeof location !== 'undefined') {
2140
    resolvedRefs[resolved] = {
2141
      name: resolvedName,
2142
      obj: location,
2143
      key: item.key,
2144
      root: item.root
2145
    };
2146
  } else {
2147
    unresolvedRefs[resolved] = {
2148
      root: item.root,
2149
      location: item.location
2150
    };
2151
  }
2152
};
2153
2154
Resolver.prototype.finish = function (spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback) {
2155
  // walk resolution table and replace with resolved refs
2156
  var ref;
2157
  for (ref in resolutionTable) {
2158
    var item = resolutionTable[ref];
2159
2160
    var key = item.key;
2161
    var resolvedTo = resolvedRefs[key];
2162
    if (resolvedTo) {
2163
      spec.definitions = spec.definitions || {};
2164
      if (item.resolveAs === 'ref') {
2165
        spec.definitions[resolvedTo.name] = resolvedTo.obj;
2166
        item.obj.$ref = '#/definitions/' + resolvedTo.name;
2167
      } else if (item.resolveAs === 'inline') {
2168
        var targetObj = item.obj;
2169
        targetObj['x-resolved-from'] = [ item.key ];
2170
        delete targetObj.$ref;
2171
2172
        for (key in resolvedTo.obj) {
2173
          var abs = this.retainRoot(resolvedTo.obj[key], item.root);
2174
          targetObj[key] = abs;
2175
        }
2176
      }
2177
    }
2178
  }
2179
  var existingUnresolved = this.countUnresolvedRefs(spec);
2180
2181
  if(existingUnresolved.length === 0 || this.iteration > 5) {
2182
    this.resolveAllOf(spec.definitions);
2183
    callback.call(this.scope, spec, unresolvedRefs);
2184
  }
2185
  else {
2186
    this.iteration += 1;
2187
    this.resolve(spec, root, callback, this.scope);
2188
  }
2189
};
2190
2191
Resolver.prototype.countUnresolvedRefs = function(spec) {
2192
  var i;
2193
  var refs = this.getRefs(spec);
2194
  var keys = [];
2195
  var unresolvedKeys = [];
2196
  for(i in refs) {
2197
    if(i.indexOf('#') === 0) {
2198
      keys.push(i.substring(1));
2199
    }
2200
    else {
2201
      unresolvedKeys.push(i);
2202
    }
2203
  }
2204
2205
  // verify possible keys
2206
  for (i = 0; i < keys.length; i++) {
2207
    var part = keys[i];
2208
    var parts = part.split('/');
2209
    var obj = spec;
2210
2211
    for (var k = 0; k < parts.length; k++) {
2212
      var key = parts[k];
2213
      if(key !== '') {
2214
        obj = obj[key];
2215
        if(typeof obj === 'undefined') {
2216
          unresolvedKeys.push(part);
2217
          break;
2218
        }
2219
      }
2220
    }
2221
  }
2222
  return unresolvedKeys.length;
2223
};
2224
2225
Resolver.prototype.getRefs = function(spec, obj) {
2226
  obj = obj || spec;
2227
  var output = {};
2228
  for(var key in obj) {
2229
    var item = obj[key];
2230
    if(key === '$ref' && typeof item === 'string') {
2231
      output[item] = null;
2232
    }
2233
    else if(_.isObject(item)) {
2234
      var o = this.getRefs(item);
2235
      for(var k in o) {
2236
        output[k] = null;
2237
      }
2238
    }
2239
  }
2240
  return output;
2241
};
2242
2243
Resolver.prototype.retainRoot = function(obj, root) {
2244
  // walk object and look for relative $refs
2245
  for(var key in obj) {
2246
    var item = obj[key];
2247
    if(key === '$ref' && typeof item === 'string') {
2248
      // stop and inspect
2249
      if(item.indexOf('http://') !== 0 && item.indexOf('https://') !== 0) {
2250
        if(item.indexOf('#') !== 0) {
2251
          item = '#' + item;
2252
        }
2253
        item = (root || '') + item;
2254
        obj[key] = item;
2255
      }
2256
    }
2257
    else if(_.isObject(item)) {
2258
      this.retainRoot(item, root);
2259
    }
2260
  }
2261
  return obj;
2262
};
2263
2264
/**
2265
 * immediately in-lines local refs, queues remote refs
2266
 * for inline resolution
2267
 */
2268
Resolver.prototype.resolveInline = function (root, spec, property, resolutionTable, unresolvedRefs, location) {
2269
  var key = property.$ref, ref = property.$ref, i, p, p2, rs;
2270
  var rootTrimmed = false;
2271
  if (ref) {
2272
    if(ref.indexOf('../') === 0) {
2273
      // reset root
2274
      p = ref.split('../');
2275
      p2 = root.split('/');
2276
      ref = '';
2277
      for(i = 0; i < p.length; i++) {
2278
        if(p[i] === '') {
2279
          p2 = p2.slice(0, p2.length-1);
2280
        }
2281
        else {
2282
          ref += p[i];
2283
        }
2284
      }
2285
      root = '';
2286
      for(i = 0; i < p2.length - 1; i++) {
2287
        if(i > 0) { root += '/'; }
2288
        root += p2[i];
2289
      }
2290
      rootTrimmed = true;
2291
    }
2292
    if(ref.indexOf('#') >= 0) {
2293
      if(ref.indexOf('/') === 0) {
2294
        rs = ref.split('#');
2295
        p  = root.split('//');
2296
        p2 = p[1].split('/');
2297
        root = p[0] + '//' + p2[0] + rs[0];
2298
        location = rs[1];
2299
      }
2300
      else {
2301
        rs = ref.split('#');
2302
        if(rs[0] !== '') {
2303
          p2 = root.split('/');
2304
          p2 = p2.slice(0, p2.length - 1);
2305
          if(!rootTrimmed) {
2306
            root = '';
2307
            for (var k = 0; k < p2.length; k++) {
2308
              if(k > 0) { root += '/'; }
2309
              root += p2[k];
2310
            }
2311
          }
2312
          root += '/' + ref.split('#')[0];
2313
        }
2314
        location = rs[1];
2315
      }
2316
    }
2317
    if (ref.indexOf('http') === 0) {
2318
      if(ref.indexOf('#') >= 0) {
2319
        root = ref.split('#')[0];
2320
        location = ref.split('#')[1];
2321
      }
2322
      else {
2323
        root = ref;
2324
        location = '';
2325
      }
2326
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2327
    } else if (ref.indexOf('#') === 0) {
2328
      location = ref.split('#')[1];
2329
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2330
    }
2331
    else {
2332
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2333
    }
2334
  } else if (property.type === 'array') {
2335
    this.resolveTo(root, property.items, resolutionTable, location);
2336
  }
2337
};
2338
2339
Resolver.prototype.resolveTo = function (root, property, resolutionTable, location) {
2340
  var ref = property.$ref;
2341
2342
  if (ref) {
2343
    if(ref.indexOf('#') >= 0) {
2344
      location = ref.split('#')[1];
2345
    }
2346
    resolutionTable.push({
2347
      obj: property, resolveAs: 'ref', root: root, key: ref, location: location
2348
    });
2349
  } else if (property.type === 'array') {
2350
    var items = property.items;
2351
    this.resolveTo(root, items, resolutionTable, location);
2352
  }
2353
};
2354
2355
Resolver.prototype.resolveAllOf = function(spec, obj, depth) {
2356
  depth = depth || 0;
2357
  obj = obj || spec;
2358
  var name;
2359
  for(var key in obj) {
2360
    var item = obj[key];
2361
    if(item === null) {
2362
      throw new TypeError("Swagger 2.0 does not support null types (" + obj + ").  See https://github.com/swagger-api/swagger-spec/issues/229.")
2363
    }
2364
    if(typeof item === 'object') {
2365
      this.resolveAllOf(spec, item, depth + 1);
2366
    }
2367
    if(item && typeof item.allOf !== 'undefined') {
2368
      var allOf = item.allOf;
2369
      if(_.isArray(allOf)) {
2370
        var output = {};
2371
        output['x-composed'] = true;
2372
        if (typeof item['x-resolved-from'] !== 'undefined') {
2373
          output['x-resolved-from'] = item['x-resolved-from'];
2374
        }
2375
        output.properties = {};
2376
        for(var i = 0; i < allOf.length; i++) {
2377
          var component = allOf[i];
2378
          var source = 'self';
2379
          if(typeof component['x-resolved-from'] !== 'undefined') {
2380
            source = component['x-resolved-from'][0];
2381
          }
2382
2383
          for(var part in component) {
2384
            if(!output.hasOwnProperty(part)) {
2385
              output[part] = JSON.parse(JSON.stringify(component[part]));
2386
              if(part === 'properties') {
2387
                for(name in output[part]) {
2388
                  output[part][name]['x-resolved-from'] = source;
2389
                }
2390
              }
2391
            }
2392
            else {
2393
              if(part === 'properties') {
2394
                var properties = component[part];
2395
                for(name in properties) {
2396
                  output.properties[name] = JSON.parse(JSON.stringify(properties[name]));
2397
                  var resolvedFrom = properties[name]['x-resolved-from'];
2398
                  if (typeof resolvedFrom === 'undefined' || resolvedFrom === 'self') {
2399
                    resolvedFrom = source;
2400
                  }
2401
                  output.properties[name]['x-resolved-from'] = resolvedFrom;
2402
                }
2403
              }
2404
              else if(part === 'required') {
2405
                // merge & dedup the required array
2406
                var a = output.required.concat(component[part]);
2407
                for(var k = 0; k < a.length; ++k) {
2408
                  for(var j = k + 1; j < a.length; ++j) {
2409
                    if(a[k] === a[j]) { a.splice(j--, 1); }
2410
                  }
2411
                }
2412
                output.required = a;
2413
              }
2414
              else if(part === 'x-resolved-from') {
2415
                output['x-resolved-from'].push(source);
2416
              }
2417
              else {
2418
                // TODO: need to merge this property
2419
                // console.log('what to do with ' + part)
2420
              }
2421
            }
2422
          }
2423
        }
2424
        obj[key] = output;
2425
      }
2426
    }
2427
    if(_.isObject(item)) {
2428
      this.resolveAllOf(spec, item, depth + 1);
2429
    }
2430
  }
2431
};
2432
2433
},{"./http":5,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isObject":147}],7:[function(require,module,exports){
2434
'use strict';
2435
2436
var Helpers = require('./helpers');
2437
2438
var _ = {
2439
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
2440
  isUndefined: require('lodash-compat/lang/isUndefined'),
2441
  isArray: require('lodash-compat/lang/isArray'),
2442
  isObject: require('lodash-compat/lang/isObject'),
2443
  isEmpty: require('lodash-compat/lang/isEmpty'),
2444
  map: require('lodash-compat/collection/map'),
2445
  indexOf: require('lodash-compat/array/indexOf'),
2446
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
2447
  keys: require('lodash-compat/object/keys'),
2448
  forEach: require('lodash-compat/collection/forEach')
2449
};
2450
2451
module.exports.optionHtml = optionHtml;
2452
module.exports.typeFromJsonSchema = typeFromJsonSchema;
2453
module.exports.getStringSignature = getStringSignature;
2454
module.exports.schemaToHTML = schemaToHTML;
2455
module.exports.schemaToJSON = schemaToJSON;
2456
2457
function optionHtml(label, value) {
2458
  return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
2459
};
2460
2461
function typeFromJsonSchema(type, format) {
2462
  var str;
2463
2464
  if (type === 'integer' && format === 'int32') {
2465
    str = 'integer';
2466
  } else if (type === 'integer' && format === 'int64') {
2467
    str = 'long';
2468
  } else if (type === 'integer' && typeof format === 'undefined') {
2469
    str = 'long';
2470
  } else if (type === 'string' && format === 'date-time') {
2471
    str = 'date-time';
2472
  } else if (type === 'string' && format === 'date') {
2473
    str = 'date';
2474
  } else if (type === 'number' && format === 'float') {
2475
    str = 'float';
2476
  } else if (type === 'number' && format === 'double') {
2477
    str = 'double';
2478
  } else if (type === 'number' && typeof format === 'undefined') {
2479
    str = 'double';
2480
  } else if (type === 'boolean') {
2481
    str = 'boolean';
2482
  } else if (type === 'string') {
2483
    str = 'string';
2484
  }
2485
2486
  return str;
2487
};
2488
2489
function getStringSignature(obj, baseComponent) {
2490
  var str = '';
2491
2492
  if (typeof obj.$ref !== 'undefined') {
2493
    str += Helpers.simpleRef(obj.$ref);
2494
  } else if (typeof obj.type === 'undefined') {
2495
    str += 'object';
2496
  } else if (obj.type === 'array') {
2497
    if (baseComponent) {
2498
      str += getStringSignature((obj.items || obj.$ref || {}));
2499
    } else {
2500
      str += 'Array[';
2501
      str += getStringSignature((obj.items || obj.$ref || {}));
2502
      str += ']';
2503
    }
2504
  } else if (obj.type === 'integer' && obj.format === 'int32') {
2505
    str += 'integer';
2506
  } else if (obj.type === 'integer' && obj.format === 'int64') {
2507
    str += 'long';
2508
  } else if (obj.type === 'integer' && typeof obj.format === 'undefined') {
2509
    str += 'long';
2510
  } else if (obj.type === 'string' && obj.format === 'date-time') {
2511
    str += 'date-time';
2512
  } else if (obj.type === 'string' && obj.format === 'date') {
2513
    str += 'date';
2514
  } else if (obj.type === 'string' && typeof obj.format === 'undefined') {
2515
    str += 'string';
2516
  } else if (obj.type === 'number' && obj.format === 'float') {
2517
    str += 'float';
2518
  } else if (obj.type === 'number' && obj.format === 'double') {
2519
    str += 'double';
2520
  } else if (obj.type === 'number' && typeof obj.format === 'undefined') {
2521
    str += 'double';
2522
  } else if (obj.type === 'boolean') {
2523
    str += 'boolean';
2524
  } else if (obj.$ref) {
2525
    str += Helpers.simpleRef(obj.$ref);
2526
  } else {
2527
    str += obj.type;
2528
  }
2529
2530
  return str;
2531
};
2532
2533
function schemaToJSON(schema, models, modelsToIgnore, modelPropertyMacro) {
2534
  // Resolve the schema (Handle nested schemas)
2535
  schema = Helpers.resolveSchema(schema);
2536
2537
  if(typeof modelPropertyMacro !== 'function') {
2538
    modelPropertyMacro = function(prop){
2539
      return (prop || {}).default;
2540
    }
2541
  }
2542
2543
  modelsToIgnore= modelsToIgnore || {};
2544
2545
  var type = schema.type || 'object';
2546
  var format = schema.format;
2547
  var model;
2548
  var output;
2549
2550
  if (schema.example) {
2551
    output = schema.example;
2552
  } else if (_.isUndefined(schema.items) && _.isArray(schema.enum)) {
2553
    output = schema.enum[0];
2554
  }
2555
2556
  if (_.isUndefined(output)) {
2557
    if (schema.$ref) {
2558
      model = models[Helpers.simpleRef(schema.$ref)];
2559
2560
      if (!_.isUndefined(model)) {
2561
        if (_.isUndefined(modelsToIgnore[model.name])) {
2562
          modelsToIgnore[model.name] = model;
2563
          output = schemaToJSON(model.definition, models, modelsToIgnore, modelPropertyMacro);
2564
          delete modelsToIgnore[model.name];
2565
        } else {
2566
          if (model.type === 'array') {
2567
            output = [];
2568
          } else {
2569
            output = {};
2570
          }
2571
        }
2572
      }
2573
    } else if (!_.isUndefined(schema.default)) {
2574
      output = schema.default;
2575
    } else if (type === 'string') {
2576
      if (format === 'date-time') {
2577
        output = new Date().toISOString();
2578
      } else if (format === 'date') {
2579
        output = new Date().toISOString().split('T')[0];
2580
      } else {
2581
        output = 'string';
2582
      }
2583
    } else if (type === 'integer') {
2584
      output = 0;
2585
    } else if (type === 'number') {
2586
      output = 0.0;
2587
    } else if (type === 'boolean') {
2588
      output = true;
2589
    } else if (type === 'object') {
2590
      output = {};
2591
2592
      _.forEach(schema.properties, function (property, name) {
2593
        var cProperty = _.cloneDeep(property);
2594
2595
        // Allow macro to set the default value
2596
        cProperty.default = modelPropertyMacro(property);
2597
2598
        output[name] = schemaToJSON(cProperty, models, modelsToIgnore, modelPropertyMacro);
2599
      });
2600
    } else if (type === 'array') {
2601
      output = [];
2602
2603
      if (_.isArray(schema.items)) {
2604
        _.forEach(schema.items, function (item) {
2605
          output.push(schemaToJSON(item, models, modelsToIgnore, modelPropertyMacro));
2606
        });
2607
      } else if (_.isPlainObject(schema.items)) {
2608
        output.push(schemaToJSON(schema.items, models, modelsToIgnore, modelPropertyMacro));
2609
      } else if (_.isUndefined(schema.items)) {
2610
        output.push({});
2611
      } else {
2612
        Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
2613
      }
2614
    }
2615
  }
2616
2617
  return output;
2618
};
2619
2620
function schemaToHTML(name, schema, models, modelPropertyMacro) {
2621
2622
  var strongOpen = '<span class="strong">';
2623
  var strongClose = '</span>';
2624
2625
  // Allow for ignoring the 'name' argument.... shifting the rest
2626
  if(_.isObject(arguments[0])) {
2627
    name = void 0;
2628
    schema = arguments[0];
2629
    models = arguments[1];
2630
    modelPropertyMacro = arguments[2];
2631
  }
2632
2633
  models = models || {};
2634
2635
  // Resolve the schema (Handle nested schemas)
2636
  schema = Helpers.resolveSchema(schema);
2637
2638
  // Return for empty object
2639
  if(_.isEmpty(schema)) {
2640
    return strongOpen + 'Empty' + strongClose;
2641
  }
2642
2643
  // Dereference $ref from 'models'
2644
  if(typeof schema.$ref === 'string') {
2645
    name = Helpers.simpleRef(schema.$ref);
2646
    schema = models[name];
2647
  }
2648
2649
  if(typeof name !== 'string') {
2650
    name = schema.title || 'Inline Model';
2651
  }
2652
2653
  // If we are a Model object... adjust accordingly
2654
  if(schema.definition) {
2655
    schema = schema.definition;
2656
  }
2657
2658
  if(typeof modelPropertyMacro !== 'function') {
2659
    modelPropertyMacro = function(prop){
2660
      return (prop || {}).default;
2661
    }
2662
  }
2663
2664
  var references = {};
2665
  var seenModels = [];
2666
  var inlineModels = 0;
2667
2668
2669
2670
  // Generate current HTML
2671
  var html = processModel(schema, name);
2672
2673
  // Generate references HTML
2674
  while (_.keys(references).length > 0) {
2675
    /* jshint ignore:start */
2676
    _.forEach(references, function (schema, name) {
2677
      var seenModel = _.indexOf(seenModels, name) > -1;
2678
2679
      delete references[name];
2680
2681
      if (!seenModel) {
2682
        seenModels.push(name);
2683
2684
        html += '<br />' + processModel(schema, name);
2685
      }
2686
    });
2687
    /* jshint ignore:end */
2688
  }
2689
2690
  return html;
2691
2692
  /////////////////////////////////
2693
2694
  function addReference(schema, name, skipRef) {
2695
    var modelName = name;
2696
    var model;
2697
2698
    if (schema.$ref) {
2699
      modelName = schema.title || Helpers.simpleRef(schema.$ref);
2700
      model = models[modelName];
2701
    } else if (_.isUndefined(name)) {
2702
      modelName = schema.title || 'Inline Model ' + (++inlineModels);
2703
      model = {definition: schema};
2704
    }
2705
2706
    if (skipRef !== true) {
2707
      references[modelName] = _.isUndefined(model) ? {} : model.definition;
2708
    }
2709
2710
    return modelName;
2711
  };
2712
2713
  function primitiveToHTML(schema) {
2714
    var html = '<span class="propType">';
2715
    var type = schema.type || 'object';
2716
2717
    if (schema.$ref) {
2718
      html += addReference(schema, Helpers.simpleRef(schema.$ref));
2719
    } else if (type === 'object') {
2720
      if (!_.isUndefined(schema.properties)) {
2721
        html += addReference(schema);
2722
      } else {
2723
        html += 'object';
2724
      }
2725
    } else if (type === 'array') {
2726
      html += 'Array[';
2727
2728
      if (_.isArray(schema.items)) {
2729
        html += _.map(schema.items, addReference).join(',');
2730
      } else if (_.isPlainObject(schema.items)) {
2731
        if (_.isUndefined(schema.items.$ref)) {
2732
          if (!_.isUndefined(schema.items.type) && _.indexOf(['array', 'object'], schema.items.type) === -1) {
2733
            html += schema.items.type;
2734
          } else {
2735
            html += addReference(schema.items);
2736
          }
2737
        } else {
2738
          html += addReference(schema.items, Helpers.simpleRef(schema.items.$ref));
2739
        }
2740
      } else {
2741
        Helpers.log('Array type\'s \'items\' schema is not an array or an object, cannot process');
2742
        html += 'object';
2743
      }
2744
2745
      html += ']';
2746
    } else {
2747
      html += schema.type;
2748
    }
2749
2750
    html += '</span>';
2751
2752
    return html;
2753
  };
2754
  function primitiveToOptionsHTML(schema, html) {
2755
    var options = '';
2756
    var type = schema.type || 'object';
2757
    var isArray = type === 'array';
2758
2759
    if (isArray) {
2760
      if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) {
2761
        type = schema.items.type;
2762
      } else {
2763
        type = 'object';
2764
      }
2765
    }
2766
2767
    if (!_.isUndefined(schema.default)) {
2768
      options += optionHtml('Default', schema.default);
2769
    }
2770
2771
    switch (type) {
2772
    case 'string':
2773
      if (schema.minLength) {
2774
        options += optionHtml('Min. Length', schema.minLength);
2775
      }
2776
2777
      if (schema.maxLength) {
2778
        options += optionHtml('Max. Length', schema.maxLength);
2779
      }
2780
2781
      if (schema.pattern) {
2782
        options += optionHtml('Reg. Exp.', schema.pattern);
2783
      }
2784
      break;
2785
    case 'integer':
2786
    case 'number':
2787
      if (schema.minimum) {
2788
        options += optionHtml('Min. Value', schema.minimum);
2789
      }
2790
2791
      if (schema.exclusiveMinimum) {
2792
        options += optionHtml('Exclusive Min.', 'true');
2793
      }
2794
2795
      if (schema.maximum) {
2796
        options += optionHtml('Max. Value', schema.maximum);
2797
      }
2798
2799
      if (schema.exclusiveMaximum) {
2800
        options += optionHtml('Exclusive Max.', 'true');
2801
      }
2802
2803
      if (schema.multipleOf) {
2804
        options += optionHtml('Multiple Of', schema.multipleOf);
2805
      }
2806
2807
      break;
2808
    }
2809
2810
    if (isArray) {
2811
      if (schema.minItems) {
2812
        options += optionHtml('Min. Items', schema.minItems);
2813
      }
2814
2815
      if (schema.maxItems) {
2816
        options += optionHtml('Max. Items', schema.maxItems);
2817
      }
2818
2819
      if (schema.uniqueItems) {
2820
        options += optionHtml('Unique Items', 'true');
2821
      }
2822
2823
      if (schema.collectionFormat) {
2824
        options += optionHtml('Coll. Format', schema.collectionFormat);
2825
      }
2826
    }
2827
2828
    if (_.isUndefined(schema.items)) {
2829
      if (_.isArray(schema.enum)) {
2830
        var enumString;
2831
2832
        if (type === 'number' || type === 'integer') {
2833
          enumString = schema.enum.join(', ');
2834
        } else {
2835
          enumString = '"' + schema.enum.join('", "') + '"';
2836
        }
2837
2838
        options += optionHtml('Enum', enumString);
2839
      }
2840
    }
2841
2842
    if (options.length > 0) {
2843
      html = '<span class="propWrap">' + html + '<table class="optionsWrapper"><tr><th colspan="2">' + type + '</th></tr>' + options + '</table></span>';
2844
    }
2845
2846
    return html;
2847
  };
2848
  function processModel(schema, name) {
2849
    var type = schema.type || 'object';
2850
    var isArray = schema.type === 'array';
2851
    var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose;
2852
2853
    if (name) {
2854
      seenModels.push(name);
2855
    }
2856
2857
    if (isArray) {
2858
      if (_.isArray(schema.items)) {
2859
        html += '<div>' + _.map(schema.items, function (item) {
2860
          var type = item.type || 'object';
2861
2862
          if (_.isUndefined(item.$ref)) {
2863
            if (_.indexOf(['array', 'object'], type) > -1) {
2864
              if (type === 'object' && _.isUndefined(item.properties)) {
2865
                return 'object';
2866
              } else {
2867
                return addReference(item);
2868
              }
2869
            } else {
2870
              return primitiveToOptionsHTML(item, type);
2871
            }
2872
          } else {
2873
            return addReference(item, Helpers.simpleRef(item.$ref));
2874
          }
2875
        }).join(',</div><div>');
2876
      } else if (_.isPlainObject(schema.items)) {
2877
        if (_.isUndefined(schema.items.$ref)) {
2878
          if (_.indexOf(['array', 'object'], schema.items.type || 'object') > -1) {
2879
            if ((_.isUndefined(schema.items.type) || schema.items.type === 'object') && _.isUndefined(schema.items.properties)) {
2880
              html += '<div>object</div>';
2881
            } else {
2882
              html += '<div>' + addReference(schema.items) + '</div>';
2883
            }
2884
          } else {
2885
            html += '<div>' + primitiveToOptionsHTML(schema.items, schema.items.type) + '</div>';
2886
          }
2887
        } else {
2888
          html += '<div>' + addReference(schema.items, Helpers.simpleRef(schema.items.$ref)) + '</div>';
2889
        }
2890
      } else {
2891
        Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
2892
        html += '<div>object</div>';
2893
      }
2894
    } else {
2895
      if (schema.$ref) {
2896
        html += '<div>' + addReference(schema, name) + '</div>';
2897
      } else if (type === 'object') {
2898
        html += '<div>';
2899
2900
        if (_.isPlainObject(schema.properties)) {
2901
          html += _.map(schema.properties, function (property, name) {
2902
            var propertyIsRequired = (_.indexOf(schema.required, name) >= 0);
2903
            var cProperty = _.cloneDeep(property);
2904
2905
            var requiredClass = propertyIsRequired ? 'required' : '';
2906
            var html = '<span class="propName ' + requiredClass + '">' + name + '</span> (';
2907
            var model;
2908
2909
            // Allow macro to set the default value
2910
            cProperty.default = modelPropertyMacro(cProperty);
2911
2912
            // Resolve the schema (Handle nested schemas)
2913
            cProperty = Helpers.resolveSchema(cProperty);
2914
2915
            // We need to handle property references to primitives (Issue 339)
2916
            if (!_.isUndefined(cProperty.$ref)) {
2917
              model = models[Helpers.simpleRef(cProperty.$ref)];
2918
2919
              if (!_.isUndefined(model) && _.indexOf([undefined, 'array', 'object'], model.definition.type) === -1) {
2920
                // Use referenced schema
2921
                cProperty = Helpers.resolveSchema(model.definition);
2922
              }
2923
            }
2924
2925
            html += primitiveToHTML(cProperty);
2926
2927
            if(!propertyIsRequired) {
2928
              html += ', <span class="propOptKey">optional</span>';
2929
            }
2930
2931
            html += ')';
2932
2933
            if (!_.isUndefined(cProperty.description)) {
2934
              html += ': ' + '<span class="propDesc">' + cProperty.description + '</span>';
2935
            }
2936
2937
            if (cProperty.enum) {
2938
              html += ' = <span class="propVals">[\'' + cProperty.enum.join('\', \'') + '\']</span>';
2939
            }
2940
2941
            return primitiveToOptionsHTML(cProperty, html);
2942
          }).join(',</div><div>');
2943
        }
2944
2945
        html += '</div>';
2946
      } else {
2947
        html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>';
2948
      }
2949
    }
2950
2951
    return html + strongOpen + (isArray ? ']' : '}') + strongClose;
2952
  };
2953
2954
};
2955
2956
},{"./helpers":4,"lodash-compat/array/indexOf":52,"lodash-compat/collection/forEach":57,"lodash-compat/collection/map":59,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isEmpty":144,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isUndefined":151,"lodash-compat/object/keys":152}],8:[function(require,module,exports){
2957
'use strict';
2958
2959
var SwaggerHttp = require('./http');
2960
var _ = {
2961
  isObject: require('lodash-compat/lang/isObject')
2962
};
2963
2964
var SwaggerSpecConverter = module.exports = function () {
2965
  this.errors = [];
2966
  this.warnings = [];
2967
  this.modelMap = {};
2968
};
2969
2970
SwaggerSpecConverter.prototype.setDocumentationLocation = function (location) {
2971
  this.docLocation = location;
2972
};
2973
2974
/**
2975
 * converts a resource listing OR api declaration
2976
 **/
2977
SwaggerSpecConverter.prototype.convert = function (obj, clientAuthorizations, callback) {
2978
  // not a valid spec
2979
  if(!obj || !Array.isArray(obj.apis)) {
2980
    return this.finish(callback, null);
2981
  }
2982
  this.clientAuthorizations = clientAuthorizations;
2983
2984
  // create a new swagger object to return
2985
  var swagger = { swagger: '2.0' };
2986
2987
  swagger.originalVersion = obj.swaggerVersion;
2988
2989
  // add the info
2990
  this.apiInfo(obj, swagger);
2991
2992
  // add security definitions
2993
  this.securityDefinitions(obj, swagger);
2994
2995
  // take basePath into account
2996
  if (obj.basePath) {
2997
    this.setDocumentationLocation(obj.basePath);
2998
  }
2999
3000
  // see if this is a single-file swagger definition
3001
  var isSingleFileSwagger = false;
3002
  var i;
3003
  for(i = 0; i < obj.apis.length; i++) {
3004
    var api = obj.apis[i];
3005
    if(Array.isArray(api.operations)) {
3006
      isSingleFileSwagger = true;
3007
    }
3008
  }
3009
  if(isSingleFileSwagger) {
3010
    this.declaration(obj, swagger);
3011
    this.finish(callback, swagger);
3012
  }
3013
  else {
3014
    this.resourceListing(obj, swagger, callback);
3015
  }
3016
};
3017
3018
SwaggerSpecConverter.prototype.declaration = function(obj, swagger) {
3019
  var name, i, p, pos;
3020
  if(!obj.apis) {
3021
    return;
3022
  }
3023
3024
  if (obj.basePath.indexOf('http://') === 0) {
3025
    p = obj.basePath.substring('http://'.length);
3026
    pos = p.indexOf('/');
3027
    if (pos > 0) {
3028
      swagger.host = p.substring(0, pos);
3029
      swagger.basePath = p.substring(pos);
3030
    }
3031
    else {
3032
      swagger.host = p;
3033
      swagger.basePath = '/';
3034
    }
3035
  } else if (obj.basePath.indexOf('https://') === 0) {
3036
    p = obj.basePath.substring('https://'.length);
3037
    pos = p.indexOf('/');
3038
    if (pos > 0) {
3039
      swagger.host = p.substring(0, pos);
3040
      swagger.basePath = p.substring(pos);
3041
    }
3042
    else {
3043
      swagger.host = p;
3044
      swagger.basePath = '/';
3045
    }
3046
  } else {
3047
    swagger.basePath = obj.basePath;
3048
  }
3049
3050
  var resourceLevelAuth;
3051
  if(obj.authorizations) {
3052
    resourceLevelAuth = obj.authorizations;
3053
  }
3054
  if(obj.consumes) {
3055
    swagger.consumes = obj.consumes;
3056
  }
3057
  if(obj.produces) {
3058
    swagger.produces = obj.produces;
3059
  }
3060
3061
  // build a mapping of id to name for 1.0 model resolutions
3062
  if(_.isObject(obj)) {
3063
    for(name in obj.models) {
3064
      var existingModel = obj.models[name];
3065
      var key = (existingModel.id || name);
3066
      this.modelMap[key] = name;
3067
    }
3068
  }
3069
3070
  for(i = 0; i < obj.apis.length; i++) {
3071
    var api = obj.apis[i];
3072
    var path = api.path;
3073
    var operations = api.operations;
3074
    this.operations(path, obj.resourcePath, operations, resourceLevelAuth, swagger);
3075
  }
3076
3077
  var models = obj.models || {};
3078
  this.models(models, swagger);
3079
};
3080
3081
SwaggerSpecConverter.prototype.models = function(obj, swagger) {
3082
  if(!_.isObject(obj)) {
3083
    return;
3084
  }
3085
  var name;
3086
3087
  swagger.definitions = swagger.definitions || {};
3088
  for(name in obj) {
3089
    var existingModel = obj[name];
3090
    var _enum = [];
3091
    var schema = { properties: {}};
3092
    var propertyName;
3093
    for(propertyName in existingModel.properties) {
3094
      var existingProperty = existingModel.properties[propertyName];
3095
      var property = {};
3096
      this.dataType(existingProperty, property);
3097
      if(existingProperty.description) {
3098
        property.description = existingProperty.description;
3099
      }
3100
      if(existingProperty['enum']) {
3101
        property['enum'] = existingProperty['enum'];
3102
      }
3103
      if(typeof existingProperty.required === 'boolean' && existingProperty.required === true) {
3104
        _enum.push(propertyName);
3105
      }
3106
      if(typeof existingProperty.required === 'string' && existingProperty.required === 'true') {
3107
        _enum.push(propertyName);
3108
      }
3109
      schema.properties[propertyName] = property;
3110
    }
3111
    if(_enum.length > 0) {
3112
      schema['enum'] = _enum;
3113
    }
3114
3115
    schema.required = existingModel.required;
3116
    swagger.definitions[name] = schema;
3117
  }
3118
};
3119
3120
SwaggerSpecConverter.prototype.extractTag = function(resourcePath) {
3121
  var pathString = resourcePath || 'default';
3122
  if(pathString.indexOf('http:') === 0 || pathString.indexOf('https:') === 0) {
3123
    pathString = pathString.split(['/']);
3124
    pathString = pathString[pathString.length -1].substring();
3125
  }
3126
  if(pathString.endsWith('.json')) {
3127
    pathString = pathString.substring(0, pathString.length - '.json'.length);
3128
  }
3129
  return pathString.replace('/','');
3130
};
3131
3132
SwaggerSpecConverter.prototype.operations = function(path, resourcePath, obj, resourceLevelAuth, swagger) {
3133
  if(!Array.isArray(obj)) {
3134
    return;
3135
  }
3136
  var i;
3137
3138
  if(!swagger.paths) {
3139
    swagger.paths = {};
3140
  }
3141
3142
  var pathObj = swagger.paths[path] || {};
3143
  var tag = this.extractTag(resourcePath);
3144
  swagger.tags = swagger.tags || [];
3145
  var matched = false;
3146
  for(i = 0; i < swagger.tags.length; i++) {
3147
    var tagObject = swagger.tags[i];
3148
    if(tagObject.name === tag) {
3149
      matched = true;
3150
    }
3151
  }
3152
  if(!matched) {
3153
    swagger.tags.push({name: tag});
3154
  }
3155
3156
  for(i = 0; i < obj.length; i++) {
3157
    var existingOperation = obj[i];
3158
    var method = (existingOperation.method || existingOperation.httpMethod).toLowerCase();
3159
    var operation = {tags: [tag]};
3160
    var existingAuthorizations = existingOperation.authorizations;
3161
3162
    if(existingAuthorizations && Object.keys(existingAuthorizations).length === 0) {
3163
      existingAuthorizations = resourceLevelAuth;
3164
    }
3165
3166
    if(typeof existingAuthorizations !== 'undefined') {
3167
      var scopesObject;
3168
      for(var key in existingAuthorizations) {
3169
        operation.security = operation.security || [];
3170
        var scopes = existingAuthorizations[key];
3171
        if(scopes) {
3172
          var securityScopes = [];
3173
          for(var j in scopes) {
3174
            securityScopes.push(scopes[j].scope);
3175
          }
3176
          scopesObject = {};
3177
          scopesObject[key] = securityScopes;
3178
          operation.security.push(scopesObject);
3179
        }
3180
        else {
3181
          scopesObject = {};
3182
          scopesObject[key] = [];
3183
          operation.security.push(scopesObject);
3184
        }
3185
      }
3186
    }
3187
3188
    if(existingOperation.consumes) {
3189
      operation.consumes = existingOperation.consumes;
3190
    }
3191
    else if(swagger.consumes) {
3192
      operation.consumes = swagger.consumes;
3193
    }
3194
    if(existingOperation.produces) {
3195
      operation.produces = existingOperation.produces;
3196
    }
3197
    else if(swagger.produces) {
3198
      operation.produces = swagger.produces;
3199
    }
3200
    if(existingOperation.summary) {
3201
      operation.summary = existingOperation.summary;
3202
    }
3203
    if(existingOperation.notes) {
3204
      operation.description = existingOperation.notes;
3205
    }
3206
    if(existingOperation.nickname) {
3207
      operation.operationId = existingOperation.nickname;
3208
    }
3209
    if(existingOperation.deprecated) {
3210
      operation.deprecated = existingOperation.deprecated;
3211
    }
3212
3213
    this.authorizations(existingAuthorizations, swagger);
3214
    this.parameters(operation, existingOperation.parameters, swagger);
3215
    this.responseMessages(operation, existingOperation, swagger);
3216
3217
    pathObj[method] = operation;
3218
  }
3219
3220
  swagger.paths[path] = pathObj;
3221
};
3222
3223
SwaggerSpecConverter.prototype.responseMessages = function(operation, existingOperation) {
3224
  if(!_.isObject(existingOperation)) {
3225
    return;
3226
  }
3227
  // build default response from the operation (1.x)
3228
  var defaultResponse = {};
3229
  this.dataType(existingOperation, defaultResponse);
3230
  // TODO: look into the real problem of rendering responses in swagger-ui
3231
  // ....should reponseType have an implicit schema?
3232
  if(!defaultResponse.schema && defaultResponse.type) {
3233
    defaultResponse = {schema: defaultResponse};
3234
  }
3235
3236
  operation.responses = operation.responses || {};
3237
3238
  // grab from responseMessages (1.2)
3239
  var has200 = false;
3240
  if(Array.isArray(existingOperation.responseMessages)) {
3241
    var i;
3242
    var existingResponses = existingOperation.responseMessages;
3243
    for(i = 0; i < existingResponses.length; i++) {
3244
      var existingResponse = existingResponses[i];
3245
      var response = { description: existingResponse.message };
3246
      if(existingResponse.code === 200) {
3247
        has200 = true;
3248
      }
3249
      // Convert responseModel -> schema{$ref: responseModel}
3250
      if(existingResponse.responseModel) {
3251
        response.schema = {'$ref': existingResponse.responseModel};
3252
      }
3253
      operation.responses['' + existingResponse.code] = response;
3254
    }
3255
  }
3256
3257
  if(has200) {
3258
    operation.responses['default'] = defaultResponse;
3259
  }
3260
  else {
3261
    operation.responses['200'] = defaultResponse;
3262
  }
3263
};
3264
3265
SwaggerSpecConverter.prototype.authorizations = function(obj) {
3266
  // TODO
3267
  if(!_.isObject(obj)) {
3268
    return;
3269
  }
3270
};
3271
3272
SwaggerSpecConverter.prototype.parameters = function(operation, obj) {
3273
  if(!Array.isArray(obj)) {
3274
    return;
3275
  }
3276
  var i;
3277
  for(i = 0; i < obj.length; i++) {
3278
    var existingParameter = obj[i];
3279
    var parameter = {};
3280
    parameter.name = existingParameter.name;
3281
    parameter.description = existingParameter.description;
3282
    parameter.required = existingParameter.required;
3283
    parameter.in = existingParameter.paramType;
3284
3285
    // per #168
3286
    if(parameter.in === 'body') {
3287
      parameter.name = 'body';
3288
    }
3289
    if(parameter.in === 'form') {
3290
      parameter.in = 'formData';
3291
    }
3292
3293
    if(existingParameter.enum) {
3294
      parameter.enum = existingParameter.enum;
3295
    }
3296
3297
    if(existingParameter.allowMultiple === true || existingParameter.allowMultiple === 'true') {
3298
      var innerType = {};
3299
      this.dataType(existingParameter, innerType);
3300
      parameter.type = 'array';
3301
      parameter.items = innerType;
3302
3303
      if(existingParameter.allowableValues) {
3304
        var av = existingParameter.allowableValues;
3305
        if(av.valueType === 'LIST') {
3306
          parameter['enum'] = av.values;
3307
        }
3308
      }
3309
    }
3310
    else {
3311
      this.dataType(existingParameter, parameter);
3312
    }
3313
3314
    operation.parameters = operation.parameters || [];
3315
    operation.parameters.push(parameter);
3316
  }
3317
};
3318
3319
SwaggerSpecConverter.prototype.dataType = function(source, target) {
3320
  if(!_.isObject(source)) {
3321
    return;
3322
  }
3323
3324
  if(source.minimum) {
3325
    target.minimum = source.minimum;
3326
  }
3327
  if(source.maximum) {
3328
    target.maximum = source.maximum;
3329
  }
3330
  if (source.format) {
3331
    target.format = source.format;
3332
  }
3333
3334
  // default can be 'false'
3335
  if(typeof source.defaultValue !== 'undefined') {
3336
    target.default = source.defaultValue;
3337
  }
3338
3339
  var jsonSchemaType = this.toJsonSchema(source);
3340
  if(jsonSchemaType) {
3341
    target = target || {};
3342
    if(jsonSchemaType.type) {
3343
      target.type = jsonSchemaType.type;
3344
    }
3345
    if(jsonSchemaType.format) {
3346
      target.format = jsonSchemaType.format;
3347
    }
3348
    if(jsonSchemaType.$ref) {
3349
      target.schema = {$ref: jsonSchemaType.$ref};
3350
    }
3351
    if(jsonSchemaType.items) {
3352
      target.items = jsonSchemaType.items;
3353
    }
3354
  }
3355
};
3356
3357
SwaggerSpecConverter.prototype.toJsonSchema = function(source) {
3358
  if(!source) {
3359
    return 'object';
3360
  }
3361
  var detectedType = (source.type || source.dataType || source.responseClass || '');
3362
  var lcType = detectedType.toLowerCase();
3363
  var format = (source.format || '').toLowerCase();
3364
3365
  if(lcType.indexOf('list[') === 0) {
3366
    var innerType = detectedType.substring(5, detectedType.length - 1);
3367
    var jsonType = this.toJsonSchema({type: innerType});
3368
    return {type: 'array', items: jsonType};
3369
  }
3370
  else if(lcType === 'int' || (lcType === 'integer' && format === 'int32'))
3371
    {return {type: 'integer', format: 'int32'};}
3372
  else if(lcType === 'long' || (lcType === 'integer' && format === 'int64'))
3373
    {return {type: 'integer', format: 'int64'};}
3374
  else if(lcType === 'integer')
3375
    {return {type: 'integer', format: 'int64'};}
3376
  else if(lcType === 'float' || (lcType === 'number' && format === 'float'))
3377
    {return {type: 'number', format: 'float'};}
3378
  else if(lcType === 'double' || (lcType === 'number' && format === 'double'))
3379
    {return {type: 'number', format: 'double'};}
3380
  else if((lcType === 'string' && format === 'date-time') || (lcType === 'date'))
3381
    {return {type: 'string', format: 'date-time'};}
3382
  else if(lcType === 'string')
3383
    {return {type: 'string'};}
3384
  else if(lcType === 'file')
3385
    {return {type: 'file'};}
3386
  else if(lcType === 'boolean')
3387
    {return {type: 'boolean'};}
3388
  else if(lcType === 'array' || lcType === 'list') {
3389
    if(source.items) {
3390
      var it = this.toJsonSchema(source.items);
3391
      return {type: 'array', items: it};
3392
    }
3393
    else {
3394
      return {type: 'array', items: {type: 'object'}};
3395
    }
3396
  }
3397
  else if(source.$ref) {
3398
    return {$ref: '#/definitions/' + this.modelMap[source.$ref] || source.$ref};
3399
  }
3400
  else if(lcType === 'void' || lcType === '')
3401
    {return {};}
3402
  else {
3403
    return {$ref: '#/definitions/' + this.modelMap[source.type] || source.type};
3404
  }
3405
};
3406
3407
SwaggerSpecConverter.prototype.resourceListing = function(obj, swagger, callback) {
3408
  var i;
3409
  var processedCount = 0;   // jshint ignore:line
3410
  var self = this;          // jshint ignore:line
3411
  var expectedCount = obj.apis.length;
3412
  var _swagger = swagger;   // jshint ignore:line
3413
3414
  if(expectedCount === 0) {
3415
    this.finish(callback, swagger);
3416
  }
3417
3418
  for(i = 0; i < expectedCount; i++) {
3419
    var api = obj.apis[i];
3420
    var path = api.path;
3421
    var absolutePath = this.getAbsolutePath(obj.swaggerVersion, this.docLocation, path);
3422
3423
    if(api.description) {
3424
      swagger.tags = swagger.tags || [];
3425
      swagger.tags.push({
3426
        name : this.extractTag(api.path),
3427
        description : api.description || ''
3428
      });
3429
    }
3430
    var http = {
3431
      url: absolutePath,
3432
      headers: {accept: 'application/json'},
3433
      on: {},
3434
      method: 'get'
3435
    };
3436
    /* jshint ignore:start */
3437
    http.on.response = function(data) {
3438
      processedCount += 1;
3439
      var obj = data.obj;
3440
      if(obj) {
3441
        self.declaration(obj, _swagger);
3442
      }
3443
      if(processedCount === expectedCount) {
3444
        self.finish(callback, _swagger);
3445
      }
3446
    };
3447
    http.on.error = function(data) {
3448
      console.error(data);
3449
      processedCount += 1;
3450
      if(processedCount === expectedCount) {
3451
        self.finish(callback, _swagger);
3452
      }
3453
    };
3454
    /* jshint ignore:end */
3455
3456
    if(this.clientAuthorizations && typeof this.clientAuthorizations.apply === 'function') {
3457
      this.clientAuthorizations.apply(http);
3458
    }
3459
3460
    new SwaggerHttp().execute(http);
3461
  }
3462
};
3463
3464
SwaggerSpecConverter.prototype.getAbsolutePath = function(version, docLocation, path)  {
3465
  if(version === '1.0') {
3466
    if(docLocation.endsWith('.json')) {
3467
      // get root path
3468
      var pos = docLocation.lastIndexOf('/');
3469
      if(pos > 0) {
3470
        docLocation = docLocation.substring(0, pos);
3471
      }
3472
    }
3473
  }
3474
3475
  var location = docLocation;
3476
  if(path.indexOf('http://') === 0 || path.indexOf('https://') === 0) {
3477
    location = path;
3478
  }
3479
  else {
3480
    if(docLocation.endsWith('/')) {
3481
      location = docLocation.substring(0, docLocation.length - 1);
3482
    }
3483
    location += path;
3484
  }
3485
  location = location.replace('{format}', 'json');
3486
  return location;
3487
};
3488
3489
SwaggerSpecConverter.prototype.securityDefinitions = function(obj, swagger) {
3490
  if(obj.authorizations) {
3491
    var name;
3492
    for(name in obj.authorizations) {
3493
      var isValid = false;
3494
      var securityDefinition = {};
3495
      var definition = obj.authorizations[name];
3496
      if(definition.type === 'apiKey') {
3497
        securityDefinition.type = 'apiKey';
3498
        securityDefinition.in = definition.passAs;
3499
        securityDefinition.name = definition.keyname || name;
3500
        isValid = true;
3501
      }
3502
      else if(definition.type === 'oauth2') {
3503
        var existingScopes = definition.scopes || [];
3504
        var scopes = {};
3505
        var i;
3506
        for(i in existingScopes) {
3507
          var scope = existingScopes[i];
3508
          scopes[scope.scope] = scope.description;
3509
        }
3510
        securityDefinition.type = 'oauth2';
3511
        if(i > 0) {
3512
          securityDefinition.scopes = scopes;
3513
        }
3514
        if(definition.grantTypes) {
3515
          if(definition.grantTypes.implicit) {
3516
            var implicit = definition.grantTypes.implicit;
3517
            securityDefinition.flow = 'implicit';
3518
            securityDefinition.authorizationUrl = implicit.loginEndpoint;
3519
            isValid = true;
3520
          }
3521
          /* jshint ignore:start */
3522
          if(definition.grantTypes['authorization_code']) {
3523
            if(!securityDefinition.flow) {
3524
              // cannot set if flow is already defined
3525
              var authCode = definition.grantTypes['authorization_code'];
3526
              securityDefinition.flow = 'accessCode';
3527
              securityDefinition.authorizationUrl = authCode.tokenRequestEndpoint.url;
3528
              securityDefinition.tokenUrl = authCode.tokenEndpoint.url;
3529
              isValid = true;
3530
            }
3531
          }
3532
          /* jshint ignore:end */
3533
        }
3534
      }
3535
      if(isValid) {
3536
        swagger.securityDefinitions = swagger.securityDefinitions || {};
3537
        swagger.securityDefinitions[name] = securityDefinition;
3538
      }
3539
    }
3540
  }
3541
};
3542
3543
SwaggerSpecConverter.prototype.apiInfo = function(obj, swagger) {
3544
  // info section
3545
  if(obj.info) {
3546
    var info = obj.info;
3547
    swagger.info = {};
3548
3549
    if(info.contact) {
3550
      swagger.info.contact = {};
3551
      swagger.info.contact.email = info.contact;
3552
    }
3553
    if(info.description) {
3554
      swagger.info.description = info.description;
3555
    }
3556
    if(info.title) {
3557
      swagger.info.title = info.title;
3558
    }
3559
    if(info.termsOfServiceUrl) {
3560
      swagger.info.termsOfService = info.termsOfServiceUrl;
3561
    }
3562
    if(info.license || info.licenseUrl) {
3563
      swagger.license = {};
3564
      if(info.license) {
3565
        swagger.license.name = info.license;
3566
      }
3567
      if(info.licenseUrl) {
3568
        swagger.license.url = info.licenseUrl;
3569
      }
3570
    }
3571
  }
3572
  else {
3573
    this.warnings.push('missing info section');
3574
  }
3575
};
3576
3577
SwaggerSpecConverter.prototype.finish = function (callback, obj) {
3578
  callback(obj);
3579
};
3580
3581
},{"./http":5,"lodash-compat/lang/isObject":147}],9:[function(require,module,exports){
3582
'use strict';
3583
3584
var _ = {
3585
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
3586
  isString: require('lodash-compat/lang/isString'),
3587
};
3588
3589
var SchemaMarkup = require('../schema-markup.js');
3590
var jsyaml = require('js-yaml');
3591
3592
var Model = module.exports = function (name, definition, models, modelPropertyMacro) {
3593
  this.definition = definition || {};
3594
  this.isArray = definition.type === 'array';
3595
  this.models = models || {};
3596
  this.name = definition.title || name || 'Inline Model';
3597
  this.modelPropertyMacro = modelPropertyMacro || function (property) {
3598
    return property.default;
3599
  };
3600
3601
  return this;
3602
};
3603
3604
Model.prototype.createJSONSample = Model.prototype.getSampleValue = function (modelsToIgnore) {
3605
  modelsToIgnore = modelsToIgnore || {};
3606
3607
  modelsToIgnore[this.name] = this;
3608
3609
  // Response support
3610
  if (this.examples && _.isPlainObject(this.examples) && this.examples['application/json']) {
3611
    this.definition.example = this.examples['application/json'];
3612
3613
    if (_.isString(this.definition.example)) {
3614
      this.definition.example = jsyaml.safeLoad(this.definition.example);
3615
    }
3616
  } else if (!this.definition.example) {
3617
    this.definition.example = this.examples;
3618
  }
3619
3620
  return SchemaMarkup.schemaToJSON(this.definition, this.models, modelsToIgnore, this.modelPropertyMacro);
3621
};
3622
3623
Model.prototype.getMockSignature = function () {
3624
  return SchemaMarkup.schemaToHTML(this.name, this.definition, this.models, this.modelPropertyMacro);
3625
};
3626
3627
},{"../schema-markup.js":7,"js-yaml":21,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isString":149}],10:[function(require,module,exports){
3628
'use strict';
3629
3630
var _ = {
3631
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
3632
  isUndefined: require('lodash-compat/lang/isUndefined'),
3633
  isEmpty: require('lodash-compat/lang/isEmpty'),
3634
  isObject: require('lodash-compat/lang/isObject')
3635
};
3636
var helpers = require('../helpers');
3637
var Model = require('./model');
3638
var SwaggerHttp = require('../http');
3639
3640
var Operation = module.exports = function (parent, scheme, operationId, httpMethod, path, args, definitions, models, clientAuthorizations) {
3641
  var errors = [];
3642
3643
  parent = parent || {};
3644
  args = args || {};
3645
3646
  if(parent && parent.options) {
3647
    this.client = parent.options.client || null;
3648
    this.responseInterceptor = parent.options.responseInterceptor || null;
3649
  }
3650
  this.authorizations = args.security;
3651
  this.basePath = parent.basePath || '/';
3652
  this.clientAuthorizations = clientAuthorizations;
3653
  this.consumes = args.consumes || parent.consumes || ['application/json'];
3654
  this.produces = args.produces || parent.produces || ['application/json'];
3655
  this.deprecated = args.deprecated;
3656
  this.description = args.description;
3657
  this.host = parent.host || 'localhost';
3658
  this.method = (httpMethod || errors.push('Operation ' + operationId + ' is missing method.'));
3659
  this.models = models || {};
3660
  this.nickname = (operationId || errors.push('Operations must have a nickname.'));
3661
  this.operation = args;
3662
  this.operations = {};
3663
  this.parameters = args !== null ? (args.parameters || []) : {};
3664
  this.parent = parent;
3665
  this.path = (path || errors.push('Operation ' + this.nickname + ' is missing path.'));
3666
  this.responses = (args.responses || {});
3667
  this.scheme = scheme || parent.scheme || 'http';
3668
  this.schemes = args.schemes || parent.schemes;
3669
  this.security = args.security;
3670
  this.summary = args.summary || '';
3671
  this.type = null;
3672
  this.useJQuery = parent.useJQuery;
3673
  this.parameterMacro = parent.parameterMacro || function (parameter) {
3674
    return parameter.default;
3675
  };
3676
3677
  this.inlineModels = [];
3678
3679
  if (typeof this.deprecated === 'string') {
3680
    switch(this.deprecated.toLowerCase()) {
3681
      case 'true': case 'yes': case '1': {
3682
        this.deprecated = true;
3683
        break;
3684
      }
3685
3686
      case 'false': case 'no': case '0': case null: {
3687
        this.deprecated = false;
3688
        break;
3689
      }
3690
3691
      default: this.deprecated = Boolean(this.deprecated);
3692
    }
3693
  }
3694
3695
  var i, model;
3696
3697
  if (definitions) {
3698
    // add to global models
3699
    var key;
3700
3701
    for (key in definitions) {
3702
      model = new Model(key, definitions[key], this.models, parent.modelPropertyMacro);
3703
3704
      if (model) {
3705
        this.models[key] = model;
3706
      }
3707
    }
3708
  }
3709
3710
  for (i = 0; i < this.parameters.length; i++) {
3711
    var param = this.parameters[i];
3712
3713
    // Allow macro to set the default value
3714
    param.default = this.parameterMacro(param);
3715
3716
    if (param.type === 'array') {
3717
      param.isList = true;
3718
      param.allowMultiple = true;
3719
      // the enum can be defined at the items level
3720
      if (param.items && param.items.enum) {
3721
        param['enum'] = param.items.enum;
3722
      }
3723
    }
3724
3725
    var innerType = this.getType(param);
3726
3727
    if (innerType && innerType.toString().toLowerCase() === 'boolean') {
3728
      param.allowableValues = {};
3729
      param.isList = true;
3730
      param['enum'] = [true, false]; // use actual primitives
3731
    }
3732
3733
    if (typeof param['enum'] !== 'undefined') {
3734
      var id;
3735
3736
      param.allowableValues = {};
3737
      param.allowableValues.values = [];
3738
      param.allowableValues.descriptiveValues = [];
3739
3740
      for (id = 0; id < param['enum'].length; id++) {
3741
        var value = param['enum'][id];
3742
        var isDefault = (value === param.default || value+'' === param.default);
3743
3744
        param.allowableValues.values.push(value);
3745
        // Always have string for descriptive values....
3746
        param.allowableValues.descriptiveValues.push({value : value+'', isDefault: isDefault});
3747
      }
3748
    }
3749
3750
    if (param.type === 'array') {
3751
      innerType = [innerType];
3752
3753
      if (typeof param.allowableValues === 'undefined') {
3754
        // can't show as a list if no values to select from
3755
        delete param.isList;
3756
        delete param.allowMultiple;
3757
      }
3758
    }
3759
3760
    param.signature = this.getModelSignature(innerType, this.models).toString();
3761
    param.sampleJSON = this.getModelSampleJSON(innerType, this.models);
3762
    param.responseClassSignature = param.signature;
3763
  }
3764
3765
  var defaultResponseCode, response, responses = this.responses;
3766
3767
  if (responses['200']) {
3768
    response = responses['200'];
3769
    defaultResponseCode = '200';
3770
  } else if (responses['201']) {
3771
    response = responses['201'];
3772
    defaultResponseCode = '201';
3773
  } else if (responses['202']) {
3774
    response = responses['202'];
3775
    defaultResponseCode = '202';
3776
  } else if (responses['203']) {
3777
    response = responses['203'];
3778
    defaultResponseCode = '203';
3779
  } else if (responses['204']) {
3780
    response = responses['204'];
3781
    defaultResponseCode = '204';
3782
  } else if (responses['205']) {
3783
    response = responses['205'];
3784
    defaultResponseCode = '205';
3785
  } else if (responses['206']) {
3786
    response = responses['206'];
3787
    defaultResponseCode = '206';
3788
  } else if (responses['default']) {
3789
    response = responses['default'];
3790
    defaultResponseCode = 'default';
3791
  }
3792
3793
  if (response && response.schema) {
3794
    var resolvedModel = this.resolveModel(response.schema, definitions);
3795
    var successResponse;
3796
3797
    delete responses[defaultResponseCode];
3798
3799
    if (resolvedModel) {
3800
      this.successResponse = {};
3801
      successResponse = this.successResponse[defaultResponseCode] = resolvedModel;
3802
    } else if (!response.schema.type || response.schema.type === 'object' || response.schema.type === 'array') {
3803
      // Inline model
3804
      this.successResponse = {};
3805
      successResponse = this.successResponse[defaultResponseCode] = new Model(undefined, response.schema || {}, this.models, parent.modelPropertyMacro);
3806
    } else {
3807
      // Primitive
3808
      this.successResponse = {};
3809
      successResponse = this.successResponse[defaultResponseCode] = response.schema;
3810
    }
3811
3812
    if (successResponse) {
3813
      // Attach response properties
3814
      if (response.description) {
3815
        successResponse.description = response.description;
3816
      }
3817
3818
      if (response.examples) {
3819
        successResponse.examples = response.examples;
3820
      }
3821
3822
      if (response.headers) {
3823
        successResponse.headers = response.headers;
3824
      }
3825
    }
3826
3827
    this.type = response;
3828
  }
3829
3830
  if (errors.length > 0) {
3831
    if (this.resource && this.resource.api && this.resource.api.fail) {
3832
      this.resource.api.fail(errors);
3833
    }
3834
  }
3835
3836
  return this;
3837
};
3838
3839
Operation.prototype.isDefaultArrayItemValue = function(value, param) {
3840
  if (param.default && Array.isArray(param.default)) {
3841
    return param.default.indexOf(value) !== -1;
3842
  }
3843
  return value === param.default;
3844
};
3845
3846
Operation.prototype.getType = function (param) {
3847
  var type = param.type;
3848
  var format = param.format;
3849
  var isArray = false;
3850
  var str;
3851
3852
  if (type === 'integer' && format === 'int32') {
3853
    str = 'integer';
3854
  } else if (type === 'integer' && format === 'int64') {
3855
    str = 'long';
3856
  } else if (type === 'integer') {
3857
    str = 'integer';
3858
  } else if (type === 'string') {
3859
    if (format === 'date-time') {
3860
      str = 'date-time';
3861
    } else if (format === 'date') {
3862
      str = 'date';
3863
    } else {
3864
      str = 'string';
3865
    }
3866
  } else if (type === 'number' && format === 'float') {
3867
    str = 'float';
3868
  } else if (type === 'number' && format === 'double') {
3869
    str = 'double';
3870
  } else if (type === 'number') {
3871
    str = 'double';
3872
  } else if (type === 'boolean') {
3873
    str = 'boolean';
3874
  } else if (type === 'array') {
3875
    isArray = true;
3876
3877
    if (param.items) {
3878
      str = this.getType(param.items);
3879
    }
3880
  }
3881
3882
  if (param.$ref) {
3883
    str = helpers.simpleRef(param.$ref);
3884
  }
3885
3886
  var schema = param.schema;
3887
3888
  if (schema) {
3889
    var ref = schema.$ref;
3890
3891
    if (ref) {
3892
      ref = helpers.simpleRef(ref);
3893
3894
      if (isArray) {
3895
        return [ ref ];
3896
      } else {
3897
        return ref;
3898
      }
3899
    } else {
3900
      // If inline schema, we add it our interal hash -> which gives us it's ID (int)
3901
      if(schema.type === 'object') {
3902
        return this.addInlineModel(schema);
3903
      }
3904
      return this.getType(schema);
3905
    }
3906
  }
3907
  if (isArray) {
3908
    return [ str ];
3909
  } else {
3910
    return str;
3911
  }
3912
};
3913
3914
/**
3915
 * adds an inline schema (model) to a hash, where we can ref it later
3916
 * @param {object} schema a schema
3917
 * @return {number} the ID of the schema being added, or null
3918
 **/
3919
Operation.prototype.addInlineModel = function (schema) {
3920
  var len = this.inlineModels.length;
3921
  var model = this.resolveModel(schema, {});
3922
  if(model) {
3923
    this.inlineModels.push(model);
3924
    return 'Inline Model '+len; // return string ref of the inline model (used with #getInlineModel)
3925
  }
3926
  return null; // report errors?
3927
};
3928
3929
/**
3930
 * gets the internal ref to an inline model
3931
 * @param {string} inline_str a string reference to an inline model
3932
 * @return {Model} the model being referenced. Or null
3933
 **/
3934
Operation.prototype.getInlineModel = function(inlineStr) {
3935
  if(/^Inline Model \d+$/.test(inlineStr)) {
3936
    var id = parseInt(inlineStr.substr('Inline Model'.length).trim(),10); //
3937
    var model = this.inlineModels[id];
3938
    return model;
3939
  }
3940
  // I'm returning null here, should I rather throw an error?
3941
  return null;
3942
};
3943
3944
Operation.prototype.resolveModel = function (schema, definitions) {
3945
  if (typeof schema.$ref !== 'undefined') {
3946
    var ref = schema.$ref;
3947
3948
    if (ref.indexOf('#/definitions/') === 0) {
3949
      ref = ref.substring('#/definitions/'.length);
3950
    }
3951
3952
    if (definitions[ref]) {
3953
      return new Model(ref, definitions[ref], this.models, this.parent.modelPropertyMacro);
3954
    }
3955
  // schema must at least be an object to get resolved to an inline Model
3956
  } else if (schema && typeof schema === 'object' &&
3957
            (schema.type === 'object' || _.isUndefined(schema.type))) {
3958
    return new Model(undefined, schema, this.models, this.parent.modelPropertyMacro);
3959
  }
3960
3961
  return null;
3962
};
3963
3964
Operation.prototype.help = function (dontPrint) {
3965
  var out = this.nickname + ': ' + this.summary + '\n';
3966
3967
  for (var i = 0; i < this.parameters.length; i++) {
3968
    var param = this.parameters[i];
3969
    var typeInfo = param.signature;
3970
3971
    out += '\n  * ' + param.name + ' (' + typeInfo + '): ' + param.description;
3972
  }
3973
3974
  if (typeof dontPrint === 'undefined') {
3975
    helpers.log(out);
3976
  }
3977
3978
  return out;
3979
};
3980
3981
Operation.prototype.getModelSignature = function (type, definitions) {
3982
  var isPrimitive, listType;
3983
3984
  if (type instanceof Array) {
3985
    listType = true;
3986
    type = type[0];
3987
  }
3988
3989
  // Convert undefined to string of 'undefined'
3990
  if (typeof type === 'undefined') {
3991
    type = 'undefined';
3992
    isPrimitive = true;
3993
3994
  } else if (definitions[type]){
3995
    // a model def exists?
3996
    type = definitions[type]; /* Model */
3997
    isPrimitive = false;
3998
3999
  } else if (this.getInlineModel(type)) {
4000
    type = this.getInlineModel(type); /* Model */
4001
    isPrimitive = false;
4002
4003
  } else {
4004
    // We default to primitive
4005
    isPrimitive = true;
4006
  }
4007
4008
  if (isPrimitive) {
4009
    if (listType) {
4010
      return 'Array[' + type + ']';
4011
    } else {
4012
      return type.toString();
4013
    }
4014
  } else {
4015
    if (listType) {
4016
      return 'Array[' + type.getMockSignature() + ']';
4017
    } else {
4018
      return type.getMockSignature();
4019
    }
4020
  }
4021
};
4022
4023
Operation.prototype.supportHeaderParams = function () {
4024
  return true;
4025
};
4026
4027
Operation.prototype.supportedSubmitMethods = function () {
4028
  return this.parent.supportedSubmitMethods;
4029
};
4030
4031
Operation.prototype.getHeaderParams = function (args) {
4032
  var headers = this.setContentTypes(args, {});
4033
4034
  for (var i = 0; i < this.parameters.length; i++) {
4035
    var param = this.parameters[i];
4036
4037
    if (typeof args[param.name] !== 'undefined') {
4038
      if (param.in === 'header') {
4039
        var value = args[param.name];
4040
4041
        if (Array.isArray(value)) {
4042
          value = value.toString();
4043
        }
4044
4045
        headers[param.name] = value;
4046
      }
4047
    }
4048
  }
4049
4050
  return headers;
4051
};
4052
4053
Operation.prototype.urlify = function (args) {
4054
  var formParams = {};
4055
  var requestUrl = this.path;
4056
  var querystring = ''; // grab params from the args, build the querystring along the way
4057
4058
  for (var i = 0; i < this.parameters.length; i++) {
4059
    var param = this.parameters[i];
4060
4061
    if (typeof args[param.name] !== 'undefined') {
4062
      if (param.in === 'path') {
4063
        var reg = new RegExp('\{' + param.name + '\}', 'gi');
4064
        var value = args[param.name];
4065
4066
        if (Array.isArray(value)) {
4067
          value = this.encodePathCollection(param.collectionFormat, param.name, value);
4068
        } else {
4069
          value = this.encodePathParam(value);
4070
        }
4071
4072
        requestUrl = requestUrl.replace(reg, value);
4073
      } else if (param.in === 'query' && typeof args[param.name] !== 'undefined') {
4074
        if (querystring === '') {
4075
          querystring += '?';
4076
        } else {
4077
          querystring += '&';
4078
        }
4079
4080
        if (typeof param.collectionFormat !== 'undefined') {
4081
          var qp = args[param.name];
4082
4083
          if (Array.isArray(qp)) {
4084
            querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp);
4085
          } else {
4086
            querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4087
          }
4088
        } else {
4089
          querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4090
        }
4091
      } else if (param.in === 'formData') {
4092
        formParams[param.name] = args[param.name];
4093
      }
4094
    }
4095
  }
4096
  var url = this.scheme + '://' + this.host;
4097
4098
  if (this.basePath !== '/') {
4099
    url += this.basePath;
4100
  }
4101
  return url + requestUrl + querystring;
4102
};
4103
4104
Operation.prototype.getMissingParams = function (args) {
4105
  var missingParams = []; // check required params, track the ones that are missing
4106
  var i;
4107
4108
  for (i = 0; i < this.parameters.length; i++) {
4109
    var param = this.parameters[i];
4110
4111
    if (param.required === true) {
4112
      if (typeof args[param.name] === 'undefined') {
4113
        missingParams = param.name;
4114
      }
4115
    }
4116
  }
4117
4118
  return missingParams;
4119
};
4120
4121
Operation.prototype.getBody = function (headers, args, opts) {
4122
  var formParams = {}, body, key, value, hasBody = false;
4123
4124
  for (var i = 0; i < this.parameters.length; i++) {
4125
    var param = this.parameters[i];
4126
4127
    if (typeof args[param.name] !== 'undefined') {
4128
      if (param.in === 'body') {
4129
        body = args[param.name];
4130
      } else if (param.in === 'formData') {
4131
        formParams[param.name] = args[param.name];
4132
      }
4133
    }
4134
    else {
4135
      if(param.in === 'body') {
4136
        hasBody = true;
4137
      }
4138
    }
4139
  }
4140
4141
  // if body is null and hasBody is true, AND a JSON body is requested, send empty {}
4142
  if(hasBody && typeof body === 'undefined') {
4143
    var contentType = headers['Content-Type'];
4144
    if(contentType && contentType.indexOf('application/json') === 0) {
4145
      body = '{}';
4146
    }
4147
  }
4148
4149
  // handle form params
4150
  if (headers['Content-Type'] === 'application/x-www-form-urlencoded') {
4151
    var encoded = '';
4152
4153
    for (key in formParams) {
4154
      value = formParams[key];
4155
4156
      if (typeof value !== 'undefined') {
4157
        if (encoded !== '') {
4158
          encoded += '&';
4159
        }
4160
4161
        encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
4162
      }
4163
    }
4164
4165
    body = encoded;
4166
  } else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
4167
    if (opts.useJQuery) {
4168
      var bodyParam = new FormData();
4169
4170
      bodyParam.type = 'formData';
4171
4172
      for (key in formParams) {
4173
        value = args[key];
4174
4175
        if (typeof value !== 'undefined') {
4176
          // required for jquery file upload
4177
          if (value.type === 'file' && value.value) {
4178
            delete headers['Content-Type'];
4179
4180
            bodyParam.append(key, value.value);
4181
          } else {
4182
            bodyParam.append(key, value);
4183
          }
4184
        }
4185
      }
4186
4187
      body = bodyParam;
4188
    }
4189
  }
4190
4191
  return body;
4192
};
4193
4194
/**
4195
 * gets sample response for a single operation
4196
 **/
4197
Operation.prototype.getModelSampleJSON = function (type, models) {
4198
  var listType, sampleJson, innerType;
4199
  models = models || {};
4200
4201
  listType = (type instanceof Array);
4202
  innerType = listType ? type[0] : type;
4203
4204
  if(models[innerType]) {
4205
    sampleJson = models[innerType].createJSONSample();
4206
  } else if (this.getInlineModel(innerType)){
4207
    sampleJson = this.getInlineModel(innerType).createJSONSample(); // may return null, if type isn't correct
4208
  }
4209
4210
4211
  if (sampleJson) {
4212
    sampleJson = listType ? [sampleJson] : sampleJson;
4213
4214
    if (typeof sampleJson === 'string') {
4215
      return sampleJson;
4216
    } else if (_.isObject(sampleJson)) {
4217
      var t = sampleJson;
4218
4219
      if (sampleJson instanceof Array && sampleJson.length > 0) {
4220
        t = sampleJson[0];
4221
      }
4222
4223
      if (t.nodeName) {
4224
        var xmlString = new XMLSerializer().serializeToString(t);
4225
4226
        return this.formatXml(xmlString);
4227
      } else {
4228
        return JSON.stringify(sampleJson, null, 2);
4229
      }
4230
    } else {
4231
      return sampleJson;
4232
    }
4233
  }
4234
};
4235
4236
/**
4237
 * legacy binding
4238
 **/
4239
Operation.prototype.do = function (args, opts, callback, error, parent) {
4240
  return this.execute(args, opts, callback, error, parent);
4241
};
4242
4243
/**
4244
 * executes an operation
4245
 **/
4246
Operation.prototype.execute = function (arg1, arg2, arg3, arg4, parent) {
4247
  var args = arg1 || {};
4248
  var opts = {}, success, error;
4249
4250
  if (_.isObject(arg2)) {
4251
    opts = arg2;
4252
    success = arg3;
4253
    error = arg4;
4254
  }
4255
4256
  if(this.client) {
4257
    opts.client = this.client;
4258
  }
4259
  if(this.responseInterceptor) {
4260
    opts.responseInterceptor = this.responseInterceptor;
4261
  }
4262
4263
4264
  if (typeof arg2 === 'function') {
4265
    success = arg2;
4266
    error = arg3;
4267
  }
4268
4269
  success = (success || this.parent.defaultSuccessCallback || helpers.log);
4270
  error = (error || this.parent.defaultErrorCallback || helpers.log);
4271
4272
4273
  if (typeof opts.useJQuery === 'undefined') {
4274
    opts.useJQuery = this.useJQuery;
4275
  }
4276
  var missingParams = this.getMissingParams(args);
4277
4278
  if (missingParams.length > 0) {
4279
    var message = 'missing required params: ' + missingParams;
4280
4281
    helpers.fail(message);
4282
    error(message);
4283
4284
    return;
4285
  }
4286
4287
  var allHeaders = this.getHeaderParams(args);
4288
  var contentTypeHeaders = this.setContentTypes(args, opts);
4289
  var headers = {}, attrname;
4290
4291
  for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
4292
  for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
4293
4294
  var body = this.getBody(contentTypeHeaders, args, opts);
4295
  var url = this.urlify(args);
4296
4297
  if(url.indexOf('.{format}') > 0) {
4298
    if(headers) {
4299
      var format = headers.Accept || headers.accept;
4300
      if(format && format.indexOf('json') > 0) {
4301
        url = url.replace('.{format}', '.json');
4302
      }
4303
      else if(format && format.indexOf('xml') > 0) {
4304
        url = url.replace('.{format}', '.xml');
4305
      }
4306
    }
4307
  }
4308
4309
  var obj = {
4310
    url: url,
4311
    method: this.method.toUpperCase(),
4312
    body: body,
4313
    useJQuery: opts.useJQuery,
4314
    headers: headers,
4315
    on: {
4316
      response: function (response) {
4317
        return success(response, parent);
4318
      },
4319
      error: function (response) {
4320
        return error(response, parent);
4321
      }
4322
    }
4323
  };
4324
4325
  this.clientAuthorizations.apply(obj, this.operation.security);
4326
  if (opts.mock === true) {
4327
    return obj;
4328
  } else {
4329
    new SwaggerHttp().execute(obj, opts);
4330
  }
4331
};
4332
4333
function itemByPriority(col, itemPriority) {
4334
4335
  // No priorities? return first...
4336
  if(_.isEmpty(itemPriority)) {
4337
    return col[0];
4338
  }
4339
4340
  for (var i = 0, len = itemPriority.length; i < len; i++) {
4341
    if(col.indexOf(itemPriority[i]) > -1) {
4342
      return itemPriority[i];
4343
    }
4344
  }
4345
4346
  // Otherwise return first
4347
  return col[0];
4348
}
4349
4350
Operation.prototype.setContentTypes = function (args, opts) {
4351
  // default type
4352
  var allDefinedParams = this.parameters;
4353
  var body;
4354
  var consumes = args.parameterContentType || itemByPriority(this.consumes, ['application/json', 'application/yaml']);
4355
  var accepts = opts.responseContentType || itemByPriority(this.produces, ['application/json', 'application/yaml']);
4356
  var definedFileParams = [];
4357
  var definedFormParams = [];
4358
  var headers = {};
4359
  var i;
4360
4361
  // get params from the operation and set them in definedFileParams, definedFormParams, headers
4362
  for (i = 0; i < allDefinedParams.length; i++) {
4363
    var param = allDefinedParams[i];
4364
4365
    if (param.in === 'formData') {
4366
      if (param.type === 'file') {
4367
        definedFileParams.push(param);
4368
      } else {
4369
        definedFormParams.push(param);
4370
      }
4371
    } else if (param.in === 'header' && opts) {
4372
      var key = param.name;
4373
      var headerValue = opts[param.name];
4374
4375
      if (typeof opts[param.name] !== 'undefined') {
4376
        headers[key] = headerValue;
4377
      }
4378
    } else if (param.in === 'body' && typeof args[param.name] !== 'undefined') {
4379
      body = args[param.name];
4380
    }
4381
  }
4382
4383
  // if there's a body, need to set the consumes header via requestContentType
4384
  if (this.method === 'post' || this.method === 'put' || this.method === 'patch' ||
4385
      (this.method === 'delete' && body) ) {
4386
    if (opts.requestContentType) {
4387
      consumes = opts.requestContentType;
4388
    }
4389
    // if any form params, content type must be set
4390
    if (definedFormParams.length > 0) {
4391
      if (opts.requestContentType) {             // override if set
4392
        consumes = opts.requestContentType;
4393
      } else if (definedFileParams.length > 0) { // if a file, must be multipart/form-data
4394
        consumes = 'multipart/form-data';
4395
      } else {                                   // default to x-www-from-urlencoded
4396
        consumes = 'application/x-www-form-urlencoded';
4397
      }
4398
    }
4399
  }
4400
  else {
4401
    consumes = null;
4402
  }
4403
4404
  if (consumes && this.consumes) {
4405
    if (this.consumes.indexOf(consumes) === -1) {
4406
      helpers.log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes));
4407
    }
4408
  }
4409
4410
  if (!this.matchesAccept(accepts)) {
4411
    helpers.log('server can\'t produce ' + accepts);
4412
  }
4413
4414
  if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded')) {
4415
    headers['Content-Type'] = consumes;
4416
  }
4417
4418
  if (accepts) {
4419
    headers.Accept = accepts;
4420
  }
4421
4422
  return headers;
4423
};
4424
4425
/**
4426
 * Returns true if the request accepts header matches anything in this.produces.
4427
 *  If this.produces contains * / *, ignore the accept header.
4428
 * @param {string=} accepts The client request accept header.
4429
 * @return {boolean}
4430
 */
4431
Operation.prototype.matchesAccept = function(accepts) {
4432
  // no accepts or produces, no problem!
4433
  if (!accepts || !this.produces) {
4434
    return true;
4435
  }
4436
  return this.produces.indexOf(accepts) !== -1 || this.produces.indexOf('*/*') !== -1;
4437
};
4438
4439
Operation.prototype.asCurl = function (args1, args2) {
4440
  var opts = {mock: true};
4441
  if (typeof args2 === 'object') {
4442
    for (var argKey in args2) {
4443
      opts[argKey] = args2[argKey];
4444
    }
4445
  }
4446
  var obj = this.execute(args1, opts);
4447
4448
  this.clientAuthorizations.apply(obj);
4449
4450
  var results = [];
4451
4452
  results.push('-X ' + this.method.toUpperCase());
4453
4454
  if (obj.headers) {
4455
    var key;
4456
4457
    for (key in obj.headers) {
4458
      results.push('--header "' + key + ': ' + obj.headers[key] + '"');
4459
    }
4460
  }
4461
4462
  if (obj.body) {
4463
    var body;
4464
4465
    if (_.isObject(obj.body)) {
4466
      body = JSON.stringify(obj.body);
4467
    } else {
4468
      body = obj.body;
4469
    }
4470
4471
    results.push('-d "' + body.replace(/"/g, '\\"') + '"');
4472
  }
4473
4474
  return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
4475
};
4476
4477
Operation.prototype.encodePathCollection = function (type, name, value) {
4478
  var encoded = '';
4479
  var i;
4480
  var separator = '';
4481
4482
  if (type === 'ssv') {
4483
    separator = '%20';
4484
  } else if (type === 'tsv') {
4485
    separator = '\\t';
4486
  } else if (type === 'pipes') {
4487
    separator = '|';
4488
  } else {
4489
    separator = ',';
4490
  }
4491
4492
  for (i = 0; i < value.length; i++) {
4493
    if (i === 0) {
4494
      encoded = this.encodeQueryParam(value[i]);
4495
    } else {
4496
      encoded += separator + this.encodeQueryParam(value[i]);
4497
    }
4498
  }
4499
4500
  return encoded;
4501
};
4502
4503
Operation.prototype.encodeQueryCollection = function (type, name, value) {
4504
  var encoded = '';
4505
  var i;
4506
4507
  if (type === 'default' || type === 'multi') {
4508
    for (i = 0; i < value.length; i++) {
4509
      if (i > 0) {encoded += '&';}
4510
4511
      encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4512
    }
4513
  } else {
4514
    var separator = '';
4515
4516
    if (type === 'csv') {
4517
      separator = ',';
4518
    } else if (type === 'ssv') {
4519
      separator = '%20';
4520
    } else if (type === 'tsv') {
4521
      separator = '\\t';
4522
    } else if (type === 'pipes') {
4523
      separator = '|';
4524
    } else if (type === 'brackets') {
4525
      for (i = 0; i < value.length; i++) {
4526
        if (i !== 0) {
4527
          encoded += '&';
4528
        }
4529
4530
        encoded += this.encodeQueryParam(name) + '[]=' + this.encodeQueryParam(value[i]);
4531
      }
4532
    }
4533
4534
    if (separator !== '') {
4535
      for (i = 0; i < value.length; i++) {
4536
        if (i === 0) {
4537
          encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4538
        } else {
4539
          encoded += separator + this.encodeQueryParam(value[i]);
4540
        }
4541
      }
4542
    }
4543
  }
4544
4545
  return encoded;
4546
};
4547
4548
Operation.prototype.encodeQueryParam = function (arg) {
4549
  return encodeURIComponent(arg);
4550
};
4551
4552
/**
4553
 * TODO revisit, might not want to leave '/'
4554
 **/
4555
Operation.prototype.encodePathParam = function (pathParam) {
4556
  return encodeURIComponent(pathParam);
4557
};
4558
4559
},{"../helpers":4,"../http":5,"./model":9,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isEmpty":144,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isUndefined":151}],11:[function(require,module,exports){
4560
'use strict';
4561
4562
var OperationGroup = module.exports = function (tag, description, externalDocs, operation) {
4563
  this.description = description;
4564
  this.externalDocs = externalDocs;
4565
  this.name = tag;
4566
  this.operation = operation;
4567
  this.operationsArray = [];
4568
  this.path = tag;
4569
  this.tag = tag;
4570
};
4571
4572
OperationGroup.prototype.sort = function () {
4573
4574
};
4575
4576
4577
},{}],12:[function(require,module,exports){
4578
4579
},{}],13:[function(require,module,exports){
4580
/*!
4581
 * The buffer module from node.js, for the browser.
4582
 *
4583
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
4584
 * @license  MIT
4585
 */
4586
4587
var base64 = require('base64-js')
4588
var ieee754 = require('ieee754')
4589
var isArray = require('is-array')
4590
4591
exports.Buffer = Buffer
4592
exports.SlowBuffer = SlowBuffer
4593
exports.INSPECT_MAX_BYTES = 50
4594
Buffer.poolSize = 8192 // not used by this implementation
4595
4596
var rootParent = {}
4597
4598
/**
4599
 * If `Buffer.TYPED_ARRAY_SUPPORT`:
4600
 *   === true    Use Uint8Array implementation (fastest)
4601
 *   === false   Use Object implementation (most compatible, even IE6)
4602
 *
4603
 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
4604
 * Opera 11.6+, iOS 4.2+.
4605
 *
4606
 * Note:
4607
 *
4608
 * - Implementation must support adding new properties to `Uint8Array` instances.
4609
 *   Firefox 4-29 lacked support, fixed in Firefox 30+.
4610
 *   See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
4611
 *
4612
 *  - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
4613
 *
4614
 *  - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
4615
 *    incorrect length in some situations.
4616
 *
4617
 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will
4618
 * get the Object implementation, which is slower but will work correctly.
4619
 */
4620
Buffer.TYPED_ARRAY_SUPPORT = (function () {
4621
  function Foo () {}
4622
  try {
4623
    var buf = new ArrayBuffer(0)
4624
    var arr = new Uint8Array(buf)
4625
    arr.foo = function () { return 42 }
4626
    arr.constructor = Foo
4627
    return arr.foo() === 42 && // typed array instances can be augmented
4628
        arr.constructor === Foo && // constructor can be set
4629
        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
4630
        new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
4631
  } catch (e) {
4632
    return false
4633
  }
4634
})()
4635
4636
function kMaxLength () {
4637
  return Buffer.TYPED_ARRAY_SUPPORT
4638
    ? 0x7fffffff
4639
    : 0x3fffffff
4640
}
4641
4642
/**
4643
 * Class: Buffer
4644
 * =============
4645
 *
4646
 * The Buffer constructor returns instances of `Uint8Array` that are augmented
4647
 * with function properties for all the node `Buffer` API functions. We use
4648
 * `Uint8Array` so that square bracket notation works as expected -- it returns
4649
 * a single octet.
4650
 *
4651
 * By augmenting the instances, we can avoid modifying the `Uint8Array`
4652
 * prototype.
4653
 */
4654
function Buffer (arg) {
4655
  if (!(this instanceof Buffer)) {
4656
    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.
4657
    if (arguments.length > 1) return new Buffer(arg, arguments[1])
4658
    return new Buffer(arg)
4659
  }
4660
4661
  this.length = 0
4662
  this.parent = undefined
4663
4664
  // Common case.
4665
  if (typeof arg === 'number') {
4666
    return fromNumber(this, arg)
4667
  }
4668
4669
  // Slightly less common case.
4670
  if (typeof arg === 'string') {
4671
    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
4672
  }
4673
4674
  // Unusual.
4675
  return fromObject(this, arg)
4676
}
4677
4678
function fromNumber (that, length) {
4679
  that = allocate(that, length < 0 ? 0 : checked(length) | 0)
4680
  if (!Buffer.TYPED_ARRAY_SUPPORT) {
4681
    for (var i = 0; i < length; i++) {
4682
      that[i] = 0
4683
    }
4684
  }
4685
  return that
4686
}
4687
4688
function fromString (that, string, encoding) {
4689
  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
4690
4691
  // Assumption: byteLength() return value is always < kMaxLength.
4692
  var length = byteLength(string, encoding) | 0
4693
  that = allocate(that, length)
4694
4695
  that.write(string, encoding)
4696
  return that
4697
}
4698
4699
function fromObject (that, object) {
4700
  if (Buffer.isBuffer(object)) return fromBuffer(that, object)
4701
4702
  if (isArray(object)) return fromArray(that, object)
4703
4704
  if (object == null) {
4705
    throw new TypeError('must start with number, buffer, array or string')
4706
  }
4707
4708
  if (typeof ArrayBuffer !== 'undefined' && object.buffer instanceof ArrayBuffer) {
4709
    return fromTypedArray(that, object)
4710
  }
4711
4712
  if (object.length) return fromArrayLike(that, object)
4713
4714
  return fromJsonObject(that, object)
4715
}
4716
4717
function fromBuffer (that, buffer) {
4718
  var length = checked(buffer.length) | 0
4719
  that = allocate(that, length)
4720
  buffer.copy(that, 0, 0, length)
4721
  return that
4722
}
4723
4724
function fromArray (that, array) {
4725
  var length = checked(array.length) | 0
4726
  that = allocate(that, length)
4727
  for (var i = 0; i < length; i += 1) {
4728
    that[i] = array[i] & 255
4729
  }
4730
  return that
4731
}
4732
4733
// Duplicate of fromArray() to keep fromArray() monomorphic.
4734
function fromTypedArray (that, array) {
4735
  var length = checked(array.length) | 0
4736
  that = allocate(that, length)
4737
  // Truncating the elements is probably not what people expect from typed
4738
  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
4739
  // of the old Buffer constructor.
4740
  for (var i = 0; i < length; i += 1) {
4741
    that[i] = array[i] & 255
4742
  }
4743
  return that
4744
}
4745
4746
function fromArrayLike (that, array) {
4747
  var length = checked(array.length) | 0
4748
  that = allocate(that, length)
4749
  for (var i = 0; i < length; i += 1) {
4750
    that[i] = array[i] & 255
4751
  }
4752
  return that
4753
}
4754
4755
// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
4756
// Returns a zero-length buffer for inputs that don't conform to the spec.
4757
function fromJsonObject (that, object) {
4758
  var array
4759
  var length = 0
4760
4761
  if (object.type === 'Buffer' && isArray(object.data)) {
4762
    array = object.data
4763
    length = checked(array.length) | 0
4764
  }
4765
  that = allocate(that, length)
4766
4767
  for (var i = 0; i < length; i += 1) {
4768
    that[i] = array[i] & 255
4769
  }
4770
  return that
4771
}
4772
4773
function allocate (that, length) {
4774
  if (Buffer.TYPED_ARRAY_SUPPORT) {
4775
    // Return an augmented `Uint8Array` instance, for best performance
4776
    that = Buffer._augment(new Uint8Array(length))
4777
  } else {
4778
    // Fallback: Return an object instance of the Buffer class
4779
    that.length = length
4780
    that._isBuffer = true
4781
  }
4782
4783
  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
4784
  if (fromPool) that.parent = rootParent
4785
4786
  return that
4787
}
4788
4789
function checked (length) {
4790
  // Note: cannot use `length < kMaxLength` here because that fails when
4791
  // length is NaN (which is otherwise coerced to zero.)
4792
  if (length >= kMaxLength()) {
4793
    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
4794
                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
4795
  }
4796
  return length | 0
4797
}
4798
4799
function SlowBuffer (subject, encoding) {
4800
  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
4801
4802
  var buf = new Buffer(subject, encoding)
4803
  delete buf.parent
4804
  return buf
4805
}
4806
4807
Buffer.isBuffer = function isBuffer (b) {
4808
  return !!(b != null && b._isBuffer)
4809
}
4810
4811
Buffer.compare = function compare (a, b) {
4812
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
4813
    throw new TypeError('Arguments must be Buffers')
4814
  }
4815
4816
  if (a === b) return 0
4817
4818
  var x = a.length
4819
  var y = b.length
4820
4821
  var i = 0
4822
  var len = Math.min(x, y)
4823
  while (i < len) {
4824
    if (a[i] !== b[i]) break
4825
4826
    ++i
4827
  }
4828
4829
  if (i !== len) {
4830
    x = a[i]
4831
    y = b[i]
4832
  }
4833
4834
  if (x < y) return -1
4835
  if (y < x) return 1
4836
  return 0
4837
}
4838
4839
Buffer.isEncoding = function isEncoding (encoding) {
4840
  switch (String(encoding).toLowerCase()) {
4841
    case 'hex':
4842
    case 'utf8':
4843
    case 'utf-8':
4844
    case 'ascii':
4845
    case 'binary':
4846
    case 'base64':
4847
    case 'raw':
4848
    case 'ucs2':
4849
    case 'ucs-2':
4850
    case 'utf16le':
4851
    case 'utf-16le':
4852
      return true
4853
    default:
4854
      return false
4855
  }
4856
}
4857
4858
Buffer.concat = function concat (list, length) {
4859
  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
4860
4861
  if (list.length === 0) {
4862
    return new Buffer(0)
4863
  } else if (list.length === 1) {
4864
    return list[0]
4865
  }
4866
4867
  var i
4868
  if (length === undefined) {
4869
    length = 0
4870
    for (i = 0; i < list.length; i++) {
4871
      length += list[i].length
4872
    }
4873
  }
4874
4875
  var buf = new Buffer(length)
4876
  var pos = 0
4877
  for (i = 0; i < list.length; i++) {
4878
    var item = list[i]
4879
    item.copy(buf, pos)
4880
    pos += item.length
4881
  }
4882
  return buf
4883
}
4884
4885
function byteLength (string, encoding) {
4886
  if (typeof string !== 'string') string = '' + string
4887
4888
  var len = string.length
4889
  if (len === 0) return 0
4890
4891
  // Use a for loop to avoid recursion
4892
  var loweredCase = false
4893
  for (;;) {
4894
    switch (encoding) {
4895
      case 'ascii':
4896
      case 'binary':
4897
      // Deprecated
4898
      case 'raw':
4899
      case 'raws':
4900
        return len
4901
      case 'utf8':
4902
      case 'utf-8':
4903
        return utf8ToBytes(string).length
4904
      case 'ucs2':
4905
      case 'ucs-2':
4906
      case 'utf16le':
4907
      case 'utf-16le':
4908
        return len * 2
4909
      case 'hex':
4910
        return len >>> 1
4911
      case 'base64':
4912
        return base64ToBytes(string).length
4913
      default:
4914
        if (loweredCase) return utf8ToBytes(string).length // assume utf8
4915
        encoding = ('' + encoding).toLowerCase()
4916
        loweredCase = true
4917
    }
4918
  }
4919
}
4920
Buffer.byteLength = byteLength
4921
4922
// pre-set for values that may exist in the future
4923
Buffer.prototype.length = undefined
4924
Buffer.prototype.parent = undefined
4925
4926
function slowToString (encoding, start, end) {
4927
  var loweredCase = false
4928
4929
  start = start | 0
4930
  end = end === undefined || end === Infinity ? this.length : end | 0
4931
4932
  if (!encoding) encoding = 'utf8'
4933
  if (start < 0) start = 0
4934
  if (end > this.length) end = this.length
4935
  if (end <= start) return ''
4936
4937
  while (true) {
4938
    switch (encoding) {
4939
      case 'hex':
4940
        return hexSlice(this, start, end)
4941
4942
      case 'utf8':
4943
      case 'utf-8':
4944
        return utf8Slice(this, start, end)
4945
4946
      case 'ascii':
4947
        return asciiSlice(this, start, end)
4948
4949
      case 'binary':
4950
        return binarySlice(this, start, end)
4951
4952
      case 'base64':
4953
        return base64Slice(this, start, end)
4954
4955
      case 'ucs2':
4956
      case 'ucs-2':
4957
      case 'utf16le':
4958
      case 'utf-16le':
4959
        return utf16leSlice(this, start, end)
4960
4961
      default:
4962
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
4963
        encoding = (encoding + '').toLowerCase()
4964
        loweredCase = true
4965
    }
4966
  }
4967
}
4968
4969
Buffer.prototype.toString = function toString () {
4970
  var length = this.length | 0
4971
  if (length === 0) return ''
4972
  if (arguments.length === 0) return utf8Slice(this, 0, length)
4973
  return slowToString.apply(this, arguments)
4974
}
4975
4976
Buffer.prototype.equals = function equals (b) {
4977
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
4978
  if (this === b) return true
4979
  return Buffer.compare(this, b) === 0
4980
}
4981
4982
Buffer.prototype.inspect = function inspect () {
4983
  var str = ''
4984
  var max = exports.INSPECT_MAX_BYTES
4985
  if (this.length > 0) {
4986
    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
4987
    if (this.length > max) str += ' ... '
4988
  }
4989
  return '<Buffer ' + str + '>'
4990
}
4991
4992
Buffer.prototype.compare = function compare (b) {
4993
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
4994
  if (this === b) return 0
4995
  return Buffer.compare(this, b)
4996
}
4997
4998
Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
4999
  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
5000
  else if (byteOffset < -0x80000000) byteOffset = -0x80000000
5001
  byteOffset >>= 0
5002
5003
  if (this.length === 0) return -1
5004
  if (byteOffset >= this.length) return -1
5005
5006
  // Negative offsets start from the end of the buffer
5007
  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
5008
5009
  if (typeof val === 'string') {
5010
    if (val.length === 0) return -1 // special case: looking for empty string always fails
5011
    return String.prototype.indexOf.call(this, val, byteOffset)
5012
  }
5013
  if (Buffer.isBuffer(val)) {
5014
    return arrayIndexOf(this, val, byteOffset)
5015
  }
5016
  if (typeof val === 'number') {
5017
    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
5018
      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
5019
    }
5020
    return arrayIndexOf(this, [ val ], byteOffset)
5021
  }
5022
5023
  function arrayIndexOf (arr, val, byteOffset) {
5024
    var foundIndex = -1
5025
    for (var i = 0; byteOffset + i < arr.length; i++) {
5026
      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
5027
        if (foundIndex === -1) foundIndex = i
5028
        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
5029
      } else {
5030
        foundIndex = -1
5031
      }
5032
    }
5033
    return -1
5034
  }
5035
5036
  throw new TypeError('val must be string, number or Buffer')
5037
}
5038
5039
// `get` will be removed in Node 0.13+
5040
Buffer.prototype.get = function get (offset) {
5041
  console.log('.get() is deprecated. Access using array indexes instead.')
5042
  return this.readUInt8(offset)
5043
}
5044
5045
// `set` will be removed in Node 0.13+
5046
Buffer.prototype.set = function set (v, offset) {
5047
  console.log('.set() is deprecated. Access using array indexes instead.')
5048
  return this.writeUInt8(v, offset)
5049
}
5050
5051
function hexWrite (buf, string, offset, length) {
5052
  offset = Number(offset) || 0
5053
  var remaining = buf.length - offset
5054
  if (!length) {
5055
    length = remaining
5056
  } else {
5057
    length = Number(length)
5058
    if (length > remaining) {
5059
      length = remaining
5060
    }
5061
  }
5062
5063
  // must be an even number of digits
5064
  var strLen = string.length
5065
  if (strLen % 2 !== 0) throw new Error('Invalid hex string')
5066
5067
  if (length > strLen / 2) {
5068
    length = strLen / 2
5069
  }
5070
  for (var i = 0; i < length; i++) {
5071
    var parsed = parseInt(string.substr(i * 2, 2), 16)
5072
    if (isNaN(parsed)) throw new Error('Invalid hex string')
5073
    buf[offset + i] = parsed
5074
  }
5075
  return i
5076
}
5077
5078
function utf8Write (buf, string, offset, length) {
5079
  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
5080
}
5081
5082
function asciiWrite (buf, string, offset, length) {
5083
  return blitBuffer(asciiToBytes(string), buf, offset, length)
5084
}
5085
5086
function binaryWrite (buf, string, offset, length) {
5087
  return asciiWrite(buf, string, offset, length)
5088
}
5089
5090
function base64Write (buf, string, offset, length) {
5091
  return blitBuffer(base64ToBytes(string), buf, offset, length)
5092
}
5093
5094
function ucs2Write (buf, string, offset, length) {
5095
  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
5096
}
5097
5098
Buffer.prototype.write = function write (string, offset, length, encoding) {
5099
  // Buffer#write(string)
5100
  if (offset === undefined) {
5101
    encoding = 'utf8'
5102
    length = this.length
5103
    offset = 0
5104
  // Buffer#write(string, encoding)
5105
  } else if (length === undefined && typeof offset === 'string') {
5106
    encoding = offset
5107
    length = this.length
5108
    offset = 0
5109
  // Buffer#write(string, offset[, length][, encoding])
5110
  } else if (isFinite(offset)) {
5111
    offset = offset | 0
5112
    if (isFinite(length)) {
5113
      length = length | 0
5114
      if (encoding === undefined) encoding = 'utf8'
5115
    } else {
5116
      encoding = length
5117
      length = undefined
5118
    }
5119
  // legacy write(string, encoding, offset, length) - remove in v0.13
5120
  } else {
5121
    var swap = encoding
5122
    encoding = offset
5123
    offset = length | 0
5124
    length = swap
5125
  }
5126
5127
  var remaining = this.length - offset
5128
  if (length === undefined || length > remaining) length = remaining
5129
5130
  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
5131
    throw new RangeError('attempt to write outside buffer bounds')
5132
  }
5133
5134
  if (!encoding) encoding = 'utf8'
5135
5136
  var loweredCase = false
5137
  for (;;) {
5138
    switch (encoding) {
5139
      case 'hex':
5140
        return hexWrite(this, string, offset, length)
5141
5142
      case 'utf8':
5143
      case 'utf-8':
5144
        return utf8Write(this, string, offset, length)
5145
5146
      case 'ascii':
5147
        return asciiWrite(this, string, offset, length)
5148
5149
      case 'binary':
5150
        return binaryWrite(this, string, offset, length)
5151
5152
      case 'base64':
5153
        // Warning: maxLength not taken into account in base64Write
5154
        return base64Write(this, string, offset, length)
5155
5156
      case 'ucs2':
5157
      case 'ucs-2':
5158
      case 'utf16le':
5159
      case 'utf-16le':
5160
        return ucs2Write(this, string, offset, length)
5161
5162
      default:
5163
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5164
        encoding = ('' + encoding).toLowerCase()
5165
        loweredCase = true
5166
    }
5167
  }
5168
}
5169
5170
Buffer.prototype.toJSON = function toJSON () {
5171
  return {
5172
    type: 'Buffer',
5173
    data: Array.prototype.slice.call(this._arr || this, 0)
5174
  }
5175
}
5176
5177
function base64Slice (buf, start, end) {
5178
  if (start === 0 && end === buf.length) {
5179
    return base64.fromByteArray(buf)
5180
  } else {
5181
    return base64.fromByteArray(buf.slice(start, end))
5182
  }
5183
}
5184
5185
function utf8Slice (buf, start, end) {
5186
  var res = ''
5187
  var tmp = ''
5188
  end = Math.min(buf.length, end)
5189
5190
  for (var i = start; i < end; i++) {
5191
    if (buf[i] <= 0x7F) {
5192
      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
5193
      tmp = ''
5194
    } else {
5195
      tmp += '%' + buf[i].toString(16)
5196
    }
5197
  }
5198
5199
  return res + decodeUtf8Char(tmp)
5200
}
5201
5202
function asciiSlice (buf, start, end) {
5203
  var ret = ''
5204
  end = Math.min(buf.length, end)
5205
5206
  for (var i = start; i < end; i++) {
5207
    ret += String.fromCharCode(buf[i] & 0x7F)
5208
  }
5209
  return ret
5210
}
5211
5212
function binarySlice (buf, start, end) {
5213
  var ret = ''
5214
  end = Math.min(buf.length, end)
5215
5216
  for (var i = start; i < end; i++) {
5217
    ret += String.fromCharCode(buf[i])
5218
  }
5219
  return ret
5220
}
5221
5222
function hexSlice (buf, start, end) {
5223
  var len = buf.length
5224
5225
  if (!start || start < 0) start = 0
5226
  if (!end || end < 0 || end > len) end = len
5227
5228
  var out = ''
5229
  for (var i = start; i < end; i++) {
5230
    out += toHex(buf[i])
5231
  }
5232
  return out
5233
}
5234
5235
function utf16leSlice (buf, start, end) {
5236
  var bytes = buf.slice(start, end)
5237
  var res = ''
5238
  for (var i = 0; i < bytes.length; i += 2) {
5239
    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
5240
  }
5241
  return res
5242
}
5243
5244
Buffer.prototype.slice = function slice (start, end) {
5245
  var len = this.length
5246
  start = ~~start
5247
  end = end === undefined ? len : ~~end
5248
5249
  if (start < 0) {
5250
    start += len
5251
    if (start < 0) start = 0
5252
  } else if (start > len) {
5253
    start = len
5254
  }
5255
5256
  if (end < 0) {
5257
    end += len
5258
    if (end < 0) end = 0
5259
  } else if (end > len) {
5260
    end = len
5261
  }
5262
5263
  if (end < start) end = start
5264
5265
  var newBuf
5266
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5267
    newBuf = Buffer._augment(this.subarray(start, end))
5268
  } else {
5269
    var sliceLen = end - start
5270
    newBuf = new Buffer(sliceLen, undefined)
5271
    for (var i = 0; i < sliceLen; i++) {
5272
      newBuf[i] = this[i + start]
5273
    }
5274
  }
5275
5276
  if (newBuf.length) newBuf.parent = this.parent || this
5277
5278
  return newBuf
5279
}
5280
5281
/*
5282
 * Need to make sure that buffer isn't trying to write out of bounds.
5283
 */
5284
function checkOffset (offset, ext, length) {
5285
  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
5286
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
5287
}
5288
5289
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
5290
  offset = offset | 0
5291
  byteLength = byteLength | 0
5292
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5293
5294
  var val = this[offset]
5295
  var mul = 1
5296
  var i = 0
5297
  while (++i < byteLength && (mul *= 0x100)) {
5298
    val += this[offset + i] * mul
5299
  }
5300
5301
  return val
5302
}
5303
5304
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
5305
  offset = offset | 0
5306
  byteLength = byteLength | 0
5307
  if (!noAssert) {
5308
    checkOffset(offset, byteLength, this.length)
5309
  }
5310
5311
  var val = this[offset + --byteLength]
5312
  var mul = 1
5313
  while (byteLength > 0 && (mul *= 0x100)) {
5314
    val += this[offset + --byteLength] * mul
5315
  }
5316
5317
  return val
5318
}
5319
5320
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
5321
  if (!noAssert) checkOffset(offset, 1, this.length)
5322
  return this[offset]
5323
}
5324
5325
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
5326
  if (!noAssert) checkOffset(offset, 2, this.length)
5327
  return this[offset] | (this[offset + 1] << 8)
5328
}
5329
5330
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
5331
  if (!noAssert) checkOffset(offset, 2, this.length)
5332
  return (this[offset] << 8) | this[offset + 1]
5333
}
5334
5335
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
5336
  if (!noAssert) checkOffset(offset, 4, this.length)
5337
5338
  return ((this[offset]) |
5339
      (this[offset + 1] << 8) |
5340
      (this[offset + 2] << 16)) +
5341
      (this[offset + 3] * 0x1000000)
5342
}
5343
5344
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
5345
  if (!noAssert) checkOffset(offset, 4, this.length)
5346
5347
  return (this[offset] * 0x1000000) +
5348
    ((this[offset + 1] << 16) |
5349
    (this[offset + 2] << 8) |
5350
    this[offset + 3])
5351
}
5352
5353
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
5354
  offset = offset | 0
5355
  byteLength = byteLength | 0
5356
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5357
5358
  var val = this[offset]
5359
  var mul = 1
5360
  var i = 0
5361
  while (++i < byteLength && (mul *= 0x100)) {
5362
    val += this[offset + i] * mul
5363
  }
5364
  mul *= 0x80
5365
5366
  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5367
5368
  return val
5369
}
5370
5371
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
5372
  offset = offset | 0
5373
  byteLength = byteLength | 0
5374
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5375
5376
  var i = byteLength
5377
  var mul = 1
5378
  var val = this[offset + --i]
5379
  while (i > 0 && (mul *= 0x100)) {
5380
    val += this[offset + --i] * mul
5381
  }
5382
  mul *= 0x80
5383
5384
  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5385
5386
  return val
5387
}
5388
5389
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
5390
  if (!noAssert) checkOffset(offset, 1, this.length)
5391
  if (!(this[offset] & 0x80)) return (this[offset])
5392
  return ((0xff - this[offset] + 1) * -1)
5393
}
5394
5395
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
5396
  if (!noAssert) checkOffset(offset, 2, this.length)
5397
  var val = this[offset] | (this[offset + 1] << 8)
5398
  return (val & 0x8000) ? val | 0xFFFF0000 : val
5399
}
5400
5401
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
5402
  if (!noAssert) checkOffset(offset, 2, this.length)
5403
  var val = this[offset + 1] | (this[offset] << 8)
5404
  return (val & 0x8000) ? val | 0xFFFF0000 : val
5405
}
5406
5407
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
5408
  if (!noAssert) checkOffset(offset, 4, this.length)
5409
5410
  return (this[offset]) |
5411
    (this[offset + 1] << 8) |
5412
    (this[offset + 2] << 16) |
5413
    (this[offset + 3] << 24)
5414
}
5415
5416
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
5417
  if (!noAssert) checkOffset(offset, 4, this.length)
5418
5419
  return (this[offset] << 24) |
5420
    (this[offset + 1] << 16) |
5421
    (this[offset + 2] << 8) |
5422
    (this[offset + 3])
5423
}
5424
5425
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
5426
  if (!noAssert) checkOffset(offset, 4, this.length)
5427
  return ieee754.read(this, offset, true, 23, 4)
5428
}
5429
5430
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
5431
  if (!noAssert) checkOffset(offset, 4, this.length)
5432
  return ieee754.read(this, offset, false, 23, 4)
5433
}
5434
5435
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
5436
  if (!noAssert) checkOffset(offset, 8, this.length)
5437
  return ieee754.read(this, offset, true, 52, 8)
5438
}
5439
5440
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
5441
  if (!noAssert) checkOffset(offset, 8, this.length)
5442
  return ieee754.read(this, offset, false, 52, 8)
5443
}
5444
5445
function checkInt (buf, value, offset, ext, max, min) {
5446
  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
5447
  if (value > max || value < min) throw new RangeError('value is out of bounds')
5448
  if (offset + ext > buf.length) throw new RangeError('index out of range')
5449
}
5450
5451
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
5452
  value = +value
5453
  offset = offset | 0
5454
  byteLength = byteLength | 0
5455
  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
5456
5457
  var mul = 1
5458
  var i = 0
5459
  this[offset] = value & 0xFF
5460
  while (++i < byteLength && (mul *= 0x100)) {
5461
    this[offset + i] = (value / mul) & 0xFF
5462
  }
5463
5464
  return offset + byteLength
5465
}
5466
5467
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
5468
  value = +value
5469
  offset = offset | 0
5470
  byteLength = byteLength | 0
5471
  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
5472
5473
  var i = byteLength - 1
5474
  var mul = 1
5475
  this[offset + i] = value & 0xFF
5476
  while (--i >= 0 && (mul *= 0x100)) {
5477
    this[offset + i] = (value / mul) & 0xFF
5478
  }
5479
5480
  return offset + byteLength
5481
}
5482
5483
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
5484
  value = +value
5485
  offset = offset | 0
5486
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
5487
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
5488
  this[offset] = value
5489
  return offset + 1
5490
}
5491
5492
function objectWriteUInt16 (buf, value, offset, littleEndian) {
5493
  if (value < 0) value = 0xffff + value + 1
5494
  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
5495
    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
5496
      (littleEndian ? i : 1 - i) * 8
5497
  }
5498
}
5499
5500
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
5501
  value = +value
5502
  offset = offset | 0
5503
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5504
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5505
    this[offset] = value
5506
    this[offset + 1] = (value >>> 8)
5507
  } else {
5508
    objectWriteUInt16(this, value, offset, true)
5509
  }
5510
  return offset + 2
5511
}
5512
5513
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
5514
  value = +value
5515
  offset = offset | 0
5516
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5517
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5518
    this[offset] = (value >>> 8)
5519
    this[offset + 1] = value
5520
  } else {
5521
    objectWriteUInt16(this, value, offset, false)
5522
  }
5523
  return offset + 2
5524
}
5525
5526
function objectWriteUInt32 (buf, value, offset, littleEndian) {
5527
  if (value < 0) value = 0xffffffff + value + 1
5528
  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
5529
    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
5530
  }
5531
}
5532
5533
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
5534
  value = +value
5535
  offset = offset | 0
5536
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5537
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5538
    this[offset + 3] = (value >>> 24)
5539
    this[offset + 2] = (value >>> 16)
5540
    this[offset + 1] = (value >>> 8)
5541
    this[offset] = value
5542
  } else {
5543
    objectWriteUInt32(this, value, offset, true)
5544
  }
5545
  return offset + 4
5546
}
5547
5548
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
5549
  value = +value
5550
  offset = offset | 0
5551
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5552
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5553
    this[offset] = (value >>> 24)
5554
    this[offset + 1] = (value >>> 16)
5555
    this[offset + 2] = (value >>> 8)
5556
    this[offset + 3] = value
5557
  } else {
5558
    objectWriteUInt32(this, value, offset, false)
5559
  }
5560
  return offset + 4
5561
}
5562
5563
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
5564
  value = +value
5565
  offset = offset | 0
5566
  if (!noAssert) {
5567
    var limit = Math.pow(2, 8 * byteLength - 1)
5568
5569
    checkInt(this, value, offset, byteLength, limit - 1, -limit)
5570
  }
5571
5572
  var i = 0
5573
  var mul = 1
5574
  var sub = value < 0 ? 1 : 0
5575
  this[offset] = value & 0xFF
5576
  while (++i < byteLength && (mul *= 0x100)) {
5577
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5578
  }
5579
5580
  return offset + byteLength
5581
}
5582
5583
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
5584
  value = +value
5585
  offset = offset | 0
5586
  if (!noAssert) {
5587
    var limit = Math.pow(2, 8 * byteLength - 1)
5588
5589
    checkInt(this, value, offset, byteLength, limit - 1, -limit)
5590
  }
5591
5592
  var i = byteLength - 1
5593
  var mul = 1
5594
  var sub = value < 0 ? 1 : 0
5595
  this[offset + i] = value & 0xFF
5596
  while (--i >= 0 && (mul *= 0x100)) {
5597
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5598
  }
5599
5600
  return offset + byteLength
5601
}
5602
5603
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
5604
  value = +value
5605
  offset = offset | 0
5606
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
5607
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
5608
  if (value < 0) value = 0xff + value + 1
5609
  this[offset] = value
5610
  return offset + 1
5611
}
5612
5613
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
5614
  value = +value
5615
  offset = offset | 0
5616
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5617
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5618
    this[offset] = value
5619
    this[offset + 1] = (value >>> 8)
5620
  } else {
5621
    objectWriteUInt16(this, value, offset, true)
5622
  }
5623
  return offset + 2
5624
}
5625
5626
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
5627
  value = +value
5628
  offset = offset | 0
5629
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5630
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5631
    this[offset] = (value >>> 8)
5632
    this[offset + 1] = value
5633
  } else {
5634
    objectWriteUInt16(this, value, offset, false)
5635
  }
5636
  return offset + 2
5637
}
5638
5639
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
5640
  value = +value
5641
  offset = offset | 0
5642
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5643
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5644
    this[offset] = value
5645
    this[offset + 1] = (value >>> 8)
5646
    this[offset + 2] = (value >>> 16)
5647
    this[offset + 3] = (value >>> 24)
5648
  } else {
5649
    objectWriteUInt32(this, value, offset, true)
5650
  }
5651
  return offset + 4
5652
}
5653
5654
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
5655
  value = +value
5656
  offset = offset | 0
5657
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5658
  if (value < 0) value = 0xffffffff + value + 1
5659
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5660
    this[offset] = (value >>> 24)
5661
    this[offset + 1] = (value >>> 16)
5662
    this[offset + 2] = (value >>> 8)
5663
    this[offset + 3] = value
5664
  } else {
5665
    objectWriteUInt32(this, value, offset, false)
5666
  }
5667
  return offset + 4
5668
}
5669
5670
function checkIEEE754 (buf, value, offset, ext, max, min) {
5671
  if (value > max || value < min) throw new RangeError('value is out of bounds')
5672
  if (offset + ext > buf.length) throw new RangeError('index out of range')
5673
  if (offset < 0) throw new RangeError('index out of range')
5674
}
5675
5676
function writeFloat (buf, value, offset, littleEndian, noAssert) {
5677
  if (!noAssert) {
5678
    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
5679
  }
5680
  ieee754.write(buf, value, offset, littleEndian, 23, 4)
5681
  return offset + 4
5682
}
5683
5684
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
5685
  return writeFloat(this, value, offset, true, noAssert)
5686
}
5687
5688
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
5689
  return writeFloat(this, value, offset, false, noAssert)
5690
}
5691
5692
function writeDouble (buf, value, offset, littleEndian, noAssert) {
5693
  if (!noAssert) {
5694
    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
5695
  }
5696
  ieee754.write(buf, value, offset, littleEndian, 52, 8)
5697
  return offset + 8
5698
}
5699
5700
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
5701
  return writeDouble(this, value, offset, true, noAssert)
5702
}
5703
5704
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
5705
  return writeDouble(this, value, offset, false, noAssert)
5706
}
5707
5708
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
5709
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
5710
  if (!start) start = 0
5711
  if (!end && end !== 0) end = this.length
5712
  if (targetStart >= target.length) targetStart = target.length
5713
  if (!targetStart) targetStart = 0
5714
  if (end > 0 && end < start) end = start
5715
5716
  // Copy 0 bytes; we're done
5717
  if (end === start) return 0
5718
  if (target.length === 0 || this.length === 0) return 0
5719
5720
  // Fatal error conditions
5721
  if (targetStart < 0) {
5722
    throw new RangeError('targetStart out of bounds')
5723
  }
5724
  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
5725
  if (end < 0) throw new RangeError('sourceEnd out of bounds')
5726
5727
  // Are we oob?
5728
  if (end > this.length) end = this.length
5729
  if (target.length - targetStart < end - start) {
5730
    end = target.length - targetStart + start
5731
  }
5732
5733
  var len = end - start
5734
5735
  if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
5736
    for (var i = 0; i < len; i++) {
5737
      target[i + targetStart] = this[i + start]
5738
    }
5739
  } else {
5740
    target._set(this.subarray(start, start + len), targetStart)
5741
  }
5742
5743
  return len
5744
}
5745
5746
// fill(value, start=0, end=buffer.length)
5747
Buffer.prototype.fill = function fill (value, start, end) {
5748
  if (!value) value = 0
5749
  if (!start) start = 0
5750
  if (!end) end = this.length
5751
5752
  if (end < start) throw new RangeError('end < start')
5753
5754
  // Fill 0 bytes; we're done
5755
  if (end === start) return
5756
  if (this.length === 0) return
5757
5758
  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
5759
  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
5760
5761
  var i
5762
  if (typeof value === 'number') {
5763
    for (i = start; i < end; i++) {
5764
      this[i] = value
5765
    }
5766
  } else {
5767
    var bytes = utf8ToBytes(value.toString())
5768
    var len = bytes.length
5769
    for (i = start; i < end; i++) {
5770
      this[i] = bytes[i % len]
5771
    }
5772
  }
5773
5774
  return this
5775
}
5776
5777
/**
5778
 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
5779
 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
5780
 */
5781
Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
5782
  if (typeof Uint8Array !== 'undefined') {
5783
    if (Buffer.TYPED_ARRAY_SUPPORT) {
5784
      return (new Buffer(this)).buffer
5785
    } else {
5786
      var buf = new Uint8Array(this.length)
5787
      for (var i = 0, len = buf.length; i < len; i += 1) {
5788
        buf[i] = this[i]
5789
      }
5790
      return buf.buffer
5791
    }
5792
  } else {
5793
    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
5794
  }
5795
}
5796
5797
// HELPER FUNCTIONS
5798
// ================
5799
5800
var BP = Buffer.prototype
5801
5802
/**
5803
 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
5804
 */
5805
Buffer._augment = function _augment (arr) {
5806
  arr.constructor = Buffer
5807
  arr._isBuffer = true
5808
5809
  // save reference to original Uint8Array set method before overwriting
5810
  arr._set = arr.set
5811
5812
  // deprecated, will be removed in node 0.13+
5813
  arr.get = BP.get
5814
  arr.set = BP.set
5815
5816
  arr.write = BP.write
5817
  arr.toString = BP.toString
5818
  arr.toLocaleString = BP.toString
5819
  arr.toJSON = BP.toJSON
5820
  arr.equals = BP.equals
5821
  arr.compare = BP.compare
5822
  arr.indexOf = BP.indexOf
5823
  arr.copy = BP.copy
5824
  arr.slice = BP.slice
5825
  arr.readUIntLE = BP.readUIntLE
5826
  arr.readUIntBE = BP.readUIntBE
5827
  arr.readUInt8 = BP.readUInt8
5828
  arr.readUInt16LE = BP.readUInt16LE
5829
  arr.readUInt16BE = BP.readUInt16BE
5830
  arr.readUInt32LE = BP.readUInt32LE
5831
  arr.readUInt32BE = BP.readUInt32BE
5832
  arr.readIntLE = BP.readIntLE
5833
  arr.readIntBE = BP.readIntBE
5834
  arr.readInt8 = BP.readInt8
5835
  arr.readInt16LE = BP.readInt16LE
5836
  arr.readInt16BE = BP.readInt16BE
5837
  arr.readInt32LE = BP.readInt32LE
5838
  arr.readInt32BE = BP.readInt32BE
5839
  arr.readFloatLE = BP.readFloatLE
5840
  arr.readFloatBE = BP.readFloatBE
5841
  arr.readDoubleLE = BP.readDoubleLE
5842
  arr.readDoubleBE = BP.readDoubleBE
5843
  arr.writeUInt8 = BP.writeUInt8
5844
  arr.writeUIntLE = BP.writeUIntLE
5845
  arr.writeUIntBE = BP.writeUIntBE
5846
  arr.writeUInt16LE = BP.writeUInt16LE
5847
  arr.writeUInt16BE = BP.writeUInt16BE
5848
  arr.writeUInt32LE = BP.writeUInt32LE
5849
  arr.writeUInt32BE = BP.writeUInt32BE
5850
  arr.writeIntLE = BP.writeIntLE
5851
  arr.writeIntBE = BP.writeIntBE
5852
  arr.writeInt8 = BP.writeInt8
5853
  arr.writeInt16LE = BP.writeInt16LE
5854
  arr.writeInt16BE = BP.writeInt16BE
5855
  arr.writeInt32LE = BP.writeInt32LE
5856
  arr.writeInt32BE = BP.writeInt32BE
5857
  arr.writeFloatLE = BP.writeFloatLE
5858
  arr.writeFloatBE = BP.writeFloatBE
5859
  arr.writeDoubleLE = BP.writeDoubleLE
5860
  arr.writeDoubleBE = BP.writeDoubleBE
5861
  arr.fill = BP.fill
5862
  arr.inspect = BP.inspect
5863
  arr.toArrayBuffer = BP.toArrayBuffer
5864
5865
  return arr
5866
}
5867
5868
var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
5869
5870
function base64clean (str) {
5871
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
5872
  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
5873
  // Node converts strings with length < 2 to ''
5874
  if (str.length < 2) return ''
5875
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
5876
  while (str.length % 4 !== 0) {
5877
    str = str + '='
5878
  }
5879
  return str
5880
}
5881
5882
function stringtrim (str) {
5883
  if (str.trim) return str.trim()
5884
  return str.replace(/^\s+|\s+$/g, '')
5885
}
5886
5887
function toHex (n) {
5888
  if (n < 16) return '0' + n.toString(16)
5889
  return n.toString(16)
5890
}
5891
5892
function utf8ToBytes (string, units) {
5893
  units = units || Infinity
5894
  var codePoint
5895
  var length = string.length
5896
  var leadSurrogate = null
5897
  var bytes = []
5898
  var i = 0
5899
5900
  for (; i < length; i++) {
5901
    codePoint = string.charCodeAt(i)
5902
5903
    // is surrogate component
5904
    if (codePoint > 0xD7FF && codePoint < 0xE000) {
5905
      // last char was a lead
5906
      if (leadSurrogate) {
5907
        // 2 leads in a row
5908
        if (codePoint < 0xDC00) {
5909
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5910
          leadSurrogate = codePoint
5911
          continue
5912
        } else {
5913
          // valid surrogate pair
5914
          codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
5915
          leadSurrogate = null
5916
        }
5917
      } else {
5918
        // no lead yet
5919
5920
        if (codePoint > 0xDBFF) {
5921
          // unexpected trail
5922
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5923
          continue
5924
        } else if (i + 1 === length) {
5925
          // unpaired lead
5926
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5927
          continue
5928
        } else {
5929
          // valid lead
5930
          leadSurrogate = codePoint
5931
          continue
5932
        }
5933
      }
5934
    } else if (leadSurrogate) {
5935
      // valid bmp char, but last char was a lead
5936
      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5937
      leadSurrogate = null
5938
    }
5939
5940
    // encode utf8
5941
    if (codePoint < 0x80) {
5942
      if ((units -= 1) < 0) break
5943
      bytes.push(codePoint)
5944
    } else if (codePoint < 0x800) {
5945
      if ((units -= 2) < 0) break
5946
      bytes.push(
5947
        codePoint >> 0x6 | 0xC0,
5948
        codePoint & 0x3F | 0x80
5949
      )
5950
    } else if (codePoint < 0x10000) {
5951
      if ((units -= 3) < 0) break
5952
      bytes.push(
5953
        codePoint >> 0xC | 0xE0,
5954
        codePoint >> 0x6 & 0x3F | 0x80,
5955
        codePoint & 0x3F | 0x80
5956
      )
5957
    } else if (codePoint < 0x200000) {
5958
      if ((units -= 4) < 0) break
5959
      bytes.push(
5960
        codePoint >> 0x12 | 0xF0,
5961
        codePoint >> 0xC & 0x3F | 0x80,
5962
        codePoint >> 0x6 & 0x3F | 0x80,
5963
        codePoint & 0x3F | 0x80
5964
      )
5965
    } else {
5966
      throw new Error('Invalid code point')
5967
    }
5968
  }
5969
5970
  return bytes
5971
}
5972
5973
function asciiToBytes (str) {
5974
  var byteArray = []
5975
  for (var i = 0; i < str.length; i++) {
5976
    // Node's code seems to be doing this and not & 0x7F..
5977
    byteArray.push(str.charCodeAt(i) & 0xFF)
5978
  }
5979
  return byteArray
5980
}
5981
5982
function utf16leToBytes (str, units) {
5983
  var c, hi, lo
5984
  var byteArray = []
5985
  for (var i = 0; i < str.length; i++) {
5986
    if ((units -= 2) < 0) break
5987
5988
    c = str.charCodeAt(i)
5989
    hi = c >> 8
5990
    lo = c % 256
5991
    byteArray.push(lo)
5992
    byteArray.push(hi)
5993
  }
5994
5995
  return byteArray
5996
}
5997
5998
function base64ToBytes (str) {
5999
  return base64.toByteArray(base64clean(str))
6000
}
6001
6002
function blitBuffer (src, dst, offset, length) {
6003
  for (var i = 0; i < length; i++) {
6004
    if ((i + offset >= dst.length) || (i >= src.length)) break
6005
    dst[i + offset] = src[i]
6006
  }
6007
  return i
6008
}
6009
6010
function decodeUtf8Char (str) {
6011
  try {
6012
    return decodeURIComponent(str)
6013
  } catch (err) {
6014
    return String.fromCharCode(0xFFFD) // UTF 8 invalid char
6015
  }
6016
}
6017
6018
},{"base64-js":14,"ieee754":15,"is-array":16}],14:[function(require,module,exports){
6019
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6020
6021
;(function (exports) {
6022
	'use strict';
6023
6024
  var Arr = (typeof Uint8Array !== 'undefined')
6025
    ? Uint8Array
6026
    : Array
6027
6028
	var PLUS   = '+'.charCodeAt(0)
6029
	var SLASH  = '/'.charCodeAt(0)
6030
	var NUMBER = '0'.charCodeAt(0)
6031
	var LOWER  = 'a'.charCodeAt(0)
6032
	var UPPER  = 'A'.charCodeAt(0)
6033
	var PLUS_URL_SAFE = '-'.charCodeAt(0)
6034
	var SLASH_URL_SAFE = '_'.charCodeAt(0)
6035
6036
	function decode (elt) {
6037
		var code = elt.charCodeAt(0)
6038
		if (code === PLUS ||
6039
		    code === PLUS_URL_SAFE)
6040
			return 62 // '+'
6041
		if (code === SLASH ||
6042
		    code === SLASH_URL_SAFE)
6043
			return 63 // '/'
6044
		if (code < NUMBER)
6045
			return -1 //no match
6046
		if (code < NUMBER + 10)
6047
			return code - NUMBER + 26 + 26
6048
		if (code < UPPER + 26)
6049
			return code - UPPER
6050
		if (code < LOWER + 26)
6051
			return code - LOWER + 26
6052
	}
6053
6054
	function b64ToByteArray (b64) {
6055
		var i, j, l, tmp, placeHolders, arr
6056
6057
		if (b64.length % 4 > 0) {
6058
			throw new Error('Invalid string. Length must be a multiple of 4')
6059
		}
6060
6061
		// the number of equal signs (place holders)
6062
		// if there are two placeholders, than the two characters before it
6063
		// represent one byte
6064
		// if there is only one, then the three characters before it represent 2 bytes
6065
		// this is just a cheap hack to not do indexOf twice
6066
		var len = b64.length
6067
		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
6068
6069
		// base64 is 4/3 + up to two characters of the original data
6070
		arr = new Arr(b64.length * 3 / 4 - placeHolders)
6071
6072
		// if there are placeholders, only get up to the last complete 4 chars
6073
		l = placeHolders > 0 ? b64.length - 4 : b64.length
6074
6075
		var L = 0
6076
6077
		function push (v) {
6078
			arr[L++] = v
6079
		}
6080
6081
		for (i = 0, j = 0; i < l; i += 4, j += 3) {
6082
			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
6083
			push((tmp & 0xFF0000) >> 16)
6084
			push((tmp & 0xFF00) >> 8)
6085
			push(tmp & 0xFF)
6086
		}
6087
6088
		if (placeHolders === 2) {
6089
			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
6090
			push(tmp & 0xFF)
6091
		} else if (placeHolders === 1) {
6092
			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
6093
			push((tmp >> 8) & 0xFF)
6094
			push(tmp & 0xFF)
6095
		}
6096
6097
		return arr
6098
	}
6099
6100
	function uint8ToBase64 (uint8) {
6101
		var i,
6102
			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
6103
			output = "",
6104
			temp, length
6105
6106
		function encode (num) {
6107
			return lookup.charAt(num)
6108
		}
6109
6110
		function tripletToBase64 (num) {
6111
			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
6112
		}
6113
6114
		// go through the array every three bytes, we'll deal with trailing stuff later
6115
		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
6116
			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
6117
			output += tripletToBase64(temp)
6118
		}
6119
6120
		// pad the end with zeros, but make sure to not forget the extra bytes
6121
		switch (extraBytes) {
6122
			case 1:
6123
				temp = uint8[uint8.length - 1]
6124
				output += encode(temp >> 2)
6125
				output += encode((temp << 4) & 0x3F)
6126
				output += '=='
6127
				break
6128
			case 2:
6129
				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
6130
				output += encode(temp >> 10)
6131
				output += encode((temp >> 4) & 0x3F)
6132
				output += encode((temp << 2) & 0x3F)
6133
				output += '='
6134
				break
6135
		}
6136
6137
		return output
6138
	}
6139
6140
	exports.toByteArray = b64ToByteArray
6141
	exports.fromByteArray = uint8ToBase64
6142
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
6143
6144
},{}],15:[function(require,module,exports){
6145
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
6146
  var e, m
6147
  var eLen = nBytes * 8 - mLen - 1
6148
  var eMax = (1 << eLen) - 1
6149
  var eBias = eMax >> 1
6150
  var nBits = -7
6151
  var i = isLE ? (nBytes - 1) : 0
6152
  var d = isLE ? -1 : 1
6153
  var s = buffer[offset + i]
6154
6155
  i += d
6156
6157
  e = s & ((1 << (-nBits)) - 1)
6158
  s >>= (-nBits)
6159
  nBits += eLen
6160
  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6161
6162
  m = e & ((1 << (-nBits)) - 1)
6163
  e >>= (-nBits)
6164
  nBits += mLen
6165
  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6166
6167
  if (e === 0) {
6168
    e = 1 - eBias
6169
  } else if (e === eMax) {
6170
    return m ? NaN : ((s ? -1 : 1) * Infinity)
6171
  } else {
6172
    m = m + Math.pow(2, mLen)
6173
    e = e - eBias
6174
  }
6175
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
6176
}
6177
6178
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6179
  var e, m, c
6180
  var eLen = nBytes * 8 - mLen - 1
6181
  var eMax = (1 << eLen) - 1
6182
  var eBias = eMax >> 1
6183
  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
6184
  var i = isLE ? 0 : (nBytes - 1)
6185
  var d = isLE ? 1 : -1
6186
  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
6187
6188
  value = Math.abs(value)
6189
6190
  if (isNaN(value) || value === Infinity) {
6191
    m = isNaN(value) ? 1 : 0
6192
    e = eMax
6193
  } else {
6194
    e = Math.floor(Math.log(value) / Math.LN2)
6195
    if (value * (c = Math.pow(2, -e)) < 1) {
6196
      e--
6197
      c *= 2
6198
    }
6199
    if (e + eBias >= 1) {
6200
      value += rt / c
6201
    } else {
6202
      value += rt * Math.pow(2, 1 - eBias)
6203
    }
6204
    if (value * c >= 2) {
6205
      e++
6206
      c /= 2
6207
    }
6208
6209
    if (e + eBias >= eMax) {
6210
      m = 0
6211
      e = eMax
6212
    } else if (e + eBias >= 1) {
6213
      m = (value * c - 1) * Math.pow(2, mLen)
6214
      e = e + eBias
6215
    } else {
6216
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
6217
      e = 0
6218
    }
6219
  }
6220
6221
  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
6222
6223
  e = (e << mLen) | m
6224
  eLen += mLen
6225
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
6226
6227
  buffer[offset + i - d] |= s * 128
6228
}
6229
6230
},{}],16:[function(require,module,exports){
6231
6232
/**
6233
 * isArray
6234
 */
6235
6236
var isArray = Array.isArray;
6237
6238
/**
6239
 * toString
6240
 */
6241
6242
var str = Object.prototype.toString;
6243
6244
/**
6245
 * Whether or not the given `val`
6246
 * is an array.
6247
 *
6248
 * example:
6249
 *
6250
 *        isArray([]);
6251
 *        // > true
6252
 *        isArray(arguments);
6253
 *        // > false
6254
 *        isArray('');
6255
 *        // > false
6256
 *
6257
 * @param {mixed} val
6258
 * @return {bool}
6259
 */
6260
6261
module.exports = isArray || function (val) {
6262
  return !! val && '[object Array]' == str.call(val);
6263
};
6264
6265
},{}],17:[function(require,module,exports){
6266
// shim for using process in browser
6267
6268
var process = module.exports = {};
6269
var queue = [];
6270
var draining = false;
6271
6272
function drainQueue() {
6273
    if (draining) {
6274
        return;
6275
    }
6276
    draining = true;
6277
    var currentQueue;
6278
    var len = queue.length;
6279
    while(len) {
6280
        currentQueue = queue;
6281
        queue = [];
6282
        var i = -1;
6283
        while (++i < len) {
6284
            currentQueue[i]();
6285
        }
6286
        len = queue.length;
6287
    }
6288
    draining = false;
6289
}
6290
process.nextTick = function (fun) {
6291
    queue.push(fun);
6292
    if (!draining) {
6293
        setTimeout(drainQueue, 0);
6294
    }
6295
};
6296
6297
process.title = 'browser';
6298
process.browser = true;
6299
process.env = {};
6300
process.argv = [];
6301
process.version = ''; // empty string to avoid regexp issues
6302
process.versions = {};
6303
6304
function noop() {}
6305
6306
process.on = noop;
6307
process.addListener = noop;
6308
process.once = noop;
6309
process.off = noop;
6310
process.removeListener = noop;
6311
process.removeAllListeners = noop;
6312
process.emit = noop;
6313
6314
process.binding = function (name) {
6315
    throw new Error('process.binding is not supported');
6316
};
6317
6318
// TODO(shtylman)
6319
process.cwd = function () { return '/' };
6320
process.chdir = function (dir) {
6321
    throw new Error('process.chdir is not supported');
6322
};
6323
process.umask = function() { return 0; };
6324
6325
},{}],18:[function(require,module,exports){
6326
(function (Buffer){
6327
(function () {
6328
  "use strict";
6329
6330
  function btoa(str) {
6331
    var buffer
6332
      ;
6333
6334
    if (str instanceof Buffer) {
6335
      buffer = str;
6336
    } else {
6337
      buffer = new Buffer(str.toString(), 'binary');
6338
    }
6339
6340
    return buffer.toString('base64');
6341
  }
6342
6343
  module.exports = btoa;
6344
}());
6345
6346
}).call(this,require("buffer").Buffer)
6347
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idG9hL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uICgpIHtcbiAgXCJ1c2Ugc3RyaWN0XCI7XG5cbiAgZnVuY3Rpb24gYnRvYShzdHIpIHtcbiAgICB2YXIgYnVmZmVyXG4gICAgICA7XG5cbiAgICBpZiAoc3RyIGluc3RhbmNlb2YgQnVmZmVyKSB7XG4gICAgICBidWZmZXIgPSBzdHI7XG4gICAgfSBlbHNlIHtcbiAgICAgIGJ1ZmZlciA9IG5ldyBCdWZmZXIoc3RyLnRvU3RyaW5nKCksICdiaW5hcnknKTtcbiAgICB9XG5cbiAgICByZXR1cm4gYnVmZmVyLnRvU3RyaW5nKCdiYXNlNjQnKTtcbiAgfVxuXG4gIG1vZHVsZS5leHBvcnRzID0gYnRvYTtcbn0oKSk7XG4iXX0=
6348
},{"buffer":13}],19:[function(require,module,exports){
6349
/* jshint node: true */
6350
(function () {
6351
    "use strict";
6352
6353
    function CookieAccessInfo(domain, path, secure, script) {
6354
        if (this instanceof CookieAccessInfo) {
6355
            this.domain = domain || undefined;
6356
            this.path = path || "/";
6357
            this.secure = !!secure;
6358
            this.script = !!script;
6359
            return this;
6360
        }
6361
        return new CookieAccessInfo(domain, path, secure, script);
6362
    }
6363
    exports.CookieAccessInfo = CookieAccessInfo;
6364
6365
    function Cookie(cookiestr, request_domain, request_path) {
6366
        if (cookiestr instanceof Cookie) {
6367
            return cookiestr;
6368
        }
6369
        if (this instanceof Cookie) {
6370
            this.name = null;
6371
            this.value = null;
6372
            this.expiration_date = Infinity;
6373
            this.path = String(request_path || "/");
6374
            this.explicit_path = false;
6375
            this.domain = request_domain || null;
6376
            this.explicit_domain = false;
6377
            this.secure = false; //how to define default?
6378
            this.noscript = false; //httponly
6379
            if (cookiestr) {
6380
                this.parse(cookiestr, request_domain, request_path);
6381
            }
6382
            return this;
6383
        }
6384
        return new Cookie(cookiestr);
6385
    }
6386
    exports.Cookie = Cookie;
6387
6388
    Cookie.prototype.toString = function toString() {
6389
        var str = [this.name + "=" + this.value];
6390
        if (this.expiration_date !== Infinity) {
6391
            str.push("expires=" + (new Date(this.expiration_date)).toGMTString());
6392
        }
6393
        if (this.domain) {
6394
            str.push("domain=" + this.domain);
6395
        }
6396
        if (this.path) {
6397
            str.push("path=" + this.path);
6398
        }
6399
        if (this.secure) {
6400
            str.push("secure");
6401
        }
6402
        if (this.noscript) {
6403
            str.push("httponly");
6404
        }
6405
        return str.join("; ");
6406
    };
6407
6408
    Cookie.prototype.toValueString = function toValueString() {
6409
        return this.name + "=" + this.value;
6410
    };
6411
6412
    var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
6413
    Cookie.prototype.parse = function parse(str, request_domain, request_path) {
6414
        if (this instanceof Cookie) {
6415
            var parts = str.split(";").filter(function (value) {
6416
                    return !!value;
6417
                }),
6418
                pair = parts[0].match(/([^=]+)=([\s\S]*)/),
6419
                key = pair[1],
6420
                value = pair[2],
6421
                i;
6422
            this.name = key;
6423
            this.value = value;
6424
6425
            for (i = 1; i < parts.length; i += 1) {
6426
                pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/);
6427
                key = pair[1].trim().toLowerCase();
6428
                value = pair[2];
6429
                switch (key) {
6430
                case "httponly":
6431
                    this.noscript = true;
6432
                    break;
6433
                case "expires":
6434
                    this.expiration_date = value ?
6435
                            Number(Date.parse(value)) :
6436
                            Infinity;
6437
                    break;
6438
                case "path":
6439
                    this.path = value ?
6440
                            value.trim() :
6441
                            "";
6442
                    this.explicit_path = true;
6443
                    break;
6444
                case "domain":
6445
                    this.domain = value ?
6446
                            value.trim() :
6447
                            "";
6448
                    this.explicit_domain = !!this.domain;
6449
                    break;
6450
                case "secure":
6451
                    this.secure = true;
6452
                    break;
6453
                }
6454
            }
6455
6456
            if (!this.explicit_path) {
6457
               this.path = request_path || "/";
6458
            }
6459
            if (!this.explicit_domain) {
6460
               this.domain = request_domain;
6461
            }
6462
6463
            return this;
6464
        }
6465
        return new Cookie().parse(str, request_domain, request_path);
6466
    };
6467
6468
    Cookie.prototype.matches = function matches(access_info) {
6469
        if (this.noscript && access_info.script ||
6470
                this.secure && !access_info.secure ||
6471
                !this.collidesWith(access_info)) {
6472
            return false;
6473
        }
6474
        return true;
6475
    };
6476
6477
    Cookie.prototype.collidesWith = function collidesWith(access_info) {
6478
        if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
6479
            return false;
6480
        }
6481
        if (this.path && access_info.path.indexOf(this.path) !== 0) {
6482
            return false;
6483
        }
6484
        if (!this.explicit_path) {
6485
           if (this.path !== access_info.path) {
6486
               return false;
6487
           }
6488
        }
6489
        var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
6490
        var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
6491
        if (cookie_domain === access_domain) {
6492
            return true;
6493
        }
6494
        if (cookie_domain) {
6495
            if (!this.explicit_domain) {
6496
                return false; // we already checked if the domains were exactly the same
6497
            }
6498
            var wildcard = access_domain.indexOf(cookie_domain);
6499
            if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) {
6500
                return false;
6501
            }
6502
            return true;
6503
        }
6504
        return true;
6505
    };
6506
6507
    function CookieJar() {
6508
        var cookies, cookies_list, collidable_cookie;
6509
        if (this instanceof CookieJar) {
6510
            cookies = Object.create(null); //name: [Cookie]
6511
6512
            this.setCookie = function setCookie(cookie, request_domain, request_path) {
6513
                var remove, i;
6514
                cookie = new Cookie(cookie, request_domain, request_path);
6515
                //Delete the cookie if the set is past the current time
6516
                remove = cookie.expiration_date <= Date.now();
6517
                if (cookies[cookie.name] !== undefined) {
6518
                    cookies_list = cookies[cookie.name];
6519
                    for (i = 0; i < cookies_list.length; i += 1) {
6520
                        collidable_cookie = cookies_list[i];
6521
                        if (collidable_cookie.collidesWith(cookie)) {
6522
                            if (remove) {
6523
                                cookies_list.splice(i, 1);
6524
                                if (cookies_list.length === 0) {
6525
                                    delete cookies[cookie.name];
6526
                                }
6527
                                return false;
6528
                            }
6529
                            cookies_list[i] = cookie;
6530
                            return cookie;
6531
                        }
6532
                    }
6533
                    if (remove) {
6534
                        return false;
6535
                    }
6536
                    cookies_list.push(cookie);
6537
                    return cookie;
6538
                }
6539
                if (remove) {
6540
                    return false;
6541
                }
6542
                cookies[cookie.name] = [cookie];
6543
                return cookies[cookie.name];
6544
            };
6545
            //returns a cookie
6546
            this.getCookie = function getCookie(cookie_name, access_info) {
6547
                var cookie, i;
6548
                cookies_list = cookies[cookie_name];
6549
                if (!cookies_list) {
6550
                    return;
6551
                }
6552
                for (i = 0; i < cookies_list.length; i += 1) {
6553
                    cookie = cookies_list[i];
6554
                    if (cookie.expiration_date <= Date.now()) {
6555
                        if (cookies_list.length === 0) {
6556
                            delete cookies[cookie.name];
6557
                        }
6558
                        continue;
6559
                    }
6560
                    if (cookie.matches(access_info)) {
6561
                        return cookie;
6562
                    }
6563
                }
6564
            };
6565
            //returns a list of cookies
6566
            this.getCookies = function getCookies(access_info) {
6567
                var matches = [], cookie_name, cookie;
6568
                for (cookie_name in cookies) {
6569
                    cookie = this.getCookie(cookie_name, access_info);
6570
                    if (cookie) {
6571
                        matches.push(cookie);
6572
                    }
6573
                }
6574
                matches.toString = function toString() {
6575
                    return matches.join(":");
6576
                };
6577
                matches.toValueString = function toValueString() {
6578
                    return matches.map(function (c) {
6579
                        return c.toValueString();
6580
                    }).join(';');
6581
                };
6582
                return matches;
6583
            };
6584
6585
            return this;
6586
        }
6587
        return new CookieJar();
6588
    }
6589
    exports.CookieJar = CookieJar;
6590
6591
    //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned.
6592
    CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) {
6593
        cookies = Array.isArray(cookies) ?
6594
                cookies :
6595
                cookies.split(cookie_str_splitter);
6596
        var successful = [],
6597
            i,
6598
            cookie;
6599
        cookies = cookies.map(Cookie);
6600
        for (i = 0; i < cookies.length; i += 1) {
6601
            cookie = cookies[i];
6602
            if (this.setCookie(cookie, request_domain, request_path)) {
6603
                successful.push(cookie);
6604
            }
6605
        }
6606
        return successful;
6607
    };
6608
}());
6609
6610
},{}],20:[function(require,module,exports){
6611
/*!
6612
 * jQuery JavaScript Library v2.1.4
6613
 * http://jquery.com/
6614
 *
6615
 * Includes Sizzle.js
6616
 * http://sizzlejs.com/
6617
 *
6618
 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
6619
 * Released under the MIT license
6620
 * http://jquery.org/license
6621
 *
6622
 * Date: 2015-04-28T16:01Z
6623
 */
6624
6625
(function( global, factory ) {
6626
6627
	if ( typeof module === "object" && typeof module.exports === "object" ) {
6628
		// For CommonJS and CommonJS-like environments where a proper `window`
6629
		// is present, execute the factory and get jQuery.
6630
		// For environments that do not have a `window` with a `document`
6631
		// (such as Node.js), expose a factory as module.exports.
6632
		// This accentuates the need for the creation of a real `window`.
6633
		// e.g. var jQuery = require("jquery")(window);
6634
		// See ticket #14549 for more info.
6635
		module.exports = global.document ?
6636
			factory( global, true ) :
6637
			function( w ) {
6638
				if ( !w.document ) {
6639
					throw new Error( "jQuery requires a window with a document" );
6640
				}
6641
				return factory( w );
6642
			};
6643
	} else {
6644
		factory( global );
6645
	}
6646
6647
// Pass this if window is not defined yet
6648
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
6649
6650
// Support: Firefox 18+
6651
// Can't be in strict mode, several libs including ASP.NET trace
6652
// the stack via arguments.caller.callee and Firefox dies if
6653
// you try to trace through "use strict" call chains. (#13335)
6654
//
6655
6656
var arr = [];
6657
6658
var slice = arr.slice;
6659
6660
var concat = arr.concat;
6661
6662
var push = arr.push;
6663
6664
var indexOf = arr.indexOf;
6665
6666
var class2type = {};
6667
6668
var toString = class2type.toString;
6669
6670
var hasOwn = class2type.hasOwnProperty;
6671
6672
var support = {};
6673
6674
6675
6676
var
6677
	// Use the correct document accordingly with window argument (sandbox)
6678
	document = window.document,
6679
6680
	version = "2.1.4",
6681
6682
	// Define a local copy of jQuery
6683
	jQuery = function( selector, context ) {
6684
		// The jQuery object is actually just the init constructor 'enhanced'
6685
		// Need init if jQuery is called (just allow error to be thrown if not included)
6686
		return new jQuery.fn.init( selector, context );
6687
	},
6688
6689
	// Support: Android<4.1
6690
	// Make sure we trim BOM and NBSP
6691
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
6692
6693
	// Matches dashed string for camelizing
6694
	rmsPrefix = /^-ms-/,
6695
	rdashAlpha = /-([\da-z])/gi,
6696
6697
	// Used by jQuery.camelCase as callback to replace()
6698
	fcamelCase = function( all, letter ) {
6699
		return letter.toUpperCase();
6700
	};
6701
6702
jQuery.fn = jQuery.prototype = {
6703
	// The current version of jQuery being used
6704
	jquery: version,
6705
6706
	constructor: jQuery,
6707
6708
	// Start with an empty selector
6709
	selector: "",
6710
6711
	// The default length of a jQuery object is 0
6712
	length: 0,
6713
6714
	toArray: function() {
6715
		return slice.call( this );
6716
	},
6717
6718
	// Get the Nth element in the matched element set OR
6719
	// Get the whole matched element set as a clean array
6720
	get: function( num ) {
6721
		return num != null ?
6722
6723
			// Return just the one element from the set
6724
			( num < 0 ? this[ num + this.length ] : this[ num ] ) :
6725
6726
			// Return all the elements in a clean array
6727
			slice.call( this );
6728
	},
6729
6730
	// Take an array of elements and push it onto the stack
6731
	// (returning the new matched element set)
6732
	pushStack: function( elems ) {
6733
6734
		// Build a new jQuery matched element set
6735
		var ret = jQuery.merge( this.constructor(), elems );
6736
6737
		// Add the old object onto the stack (as a reference)
6738
		ret.prevObject = this;
6739
		ret.context = this.context;
6740
6741
		// Return the newly-formed element set
6742
		return ret;
6743
	},
6744
6745
	// Execute a callback for every element in the matched set.
6746
	// (You can seed the arguments with an array of args, but this is
6747
	// only used internally.)
6748
	each: function( callback, args ) {
6749
		return jQuery.each( this, callback, args );
6750
	},
6751
6752
	map: function( callback ) {
6753
		return this.pushStack( jQuery.map(this, function( elem, i ) {
6754
			return callback.call( elem, i, elem );
6755
		}));
6756
	},
6757
6758
	slice: function() {
6759
		return this.pushStack( slice.apply( this, arguments ) );
6760
	},
6761
6762
	first: function() {
6763
		return this.eq( 0 );
6764
	},
6765
6766
	last: function() {
6767
		return this.eq( -1 );
6768
	},
6769
6770
	eq: function( i ) {
6771
		var len = this.length,
6772
			j = +i + ( i < 0 ? len : 0 );
6773
		return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
6774
	},
6775
6776
	end: function() {
6777
		return this.prevObject || this.constructor(null);
6778
	},
6779
6780
	// For internal use only.
6781
	// Behaves like an Array's method, not like a jQuery method.
6782
	push: push,
6783
	sort: arr.sort,
6784
	splice: arr.splice
6785
};
6786
6787
jQuery.extend = jQuery.fn.extend = function() {
6788
	var options, name, src, copy, copyIsArray, clone,
6789
		target = arguments[0] || {},
6790
		i = 1,
6791
		length = arguments.length,
6792
		deep = false;
6793
6794
	// Handle a deep copy situation
6795
	if ( typeof target === "boolean" ) {
6796
		deep = target;
6797
6798
		// Skip the boolean and the target
6799
		target = arguments[ i ] || {};
6800
		i++;
6801
	}
6802
6803
	// Handle case when target is a string or something (possible in deep copy)
6804
	if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
6805
		target = {};
6806
	}
6807
6808
	// Extend jQuery itself if only one argument is passed
6809
	if ( i === length ) {
6810
		target = this;
6811
		i--;
6812
	}
6813
6814
	for ( ; i < length; i++ ) {
6815
		// Only deal with non-null/undefined values
6816
		if ( (options = arguments[ i ]) != null ) {
6817
			// Extend the base object
6818
			for ( name in options ) {
6819
				src = target[ name ];
6820
				copy = options[ name ];
6821
6822
				// Prevent never-ending loop
6823
				if ( target === copy ) {
6824
					continue;
6825
				}
6826
6827
				// Recurse if we're merging plain objects or arrays
6828
				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
6829
					if ( copyIsArray ) {
6830
						copyIsArray = false;
6831
						clone = src && jQuery.isArray(src) ? src : [];
6832
6833
					} else {
6834
						clone = src && jQuery.isPlainObject(src) ? src : {};
6835
					}
6836
6837
					// Never move original objects, clone them
6838
					target[ name ] = jQuery.extend( deep, clone, copy );
6839
6840
				// Don't bring in undefined values
6841
				} else if ( copy !== undefined ) {
6842
					target[ name ] = copy;
6843
				}
6844
			}
6845
		}
6846
	}
6847
6848
	// Return the modified object
6849
	return target;
6850
};
6851
6852
jQuery.extend({
6853
	// Unique for each copy of jQuery on the page
6854
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
6855
6856
	// Assume jQuery is ready without the ready module
6857
	isReady: true,
6858
6859
	error: function( msg ) {
6860
		throw new Error( msg );
6861
	},
6862
6863
	noop: function() {},
6864
6865
	isFunction: function( obj ) {
6866
		return jQuery.type(obj) === "function";
6867
	},
6868
6869
	isArray: Array.isArray,
6870
6871
	isWindow: function( obj ) {
6872
		return obj != null && obj === obj.window;
6873
	},
6874
6875
	isNumeric: function( obj ) {
6876
		// parseFloat NaNs numeric-cast false positives (null|true|false|"")
6877
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
6878
		// subtraction forces infinities to NaN
6879
		// adding 1 corrects loss of precision from parseFloat (#15100)
6880
		return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
6881
	},
6882
6883
	isPlainObject: function( obj ) {
6884
		// Not plain objects:
6885
		// - Any object or value whose internal [[Class]] property is not "[object Object]"
6886
		// - DOM nodes
6887
		// - window
6888
		if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
6889
			return false;
6890
		}
6891
6892
		if ( obj.constructor &&
6893
				!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
6894
			return false;
6895
		}
6896
6897
		// If the function hasn't returned already, we're confident that
6898
		// |obj| is a plain object, created by {} or constructed with new Object
6899
		return true;
6900
	},
6901
6902
	isEmptyObject: function( obj ) {
6903
		var name;
6904
		for ( name in obj ) {
6905
			return false;
6906
		}
6907
		return true;
6908
	},
6909
6910
	type: function( obj ) {
6911
		if ( obj == null ) {
6912
			return obj + "";
6913
		}
6914
		// Support: Android<4.0, iOS<6 (functionish RegExp)
6915
		return typeof obj === "object" || typeof obj === "function" ?
6916
			class2type[ toString.call(obj) ] || "object" :
6917
			typeof obj;
6918
	},
6919
6920
	// Evaluates a script in a global context
6921
	globalEval: function( code ) {
6922
		var script,
6923
			indirect = eval;
6924
6925
		code = jQuery.trim( code );
6926
6927
		if ( code ) {
6928
			// If the code includes a valid, prologue position
6929
			// strict mode pragma, execute code by injecting a
6930
			// script tag into the document.
6931
			if ( code.indexOf("use strict") === 1 ) {
6932
				script = document.createElement("script");
6933
				script.text = code;
6934
				document.head.appendChild( script ).parentNode.removeChild( script );
6935
			} else {
6936
			// Otherwise, avoid the DOM node creation, insertion
6937
			// and removal by using an indirect global eval
6938
				indirect( code );
6939
			}
6940
		}
6941
	},
6942
6943
	// Convert dashed to camelCase; used by the css and data modules
6944
	// Support: IE9-11+
6945
	// Microsoft forgot to hump their vendor prefix (#9572)
6946
	camelCase: function( string ) {
6947
		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
6948
	},
6949
6950
	nodeName: function( elem, name ) {
6951
		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
6952
	},
6953
6954
	// args is for internal usage only
6955
	each: function( obj, callback, args ) {
6956
		var value,
6957
			i = 0,
6958
			length = obj.length,
6959
			isArray = isArraylike( obj );
6960
6961
		if ( args ) {
6962
			if ( isArray ) {
6963
				for ( ; i < length; i++ ) {
6964
					value = callback.apply( obj[ i ], args );
6965
6966
					if ( value === false ) {
6967
						break;
6968
					}
6969
				}
6970
			} else {
6971
				for ( i in obj ) {
6972
					value = callback.apply( obj[ i ], args );
6973
6974
					if ( value === false ) {
6975
						break;
6976
					}
6977
				}
6978
			}
6979
6980
		// A special, fast, case for the most common use of each
6981
		} else {
6982
			if ( isArray ) {
6983
				for ( ; i < length; i++ ) {
6984
					value = callback.call( obj[ i ], i, obj[ i ] );
6985
6986
					if ( value === false ) {
6987
						break;
6988
					}
6989
				}
6990
			} else {
6991
				for ( i in obj ) {
6992
					value = callback.call( obj[ i ], i, obj[ i ] );
6993
6994
					if ( value === false ) {
6995
						break;
6996
					}
6997
				}
6998
			}
6999
		}
7000
7001
		return obj;
7002
	},
7003
7004
	// Support: Android<4.1
7005
	trim: function( text ) {
7006
		return text == null ?
7007
			"" :
7008
			( text + "" ).replace( rtrim, "" );
7009
	},
7010
7011
	// results is for internal usage only
7012
	makeArray: function( arr, results ) {
7013
		var ret = results || [];
7014
7015
		if ( arr != null ) {
7016
			if ( isArraylike( Object(arr) ) ) {
7017
				jQuery.merge( ret,
7018
					typeof arr === "string" ?
7019
					[ arr ] : arr
7020
				);
7021
			} else {
7022
				push.call( ret, arr );
7023
			}
7024
		}
7025
7026
		return ret;
7027
	},
7028
7029
	inArray: function( elem, arr, i ) {
7030
		return arr == null ? -1 : indexOf.call( arr, elem, i );
7031
	},
7032
7033
	merge: function( first, second ) {
7034
		var len = +second.length,
7035
			j = 0,
7036
			i = first.length;
7037
7038
		for ( ; j < len; j++ ) {
7039
			first[ i++ ] = second[ j ];
7040
		}
7041
7042
		first.length = i;
7043
7044
		return first;
7045
	},
7046
7047
	grep: function( elems, callback, invert ) {
7048
		var callbackInverse,
7049
			matches = [],
7050
			i = 0,
7051
			length = elems.length,
7052
			callbackExpect = !invert;
7053
7054
		// Go through the array, only saving the items
7055
		// that pass the validator function
7056
		for ( ; i < length; i++ ) {
7057
			callbackInverse = !callback( elems[ i ], i );
7058
			if ( callbackInverse !== callbackExpect ) {
7059
				matches.push( elems[ i ] );
7060
			}
7061
		}
7062
7063
		return matches;
7064
	},
7065
7066
	// arg is for internal usage only
7067
	map: function( elems, callback, arg ) {
7068
		var value,
7069
			i = 0,
7070
			length = elems.length,
7071
			isArray = isArraylike( elems ),
7072
			ret = [];
7073
7074
		// Go through the array, translating each of the items to their new values
7075
		if ( isArray ) {
7076
			for ( ; i < length; i++ ) {
7077
				value = callback( elems[ i ], i, arg );
7078
7079
				if ( value != null ) {
7080
					ret.push( value );
7081
				}
7082
			}
7083
7084
		// Go through every key on the object,
7085
		} else {
7086
			for ( i in elems ) {
7087
				value = callback( elems[ i ], i, arg );
7088
7089
				if ( value != null ) {
7090
					ret.push( value );
7091
				}
7092
			}
7093
		}
7094
7095
		// Flatten any nested arrays
7096
		return concat.apply( [], ret );
7097
	},
7098
7099
	// A global GUID counter for objects
7100
	guid: 1,
7101
7102
	// Bind a function to a context, optionally partially applying any
7103
	// arguments.
7104
	proxy: function( fn, context ) {
7105
		var tmp, args, proxy;
7106
7107
		if ( typeof context === "string" ) {
7108
			tmp = fn[ context ];
7109
			context = fn;
7110
			fn = tmp;
7111
		}
7112
7113
		// Quick check to determine if target is callable, in the spec
7114
		// this throws a TypeError, but we will just return undefined.
7115
		if ( !jQuery.isFunction( fn ) ) {
7116
			return undefined;
7117
		}
7118
7119
		// Simulated bind
7120
		args = slice.call( arguments, 2 );
7121
		proxy = function() {
7122
			return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
7123
		};
7124
7125
		// Set the guid of unique handler to the same of original handler, so it can be removed
7126
		proxy.guid = fn.guid = fn.guid || jQuery.guid++;
7127
7128
		return proxy;
7129
	},
7130
7131
	now: Date.now,
7132
7133
	// jQuery.support is not used in Core but other projects attach their
7134
	// properties to it so it needs to exist.
7135
	support: support
7136
});
7137
7138
// Populate the class2type map
7139
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
7140
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
7141
});
7142
7143
function isArraylike( obj ) {
7144
7145
	// Support: iOS 8.2 (not reproducible in simulator)
7146
	// `in` check used to prevent JIT error (gh-2145)
7147
	// hasOwn isn't used here due to false negatives
7148
	// regarding Nodelist length in IE
7149
	var length = "length" in obj && obj.length,
7150
		type = jQuery.type( obj );
7151
7152
	if ( type === "function" || jQuery.isWindow( obj ) ) {
7153
		return false;
7154
	}
7155
7156
	if ( obj.nodeType === 1 && length ) {
7157
		return true;
7158
	}
7159
7160
	return type === "array" || length === 0 ||
7161
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
7162
}
7163
var Sizzle =
7164
/*!
7165
 * Sizzle CSS Selector Engine v2.2.0-pre
7166
 * http://sizzlejs.com/
7167
 *
7168
 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
7169
 * Released under the MIT license
7170
 * http://jquery.org/license
7171
 *
7172
 * Date: 2014-12-16
7173
 */
7174
(function( window ) {
7175
7176
var i,
7177
	support,
7178
	Expr,
7179
	getText,
7180
	isXML,
7181
	tokenize,
7182
	compile,
7183
	select,
7184
	outermostContext,
7185
	sortInput,
7186
	hasDuplicate,
7187
7188
	// Local document vars
7189
	setDocument,
7190
	document,
7191
	docElem,
7192
	documentIsHTML,
7193
	rbuggyQSA,
7194
	rbuggyMatches,
7195
	matches,
7196
	contains,
7197
7198
	// Instance-specific data
7199
	expando = "sizzle" + 1 * new Date(),
7200
	preferredDoc = window.document,
7201
	dirruns = 0,
7202
	done = 0,
7203
	classCache = createCache(),
7204
	tokenCache = createCache(),
7205
	compilerCache = createCache(),
7206
	sortOrder = function( a, b ) {
7207
		if ( a === b ) {
7208
			hasDuplicate = true;
7209
		}
7210
		return 0;
7211
	},
7212
7213
	// General-purpose constants
7214
	MAX_NEGATIVE = 1 << 31,
7215
7216
	// Instance methods
7217
	hasOwn = ({}).hasOwnProperty,
7218
	arr = [],
7219
	pop = arr.pop,
7220
	push_native = arr.push,
7221
	push = arr.push,
7222
	slice = arr.slice,
7223
	// Use a stripped-down indexOf as it's faster than native
7224
	// http://jsperf.com/thor-indexof-vs-for/5
7225
	indexOf = function( list, elem ) {
7226
		var i = 0,
7227
			len = list.length;
7228
		for ( ; i < len; i++ ) {
7229
			if ( list[i] === elem ) {
7230
				return i;
7231
			}
7232
		}
7233
		return -1;
7234
	},
7235
7236
	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
7237
7238
	// Regular expressions
7239
7240
	// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
7241
	whitespace = "[\\x20\\t\\r\\n\\f]",
7242
	// http://www.w3.org/TR/css3-syntax/#characters
7243
	characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
7244
7245
	// Loosely modeled on CSS identifier characters
7246
	// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
7247
	// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
7248
	identifier = characterEncoding.replace( "w", "w#" ),
7249
7250
	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
7251
	attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
7252
		// Operator (capture 2)
7253
		"*([*^$|!~]?=)" + whitespace +
7254
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
7255
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
7256
		"*\\]",
7257
7258
	pseudos = ":(" + characterEncoding + ")(?:\\((" +
7259
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
7260
		// 1. quoted (capture 3; capture 4 or capture 5)
7261
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
7262
		// 2. simple (capture 6)
7263
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
7264
		// 3. anything else (capture 2)
7265
		".*" +
7266
		")\\)|)",
7267
7268
	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
7269
	rwhitespace = new RegExp( whitespace + "+", "g" ),
7270
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
7271
7272
	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
7273
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
7274
7275
	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
7276
7277
	rpseudo = new RegExp( pseudos ),
7278
	ridentifier = new RegExp( "^" + identifier + "$" ),
7279
7280
	matchExpr = {
7281
		"ID": new RegExp( "^#(" + characterEncoding + ")" ),
7282
		"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
7283
		"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
7284
		"ATTR": new RegExp( "^" + attributes ),
7285
		"PSEUDO": new RegExp( "^" + pseudos ),
7286
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
7287
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
7288
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
7289
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
7290
		// For use in libraries implementing .is()
7291
		// We use this for POS matching in `select`
7292
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
7293
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
7294
	},
7295
7296
	rinputs = /^(?:input|select|textarea|button)$/i,
7297
	rheader = /^h\d$/i,
7298
7299
	rnative = /^[^{]+\{\s*\[native \w/,
7300
7301
	// Easily-parseable/retrievable ID or TAG or CLASS selectors
7302
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
7303
7304
	rsibling = /[+~]/,
7305
	rescape = /'|\\/g,
7306
7307
	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
7308
	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
7309
	funescape = function( _, escaped, escapedWhitespace ) {
7310
		var high = "0x" + escaped - 0x10000;
7311
		// NaN means non-codepoint
7312
		// Support: Firefox<24
7313
		// Workaround erroneous numeric interpretation of +"0x"
7314
		return high !== high || escapedWhitespace ?
7315
			escaped :
7316
			high < 0 ?
7317
				// BMP codepoint
7318
				String.fromCharCode( high + 0x10000 ) :
7319
				// Supplemental Plane codepoint (surrogate pair)
7320
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
7321
	},
7322
7323
	// Used for iframes
7324
	// See setDocument()
7325
	// Removing the function wrapper causes a "Permission Denied"
7326
	// error in IE
7327
	unloadHandler = function() {
7328
		setDocument();
7329
	};
7330
7331
// Optimize for push.apply( _, NodeList )
7332
try {
7333
	push.apply(
7334
		(arr = slice.call( preferredDoc.childNodes )),
7335
		preferredDoc.childNodes
7336
	);
7337
	// Support: Android<4.0
7338
	// Detect silently failing push.apply
7339
	arr[ preferredDoc.childNodes.length ].nodeType;
7340
} catch ( e ) {
7341
	push = { apply: arr.length ?
7342
7343
		// Leverage slice if possible
7344
		function( target, els ) {
7345
			push_native.apply( target, slice.call(els) );
7346
		} :
7347
7348
		// Support: IE<9
7349
		// Otherwise append directly
7350
		function( target, els ) {
7351
			var j = target.length,
7352
				i = 0;
7353
			// Can't trust NodeList.length
7354
			while ( (target[j++] = els[i++]) ) {}
7355
			target.length = j - 1;
7356
		}
7357
	};
7358
}
7359
7360
function Sizzle( selector, context, results, seed ) {
7361
	var match, elem, m, nodeType,
7362
		// QSA vars
7363
		i, groups, old, nid, newContext, newSelector;
7364
7365
	if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
7366
		setDocument( context );
7367
	}
7368
7369
	context = context || document;
7370
	results = results || [];
7371
	nodeType = context.nodeType;
7372
7373
	if ( typeof selector !== "string" || !selector ||
7374
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
7375
7376
		return results;
7377
	}
7378
7379
	if ( !seed && documentIsHTML ) {
7380
7381
		// Try to shortcut find operations when possible (e.g., not under DocumentFragment)
7382
		if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
7383
			// Speed-up: Sizzle("#ID")
7384
			if ( (m = match[1]) ) {
7385
				if ( nodeType === 9 ) {
7386
					elem = context.getElementById( m );
7387
					// Check parentNode to catch when Blackberry 4.6 returns
7388
					// nodes that are no longer in the document (jQuery #6963)
7389
					if ( elem && elem.parentNode ) {
7390
						// Handle the case where IE, Opera, and Webkit return items
7391
						// by name instead of ID
7392
						if ( elem.id === m ) {
7393
							results.push( elem );
7394
							return results;
7395
						}
7396
					} else {
7397
						return results;
7398
					}
7399
				} else {
7400
					// Context is not a document
7401
					if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
7402
						contains( context, elem ) && elem.id === m ) {
7403
						results.push( elem );
7404
						return results;
7405
					}
7406
				}
7407
7408
			// Speed-up: Sizzle("TAG")
7409
			} else if ( match[2] ) {
7410
				push.apply( results, context.getElementsByTagName( selector ) );
7411
				return results;
7412
7413
			// Speed-up: Sizzle(".CLASS")
7414
			} else if ( (m = match[3]) && support.getElementsByClassName ) {
7415
				push.apply( results, context.getElementsByClassName( m ) );
7416
				return results;
7417
			}
7418
		}
7419
7420
		// QSA path
7421
		if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
7422
			nid = old = expando;
7423
			newContext = context;
7424
			newSelector = nodeType !== 1 && selector;
7425
7426
			// qSA works strangely on Element-rooted queries
7427
			// We can work around this by specifying an extra ID on the root
7428
			// and working up from there (Thanks to Andrew Dupont for the technique)
7429
			// IE 8 doesn't work on object elements
7430
			if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
7431
				groups = tokenize( selector );
7432
7433
				if ( (old = context.getAttribute("id")) ) {
7434
					nid = old.replace( rescape, "\\$&" );
7435
				} else {
7436
					context.setAttribute( "id", nid );
7437
				}
7438
				nid = "[id='" + nid + "'] ";
7439
7440
				i = groups.length;
7441
				while ( i-- ) {
7442
					groups[i] = nid + toSelector( groups[i] );
7443
				}
7444
				newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
7445
				newSelector = groups.join(",");
7446
			}
7447
7448
			if ( newSelector ) {
7449
				try {
7450
					push.apply( results,
7451
						newContext.querySelectorAll( newSelector )
7452
					);
7453
					return results;
7454
				} catch(qsaError) {
7455
				} finally {
7456
					if ( !old ) {
7457
						context.removeAttribute("id");
7458
					}
7459
				}
7460
			}
7461
		}
7462
	}
7463
7464
	// All others
7465
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
7466
}
7467
7468
/**
7469
 * Create key-value caches of limited size
7470
 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
7471
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
7472
 *	deleting the oldest entry
7473
 */
7474
function createCache() {
7475
	var keys = [];
7476
7477
	function cache( key, value ) {
7478
		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
7479
		if ( keys.push( key + " " ) > Expr.cacheLength ) {
7480
			// Only keep the most recent entries
7481
			delete cache[ keys.shift() ];
7482
		}
7483
		return (cache[ key + " " ] = value);
7484
	}
7485
	return cache;
7486
}
7487
7488
/**
7489
 * Mark a function for special use by Sizzle
7490
 * @param {Function} fn The function to mark
7491
 */
7492
function markFunction( fn ) {
7493
	fn[ expando ] = true;
7494
	return fn;
7495
}
7496
7497
/**
7498
 * Support testing using an element
7499
 * @param {Function} fn Passed the created div and expects a boolean result
7500
 */
7501
function assert( fn ) {
7502
	var div = document.createElement("div");
7503
7504
	try {
7505
		return !!fn( div );
7506
	} catch (e) {
7507
		return false;
7508
	} finally {
7509
		// Remove from its parent by default
7510
		if ( div.parentNode ) {
7511
			div.parentNode.removeChild( div );
7512
		}
7513
		// release memory in IE
7514
		div = null;
7515
	}
7516
}
7517
7518
/**
7519
 * Adds the same handler for all of the specified attrs
7520
 * @param {String} attrs Pipe-separated list of attributes
7521
 * @param {Function} handler The method that will be applied
7522
 */
7523
function addHandle( attrs, handler ) {
7524
	var arr = attrs.split("|"),
7525
		i = attrs.length;
7526
7527
	while ( i-- ) {
7528
		Expr.attrHandle[ arr[i] ] = handler;
7529
	}
7530
}
7531
7532
/**
7533
 * Checks document order of two siblings
7534
 * @param {Element} a
7535
 * @param {Element} b
7536
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
7537
 */
7538
function siblingCheck( a, b ) {
7539
	var cur = b && a,
7540
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
7541
			( ~b.sourceIndex || MAX_NEGATIVE ) -
7542
			( ~a.sourceIndex || MAX_NEGATIVE );
7543
7544
	// Use IE sourceIndex if available on both nodes
7545
	if ( diff ) {
7546
		return diff;
7547
	}
7548
7549
	// Check if b follows a
7550
	if ( cur ) {
7551
		while ( (cur = cur.nextSibling) ) {
7552
			if ( cur === b ) {
7553
				return -1;
7554
			}
7555
		}
7556
	}
7557
7558
	return a ? 1 : -1;
7559
}
7560
7561
/**
7562
 * Returns a function to use in pseudos for input types
7563
 * @param {String} type
7564
 */
7565
function createInputPseudo( type ) {
7566
	return function( elem ) {
7567
		var name = elem.nodeName.toLowerCase();
7568
		return name === "input" && elem.type === type;
7569
	};
7570
}
7571
7572
/**
7573
 * Returns a function to use in pseudos for buttons
7574
 * @param {String} type
7575
 */
7576
function createButtonPseudo( type ) {
7577
	return function( elem ) {
7578
		var name = elem.nodeName.toLowerCase();
7579
		return (name === "input" || name === "button") && elem.type === type;
7580
	};
7581
}
7582
7583
/**
7584
 * Returns a function to use in pseudos for positionals
7585
 * @param {Function} fn
7586
 */
7587
function createPositionalPseudo( fn ) {
7588
	return markFunction(function( argument ) {
7589
		argument = +argument;
7590
		return markFunction(function( seed, matches ) {
7591
			var j,
7592
				matchIndexes = fn( [], seed.length, argument ),
7593
				i = matchIndexes.length;
7594
7595
			// Match elements found at the specified indexes
7596
			while ( i-- ) {
7597
				if ( seed[ (j = matchIndexes[i]) ] ) {
7598
					seed[j] = !(matches[j] = seed[j]);
7599
				}
7600
			}
7601
		});
7602
	});
7603
}
7604
7605
/**
7606
 * Checks a node for validity as a Sizzle context
7607
 * @param {Element|Object=} context
7608
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
7609
 */
7610
function testContext( context ) {
7611
	return context && typeof context.getElementsByTagName !== "undefined" && context;
7612
}
7613
7614
// Expose support vars for convenience
7615
support = Sizzle.support = {};
7616
7617
/**
7618
 * Detects XML nodes
7619
 * @param {Element|Object} elem An element or a document
7620
 * @returns {Boolean} True iff elem is a non-HTML XML node
7621
 */
7622
isXML = Sizzle.isXML = function( elem ) {
7623
	// documentElement is verified for cases where it doesn't yet exist
7624
	// (such as loading iframes in IE - #4833)
7625
	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
7626
	return documentElement ? documentElement.nodeName !== "HTML" : false;
7627
};
7628
7629
/**
7630
 * Sets document-related variables once based on the current document
7631
 * @param {Element|Object} [doc] An element or document object to use to set the document
7632
 * @returns {Object} Returns the current document
7633
 */
7634
setDocument = Sizzle.setDocument = function( node ) {
7635
	var hasCompare, parent,
7636
		doc = node ? node.ownerDocument || node : preferredDoc;
7637
7638
	// If no document and documentElement is available, return
7639
	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
7640
		return document;
7641
	}
7642
7643
	// Set our document
7644
	document = doc;
7645
	docElem = doc.documentElement;
7646
	parent = doc.defaultView;
7647
7648
	// Support: IE>8
7649
	// If iframe document is assigned to "document" variable and if iframe has been reloaded,
7650
	// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
7651
	// IE6-8 do not support the defaultView property so parent will be undefined
7652
	if ( parent && parent !== parent.top ) {
7653
		// IE11 does not have attachEvent, so all must suffer
7654
		if ( parent.addEventListener ) {
7655
			parent.addEventListener( "unload", unloadHandler, false );
7656
		} else if ( parent.attachEvent ) {
7657
			parent.attachEvent( "onunload", unloadHandler );
7658
		}
7659
	}
7660
7661
	/* Support tests
7662
	---------------------------------------------------------------------- */
7663
	documentIsHTML = !isXML( doc );
7664
7665
	/* Attributes
7666
	---------------------------------------------------------------------- */
7667
7668
	// Support: IE<8
7669
	// Verify that getAttribute really returns attributes and not properties
7670
	// (excepting IE8 booleans)
7671
	support.attributes = assert(function( div ) {
7672
		div.className = "i";
7673
		return !div.getAttribute("className");
7674
	});
7675
7676
	/* getElement(s)By*
7677
	---------------------------------------------------------------------- */
7678
7679
	// Check if getElementsByTagName("*") returns only elements
7680
	support.getElementsByTagName = assert(function( div ) {
7681
		div.appendChild( doc.createComment("") );
7682
		return !div.getElementsByTagName("*").length;
7683
	});
7684
7685
	// Support: IE<9
7686
	support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
7687
7688
	// Support: IE<10
7689
	// Check if getElementById returns elements by name
7690
	// The broken getElementById methods don't pick up programatically-set names,
7691
	// so use a roundabout getElementsByName test
7692
	support.getById = assert(function( div ) {
7693
		docElem.appendChild( div ).id = expando;
7694
		return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
7695
	});
7696
7697
	// ID find and filter
7698
	if ( support.getById ) {
7699
		Expr.find["ID"] = function( id, context ) {
7700
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
7701
				var m = context.getElementById( id );
7702
				// Check parentNode to catch when Blackberry 4.6 returns
7703
				// nodes that are no longer in the document #6963
7704
				return m && m.parentNode ? [ m ] : [];
7705
			}
7706
		};
7707
		Expr.filter["ID"] = function( id ) {
7708
			var attrId = id.replace( runescape, funescape );
7709
			return function( elem ) {
7710
				return elem.getAttribute("id") === attrId;
7711
			};
7712
		};
7713
	} else {
7714
		// Support: IE6/7
7715
		// getElementById is not reliable as a find shortcut
7716
		delete Expr.find["ID"];
7717
7718
		Expr.filter["ID"] =  function( id ) {
7719
			var attrId = id.replace( runescape, funescape );
7720
			return function( elem ) {
7721
				var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
7722
				return node && node.value === attrId;
7723
			};
7724
		};
7725
	}
7726
7727
	// Tag
7728
	Expr.find["TAG"] = support.getElementsByTagName ?
7729
		function( tag, context ) {
7730
			if ( typeof context.getElementsByTagName !== "undefined" ) {
7731
				return context.getElementsByTagName( tag );
7732
7733
			// DocumentFragment nodes don't have gEBTN
7734
			} else if ( support.qsa ) {
7735
				return context.querySelectorAll( tag );
7736
			}
7737
		} :
7738
7739
		function( tag, context ) {
7740
			var elem,
7741
				tmp = [],
7742
				i = 0,
7743
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
7744
				results = context.getElementsByTagName( tag );
7745
7746
			// Filter out possible comments
7747
			if ( tag === "*" ) {
7748
				while ( (elem = results[i++]) ) {
7749
					if ( elem.nodeType === 1 ) {
7750
						tmp.push( elem );
7751
					}
7752
				}
7753
7754
				return tmp;
7755
			}
7756
			return results;
7757
		};
7758
7759
	// Class
7760
	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
7761
		if ( documentIsHTML ) {
7762
			return context.getElementsByClassName( className );
7763
		}
7764
	};
7765
7766
	/* QSA/matchesSelector
7767
	---------------------------------------------------------------------- */
7768
7769
	// QSA and matchesSelector support
7770
7771
	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
7772
	rbuggyMatches = [];
7773
7774
	// qSa(:focus) reports false when true (Chrome 21)
7775
	// We allow this because of a bug in IE8/9 that throws an error
7776
	// whenever `document.activeElement` is accessed on an iframe
7777
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
7778
	// See http://bugs.jquery.com/ticket/13378
7779
	rbuggyQSA = [];
7780
7781
	if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
7782
		// Build QSA regex
7783
		// Regex strategy adopted from Diego Perini
7784
		assert(function( div ) {
7785
			// Select is set to empty string on purpose
7786
			// This is to test IE's treatment of not explicitly
7787
			// setting a boolean content attribute,
7788
			// since its presence should be enough
7789
			// http://bugs.jquery.com/ticket/12359
7790
			docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
7791
				"<select id='" + expando + "-\f]' msallowcapture=''>" +
7792
				"<option selected=''></option></select>";
7793
7794
			// Support: IE8, Opera 11-12.16
7795
			// Nothing should be selected when empty strings follow ^= or $= or *=
7796
			// The test attribute must be unknown in Opera but "safe" for WinRT
7797
			// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
7798
			if ( div.querySelectorAll("[msallowcapture^='']").length ) {
7799
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
7800
			}
7801
7802
			// Support: IE8
7803
			// Boolean attributes and "value" are not treated correctly
7804
			if ( !div.querySelectorAll("[selected]").length ) {
7805
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
7806
			}
7807
7808
			// Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
7809
			if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
7810
				rbuggyQSA.push("~=");
7811
			}
7812
7813
			// Webkit/Opera - :checked should return selected option elements
7814
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
7815
			// IE8 throws error here and will not see later tests
7816
			if ( !div.querySelectorAll(":checked").length ) {
7817
				rbuggyQSA.push(":checked");
7818
			}
7819
7820
			// Support: Safari 8+, iOS 8+
7821
			// https://bugs.webkit.org/show_bug.cgi?id=136851
7822
			// In-page `selector#id sibing-combinator selector` fails
7823
			if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
7824
				rbuggyQSA.push(".#.+[+~]");
7825
			}
7826
		});
7827
7828
		assert(function( div ) {
7829
			// Support: Windows 8 Native Apps
7830
			// The type and name attributes are restricted during .innerHTML assignment
7831
			var input = doc.createElement("input");
7832
			input.setAttribute( "type", "hidden" );
7833
			div.appendChild( input ).setAttribute( "name", "D" );
7834
7835
			// Support: IE8
7836
			// Enforce case-sensitivity of name attribute
7837
			if ( div.querySelectorAll("[name=d]").length ) {
7838
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
7839
			}
7840
7841
			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
7842
			// IE8 throws error here and will not see later tests
7843
			if ( !div.querySelectorAll(":enabled").length ) {
7844
				rbuggyQSA.push( ":enabled", ":disabled" );
7845
			}
7846
7847
			// Opera 10-11 does not throw on post-comma invalid pseudos
7848
			div.querySelectorAll("*,:x");
7849
			rbuggyQSA.push(",.*:");
7850
		});
7851
	}
7852
7853
	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
7854
		docElem.webkitMatchesSelector ||
7855
		docElem.mozMatchesSelector ||
7856
		docElem.oMatchesSelector ||
7857
		docElem.msMatchesSelector) )) ) {
7858
7859
		assert(function( div ) {
7860
			// Check to see if it's possible to do matchesSelector
7861
			// on a disconnected node (IE 9)
7862
			support.disconnectedMatch = matches.call( div, "div" );
7863
7864
			// This should fail with an exception
7865
			// Gecko does not error, returns false instead
7866
			matches.call( div, "[s!='']:x" );
7867
			rbuggyMatches.push( "!=", pseudos );
7868
		});
7869
	}
7870
7871
	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
7872
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
7873
7874
	/* Contains
7875
	---------------------------------------------------------------------- */
7876
	hasCompare = rnative.test( docElem.compareDocumentPosition );
7877
7878
	// Element contains another
7879
	// Purposefully does not implement inclusive descendent
7880
	// As in, an element does not contain itself
7881
	contains = hasCompare || rnative.test( docElem.contains ) ?
7882
		function( a, b ) {
7883
			var adown = a.nodeType === 9 ? a.documentElement : a,
7884
				bup = b && b.parentNode;
7885
			return a === bup || !!( bup && bup.nodeType === 1 && (
7886
				adown.contains ?
7887
					adown.contains( bup ) :
7888
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
7889
			));
7890
		} :
7891
		function( a, b ) {
7892
			if ( b ) {
7893
				while ( (b = b.parentNode) ) {
7894
					if ( b === a ) {
7895
						return true;
7896
					}
7897
				}
7898
			}
7899
			return false;
7900
		};
7901
7902
	/* Sorting
7903
	---------------------------------------------------------------------- */
7904
7905
	// Document order sorting
7906
	sortOrder = hasCompare ?
7907
	function( a, b ) {
7908
7909
		// Flag for duplicate removal
7910
		if ( a === b ) {
7911
			hasDuplicate = true;
7912
			return 0;
7913
		}
7914
7915
		// Sort on method existence if only one input has compareDocumentPosition
7916
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
7917
		if ( compare ) {
7918
			return compare;
7919
		}
7920
7921
		// Calculate position if both inputs belong to the same document
7922
		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
7923
			a.compareDocumentPosition( b ) :
7924
7925
			// Otherwise we know they are disconnected
7926
			1;
7927
7928
		// Disconnected nodes
7929
		if ( compare & 1 ||
7930
			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
7931
7932
			// Choose the first element that is related to our preferred document
7933
			if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
7934
				return -1;
7935
			}
7936
			if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
7937
				return 1;
7938
			}
7939
7940
			// Maintain original order
7941
			return sortInput ?
7942
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
7943
				0;
7944
		}
7945
7946
		return compare & 4 ? -1 : 1;
7947
	} :
7948
	function( a, b ) {
7949
		// Exit early if the nodes are identical
7950
		if ( a === b ) {
7951
			hasDuplicate = true;
7952
			return 0;
7953
		}
7954
7955
		var cur,
7956
			i = 0,
7957
			aup = a.parentNode,
7958
			bup = b.parentNode,
7959
			ap = [ a ],
7960
			bp = [ b ];
7961
7962
		// Parentless nodes are either documents or disconnected
7963
		if ( !aup || !bup ) {
7964
			return a === doc ? -1 :
7965
				b === doc ? 1 :
7966
				aup ? -1 :
7967
				bup ? 1 :
7968
				sortInput ?
7969
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
7970
				0;
7971
7972
		// If the nodes are siblings, we can do a quick check
7973
		} else if ( aup === bup ) {
7974
			return siblingCheck( a, b );
7975
		}
7976
7977
		// Otherwise we need full lists of their ancestors for comparison
7978
		cur = a;
7979
		while ( (cur = cur.parentNode) ) {
7980
			ap.unshift( cur );
7981
		}
7982
		cur = b;
7983
		while ( (cur = cur.parentNode) ) {
7984
			bp.unshift( cur );
7985
		}
7986
7987
		// Walk down the tree looking for a discrepancy
7988
		while ( ap[i] === bp[i] ) {
7989
			i++;
7990
		}
7991
7992
		return i ?
7993
			// Do a sibling check if the nodes have a common ancestor
7994
			siblingCheck( ap[i], bp[i] ) :
7995
7996
			// Otherwise nodes in our document sort first
7997
			ap[i] === preferredDoc ? -1 :
7998
			bp[i] === preferredDoc ? 1 :
7999
			0;
8000
	};
8001
8002
	return doc;
8003
};
8004
8005
Sizzle.matches = function( expr, elements ) {
8006
	return Sizzle( expr, null, null, elements );
8007
};
8008
8009
Sizzle.matchesSelector = function( elem, expr ) {
8010
	// Set document vars if needed
8011
	if ( ( elem.ownerDocument || elem ) !== document ) {
8012
		setDocument( elem );
8013
	}
8014
8015
	// Make sure that attribute selectors are quoted
8016
	expr = expr.replace( rattributeQuotes, "='$1']" );
8017
8018
	if ( support.matchesSelector && documentIsHTML &&
8019
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
8020
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
8021
8022
		try {
8023
			var ret = matches.call( elem, expr );
8024
8025
			// IE 9's matchesSelector returns false on disconnected nodes
8026
			if ( ret || support.disconnectedMatch ||
8027
					// As well, disconnected nodes are said to be in a document
8028
					// fragment in IE 9
8029
					elem.document && elem.document.nodeType !== 11 ) {
8030
				return ret;
8031
			}
8032
		} catch (e) {}
8033
	}
8034
8035
	return Sizzle( expr, document, null, [ elem ] ).length > 0;
8036
};
8037
8038
Sizzle.contains = function( context, elem ) {
8039
	// Set document vars if needed
8040
	if ( ( context.ownerDocument || context ) !== document ) {
8041
		setDocument( context );
8042
	}
8043
	return contains( context, elem );
8044
};
8045
8046
Sizzle.attr = function( elem, name ) {
8047
	// Set document vars if needed
8048
	if ( ( elem.ownerDocument || elem ) !== document ) {
8049
		setDocument( elem );
8050
	}
8051
8052
	var fn = Expr.attrHandle[ name.toLowerCase() ],
8053
		// Don't get fooled by Object.prototype properties (jQuery #13807)
8054
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
8055
			fn( elem, name, !documentIsHTML ) :
8056
			undefined;
8057
8058
	return val !== undefined ?
8059
		val :
8060
		support.attributes || !documentIsHTML ?
8061
			elem.getAttribute( name ) :
8062
			(val = elem.getAttributeNode(name)) && val.specified ?
8063
				val.value :
8064
				null;
8065
};
8066
8067
Sizzle.error = function( msg ) {
8068
	throw new Error( "Syntax error, unrecognized expression: " + msg );
8069
};
8070
8071
/**
8072
 * Document sorting and removing duplicates
8073
 * @param {ArrayLike} results
8074
 */
8075
Sizzle.uniqueSort = function( results ) {
8076
	var elem,
8077
		duplicates = [],
8078
		j = 0,
8079
		i = 0;
8080
8081
	// Unless we *know* we can detect duplicates, assume their presence
8082
	hasDuplicate = !support.detectDuplicates;
8083
	sortInput = !support.sortStable && results.slice( 0 );
8084
	results.sort( sortOrder );
8085
8086
	if ( hasDuplicate ) {
8087
		while ( (elem = results[i++]) ) {
8088
			if ( elem === results[ i ] ) {
8089
				j = duplicates.push( i );
8090
			}
8091
		}
8092
		while ( j-- ) {
8093
			results.splice( duplicates[ j ], 1 );
8094
		}
8095
	}
8096
8097
	// Clear input after sorting to release objects
8098
	// See https://github.com/jquery/sizzle/pull/225
8099
	sortInput = null;
8100
8101
	return results;
8102
};
8103
8104
/**
8105
 * Utility function for retrieving the text value of an array of DOM nodes
8106
 * @param {Array|Element} elem
8107
 */
8108
getText = Sizzle.getText = function( elem ) {
8109
	var node,
8110
		ret = "",
8111
		i = 0,
8112
		nodeType = elem.nodeType;
8113
8114
	if ( !nodeType ) {
8115
		// If no nodeType, this is expected to be an array
8116
		while ( (node = elem[i++]) ) {
8117
			// Do not traverse comment nodes
8118
			ret += getText( node );
8119
		}
8120
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
8121
		// Use textContent for elements
8122
		// innerText usage removed for consistency of new lines (jQuery #11153)
8123
		if ( typeof elem.textContent === "string" ) {
8124
			return elem.textContent;
8125
		} else {
8126
			// Traverse its children
8127
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8128
				ret += getText( elem );
8129
			}
8130
		}
8131
	} else if ( nodeType === 3 || nodeType === 4 ) {
8132
		return elem.nodeValue;
8133
	}
8134
	// Do not include comment or processing instruction nodes
8135
8136
	return ret;
8137
};
8138
8139
Expr = Sizzle.selectors = {
8140
8141
	// Can be adjusted by the user
8142
	cacheLength: 50,
8143
8144
	createPseudo: markFunction,
8145
8146
	match: matchExpr,
8147
8148
	attrHandle: {},
8149
8150
	find: {},
8151
8152
	relative: {
8153
		">": { dir: "parentNode", first: true },
8154
		" ": { dir: "parentNode" },
8155
		"+": { dir: "previousSibling", first: true },
8156
		"~": { dir: "previousSibling" }
8157
	},
8158
8159
	preFilter: {
8160
		"ATTR": function( match ) {
8161
			match[1] = match[1].replace( runescape, funescape );
8162
8163
			// Move the given value to match[3] whether quoted or unquoted
8164
			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
8165
8166
			if ( match[2] === "~=" ) {
8167
				match[3] = " " + match[3] + " ";
8168
			}
8169
8170
			return match.slice( 0, 4 );
8171
		},
8172
8173
		"CHILD": function( match ) {
8174
			/* matches from matchExpr["CHILD"]
8175
				1 type (only|nth|...)
8176
				2 what (child|of-type)
8177
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
8178
				4 xn-component of xn+y argument ([+-]?\d*n|)
8179
				5 sign of xn-component
8180
				6 x of xn-component
8181
				7 sign of y-component
8182
				8 y of y-component
8183
			*/
8184
			match[1] = match[1].toLowerCase();
8185
8186
			if ( match[1].slice( 0, 3 ) === "nth" ) {
8187
				// nth-* requires argument
8188
				if ( !match[3] ) {
8189
					Sizzle.error( match[0] );
8190
				}
8191
8192
				// numeric x and y parameters for Expr.filter.CHILD
8193
				// remember that false/true cast respectively to 0/1
8194
				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
8195
				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
8196
8197
			// other types prohibit arguments
8198
			} else if ( match[3] ) {
8199
				Sizzle.error( match[0] );
8200
			}
8201
8202
			return match;
8203
		},
8204
8205
		"PSEUDO": function( match ) {
8206
			var excess,
8207
				unquoted = !match[6] && match[2];
8208
8209
			if ( matchExpr["CHILD"].test( match[0] ) ) {
8210
				return null;
8211
			}
8212
8213
			// Accept quoted arguments as-is
8214
			if ( match[3] ) {
8215
				match[2] = match[4] || match[5] || "";
8216
8217
			// Strip excess characters from unquoted arguments
8218
			} else if ( unquoted && rpseudo.test( unquoted ) &&
8219
				// Get excess from tokenize (recursively)
8220
				(excess = tokenize( unquoted, true )) &&
8221
				// advance to the next closing parenthesis
8222
				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
8223
8224
				// excess is a negative index
8225
				match[0] = match[0].slice( 0, excess );
8226
				match[2] = unquoted.slice( 0, excess );
8227
			}
8228
8229
			// Return only captures needed by the pseudo filter method (type and argument)
8230
			return match.slice( 0, 3 );
8231
		}
8232
	},
8233
8234
	filter: {
8235
8236
		"TAG": function( nodeNameSelector ) {
8237
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
8238
			return nodeNameSelector === "*" ?
8239
				function() { return true; } :
8240
				function( elem ) {
8241
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
8242
				};
8243
		},
8244
8245
		"CLASS": function( className ) {
8246
			var pattern = classCache[ className + " " ];
8247
8248
			return pattern ||
8249
				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
8250
				classCache( className, function( elem ) {
8251
					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
8252
				});
8253
		},
8254
8255
		"ATTR": function( name, operator, check ) {
8256
			return function( elem ) {
8257
				var result = Sizzle.attr( elem, name );
8258
8259
				if ( result == null ) {
8260
					return operator === "!=";
8261
				}
8262
				if ( !operator ) {
8263
					return true;
8264
				}
8265
8266
				result += "";
8267
8268
				return operator === "=" ? result === check :
8269
					operator === "!=" ? result !== check :
8270
					operator === "^=" ? check && result.indexOf( check ) === 0 :
8271
					operator === "*=" ? check && result.indexOf( check ) > -1 :
8272
					operator === "$=" ? check && result.slice( -check.length ) === check :
8273
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
8274
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
8275
					false;
8276
			};
8277
		},
8278
8279
		"CHILD": function( type, what, argument, first, last ) {
8280
			var simple = type.slice( 0, 3 ) !== "nth",
8281
				forward = type.slice( -4 ) !== "last",
8282
				ofType = what === "of-type";
8283
8284
			return first === 1 && last === 0 ?
8285
8286
				// Shortcut for :nth-*(n)
8287
				function( elem ) {
8288
					return !!elem.parentNode;
8289
				} :
8290
8291
				function( elem, context, xml ) {
8292
					var cache, outerCache, node, diff, nodeIndex, start,
8293
						dir = simple !== forward ? "nextSibling" : "previousSibling",
8294
						parent = elem.parentNode,
8295
						name = ofType && elem.nodeName.toLowerCase(),
8296
						useCache = !xml && !ofType;
8297
8298
					if ( parent ) {
8299
8300
						// :(first|last|only)-(child|of-type)
8301
						if ( simple ) {
8302
							while ( dir ) {
8303
								node = elem;
8304
								while ( (node = node[ dir ]) ) {
8305
									if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
8306
										return false;
8307
									}
8308
								}
8309
								// Reverse direction for :only-* (if we haven't yet done so)
8310
								start = dir = type === "only" && !start && "nextSibling";
8311
							}
8312
							return true;
8313
						}
8314
8315
						start = [ forward ? parent.firstChild : parent.lastChild ];
8316
8317
						// non-xml :nth-child(...) stores cache data on `parent`
8318
						if ( forward && useCache ) {
8319
							// Seek `elem` from a previously-cached index
8320
							outerCache = parent[ expando ] || (parent[ expando ] = {});
8321
							cache = outerCache[ type ] || [];
8322
							nodeIndex = cache[0] === dirruns && cache[1];
8323
							diff = cache[0] === dirruns && cache[2];
8324
							node = nodeIndex && parent.childNodes[ nodeIndex ];
8325
8326
							while ( (node = ++nodeIndex && node && node[ dir ] ||
8327
8328
								// Fallback to seeking `elem` from the start
8329
								(diff = nodeIndex = 0) || start.pop()) ) {
8330
8331
								// When found, cache indexes on `parent` and break
8332
								if ( node.nodeType === 1 && ++diff && node === elem ) {
8333
									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
8334
									break;
8335
								}
8336
							}
8337
8338
						// Use previously-cached element index if available
8339
						} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
8340
							diff = cache[1];
8341
8342
						// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
8343
						} else {
8344
							// Use the same loop as above to seek `elem` from the start
8345
							while ( (node = ++nodeIndex && node && node[ dir ] ||
8346
								(diff = nodeIndex = 0) || start.pop()) ) {
8347
8348
								if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
8349
									// Cache the index of each encountered element
8350
									if ( useCache ) {
8351
										(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
8352
									}
8353
8354
									if ( node === elem ) {
8355
										break;
8356
									}
8357
								}
8358
							}
8359
						}
8360
8361
						// Incorporate the offset, then check against cycle size
8362
						diff -= last;
8363
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
8364
					}
8365
				};
8366
		},
8367
8368
		"PSEUDO": function( pseudo, argument ) {
8369
			// pseudo-class names are case-insensitive
8370
			// http://www.w3.org/TR/selectors/#pseudo-classes
8371
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
8372
			// Remember that setFilters inherits from pseudos
8373
			var args,
8374
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
8375
					Sizzle.error( "unsupported pseudo: " + pseudo );
8376
8377
			// The user may use createPseudo to indicate that
8378
			// arguments are needed to create the filter function
8379
			// just as Sizzle does
8380
			if ( fn[ expando ] ) {
8381
				return fn( argument );
8382
			}
8383
8384
			// But maintain support for old signatures
8385
			if ( fn.length > 1 ) {
8386
				args = [ pseudo, pseudo, "", argument ];
8387
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
8388
					markFunction(function( seed, matches ) {
8389
						var idx,
8390
							matched = fn( seed, argument ),
8391
							i = matched.length;
8392
						while ( i-- ) {
8393
							idx = indexOf( seed, matched[i] );
8394
							seed[ idx ] = !( matches[ idx ] = matched[i] );
8395
						}
8396
					}) :
8397
					function( elem ) {
8398
						return fn( elem, 0, args );
8399
					};
8400
			}
8401
8402
			return fn;
8403
		}
8404
	},
8405
8406
	pseudos: {
8407
		// Potentially complex pseudos
8408
		"not": markFunction(function( selector ) {
8409
			// Trim the selector passed to compile
8410
			// to avoid treating leading and trailing
8411
			// spaces as combinators
8412
			var input = [],
8413
				results = [],
8414
				matcher = compile( selector.replace( rtrim, "$1" ) );
8415
8416
			return matcher[ expando ] ?
8417
				markFunction(function( seed, matches, context, xml ) {
8418
					var elem,
8419
						unmatched = matcher( seed, null, xml, [] ),
8420
						i = seed.length;
8421
8422
					// Match elements unmatched by `matcher`
8423
					while ( i-- ) {
8424
						if ( (elem = unmatched[i]) ) {
8425
							seed[i] = !(matches[i] = elem);
8426
						}
8427
					}
8428
				}) :
8429
				function( elem, context, xml ) {
8430
					input[0] = elem;
8431
					matcher( input, null, xml, results );
8432
					// Don't keep the element (issue #299)
8433
					input[0] = null;
8434
					return !results.pop();
8435
				};
8436
		}),
8437
8438
		"has": markFunction(function( selector ) {
8439
			return function( elem ) {
8440
				return Sizzle( selector, elem ).length > 0;
8441
			};
8442
		}),
8443
8444
		"contains": markFunction(function( text ) {
8445
			text = text.replace( runescape, funescape );
8446
			return function( elem ) {
8447
				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
8448
			};
8449
		}),
8450
8451
		// "Whether an element is represented by a :lang() selector
8452
		// is based solely on the element's language value
8453
		// being equal to the identifier C,
8454
		// or beginning with the identifier C immediately followed by "-".
8455
		// The matching of C against the element's language value is performed case-insensitively.
8456
		// The identifier C does not have to be a valid language name."
8457
		// http://www.w3.org/TR/selectors/#lang-pseudo
8458
		"lang": markFunction( function( lang ) {
8459
			// lang value must be a valid identifier
8460
			if ( !ridentifier.test(lang || "") ) {
8461
				Sizzle.error( "unsupported lang: " + lang );
8462
			}
8463
			lang = lang.replace( runescape, funescape ).toLowerCase();
8464
			return function( elem ) {
8465
				var elemLang;
8466
				do {
8467
					if ( (elemLang = documentIsHTML ?
8468
						elem.lang :
8469
						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
8470
8471
						elemLang = elemLang.toLowerCase();
8472
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
8473
					}
8474
				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
8475
				return false;
8476
			};
8477
		}),
8478
8479
		// Miscellaneous
8480
		"target": function( elem ) {
8481
			var hash = window.location && window.location.hash;
8482
			return hash && hash.slice( 1 ) === elem.id;
8483
		},
8484
8485
		"root": function( elem ) {
8486
			return elem === docElem;
8487
		},
8488
8489
		"focus": function( elem ) {
8490
			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
8491
		},
8492
8493
		// Boolean properties
8494
		"enabled": function( elem ) {
8495
			return elem.disabled === false;
8496
		},
8497
8498
		"disabled": function( elem ) {
8499
			return elem.disabled === true;
8500
		},
8501
8502
		"checked": function( elem ) {
8503
			// In CSS3, :checked should return both checked and selected elements
8504
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
8505
			var nodeName = elem.nodeName.toLowerCase();
8506
			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
8507
		},
8508
8509
		"selected": function( elem ) {
8510
			// Accessing this property makes selected-by-default
8511
			// options in Safari work properly
8512
			if ( elem.parentNode ) {
8513
				elem.parentNode.selectedIndex;
8514
			}
8515
8516
			return elem.selected === true;
8517
		},
8518
8519
		// Contents
8520
		"empty": function( elem ) {
8521
			// http://www.w3.org/TR/selectors/#empty-pseudo
8522
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
8523
			//   but not by others (comment: 8; processing instruction: 7; etc.)
8524
			// nodeType < 6 works because attributes (2) do not appear as children
8525
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8526
				if ( elem.nodeType < 6 ) {
8527
					return false;
8528
				}
8529
			}
8530
			return true;
8531
		},
8532
8533
		"parent": function( elem ) {
8534
			return !Expr.pseudos["empty"]( elem );
8535
		},
8536
8537
		// Element/input types
8538
		"header": function( elem ) {
8539
			return rheader.test( elem.nodeName );
8540
		},
8541
8542
		"input": function( elem ) {
8543
			return rinputs.test( elem.nodeName );
8544
		},
8545
8546
		"button": function( elem ) {
8547
			var name = elem.nodeName.toLowerCase();
8548
			return name === "input" && elem.type === "button" || name === "button";
8549
		},
8550
8551
		"text": function( elem ) {
8552
			var attr;
8553
			return elem.nodeName.toLowerCase() === "input" &&
8554
				elem.type === "text" &&
8555
8556
				// Support: IE<8
8557
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
8558
				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
8559
		},
8560
8561
		// Position-in-collection
8562
		"first": createPositionalPseudo(function() {
8563
			return [ 0 ];
8564
		}),
8565
8566
		"last": createPositionalPseudo(function( matchIndexes, length ) {
8567
			return [ length - 1 ];
8568
		}),
8569
8570
		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
8571
			return [ argument < 0 ? argument + length : argument ];
8572
		}),
8573
8574
		"even": createPositionalPseudo(function( matchIndexes, length ) {
8575
			var i = 0;
8576
			for ( ; i < length; i += 2 ) {
8577
				matchIndexes.push( i );
8578
			}
8579
			return matchIndexes;
8580
		}),
8581
8582
		"odd": createPositionalPseudo(function( matchIndexes, length ) {
8583
			var i = 1;
8584
			for ( ; i < length; i += 2 ) {
8585
				matchIndexes.push( i );
8586
			}
8587
			return matchIndexes;
8588
		}),
8589
8590
		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8591
			var i = argument < 0 ? argument + length : argument;
8592
			for ( ; --i >= 0; ) {
8593
				matchIndexes.push( i );
8594
			}
8595
			return matchIndexes;
8596
		}),
8597
8598
		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8599
			var i = argument < 0 ? argument + length : argument;
8600
			for ( ; ++i < length; ) {
8601
				matchIndexes.push( i );
8602
			}
8603
			return matchIndexes;
8604
		})
8605
	}
8606
};
8607
8608
Expr.pseudos["nth"] = Expr.pseudos["eq"];
8609
8610
// Add button/input type pseudos
8611
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
8612
	Expr.pseudos[ i ] = createInputPseudo( i );
8613
}
8614
for ( i in { submit: true, reset: true } ) {
8615
	Expr.pseudos[ i ] = createButtonPseudo( i );
8616
}
8617
8618
// Easy API for creating new setFilters
8619
function setFilters() {}
8620
setFilters.prototype = Expr.filters = Expr.pseudos;
8621
Expr.setFilters = new setFilters();
8622
8623
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
8624
	var matched, match, tokens, type,
8625
		soFar, groups, preFilters,
8626
		cached = tokenCache[ selector + " " ];
8627
8628
	if ( cached ) {
8629
		return parseOnly ? 0 : cached.slice( 0 );
8630
	}
8631
8632
	soFar = selector;
8633
	groups = [];
8634
	preFilters = Expr.preFilter;
8635
8636
	while ( soFar ) {
8637
8638
		// Comma and first run
8639
		if ( !matched || (match = rcomma.exec( soFar )) ) {
8640
			if ( match ) {
8641
				// Don't consume trailing commas as valid
8642
				soFar = soFar.slice( match[0].length ) || soFar;
8643
			}
8644
			groups.push( (tokens = []) );
8645
		}
8646
8647
		matched = false;
8648
8649
		// Combinators
8650
		if ( (match = rcombinators.exec( soFar )) ) {
8651
			matched = match.shift();
8652
			tokens.push({
8653
				value: matched,
8654
				// Cast descendant combinators to space
8655
				type: match[0].replace( rtrim, " " )
8656
			});
8657
			soFar = soFar.slice( matched.length );
8658
		}
8659
8660
		// Filters
8661
		for ( type in Expr.filter ) {
8662
			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
8663
				(match = preFilters[ type ]( match ))) ) {
8664
				matched = match.shift();
8665
				tokens.push({
8666
					value: matched,
8667
					type: type,
8668
					matches: match
8669
				});
8670
				soFar = soFar.slice( matched.length );
8671
			}
8672
		}
8673
8674
		if ( !matched ) {
8675
			break;
8676
		}
8677
	}
8678
8679
	// Return the length of the invalid excess
8680
	// if we're just parsing
8681
	// Otherwise, throw an error or return tokens
8682
	return parseOnly ?
8683
		soFar.length :
8684
		soFar ?
8685
			Sizzle.error( selector ) :
8686
			// Cache the tokens
8687
			tokenCache( selector, groups ).slice( 0 );
8688
};
8689
8690
function toSelector( tokens ) {
8691
	var i = 0,
8692
		len = tokens.length,
8693
		selector = "";
8694
	for ( ; i < len; i++ ) {
8695
		selector += tokens[i].value;
8696
	}
8697
	return selector;
8698
}
8699
8700
function addCombinator( matcher, combinator, base ) {
8701
	var dir = combinator.dir,
8702
		checkNonElements = base && dir === "parentNode",
8703
		doneName = done++;
8704
8705
	return combinator.first ?
8706
		// Check against closest ancestor/preceding element
8707
		function( elem, context, xml ) {
8708
			while ( (elem = elem[ dir ]) ) {
8709
				if ( elem.nodeType === 1 || checkNonElements ) {
8710
					return matcher( elem, context, xml );
8711
				}
8712
			}
8713
		} :
8714
8715
		// Check against all ancestor/preceding elements
8716
		function( elem, context, xml ) {
8717
			var oldCache, outerCache,
8718
				newCache = [ dirruns, doneName ];
8719
8720
			// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
8721
			if ( xml ) {
8722
				while ( (elem = elem[ dir ]) ) {
8723
					if ( elem.nodeType === 1 || checkNonElements ) {
8724
						if ( matcher( elem, context, xml ) ) {
8725
							return true;
8726
						}
8727
					}
8728
				}
8729
			} else {
8730
				while ( (elem = elem[ dir ]) ) {
8731
					if ( elem.nodeType === 1 || checkNonElements ) {
8732
						outerCache = elem[ expando ] || (elem[ expando ] = {});
8733
						if ( (oldCache = outerCache[ dir ]) &&
8734
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
8735
8736
							// Assign to newCache so results back-propagate to previous elements
8737
							return (newCache[ 2 ] = oldCache[ 2 ]);
8738
						} else {
8739
							// Reuse newcache so results back-propagate to previous elements
8740
							outerCache[ dir ] = newCache;
8741
8742
							// A match means we're done; a fail means we have to keep checking
8743
							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
8744
								return true;
8745
							}
8746
						}
8747
					}
8748
				}
8749
			}
8750
		};
8751
}
8752
8753
function elementMatcher( matchers ) {
8754
	return matchers.length > 1 ?
8755
		function( elem, context, xml ) {
8756
			var i = matchers.length;
8757
			while ( i-- ) {
8758
				if ( !matchers[i]( elem, context, xml ) ) {
8759
					return false;
8760
				}
8761
			}
8762
			return true;
8763
		} :
8764
		matchers[0];
8765
}
8766
8767
function multipleContexts( selector, contexts, results ) {
8768
	var i = 0,
8769
		len = contexts.length;
8770
	for ( ; i < len; i++ ) {
8771
		Sizzle( selector, contexts[i], results );
8772
	}
8773
	return results;
8774
}
8775
8776
function condense( unmatched, map, filter, context, xml ) {
8777
	var elem,
8778
		newUnmatched = [],
8779
		i = 0,
8780
		len = unmatched.length,
8781
		mapped = map != null;
8782
8783
	for ( ; i < len; i++ ) {
8784
		if ( (elem = unmatched[i]) ) {
8785
			if ( !filter || filter( elem, context, xml ) ) {
8786
				newUnmatched.push( elem );
8787
				if ( mapped ) {
8788
					map.push( i );
8789
				}
8790
			}
8791
		}
8792
	}
8793
8794
	return newUnmatched;
8795
}
8796
8797
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
8798
	if ( postFilter && !postFilter[ expando ] ) {
8799
		postFilter = setMatcher( postFilter );
8800
	}
8801
	if ( postFinder && !postFinder[ expando ] ) {
8802
		postFinder = setMatcher( postFinder, postSelector );
8803
	}
8804
	return markFunction(function( seed, results, context, xml ) {
8805
		var temp, i, elem,
8806
			preMap = [],
8807
			postMap = [],
8808
			preexisting = results.length,
8809
8810
			// Get initial elements from seed or context
8811
			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
8812
8813
			// Prefilter to get matcher input, preserving a map for seed-results synchronization
8814
			matcherIn = preFilter && ( seed || !selector ) ?
8815
				condense( elems, preMap, preFilter, context, xml ) :
8816
				elems,
8817
8818
			matcherOut = matcher ?
8819
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
8820
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
8821
8822
					// ...intermediate processing is necessary
8823
					[] :
8824
8825
					// ...otherwise use results directly
8826
					results :
8827
				matcherIn;
8828
8829
		// Find primary matches
8830
		if ( matcher ) {
8831
			matcher( matcherIn, matcherOut, context, xml );
8832
		}
8833
8834
		// Apply postFilter
8835
		if ( postFilter ) {
8836
			temp = condense( matcherOut, postMap );
8837
			postFilter( temp, [], context, xml );
8838
8839
			// Un-match failing elements by moving them back to matcherIn
8840
			i = temp.length;
8841
			while ( i-- ) {
8842
				if ( (elem = temp[i]) ) {
8843
					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
8844
				}
8845
			}
8846
		}
8847
8848
		if ( seed ) {
8849
			if ( postFinder || preFilter ) {
8850
				if ( postFinder ) {
8851
					// Get the final matcherOut by condensing this intermediate into postFinder contexts
8852
					temp = [];
8853
					i = matcherOut.length;
8854
					while ( i-- ) {
8855
						if ( (elem = matcherOut[i]) ) {
8856
							// Restore matcherIn since elem is not yet a final match
8857
							temp.push( (matcherIn[i] = elem) );
8858
						}
8859
					}
8860
					postFinder( null, (matcherOut = []), temp, xml );
8861
				}
8862
8863
				// Move matched elements from seed to results to keep them synchronized
8864
				i = matcherOut.length;
8865
				while ( i-- ) {
8866
					if ( (elem = matcherOut[i]) &&
8867
						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
8868
8869
						seed[temp] = !(results[temp] = elem);
8870
					}
8871
				}
8872
			}
8873
8874
		// Add elements to results, through postFinder if defined
8875
		} else {
8876
			matcherOut = condense(
8877
				matcherOut === results ?
8878
					matcherOut.splice( preexisting, matcherOut.length ) :
8879
					matcherOut
8880
			);
8881
			if ( postFinder ) {
8882
				postFinder( null, results, matcherOut, xml );
8883
			} else {
8884
				push.apply( results, matcherOut );
8885
			}
8886
		}
8887
	});
8888
}
8889
8890
function matcherFromTokens( tokens ) {
8891
	var checkContext, matcher, j,
8892
		len = tokens.length,
8893
		leadingRelative = Expr.relative[ tokens[0].type ],
8894
		implicitRelative = leadingRelative || Expr.relative[" "],
8895
		i = leadingRelative ? 1 : 0,
8896
8897
		// The foundational matcher ensures that elements are reachable from top-level context(s)
8898
		matchContext = addCombinator( function( elem ) {
8899
			return elem === checkContext;
8900
		}, implicitRelative, true ),
8901
		matchAnyContext = addCombinator( function( elem ) {
8902
			return indexOf( checkContext, elem ) > -1;
8903
		}, implicitRelative, true ),
8904
		matchers = [ function( elem, context, xml ) {
8905
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
8906
				(checkContext = context).nodeType ?
8907
					matchContext( elem, context, xml ) :
8908
					matchAnyContext( elem, context, xml ) );
8909
			// Avoid hanging onto element (issue #299)
8910
			checkContext = null;
8911
			return ret;
8912
		} ];
8913
8914
	for ( ; i < len; i++ ) {
8915
		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
8916
			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
8917
		} else {
8918
			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
8919
8920
			// Return special upon seeing a positional matcher
8921
			if ( matcher[ expando ] ) {
8922
				// Find the next relative operator (if any) for proper handling
8923
				j = ++i;
8924
				for ( ; j < len; j++ ) {
8925
					if ( Expr.relative[ tokens[j].type ] ) {
8926
						break;
8927
					}
8928
				}
8929
				return setMatcher(
8930
					i > 1 && elementMatcher( matchers ),
8931
					i > 1 && toSelector(
8932
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
8933
						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
8934
					).replace( rtrim, "$1" ),
8935
					matcher,
8936
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
8937
					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
8938
					j < len && toSelector( tokens )
8939
				);
8940
			}
8941
			matchers.push( matcher );
8942
		}
8943
	}
8944
8945
	return elementMatcher( matchers );
8946
}
8947
8948
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
8949
	var bySet = setMatchers.length > 0,
8950
		byElement = elementMatchers.length > 0,
8951
		superMatcher = function( seed, context, xml, results, outermost ) {
8952
			var elem, j, matcher,
8953
				matchedCount = 0,
8954
				i = "0",
8955
				unmatched = seed && [],
8956
				setMatched = [],
8957
				contextBackup = outermostContext,
8958
				// We must always have either seed elements or outermost context
8959
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
8960
				// Use integer dirruns iff this is the outermost matcher
8961
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
8962
				len = elems.length;
8963
8964
			if ( outermost ) {
8965
				outermostContext = context !== document && context;
8966
			}
8967
8968
			// Add elements passing elementMatchers directly to results
8969
			// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
8970
			// Support: IE<9, Safari
8971
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
8972
			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
8973
				if ( byElement && elem ) {
8974
					j = 0;
8975
					while ( (matcher = elementMatchers[j++]) ) {
8976
						if ( matcher( elem, context, xml ) ) {
8977
							results.push( elem );
8978
							break;
8979
						}
8980
					}
8981
					if ( outermost ) {
8982
						dirruns = dirrunsUnique;
8983
					}
8984
				}
8985
8986
				// Track unmatched elements for set filters
8987
				if ( bySet ) {
8988
					// They will have gone through all possible matchers
8989
					if ( (elem = !matcher && elem) ) {
8990
						matchedCount--;
8991
					}
8992
8993
					// Lengthen the array for every element, matched or not
8994
					if ( seed ) {
8995
						unmatched.push( elem );
8996
					}
8997
				}
8998
			}
8999
9000
			// Apply set filters to unmatched elements
9001
			matchedCount += i;
9002
			if ( bySet && i !== matchedCount ) {
9003
				j = 0;
9004
				while ( (matcher = setMatchers[j++]) ) {
9005
					matcher( unmatched, setMatched, context, xml );
9006
				}
9007
9008
				if ( seed ) {
9009
					// Reintegrate element matches to eliminate the need for sorting
9010
					if ( matchedCount > 0 ) {
9011
						while ( i-- ) {
9012
							if ( !(unmatched[i] || setMatched[i]) ) {
9013
								setMatched[i] = pop.call( results );
9014
							}
9015
						}
9016
					}
9017
9018
					// Discard index placeholder values to get only actual matches
9019
					setMatched = condense( setMatched );
9020
				}
9021
9022
				// Add matches to results
9023
				push.apply( results, setMatched );
9024
9025
				// Seedless set matches succeeding multiple successful matchers stipulate sorting
9026
				if ( outermost && !seed && setMatched.length > 0 &&
9027
					( matchedCount + setMatchers.length ) > 1 ) {
9028
9029
					Sizzle.uniqueSort( results );
9030
				}
9031
			}
9032
9033
			// Override manipulation of globals by nested matchers
9034
			if ( outermost ) {
9035
				dirruns = dirrunsUnique;
9036
				outermostContext = contextBackup;
9037
			}
9038
9039
			return unmatched;
9040
		};
9041
9042
	return bySet ?
9043
		markFunction( superMatcher ) :
9044
		superMatcher;
9045
}
9046
9047
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
9048
	var i,
9049
		setMatchers = [],
9050
		elementMatchers = [],
9051
		cached = compilerCache[ selector + " " ];
9052
9053
	if ( !cached ) {
9054
		// Generate a function of recursive functions that can be used to check each element
9055
		if ( !match ) {
9056
			match = tokenize( selector );
9057
		}
9058
		i = match.length;
9059
		while ( i-- ) {
9060
			cached = matcherFromTokens( match[i] );
9061
			if ( cached[ expando ] ) {
9062
				setMatchers.push( cached );
9063
			} else {
9064
				elementMatchers.push( cached );
9065
			}
9066
		}
9067
9068
		// Cache the compiled function
9069
		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
9070
9071
		// Save selector and tokenization
9072
		cached.selector = selector;
9073
	}
9074
	return cached;
9075
};
9076
9077
/**
9078
 * A low-level selection function that works with Sizzle's compiled
9079
 *  selector functions
9080
 * @param {String|Function} selector A selector or a pre-compiled
9081
 *  selector function built with Sizzle.compile
9082
 * @param {Element} context
9083
 * @param {Array} [results]
9084
 * @param {Array} [seed] A set of elements to match against
9085
 */
9086
select = Sizzle.select = function( selector, context, results, seed ) {
9087
	var i, tokens, token, type, find,
9088
		compiled = typeof selector === "function" && selector,
9089
		match = !seed && tokenize( (selector = compiled.selector || selector) );
9090
9091
	results = results || [];
9092
9093
	// Try to minimize operations if there is no seed and only one group
9094
	if ( match.length === 1 ) {
9095
9096
		// Take a shortcut and set the context if the root selector is an ID
9097
		tokens = match[0] = match[0].slice( 0 );
9098
		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
9099
				support.getById && context.nodeType === 9 && documentIsHTML &&
9100
				Expr.relative[ tokens[1].type ] ) {
9101
9102
			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
9103
			if ( !context ) {
9104
				return results;
9105
9106
			// Precompiled matchers will still verify ancestry, so step up a level
9107
			} else if ( compiled ) {
9108
				context = context.parentNode;
9109
			}
9110
9111
			selector = selector.slice( tokens.shift().value.length );
9112
		}
9113
9114
		// Fetch a seed set for right-to-left matching
9115
		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
9116
		while ( i-- ) {
9117
			token = tokens[i];
9118
9119
			// Abort if we hit a combinator
9120
			if ( Expr.relative[ (type = token.type) ] ) {
9121
				break;
9122
			}
9123
			if ( (find = Expr.find[ type ]) ) {
9124
				// Search, expanding context for leading sibling combinators
9125
				if ( (seed = find(
9126
					token.matches[0].replace( runescape, funescape ),
9127
					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
9128
				)) ) {
9129
9130
					// If seed is empty or no tokens remain, we can return early
9131
					tokens.splice( i, 1 );
9132
					selector = seed.length && toSelector( tokens );
9133
					if ( !selector ) {
9134
						push.apply( results, seed );
9135
						return results;
9136
					}
9137
9138
					break;
9139
				}
9140
			}
9141
		}
9142
	}
9143
9144
	// Compile and execute a filtering function if one is not provided
9145
	// Provide `match` to avoid retokenization if we modified the selector above
9146
	( compiled || compile( selector, match ) )(
9147
		seed,
9148
		context,
9149
		!documentIsHTML,
9150
		results,
9151
		rsibling.test( selector ) && testContext( context.parentNode ) || context
9152
	);
9153
	return results;
9154
};
9155
9156
// One-time assignments
9157
9158
// Sort stability
9159
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
9160
9161
// Support: Chrome 14-35+
9162
// Always assume duplicates if they aren't passed to the comparison function
9163
support.detectDuplicates = !!hasDuplicate;
9164
9165
// Initialize against the default document
9166
setDocument();
9167
9168
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
9169
// Detached nodes confoundingly follow *each other*
9170
support.sortDetached = assert(function( div1 ) {
9171
	// Should return 1, but returns 4 (following)
9172
	return div1.compareDocumentPosition( document.createElement("div") ) & 1;
9173
});
9174
9175
// Support: IE<8
9176
// Prevent attribute/property "interpolation"
9177
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
9178
if ( !assert(function( div ) {
9179
	div.innerHTML = "<a href='#'></a>";
9180
	return div.firstChild.getAttribute("href") === "#" ;
9181
}) ) {
9182
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
9183
		if ( !isXML ) {
9184
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
9185
		}
9186
	});
9187
}
9188
9189
// Support: IE<9
9190
// Use defaultValue in place of getAttribute("value")
9191
if ( !support.attributes || !assert(function( div ) {
9192
	div.innerHTML = "<input/>";
9193
	div.firstChild.setAttribute( "value", "" );
9194
	return div.firstChild.getAttribute( "value" ) === "";
9195
}) ) {
9196
	addHandle( "value", function( elem, name, isXML ) {
9197
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
9198
			return elem.defaultValue;
9199
		}
9200
	});
9201
}
9202
9203
// Support: IE<9
9204
// Use getAttributeNode to fetch booleans when getAttribute lies
9205
if ( !assert(function( div ) {
9206
	return div.getAttribute("disabled") == null;
9207
}) ) {
9208
	addHandle( booleans, function( elem, name, isXML ) {
9209
		var val;
9210
		if ( !isXML ) {
9211
			return elem[ name ] === true ? name.toLowerCase() :
9212
					(val = elem.getAttributeNode( name )) && val.specified ?
9213
					val.value :
9214
				null;
9215
		}
9216
	});
9217
}
9218
9219
return Sizzle;
9220
9221
})( window );
9222
9223
9224
9225
jQuery.find = Sizzle;
9226
jQuery.expr = Sizzle.selectors;
9227
jQuery.expr[":"] = jQuery.expr.pseudos;
9228
jQuery.unique = Sizzle.uniqueSort;
9229
jQuery.text = Sizzle.getText;
9230
jQuery.isXMLDoc = Sizzle.isXML;
9231
jQuery.contains = Sizzle.contains;
9232
9233
9234
9235
var rneedsContext = jQuery.expr.match.needsContext;
9236
9237
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
9238
9239
9240
9241
var risSimple = /^.[^:#\[\.,]*$/;
9242
9243
// Implement the identical functionality for filter and not
9244
function winnow( elements, qualifier, not ) {
9245
	if ( jQuery.isFunction( qualifier ) ) {
9246
		return jQuery.grep( elements, function( elem, i ) {
9247
			/* jshint -W018 */
9248
			return !!qualifier.call( elem, i, elem ) !== not;
9249
		});
9250
9251
	}
9252
9253
	if ( qualifier.nodeType ) {
9254
		return jQuery.grep( elements, function( elem ) {
9255
			return ( elem === qualifier ) !== not;
9256
		});
9257
9258
	}
9259
9260
	if ( typeof qualifier === "string" ) {
9261
		if ( risSimple.test( qualifier ) ) {
9262
			return jQuery.filter( qualifier, elements, not );
9263
		}
9264
9265
		qualifier = jQuery.filter( qualifier, elements );
9266
	}
9267
9268
	return jQuery.grep( elements, function( elem ) {
9269
		return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
9270
	});
9271
}
9272
9273
jQuery.filter = function( expr, elems, not ) {
9274
	var elem = elems[ 0 ];
9275
9276
	if ( not ) {
9277
		expr = ":not(" + expr + ")";
9278
	}
9279
9280
	return elems.length === 1 && elem.nodeType === 1 ?
9281
		jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
9282
		jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
9283
			return elem.nodeType === 1;
9284
		}));
9285
};
9286
9287
jQuery.fn.extend({
9288
	find: function( selector ) {
9289
		var i,
9290
			len = this.length,
9291
			ret = [],
9292
			self = this;
9293
9294
		if ( typeof selector !== "string" ) {
9295
			return this.pushStack( jQuery( selector ).filter(function() {
9296
				for ( i = 0; i < len; i++ ) {
9297
					if ( jQuery.contains( self[ i ], this ) ) {
9298
						return true;
9299
					}
9300
				}
9301
			}) );
9302
		}
9303
9304
		for ( i = 0; i < len; i++ ) {
9305
			jQuery.find( selector, self[ i ], ret );
9306
		}
9307
9308
		// Needed because $( selector, context ) becomes $( context ).find( selector )
9309
		ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
9310
		ret.selector = this.selector ? this.selector + " " + selector : selector;
9311
		return ret;
9312
	},
9313
	filter: function( selector ) {
9314
		return this.pushStack( winnow(this, selector || [], false) );
9315
	},
9316
	not: function( selector ) {
9317
		return this.pushStack( winnow(this, selector || [], true) );
9318
	},
9319
	is: function( selector ) {
9320
		return !!winnow(
9321
			this,
9322
9323
			// If this is a positional/relative selector, check membership in the returned set
9324
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
9325
			typeof selector === "string" && rneedsContext.test( selector ) ?
9326
				jQuery( selector ) :
9327
				selector || [],
9328
			false
9329
		).length;
9330
	}
9331
});
9332
9333
9334
// Initialize a jQuery object
9335
9336
9337
// A central reference to the root jQuery(document)
9338
var rootjQuery,
9339
9340
	// A simple way to check for HTML strings
9341
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
9342
	// Strict HTML recognition (#11290: must start with <)
9343
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
9344
9345
	init = jQuery.fn.init = function( selector, context ) {
9346
		var match, elem;
9347
9348
		// HANDLE: $(""), $(null), $(undefined), $(false)
9349
		if ( !selector ) {
9350
			return this;
9351
		}
9352
9353
		// Handle HTML strings
9354
		if ( typeof selector === "string" ) {
9355
			if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
9356
				// Assume that strings that start and end with <> are HTML and skip the regex check
9357
				match = [ null, selector, null ];
9358
9359
			} else {
9360
				match = rquickExpr.exec( selector );
9361
			}
9362
9363
			// Match html or make sure no context is specified for #id
9364
			if ( match && (match[1] || !context) ) {
9365
9366
				// HANDLE: $(html) -> $(array)
9367
				if ( match[1] ) {
9368
					context = context instanceof jQuery ? context[0] : context;
9369
9370
					// Option to run scripts is true for back-compat
9371
					// Intentionally let the error be thrown if parseHTML is not present
9372
					jQuery.merge( this, jQuery.parseHTML(
9373
						match[1],
9374
						context && context.nodeType ? context.ownerDocument || context : document,
9375
						true
9376
					) );
9377
9378
					// HANDLE: $(html, props)
9379
					if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
9380
						for ( match in context ) {
9381
							// Properties of context are called as methods if possible
9382
							if ( jQuery.isFunction( this[ match ] ) ) {
9383
								this[ match ]( context[ match ] );
9384
9385
							// ...and otherwise set as attributes
9386
							} else {
9387
								this.attr( match, context[ match ] );
9388
							}
9389
						}
9390
					}
9391
9392
					return this;
9393
9394
				// HANDLE: $(#id)
9395
				} else {
9396
					elem = document.getElementById( match[2] );
9397
9398
					// Support: Blackberry 4.6
9399
					// gEBID returns nodes no longer in the document (#6963)
9400
					if ( elem && elem.parentNode ) {
9401
						// Inject the element directly into the jQuery object
9402
						this.length = 1;
9403
						this[0] = elem;
9404
					}
9405
9406
					this.context = document;
9407
					this.selector = selector;
9408
					return this;
9409
				}
9410
9411
			// HANDLE: $(expr, $(...))
9412
			} else if ( !context || context.jquery ) {
9413
				return ( context || rootjQuery ).find( selector );
9414
9415
			// HANDLE: $(expr, context)
9416
			// (which is just equivalent to: $(context).find(expr)
9417
			} else {
9418
				return this.constructor( context ).find( selector );
9419
			}
9420
9421
		// HANDLE: $(DOMElement)
9422
		} else if ( selector.nodeType ) {
9423
			this.context = this[0] = selector;
9424
			this.length = 1;
9425
			return this;
9426
9427
		// HANDLE: $(function)
9428
		// Shortcut for document ready
9429
		} else if ( jQuery.isFunction( selector ) ) {
9430
			return typeof rootjQuery.ready !== "undefined" ?
9431
				rootjQuery.ready( selector ) :
9432
				// Execute immediately if ready is not present
9433
				selector( jQuery );
9434
		}
9435
9436
		if ( selector.selector !== undefined ) {
9437
			this.selector = selector.selector;
9438
			this.context = selector.context;
9439
		}
9440
9441
		return jQuery.makeArray( selector, this );
9442
	};
9443
9444
// Give the init function the jQuery prototype for later instantiation
9445
init.prototype = jQuery.fn;
9446
9447
// Initialize central reference
9448
rootjQuery = jQuery( document );
9449
9450
9451
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
9452
	// Methods guaranteed to produce a unique set when starting from a unique set
9453
	guaranteedUnique = {
9454
		children: true,
9455
		contents: true,
9456
		next: true,
9457
		prev: true
9458
	};
9459
9460
jQuery.extend({
9461
	dir: function( elem, dir, until ) {
9462
		var matched = [],
9463
			truncate = until !== undefined;
9464
9465
		while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
9466
			if ( elem.nodeType === 1 ) {
9467
				if ( truncate && jQuery( elem ).is( until ) ) {
9468
					break;
9469
				}
9470
				matched.push( elem );
9471
			}
9472
		}
9473
		return matched;
9474
	},
9475
9476
	sibling: function( n, elem ) {
9477
		var matched = [];
9478
9479
		for ( ; n; n = n.nextSibling ) {
9480
			if ( n.nodeType === 1 && n !== elem ) {
9481
				matched.push( n );
9482
			}
9483
		}
9484
9485
		return matched;
9486
	}
9487
});
9488
9489
jQuery.fn.extend({
9490
	has: function( target ) {
9491
		var targets = jQuery( target, this ),
9492
			l = targets.length;
9493
9494
		return this.filter(function() {
9495
			var i = 0;
9496
			for ( ; i < l; i++ ) {
9497
				if ( jQuery.contains( this, targets[i] ) ) {
9498
					return true;
9499
				}
9500
			}
9501
		});
9502
	},
9503
9504
	closest: function( selectors, context ) {
9505
		var cur,
9506
			i = 0,
9507
			l = this.length,
9508
			matched = [],
9509
			pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
9510
				jQuery( selectors, context || this.context ) :
9511
				0;
9512
9513
		for ( ; i < l; i++ ) {
9514
			for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
9515
				// Always skip document fragments
9516
				if ( cur.nodeType < 11 && (pos ?
9517
					pos.index(cur) > -1 :
9518
9519
					// Don't pass non-elements to Sizzle
9520
					cur.nodeType === 1 &&
9521
						jQuery.find.matchesSelector(cur, selectors)) ) {
9522
9523
					matched.push( cur );
9524
					break;
9525
				}
9526
			}
9527
		}
9528
9529
		return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
9530
	},
9531
9532
	// Determine the position of an element within the set
9533
	index: function( elem ) {
9534
9535
		// No argument, return index in parent
9536
		if ( !elem ) {
9537
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
9538
		}
9539
9540
		// Index in selector
9541
		if ( typeof elem === "string" ) {
9542
			return indexOf.call( jQuery( elem ), this[ 0 ] );
9543
		}
9544
9545
		// Locate the position of the desired element
9546
		return indexOf.call( this,
9547
9548
			// If it receives a jQuery object, the first element is used
9549
			elem.jquery ? elem[ 0 ] : elem
9550
		);
9551
	},
9552
9553
	add: function( selector, context ) {
9554
		return this.pushStack(
9555
			jQuery.unique(
9556
				jQuery.merge( this.get(), jQuery( selector, context ) )
9557
			)
9558
		);
9559
	},
9560
9561
	addBack: function( selector ) {
9562
		return this.add( selector == null ?
9563
			this.prevObject : this.prevObject.filter(selector)
9564
		);
9565
	}
9566
});
9567
9568
function sibling( cur, dir ) {
9569
	while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
9570
	return cur;
9571
}
9572
9573
jQuery.each({
9574
	parent: function( elem ) {
9575
		var parent = elem.parentNode;
9576
		return parent && parent.nodeType !== 11 ? parent : null;
9577
	},
9578
	parents: function( elem ) {
9579
		return jQuery.dir( elem, "parentNode" );
9580
	},
9581
	parentsUntil: function( elem, i, until ) {
9582
		return jQuery.dir( elem, "parentNode", until );
9583
	},
9584
	next: function( elem ) {
9585
		return sibling( elem, "nextSibling" );
9586
	},
9587
	prev: function( elem ) {
9588
		return sibling( elem, "previousSibling" );
9589
	},
9590
	nextAll: function( elem ) {
9591
		return jQuery.dir( elem, "nextSibling" );
9592
	},
9593
	prevAll: function( elem ) {
9594
		return jQuery.dir( elem, "previousSibling" );
9595
	},
9596
	nextUntil: function( elem, i, until ) {
9597
		return jQuery.dir( elem, "nextSibling", until );
9598
	},
9599
	prevUntil: function( elem, i, until ) {
9600
		return jQuery.dir( elem, "previousSibling", until );
9601
	},
9602
	siblings: function( elem ) {
9603
		return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
9604
	},
9605
	children: function( elem ) {
9606
		return jQuery.sibling( elem.firstChild );
9607
	},
9608
	contents: function( elem ) {
9609
		return elem.contentDocument || jQuery.merge( [], elem.childNodes );
9610
	}
9611
}, function( name, fn ) {
9612
	jQuery.fn[ name ] = function( until, selector ) {
9613
		var matched = jQuery.map( this, fn, until );
9614
9615
		if ( name.slice( -5 ) !== "Until" ) {
9616
			selector = until;
9617
		}
9618
9619
		if ( selector && typeof selector === "string" ) {
9620
			matched = jQuery.filter( selector, matched );
9621
		}
9622
9623
		if ( this.length > 1 ) {
9624
			// Remove duplicates
9625
			if ( !guaranteedUnique[ name ] ) {
9626
				jQuery.unique( matched );
9627
			}
9628
9629
			// Reverse order for parents* and prev-derivatives
9630
			if ( rparentsprev.test( name ) ) {
9631
				matched.reverse();
9632
			}
9633
		}
9634
9635
		return this.pushStack( matched );
9636
	};
9637
});
9638
var rnotwhite = (/\S+/g);
9639
9640
9641
9642
// String to Object options format cache
9643
var optionsCache = {};
9644
9645
// Convert String-formatted options into Object-formatted ones and store in cache
9646
function createOptions( options ) {
9647
	var object = optionsCache[ options ] = {};
9648
	jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
9649
		object[ flag ] = true;
9650
	});
9651
	return object;
9652
}
9653
9654
/*
9655
 * Create a callback list using the following parameters:
9656
 *
9657
 *	options: an optional list of space-separated options that will change how
9658
 *			the callback list behaves or a more traditional option object
9659
 *
9660
 * By default a callback list will act like an event callback list and can be
9661
 * "fired" multiple times.
9662
 *
9663
 * Possible options:
9664
 *
9665
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
9666
 *
9667
 *	memory:			will keep track of previous values and will call any callback added
9668
 *					after the list has been fired right away with the latest "memorized"
9669
 *					values (like a Deferred)
9670
 *
9671
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
9672
 *
9673
 *	stopOnFalse:	interrupt callings when a callback returns false
9674
 *
9675
 */
9676
jQuery.Callbacks = function( options ) {
9677
9678
	// Convert options from String-formatted to Object-formatted if needed
9679
	// (we check in cache first)
9680
	options = typeof options === "string" ?
9681
		( optionsCache[ options ] || createOptions( options ) ) :
9682
		jQuery.extend( {}, options );
9683
9684
	var // Last fire value (for non-forgettable lists)
9685
		memory,
9686
		// Flag to know if list was already fired
9687
		fired,
9688
		// Flag to know if list is currently firing
9689
		firing,
9690
		// First callback to fire (used internally by add and fireWith)
9691
		firingStart,
9692
		// End of the loop when firing
9693
		firingLength,
9694
		// Index of currently firing callback (modified by remove if needed)
9695
		firingIndex,
9696
		// Actual callback list
9697
		list = [],
9698
		// Stack of fire calls for repeatable lists
9699
		stack = !options.once && [],
9700
		// Fire callbacks
9701
		fire = function( data ) {
9702
			memory = options.memory && data;
9703
			fired = true;
9704
			firingIndex = firingStart || 0;
9705
			firingStart = 0;
9706
			firingLength = list.length;
9707
			firing = true;
9708
			for ( ; list && firingIndex < firingLength; firingIndex++ ) {
9709
				if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
9710
					memory = false; // To prevent further calls using add
9711
					break;
9712
				}
9713
			}
9714
			firing = false;
9715
			if ( list ) {
9716
				if ( stack ) {
9717
					if ( stack.length ) {
9718
						fire( stack.shift() );
9719
					}
9720
				} else if ( memory ) {
9721
					list = [];
9722
				} else {
9723
					self.disable();
9724
				}
9725
			}
9726
		},
9727
		// Actual Callbacks object
9728
		self = {
9729
			// Add a callback or a collection of callbacks to the list
9730
			add: function() {
9731
				if ( list ) {
9732
					// First, we save the current length
9733
					var start = list.length;
9734
					(function add( args ) {
9735
						jQuery.each( args, function( _, arg ) {
9736
							var type = jQuery.type( arg );
9737
							if ( type === "function" ) {
9738
								if ( !options.unique || !self.has( arg ) ) {
9739
									list.push( arg );
9740
								}
9741
							} else if ( arg && arg.length && type !== "string" ) {
9742
								// Inspect recursively
9743
								add( arg );
9744
							}
9745
						});
9746
					})( arguments );
9747
					// Do we need to add the callbacks to the
9748
					// current firing batch?
9749
					if ( firing ) {
9750
						firingLength = list.length;
9751
					// With memory, if we're not firing then
9752
					// we should call right away
9753
					} else if ( memory ) {
9754
						firingStart = start;
9755
						fire( memory );
9756
					}
9757
				}
9758
				return this;
9759
			},
9760
			// Remove a callback from the list
9761
			remove: function() {
9762
				if ( list ) {
9763
					jQuery.each( arguments, function( _, arg ) {
9764
						var index;
9765
						while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
9766
							list.splice( index, 1 );
9767
							// Handle firing indexes
9768
							if ( firing ) {
9769
								if ( index <= firingLength ) {
9770
									firingLength--;
9771
								}
9772
								if ( index <= firingIndex ) {
9773
									firingIndex--;
9774
								}
9775
							}
9776
						}
9777
					});
9778
				}
9779
				return this;
9780
			},
9781
			// Check if a given callback is in the list.
9782
			// If no argument is given, return whether or not list has callbacks attached.
9783
			has: function( fn ) {
9784
				return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
9785
			},
9786
			// Remove all callbacks from the list
9787
			empty: function() {
9788
				list = [];
9789
				firingLength = 0;
9790
				return this;
9791
			},
9792
			// Have the list do nothing anymore
9793
			disable: function() {
9794
				list = stack = memory = undefined;
9795
				return this;
9796
			},
9797
			// Is it disabled?
9798
			disabled: function() {
9799
				return !list;
9800
			},
9801
			// Lock the list in its current state
9802
			lock: function() {
9803
				stack = undefined;
9804
				if ( !memory ) {
9805
					self.disable();
9806
				}
9807
				return this;
9808
			},
9809
			// Is it locked?
9810
			locked: function() {
9811
				return !stack;
9812
			},
9813
			// Call all callbacks with the given context and arguments
9814
			fireWith: function( context, args ) {
9815
				if ( list && ( !fired || stack ) ) {
9816
					args = args || [];
9817
					args = [ context, args.slice ? args.slice() : args ];
9818
					if ( firing ) {
9819
						stack.push( args );
9820
					} else {
9821
						fire( args );
9822
					}
9823
				}
9824
				return this;
9825
			},
9826
			// Call all the callbacks with the given arguments
9827
			fire: function() {
9828
				self.fireWith( this, arguments );
9829
				return this;
9830
			},
9831
			// To know if the callbacks have already been called at least once
9832
			fired: function() {
9833
				return !!fired;
9834
			}
9835
		};
9836
9837
	return self;
9838
};
9839
9840
9841
jQuery.extend({
9842
9843
	Deferred: function( func ) {
9844
		var tuples = [
9845
				// action, add listener, listener list, final state
9846
				[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
9847
				[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
9848
				[ "notify", "progress", jQuery.Callbacks("memory") ]
9849
			],
9850
			state = "pending",
9851
			promise = {
9852
				state: function() {
9853
					return state;
9854
				},
9855
				always: function() {
9856
					deferred.done( arguments ).fail( arguments );
9857
					return this;
9858
				},
9859
				then: function( /* fnDone, fnFail, fnProgress */ ) {
9860
					var fns = arguments;
9861
					return jQuery.Deferred(function( newDefer ) {
9862
						jQuery.each( tuples, function( i, tuple ) {
9863
							var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
9864
							// deferred[ done | fail | progress ] for forwarding actions to newDefer
9865
							deferred[ tuple[1] ](function() {
9866
								var returned = fn && fn.apply( this, arguments );
9867
								if ( returned && jQuery.isFunction( returned.promise ) ) {
9868
									returned.promise()
9869
										.done( newDefer.resolve )
9870
										.fail( newDefer.reject )
9871
										.progress( newDefer.notify );
9872
								} else {
9873
									newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
9874
								}
9875
							});
9876
						});
9877
						fns = null;
9878
					}).promise();
9879
				},
9880
				// Get a promise for this deferred
9881
				// If obj is provided, the promise aspect is added to the object
9882
				promise: function( obj ) {
9883
					return obj != null ? jQuery.extend( obj, promise ) : promise;
9884
				}
9885
			},
9886
			deferred = {};
9887
9888
		// Keep pipe for back-compat
9889
		promise.pipe = promise.then;
9890
9891
		// Add list-specific methods
9892
		jQuery.each( tuples, function( i, tuple ) {
9893
			var list = tuple[ 2 ],
9894
				stateString = tuple[ 3 ];
9895
9896
			// promise[ done | fail | progress ] = list.add
9897
			promise[ tuple[1] ] = list.add;
9898
9899
			// Handle state
9900
			if ( stateString ) {
9901
				list.add(function() {
9902
					// state = [ resolved | rejected ]
9903
					state = stateString;
9904
9905
				// [ reject_list | resolve_list ].disable; progress_list.lock
9906
				}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
9907
			}
9908
9909
			// deferred[ resolve | reject | notify ]
9910
			deferred[ tuple[0] ] = function() {
9911
				deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
9912
				return this;
9913
			};
9914
			deferred[ tuple[0] + "With" ] = list.fireWith;
9915
		});
9916
9917
		// Make the deferred a promise
9918
		promise.promise( deferred );
9919
9920
		// Call given func if any
9921
		if ( func ) {
9922
			func.call( deferred, deferred );
9923
		}
9924
9925
		// All done!
9926
		return deferred;
9927
	},
9928
9929
	// Deferred helper
9930
	when: function( subordinate /* , ..., subordinateN */ ) {
9931
		var i = 0,
9932
			resolveValues = slice.call( arguments ),
9933
			length = resolveValues.length,
9934
9935
			// the count of uncompleted subordinates
9936
			remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
9937
9938
			// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
9939
			deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
9940
9941
			// Update function for both resolve and progress values
9942
			updateFunc = function( i, contexts, values ) {
9943
				return function( value ) {
9944
					contexts[ i ] = this;
9945
					values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
9946
					if ( values === progressValues ) {
9947
						deferred.notifyWith( contexts, values );
9948
					} else if ( !( --remaining ) ) {
9949
						deferred.resolveWith( contexts, values );
9950
					}
9951
				};
9952
			},
9953
9954
			progressValues, progressContexts, resolveContexts;
9955
9956
		// Add listeners to Deferred subordinates; treat others as resolved
9957
		if ( length > 1 ) {
9958
			progressValues = new Array( length );
9959
			progressContexts = new Array( length );
9960
			resolveContexts = new Array( length );
9961
			for ( ; i < length; i++ ) {
9962
				if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
9963
					resolveValues[ i ].promise()
9964
						.done( updateFunc( i, resolveContexts, resolveValues ) )
9965
						.fail( deferred.reject )
9966
						.progress( updateFunc( i, progressContexts, progressValues ) );
9967
				} else {
9968
					--remaining;
9969
				}
9970
			}
9971
		}
9972
9973
		// If we're not waiting on anything, resolve the master
9974
		if ( !remaining ) {
9975
			deferred.resolveWith( resolveContexts, resolveValues );
9976
		}
9977
9978
		return deferred.promise();
9979
	}
9980
});
9981
9982
9983
// The deferred used on DOM ready
9984
var readyList;
9985
9986
jQuery.fn.ready = function( fn ) {
9987
	// Add the callback
9988
	jQuery.ready.promise().done( fn );
9989
9990
	return this;
9991
};
9992
9993
jQuery.extend({
9994
	// Is the DOM ready to be used? Set to true once it occurs.
9995
	isReady: false,
9996
9997
	// A counter to track how many items to wait for before
9998
	// the ready event fires. See #6781
9999
	readyWait: 1,
10000
10001
	// Hold (or release) the ready event
10002
	holdReady: function( hold ) {
10003
		if ( hold ) {
10004
			jQuery.readyWait++;
10005
		} else {
10006
			jQuery.ready( true );
10007
		}
10008
	},
10009
10010
	// Handle when the DOM is ready
10011
	ready: function( wait ) {
10012
10013
		// Abort if there are pending holds or we're already ready
10014
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
10015
			return;
10016
		}
10017
10018
		// Remember that the DOM is ready
10019
		jQuery.isReady = true;
10020
10021
		// If a normal DOM Ready event fired, decrement, and wait if need be
10022
		if ( wait !== true && --jQuery.readyWait > 0 ) {
10023
			return;
10024
		}
10025
10026
		// If there are functions bound, to execute
10027
		readyList.resolveWith( document, [ jQuery ] );
10028
10029
		// Trigger any bound ready events
10030
		if ( jQuery.fn.triggerHandler ) {
10031
			jQuery( document ).triggerHandler( "ready" );
10032
			jQuery( document ).off( "ready" );
10033
		}
10034
	}
10035
});
10036
10037
/**
10038
 * The ready event handler and self cleanup method
10039
 */
10040
function completed() {
10041
	document.removeEventListener( "DOMContentLoaded", completed, false );
10042
	window.removeEventListener( "load", completed, false );
10043
	jQuery.ready();
10044
}
10045
10046
jQuery.ready.promise = function( obj ) {
10047
	if ( !readyList ) {
10048
10049
		readyList = jQuery.Deferred();
10050
10051
		// Catch cases where $(document).ready() is called after the browser event has already occurred.
10052
		// We once tried to use readyState "interactive" here, but it caused issues like the one
10053
		// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
10054
		if ( document.readyState === "complete" ) {
10055
			// Handle it asynchronously to allow scripts the opportunity to delay ready
10056
			setTimeout( jQuery.ready );
10057
10058
		} else {
10059
10060
			// Use the handy event callback
10061
			document.addEventListener( "DOMContentLoaded", completed, false );
10062
10063
			// A fallback to window.onload, that will always work
10064
			window.addEventListener( "load", completed, false );
10065
		}
10066
	}
10067
	return readyList.promise( obj );
10068
};
10069
10070
// Kick off the DOM ready check even if the user does not
10071
jQuery.ready.promise();
10072
10073
10074
10075
10076
// Multifunctional method to get and set values of a collection
10077
// The value/s can optionally be executed if it's a function
10078
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
10079
	var i = 0,
10080
		len = elems.length,
10081
		bulk = key == null;
10082
10083
	// Sets many values
10084
	if ( jQuery.type( key ) === "object" ) {
10085
		chainable = true;
10086
		for ( i in key ) {
10087
			jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
10088
		}
10089
10090
	// Sets one value
10091
	} else if ( value !== undefined ) {
10092
		chainable = true;
10093
10094
		if ( !jQuery.isFunction( value ) ) {
10095
			raw = true;
10096
		}
10097
10098
		if ( bulk ) {
10099
			// Bulk operations run against the entire set
10100
			if ( raw ) {
10101
				fn.call( elems, value );
10102
				fn = null;
10103
10104
			// ...except when executing function values
10105
			} else {
10106
				bulk = fn;
10107
				fn = function( elem, key, value ) {
10108
					return bulk.call( jQuery( elem ), value );
10109
				};
10110
			}
10111
		}
10112
10113
		if ( fn ) {
10114
			for ( ; i < len; i++ ) {
10115
				fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
10116
			}
10117
		}
10118
	}
10119
10120
	return chainable ?
10121
		elems :
10122
10123
		// Gets
10124
		bulk ?
10125
			fn.call( elems ) :
10126
			len ? fn( elems[0], key ) : emptyGet;
10127
};
10128
10129
10130
/**
10131
 * Determines whether an object can have data
10132
 */
10133
jQuery.acceptData = function( owner ) {
10134
	// Accepts only:
10135
	//  - Node
10136
	//    - Node.ELEMENT_NODE
10137
	//    - Node.DOCUMENT_NODE
10138
	//  - Object
10139
	//    - Any
10140
	/* jshint -W018 */
10141
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
10142
};
10143
10144
10145
function Data() {
10146
	// Support: Android<4,
10147
	// Old WebKit does not have Object.preventExtensions/freeze method,
10148
	// return new empty object instead with no [[set]] accessor
10149
	Object.defineProperty( this.cache = {}, 0, {
10150
		get: function() {
10151
			return {};
10152
		}
10153
	});
10154
10155
	this.expando = jQuery.expando + Data.uid++;
10156
}
10157
10158
Data.uid = 1;
10159
Data.accepts = jQuery.acceptData;
10160
10161
Data.prototype = {
10162
	key: function( owner ) {
10163
		// We can accept data for non-element nodes in modern browsers,
10164
		// but we should not, see #8335.
10165
		// Always return the key for a frozen object.
10166
		if ( !Data.accepts( owner ) ) {
10167
			return 0;
10168
		}
10169
10170
		var descriptor = {},
10171
			// Check if the owner object already has a cache key
10172
			unlock = owner[ this.expando ];
10173
10174
		// If not, create one
10175
		if ( !unlock ) {
10176
			unlock = Data.uid++;
10177
10178
			// Secure it in a non-enumerable, non-writable property
10179
			try {
10180
				descriptor[ this.expando ] = { value: unlock };
10181
				Object.defineProperties( owner, descriptor );
10182
10183
			// Support: Android<4
10184
			// Fallback to a less secure definition
10185
			} catch ( e ) {
10186
				descriptor[ this.expando ] = unlock;
10187
				jQuery.extend( owner, descriptor );
10188
			}
10189
		}
10190
10191
		// Ensure the cache object
10192
		if ( !this.cache[ unlock ] ) {
10193
			this.cache[ unlock ] = {};
10194
		}
10195
10196
		return unlock;
10197
	},
10198
	set: function( owner, data, value ) {
10199
		var prop,
10200
			// There may be an unlock assigned to this node,
10201
			// if there is no entry for this "owner", create one inline
10202
			// and set the unlock as though an owner entry had always existed
10203
			unlock = this.key( owner ),
10204
			cache = this.cache[ unlock ];
10205
10206
		// Handle: [ owner, key, value ] args
10207
		if ( typeof data === "string" ) {
10208
			cache[ data ] = value;
10209
10210
		// Handle: [ owner, { properties } ] args
10211
		} else {
10212
			// Fresh assignments by object are shallow copied
10213
			if ( jQuery.isEmptyObject( cache ) ) {
10214
				jQuery.extend( this.cache[ unlock ], data );
10215
			// Otherwise, copy the properties one-by-one to the cache object
10216
			} else {
10217
				for ( prop in data ) {
10218
					cache[ prop ] = data[ prop ];
10219
				}
10220
			}
10221
		}
10222
		return cache;
10223
	},
10224
	get: function( owner, key ) {
10225
		// Either a valid cache is found, or will be created.
10226
		// New caches will be created and the unlock returned,
10227
		// allowing direct access to the newly created
10228
		// empty data object. A valid owner object must be provided.
10229
		var cache = this.cache[ this.key( owner ) ];
10230
10231
		return key === undefined ?
10232
			cache : cache[ key ];
10233
	},
10234
	access: function( owner, key, value ) {
10235
		var stored;
10236
		// In cases where either:
10237
		//
10238
		//   1. No key was specified
10239
		//   2. A string key was specified, but no value provided
10240
		//
10241
		// Take the "read" path and allow the get method to determine
10242
		// which value to return, respectively either:
10243
		//
10244
		//   1. The entire cache object
10245
		//   2. The data stored at the key
10246
		//
10247
		if ( key === undefined ||
10248
				((key && typeof key === "string") && value === undefined) ) {
10249
10250
			stored = this.get( owner, key );
10251
10252
			return stored !== undefined ?
10253
				stored : this.get( owner, jQuery.camelCase(key) );
10254
		}
10255
10256
		// [*]When the key is not a string, or both a key and value
10257
		// are specified, set or extend (existing objects) with either:
10258
		//
10259
		//   1. An object of properties
10260
		//   2. A key and value
10261
		//
10262
		this.set( owner, key, value );
10263
10264
		// Since the "set" path can have two possible entry points
10265
		// return the expected data based on which path was taken[*]
10266
		return value !== undefined ? value : key;
10267
	},
10268
	remove: function( owner, key ) {
10269
		var i, name, camel,
10270
			unlock = this.key( owner ),
10271
			cache = this.cache[ unlock ];
10272
10273
		if ( key === undefined ) {
10274
			this.cache[ unlock ] = {};
10275
10276
		} else {
10277
			// Support array or space separated string of keys
10278
			if ( jQuery.isArray( key ) ) {
10279
				// If "name" is an array of keys...
10280
				// When data is initially created, via ("key", "val") signature,
10281
				// keys will be converted to camelCase.
10282
				// Since there is no way to tell _how_ a key was added, remove
10283
				// both plain key and camelCase key. #12786
10284
				// This will only penalize the array argument path.
10285
				name = key.concat( key.map( jQuery.camelCase ) );
10286
			} else {
10287
				camel = jQuery.camelCase( key );
10288
				// Try the string as a key before any manipulation
10289
				if ( key in cache ) {
10290
					name = [ key, camel ];
10291
				} else {
10292
					// If a key with the spaces exists, use it.
10293
					// Otherwise, create an array by matching non-whitespace
10294
					name = camel;
10295
					name = name in cache ?
10296
						[ name ] : ( name.match( rnotwhite ) || [] );
10297
				}
10298
			}
10299
10300
			i = name.length;
10301
			while ( i-- ) {
10302
				delete cache[ name[ i ] ];
10303
			}
10304
		}
10305
	},
10306
	hasData: function( owner ) {
10307
		return !jQuery.isEmptyObject(
10308
			this.cache[ owner[ this.expando ] ] || {}
10309
		);
10310
	},
10311
	discard: function( owner ) {
10312
		if ( owner[ this.expando ] ) {
10313
			delete this.cache[ owner[ this.expando ] ];
10314
		}
10315
	}
10316
};
10317
var data_priv = new Data();
10318
10319
var data_user = new Data();
10320
10321
10322
10323
//	Implementation Summary
10324
//
10325
//	1. Enforce API surface and semantic compatibility with 1.9.x branch
10326
//	2. Improve the module's maintainability by reducing the storage
10327
//		paths to a single mechanism.
10328
//	3. Use the same single mechanism to support "private" and "user" data.
10329
//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
10330
//	5. Avoid exposing implementation details on user objects (eg. expando properties)
10331
//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
10332
10333
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
10334
	rmultiDash = /([A-Z])/g;
10335
10336
function dataAttr( elem, key, data ) {
10337
	var name;
10338
10339
	// If nothing was found internally, try to fetch any
10340
	// data from the HTML5 data-* attribute
10341
	if ( data === undefined && elem.nodeType === 1 ) {
10342
		name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
10343
		data = elem.getAttribute( name );
10344
10345
		if ( typeof data === "string" ) {
10346
			try {
10347
				data = data === "true" ? true :
10348
					data === "false" ? false :
10349
					data === "null" ? null :
10350
					// Only convert to a number if it doesn't change the string
10351
					+data + "" === data ? +data :
10352
					rbrace.test( data ) ? jQuery.parseJSON( data ) :
10353
					data;
10354
			} catch( e ) {}
10355
10356
			// Make sure we set the data so it isn't changed later
10357
			data_user.set( elem, key, data );
10358
		} else {
10359
			data = undefined;
10360
		}
10361
	}
10362
	return data;
10363
}
10364
10365
jQuery.extend({
10366
	hasData: function( elem ) {
10367
		return data_user.hasData( elem ) || data_priv.hasData( elem );
10368
	},
10369
10370
	data: function( elem, name, data ) {
10371
		return data_user.access( elem, name, data );
10372
	},
10373
10374
	removeData: function( elem, name ) {
10375
		data_user.remove( elem, name );
10376
	},
10377
10378
	// TODO: Now that all calls to _data and _removeData have been replaced
10379
	// with direct calls to data_priv methods, these can be deprecated.
10380
	_data: function( elem, name, data ) {
10381
		return data_priv.access( elem, name, data );
10382
	},
10383
10384
	_removeData: function( elem, name ) {
10385
		data_priv.remove( elem, name );
10386
	}
10387
});
10388
10389
jQuery.fn.extend({
10390
	data: function( key, value ) {
10391
		var i, name, data,
10392
			elem = this[ 0 ],
10393
			attrs = elem && elem.attributes;
10394
10395
		// Gets all values
10396
		if ( key === undefined ) {
10397
			if ( this.length ) {
10398
				data = data_user.get( elem );
10399
10400
				if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
10401
					i = attrs.length;
10402
					while ( i-- ) {
10403
10404
						// Support: IE11+
10405
						// The attrs elements can be null (#14894)
10406
						if ( attrs[ i ] ) {
10407
							name = attrs[ i ].name;
10408
							if ( name.indexOf( "data-" ) === 0 ) {
10409
								name = jQuery.camelCase( name.slice(5) );
10410
								dataAttr( elem, name, data[ name ] );
10411
							}
10412
						}
10413
					}
10414
					data_priv.set( elem, "hasDataAttrs", true );
10415
				}
10416
			}
10417
10418
			return data;
10419
		}
10420
10421
		// Sets multiple values
10422
		if ( typeof key === "object" ) {
10423
			return this.each(function() {
10424
				data_user.set( this, key );
10425
			});
10426
		}
10427
10428
		return access( this, function( value ) {
10429
			var data,
10430
				camelKey = jQuery.camelCase( key );
10431
10432
			// The calling jQuery object (element matches) is not empty
10433
			// (and therefore has an element appears at this[ 0 ]) and the
10434
			// `value` parameter was not undefined. An empty jQuery object
10435
			// will result in `undefined` for elem = this[ 0 ] which will
10436
			// throw an exception if an attempt to read a data cache is made.
10437
			if ( elem && value === undefined ) {
10438
				// Attempt to get data from the cache
10439
				// with the key as-is
10440
				data = data_user.get( elem, key );
10441
				if ( data !== undefined ) {
10442
					return data;
10443
				}
10444
10445
				// Attempt to get data from the cache
10446
				// with the key camelized
10447
				data = data_user.get( elem, camelKey );
10448
				if ( data !== undefined ) {
10449
					return data;
10450
				}
10451
10452
				// Attempt to "discover" the data in
10453
				// HTML5 custom data-* attrs
10454
				data = dataAttr( elem, camelKey, undefined );
10455
				if ( data !== undefined ) {
10456
					return data;
10457
				}
10458
10459
				// We tried really hard, but the data doesn't exist.
10460
				return;
10461
			}
10462
10463
			// Set the data...
10464
			this.each(function() {
10465
				// First, attempt to store a copy or reference of any
10466
				// data that might've been store with a camelCased key.
10467
				var data = data_user.get( this, camelKey );
10468
10469
				// For HTML5 data-* attribute interop, we have to
10470
				// store property names with dashes in a camelCase form.
10471
				// This might not apply to all properties...*
10472
				data_user.set( this, camelKey, value );
10473
10474
				// *... In the case of properties that might _actually_
10475
				// have dashes, we need to also store a copy of that
10476
				// unchanged property.
10477
				if ( key.indexOf("-") !== -1 && data !== undefined ) {
10478
					data_user.set( this, key, value );
10479
				}
10480
			});
10481
		}, null, value, arguments.length > 1, null, true );
10482
	},
10483
10484
	removeData: function( key ) {
10485
		return this.each(function() {
10486
			data_user.remove( this, key );
10487
		});
10488
	}
10489
});
10490
10491
10492
jQuery.extend({
10493
	queue: function( elem, type, data ) {
10494
		var queue;
10495
10496
		if ( elem ) {
10497
			type = ( type || "fx" ) + "queue";
10498
			queue = data_priv.get( elem, type );
10499
10500
			// Speed up dequeue by getting out quickly if this is just a lookup
10501
			if ( data ) {
10502
				if ( !queue || jQuery.isArray( data ) ) {
10503
					queue = data_priv.access( elem, type, jQuery.makeArray(data) );
10504
				} else {
10505
					queue.push( data );
10506
				}
10507
			}
10508
			return queue || [];
10509
		}
10510
	},
10511
10512
	dequeue: function( elem, type ) {
10513
		type = type || "fx";
10514
10515
		var queue = jQuery.queue( elem, type ),
10516
			startLength = queue.length,
10517
			fn = queue.shift(),
10518
			hooks = jQuery._queueHooks( elem, type ),
10519
			next = function() {
10520
				jQuery.dequeue( elem, type );
10521
			};
10522
10523
		// If the fx queue is dequeued, always remove the progress sentinel
10524
		if ( fn === "inprogress" ) {
10525
			fn = queue.shift();
10526
			startLength--;
10527
		}
10528
10529
		if ( fn ) {
10530
10531
			// Add a progress sentinel to prevent the fx queue from being
10532
			// automatically dequeued
10533
			if ( type === "fx" ) {
10534
				queue.unshift( "inprogress" );
10535
			}
10536
10537
			// Clear up the last queue stop function
10538
			delete hooks.stop;
10539
			fn.call( elem, next, hooks );
10540
		}
10541
10542
		if ( !startLength && hooks ) {
10543
			hooks.empty.fire();
10544
		}
10545
	},
10546
10547
	// Not public - generate a queueHooks object, or return the current one
10548
	_queueHooks: function( elem, type ) {
10549
		var key = type + "queueHooks";
10550
		return data_priv.get( elem, key ) || data_priv.access( elem, key, {
10551
			empty: jQuery.Callbacks("once memory").add(function() {
10552
				data_priv.remove( elem, [ type + "queue", key ] );
10553
			})
10554
		});
10555
	}
10556
});
10557
10558
jQuery.fn.extend({
10559
	queue: function( type, data ) {
10560
		var setter = 2;
10561
10562
		if ( typeof type !== "string" ) {
10563
			data = type;
10564
			type = "fx";
10565
			setter--;
10566
		}
10567
10568
		if ( arguments.length < setter ) {
10569
			return jQuery.queue( this[0], type );
10570
		}
10571
10572
		return data === undefined ?
10573
			this :
10574
			this.each(function() {
10575
				var queue = jQuery.queue( this, type, data );
10576
10577
				// Ensure a hooks for this queue
10578
				jQuery._queueHooks( this, type );
10579
10580
				if ( type === "fx" && queue[0] !== "inprogress" ) {
10581
					jQuery.dequeue( this, type );
10582
				}
10583
			});
10584
	},
10585
	dequeue: function( type ) {
10586
		return this.each(function() {
10587
			jQuery.dequeue( this, type );
10588
		});
10589
	},
10590
	clearQueue: function( type ) {
10591
		return this.queue( type || "fx", [] );
10592
	},
10593
	// Get a promise resolved when queues of a certain type
10594
	// are emptied (fx is the type by default)
10595
	promise: function( type, obj ) {
10596
		var tmp,
10597
			count = 1,
10598
			defer = jQuery.Deferred(),
10599
			elements = this,
10600
			i = this.length,
10601
			resolve = function() {
10602
				if ( !( --count ) ) {
10603
					defer.resolveWith( elements, [ elements ] );
10604
				}
10605
			};
10606
10607
		if ( typeof type !== "string" ) {
10608
			obj = type;
10609
			type = undefined;
10610
		}
10611
		type = type || "fx";
10612
10613
		while ( i-- ) {
10614
			tmp = data_priv.get( elements[ i ], type + "queueHooks" );
10615
			if ( tmp && tmp.empty ) {
10616
				count++;
10617
				tmp.empty.add( resolve );
10618
			}
10619
		}
10620
		resolve();
10621
		return defer.promise( obj );
10622
	}
10623
});
10624
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
10625
10626
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
10627
10628
var isHidden = function( elem, el ) {
10629
		// isHidden might be called from jQuery#filter function;
10630
		// in that case, element will be second argument
10631
		elem = el || elem;
10632
		return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
10633
	};
10634
10635
var rcheckableType = (/^(?:checkbox|radio)$/i);
10636
10637
10638
10639
(function() {
10640
	var fragment = document.createDocumentFragment(),
10641
		div = fragment.appendChild( document.createElement( "div" ) ),
10642
		input = document.createElement( "input" );
10643
10644
	// Support: Safari<=5.1
10645
	// Check state lost if the name is set (#11217)
10646
	// Support: Windows Web Apps (WWA)
10647
	// `name` and `type` must use .setAttribute for WWA (#14901)
10648
	input.setAttribute( "type", "radio" );
10649
	input.setAttribute( "checked", "checked" );
10650
	input.setAttribute( "name", "t" );
10651
10652
	div.appendChild( input );
10653
10654
	// Support: Safari<=5.1, Android<4.2
10655
	// Older WebKit doesn't clone checked state correctly in fragments
10656
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
10657
10658
	// Support: IE<=11+
10659
	// Make sure textarea (and checkbox) defaultValue is properly cloned
10660
	div.innerHTML = "<textarea>x</textarea>";
10661
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
10662
})();
10663
var strundefined = typeof undefined;
10664
10665
10666
10667
support.focusinBubbles = "onfocusin" in window;
10668
10669
10670
var
10671
	rkeyEvent = /^key/,
10672
	rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
10673
	rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
10674
	rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
10675
10676
function returnTrue() {
10677
	return true;
10678
}
10679
10680
function returnFalse() {
10681
	return false;
10682
}
10683
10684
function safeActiveElement() {
10685
	try {
10686
		return document.activeElement;
10687
	} catch ( err ) { }
10688
}
10689
10690
/*
10691
 * Helper functions for managing events -- not part of the public interface.
10692
 * Props to Dean Edwards' addEvent library for many of the ideas.
10693
 */
10694
jQuery.event = {
10695
10696
	global: {},
10697
10698
	add: function( elem, types, handler, data, selector ) {
10699
10700
		var handleObjIn, eventHandle, tmp,
10701
			events, t, handleObj,
10702
			special, handlers, type, namespaces, origType,
10703
			elemData = data_priv.get( elem );
10704
10705
		// Don't attach events to noData or text/comment nodes (but allow plain objects)
10706
		if ( !elemData ) {
10707
			return;
10708
		}
10709
10710
		// Caller can pass in an object of custom data in lieu of the handler
10711
		if ( handler.handler ) {
10712
			handleObjIn = handler;
10713
			handler = handleObjIn.handler;
10714
			selector = handleObjIn.selector;
10715
		}
10716
10717
		// Make sure that the handler has a unique ID, used to find/remove it later
10718
		if ( !handler.guid ) {
10719
			handler.guid = jQuery.guid++;
10720
		}
10721
10722
		// Init the element's event structure and main handler, if this is the first
10723
		if ( !(events = elemData.events) ) {
10724
			events = elemData.events = {};
10725
		}
10726
		if ( !(eventHandle = elemData.handle) ) {
10727
			eventHandle = elemData.handle = function( e ) {
10728
				// Discard the second event of a jQuery.event.trigger() and
10729
				// when an event is called after a page has unloaded
10730
				return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
10731
					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
10732
			};
10733
		}
10734
10735
		// Handle multiple events separated by a space
10736
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
10737
		t = types.length;
10738
		while ( t-- ) {
10739
			tmp = rtypenamespace.exec( types[t] ) || [];
10740
			type = origType = tmp[1];
10741
			namespaces = ( tmp[2] || "" ).split( "." ).sort();
10742
10743
			// There *must* be a type, no attaching namespace-only handlers
10744
			if ( !type ) {
10745
				continue;
10746
			}
10747
10748
			// If event changes its type, use the special event handlers for the changed type
10749
			special = jQuery.event.special[ type ] || {};
10750
10751
			// If selector defined, determine special event api type, otherwise given type
10752
			type = ( selector ? special.delegateType : special.bindType ) || type;
10753
10754
			// Update special based on newly reset type
10755
			special = jQuery.event.special[ type ] || {};
10756
10757
			// handleObj is passed to all event handlers
10758
			handleObj = jQuery.extend({
10759
				type: type,
10760
				origType: origType,
10761
				data: data,
10762
				handler: handler,
10763
				guid: handler.guid,
10764
				selector: selector,
10765
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
10766
				namespace: namespaces.join(".")
10767
			}, handleObjIn );
10768
10769
			// Init the event handler queue if we're the first
10770
			if ( !(handlers = events[ type ]) ) {
10771
				handlers = events[ type ] = [];
10772
				handlers.delegateCount = 0;
10773
10774
				// Only use addEventListener if the special events handler returns false
10775
				if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
10776
					if ( elem.addEventListener ) {
10777
						elem.addEventListener( type, eventHandle, false );
10778
					}
10779
				}
10780
			}
10781
10782
			if ( special.add ) {
10783
				special.add.call( elem, handleObj );
10784
10785
				if ( !handleObj.handler.guid ) {
10786
					handleObj.handler.guid = handler.guid;
10787
				}
10788
			}
10789
10790
			// Add to the element's handler list, delegates in front
10791
			if ( selector ) {
10792
				handlers.splice( handlers.delegateCount++, 0, handleObj );
10793
			} else {
10794
				handlers.push( handleObj );
10795
			}
10796
10797
			// Keep track of which events have ever been used, for event optimization
10798
			jQuery.event.global[ type ] = true;
10799
		}
10800
10801
	},
10802
10803
	// Detach an event or set of events from an element
10804
	remove: function( elem, types, handler, selector, mappedTypes ) {
10805
10806
		var j, origCount, tmp,
10807
			events, t, handleObj,
10808
			special, handlers, type, namespaces, origType,
10809
			elemData = data_priv.hasData( elem ) && data_priv.get( elem );
10810
10811
		if ( !elemData || !(events = elemData.events) ) {
10812
			return;
10813
		}
10814
10815
		// Once for each type.namespace in types; type may be omitted
10816
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
10817
		t = types.length;
10818
		while ( t-- ) {
10819
			tmp = rtypenamespace.exec( types[t] ) || [];
10820
			type = origType = tmp[1];
10821
			namespaces = ( tmp[2] || "" ).split( "." ).sort();
10822
10823
			// Unbind all events (on this namespace, if provided) for the element
10824
			if ( !type ) {
10825
				for ( type in events ) {
10826
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
10827
				}
10828
				continue;
10829
			}
10830
10831
			special = jQuery.event.special[ type ] || {};
10832
			type = ( selector ? special.delegateType : special.bindType ) || type;
10833
			handlers = events[ type ] || [];
10834
			tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
10835
10836
			// Remove matching events
10837
			origCount = j = handlers.length;
10838
			while ( j-- ) {
10839
				handleObj = handlers[ j ];
10840
10841
				if ( ( mappedTypes || origType === handleObj.origType ) &&
10842
					( !handler || handler.guid === handleObj.guid ) &&
10843
					( !tmp || tmp.test( handleObj.namespace ) ) &&
10844
					( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
10845
					handlers.splice( j, 1 );
10846
10847
					if ( handleObj.selector ) {
10848
						handlers.delegateCount--;
10849
					}
10850
					if ( special.remove ) {
10851
						special.remove.call( elem, handleObj );
10852
					}
10853
				}
10854
			}
10855
10856
			// Remove generic event handler if we removed something and no more handlers exist
10857
			// (avoids potential for endless recursion during removal of special event handlers)
10858
			if ( origCount && !handlers.length ) {
10859
				if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
10860
					jQuery.removeEvent( elem, type, elemData.handle );
10861
				}
10862
10863
				delete events[ type ];
10864
			}
10865
		}
10866
10867
		// Remove the expando if it's no longer used
10868
		if ( jQuery.isEmptyObject( events ) ) {
10869
			delete elemData.handle;
10870
			data_priv.remove( elem, "events" );
10871
		}
10872
	},
10873
10874
	trigger: function( event, data, elem, onlyHandlers ) {
10875
10876
		var i, cur, tmp, bubbleType, ontype, handle, special,
10877
			eventPath = [ elem || document ],
10878
			type = hasOwn.call( event, "type" ) ? event.type : event,
10879
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
10880
10881
		cur = tmp = elem = elem || document;
10882
10883
		// Don't do events on text and comment nodes
10884
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
10885
			return;
10886
		}
10887
10888
		// focus/blur morphs to focusin/out; ensure we're not firing them right now
10889
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
10890
			return;
10891
		}
10892
10893
		if ( type.indexOf(".") >= 0 ) {
10894
			// Namespaced trigger; create a regexp to match event type in handle()
10895
			namespaces = type.split(".");
10896
			type = namespaces.shift();
10897
			namespaces.sort();
10898
		}
10899
		ontype = type.indexOf(":") < 0 && "on" + type;
10900
10901
		// Caller can pass in a jQuery.Event object, Object, or just an event type string
10902
		event = event[ jQuery.expando ] ?
10903
			event :
10904
			new jQuery.Event( type, typeof event === "object" && event );
10905
10906
		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
10907
		event.isTrigger = onlyHandlers ? 2 : 3;
10908
		event.namespace = namespaces.join(".");
10909
		event.namespace_re = event.namespace ?
10910
			new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
10911
			null;
10912
10913
		// Clean up the event in case it is being reused
10914
		event.result = undefined;
10915
		if ( !event.target ) {
10916
			event.target = elem;
10917
		}
10918
10919
		// Clone any incoming data and prepend the event, creating the handler arg list
10920
		data = data == null ?
10921
			[ event ] :
10922
			jQuery.makeArray( data, [ event ] );
10923
10924
		// Allow special events to draw outside the lines
10925
		special = jQuery.event.special[ type ] || {};
10926
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
10927
			return;
10928
		}
10929
10930
		// Determine event propagation path in advance, per W3C events spec (#9951)
10931
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
10932
		if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
10933
10934
			bubbleType = special.delegateType || type;
10935
			if ( !rfocusMorph.test( bubbleType + type ) ) {
10936
				cur = cur.parentNode;
10937
			}
10938
			for ( ; cur; cur = cur.parentNode ) {
10939
				eventPath.push( cur );
10940
				tmp = cur;
10941
			}
10942
10943
			// Only add window if we got to document (e.g., not plain obj or detached DOM)
10944
			if ( tmp === (elem.ownerDocument || document) ) {
10945
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
10946
			}
10947
		}
10948
10949
		// Fire handlers on the event path
10950
		i = 0;
10951
		while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
10952
10953
			event.type = i > 1 ?
10954
				bubbleType :
10955
				special.bindType || type;
10956
10957
			// jQuery handler
10958
			handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
10959
			if ( handle ) {
10960
				handle.apply( cur, data );
10961
			}
10962
10963
			// Native handler
10964
			handle = ontype && cur[ ontype ];
10965
			if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
10966
				event.result = handle.apply( cur, data );
10967
				if ( event.result === false ) {
10968
					event.preventDefault();
10969
				}
10970
			}
10971
		}
10972
		event.type = type;
10973
10974
		// If nobody prevented the default action, do it now
10975
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
10976
10977
			if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
10978
				jQuery.acceptData( elem ) ) {
10979
10980
				// Call a native DOM method on the target with the same name name as the event.
10981
				// Don't do default actions on window, that's where global variables be (#6170)
10982
				if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
10983
10984
					// Don't re-trigger an onFOO event when we call its FOO() method
10985
					tmp = elem[ ontype ];
10986
10987
					if ( tmp ) {
10988
						elem[ ontype ] = null;
10989
					}
10990
10991
					// Prevent re-triggering of the same event, since we already bubbled it above
10992
					jQuery.event.triggered = type;
10993
					elem[ type ]();
10994
					jQuery.event.triggered = undefined;
10995
10996
					if ( tmp ) {
10997
						elem[ ontype ] = tmp;
10998
					}
10999
				}
11000
			}
11001
		}
11002
11003
		return event.result;
11004
	},
11005
11006
	dispatch: function( event ) {
11007
11008
		// Make a writable jQuery.Event from the native event object
11009
		event = jQuery.event.fix( event );
11010
11011
		var i, j, ret, matched, handleObj,
11012
			handlerQueue = [],
11013
			args = slice.call( arguments ),
11014
			handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
11015
			special = jQuery.event.special[ event.type ] || {};
11016
11017
		// Use the fix-ed jQuery.Event rather than the (read-only) native event
11018
		args[0] = event;
11019
		event.delegateTarget = this;
11020
11021
		// Call the preDispatch hook for the mapped type, and let it bail if desired
11022
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
11023
			return;
11024
		}
11025
11026
		// Determine handlers
11027
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
11028
11029
		// Run delegates first; they may want to stop propagation beneath us
11030
		i = 0;
11031
		while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
11032
			event.currentTarget = matched.elem;
11033
11034
			j = 0;
11035
			while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
11036
11037
				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
11038
				// a subset or equal to those in the bound event (both can have no namespace).
11039
				if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
11040
11041
					event.handleObj = handleObj;
11042
					event.data = handleObj.data;
11043
11044
					ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
11045
							.apply( matched.elem, args );
11046
11047
					if ( ret !== undefined ) {
11048
						if ( (event.result = ret) === false ) {
11049
							event.preventDefault();
11050
							event.stopPropagation();
11051
						}
11052
					}
11053
				}
11054
			}
11055
		}
11056
11057
		// Call the postDispatch hook for the mapped type
11058
		if ( special.postDispatch ) {
11059
			special.postDispatch.call( this, event );
11060
		}
11061
11062
		return event.result;
11063
	},
11064
11065
	handlers: function( event, handlers ) {
11066
		var i, matches, sel, handleObj,
11067
			handlerQueue = [],
11068
			delegateCount = handlers.delegateCount,
11069
			cur = event.target;
11070
11071
		// Find delegate handlers
11072
		// Black-hole SVG <use> instance trees (#13180)
11073
		// Avoid non-left-click bubbling in Firefox (#3861)
11074
		if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
11075
11076
			for ( ; cur !== this; cur = cur.parentNode || this ) {
11077
11078
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
11079
				if ( cur.disabled !== true || event.type !== "click" ) {
11080
					matches = [];
11081
					for ( i = 0; i < delegateCount; i++ ) {
11082
						handleObj = handlers[ i ];
11083
11084
						// Don't conflict with Object.prototype properties (#13203)
11085
						sel = handleObj.selector + " ";
11086
11087
						if ( matches[ sel ] === undefined ) {
11088
							matches[ sel ] = handleObj.needsContext ?
11089
								jQuery( sel, this ).index( cur ) >= 0 :
11090
								jQuery.find( sel, this, null, [ cur ] ).length;
11091
						}
11092
						if ( matches[ sel ] ) {
11093
							matches.push( handleObj );
11094
						}
11095
					}
11096
					if ( matches.length ) {
11097
						handlerQueue.push({ elem: cur, handlers: matches });
11098
					}
11099
				}
11100
			}
11101
		}
11102
11103
		// Add the remaining (directly-bound) handlers
11104
		if ( delegateCount < handlers.length ) {
11105
			handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
11106
		}
11107
11108
		return handlerQueue;
11109
	},
11110
11111
	// Includes some event props shared by KeyEvent and MouseEvent
11112
	props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
11113
11114
	fixHooks: {},
11115
11116
	keyHooks: {
11117
		props: "char charCode key keyCode".split(" "),
11118
		filter: function( event, original ) {
11119
11120
			// Add which for key events
11121
			if ( event.which == null ) {
11122
				event.which = original.charCode != null ? original.charCode : original.keyCode;
11123
			}
11124
11125
			return event;
11126
		}
11127
	},
11128
11129
	mouseHooks: {
11130
		props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
11131
		filter: function( event, original ) {
11132
			var eventDoc, doc, body,
11133
				button = original.button;
11134
11135
			// Calculate pageX/Y if missing and clientX/Y available
11136
			if ( event.pageX == null && original.clientX != null ) {
11137
				eventDoc = event.target.ownerDocument || document;
11138
				doc = eventDoc.documentElement;
11139
				body = eventDoc.body;
11140
11141
				event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
11142
				event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
11143
			}
11144
11145
			// Add which for click: 1 === left; 2 === middle; 3 === right
11146
			// Note: button is not normalized, so don't use it
11147
			if ( !event.which && button !== undefined ) {
11148
				event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
11149
			}
11150
11151
			return event;
11152
		}
11153
	},
11154
11155
	fix: function( event ) {
11156
		if ( event[ jQuery.expando ] ) {
11157
			return event;
11158
		}
11159
11160
		// Create a writable copy of the event object and normalize some properties
11161
		var i, prop, copy,
11162
			type = event.type,
11163
			originalEvent = event,
11164
			fixHook = this.fixHooks[ type ];
11165
11166
		if ( !fixHook ) {
11167
			this.fixHooks[ type ] = fixHook =
11168
				rmouseEvent.test( type ) ? this.mouseHooks :
11169
				rkeyEvent.test( type ) ? this.keyHooks :
11170
				{};
11171
		}
11172
		copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
11173
11174
		event = new jQuery.Event( originalEvent );
11175
11176
		i = copy.length;
11177
		while ( i-- ) {
11178
			prop = copy[ i ];
11179
			event[ prop ] = originalEvent[ prop ];
11180
		}
11181
11182
		// Support: Cordova 2.5 (WebKit) (#13255)
11183
		// All events should have a target; Cordova deviceready doesn't
11184
		if ( !event.target ) {
11185
			event.target = document;
11186
		}
11187
11188
		// Support: Safari 6.0+, Chrome<28
11189
		// Target should not be a text node (#504, #13143)
11190
		if ( event.target.nodeType === 3 ) {
11191
			event.target = event.target.parentNode;
11192
		}
11193
11194
		return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
11195
	},
11196
11197
	special: {
11198
		load: {
11199
			// Prevent triggered image.load events from bubbling to window.load
11200
			noBubble: true
11201
		},
11202
		focus: {
11203
			// Fire native event if possible so blur/focus sequence is correct
11204
			trigger: function() {
11205
				if ( this !== safeActiveElement() && this.focus ) {
11206
					this.focus();
11207
					return false;
11208
				}
11209
			},
11210
			delegateType: "focusin"
11211
		},
11212
		blur: {
11213
			trigger: function() {
11214
				if ( this === safeActiveElement() && this.blur ) {
11215
					this.blur();
11216
					return false;
11217
				}
11218
			},
11219
			delegateType: "focusout"
11220
		},
11221
		click: {
11222
			// For checkbox, fire native event so checked state will be right
11223
			trigger: function() {
11224
				if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
11225
					this.click();
11226
					return false;
11227
				}
11228
			},
11229
11230
			// For cross-browser consistency, don't fire native .click() on links
11231
			_default: function( event ) {
11232
				return jQuery.nodeName( event.target, "a" );
11233
			}
11234
		},
11235
11236
		beforeunload: {
11237
			postDispatch: function( event ) {
11238
11239
				// Support: Firefox 20+
11240
				// Firefox doesn't alert if the returnValue field is not set.
11241
				if ( event.result !== undefined && event.originalEvent ) {
11242
					event.originalEvent.returnValue = event.result;
11243
				}
11244
			}
11245
		}
11246
	},
11247
11248
	simulate: function( type, elem, event, bubble ) {
11249
		// Piggyback on a donor event to simulate a different one.
11250
		// Fake originalEvent to avoid donor's stopPropagation, but if the
11251
		// simulated event prevents default then we do the same on the donor.
11252
		var e = jQuery.extend(
11253
			new jQuery.Event(),
11254
			event,
11255
			{
11256
				type: type,
11257
				isSimulated: true,
11258
				originalEvent: {}
11259
			}
11260
		);
11261
		if ( bubble ) {
11262
			jQuery.event.trigger( e, null, elem );
11263
		} else {
11264
			jQuery.event.dispatch.call( elem, e );
11265
		}
11266
		if ( e.isDefaultPrevented() ) {
11267
			event.preventDefault();
11268
		}
11269
	}
11270
};
11271
11272
jQuery.removeEvent = function( elem, type, handle ) {
11273
	if ( elem.removeEventListener ) {
11274
		elem.removeEventListener( type, handle, false );
11275
	}
11276
};
11277
11278
jQuery.Event = function( src, props ) {
11279
	// Allow instantiation without the 'new' keyword
11280
	if ( !(this instanceof jQuery.Event) ) {
11281
		return new jQuery.Event( src, props );
11282
	}
11283
11284
	// Event object
11285
	if ( src && src.type ) {
11286
		this.originalEvent = src;
11287
		this.type = src.type;
11288
11289
		// Events bubbling up the document may have been marked as prevented
11290
		// by a handler lower down the tree; reflect the correct value.
11291
		this.isDefaultPrevented = src.defaultPrevented ||
11292
				src.defaultPrevented === undefined &&
11293
				// Support: Android<4.0
11294
				src.returnValue === false ?
11295
			returnTrue :
11296
			returnFalse;
11297
11298
	// Event type
11299
	} else {
11300
		this.type = src;
11301
	}
11302
11303
	// Put explicitly provided properties onto the event object
11304
	if ( props ) {
11305
		jQuery.extend( this, props );
11306
	}
11307
11308
	// Create a timestamp if incoming event doesn't have one
11309
	this.timeStamp = src && src.timeStamp || jQuery.now();
11310
11311
	// Mark it as fixed
11312
	this[ jQuery.expando ] = true;
11313
};
11314
11315
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
11316
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
11317
jQuery.Event.prototype = {
11318
	isDefaultPrevented: returnFalse,
11319
	isPropagationStopped: returnFalse,
11320
	isImmediatePropagationStopped: returnFalse,
11321
11322
	preventDefault: function() {
11323
		var e = this.originalEvent;
11324
11325
		this.isDefaultPrevented = returnTrue;
11326
11327
		if ( e && e.preventDefault ) {
11328
			e.preventDefault();
11329
		}
11330
	},
11331
	stopPropagation: function() {
11332
		var e = this.originalEvent;
11333
11334
		this.isPropagationStopped = returnTrue;
11335
11336
		if ( e && e.stopPropagation ) {
11337
			e.stopPropagation();
11338
		}
11339
	},
11340
	stopImmediatePropagation: function() {
11341
		var e = this.originalEvent;
11342
11343
		this.isImmediatePropagationStopped = returnTrue;
11344
11345
		if ( e && e.stopImmediatePropagation ) {
11346
			e.stopImmediatePropagation();
11347
		}
11348
11349
		this.stopPropagation();
11350
	}
11351
};
11352
11353
// Create mouseenter/leave events using mouseover/out and event-time checks
11354
// Support: Chrome 15+
11355
jQuery.each({
11356
	mouseenter: "mouseover",
11357
	mouseleave: "mouseout",
11358
	pointerenter: "pointerover",
11359
	pointerleave: "pointerout"
11360
}, function( orig, fix ) {
11361
	jQuery.event.special[ orig ] = {
11362
		delegateType: fix,
11363
		bindType: fix,
11364
11365
		handle: function( event ) {
11366
			var ret,
11367
				target = this,
11368
				related = event.relatedTarget,
11369
				handleObj = event.handleObj;
11370
11371
			// For mousenter/leave call the handler if related is outside the target.
11372
			// NB: No relatedTarget if the mouse left/entered the browser window
11373
			if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
11374
				event.type = handleObj.origType;
11375
				ret = handleObj.handler.apply( this, arguments );
11376
				event.type = fix;
11377
			}
11378
			return ret;
11379
		}
11380
	};
11381
});
11382
11383
// Support: Firefox, Chrome, Safari
11384
// Create "bubbling" focus and blur events
11385
if ( !support.focusinBubbles ) {
11386
	jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
11387
11388
		// Attach a single capturing handler on the document while someone wants focusin/focusout
11389
		var handler = function( event ) {
11390
				jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
11391
			};
11392
11393
		jQuery.event.special[ fix ] = {
11394
			setup: function() {
11395
				var doc = this.ownerDocument || this,
11396
					attaches = data_priv.access( doc, fix );
11397
11398
				if ( !attaches ) {
11399
					doc.addEventListener( orig, handler, true );
11400
				}
11401
				data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
11402
			},
11403
			teardown: function() {
11404
				var doc = this.ownerDocument || this,
11405
					attaches = data_priv.access( doc, fix ) - 1;
11406
11407
				if ( !attaches ) {
11408
					doc.removeEventListener( orig, handler, true );
11409
					data_priv.remove( doc, fix );
11410
11411
				} else {
11412
					data_priv.access( doc, fix, attaches );
11413
				}
11414
			}
11415
		};
11416
	});
11417
}
11418
11419
jQuery.fn.extend({
11420
11421
	on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
11422
		var origFn, type;
11423
11424
		// Types can be a map of types/handlers
11425
		if ( typeof types === "object" ) {
11426
			// ( types-Object, selector, data )
11427
			if ( typeof selector !== "string" ) {
11428
				// ( types-Object, data )
11429
				data = data || selector;
11430
				selector = undefined;
11431
			}
11432
			for ( type in types ) {
11433
				this.on( type, selector, data, types[ type ], one );
11434
			}
11435
			return this;
11436
		}
11437
11438
		if ( data == null && fn == null ) {
11439
			// ( types, fn )
11440
			fn = selector;
11441
			data = selector = undefined;
11442
		} else if ( fn == null ) {
11443
			if ( typeof selector === "string" ) {
11444
				// ( types, selector, fn )
11445
				fn = data;
11446
				data = undefined;
11447
			} else {
11448
				// ( types, data, fn )
11449
				fn = data;
11450
				data = selector;
11451
				selector = undefined;
11452
			}
11453
		}
11454
		if ( fn === false ) {
11455
			fn = returnFalse;
11456
		} else if ( !fn ) {
11457
			return this;
11458
		}
11459
11460
		if ( one === 1 ) {
11461
			origFn = fn;
11462
			fn = function( event ) {
11463
				// Can use an empty set, since event contains the info
11464
				jQuery().off( event );
11465
				return origFn.apply( this, arguments );
11466
			};
11467
			// Use same guid so caller can remove using origFn
11468
			fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
11469
		}
11470
		return this.each( function() {
11471
			jQuery.event.add( this, types, fn, data, selector );
11472
		});
11473
	},
11474
	one: function( types, selector, data, fn ) {
11475
		return this.on( types, selector, data, fn, 1 );
11476
	},
11477
	off: function( types, selector, fn ) {
11478
		var handleObj, type;
11479
		if ( types && types.preventDefault && types.handleObj ) {
11480
			// ( event )  dispatched jQuery.Event
11481
			handleObj = types.handleObj;
11482
			jQuery( types.delegateTarget ).off(
11483
				handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
11484
				handleObj.selector,
11485
				handleObj.handler
11486
			);
11487
			return this;
11488
		}
11489
		if ( typeof types === "object" ) {
11490
			// ( types-object [, selector] )
11491
			for ( type in types ) {
11492
				this.off( type, selector, types[ type ] );
11493
			}
11494
			return this;
11495
		}
11496
		if ( selector === false || typeof selector === "function" ) {
11497
			// ( types [, fn] )
11498
			fn = selector;
11499
			selector = undefined;
11500
		}
11501
		if ( fn === false ) {
11502
			fn = returnFalse;
11503
		}
11504
		return this.each(function() {
11505
			jQuery.event.remove( this, types, fn, selector );
11506
		});
11507
	},
11508
11509
	trigger: function( type, data ) {
11510
		return this.each(function() {
11511
			jQuery.event.trigger( type, data, this );
11512
		});
11513
	},
11514
	triggerHandler: function( type, data ) {
11515
		var elem = this[0];
11516
		if ( elem ) {
11517
			return jQuery.event.trigger( type, data, elem, true );
11518
		}
11519
	}
11520
});
11521
11522
11523
var
11524
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
11525
	rtagName = /<([\w:]+)/,
11526
	rhtml = /<|&#?\w+;/,
11527
	rnoInnerhtml = /<(?:script|style|link)/i,
11528
	// checked="checked" or checked
11529
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
11530
	rscriptType = /^$|\/(?:java|ecma)script/i,
11531
	rscriptTypeMasked = /^true\/(.*)/,
11532
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
11533
11534
	// We have to close these tags to support XHTML (#13200)
11535
	wrapMap = {
11536
11537
		// Support: IE9
11538
		option: [ 1, "<select multiple='multiple'>", "</select>" ],
11539
11540
		thead: [ 1, "<table>", "</table>" ],
11541
		col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
11542
		tr: [ 2, "<table><tbody>", "</tbody></table>" ],
11543
		td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
11544
11545
		_default: [ 0, "", "" ]
11546
	};
11547
11548
// Support: IE9
11549
wrapMap.optgroup = wrapMap.option;
11550
11551
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
11552
wrapMap.th = wrapMap.td;
11553
11554
// Support: 1.x compatibility
11555
// Manipulating tables requires a tbody
11556
function manipulationTarget( elem, content ) {
11557
	return jQuery.nodeName( elem, "table" ) &&
11558
		jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
11559
11560
		elem.getElementsByTagName("tbody")[0] ||
11561
			elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
11562
		elem;
11563
}
11564
11565
// Replace/restore the type attribute of script elements for safe DOM manipulation
11566
function disableScript( elem ) {
11567
	elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
11568
	return elem;
11569
}
11570
function restoreScript( elem ) {
11571
	var match = rscriptTypeMasked.exec( elem.type );
11572
11573
	if ( match ) {
11574
		elem.type = match[ 1 ];
11575
	} else {
11576
		elem.removeAttribute("type");
11577
	}
11578
11579
	return elem;
11580
}
11581
11582
// Mark scripts as having already been evaluated
11583
function setGlobalEval( elems, refElements ) {
11584
	var i = 0,
11585
		l = elems.length;
11586
11587
	for ( ; i < l; i++ ) {
11588
		data_priv.set(
11589
			elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
11590
		);
11591
	}
11592
}
11593
11594
function cloneCopyEvent( src, dest ) {
11595
	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
11596
11597
	if ( dest.nodeType !== 1 ) {
11598
		return;
11599
	}
11600
11601
	// 1. Copy private data: events, handlers, etc.
11602
	if ( data_priv.hasData( src ) ) {
11603
		pdataOld = data_priv.access( src );
11604
		pdataCur = data_priv.set( dest, pdataOld );
11605
		events = pdataOld.events;
11606
11607
		if ( events ) {
11608
			delete pdataCur.handle;
11609
			pdataCur.events = {};
11610
11611
			for ( type in events ) {
11612
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
11613
					jQuery.event.add( dest, type, events[ type ][ i ] );
11614
				}
11615
			}
11616
		}
11617
	}
11618
11619
	// 2. Copy user data
11620
	if ( data_user.hasData( src ) ) {
11621
		udataOld = data_user.access( src );
11622
		udataCur = jQuery.extend( {}, udataOld );
11623
11624
		data_user.set( dest, udataCur );
11625
	}
11626
}
11627
11628
function getAll( context, tag ) {
11629
	var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
11630
			context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
11631
			[];
11632
11633
	return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
11634
		jQuery.merge( [ context ], ret ) :
11635
		ret;
11636
}
11637
11638
// Fix IE bugs, see support tests
11639
function fixInput( src, dest ) {
11640
	var nodeName = dest.nodeName.toLowerCase();
11641
11642
	// Fails to persist the checked state of a cloned checkbox or radio button.
11643
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
11644
		dest.checked = src.checked;
11645
11646
	// Fails to return the selected option to the default selected state when cloning options
11647
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
11648
		dest.defaultValue = src.defaultValue;
11649
	}
11650
}
11651
11652
jQuery.extend({
11653
	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
11654
		var i, l, srcElements, destElements,
11655
			clone = elem.cloneNode( true ),
11656
			inPage = jQuery.contains( elem.ownerDocument, elem );
11657
11658
		// Fix IE cloning issues
11659
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
11660
				!jQuery.isXMLDoc( elem ) ) {
11661
11662
			// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
11663
			destElements = getAll( clone );
11664
			srcElements = getAll( elem );
11665
11666
			for ( i = 0, l = srcElements.length; i < l; i++ ) {
11667
				fixInput( srcElements[ i ], destElements[ i ] );
11668
			}
11669
		}
11670
11671
		// Copy the events from the original to the clone
11672
		if ( dataAndEvents ) {
11673
			if ( deepDataAndEvents ) {
11674
				srcElements = srcElements || getAll( elem );
11675
				destElements = destElements || getAll( clone );
11676
11677
				for ( i = 0, l = srcElements.length; i < l; i++ ) {
11678
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
11679
				}
11680
			} else {
11681
				cloneCopyEvent( elem, clone );
11682
			}
11683
		}
11684
11685
		// Preserve script evaluation history
11686
		destElements = getAll( clone, "script" );
11687
		if ( destElements.length > 0 ) {
11688
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
11689
		}
11690
11691
		// Return the cloned set
11692
		return clone;
11693
	},
11694
11695
	buildFragment: function( elems, context, scripts, selection ) {
11696
		var elem, tmp, tag, wrap, contains, j,
11697
			fragment = context.createDocumentFragment(),
11698
			nodes = [],
11699
			i = 0,
11700
			l = elems.length;
11701
11702
		for ( ; i < l; i++ ) {
11703
			elem = elems[ i ];
11704
11705
			if ( elem || elem === 0 ) {
11706
11707
				// Add nodes directly
11708
				if ( jQuery.type( elem ) === "object" ) {
11709
					// Support: QtWebKit, PhantomJS
11710
					// push.apply(_, arraylike) throws on ancient WebKit
11711
					jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
11712
11713
				// Convert non-html into a text node
11714
				} else if ( !rhtml.test( elem ) ) {
11715
					nodes.push( context.createTextNode( elem ) );
11716
11717
				// Convert html into DOM nodes
11718
				} else {
11719
					tmp = tmp || fragment.appendChild( context.createElement("div") );
11720
11721
					// Deserialize a standard representation
11722
					tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
11723
					wrap = wrapMap[ tag ] || wrapMap._default;
11724
					tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
11725
11726
					// Descend through wrappers to the right content
11727
					j = wrap[ 0 ];
11728
					while ( j-- ) {
11729
						tmp = tmp.lastChild;
11730
					}
11731
11732
					// Support: QtWebKit, PhantomJS
11733
					// push.apply(_, arraylike) throws on ancient WebKit
11734
					jQuery.merge( nodes, tmp.childNodes );
11735
11736
					// Remember the top-level container
11737
					tmp = fragment.firstChild;
11738
11739
					// Ensure the created nodes are orphaned (#12392)
11740
					tmp.textContent = "";
11741
				}
11742
			}
11743
		}
11744
11745
		// Remove wrapper from fragment
11746
		fragment.textContent = "";
11747
11748
		i = 0;
11749
		while ( (elem = nodes[ i++ ]) ) {
11750
11751
			// #4087 - If origin and destination elements are the same, and this is
11752
			// that element, do not do anything
11753
			if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
11754
				continue;
11755
			}
11756
11757
			contains = jQuery.contains( elem.ownerDocument, elem );
11758
11759
			// Append to fragment
11760
			tmp = getAll( fragment.appendChild( elem ), "script" );
11761
11762
			// Preserve script evaluation history
11763
			if ( contains ) {
11764
				setGlobalEval( tmp );
11765
			}
11766
11767
			// Capture executables
11768
			if ( scripts ) {
11769
				j = 0;
11770
				while ( (elem = tmp[ j++ ]) ) {
11771
					if ( rscriptType.test( elem.type || "" ) ) {
11772
						scripts.push( elem );
11773
					}
11774
				}
11775
			}
11776
		}
11777
11778
		return fragment;
11779
	},
11780
11781
	cleanData: function( elems ) {
11782
		var data, elem, type, key,
11783
			special = jQuery.event.special,
11784
			i = 0;
11785
11786
		for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
11787
			if ( jQuery.acceptData( elem ) ) {
11788
				key = elem[ data_priv.expando ];
11789
11790
				if ( key && (data = data_priv.cache[ key ]) ) {
11791
					if ( data.events ) {
11792
						for ( type in data.events ) {
11793
							if ( special[ type ] ) {
11794
								jQuery.event.remove( elem, type );
11795
11796
							// This is a shortcut to avoid jQuery.event.remove's overhead
11797
							} else {
11798
								jQuery.removeEvent( elem, type, data.handle );
11799
							}
11800
						}
11801
					}
11802
					if ( data_priv.cache[ key ] ) {
11803
						// Discard any remaining `private` data
11804
						delete data_priv.cache[ key ];
11805
					}
11806
				}
11807
			}
11808
			// Discard any remaining `user` data
11809
			delete data_user.cache[ elem[ data_user.expando ] ];
11810
		}
11811
	}
11812
});
11813
11814
jQuery.fn.extend({
11815
	text: function( value ) {
11816
		return access( this, function( value ) {
11817
			return value === undefined ?
11818
				jQuery.text( this ) :
11819
				this.empty().each(function() {
11820
					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11821
						this.textContent = value;
11822
					}
11823
				});
11824
		}, null, value, arguments.length );
11825
	},
11826
11827
	append: function() {
11828
		return this.domManip( arguments, function( elem ) {
11829
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11830
				var target = manipulationTarget( this, elem );
11831
				target.appendChild( elem );
11832
			}
11833
		});
11834
	},
11835
11836
	prepend: function() {
11837
		return this.domManip( arguments, function( elem ) {
11838
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11839
				var target = manipulationTarget( this, elem );
11840
				target.insertBefore( elem, target.firstChild );
11841
			}
11842
		});
11843
	},
11844
11845
	before: function() {
11846
		return this.domManip( arguments, function( elem ) {
11847
			if ( this.parentNode ) {
11848
				this.parentNode.insertBefore( elem, this );
11849
			}
11850
		});
11851
	},
11852
11853
	after: function() {
11854
		return this.domManip( arguments, function( elem ) {
11855
			if ( this.parentNode ) {
11856
				this.parentNode.insertBefore( elem, this.nextSibling );
11857
			}
11858
		});
11859
	},
11860
11861
	remove: function( selector, keepData /* Internal Use Only */ ) {
11862
		var elem,
11863
			elems = selector ? jQuery.filter( selector, this ) : this,
11864
			i = 0;
11865
11866
		for ( ; (elem = elems[i]) != null; i++ ) {
11867
			if ( !keepData && elem.nodeType === 1 ) {
11868
				jQuery.cleanData( getAll( elem ) );
11869
			}
11870
11871
			if ( elem.parentNode ) {
11872
				if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
11873
					setGlobalEval( getAll( elem, "script" ) );
11874
				}
11875
				elem.parentNode.removeChild( elem );
11876
			}
11877
		}
11878
11879
		return this;
11880
	},
11881
11882
	empty: function() {
11883
		var elem,
11884
			i = 0;
11885
11886
		for ( ; (elem = this[i]) != null; i++ ) {
11887
			if ( elem.nodeType === 1 ) {
11888
11889
				// Prevent memory leaks
11890
				jQuery.cleanData( getAll( elem, false ) );
11891
11892
				// Remove any remaining nodes
11893
				elem.textContent = "";
11894
			}
11895
		}
11896
11897
		return this;
11898
	},
11899
11900
	clone: function( dataAndEvents, deepDataAndEvents ) {
11901
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
11902
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
11903
11904
		return this.map(function() {
11905
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
11906
		});
11907
	},
11908
11909
	html: function( value ) {
11910
		return access( this, function( value ) {
11911
			var elem = this[ 0 ] || {},
11912
				i = 0,
11913
				l = this.length;
11914
11915
			if ( value === undefined && elem.nodeType === 1 ) {
11916
				return elem.innerHTML;
11917
			}
11918
11919
			// See if we can take a shortcut and just use innerHTML
11920
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
11921
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
11922
11923
				value = value.replace( rxhtmlTag, "<$1></$2>" );
11924
11925
				try {
11926
					for ( ; i < l; i++ ) {
11927
						elem = this[ i ] || {};
11928
11929
						// Remove element nodes and prevent memory leaks
11930
						if ( elem.nodeType === 1 ) {
11931
							jQuery.cleanData( getAll( elem, false ) );
11932
							elem.innerHTML = value;
11933
						}
11934
					}
11935
11936
					elem = 0;
11937
11938
				// If using innerHTML throws an exception, use the fallback method
11939
				} catch( e ) {}
11940
			}
11941
11942
			if ( elem ) {
11943
				this.empty().append( value );
11944
			}
11945
		}, null, value, arguments.length );
11946
	},
11947
11948
	replaceWith: function() {
11949
		var arg = arguments[ 0 ];
11950
11951
		// Make the changes, replacing each context element with the new content
11952
		this.domManip( arguments, function( elem ) {
11953
			arg = this.parentNode;
11954
11955
			jQuery.cleanData( getAll( this ) );
11956
11957
			if ( arg ) {
11958
				arg.replaceChild( elem, this );
11959
			}
11960
		});
11961
11962
		// Force removal if there was no new content (e.g., from empty arguments)
11963
		return arg && (arg.length || arg.nodeType) ? this : this.remove();
11964
	},
11965
11966
	detach: function( selector ) {
11967
		return this.remove( selector, true );
11968
	},
11969
11970
	domManip: function( args, callback ) {
11971
11972
		// Flatten any nested arrays
11973
		args = concat.apply( [], args );
11974
11975
		var fragment, first, scripts, hasScripts, node, doc,
11976
			i = 0,
11977
			l = this.length,
11978
			set = this,
11979
			iNoClone = l - 1,
11980
			value = args[ 0 ],
11981
			isFunction = jQuery.isFunction( value );
11982
11983
		// We can't cloneNode fragments that contain checked, in WebKit
11984
		if ( isFunction ||
11985
				( l > 1 && typeof value === "string" &&
11986
					!support.checkClone && rchecked.test( value ) ) ) {
11987
			return this.each(function( index ) {
11988
				var self = set.eq( index );
11989
				if ( isFunction ) {
11990
					args[ 0 ] = value.call( this, index, self.html() );
11991
				}
11992
				self.domManip( args, callback );
11993
			});
11994
		}
11995
11996
		if ( l ) {
11997
			fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
11998
			first = fragment.firstChild;
11999
12000
			if ( fragment.childNodes.length === 1 ) {
12001
				fragment = first;
12002
			}
12003
12004
			if ( first ) {
12005
				scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
12006
				hasScripts = scripts.length;
12007
12008
				// Use the original fragment for the last item instead of the first because it can end up
12009
				// being emptied incorrectly in certain situations (#8070).
12010
				for ( ; i < l; i++ ) {
12011
					node = fragment;
12012
12013
					if ( i !== iNoClone ) {
12014
						node = jQuery.clone( node, true, true );
12015
12016
						// Keep references to cloned scripts for later restoration
12017
						if ( hasScripts ) {
12018
							// Support: QtWebKit
12019
							// jQuery.merge because push.apply(_, arraylike) throws
12020
							jQuery.merge( scripts, getAll( node, "script" ) );
12021
						}
12022
					}
12023
12024
					callback.call( this[ i ], node, i );
12025
				}
12026
12027
				if ( hasScripts ) {
12028
					doc = scripts[ scripts.length - 1 ].ownerDocument;
12029
12030
					// Reenable scripts
12031
					jQuery.map( scripts, restoreScript );
12032
12033
					// Evaluate executable scripts on first document insertion
12034
					for ( i = 0; i < hasScripts; i++ ) {
12035
						node = scripts[ i ];
12036
						if ( rscriptType.test( node.type || "" ) &&
12037
							!data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
12038
12039
							if ( node.src ) {
12040
								// Optional AJAX dependency, but won't run scripts if not present
12041
								if ( jQuery._evalUrl ) {
12042
									jQuery._evalUrl( node.src );
12043
								}
12044
							} else {
12045
								jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
12046
							}
12047
						}
12048
					}
12049
				}
12050
			}
12051
		}
12052
12053
		return this;
12054
	}
12055
});
12056
12057
jQuery.each({
12058
	appendTo: "append",
12059
	prependTo: "prepend",
12060
	insertBefore: "before",
12061
	insertAfter: "after",
12062
	replaceAll: "replaceWith"
12063
}, function( name, original ) {
12064
	jQuery.fn[ name ] = function( selector ) {
12065
		var elems,
12066
			ret = [],
12067
			insert = jQuery( selector ),
12068
			last = insert.length - 1,
12069
			i = 0;
12070
12071
		for ( ; i <= last; i++ ) {
12072
			elems = i === last ? this : this.clone( true );
12073
			jQuery( insert[ i ] )[ original ]( elems );
12074
12075
			// Support: QtWebKit
12076
			// .get() because push.apply(_, arraylike) throws
12077
			push.apply( ret, elems.get() );
12078
		}
12079
12080
		return this.pushStack( ret );
12081
	};
12082
});
12083
12084
12085
var iframe,
12086
	elemdisplay = {};
12087
12088
/**
12089
 * Retrieve the actual display of a element
12090
 * @param {String} name nodeName of the element
12091
 * @param {Object} doc Document object
12092
 */
12093
// Called only from within defaultDisplay
12094
function actualDisplay( name, doc ) {
12095
	var style,
12096
		elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
12097
12098
		// getDefaultComputedStyle might be reliably used only on attached element
12099
		display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
12100
12101
			// Use of this method is a temporary fix (more like optimization) until something better comes along,
12102
			// since it was removed from specification and supported only in FF
12103
			style.display : jQuery.css( elem[ 0 ], "display" );
12104
12105
	// We don't have any data stored on the element,
12106
	// so use "detach" method as fast way to get rid of the element
12107
	elem.detach();
12108
12109
	return display;
12110
}
12111
12112
/**
12113
 * Try to determine the default display value of an element
12114
 * @param {String} nodeName
12115
 */
12116
function defaultDisplay( nodeName ) {
12117
	var doc = document,
12118
		display = elemdisplay[ nodeName ];
12119
12120
	if ( !display ) {
12121
		display = actualDisplay( nodeName, doc );
12122
12123
		// If the simple way fails, read from inside an iframe
12124
		if ( display === "none" || !display ) {
12125
12126
			// Use the already-created iframe if possible
12127
			iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
12128
12129
			// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
12130
			doc = iframe[ 0 ].contentDocument;
12131
12132
			// Support: IE
12133
			doc.write();
12134
			doc.close();
12135
12136
			display = actualDisplay( nodeName, doc );
12137
			iframe.detach();
12138
		}
12139
12140
		// Store the correct default display
12141
		elemdisplay[ nodeName ] = display;
12142
	}
12143
12144
	return display;
12145
}
12146
var rmargin = (/^margin/);
12147
12148
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
12149
12150
var getStyles = function( elem ) {
12151
		// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
12152
		// IE throws on elements created in popups
12153
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
12154
		if ( elem.ownerDocument.defaultView.opener ) {
12155
			return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
12156
		}
12157
12158
		return window.getComputedStyle( elem, null );
12159
	};
12160
12161
12162
12163
function curCSS( elem, name, computed ) {
12164
	var width, minWidth, maxWidth, ret,
12165
		style = elem.style;
12166
12167
	computed = computed || getStyles( elem );
12168
12169
	// Support: IE9
12170
	// getPropertyValue is only needed for .css('filter') (#12537)
12171
	if ( computed ) {
12172
		ret = computed.getPropertyValue( name ) || computed[ name ];
12173
	}
12174
12175
	if ( computed ) {
12176
12177
		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
12178
			ret = jQuery.style( elem, name );
12179
		}
12180
12181
		// Support: iOS < 6
12182
		// A tribute to the "awesome hack by Dean Edwards"
12183
		// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
12184
		// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
12185
		if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
12186
12187
			// Remember the original values
12188
			width = style.width;
12189
			minWidth = style.minWidth;
12190
			maxWidth = style.maxWidth;
12191
12192
			// Put in the new values to get a computed value out
12193
			style.minWidth = style.maxWidth = style.width = ret;
12194
			ret = computed.width;
12195
12196
			// Revert the changed values
12197
			style.width = width;
12198
			style.minWidth = minWidth;
12199
			style.maxWidth = maxWidth;
12200
		}
12201
	}
12202
12203
	return ret !== undefined ?
12204
		// Support: IE
12205
		// IE returns zIndex value as an integer.
12206
		ret + "" :
12207
		ret;
12208
}
12209
12210
12211
function addGetHookIf( conditionFn, hookFn ) {
12212
	// Define the hook, we'll check on the first run if it's really needed.
12213
	return {
12214
		get: function() {
12215
			if ( conditionFn() ) {
12216
				// Hook not needed (or it's not possible to use it due
12217
				// to missing dependency), remove it.
12218
				delete this.get;
12219
				return;
12220
			}
12221
12222
			// Hook needed; redefine it so that the support test is not executed again.
12223
			return (this.get = hookFn).apply( this, arguments );
12224
		}
12225
	};
12226
}
12227
12228
12229
(function() {
12230
	var pixelPositionVal, boxSizingReliableVal,
12231
		docElem = document.documentElement,
12232
		container = document.createElement( "div" ),
12233
		div = document.createElement( "div" );
12234
12235
	if ( !div.style ) {
12236
		return;
12237
	}
12238
12239
	// Support: IE9-11+
12240
	// Style of cloned element affects source element cloned (#8908)
12241
	div.style.backgroundClip = "content-box";
12242
	div.cloneNode( true ).style.backgroundClip = "";
12243
	support.clearCloneStyle = div.style.backgroundClip === "content-box";
12244
12245
	container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
12246
		"position:absolute";
12247
	container.appendChild( div );
12248
12249
	// Executing both pixelPosition & boxSizingReliable tests require only one layout
12250
	// so they're executed at the same time to save the second computation.
12251
	function computePixelPositionAndBoxSizingReliable() {
12252
		div.style.cssText =
12253
			// Support: Firefox<29, Android 2.3
12254
			// Vendor-prefix box-sizing
12255
			"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
12256
			"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
12257
			"border:1px;padding:1px;width:4px;position:absolute";
12258
		div.innerHTML = "";
12259
		docElem.appendChild( container );
12260
12261
		var divStyle = window.getComputedStyle( div, null );
12262
		pixelPositionVal = divStyle.top !== "1%";
12263
		boxSizingReliableVal = divStyle.width === "4px";
12264
12265
		docElem.removeChild( container );
12266
	}
12267
12268
	// Support: node.js jsdom
12269
	// Don't assume that getComputedStyle is a property of the global object
12270
	if ( window.getComputedStyle ) {
12271
		jQuery.extend( support, {
12272
			pixelPosition: function() {
12273
12274
				// This test is executed only once but we still do memoizing
12275
				// since we can use the boxSizingReliable pre-computing.
12276
				// No need to check if the test was already performed, though.
12277
				computePixelPositionAndBoxSizingReliable();
12278
				return pixelPositionVal;
12279
			},
12280
			boxSizingReliable: function() {
12281
				if ( boxSizingReliableVal == null ) {
12282
					computePixelPositionAndBoxSizingReliable();
12283
				}
12284
				return boxSizingReliableVal;
12285
			},
12286
			reliableMarginRight: function() {
12287
12288
				// Support: Android 2.3
12289
				// Check if div with explicit width and no margin-right incorrectly
12290
				// gets computed margin-right based on width of container. (#3333)
12291
				// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
12292
				// This support function is only executed once so no memoizing is needed.
12293
				var ret,
12294
					marginDiv = div.appendChild( document.createElement( "div" ) );
12295
12296
				// Reset CSS: box-sizing; display; margin; border; padding
12297
				marginDiv.style.cssText = div.style.cssText =
12298
					// Support: Firefox<29, Android 2.3
12299
					// Vendor-prefix box-sizing
12300
					"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
12301
					"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
12302
				marginDiv.style.marginRight = marginDiv.style.width = "0";
12303
				div.style.width = "1px";
12304
				docElem.appendChild( container );
12305
12306
				ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
12307
12308
				docElem.removeChild( container );
12309
				div.removeChild( marginDiv );
12310
12311
				return ret;
12312
			}
12313
		});
12314
	}
12315
})();
12316
12317
12318
// A method for quickly swapping in/out CSS properties to get correct calculations.
12319
jQuery.swap = function( elem, options, callback, args ) {
12320
	var ret, name,
12321
		old = {};
12322
12323
	// Remember the old values, and insert the new ones
12324
	for ( name in options ) {
12325
		old[ name ] = elem.style[ name ];
12326
		elem.style[ name ] = options[ name ];
12327
	}
12328
12329
	ret = callback.apply( elem, args || [] );
12330
12331
	// Revert the old values
12332
	for ( name in options ) {
12333
		elem.style[ name ] = old[ name ];
12334
	}
12335
12336
	return ret;
12337
};
12338
12339
12340
var
12341
	// Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
12342
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
12343
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
12344
	rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
12345
	rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
12346
12347
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
12348
	cssNormalTransform = {
12349
		letterSpacing: "0",
12350
		fontWeight: "400"
12351
	},
12352
12353
	cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
12354
12355
// Return a css property mapped to a potentially vendor prefixed property
12356
function vendorPropName( style, name ) {
12357
12358
	// Shortcut for names that are not vendor prefixed
12359
	if ( name in style ) {
12360
		return name;
12361
	}
12362
12363
	// Check for vendor prefixed names
12364
	var capName = name[0].toUpperCase() + name.slice(1),
12365
		origName = name,
12366
		i = cssPrefixes.length;
12367
12368
	while ( i-- ) {
12369
		name = cssPrefixes[ i ] + capName;
12370
		if ( name in style ) {
12371
			return name;
12372
		}
12373
	}
12374
12375
	return origName;
12376
}
12377
12378
function setPositiveNumber( elem, value, subtract ) {
12379
	var matches = rnumsplit.exec( value );
12380
	return matches ?
12381
		// Guard against undefined "subtract", e.g., when used as in cssHooks
12382
		Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
12383
		value;
12384
}
12385
12386
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
12387
	var i = extra === ( isBorderBox ? "border" : "content" ) ?
12388
		// If we already have the right measurement, avoid augmentation
12389
		4 :
12390
		// Otherwise initialize for horizontal or vertical properties
12391
		name === "width" ? 1 : 0,
12392
12393
		val = 0;
12394
12395
	for ( ; i < 4; i += 2 ) {
12396
		// Both box models exclude margin, so add it if we want it
12397
		if ( extra === "margin" ) {
12398
			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
12399
		}
12400
12401
		if ( isBorderBox ) {
12402
			// border-box includes padding, so remove it if we want content
12403
			if ( extra === "content" ) {
12404
				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12405
			}
12406
12407
			// At this point, extra isn't border nor margin, so remove border
12408
			if ( extra !== "margin" ) {
12409
				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12410
			}
12411
		} else {
12412
			// At this point, extra isn't content, so add padding
12413
			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12414
12415
			// At this point, extra isn't content nor padding, so add border
12416
			if ( extra !== "padding" ) {
12417
				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12418
			}
12419
		}
12420
	}
12421
12422
	return val;
12423
}
12424
12425
function getWidthOrHeight( elem, name, extra ) {
12426
12427
	// Start with offset property, which is equivalent to the border-box value
12428
	var valueIsBorderBox = true,
12429
		val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
12430
		styles = getStyles( elem ),
12431
		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
12432
12433
	// Some non-html elements return undefined for offsetWidth, so check for null/undefined
12434
	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
12435
	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
12436
	if ( val <= 0 || val == null ) {
12437
		// Fall back to computed then uncomputed css if necessary
12438
		val = curCSS( elem, name, styles );
12439
		if ( val < 0 || val == null ) {
12440
			val = elem.style[ name ];
12441
		}
12442
12443
		// Computed unit is not pixels. Stop here and return.
12444
		if ( rnumnonpx.test(val) ) {
12445
			return val;
12446
		}
12447
12448
		// Check for style in case a browser which returns unreliable values
12449
		// for getComputedStyle silently falls back to the reliable elem.style
12450
		valueIsBorderBox = isBorderBox &&
12451
			( support.boxSizingReliable() || val === elem.style[ name ] );
12452
12453
		// Normalize "", auto, and prepare for extra
12454
		val = parseFloat( val ) || 0;
12455
	}
12456
12457
	// Use the active box-sizing model to add/subtract irrelevant styles
12458
	return ( val +
12459
		augmentWidthOrHeight(
12460
			elem,
12461
			name,
12462
			extra || ( isBorderBox ? "border" : "content" ),
12463
			valueIsBorderBox,
12464
			styles
12465
		)
12466
	) + "px";
12467
}
12468
12469
function showHide( elements, show ) {
12470
	var display, elem, hidden,
12471
		values = [],
12472
		index = 0,
12473
		length = elements.length;
12474
12475
	for ( ; index < length; index++ ) {
12476
		elem = elements[ index ];
12477
		if ( !elem.style ) {
12478
			continue;
12479
		}
12480
12481
		values[ index ] = data_priv.get( elem, "olddisplay" );
12482
		display = elem.style.display;
12483
		if ( show ) {
12484
			// Reset the inline display of this element to learn if it is
12485
			// being hidden by cascaded rules or not
12486
			if ( !values[ index ] && display === "none" ) {
12487
				elem.style.display = "";
12488
			}
12489
12490
			// Set elements which have been overridden with display: none
12491
			// in a stylesheet to whatever the default browser style is
12492
			// for such an element
12493
			if ( elem.style.display === "" && isHidden( elem ) ) {
12494
				values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
12495
			}
12496
		} else {
12497
			hidden = isHidden( elem );
12498
12499
			if ( display !== "none" || !hidden ) {
12500
				data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
12501
			}
12502
		}
12503
	}
12504
12505
	// Set the display of most of the elements in a second loop
12506
	// to avoid the constant reflow
12507
	for ( index = 0; index < length; index++ ) {
12508
		elem = elements[ index ];
12509
		if ( !elem.style ) {
12510
			continue;
12511
		}
12512
		if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
12513
			elem.style.display = show ? values[ index ] || "" : "none";
12514
		}
12515
	}
12516
12517
	return elements;
12518
}
12519
12520
jQuery.extend({
12521
12522
	// Add in style property hooks for overriding the default
12523
	// behavior of getting and setting a style property
12524
	cssHooks: {
12525
		opacity: {
12526
			get: function( elem, computed ) {
12527
				if ( computed ) {
12528
12529
					// We should always get a number back from opacity
12530
					var ret = curCSS( elem, "opacity" );
12531
					return ret === "" ? "1" : ret;
12532
				}
12533
			}
12534
		}
12535
	},
12536
12537
	// Don't automatically add "px" to these possibly-unitless properties
12538
	cssNumber: {
12539
		"columnCount": true,
12540
		"fillOpacity": true,
12541
		"flexGrow": true,
12542
		"flexShrink": true,
12543
		"fontWeight": true,
12544
		"lineHeight": true,
12545
		"opacity": true,
12546
		"order": true,
12547
		"orphans": true,
12548
		"widows": true,
12549
		"zIndex": true,
12550
		"zoom": true
12551
	},
12552
12553
	// Add in properties whose names you wish to fix before
12554
	// setting or getting the value
12555
	cssProps: {
12556
		"float": "cssFloat"
12557
	},
12558
12559
	// Get and set the style property on a DOM Node
12560
	style: function( elem, name, value, extra ) {
12561
12562
		// Don't set styles on text and comment nodes
12563
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
12564
			return;
12565
		}
12566
12567
		// Make sure that we're working with the right name
12568
		var ret, type, hooks,
12569
			origName = jQuery.camelCase( name ),
12570
			style = elem.style;
12571
12572
		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
12573
12574
		// Gets hook for the prefixed version, then unprefixed version
12575
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12576
12577
		// Check if we're setting a value
12578
		if ( value !== undefined ) {
12579
			type = typeof value;
12580
12581
			// Convert "+=" or "-=" to relative numbers (#7345)
12582
			if ( type === "string" && (ret = rrelNum.exec( value )) ) {
12583
				value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
12584
				// Fixes bug #9237
12585
				type = "number";
12586
			}
12587
12588
			// Make sure that null and NaN values aren't set (#7116)
12589
			if ( value == null || value !== value ) {
12590
				return;
12591
			}
12592
12593
			// If a number, add 'px' to the (except for certain CSS properties)
12594
			if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
12595
				value += "px";
12596
			}
12597
12598
			// Support: IE9-11+
12599
			// background-* props affect original clone's values
12600
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
12601
				style[ name ] = "inherit";
12602
			}
12603
12604
			// If a hook was provided, use that value, otherwise just set the specified value
12605
			if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
12606
				style[ name ] = value;
12607
			}
12608
12609
		} else {
12610
			// If a hook was provided get the non-computed value from there
12611
			if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
12612
				return ret;
12613
			}
12614
12615
			// Otherwise just get the value from the style object
12616
			return style[ name ];
12617
		}
12618
	},
12619
12620
	css: function( elem, name, extra, styles ) {
12621
		var val, num, hooks,
12622
			origName = jQuery.camelCase( name );
12623
12624
		// Make sure that we're working with the right name
12625
		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
12626
12627
		// Try prefixed name followed by the unprefixed name
12628
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12629
12630
		// If a hook was provided get the computed value from there
12631
		if ( hooks && "get" in hooks ) {
12632
			val = hooks.get( elem, true, extra );
12633
		}
12634
12635
		// Otherwise, if a way to get the computed value exists, use that
12636
		if ( val === undefined ) {
12637
			val = curCSS( elem, name, styles );
12638
		}
12639
12640
		// Convert "normal" to computed value
12641
		if ( val === "normal" && name in cssNormalTransform ) {
12642
			val = cssNormalTransform[ name ];
12643
		}
12644
12645
		// Make numeric if forced or a qualifier was provided and val looks numeric
12646
		if ( extra === "" || extra ) {
12647
			num = parseFloat( val );
12648
			return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
12649
		}
12650
		return val;
12651
	}
12652
});
12653
12654
jQuery.each([ "height", "width" ], function( i, name ) {
12655
	jQuery.cssHooks[ name ] = {
12656
		get: function( elem, computed, extra ) {
12657
			if ( computed ) {
12658
12659
				// Certain elements can have dimension info if we invisibly show them
12660
				// but it must have a current display style that would benefit
12661
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
12662
					jQuery.swap( elem, cssShow, function() {
12663
						return getWidthOrHeight( elem, name, extra );
12664
					}) :
12665
					getWidthOrHeight( elem, name, extra );
12666
			}
12667
		},
12668
12669
		set: function( elem, value, extra ) {
12670
			var styles = extra && getStyles( elem );
12671
			return setPositiveNumber( elem, value, extra ?
12672
				augmentWidthOrHeight(
12673
					elem,
12674
					name,
12675
					extra,
12676
					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
12677
					styles
12678
				) : 0
12679
			);
12680
		}
12681
	};
12682
});
12683
12684
// Support: Android 2.3
12685
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
12686
	function( elem, computed ) {
12687
		if ( computed ) {
12688
			return jQuery.swap( elem, { "display": "inline-block" },
12689
				curCSS, [ elem, "marginRight" ] );
12690
		}
12691
	}
12692
);
12693
12694
// These hooks are used by animate to expand properties
12695
jQuery.each({
12696
	margin: "",
12697
	padding: "",
12698
	border: "Width"
12699
}, function( prefix, suffix ) {
12700
	jQuery.cssHooks[ prefix + suffix ] = {
12701
		expand: function( value ) {
12702
			var i = 0,
12703
				expanded = {},
12704
12705
				// Assumes a single number if not a string
12706
				parts = typeof value === "string" ? value.split(" ") : [ value ];
12707
12708
			for ( ; i < 4; i++ ) {
12709
				expanded[ prefix + cssExpand[ i ] + suffix ] =
12710
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
12711
			}
12712
12713
			return expanded;
12714
		}
12715
	};
12716
12717
	if ( !rmargin.test( prefix ) ) {
12718
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
12719
	}
12720
});
12721
12722
jQuery.fn.extend({
12723
	css: function( name, value ) {
12724
		return access( this, function( elem, name, value ) {
12725
			var styles, len,
12726
				map = {},
12727
				i = 0;
12728
12729
			if ( jQuery.isArray( name ) ) {
12730
				styles = getStyles( elem );
12731
				len = name.length;
12732
12733
				for ( ; i < len; i++ ) {
12734
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
12735
				}
12736
12737
				return map;
12738
			}
12739
12740
			return value !== undefined ?
12741
				jQuery.style( elem, name, value ) :
12742
				jQuery.css( elem, name );
12743
		}, name, value, arguments.length > 1 );
12744
	},
12745
	show: function() {
12746
		return showHide( this, true );
12747
	},
12748
	hide: function() {
12749
		return showHide( this );
12750
	},
12751
	toggle: function( state ) {
12752
		if ( typeof state === "boolean" ) {
12753
			return state ? this.show() : this.hide();
12754
		}
12755
12756
		return this.each(function() {
12757
			if ( isHidden( this ) ) {
12758
				jQuery( this ).show();
12759
			} else {
12760
				jQuery( this ).hide();
12761
			}
12762
		});
12763
	}
12764
});
12765
12766
12767
function Tween( elem, options, prop, end, easing ) {
12768
	return new Tween.prototype.init( elem, options, prop, end, easing );
12769
}
12770
jQuery.Tween = Tween;
12771
12772
Tween.prototype = {
12773
	constructor: Tween,
12774
	init: function( elem, options, prop, end, easing, unit ) {
12775
		this.elem = elem;
12776
		this.prop = prop;
12777
		this.easing = easing || "swing";
12778
		this.options = options;
12779
		this.start = this.now = this.cur();
12780
		this.end = end;
12781
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
12782
	},
12783
	cur: function() {
12784
		var hooks = Tween.propHooks[ this.prop ];
12785
12786
		return hooks && hooks.get ?
12787
			hooks.get( this ) :
12788
			Tween.propHooks._default.get( this );
12789
	},
12790
	run: function( percent ) {
12791
		var eased,
12792
			hooks = Tween.propHooks[ this.prop ];
12793
12794
		if ( this.options.duration ) {
12795
			this.pos = eased = jQuery.easing[ this.easing ](
12796
				percent, this.options.duration * percent, 0, 1, this.options.duration
12797
			);
12798
		} else {
12799
			this.pos = eased = percent;
12800
		}
12801
		this.now = ( this.end - this.start ) * eased + this.start;
12802
12803
		if ( this.options.step ) {
12804
			this.options.step.call( this.elem, this.now, this );
12805
		}
12806
12807
		if ( hooks && hooks.set ) {
12808
			hooks.set( this );
12809
		} else {
12810
			Tween.propHooks._default.set( this );
12811
		}
12812
		return this;
12813
	}
12814
};
12815
12816
Tween.prototype.init.prototype = Tween.prototype;
12817
12818
Tween.propHooks = {
12819
	_default: {
12820
		get: function( tween ) {
12821
			var result;
12822
12823
			if ( tween.elem[ tween.prop ] != null &&
12824
				(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
12825
				return tween.elem[ tween.prop ];
12826
			}
12827
12828
			// Passing an empty string as a 3rd parameter to .css will automatically
12829
			// attempt a parseFloat and fallback to a string if the parse fails.
12830
			// Simple values such as "10px" are parsed to Float;
12831
			// complex values such as "rotate(1rad)" are returned as-is.
12832
			result = jQuery.css( tween.elem, tween.prop, "" );
12833
			// Empty strings, null, undefined and "auto" are converted to 0.
12834
			return !result || result === "auto" ? 0 : result;
12835
		},
12836
		set: function( tween ) {
12837
			// Use step hook for back compat.
12838
			// Use cssHook if its there.
12839
			// Use .style if available and use plain properties where available.
12840
			if ( jQuery.fx.step[ tween.prop ] ) {
12841
				jQuery.fx.step[ tween.prop ]( tween );
12842
			} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
12843
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
12844
			} else {
12845
				tween.elem[ tween.prop ] = tween.now;
12846
			}
12847
		}
12848
	}
12849
};
12850
12851
// Support: IE9
12852
// Panic based approach to setting things on disconnected nodes
12853
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
12854
	set: function( tween ) {
12855
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
12856
			tween.elem[ tween.prop ] = tween.now;
12857
		}
12858
	}
12859
};
12860
12861
jQuery.easing = {
12862
	linear: function( p ) {
12863
		return p;
12864
	},
12865
	swing: function( p ) {
12866
		return 0.5 - Math.cos( p * Math.PI ) / 2;
12867
	}
12868
};
12869
12870
jQuery.fx = Tween.prototype.init;
12871
12872
// Back Compat <1.8 extension point
12873
jQuery.fx.step = {};
12874
12875
12876
12877
12878
var
12879
	fxNow, timerId,
12880
	rfxtypes = /^(?:toggle|show|hide)$/,
12881
	rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
12882
	rrun = /queueHooks$/,
12883
	animationPrefilters = [ defaultPrefilter ],
12884
	tweeners = {
12885
		"*": [ function( prop, value ) {
12886
			var tween = this.createTween( prop, value ),
12887
				target = tween.cur(),
12888
				parts = rfxnum.exec( value ),
12889
				unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
12890
12891
				// Starting value computation is required for potential unit mismatches
12892
				start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
12893
					rfxnum.exec( jQuery.css( tween.elem, prop ) ),
12894
				scale = 1,
12895
				maxIterations = 20;
12896
12897
			if ( start && start[ 3 ] !== unit ) {
12898
				// Trust units reported by jQuery.css
12899
				unit = unit || start[ 3 ];
12900
12901
				// Make sure we update the tween properties later on
12902
				parts = parts || [];
12903
12904
				// Iteratively approximate from a nonzero starting point
12905
				start = +target || 1;
12906
12907
				do {
12908
					// If previous iteration zeroed out, double until we get *something*.
12909
					// Use string for doubling so we don't accidentally see scale as unchanged below
12910
					scale = scale || ".5";
12911
12912
					// Adjust and apply
12913
					start = start / scale;
12914
					jQuery.style( tween.elem, prop, start + unit );
12915
12916
				// Update scale, tolerating zero or NaN from tween.cur(),
12917
				// break the loop if scale is unchanged or perfect, or if we've just had enough
12918
				} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
12919
			}
12920
12921
			// Update tween properties
12922
			if ( parts ) {
12923
				start = tween.start = +start || +target || 0;
12924
				tween.unit = unit;
12925
				// If a +=/-= token was provided, we're doing a relative animation
12926
				tween.end = parts[ 1 ] ?
12927
					start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
12928
					+parts[ 2 ];
12929
			}
12930
12931
			return tween;
12932
		} ]
12933
	};
12934
12935
// Animations created synchronously will run synchronously
12936
function createFxNow() {
12937
	setTimeout(function() {
12938
		fxNow = undefined;
12939
	});
12940
	return ( fxNow = jQuery.now() );
12941
}
12942
12943
// Generate parameters to create a standard animation
12944
function genFx( type, includeWidth ) {
12945
	var which,
12946
		i = 0,
12947
		attrs = { height: type };
12948
12949
	// If we include width, step value is 1 to do all cssExpand values,
12950
	// otherwise step value is 2 to skip over Left and Right
12951
	includeWidth = includeWidth ? 1 : 0;
12952
	for ( ; i < 4 ; i += 2 - includeWidth ) {
12953
		which = cssExpand[ i ];
12954
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
12955
	}
12956
12957
	if ( includeWidth ) {
12958
		attrs.opacity = attrs.width = type;
12959
	}
12960
12961
	return attrs;
12962
}
12963
12964
function createTween( value, prop, animation ) {
12965
	var tween,
12966
		collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
12967
		index = 0,
12968
		length = collection.length;
12969
	for ( ; index < length; index++ ) {
12970
		if ( (tween = collection[ index ].call( animation, prop, value )) ) {
12971
12972
			// We're done with this property
12973
			return tween;
12974
		}
12975
	}
12976
}
12977
12978
function defaultPrefilter( elem, props, opts ) {
12979
	/* jshint validthis: true */
12980
	var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
12981
		anim = this,
12982
		orig = {},
12983
		style = elem.style,
12984
		hidden = elem.nodeType && isHidden( elem ),
12985
		dataShow = data_priv.get( elem, "fxshow" );
12986
12987
	// Handle queue: false promises
12988
	if ( !opts.queue ) {
12989
		hooks = jQuery._queueHooks( elem, "fx" );
12990
		if ( hooks.unqueued == null ) {
12991
			hooks.unqueued = 0;
12992
			oldfire = hooks.empty.fire;
12993
			hooks.empty.fire = function() {
12994
				if ( !hooks.unqueued ) {
12995
					oldfire();
12996
				}
12997
			};
12998
		}
12999
		hooks.unqueued++;
13000
13001
		anim.always(function() {
13002
			// Ensure the complete handler is called before this completes
13003
			anim.always(function() {
13004
				hooks.unqueued--;
13005
				if ( !jQuery.queue( elem, "fx" ).length ) {
13006
					hooks.empty.fire();
13007
				}
13008
			});
13009
		});
13010
	}
13011
13012
	// Height/width overflow pass
13013
	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
13014
		// Make sure that nothing sneaks out
13015
		// Record all 3 overflow attributes because IE9-10 do not
13016
		// change the overflow attribute when overflowX and
13017
		// overflowY are set to the same value
13018
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
13019
13020
		// Set display property to inline-block for height/width
13021
		// animations on inline elements that are having width/height animated
13022
		display = jQuery.css( elem, "display" );
13023
13024
		// Test default display if display is currently "none"
13025
		checkDisplay = display === "none" ?
13026
			data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
13027
13028
		if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
13029
			style.display = "inline-block";
13030
		}
13031
	}
13032
13033
	if ( opts.overflow ) {
13034
		style.overflow = "hidden";
13035
		anim.always(function() {
13036
			style.overflow = opts.overflow[ 0 ];
13037
			style.overflowX = opts.overflow[ 1 ];
13038
			style.overflowY = opts.overflow[ 2 ];
13039
		});
13040
	}
13041
13042
	// show/hide pass
13043
	for ( prop in props ) {
13044
		value = props[ prop ];
13045
		if ( rfxtypes.exec( value ) ) {
13046
			delete props[ prop ];
13047
			toggle = toggle || value === "toggle";
13048
			if ( value === ( hidden ? "hide" : "show" ) ) {
13049
13050
				// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
13051
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
13052
					hidden = true;
13053
				} else {
13054
					continue;
13055
				}
13056
			}
13057
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
13058
13059
		// Any non-fx value stops us from restoring the original display value
13060
		} else {
13061
			display = undefined;
13062
		}
13063
	}
13064
13065
	if ( !jQuery.isEmptyObject( orig ) ) {
13066
		if ( dataShow ) {
13067
			if ( "hidden" in dataShow ) {
13068
				hidden = dataShow.hidden;
13069
			}
13070
		} else {
13071
			dataShow = data_priv.access( elem, "fxshow", {} );
13072
		}
13073
13074
		// Store state if its toggle - enables .stop().toggle() to "reverse"
13075
		if ( toggle ) {
13076
			dataShow.hidden = !hidden;
13077
		}
13078
		if ( hidden ) {
13079
			jQuery( elem ).show();
13080
		} else {
13081
			anim.done(function() {
13082
				jQuery( elem ).hide();
13083
			});
13084
		}
13085
		anim.done(function() {
13086
			var prop;
13087
13088
			data_priv.remove( elem, "fxshow" );
13089
			for ( prop in orig ) {
13090
				jQuery.style( elem, prop, orig[ prop ] );
13091
			}
13092
		});
13093
		for ( prop in orig ) {
13094
			tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
13095
13096
			if ( !( prop in dataShow ) ) {
13097
				dataShow[ prop ] = tween.start;
13098
				if ( hidden ) {
13099
					tween.end = tween.start;
13100
					tween.start = prop === "width" || prop === "height" ? 1 : 0;
13101
				}
13102
			}
13103
		}
13104
13105
	// If this is a noop like .hide().hide(), restore an overwritten display value
13106
	} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
13107
		style.display = display;
13108
	}
13109
}
13110
13111
function propFilter( props, specialEasing ) {
13112
	var index, name, easing, value, hooks;
13113
13114
	// camelCase, specialEasing and expand cssHook pass
13115
	for ( index in props ) {
13116
		name = jQuery.camelCase( index );
13117
		easing = specialEasing[ name ];
13118
		value = props[ index ];
13119
		if ( jQuery.isArray( value ) ) {
13120
			easing = value[ 1 ];
13121
			value = props[ index ] = value[ 0 ];
13122
		}
13123
13124
		if ( index !== name ) {
13125
			props[ name ] = value;
13126
			delete props[ index ];
13127
		}
13128
13129
		hooks = jQuery.cssHooks[ name ];
13130
		if ( hooks && "expand" in hooks ) {
13131
			value = hooks.expand( value );
13132
			delete props[ name ];
13133
13134
			// Not quite $.extend, this won't overwrite existing keys.
13135
			// Reusing 'index' because we have the correct "name"
13136
			for ( index in value ) {
13137
				if ( !( index in props ) ) {
13138
					props[ index ] = value[ index ];
13139
					specialEasing[ index ] = easing;
13140
				}
13141
			}
13142
		} else {
13143
			specialEasing[ name ] = easing;
13144
		}
13145
	}
13146
}
13147
13148
function Animation( elem, properties, options ) {
13149
	var result,
13150
		stopped,
13151
		index = 0,
13152
		length = animationPrefilters.length,
13153
		deferred = jQuery.Deferred().always( function() {
13154
			// Don't match elem in the :animated selector
13155
			delete tick.elem;
13156
		}),
13157
		tick = function() {
13158
			if ( stopped ) {
13159
				return false;
13160
			}
13161
			var currentTime = fxNow || createFxNow(),
13162
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
13163
				// Support: Android 2.3
13164
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
13165
				temp = remaining / animation.duration || 0,
13166
				percent = 1 - temp,
13167
				index = 0,
13168
				length = animation.tweens.length;
13169
13170
			for ( ; index < length ; index++ ) {
13171
				animation.tweens[ index ].run( percent );
13172
			}
13173
13174
			deferred.notifyWith( elem, [ animation, percent, remaining ]);
13175
13176
			if ( percent < 1 && length ) {
13177
				return remaining;
13178
			} else {
13179
				deferred.resolveWith( elem, [ animation ] );
13180
				return false;
13181
			}
13182
		},
13183
		animation = deferred.promise({
13184
			elem: elem,
13185
			props: jQuery.extend( {}, properties ),
13186
			opts: jQuery.extend( true, { specialEasing: {} }, options ),
13187
			originalProperties: properties,
13188
			originalOptions: options,
13189
			startTime: fxNow || createFxNow(),
13190
			duration: options.duration,
13191
			tweens: [],
13192
			createTween: function( prop, end ) {
13193
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
13194
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
13195
				animation.tweens.push( tween );
13196
				return tween;
13197
			},
13198
			stop: function( gotoEnd ) {
13199
				var index = 0,
13200
					// If we are going to the end, we want to run all the tweens
13201
					// otherwise we skip this part
13202
					length = gotoEnd ? animation.tweens.length : 0;
13203
				if ( stopped ) {
13204
					return this;
13205
				}
13206
				stopped = true;
13207
				for ( ; index < length ; index++ ) {
13208
					animation.tweens[ index ].run( 1 );
13209
				}
13210
13211
				// Resolve when we played the last frame; otherwise, reject
13212
				if ( gotoEnd ) {
13213
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
13214
				} else {
13215
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
13216
				}
13217
				return this;
13218
			}
13219
		}),
13220
		props = animation.props;
13221
13222
	propFilter( props, animation.opts.specialEasing );
13223
13224
	for ( ; index < length ; index++ ) {
13225
		result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
13226
		if ( result ) {
13227
			return result;
13228
		}
13229
	}
13230
13231
	jQuery.map( props, createTween, animation );
13232
13233
	if ( jQuery.isFunction( animation.opts.start ) ) {
13234
		animation.opts.start.call( elem, animation );
13235
	}
13236
13237
	jQuery.fx.timer(
13238
		jQuery.extend( tick, {
13239
			elem: elem,
13240
			anim: animation,
13241
			queue: animation.opts.queue
13242
		})
13243
	);
13244
13245
	// attach callbacks from options
13246
	return animation.progress( animation.opts.progress )
13247
		.done( animation.opts.done, animation.opts.complete )
13248
		.fail( animation.opts.fail )
13249
		.always( animation.opts.always );
13250
}
13251
13252
jQuery.Animation = jQuery.extend( Animation, {
13253
13254
	tweener: function( props, callback ) {
13255
		if ( jQuery.isFunction( props ) ) {
13256
			callback = props;
13257
			props = [ "*" ];
13258
		} else {
13259
			props = props.split(" ");
13260
		}
13261
13262
		var prop,
13263
			index = 0,
13264
			length = props.length;
13265
13266
		for ( ; index < length ; index++ ) {
13267
			prop = props[ index ];
13268
			tweeners[ prop ] = tweeners[ prop ] || [];
13269
			tweeners[ prop ].unshift( callback );
13270
		}
13271
	},
13272
13273
	prefilter: function( callback, prepend ) {
13274
		if ( prepend ) {
13275
			animationPrefilters.unshift( callback );
13276
		} else {
13277
			animationPrefilters.push( callback );
13278
		}
13279
	}
13280
});
13281
13282
jQuery.speed = function( speed, easing, fn ) {
13283
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
13284
		complete: fn || !fn && easing ||
13285
			jQuery.isFunction( speed ) && speed,
13286
		duration: speed,
13287
		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
13288
	};
13289
13290
	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
13291
		opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
13292
13293
	// Normalize opt.queue - true/undefined/null -> "fx"
13294
	if ( opt.queue == null || opt.queue === true ) {
13295
		opt.queue = "fx";
13296
	}
13297
13298
	// Queueing
13299
	opt.old = opt.complete;
13300
13301
	opt.complete = function() {
13302
		if ( jQuery.isFunction( opt.old ) ) {
13303
			opt.old.call( this );
13304
		}
13305
13306
		if ( opt.queue ) {
13307
			jQuery.dequeue( this, opt.queue );
13308
		}
13309
	};
13310
13311
	return opt;
13312
};
13313
13314
jQuery.fn.extend({
13315
	fadeTo: function( speed, to, easing, callback ) {
13316
13317
		// Show any hidden elements after setting opacity to 0
13318
		return this.filter( isHidden ).css( "opacity", 0 ).show()
13319
13320
			// Animate to the value specified
13321
			.end().animate({ opacity: to }, speed, easing, callback );
13322
	},
13323
	animate: function( prop, speed, easing, callback ) {
13324
		var empty = jQuery.isEmptyObject( prop ),
13325
			optall = jQuery.speed( speed, easing, callback ),
13326
			doAnimation = function() {
13327
				// Operate on a copy of prop so per-property easing won't be lost
13328
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
13329
13330
				// Empty animations, or finishing resolves immediately
13331
				if ( empty || data_priv.get( this, "finish" ) ) {
13332
					anim.stop( true );
13333
				}
13334
			};
13335
			doAnimation.finish = doAnimation;
13336
13337
		return empty || optall.queue === false ?
13338
			this.each( doAnimation ) :
13339
			this.queue( optall.queue, doAnimation );
13340
	},
13341
	stop: function( type, clearQueue, gotoEnd ) {
13342
		var stopQueue = function( hooks ) {
13343
			var stop = hooks.stop;
13344
			delete hooks.stop;
13345
			stop( gotoEnd );
13346
		};
13347
13348
		if ( typeof type !== "string" ) {
13349
			gotoEnd = clearQueue;
13350
			clearQueue = type;
13351
			type = undefined;
13352
		}
13353
		if ( clearQueue && type !== false ) {
13354
			this.queue( type || "fx", [] );
13355
		}
13356
13357
		return this.each(function() {
13358
			var dequeue = true,
13359
				index = type != null && type + "queueHooks",
13360
				timers = jQuery.timers,
13361
				data = data_priv.get( this );
13362
13363
			if ( index ) {
13364
				if ( data[ index ] && data[ index ].stop ) {
13365
					stopQueue( data[ index ] );
13366
				}
13367
			} else {
13368
				for ( index in data ) {
13369
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
13370
						stopQueue( data[ index ] );
13371
					}
13372
				}
13373
			}
13374
13375
			for ( index = timers.length; index--; ) {
13376
				if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
13377
					timers[ index ].anim.stop( gotoEnd );
13378
					dequeue = false;
13379
					timers.splice( index, 1 );
13380
				}
13381
			}
13382
13383
			// Start the next in the queue if the last step wasn't forced.
13384
			// Timers currently will call their complete callbacks, which
13385
			// will dequeue but only if they were gotoEnd.
13386
			if ( dequeue || !gotoEnd ) {
13387
				jQuery.dequeue( this, type );
13388
			}
13389
		});
13390
	},
13391
	finish: function( type ) {
13392
		if ( type !== false ) {
13393
			type = type || "fx";
13394
		}
13395
		return this.each(function() {
13396
			var index,
13397
				data = data_priv.get( this ),
13398
				queue = data[ type + "queue" ],
13399
				hooks = data[ type + "queueHooks" ],
13400
				timers = jQuery.timers,
13401
				length = queue ? queue.length : 0;
13402
13403
			// Enable finishing flag on private data
13404
			data.finish = true;
13405
13406
			// Empty the queue first
13407
			jQuery.queue( this, type, [] );
13408
13409
			if ( hooks && hooks.stop ) {
13410
				hooks.stop.call( this, true );
13411
			}
13412
13413
			// Look for any active animations, and finish them
13414
			for ( index = timers.length; index--; ) {
13415
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
13416
					timers[ index ].anim.stop( true );
13417
					timers.splice( index, 1 );
13418
				}
13419
			}
13420
13421
			// Look for any animations in the old queue and finish them
13422
			for ( index = 0; index < length; index++ ) {
13423
				if ( queue[ index ] && queue[ index ].finish ) {
13424
					queue[ index ].finish.call( this );
13425
				}
13426
			}
13427
13428
			// Turn off finishing flag
13429
			delete data.finish;
13430
		});
13431
	}
13432
});
13433
13434
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
13435
	var cssFn = jQuery.fn[ name ];
13436
	jQuery.fn[ name ] = function( speed, easing, callback ) {
13437
		return speed == null || typeof speed === "boolean" ?
13438
			cssFn.apply( this, arguments ) :
13439
			this.animate( genFx( name, true ), speed, easing, callback );
13440
	};
13441
});
13442
13443
// Generate shortcuts for custom animations
13444
jQuery.each({
13445
	slideDown: genFx("show"),
13446
	slideUp: genFx("hide"),
13447
	slideToggle: genFx("toggle"),
13448
	fadeIn: { opacity: "show" },
13449
	fadeOut: { opacity: "hide" },
13450
	fadeToggle: { opacity: "toggle" }
13451
}, function( name, props ) {
13452
	jQuery.fn[ name ] = function( speed, easing, callback ) {
13453
		return this.animate( props, speed, easing, callback );
13454
	};
13455
});
13456
13457
jQuery.timers = [];
13458
jQuery.fx.tick = function() {
13459
	var timer,
13460
		i = 0,
13461
		timers = jQuery.timers;
13462
13463
	fxNow = jQuery.now();
13464
13465
	for ( ; i < timers.length; i++ ) {
13466
		timer = timers[ i ];
13467
		// Checks the timer has not already been removed
13468
		if ( !timer() && timers[ i ] === timer ) {
13469
			timers.splice( i--, 1 );
13470
		}
13471
	}
13472
13473
	if ( !timers.length ) {
13474
		jQuery.fx.stop();
13475
	}
13476
	fxNow = undefined;
13477
};
13478
13479
jQuery.fx.timer = function( timer ) {
13480
	jQuery.timers.push( timer );
13481
	if ( timer() ) {
13482
		jQuery.fx.start();
13483
	} else {
13484
		jQuery.timers.pop();
13485
	}
13486
};
13487
13488
jQuery.fx.interval = 13;
13489
13490
jQuery.fx.start = function() {
13491
	if ( !timerId ) {
13492
		timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
13493
	}
13494
};
13495
13496
jQuery.fx.stop = function() {
13497
	clearInterval( timerId );
13498
	timerId = null;
13499
};
13500
13501
jQuery.fx.speeds = {
13502
	slow: 600,
13503
	fast: 200,
13504
	// Default speed
13505
	_default: 400
13506
};
13507
13508
13509
// Based off of the plugin by Clint Helfers, with permission.
13510
// http://blindsignals.com/index.php/2009/07/jquery-delay/
13511
jQuery.fn.delay = function( time, type ) {
13512
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
13513
	type = type || "fx";
13514
13515
	return this.queue( type, function( next, hooks ) {
13516
		var timeout = setTimeout( next, time );
13517
		hooks.stop = function() {
13518
			clearTimeout( timeout );
13519
		};
13520
	});
13521
};
13522
13523
13524
(function() {
13525
	var input = document.createElement( "input" ),
13526
		select = document.createElement( "select" ),
13527
		opt = select.appendChild( document.createElement( "option" ) );
13528
13529
	input.type = "checkbox";
13530
13531
	// Support: iOS<=5.1, Android<=4.2+
13532
	// Default value for a checkbox should be "on"
13533
	support.checkOn = input.value !== "";
13534
13535
	// Support: IE<=11+
13536
	// Must access selectedIndex to make default options select
13537
	support.optSelected = opt.selected;
13538
13539
	// Support: Android<=2.3
13540
	// Options inside disabled selects are incorrectly marked as disabled
13541
	select.disabled = true;
13542
	support.optDisabled = !opt.disabled;
13543
13544
	// Support: IE<=11+
13545
	// An input loses its value after becoming a radio
13546
	input = document.createElement( "input" );
13547
	input.value = "t";
13548
	input.type = "radio";
13549
	support.radioValue = input.value === "t";
13550
})();
13551
13552
13553
var nodeHook, boolHook,
13554
	attrHandle = jQuery.expr.attrHandle;
13555
13556
jQuery.fn.extend({
13557
	attr: function( name, value ) {
13558
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
13559
	},
13560
13561
	removeAttr: function( name ) {
13562
		return this.each(function() {
13563
			jQuery.removeAttr( this, name );
13564
		});
13565
	}
13566
});
13567
13568
jQuery.extend({
13569
	attr: function( elem, name, value ) {
13570
		var hooks, ret,
13571
			nType = elem.nodeType;
13572
13573
		// don't get/set attributes on text, comment and attribute nodes
13574
		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
13575
			return;
13576
		}
13577
13578
		// Fallback to prop when attributes are not supported
13579
		if ( typeof elem.getAttribute === strundefined ) {
13580
			return jQuery.prop( elem, name, value );
13581
		}
13582
13583
		// All attributes are lowercase
13584
		// Grab necessary hook if one is defined
13585
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
13586
			name = name.toLowerCase();
13587
			hooks = jQuery.attrHooks[ name ] ||
13588
				( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
13589
		}
13590
13591
		if ( value !== undefined ) {
13592
13593
			if ( value === null ) {
13594
				jQuery.removeAttr( elem, name );
13595
13596
			} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
13597
				return ret;
13598
13599
			} else {
13600
				elem.setAttribute( name, value + "" );
13601
				return value;
13602
			}
13603
13604
		} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
13605
			return ret;
13606
13607
		} else {
13608
			ret = jQuery.find.attr( elem, name );
13609
13610
			// Non-existent attributes return null, we normalize to undefined
13611
			return ret == null ?
13612
				undefined :
13613
				ret;
13614
		}
13615
	},
13616
13617
	removeAttr: function( elem, value ) {
13618
		var name, propName,
13619
			i = 0,
13620
			attrNames = value && value.match( rnotwhite );
13621
13622
		if ( attrNames && elem.nodeType === 1 ) {
13623
			while ( (name = attrNames[i++]) ) {
13624
				propName = jQuery.propFix[ name ] || name;
13625
13626
				// Boolean attributes get special treatment (#10870)
13627
				if ( jQuery.expr.match.bool.test( name ) ) {
13628
					// Set corresponding property to false
13629
					elem[ propName ] = false;
13630
				}
13631
13632
				elem.removeAttribute( name );
13633
			}
13634
		}
13635
	},
13636
13637
	attrHooks: {
13638
		type: {
13639
			set: function( elem, value ) {
13640
				if ( !support.radioValue && value === "radio" &&
13641
					jQuery.nodeName( elem, "input" ) ) {
13642
					var val = elem.value;
13643
					elem.setAttribute( "type", value );
13644
					if ( val ) {
13645
						elem.value = val;
13646
					}
13647
					return value;
13648
				}
13649
			}
13650
		}
13651
	}
13652
});
13653
13654
// Hooks for boolean attributes
13655
boolHook = {
13656
	set: function( elem, value, name ) {
13657
		if ( value === false ) {
13658
			// Remove boolean attributes when set to false
13659
			jQuery.removeAttr( elem, name );
13660
		} else {
13661
			elem.setAttribute( name, name );
13662
		}
13663
		return name;
13664
	}
13665
};
13666
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
13667
	var getter = attrHandle[ name ] || jQuery.find.attr;
13668
13669
	attrHandle[ name ] = function( elem, name, isXML ) {
13670
		var ret, handle;
13671
		if ( !isXML ) {
13672
			// Avoid an infinite loop by temporarily removing this function from the getter
13673
			handle = attrHandle[ name ];
13674
			attrHandle[ name ] = ret;
13675
			ret = getter( elem, name, isXML ) != null ?
13676
				name.toLowerCase() :
13677
				null;
13678
			attrHandle[ name ] = handle;
13679
		}
13680
		return ret;
13681
	};
13682
});
13683
13684
13685
13686
13687
var rfocusable = /^(?:input|select|textarea|button)$/i;
13688
13689
jQuery.fn.extend({
13690
	prop: function( name, value ) {
13691
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
13692
	},
13693
13694
	removeProp: function( name ) {
13695
		return this.each(function() {
13696
			delete this[ jQuery.propFix[ name ] || name ];
13697
		});
13698
	}
13699
});
13700
13701
jQuery.extend({
13702
	propFix: {
13703
		"for": "htmlFor",
13704
		"class": "className"
13705
	},
13706
13707
	prop: function( elem, name, value ) {
13708
		var ret, hooks, notxml,
13709
			nType = elem.nodeType;
13710
13711
		// Don't get/set properties on text, comment and attribute nodes
13712
		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
13713
			return;
13714
		}
13715
13716
		notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
13717
13718
		if ( notxml ) {
13719
			// Fix name and attach hooks
13720
			name = jQuery.propFix[ name ] || name;
13721
			hooks = jQuery.propHooks[ name ];
13722
		}
13723
13724
		if ( value !== undefined ) {
13725
			return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
13726
				ret :
13727
				( elem[ name ] = value );
13728
13729
		} else {
13730
			return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
13731
				ret :
13732
				elem[ name ];
13733
		}
13734
	},
13735
13736
	propHooks: {
13737
		tabIndex: {
13738
			get: function( elem ) {
13739
				return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
13740
					elem.tabIndex :
13741
					-1;
13742
			}
13743
		}
13744
	}
13745
});
13746
13747
if ( !support.optSelected ) {
13748
	jQuery.propHooks.selected = {
13749
		get: function( elem ) {
13750
			var parent = elem.parentNode;
13751
			if ( parent && parent.parentNode ) {
13752
				parent.parentNode.selectedIndex;
13753
			}
13754
			return null;
13755
		}
13756
	};
13757
}
13758
13759
jQuery.each([
13760
	"tabIndex",
13761
	"readOnly",
13762
	"maxLength",
13763
	"cellSpacing",
13764
	"cellPadding",
13765
	"rowSpan",
13766
	"colSpan",
13767
	"useMap",
13768
	"frameBorder",
13769
	"contentEditable"
13770
], function() {
13771
	jQuery.propFix[ this.toLowerCase() ] = this;
13772
});
13773
13774
13775
13776
13777
var rclass = /[\t\r\n\f]/g;
13778
13779
jQuery.fn.extend({
13780
	addClass: function( value ) {
13781
		var classes, elem, cur, clazz, j, finalValue,
13782
			proceed = typeof value === "string" && value,
13783
			i = 0,
13784
			len = this.length;
13785
13786
		if ( jQuery.isFunction( value ) ) {
13787
			return this.each(function( j ) {
13788
				jQuery( this ).addClass( value.call( this, j, this.className ) );
13789
			});
13790
		}
13791
13792
		if ( proceed ) {
13793
			// The disjunction here is for better compressibility (see removeClass)
13794
			classes = ( value || "" ).match( rnotwhite ) || [];
13795
13796
			for ( ; i < len; i++ ) {
13797
				elem = this[ i ];
13798
				cur = elem.nodeType === 1 && ( elem.className ?
13799
					( " " + elem.className + " " ).replace( rclass, " " ) :
13800
					" "
13801
				);
13802
13803
				if ( cur ) {
13804
					j = 0;
13805
					while ( (clazz = classes[j++]) ) {
13806
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
13807
							cur += clazz + " ";
13808
						}
13809
					}
13810
13811
					// only assign if different to avoid unneeded rendering.
13812
					finalValue = jQuery.trim( cur );
13813
					if ( elem.className !== finalValue ) {
13814
						elem.className = finalValue;
13815
					}
13816
				}
13817
			}
13818
		}
13819
13820
		return this;
13821
	},
13822
13823
	removeClass: function( value ) {
13824
		var classes, elem, cur, clazz, j, finalValue,
13825
			proceed = arguments.length === 0 || typeof value === "string" && value,
13826
			i = 0,
13827
			len = this.length;
13828
13829
		if ( jQuery.isFunction( value ) ) {
13830
			return this.each(function( j ) {
13831
				jQuery( this ).removeClass( value.call( this, j, this.className ) );
13832
			});
13833
		}
13834
		if ( proceed ) {
13835
			classes = ( value || "" ).match( rnotwhite ) || [];
13836
13837
			for ( ; i < len; i++ ) {
13838
				elem = this[ i ];
13839
				// This expression is here for better compressibility (see addClass)
13840
				cur = elem.nodeType === 1 && ( elem.className ?
13841
					( " " + elem.className + " " ).replace( rclass, " " ) :
13842
					""
13843
				);
13844
13845
				if ( cur ) {
13846
					j = 0;
13847
					while ( (clazz = classes[j++]) ) {
13848
						// Remove *all* instances
13849
						while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
13850
							cur = cur.replace( " " + clazz + " ", " " );
13851
						}
13852
					}
13853
13854
					// Only assign if different to avoid unneeded rendering.
13855
					finalValue = value ? jQuery.trim( cur ) : "";
13856
					if ( elem.className !== finalValue ) {
13857
						elem.className = finalValue;
13858
					}
13859
				}
13860
			}
13861
		}
13862
13863
		return this;
13864
	},
13865
13866
	toggleClass: function( value, stateVal ) {
13867
		var type = typeof value;
13868
13869
		if ( typeof stateVal === "boolean" && type === "string" ) {
13870
			return stateVal ? this.addClass( value ) : this.removeClass( value );
13871
		}
13872
13873
		if ( jQuery.isFunction( value ) ) {
13874
			return this.each(function( i ) {
13875
				jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
13876
			});
13877
		}
13878
13879
		return this.each(function() {
13880
			if ( type === "string" ) {
13881
				// Toggle individual class names
13882
				var className,
13883
					i = 0,
13884
					self = jQuery( this ),
13885
					classNames = value.match( rnotwhite ) || [];
13886
13887
				while ( (className = classNames[ i++ ]) ) {
13888
					// Check each className given, space separated list
13889
					if ( self.hasClass( className ) ) {
13890
						self.removeClass( className );
13891
					} else {
13892
						self.addClass( className );
13893
					}
13894
				}
13895
13896
			// Toggle whole class name
13897
			} else if ( type === strundefined || type === "boolean" ) {
13898
				if ( this.className ) {
13899
					// store className if set
13900
					data_priv.set( this, "__className__", this.className );
13901
				}
13902
13903
				// If the element has a class name or if we're passed `false`,
13904
				// then remove the whole classname (if there was one, the above saved it).
13905
				// Otherwise bring back whatever was previously saved (if anything),
13906
				// falling back to the empty string if nothing was stored.
13907
				this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
13908
			}
13909
		});
13910
	},
13911
13912
	hasClass: function( selector ) {
13913
		var className = " " + selector + " ",
13914
			i = 0,
13915
			l = this.length;
13916
		for ( ; i < l; i++ ) {
13917
			if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
13918
				return true;
13919
			}
13920
		}
13921
13922
		return false;
13923
	}
13924
});
13925
13926
13927
13928
13929
var rreturn = /\r/g;
13930
13931
jQuery.fn.extend({
13932
	val: function( value ) {
13933
		var hooks, ret, isFunction,
13934
			elem = this[0];
13935
13936
		if ( !arguments.length ) {
13937
			if ( elem ) {
13938
				hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
13939
13940
				if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
13941
					return ret;
13942
				}
13943
13944
				ret = elem.value;
13945
13946
				return typeof ret === "string" ?
13947
					// Handle most common string cases
13948
					ret.replace(rreturn, "") :
13949
					// Handle cases where value is null/undef or number
13950
					ret == null ? "" : ret;
13951
			}
13952
13953
			return;
13954
		}
13955
13956
		isFunction = jQuery.isFunction( value );
13957
13958
		return this.each(function( i ) {
13959
			var val;
13960
13961
			if ( this.nodeType !== 1 ) {
13962
				return;
13963
			}
13964
13965
			if ( isFunction ) {
13966
				val = value.call( this, i, jQuery( this ).val() );
13967
			} else {
13968
				val = value;
13969
			}
13970
13971
			// Treat null/undefined as ""; convert numbers to string
13972
			if ( val == null ) {
13973
				val = "";
13974
13975
			} else if ( typeof val === "number" ) {
13976
				val += "";
13977
13978
			} else if ( jQuery.isArray( val ) ) {
13979
				val = jQuery.map( val, function( value ) {
13980
					return value == null ? "" : value + "";
13981
				});
13982
			}
13983
13984
			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
13985
13986
			// If set returns undefined, fall back to normal setting
13987
			if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
13988
				this.value = val;
13989
			}
13990
		});
13991
	}
13992
});
13993
13994
jQuery.extend({
13995
	valHooks: {
13996
		option: {
13997
			get: function( elem ) {
13998
				var val = jQuery.find.attr( elem, "value" );
13999
				return val != null ?
14000
					val :
14001
					// Support: IE10-11+
14002
					// option.text throws exceptions (#14686, #14858)
14003
					jQuery.trim( jQuery.text( elem ) );
14004
			}
14005
		},
14006
		select: {
14007
			get: function( elem ) {
14008
				var value, option,
14009
					options = elem.options,
14010
					index = elem.selectedIndex,
14011
					one = elem.type === "select-one" || index < 0,
14012
					values = one ? null : [],
14013
					max = one ? index + 1 : options.length,
14014
					i = index < 0 ?
14015
						max :
14016
						one ? index : 0;
14017
14018
				// Loop through all the selected options
14019
				for ( ; i < max; i++ ) {
14020
					option = options[ i ];
14021
14022
					// IE6-9 doesn't update selected after form reset (#2551)
14023
					if ( ( option.selected || i === index ) &&
14024
							// Don't return options that are disabled or in a disabled optgroup
14025
							( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
14026
							( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
14027
14028
						// Get the specific value for the option
14029
						value = jQuery( option ).val();
14030
14031
						// We don't need an array for one selects
14032
						if ( one ) {
14033
							return value;
14034
						}
14035
14036
						// Multi-Selects return an array
14037
						values.push( value );
14038
					}
14039
				}
14040
14041
				return values;
14042
			},
14043
14044
			set: function( elem, value ) {
14045
				var optionSet, option,
14046
					options = elem.options,
14047
					values = jQuery.makeArray( value ),
14048
					i = options.length;
14049
14050
				while ( i-- ) {
14051
					option = options[ i ];
14052
					if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
14053
						optionSet = true;
14054
					}
14055
				}
14056
14057
				// Force browsers to behave consistently when non-matching value is set
14058
				if ( !optionSet ) {
14059
					elem.selectedIndex = -1;
14060
				}
14061
				return values;
14062
			}
14063
		}
14064
	}
14065
});
14066
14067
// Radios and checkboxes getter/setter
14068
jQuery.each([ "radio", "checkbox" ], function() {
14069
	jQuery.valHooks[ this ] = {
14070
		set: function( elem, value ) {
14071
			if ( jQuery.isArray( value ) ) {
14072
				return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
14073
			}
14074
		}
14075
	};
14076
	if ( !support.checkOn ) {
14077
		jQuery.valHooks[ this ].get = function( elem ) {
14078
			return elem.getAttribute("value") === null ? "on" : elem.value;
14079
		};
14080
	}
14081
});
14082
14083
14084
14085
14086
// Return jQuery for attributes-only inclusion
14087
14088
14089
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
14090
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
14091
	"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
14092
14093
	// Handle event binding
14094
	jQuery.fn[ name ] = function( data, fn ) {
14095
		return arguments.length > 0 ?
14096
			this.on( name, null, data, fn ) :
14097
			this.trigger( name );
14098
	};
14099
});
14100
14101
jQuery.fn.extend({
14102
	hover: function( fnOver, fnOut ) {
14103
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
14104
	},
14105
14106
	bind: function( types, data, fn ) {
14107
		return this.on( types, null, data, fn );
14108
	},
14109
	unbind: function( types, fn ) {
14110
		return this.off( types, null, fn );
14111
	},
14112
14113
	delegate: function( selector, types, data, fn ) {
14114
		return this.on( types, selector, data, fn );
14115
	},
14116
	undelegate: function( selector, types, fn ) {
14117
		// ( namespace ) or ( selector, types [, fn] )
14118
		return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
14119
	}
14120
});
14121
14122
14123
var nonce = jQuery.now();
14124
14125
var rquery = (/\?/);
14126
14127
14128
14129
// Support: Android 2.3
14130
// Workaround failure to string-cast null input
14131
jQuery.parseJSON = function( data ) {
14132
	return JSON.parse( data + "" );
14133
};
14134
14135
14136
// Cross-browser xml parsing
14137
jQuery.parseXML = function( data ) {
14138
	var xml, tmp;
14139
	if ( !data || typeof data !== "string" ) {
14140
		return null;
14141
	}
14142
14143
	// Support: IE9
14144
	try {
14145
		tmp = new DOMParser();
14146
		xml = tmp.parseFromString( data, "text/xml" );
14147
	} catch ( e ) {
14148
		xml = undefined;
14149
	}
14150
14151
	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
14152
		jQuery.error( "Invalid XML: " + data );
14153
	}
14154
	return xml;
14155
};
14156
14157
14158
var
14159
	rhash = /#.*$/,
14160
	rts = /([?&])_=[^&]*/,
14161
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
14162
	// #7653, #8125, #8152: local protocol detection
14163
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
14164
	rnoContent = /^(?:GET|HEAD)$/,
14165
	rprotocol = /^\/\//,
14166
	rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
14167
14168
	/* Prefilters
14169
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
14170
	 * 2) These are called:
14171
	 *    - BEFORE asking for a transport
14172
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
14173
	 * 3) key is the dataType
14174
	 * 4) the catchall symbol "*" can be used
14175
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
14176
	 */
14177
	prefilters = {},
14178
14179
	/* Transports bindings
14180
	 * 1) key is the dataType
14181
	 * 2) the catchall symbol "*" can be used
14182
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
14183
	 */
14184
	transports = {},
14185
14186
	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
14187
	allTypes = "*/".concat( "*" ),
14188
14189
	// Document location
14190
	ajaxLocation = window.location.href,
14191
14192
	// Segment location into parts
14193
	ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
14194
14195
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
14196
function addToPrefiltersOrTransports( structure ) {
14197
14198
	// dataTypeExpression is optional and defaults to "*"
14199
	return function( dataTypeExpression, func ) {
14200
14201
		if ( typeof dataTypeExpression !== "string" ) {
14202
			func = dataTypeExpression;
14203
			dataTypeExpression = "*";
14204
		}
14205
14206
		var dataType,
14207
			i = 0,
14208
			dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
14209
14210
		if ( jQuery.isFunction( func ) ) {
14211
			// For each dataType in the dataTypeExpression
14212
			while ( (dataType = dataTypes[i++]) ) {
14213
				// Prepend if requested
14214
				if ( dataType[0] === "+" ) {
14215
					dataType = dataType.slice( 1 ) || "*";
14216
					(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
14217
14218
				// Otherwise append
14219
				} else {
14220
					(structure[ dataType ] = structure[ dataType ] || []).push( func );
14221
				}
14222
			}
14223
		}
14224
	};
14225
}
14226
14227
// Base inspection function for prefilters and transports
14228
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
14229
14230
	var inspected = {},
14231
		seekingTransport = ( structure === transports );
14232
14233
	function inspect( dataType ) {
14234
		var selected;
14235
		inspected[ dataType ] = true;
14236
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
14237
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
14238
			if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
14239
				options.dataTypes.unshift( dataTypeOrTransport );
14240
				inspect( dataTypeOrTransport );
14241
				return false;
14242
			} else if ( seekingTransport ) {
14243
				return !( selected = dataTypeOrTransport );
14244
			}
14245
		});
14246
		return selected;
14247
	}
14248
14249
	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
14250
}
14251
14252
// A special extend for ajax options
14253
// that takes "flat" options (not to be deep extended)
14254
// Fixes #9887
14255
function ajaxExtend( target, src ) {
14256
	var key, deep,
14257
		flatOptions = jQuery.ajaxSettings.flatOptions || {};
14258
14259
	for ( key in src ) {
14260
		if ( src[ key ] !== undefined ) {
14261
			( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
14262
		}
14263
	}
14264
	if ( deep ) {
14265
		jQuery.extend( true, target, deep );
14266
	}
14267
14268
	return target;
14269
}
14270
14271
/* Handles responses to an ajax request:
14272
 * - finds the right dataType (mediates between content-type and expected dataType)
14273
 * - returns the corresponding response
14274
 */
14275
function ajaxHandleResponses( s, jqXHR, responses ) {
14276
14277
	var ct, type, finalDataType, firstDataType,
14278
		contents = s.contents,
14279
		dataTypes = s.dataTypes;
14280
14281
	// Remove auto dataType and get content-type in the process
14282
	while ( dataTypes[ 0 ] === "*" ) {
14283
		dataTypes.shift();
14284
		if ( ct === undefined ) {
14285
			ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
14286
		}
14287
	}
14288
14289
	// Check if we're dealing with a known content-type
14290
	if ( ct ) {
14291
		for ( type in contents ) {
14292
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
14293
				dataTypes.unshift( type );
14294
				break;
14295
			}
14296
		}
14297
	}
14298
14299
	// Check to see if we have a response for the expected dataType
14300
	if ( dataTypes[ 0 ] in responses ) {
14301
		finalDataType = dataTypes[ 0 ];
14302
	} else {
14303
		// Try convertible dataTypes
14304
		for ( type in responses ) {
14305
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
14306
				finalDataType = type;
14307
				break;
14308
			}
14309
			if ( !firstDataType ) {
14310
				firstDataType = type;
14311
			}
14312
		}
14313
		// Or just use first one
14314
		finalDataType = finalDataType || firstDataType;
14315
	}
14316
14317
	// If we found a dataType
14318
	// We add the dataType to the list if needed
14319
	// and return the corresponding response
14320
	if ( finalDataType ) {
14321
		if ( finalDataType !== dataTypes[ 0 ] ) {
14322
			dataTypes.unshift( finalDataType );
14323
		}
14324
		return responses[ finalDataType ];
14325
	}
14326
}
14327
14328
/* Chain conversions given the request and the original response
14329
 * Also sets the responseXXX fields on the jqXHR instance
14330
 */
14331
function ajaxConvert( s, response, jqXHR, isSuccess ) {
14332
	var conv2, current, conv, tmp, prev,
14333
		converters = {},
14334
		// Work with a copy of dataTypes in case we need to modify it for conversion
14335
		dataTypes = s.dataTypes.slice();
14336
14337
	// Create converters map with lowercased keys
14338
	if ( dataTypes[ 1 ] ) {
14339
		for ( conv in s.converters ) {
14340
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
14341
		}
14342
	}
14343
14344
	current = dataTypes.shift();
14345
14346
	// Convert to each sequential dataType
14347
	while ( current ) {
14348
14349
		if ( s.responseFields[ current ] ) {
14350
			jqXHR[ s.responseFields[ current ] ] = response;
14351
		}
14352
14353
		// Apply the dataFilter if provided
14354
		if ( !prev && isSuccess && s.dataFilter ) {
14355
			response = s.dataFilter( response, s.dataType );
14356
		}
14357
14358
		prev = current;
14359
		current = dataTypes.shift();
14360
14361
		if ( current ) {
14362
14363
		// There's only work to do if current dataType is non-auto
14364
			if ( current === "*" ) {
14365
14366
				current = prev;
14367
14368
			// Convert response if prev dataType is non-auto and differs from current
14369
			} else if ( prev !== "*" && prev !== current ) {
14370
14371
				// Seek a direct converter
14372
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
14373
14374
				// If none found, seek a pair
14375
				if ( !conv ) {
14376
					for ( conv2 in converters ) {
14377
14378
						// If conv2 outputs current
14379
						tmp = conv2.split( " " );
14380
						if ( tmp[ 1 ] === current ) {
14381
14382
							// If prev can be converted to accepted input
14383
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
14384
								converters[ "* " + tmp[ 0 ] ];
14385
							if ( conv ) {
14386
								// Condense equivalence converters
14387
								if ( conv === true ) {
14388
									conv = converters[ conv2 ];
14389
14390
								// Otherwise, insert the intermediate dataType
14391
								} else if ( converters[ conv2 ] !== true ) {
14392
									current = tmp[ 0 ];
14393
									dataTypes.unshift( tmp[ 1 ] );
14394
								}
14395
								break;
14396
							}
14397
						}
14398
					}
14399
				}
14400
14401
				// Apply converter (if not an equivalence)
14402
				if ( conv !== true ) {
14403
14404
					// Unless errors are allowed to bubble, catch and return them
14405
					if ( conv && s[ "throws" ] ) {
14406
						response = conv( response );
14407
					} else {
14408
						try {
14409
							response = conv( response );
14410
						} catch ( e ) {
14411
							return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
14412
						}
14413
					}
14414
				}
14415
			}
14416
		}
14417
	}
14418
14419
	return { state: "success", data: response };
14420
}
14421
14422
jQuery.extend({
14423
14424
	// Counter for holding the number of active queries
14425
	active: 0,
14426
14427
	// Last-Modified header cache for next request
14428
	lastModified: {},
14429
	etag: {},
14430
14431
	ajaxSettings: {
14432
		url: ajaxLocation,
14433
		type: "GET",
14434
		isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
14435
		global: true,
14436
		processData: true,
14437
		async: true,
14438
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
14439
		/*
14440
		timeout: 0,
14441
		data: null,
14442
		dataType: null,
14443
		username: null,
14444
		password: null,
14445
		cache: null,
14446
		throws: false,
14447
		traditional: false,
14448
		headers: {},
14449
		*/
14450
14451
		accepts: {
14452
			"*": allTypes,
14453
			text: "text/plain",
14454
			html: "text/html",
14455
			xml: "application/xml, text/xml",
14456
			json: "application/json, text/javascript"
14457
		},
14458
14459
		contents: {
14460
			xml: /xml/,
14461
			html: /html/,
14462
			json: /json/
14463
		},
14464
14465
		responseFields: {
14466
			xml: "responseXML",
14467
			text: "responseText",
14468
			json: "responseJSON"
14469
		},
14470
14471
		// Data converters
14472
		// Keys separate source (or catchall "*") and destination types with a single space
14473
		converters: {
14474
14475
			// Convert anything to text
14476
			"* text": String,
14477
14478
			// Text to html (true = no transformation)
14479
			"text html": true,
14480
14481
			// Evaluate text as a json expression
14482
			"text json": jQuery.parseJSON,
14483
14484
			// Parse text as xml
14485
			"text xml": jQuery.parseXML
14486
		},
14487
14488
		// For options that shouldn't be deep extended:
14489
		// you can add your own custom options here if
14490
		// and when you create one that shouldn't be
14491
		// deep extended (see ajaxExtend)
14492
		flatOptions: {
14493
			url: true,
14494
			context: true
14495
		}
14496
	},
14497
14498
	// Creates a full fledged settings object into target
14499
	// with both ajaxSettings and settings fields.
14500
	// If target is omitted, writes into ajaxSettings.
14501
	ajaxSetup: function( target, settings ) {
14502
		return settings ?
14503
14504
			// Building a settings object
14505
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
14506
14507
			// Extending ajaxSettings
14508
			ajaxExtend( jQuery.ajaxSettings, target );
14509
	},
14510
14511
	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
14512
	ajaxTransport: addToPrefiltersOrTransports( transports ),
14513
14514
	// Main method
14515
	ajax: function( url, options ) {
14516
14517
		// If url is an object, simulate pre-1.5 signature
14518
		if ( typeof url === "object" ) {
14519
			options = url;
14520
			url = undefined;
14521
		}
14522
14523
		// Force options to be an object
14524
		options = options || {};
14525
14526
		var transport,
14527
			// URL without anti-cache param
14528
			cacheURL,
14529
			// Response headers
14530
			responseHeadersString,
14531
			responseHeaders,
14532
			// timeout handle
14533
			timeoutTimer,
14534
			// Cross-domain detection vars
14535
			parts,
14536
			// To know if global events are to be dispatched
14537
			fireGlobals,
14538
			// Loop variable
14539
			i,
14540
			// Create the final options object
14541
			s = jQuery.ajaxSetup( {}, options ),
14542
			// Callbacks context
14543
			callbackContext = s.context || s,
14544
			// Context for global events is callbackContext if it is a DOM node or jQuery collection
14545
			globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
14546
				jQuery( callbackContext ) :
14547
				jQuery.event,
14548
			// Deferreds
14549
			deferred = jQuery.Deferred(),
14550
			completeDeferred = jQuery.Callbacks("once memory"),
14551
			// Status-dependent callbacks
14552
			statusCode = s.statusCode || {},
14553
			// Headers (they are sent all at once)
14554
			requestHeaders = {},
14555
			requestHeadersNames = {},
14556
			// The jqXHR state
14557
			state = 0,
14558
			// Default abort message
14559
			strAbort = "canceled",
14560
			// Fake xhr
14561
			jqXHR = {
14562
				readyState: 0,
14563
14564
				// Builds headers hashtable if needed
14565
				getResponseHeader: function( key ) {
14566
					var match;
14567
					if ( state === 2 ) {
14568
						if ( !responseHeaders ) {
14569
							responseHeaders = {};
14570
							while ( (match = rheaders.exec( responseHeadersString )) ) {
14571
								responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
14572
							}
14573
						}
14574
						match = responseHeaders[ key.toLowerCase() ];
14575
					}
14576
					return match == null ? null : match;
14577
				},
14578
14579
				// Raw string
14580
				getAllResponseHeaders: function() {
14581
					return state === 2 ? responseHeadersString : null;
14582
				},
14583
14584
				// Caches the header
14585
				setRequestHeader: function( name, value ) {
14586
					var lname = name.toLowerCase();
14587
					if ( !state ) {
14588
						name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
14589
						requestHeaders[ name ] = value;
14590
					}
14591
					return this;
14592
				},
14593
14594
				// Overrides response content-type header
14595
				overrideMimeType: function( type ) {
14596
					if ( !state ) {
14597
						s.mimeType = type;
14598
					}
14599
					return this;
14600
				},
14601
14602
				// Status-dependent callbacks
14603
				statusCode: function( map ) {
14604
					var code;
14605
					if ( map ) {
14606
						if ( state < 2 ) {
14607
							for ( code in map ) {
14608
								// Lazy-add the new callback in a way that preserves old ones
14609
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
14610
							}
14611
						} else {
14612
							// Execute the appropriate callbacks
14613
							jqXHR.always( map[ jqXHR.status ] );
14614
						}
14615
					}
14616
					return this;
14617
				},
14618
14619
				// Cancel the request
14620
				abort: function( statusText ) {
14621
					var finalText = statusText || strAbort;
14622
					if ( transport ) {
14623
						transport.abort( finalText );
14624
					}
14625
					done( 0, finalText );
14626
					return this;
14627
				}
14628
			};
14629
14630
		// Attach deferreds
14631
		deferred.promise( jqXHR ).complete = completeDeferred.add;
14632
		jqXHR.success = jqXHR.done;
14633
		jqXHR.error = jqXHR.fail;
14634
14635
		// Remove hash character (#7531: and string promotion)
14636
		// Add protocol if not provided (prefilters might expect it)
14637
		// Handle falsy url in the settings object (#10093: consistency with old signature)
14638
		// We also use the url parameter if available
14639
		s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
14640
			.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
14641
14642
		// Alias method option to type as per ticket #12004
14643
		s.type = options.method || options.type || s.method || s.type;
14644
14645
		// Extract dataTypes list
14646
		s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
14647
14648
		// A cross-domain request is in order when we have a protocol:host:port mismatch
14649
		if ( s.crossDomain == null ) {
14650
			parts = rurl.exec( s.url.toLowerCase() );
14651
			s.crossDomain = !!( parts &&
14652
				( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
14653
					( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
14654
						( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
14655
			);
14656
		}
14657
14658
		// Convert data if not already a string
14659
		if ( s.data && s.processData && typeof s.data !== "string" ) {
14660
			s.data = jQuery.param( s.data, s.traditional );
14661
		}
14662
14663
		// Apply prefilters
14664
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
14665
14666
		// If request was aborted inside a prefilter, stop there
14667
		if ( state === 2 ) {
14668
			return jqXHR;
14669
		}
14670
14671
		// We can fire global events as of now if asked to
14672
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
14673
		fireGlobals = jQuery.event && s.global;
14674
14675
		// Watch for a new set of requests
14676
		if ( fireGlobals && jQuery.active++ === 0 ) {
14677
			jQuery.event.trigger("ajaxStart");
14678
		}
14679
14680
		// Uppercase the type
14681
		s.type = s.type.toUpperCase();
14682
14683
		// Determine if request has content
14684
		s.hasContent = !rnoContent.test( s.type );
14685
14686
		// Save the URL in case we're toying with the If-Modified-Since
14687
		// and/or If-None-Match header later on
14688
		cacheURL = s.url;
14689
14690
		// More options handling for requests with no content
14691
		if ( !s.hasContent ) {
14692
14693
			// If data is available, append data to url
14694
			if ( s.data ) {
14695
				cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
14696
				// #9682: remove data so that it's not used in an eventual retry
14697
				delete s.data;
14698
			}
14699
14700
			// Add anti-cache in url if needed
14701
			if ( s.cache === false ) {
14702
				s.url = rts.test( cacheURL ) ?
14703
14704
					// If there is already a '_' parameter, set its value
14705
					cacheURL.replace( rts, "$1_=" + nonce++ ) :
14706
14707
					// Otherwise add one to the end
14708
					cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
14709
			}
14710
		}
14711
14712
		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14713
		if ( s.ifModified ) {
14714
			if ( jQuery.lastModified[ cacheURL ] ) {
14715
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
14716
			}
14717
			if ( jQuery.etag[ cacheURL ] ) {
14718
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
14719
			}
14720
		}
14721
14722
		// Set the correct header, if data is being sent
14723
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
14724
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
14725
		}
14726
14727
		// Set the Accepts header for the server, depending on the dataType
14728
		jqXHR.setRequestHeader(
14729
			"Accept",
14730
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
14731
				s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
14732
				s.accepts[ "*" ]
14733
		);
14734
14735
		// Check for headers option
14736
		for ( i in s.headers ) {
14737
			jqXHR.setRequestHeader( i, s.headers[ i ] );
14738
		}
14739
14740
		// Allow custom headers/mimetypes and early abort
14741
		if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
14742
			// Abort if not done already and return
14743
			return jqXHR.abort();
14744
		}
14745
14746
		// Aborting is no longer a cancellation
14747
		strAbort = "abort";
14748
14749
		// Install callbacks on deferreds
14750
		for ( i in { success: 1, error: 1, complete: 1 } ) {
14751
			jqXHR[ i ]( s[ i ] );
14752
		}
14753
14754
		// Get transport
14755
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
14756
14757
		// If no transport, we auto-abort
14758
		if ( !transport ) {
14759
			done( -1, "No Transport" );
14760
		} else {
14761
			jqXHR.readyState = 1;
14762
14763
			// Send global event
14764
			if ( fireGlobals ) {
14765
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
14766
			}
14767
			// Timeout
14768
			if ( s.async && s.timeout > 0 ) {
14769
				timeoutTimer = setTimeout(function() {
14770
					jqXHR.abort("timeout");
14771
				}, s.timeout );
14772
			}
14773
14774
			try {
14775
				state = 1;
14776
				transport.send( requestHeaders, done );
14777
			} catch ( e ) {
14778
				// Propagate exception as error if not done
14779
				if ( state < 2 ) {
14780
					done( -1, e );
14781
				// Simply rethrow otherwise
14782
				} else {
14783
					throw e;
14784
				}
14785
			}
14786
		}
14787
14788
		// Callback for when everything is done
14789
		function done( status, nativeStatusText, responses, headers ) {
14790
			var isSuccess, success, error, response, modified,
14791
				statusText = nativeStatusText;
14792
14793
			// Called once
14794
			if ( state === 2 ) {
14795
				return;
14796
			}
14797
14798
			// State is "done" now
14799
			state = 2;
14800
14801
			// Clear timeout if it exists
14802
			if ( timeoutTimer ) {
14803
				clearTimeout( timeoutTimer );
14804
			}
14805
14806
			// Dereference transport for early garbage collection
14807
			// (no matter how long the jqXHR object will be used)
14808
			transport = undefined;
14809
14810
			// Cache response headers
14811
			responseHeadersString = headers || "";
14812
14813
			// Set readyState
14814
			jqXHR.readyState = status > 0 ? 4 : 0;
14815
14816
			// Determine if successful
14817
			isSuccess = status >= 200 && status < 300 || status === 304;
14818
14819
			// Get response data
14820
			if ( responses ) {
14821
				response = ajaxHandleResponses( s, jqXHR, responses );
14822
			}
14823
14824
			// Convert no matter what (that way responseXXX fields are always set)
14825
			response = ajaxConvert( s, response, jqXHR, isSuccess );
14826
14827
			// If successful, handle type chaining
14828
			if ( isSuccess ) {
14829
14830
				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14831
				if ( s.ifModified ) {
14832
					modified = jqXHR.getResponseHeader("Last-Modified");
14833
					if ( modified ) {
14834
						jQuery.lastModified[ cacheURL ] = modified;
14835
					}
14836
					modified = jqXHR.getResponseHeader("etag");
14837
					if ( modified ) {
14838
						jQuery.etag[ cacheURL ] = modified;
14839
					}
14840
				}
14841
14842
				// if no content
14843
				if ( status === 204 || s.type === "HEAD" ) {
14844
					statusText = "nocontent";
14845
14846
				// if not modified
14847
				} else if ( status === 304 ) {
14848
					statusText = "notmodified";
14849
14850
				// If we have data, let's convert it
14851
				} else {
14852
					statusText = response.state;
14853
					success = response.data;
14854
					error = response.error;
14855
					isSuccess = !error;
14856
				}
14857
			} else {
14858
				// Extract error from statusText and normalize for non-aborts
14859
				error = statusText;
14860
				if ( status || !statusText ) {
14861
					statusText = "error";
14862
					if ( status < 0 ) {
14863
						status = 0;
14864
					}
14865
				}
14866
			}
14867
14868
			// Set data for the fake xhr object
14869
			jqXHR.status = status;
14870
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
14871
14872
			// Success/Error
14873
			if ( isSuccess ) {
14874
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
14875
			} else {
14876
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
14877
			}
14878
14879
			// Status-dependent callbacks
14880
			jqXHR.statusCode( statusCode );
14881
			statusCode = undefined;
14882
14883
			if ( fireGlobals ) {
14884
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
14885
					[ jqXHR, s, isSuccess ? success : error ] );
14886
			}
14887
14888
			// Complete
14889
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
14890
14891
			if ( fireGlobals ) {
14892
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
14893
				// Handle the global AJAX counter
14894
				if ( !( --jQuery.active ) ) {
14895
					jQuery.event.trigger("ajaxStop");
14896
				}
14897
			}
14898
		}
14899
14900
		return jqXHR;
14901
	},
14902
14903
	getJSON: function( url, data, callback ) {
14904
		return jQuery.get( url, data, callback, "json" );
14905
	},
14906
14907
	getScript: function( url, callback ) {
14908
		return jQuery.get( url, undefined, callback, "script" );
14909
	}
14910
});
14911
14912
jQuery.each( [ "get", "post" ], function( i, method ) {
14913
	jQuery[ method ] = function( url, data, callback, type ) {
14914
		// Shift arguments if data argument was omitted
14915
		if ( jQuery.isFunction( data ) ) {
14916
			type = type || callback;
14917
			callback = data;
14918
			data = undefined;
14919
		}
14920
14921
		return jQuery.ajax({
14922
			url: url,
14923
			type: method,
14924
			dataType: type,
14925
			data: data,
14926
			success: callback
14927
		});
14928
	};
14929
});
14930
14931
14932
jQuery._evalUrl = function( url ) {
14933
	return jQuery.ajax({
14934
		url: url,
14935
		type: "GET",
14936
		dataType: "script",
14937
		async: false,
14938
		global: false,
14939
		"throws": true
14940
	});
14941
};
14942
14943
14944
jQuery.fn.extend({
14945
	wrapAll: function( html ) {
14946
		var wrap;
14947
14948
		if ( jQuery.isFunction( html ) ) {
14949
			return this.each(function( i ) {
14950
				jQuery( this ).wrapAll( html.call(this, i) );
14951
			});
14952
		}
14953
14954
		if ( this[ 0 ] ) {
14955
14956
			// The elements to wrap the target around
14957
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
14958
14959
			if ( this[ 0 ].parentNode ) {
14960
				wrap.insertBefore( this[ 0 ] );
14961
			}
14962
14963
			wrap.map(function() {
14964
				var elem = this;
14965
14966
				while ( elem.firstElementChild ) {
14967
					elem = elem.firstElementChild;
14968
				}
14969
14970
				return elem;
14971
			}).append( this );
14972
		}
14973
14974
		return this;
14975
	},
14976
14977
	wrapInner: function( html ) {
14978
		if ( jQuery.isFunction( html ) ) {
14979
			return this.each(function( i ) {
14980
				jQuery( this ).wrapInner( html.call(this, i) );
14981
			});
14982
		}
14983
14984
		return this.each(function() {
14985
			var self = jQuery( this ),
14986
				contents = self.contents();
14987
14988
			if ( contents.length ) {
14989
				contents.wrapAll( html );
14990
14991
			} else {
14992
				self.append( html );
14993
			}
14994
		});
14995
	},
14996
14997
	wrap: function( html ) {
14998
		var isFunction = jQuery.isFunction( html );
14999
15000
		return this.each(function( i ) {
15001
			jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
15002
		});
15003
	},
15004
15005
	unwrap: function() {
15006
		return this.parent().each(function() {
15007
			if ( !jQuery.nodeName( this, "body" ) ) {
15008
				jQuery( this ).replaceWith( this.childNodes );
15009
			}
15010
		}).end();
15011
	}
15012
});
15013
15014
15015
jQuery.expr.filters.hidden = function( elem ) {
15016
	// Support: Opera <= 12.12
15017
	// Opera reports offsetWidths and offsetHeights less than zero on some elements
15018
	return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
15019
};
15020
jQuery.expr.filters.visible = function( elem ) {
15021
	return !jQuery.expr.filters.hidden( elem );
15022
};
15023
15024
15025
15026
15027
var r20 = /%20/g,
15028
	rbracket = /\[\]$/,
15029
	rCRLF = /\r?\n/g,
15030
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
15031
	rsubmittable = /^(?:input|select|textarea|keygen)/i;
15032
15033
function buildParams( prefix, obj, traditional, add ) {
15034
	var name;
15035
15036
	if ( jQuery.isArray( obj ) ) {
15037
		// Serialize array item.
15038
		jQuery.each( obj, function( i, v ) {
15039
			if ( traditional || rbracket.test( prefix ) ) {
15040
				// Treat each array item as a scalar.
15041
				add( prefix, v );
15042
15043
			} else {
15044
				// Item is non-scalar (array or object), encode its numeric index.
15045
				buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
15046
			}
15047
		});
15048
15049
	} else if ( !traditional && jQuery.type( obj ) === "object" ) {
15050
		// Serialize object item.
15051
		for ( name in obj ) {
15052
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
15053
		}
15054
15055
	} else {
15056
		// Serialize scalar item.
15057
		add( prefix, obj );
15058
	}
15059
}
15060
15061
// Serialize an array of form elements or a set of
15062
// key/values into a query string
15063
jQuery.param = function( a, traditional ) {
15064
	var prefix,
15065
		s = [],
15066
		add = function( key, value ) {
15067
			// If value is a function, invoke it and return its value
15068
			value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
15069
			s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
15070
		};
15071
15072
	// Set traditional to true for jQuery <= 1.3.2 behavior.
15073
	if ( traditional === undefined ) {
15074
		traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
15075
	}
15076
15077
	// If an array was passed in, assume that it is an array of form elements.
15078
	if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
15079
		// Serialize the form elements
15080
		jQuery.each( a, function() {
15081
			add( this.name, this.value );
15082
		});
15083
15084
	} else {
15085
		// If traditional, encode the "old" way (the way 1.3.2 or older
15086
		// did it), otherwise encode params recursively.
15087
		for ( prefix in a ) {
15088
			buildParams( prefix, a[ prefix ], traditional, add );
15089
		}
15090
	}
15091
15092
	// Return the resulting serialization
15093
	return s.join( "&" ).replace( r20, "+" );
15094
};
15095
15096
jQuery.fn.extend({
15097
	serialize: function() {
15098
		return jQuery.param( this.serializeArray() );
15099
	},
15100
	serializeArray: function() {
15101
		return this.map(function() {
15102
			// Can add propHook for "elements" to filter or add form elements
15103
			var elements = jQuery.prop( this, "elements" );
15104
			return elements ? jQuery.makeArray( elements ) : this;
15105
		})
15106
		.filter(function() {
15107
			var type = this.type;
15108
15109
			// Use .is( ":disabled" ) so that fieldset[disabled] works
15110
			return this.name && !jQuery( this ).is( ":disabled" ) &&
15111
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
15112
				( this.checked || !rcheckableType.test( type ) );
15113
		})
15114
		.map(function( i, elem ) {
15115
			var val = jQuery( this ).val();
15116
15117
			return val == null ?
15118
				null :
15119
				jQuery.isArray( val ) ?
15120
					jQuery.map( val, function( val ) {
15121
						return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15122
					}) :
15123
					{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15124
		}).get();
15125
	}
15126
});
15127
15128
15129
jQuery.ajaxSettings.xhr = function() {
15130
	try {
15131
		return new XMLHttpRequest();
15132
	} catch( e ) {}
15133
};
15134
15135
var xhrId = 0,
15136
	xhrCallbacks = {},
15137
	xhrSuccessStatus = {
15138
		// file protocol always yields status code 0, assume 200
15139
		0: 200,
15140
		// Support: IE9
15141
		// #1450: sometimes IE returns 1223 when it should be 204
15142
		1223: 204
15143
	},
15144
	xhrSupported = jQuery.ajaxSettings.xhr();
15145
15146
// Support: IE9
15147
// Open requests must be manually aborted on unload (#5280)
15148
// See https://support.microsoft.com/kb/2856746 for more info
15149
if ( window.attachEvent ) {
15150
	window.attachEvent( "onunload", function() {
15151
		for ( var key in xhrCallbacks ) {
15152
			xhrCallbacks[ key ]();
15153
		}
15154
	});
15155
}
15156
15157
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
15158
support.ajax = xhrSupported = !!xhrSupported;
15159
15160
jQuery.ajaxTransport(function( options ) {
15161
	var callback;
15162
15163
	// Cross domain only allowed if supported through XMLHttpRequest
15164
	if ( support.cors || xhrSupported && !options.crossDomain ) {
15165
		return {
15166
			send: function( headers, complete ) {
15167
				var i,
15168
					xhr = options.xhr(),
15169
					id = ++xhrId;
15170
15171
				xhr.open( options.type, options.url, options.async, options.username, options.password );
15172
15173
				// Apply custom fields if provided
15174
				if ( options.xhrFields ) {
15175
					for ( i in options.xhrFields ) {
15176
						xhr[ i ] = options.xhrFields[ i ];
15177
					}
15178
				}
15179
15180
				// Override mime type if needed
15181
				if ( options.mimeType && xhr.overrideMimeType ) {
15182
					xhr.overrideMimeType( options.mimeType );
15183
				}
15184
15185
				// X-Requested-With header
15186
				// For cross-domain requests, seeing as conditions for a preflight are
15187
				// akin to a jigsaw puzzle, we simply never set it to be sure.
15188
				// (it can always be set on a per-request basis or even using ajaxSetup)
15189
				// For same-domain requests, won't change header if already provided.
15190
				if ( !options.crossDomain && !headers["X-Requested-With"] ) {
15191
					headers["X-Requested-With"] = "XMLHttpRequest";
15192
				}
15193
15194
				// Set headers
15195
				for ( i in headers ) {
15196
					xhr.setRequestHeader( i, headers[ i ] );
15197
				}
15198
15199
				// Callback
15200
				callback = function( type ) {
15201
					return function() {
15202
						if ( callback ) {
15203
							delete xhrCallbacks[ id ];
15204
							callback = xhr.onload = xhr.onerror = null;
15205
15206
							if ( type === "abort" ) {
15207
								xhr.abort();
15208
							} else if ( type === "error" ) {
15209
								complete(
15210
									// file: protocol always yields status 0; see #8605, #14207
15211
									xhr.status,
15212
									xhr.statusText
15213
								);
15214
							} else {
15215
								complete(
15216
									xhrSuccessStatus[ xhr.status ] || xhr.status,
15217
									xhr.statusText,
15218
									// Support: IE9
15219
									// Accessing binary-data responseText throws an exception
15220
									// (#11426)
15221
									typeof xhr.responseText === "string" ? {
15222
										text: xhr.responseText
15223
									} : undefined,
15224
									xhr.getAllResponseHeaders()
15225
								);
15226
							}
15227
						}
15228
					};
15229
				};
15230
15231
				// Listen to events
15232
				xhr.onload = callback();
15233
				xhr.onerror = callback("error");
15234
15235
				// Create the abort callback
15236
				callback = xhrCallbacks[ id ] = callback("abort");
15237
15238
				try {
15239
					// Do send the request (this may raise an exception)
15240
					xhr.send( options.hasContent && options.data || null );
15241
				} catch ( e ) {
15242
					// #14683: Only rethrow if this hasn't been notified as an error yet
15243
					if ( callback ) {
15244
						throw e;
15245
					}
15246
				}
15247
			},
15248
15249
			abort: function() {
15250
				if ( callback ) {
15251
					callback();
15252
				}
15253
			}
15254
		};
15255
	}
15256
});
15257
15258
15259
15260
15261
// Install script dataType
15262
jQuery.ajaxSetup({
15263
	accepts: {
15264
		script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
15265
	},
15266
	contents: {
15267
		script: /(?:java|ecma)script/
15268
	},
15269
	converters: {
15270
		"text script": function( text ) {
15271
			jQuery.globalEval( text );
15272
			return text;
15273
		}
15274
	}
15275
});
15276
15277
// Handle cache's special case and crossDomain
15278
jQuery.ajaxPrefilter( "script", function( s ) {
15279
	if ( s.cache === undefined ) {
15280
		s.cache = false;
15281
	}
15282
	if ( s.crossDomain ) {
15283
		s.type = "GET";
15284
	}
15285
});
15286
15287
// Bind script tag hack transport
15288
jQuery.ajaxTransport( "script", function( s ) {
15289
	// This transport only deals with cross domain requests
15290
	if ( s.crossDomain ) {
15291
		var script, callback;
15292
		return {
15293
			send: function( _, complete ) {
15294
				script = jQuery("<script>").prop({
15295
					async: true,
15296
					charset: s.scriptCharset,
15297
					src: s.url
15298
				}).on(
15299
					"load error",
15300
					callback = function( evt ) {
15301
						script.remove();
15302
						callback = null;
15303
						if ( evt ) {
15304
							complete( evt.type === "error" ? 404 : 200, evt.type );
15305
						}
15306
					}
15307
				);
15308
				document.head.appendChild( script[ 0 ] );
15309
			},
15310
			abort: function() {
15311
				if ( callback ) {
15312
					callback();
15313
				}
15314
			}
15315
		};
15316
	}
15317
});
15318
15319
15320
15321
15322
var oldCallbacks = [],
15323
	rjsonp = /(=)\?(?=&|$)|\?\?/;
15324
15325
// Default jsonp settings
15326
jQuery.ajaxSetup({
15327
	jsonp: "callback",
15328
	jsonpCallback: function() {
15329
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
15330
		this[ callback ] = true;
15331
		return callback;
15332
	}
15333
});
15334
15335
// Detect, normalize options and install callbacks for jsonp requests
15336
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
15337
15338
	var callbackName, overwritten, responseContainer,
15339
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
15340
			"url" :
15341
			typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
15342
		);
15343
15344
	// Handle iff the expected data type is "jsonp" or we have a parameter to set
15345
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
15346
15347
		// Get callback name, remembering preexisting value associated with it
15348
		callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
15349
			s.jsonpCallback() :
15350
			s.jsonpCallback;
15351
15352
		// Insert callback into url or form data
15353
		if ( jsonProp ) {
15354
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
15355
		} else if ( s.jsonp !== false ) {
15356
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
15357
		}
15358
15359
		// Use data converter to retrieve json after script execution
15360
		s.converters["script json"] = function() {
15361
			if ( !responseContainer ) {
15362
				jQuery.error( callbackName + " was not called" );
15363
			}
15364
			return responseContainer[ 0 ];
15365
		};
15366
15367
		// force json dataType
15368
		s.dataTypes[ 0 ] = "json";
15369
15370
		// Install callback
15371
		overwritten = window[ callbackName ];
15372
		window[ callbackName ] = function() {
15373
			responseContainer = arguments;
15374
		};
15375
15376
		// Clean-up function (fires after converters)
15377
		jqXHR.always(function() {
15378
			// Restore preexisting value
15379
			window[ callbackName ] = overwritten;
15380
15381
			// Save back as free
15382
			if ( s[ callbackName ] ) {
15383
				// make sure that re-using the options doesn't screw things around
15384
				s.jsonpCallback = originalSettings.jsonpCallback;
15385
15386
				// save the callback name for future use
15387
				oldCallbacks.push( callbackName );
15388
			}
15389
15390
			// Call if it was a function and we have a response
15391
			if ( responseContainer && jQuery.isFunction( overwritten ) ) {
15392
				overwritten( responseContainer[ 0 ] );
15393
			}
15394
15395
			responseContainer = overwritten = undefined;
15396
		});
15397
15398
		// Delegate to script
15399
		return "script";
15400
	}
15401
});
15402
15403
15404
15405
15406
// data: string of html
15407
// context (optional): If specified, the fragment will be created in this context, defaults to document
15408
// keepScripts (optional): If true, will include scripts passed in the html string
15409
jQuery.parseHTML = function( data, context, keepScripts ) {
15410
	if ( !data || typeof data !== "string" ) {
15411
		return null;
15412
	}
15413
	if ( typeof context === "boolean" ) {
15414
		keepScripts = context;
15415
		context = false;
15416
	}
15417
	context = context || document;
15418
15419
	var parsed = rsingleTag.exec( data ),
15420
		scripts = !keepScripts && [];
15421
15422
	// Single tag
15423
	if ( parsed ) {
15424
		return [ context.createElement( parsed[1] ) ];
15425
	}
15426
15427
	parsed = jQuery.buildFragment( [ data ], context, scripts );
15428
15429
	if ( scripts && scripts.length ) {
15430
		jQuery( scripts ).remove();
15431
	}
15432
15433
	return jQuery.merge( [], parsed.childNodes );
15434
};
15435
15436
15437
// Keep a copy of the old load method
15438
var _load = jQuery.fn.load;
15439
15440
/**
15441
 * Load a url into a page
15442
 */
15443
jQuery.fn.load = function( url, params, callback ) {
15444
	if ( typeof url !== "string" && _load ) {
15445
		return _load.apply( this, arguments );
15446
	}
15447
15448
	var selector, type, response,
15449
		self = this,
15450
		off = url.indexOf(" ");
15451
15452
	if ( off >= 0 ) {
15453
		selector = jQuery.trim( url.slice( off ) );
15454
		url = url.slice( 0, off );
15455
	}
15456
15457
	// If it's a function
15458
	if ( jQuery.isFunction( params ) ) {
15459
15460
		// We assume that it's the callback
15461
		callback = params;
15462
		params = undefined;
15463
15464
	// Otherwise, build a param string
15465
	} else if ( params && typeof params === "object" ) {
15466
		type = "POST";
15467
	}
15468
15469
	// If we have elements to modify, make the request
15470
	if ( self.length > 0 ) {
15471
		jQuery.ajax({
15472
			url: url,
15473
15474
			// if "type" variable is undefined, then "GET" method will be used
15475
			type: type,
15476
			dataType: "html",
15477
			data: params
15478
		}).done(function( responseText ) {
15479
15480
			// Save response for use in complete callback
15481
			response = arguments;
15482
15483
			self.html( selector ?
15484
15485
				// If a selector was specified, locate the right elements in a dummy div
15486
				// Exclude scripts to avoid IE 'Permission Denied' errors
15487
				jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
15488
15489
				// Otherwise use the full result
15490
				responseText );
15491
15492
		}).complete( callback && function( jqXHR, status ) {
15493
			self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
15494
		});
15495
	}
15496
15497
	return this;
15498
};
15499
15500
15501
15502
15503
// Attach a bunch of functions for handling common AJAX events
15504
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
15505
	jQuery.fn[ type ] = function( fn ) {
15506
		return this.on( type, fn );
15507
	};
15508
});
15509
15510
15511
15512
15513
jQuery.expr.filters.animated = function( elem ) {
15514
	return jQuery.grep(jQuery.timers, function( fn ) {
15515
		return elem === fn.elem;
15516
	}).length;
15517
};
15518
15519
15520
15521
15522
var docElem = window.document.documentElement;
15523
15524
/**
15525
 * Gets a window from an element
15526
 */
15527
function getWindow( elem ) {
15528
	return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
15529
}
15530
15531
jQuery.offset = {
15532
	setOffset: function( elem, options, i ) {
15533
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
15534
			position = jQuery.css( elem, "position" ),
15535
			curElem = jQuery( elem ),
15536
			props = {};
15537
15538
		// Set position first, in-case top/left are set even on static elem
15539
		if ( position === "static" ) {
15540
			elem.style.position = "relative";
15541
		}
15542
15543
		curOffset = curElem.offset();
15544
		curCSSTop = jQuery.css( elem, "top" );
15545
		curCSSLeft = jQuery.css( elem, "left" );
15546
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
15547
			( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
15548
15549
		// Need to be able to calculate position if either
15550
		// top or left is auto and position is either absolute or fixed
15551
		if ( calculatePosition ) {
15552
			curPosition = curElem.position();
15553
			curTop = curPosition.top;
15554
			curLeft = curPosition.left;
15555
15556
		} else {
15557
			curTop = parseFloat( curCSSTop ) || 0;
15558
			curLeft = parseFloat( curCSSLeft ) || 0;
15559
		}
15560
15561
		if ( jQuery.isFunction( options ) ) {
15562
			options = options.call( elem, i, curOffset );
15563
		}
15564
15565
		if ( options.top != null ) {
15566
			props.top = ( options.top - curOffset.top ) + curTop;
15567
		}
15568
		if ( options.left != null ) {
15569
			props.left = ( options.left - curOffset.left ) + curLeft;
15570
		}
15571
15572
		if ( "using" in options ) {
15573
			options.using.call( elem, props );
15574
15575
		} else {
15576
			curElem.css( props );
15577
		}
15578
	}
15579
};
15580
15581
jQuery.fn.extend({
15582
	offset: function( options ) {
15583
		if ( arguments.length ) {
15584
			return options === undefined ?
15585
				this :
15586
				this.each(function( i ) {
15587
					jQuery.offset.setOffset( this, options, i );
15588
				});
15589
		}
15590
15591
		var docElem, win,
15592
			elem = this[ 0 ],
15593
			box = { top: 0, left: 0 },
15594
			doc = elem && elem.ownerDocument;
15595
15596
		if ( !doc ) {
15597
			return;
15598
		}
15599
15600
		docElem = doc.documentElement;
15601
15602
		// Make sure it's not a disconnected DOM node
15603
		if ( !jQuery.contains( docElem, elem ) ) {
15604
			return box;
15605
		}
15606
15607
		// Support: BlackBerry 5, iOS 3 (original iPhone)
15608
		// If we don't have gBCR, just use 0,0 rather than error
15609
		if ( typeof elem.getBoundingClientRect !== strundefined ) {
15610
			box = elem.getBoundingClientRect();
15611
		}
15612
		win = getWindow( doc );
15613
		return {
15614
			top: box.top + win.pageYOffset - docElem.clientTop,
15615
			left: box.left + win.pageXOffset - docElem.clientLeft
15616
		};
15617
	},
15618
15619
	position: function() {
15620
		if ( !this[ 0 ] ) {
15621
			return;
15622
		}
15623
15624
		var offsetParent, offset,
15625
			elem = this[ 0 ],
15626
			parentOffset = { top: 0, left: 0 };
15627
15628
		// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
15629
		if ( jQuery.css( elem, "position" ) === "fixed" ) {
15630
			// Assume getBoundingClientRect is there when computed position is fixed
15631
			offset = elem.getBoundingClientRect();
15632
15633
		} else {
15634
			// Get *real* offsetParent
15635
			offsetParent = this.offsetParent();
15636
15637
			// Get correct offsets
15638
			offset = this.offset();
15639
			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
15640
				parentOffset = offsetParent.offset();
15641
			}
15642
15643
			// Add offsetParent borders
15644
			parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
15645
			parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
15646
		}
15647
15648
		// Subtract parent offsets and element margins
15649
		return {
15650
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
15651
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
15652
		};
15653
	},
15654
15655
	offsetParent: function() {
15656
		return this.map(function() {
15657
			var offsetParent = this.offsetParent || docElem;
15658
15659
			while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
15660
				offsetParent = offsetParent.offsetParent;
15661
			}
15662
15663
			return offsetParent || docElem;
15664
		});
15665
	}
15666
});
15667
15668
// Create scrollLeft and scrollTop methods
15669
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
15670
	var top = "pageYOffset" === prop;
15671
15672
	jQuery.fn[ method ] = function( val ) {
15673
		return access( this, function( elem, method, val ) {
15674
			var win = getWindow( elem );
15675
15676
			if ( val === undefined ) {
15677
				return win ? win[ prop ] : elem[ method ];
15678
			}
15679
15680
			if ( win ) {
15681
				win.scrollTo(
15682
					!top ? val : window.pageXOffset,
15683
					top ? val : window.pageYOffset
15684
				);
15685
15686
			} else {
15687
				elem[ method ] = val;
15688
			}
15689
		}, method, val, arguments.length, null );
15690
	};
15691
});
15692
15693
// Support: Safari<7+, Chrome<37+
15694
// Add the top/left cssHooks using jQuery.fn.position
15695
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
15696
// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
15697
// getComputedStyle returns percent when specified for top/left/bottom/right;
15698
// rather than make the css module depend on the offset module, just check for it here
15699
jQuery.each( [ "top", "left" ], function( i, prop ) {
15700
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
15701
		function( elem, computed ) {
15702
			if ( computed ) {
15703
				computed = curCSS( elem, prop );
15704
				// If curCSS returns percentage, fallback to offset
15705
				return rnumnonpx.test( computed ) ?
15706
					jQuery( elem ).position()[ prop ] + "px" :
15707
					computed;
15708
			}
15709
		}
15710
	);
15711
});
15712
15713
15714
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
15715
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
15716
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
15717
		// Margin is only for outerHeight, outerWidth
15718
		jQuery.fn[ funcName ] = function( margin, value ) {
15719
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
15720
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
15721
15722
			return access( this, function( elem, type, value ) {
15723
				var doc;
15724
15725
				if ( jQuery.isWindow( elem ) ) {
15726
					// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
15727
					// isn't a whole lot we can do. See pull request at this URL for discussion:
15728
					// https://github.com/jquery/jquery/pull/764
15729
					return elem.document.documentElement[ "client" + name ];
15730
				}
15731
15732
				// Get document width or height
15733
				if ( elem.nodeType === 9 ) {
15734
					doc = elem.documentElement;
15735
15736
					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
15737
					// whichever is greatest
15738
					return Math.max(
15739
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
15740
						elem.body[ "offset" + name ], doc[ "offset" + name ],
15741
						doc[ "client" + name ]
15742
					);
15743
				}
15744
15745
				return value === undefined ?
15746
					// Get width or height on the element, requesting but not forcing parseFloat
15747
					jQuery.css( elem, type, extra ) :
15748
15749
					// Set width or height on the element
15750
					jQuery.style( elem, type, value, extra );
15751
			}, type, chainable ? margin : undefined, chainable, null );
15752
		};
15753
	});
15754
});
15755
15756
15757
// The number of elements contained in the matched element set
15758
jQuery.fn.size = function() {
15759
	return this.length;
15760
};
15761
15762
jQuery.fn.andSelf = jQuery.fn.addBack;
15763
15764
15765
15766
15767
// Register as a named AMD module, since jQuery can be concatenated with other
15768
// files that may use define, but not via a proper concatenation script that
15769
// understands anonymous AMD modules. A named AMD is safest and most robust
15770
// way to register. Lowercase jquery is used because AMD module names are
15771
// derived from file names, and jQuery is normally delivered in a lowercase
15772
// file name. Do this after creating the global so that if an AMD module wants
15773
// to call noConflict to hide this version of jQuery, it will work.
15774
15775
// Note that for maximum portability, libraries that are not jQuery should
15776
// declare themselves as anonymous modules, and avoid setting a global if an
15777
// AMD loader is present. jQuery is a special case. For more information, see
15778
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
15779
15780
if ( typeof define === "function" && define.amd ) {
15781
	define( "jquery", [], function() {
15782
		return jQuery;
15783
	});
15784
}
15785
15786
15787
15788
15789
var
15790
	// Map over jQuery in case of overwrite
15791
	_jQuery = window.jQuery,
15792
15793
	// Map over the $ in case of overwrite
15794
	_$ = window.$;
15795
15796
jQuery.noConflict = function( deep ) {
15797
	if ( window.$ === jQuery ) {
15798
		window.$ = _$;
15799
	}
15800
15801
	if ( deep && window.jQuery === jQuery ) {
15802
		window.jQuery = _jQuery;
15803
	}
15804
15805
	return jQuery;
15806
};
15807
15808
// Expose jQuery and $ identifiers, even in AMD
15809
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
15810
// and CommonJS for browser emulators (#13566)
15811
if ( typeof noGlobal === strundefined ) {
15812
	window.jQuery = window.$ = jQuery;
15813
}
15814
15815
15816
15817
15818
return jQuery;
15819
15820
}));
15821
15822
},{}],21:[function(require,module,exports){
15823
'use strict';
15824
15825
15826
var yaml = require('./lib/js-yaml.js');
15827
15828
15829
module.exports = yaml;
15830
15831
},{"./lib/js-yaml.js":22}],22:[function(require,module,exports){
15832
'use strict';
15833
15834
15835
var loader = require('./js-yaml/loader');
15836
var dumper = require('./js-yaml/dumper');
15837
15838
15839
function deprecated(name) {
15840
  return function () {
15841
    throw new Error('Function ' + name + ' is deprecated and cannot be used.');
15842
  };
15843
}
15844
15845
15846
module.exports.Type                = require('./js-yaml/type');
15847
module.exports.Schema              = require('./js-yaml/schema');
15848
module.exports.FAILSAFE_SCHEMA     = require('./js-yaml/schema/failsafe');
15849
module.exports.JSON_SCHEMA         = require('./js-yaml/schema/json');
15850
module.exports.CORE_SCHEMA         = require('./js-yaml/schema/core');
15851
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
15852
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
15853
module.exports.load                = loader.load;
15854
module.exports.loadAll             = loader.loadAll;
15855
module.exports.safeLoad            = loader.safeLoad;
15856
module.exports.safeLoadAll         = loader.safeLoadAll;
15857
module.exports.dump                = dumper.dump;
15858
module.exports.safeDump            = dumper.safeDump;
15859
module.exports.YAMLException       = require('./js-yaml/exception');
15860
15861
// Deprecared schema names from JS-YAML 2.0.x
15862
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
15863
module.exports.SAFE_SCHEMA    = require('./js-yaml/schema/default_safe');
15864
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
15865
15866
// Deprecated functions from JS-YAML 1.x.x
15867
module.exports.scan           = deprecated('scan');
15868
module.exports.parse          = deprecated('parse');
15869
module.exports.compose        = deprecated('compose');
15870
module.exports.addConstructor = deprecated('addConstructor');
15871
15872
},{"./js-yaml/dumper":24,"./js-yaml/exception":25,"./js-yaml/loader":26,"./js-yaml/schema":28,"./js-yaml/schema/core":29,"./js-yaml/schema/default_full":30,"./js-yaml/schema/default_safe":31,"./js-yaml/schema/failsafe":32,"./js-yaml/schema/json":33,"./js-yaml/type":34}],23:[function(require,module,exports){
15873
'use strict';
15874
15875
15876
function isNothing(subject) {
15877
  return (typeof subject === 'undefined') || (null === subject);
15878
}
15879
15880
15881
function isObject(subject) {
15882
  return (typeof subject === 'object') && (null !== subject);
15883
}
15884
15885
15886
function toArray(sequence) {
15887
  if (Array.isArray(sequence)) {
15888
    return sequence;
15889
  } else if (isNothing(sequence)) {
15890
    return [];
15891
  }
15892
  return [ sequence ];
15893
}
15894
15895
15896
function extend(target, source) {
15897
  var index, length, key, sourceKeys;
15898
15899
  if (source) {
15900
    sourceKeys = Object.keys(source);
15901
15902
    for (index = 0, length = sourceKeys.length; index < length; index += 1) {
15903
      key = sourceKeys[index];
15904
      target[key] = source[key];
15905
    }
15906
  }
15907
15908
  return target;
15909
}
15910
15911
15912
function repeat(string, count) {
15913
  var result = '', cycle;
15914
15915
  for (cycle = 0; cycle < count; cycle += 1) {
15916
    result += string;
15917
  }
15918
15919
  return result;
15920
}
15921
15922
15923
function isNegativeZero(number) {
15924
  return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
15925
}
15926
15927
15928
module.exports.isNothing      = isNothing;
15929
module.exports.isObject       = isObject;
15930
module.exports.toArray        = toArray;
15931
module.exports.repeat         = repeat;
15932
module.exports.isNegativeZero = isNegativeZero;
15933
module.exports.extend         = extend;
15934
15935
},{}],24:[function(require,module,exports){
15936
'use strict';
15937
15938
/*eslint-disable no-use-before-define*/
15939
15940
var common              = require('./common');
15941
var YAMLException       = require('./exception');
15942
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
15943
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
15944
15945
var _toString       = Object.prototype.toString;
15946
var _hasOwnProperty = Object.prototype.hasOwnProperty;
15947
15948
var CHAR_TAB                  = 0x09; /* Tab */
15949
var CHAR_LINE_FEED            = 0x0A; /* LF */
15950
var CHAR_CARRIAGE_RETURN      = 0x0D; /* CR */
15951
var CHAR_SPACE                = 0x20; /* Space */
15952
var CHAR_EXCLAMATION          = 0x21; /* ! */
15953
var CHAR_DOUBLE_QUOTE         = 0x22; /* " */
15954
var CHAR_SHARP                = 0x23; /* # */
15955
var CHAR_PERCENT              = 0x25; /* % */
15956
var CHAR_AMPERSAND            = 0x26; /* & */
15957
var CHAR_SINGLE_QUOTE         = 0x27; /* ' */
15958
var CHAR_ASTERISK             = 0x2A; /* * */
15959
var CHAR_COMMA                = 0x2C; /* , */
15960
var CHAR_MINUS                = 0x2D; /* - */
15961
var CHAR_COLON                = 0x3A; /* : */
15962
var CHAR_GREATER_THAN         = 0x3E; /* > */
15963
var CHAR_QUESTION             = 0x3F; /* ? */
15964
var CHAR_COMMERCIAL_AT        = 0x40; /* @ */
15965
var CHAR_LEFT_SQUARE_BRACKET  = 0x5B; /* [ */
15966
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
15967
var CHAR_GRAVE_ACCENT         = 0x60; /* ` */
15968
var CHAR_LEFT_CURLY_BRACKET   = 0x7B; /* { */
15969
var CHAR_VERTICAL_LINE        = 0x7C; /* | */
15970
var CHAR_RIGHT_CURLY_BRACKET  = 0x7D; /* } */
15971
15972
var ESCAPE_SEQUENCES = {};
15973
15974
ESCAPE_SEQUENCES[0x00]   = '\\0';
15975
ESCAPE_SEQUENCES[0x07]   = '\\a';
15976
ESCAPE_SEQUENCES[0x08]   = '\\b';
15977
ESCAPE_SEQUENCES[0x09]   = '\\t';
15978
ESCAPE_SEQUENCES[0x0A]   = '\\n';
15979
ESCAPE_SEQUENCES[0x0B]   = '\\v';
15980
ESCAPE_SEQUENCES[0x0C]   = '\\f';
15981
ESCAPE_SEQUENCES[0x0D]   = '\\r';
15982
ESCAPE_SEQUENCES[0x1B]   = '\\e';
15983
ESCAPE_SEQUENCES[0x22]   = '\\"';
15984
ESCAPE_SEQUENCES[0x5C]   = '\\\\';
15985
ESCAPE_SEQUENCES[0x85]   = '\\N';
15986
ESCAPE_SEQUENCES[0xA0]   = '\\_';
15987
ESCAPE_SEQUENCES[0x2028] = '\\L';
15988
ESCAPE_SEQUENCES[0x2029] = '\\P';
15989
15990
var DEPRECATED_BOOLEANS_SYNTAX = [
15991
  'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
15992
  'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
15993
];
15994
15995
function compileStyleMap(schema, map) {
15996
  var result, keys, index, length, tag, style, type;
15997
15998
  if (null === map) {
15999
    return {};
16000
  }
16001
16002
  result = {};
16003
  keys = Object.keys(map);
16004
16005
  for (index = 0, length = keys.length; index < length; index += 1) {
16006
    tag = keys[index];
16007
    style = String(map[tag]);
16008
16009
    if ('!!' === tag.slice(0, 2)) {
16010
      tag = 'tag:yaml.org,2002:' + tag.slice(2);
16011
    }
16012
16013
    type = schema.compiledTypeMap[tag];
16014
16015
    if (type && _hasOwnProperty.call(type.styleAliases, style)) {
16016
      style = type.styleAliases[style];
16017
    }
16018
16019
    result[tag] = style;
16020
  }
16021
16022
  return result;
16023
}
16024
16025
function encodeHex(character) {
16026
  var string, handle, length;
16027
16028
  string = character.toString(16).toUpperCase();
16029
16030
  if (character <= 0xFF) {
16031
    handle = 'x';
16032
    length = 2;
16033
  } else if (character <= 0xFFFF) {
16034
    handle = 'u';
16035
    length = 4;
16036
  } else if (character <= 0xFFFFFFFF) {
16037
    handle = 'U';
16038
    length = 8;
16039
  } else {
16040
    throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
16041
  }
16042
16043
  return '\\' + handle + common.repeat('0', length - string.length) + string;
16044
}
16045
16046
function State(options) {
16047
  this.schema      = options['schema'] || DEFAULT_FULL_SCHEMA;
16048
  this.indent      = Math.max(1, (options['indent'] || 2));
16049
  this.skipInvalid = options['skipInvalid'] || false;
16050
  this.flowLevel   = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
16051
  this.styleMap    = compileStyleMap(this.schema, options['styles'] || null);
16052
  this.sortKeys    = options['sortKeys'] || false;
16053
16054
  this.implicitTypes = this.schema.compiledImplicit;
16055
  this.explicitTypes = this.schema.compiledExplicit;
16056
16057
  this.tag = null;
16058
  this.result = '';
16059
16060
  this.duplicates = [];
16061
  this.usedDuplicates = null;
16062
}
16063
16064
function indentString(string, spaces) {
16065
  var ind = common.repeat(' ', spaces),
16066
      position = 0,
16067
      next = -1,
16068
      result = '',
16069
      line,
16070
      length = string.length;
16071
16072
  while (position < length) {
16073
    next = string.indexOf('\n', position);
16074
    if (next === -1) {
16075
      line = string.slice(position);
16076
      position = length;
16077
    } else {
16078
      line = string.slice(position, next + 1);
16079
      position = next + 1;
16080
    }
16081
    if (line.length && line !== '\n') {
16082
      result += ind;
16083
    }
16084
    result += line;
16085
  }
16086
16087
  return result;
16088
}
16089
16090
function generateNextLine(state, level) {
16091
  return '\n' + common.repeat(' ', state.indent * level);
16092
}
16093
16094
function testImplicitResolving(state, str) {
16095
  var index, length, type;
16096
16097
  for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
16098
    type = state.implicitTypes[index];
16099
16100
    if (type.resolve(str)) {
16101
      return true;
16102
    }
16103
  }
16104
16105
  return false;
16106
}
16107
16108
function StringBuilder(source) {
16109
  this.source = source;
16110
  this.result = '';
16111
  this.checkpoint = 0;
16112
}
16113
16114
StringBuilder.prototype.takeUpTo = function (position) {
16115
  var er;
16116
16117
  if (position < this.checkpoint) {
16118
    er = new Error('position should be > checkpoint');
16119
    er.position = position;
16120
    er.checkpoint = this.checkpoint;
16121
    throw er;
16122
  }
16123
16124
  this.result += this.source.slice(this.checkpoint, position);
16125
  this.checkpoint = position;
16126
  return this;
16127
};
16128
16129
StringBuilder.prototype.escapeChar = function () {
16130
  var character, esc;
16131
16132
  character = this.source.charCodeAt(this.checkpoint);
16133
  esc = ESCAPE_SEQUENCES[character] || encodeHex(character);
16134
  this.result += esc;
16135
  this.checkpoint += 1;
16136
16137
  return this;
16138
};
16139
16140
StringBuilder.prototype.finish = function () {
16141
  if (this.source.length > this.checkpoint) {
16142
    this.takeUpTo(this.source.length);
16143
  }
16144
};
16145
16146
function writeScalar(state, object, level) {
16147
  var simple, first, spaceWrap, folded, literal, single, double,
16148
      sawLineFeed, linePosition, longestLine, indent, max, character,
16149
      position, escapeSeq, hexEsc, previous, lineLength, modifier,
16150
      trailingLineBreaks, result;
16151
16152
  if (0 === object.length) {
16153
    state.dump = "''";
16154
    return;
16155
  }
16156
16157
  if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
16158
    state.dump = "'" + object + "'";
16159
    return;
16160
  }
16161
16162
  simple = true;
16163
  first = object.length ? object.charCodeAt(0) : 0;
16164
  spaceWrap = (CHAR_SPACE === first ||
16165
               CHAR_SPACE === object.charCodeAt(object.length - 1));
16166
16167
  // Simplified check for restricted first characters
16168
  // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29
16169
  if (CHAR_MINUS         === first ||
16170
      CHAR_QUESTION      === first ||
16171
      CHAR_COMMERCIAL_AT === first ||
16172
      CHAR_GRAVE_ACCENT  === first) {
16173
    simple = false;
16174
  }
16175
16176
  // can only use > and | if not wrapped in spaces.
16177
  if (spaceWrap) {
16178
    simple = false;
16179
    folded = false;
16180
    literal = false;
16181
  } else {
16182
    folded = true;
16183
    literal = true;
16184
  }
16185
16186
  single = true;
16187
  double = new StringBuilder(object);
16188
16189
  sawLineFeed = false;
16190
  linePosition = 0;
16191
  longestLine = 0;
16192
16193
  indent = state.indent * level;
16194
  max = 80;
16195
  if (indent < 40) {
16196
    max -= indent;
16197
  } else {
16198
    max = 40;
16199
  }
16200
16201
  for (position = 0; position < object.length; position++) {
16202
    character = object.charCodeAt(position);
16203
    if (simple) {
16204
      // Characters that can never appear in the simple scalar
16205
      if (!simpleChar(character)) {
16206
        simple = false;
16207
      } else {
16208
        // Still simple.  If we make it all the way through like
16209
        // this, then we can just dump the string as-is.
16210
        continue;
16211
      }
16212
    }
16213
16214
    if (single && character === CHAR_SINGLE_QUOTE) {
16215
      single = false;
16216
    }
16217
16218
    escapeSeq = ESCAPE_SEQUENCES[character];
16219
    hexEsc = needsHexEscape(character);
16220
16221
    if (!escapeSeq && !hexEsc) {
16222
      continue;
16223
    }
16224
16225
    if (character !== CHAR_LINE_FEED &&
16226
        character !== CHAR_DOUBLE_QUOTE &&
16227
        character !== CHAR_SINGLE_QUOTE) {
16228
      folded = false;
16229
      literal = false;
16230
    } else if (character === CHAR_LINE_FEED) {
16231
      sawLineFeed = true;
16232
      single = false;
16233
      if (position > 0) {
16234
        previous = object.charCodeAt(position - 1);
16235
        if (previous === CHAR_SPACE) {
16236
          literal = false;
16237
          folded = false;
16238
        }
16239
      }
16240
      if (folded) {
16241
        lineLength = position - linePosition;
16242
        linePosition = position;
16243
        if (lineLength > longestLine) {
16244
          longestLine = lineLength;
16245
        }
16246
      }
16247
    }
16248
16249
    if (character !== CHAR_DOUBLE_QUOTE) {
16250
      single = false;
16251
    }
16252
16253
    double.takeUpTo(position);
16254
    double.escapeChar();
16255
  }
16256
16257
  if (simple && testImplicitResolving(state, object)) {
16258
    simple = false;
16259
  }
16260
16261
  modifier = '';
16262
  if (folded || literal) {
16263
    trailingLineBreaks = 0;
16264
    if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {
16265
      trailingLineBreaks += 1;
16266
      if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {
16267
        trailingLineBreaks += 1;
16268
      }
16269
    }
16270
16271
    if (trailingLineBreaks === 0) {
16272
      modifier = '-';
16273
    } else if (trailingLineBreaks === 2) {
16274
      modifier = '+';
16275
    }
16276
  }
16277
16278
  if (literal && longestLine < max) {
16279
    folded = false;
16280
  }
16281
16282
  // If it's literally one line, then don't bother with the literal.
16283
  // We may still want to do a fold, though, if it's a super long line.
16284
  if (!sawLineFeed) {
16285
    literal = false;
16286
  }
16287
16288
  if (simple) {
16289
    state.dump = object;
16290
  } else if (single) {
16291
    state.dump = '\'' + object + '\'';
16292
  } else if (folded) {
16293
    result = fold(object, max);
16294
    state.dump = '>' + modifier + '\n' + indentString(result, indent);
16295
  } else if (literal) {
16296
    if (!modifier) {
16297
      object = object.replace(/\n$/, '');
16298
    }
16299
    state.dump = '|' + modifier + '\n' + indentString(object, indent);
16300
  } else if (double) {
16301
    double.finish();
16302
    state.dump = '"' + double.result + '"';
16303
  } else {
16304
    throw new Error('Failed to dump scalar value');
16305
  }
16306
16307
  return;
16308
}
16309
16310
// The `trailing` var is a regexp match of any trailing `\n` characters.
16311
//
16312
// There are three cases we care about:
16313
//
16314
// 1. One trailing `\n` on the string.  Just use `|` or `>`.
16315
//    This is the assumed default. (trailing = null)
16316
// 2. No trailing `\n` on the string.  Use `|-` or `>-` to "chomp" the end.
16317
// 3. More than one trailing `\n` on the string.  Use `|+` or `>+`.
16318
//
16319
// In the case of `>+`, these line breaks are *not* doubled (like the line
16320
// breaks within the string), so it's important to only end with the exact
16321
// same number as we started.
16322
function fold(object, max) {
16323
  var result = '',
16324
      position = 0,
16325
      length = object.length,
16326
      trailing = /\n+$/.exec(object),
16327
      newLine;
16328
16329
  if (trailing) {
16330
    length = trailing.index + 1;
16331
  }
16332
16333
  while (position < length) {
16334
    newLine = object.indexOf('\n', position);
16335
    if (newLine > length || newLine === -1) {
16336
      if (result) {
16337
        result += '\n\n';
16338
      }
16339
      result += foldLine(object.slice(position, length), max);
16340
      position = length;
16341
    } else {
16342
      if (result) {
16343
        result += '\n\n';
16344
      }
16345
      result += foldLine(object.slice(position, newLine), max);
16346
      position = newLine + 1;
16347
    }
16348
  }
16349
  if (trailing && trailing[0] !== '\n') {
16350
    result += trailing[0];
16351
  }
16352
16353
  return result;
16354
}
16355
16356
function foldLine(line, max) {
16357
  if (line === '') {
16358
    return line;
16359
  }
16360
16361
  var foldRe = /[^\s] [^\s]/g,
16362
      result = '',
16363
      prevMatch = 0,
16364
      foldStart = 0,
16365
      match = foldRe.exec(line),
16366
      index,
16367
      foldEnd,
16368
      folded;
16369
16370
  while (match) {
16371
    index = match.index;
16372
16373
    // when we cross the max len, if the previous match would've
16374
    // been ok, use that one, and carry on.  If there was no previous
16375
    // match on this fold section, then just have a long line.
16376
    if (index - foldStart > max) {
16377
      if (prevMatch !== foldStart) {
16378
        foldEnd = prevMatch;
16379
      } else {
16380
        foldEnd = index;
16381
      }
16382
16383
      if (result) {
16384
        result += '\n';
16385
      }
16386
      folded = line.slice(foldStart, foldEnd);
16387
      result += folded;
16388
      foldStart = foldEnd + 1;
16389
    }
16390
    prevMatch = index + 1;
16391
    match = foldRe.exec(line);
16392
  }
16393
16394
  if (result) {
16395
    result += '\n';
16396
  }
16397
16398
  // if we end up with one last word at the end, then the last bit might
16399
  // be slightly bigger than we wanted, because we exited out of the loop.
16400
  if (foldStart !== prevMatch && line.length - foldStart > max) {
16401
    result += line.slice(foldStart, prevMatch) + '\n' +
16402
              line.slice(prevMatch + 1);
16403
  } else {
16404
    result += line.slice(foldStart);
16405
  }
16406
16407
  return result;
16408
}
16409
16410
// Returns true if character can be found in a simple scalar
16411
function simpleChar(character) {
16412
  return CHAR_TAB                  !== character &&
16413
         CHAR_LINE_FEED            !== character &&
16414
         CHAR_CARRIAGE_RETURN      !== character &&
16415
         CHAR_COMMA                !== character &&
16416
         CHAR_LEFT_SQUARE_BRACKET  !== character &&
16417
         CHAR_RIGHT_SQUARE_BRACKET !== character &&
16418
         CHAR_LEFT_CURLY_BRACKET   !== character &&
16419
         CHAR_RIGHT_CURLY_BRACKET  !== character &&
16420
         CHAR_SHARP                !== character &&
16421
         CHAR_AMPERSAND            !== character &&
16422
         CHAR_ASTERISK             !== character &&
16423
         CHAR_EXCLAMATION          !== character &&
16424
         CHAR_VERTICAL_LINE        !== character &&
16425
         CHAR_GREATER_THAN         !== character &&
16426
         CHAR_SINGLE_QUOTE         !== character &&
16427
         CHAR_DOUBLE_QUOTE         !== character &&
16428
         CHAR_PERCENT              !== character &&
16429
         CHAR_COLON                !== character &&
16430
         !ESCAPE_SEQUENCES[character]            &&
16431
         !needsHexEscape(character);
16432
}
16433
16434
// Returns true if the character code needs to be escaped.
16435
function needsHexEscape(character) {
16436
  return !((0x00020 <= character && character <= 0x00007E) ||
16437
           (0x00085 === character)                         ||
16438
           (0x000A0 <= character && character <= 0x00D7FF) ||
16439
           (0x0E000 <= character && character <= 0x00FFFD) ||
16440
           (0x10000 <= character && character <= 0x10FFFF));
16441
}
16442
16443
function writeFlowSequence(state, level, object) {
16444
  var _result = '',
16445
      _tag    = state.tag,
16446
      index,
16447
      length;
16448
16449
  for (index = 0, length = object.length; index < length; index += 1) {
16450
    // Write only valid elements.
16451
    if (writeNode(state, level, object[index], false, false)) {
16452
      if (0 !== index) {
16453
        _result += ', ';
16454
      }
16455
      _result += state.dump;
16456
    }
16457
  }
16458
16459
  state.tag = _tag;
16460
  state.dump = '[' + _result + ']';
16461
}
16462
16463
function writeBlockSequence(state, level, object, compact) {
16464
  var _result = '',
16465
      _tag    = state.tag,
16466
      index,
16467
      length;
16468
16469
  for (index = 0, length = object.length; index < length; index += 1) {
16470
    // Write only valid elements.
16471
    if (writeNode(state, level + 1, object[index], true, true)) {
16472
      if (!compact || 0 !== index) {
16473
        _result += generateNextLine(state, level);
16474
      }
16475
      _result += '- ' + state.dump;
16476
    }
16477
  }
16478
16479
  state.tag = _tag;
16480
  state.dump = _result || '[]'; // Empty sequence if no valid values.
16481
}
16482
16483
function writeFlowMapping(state, level, object) {
16484
  var _result       = '',
16485
      _tag          = state.tag,
16486
      objectKeyList = Object.keys(object),
16487
      index,
16488
      length,
16489
      objectKey,
16490
      objectValue,
16491
      pairBuffer;
16492
16493
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16494
    pairBuffer = '';
16495
16496
    if (0 !== index) {
16497
      pairBuffer += ', ';
16498
    }
16499
16500
    objectKey = objectKeyList[index];
16501
    objectValue = object[objectKey];
16502
16503
    if (!writeNode(state, level, objectKey, false, false)) {
16504
      continue; // Skip this pair because of invalid key;
16505
    }
16506
16507
    if (state.dump.length > 1024) {
16508
      pairBuffer += '? ';
16509
    }
16510
16511
    pairBuffer += state.dump + ': ';
16512
16513
    if (!writeNode(state, level, objectValue, false, false)) {
16514
      continue; // Skip this pair because of invalid value.
16515
    }
16516
16517
    pairBuffer += state.dump;
16518
16519
    // Both key and value are valid.
16520
    _result += pairBuffer;
16521
  }
16522
16523
  state.tag = _tag;
16524
  state.dump = '{' + _result + '}';
16525
}
16526
16527
function writeBlockMapping(state, level, object, compact) {
16528
  var _result       = '',
16529
      _tag          = state.tag,
16530
      objectKeyList = Object.keys(object),
16531
      index,
16532
      length,
16533
      objectKey,
16534
      objectValue,
16535
      explicitPair,
16536
      pairBuffer;
16537
16538
  // Allow sorting keys so that the output file is deterministic
16539
  if (state.sortKeys === true) {
16540
    // Default sorting
16541
    objectKeyList.sort();
16542
  } else if (typeof state.sortKeys === 'function') {
16543
    // Custom sort function
16544
    objectKeyList.sort(state.sortKeys);
16545
  } else if (state.sortKeys) {
16546
    // Something is wrong
16547
    throw new YAMLException('sortKeys must be a boolean or a function');
16548
  }
16549
16550
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16551
    pairBuffer = '';
16552
16553
    if (!compact || 0 !== index) {
16554
      pairBuffer += generateNextLine(state, level);
16555
    }
16556
16557
    objectKey = objectKeyList[index];
16558
    objectValue = object[objectKey];
16559
16560
    if (!writeNode(state, level + 1, objectKey, true, true)) {
16561
      continue; // Skip this pair because of invalid key.
16562
    }
16563
16564
    explicitPair = (null !== state.tag && '?' !== state.tag) ||
16565
                   (state.dump && state.dump.length > 1024);
16566
16567
    if (explicitPair) {
16568
      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
16569
        pairBuffer += '?';
16570
      } else {
16571
        pairBuffer += '? ';
16572
      }
16573
    }
16574
16575
    pairBuffer += state.dump;
16576
16577
    if (explicitPair) {
16578
      pairBuffer += generateNextLine(state, level);
16579
    }
16580
16581
    if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
16582
      continue; // Skip this pair because of invalid value.
16583
    }
16584
16585
    if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
16586
      pairBuffer += ':';
16587
    } else {
16588
      pairBuffer += ': ';
16589
    }
16590
16591
    pairBuffer += state.dump;
16592
16593
    // Both key and value are valid.
16594
    _result += pairBuffer;
16595
  }
16596
16597
  state.tag = _tag;
16598
  state.dump = _result || '{}'; // Empty mapping if no valid pairs.
16599
}
16600
16601
function detectType(state, object, explicit) {
16602
  var _result, typeList, index, length, type, style;
16603
16604
  typeList = explicit ? state.explicitTypes : state.implicitTypes;
16605
16606
  for (index = 0, length = typeList.length; index < length; index += 1) {
16607
    type = typeList[index];
16608
16609
    if ((type.instanceOf  || type.predicate) &&
16610
        (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
16611
        (!type.predicate  || type.predicate(object))) {
16612
16613
      state.tag = explicit ? type.tag : '?';
16614
16615
      if (type.represent) {
16616
        style = state.styleMap[type.tag] || type.defaultStyle;
16617
16618
        if ('[object Function]' === _toString.call(type.represent)) {
16619
          _result = type.represent(object, style);
16620
        } else if (_hasOwnProperty.call(type.represent, style)) {
16621
          _result = type.represent[style](object, style);
16622
        } else {
16623
          throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
16624
        }
16625
16626
        state.dump = _result;
16627
      }
16628
16629
      return true;
16630
    }
16631
  }
16632
16633
  return false;
16634
}
16635
16636
// Serializes `object` and writes it to global `result`.
16637
// Returns true on success, or false on invalid object.
16638
//
16639
function writeNode(state, level, object, block, compact) {
16640
  state.tag = null;
16641
  state.dump = object;
16642
16643
  if (!detectType(state, object, false)) {
16644
    detectType(state, object, true);
16645
  }
16646
16647
  var type = _toString.call(state.dump);
16648
16649
  if (block) {
16650
    block = (0 > state.flowLevel || state.flowLevel > level);
16651
  }
16652
16653
  if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) {
16654
    compact = false;
16655
  }
16656
16657
  var objectOrArray = '[object Object]' === type || '[object Array]' === type,
16658
      duplicateIndex,
16659
      duplicate;
16660
16661
  if (objectOrArray) {
16662
    duplicateIndex = state.duplicates.indexOf(object);
16663
    duplicate = duplicateIndex !== -1;
16664
  }
16665
16666
  if (duplicate && state.usedDuplicates[duplicateIndex]) {
16667
    state.dump = '*ref_' + duplicateIndex;
16668
  } else {
16669
    if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
16670
      state.usedDuplicates[duplicateIndex] = true;
16671
    }
16672
    if ('[object Object]' === type) {
16673
      if (block && (0 !== Object.keys(state.dump).length)) {
16674
        writeBlockMapping(state, level, state.dump, compact);
16675
        if (duplicate) {
16676
          state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
16677
        }
16678
      } else {
16679
        writeFlowMapping(state, level, state.dump);
16680
        if (duplicate) {
16681
          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
16682
        }
16683
      }
16684
    } else if ('[object Array]' === type) {
16685
      if (block && (0 !== state.dump.length)) {
16686
        writeBlockSequence(state, level, state.dump, compact);
16687
        if (duplicate) {
16688
          state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
16689
        }
16690
      } else {
16691
        writeFlowSequence(state, level, state.dump);
16692
        if (duplicate) {
16693
          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
16694
        }
16695
      }
16696
    } else if ('[object String]' === type) {
16697
      if ('?' !== state.tag) {
16698
        writeScalar(state, state.dump, level);
16699
      }
16700
    } else {
16701
      if (state.skipInvalid) {
16702
        return false;
16703
      }
16704
      throw new YAMLException('unacceptable kind of an object to dump ' + type);
16705
    }
16706
16707
    if (null !== state.tag && '?' !== state.tag) {
16708
      state.dump = '!<' + state.tag + '> ' + state.dump;
16709
    }
16710
  }
16711
16712
  return true;
16713
}
16714
16715
function getDuplicateReferences(object, state) {
16716
  var objects = [],
16717
      duplicatesIndexes = [],
16718
      index,
16719
      length;
16720
16721
  inspectNode(object, objects, duplicatesIndexes);
16722
16723
  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
16724
    state.duplicates.push(objects[duplicatesIndexes[index]]);
16725
  }
16726
  state.usedDuplicates = new Array(length);
16727
}
16728
16729
function inspectNode(object, objects, duplicatesIndexes) {
16730
  var type = _toString.call(object),
16731
      objectKeyList,
16732
      index,
16733
      length;
16734
16735
  if (null !== object && 'object' === typeof object) {
16736
    index = objects.indexOf(object);
16737
    if (-1 !== index) {
16738
      if (-1 === duplicatesIndexes.indexOf(index)) {
16739
        duplicatesIndexes.push(index);
16740
      }
16741
    } else {
16742
      objects.push(object);
16743
16744
      if (Array.isArray(object)) {
16745
        for (index = 0, length = object.length; index < length; index += 1) {
16746
          inspectNode(object[index], objects, duplicatesIndexes);
16747
        }
16748
      } else {
16749
        objectKeyList = Object.keys(object);
16750
16751
        for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16752
          inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
16753
        }
16754
      }
16755
    }
16756
  }
16757
}
16758
16759
function dump(input, options) {
16760
  options = options || {};
16761
16762
  var state = new State(options);
16763
16764
  getDuplicateReferences(input, state);
16765
16766
  if (writeNode(state, 0, input, true, true)) {
16767
    return state.dump + '\n';
16768
  }
16769
  return '';
16770
}
16771
16772
function safeDump(input, options) {
16773
  return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
16774
}
16775
16776
module.exports.dump     = dump;
16777
module.exports.safeDump = safeDump;
16778
16779
},{"./common":23,"./exception":25,"./schema/default_full":30,"./schema/default_safe":31}],25:[function(require,module,exports){
16780
'use strict';
16781
16782
16783
function YAMLException(reason, mark) {
16784
  this.name    = 'YAMLException';
16785
  this.reason  = reason;
16786
  this.mark    = mark;
16787
  this.message = this.toString(false);
16788
}
16789
16790
16791
YAMLException.prototype.toString = function toString(compact) {
16792
  var result;
16793
16794
  result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
16795
16796
  if (!compact && this.mark) {
16797
    result += ' ' + this.mark.toString();
16798
  }
16799
16800
  return result;
16801
};
16802
16803
16804
module.exports = YAMLException;
16805
16806
},{}],26:[function(require,module,exports){
16807
'use strict';
16808
16809
/*eslint-disable max-len,no-use-before-define*/
16810
16811
var common              = require('./common');
16812
var YAMLException       = require('./exception');
16813
var Mark                = require('./mark');
16814
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
16815
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
16816
16817
16818
var _hasOwnProperty = Object.prototype.hasOwnProperty;
16819
16820
16821
var CONTEXT_FLOW_IN   = 1;
16822
var CONTEXT_FLOW_OUT  = 2;
16823
var CONTEXT_BLOCK_IN  = 3;
16824
var CONTEXT_BLOCK_OUT = 4;
16825
16826
16827
var CHOMPING_CLIP  = 1;
16828
var CHOMPING_STRIP = 2;
16829
var CHOMPING_KEEP  = 3;
16830
16831
16832
var PATTERN_NON_PRINTABLE         = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
16833
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
16834
var PATTERN_FLOW_INDICATORS       = /[,\[\]\{\}]/;
16835
var PATTERN_TAG_HANDLE            = /^(?:!|!!|![a-z\-]+!)$/i;
16836
var PATTERN_TAG_URI               = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
16837
16838
16839
function is_EOL(c) {
16840
  return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
16841
}
16842
16843
function is_WHITE_SPACE(c) {
16844
  return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
16845
}
16846
16847
function is_WS_OR_EOL(c) {
16848
  return (c === 0x09/* Tab */) ||
16849
         (c === 0x20/* Space */) ||
16850
         (c === 0x0A/* LF */) ||
16851
         (c === 0x0D/* CR */);
16852
}
16853
16854
function is_FLOW_INDICATOR(c) {
16855
  return 0x2C/* , */ === c ||
16856
         0x5B/* [ */ === c ||
16857
         0x5D/* ] */ === c ||
16858
         0x7B/* { */ === c ||
16859
         0x7D/* } */ === c;
16860
}
16861
16862
function fromHexCode(c) {
16863
  var lc;
16864
16865
  if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
16866
    return c - 0x30;
16867
  }
16868
16869
  /*eslint-disable no-bitwise*/
16870
  lc = c | 0x20;
16871
16872
  if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
16873
    return lc - 0x61 + 10;
16874
  }
16875
16876
  return -1;
16877
}
16878
16879
function escapedHexLen(c) {
16880
  if (c === 0x78/* x */) { return 2; }
16881
  if (c === 0x75/* u */) { return 4; }
16882
  if (c === 0x55/* U */) { return 8; }
16883
  return 0;
16884
}
16885
16886
function fromDecimalCode(c) {
16887
  if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
16888
    return c - 0x30;
16889
  }
16890
16891
  return -1;
16892
}
16893
16894
function simpleEscapeSequence(c) {
16895
  return (c === 0x30/* 0 */) ? '\x00' :
16896
        (c === 0x61/* a */) ? '\x07' :
16897
        (c === 0x62/* b */) ? '\x08' :
16898
        (c === 0x74/* t */) ? '\x09' :
16899
        (c === 0x09/* Tab */) ? '\x09' :
16900
        (c === 0x6E/* n */) ? '\x0A' :
16901
        (c === 0x76/* v */) ? '\x0B' :
16902
        (c === 0x66/* f */) ? '\x0C' :
16903
        (c === 0x72/* r */) ? '\x0D' :
16904
        (c === 0x65/* e */) ? '\x1B' :
16905
        (c === 0x20/* Space */) ? ' ' :
16906
        (c === 0x22/* " */) ? '\x22' :
16907
        (c === 0x2F/* / */) ? '/' :
16908
        (c === 0x5C/* \ */) ? '\x5C' :
16909
        (c === 0x4E/* N */) ? '\x85' :
16910
        (c === 0x5F/* _ */) ? '\xA0' :
16911
        (c === 0x4C/* L */) ? '\u2028' :
16912
        (c === 0x50/* P */) ? '\u2029' : '';
16913
}
16914
16915
function charFromCodepoint(c) {
16916
  if (c <= 0xFFFF) {
16917
    return String.fromCharCode(c);
16918
  }
16919
  // Encode UTF-16 surrogate pair
16920
  // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
16921
  return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
16922
                             ((c - 0x010000) & 0x03FF) + 0xDC00);
16923
}
16924
16925
var simpleEscapeCheck = new Array(256); // integer, for fast access
16926
var simpleEscapeMap = new Array(256);
16927
for (var i = 0; i < 256; i++) {
16928
  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
16929
  simpleEscapeMap[i] = simpleEscapeSequence(i);
16930
}
16931
16932
16933
function State(input, options) {
16934
  this.input = input;
16935
16936
  this.filename  = options['filename']  || null;
16937
  this.schema    = options['schema']    || DEFAULT_FULL_SCHEMA;
16938
  this.onWarning = options['onWarning'] || null;
16939
  this.legacy    = options['legacy']    || false;
16940
16941
  this.implicitTypes = this.schema.compiledImplicit;
16942
  this.typeMap       = this.schema.compiledTypeMap;
16943
16944
  this.length     = input.length;
16945
  this.position   = 0;
16946
  this.line       = 0;
16947
  this.lineStart  = 0;
16948
  this.lineIndent = 0;
16949
16950
  this.documents = [];
16951
16952
  /*
16953
  this.version;
16954
  this.checkLineBreaks;
16955
  this.tagMap;
16956
  this.anchorMap;
16957
  this.tag;
16958
  this.anchor;
16959
  this.kind;
16960
  this.result;*/
16961
16962
}
16963
16964
16965
function generateError(state, message) {
16966
  return new YAMLException(
16967
    message,
16968
    new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
16969
}
16970
16971
function throwError(state, message) {
16972
  throw generateError(state, message);
16973
}
16974
16975
function throwWarning(state, message) {
16976
  var error = generateError(state, message);
16977
16978
  if (state.onWarning) {
16979
    state.onWarning.call(null, error);
16980
  } else {
16981
    throw error;
16982
  }
16983
}
16984
16985
16986
var directiveHandlers = {
16987
16988
  YAML: function handleYamlDirective(state, name, args) {
16989
16990
      var match, major, minor;
16991
16992
      if (null !== state.version) {
16993
        throwError(state, 'duplication of %YAML directive');
16994
      }
16995
16996
      if (1 !== args.length) {
16997
        throwError(state, 'YAML directive accepts exactly one argument');
16998
      }
16999
17000
      match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
17001
17002
      if (null === match) {
17003
        throwError(state, 'ill-formed argument of the YAML directive');
17004
      }
17005
17006
      major = parseInt(match[1], 10);
17007
      minor = parseInt(match[2], 10);
17008
17009
      if (1 !== major) {
17010
        throwError(state, 'unacceptable YAML version of the document');
17011
      }
17012
17013
      state.version = args[0];
17014
      state.checkLineBreaks = (minor < 2);
17015
17016
      if (1 !== minor && 2 !== minor) {
17017
        throwWarning(state, 'unsupported YAML version of the document');
17018
      }
17019
    },
17020
17021
  TAG: function handleTagDirective(state, name, args) {
17022
17023
      var handle, prefix;
17024
17025
      if (2 !== args.length) {
17026
        throwError(state, 'TAG directive accepts exactly two arguments');
17027
      }
17028
17029
      handle = args[0];
17030
      prefix = args[1];
17031
17032
      if (!PATTERN_TAG_HANDLE.test(handle)) {
17033
        throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
17034
      }
17035
17036
      if (_hasOwnProperty.call(state.tagMap, handle)) {
17037
        throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
17038
      }
17039
17040
      if (!PATTERN_TAG_URI.test(prefix)) {
17041
        throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
17042
      }
17043
17044
      state.tagMap[handle] = prefix;
17045
    }
17046
};
17047
17048
17049
function captureSegment(state, start, end, checkJson) {
17050
  var _position, _length, _character, _result;
17051
17052
  if (start < end) {
17053
    _result = state.input.slice(start, end);
17054
17055
    if (checkJson) {
17056
      for (_position = 0, _length = _result.length;
17057
           _position < _length;
17058
           _position += 1) {
17059
        _character = _result.charCodeAt(_position);
17060
        if (!(0x09 === _character ||
17061
              0x20 <= _character && _character <= 0x10FFFF)) {
17062
          throwError(state, 'expected valid JSON character');
17063
        }
17064
      }
17065
    }
17066
17067
    state.result += _result;
17068
  }
17069
}
17070
17071
function mergeMappings(state, destination, source) {
17072
  var sourceKeys, key, index, quantity;
17073
17074
  if (!common.isObject(source)) {
17075
    throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
17076
  }
17077
17078
  sourceKeys = Object.keys(source);
17079
17080
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
17081
    key = sourceKeys[index];
17082
17083
    if (!_hasOwnProperty.call(destination, key)) {
17084
      destination[key] = source[key];
17085
    }
17086
  }
17087
}
17088
17089
function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
17090
  var index, quantity;
17091
17092
  keyNode = String(keyNode);
17093
17094
  if (null === _result) {
17095
    _result = {};
17096
  }
17097
17098
  if ('tag:yaml.org,2002:merge' === keyTag) {
17099
    if (Array.isArray(valueNode)) {
17100
      for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
17101
        mergeMappings(state, _result, valueNode[index]);
17102
      }
17103
    } else {
17104
      mergeMappings(state, _result, valueNode);
17105
    }
17106
  } else {
17107
    _result[keyNode] = valueNode;
17108
  }
17109
17110
  return _result;
17111
}
17112
17113
function readLineBreak(state) {
17114
  var ch;
17115
17116
  ch = state.input.charCodeAt(state.position);
17117
17118
  if (0x0A/* LF */ === ch) {
17119
    state.position++;
17120
  } else if (0x0D/* CR */ === ch) {
17121
    state.position++;
17122
    if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {
17123
      state.position++;
17124
    }
17125
  } else {
17126
    throwError(state, 'a line break is expected');
17127
  }
17128
17129
  state.line += 1;
17130
  state.lineStart = state.position;
17131
}
17132
17133
function skipSeparationSpace(state, allowComments, checkIndent) {
17134
  var lineBreaks = 0,
17135
      ch = state.input.charCodeAt(state.position);
17136
17137
  while (0 !== ch) {
17138
    while (is_WHITE_SPACE(ch)) {
17139
      ch = state.input.charCodeAt(++state.position);
17140
    }
17141
17142
    if (allowComments && 0x23/* # */ === ch) {
17143
      do {
17144
        ch = state.input.charCodeAt(++state.position);
17145
      } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);
17146
    }
17147
17148
    if (is_EOL(ch)) {
17149
      readLineBreak(state);
17150
17151
      ch = state.input.charCodeAt(state.position);
17152
      lineBreaks++;
17153
      state.lineIndent = 0;
17154
17155
      while (0x20/* Space */ === ch) {
17156
        state.lineIndent++;
17157
        ch = state.input.charCodeAt(++state.position);
17158
      }
17159
    } else {
17160
      break;
17161
    }
17162
  }
17163
17164
  if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {
17165
    throwWarning(state, 'deficient indentation');
17166
  }
17167
17168
  return lineBreaks;
17169
}
17170
17171
function testDocumentSeparator(state) {
17172
  var _position = state.position,
17173
      ch;
17174
17175
  ch = state.input.charCodeAt(_position);
17176
17177
  // Condition state.position === state.lineStart is tested
17178
  // in parent on each call, for efficiency. No needs to test here again.
17179
  if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&
17180
      state.input.charCodeAt(_position + 1) === ch &&
17181
      state.input.charCodeAt(_position + 2) === ch) {
17182
17183
    _position += 3;
17184
17185
    ch = state.input.charCodeAt(_position);
17186
17187
    if (ch === 0 || is_WS_OR_EOL(ch)) {
17188
      return true;
17189
    }
17190
  }
17191
17192
  return false;
17193
}
17194
17195
function writeFoldedLines(state, count) {
17196
  if (1 === count) {
17197
    state.result += ' ';
17198
  } else if (count > 1) {
17199
    state.result += common.repeat('\n', count - 1);
17200
  }
17201
}
17202
17203
17204
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
17205
  var preceding,
17206
      following,
17207
      captureStart,
17208
      captureEnd,
17209
      hasPendingContent,
17210
      _line,
17211
      _lineStart,
17212
      _lineIndent,
17213
      _kind = state.kind,
17214
      _result = state.result,
17215
      ch;
17216
17217
  ch = state.input.charCodeAt(state.position);
17218
17219
  if (is_WS_OR_EOL(ch)             ||
17220
      is_FLOW_INDICATOR(ch)        ||
17221
      0x23/* # */           === ch ||
17222
      0x26/* & */           === ch ||
17223
      0x2A/* * */           === ch ||
17224
      0x21/* ! */           === ch ||
17225
      0x7C/* | */           === ch ||
17226
      0x3E/* > */           === ch ||
17227
      0x27/* ' */           === ch ||
17228
      0x22/* " */           === ch ||
17229
      0x25/* % */           === ch ||
17230
      0x40/* @ */           === ch ||
17231
      0x60/* ` */           === ch) {
17232
    return false;
17233
  }
17234
17235
  if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {
17236
    following = state.input.charCodeAt(state.position + 1);
17237
17238
    if (is_WS_OR_EOL(following) ||
17239
        withinFlowCollection && is_FLOW_INDICATOR(following)) {
17240
      return false;
17241
    }
17242
  }
17243
17244
  state.kind = 'scalar';
17245
  state.result = '';
17246
  captureStart = captureEnd = state.position;
17247
  hasPendingContent = false;
17248
17249
  while (0 !== ch) {
17250
    if (0x3A/* : */ === ch) {
17251
      following = state.input.charCodeAt(state.position + 1);
17252
17253
      if (is_WS_OR_EOL(following) ||
17254
          withinFlowCollection && is_FLOW_INDICATOR(following)) {
17255
        break;
17256
      }
17257
17258
    } else if (0x23/* # */ === ch) {
17259
      preceding = state.input.charCodeAt(state.position - 1);
17260
17261
      if (is_WS_OR_EOL(preceding)) {
17262
        break;
17263
      }
17264
17265
    } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
17266
               withinFlowCollection && is_FLOW_INDICATOR(ch)) {
17267
      break;
17268
17269
    } else if (is_EOL(ch)) {
17270
      _line = state.line;
17271
      _lineStart = state.lineStart;
17272
      _lineIndent = state.lineIndent;
17273
      skipSeparationSpace(state, false, -1);
17274
17275
      if (state.lineIndent >= nodeIndent) {
17276
        hasPendingContent = true;
17277
        ch = state.input.charCodeAt(state.position);
17278
        continue;
17279
      } else {
17280
        state.position = captureEnd;
17281
        state.line = _line;
17282
        state.lineStart = _lineStart;
17283
        state.lineIndent = _lineIndent;
17284
        break;
17285
      }
17286
    }
17287
17288
    if (hasPendingContent) {
17289
      captureSegment(state, captureStart, captureEnd, false);
17290
      writeFoldedLines(state, state.line - _line);
17291
      captureStart = captureEnd = state.position;
17292
      hasPendingContent = false;
17293
    }
17294
17295
    if (!is_WHITE_SPACE(ch)) {
17296
      captureEnd = state.position + 1;
17297
    }
17298
17299
    ch = state.input.charCodeAt(++state.position);
17300
  }
17301
17302
  captureSegment(state, captureStart, captureEnd, false);
17303
17304
  if (state.result) {
17305
    return true;
17306
  }
17307
17308
  state.kind = _kind;
17309
  state.result = _result;
17310
  return false;
17311
}
17312
17313
function readSingleQuotedScalar(state, nodeIndent) {
17314
  var ch,
17315
      captureStart, captureEnd;
17316
17317
  ch = state.input.charCodeAt(state.position);
17318
17319
  if (0x27/* ' */ !== ch) {
17320
    return false;
17321
  }
17322
17323
  state.kind = 'scalar';
17324
  state.result = '';
17325
  state.position++;
17326
  captureStart = captureEnd = state.position;
17327
17328
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
17329
    if (0x27/* ' */ === ch) {
17330
      captureSegment(state, captureStart, state.position, true);
17331
      ch = state.input.charCodeAt(++state.position);
17332
17333
      if (0x27/* ' */ === ch) {
17334
        captureStart = captureEnd = state.position;
17335
        state.position++;
17336
      } else {
17337
        return true;
17338
      }
17339
17340
    } else if (is_EOL(ch)) {
17341
      captureSegment(state, captureStart, captureEnd, true);
17342
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
17343
      captureStart = captureEnd = state.position;
17344
17345
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
17346
      throwError(state, 'unexpected end of the document within a single quoted scalar');
17347
17348
    } else {
17349
      state.position++;
17350
      captureEnd = state.position;
17351
    }
17352
  }
17353
17354
  throwError(state, 'unexpected end of the stream within a single quoted scalar');
17355
}
17356
17357
function readDoubleQuotedScalar(state, nodeIndent) {
17358
  var captureStart,
17359
      captureEnd,
17360
      hexLength,
17361
      hexResult,
17362
      tmp, tmpEsc,
17363
      ch;
17364
17365
  ch = state.input.charCodeAt(state.position);
17366
17367
  if (0x22/* " */ !== ch) {
17368
    return false;
17369
  }
17370
17371
  state.kind = 'scalar';
17372
  state.result = '';
17373
  state.position++;
17374
  captureStart = captureEnd = state.position;
17375
17376
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
17377
    if (0x22/* " */ === ch) {
17378
      captureSegment(state, captureStart, state.position, true);
17379
      state.position++;
17380
      return true;
17381
17382
    } else if (0x5C/* \ */ === ch) {
17383
      captureSegment(state, captureStart, state.position, true);
17384
      ch = state.input.charCodeAt(++state.position);
17385
17386
      if (is_EOL(ch)) {
17387
        skipSeparationSpace(state, false, nodeIndent);
17388
17389
        // TODO: rework to inline fn with no type cast?
17390
      } else if (ch < 256 && simpleEscapeCheck[ch]) {
17391
        state.result += simpleEscapeMap[ch];
17392
        state.position++;
17393
17394
      } else if ((tmp = escapedHexLen(ch)) > 0) {
17395
        hexLength = tmp;
17396
        hexResult = 0;
17397
17398
        for (; hexLength > 0; hexLength--) {
17399
          ch = state.input.charCodeAt(++state.position);
17400
17401
          if ((tmp = fromHexCode(ch)) >= 0) {
17402
            hexResult = (hexResult << 4) + tmp;
17403
17404
          } else {
17405
            throwError(state, 'expected hexadecimal character');
17406
          }
17407
        }
17408
17409
        state.result += charFromCodepoint(hexResult);
17410
17411
        state.position++;
17412
17413
      } else {
17414
        throwError(state, 'unknown escape sequence');
17415
      }
17416
17417
      captureStart = captureEnd = state.position;
17418
17419
    } else if (is_EOL(ch)) {
17420
      captureSegment(state, captureStart, captureEnd, true);
17421
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
17422
      captureStart = captureEnd = state.position;
17423
17424
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
17425
      throwError(state, 'unexpected end of the document within a double quoted scalar');
17426
17427
    } else {
17428
      state.position++;
17429
      captureEnd = state.position;
17430
    }
17431
  }
17432
17433
  throwError(state, 'unexpected end of the stream within a double quoted scalar');
17434
}
17435
17436
function readFlowCollection(state, nodeIndent) {
17437
  var readNext = true,
17438
      _line,
17439
      _tag     = state.tag,
17440
      _result,
17441
      _anchor  = state.anchor,
17442
      following,
17443
      terminator,
17444
      isPair,
17445
      isExplicitPair,
17446
      isMapping,
17447
      keyNode,
17448
      keyTag,
17449
      valueNode,
17450
      ch;
17451
17452
  ch = state.input.charCodeAt(state.position);
17453
17454
  if (ch === 0x5B/* [ */) {
17455
    terminator = 0x5D;/* ] */
17456
    isMapping = false;
17457
    _result = [];
17458
  } else if (ch === 0x7B/* { */) {
17459
    terminator = 0x7D;/* } */
17460
    isMapping = true;
17461
    _result = {};
17462
  } else {
17463
    return false;
17464
  }
17465
17466
  if (null !== state.anchor) {
17467
    state.anchorMap[state.anchor] = _result;
17468
  }
17469
17470
  ch = state.input.charCodeAt(++state.position);
17471
17472
  while (0 !== ch) {
17473
    skipSeparationSpace(state, true, nodeIndent);
17474
17475
    ch = state.input.charCodeAt(state.position);
17476
17477
    if (ch === terminator) {
17478
      state.position++;
17479
      state.tag = _tag;
17480
      state.anchor = _anchor;
17481
      state.kind = isMapping ? 'mapping' : 'sequence';
17482
      state.result = _result;
17483
      return true;
17484
    } else if (!readNext) {
17485
      throwError(state, 'missed comma between flow collection entries');
17486
    }
17487
17488
    keyTag = keyNode = valueNode = null;
17489
    isPair = isExplicitPair = false;
17490
17491
    if (0x3F/* ? */ === ch) {
17492
      following = state.input.charCodeAt(state.position + 1);
17493
17494
      if (is_WS_OR_EOL(following)) {
17495
        isPair = isExplicitPair = true;
17496
        state.position++;
17497
        skipSeparationSpace(state, true, nodeIndent);
17498
      }
17499
    }
17500
17501
    _line = state.line;
17502
    composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
17503
    keyTag = state.tag;
17504
    keyNode = state.result;
17505
    skipSeparationSpace(state, true, nodeIndent);
17506
17507
    ch = state.input.charCodeAt(state.position);
17508
17509
    if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {
17510
      isPair = true;
17511
      ch = state.input.charCodeAt(++state.position);
17512
      skipSeparationSpace(state, true, nodeIndent);
17513
      composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
17514
      valueNode = state.result;
17515
    }
17516
17517
    if (isMapping) {
17518
      storeMappingPair(state, _result, keyTag, keyNode, valueNode);
17519
    } else if (isPair) {
17520
      _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));
17521
    } else {
17522
      _result.push(keyNode);
17523
    }
17524
17525
    skipSeparationSpace(state, true, nodeIndent);
17526
17527
    ch = state.input.charCodeAt(state.position);
17528
17529
    if (0x2C/* , */ === ch) {
17530
      readNext = true;
17531
      ch = state.input.charCodeAt(++state.position);
17532
    } else {
17533
      readNext = false;
17534
    }
17535
  }
17536
17537
  throwError(state, 'unexpected end of the stream within a flow collection');
17538
}
17539
17540
function readBlockScalar(state, nodeIndent) {
17541
  var captureStart,
17542
      folding,
17543
      chomping       = CHOMPING_CLIP,
17544
      detectedIndent = false,
17545
      textIndent     = nodeIndent,
17546
      emptyLines     = 0,
17547
      atMoreIndented = false,
17548
      tmp,
17549
      ch;
17550
17551
  ch = state.input.charCodeAt(state.position);
17552
17553
  if (ch === 0x7C/* | */) {
17554
    folding = false;
17555
  } else if (ch === 0x3E/* > */) {
17556
    folding = true;
17557
  } else {
17558
    return false;
17559
  }
17560
17561
  state.kind = 'scalar';
17562
  state.result = '';
17563
17564
  while (0 !== ch) {
17565
    ch = state.input.charCodeAt(++state.position);
17566
17567
    if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {
17568
      if (CHOMPING_CLIP === chomping) {
17569
        chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;
17570
      } else {
17571
        throwError(state, 'repeat of a chomping mode identifier');
17572
      }
17573
17574
    } else if ((tmp = fromDecimalCode(ch)) >= 0) {
17575
      if (tmp === 0) {
17576
        throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
17577
      } else if (!detectedIndent) {
17578
        textIndent = nodeIndent + tmp - 1;
17579
        detectedIndent = true;
17580
      } else {
17581
        throwError(state, 'repeat of an indentation width identifier');
17582
      }
17583
17584
    } else {
17585
      break;
17586
    }
17587
  }
17588
17589
  if (is_WHITE_SPACE(ch)) {
17590
    do { ch = state.input.charCodeAt(++state.position); }
17591
    while (is_WHITE_SPACE(ch));
17592
17593
    if (0x23/* # */ === ch) {
17594
      do { ch = state.input.charCodeAt(++state.position); }
17595
      while (!is_EOL(ch) && (0 !== ch));
17596
    }
17597
  }
17598
17599
  while (0 !== ch) {
17600
    readLineBreak(state);
17601
    state.lineIndent = 0;
17602
17603
    ch = state.input.charCodeAt(state.position);
17604
17605
    while ((!detectedIndent || state.lineIndent < textIndent) &&
17606
           (0x20/* Space */ === ch)) {
17607
      state.lineIndent++;
17608
      ch = state.input.charCodeAt(++state.position);
17609
    }
17610
17611
    if (!detectedIndent && state.lineIndent > textIndent) {
17612
      textIndent = state.lineIndent;
17613
    }
17614
17615
    if (is_EOL(ch)) {
17616
      emptyLines++;
17617
      continue;
17618
    }
17619
17620
    // End of the scalar.
17621
    if (state.lineIndent < textIndent) {
17622
17623
      // Perform the chomping.
17624
      if (chomping === CHOMPING_KEEP) {
17625
        state.result += common.repeat('\n', emptyLines);
17626
      } else if (chomping === CHOMPING_CLIP) {
17627
        if (detectedIndent) { // i.e. only if the scalar is not empty.
17628
          state.result += '\n';
17629
        }
17630
      }
17631
17632
      // Break this `while` cycle and go to the funciton's epilogue.
17633
      break;
17634
    }
17635
17636
    // Folded style: use fancy rules to handle line breaks.
17637
    if (folding) {
17638
17639
      // Lines starting with white space characters (more-indented lines) are not folded.
17640
      if (is_WHITE_SPACE(ch)) {
17641
        atMoreIndented = true;
17642
        state.result += common.repeat('\n', emptyLines + 1);
17643
17644
      // End of more-indented block.
17645
      } else if (atMoreIndented) {
17646
        atMoreIndented = false;
17647
        state.result += common.repeat('\n', emptyLines + 1);
17648
17649
      // Just one line break - perceive as the same line.
17650
      } else if (0 === emptyLines) {
17651
        if (detectedIndent) { // i.e. only if we have already read some scalar content.
17652
          state.result += ' ';
17653
        }
17654
17655
      // Several line breaks - perceive as different lines.
17656
      } else {
17657
        state.result += common.repeat('\n', emptyLines);
17658
      }
17659
17660
    // Literal style: just add exact number of line breaks between content lines.
17661
    } else if (detectedIndent) {
17662
      // If current line isn't the first one - count line break from the last content line.
17663
      state.result += common.repeat('\n', emptyLines + 1);
17664
    } else {
17665
      // In case of the first content line - count only empty lines.
17666
    }
17667
17668
    detectedIndent = true;
17669
    emptyLines = 0;
17670
    captureStart = state.position;
17671
17672
    while (!is_EOL(ch) && (0 !== ch)) {
17673
      ch = state.input.charCodeAt(++state.position);
17674
    }
17675
17676
    captureSegment(state, captureStart, state.position, false);
17677
  }
17678
17679
  return true;
17680
}
17681
17682
function readBlockSequence(state, nodeIndent) {
17683
  var _line,
17684
      _tag      = state.tag,
17685
      _anchor   = state.anchor,
17686
      _result   = [],
17687
      following,
17688
      detected  = false,
17689
      ch;
17690
17691
  if (null !== state.anchor) {
17692
    state.anchorMap[state.anchor] = _result;
17693
  }
17694
17695
  ch = state.input.charCodeAt(state.position);
17696
17697
  while (0 !== ch) {
17698
17699
    if (0x2D/* - */ !== ch) {
17700
      break;
17701
    }
17702
17703
    following = state.input.charCodeAt(state.position + 1);
17704
17705
    if (!is_WS_OR_EOL(following)) {
17706
      break;
17707
    }
17708
17709
    detected = true;
17710
    state.position++;
17711
17712
    if (skipSeparationSpace(state, true, -1)) {
17713
      if (state.lineIndent <= nodeIndent) {
17714
        _result.push(null);
17715
        ch = state.input.charCodeAt(state.position);
17716
        continue;
17717
      }
17718
    }
17719
17720
    _line = state.line;
17721
    composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
17722
    _result.push(state.result);
17723
    skipSeparationSpace(state, true, -1);
17724
17725
    ch = state.input.charCodeAt(state.position);
17726
17727
    if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {
17728
      throwError(state, 'bad indentation of a sequence entry');
17729
    } else if (state.lineIndent < nodeIndent) {
17730
      break;
17731
    }
17732
  }
17733
17734
  if (detected) {
17735
    state.tag = _tag;
17736
    state.anchor = _anchor;
17737
    state.kind = 'sequence';
17738
    state.result = _result;
17739
    return true;
17740
  }
17741
  return false;
17742
}
17743
17744
function readBlockMapping(state, nodeIndent, flowIndent) {
17745
  var following,
17746
      allowCompact,
17747
      _line,
17748
      _tag          = state.tag,
17749
      _anchor       = state.anchor,
17750
      _result       = {},
17751
      keyTag        = null,
17752
      keyNode       = null,
17753
      valueNode     = null,
17754
      atExplicitKey = false,
17755
      detected      = false,
17756
      ch;
17757
17758
  if (null !== state.anchor) {
17759
    state.anchorMap[state.anchor] = _result;
17760
  }
17761
17762
  ch = state.input.charCodeAt(state.position);
17763
17764
  while (0 !== ch) {
17765
    following = state.input.charCodeAt(state.position + 1);
17766
    _line = state.line; // Save the current line.
17767
17768
    //
17769
    // Explicit notation case. There are two separate blocks:
17770
    // first for the key (denoted by "?") and second for the value (denoted by ":")
17771
    //
17772
    if ((0x3F/* ? */ === ch || 0x3A/* : */  === ch) && is_WS_OR_EOL(following)) {
17773
17774
      if (0x3F/* ? */ === ch) {
17775
        if (atExplicitKey) {
17776
          storeMappingPair(state, _result, keyTag, keyNode, null);
17777
          keyTag = keyNode = valueNode = null;
17778
        }
17779
17780
        detected = true;
17781
        atExplicitKey = true;
17782
        allowCompact = true;
17783
17784
      } else if (atExplicitKey) {
17785
        // i.e. 0x3A/* : */ === character after the explicit key.
17786
        atExplicitKey = false;
17787
        allowCompact = true;
17788
17789
      } else {
17790
        throwError(state, 'incomplete explicit mapping pair; a key node is missed');
17791
      }
17792
17793
      state.position += 1;
17794
      ch = following;
17795
17796
    //
17797
    // Implicit notation case. Flow-style node as the key first, then ":", and the value.
17798
    //
17799
    } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
17800
17801
      if (state.line === _line) {
17802
        ch = state.input.charCodeAt(state.position);
17803
17804
        while (is_WHITE_SPACE(ch)) {
17805
          ch = state.input.charCodeAt(++state.position);
17806
        }
17807
17808
        if (0x3A/* : */ === ch) {
17809
          ch = state.input.charCodeAt(++state.position);
17810
17811
          if (!is_WS_OR_EOL(ch)) {
17812
            throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
17813
          }
17814
17815
          if (atExplicitKey) {
17816
            storeMappingPair(state, _result, keyTag, keyNode, null);
17817
            keyTag = keyNode = valueNode = null;
17818
          }
17819
17820
          detected = true;
17821
          atExplicitKey = false;
17822
          allowCompact = false;
17823
          keyTag = state.tag;
17824
          keyNode = state.result;
17825
17826
        } else if (detected) {
17827
          throwError(state, 'can not read an implicit mapping pair; a colon is missed');
17828
17829
        } else {
17830
          state.tag = _tag;
17831
          state.anchor = _anchor;
17832
          return true; // Keep the result of `composeNode`.
17833
        }
17834
17835
      } else if (detected) {
17836
        throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
17837
17838
      } else {
17839
        state.tag = _tag;
17840
        state.anchor = _anchor;
17841
        return true; // Keep the result of `composeNode`.
17842
      }
17843
17844
    } else {
17845
      break; // Reading is done. Go to the epilogue.
17846
    }
17847
17848
    //
17849
    // Common reading code for both explicit and implicit notations.
17850
    //
17851
    if (state.line === _line || state.lineIndent > nodeIndent) {
17852
      if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
17853
        if (atExplicitKey) {
17854
          keyNode = state.result;
17855
        } else {
17856
          valueNode = state.result;
17857
        }
17858
      }
17859
17860
      if (!atExplicitKey) {
17861
        storeMappingPair(state, _result, keyTag, keyNode, valueNode);
17862
        keyTag = keyNode = valueNode = null;
17863
      }
17864
17865
      skipSeparationSpace(state, true, -1);
17866
      ch = state.input.charCodeAt(state.position);
17867
    }
17868
17869
    if (state.lineIndent > nodeIndent && (0 !== ch)) {
17870
      throwError(state, 'bad indentation of a mapping entry');
17871
    } else if (state.lineIndent < nodeIndent) {
17872
      break;
17873
    }
17874
  }
17875
17876
  //
17877
  // Epilogue.
17878
  //
17879
17880
  // Special case: last mapping's node contains only the key in explicit notation.
17881
  if (atExplicitKey) {
17882
    storeMappingPair(state, _result, keyTag, keyNode, null);
17883
  }
17884
17885
  // Expose the resulting mapping.
17886
  if (detected) {
17887
    state.tag = _tag;
17888
    state.anchor = _anchor;
17889
    state.kind = 'mapping';
17890
    state.result = _result;
17891
  }
17892
17893
  return detected;
17894
}
17895
17896
function readTagProperty(state) {
17897
  var _position,
17898
      isVerbatim = false,
17899
      isNamed    = false,
17900
      tagHandle,
17901
      tagName,
17902
      ch;
17903
17904
  ch = state.input.charCodeAt(state.position);
17905
17906
  if (0x21/* ! */ !== ch) {
17907
    return false;
17908
  }
17909
17910
  if (null !== state.tag) {
17911
    throwError(state, 'duplication of a tag property');
17912
  }
17913
17914
  ch = state.input.charCodeAt(++state.position);
17915
17916
  if (0x3C/* < */ === ch) {
17917
    isVerbatim = true;
17918
    ch = state.input.charCodeAt(++state.position);
17919
17920
  } else if (0x21/* ! */ === ch) {
17921
    isNamed = true;
17922
    tagHandle = '!!';
17923
    ch = state.input.charCodeAt(++state.position);
17924
17925
  } else {
17926
    tagHandle = '!';
17927
  }
17928
17929
  _position = state.position;
17930
17931
  if (isVerbatim) {
17932
    do { ch = state.input.charCodeAt(++state.position); }
17933
    while (0 !== ch && 0x3E/* > */ !== ch);
17934
17935
    if (state.position < state.length) {
17936
      tagName = state.input.slice(_position, state.position);
17937
      ch = state.input.charCodeAt(++state.position);
17938
    } else {
17939
      throwError(state, 'unexpected end of the stream within a verbatim tag');
17940
    }
17941
  } else {
17942
    while (0 !== ch && !is_WS_OR_EOL(ch)) {
17943
17944
      if (0x21/* ! */ === ch) {
17945
        if (!isNamed) {
17946
          tagHandle = state.input.slice(_position - 1, state.position + 1);
17947
17948
          if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
17949
            throwError(state, 'named tag handle cannot contain such characters');
17950
          }
17951
17952
          isNamed = true;
17953
          _position = state.position + 1;
17954
        } else {
17955
          throwError(state, 'tag suffix cannot contain exclamation marks');
17956
        }
17957
      }
17958
17959
      ch = state.input.charCodeAt(++state.position);
17960
    }
17961
17962
    tagName = state.input.slice(_position, state.position);
17963
17964
    if (PATTERN_FLOW_INDICATORS.test(tagName)) {
17965
      throwError(state, 'tag suffix cannot contain flow indicator characters');
17966
    }
17967
  }
17968
17969
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
17970
    throwError(state, 'tag name cannot contain such characters: ' + tagName);
17971
  }
17972
17973
  if (isVerbatim) {
17974
    state.tag = tagName;
17975
17976
  } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
17977
    state.tag = state.tagMap[tagHandle] + tagName;
17978
17979
  } else if ('!' === tagHandle) {
17980
    state.tag = '!' + tagName;
17981
17982
  } else if ('!!' === tagHandle) {
17983
    state.tag = 'tag:yaml.org,2002:' + tagName;
17984
17985
  } else {
17986
    throwError(state, 'undeclared tag handle "' + tagHandle + '"');
17987
  }
17988
17989
  return true;
17990
}
17991
17992
function readAnchorProperty(state) {
17993
  var _position,
17994
      ch;
17995
17996
  ch = state.input.charCodeAt(state.position);
17997
17998
  if (0x26/* & */ !== ch) {
17999
    return false;
18000
  }
18001
18002
  if (null !== state.anchor) {
18003
    throwError(state, 'duplication of an anchor property');
18004
  }
18005
18006
  ch = state.input.charCodeAt(++state.position);
18007
  _position = state.position;
18008
18009
  while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
18010
    ch = state.input.charCodeAt(++state.position);
18011
  }
18012
18013
  if (state.position === _position) {
18014
    throwError(state, 'name of an anchor node must contain at least one character');
18015
  }
18016
18017
  state.anchor = state.input.slice(_position, state.position);
18018
  return true;
18019
}
18020
18021
function readAlias(state) {
18022
  var _position, alias,
18023
      len = state.length,
18024
      input = state.input,
18025
      ch;
18026
18027
  ch = state.input.charCodeAt(state.position);
18028
18029
  if (0x2A/* * */ !== ch) {
18030
    return false;
18031
  }
18032
18033
  ch = state.input.charCodeAt(++state.position);
18034
  _position = state.position;
18035
18036
  while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
18037
    ch = state.input.charCodeAt(++state.position);
18038
  }
18039
18040
  if (state.position === _position) {
18041
    throwError(state, 'name of an alias node must contain at least one character');
18042
  }
18043
18044
  alias = state.input.slice(_position, state.position);
18045
18046
  if (!state.anchorMap.hasOwnProperty(alias)) {
18047
    throwError(state, 'unidentified alias "' + alias + '"');
18048
  }
18049
18050
  state.result = state.anchorMap[alias];
18051
  skipSeparationSpace(state, true, -1);
18052
  return true;
18053
}
18054
18055
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
18056
  var allowBlockStyles,
18057
      allowBlockScalars,
18058
      allowBlockCollections,
18059
      indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
18060
      atNewLine  = false,
18061
      hasContent = false,
18062
      typeIndex,
18063
      typeQuantity,
18064
      type,
18065
      flowIndent,
18066
      blockIndent,
18067
      _result;
18068
18069
  state.tag    = null;
18070
  state.anchor = null;
18071
  state.kind   = null;
18072
  state.result = null;
18073
18074
  allowBlockStyles = allowBlockScalars = allowBlockCollections =
18075
    CONTEXT_BLOCK_OUT === nodeContext ||
18076
    CONTEXT_BLOCK_IN  === nodeContext;
18077
18078
  if (allowToSeek) {
18079
    if (skipSeparationSpace(state, true, -1)) {
18080
      atNewLine = true;
18081
18082
      if (state.lineIndent > parentIndent) {
18083
        indentStatus = 1;
18084
      } else if (state.lineIndent === parentIndent) {
18085
        indentStatus = 0;
18086
      } else if (state.lineIndent < parentIndent) {
18087
        indentStatus = -1;
18088
      }
18089
    }
18090
  }
18091
18092
  if (1 === indentStatus) {
18093
    while (readTagProperty(state) || readAnchorProperty(state)) {
18094
      if (skipSeparationSpace(state, true, -1)) {
18095
        atNewLine = true;
18096
        allowBlockCollections = allowBlockStyles;
18097
18098
        if (state.lineIndent > parentIndent) {
18099
          indentStatus = 1;
18100
        } else if (state.lineIndent === parentIndent) {
18101
          indentStatus = 0;
18102
        } else if (state.lineIndent < parentIndent) {
18103
          indentStatus = -1;
18104
        }
18105
      } else {
18106
        allowBlockCollections = false;
18107
      }
18108
    }
18109
  }
18110
18111
  if (allowBlockCollections) {
18112
    allowBlockCollections = atNewLine || allowCompact;
18113
  }
18114
18115
  if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
18116
    if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
18117
      flowIndent = parentIndent;
18118
    } else {
18119
      flowIndent = parentIndent + 1;
18120
    }
18121
18122
    blockIndent = state.position - state.lineStart;
18123
18124
    if (1 === indentStatus) {
18125
      if (allowBlockCollections &&
18126
          (readBlockSequence(state, blockIndent) ||
18127
           readBlockMapping(state, blockIndent, flowIndent)) ||
18128
          readFlowCollection(state, flowIndent)) {
18129
        hasContent = true;
18130
      } else {
18131
        if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
18132
            readSingleQuotedScalar(state, flowIndent) ||
18133
            readDoubleQuotedScalar(state, flowIndent)) {
18134
          hasContent = true;
18135
18136
        } else if (readAlias(state)) {
18137
          hasContent = true;
18138
18139
          if (null !== state.tag || null !== state.anchor) {
18140
            throwError(state, 'alias node should not have any properties');
18141
          }
18142
18143
        } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
18144
          hasContent = true;
18145
18146
          if (null === state.tag) {
18147
            state.tag = '?';
18148
          }
18149
        }
18150
18151
        if (null !== state.anchor) {
18152
          state.anchorMap[state.anchor] = state.result;
18153
        }
18154
      }
18155
    } else if (0 === indentStatus) {
18156
      // Special case: block sequences are allowed to have same indentation level as the parent.
18157
      // http://www.yaml.org/spec/1.2/spec.html#id2799784
18158
      hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
18159
    }
18160
  }
18161
18162
  if (null !== state.tag && '!' !== state.tag) {
18163
    if ('?' === state.tag) {
18164
      for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
18165
           typeIndex < typeQuantity;
18166
           typeIndex += 1) {
18167
        type = state.implicitTypes[typeIndex];
18168
18169
        // Implicit resolving is not allowed for non-scalar types, and '?'
18170
        // non-specific tag is only assigned to plain scalars. So, it isn't
18171
        // needed to check for 'kind' conformity.
18172
18173
        if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
18174
          state.result = type.construct(state.result);
18175
          state.tag = type.tag;
18176
          if (null !== state.anchor) {
18177
            state.anchorMap[state.anchor] = state.result;
18178
          }
18179
          break;
18180
        }
18181
      }
18182
    } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
18183
      type = state.typeMap[state.tag];
18184
18185
      if (null !== state.result && type.kind !== state.kind) {
18186
        throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
18187
      }
18188
18189
      if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
18190
        throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
18191
      } else {
18192
        state.result = type.construct(state.result);
18193
        if (null !== state.anchor) {
18194
          state.anchorMap[state.anchor] = state.result;
18195
        }
18196
      }
18197
    } else {
18198
      throwWarning(state, 'unknown tag !<' + state.tag + '>');
18199
    }
18200
  }
18201
18202
  return null !== state.tag || null !== state.anchor || hasContent;
18203
}
18204
18205
function readDocument(state) {
18206
  var documentStart = state.position,
18207
      _position,
18208
      directiveName,
18209
      directiveArgs,
18210
      hasDirectives = false,
18211
      ch;
18212
18213
  state.version = null;
18214
  state.checkLineBreaks = state.legacy;
18215
  state.tagMap = {};
18216
  state.anchorMap = {};
18217
18218
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
18219
    skipSeparationSpace(state, true, -1);
18220
18221
    ch = state.input.charCodeAt(state.position);
18222
18223
    if (state.lineIndent > 0 || 0x25/* % */ !== ch) {
18224
      break;
18225
    }
18226
18227
    hasDirectives = true;
18228
    ch = state.input.charCodeAt(++state.position);
18229
    _position = state.position;
18230
18231
    while (0 !== ch && !is_WS_OR_EOL(ch)) {
18232
      ch = state.input.charCodeAt(++state.position);
18233
    }
18234
18235
    directiveName = state.input.slice(_position, state.position);
18236
    directiveArgs = [];
18237
18238
    if (directiveName.length < 1) {
18239
      throwError(state, 'directive name must not be less than one character in length');
18240
    }
18241
18242
    while (0 !== ch) {
18243
      while (is_WHITE_SPACE(ch)) {
18244
        ch = state.input.charCodeAt(++state.position);
18245
      }
18246
18247
      if (0x23/* # */ === ch) {
18248
        do { ch = state.input.charCodeAt(++state.position); }
18249
        while (0 !== ch && !is_EOL(ch));
18250
        break;
18251
      }
18252
18253
      if (is_EOL(ch)) {
18254
        break;
18255
      }
18256
18257
      _position = state.position;
18258
18259
      while (0 !== ch && !is_WS_OR_EOL(ch)) {
18260
        ch = state.input.charCodeAt(++state.position);
18261
      }
18262
18263
      directiveArgs.push(state.input.slice(_position, state.position));
18264
    }
18265
18266
    if (0 !== ch) {
18267
      readLineBreak(state);
18268
    }
18269
18270
    if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
18271
      directiveHandlers[directiveName](state, directiveName, directiveArgs);
18272
    } else {
18273
      throwWarning(state, 'unknown document directive "' + directiveName + '"');
18274
    }
18275
  }
18276
18277
  skipSeparationSpace(state, true, -1);
18278
18279
  if (0 === state.lineIndent &&
18280
      0x2D/* - */ === state.input.charCodeAt(state.position) &&
18281
      0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&
18282
      0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {
18283
    state.position += 3;
18284
    skipSeparationSpace(state, true, -1);
18285
18286
  } else if (hasDirectives) {
18287
    throwError(state, 'directives end mark is expected');
18288
  }
18289
18290
  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
18291
  skipSeparationSpace(state, true, -1);
18292
18293
  if (state.checkLineBreaks &&
18294
      PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
18295
    throwWarning(state, 'non-ASCII line breaks are interpreted as content');
18296
  }
18297
18298
  state.documents.push(state.result);
18299
18300
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
18301
18302
    if (0x2E/* . */ === state.input.charCodeAt(state.position)) {
18303
      state.position += 3;
18304
      skipSeparationSpace(state, true, -1);
18305
    }
18306
    return;
18307
  }
18308
18309
  if (state.position < (state.length - 1)) {
18310
    throwError(state, 'end of the stream or a document separator is expected');
18311
  } else {
18312
    return;
18313
  }
18314
}
18315
18316
18317
function loadDocuments(input, options) {
18318
  input = String(input);
18319
  options = options || {};
18320
18321
  if (input.length !== 0) {
18322
18323
    // Add tailing `\n` if not exists
18324
    if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
18325
        0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
18326
      input += '\n';
18327
    }
18328
18329
    // Strip BOM
18330
    if (input.charCodeAt(0) === 0xFEFF) {
18331
      input = input.slice(1);
18332
    }
18333
  }
18334
18335
  var state = new State(input, options);
18336
18337
  if (PATTERN_NON_PRINTABLE.test(state.input)) {
18338
    throwError(state, 'the stream contains non-printable characters');
18339
  }
18340
18341
  // Use 0 as string terminator. That significantly simplifies bounds check.
18342
  state.input += '\0';
18343
18344
  while (0x20/* Space */ === state.input.charCodeAt(state.position)) {
18345
    state.lineIndent += 1;
18346
    state.position += 1;
18347
  }
18348
18349
  while (state.position < (state.length - 1)) {
18350
    readDocument(state);
18351
  }
18352
18353
  return state.documents;
18354
}
18355
18356
18357
function loadAll(input, iterator, options) {
18358
  var documents = loadDocuments(input, options), index, length;
18359
18360
  for (index = 0, length = documents.length; index < length; index += 1) {
18361
    iterator(documents[index]);
18362
  }
18363
}
18364
18365
18366
function load(input, options) {
18367
  var documents = loadDocuments(input, options), index, length;
18368
18369
  if (0 === documents.length) {
18370
    /*eslint-disable no-undefined*/
18371
    return undefined;
18372
  } else if (1 === documents.length) {
18373
    return documents[0];
18374
  }
18375
  throw new YAMLException('expected a single document in the stream, but found more');
18376
}
18377
18378
18379
function safeLoadAll(input, output, options) {
18380
  loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
18381
}
18382
18383
18384
function safeLoad(input, options) {
18385
  return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
18386
}
18387
18388
18389
module.exports.loadAll     = loadAll;
18390
module.exports.load        = load;
18391
module.exports.safeLoadAll = safeLoadAll;
18392
module.exports.safeLoad    = safeLoad;
18393
18394
},{"./common":23,"./exception":25,"./mark":27,"./schema/default_full":30,"./schema/default_safe":31}],27:[function(require,module,exports){
18395
'use strict';
18396
18397
18398
var common = require('./common');
18399
18400
18401
function Mark(name, buffer, position, line, column) {
18402
  this.name     = name;
18403
  this.buffer   = buffer;
18404
  this.position = position;
18405
  this.line     = line;
18406
  this.column   = column;
18407
}
18408
18409
18410
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
18411
  var head, start, tail, end, snippet;
18412
18413
  if (!this.buffer) {
18414
    return null;
18415
  }
18416
18417
  indent = indent || 4;
18418
  maxLength = maxLength || 75;
18419
18420
  head = '';
18421
  start = this.position;
18422
18423
  while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
18424
    start -= 1;
18425
    if (this.position - start > (maxLength / 2 - 1)) {
18426
      head = ' ... ';
18427
      start += 5;
18428
      break;
18429
    }
18430
  }
18431
18432
  tail = '';
18433
  end = this.position;
18434
18435
  while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
18436
    end += 1;
18437
    if (end - this.position > (maxLength / 2 - 1)) {
18438
      tail = ' ... ';
18439
      end -= 5;
18440
      break;
18441
    }
18442
  }
18443
18444
  snippet = this.buffer.slice(start, end);
18445
18446
  return common.repeat(' ', indent) + head + snippet + tail + '\n' +
18447
         common.repeat(' ', indent + this.position - start + head.length) + '^';
18448
};
18449
18450
18451
Mark.prototype.toString = function toString(compact) {
18452
  var snippet, where = '';
18453
18454
  if (this.name) {
18455
    where += 'in "' + this.name + '" ';
18456
  }
18457
18458
  where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
18459
18460
  if (!compact) {
18461
    snippet = this.getSnippet();
18462
18463
    if (snippet) {
18464
      where += ':\n' + snippet;
18465
    }
18466
  }
18467
18468
  return where;
18469
};
18470
18471
18472
module.exports = Mark;
18473
18474
},{"./common":23}],28:[function(require,module,exports){
18475
'use strict';
18476
18477
/*eslint-disable max-len*/
18478
18479
var common        = require('./common');
18480
var YAMLException = require('./exception');
18481
var Type          = require('./type');
18482
18483
18484
function compileList(schema, name, result) {
18485
  var exclude = [];
18486
18487
  schema.include.forEach(function (includedSchema) {
18488
    result = compileList(includedSchema, name, result);
18489
  });
18490
18491
  schema[name].forEach(function (currentType) {
18492
    result.forEach(function (previousType, previousIndex) {
18493
      if (previousType.tag === currentType.tag) {
18494
        exclude.push(previousIndex);
18495
      }
18496
    });
18497
18498
    result.push(currentType);
18499
  });
18500
18501
  return result.filter(function (type, index) {
18502
    return -1 === exclude.indexOf(index);
18503
  });
18504
}
18505
18506
18507
function compileMap(/* lists... */) {
18508
  var result = {}, index, length;
18509
18510
  function collectType(type) {
18511
    result[type.tag] = type;
18512
  }
18513
18514
  for (index = 0, length = arguments.length; index < length; index += 1) {
18515
    arguments[index].forEach(collectType);
18516
  }
18517
18518
  return result;
18519
}
18520
18521
18522
function Schema(definition) {
18523
  this.include  = definition.include  || [];
18524
  this.implicit = definition.implicit || [];
18525
  this.explicit = definition.explicit || [];
18526
18527
  this.implicit.forEach(function (type) {
18528
    if (type.loadKind && 'scalar' !== type.loadKind) {
18529
      throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
18530
    }
18531
  });
18532
18533
  this.compiledImplicit = compileList(this, 'implicit', []);
18534
  this.compiledExplicit = compileList(this, 'explicit', []);
18535
  this.compiledTypeMap  = compileMap(this.compiledImplicit, this.compiledExplicit);
18536
}
18537
18538
18539
Schema.DEFAULT = null;
18540
18541
18542
Schema.create = function createSchema() {
18543
  var schemas, types;
18544
18545
  switch (arguments.length) {
18546
  case 1:
18547
    schemas = Schema.DEFAULT;
18548
    types = arguments[0];
18549
    break;
18550
18551
  case 2:
18552
    schemas = arguments[0];
18553
    types = arguments[1];
18554
    break;
18555
18556
  default:
18557
    throw new YAMLException('Wrong number of arguments for Schema.create function');
18558
  }
18559
18560
  schemas = common.toArray(schemas);
18561
  types = common.toArray(types);
18562
18563
  if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
18564
    throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
18565
  }
18566
18567
  if (!types.every(function (type) { return type instanceof Type; })) {
18568
    throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
18569
  }
18570
18571
  return new Schema({
18572
    include: schemas,
18573
    explicit: types
18574
  });
18575
};
18576
18577
18578
module.exports = Schema;
18579
18580
},{"./common":23,"./exception":25,"./type":34}],29:[function(require,module,exports){
18581
// Standard YAML's Core schema.
18582
// http://www.yaml.org/spec/1.2/spec.html#id2804923
18583
//
18584
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
18585
// So, Core schema has no distinctions from JSON schema is JS-YAML.
18586
18587
18588
'use strict';
18589
18590
18591
var Schema = require('../schema');
18592
18593
18594
module.exports = new Schema({
18595
  include: [
18596
    require('./json')
18597
  ]
18598
});
18599
18600
},{"../schema":28,"./json":33}],30:[function(require,module,exports){
18601
// JS-YAML's default schema for `load` function.
18602
// It is not described in the YAML specification.
18603
//
18604
// This schema is based on JS-YAML's default safe schema and includes
18605
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
18606
//
18607
// Also this schema is used as default base schema at `Schema.create` function.
18608
18609
18610
'use strict';
18611
18612
18613
var Schema = require('../schema');
18614
18615
18616
module.exports = Schema.DEFAULT = new Schema({
18617
  include: [
18618
    require('./default_safe')
18619
  ],
18620
  explicit: [
18621
    require('../type/js/undefined'),
18622
    require('../type/js/regexp'),
18623
    require('../type/js/function')
18624
  ]
18625
});
18626
18627
},{"../schema":28,"../type/js/function":39,"../type/js/regexp":40,"../type/js/undefined":41,"./default_safe":31}],31:[function(require,module,exports){
18628
// JS-YAML's default schema for `safeLoad` function.
18629
// It is not described in the YAML specification.
18630
//
18631
// This schema is based on standard YAML's Core schema and includes most of
18632
// extra types described at YAML tag repository. (http://yaml.org/type/)
18633
18634
18635
'use strict';
18636
18637
18638
var Schema = require('../schema');
18639
18640
18641
module.exports = new Schema({
18642
  include: [
18643
    require('./core')
18644
  ],
18645
  implicit: [
18646
    require('../type/timestamp'),
18647
    require('../type/merge')
18648
  ],
18649
  explicit: [
18650
    require('../type/binary'),
18651
    require('../type/omap'),
18652
    require('../type/pairs'),
18653
    require('../type/set')
18654
  ]
18655
});
18656
18657
},{"../schema":28,"../type/binary":35,"../type/merge":43,"../type/omap":45,"../type/pairs":46,"../type/set":48,"../type/timestamp":50,"./core":29}],32:[function(require,module,exports){
18658
// Standard YAML's Failsafe schema.
18659
// http://www.yaml.org/spec/1.2/spec.html#id2802346
18660
18661
18662
'use strict';
18663
18664
18665
var Schema = require('../schema');
18666
18667
18668
module.exports = new Schema({
18669
  explicit: [
18670
    require('../type/str'),
18671
    require('../type/seq'),
18672
    require('../type/map')
18673
  ]
18674
});
18675
18676
},{"../schema":28,"../type/map":42,"../type/seq":47,"../type/str":49}],33:[function(require,module,exports){
18677
// Standard YAML's JSON schema.
18678
// http://www.yaml.org/spec/1.2/spec.html#id2803231
18679
//
18680
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
18681
// So, this schema is not such strict as defined in the YAML specification.
18682
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
18683
18684
18685
'use strict';
18686
18687
18688
var Schema = require('../schema');
18689
18690
18691
module.exports = new Schema({
18692
  include: [
18693
    require('./failsafe')
18694
  ],
18695
  implicit: [
18696
    require('../type/null'),
18697
    require('../type/bool'),
18698
    require('../type/int'),
18699
    require('../type/float')
18700
  ]
18701
});
18702
18703
},{"../schema":28,"../type/bool":36,"../type/float":37,"../type/int":38,"../type/null":44,"./failsafe":32}],34:[function(require,module,exports){
18704
'use strict';
18705
18706
var YAMLException = require('./exception');
18707
18708
var TYPE_CONSTRUCTOR_OPTIONS = [
18709
  'kind',
18710
  'resolve',
18711
  'construct',
18712
  'instanceOf',
18713
  'predicate',
18714
  'represent',
18715
  'defaultStyle',
18716
  'styleAliases'
18717
];
18718
18719
var YAML_NODE_KINDS = [
18720
  'scalar',
18721
  'sequence',
18722
  'mapping'
18723
];
18724
18725
function compileStyleAliases(map) {
18726
  var result = {};
18727
18728
  if (null !== map) {
18729
    Object.keys(map).forEach(function (style) {
18730
      map[style].forEach(function (alias) {
18731
        result[String(alias)] = style;
18732
      });
18733
    });
18734
  }
18735
18736
  return result;
18737
}
18738
18739
function Type(tag, options) {
18740
  options = options || {};
18741
18742
  Object.keys(options).forEach(function (name) {
18743
    if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
18744
      throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
18745
    }
18746
  });
18747
18748
  // TODO: Add tag format check.
18749
  this.tag          = tag;
18750
  this.kind         = options['kind']         || null;
18751
  this.resolve      = options['resolve']      || function () { return true; };
18752
  this.construct    = options['construct']    || function (data) { return data; };
18753
  this.instanceOf   = options['instanceOf']   || null;
18754
  this.predicate    = options['predicate']    || null;
18755
  this.represent    = options['represent']    || null;
18756
  this.defaultStyle = options['defaultStyle'] || null;
18757
  this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
18758
18759
  if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
18760
    throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
18761
  }
18762
}
18763
18764
module.exports = Type;
18765
18766
},{"./exception":25}],35:[function(require,module,exports){
18767
'use strict';
18768
18769
/*eslint-disable no-bitwise*/
18770
18771
// A trick for browserified version.
18772
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
18773
var NodeBuffer = require('buffer').Buffer;
18774
var Type       = require('../type');
18775
18776
18777
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
18778
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
18779
18780
18781
function resolveYamlBinary(data) {
18782
  if (null === data) {
18783
    return false;
18784
  }
18785
18786
  var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP;
18787
18788
  // Convert one by one.
18789
  for (idx = 0; idx < max; idx++) {
18790
    code = map.indexOf(data.charAt(idx));
18791
18792
    // Skip CR/LF
18793
    if (code > 64) { continue; }
18794
18795
    // Fail on illegal characters
18796
    if (code < 0) { return false; }
18797
18798
    bitlen += 6;
18799
  }
18800
18801
  // If there are any bits left, source was corrupted
18802
  return (bitlen % 8) === 0;
18803
}
18804
18805
function constructYamlBinary(data) {
18806
  var code, idx, tailbits,
18807
      input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
18808
      max = input.length,
18809
      map = BASE64_MAP,
18810
      bits = 0,
18811
      result = [];
18812
18813
  // Collect by 6*4 bits (3 bytes)
18814
18815
  for (idx = 0; idx < max; idx++) {
18816
    if ((idx % 4 === 0) && idx) {
18817
      result.push((bits >> 16) & 0xFF);
18818
      result.push((bits >> 8) & 0xFF);
18819
      result.push(bits & 0xFF);
18820
    }
18821
18822
    bits = (bits << 6) | map.indexOf(input.charAt(idx));
18823
  }
18824
18825
  // Dump tail
18826
18827
  tailbits = (max % 4) * 6;
18828
18829
  if (tailbits === 0) {
18830
    result.push((bits >> 16) & 0xFF);
18831
    result.push((bits >> 8) & 0xFF);
18832
    result.push(bits & 0xFF);
18833
  } else if (tailbits === 18) {
18834
    result.push((bits >> 10) & 0xFF);
18835
    result.push((bits >> 2) & 0xFF);
18836
  } else if (tailbits === 12) {
18837
    result.push((bits >> 4) & 0xFF);
18838
  }
18839
18840
  // Wrap into Buffer for NodeJS and leave Array for browser
18841
  if (NodeBuffer) {
18842
    return new NodeBuffer(result);
18843
  }
18844
18845
  return result;
18846
}
18847
18848
function representYamlBinary(object /*, style*/) {
18849
  var result = '', bits = 0, idx, tail,
18850
      max = object.length,
18851
      map = BASE64_MAP;
18852
18853
  // Convert every three bytes to 4 ASCII characters.
18854
18855
  for (idx = 0; idx < max; idx++) {
18856
    if ((idx % 3 === 0) && idx) {
18857
      result += map[(bits >> 18) & 0x3F];
18858
      result += map[(bits >> 12) & 0x3F];
18859
      result += map[(bits >> 6) & 0x3F];
18860
      result += map[bits & 0x3F];
18861
    }
18862
18863
    bits = (bits << 8) + object[idx];
18864
  }
18865
18866
  // Dump tail
18867
18868
  tail = max % 3;
18869
18870
  if (tail === 0) {
18871
    result += map[(bits >> 18) & 0x3F];
18872
    result += map[(bits >> 12) & 0x3F];
18873
    result += map[(bits >> 6) & 0x3F];
18874
    result += map[bits & 0x3F];
18875
  } else if (tail === 2) {
18876
    result += map[(bits >> 10) & 0x3F];
18877
    result += map[(bits >> 4) & 0x3F];
18878
    result += map[(bits << 2) & 0x3F];
18879
    result += map[64];
18880
  } else if (tail === 1) {
18881
    result += map[(bits >> 2) & 0x3F];
18882
    result += map[(bits << 4) & 0x3F];
18883
    result += map[64];
18884
    result += map[64];
18885
  }
18886
18887
  return result;
18888
}
18889
18890
function isBinary(object) {
18891
  return NodeBuffer && NodeBuffer.isBuffer(object);
18892
}
18893
18894
module.exports = new Type('tag:yaml.org,2002:binary', {
18895
  kind: 'scalar',
18896
  resolve: resolveYamlBinary,
18897
  construct: constructYamlBinary,
18898
  predicate: isBinary,
18899
  represent: representYamlBinary
18900
});
18901
18902
},{"../type":34,"buffer":12}],36:[function(require,module,exports){
18903
'use strict';
18904
18905
var Type = require('../type');
18906
18907
function resolveYamlBoolean(data) {
18908
  if (null === data) {
18909
    return false;
18910
  }
18911
18912
  var max = data.length;
18913
18914
  return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
18915
         (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
18916
}
18917
18918
function constructYamlBoolean(data) {
18919
  return data === 'true' ||
18920
         data === 'True' ||
18921
         data === 'TRUE';
18922
}
18923
18924
function isBoolean(object) {
18925
  return '[object Boolean]' === Object.prototype.toString.call(object);
18926
}
18927
18928
module.exports = new Type('tag:yaml.org,2002:bool', {
18929
  kind: 'scalar',
18930
  resolve: resolveYamlBoolean,
18931
  construct: constructYamlBoolean,
18932
  predicate: isBoolean,
18933
  represent: {
18934
    lowercase: function (object) { return object ? 'true' : 'false'; },
18935
    uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
18936
    camelcase: function (object) { return object ? 'True' : 'False'; }
18937
  },
18938
  defaultStyle: 'lowercase'
18939
});
18940
18941
},{"../type":34}],37:[function(require,module,exports){
18942
'use strict';
18943
18944
var common = require('../common');
18945
var Type   = require('../type');
18946
18947
var YAML_FLOAT_PATTERN = new RegExp(
18948
  '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
18949
  '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
18950
  '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
18951
  '|[-+]?\\.(?:inf|Inf|INF)' +
18952
  '|\\.(?:nan|NaN|NAN))$');
18953
18954
function resolveYamlFloat(data) {
18955
  if (null === data) {
18956
    return false;
18957
  }
18958
18959
  var value, sign, base, digits;
18960
18961
  if (!YAML_FLOAT_PATTERN.test(data)) {
18962
    return false;
18963
  }
18964
  return true;
18965
}
18966
18967
function constructYamlFloat(data) {
18968
  var value, sign, base, digits;
18969
18970
  value  = data.replace(/_/g, '').toLowerCase();
18971
  sign   = '-' === value[0] ? -1 : 1;
18972
  digits = [];
18973
18974
  if (0 <= '+-'.indexOf(value[0])) {
18975
    value = value.slice(1);
18976
  }
18977
18978
  if ('.inf' === value) {
18979
    return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
18980
18981
  } else if ('.nan' === value) {
18982
    return NaN;
18983
18984
  } else if (0 <= value.indexOf(':')) {
18985
    value.split(':').forEach(function (v) {
18986
      digits.unshift(parseFloat(v, 10));
18987
    });
18988
18989
    value = 0.0;
18990
    base = 1;
18991
18992
    digits.forEach(function (d) {
18993
      value += d * base;
18994
      base *= 60;
18995
    });
18996
18997
    return sign * value;
18998
18999
  }
19000
  return sign * parseFloat(value, 10);
19001
}
19002
19003
function representYamlFloat(object, style) {
19004
  if (isNaN(object)) {
19005
    switch (style) {
19006
    case 'lowercase':
19007
      return '.nan';
19008
    case 'uppercase':
19009
      return '.NAN';
19010
    case 'camelcase':
19011
      return '.NaN';
19012
    }
19013
  } else if (Number.POSITIVE_INFINITY === object) {
19014
    switch (style) {
19015
    case 'lowercase':
19016
      return '.inf';
19017
    case 'uppercase':
19018
      return '.INF';
19019
    case 'camelcase':
19020
      return '.Inf';
19021
    }
19022
  } else if (Number.NEGATIVE_INFINITY === object) {
19023
    switch (style) {
19024
    case 'lowercase':
19025
      return '-.inf';
19026
    case 'uppercase':
19027
      return '-.INF';
19028
    case 'camelcase':
19029
      return '-.Inf';
19030
    }
19031
  } else if (common.isNegativeZero(object)) {
19032
    return '-0.0';
19033
  }
19034
  return object.toString(10);
19035
}
19036
19037
function isFloat(object) {
19038
  return ('[object Number]' === Object.prototype.toString.call(object)) &&
19039
         (0 !== object % 1 || common.isNegativeZero(object));
19040
}
19041
19042
module.exports = new Type('tag:yaml.org,2002:float', {
19043
  kind: 'scalar',
19044
  resolve: resolveYamlFloat,
19045
  construct: constructYamlFloat,
19046
  predicate: isFloat,
19047
  represent: representYamlFloat,
19048
  defaultStyle: 'lowercase'
19049
});
19050
19051
},{"../common":23,"../type":34}],38:[function(require,module,exports){
19052
'use strict';
19053
19054
var common = require('../common');
19055
var Type   = require('../type');
19056
19057
function isHexCode(c) {
19058
  return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
19059
         ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
19060
         ((0x61/* a */ <= c) && (c <= 0x66/* f */));
19061
}
19062
19063
function isOctCode(c) {
19064
  return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
19065
}
19066
19067
function isDecCode(c) {
19068
  return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
19069
}
19070
19071
function resolveYamlInteger(data) {
19072
  if (null === data) {
19073
    return false;
19074
  }
19075
19076
  var max = data.length,
19077
      index = 0,
19078
      hasDigits = false,
19079
      ch;
19080
19081
  if (!max) { return false; }
19082
19083
  ch = data[index];
19084
19085
  // sign
19086
  if (ch === '-' || ch === '+') {
19087
    ch = data[++index];
19088
  }
19089
19090
  if (ch === '0') {
19091
    // 0
19092
    if (index + 1 === max) { return true; }
19093
    ch = data[++index];
19094
19095
    // base 2, base 8, base 16
19096
19097
    if (ch === 'b') {
19098
      // base 2
19099
      index++;
19100
19101
      for (; index < max; index++) {
19102
        ch = data[index];
19103
        if (ch === '_') { continue; }
19104
        if (ch !== '0' && ch !== '1') {
19105
          return false;
19106
        }
19107
        hasDigits = true;
19108
      }
19109
      return hasDigits;
19110
    }
19111
19112
19113
    if (ch === 'x') {
19114
      // base 16
19115
      index++;
19116
19117
      for (; index < max; index++) {
19118
        ch = data[index];
19119
        if (ch === '_') { continue; }
19120
        if (!isHexCode(data.charCodeAt(index))) {
19121
          return false;
19122
        }
19123
        hasDigits = true;
19124
      }
19125
      return hasDigits;
19126
    }
19127
19128
    // base 8
19129
    for (; index < max; index++) {
19130
      ch = data[index];
19131
      if (ch === '_') { continue; }
19132
      if (!isOctCode(data.charCodeAt(index))) {
19133
        return false;
19134
      }
19135
      hasDigits = true;
19136
    }
19137
    return hasDigits;
19138
  }
19139
19140
  // base 10 (except 0) or base 60
19141
19142
  for (; index < max; index++) {
19143
    ch = data[index];
19144
    if (ch === '_') { continue; }
19145
    if (ch === ':') { break; }
19146
    if (!isDecCode(data.charCodeAt(index))) {
19147
      return false;
19148
    }
19149
    hasDigits = true;
19150
  }
19151
19152
  if (!hasDigits) { return false; }
19153
19154
  // if !base60 - done;
19155
  if (ch !== ':') { return true; }
19156
19157
  // base60 almost not used, no needs to optimize
19158
  return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
19159
}
19160
19161
function constructYamlInteger(data) {
19162
  var value = data, sign = 1, ch, base, digits = [];
19163
19164
  if (value.indexOf('_') !== -1) {
19165
    value = value.replace(/_/g, '');
19166
  }
19167
19168
  ch = value[0];
19169
19170
  if (ch === '-' || ch === '+') {
19171
    if (ch === '-') { sign = -1; }
19172
    value = value.slice(1);
19173
    ch = value[0];
19174
  }
19175
19176
  if ('0' === value) {
19177
    return 0;
19178
  }
19179
19180
  if (ch === '0') {
19181
    if (value[1] === 'b') {
19182
      return sign * parseInt(value.slice(2), 2);
19183
    }
19184
    if (value[1] === 'x') {
19185
      return sign * parseInt(value, 16);
19186
    }
19187
    return sign * parseInt(value, 8);
19188
19189
  }
19190
19191
  if (value.indexOf(':') !== -1) {
19192
    value.split(':').forEach(function (v) {
19193
      digits.unshift(parseInt(v, 10));
19194
    });
19195
19196
    value = 0;
19197
    base = 1;
19198
19199
    digits.forEach(function (d) {
19200
      value += (d * base);
19201
      base *= 60;
19202
    });
19203
19204
    return sign * value;
19205
19206
  }
19207
19208
  return sign * parseInt(value, 10);
19209
}
19210
19211
function isInteger(object) {
19212
  return ('[object Number]' === Object.prototype.toString.call(object)) &&
19213
         (0 === object % 1 && !common.isNegativeZero(object));
19214
}
19215
19216
module.exports = new Type('tag:yaml.org,2002:int', {
19217
  kind: 'scalar',
19218
  resolve: resolveYamlInteger,
19219
  construct: constructYamlInteger,
19220
  predicate: isInteger,
19221
  represent: {
19222
    binary:      function (object) { return '0b' + object.toString(2); },
19223
    octal:       function (object) { return '0'  + object.toString(8); },
19224
    decimal:     function (object) { return        object.toString(10); },
19225
    hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
19226
  },
19227
  defaultStyle: 'decimal',
19228
  styleAliases: {
19229
    binary:      [ 2,  'bin' ],
19230
    octal:       [ 8,  'oct' ],
19231
    decimal:     [ 10, 'dec' ],
19232
    hexadecimal: [ 16, 'hex' ]
19233
  }
19234
});
19235
19236
},{"../common":23,"../type":34}],39:[function(require,module,exports){
19237
'use strict';
19238
19239
var esprima;
19240
19241
// Browserified version does not have esprima
19242
//
19243
// 1. For node.js just require module as deps
19244
// 2. For browser try to require mudule via external AMD system.
19245
//    If not found - try to fallback to window.esprima. If not
19246
//    found too - then fail to parse.
19247
//
19248
try {
19249
  esprima = require('esprima');
19250
} catch (_) {
19251
  /*global window */
19252
  if (typeof window !== 'undefined') { esprima = window.esprima; }
19253
}
19254
19255
var Type = require('../../type');
19256
19257
function resolveJavascriptFunction(data) {
19258
  if (null === data) {
19259
    return false;
19260
  }
19261
19262
  try {
19263
    var source = '(' + data + ')',
19264
        ast    = esprima.parse(source, { range: true }),
19265
        params = [],
19266
        body;
19267
19268
    if ('Program'             !== ast.type         ||
19269
        1                     !== ast.body.length  ||
19270
        'ExpressionStatement' !== ast.body[0].type ||
19271
        'FunctionExpression'  !== ast.body[0].expression.type) {
19272
      return false;
19273
    }
19274
19275
    return true;
19276
  } catch (err) {
19277
    return false;
19278
  }
19279
}
19280
19281
function constructJavascriptFunction(data) {
19282
  /*jslint evil:true*/
19283
19284
  var source = '(' + data + ')',
19285
      ast    = esprima.parse(source, { range: true }),
19286
      params = [],
19287
      body;
19288
19289
  if ('Program'             !== ast.type         ||
19290
      1                     !== ast.body.length  ||
19291
      'ExpressionStatement' !== ast.body[0].type ||
19292
      'FunctionExpression'  !== ast.body[0].expression.type) {
19293
    throw new Error('Failed to resolve function');
19294
  }
19295
19296
  ast.body[0].expression.params.forEach(function (param) {
19297
    params.push(param.name);
19298
  });
19299
19300
  body = ast.body[0].expression.body.range;
19301
19302
  // Esprima's ranges include the first '{' and the last '}' characters on
19303
  // function expressions. So cut them out.
19304
  /*eslint-disable no-new-func*/
19305
  return new Function(params, source.slice(body[0] + 1, body[1] - 1));
19306
}
19307
19308
function representJavascriptFunction(object /*, style*/) {
19309
  return object.toString();
19310
}
19311
19312
function isFunction(object) {
19313
  return '[object Function]' === Object.prototype.toString.call(object);
19314
}
19315
19316
module.exports = new Type('tag:yaml.org,2002:js/function', {
19317
  kind: 'scalar',
19318
  resolve: resolveJavascriptFunction,
19319
  construct: constructJavascriptFunction,
19320
  predicate: isFunction,
19321
  represent: representJavascriptFunction
19322
});
19323
19324
},{"../../type":34,"esprima":51}],40:[function(require,module,exports){
19325
'use strict';
19326
19327
var Type = require('../../type');
19328
19329
function resolveJavascriptRegExp(data) {
19330
  if (null === data) {
19331
    return false;
19332
  }
19333
19334
  if (0 === data.length) {
19335
    return false;
19336
  }
19337
19338
  var regexp = data,
19339
      tail   = /\/([gim]*)$/.exec(data),
19340
      modifiers = '';
19341
19342
  // if regexp starts with '/' it can have modifiers and must be properly closed
19343
  // `/foo/gim` - modifiers tail can be maximum 3 chars
19344
  if ('/' === regexp[0]) {
19345
    if (tail) {
19346
      modifiers = tail[1];
19347
    }
19348
19349
    if (modifiers.length > 3) { return false; }
19350
    // if expression starts with /, is should be properly terminated
19351
    if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
19352
19353
    regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
19354
  }
19355
19356
  try {
19357
    var dummy = new RegExp(regexp, modifiers);
19358
    return true;
19359
  } catch (error) {
19360
    return false;
19361
  }
19362
}
19363
19364
function constructJavascriptRegExp(data) {
19365
  var regexp = data,
19366
      tail   = /\/([gim]*)$/.exec(data),
19367
      modifiers = '';
19368
19369
  // `/foo/gim` - tail can be maximum 4 chars
19370
  if ('/' === regexp[0]) {
19371
    if (tail) {
19372
      modifiers = tail[1];
19373
    }
19374
    regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
19375
  }
19376
19377
  return new RegExp(regexp, modifiers);
19378
}
19379
19380
function representJavascriptRegExp(object /*, style*/) {
19381
  var result = '/' + object.source + '/';
19382
19383
  if (object.global) {
19384
    result += 'g';
19385
  }
19386
19387
  if (object.multiline) {
19388
    result += 'm';
19389
  }
19390
19391
  if (object.ignoreCase) {
19392
    result += 'i';
19393
  }
19394
19395
  return result;
19396
}
19397
19398
function isRegExp(object) {
19399
  return '[object RegExp]' === Object.prototype.toString.call(object);
19400
}
19401
19402
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
19403
  kind: 'scalar',
19404
  resolve: resolveJavascriptRegExp,
19405
  construct: constructJavascriptRegExp,
19406
  predicate: isRegExp,
19407
  represent: representJavascriptRegExp
19408
});
19409
19410
},{"../../type":34}],41:[function(require,module,exports){
19411
'use strict';
19412
19413
var Type = require('../../type');
19414
19415
function resolveJavascriptUndefined() {
19416
  return true;
19417
}
19418
19419
function constructJavascriptUndefined() {
19420
  /*eslint-disable no-undefined*/
19421
  return undefined;
19422
}
19423
19424
function representJavascriptUndefined() {
19425
  return '';
19426
}
19427
19428
function isUndefined(object) {
19429
  return 'undefined' === typeof object;
19430
}
19431
19432
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
19433
  kind: 'scalar',
19434
  resolve: resolveJavascriptUndefined,
19435
  construct: constructJavascriptUndefined,
19436
  predicate: isUndefined,
19437
  represent: representJavascriptUndefined
19438
});
19439
19440
},{"../../type":34}],42:[function(require,module,exports){
19441
'use strict';
19442
19443
var Type = require('../type');
19444
19445
module.exports = new Type('tag:yaml.org,2002:map', {
19446
  kind: 'mapping',
19447
  construct: function (data) { return null !== data ? data : {}; }
19448
});
19449
19450
},{"../type":34}],43:[function(require,module,exports){
19451
'use strict';
19452
19453
var Type = require('../type');
19454
19455
function resolveYamlMerge(data) {
19456
  return '<<' === data || null === data;
19457
}
19458
19459
module.exports = new Type('tag:yaml.org,2002:merge', {
19460
  kind: 'scalar',
19461
  resolve: resolveYamlMerge
19462
});
19463
19464
},{"../type":34}],44:[function(require,module,exports){
19465
'use strict';
19466
19467
var Type = require('../type');
19468
19469
function resolveYamlNull(data) {
19470
  if (null === data) {
19471
    return true;
19472
  }
19473
19474
  var max = data.length;
19475
19476
  return (max === 1 && data === '~') ||
19477
         (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
19478
}
19479
19480
function constructYamlNull() {
19481
  return null;
19482
}
19483
19484
function isNull(object) {
19485
  return null === object;
19486
}
19487
19488
module.exports = new Type('tag:yaml.org,2002:null', {
19489
  kind: 'scalar',
19490
  resolve: resolveYamlNull,
19491
  construct: constructYamlNull,
19492
  predicate: isNull,
19493
  represent: {
19494
    canonical: function () { return '~';    },
19495
    lowercase: function () { return 'null'; },
19496
    uppercase: function () { return 'NULL'; },
19497
    camelcase: function () { return 'Null'; }
19498
  },
19499
  defaultStyle: 'lowercase'
19500
});
19501
19502
},{"../type":34}],45:[function(require,module,exports){
19503
'use strict';
19504
19505
var Type = require('../type');
19506
19507
var _hasOwnProperty = Object.prototype.hasOwnProperty;
19508
var _toString       = Object.prototype.toString;
19509
19510
function resolveYamlOmap(data) {
19511
  if (null === data) {
19512
    return true;
19513
  }
19514
19515
  var objectKeys = [], index, length, pair, pairKey, pairHasKey,
19516
      object = data;
19517
19518
  for (index = 0, length = object.length; index < length; index += 1) {
19519
    pair = object[index];
19520
    pairHasKey = false;
19521
19522
    if ('[object Object]' !== _toString.call(pair)) {
19523
      return false;
19524
    }
19525
19526
    for (pairKey in pair) {
19527
      if (_hasOwnProperty.call(pair, pairKey)) {
19528
        if (!pairHasKey) {
19529
          pairHasKey = true;
19530
        } else {
19531
          return false;
19532
        }
19533
      }
19534
    }
19535
19536
    if (!pairHasKey) {
19537
      return false;
19538
    }
19539
19540
    if (-1 === objectKeys.indexOf(pairKey)) {
19541
      objectKeys.push(pairKey);
19542
    } else {
19543
      return false;
19544
    }
19545
  }
19546
19547
  return true;
19548
}
19549
19550
function constructYamlOmap(data) {
19551
  return null !== data ? data : [];
19552
}
19553
19554
module.exports = new Type('tag:yaml.org,2002:omap', {
19555
  kind: 'sequence',
19556
  resolve: resolveYamlOmap,
19557
  construct: constructYamlOmap
19558
});
19559
19560
},{"../type":34}],46:[function(require,module,exports){
19561
'use strict';
19562
19563
var Type = require('../type');
19564
19565
var _toString = Object.prototype.toString;
19566
19567
function resolveYamlPairs(data) {
19568
  if (null === data) {
19569
    return true;
19570
  }
19571
19572
  var index, length, pair, keys, result,
19573
      object = data;
19574
19575
  result = new Array(object.length);
19576
19577
  for (index = 0, length = object.length; index < length; index += 1) {
19578
    pair = object[index];
19579
19580
    if ('[object Object]' !== _toString.call(pair)) {
19581
      return false;
19582
    }
19583
19584
    keys = Object.keys(pair);
19585
19586
    if (1 !== keys.length) {
19587
      return false;
19588
    }
19589
19590
    result[index] = [ keys[0], pair[keys[0]] ];
19591
  }
19592
19593
  return true;
19594
}
19595
19596
function constructYamlPairs(data) {
19597
  if (null === data) {
19598
    return [];
19599
  }
19600
19601
  var index, length, pair, keys, result,
19602
      object = data;
19603
19604
  result = new Array(object.length);
19605
19606
  for (index = 0, length = object.length; index < length; index += 1) {
19607
    pair = object[index];
19608
19609
    keys = Object.keys(pair);
19610
19611
    result[index] = [ keys[0], pair[keys[0]] ];
19612
  }
19613
19614
  return result;
19615
}
19616
19617
module.exports = new Type('tag:yaml.org,2002:pairs', {
19618
  kind: 'sequence',
19619
  resolve: resolveYamlPairs,
19620
  construct: constructYamlPairs
19621
});
19622
19623
},{"../type":34}],47:[function(require,module,exports){
19624
'use strict';
19625
19626
var Type = require('../type');
19627
19628
module.exports = new Type('tag:yaml.org,2002:seq', {
19629
  kind: 'sequence',
19630
  construct: function (data) { return null !== data ? data : []; }
19631
});
19632
19633
},{"../type":34}],48:[function(require,module,exports){
19634
'use strict';
19635
19636
var Type = require('../type');
19637
19638
var _hasOwnProperty = Object.prototype.hasOwnProperty;
19639
19640
function resolveYamlSet(data) {
19641
  if (null === data) {
19642
    return true;
19643
  }
19644
19645
  var key, object = data;
19646
19647
  for (key in object) {
19648
    if (_hasOwnProperty.call(object, key)) {
19649
      if (null !== object[key]) {
19650
        return false;
19651
      }
19652
    }
19653
  }
19654
19655
  return true;
19656
}
19657
19658
function constructYamlSet(data) {
19659
  return null !== data ? data : {};
19660
}
19661
19662
module.exports = new Type('tag:yaml.org,2002:set', {
19663
  kind: 'mapping',
19664
  resolve: resolveYamlSet,
19665
  construct: constructYamlSet
19666
});
19667
19668
},{"../type":34}],49:[function(require,module,exports){
19669
'use strict';
19670
19671
var Type = require('../type');
19672
19673
module.exports = new Type('tag:yaml.org,2002:str', {
19674
  kind: 'scalar',
19675
  construct: function (data) { return null !== data ? data : ''; }
19676
});
19677
19678
},{"../type":34}],50:[function(require,module,exports){
19679
'use strict';
19680
19681
var Type = require('../type');
19682
19683
var YAML_TIMESTAMP_REGEXP = new RegExp(
19684
  '^([0-9][0-9][0-9][0-9])'          + // [1] year
19685
  '-([0-9][0-9]?)'                   + // [2] month
19686
  '-([0-9][0-9]?)'                   + // [3] day
19687
  '(?:(?:[Tt]|[ \\t]+)'              + // ...
19688
  '([0-9][0-9]?)'                    + // [4] hour
19689
  ':([0-9][0-9])'                    + // [5] minute
19690
  ':([0-9][0-9])'                    + // [6] second
19691
  '(?:\\.([0-9]*))?'                 + // [7] fraction
19692
  '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
19693
  '(?::([0-9][0-9]))?))?)?$');         // [11] tz_minute
19694
19695
function resolveYamlTimestamp(data) {
19696
  if (null === data) {
19697
    return false;
19698
  }
19699
19700
  var match, year, month, day, hour, minute, second, fraction = 0,
19701
      delta = null, tz_hour, tz_minute, date;
19702
19703
  match = YAML_TIMESTAMP_REGEXP.exec(data);
19704
19705
  if (null === match) {
19706
    return false;
19707
  }
19708
19709
  return true;
19710
}
19711
19712
function constructYamlTimestamp(data) {
19713
  var match, year, month, day, hour, minute, second, fraction = 0,
19714
      delta = null, tz_hour, tz_minute, date;
19715
19716
  match = YAML_TIMESTAMP_REGEXP.exec(data);
19717
19718
  if (null === match) {
19719
    throw new Error('Date resolve error');
19720
  }
19721
19722
  // match: [1] year [2] month [3] day
19723
19724
  year = +(match[1]);
19725
  month = +(match[2]) - 1; // JS month starts with 0
19726
  day = +(match[3]);
19727
19728
  if (!match[4]) { // no hour
19729
    return new Date(Date.UTC(year, month, day));
19730
  }
19731
19732
  // match: [4] hour [5] minute [6] second [7] fraction
19733
19734
  hour = +(match[4]);
19735
  minute = +(match[5]);
19736
  second = +(match[6]);
19737
19738
  if (match[7]) {
19739
    fraction = match[7].slice(0, 3);
19740
    while (fraction.length < 3) { // milli-seconds
19741
      fraction += '0';
19742
    }
19743
    fraction = +fraction;
19744
  }
19745
19746
  // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
19747
19748
  if (match[9]) {
19749
    tz_hour = +(match[10]);
19750
    tz_minute = +(match[11] || 0);
19751
    delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
19752
    if ('-' === match[9]) {
19753
      delta = -delta;
19754
    }
19755
  }
19756
19757
  date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
19758
19759
  if (delta) {
19760
    date.setTime(date.getTime() - delta);
19761
  }
19762
19763
  return date;
19764
}
19765
19766
function representYamlTimestamp(object /*, style*/) {
19767
  return object.toISOString();
19768
}
19769
19770
module.exports = new Type('tag:yaml.org,2002:timestamp', {
19771
  kind: 'scalar',
19772
  resolve: resolveYamlTimestamp,
19773
  construct: constructYamlTimestamp,
19774
  instanceOf: Date,
19775
  represent: representYamlTimestamp
19776
});
19777
19778
},{"../type":34}],51:[function(require,module,exports){
19779
/*
19780
  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
19781
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
19782
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
19783
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
19784
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
19785
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
19786
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
19787
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
19788
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
19789
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
19790
19791
  Redistribution and use in source and binary forms, with or without
19792
  modification, are permitted provided that the following conditions are met:
19793
19794
    * Redistributions of source code must retain the above copyright
19795
      notice, this list of conditions and the following disclaimer.
19796
    * Redistributions in binary form must reproduce the above copyright
19797
      notice, this list of conditions and the following disclaimer in the
19798
      documentation and/or other materials provided with the distribution.
19799
19800
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19801
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19802
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19803
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19804
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19805
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19806
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19807
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19808
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19809
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19810
*/
19811
19812
(function (root, factory) {
19813
    'use strict';
19814
19815
    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
19816
    // Rhino, and plain browser loading.
19817
19818
    /* istanbul ignore next */
19819
    if (typeof define === 'function' && define.amd) {
19820
        define(['exports'], factory);
19821
    } else if (typeof exports !== 'undefined') {
19822
        factory(exports);
19823
    } else {
19824
        factory((root.esprima = {}));
19825
    }
19826
}(this, function (exports) {
19827
    'use strict';
19828
19829
    var Token,
19830
        TokenName,
19831
        FnExprTokens,
19832
        Syntax,
19833
        PlaceHolders,
19834
        Messages,
19835
        Regex,
19836
        source,
19837
        strict,
19838
        sourceType,
19839
        index,
19840
        lineNumber,
19841
        lineStart,
19842
        hasLineTerminator,
19843
        lastIndex,
19844
        lastLineNumber,
19845
        lastLineStart,
19846
        startIndex,
19847
        startLineNumber,
19848
        startLineStart,
19849
        scanning,
19850
        length,
19851
        lookahead,
19852
        state,
19853
        extra,
19854
        isBindingElement,
19855
        isAssignmentTarget,
19856
        firstCoverInitializedNameError;
19857
19858
    Token = {
19859
        BooleanLiteral: 1,
19860
        EOF: 2,
19861
        Identifier: 3,
19862
        Keyword: 4,
19863
        NullLiteral: 5,
19864
        NumericLiteral: 6,
19865
        Punctuator: 7,
19866
        StringLiteral: 8,
19867
        RegularExpression: 9,
19868
        Template: 10
19869
    };
19870
19871
    TokenName = {};
19872
    TokenName[Token.BooleanLiteral] = 'Boolean';
19873
    TokenName[Token.EOF] = '<end>';
19874
    TokenName[Token.Identifier] = 'Identifier';
19875
    TokenName[Token.Keyword] = 'Keyword';
19876
    TokenName[Token.NullLiteral] = 'Null';
19877
    TokenName[Token.NumericLiteral] = 'Numeric';
19878
    TokenName[Token.Punctuator] = 'Punctuator';
19879
    TokenName[Token.StringLiteral] = 'String';
19880
    TokenName[Token.RegularExpression] = 'RegularExpression';
19881
    TokenName[Token.Template] = 'Template';
19882
19883
    // A function following one of those tokens is an expression.
19884
    FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
19885
                    'return', 'case', 'delete', 'throw', 'void',
19886
                    // assignment operators
19887
                    '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
19888
                    '&=', '|=', '^=', ',',
19889
                    // binary/unary operators
19890
                    '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
19891
                    '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
19892
                    '<=', '<', '>', '!=', '!=='];
19893
19894
    Syntax = {
19895
        AssignmentExpression: 'AssignmentExpression',
19896
        AssignmentPattern: 'AssignmentPattern',
19897
        ArrayExpression: 'ArrayExpression',
19898
        ArrayPattern: 'ArrayPattern',
19899
        ArrowFunctionExpression: 'ArrowFunctionExpression',
19900
        BlockStatement: 'BlockStatement',
19901
        BinaryExpression: 'BinaryExpression',
19902
        BreakStatement: 'BreakStatement',
19903
        CallExpression: 'CallExpression',
19904
        CatchClause: 'CatchClause',
19905
        ClassBody: 'ClassBody',
19906
        ClassDeclaration: 'ClassDeclaration',
19907
        ClassExpression: 'ClassExpression',
19908
        ConditionalExpression: 'ConditionalExpression',
19909
        ContinueStatement: 'ContinueStatement',
19910
        DoWhileStatement: 'DoWhileStatement',
19911
        DebuggerStatement: 'DebuggerStatement',
19912
        EmptyStatement: 'EmptyStatement',
19913
        ExportAllDeclaration: 'ExportAllDeclaration',
19914
        ExportDefaultDeclaration: 'ExportDefaultDeclaration',
19915
        ExportNamedDeclaration: 'ExportNamedDeclaration',
19916
        ExportSpecifier: 'ExportSpecifier',
19917
        ExpressionStatement: 'ExpressionStatement',
19918
        ForStatement: 'ForStatement',
19919
        ForInStatement: 'ForInStatement',
19920
        FunctionDeclaration: 'FunctionDeclaration',
19921
        FunctionExpression: 'FunctionExpression',
19922
        Identifier: 'Identifier',
19923
        IfStatement: 'IfStatement',
19924
        ImportDeclaration: 'ImportDeclaration',
19925
        ImportDefaultSpecifier: 'ImportDefaultSpecifier',
19926
        ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
19927
        ImportSpecifier: 'ImportSpecifier',
19928
        Literal: 'Literal',
19929
        LabeledStatement: 'LabeledStatement',
19930
        LogicalExpression: 'LogicalExpression',
19931
        MemberExpression: 'MemberExpression',
19932
        MethodDefinition: 'MethodDefinition',
19933
        NewExpression: 'NewExpression',
19934
        ObjectExpression: 'ObjectExpression',
19935
        ObjectPattern: 'ObjectPattern',
19936
        Program: 'Program',
19937
        Property: 'Property',
19938
        RestElement: 'RestElement',
19939
        ReturnStatement: 'ReturnStatement',
19940
        SequenceExpression: 'SequenceExpression',
19941
        SpreadElement: 'SpreadElement',
19942
        Super: 'Super',
19943
        SwitchCase: 'SwitchCase',
19944
        SwitchStatement: 'SwitchStatement',
19945
        TaggedTemplateExpression: 'TaggedTemplateExpression',
19946
        TemplateElement: 'TemplateElement',
19947
        TemplateLiteral: 'TemplateLiteral',
19948
        ThisExpression: 'ThisExpression',
19949
        ThrowStatement: 'ThrowStatement',
19950
        TryStatement: 'TryStatement',
19951
        UnaryExpression: 'UnaryExpression',
19952
        UpdateExpression: 'UpdateExpression',
19953
        VariableDeclaration: 'VariableDeclaration',
19954
        VariableDeclarator: 'VariableDeclarator',
19955
        WhileStatement: 'WhileStatement',
19956
        WithStatement: 'WithStatement'
19957
    };
19958
19959
    PlaceHolders = {
19960
        ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder'
19961
    };
19962
19963
    // Error messages should be identical to V8.
19964
    Messages = {
19965
        UnexpectedToken: 'Unexpected token %0',
19966
        UnexpectedNumber: 'Unexpected number',
19967
        UnexpectedString: 'Unexpected string',
19968
        UnexpectedIdentifier: 'Unexpected identifier',
19969
        UnexpectedReserved: 'Unexpected reserved word',
19970
        UnexpectedTemplate: 'Unexpected quasi %0',
19971
        UnexpectedEOS: 'Unexpected end of input',
19972
        NewlineAfterThrow: 'Illegal newline after throw',
19973
        InvalidRegExp: 'Invalid regular expression',
19974
        UnterminatedRegExp: 'Invalid regular expression: missing /',
19975
        InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
19976
        InvalidLHSInForIn: 'Invalid left-hand side in for-in',
19977
        MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
19978
        NoCatchOrFinally: 'Missing catch or finally after try',
19979
        UnknownLabel: 'Undefined label \'%0\'',
19980
        Redeclaration: '%0 \'%1\' has already been declared',
19981
        IllegalContinue: 'Illegal continue statement',
19982
        IllegalBreak: 'Illegal break statement',
19983
        IllegalReturn: 'Illegal return statement',
19984
        StrictModeWith: 'Strict mode code may not include a with statement',
19985
        StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
19986
        StrictVarName: 'Variable name may not be eval or arguments in strict mode',
19987
        StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
19988
        StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
19989
        StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
19990
        StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
19991
        StrictDelete: 'Delete of an unqualified identifier in strict mode.',
19992
        StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
19993
        StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
19994
        StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
19995
        StrictReservedWord: 'Use of future reserved word in strict mode',
19996
        TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
19997
        ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
19998
        DefaultRestParameter: 'Unexpected token =',
19999
        ObjectPatternAsRestParameter: 'Unexpected token {',
20000
        DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
20001
        ConstructorSpecialMethod: 'Class constructor may not be an accessor',
20002
        DuplicateConstructor: 'A class may only have one constructor',
20003
        StaticPrototype: 'Classes may not have static property named prototype',
20004
        MissingFromClause: 'Unexpected token',
20005
        NoAsAfterImportNamespace: 'Unexpected token',
20006
        InvalidModuleSpecifier: 'Unexpected token',
20007
        IllegalImportDeclaration: 'Unexpected token',
20008
        IllegalExportDeclaration: 'Unexpected token'
20009
    };
20010
20011
    // See also tools/generate-unicode-regex.py.
20012
    Regex = {
20013
        NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'),
20014
        NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]')
20015
    };
20016
20017
    // Ensure the condition is true, otherwise throw an error.
20018
    // This is only to have a better contract semantic, i.e. another safety net
20019
    // to catch a logic error. The condition shall be fulfilled in normal case.
20020
    // Do NOT use this to enforce a certain condition on any user input.
20021
20022
    function assert(condition, message) {
20023
        /* istanbul ignore if */
20024
        if (!condition) {
20025
            throw new Error('ASSERT: ' + message);
20026
        }
20027
    }
20028
20029
    function isDecimalDigit(ch) {
20030
        return (ch >= 0x30 && ch <= 0x39);   // 0..9
20031
    }
20032
20033
    function isHexDigit(ch) {
20034
        return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
20035
    }
20036
20037
    function isOctalDigit(ch) {
20038
        return '01234567'.indexOf(ch) >= 0;
20039
    }
20040
20041
    function octalToDecimal(ch) {
20042
        // \0 is not octal escape sequence
20043
        var octal = (ch !== '0'), code = '01234567'.indexOf(ch);
20044
20045
        if (index < length && isOctalDigit(source[index])) {
20046
            octal = true;
20047
            code = code * 8 + '01234567'.indexOf(source[index++]);
20048
20049
            // 3 digits are only allowed when string starts
20050
            // with 0, 1, 2, 3
20051
            if ('0123'.indexOf(ch) >= 0 &&
20052
                    index < length &&
20053
                    isOctalDigit(source[index])) {
20054
                code = code * 8 + '01234567'.indexOf(source[index++]);
20055
            }
20056
        }
20057
20058
        return {
20059
            code: code,
20060
            octal: octal
20061
        };
20062
    }
20063
20064
    // 7.2 White Space
20065
20066
    function isWhiteSpace(ch) {
20067
        return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||
20068
            (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);
20069
    }
20070
20071
    // 7.3 Line Terminators
20072
20073
    function isLineTerminator(ch) {
20074
        return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);
20075
    }
20076
20077
    // 7.6 Identifier Names and Identifiers
20078
20079
    function isIdentifierStart(ch) {
20080
        return (ch === 0x24) || (ch === 0x5F) ||  // $ (dollar) and _ (underscore)
20081
            (ch >= 0x41 && ch <= 0x5A) ||         // A..Z
20082
            (ch >= 0x61 && ch <= 0x7A) ||         // a..z
20083
            (ch === 0x5C) ||                      // \ (backslash)
20084
            ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
20085
    }
20086
20087
    function isIdentifierPart(ch) {
20088
        return (ch === 0x24) || (ch === 0x5F) ||  // $ (dollar) and _ (underscore)
20089
            (ch >= 0x41 && ch <= 0x5A) ||         // A..Z
20090
            (ch >= 0x61 && ch <= 0x7A) ||         // a..z
20091
            (ch >= 0x30 && ch <= 0x39) ||         // 0..9
20092
            (ch === 0x5C) ||                      // \ (backslash)
20093
            ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
20094
    }
20095
20096
    // 7.6.1.2 Future Reserved Words
20097
20098
    function isFutureReservedWord(id) {
20099
        switch (id) {
20100
        case 'enum':
20101
        case 'export':
20102
        case 'import':
20103
        case 'super':
20104
            return true;
20105
        default:
20106
            return false;
20107
        }
20108
    }
20109
20110
    // 11.6.2.2 Future Reserved Words
20111
20112
    function isStrictModeReservedWord(id) {
20113
        switch (id) {
20114
        case 'implements':
20115
        case 'interface':
20116
        case 'package':
20117
        case 'private':
20118
        case 'protected':
20119
        case 'public':
20120
        case 'static':
20121
        case 'yield':
20122
        case 'let':
20123
            return true;
20124
        default:
20125
            return false;
20126
        }
20127
    }
20128
20129
    function isRestrictedWord(id) {
20130
        return id === 'eval' || id === 'arguments';
20131
    }
20132
20133
    // 7.6.1.1 Keywords
20134
20135
    function isKeyword(id) {
20136
20137
        // 'const' is specialized as Keyword in V8.
20138
        // 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next.
20139
        // Some others are from future reserved words.
20140
20141
        switch (id.length) {
20142
        case 2:
20143
            return (id === 'if') || (id === 'in') || (id === 'do');
20144
        case 3:
20145
            return (id === 'var') || (id === 'for') || (id === 'new') ||
20146
                (id === 'try') || (id === 'let');
20147
        case 4:
20148
            return (id === 'this') || (id === 'else') || (id === 'case') ||
20149
                (id === 'void') || (id === 'with') || (id === 'enum');
20150
        case 5:
20151
            return (id === 'while') || (id === 'break') || (id === 'catch') ||
20152
                (id === 'throw') || (id === 'const') || (id === 'yield') ||
20153
                (id === 'class') || (id === 'super');
20154
        case 6:
20155
            return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
20156
                (id === 'switch') || (id === 'export') || (id === 'import');
20157
        case 7:
20158
            return (id === 'default') || (id === 'finally') || (id === 'extends');
20159
        case 8:
20160
            return (id === 'function') || (id === 'continue') || (id === 'debugger');
20161
        case 10:
20162
            return (id === 'instanceof');
20163
        default:
20164
            return false;
20165
        }
20166
    }
20167
20168
    // 7.4 Comments
20169
20170
    function addComment(type, value, start, end, loc) {
20171
        var comment;
20172
20173
        assert(typeof start === 'number', 'Comment must have valid position');
20174
20175
        state.lastCommentStart = start;
20176
20177
        comment = {
20178
            type: type,
20179
            value: value
20180
        };
20181
        if (extra.range) {
20182
            comment.range = [start, end];
20183
        }
20184
        if (extra.loc) {
20185
            comment.loc = loc;
20186
        }
20187
        extra.comments.push(comment);
20188
        if (extra.attachComment) {
20189
            extra.leadingComments.push(comment);
20190
            extra.trailingComments.push(comment);
20191
        }
20192
    }
20193
20194
    function skipSingleLineComment(offset) {
20195
        var start, loc, ch, comment;
20196
20197
        start = index - offset;
20198
        loc = {
20199
            start: {
20200
                line: lineNumber,
20201
                column: index - lineStart - offset
20202
            }
20203
        };
20204
20205
        while (index < length) {
20206
            ch = source.charCodeAt(index);
20207
            ++index;
20208
            if (isLineTerminator(ch)) {
20209
                hasLineTerminator = true;
20210
                if (extra.comments) {
20211
                    comment = source.slice(start + offset, index - 1);
20212
                    loc.end = {
20213
                        line: lineNumber,
20214
                        column: index - lineStart - 1
20215
                    };
20216
                    addComment('Line', comment, start, index - 1, loc);
20217
                }
20218
                if (ch === 13 && source.charCodeAt(index) === 10) {
20219
                    ++index;
20220
                }
20221
                ++lineNumber;
20222
                lineStart = index;
20223
                return;
20224
            }
20225
        }
20226
20227
        if (extra.comments) {
20228
            comment = source.slice(start + offset, index);
20229
            loc.end = {
20230
                line: lineNumber,
20231
                column: index - lineStart
20232
            };
20233
            addComment('Line', comment, start, index, loc);
20234
        }
20235
    }
20236
20237
    function skipMultiLineComment() {
20238
        var start, loc, ch, comment;
20239
20240
        if (extra.comments) {
20241
            start = index - 2;
20242
            loc = {
20243
                start: {
20244
                    line: lineNumber,
20245
                    column: index - lineStart - 2
20246
                }
20247
            };
20248
        }
20249
20250
        while (index < length) {
20251
            ch = source.charCodeAt(index);
20252
            if (isLineTerminator(ch)) {
20253
                if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) {
20254
                    ++index;
20255
                }
20256
                hasLineTerminator = true;
20257
                ++lineNumber;
20258
                ++index;
20259
                lineStart = index;
20260
            } else if (ch === 0x2A) {
20261
                // Block comment ends with '*/'.
20262
                if (source.charCodeAt(index + 1) === 0x2F) {
20263
                    ++index;
20264
                    ++index;
20265
                    if (extra.comments) {
20266
                        comment = source.slice(start + 2, index - 2);
20267
                        loc.end = {
20268
                            line: lineNumber,
20269
                            column: index - lineStart
20270
                        };
20271
                        addComment('Block', comment, start, index, loc);
20272
                    }
20273
                    return;
20274
                }
20275
                ++index;
20276
            } else {
20277
                ++index;
20278
            }
20279
        }
20280
20281
        // Ran off the end of the file - the whole thing is a comment
20282
        if (extra.comments) {
20283
            loc.end = {
20284
                line: lineNumber,
20285
                column: index - lineStart
20286
            };
20287
            comment = source.slice(start + 2, index);
20288
            addComment('Block', comment, start, index, loc);
20289
        }
20290
        tolerateUnexpectedToken();
20291
    }
20292
20293
    function skipComment() {
20294
        var ch, start;
20295
        hasLineTerminator = false;
20296
20297
        start = (index === 0);
20298
        while (index < length) {
20299
            ch = source.charCodeAt(index);
20300
20301
            if (isWhiteSpace(ch)) {
20302
                ++index;
20303
            } else if (isLineTerminator(ch)) {
20304
                hasLineTerminator = true;
20305
                ++index;
20306
                if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {
20307
                    ++index;
20308
                }
20309
                ++lineNumber;
20310
                lineStart = index;
20311
                start = true;
20312
            } else if (ch === 0x2F) { // U+002F is '/'
20313
                ch = source.charCodeAt(index + 1);
20314
                if (ch === 0x2F) {
20315
                    ++index;
20316
                    ++index;
20317
                    skipSingleLineComment(2);
20318
                    start = true;
20319
                } else if (ch === 0x2A) {  // U+002A is '*'
20320
                    ++index;
20321
                    ++index;
20322
                    skipMultiLineComment();
20323
                } else {
20324
                    break;
20325
                }
20326
            } else if (start && ch === 0x2D) { // U+002D is '-'
20327
                // U+003E is '>'
20328
                if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) {
20329
                    // '-->' is a single-line comment
20330
                    index += 3;
20331
                    skipSingleLineComment(3);
20332
                } else {
20333
                    break;
20334
                }
20335
            } else if (ch === 0x3C) { // U+003C is '<'
20336
                if (source.slice(index + 1, index + 4) === '!--') {
20337
                    ++index; // `<`
20338
                    ++index; // `!`
20339
                    ++index; // `-`
20340
                    ++index; // `-`
20341
                    skipSingleLineComment(4);
20342
                } else {
20343
                    break;
20344
                }
20345
            } else {
20346
                break;
20347
            }
20348
        }
20349
    }
20350
20351
    function scanHexEscape(prefix) {
20352
        var i, len, ch, code = 0;
20353
20354
        len = (prefix === 'u') ? 4 : 2;
20355
        for (i = 0; i < len; ++i) {
20356
            if (index < length && isHexDigit(source[index])) {
20357
                ch = source[index++];
20358
                code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
20359
            } else {
20360
                return '';
20361
            }
20362
        }
20363
        return String.fromCharCode(code);
20364
    }
20365
20366
    function scanUnicodeCodePointEscape() {
20367
        var ch, code, cu1, cu2;
20368
20369
        ch = source[index];
20370
        code = 0;
20371
20372
        // At least, one hex digit is required.
20373
        if (ch === '}') {
20374
            throwUnexpectedToken();
20375
        }
20376
20377
        while (index < length) {
20378
            ch = source[index++];
20379
            if (!isHexDigit(ch)) {
20380
                break;
20381
            }
20382
            code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
20383
        }
20384
20385
        if (code > 0x10FFFF || ch !== '}') {
20386
            throwUnexpectedToken();
20387
        }
20388
20389
        // UTF-16 Encoding
20390
        if (code <= 0xFFFF) {
20391
            return String.fromCharCode(code);
20392
        }
20393
        cu1 = ((code - 0x10000) >> 10) + 0xD800;
20394
        cu2 = ((code - 0x10000) & 1023) + 0xDC00;
20395
        return String.fromCharCode(cu1, cu2);
20396
    }
20397
20398
    function getEscapedIdentifier() {
20399
        var ch, id;
20400
20401
        ch = source.charCodeAt(index++);
20402
        id = String.fromCharCode(ch);
20403
20404
        // '\u' (U+005C, U+0075) denotes an escaped character.
20405
        if (ch === 0x5C) {
20406
            if (source.charCodeAt(index) !== 0x75) {
20407
                throwUnexpectedToken();
20408
            }
20409
            ++index;
20410
            ch = scanHexEscape('u');
20411
            if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
20412
                throwUnexpectedToken();
20413
            }
20414
            id = ch;
20415
        }
20416
20417
        while (index < length) {
20418
            ch = source.charCodeAt(index);
20419
            if (!isIdentifierPart(ch)) {
20420
                break;
20421
            }
20422
            ++index;
20423
            id += String.fromCharCode(ch);
20424
20425
            // '\u' (U+005C, U+0075) denotes an escaped character.
20426
            if (ch === 0x5C) {
20427
                id = id.substr(0, id.length - 1);
20428
                if (source.charCodeAt(index) !== 0x75) {
20429
                    throwUnexpectedToken();
20430
                }
20431
                ++index;
20432
                ch = scanHexEscape('u');
20433
                if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
20434
                    throwUnexpectedToken();
20435
                }
20436
                id += ch;
20437
            }
20438
        }
20439
20440
        return id;
20441
    }
20442
20443
    function getIdentifier() {
20444
        var start, ch;
20445
20446
        start = index++;
20447
        while (index < length) {
20448
            ch = source.charCodeAt(index);
20449
            if (ch === 0x5C) {
20450
                // Blackslash (U+005C) marks Unicode escape sequence.
20451
                index = start;
20452
                return getEscapedIdentifier();
20453
            }
20454
            if (isIdentifierPart(ch)) {
20455
                ++index;
20456
            } else {
20457
                break;
20458
            }
20459
        }
20460
20461
        return source.slice(start, index);
20462
    }
20463
20464
    function scanIdentifier() {
20465
        var start, id, type;
20466
20467
        start = index;
20468
20469
        // Backslash (U+005C) starts an escaped character.
20470
        id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier();
20471
20472
        // There is no keyword or literal with only one character.
20473
        // Thus, it must be an identifier.
20474
        if (id.length === 1) {
20475
            type = Token.Identifier;
20476
        } else if (isKeyword(id)) {
20477
            type = Token.Keyword;
20478
        } else if (id === 'null') {
20479
            type = Token.NullLiteral;
20480
        } else if (id === 'true' || id === 'false') {
20481
            type = Token.BooleanLiteral;
20482
        } else {
20483
            type = Token.Identifier;
20484
        }
20485
20486
        return {
20487
            type: type,
20488
            value: id,
20489
            lineNumber: lineNumber,
20490
            lineStart: lineStart,
20491
            start: start,
20492
            end: index
20493
        };
20494
    }
20495
20496
20497
    // 7.7 Punctuators
20498
20499
    function scanPunctuator() {
20500
        var token, str;
20501
20502
        token = {
20503
            type: Token.Punctuator,
20504
            value: '',
20505
            lineNumber: lineNumber,
20506
            lineStart: lineStart,
20507
            start: index,
20508
            end: index
20509
        };
20510
20511
        // Check for most common single-character punctuators.
20512
        str = source[index];
20513
        switch (str) {
20514
20515
        case '(':
20516
            if (extra.tokenize) {
20517
                extra.openParenToken = extra.tokens.length;
20518
            }
20519
            ++index;
20520
            break;
20521
20522
        case '{':
20523
            if (extra.tokenize) {
20524
                extra.openCurlyToken = extra.tokens.length;
20525
            }
20526
            state.curlyStack.push('{');
20527
            ++index;
20528
            break;
20529
20530
        case '.':
20531
            ++index;
20532
            if (source[index] === '.' && source[index + 1] === '.') {
20533
                // Spread operator: ...
20534
                index += 2;
20535
                str = '...';
20536
            }
20537
            break;
20538
20539
        case '}':
20540
            ++index;
20541
            state.curlyStack.pop();
20542
            break;
20543
        case ')':
20544
        case ';':
20545
        case ',':
20546
        case '[':
20547
        case ']':
20548
        case ':':
20549
        case '?':
20550
        case '~':
20551
            ++index;
20552
            break;
20553
20554
        default:
20555
            // 4-character punctuator.
20556
            str = source.substr(index, 4);
20557
            if (str === '>>>=') {
20558
                index += 4;
20559
            } else {
20560
20561
                // 3-character punctuators.
20562
                str = str.substr(0, 3);
20563
                if (str === '===' || str === '!==' || str === '>>>' ||
20564
                    str === '<<=' || str === '>>=') {
20565
                    index += 3;
20566
                } else {
20567
20568
                    // 2-character punctuators.
20569
                    str = str.substr(0, 2);
20570
                    if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
20571
                        str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
20572
                        str === '++' || str === '--' || str === '<<' || str === '>>' ||
20573
                        str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
20574
                        str === '<=' || str === '>=' || str === '=>') {
20575
                        index += 2;
20576
                    } else {
20577
20578
                        // 1-character punctuators.
20579
                        str = source[index];
20580
                        if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
20581
                            ++index;
20582
                        }
20583
                    }
20584
                }
20585
            }
20586
        }
20587
20588
        if (index === token.start) {
20589
            throwUnexpectedToken();
20590
        }
20591
20592
        token.end = index;
20593
        token.value = str;
20594
        return token;
20595
    }
20596
20597
    // 7.8.3 Numeric Literals
20598
20599
    function scanHexLiteral(start) {
20600
        var number = '';
20601
20602
        while (index < length) {
20603
            if (!isHexDigit(source[index])) {
20604
                break;
20605
            }
20606
            number += source[index++];
20607
        }
20608
20609
        if (number.length === 0) {
20610
            throwUnexpectedToken();
20611
        }
20612
20613
        if (isIdentifierStart(source.charCodeAt(index))) {
20614
            throwUnexpectedToken();
20615
        }
20616
20617
        return {
20618
            type: Token.NumericLiteral,
20619
            value: parseInt('0x' + number, 16),
20620
            lineNumber: lineNumber,
20621
            lineStart: lineStart,
20622
            start: start,
20623
            end: index
20624
        };
20625
    }
20626
20627
    function scanBinaryLiteral(start) {
20628
        var ch, number;
20629
20630
        number = '';
20631
20632
        while (index < length) {
20633
            ch = source[index];
20634
            if (ch !== '0' && ch !== '1') {
20635
                break;
20636
            }
20637
            number += source[index++];
20638
        }
20639
20640
        if (number.length === 0) {
20641
            // only 0b or 0B
20642
            throwUnexpectedToken();
20643
        }
20644
20645
        if (index < length) {
20646
            ch = source.charCodeAt(index);
20647
            /* istanbul ignore else */
20648
            if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
20649
                throwUnexpectedToken();
20650
            }
20651
        }
20652
20653
        return {
20654
            type: Token.NumericLiteral,
20655
            value: parseInt(number, 2),
20656
            lineNumber: lineNumber,
20657
            lineStart: lineStart,
20658
            start: start,
20659
            end: index
20660
        };
20661
    }
20662
20663
    function scanOctalLiteral(prefix, start) {
20664
        var number, octal;
20665
20666
        if (isOctalDigit(prefix)) {
20667
            octal = true;
20668
            number = '0' + source[index++];
20669
        } else {
20670
            octal = false;
20671
            ++index;
20672
            number = '';
20673
        }
20674
20675
        while (index < length) {
20676
            if (!isOctalDigit(source[index])) {
20677
                break;
20678
            }
20679
            number += source[index++];
20680
        }
20681
20682
        if (!octal && number.length === 0) {
20683
            // only 0o or 0O
20684
            throwUnexpectedToken();
20685
        }
20686
20687
        if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
20688
            throwUnexpectedToken();
20689
        }
20690
20691
        return {
20692
            type: Token.NumericLiteral,
20693
            value: parseInt(number, 8),
20694
            octal: octal,
20695
            lineNumber: lineNumber,
20696
            lineStart: lineStart,
20697
            start: start,
20698
            end: index
20699
        };
20700
    }
20701
20702
    function isImplicitOctalLiteral() {
20703
        var i, ch;
20704
20705
        // Implicit octal, unless there is a non-octal digit.
20706
        // (Annex B.1.1 on Numeric Literals)
20707
        for (i = index + 1; i < length; ++i) {
20708
            ch = source[i];
20709
            if (ch === '8' || ch === '9') {
20710
                return false;
20711
            }
20712
            if (!isOctalDigit(ch)) {
20713
                return true;
20714
            }
20715
        }
20716
20717
        return true;
20718
    }
20719
20720
    function scanNumericLiteral() {
20721
        var number, start, ch;
20722
20723
        ch = source[index];
20724
        assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
20725
            'Numeric literal must start with a decimal digit or a decimal point');
20726
20727
        start = index;
20728
        number = '';
20729
        if (ch !== '.') {
20730
            number = source[index++];
20731
            ch = source[index];
20732
20733
            // Hex number starts with '0x'.
20734
            // Octal number starts with '0'.
20735
            // Octal number in ES6 starts with '0o'.
20736
            // Binary number in ES6 starts with '0b'.
20737
            if (number === '0') {
20738
                if (ch === 'x' || ch === 'X') {
20739
                    ++index;
20740
                    return scanHexLiteral(start);
20741
                }
20742
                if (ch === 'b' || ch === 'B') {
20743
                    ++index;
20744
                    return scanBinaryLiteral(start);
20745
                }
20746
                if (ch === 'o' || ch === 'O') {
20747
                    return scanOctalLiteral(ch, start);
20748
                }
20749
20750
                if (isOctalDigit(ch)) {
20751
                    if (isImplicitOctalLiteral()) {
20752
                        return scanOctalLiteral(ch, start);
20753
                    }
20754
                }
20755
            }
20756
20757
            while (isDecimalDigit(source.charCodeAt(index))) {
20758
                number += source[index++];
20759
            }
20760
            ch = source[index];
20761
        }
20762
20763
        if (ch === '.') {
20764
            number += source[index++];
20765
            while (isDecimalDigit(source.charCodeAt(index))) {
20766
                number += source[index++];
20767
            }
20768
            ch = source[index];
20769
        }
20770
20771
        if (ch === 'e' || ch === 'E') {
20772
            number += source[index++];
20773
20774
            ch = source[index];
20775
            if (ch === '+' || ch === '-') {
20776
                number += source[index++];
20777
            }
20778
            if (isDecimalDigit(source.charCodeAt(index))) {
20779
                while (isDecimalDigit(source.charCodeAt(index))) {
20780
                    number += source[index++];
20781
                }
20782
            } else {
20783
                throwUnexpectedToken();
20784
            }
20785
        }
20786
20787
        if (isIdentifierStart(source.charCodeAt(index))) {
20788
            throwUnexpectedToken();
20789
        }
20790
20791
        return {
20792
            type: Token.NumericLiteral,
20793
            value: parseFloat(number),
20794
            lineNumber: lineNumber,
20795
            lineStart: lineStart,
20796
            start: start,
20797
            end: index
20798
        };
20799
    }
20800
20801
    // 7.8.4 String Literals
20802
20803
    function scanStringLiteral() {
20804
        var str = '', quote, start, ch, unescaped, octToDec, octal = false;
20805
20806
        quote = source[index];
20807
        assert((quote === '\'' || quote === '"'),
20808
            'String literal must starts with a quote');
20809
20810
        start = index;
20811
        ++index;
20812
20813
        while (index < length) {
20814
            ch = source[index++];
20815
20816
            if (ch === quote) {
20817
                quote = '';
20818
                break;
20819
            } else if (ch === '\\') {
20820
                ch = source[index++];
20821
                if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
20822
                    switch (ch) {
20823
                    case 'u':
20824
                    case 'x':
20825
                        if (source[index] === '{') {
20826
                            ++index;
20827
                            str += scanUnicodeCodePointEscape();
20828
                        } else {
20829
                            unescaped = scanHexEscape(ch);
20830
                            if (!unescaped) {
20831
                                throw throwUnexpectedToken();
20832
                            }
20833
                            str += unescaped;
20834
                        }
20835
                        break;
20836
                    case 'n':
20837
                        str += '\n';
20838
                        break;
20839
                    case 'r':
20840
                        str += '\r';
20841
                        break;
20842
                    case 't':
20843
                        str += '\t';
20844
                        break;
20845
                    case 'b':
20846
                        str += '\b';
20847
                        break;
20848
                    case 'f':
20849
                        str += '\f';
20850
                        break;
20851
                    case 'v':
20852
                        str += '\x0B';
20853
                        break;
20854
                    case '8':
20855
                    case '9':
20856
                        throw throwUnexpectedToken();
20857
20858
                    default:
20859
                        if (isOctalDigit(ch)) {
20860
                            octToDec = octalToDecimal(ch);
20861
20862
                            octal = octToDec.octal || octal;
20863
                            str += String.fromCharCode(octToDec.code);
20864
                        } else {
20865
                            str += ch;
20866
                        }
20867
                        break;
20868
                    }
20869
                } else {
20870
                    ++lineNumber;
20871
                    if (ch === '\r' && source[index] === '\n') {
20872
                        ++index;
20873
                    }
20874
                    lineStart = index;
20875
                }
20876
            } else if (isLineTerminator(ch.charCodeAt(0))) {
20877
                break;
20878
            } else {
20879
                str += ch;
20880
            }
20881
        }
20882
20883
        if (quote !== '') {
20884
            throwUnexpectedToken();
20885
        }
20886
20887
        return {
20888
            type: Token.StringLiteral,
20889
            value: str,
20890
            octal: octal,
20891
            lineNumber: startLineNumber,
20892
            lineStart: startLineStart,
20893
            start: start,
20894
            end: index
20895
        };
20896
    }
20897
20898
    function scanTemplate() {
20899
        var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
20900
20901
        terminated = false;
20902
        tail = false;
20903
        start = index;
20904
        head = (source[index] === '`');
20905
        rawOffset = 2;
20906
20907
        ++index;
20908
20909
        while (index < length) {
20910
            ch = source[index++];
20911
            if (ch === '`') {
20912
                rawOffset = 1;
20913
                tail = true;
20914
                terminated = true;
20915
                break;
20916
            } else if (ch === '$') {
20917
                if (source[index] === '{') {
20918
                    state.curlyStack.push('${');
20919
                    ++index;
20920
                    terminated = true;
20921
                    break;
20922
                }
20923
                cooked += ch;
20924
            } else if (ch === '\\') {
20925
                ch = source[index++];
20926
                if (!isLineTerminator(ch.charCodeAt(0))) {
20927
                    switch (ch) {
20928
                    case 'n':
20929
                        cooked += '\n';
20930
                        break;
20931
                    case 'r':
20932
                        cooked += '\r';
20933
                        break;
20934
                    case 't':
20935
                        cooked += '\t';
20936
                        break;
20937
                    case 'u':
20938
                    case 'x':
20939
                        if (source[index] === '{') {
20940
                            ++index;
20941
                            cooked += scanUnicodeCodePointEscape();
20942
                        } else {
20943
                            restore = index;
20944
                            unescaped = scanHexEscape(ch);
20945
                            if (unescaped) {
20946
                                cooked += unescaped;
20947
                            } else {
20948
                                index = restore;
20949
                                cooked += ch;
20950
                            }
20951
                        }
20952
                        break;
20953
                    case 'b':
20954
                        cooked += '\b';
20955
                        break;
20956
                    case 'f':
20957
                        cooked += '\f';
20958
                        break;
20959
                    case 'v':
20960
                        cooked += '\v';
20961
                        break;
20962
20963
                    default:
20964
                        if (ch === '0') {
20965
                            if (isDecimalDigit(source.charCodeAt(index))) {
20966
                                // Illegal: \01 \02 and so on
20967
                                throwError(Messages.TemplateOctalLiteral);
20968
                            }
20969
                            cooked += '\0';
20970
                        } else if (isOctalDigit(ch)) {
20971
                            // Illegal: \1 \2
20972
                            throwError(Messages.TemplateOctalLiteral);
20973
                        } else {
20974
                            cooked += ch;
20975
                        }
20976
                        break;
20977
                    }
20978
                } else {
20979
                    ++lineNumber;
20980
                    if (ch === '\r' && source[index] === '\n') {
20981
                        ++index;
20982
                    }
20983
                    lineStart = index;
20984
                }
20985
            } else if (isLineTerminator(ch.charCodeAt(0))) {
20986
                ++lineNumber;
20987
                if (ch === '\r' && source[index] === '\n') {
20988
                    ++index;
20989
                }
20990
                lineStart = index;
20991
                cooked += '\n';
20992
            } else {
20993
                cooked += ch;
20994
            }
20995
        }
20996
20997
        if (!terminated) {
20998
            throwUnexpectedToken();
20999
        }
21000
21001
        if (!head) {
21002
            state.curlyStack.pop();
21003
        }
21004
21005
        return {
21006
            type: Token.Template,
21007
            value: {
21008
                cooked: cooked,
21009
                raw: source.slice(start + 1, index - rawOffset)
21010
            },
21011
            head: head,
21012
            tail: tail,
21013
            lineNumber: lineNumber,
21014
            lineStart: lineStart,
21015
            start: start,
21016
            end: index
21017
        };
21018
    }
21019
21020
    function testRegExp(pattern, flags) {
21021
        var tmp = pattern;
21022
21023
        if (flags.indexOf('u') >= 0) {
21024
            // Replace each astral symbol and every Unicode escape sequence
21025
            // that possibly represents an astral symbol or a paired surrogate
21026
            // with a single ASCII symbol to avoid throwing on regular
21027
            // expressions that are only valid in combination with the `/u`
21028
            // flag.
21029
            // Note: replacing with the ASCII symbol `x` might cause false
21030
            // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
21031
            // perfectly valid pattern that is equivalent to `[a-b]`, but it
21032
            // would be replaced by `[x-b]` which throws an error.
21033
            tmp = tmp
21034
                .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
21035
                    if (parseInt($1, 16) <= 0x10FFFF) {
21036
                        return 'x';
21037
                    }
21038
                    throwUnexpectedToken(null, Messages.InvalidRegExp);
21039
                })
21040
                .replace(
21041
                    /\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
21042
                    'x'
21043
                );
21044
        }
21045
21046
        // First, detect invalid regular expressions.
21047
        try {
21048
            RegExp(tmp);
21049
        } catch (e) {
21050
            throwUnexpectedToken(null, Messages.InvalidRegExp);
21051
        }
21052
21053
        // Return a regular expression object for this pattern-flag pair, or
21054
        // `null` in case the current environment doesn't support the flags it
21055
        // uses.
21056
        try {
21057
            return new RegExp(pattern, flags);
21058
        } catch (exception) {
21059
            return null;
21060
        }
21061
    }
21062
21063
    function scanRegExpBody() {
21064
        var ch, str, classMarker, terminated, body;
21065
21066
        ch = source[index];
21067
        assert(ch === '/', 'Regular expression literal must start with a slash');
21068
        str = source[index++];
21069
21070
        classMarker = false;
21071
        terminated = false;
21072
        while (index < length) {
21073
            ch = source[index++];
21074
            str += ch;
21075
            if (ch === '\\') {
21076
                ch = source[index++];
21077
                // ECMA-262 7.8.5
21078
                if (isLineTerminator(ch.charCodeAt(0))) {
21079
                    throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21080
                }
21081
                str += ch;
21082
            } else if (isLineTerminator(ch.charCodeAt(0))) {
21083
                throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21084
            } else if (classMarker) {
21085
                if (ch === ']') {
21086
                    classMarker = false;
21087
                }
21088
            } else {
21089
                if (ch === '/') {
21090
                    terminated = true;
21091
                    break;
21092
                } else if (ch === '[') {
21093
                    classMarker = true;
21094
                }
21095
            }
21096
        }
21097
21098
        if (!terminated) {
21099
            throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21100
        }
21101
21102
        // Exclude leading and trailing slash.
21103
        body = str.substr(1, str.length - 2);
21104
        return {
21105
            value: body,
21106
            literal: str
21107
        };
21108
    }
21109
21110
    function scanRegExpFlags() {
21111
        var ch, str, flags, restore;
21112
21113
        str = '';
21114
        flags = '';
21115
        while (index < length) {
21116
            ch = source[index];
21117
            if (!isIdentifierPart(ch.charCodeAt(0))) {
21118
                break;
21119
            }
21120
21121
            ++index;
21122
            if (ch === '\\' && index < length) {
21123
                ch = source[index];
21124
                if (ch === 'u') {
21125
                    ++index;
21126
                    restore = index;
21127
                    ch = scanHexEscape('u');
21128
                    if (ch) {
21129
                        flags += ch;
21130
                        for (str += '\\u'; restore < index; ++restore) {
21131
                            str += source[restore];
21132
                        }
21133
                    } else {
21134
                        index = restore;
21135
                        flags += 'u';
21136
                        str += '\\u';
21137
                    }
21138
                    tolerateUnexpectedToken();
21139
                } else {
21140
                    str += '\\';
21141
                    tolerateUnexpectedToken();
21142
                }
21143
            } else {
21144
                flags += ch;
21145
                str += ch;
21146
            }
21147
        }
21148
21149
        return {
21150
            value: flags,
21151
            literal: str
21152
        };
21153
    }
21154
21155
    function scanRegExp() {
21156
        scanning = true;
21157
        var start, body, flags, value;
21158
21159
        lookahead = null;
21160
        skipComment();
21161
        start = index;
21162
21163
        body = scanRegExpBody();
21164
        flags = scanRegExpFlags();
21165
        value = testRegExp(body.value, flags.value);
21166
        scanning = false;
21167
        if (extra.tokenize) {
21168
            return {
21169
                type: Token.RegularExpression,
21170
                value: value,
21171
                regex: {
21172
                    pattern: body.value,
21173
                    flags: flags.value
21174
                },
21175
                lineNumber: lineNumber,
21176
                lineStart: lineStart,
21177
                start: start,
21178
                end: index
21179
            };
21180
        }
21181
21182
        return {
21183
            literal: body.literal + flags.literal,
21184
            value: value,
21185
            regex: {
21186
                pattern: body.value,
21187
                flags: flags.value
21188
            },
21189
            start: start,
21190
            end: index
21191
        };
21192
    }
21193
21194
    function collectRegex() {
21195
        var pos, loc, regex, token;
21196
21197
        skipComment();
21198
21199
        pos = index;
21200
        loc = {
21201
            start: {
21202
                line: lineNumber,
21203
                column: index - lineStart
21204
            }
21205
        };
21206
21207
        regex = scanRegExp();
21208
21209
        loc.end = {
21210
            line: lineNumber,
21211
            column: index - lineStart
21212
        };
21213
21214
        /* istanbul ignore next */
21215
        if (!extra.tokenize) {
21216
            // Pop the previous token, which is likely '/' or '/='
21217
            if (extra.tokens.length > 0) {
21218
                token = extra.tokens[extra.tokens.length - 1];
21219
                if (token.range[0] === pos && token.type === 'Punctuator') {
21220
                    if (token.value === '/' || token.value === '/=') {
21221
                        extra.tokens.pop();
21222
                    }
21223
                }
21224
            }
21225
21226
            extra.tokens.push({
21227
                type: 'RegularExpression',
21228
                value: regex.literal,
21229
                regex: regex.regex,
21230
                range: [pos, index],
21231
                loc: loc
21232
            });
21233
        }
21234
21235
        return regex;
21236
    }
21237
21238
    function isIdentifierName(token) {
21239
        return token.type === Token.Identifier ||
21240
            token.type === Token.Keyword ||
21241
            token.type === Token.BooleanLiteral ||
21242
            token.type === Token.NullLiteral;
21243
    }
21244
21245
    function advanceSlash() {
21246
        var prevToken,
21247
            checkToken;
21248
        // Using the following algorithm:
21249
        // https://github.com/mozilla/sweet.js/wiki/design
21250
        prevToken = extra.tokens[extra.tokens.length - 1];
21251
        if (!prevToken) {
21252
            // Nothing before that: it cannot be a division.
21253
            return collectRegex();
21254
        }
21255
        if (prevToken.type === 'Punctuator') {
21256
            if (prevToken.value === ']') {
21257
                return scanPunctuator();
21258
            }
21259
            if (prevToken.value === ')') {
21260
                checkToken = extra.tokens[extra.openParenToken - 1];
21261
                if (checkToken &&
21262
                        checkToken.type === 'Keyword' &&
21263
                        (checkToken.value === 'if' ||
21264
                         checkToken.value === 'while' ||
21265
                         checkToken.value === 'for' ||
21266
                         checkToken.value === 'with')) {
21267
                    return collectRegex();
21268
                }
21269
                return scanPunctuator();
21270
            }
21271
            if (prevToken.value === '}') {
21272
                // Dividing a function by anything makes little sense,
21273
                // but we have to check for that.
21274
                if (extra.tokens[extra.openCurlyToken - 3] &&
21275
                        extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
21276
                    // Anonymous function.
21277
                    checkToken = extra.tokens[extra.openCurlyToken - 4];
21278
                    if (!checkToken) {
21279
                        return scanPunctuator();
21280
                    }
21281
                } else if (extra.tokens[extra.openCurlyToken - 4] &&
21282
                        extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
21283
                    // Named function.
21284
                    checkToken = extra.tokens[extra.openCurlyToken - 5];
21285
                    if (!checkToken) {
21286
                        return collectRegex();
21287
                    }
21288
                } else {
21289
                    return scanPunctuator();
21290
                }
21291
                // checkToken determines whether the function is
21292
                // a declaration or an expression.
21293
                if (FnExprTokens.indexOf(checkToken.value) >= 0) {
21294
                    // It is an expression.
21295
                    return scanPunctuator();
21296
                }
21297
                // It is a declaration.
21298
                return collectRegex();
21299
            }
21300
            return collectRegex();
21301
        }
21302
        if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
21303
            return collectRegex();
21304
        }
21305
        return scanPunctuator();
21306
    }
21307
21308
    function advance() {
21309
        var ch, token;
21310
21311
        if (index >= length) {
21312
            return {
21313
                type: Token.EOF,
21314
                lineNumber: lineNumber,
21315
                lineStart: lineStart,
21316
                start: index,
21317
                end: index
21318
            };
21319
        }
21320
21321
        ch = source.charCodeAt(index);
21322
21323
        if (isIdentifierStart(ch)) {
21324
            token = scanIdentifier();
21325
            if (strict && isStrictModeReservedWord(token.value)) {
21326
                token.type = Token.Keyword;
21327
            }
21328
            return token;
21329
        }
21330
21331
        // Very common: ( and ) and ;
21332
        if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
21333
            return scanPunctuator();
21334
        }
21335
21336
        // String literal starts with single quote (U+0027) or double quote (U+0022).
21337
        if (ch === 0x27 || ch === 0x22) {
21338
            return scanStringLiteral();
21339
        }
21340
21341
        // Dot (.) U+002E can also start a floating-point number, hence the need
21342
        // to check the next character.
21343
        if (ch === 0x2E) {
21344
            if (isDecimalDigit(source.charCodeAt(index + 1))) {
21345
                return scanNumericLiteral();
21346
            }
21347
            return scanPunctuator();
21348
        }
21349
21350
        if (isDecimalDigit(ch)) {
21351
            return scanNumericLiteral();
21352
        }
21353
21354
        // Slash (/) U+002F can also start a regex.
21355
        if (extra.tokenize && ch === 0x2F) {
21356
            return advanceSlash();
21357
        }
21358
21359
        // Template literals start with ` (U+0060) for template head
21360
        // or } (U+007D) for template middle or template tail.
21361
        if (ch === 0x60 || (ch === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) {
21362
            return scanTemplate();
21363
        }
21364
21365
        return scanPunctuator();
21366
    }
21367
21368
    function collectToken() {
21369
        var loc, token, value, entry;
21370
21371
        loc = {
21372
            start: {
21373
                line: lineNumber,
21374
                column: index - lineStart
21375
            }
21376
        };
21377
21378
        token = advance();
21379
        loc.end = {
21380
            line: lineNumber,
21381
            column: index - lineStart
21382
        };
21383
21384
        if (token.type !== Token.EOF) {
21385
            value = source.slice(token.start, token.end);
21386
            entry = {
21387
                type: TokenName[token.type],
21388
                value: value,
21389
                range: [token.start, token.end],
21390
                loc: loc
21391
            };
21392
            if (token.regex) {
21393
                entry.regex = {
21394
                    pattern: token.regex.pattern,
21395
                    flags: token.regex.flags
21396
                };
21397
            }
21398
            extra.tokens.push(entry);
21399
        }
21400
21401
        return token;
21402
    }
21403
21404
    function lex() {
21405
        var token;
21406
        scanning = true;
21407
21408
        lastIndex = index;
21409
        lastLineNumber = lineNumber;
21410
        lastLineStart = lineStart;
21411
21412
        skipComment();
21413
21414
        token = lookahead;
21415
21416
        startIndex = index;
21417
        startLineNumber = lineNumber;
21418
        startLineStart = lineStart;
21419
21420
        lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
21421
        scanning = false;
21422
        return token;
21423
    }
21424
21425
    function peek() {
21426
        scanning = true;
21427
21428
        skipComment();
21429
21430
        lastIndex = index;
21431
        lastLineNumber = lineNumber;
21432
        lastLineStart = lineStart;
21433
21434
        startIndex = index;
21435
        startLineNumber = lineNumber;
21436
        startLineStart = lineStart;
21437
21438
        lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
21439
        scanning = false;
21440
    }
21441
21442
    function Position() {
21443
        this.line = startLineNumber;
21444
        this.column = startIndex - startLineStart;
21445
    }
21446
21447
    function SourceLocation() {
21448
        this.start = new Position();
21449
        this.end = null;
21450
    }
21451
21452
    function WrappingSourceLocation(startToken) {
21453
        this.start = {
21454
            line: startToken.lineNumber,
21455
            column: startToken.start - startToken.lineStart
21456
        };
21457
        this.end = null;
21458
    }
21459
21460
    function Node() {
21461
        if (extra.range) {
21462
            this.range = [startIndex, 0];
21463
        }
21464
        if (extra.loc) {
21465
            this.loc = new SourceLocation();
21466
        }
21467
    }
21468
21469
    function WrappingNode(startToken) {
21470
        if (extra.range) {
21471
            this.range = [startToken.start, 0];
21472
        }
21473
        if (extra.loc) {
21474
            this.loc = new WrappingSourceLocation(startToken);
21475
        }
21476
    }
21477
21478
    WrappingNode.prototype = Node.prototype = {
21479
21480
        processComment: function () {
21481
            var lastChild,
21482
                leadingComments,
21483
                trailingComments,
21484
                bottomRight = extra.bottomRightStack,
21485
                i,
21486
                comment,
21487
                last = bottomRight[bottomRight.length - 1];
21488
21489
            if (this.type === Syntax.Program) {
21490
                if (this.body.length > 0) {
21491
                    return;
21492
                }
21493
            }
21494
21495
            if (extra.trailingComments.length > 0) {
21496
                trailingComments = [];
21497
                for (i = extra.trailingComments.length - 1; i >= 0; --i) {
21498
                    comment = extra.trailingComments[i];
21499
                    if (comment.range[0] >= this.range[1]) {
21500
                        trailingComments.unshift(comment);
21501
                        extra.trailingComments.splice(i, 1);
21502
                    }
21503
                }
21504
                extra.trailingComments = [];
21505
            } else {
21506
                if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) {
21507
                    trailingComments = last.trailingComments;
21508
                    delete last.trailingComments;
21509
                }
21510
            }
21511
21512
            // Eating the stack.
21513
            if (last) {
21514
                while (last && last.range[0] >= this.range[0]) {
21515
                    lastChild = last;
21516
                    last = bottomRight.pop();
21517
                }
21518
            }
21519
21520
            if (lastChild) {
21521
                if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= this.range[0]) {
21522
                    this.leadingComments = lastChild.leadingComments;
21523
                    lastChild.leadingComments = undefined;
21524
                }
21525
            } else if (extra.leadingComments.length > 0) {
21526
                leadingComments = [];
21527
                for (i = extra.leadingComments.length - 1; i >= 0; --i) {
21528
                    comment = extra.leadingComments[i];
21529
                    if (comment.range[1] <= this.range[0]) {
21530
                        leadingComments.unshift(comment);
21531
                        extra.leadingComments.splice(i, 1);
21532
                    }
21533
                }
21534
            }
21535
21536
21537
            if (leadingComments && leadingComments.length > 0) {
21538
                this.leadingComments = leadingComments;
21539
            }
21540
            if (trailingComments && trailingComments.length > 0) {
21541
                this.trailingComments = trailingComments;
21542
            }
21543
21544
            bottomRight.push(this);
21545
        },
21546
21547
        finish: function () {
21548
            if (extra.range) {
21549
                this.range[1] = lastIndex;
21550
            }
21551
            if (extra.loc) {
21552
                this.loc.end = {
21553
                    line: lastLineNumber,
21554
                    column: lastIndex - lastLineStart
21555
                };
21556
                if (extra.source) {
21557
                    this.loc.source = extra.source;
21558
                }
21559
            }
21560
21561
            if (extra.attachComment) {
21562
                this.processComment();
21563
            }
21564
        },
21565
21566
        finishArrayExpression: function (elements) {
21567
            this.type = Syntax.ArrayExpression;
21568
            this.elements = elements;
21569
            this.finish();
21570
            return this;
21571
        },
21572
21573
        finishArrayPattern: function (elements) {
21574
            this.type = Syntax.ArrayPattern;
21575
            this.elements = elements;
21576
            this.finish();
21577
            return this;
21578
        },
21579
21580
        finishArrowFunctionExpression: function (params, defaults, body, expression) {
21581
            this.type = Syntax.ArrowFunctionExpression;
21582
            this.id = null;
21583
            this.params = params;
21584
            this.defaults = defaults;
21585
            this.body = body;
21586
            this.generator = false;
21587
            this.expression = expression;
21588
            this.finish();
21589
            return this;
21590
        },
21591
21592
        finishAssignmentExpression: function (operator, left, right) {
21593
            this.type = Syntax.AssignmentExpression;
21594
            this.operator = operator;
21595
            this.left = left;
21596
            this.right = right;
21597
            this.finish();
21598
            return this;
21599
        },
21600
21601
        finishAssignmentPattern: function (left, right) {
21602
            this.type = Syntax.AssignmentPattern;
21603
            this.left = left;
21604
            this.right = right;
21605
            this.finish();
21606
            return this;
21607
        },
21608
21609
        finishBinaryExpression: function (operator, left, right) {
21610
            this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;
21611
            this.operator = operator;
21612
            this.left = left;
21613
            this.right = right;
21614
            this.finish();
21615
            return this;
21616
        },
21617
21618
        finishBlockStatement: function (body) {
21619
            this.type = Syntax.BlockStatement;
21620
            this.body = body;
21621
            this.finish();
21622
            return this;
21623
        },
21624
21625
        finishBreakStatement: function (label) {
21626
            this.type = Syntax.BreakStatement;
21627
            this.label = label;
21628
            this.finish();
21629
            return this;
21630
        },
21631
21632
        finishCallExpression: function (callee, args) {
21633
            this.type = Syntax.CallExpression;
21634
            this.callee = callee;
21635
            this.arguments = args;
21636
            this.finish();
21637
            return this;
21638
        },
21639
21640
        finishCatchClause: function (param, body) {
21641
            this.type = Syntax.CatchClause;
21642
            this.param = param;
21643
            this.body = body;
21644
            this.finish();
21645
            return this;
21646
        },
21647
21648
        finishClassBody: function (body) {
21649
            this.type = Syntax.ClassBody;
21650
            this.body = body;
21651
            this.finish();
21652
            return this;
21653
        },
21654
21655
        finishClassDeclaration: function (id, superClass, body) {
21656
            this.type = Syntax.ClassDeclaration;
21657
            this.id = id;
21658
            this.superClass = superClass;
21659
            this.body = body;
21660
            this.finish();
21661
            return this;
21662
        },
21663
21664
        finishClassExpression: function (id, superClass, body) {
21665
            this.type = Syntax.ClassExpression;
21666
            this.id = id;
21667
            this.superClass = superClass;
21668
            this.body = body;
21669
            this.finish();
21670
            return this;
21671
        },
21672
21673
        finishConditionalExpression: function (test, consequent, alternate) {
21674
            this.type = Syntax.ConditionalExpression;
21675
            this.test = test;
21676
            this.consequent = consequent;
21677
            this.alternate = alternate;
21678
            this.finish();
21679
            return this;
21680
        },
21681
21682
        finishContinueStatement: function (label) {
21683
            this.type = Syntax.ContinueStatement;
21684
            this.label = label;
21685
            this.finish();
21686
            return this;
21687
        },
21688
21689
        finishDebuggerStatement: function () {
21690
            this.type = Syntax.DebuggerStatement;
21691
            this.finish();
21692
            return this;
21693
        },
21694
21695
        finishDoWhileStatement: function (body, test) {
21696
            this.type = Syntax.DoWhileStatement;
21697
            this.body = body;
21698
            this.test = test;
21699
            this.finish();
21700
            return this;
21701
        },
21702
21703
        finishEmptyStatement: function () {
21704
            this.type = Syntax.EmptyStatement;
21705
            this.finish();
21706
            return this;
21707
        },
21708
21709
        finishExpressionStatement: function (expression) {
21710
            this.type = Syntax.ExpressionStatement;
21711
            this.expression = expression;
21712
            this.finish();
21713
            return this;
21714
        },
21715
21716
        finishForStatement: function (init, test, update, body) {
21717
            this.type = Syntax.ForStatement;
21718
            this.init = init;
21719
            this.test = test;
21720
            this.update = update;
21721
            this.body = body;
21722
            this.finish();
21723
            return this;
21724
        },
21725
21726
        finishForInStatement: function (left, right, body) {
21727
            this.type = Syntax.ForInStatement;
21728
            this.left = left;
21729
            this.right = right;
21730
            this.body = body;
21731
            this.each = false;
21732
            this.finish();
21733
            return this;
21734
        },
21735
21736
        finishFunctionDeclaration: function (id, params, defaults, body) {
21737
            this.type = Syntax.FunctionDeclaration;
21738
            this.id = id;
21739
            this.params = params;
21740
            this.defaults = defaults;
21741
            this.body = body;
21742
            this.generator = false;
21743
            this.expression = false;
21744
            this.finish();
21745
            return this;
21746
        },
21747
21748
        finishFunctionExpression: function (id, params, defaults, body) {
21749
            this.type = Syntax.FunctionExpression;
21750
            this.id = id;
21751
            this.params = params;
21752
            this.defaults = defaults;
21753
            this.body = body;
21754
            this.generator = false;
21755
            this.expression = false;
21756
            this.finish();
21757
            return this;
21758
        },
21759
21760
        finishIdentifier: function (name) {
21761
            this.type = Syntax.Identifier;
21762
            this.name = name;
21763
            this.finish();
21764
            return this;
21765
        },
21766
21767
        finishIfStatement: function (test, consequent, alternate) {
21768
            this.type = Syntax.IfStatement;
21769
            this.test = test;
21770
            this.consequent = consequent;
21771
            this.alternate = alternate;
21772
            this.finish();
21773
            return this;
21774
        },
21775
21776
        finishLabeledStatement: function (label, body) {
21777
            this.type = Syntax.LabeledStatement;
21778
            this.label = label;
21779
            this.body = body;
21780
            this.finish();
21781
            return this;
21782
        },
21783
21784
        finishLiteral: function (token) {
21785
            this.type = Syntax.Literal;
21786
            this.value = token.value;
21787
            this.raw = source.slice(token.start, token.end);
21788
            if (token.regex) {
21789
                this.regex = token.regex;
21790
            }
21791
            this.finish();
21792
            return this;
21793
        },
21794
21795
        finishMemberExpression: function (accessor, object, property) {
21796
            this.type = Syntax.MemberExpression;
21797
            this.computed = accessor === '[';
21798
            this.object = object;
21799
            this.property = property;
21800
            this.finish();
21801
            return this;
21802
        },
21803
21804
        finishNewExpression: function (callee, args) {
21805
            this.type = Syntax.NewExpression;
21806
            this.callee = callee;
21807
            this.arguments = args;
21808
            this.finish();
21809
            return this;
21810
        },
21811
21812
        finishObjectExpression: function (properties) {
21813
            this.type = Syntax.ObjectExpression;
21814
            this.properties = properties;
21815
            this.finish();
21816
            return this;
21817
        },
21818
21819
        finishObjectPattern: function (properties) {
21820
            this.type = Syntax.ObjectPattern;
21821
            this.properties = properties;
21822
            this.finish();
21823
            return this;
21824
        },
21825
21826
        finishPostfixExpression: function (operator, argument) {
21827
            this.type = Syntax.UpdateExpression;
21828
            this.operator = operator;
21829
            this.argument = argument;
21830
            this.prefix = false;
21831
            this.finish();
21832
            return this;
21833
        },
21834
21835
        finishProgram: function (body) {
21836
            this.type = Syntax.Program;
21837
            this.body = body;
21838
            if (sourceType === 'module') {
21839
                // very restrictive for now
21840
                this.sourceType = sourceType;
21841
            }
21842
            this.finish();
21843
            return this;
21844
        },
21845
21846
        finishProperty: function (kind, key, computed, value, method, shorthand) {
21847
            this.type = Syntax.Property;
21848
            this.key = key;
21849
            this.computed = computed;
21850
            this.value = value;
21851
            this.kind = kind;
21852
            this.method = method;
21853
            this.shorthand = shorthand;
21854
            this.finish();
21855
            return this;
21856
        },
21857
21858
        finishRestElement: function (argument) {
21859
            this.type = Syntax.RestElement;
21860
            this.argument = argument;
21861
            this.finish();
21862
            return this;
21863
        },
21864
21865
        finishReturnStatement: function (argument) {
21866
            this.type = Syntax.ReturnStatement;
21867
            this.argument = argument;
21868
            this.finish();
21869
            return this;
21870
        },
21871
21872
        finishSequenceExpression: function (expressions) {
21873
            this.type = Syntax.SequenceExpression;
21874
            this.expressions = expressions;
21875
            this.finish();
21876
            return this;
21877
        },
21878
21879
        finishSpreadElement: function (argument) {
21880
            this.type = Syntax.SpreadElement;
21881
            this.argument = argument;
21882
            this.finish();
21883
            return this;
21884
        },
21885
21886
        finishSwitchCase: function (test, consequent) {
21887
            this.type = Syntax.SwitchCase;
21888
            this.test = test;
21889
            this.consequent = consequent;
21890
            this.finish();
21891
            return this;
21892
        },
21893
21894
        finishSuper: function () {
21895
            this.type = Syntax.Super;
21896
            this.finish();
21897
            return this;
21898
        },
21899
21900
        finishSwitchStatement: function (discriminant, cases) {
21901
            this.type = Syntax.SwitchStatement;
21902
            this.discriminant = discriminant;
21903
            this.cases = cases;
21904
            this.finish();
21905
            return this;
21906
        },
21907
21908
        finishTaggedTemplateExpression: function (tag, quasi) {
21909
            this.type = Syntax.TaggedTemplateExpression;
21910
            this.tag = tag;
21911
            this.quasi = quasi;
21912
            this.finish();
21913
            return this;
21914
        },
21915
21916
        finishTemplateElement: function (value, tail) {
21917
            this.type = Syntax.TemplateElement;
21918
            this.value = value;
21919
            this.tail = tail;
21920
            this.finish();
21921
            return this;
21922
        },
21923
21924
        finishTemplateLiteral: function (quasis, expressions) {
21925
            this.type = Syntax.TemplateLiteral;
21926
            this.quasis = quasis;
21927
            this.expressions = expressions;
21928
            this.finish();
21929
            return this;
21930
        },
21931
21932
        finishThisExpression: function () {
21933
            this.type = Syntax.ThisExpression;
21934
            this.finish();
21935
            return this;
21936
        },
21937
21938
        finishThrowStatement: function (argument) {
21939
            this.type = Syntax.ThrowStatement;
21940
            this.argument = argument;
21941
            this.finish();
21942
            return this;
21943
        },
21944
21945
        finishTryStatement: function (block, handler, finalizer) {
21946
            this.type = Syntax.TryStatement;
21947
            this.block = block;
21948
            this.guardedHandlers = [];
21949
            this.handlers = handler ? [ handler ] : [];
21950
            this.handler = handler;
21951
            this.finalizer = finalizer;
21952
            this.finish();
21953
            return this;
21954
        },
21955
21956
        finishUnaryExpression: function (operator, argument) {
21957
            this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression;
21958
            this.operator = operator;
21959
            this.argument = argument;
21960
            this.prefix = true;
21961
            this.finish();
21962
            return this;
21963
        },
21964
21965
        finishVariableDeclaration: function (declarations) {
21966
            this.type = Syntax.VariableDeclaration;
21967
            this.declarations = declarations;
21968
            this.kind = 'var';
21969
            this.finish();
21970
            return this;
21971
        },
21972
21973
        finishLexicalDeclaration: function (declarations, kind) {
21974
            this.type = Syntax.VariableDeclaration;
21975
            this.declarations = declarations;
21976
            this.kind = kind;
21977
            this.finish();
21978
            return this;
21979
        },
21980
21981
        finishVariableDeclarator: function (id, init) {
21982
            this.type = Syntax.VariableDeclarator;
21983
            this.id = id;
21984
            this.init = init;
21985
            this.finish();
21986
            return this;
21987
        },
21988
21989
        finishWhileStatement: function (test, body) {
21990
            this.type = Syntax.WhileStatement;
21991
            this.test = test;
21992
            this.body = body;
21993
            this.finish();
21994
            return this;
21995
        },
21996
21997
        finishWithStatement: function (object, body) {
21998
            this.type = Syntax.WithStatement;
21999
            this.object = object;
22000
            this.body = body;
22001
            this.finish();
22002
            return this;
22003
        },
22004
22005
        finishExportSpecifier: function (local, exported) {
22006
            this.type = Syntax.ExportSpecifier;
22007
            this.exported = exported || local;
22008
            this.local = local;
22009
            this.finish();
22010
            return this;
22011
        },
22012
22013
        finishImportDefaultSpecifier: function (local) {
22014
            this.type = Syntax.ImportDefaultSpecifier;
22015
            this.local = local;
22016
            this.finish();
22017
            return this;
22018
        },
22019
22020
        finishImportNamespaceSpecifier: function (local) {
22021
            this.type = Syntax.ImportNamespaceSpecifier;
22022
            this.local = local;
22023
            this.finish();
22024
            return this;
22025
        },
22026
22027
        finishExportNamedDeclaration: function (declaration, specifiers, src) {
22028
            this.type = Syntax.ExportNamedDeclaration;
22029
            this.declaration = declaration;
22030
            this.specifiers = specifiers;
22031
            this.source = src;
22032
            this.finish();
22033
            return this;
22034
        },
22035
22036
        finishExportDefaultDeclaration: function (declaration) {
22037
            this.type = Syntax.ExportDefaultDeclaration;
22038
            this.declaration = declaration;
22039
            this.finish();
22040
            return this;
22041
        },
22042
22043
        finishExportAllDeclaration: function (src) {
22044
            this.type = Syntax.ExportAllDeclaration;
22045
            this.source = src;
22046
            this.finish();
22047
            return this;
22048
        },
22049
22050
        finishImportSpecifier: function (local, imported) {
22051
            this.type = Syntax.ImportSpecifier;
22052
            this.local = local || imported;
22053
            this.imported = imported;
22054
            this.finish();
22055
            return this;
22056
        },
22057
22058
        finishImportDeclaration: function (specifiers, src) {
22059
            this.type = Syntax.ImportDeclaration;
22060
            this.specifiers = specifiers;
22061
            this.source = src;
22062
            this.finish();
22063
            return this;
22064
        }
22065
    };
22066
22067
22068
    function recordError(error) {
22069
        var e, existing;
22070
22071
        for (e = 0; e < extra.errors.length; e++) {
22072
            existing = extra.errors[e];
22073
            // Prevent duplicated error.
22074
            /* istanbul ignore next */
22075
            if (existing.index === error.index && existing.message === error.message) {
22076
                return;
22077
            }
22078
        }
22079
22080
        extra.errors.push(error);
22081
    }
22082
22083
    function createError(line, pos, description) {
22084
        var error = new Error('Line ' + line + ': ' + description);
22085
        error.index = pos;
22086
        error.lineNumber = line;
22087
        error.column = pos - (scanning ? lineStart : lastLineStart) + 1;
22088
        error.description = description;
22089
        return error;
22090
    }
22091
22092
    // Throw an exception
22093
22094
    function throwError(messageFormat) {
22095
        var args, msg;
22096
22097
        args = Array.prototype.slice.call(arguments, 1);
22098
        msg = messageFormat.replace(/%(\d)/g,
22099
            function (whole, idx) {
22100
                assert(idx < args.length, 'Message reference must be in range');
22101
                return args[idx];
22102
            }
22103
        );
22104
22105
        throw createError(lastLineNumber, lastIndex, msg);
22106
    }
22107
22108
    function tolerateError(messageFormat) {
22109
        var args, msg, error;
22110
22111
        args = Array.prototype.slice.call(arguments, 1);
22112
        /* istanbul ignore next */
22113
        msg = messageFormat.replace(/%(\d)/g,
22114
            function (whole, idx) {
22115
                assert(idx < args.length, 'Message reference must be in range');
22116
                return args[idx];
22117
            }
22118
        );
22119
22120
        error = createError(lineNumber, lastIndex, msg);
22121
        if (extra.errors) {
22122
            recordError(error);
22123
        } else {
22124
            throw error;
22125
        }
22126
    }
22127
22128
    // Throw an exception because of the token.
22129
22130
    function unexpectedTokenError(token, message) {
22131
        var value, msg = message || Messages.UnexpectedToken;
22132
22133
        if (token) {
22134
            if (!message) {
22135
                msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :
22136
                    (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :
22137
                    (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :
22138
                    (token.type === Token.StringLiteral) ? Messages.UnexpectedString :
22139
                    (token.type === Token.Template) ? Messages.UnexpectedTemplate :
22140
                    Messages.UnexpectedToken;
22141
22142
                if (token.type === Token.Keyword) {
22143
                    if (isFutureReservedWord(token.value)) {
22144
                        msg = Messages.UnexpectedReserved;
22145
                    } else if (strict && isStrictModeReservedWord(token.value)) {
22146
                        msg = Messages.StrictReservedWord;
22147
                    }
22148
                }
22149
            }
22150
22151
            value = (token.type === Token.Template) ? token.value.raw : token.value;
22152
        } else {
22153
            value = 'ILLEGAL';
22154
        }
22155
22156
        msg = msg.replace('%0', value);
22157
22158
        return (token && typeof token.lineNumber === 'number') ?
22159
            createError(token.lineNumber, token.start, msg) :
22160
            createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);
22161
    }
22162
22163
    function throwUnexpectedToken(token, message) {
22164
        throw unexpectedTokenError(token, message);
22165
    }
22166
22167
    function tolerateUnexpectedToken(token, message) {
22168
        var error = unexpectedTokenError(token, message);
22169
        if (extra.errors) {
22170
            recordError(error);
22171
        } else {
22172
            throw error;
22173
        }
22174
    }
22175
22176
    // Expect the next token to match the specified punctuator.
22177
    // If not, an exception will be thrown.
22178
22179
    function expect(value) {
22180
        var token = lex();
22181
        if (token.type !== Token.Punctuator || token.value !== value) {
22182
            throwUnexpectedToken(token);
22183
        }
22184
    }
22185
22186
    /**
22187
     * @name expectCommaSeparator
22188
     * @description Quietly expect a comma when in tolerant mode, otherwise delegates
22189
     * to <code>expect(value)</code>
22190
     * @since 2.0
22191
     */
22192
    function expectCommaSeparator() {
22193
        var token;
22194
22195
        if (extra.errors) {
22196
            token = lookahead;
22197
            if (token.type === Token.Punctuator && token.value === ',') {
22198
                lex();
22199
            } else if (token.type === Token.Punctuator && token.value === ';') {
22200
                lex();
22201
                tolerateUnexpectedToken(token);
22202
            } else {
22203
                tolerateUnexpectedToken(token, Messages.UnexpectedToken);
22204
            }
22205
        } else {
22206
            expect(',');
22207
        }
22208
    }
22209
22210
    // Expect the next token to match the specified keyword.
22211
    // If not, an exception will be thrown.
22212
22213
    function expectKeyword(keyword) {
22214
        var token = lex();
22215
        if (token.type !== Token.Keyword || token.value !== keyword) {
22216
            throwUnexpectedToken(token);
22217
        }
22218
    }
22219
22220
    // Return true if the next token matches the specified punctuator.
22221
22222
    function match(value) {
22223
        return lookahead.type === Token.Punctuator && lookahead.value === value;
22224
    }
22225
22226
    // Return true if the next token matches the specified keyword
22227
22228
    function matchKeyword(keyword) {
22229
        return lookahead.type === Token.Keyword && lookahead.value === keyword;
22230
    }
22231
22232
    // Return true if the next token matches the specified contextual keyword
22233
    // (where an identifier is sometimes a keyword depending on the context)
22234
22235
    function matchContextualKeyword(keyword) {
22236
        return lookahead.type === Token.Identifier && lookahead.value === keyword;
22237
    }
22238
22239
    // Return true if the next token is an assignment operator
22240
22241
    function matchAssign() {
22242
        var op;
22243
22244
        if (lookahead.type !== Token.Punctuator) {
22245
            return false;
22246
        }
22247
        op = lookahead.value;
22248
        return op === '=' ||
22249
            op === '*=' ||
22250
            op === '/=' ||
22251
            op === '%=' ||
22252
            op === '+=' ||
22253
            op === '-=' ||
22254
            op === '<<=' ||
22255
            op === '>>=' ||
22256
            op === '>>>=' ||
22257
            op === '&=' ||
22258
            op === '^=' ||
22259
            op === '|=';
22260
    }
22261
22262
    function consumeSemicolon() {
22263
        // Catch the very common case first: immediately a semicolon (U+003B).
22264
        if (source.charCodeAt(startIndex) === 0x3B || match(';')) {
22265
            lex();
22266
            return;
22267
        }
22268
22269
        if (hasLineTerminator) {
22270
            return;
22271
        }
22272
22273
        // FIXME(ikarienator): this is seemingly an issue in the previous location info convention.
22274
        lastIndex = startIndex;
22275
        lastLineNumber = startLineNumber;
22276
        lastLineStart = startLineStart;
22277
22278
        if (lookahead.type !== Token.EOF && !match('}')) {
22279
            throwUnexpectedToken(lookahead);
22280
        }
22281
    }
22282
22283
    // Cover grammar support.
22284
    //
22285
    // When an assignment expression position starts with an left parenthesis, the determination of the type
22286
    // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
22287
    // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
22288
    //
22289
    // There are three productions that can be parsed in a parentheses pair that needs to be determined
22290
    // after the outermost pair is closed. They are:
22291
    //
22292
    //   1. AssignmentExpression
22293
    //   2. BindingElements
22294
    //   3. AssignmentTargets
22295
    //
22296
    // In order to avoid exponential backtracking, we use two flags to denote if the production can be
22297
    // binding element or assignment target.
22298
    //
22299
    // The three productions have the relationship:
22300
    //
22301
    //   BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
22302
    //
22303
    // with a single exception that CoverInitializedName when used directly in an Expression, generates
22304
    // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
22305
    // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
22306
    //
22307
    // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
22308
    // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
22309
    // the CoverInitializedName check is conducted.
22310
    //
22311
    // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
22312
    // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
22313
    // pattern. The CoverInitializedName check is deferred.
22314
    function isolateCoverGrammar(parser) {
22315
        var oldIsBindingElement = isBindingElement,
22316
            oldIsAssignmentTarget = isAssignmentTarget,
22317
            oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
22318
            result;
22319
        isBindingElement = true;
22320
        isAssignmentTarget = true;
22321
        firstCoverInitializedNameError = null;
22322
        result = parser();
22323
        if (firstCoverInitializedNameError !== null) {
22324
            throwUnexpectedToken(firstCoverInitializedNameError);
22325
        }
22326
        isBindingElement = oldIsBindingElement;
22327
        isAssignmentTarget = oldIsAssignmentTarget;
22328
        firstCoverInitializedNameError = oldFirstCoverInitializedNameError;
22329
        return result;
22330
    }
22331
22332
    function inheritCoverGrammar(parser) {
22333
        var oldIsBindingElement = isBindingElement,
22334
            oldIsAssignmentTarget = isAssignmentTarget,
22335
            oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
22336
            result;
22337
        isBindingElement = true;
22338
        isAssignmentTarget = true;
22339
        firstCoverInitializedNameError = null;
22340
        result = parser();
22341
        isBindingElement = isBindingElement && oldIsBindingElement;
22342
        isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget;
22343
        firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError;
22344
        return result;
22345
    }
22346
22347
    function parseArrayPattern() {
22348
        var node = new Node(), elements = [], rest, restNode;
22349
        expect('[');
22350
22351
        while (!match(']')) {
22352
            if (match(',')) {
22353
                lex();
22354
                elements.push(null);
22355
            } else {
22356
                if (match('...')) {
22357
                    restNode = new Node();
22358
                    lex();
22359
                    rest = parseVariableIdentifier();
22360
                    elements.push(restNode.finishRestElement(rest));
22361
                    break;
22362
                } else {
22363
                    elements.push(parsePatternWithDefault());
22364
                }
22365
                if (!match(']')) {
22366
                    expect(',');
22367
                }
22368
            }
22369
22370
        }
22371
22372
        expect(']');
22373
22374
        return node.finishArrayPattern(elements);
22375
    }
22376
22377
    function parsePropertyPattern() {
22378
        var node = new Node(), key, computed = match('['), init;
22379
        if (lookahead.type === Token.Identifier) {
22380
            key = parseVariableIdentifier();
22381
            if (match('=')) {
22382
                lex();
22383
                init = parseAssignmentExpression();
22384
                return node.finishProperty(
22385
                    'init', key, false,
22386
                    new WrappingNode(key).finishAssignmentPattern(key, init), false, false);
22387
            } else if (!match(':')) {
22388
                return node.finishProperty('init', key, false, key, false, true);
22389
            }
22390
        } else {
22391
            key = parseObjectPropertyKey();
22392
        }
22393
        expect(':');
22394
        init = parsePatternWithDefault();
22395
        return node.finishProperty('init', key, computed, init, false, false);
22396
    }
22397
22398
    function parseObjectPattern() {
22399
        var node = new Node(), properties = [];
22400
22401
        expect('{');
22402
22403
        while (!match('}')) {
22404
            properties.push(parsePropertyPattern());
22405
            if (!match('}')) {
22406
                expect(',');
22407
            }
22408
        }
22409
22410
        lex();
22411
22412
        return node.finishObjectPattern(properties);
22413
    }
22414
22415
    function parsePattern() {
22416
        if (lookahead.type === Token.Identifier) {
22417
            return parseVariableIdentifier();
22418
        } else if (match('[')) {
22419
            return parseArrayPattern();
22420
        } else if (match('{')) {
22421
            return parseObjectPattern();
22422
        }
22423
        throwUnexpectedToken(lookahead);
22424
    }
22425
22426
    function parsePatternWithDefault() {
22427
        var startToken = lookahead, pattern, right;
22428
        pattern = parsePattern();
22429
        if (match('=')) {
22430
            lex();
22431
            right = isolateCoverGrammar(parseAssignmentExpression);
22432
            pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right);
22433
        }
22434
        return pattern;
22435
    }
22436
22437
    // 11.1.4 Array Initialiser
22438
22439
    function parseArrayInitialiser() {
22440
        var elements = [], node = new Node(), restSpread;
22441
22442
        expect('[');
22443
22444
        while (!match(']')) {
22445
            if (match(',')) {
22446
                lex();
22447
                elements.push(null);
22448
            } else if (match('...')) {
22449
                restSpread = new Node();
22450
                lex();
22451
                restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));
22452
22453
                if (!match(']')) {
22454
                    isAssignmentTarget = isBindingElement = false;
22455
                    expect(',');
22456
                }
22457
                elements.push(restSpread);
22458
            } else {
22459
                elements.push(inheritCoverGrammar(parseAssignmentExpression));
22460
22461
                if (!match(']')) {
22462
                    expect(',');
22463
                }
22464
            }
22465
        }
22466
22467
        lex();
22468
22469
        return node.finishArrayExpression(elements);
22470
    }
22471
22472
    // 11.1.5 Object Initialiser
22473
22474
    function parsePropertyFunction(node, paramInfo) {
22475
        var previousStrict, body;
22476
22477
        isAssignmentTarget = isBindingElement = false;
22478
22479
        previousStrict = strict;
22480
        body = isolateCoverGrammar(parseFunctionSourceElements);
22481
22482
        if (strict && paramInfo.firstRestricted) {
22483
            tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);
22484
        }
22485
        if (strict && paramInfo.stricted) {
22486
            tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);
22487
        }
22488
22489
        strict = previousStrict;
22490
        return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body);
22491
    }
22492
22493
    function parsePropertyMethodFunction() {
22494
        var params, method, node = new Node();
22495
22496
        params = parseParams();
22497
        method = parsePropertyFunction(node, params);
22498
22499
        return method;
22500
    }
22501
22502
    function parseObjectPropertyKey() {
22503
        var token, node = new Node(), expr;
22504
22505
        token = lex();
22506
22507
        // Note: This function is called only from parseObjectProperty(), where
22508
        // EOF and Punctuator tokens are already filtered out.
22509
22510
        switch (token.type) {
22511
        case Token.StringLiteral:
22512
        case Token.NumericLiteral:
22513
            if (strict && token.octal) {
22514
                tolerateUnexpectedToken(token, Messages.StrictOctalLiteral);
22515
            }
22516
            return node.finishLiteral(token);
22517
        case Token.Identifier:
22518
        case Token.BooleanLiteral:
22519
        case Token.NullLiteral:
22520
        case Token.Keyword:
22521
            return node.finishIdentifier(token.value);
22522
        case Token.Punctuator:
22523
            if (token.value === '[') {
22524
                expr = isolateCoverGrammar(parseAssignmentExpression);
22525
                expect(']');
22526
                return expr;
22527
            }
22528
            break;
22529
        }
22530
        throwUnexpectedToken(token);
22531
    }
22532
22533
    function lookaheadPropertyName() {
22534
        switch (lookahead.type) {
22535
        case Token.Identifier:
22536
        case Token.StringLiteral:
22537
        case Token.BooleanLiteral:
22538
        case Token.NullLiteral:
22539
        case Token.NumericLiteral:
22540
        case Token.Keyword:
22541
            return true;
22542
        case Token.Punctuator:
22543
            return lookahead.value === '[';
22544
        }
22545
        return false;
22546
    }
22547
22548
    // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals,
22549
    // it might be called at a position where there is in fact a short hand identifier pattern or a data property.
22550
    // This can only be determined after we consumed up to the left parentheses.
22551
    //
22552
    // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller
22553
    // is responsible to visit other options.
22554
    function tryParseMethodDefinition(token, key, computed, node) {
22555
        var value, options, methodNode;
22556
22557
        if (token.type === Token.Identifier) {
22558
            // check for `get` and `set`;
22559
22560
            if (token.value === 'get' && lookaheadPropertyName()) {
22561
                computed = match('[');
22562
                key = parseObjectPropertyKey();
22563
                methodNode = new Node();
22564
                expect('(');
22565
                expect(')');
22566
                value = parsePropertyFunction(methodNode, {
22567
                    params: [],
22568
                    defaults: [],
22569
                    stricted: null,
22570
                    firstRestricted: null,
22571
                    message: null
22572
                });
22573
                return node.finishProperty('get', key, computed, value, false, false);
22574
            } else if (token.value === 'set' && lookaheadPropertyName()) {
22575
                computed = match('[');
22576
                key = parseObjectPropertyKey();
22577
                methodNode = new Node();
22578
                expect('(');
22579
22580
                options = {
22581
                    params: [],
22582
                    defaultCount: 0,
22583
                    defaults: [],
22584
                    firstRestricted: null,
22585
                    paramSet: {}
22586
                };
22587
                if (match(')')) {
22588
                    tolerateUnexpectedToken(lookahead);
22589
                } else {
22590
                    parseParam(options);
22591
                    if (options.defaultCount === 0) {
22592
                        options.defaults = [];
22593
                    }
22594
                }
22595
                expect(')');
22596
22597
                value = parsePropertyFunction(methodNode, options);
22598
                return node.finishProperty('set', key, computed, value, false, false);
22599
            }
22600
        }
22601
22602
        if (match('(')) {
22603
            value = parsePropertyMethodFunction();
22604
            return node.finishProperty('init', key, computed, value, true, false);
22605
        }
22606
22607
        // Not a MethodDefinition.
22608
        return null;
22609
    }
22610
22611
    function checkProto(key, computed, hasProto) {
22612
        if (computed === false && (key.type === Syntax.Identifier && key.name === '__proto__' ||
22613
            key.type === Syntax.Literal && key.value === '__proto__')) {
22614
            if (hasProto.value) {
22615
                tolerateError(Messages.DuplicateProtoProperty);
22616
            } else {
22617
                hasProto.value = true;
22618
            }
22619
        }
22620
    }
22621
22622
    function parseObjectProperty(hasProto) {
22623
        var token = lookahead, node = new Node(), computed, key, maybeMethod, value;
22624
22625
        computed = match('[');
22626
        key = parseObjectPropertyKey();
22627
        maybeMethod = tryParseMethodDefinition(token, key, computed, node);
22628
22629
        if (maybeMethod) {
22630
            checkProto(maybeMethod.key, maybeMethod.computed, hasProto);
22631
            // finished
22632
            return maybeMethod;
22633
        }
22634
22635
        // init property or short hand property.
22636
        checkProto(key, computed, hasProto);
22637
22638
        if (match(':')) {
22639
            lex();
22640
            value = inheritCoverGrammar(parseAssignmentExpression);
22641
            return node.finishProperty('init', key, computed, value, false, false);
22642
        }
22643
22644
        if (token.type === Token.Identifier) {
22645
            if (match('=')) {
22646
                firstCoverInitializedNameError = lookahead;
22647
                lex();
22648
                value = isolateCoverGrammar(parseAssignmentExpression);
22649
                return node.finishProperty('init', key, computed,
22650
                    new WrappingNode(token).finishAssignmentPattern(key, value), false, true);
22651
            }
22652
            return node.finishProperty('init', key, computed, key, false, true);
22653
        }
22654
22655
        throwUnexpectedToken(lookahead);
22656
    }
22657
22658
    function parseObjectInitialiser() {
22659
        var properties = [], hasProto = {value: false}, node = new Node();
22660
22661
        expect('{');
22662
22663
        while (!match('}')) {
22664
            properties.push(parseObjectProperty(hasProto));
22665
22666
            if (!match('}')) {
22667
                expectCommaSeparator();
22668
            }
22669
        }
22670
22671
        expect('}');
22672
22673
        return node.finishObjectExpression(properties);
22674
    }
22675
22676
    function reinterpretExpressionAsPattern(expr) {
22677
        var i;
22678
        switch (expr.type) {
22679
        case Syntax.Identifier:
22680
        case Syntax.MemberExpression:
22681
        case Syntax.RestElement:
22682
        case Syntax.AssignmentPattern:
22683
            break;
22684
        case Syntax.SpreadElement:
22685
            expr.type = Syntax.RestElement;
22686
            reinterpretExpressionAsPattern(expr.argument);
22687
            break;
22688
        case Syntax.ArrayExpression:
22689
            expr.type = Syntax.ArrayPattern;
22690
            for (i = 0; i < expr.elements.length; i++) {
22691
                if (expr.elements[i] !== null) {
22692
                    reinterpretExpressionAsPattern(expr.elements[i]);
22693
                }
22694
            }
22695
            break;
22696
        case Syntax.ObjectExpression:
22697
            expr.type = Syntax.ObjectPattern;
22698
            for (i = 0; i < expr.properties.length; i++) {
22699
                reinterpretExpressionAsPattern(expr.properties[i].value);
22700
            }
22701
            break;
22702
        case Syntax.AssignmentExpression:
22703
            expr.type = Syntax.AssignmentPattern;
22704
            reinterpretExpressionAsPattern(expr.left);
22705
            break;
22706
        default:
22707
            // Allow other node type for tolerant parsing.
22708
            break;
22709
        }
22710
    }
22711
22712
    function parseTemplateElement(option) {
22713
        var node, token;
22714
22715
        if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
22716
            throwUnexpectedToken();
22717
        }
22718
22719
        node = new Node();
22720
        token = lex();
22721
22722
        return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
22723
    }
22724
22725
    function parseTemplateLiteral() {
22726
        var quasi, quasis, expressions, node = new Node();
22727
22728
        quasi = parseTemplateElement({ head: true });
22729
        quasis = [ quasi ];
22730
        expressions = [];
22731
22732
        while (!quasi.tail) {
22733
            expressions.push(parseExpression());
22734
            quasi = parseTemplateElement({ head: false });
22735
            quasis.push(quasi);
22736
        }
22737
22738
        return node.finishTemplateLiteral(quasis, expressions);
22739
    }
22740
22741
    // 11.1.6 The Grouping Operator
22742
22743
    function parseGroupExpression() {
22744
        var expr, expressions, startToken, i;
22745
22746
        expect('(');
22747
22748
        if (match(')')) {
22749
            lex();
22750
            if (!match('=>')) {
22751
                expect('=>');
22752
            }
22753
            return {
22754
                type: PlaceHolders.ArrowParameterPlaceHolder,
22755
                params: []
22756
            };
22757
        }
22758
22759
        startToken = lookahead;
22760
        if (match('...')) {
22761
            expr = parseRestElement();
22762
            expect(')');
22763
            if (!match('=>')) {
22764
                expect('=>');
22765
            }
22766
            return {
22767
                type: PlaceHolders.ArrowParameterPlaceHolder,
22768
                params: [expr]
22769
            };
22770
        }
22771
22772
        isBindingElement = true;
22773
        expr = inheritCoverGrammar(parseAssignmentExpression);
22774
22775
        if (match(',')) {
22776
            isAssignmentTarget = false;
22777
            expressions = [expr];
22778
22779
            while (startIndex < length) {
22780
                if (!match(',')) {
22781
                    break;
22782
                }
22783
                lex();
22784
22785
                if (match('...')) {
22786
                    if (!isBindingElement) {
22787
                        throwUnexpectedToken(lookahead);
22788
                    }
22789
                    expressions.push(parseRestElement());
22790
                    expect(')');
22791
                    if (!match('=>')) {
22792
                        expect('=>');
22793
                    }
22794
                    isBindingElement = false;
22795
                    for (i = 0; i < expressions.length; i++) {
22796
                        reinterpretExpressionAsPattern(expressions[i]);
22797
                    }
22798
                    return {
22799
                        type: PlaceHolders.ArrowParameterPlaceHolder,
22800
                        params: expressions
22801
                    };
22802
                }
22803
22804
                expressions.push(inheritCoverGrammar(parseAssignmentExpression));
22805
            }
22806
22807
            expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
22808
        }
22809
22810
22811
        expect(')');
22812
22813
        if (match('=>')) {
22814
            if (!isBindingElement) {
22815
                throwUnexpectedToken(lookahead);
22816
            }
22817
22818
            if (expr.type === Syntax.SequenceExpression) {
22819
                for (i = 0; i < expr.expressions.length; i++) {
22820
                    reinterpretExpressionAsPattern(expr.expressions[i]);
22821
                }
22822
            } else {
22823
                reinterpretExpressionAsPattern(expr);
22824
            }
22825
22826
            expr = {
22827
                type: PlaceHolders.ArrowParameterPlaceHolder,
22828
                params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
22829
            };
22830
        }
22831
        isBindingElement = false;
22832
        return expr;
22833
    }
22834
22835
22836
    // 11.1 Primary Expressions
22837
22838
    function parsePrimaryExpression() {
22839
        var type, token, expr, node;
22840
22841
        if (match('(')) {
22842
            isBindingElement = false;
22843
            return inheritCoverGrammar(parseGroupExpression);
22844
        }
22845
22846
        if (match('[')) {
22847
            return inheritCoverGrammar(parseArrayInitialiser);
22848
        }
22849
22850
        if (match('{')) {
22851
            return inheritCoverGrammar(parseObjectInitialiser);
22852
        }
22853
22854
        type = lookahead.type;
22855
        node = new Node();
22856
22857
        if (type === Token.Identifier) {
22858
            expr = node.finishIdentifier(lex().value);
22859
        } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
22860
            isAssignmentTarget = isBindingElement = false;
22861
            if (strict && lookahead.octal) {
22862
                tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);
22863
            }
22864
            expr = node.finishLiteral(lex());
22865
        } else if (type === Token.Keyword) {
22866
            isAssignmentTarget = isBindingElement = false;
22867
            if (matchKeyword('function')) {
22868
                return parseFunctionExpression();
22869
            }
22870
            if (matchKeyword('this')) {
22871
                lex();
22872
                return node.finishThisExpression();
22873
            }
22874
            if (matchKeyword('class')) {
22875
                return parseClassExpression();
22876
            }
22877
            throwUnexpectedToken(lex());
22878
        } else if (type === Token.BooleanLiteral) {
22879
            isAssignmentTarget = isBindingElement = false;
22880
            token = lex();
22881
            token.value = (token.value === 'true');
22882
            expr = node.finishLiteral(token);
22883
        } else if (type === Token.NullLiteral) {
22884
            isAssignmentTarget = isBindingElement = false;
22885
            token = lex();
22886
            token.value = null;
22887
            expr = node.finishLiteral(token);
22888
        } else if (match('/') || match('/=')) {
22889
            isAssignmentTarget = isBindingElement = false;
22890
            index = startIndex;
22891
22892
            if (typeof extra.tokens !== 'undefined') {
22893
                token = collectRegex();
22894
            } else {
22895
                token = scanRegExp();
22896
            }
22897
            lex();
22898
            expr = node.finishLiteral(token);
22899
        } else if (type === Token.Template) {
22900
            expr = parseTemplateLiteral();
22901
        } else {
22902
            throwUnexpectedToken(lex());
22903
        }
22904
22905
        return expr;
22906
    }
22907
22908
    // 11.2 Left-Hand-Side Expressions
22909
22910
    function parseArguments() {
22911
        var args = [];
22912
22913
        expect('(');
22914
22915
        if (!match(')')) {
22916
            while (startIndex < length) {
22917
                args.push(isolateCoverGrammar(parseAssignmentExpression));
22918
                if (match(')')) {
22919
                    break;
22920
                }
22921
                expectCommaSeparator();
22922
            }
22923
        }
22924
22925
        expect(')');
22926
22927
        return args;
22928
    }
22929
22930
    function parseNonComputedProperty() {
22931
        var token, node = new Node();
22932
22933
        token = lex();
22934
22935
        if (!isIdentifierName(token)) {
22936
            throwUnexpectedToken(token);
22937
        }
22938
22939
        return node.finishIdentifier(token.value);
22940
    }
22941
22942
    function parseNonComputedMember() {
22943
        expect('.');
22944
22945
        return parseNonComputedProperty();
22946
    }
22947
22948
    function parseComputedMember() {
22949
        var expr;
22950
22951
        expect('[');
22952
22953
        expr = isolateCoverGrammar(parseExpression);
22954
22955
        expect(']');
22956
22957
        return expr;
22958
    }
22959
22960
    function parseNewExpression() {
22961
        var callee, args, node = new Node();
22962
22963
        expectKeyword('new');
22964
        callee = isolateCoverGrammar(parseLeftHandSideExpression);
22965
        args = match('(') ? parseArguments() : [];
22966
22967
        isAssignmentTarget = isBindingElement = false;
22968
22969
        return node.finishNewExpression(callee, args);
22970
    }
22971
22972
    function parseLeftHandSideExpressionAllowCall() {
22973
        var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
22974
22975
        startToken = lookahead;
22976
        state.allowIn = true;
22977
22978
        if (matchKeyword('super') && state.inFunctionBody) {
22979
            expr = new Node();
22980
            lex();
22981
            expr = expr.finishSuper();
22982
            if (!match('(') && !match('.') && !match('[')) {
22983
                throwUnexpectedToken(lookahead);
22984
            }
22985
        } else {
22986
            expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
22987
        }
22988
22989
        for (;;) {
22990
            if (match('.')) {
22991
                isBindingElement = false;
22992
                isAssignmentTarget = true;
22993
                property = parseNonComputedMember();
22994
                expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
22995
            } else if (match('(')) {
22996
                isBindingElement = false;
22997
                isAssignmentTarget = false;
22998
                args = parseArguments();
22999
                expr = new WrappingNode(startToken).finishCallExpression(expr, args);
23000
            } else if (match('[')) {
23001
                isBindingElement = false;
23002
                isAssignmentTarget = true;
23003
                property = parseComputedMember();
23004
                expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
23005
            } else if (lookahead.type === Token.Template && lookahead.head) {
23006
                quasi = parseTemplateLiteral();
23007
                expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
23008
            } else {
23009
                break;
23010
            }
23011
        }
23012
        state.allowIn = previousAllowIn;
23013
23014
        return expr;
23015
    }
23016
23017
    function parseLeftHandSideExpression() {
23018
        var quasi, expr, property, startToken;
23019
        assert(state.allowIn, 'callee of new expression always allow in keyword.');
23020
23021
        startToken = lookahead;
23022
23023
        if (matchKeyword('super') && state.inFunctionBody) {
23024
            expr = new Node();
23025
            lex();
23026
            expr = expr.finishSuper();
23027
            if (!match('[') && !match('.')) {
23028
                throwUnexpectedToken(lookahead);
23029
            }
23030
        } else {
23031
            expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
23032
        }
23033
23034
        for (;;) {
23035
            if (match('[')) {
23036
                isBindingElement = false;
23037
                isAssignmentTarget = true;
23038
                property = parseComputedMember();
23039
                expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
23040
            } else if (match('.')) {
23041
                isBindingElement = false;
23042
                isAssignmentTarget = true;
23043
                property = parseNonComputedMember();
23044
                expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
23045
            } else if (lookahead.type === Token.Template && lookahead.head) {
23046
                quasi = parseTemplateLiteral();
23047
                expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
23048
            } else {
23049
                break;
23050
            }
23051
        }
23052
        return expr;
23053
    }
23054
23055
    // 11.3 Postfix Expressions
23056
23057
    function parsePostfixExpression() {
23058
        var expr, token, startToken = lookahead;
23059
23060
        expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
23061
23062
        if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
23063
            if (match('++') || match('--')) {
23064
                // 11.3.1, 11.3.2
23065
                if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23066
                    tolerateError(Messages.StrictLHSPostfix);
23067
                }
23068
23069
                if (!isAssignmentTarget) {
23070
                    tolerateError(Messages.InvalidLHSInAssignment);
23071
                }
23072
23073
                isAssignmentTarget = isBindingElement = false;
23074
23075
                token = lex();
23076
                expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);
23077
            }
23078
        }
23079
23080
        return expr;
23081
    }
23082
23083
    // 11.4 Unary Operators
23084
23085
    function parseUnaryExpression() {
23086
        var token, expr, startToken;
23087
23088
        if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
23089
            expr = parsePostfixExpression();
23090
        } else if (match('++') || match('--')) {
23091
            startToken = lookahead;
23092
            token = lex();
23093
            expr = inheritCoverGrammar(parseUnaryExpression);
23094
            // 11.4.4, 11.4.5
23095
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23096
                tolerateError(Messages.StrictLHSPrefix);
23097
            }
23098
23099
            if (!isAssignmentTarget) {
23100
                tolerateError(Messages.InvalidLHSInAssignment);
23101
            }
23102
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23103
            isAssignmentTarget = isBindingElement = false;
23104
        } else if (match('+') || match('-') || match('~') || match('!')) {
23105
            startToken = lookahead;
23106
            token = lex();
23107
            expr = inheritCoverGrammar(parseUnaryExpression);
23108
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23109
            isAssignmentTarget = isBindingElement = false;
23110
        } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
23111
            startToken = lookahead;
23112
            token = lex();
23113
            expr = inheritCoverGrammar(parseUnaryExpression);
23114
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23115
            if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
23116
                tolerateError(Messages.StrictDelete);
23117
            }
23118
            isAssignmentTarget = isBindingElement = false;
23119
        } else {
23120
            expr = parsePostfixExpression();
23121
        }
23122
23123
        return expr;
23124
    }
23125
23126
    function binaryPrecedence(token, allowIn) {
23127
        var prec = 0;
23128
23129
        if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
23130
            return 0;
23131
        }
23132
23133
        switch (token.value) {
23134
        case '||':
23135
            prec = 1;
23136
            break;
23137
23138
        case '&&':
23139
            prec = 2;
23140
            break;
23141
23142
        case '|':
23143
            prec = 3;
23144
            break;
23145
23146
        case '^':
23147
            prec = 4;
23148
            break;
23149
23150
        case '&':
23151
            prec = 5;
23152
            break;
23153
23154
        case '==':
23155
        case '!=':
23156
        case '===':
23157
        case '!==':
23158
            prec = 6;
23159
            break;
23160
23161
        case '<':
23162
        case '>':
23163
        case '<=':
23164
        case '>=':
23165
        case 'instanceof':
23166
            prec = 7;
23167
            break;
23168
23169
        case 'in':
23170
            prec = allowIn ? 7 : 0;
23171
            break;
23172
23173
        case '<<':
23174
        case '>>':
23175
        case '>>>':
23176
            prec = 8;
23177
            break;
23178
23179
        case '+':
23180
        case '-':
23181
            prec = 9;
23182
            break;
23183
23184
        case '*':
23185
        case '/':
23186
        case '%':
23187
            prec = 11;
23188
            break;
23189
23190
        default:
23191
            break;
23192
        }
23193
23194
        return prec;
23195
    }
23196
23197
    // 11.5 Multiplicative Operators
23198
    // 11.6 Additive Operators
23199
    // 11.7 Bitwise Shift Operators
23200
    // 11.8 Relational Operators
23201
    // 11.9 Equality Operators
23202
    // 11.10 Binary Bitwise Operators
23203
    // 11.11 Binary Logical Operators
23204
23205
    function parseBinaryExpression() {
23206
        var marker, markers, expr, token, prec, stack, right, operator, left, i;
23207
23208
        marker = lookahead;
23209
        left = inheritCoverGrammar(parseUnaryExpression);
23210
23211
        token = lookahead;
23212
        prec = binaryPrecedence(token, state.allowIn);
23213
        if (prec === 0) {
23214
            return left;
23215
        }
23216
        isAssignmentTarget = isBindingElement = false;
23217
        token.prec = prec;
23218
        lex();
23219
23220
        markers = [marker, lookahead];
23221
        right = isolateCoverGrammar(parseUnaryExpression);
23222
23223
        stack = [left, token, right];
23224
23225
        while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) {
23226
23227
            // Reduce: make a binary expression from the three topmost entries.
23228
            while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
23229
                right = stack.pop();
23230
                operator = stack.pop().value;
23231
                left = stack.pop();
23232
                markers.pop();
23233
                expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right);
23234
                stack.push(expr);
23235
            }
23236
23237
            // Shift.
23238
            token = lex();
23239
            token.prec = prec;
23240
            stack.push(token);
23241
            markers.push(lookahead);
23242
            expr = isolateCoverGrammar(parseUnaryExpression);
23243
            stack.push(expr);
23244
        }
23245
23246
        // Final reduce to clean-up the stack.
23247
        i = stack.length - 1;
23248
        expr = stack[i];
23249
        markers.pop();
23250
        while (i > 1) {
23251
            expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
23252
            i -= 2;
23253
        }
23254
23255
        return expr;
23256
    }
23257
23258
23259
    // 11.12 Conditional Operator
23260
23261
    function parseConditionalExpression() {
23262
        var expr, previousAllowIn, consequent, alternate, startToken;
23263
23264
        startToken = lookahead;
23265
23266
        expr = inheritCoverGrammar(parseBinaryExpression);
23267
        if (match('?')) {
23268
            lex();
23269
            previousAllowIn = state.allowIn;
23270
            state.allowIn = true;
23271
            consequent = isolateCoverGrammar(parseAssignmentExpression);
23272
            state.allowIn = previousAllowIn;
23273
            expect(':');
23274
            alternate = isolateCoverGrammar(parseAssignmentExpression);
23275
23276
            expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);
23277
            isAssignmentTarget = isBindingElement = false;
23278
        }
23279
23280
        return expr;
23281
    }
23282
23283
    // [ES6] 14.2 Arrow Function
23284
23285
    function parseConciseBody() {
23286
        if (match('{')) {
23287
            return parseFunctionSourceElements();
23288
        }
23289
        return isolateCoverGrammar(parseAssignmentExpression);
23290
    }
23291
23292
    function checkPatternParam(options, param) {
23293
        var i;
23294
        switch (param.type) {
23295
        case Syntax.Identifier:
23296
            validateParam(options, param, param.name);
23297
            break;
23298
        case Syntax.RestElement:
23299
            checkPatternParam(options, param.argument);
23300
            break;
23301
        case Syntax.AssignmentPattern:
23302
            checkPatternParam(options, param.left);
23303
            break;
23304
        case Syntax.ArrayPattern:
23305
            for (i = 0; i < param.elements.length; i++) {
23306
                if (param.elements[i] !== null) {
23307
                    checkPatternParam(options, param.elements[i]);
23308
                }
23309
            }
23310
            break;
23311
        default:
23312
            assert(param.type === Syntax.ObjectPattern, 'Invalid type');
23313
            for (i = 0; i < param.properties.length; i++) {
23314
                checkPatternParam(options, param.properties[i].value);
23315
            }
23316
            break;
23317
        }
23318
    }
23319
    function reinterpretAsCoverFormalsList(expr) {
23320
        var i, len, param, params, defaults, defaultCount, options, token;
23321
23322
        defaults = [];
23323
        defaultCount = 0;
23324
        params = [expr];
23325
23326
        switch (expr.type) {
23327
        case Syntax.Identifier:
23328
            break;
23329
        case PlaceHolders.ArrowParameterPlaceHolder:
23330
            params = expr.params;
23331
            break;
23332
        default:
23333
            return null;
23334
        }
23335
23336
        options = {
23337
            paramSet: {}
23338
        };
23339
23340
        for (i = 0, len = params.length; i < len; i += 1) {
23341
            param = params[i];
23342
            switch (param.type) {
23343
            case Syntax.AssignmentPattern:
23344
                params[i] = param.left;
23345
                defaults.push(param.right);
23346
                ++defaultCount;
23347
                checkPatternParam(options, param.left);
23348
                break;
23349
            default:
23350
                checkPatternParam(options, param);
23351
                params[i] = param;
23352
                defaults.push(null);
23353
                break;
23354
            }
23355
        }
23356
23357
        if (options.message === Messages.StrictParamDupe) {
23358
            token = strict ? options.stricted : options.firstRestricted;
23359
            throwUnexpectedToken(token, options.message);
23360
        }
23361
23362
        if (defaultCount === 0) {
23363
            defaults = [];
23364
        }
23365
23366
        return {
23367
            params: params,
23368
            defaults: defaults,
23369
            stricted: options.stricted,
23370
            firstRestricted: options.firstRestricted,
23371
            message: options.message
23372
        };
23373
    }
23374
23375
    function parseArrowFunctionExpression(options, node) {
23376
        var previousStrict, body;
23377
23378
        if (hasLineTerminator) {
23379
            tolerateUnexpectedToken(lookahead);
23380
        }
23381
        expect('=>');
23382
        previousStrict = strict;
23383
23384
        body = parseConciseBody();
23385
23386
        if (strict && options.firstRestricted) {
23387
            throwUnexpectedToken(options.firstRestricted, options.message);
23388
        }
23389
        if (strict && options.stricted) {
23390
            tolerateUnexpectedToken(options.stricted, options.message);
23391
        }
23392
23393
        strict = previousStrict;
23394
23395
        return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement);
23396
    }
23397
23398
    // 11.13 Assignment Operators
23399
23400
    function parseAssignmentExpression() {
23401
        var token, expr, right, list, startToken;
23402
23403
        startToken = lookahead;
23404
        token = lookahead;
23405
23406
        expr = parseConditionalExpression();
23407
23408
        if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {
23409
            isAssignmentTarget = isBindingElement = false;
23410
            list = reinterpretAsCoverFormalsList(expr);
23411
23412
            if (list) {
23413
                firstCoverInitializedNameError = null;
23414
                return parseArrowFunctionExpression(list, new WrappingNode(startToken));
23415
            }
23416
23417
            return expr;
23418
        }
23419
23420
        if (matchAssign()) {
23421
            if (!isAssignmentTarget) {
23422
                tolerateError(Messages.InvalidLHSInAssignment);
23423
            }
23424
23425
            // 11.13.1
23426
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23427
                tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);
23428
            }
23429
23430
            if (!match('=')) {
23431
                isAssignmentTarget = isBindingElement = false;
23432
            } else {
23433
                reinterpretExpressionAsPattern(expr);
23434
            }
23435
23436
            token = lex();
23437
            right = isolateCoverGrammar(parseAssignmentExpression);
23438
            expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);
23439
            firstCoverInitializedNameError = null;
23440
        }
23441
23442
        return expr;
23443
    }
23444
23445
    // 11.14 Comma Operator
23446
23447
    function parseExpression() {
23448
        var expr, startToken = lookahead, expressions;
23449
23450
        expr = isolateCoverGrammar(parseAssignmentExpression);
23451
23452
        if (match(',')) {
23453
            expressions = [expr];
23454
23455
            while (startIndex < length) {
23456
                if (!match(',')) {
23457
                    break;
23458
                }
23459
                lex();
23460
                expressions.push(isolateCoverGrammar(parseAssignmentExpression));
23461
            }
23462
23463
            expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
23464
        }
23465
23466
        return expr;
23467
    }
23468
23469
    // 12.1 Block
23470
23471
    function parseStatementListItem() {
23472
        if (lookahead.type === Token.Keyword) {
23473
            switch (lookahead.value) {
23474
            case 'export':
23475
                if (sourceType !== 'module') {
23476
                    tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
23477
                }
23478
                return parseExportDeclaration();
23479
            case 'import':
23480
                if (sourceType !== 'module') {
23481
                    tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);
23482
                }
23483
                return parseImportDeclaration();
23484
            case 'const':
23485
            case 'let':
23486
                return parseLexicalDeclaration({inFor: false});
23487
            case 'function':
23488
                return parseFunctionDeclaration(new Node());
23489
            case 'class':
23490
                return parseClassDeclaration();
23491
            }
23492
        }
23493
23494
        return parseStatement();
23495
    }
23496
23497
    function parseStatementList() {
23498
        var list = [];
23499
        while (startIndex < length) {
23500
            if (match('}')) {
23501
                break;
23502
            }
23503
            list.push(parseStatementListItem());
23504
        }
23505
23506
        return list;
23507
    }
23508
23509
    function parseBlock() {
23510
        var block, node = new Node();
23511
23512
        expect('{');
23513
23514
        block = parseStatementList();
23515
23516
        expect('}');
23517
23518
        return node.finishBlockStatement(block);
23519
    }
23520
23521
    // 12.2 Variable Statement
23522
23523
    function parseVariableIdentifier() {
23524
        var token, node = new Node();
23525
23526
        token = lex();
23527
23528
        if (token.type !== Token.Identifier) {
23529
            if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {
23530
                tolerateUnexpectedToken(token, Messages.StrictReservedWord);
23531
            } else {
23532
                throwUnexpectedToken(token);
23533
            }
23534
        }
23535
23536
        return node.finishIdentifier(token.value);
23537
    }
23538
23539
    function parseVariableDeclaration() {
23540
        var init = null, id, node = new Node();
23541
23542
        id = parsePattern();
23543
23544
        // 12.2.1
23545
        if (strict && isRestrictedWord(id.name)) {
23546
            tolerateError(Messages.StrictVarName);
23547
        }
23548
23549
        if (match('=')) {
23550
            lex();
23551
            init = isolateCoverGrammar(parseAssignmentExpression);
23552
        } else if (id.type !== Syntax.Identifier) {
23553
            expect('=');
23554
        }
23555
23556
        return node.finishVariableDeclarator(id, init);
23557
    }
23558
23559
    function parseVariableDeclarationList() {
23560
        var list = [];
23561
23562
        do {
23563
            list.push(parseVariableDeclaration());
23564
            if (!match(',')) {
23565
                break;
23566
            }
23567
            lex();
23568
        } while (startIndex < length);
23569
23570
        return list;
23571
    }
23572
23573
    function parseVariableStatement(node) {
23574
        var declarations;
23575
23576
        expectKeyword('var');
23577
23578
        declarations = parseVariableDeclarationList();
23579
23580
        consumeSemicolon();
23581
23582
        return node.finishVariableDeclaration(declarations);
23583
    }
23584
23585
    function parseLexicalBinding(kind, options) {
23586
        var init = null, id, node = new Node();
23587
23588
        id = parsePattern();
23589
23590
        // 12.2.1
23591
        if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
23592
            tolerateError(Messages.StrictVarName);
23593
        }
23594
23595
        if (kind === 'const') {
23596
            if (!matchKeyword('in')) {
23597
                expect('=');
23598
                init = isolateCoverGrammar(parseAssignmentExpression);
23599
            }
23600
        } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {
23601
            expect('=');
23602
            init = isolateCoverGrammar(parseAssignmentExpression);
23603
        }
23604
23605
        return node.finishVariableDeclarator(id, init);
23606
    }
23607
23608
    function parseBindingList(kind, options) {
23609
        var list = [];
23610
23611
        do {
23612
            list.push(parseLexicalBinding(kind, options));
23613
            if (!match(',')) {
23614
                break;
23615
            }
23616
            lex();
23617
        } while (startIndex < length);
23618
23619
        return list;
23620
    }
23621
23622
    function parseLexicalDeclaration(options) {
23623
        var kind, declarations, node = new Node();
23624
23625
        kind = lex().value;
23626
        assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
23627
23628
        declarations = parseBindingList(kind, options);
23629
23630
        consumeSemicolon();
23631
23632
        return node.finishLexicalDeclaration(declarations, kind);
23633
    }
23634
23635
    function parseRestElement() {
23636
        var param, node = new Node();
23637
23638
        lex();
23639
23640
        if (match('{')) {
23641
            throwError(Messages.ObjectPatternAsRestParameter);
23642
        }
23643
23644
        param = parseVariableIdentifier();
23645
23646
        if (match('=')) {
23647
            throwError(Messages.DefaultRestParameter);
23648
        }
23649
23650
        if (!match(')')) {
23651
            throwError(Messages.ParameterAfterRestParameter);
23652
        }
23653
23654
        return node.finishRestElement(param);
23655
    }
23656
23657
    // 12.3 Empty Statement
23658
23659
    function parseEmptyStatement(node) {
23660
        expect(';');
23661
        return node.finishEmptyStatement();
23662
    }
23663
23664
    // 12.4 Expression Statement
23665
23666
    function parseExpressionStatement(node) {
23667
        var expr = parseExpression();
23668
        consumeSemicolon();
23669
        return node.finishExpressionStatement(expr);
23670
    }
23671
23672
    // 12.5 If statement
23673
23674
    function parseIfStatement(node) {
23675
        var test, consequent, alternate;
23676
23677
        expectKeyword('if');
23678
23679
        expect('(');
23680
23681
        test = parseExpression();
23682
23683
        expect(')');
23684
23685
        consequent = parseStatement();
23686
23687
        if (matchKeyword('else')) {
23688
            lex();
23689
            alternate = parseStatement();
23690
        } else {
23691
            alternate = null;
23692
        }
23693
23694
        return node.finishIfStatement(test, consequent, alternate);
23695
    }
23696
23697
    // 12.6 Iteration Statements
23698
23699
    function parseDoWhileStatement(node) {
23700
        var body, test, oldInIteration;
23701
23702
        expectKeyword('do');
23703
23704
        oldInIteration = state.inIteration;
23705
        state.inIteration = true;
23706
23707
        body = parseStatement();
23708
23709
        state.inIteration = oldInIteration;
23710
23711
        expectKeyword('while');
23712
23713
        expect('(');
23714
23715
        test = parseExpression();
23716
23717
        expect(')');
23718
23719
        if (match(';')) {
23720
            lex();
23721
        }
23722
23723
        return node.finishDoWhileStatement(body, test);
23724
    }
23725
23726
    function parseWhileStatement(node) {
23727
        var test, body, oldInIteration;
23728
23729
        expectKeyword('while');
23730
23731
        expect('(');
23732
23733
        test = parseExpression();
23734
23735
        expect(')');
23736
23737
        oldInIteration = state.inIteration;
23738
        state.inIteration = true;
23739
23740
        body = parseStatement();
23741
23742
        state.inIteration = oldInIteration;
23743
23744
        return node.finishWhileStatement(test, body);
23745
    }
23746
23747
    function parseForStatement(node) {
23748
        var init, initSeq, initStartToken, test, update, left, right, kind, declarations,
23749
            body, oldInIteration, previousAllowIn = state.allowIn;
23750
23751
        init = test = update = null;
23752
23753
        expectKeyword('for');
23754
23755
        expect('(');
23756
23757
        if (match(';')) {
23758
            lex();
23759
        } else {
23760
            if (matchKeyword('var')) {
23761
                init = new Node();
23762
                lex();
23763
23764
                state.allowIn = false;
23765
                init = init.finishVariableDeclaration(parseVariableDeclarationList());
23766
                state.allowIn = previousAllowIn;
23767
23768
                if (init.declarations.length === 1 && matchKeyword('in')) {
23769
                    lex();
23770
                    left = init;
23771
                    right = parseExpression();
23772
                    init = null;
23773
                } else {
23774
                    expect(';');
23775
                }
23776
            } else if (matchKeyword('const') || matchKeyword('let')) {
23777
                init = new Node();
23778
                kind = lex().value;
23779
23780
                state.allowIn = false;
23781
                declarations = parseBindingList(kind, {inFor: true});
23782
                state.allowIn = previousAllowIn;
23783
23784
                if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) {
23785
                    init = init.finishLexicalDeclaration(declarations, kind);
23786
                    lex();
23787
                    left = init;
23788
                    right = parseExpression();
23789
                    init = null;
23790
                } else {
23791
                    consumeSemicolon();
23792
                    init = init.finishLexicalDeclaration(declarations, kind);
23793
                }
23794
            } else {
23795
                initStartToken = lookahead;
23796
                state.allowIn = false;
23797
                init = inheritCoverGrammar(parseAssignmentExpression);
23798
                state.allowIn = previousAllowIn;
23799
23800
                if (matchKeyword('in')) {
23801
                    if (!isAssignmentTarget) {
23802
                        tolerateError(Messages.InvalidLHSInForIn);
23803
                    }
23804
23805
                    lex();
23806
                    reinterpretExpressionAsPattern(init);
23807
                    left = init;
23808
                    right = parseExpression();
23809
                    init = null;
23810
                } else {
23811
                    if (match(',')) {
23812
                        initSeq = [init];
23813
                        while (match(',')) {
23814
                            lex();
23815
                            initSeq.push(isolateCoverGrammar(parseAssignmentExpression));
23816
                        }
23817
                        init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq);
23818
                    }
23819
                    expect(';');
23820
                }
23821
            }
23822
        }
23823
23824
        if (typeof left === 'undefined') {
23825
23826
            if (!match(';')) {
23827
                test = parseExpression();
23828
            }
23829
            expect(';');
23830
23831
            if (!match(')')) {
23832
                update = parseExpression();
23833
            }
23834
        }
23835
23836
        expect(')');
23837
23838
        oldInIteration = state.inIteration;
23839
        state.inIteration = true;
23840
23841
        body = isolateCoverGrammar(parseStatement);
23842
23843
        state.inIteration = oldInIteration;
23844
23845
        return (typeof left === 'undefined') ?
23846
                node.finishForStatement(init, test, update, body) :
23847
                node.finishForInStatement(left, right, body);
23848
    }
23849
23850
    // 12.7 The continue statement
23851
23852
    function parseContinueStatement(node) {
23853
        var label = null, key;
23854
23855
        expectKeyword('continue');
23856
23857
        // Optimize the most common form: 'continue;'.
23858
        if (source.charCodeAt(startIndex) === 0x3B) {
23859
            lex();
23860
23861
            if (!state.inIteration) {
23862
                throwError(Messages.IllegalContinue);
23863
            }
23864
23865
            return node.finishContinueStatement(null);
23866
        }
23867
23868
        if (hasLineTerminator) {
23869
            if (!state.inIteration) {
23870
                throwError(Messages.IllegalContinue);
23871
            }
23872
23873
            return node.finishContinueStatement(null);
23874
        }
23875
23876
        if (lookahead.type === Token.Identifier) {
23877
            label = parseVariableIdentifier();
23878
23879
            key = '$' + label.name;
23880
            if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
23881
                throwError(Messages.UnknownLabel, label.name);
23882
            }
23883
        }
23884
23885
        consumeSemicolon();
23886
23887
        if (label === null && !state.inIteration) {
23888
            throwError(Messages.IllegalContinue);
23889
        }
23890
23891
        return node.finishContinueStatement(label);
23892
    }
23893
23894
    // 12.8 The break statement
23895
23896
    function parseBreakStatement(node) {
23897
        var label = null, key;
23898
23899
        expectKeyword('break');
23900
23901
        // Catch the very common case first: immediately a semicolon (U+003B).
23902
        if (source.charCodeAt(lastIndex) === 0x3B) {
23903
            lex();
23904
23905
            if (!(state.inIteration || state.inSwitch)) {
23906
                throwError(Messages.IllegalBreak);
23907
            }
23908
23909
            return node.finishBreakStatement(null);
23910
        }
23911
23912
        if (hasLineTerminator) {
23913
            if (!(state.inIteration || state.inSwitch)) {
23914
                throwError(Messages.IllegalBreak);
23915
            }
23916
23917
            return node.finishBreakStatement(null);
23918
        }
23919
23920
        if (lookahead.type === Token.Identifier) {
23921
            label = parseVariableIdentifier();
23922
23923
            key = '$' + label.name;
23924
            if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
23925
                throwError(Messages.UnknownLabel, label.name);
23926
            }
23927
        }
23928
23929
        consumeSemicolon();
23930
23931
        if (label === null && !(state.inIteration || state.inSwitch)) {
23932
            throwError(Messages.IllegalBreak);
23933
        }
23934
23935
        return node.finishBreakStatement(label);
23936
    }
23937
23938
    // 12.9 The return statement
23939
23940
    function parseReturnStatement(node) {
23941
        var argument = null;
23942
23943
        expectKeyword('return');
23944
23945
        if (!state.inFunctionBody) {
23946
            tolerateError(Messages.IllegalReturn);
23947
        }
23948
23949
        // 'return' followed by a space and an identifier is very common.
23950
        if (source.charCodeAt(lastIndex) === 0x20) {
23951
            if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {
23952
                argument = parseExpression();
23953
                consumeSemicolon();
23954
                return node.finishReturnStatement(argument);
23955
            }
23956
        }
23957
23958
        if (hasLineTerminator) {
23959
            // HACK
23960
            return node.finishReturnStatement(null);
23961
        }
23962
23963
        if (!match(';')) {
23964
            if (!match('}') && lookahead.type !== Token.EOF) {
23965
                argument = parseExpression();
23966
            }
23967
        }
23968
23969
        consumeSemicolon();
23970
23971
        return node.finishReturnStatement(argument);
23972
    }
23973
23974
    // 12.10 The with statement
23975
23976
    function parseWithStatement(node) {
23977
        var object, body;
23978
23979
        if (strict) {
23980
            tolerateError(Messages.StrictModeWith);
23981
        }
23982
23983
        expectKeyword('with');
23984
23985
        expect('(');
23986
23987
        object = parseExpression();
23988
23989
        expect(')');
23990
23991
        body = parseStatement();
23992
23993
        return node.finishWithStatement(object, body);
23994
    }
23995
23996
    // 12.10 The swith statement
23997
23998
    function parseSwitchCase() {
23999
        var test, consequent = [], statement, node = new Node();
24000
24001
        if (matchKeyword('default')) {
24002
            lex();
24003
            test = null;
24004
        } else {
24005
            expectKeyword('case');
24006
            test = parseExpression();
24007
        }
24008
        expect(':');
24009
24010
        while (startIndex < length) {
24011
            if (match('}') || matchKeyword('default') || matchKeyword('case')) {
24012
                break;
24013
            }
24014
            statement = parseStatementListItem();
24015
            consequent.push(statement);
24016
        }
24017
24018
        return node.finishSwitchCase(test, consequent);
24019
    }
24020
24021
    function parseSwitchStatement(node) {
24022
        var discriminant, cases, clause, oldInSwitch, defaultFound;
24023
24024
        expectKeyword('switch');
24025
24026
        expect('(');
24027
24028
        discriminant = parseExpression();
24029
24030
        expect(')');
24031
24032
        expect('{');
24033
24034
        cases = [];
24035
24036
        if (match('}')) {
24037
            lex();
24038
            return node.finishSwitchStatement(discriminant, cases);
24039
        }
24040
24041
        oldInSwitch = state.inSwitch;
24042
        state.inSwitch = true;
24043
        defaultFound = false;
24044
24045
        while (startIndex < length) {
24046
            if (match('}')) {
24047
                break;
24048
            }
24049
            clause = parseSwitchCase();
24050
            if (clause.test === null) {
24051
                if (defaultFound) {
24052
                    throwError(Messages.MultipleDefaultsInSwitch);
24053
                }
24054
                defaultFound = true;
24055
            }
24056
            cases.push(clause);
24057
        }
24058
24059
        state.inSwitch = oldInSwitch;
24060
24061
        expect('}');
24062
24063
        return node.finishSwitchStatement(discriminant, cases);
24064
    }
24065
24066
    // 12.13 The throw statement
24067
24068
    function parseThrowStatement(node) {
24069
        var argument;
24070
24071
        expectKeyword('throw');
24072
24073
        if (hasLineTerminator) {
24074
            throwError(Messages.NewlineAfterThrow);
24075
        }
24076
24077
        argument = parseExpression();
24078
24079
        consumeSemicolon();
24080
24081
        return node.finishThrowStatement(argument);
24082
    }
24083
24084
    // 12.14 The try statement
24085
24086
    function parseCatchClause() {
24087
        var param, body, node = new Node();
24088
24089
        expectKeyword('catch');
24090
24091
        expect('(');
24092
        if (match(')')) {
24093
            throwUnexpectedToken(lookahead);
24094
        }
24095
24096
        param = parsePattern();
24097
24098
        // 12.14.1
24099
        if (strict && isRestrictedWord(param.name)) {
24100
            tolerateError(Messages.StrictCatchVariable);
24101
        }
24102
24103
        expect(')');
24104
        body = parseBlock();
24105
        return node.finishCatchClause(param, body);
24106
    }
24107
24108
    function parseTryStatement(node) {
24109
        var block, handler = null, finalizer = null;
24110
24111
        expectKeyword('try');
24112
24113
        block = parseBlock();
24114
24115
        if (matchKeyword('catch')) {
24116
            handler = parseCatchClause();
24117
        }
24118
24119
        if (matchKeyword('finally')) {
24120
            lex();
24121
            finalizer = parseBlock();
24122
        }
24123
24124
        if (!handler && !finalizer) {
24125
            throwError(Messages.NoCatchOrFinally);
24126
        }
24127
24128
        return node.finishTryStatement(block, handler, finalizer);
24129
    }
24130
24131
    // 12.15 The debugger statement
24132
24133
    function parseDebuggerStatement(node) {
24134
        expectKeyword('debugger');
24135
24136
        consumeSemicolon();
24137
24138
        return node.finishDebuggerStatement();
24139
    }
24140
24141
    // 12 Statements
24142
24143
    function parseStatement() {
24144
        var type = lookahead.type,
24145
            expr,
24146
            labeledBody,
24147
            key,
24148
            node;
24149
24150
        if (type === Token.EOF) {
24151
            throwUnexpectedToken(lookahead);
24152
        }
24153
24154
        if (type === Token.Punctuator && lookahead.value === '{') {
24155
            return parseBlock();
24156
        }
24157
        isAssignmentTarget = isBindingElement = true;
24158
        node = new Node();
24159
24160
        if (type === Token.Punctuator) {
24161
            switch (lookahead.value) {
24162
            case ';':
24163
                return parseEmptyStatement(node);
24164
            case '(':
24165
                return parseExpressionStatement(node);
24166
            default:
24167
                break;
24168
            }
24169
        } else if (type === Token.Keyword) {
24170
            switch (lookahead.value) {
24171
            case 'break':
24172
                return parseBreakStatement(node);
24173
            case 'continue':
24174
                return parseContinueStatement(node);
24175
            case 'debugger':
24176
                return parseDebuggerStatement(node);
24177
            case 'do':
24178
                return parseDoWhileStatement(node);
24179
            case 'for':
24180
                return parseForStatement(node);
24181
            case 'function':
24182
                return parseFunctionDeclaration(node);
24183
            case 'if':
24184
                return parseIfStatement(node);
24185
            case 'return':
24186
                return parseReturnStatement(node);
24187
            case 'switch':
24188
                return parseSwitchStatement(node);
24189
            case 'throw':
24190
                return parseThrowStatement(node);
24191
            case 'try':
24192
                return parseTryStatement(node);
24193
            case 'var':
24194
                return parseVariableStatement(node);
24195
            case 'while':
24196
                return parseWhileStatement(node);
24197
            case 'with':
24198
                return parseWithStatement(node);
24199
            default:
24200
                break;
24201
            }
24202
        }
24203
24204
        expr = parseExpression();
24205
24206
        // 12.12 Labelled Statements
24207
        if ((expr.type === Syntax.Identifier) && match(':')) {
24208
            lex();
24209
24210
            key = '$' + expr.name;
24211
            if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
24212
                throwError(Messages.Redeclaration, 'Label', expr.name);
24213
            }
24214
24215
            state.labelSet[key] = true;
24216
            labeledBody = parseStatement();
24217
            delete state.labelSet[key];
24218
            return node.finishLabeledStatement(expr, labeledBody);
24219
        }
24220
24221
        consumeSemicolon();
24222
24223
        return node.finishExpressionStatement(expr);
24224
    }
24225
24226
    // 13 Function Definition
24227
24228
    function parseFunctionSourceElements() {
24229
        var statement, body = [], token, directive, firstRestricted,
24230
            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
24231
            node = new Node();
24232
24233
        expect('{');
24234
24235
        while (startIndex < length) {
24236
            if (lookahead.type !== Token.StringLiteral) {
24237
                break;
24238
            }
24239
            token = lookahead;
24240
24241
            statement = parseStatementListItem();
24242
            body.push(statement);
24243
            if (statement.expression.type !== Syntax.Literal) {
24244
                // this is not directive
24245
                break;
24246
            }
24247
            directive = source.slice(token.start + 1, token.end - 1);
24248
            if (directive === 'use strict') {
24249
                strict = true;
24250
                if (firstRestricted) {
24251
                    tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
24252
                }
24253
            } else {
24254
                if (!firstRestricted && token.octal) {
24255
                    firstRestricted = token;
24256
                }
24257
            }
24258
        }
24259
24260
        oldLabelSet = state.labelSet;
24261
        oldInIteration = state.inIteration;
24262
        oldInSwitch = state.inSwitch;
24263
        oldInFunctionBody = state.inFunctionBody;
24264
        oldParenthesisCount = state.parenthesizedCount;
24265
24266
        state.labelSet = {};
24267
        state.inIteration = false;
24268
        state.inSwitch = false;
24269
        state.inFunctionBody = true;
24270
        state.parenthesizedCount = 0;
24271
24272
        while (startIndex < length) {
24273
            if (match('}')) {
24274
                break;
24275
            }
24276
            body.push(parseStatementListItem());
24277
        }
24278
24279
        expect('}');
24280
24281
        state.labelSet = oldLabelSet;
24282
        state.inIteration = oldInIteration;
24283
        state.inSwitch = oldInSwitch;
24284
        state.inFunctionBody = oldInFunctionBody;
24285
        state.parenthesizedCount = oldParenthesisCount;
24286
24287
        return node.finishBlockStatement(body);
24288
    }
24289
24290
    function validateParam(options, param, name) {
24291
        var key = '$' + name;
24292
        if (strict) {
24293
            if (isRestrictedWord(name)) {
24294
                options.stricted = param;
24295
                options.message = Messages.StrictParamName;
24296
            }
24297
            if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
24298
                options.stricted = param;
24299
                options.message = Messages.StrictParamDupe;
24300
            }
24301
        } else if (!options.firstRestricted) {
24302
            if (isRestrictedWord(name)) {
24303
                options.firstRestricted = param;
24304
                options.message = Messages.StrictParamName;
24305
            } else if (isStrictModeReservedWord(name)) {
24306
                options.firstRestricted = param;
24307
                options.message = Messages.StrictReservedWord;
24308
            } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
24309
                options.firstRestricted = param;
24310
                options.message = Messages.StrictParamDupe;
24311
            }
24312
        }
24313
        options.paramSet[key] = true;
24314
    }
24315
24316
    function parseParam(options) {
24317
        var token, param, def;
24318
24319
        token = lookahead;
24320
        if (token.value === '...') {
24321
            param = parseRestElement();
24322
            validateParam(options, param.argument, param.argument.name);
24323
            options.params.push(param);
24324
            options.defaults.push(null);
24325
            return false;
24326
        }
24327
24328
        param = parsePatternWithDefault();
24329
        validateParam(options, token, token.value);
24330
24331
        if (param.type === Syntax.AssignmentPattern) {
24332
            def = param.right;
24333
            param = param.left;
24334
            ++options.defaultCount;
24335
        }
24336
24337
        options.params.push(param);
24338
        options.defaults.push(def);
24339
24340
        return !match(')');
24341
    }
24342
24343
    function parseParams(firstRestricted) {
24344
        var options;
24345
24346
        options = {
24347
            params: [],
24348
            defaultCount: 0,
24349
            defaults: [],
24350
            firstRestricted: firstRestricted
24351
        };
24352
24353
        expect('(');
24354
24355
        if (!match(')')) {
24356
            options.paramSet = {};
24357
            while (startIndex < length) {
24358
                if (!parseParam(options)) {
24359
                    break;
24360
                }
24361
                expect(',');
24362
            }
24363
        }
24364
24365
        expect(')');
24366
24367
        if (options.defaultCount === 0) {
24368
            options.defaults = [];
24369
        }
24370
24371
        return {
24372
            params: options.params,
24373
            defaults: options.defaults,
24374
            stricted: options.stricted,
24375
            firstRestricted: options.firstRestricted,
24376
            message: options.message
24377
        };
24378
    }
24379
24380
    function parseFunctionDeclaration(node, identifierIsOptional) {
24381
        var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict;
24382
24383
        expectKeyword('function');
24384
        if (!identifierIsOptional || !match('(')) {
24385
            token = lookahead;
24386
            id = parseVariableIdentifier();
24387
            if (strict) {
24388
                if (isRestrictedWord(token.value)) {
24389
                    tolerateUnexpectedToken(token, Messages.StrictFunctionName);
24390
                }
24391
            } else {
24392
                if (isRestrictedWord(token.value)) {
24393
                    firstRestricted = token;
24394
                    message = Messages.StrictFunctionName;
24395
                } else if (isStrictModeReservedWord(token.value)) {
24396
                    firstRestricted = token;
24397
                    message = Messages.StrictReservedWord;
24398
                }
24399
            }
24400
        }
24401
24402
        tmp = parseParams(firstRestricted);
24403
        params = tmp.params;
24404
        defaults = tmp.defaults;
24405
        stricted = tmp.stricted;
24406
        firstRestricted = tmp.firstRestricted;
24407
        if (tmp.message) {
24408
            message = tmp.message;
24409
        }
24410
24411
        previousStrict = strict;
24412
        body = parseFunctionSourceElements();
24413
        if (strict && firstRestricted) {
24414
            throwUnexpectedToken(firstRestricted, message);
24415
        }
24416
        if (strict && stricted) {
24417
            tolerateUnexpectedToken(stricted, message);
24418
        }
24419
        strict = previousStrict;
24420
24421
        return node.finishFunctionDeclaration(id, params, defaults, body);
24422
    }
24423
24424
    function parseFunctionExpression() {
24425
        var token, id = null, stricted, firstRestricted, message, tmp,
24426
            params = [], defaults = [], body, previousStrict, node = new Node();
24427
24428
        expectKeyword('function');
24429
24430
        if (!match('(')) {
24431
            token = lookahead;
24432
            id = parseVariableIdentifier();
24433
            if (strict) {
24434
                if (isRestrictedWord(token.value)) {
24435
                    tolerateUnexpectedToken(token, Messages.StrictFunctionName);
24436
                }
24437
            } else {
24438
                if (isRestrictedWord(token.value)) {
24439
                    firstRestricted = token;
24440
                    message = Messages.StrictFunctionName;
24441
                } else if (isStrictModeReservedWord(token.value)) {
24442
                    firstRestricted = token;
24443
                    message = Messages.StrictReservedWord;
24444
                }
24445
            }
24446
        }
24447
24448
        tmp = parseParams(firstRestricted);
24449
        params = tmp.params;
24450
        defaults = tmp.defaults;
24451
        stricted = tmp.stricted;
24452
        firstRestricted = tmp.firstRestricted;
24453
        if (tmp.message) {
24454
            message = tmp.message;
24455
        }
24456
24457
        previousStrict = strict;
24458
        body = parseFunctionSourceElements();
24459
        if (strict && firstRestricted) {
24460
            throwUnexpectedToken(firstRestricted, message);
24461
        }
24462
        if (strict && stricted) {
24463
            tolerateUnexpectedToken(stricted, message);
24464
        }
24465
        strict = previousStrict;
24466
24467
        return node.finishFunctionExpression(id, params, defaults, body);
24468
    }
24469
24470
24471
    function parseClassBody() {
24472
        var classBody, token, isStatic, hasConstructor = false, body, method, computed, key;
24473
24474
        classBody = new Node();
24475
24476
        expect('{');
24477
        body = [];
24478
        while (!match('}')) {
24479
            if (match(';')) {
24480
                lex();
24481
            } else {
24482
                method = new Node();
24483
                token = lookahead;
24484
                isStatic = false;
24485
                computed = match('[');
24486
                key = parseObjectPropertyKey();
24487
                if (key.name === 'static' && lookaheadPropertyName()) {
24488
                    token = lookahead;
24489
                    isStatic = true;
24490
                    computed = match('[');
24491
                    key = parseObjectPropertyKey();
24492
                }
24493
                method = tryParseMethodDefinition(token, key, computed, method);
24494
                if (method) {
24495
                    method['static'] = isStatic;
24496
                    if (method.kind === 'init') {
24497
                        method.kind = 'method';
24498
                    }
24499
                    if (!isStatic) {
24500
                        if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') {
24501
                            if (method.kind !== 'method' || !method.method || method.value.generator) {
24502
                                throwUnexpectedToken(token, Messages.ConstructorSpecialMethod);
24503
                            }
24504
                            if (hasConstructor) {
24505
                                throwUnexpectedToken(token, Messages.DuplicateConstructor);
24506
                            } else {
24507
                                hasConstructor = true;
24508
                            }
24509
                            method.kind = 'constructor';
24510
                        }
24511
                    } else {
24512
                        if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') {
24513
                            throwUnexpectedToken(token, Messages.StaticPrototype);
24514
                        }
24515
                    }
24516
                    method.type = Syntax.MethodDefinition;
24517
                    delete method.method;
24518
                    delete method.shorthand;
24519
                    body.push(method);
24520
                } else {
24521
                    throwUnexpectedToken(lookahead);
24522
                }
24523
            }
24524
        }
24525
        lex();
24526
        return classBody.finishClassBody(body);
24527
    }
24528
24529
    function parseClassDeclaration(identifierIsOptional) {
24530
        var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
24531
        strict = true;
24532
24533
        expectKeyword('class');
24534
24535
        if (!identifierIsOptional || lookahead.type === Token.Identifier) {
24536
            id = parseVariableIdentifier();
24537
        }
24538
24539
        if (matchKeyword('extends')) {
24540
            lex();
24541
            superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
24542
        }
24543
        classBody = parseClassBody();
24544
        strict = previousStrict;
24545
24546
        return classNode.finishClassDeclaration(id, superClass, classBody);
24547
    }
24548
24549
    function parseClassExpression() {
24550
        var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
24551
        strict = true;
24552
24553
        expectKeyword('class');
24554
24555
        if (lookahead.type === Token.Identifier) {
24556
            id = parseVariableIdentifier();
24557
        }
24558
24559
        if (matchKeyword('extends')) {
24560
            lex();
24561
            superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
24562
        }
24563
        classBody = parseClassBody();
24564
        strict = previousStrict;
24565
24566
        return classNode.finishClassExpression(id, superClass, classBody);
24567
    }
24568
24569
    // Modules grammar from:
24570
    // people.mozilla.org/~jorendorff/es6-draft.html
24571
24572
    function parseModuleSpecifier() {
24573
        var node = new Node();
24574
24575
        if (lookahead.type !== Token.StringLiteral) {
24576
            throwError(Messages.InvalidModuleSpecifier);
24577
        }
24578
        return node.finishLiteral(lex());
24579
    }
24580
24581
    function parseExportSpecifier() {
24582
        var exported, local, node = new Node(), def;
24583
        if (matchKeyword('default')) {
24584
            // export {default} from 'something';
24585
            def = new Node();
24586
            lex();
24587
            local = def.finishIdentifier('default');
24588
        } else {
24589
            local = parseVariableIdentifier();
24590
        }
24591
        if (matchContextualKeyword('as')) {
24592
            lex();
24593
            exported = parseNonComputedProperty();
24594
        }
24595
        return node.finishExportSpecifier(local, exported);
24596
    }
24597
24598
    function parseExportNamedDeclaration(node) {
24599
        var declaration = null,
24600
            isExportFromIdentifier,
24601
            src = null, specifiers = [];
24602
24603
        // non-default export
24604
        if (lookahead.type === Token.Keyword) {
24605
            // covers:
24606
            // export var f = 1;
24607
            switch (lookahead.value) {
24608
                case 'let':
24609
                case 'const':
24610
                case 'var':
24611
                case 'class':
24612
                case 'function':
24613
                    declaration = parseStatementListItem();
24614
                    return node.finishExportNamedDeclaration(declaration, specifiers, null);
24615
            }
24616
        }
24617
24618
        expect('{');
24619
        if (!match('}')) {
24620
            do {
24621
                isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');
24622
                specifiers.push(parseExportSpecifier());
24623
            } while (match(',') && lex());
24624
        }
24625
        expect('}');
24626
24627
        if (matchContextualKeyword('from')) {
24628
            // covering:
24629
            // export {default} from 'foo';
24630
            // export {foo} from 'foo';
24631
            lex();
24632
            src = parseModuleSpecifier();
24633
            consumeSemicolon();
24634
        } else if (isExportFromIdentifier) {
24635
            // covering:
24636
            // export {default}; // missing fromClause
24637
            throwError(lookahead.value ?
24638
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24639
        } else {
24640
            // cover
24641
            // export {foo};
24642
            consumeSemicolon();
24643
        }
24644
        return node.finishExportNamedDeclaration(declaration, specifiers, src);
24645
    }
24646
24647
    function parseExportDefaultDeclaration(node) {
24648
        var declaration = null,
24649
            expression = null;
24650
24651
        // covers:
24652
        // export default ...
24653
        expectKeyword('default');
24654
24655
        if (matchKeyword('function')) {
24656
            // covers:
24657
            // export default function foo () {}
24658
            // export default function () {}
24659
            declaration = parseFunctionDeclaration(new Node(), true);
24660
            return node.finishExportDefaultDeclaration(declaration);
24661
        }
24662
        if (matchKeyword('class')) {
24663
            declaration = parseClassDeclaration(true);
24664
            return node.finishExportDefaultDeclaration(declaration);
24665
        }
24666
24667
        if (matchContextualKeyword('from')) {
24668
            throwError(Messages.UnexpectedToken, lookahead.value);
24669
        }
24670
24671
        // covers:
24672
        // export default {};
24673
        // export default [];
24674
        // export default (1 + 2);
24675
        if (match('{')) {
24676
            expression = parseObjectInitialiser();
24677
        } else if (match('[')) {
24678
            expression = parseArrayInitialiser();
24679
        } else {
24680
            expression = parseAssignmentExpression();
24681
        }
24682
        consumeSemicolon();
24683
        return node.finishExportDefaultDeclaration(expression);
24684
    }
24685
24686
    function parseExportAllDeclaration(node) {
24687
        var src;
24688
24689
        // covers:
24690
        // export * from 'foo';
24691
        expect('*');
24692
        if (!matchContextualKeyword('from')) {
24693
            throwError(lookahead.value ?
24694
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24695
        }
24696
        lex();
24697
        src = parseModuleSpecifier();
24698
        consumeSemicolon();
24699
24700
        return node.finishExportAllDeclaration(src);
24701
    }
24702
24703
    function parseExportDeclaration() {
24704
        var node = new Node();
24705
        if (state.inFunctionBody) {
24706
            throwError(Messages.IllegalExportDeclaration);
24707
        }
24708
24709
        expectKeyword('export');
24710
24711
        if (matchKeyword('default')) {
24712
            return parseExportDefaultDeclaration(node);
24713
        }
24714
        if (match('*')) {
24715
            return parseExportAllDeclaration(node);
24716
        }
24717
        return parseExportNamedDeclaration(node);
24718
    }
24719
24720
    function parseImportSpecifier() {
24721
        // import {<foo as bar>} ...;
24722
        var local, imported, node = new Node();
24723
24724
        imported = parseNonComputedProperty();
24725
        if (matchContextualKeyword('as')) {
24726
            lex();
24727
            local = parseVariableIdentifier();
24728
        }
24729
24730
        return node.finishImportSpecifier(local, imported);
24731
    }
24732
24733
    function parseNamedImports() {
24734
        var specifiers = [];
24735
        // {foo, bar as bas}
24736
        expect('{');
24737
        if (!match('}')) {
24738
            do {
24739
                specifiers.push(parseImportSpecifier());
24740
            } while (match(',') && lex());
24741
        }
24742
        expect('}');
24743
        return specifiers;
24744
    }
24745
24746
    function parseImportDefaultSpecifier() {
24747
        // import <foo> ...;
24748
        var local, node = new Node();
24749
24750
        local = parseNonComputedProperty();
24751
24752
        return node.finishImportDefaultSpecifier(local);
24753
    }
24754
24755
    function parseImportNamespaceSpecifier() {
24756
        // import <* as foo> ...;
24757
        var local, node = new Node();
24758
24759
        expect('*');
24760
        if (!matchContextualKeyword('as')) {
24761
            throwError(Messages.NoAsAfterImportNamespace);
24762
        }
24763
        lex();
24764
        local = parseNonComputedProperty();
24765
24766
        return node.finishImportNamespaceSpecifier(local);
24767
    }
24768
24769
    function parseImportDeclaration() {
24770
        var specifiers, src, node = new Node();
24771
24772
        if (state.inFunctionBody) {
24773
            throwError(Messages.IllegalImportDeclaration);
24774
        }
24775
24776
        expectKeyword('import');
24777
        specifiers = [];
24778
24779
        if (lookahead.type === Token.StringLiteral) {
24780
            // covers:
24781
            // import 'foo';
24782
            src = parseModuleSpecifier();
24783
            consumeSemicolon();
24784
            return node.finishImportDeclaration(specifiers, src);
24785
        }
24786
24787
        if (!matchKeyword('default') && isIdentifierName(lookahead)) {
24788
            // covers:
24789
            // import foo
24790
            // import foo, ...
24791
            specifiers.push(parseImportDefaultSpecifier());
24792
            if (match(',')) {
24793
                lex();
24794
            }
24795
        }
24796
        if (match('*')) {
24797
            // covers:
24798
            // import foo, * as foo
24799
            // import * as foo
24800
            specifiers.push(parseImportNamespaceSpecifier());
24801
        } else if (match('{')) {
24802
            // covers:
24803
            // import foo, {bar}
24804
            // import {bar}
24805
            specifiers = specifiers.concat(parseNamedImports());
24806
        }
24807
24808
        if (!matchContextualKeyword('from')) {
24809
            throwError(lookahead.value ?
24810
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24811
        }
24812
        lex();
24813
        src = parseModuleSpecifier();
24814
        consumeSemicolon();
24815
24816
        return node.finishImportDeclaration(specifiers, src);
24817
    }
24818
24819
    // 14 Program
24820
24821
    function parseScriptBody() {
24822
        var statement, body = [], token, directive, firstRestricted;
24823
24824
        while (startIndex < length) {
24825
            token = lookahead;
24826
            if (token.type !== Token.StringLiteral) {
24827
                break;
24828
            }
24829
24830
            statement = parseStatementListItem();
24831
            body.push(statement);
24832
            if (statement.expression.type !== Syntax.Literal) {
24833
                // this is not directive
24834
                break;
24835
            }
24836
            directive = source.slice(token.start + 1, token.end - 1);
24837
            if (directive === 'use strict') {
24838
                strict = true;
24839
                if (firstRestricted) {
24840
                    tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
24841
                }
24842
            } else {
24843
                if (!firstRestricted && token.octal) {
24844
                    firstRestricted = token;
24845
                }
24846
            }
24847
        }
24848
24849
        while (startIndex < length) {
24850
            statement = parseStatementListItem();
24851
            /* istanbul ignore if */
24852
            if (typeof statement === 'undefined') {
24853
                break;
24854
            }
24855
            body.push(statement);
24856
        }
24857
        return body;
24858
    }
24859
24860
    function parseProgram() {
24861
        var body, node;
24862
24863
        peek();
24864
        node = new Node();
24865
24866
        body = parseScriptBody();
24867
        return node.finishProgram(body);
24868
    }
24869
24870
    function filterTokenLocation() {
24871
        var i, entry, token, tokens = [];
24872
24873
        for (i = 0; i < extra.tokens.length; ++i) {
24874
            entry = extra.tokens[i];
24875
            token = {
24876
                type: entry.type,
24877
                value: entry.value
24878
            };
24879
            if (entry.regex) {
24880
                token.regex = {
24881
                    pattern: entry.regex.pattern,
24882
                    flags: entry.regex.flags
24883
                };
24884
            }
24885
            if (extra.range) {
24886
                token.range = entry.range;
24887
            }
24888
            if (extra.loc) {
24889
                token.loc = entry.loc;
24890
            }
24891
            tokens.push(token);
24892
        }
24893
24894
        extra.tokens = tokens;
24895
    }
24896
24897
    function tokenize(code, options) {
24898
        var toString,
24899
            tokens;
24900
24901
        toString = String;
24902
        if (typeof code !== 'string' && !(code instanceof String)) {
24903
            code = toString(code);
24904
        }
24905
24906
        source = code;
24907
        index = 0;
24908
        lineNumber = (source.length > 0) ? 1 : 0;
24909
        lineStart = 0;
24910
        startIndex = index;
24911
        startLineNumber = lineNumber;
24912
        startLineStart = lineStart;
24913
        length = source.length;
24914
        lookahead = null;
24915
        state = {
24916
            allowIn: true,
24917
            labelSet: {},
24918
            inFunctionBody: false,
24919
            inIteration: false,
24920
            inSwitch: false,
24921
            lastCommentStart: -1,
24922
            curlyStack: []
24923
        };
24924
24925
        extra = {};
24926
24927
        // Options matching.
24928
        options = options || {};
24929
24930
        // Of course we collect tokens here.
24931
        options.tokens = true;
24932
        extra.tokens = [];
24933
        extra.tokenize = true;
24934
        // The following two fields are necessary to compute the Regex tokens.
24935
        extra.openParenToken = -1;
24936
        extra.openCurlyToken = -1;
24937
24938
        extra.range = (typeof options.range === 'boolean') && options.range;
24939
        extra.loc = (typeof options.loc === 'boolean') && options.loc;
24940
24941
        if (typeof options.comment === 'boolean' && options.comment) {
24942
            extra.comments = [];
24943
        }
24944
        if (typeof options.tolerant === 'boolean' && options.tolerant) {
24945
            extra.errors = [];
24946
        }
24947
24948
        try {
24949
            peek();
24950
            if (lookahead.type === Token.EOF) {
24951
                return extra.tokens;
24952
            }
24953
24954
            lex();
24955
            while (lookahead.type !== Token.EOF) {
24956
                try {
24957
                    lex();
24958
                } catch (lexError) {
24959
                    if (extra.errors) {
24960
                        recordError(lexError);
24961
                        // We have to break on the first error
24962
                        // to avoid infinite loops.
24963
                        break;
24964
                    } else {
24965
                        throw lexError;
24966
                    }
24967
                }
24968
            }
24969
24970
            filterTokenLocation();
24971
            tokens = extra.tokens;
24972
            if (typeof extra.comments !== 'undefined') {
24973
                tokens.comments = extra.comments;
24974
            }
24975
            if (typeof extra.errors !== 'undefined') {
24976
                tokens.errors = extra.errors;
24977
            }
24978
        } catch (e) {
24979
            throw e;
24980
        } finally {
24981
            extra = {};
24982
        }
24983
        return tokens;
24984
    }
24985
24986
    function parse(code, options) {
24987
        var program, toString;
24988
24989
        toString = String;
24990
        if (typeof code !== 'string' && !(code instanceof String)) {
24991
            code = toString(code);
24992
        }
24993
24994
        source = code;
24995
        index = 0;
24996
        lineNumber = (source.length > 0) ? 1 : 0;
24997
        lineStart = 0;
24998
        startIndex = index;
24999
        startLineNumber = lineNumber;
25000
        startLineStart = lineStart;
25001
        length = source.length;
25002
        lookahead = null;
25003
        state = {
25004
            allowIn: true,
25005
            labelSet: {},
25006
            inFunctionBody: false,
25007
            inIteration: false,
25008
            inSwitch: false,
25009
            lastCommentStart: -1,
25010
            curlyStack: []
25011
        };
25012
        sourceType = 'script';
25013
        strict = false;
25014
25015
        extra = {};
25016
        if (typeof options !== 'undefined') {
25017
            extra.range = (typeof options.range === 'boolean') && options.range;
25018
            extra.loc = (typeof options.loc === 'boolean') && options.loc;
25019
            extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;
25020
25021
            if (extra.loc && options.source !== null && options.source !== undefined) {
25022
                extra.source = toString(options.source);
25023
            }
25024
25025
            if (typeof options.tokens === 'boolean' && options.tokens) {
25026
                extra.tokens = [];
25027
            }
25028
            if (typeof options.comment === 'boolean' && options.comment) {
25029
                extra.comments = [];
25030
            }
25031
            if (typeof options.tolerant === 'boolean' && options.tolerant) {
25032
                extra.errors = [];
25033
            }
25034
            if (extra.attachComment) {
25035
                extra.range = true;
25036
                extra.comments = [];
25037
                extra.bottomRightStack = [];
25038
                extra.trailingComments = [];
25039
                extra.leadingComments = [];
25040
            }
25041
            if (options.sourceType === 'module') {
25042
                // very restrictive condition for now
25043
                sourceType = options.sourceType;
25044
                strict = true;
25045
            }
25046
        }
25047
25048
        try {
25049
            program = parseProgram();
25050
            if (typeof extra.comments !== 'undefined') {
25051
                program.comments = extra.comments;
25052
            }
25053
            if (typeof extra.tokens !== 'undefined') {
25054
                filterTokenLocation();
25055
                program.tokens = extra.tokens;
25056
            }
25057
            if (typeof extra.errors !== 'undefined') {
25058
                program.errors = extra.errors;
25059
            }
25060
        } catch (e) {
25061
            throw e;
25062
        } finally {
25063
            extra = {};
25064
        }
25065
25066
        return program;
25067
    }
25068
25069
    // Sync with *.json manifests.
25070
    exports.version = '2.2.0';
25071
25072
    exports.tokenize = tokenize;
25073
25074
    exports.parse = parse;
25075
25076
    // Deep copy.
25077
    /* istanbul ignore next */
25078
    exports.Syntax = (function () {
25079
        var name, types = {};
25080
25081
        if (typeof Object.create === 'function') {
25082
            types = Object.create(null);
25083
        }
25084
25085
        for (name in Syntax) {
25086
            if (Syntax.hasOwnProperty(name)) {
25087
                types[name] = Syntax[name];
25088
            }
25089
        }
25090
25091
        if (typeof Object.freeze === 'function') {
25092
            Object.freeze(types);
25093
        }
25094
25095
        return types;
25096
    }());
25097
25098
}));
25099
/* vim: set sw=4 ts=4 et tw=80 : */
25100
25101
},{}],52:[function(require,module,exports){
25102
var baseIndexOf = require('../internal/baseIndexOf'),
25103
    binaryIndex = require('../internal/binaryIndex');
25104
25105
/* Native method references for those with the same name as other `lodash` methods. */
25106
var nativeMax = Math.max;
25107
25108
/**
25109
 * Gets the index at which the first occurrence of `value` is found in `array`
25110
 * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
25111
 * for equality comparisons. If `fromIndex` is negative, it is used as the offset
25112
 * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
25113
 * performs a faster binary search.
25114
 *
25115
 * @static
25116
 * @memberOf _
25117
 * @category Array
25118
 * @param {Array} array The array to search.
25119
 * @param {*} value The value to search for.
25120
 * @param {boolean|number} [fromIndex=0] The index to search from or `true`
25121
 *  to perform a binary search on a sorted array.
25122
 * @returns {number} Returns the index of the matched value, else `-1`.
25123
 * @example
25124
 *
25125
 * _.indexOf([1, 2, 1, 2], 2);
25126
 * // => 1
25127
 *
25128
 * // using `fromIndex`
25129
 * _.indexOf([1, 2, 1, 2], 2, 2);
25130
 * // => 3
25131
 *
25132
 * // performing a binary search
25133
 * _.indexOf([1, 1, 2, 2], 2, true);
25134
 * // => 2
25135
 */
25136
function indexOf(array, value, fromIndex) {
25137
  var length = array ? array.length : 0;
25138
  if (!length) {
25139
    return -1;
25140
  }
25141
  if (typeof fromIndex == 'number') {
25142
    fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
25143
  } else if (fromIndex) {
25144
    var index = binaryIndex(array, value);
25145
    if (index < length &&
25146
        (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
25147
      return index;
25148
    }
25149
    return -1;
25150
  }
25151
  return baseIndexOf(array, value, fromIndex || 0);
25152
}
25153
25154
module.exports = indexOf;
25155
25156
},{"../internal/baseIndexOf":81,"../internal/binaryIndex":95}],53:[function(require,module,exports){
25157
/**
25158
 * Gets the last element of `array`.
25159
 *
25160
 * @static
25161
 * @memberOf _
25162
 * @category Array
25163
 * @param {Array} array The array to query.
25164
 * @returns {*} Returns the last element of `array`.
25165
 * @example
25166
 *
25167
 * _.last([1, 2, 3]);
25168
 * // => 3
25169
 */
25170
function last(array) {
25171
  var length = array ? array.length : 0;
25172
  return length ? array[length - 1] : undefined;
25173
}
25174
25175
module.exports = last;
25176
25177
},{}],54:[function(require,module,exports){
25178
var LazyWrapper = require('../internal/LazyWrapper'),
25179
    LodashWrapper = require('../internal/LodashWrapper'),
25180
    baseLodash = require('../internal/baseLodash'),
25181
    isArray = require('../lang/isArray'),
25182
    isObjectLike = require('../internal/isObjectLike'),
25183
    wrapperClone = require('../internal/wrapperClone');
25184
25185
/** Used for native method references. */
25186
var objectProto = Object.prototype;
25187
25188
/** Used to check objects for own properties. */
25189
var hasOwnProperty = objectProto.hasOwnProperty;
25190
25191
/**
25192
 * Creates a `lodash` object which wraps `value` to enable implicit chaining.
25193
 * Methods that operate on and return arrays, collections, and functions can
25194
 * be chained together. Methods that retrieve a single value or may return a
25195
 * primitive value will automatically end the chain returning the unwrapped
25196
 * value. Explicit chaining may be enabled using `_.chain`. The execution of
25197
 * chained methods is lazy, that is, execution is deferred until `_#value`
25198
 * is implicitly or explicitly called.
25199
 *
25200
 * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
25201
 * fusion is an optimization strategy which merge iteratee calls; this can help
25202
 * to avoid the creation of intermediate data structures and greatly reduce the
25203
 * number of iteratee executions.
25204
 *
25205
 * Chaining is supported in custom builds as long as the `_#value` method is
25206
 * directly or indirectly included in the build.
25207
 *
25208
 * In addition to lodash methods, wrappers have `Array` and `String` methods.
25209
 *
25210
 * The wrapper `Array` methods are:
25211
 * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
25212
 * `splice`, and `unshift`
25213
 *
25214
 * The wrapper `String` methods are:
25215
 * `replace` and `split`
25216
 *
25217
 * The wrapper methods that support shortcut fusion are:
25218
 * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
25219
 * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
25220
 * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
25221
 * and `where`
25222
 *
25223
 * The chainable wrapper methods are:
25224
 * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
25225
 * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
25226
 * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
25227
 * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
25228
 * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
25229
 * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
25230
 * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
25231
 * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
25232
 * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
25233
 * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
25234
 * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
25235
 * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
25236
 * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
25237
 * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
25238
 * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
25239
 * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
25240
 * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
25241
 *
25242
 * The wrapper methods that are **not** chainable by default are:
25243
 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
25244
 * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
25245
 * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
25246
 * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
25247
 * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
25248
 * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
25249
 * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
25250
 * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
25251
 * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
25252
 * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
25253
 * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
25254
 * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
25255
 * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
25256
 * `unescape`, `uniqueId`, `value`, and `words`
25257
 *
25258
 * The wrapper method `sample` will return a wrapped value when `n` is provided,
25259
 * otherwise an unwrapped value is returned.
25260
 *
25261
 * @name _
25262
 * @constructor
25263
 * @category Chain
25264
 * @param {*} value The value to wrap in a `lodash` instance.
25265
 * @returns {Object} Returns the new `lodash` wrapper instance.
25266
 * @example
25267
 *
25268
 * var wrapped = _([1, 2, 3]);
25269
 *
25270
 * // returns an unwrapped value
25271
 * wrapped.reduce(function(total, n) {
25272
 *   return total + n;
25273
 * });
25274
 * // => 6
25275
 *
25276
 * // returns a wrapped value
25277
 * var squares = wrapped.map(function(n) {
25278
 *   return n * n;
25279
 * });
25280
 *
25281
 * _.isArray(squares);
25282
 * // => false
25283
 *
25284
 * _.isArray(squares.value());
25285
 * // => true
25286
 */
25287
function lodash(value) {
25288
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
25289
    if (value instanceof LodashWrapper) {
25290
      return value;
25291
    }
25292
    if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
25293
      return wrapperClone(value);
25294
    }
25295
  }
25296
  return new LodashWrapper(value);
25297
}
25298
25299
// Ensure wrappers are instances of `baseLodash`.
25300
lodash.prototype = baseLodash.prototype;
25301
25302
module.exports = lodash;
25303
25304
},{"../internal/LazyWrapper":63,"../internal/LodashWrapper":64,"../internal/baseLodash":85,"../internal/isObjectLike":129,"../internal/wrapperClone":140,"../lang/isArray":143}],55:[function(require,module,exports){
25305
module.exports = require('./forEach');
25306
25307
},{"./forEach":57}],56:[function(require,module,exports){
25308
var baseEach = require('../internal/baseEach'),
25309
    createFind = require('../internal/createFind');
25310
25311
/**
25312
 * Iterates over elements of `collection`, returning the first element
25313
 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
25314
 * invoked with three arguments: (value, index|key, collection).
25315
 *
25316
 * If a property name is provided for `predicate` the created `_.property`
25317
 * style callback returns the property value of the given element.
25318
 *
25319
 * If a value is also provided for `thisArg` the created `_.matchesProperty`
25320
 * style callback returns `true` for elements that have a matching property
25321
 * value, else `false`.
25322
 *
25323
 * If an object is provided for `predicate` the created `_.matches` style
25324
 * callback returns `true` for elements that have the properties of the given
25325
 * object, else `false`.
25326
 *
25327
 * @static
25328
 * @memberOf _
25329
 * @alias detect
25330
 * @category Collection
25331
 * @param {Array|Object|string} collection The collection to search.
25332
 * @param {Function|Object|string} [predicate=_.identity] The function invoked
25333
 *  per iteration.
25334
 * @param {*} [thisArg] The `this` binding of `predicate`.
25335
 * @returns {*} Returns the matched element, else `undefined`.
25336
 * @example
25337
 *
25338
 * var users = [
25339
 *   { 'user': 'barney',  'age': 36, 'active': true },
25340
 *   { 'user': 'fred',    'age': 40, 'active': false },
25341
 *   { 'user': 'pebbles', 'age': 1,  'active': true }
25342
 * ];
25343
 *
25344
 * _.result(_.find(users, function(chr) {
25345
 *   return chr.age < 40;
25346
 * }), 'user');
25347
 * // => 'barney'
25348
 *
25349
 * // using the `_.matches` callback shorthand
25350
 * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
25351
 * // => 'pebbles'
25352
 *
25353
 * // using the `_.matchesProperty` callback shorthand
25354
 * _.result(_.find(users, 'active', false), 'user');
25355
 * // => 'fred'
25356
 *
25357
 * // using the `_.property` callback shorthand
25358
 * _.result(_.find(users, 'active'), 'user');
25359
 * // => 'barney'
25360
 */
25361
var find = createFind(baseEach);
25362
25363
module.exports = find;
25364
25365
},{"../internal/baseEach":74,"../internal/createFind":105}],57:[function(require,module,exports){
25366
var arrayEach = require('../internal/arrayEach'),
25367
    baseEach = require('../internal/baseEach'),
25368
    createForEach = require('../internal/createForEach');
25369
25370
/**
25371
 * Iterates over elements of `collection` invoking `iteratee` for each element.
25372
 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
25373
 * (value, index|key, collection). Iteratee functions may exit iteration early
25374
 * by explicitly returning `false`.
25375
 *
25376
 * **Note:** As with other "Collections" methods, objects with a "length" property
25377
 * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
25378
 * may be used for object iteration.
25379
 *
25380
 * @static
25381
 * @memberOf _
25382
 * @alias each
25383
 * @category Collection
25384
 * @param {Array|Object|string} collection The collection to iterate over.
25385
 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
25386
 * @param {*} [thisArg] The `this` binding of `iteratee`.
25387
 * @returns {Array|Object|string} Returns `collection`.
25388
 * @example
25389
 *
25390
 * _([1, 2]).forEach(function(n) {
25391
 *   console.log(n);
25392
 * }).value();
25393
 * // => logs each value from left to right and returns the array
25394
 *
25395
 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
25396
 *   console.log(n, key);
25397
 * });
25398
 * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
25399
 */
25400
var forEach = createForEach(arrayEach, baseEach);
25401
25402
module.exports = forEach;
25403
25404
},{"../internal/arrayEach":66,"../internal/baseEach":74,"../internal/createForEach":106}],58:[function(require,module,exports){
25405
var baseIndexOf = require('../internal/baseIndexOf'),
25406
    getLength = require('../internal/getLength'),
25407
    isArray = require('../lang/isArray'),
25408
    isIterateeCall = require('../internal/isIterateeCall'),
25409
    isLength = require('../internal/isLength'),
25410
    isString = require('../lang/isString'),
25411
    values = require('../object/values');
25412
25413
/* Native method references for those with the same name as other `lodash` methods. */
25414
var nativeMax = Math.max;
25415
25416
/**
25417
 * Checks if `value` is in `collection` using
25418
 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
25419
 * for equality comparisons. If `fromIndex` is negative, it is used as the offset
25420
 * from the end of `collection`.
25421
 *
25422
 * @static
25423
 * @memberOf _
25424
 * @alias contains, include
25425
 * @category Collection
25426
 * @param {Array|Object|string} collection The collection to search.
25427
 * @param {*} target The value to search for.
25428
 * @param {number} [fromIndex=0] The index to search from.
25429
 * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
25430
 * @returns {boolean} Returns `true` if a matching element is found, else `false`.
25431
 * @example
25432
 *
25433
 * _.includes([1, 2, 3], 1);
25434
 * // => true
25435
 *
25436
 * _.includes([1, 2, 3], 1, 2);
25437
 * // => false
25438
 *
25439
 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
25440
 * // => true
25441
 *
25442
 * _.includes('pebbles', 'eb');
25443
 * // => true
25444
 */
25445
function includes(collection, target, fromIndex, guard) {
25446
  var length = collection ? getLength(collection) : 0;
25447
  if (!isLength(length)) {
25448
    collection = values(collection);
25449
    length = collection.length;
25450
  }
25451
  if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
25452
    fromIndex = 0;
25453
  } else {
25454
    fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
25455
  }
25456
  return (typeof collection == 'string' || !isArray(collection) && isString(collection))
25457
    ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
25458
    : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
25459
}
25460
25461
module.exports = includes;
25462
25463
},{"../internal/baseIndexOf":81,"../internal/getLength":115,"../internal/isIterateeCall":125,"../internal/isLength":128,"../lang/isArray":143,"../lang/isString":149,"../object/values":155}],59:[function(require,module,exports){
25464
var arrayMap = require('../internal/arrayMap'),
25465
    baseCallback = require('../internal/baseCallback'),
25466
    baseMap = require('../internal/baseMap'),
25467
    isArray = require('../lang/isArray');
25468
25469
/**
25470
 * Creates an array of values by running each element in `collection` through
25471
 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
25472
 * arguments: (value, index|key, collection).
25473
 *
25474
 * If a property name is provided for `iteratee` the created `_.property`
25475
 * style callback returns the property value of the given element.
25476
 *
25477
 * If a value is also provided for `thisArg` the created `_.matchesProperty`
25478
 * style callback returns `true` for elements that have a matching property
25479
 * value, else `false`.
25480
 *
25481
 * If an object is provided for `iteratee` the created `_.matches` style
25482
 * callback returns `true` for elements that have the properties of the given
25483
 * object, else `false`.
25484
 *
25485
 * Many lodash methods are guarded to work as iteratees for methods like
25486
 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
25487
 *
25488
 * The guarded methods are:
25489
 * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
25490
 * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
25491
 * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
25492
 * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
25493
 * `sum`, `uniq`, and `words`
25494
 *
25495
 * @static
25496
 * @memberOf _
25497
 * @alias collect
25498
 * @category Collection
25499
 * @param {Array|Object|string} collection The collection to iterate over.
25500
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked
25501
 *  per iteration.
25502
 * @param {*} [thisArg] The `this` binding of `iteratee`.
25503
 * @returns {Array} Returns the new mapped array.
25504
 * @example
25505
 *
25506
 * function timesThree(n) {
25507
 *   return n * 3;
25508
 * }
25509
 *
25510
 * _.map([1, 2], timesThree);
25511
 * // => [3, 6]
25512
 *
25513
 * _.map({ 'a': 1, 'b': 2 }, timesThree);
25514
 * // => [3, 6] (iteration order is not guaranteed)
25515
 *
25516
 * var users = [
25517
 *   { 'user': 'barney' },
25518
 *   { 'user': 'fred' }
25519
 * ];
25520
 *
25521
 * // using the `_.property` callback shorthand
25522
 * _.map(users, 'user');
25523
 * // => ['barney', 'fred']
25524
 */
25525
function map(collection, iteratee, thisArg) {
25526
  var func = isArray(collection) ? arrayMap : baseMap;
25527
  iteratee = baseCallback(iteratee, thisArg, 3);
25528
  return func(collection, iteratee);
25529
}
25530
25531
module.exports = map;
25532
25533
},{"../internal/arrayMap":67,"../internal/baseCallback":70,"../internal/baseMap":86,"../lang/isArray":143}],60:[function(require,module,exports){
25534
var getNative = require('../internal/getNative');
25535
25536
/* Native method references for those with the same name as other `lodash` methods. */
25537
var nativeNow = getNative(Date, 'now');
25538
25539
/**
25540
 * Gets the number of milliseconds that have elapsed since the Unix epoch
25541
 * (1 January 1970 00:00:00 UTC).
25542
 *
25543
 * @static
25544
 * @memberOf _
25545
 * @category Date
25546
 * @example
25547
 *
25548
 * _.defer(function(stamp) {
25549
 *   console.log(_.now() - stamp);
25550
 * }, _.now());
25551
 * // => logs the number of milliseconds it took for the deferred function to be invoked
25552
 */
25553
var now = nativeNow || function() {
25554
  return new Date().getTime();
25555
};
25556
25557
module.exports = now;
25558
25559
},{"../internal/getNative":117}],61:[function(require,module,exports){
25560
var createWrapper = require('../internal/createWrapper'),
25561
    replaceHolders = require('../internal/replaceHolders'),
25562
    restParam = require('./restParam');
25563
25564
/** Used to compose bitmasks for wrapper metadata. */
25565
var BIND_FLAG = 1,
25566
    PARTIAL_FLAG = 32;
25567
25568
/**
25569
 * Creates a function that invokes `func` with the `this` binding of `thisArg`
25570
 * and prepends any additional `_.bind` arguments to those provided to the
25571
 * bound function.
25572
 *
25573
 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
25574
 * may be used as a placeholder for partially applied arguments.
25575
 *
25576
 * **Note:** Unlike native `Function#bind` this method does not set the "length"
25577
 * property of bound functions.
25578
 *
25579
 * @static
25580
 * @memberOf _
25581
 * @category Function
25582
 * @param {Function} func The function to bind.
25583
 * @param {*} thisArg The `this` binding of `func`.
25584
 * @param {...*} [partials] The arguments to be partially applied.
25585
 * @returns {Function} Returns the new bound function.
25586
 * @example
25587
 *
25588
 * var greet = function(greeting, punctuation) {
25589
 *   return greeting + ' ' + this.user + punctuation;
25590
 * };
25591
 *
25592
 * var object = { 'user': 'fred' };
25593
 *
25594
 * var bound = _.bind(greet, object, 'hi');
25595
 * bound('!');
25596
 * // => 'hi fred!'
25597
 *
25598
 * // using placeholders
25599
 * var bound = _.bind(greet, object, _, '!');
25600
 * bound('hi');
25601
 * // => 'hi fred!'
25602
 */
25603
var bind = restParam(function(func, thisArg, partials) {
25604
  var bitmask = BIND_FLAG;
25605
  if (partials.length) {
25606
    var holders = replaceHolders(partials, bind.placeholder);
25607
    bitmask |= PARTIAL_FLAG;
25608
  }
25609
  return createWrapper(func, bitmask, thisArg, partials, holders);
25610
});
25611
25612
// Assign default placeholders.
25613
bind.placeholder = {};
25614
25615
module.exports = bind;
25616
25617
},{"../internal/createWrapper":109,"../internal/replaceHolders":135,"./restParam":62}],62:[function(require,module,exports){
25618
/** Used as the `TypeError` message for "Functions" methods. */
25619
var FUNC_ERROR_TEXT = 'Expected a function';
25620
25621
/* Native method references for those with the same name as other `lodash` methods. */
25622
var nativeMax = Math.max;
25623
25624
/**
25625
 * Creates a function that invokes `func` with the `this` binding of the
25626
 * created function and arguments from `start` and beyond provided as an array.
25627
 *
25628
 * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
25629
 *
25630
 * @static
25631
 * @memberOf _
25632
 * @category Function
25633
 * @param {Function} func The function to apply a rest parameter to.
25634
 * @param {number} [start=func.length-1] The start position of the rest parameter.
25635
 * @returns {Function} Returns the new function.
25636
 * @example
25637
 *
25638
 * var say = _.restParam(function(what, names) {
25639
 *   return what + ' ' + _.initial(names).join(', ') +
25640
 *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
25641
 * });
25642
 *
25643
 * say('hello', 'fred', 'barney', 'pebbles');
25644
 * // => 'hello fred, barney, & pebbles'
25645
 */
25646
function restParam(func, start) {
25647
  if (typeof func != 'function') {
25648
    throw new TypeError(FUNC_ERROR_TEXT);
25649
  }
25650
  start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
25651
  return function() {
25652
    var args = arguments,
25653
        index = -1,
25654
        length = nativeMax(args.length - start, 0),
25655
        rest = Array(length);
25656
25657
    while (++index < length) {
25658
      rest[index] = args[start + index];
25659
    }
25660
    switch (start) {
25661
      case 0: return func.call(this, rest);
25662
      case 1: return func.call(this, args[0], rest);
25663
      case 2: return func.call(this, args[0], args[1], rest);
25664
    }
25665
    var otherArgs = Array(start + 1);
25666
    index = -1;
25667
    while (++index < start) {
25668
      otherArgs[index] = args[index];
25669
    }
25670
    otherArgs[start] = rest;
25671
    return func.apply(this, otherArgs);
25672
  };
25673
}
25674
25675
module.exports = restParam;
25676
25677
},{}],63:[function(require,module,exports){
25678
var baseCreate = require('./baseCreate'),
25679
    baseLodash = require('./baseLodash');
25680
25681
/** Used as references for `-Infinity` and `Infinity`. */
25682
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
25683
25684
/**
25685
 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
25686
 *
25687
 * @private
25688
 * @param {*} value The value to wrap.
25689
 */
25690
function LazyWrapper(value) {
25691
  this.__wrapped__ = value;
25692
  this.__actions__ = [];
25693
  this.__dir__ = 1;
25694
  this.__filtered__ = false;
25695
  this.__iteratees__ = [];
25696
  this.__takeCount__ = POSITIVE_INFINITY;
25697
  this.__views__ = [];
25698
}
25699
25700
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
25701
LazyWrapper.prototype.constructor = LazyWrapper;
25702
25703
module.exports = LazyWrapper;
25704
25705
},{"./baseCreate":73,"./baseLodash":85}],64:[function(require,module,exports){
25706
var baseCreate = require('./baseCreate'),
25707
    baseLodash = require('./baseLodash');
25708
25709
/**
25710
 * The base constructor for creating `lodash` wrapper objects.
25711
 *
25712
 * @private
25713
 * @param {*} value The value to wrap.
25714
 * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
25715
 * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
25716
 */
25717
function LodashWrapper(value, chainAll, actions) {
25718
  this.__wrapped__ = value;
25719
  this.__actions__ = actions || [];
25720
  this.__chain__ = !!chainAll;
25721
}
25722
25723
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
25724
LodashWrapper.prototype.constructor = LodashWrapper;
25725
25726
module.exports = LodashWrapper;
25727
25728
},{"./baseCreate":73,"./baseLodash":85}],65:[function(require,module,exports){
25729
/**
25730
 * Copies the values of `source` to `array`.
25731
 *
25732
 * @private
25733
 * @param {Array} source The array to copy values from.
25734
 * @param {Array} [array=[]] The array to copy values to.
25735
 * @returns {Array} Returns `array`.
25736
 */
25737
function arrayCopy(source, array) {
25738
  var index = -1,
25739
      length = source.length;
25740
25741
  array || (array = Array(length));
25742
  while (++index < length) {
25743
    array[index] = source[index];
25744
  }
25745
  return array;
25746
}
25747
25748
module.exports = arrayCopy;
25749
25750
},{}],66:[function(require,module,exports){
25751
/**
25752
 * A specialized version of `_.forEach` for arrays without support for callback
25753
 * shorthands and `this` binding.
25754
 *
25755
 * @private
25756
 * @param {Array} array The array to iterate over.
25757
 * @param {Function} iteratee The function invoked per iteration.
25758
 * @returns {Array} Returns `array`.
25759
 */
25760
function arrayEach(array, iteratee) {
25761
  var index = -1,
25762
      length = array.length;
25763
25764
  while (++index < length) {
25765
    if (iteratee(array[index], index, array) === false) {
25766
      break;
25767
    }
25768
  }
25769
  return array;
25770
}
25771
25772
module.exports = arrayEach;
25773
25774
},{}],67:[function(require,module,exports){
25775
/**
25776
 * A specialized version of `_.map` for arrays without support for callback
25777
 * shorthands and `this` binding.
25778
 *
25779
 * @private
25780
 * @param {Array} array The array to iterate over.
25781
 * @param {Function} iteratee The function invoked per iteration.
25782
 * @returns {Array} Returns the new mapped array.
25783
 */
25784
function arrayMap(array, iteratee) {
25785
  var index = -1,
25786
      length = array.length,
25787
      result = Array(length);
25788
25789
  while (++index < length) {
25790
    result[index] = iteratee(array[index], index, array);
25791
  }
25792
  return result;
25793
}
25794
25795
module.exports = arrayMap;
25796
25797
},{}],68:[function(require,module,exports){
25798
/**
25799
 * A specialized version of `_.some` for arrays without support for callback
25800
 * shorthands and `this` binding.
25801
 *
25802
 * @private
25803
 * @param {Array} array The array to iterate over.
25804
 * @param {Function} predicate The function invoked per iteration.
25805
 * @returns {boolean} Returns `true` if any element passes the predicate check,
25806
 *  else `false`.
25807
 */
25808
function arraySome(array, predicate) {
25809
  var index = -1,
25810
      length = array.length;
25811
25812
  while (++index < length) {
25813
    if (predicate(array[index], index, array)) {
25814
      return true;
25815
    }
25816
  }
25817
  return false;
25818
}
25819
25820
module.exports = arraySome;
25821
25822
},{}],69:[function(require,module,exports){
25823
var baseCopy = require('./baseCopy'),
25824
    keys = require('../object/keys');
25825
25826
/**
25827
 * The base implementation of `_.assign` without support for argument juggling,
25828
 * multiple sources, and `customizer` functions.
25829
 *
25830
 * @private
25831
 * @param {Object} object The destination object.
25832
 * @param {Object} source The source object.
25833
 * @returns {Object} Returns `object`.
25834
 */
25835
function baseAssign(object, source) {
25836
  return source == null
25837
    ? object
25838
    : baseCopy(source, keys(source), object);
25839
}
25840
25841
module.exports = baseAssign;
25842
25843
},{"../object/keys":152,"./baseCopy":72}],70:[function(require,module,exports){
25844
var baseMatches = require('./baseMatches'),
25845
    baseMatchesProperty = require('./baseMatchesProperty'),
25846
    bindCallback = require('./bindCallback'),
25847
    identity = require('../utility/identity'),
25848
    property = require('../utility/property');
25849
25850
/**
25851
 * The base implementation of `_.callback` which supports specifying the
25852
 * number of arguments to provide to `func`.
25853
 *
25854
 * @private
25855
 * @param {*} [func=_.identity] The value to convert to a callback.
25856
 * @param {*} [thisArg] The `this` binding of `func`.
25857
 * @param {number} [argCount] The number of arguments to provide to `func`.
25858
 * @returns {Function} Returns the callback.
25859
 */
25860
function baseCallback(func, thisArg, argCount) {
25861
  var type = typeof func;
25862
  if (type == 'function') {
25863
    return thisArg === undefined
25864
      ? func
25865
      : bindCallback(func, thisArg, argCount);
25866
  }
25867
  if (func == null) {
25868
    return identity;
25869
  }
25870
  if (type == 'object') {
25871
    return baseMatches(func);
25872
  }
25873
  return thisArg === undefined
25874
    ? property(func)
25875
    : baseMatchesProperty(func, thisArg);
25876
}
25877
25878
module.exports = baseCallback;
25879
25880
},{"../utility/identity":157,"../utility/property":159,"./baseMatches":87,"./baseMatchesProperty":88,"./bindCallback":97}],71:[function(require,module,exports){
25881
var arrayCopy = require('./arrayCopy'),
25882
    arrayEach = require('./arrayEach'),
25883
    baseAssign = require('./baseAssign'),
25884
    baseForOwn = require('./baseForOwn'),
25885
    initCloneArray = require('./initCloneArray'),
25886
    initCloneByTag = require('./initCloneByTag'),
25887
    initCloneObject = require('./initCloneObject'),
25888
    isArray = require('../lang/isArray'),
25889
    isHostObject = require('./isHostObject'),
25890
    isObject = require('../lang/isObject');
25891
25892
/** `Object#toString` result references. */
25893
var argsTag = '[object Arguments]',
25894
    arrayTag = '[object Array]',
25895
    boolTag = '[object Boolean]',
25896
    dateTag = '[object Date]',
25897
    errorTag = '[object Error]',
25898
    funcTag = '[object Function]',
25899
    mapTag = '[object Map]',
25900
    numberTag = '[object Number]',
25901
    objectTag = '[object Object]',
25902
    regexpTag = '[object RegExp]',
25903
    setTag = '[object Set]',
25904
    stringTag = '[object String]',
25905
    weakMapTag = '[object WeakMap]';
25906
25907
var arrayBufferTag = '[object ArrayBuffer]',
25908
    float32Tag = '[object Float32Array]',
25909
    float64Tag = '[object Float64Array]',
25910
    int8Tag = '[object Int8Array]',
25911
    int16Tag = '[object Int16Array]',
25912
    int32Tag = '[object Int32Array]',
25913
    uint8Tag = '[object Uint8Array]',
25914
    uint8ClampedTag = '[object Uint8ClampedArray]',
25915
    uint16Tag = '[object Uint16Array]',
25916
    uint32Tag = '[object Uint32Array]';
25917
25918
/** Used to identify `toStringTag` values supported by `_.clone`. */
25919
var cloneableTags = {};
25920
cloneableTags[argsTag] = cloneableTags[arrayTag] =
25921
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
25922
cloneableTags[dateTag] = cloneableTags[float32Tag] =
25923
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
25924
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
25925
cloneableTags[numberTag] = cloneableTags[objectTag] =
25926
cloneableTags[regexpTag] = cloneableTags[stringTag] =
25927
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
25928
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
25929
cloneableTags[errorTag] = cloneableTags[funcTag] =
25930
cloneableTags[mapTag] = cloneableTags[setTag] =
25931
cloneableTags[weakMapTag] = false;
25932
25933
/** Used for native method references. */
25934
var objectProto = Object.prototype;
25935
25936
/**
25937
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
25938
 * of values.
25939
 */
25940
var objToString = objectProto.toString;
25941
25942
/**
25943
 * The base implementation of `_.clone` without support for argument juggling
25944
 * and `this` binding `customizer` functions.
25945
 *
25946
 * @private
25947
 * @param {*} value The value to clone.
25948
 * @param {boolean} [isDeep] Specify a deep clone.
25949
 * @param {Function} [customizer] The function to customize cloning values.
25950
 * @param {string} [key] The key of `value`.
25951
 * @param {Object} [object] The object `value` belongs to.
25952
 * @param {Array} [stackA=[]] Tracks traversed source objects.
25953
 * @param {Array} [stackB=[]] Associates clones with source counterparts.
25954
 * @returns {*} Returns the cloned value.
25955
 */
25956
function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
25957
  var result;
25958
  if (customizer) {
25959
    result = object ? customizer(value, key, object) : customizer(value);
25960
  }
25961
  if (result !== undefined) {
25962
    return result;
25963
  }
25964
  if (!isObject(value)) {
25965
    return value;
25966
  }
25967
  var isArr = isArray(value);
25968
  if (isArr) {
25969
    result = initCloneArray(value);
25970
    if (!isDeep) {
25971
      return arrayCopy(value, result);
25972
    }
25973
  } else {
25974
    var tag = objToString.call(value),
25975
        isFunc = tag == funcTag;
25976
25977
    if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
25978
      if (isHostObject(value)) {
25979
        return object ? value : {};
25980
      }
25981
      result = initCloneObject(isFunc ? {} : value);
25982
      if (!isDeep) {
25983
        return baseAssign(result, value);
25984
      }
25985
    } else {
25986
      return cloneableTags[tag]
25987
        ? initCloneByTag(value, tag, isDeep)
25988
        : (object ? value : {});
25989
    }
25990
  }
25991
  // Check for circular references and return its corresponding clone.
25992
  stackA || (stackA = []);
25993
  stackB || (stackB = []);
25994
25995
  var length = stackA.length;
25996
  while (length--) {
25997
    if (stackA[length] == value) {
25998
      return stackB[length];
25999
    }
26000
  }
26001
  // Add the source value to the stack of traversed objects and associate it with its clone.
26002
  stackA.push(value);
26003
  stackB.push(result);
26004
26005
  // Recursively populate clone (susceptible to call stack limits).
26006
  (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
26007
    result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
26008
  });
26009
  return result;
26010
}
26011
26012
module.exports = baseClone;
26013
26014
},{"../lang/isArray":143,"../lang/isObject":147,"./arrayCopy":65,"./arrayEach":66,"./baseAssign":69,"./baseForOwn":79,"./initCloneArray":119,"./initCloneByTag":120,"./initCloneObject":121,"./isHostObject":123}],72:[function(require,module,exports){
26015
/**
26016
 * Copies properties of `source` to `object`.
26017
 *
26018
 * @private
26019
 * @param {Object} source The object to copy properties from.
26020
 * @param {Array} props The property names to copy.
26021
 * @param {Object} [object={}] The object to copy properties to.
26022
 * @returns {Object} Returns `object`.
26023
 */
26024
function baseCopy(source, props, object) {
26025
  object || (object = {});
26026
26027
  var index = -1,
26028
      length = props.length;
26029
26030
  while (++index < length) {
26031
    var key = props[index];
26032
    object[key] = source[key];
26033
  }
26034
  return object;
26035
}
26036
26037
module.exports = baseCopy;
26038
26039
},{}],73:[function(require,module,exports){
26040
var isObject = require('../lang/isObject');
26041
26042
/**
26043
 * The base implementation of `_.create` without support for assigning
26044
 * properties to the created object.
26045
 *
26046
 * @private
26047
 * @param {Object} prototype The object to inherit from.
26048
 * @returns {Object} Returns the new object.
26049
 */
26050
var baseCreate = (function() {
26051
  function object() {}
26052
  return function(prototype) {
26053
    if (isObject(prototype)) {
26054
      object.prototype = prototype;
26055
      var result = new object;
26056
      object.prototype = undefined;
26057
    }
26058
    return result || {};
26059
  };
26060
}());
26061
26062
module.exports = baseCreate;
26063
26064
},{"../lang/isObject":147}],74:[function(require,module,exports){
26065
var baseForOwn = require('./baseForOwn'),
26066
    createBaseEach = require('./createBaseEach');
26067
26068
/**
26069
 * The base implementation of `_.forEach` without support for callback
26070
 * shorthands and `this` binding.
26071
 *
26072
 * @private
26073
 * @param {Array|Object|string} collection The collection to iterate over.
26074
 * @param {Function} iteratee The function invoked per iteration.
26075
 * @returns {Array|Object|string} Returns `collection`.
26076
 */
26077
var baseEach = createBaseEach(baseForOwn);
26078
26079
module.exports = baseEach;
26080
26081
},{"./baseForOwn":79,"./createBaseEach":101}],75:[function(require,module,exports){
26082
/**
26083
 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
26084
 * without support for callback shorthands and `this` binding, which iterates
26085
 * over `collection` using the provided `eachFunc`.
26086
 *
26087
 * @private
26088
 * @param {Array|Object|string} collection The collection to search.
26089
 * @param {Function} predicate The function invoked per iteration.
26090
 * @param {Function} eachFunc The function to iterate over `collection`.
26091
 * @param {boolean} [retKey] Specify returning the key of the found element
26092
 *  instead of the element itself.
26093
 * @returns {*} Returns the found element or its key, else `undefined`.
26094
 */
26095
function baseFind(collection, predicate, eachFunc, retKey) {
26096
  var result;
26097
  eachFunc(collection, function(value, key, collection) {
26098
    if (predicate(value, key, collection)) {
26099
      result = retKey ? key : value;
26100
      return false;
26101
    }
26102
  });
26103
  return result;
26104
}
26105
26106
module.exports = baseFind;
26107
26108
},{}],76:[function(require,module,exports){
26109
/**
26110
 * The base implementation of `_.findIndex` and `_.findLastIndex` without
26111
 * support for callback shorthands and `this` binding.
26112
 *
26113
 * @private
26114
 * @param {Array} array The array to search.
26115
 * @param {Function} predicate The function invoked per iteration.
26116
 * @param {boolean} [fromRight] Specify iterating from right to left.
26117
 * @returns {number} Returns the index of the matched value, else `-1`.
26118
 */
26119
function baseFindIndex(array, predicate, fromRight) {
26120
  var length = array.length,
26121
      index = fromRight ? length : -1;
26122
26123
  while ((fromRight ? index-- : ++index < length)) {
26124
    if (predicate(array[index], index, array)) {
26125
      return index;
26126
    }
26127
  }
26128
  return -1;
26129
}
26130
26131
module.exports = baseFindIndex;
26132
26133
},{}],77:[function(require,module,exports){
26134
var createBaseFor = require('./createBaseFor');
26135
26136
/**
26137
 * The base implementation of `baseForIn` and `baseForOwn` which iterates
26138
 * over `object` properties returned by `keysFunc` invoking `iteratee` for
26139
 * each property. Iteratee functions may exit iteration early by explicitly
26140
 * returning `false`.
26141
 *
26142
 * @private
26143
 * @param {Object} object The object to iterate over.
26144
 * @param {Function} iteratee The function invoked per iteration.
26145
 * @param {Function} keysFunc The function to get the keys of `object`.
26146
 * @returns {Object} Returns `object`.
26147
 */
26148
var baseFor = createBaseFor();
26149
26150
module.exports = baseFor;
26151
26152
},{"./createBaseFor":102}],78:[function(require,module,exports){
26153
var baseFor = require('./baseFor'),
26154
    keysIn = require('../object/keysIn');
26155
26156
/**
26157
 * The base implementation of `_.forIn` without support for callback
26158
 * shorthands and `this` binding.
26159
 *
26160
 * @private
26161
 * @param {Object} object The object to iterate over.
26162
 * @param {Function} iteratee The function invoked per iteration.
26163
 * @returns {Object} Returns `object`.
26164
 */
26165
function baseForIn(object, iteratee) {
26166
  return baseFor(object, iteratee, keysIn);
26167
}
26168
26169
module.exports = baseForIn;
26170
26171
},{"../object/keysIn":153,"./baseFor":77}],79:[function(require,module,exports){
26172
var baseFor = require('./baseFor'),
26173
    keys = require('../object/keys');
26174
26175
/**
26176
 * The base implementation of `_.forOwn` without support for callback
26177
 * shorthands and `this` binding.
26178
 *
26179
 * @private
26180
 * @param {Object} object The object to iterate over.
26181
 * @param {Function} iteratee The function invoked per iteration.
26182
 * @returns {Object} Returns `object`.
26183
 */
26184
function baseForOwn(object, iteratee) {
26185
  return baseFor(object, iteratee, keys);
26186
}
26187
26188
module.exports = baseForOwn;
26189
26190
},{"../object/keys":152,"./baseFor":77}],80:[function(require,module,exports){
26191
var toObject = require('./toObject');
26192
26193
/**
26194
 * The base implementation of `get` without support for string paths
26195
 * and default values.
26196
 *
26197
 * @private
26198
 * @param {Object} object The object to query.
26199
 * @param {Array} path The path of the property to get.
26200
 * @param {string} [pathKey] The key representation of path.
26201
 * @returns {*} Returns the resolved value.
26202
 */
26203
function baseGet(object, path, pathKey) {
26204
  if (object == null) {
26205
    return;
26206
  }
26207
  object = toObject(object);
26208
  if (pathKey !== undefined && pathKey in object) {
26209
    path = [pathKey];
26210
  }
26211
  var index = 0,
26212
      length = path.length;
26213
26214
  while (object != null && index < length) {
26215
    object = toObject(object)[path[index++]];
26216
  }
26217
  return (index && index == length) ? object : undefined;
26218
}
26219
26220
module.exports = baseGet;
26221
26222
},{"./toObject":138}],81:[function(require,module,exports){
26223
var indexOfNaN = require('./indexOfNaN');
26224
26225
/**
26226
 * The base implementation of `_.indexOf` without support for binary searches.
26227
 *
26228
 * @private
26229
 * @param {Array} array The array to search.
26230
 * @param {*} value The value to search for.
26231
 * @param {number} fromIndex The index to search from.
26232
 * @returns {number} Returns the index of the matched value, else `-1`.
26233
 */
26234
function baseIndexOf(array, value, fromIndex) {
26235
  if (value !== value) {
26236
    return indexOfNaN(array, fromIndex);
26237
  }
26238
  var index = fromIndex - 1,
26239
      length = array.length;
26240
26241
  while (++index < length) {
26242
    if (array[index] === value) {
26243
      return index;
26244
    }
26245
  }
26246
  return -1;
26247
}
26248
26249
module.exports = baseIndexOf;
26250
26251
},{"./indexOfNaN":118}],82:[function(require,module,exports){
26252
var baseIsEqualDeep = require('./baseIsEqualDeep'),
26253
    isObject = require('../lang/isObject'),
26254
    isObjectLike = require('./isObjectLike');
26255
26256
/**
26257
 * The base implementation of `_.isEqual` without support for `this` binding
26258
 * `customizer` functions.
26259
 *
26260
 * @private
26261
 * @param {*} value The value to compare.
26262
 * @param {*} other The other value to compare.
26263
 * @param {Function} [customizer] The function to customize comparing values.
26264
 * @param {boolean} [isLoose] Specify performing partial comparisons.
26265
 * @param {Array} [stackA] Tracks traversed `value` objects.
26266
 * @param {Array} [stackB] Tracks traversed `other` objects.
26267
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
26268
 */
26269
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
26270
  if (value === other) {
26271
    return true;
26272
  }
26273
  if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
26274
    return value !== value && other !== other;
26275
  }
26276
  return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
26277
}
26278
26279
module.exports = baseIsEqual;
26280
26281
},{"../lang/isObject":147,"./baseIsEqualDeep":83,"./isObjectLike":129}],83:[function(require,module,exports){
26282
var equalArrays = require('./equalArrays'),
26283
    equalByTag = require('./equalByTag'),
26284
    equalObjects = require('./equalObjects'),
26285
    isArray = require('../lang/isArray'),
26286
    isHostObject = require('./isHostObject'),
26287
    isTypedArray = require('../lang/isTypedArray');
26288
26289
/** `Object#toString` result references. */
26290
var argsTag = '[object Arguments]',
26291
    arrayTag = '[object Array]',
26292
    objectTag = '[object Object]';
26293
26294
/** Used for native method references. */
26295
var objectProto = Object.prototype;
26296
26297
/** Used to check objects for own properties. */
26298
var hasOwnProperty = objectProto.hasOwnProperty;
26299
26300
/**
26301
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
26302
 * of values.
26303
 */
26304
var objToString = objectProto.toString;
26305
26306
/**
26307
 * A specialized version of `baseIsEqual` for arrays and objects which performs
26308
 * deep comparisons and tracks traversed objects enabling objects with circular
26309
 * references to be compared.
26310
 *
26311
 * @private
26312
 * @param {Object} object The object to compare.
26313
 * @param {Object} other The other object to compare.
26314
 * @param {Function} equalFunc The function to determine equivalents of values.
26315
 * @param {Function} [customizer] The function to customize comparing objects.
26316
 * @param {boolean} [isLoose] Specify performing partial comparisons.
26317
 * @param {Array} [stackA=[]] Tracks traversed `value` objects.
26318
 * @param {Array} [stackB=[]] Tracks traversed `other` objects.
26319
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
26320
 */
26321
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
26322
  var objIsArr = isArray(object),
26323
      othIsArr = isArray(other),
26324
      objTag = arrayTag,
26325
      othTag = arrayTag;
26326
26327
  if (!objIsArr) {
26328
    objTag = objToString.call(object);
26329
    if (objTag == argsTag) {
26330
      objTag = objectTag;
26331
    } else if (objTag != objectTag) {
26332
      objIsArr = isTypedArray(object);
26333
    }
26334
  }
26335
  if (!othIsArr) {
26336
    othTag = objToString.call(other);
26337
    if (othTag == argsTag) {
26338
      othTag = objectTag;
26339
    } else if (othTag != objectTag) {
26340
      othIsArr = isTypedArray(other);
26341
    }
26342
  }
26343
  var objIsObj = objTag == objectTag && !isHostObject(object),
26344
      othIsObj = othTag == objectTag && !isHostObject(other),
26345
      isSameTag = objTag == othTag;
26346
26347
  if (isSameTag && !(objIsArr || objIsObj)) {
26348
    return equalByTag(object, other, objTag);
26349
  }
26350
  if (!isLoose) {
26351
    var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
26352
        othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
26353
26354
    if (objIsWrapped || othIsWrapped) {
26355
      return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
26356
    }
26357
  }
26358
  if (!isSameTag) {
26359
    return false;
26360
  }
26361
  // Assume cyclic values are equal.
26362
  // For more information on detecting circular references see https://es5.github.io/#JO.
26363
  stackA || (stackA = []);
26364
  stackB || (stackB = []);
26365
26366
  var length = stackA.length;
26367
  while (length--) {
26368
    if (stackA[length] == object) {
26369
      return stackB[length] == other;
26370
    }
26371
  }
26372
  // Add `object` and `other` to the stack of traversed objects.
26373
  stackA.push(object);
26374
  stackB.push(other);
26375
26376
  var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
26377
26378
  stackA.pop();
26379
  stackB.pop();
26380
26381
  return result;
26382
}
26383
26384
module.exports = baseIsEqualDeep;
26385
26386
},{"../lang/isArray":143,"../lang/isTypedArray":150,"./equalArrays":110,"./equalByTag":111,"./equalObjects":112,"./isHostObject":123}],84:[function(require,module,exports){
26387
var baseIsEqual = require('./baseIsEqual'),
26388
    toObject = require('./toObject');
26389
26390
/**
26391
 * The base implementation of `_.isMatch` without support for callback
26392
 * shorthands and `this` binding.
26393
 *
26394
 * @private
26395
 * @param {Object} object The object to inspect.
26396
 * @param {Array} matchData The propery names, values, and compare flags to match.
26397
 * @param {Function} [customizer] The function to customize comparing objects.
26398
 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
26399
 */
26400
function baseIsMatch(object, matchData, customizer) {
26401
  var index = matchData.length,
26402
      length = index,
26403
      noCustomizer = !customizer;
26404
26405
  if (object == null) {
26406
    return !length;
26407
  }
26408
  object = toObject(object);
26409
  while (index--) {
26410
    var data = matchData[index];
26411
    if ((noCustomizer && data[2])
26412
          ? data[1] !== object[data[0]]
26413
          : !(data[0] in object)
26414
        ) {
26415
      return false;
26416
    }
26417
  }
26418
  while (++index < length) {
26419
    data = matchData[index];
26420
    var key = data[0],
26421
        objValue = object[key],
26422
        srcValue = data[1];
26423
26424
    if (noCustomizer && data[2]) {
26425
      if (objValue === undefined && !(key in object)) {
26426
        return false;
26427
      }
26428
    } else {
26429
      var result = customizer ? customizer(objValue, srcValue, key) : undefined;
26430
      if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
26431
        return false;
26432
      }
26433
    }
26434
  }
26435
  return true;
26436
}
26437
26438
module.exports = baseIsMatch;
26439
26440
},{"./baseIsEqual":82,"./toObject":138}],85:[function(require,module,exports){
26441
/**
26442
 * The function whose prototype all chaining wrappers inherit from.
26443
 *
26444
 * @private
26445
 */
26446
function baseLodash() {
26447
  // No operation performed.
26448
}
26449
26450
module.exports = baseLodash;
26451
26452
},{}],86:[function(require,module,exports){
26453
var baseEach = require('./baseEach'),
26454
    isArrayLike = require('./isArrayLike');
26455
26456
/**
26457
 * The base implementation of `_.map` without support for callback shorthands
26458
 * and `this` binding.
26459
 *
26460
 * @private
26461
 * @param {Array|Object|string} collection The collection to iterate over.
26462
 * @param {Function} iteratee The function invoked per iteration.
26463
 * @returns {Array} Returns the new mapped array.
26464
 */
26465
function baseMap(collection, iteratee) {
26466
  var index = -1,
26467
      result = isArrayLike(collection) ? Array(collection.length) : [];
26468
26469
  baseEach(collection, function(value, key, collection) {
26470
    result[++index] = iteratee(value, key, collection);
26471
  });
26472
  return result;
26473
}
26474
26475
module.exports = baseMap;
26476
26477
},{"./baseEach":74,"./isArrayLike":122}],87:[function(require,module,exports){
26478
var baseIsMatch = require('./baseIsMatch'),
26479
    getMatchData = require('./getMatchData'),
26480
    toObject = require('./toObject');
26481
26482
/**
26483
 * The base implementation of `_.matches` which does not clone `source`.
26484
 *
26485
 * @private
26486
 * @param {Object} source The object of property values to match.
26487
 * @returns {Function} Returns the new function.
26488
 */
26489
function baseMatches(source) {
26490
  var matchData = getMatchData(source);
26491
  if (matchData.length == 1 && matchData[0][2]) {
26492
    var key = matchData[0][0],
26493
        value = matchData[0][1];
26494
26495
    return function(object) {
26496
      if (object == null) {
26497
        return false;
26498
      }
26499
      object = toObject(object);
26500
      return object[key] === value && (value !== undefined || (key in object));
26501
    };
26502
  }
26503
  return function(object) {
26504
    return baseIsMatch(object, matchData);
26505
  };
26506
}
26507
26508
module.exports = baseMatches;
26509
26510
},{"./baseIsMatch":84,"./getMatchData":116,"./toObject":138}],88:[function(require,module,exports){
26511
var baseGet = require('./baseGet'),
26512
    baseIsEqual = require('./baseIsEqual'),
26513
    baseSlice = require('./baseSlice'),
26514
    isArray = require('../lang/isArray'),
26515
    isKey = require('./isKey'),
26516
    isStrictComparable = require('./isStrictComparable'),
26517
    last = require('../array/last'),
26518
    toObject = require('./toObject'),
26519
    toPath = require('./toPath');
26520
26521
/**
26522
 * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
26523
 *
26524
 * @private
26525
 * @param {string} path The path of the property to get.
26526
 * @param {*} srcValue The value to compare.
26527
 * @returns {Function} Returns the new function.
26528
 */
26529
function baseMatchesProperty(path, srcValue) {
26530
  var isArr = isArray(path),
26531
      isCommon = isKey(path) && isStrictComparable(srcValue),
26532
      pathKey = (path + '');
26533
26534
  path = toPath(path);
26535
  return function(object) {
26536
    if (object == null) {
26537
      return false;
26538
    }
26539
    var key = pathKey;
26540
    object = toObject(object);
26541
    if ((isArr || !isCommon) && !(key in object)) {
26542
      object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
26543
      if (object == null) {
26544
        return false;
26545
      }
26546
      key = last(path);
26547
      object = toObject(object);
26548
    }
26549
    return object[key] === srcValue
26550
      ? (srcValue !== undefined || (key in object))
26551
      : baseIsEqual(srcValue, object[key], undefined, true);
26552
  };
26553
}
26554
26555
module.exports = baseMatchesProperty;
26556
26557
},{"../array/last":53,"../lang/isArray":143,"./baseGet":80,"./baseIsEqual":82,"./baseSlice":92,"./isKey":126,"./isStrictComparable":130,"./toObject":138,"./toPath":139}],89:[function(require,module,exports){
26558
var toObject = require('./toObject');
26559
26560
/**
26561
 * The base implementation of `_.property` without support for deep paths.
26562
 *
26563
 * @private
26564
 * @param {string} key The key of the property to get.
26565
 * @returns {Function} Returns the new function.
26566
 */
26567
function baseProperty(key) {
26568
  return function(object) {
26569
    return object == null ? undefined : toObject(object)[key];
26570
  };
26571
}
26572
26573
module.exports = baseProperty;
26574
26575
},{"./toObject":138}],90:[function(require,module,exports){
26576
var baseGet = require('./baseGet'),
26577
    toPath = require('./toPath');
26578
26579
/**
26580
 * A specialized version of `baseProperty` which supports deep paths.
26581
 *
26582
 * @private
26583
 * @param {Array|string} path The path of the property to get.
26584
 * @returns {Function} Returns the new function.
26585
 */
26586
function basePropertyDeep(path) {
26587
  var pathKey = (path + '');
26588
  path = toPath(path);
26589
  return function(object) {
26590
    return baseGet(object, path, pathKey);
26591
  };
26592
}
26593
26594
module.exports = basePropertyDeep;
26595
26596
},{"./baseGet":80,"./toPath":139}],91:[function(require,module,exports){
26597
var identity = require('../utility/identity'),
26598
    metaMap = require('./metaMap');
26599
26600
/**
26601
 * The base implementation of `setData` without support for hot loop detection.
26602
 *
26603
 * @private
26604
 * @param {Function} func The function to associate metadata with.
26605
 * @param {*} data The metadata.
26606
 * @returns {Function} Returns `func`.
26607
 */
26608
var baseSetData = !metaMap ? identity : function(func, data) {
26609
  metaMap.set(func, data);
26610
  return func;
26611
};
26612
26613
module.exports = baseSetData;
26614
26615
},{"../utility/identity":157,"./metaMap":132}],92:[function(require,module,exports){
26616
/**
26617
 * The base implementation of `_.slice` without an iteratee call guard.
26618
 *
26619
 * @private
26620
 * @param {Array} array The array to slice.
26621
 * @param {number} [start=0] The start position.
26622
 * @param {number} [end=array.length] The end position.
26623
 * @returns {Array} Returns the slice of `array`.
26624
 */
26625
function baseSlice(array, start, end) {
26626
  var index = -1,
26627
      length = array.length;
26628
26629
  start = start == null ? 0 : (+start || 0);
26630
  if (start < 0) {
26631
    start = -start > length ? 0 : (length + start);
26632
  }
26633
  end = (end === undefined || end > length) ? length : (+end || 0);
26634
  if (end < 0) {
26635
    end += length;
26636
  }
26637
  length = start > end ? 0 : ((end - start) >>> 0);
26638
  start >>>= 0;
26639
26640
  var result = Array(length);
26641
  while (++index < length) {
26642
    result[index] = array[index + start];
26643
  }
26644
  return result;
26645
}
26646
26647
module.exports = baseSlice;
26648
26649
},{}],93:[function(require,module,exports){
26650
/**
26651
 * Converts `value` to a string if it's not one. An empty string is returned
26652
 * for `null` or `undefined` values.
26653
 *
26654
 * @private
26655
 * @param {*} value The value to process.
26656
 * @returns {string} Returns the string.
26657
 */
26658
function baseToString(value) {
26659
  return value == null ? '' : (value + '');
26660
}
26661
26662
module.exports = baseToString;
26663
26664
},{}],94:[function(require,module,exports){
26665
/**
26666
 * The base implementation of `_.values` and `_.valuesIn` which creates an
26667
 * array of `object` property values corresponding to the property names
26668
 * of `props`.
26669
 *
26670
 * @private
26671
 * @param {Object} object The object to query.
26672
 * @param {Array} props The property names to get values for.
26673
 * @returns {Object} Returns the array of property values.
26674
 */
26675
function baseValues(object, props) {
26676
  var index = -1,
26677
      length = props.length,
26678
      result = Array(length);
26679
26680
  while (++index < length) {
26681
    result[index] = object[props[index]];
26682
  }
26683
  return result;
26684
}
26685
26686
module.exports = baseValues;
26687
26688
},{}],95:[function(require,module,exports){
26689
var binaryIndexBy = require('./binaryIndexBy'),
26690
    identity = require('../utility/identity');
26691
26692
/** Used as references for the maximum length and index of an array. */
26693
var MAX_ARRAY_LENGTH = 4294967295,
26694
    HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
26695
26696
/**
26697
 * Performs a binary search of `array` to determine the index at which `value`
26698
 * should be inserted into `array` in order to maintain its sort order.
26699
 *
26700
 * @private
26701
 * @param {Array} array The sorted array to inspect.
26702
 * @param {*} value The value to evaluate.
26703
 * @param {boolean} [retHighest] Specify returning the highest qualified index.
26704
 * @returns {number} Returns the index at which `value` should be inserted
26705
 *  into `array`.
26706
 */
26707
function binaryIndex(array, value, retHighest) {
26708
  var low = 0,
26709
      high = array ? array.length : low;
26710
26711
  if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
26712
    while (low < high) {
26713
      var mid = (low + high) >>> 1,
26714
          computed = array[mid];
26715
26716
      if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
26717
        low = mid + 1;
26718
      } else {
26719
        high = mid;
26720
      }
26721
    }
26722
    return high;
26723
  }
26724
  return binaryIndexBy(array, value, identity, retHighest);
26725
}
26726
26727
module.exports = binaryIndex;
26728
26729
},{"../utility/identity":157,"./binaryIndexBy":96}],96:[function(require,module,exports){
26730
/* Native method references for those with the same name as other `lodash` methods. */
26731
var nativeFloor = Math.floor,
26732
    nativeMin = Math.min;
26733
26734
/** Used as references for the maximum length and index of an array. */
26735
var MAX_ARRAY_LENGTH = 4294967295,
26736
    MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
26737
26738
/**
26739
 * This function is like `binaryIndex` except that it invokes `iteratee` for
26740
 * `value` and each element of `array` to compute their sort ranking. The
26741
 * iteratee is invoked with one argument; (value).
26742
 *
26743
 * @private
26744
 * @param {Array} array The sorted array to inspect.
26745
 * @param {*} value The value to evaluate.
26746
 * @param {Function} iteratee The function invoked per iteration.
26747
 * @param {boolean} [retHighest] Specify returning the highest qualified index.
26748
 * @returns {number} Returns the index at which `value` should be inserted
26749
 *  into `array`.
26750
 */
26751
function binaryIndexBy(array, value, iteratee, retHighest) {
26752
  value = iteratee(value);
26753
26754
  var low = 0,
26755
      high = array ? array.length : 0,
26756
      valIsNaN = value !== value,
26757
      valIsNull = value === null,
26758
      valIsUndef = value === undefined;
26759
26760
  while (low < high) {
26761
    var mid = nativeFloor((low + high) / 2),
26762
        computed = iteratee(array[mid]),
26763
        isDef = computed !== undefined,
26764
        isReflexive = computed === computed;
26765
26766
    if (valIsNaN) {
26767
      var setLow = isReflexive || retHighest;
26768
    } else if (valIsNull) {
26769
      setLow = isReflexive && isDef && (retHighest || computed != null);
26770
    } else if (valIsUndef) {
26771
      setLow = isReflexive && (retHighest || isDef);
26772
    } else if (computed == null) {
26773
      setLow = false;
26774
    } else {
26775
      setLow = retHighest ? (computed <= value) : (computed < value);
26776
    }
26777
    if (setLow) {
26778
      low = mid + 1;
26779
    } else {
26780
      high = mid;
26781
    }
26782
  }
26783
  return nativeMin(high, MAX_ARRAY_INDEX);
26784
}
26785
26786
module.exports = binaryIndexBy;
26787
26788
},{}],97:[function(require,module,exports){
26789
var identity = require('../utility/identity');
26790
26791
/**
26792
 * A specialized version of `baseCallback` which only supports `this` binding
26793
 * and specifying the number of arguments to provide to `func`.
26794
 *
26795
 * @private
26796
 * @param {Function} func The function to bind.
26797
 * @param {*} thisArg The `this` binding of `func`.
26798
 * @param {number} [argCount] The number of arguments to provide to `func`.
26799
 * @returns {Function} Returns the callback.
26800
 */
26801
function bindCallback(func, thisArg, argCount) {
26802
  if (typeof func != 'function') {
26803
    return identity;
26804
  }
26805
  if (thisArg === undefined) {
26806
    return func;
26807
  }
26808
  switch (argCount) {
26809
    case 1: return function(value) {
26810
      return func.call(thisArg, value);
26811
    };
26812
    case 3: return function(value, index, collection) {
26813
      return func.call(thisArg, value, index, collection);
26814
    };
26815
    case 4: return function(accumulator, value, index, collection) {
26816
      return func.call(thisArg, accumulator, value, index, collection);
26817
    };
26818
    case 5: return function(value, other, key, object, source) {
26819
      return func.call(thisArg, value, other, key, object, source);
26820
    };
26821
  }
26822
  return function() {
26823
    return func.apply(thisArg, arguments);
26824
  };
26825
}
26826
26827
module.exports = bindCallback;
26828
26829
},{"../utility/identity":157}],98:[function(require,module,exports){
26830
(function (global){
26831
/** Native method references. */
26832
var ArrayBuffer = global.ArrayBuffer,
26833
    Uint8Array = global.Uint8Array;
26834
26835
/**
26836
 * Creates a clone of the given array buffer.
26837
 *
26838
 * @private
26839
 * @param {ArrayBuffer} buffer The array buffer to clone.
26840
 * @returns {ArrayBuffer} Returns the cloned array buffer.
26841
 */
26842
function bufferClone(buffer) {
26843
  var result = new ArrayBuffer(buffer.byteLength),
26844
      view = new Uint8Array(result);
26845
26846
  view.set(new Uint8Array(buffer));
26847
  return result;
26848
}
26849
26850
module.exports = bufferClone;
26851
26852
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
26853
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2J1ZmZlckNsb25lLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBOYXRpdmUgbWV0aG9kIHJlZmVyZW5jZXMuICovXG52YXIgQXJyYXlCdWZmZXIgPSBnbG9iYWwuQXJyYXlCdWZmZXIsXG4gICAgVWludDhBcnJheSA9IGdsb2JhbC5VaW50OEFycmF5O1xuXG4vKipcbiAqIENyZWF0ZXMgYSBjbG9uZSBvZiB0aGUgZ2l2ZW4gYXJyYXkgYnVmZmVyLlxuICpcbiAqIEBwcml2YXRlXG4gKiBAcGFyYW0ge0FycmF5QnVmZmVyfSBidWZmZXIgVGhlIGFycmF5IGJ1ZmZlciB0byBjbG9uZS5cbiAqIEByZXR1cm5zIHtBcnJheUJ1ZmZlcn0gUmV0dXJucyB0aGUgY2xvbmVkIGFycmF5IGJ1ZmZlci5cbiAqL1xuZnVuY3Rpb24gYnVmZmVyQ2xvbmUoYnVmZmVyKSB7XG4gIHZhciByZXN1bHQgPSBuZXcgQXJyYXlCdWZmZXIoYnVmZmVyLmJ5dGVMZW5ndGgpLFxuICAgICAgdmlldyA9IG5ldyBVaW50OEFycmF5KHJlc3VsdCk7XG5cbiAgdmlldy5zZXQobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSk7XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gYnVmZmVyQ2xvbmU7XG4iXX0=
26854
},{}],99:[function(require,module,exports){
26855
/* Native method references for those with the same name as other `lodash` methods. */
26856
var nativeMax = Math.max;
26857
26858
/**
26859
 * Creates an array that is the composition of partially applied arguments,
26860
 * placeholders, and provided arguments into a single array of arguments.
26861
 *
26862
 * @private
26863
 * @param {Array|Object} args The provided arguments.
26864
 * @param {Array} partials The arguments to prepend to those provided.
26865
 * @param {Array} holders The `partials` placeholder indexes.
26866
 * @returns {Array} Returns the new array of composed arguments.
26867
 */
26868
function composeArgs(args, partials, holders) {
26869
  var holdersLength = holders.length,
26870
      argsIndex = -1,
26871
      argsLength = nativeMax(args.length - holdersLength, 0),
26872
      leftIndex = -1,
26873
      leftLength = partials.length,
26874
      result = Array(leftLength + argsLength);
26875
26876
  while (++leftIndex < leftLength) {
26877
    result[leftIndex] = partials[leftIndex];
26878
  }
26879
  while (++argsIndex < holdersLength) {
26880
    result[holders[argsIndex]] = args[argsIndex];
26881
  }
26882
  while (argsLength--) {
26883
    result[leftIndex++] = args[argsIndex++];
26884
  }
26885
  return result;
26886
}
26887
26888
module.exports = composeArgs;
26889
26890
},{}],100:[function(require,module,exports){
26891
/* Native method references for those with the same name as other `lodash` methods. */
26892
var nativeMax = Math.max;
26893
26894
/**
26895
 * This function is like `composeArgs` except that the arguments composition
26896
 * is tailored for `_.partialRight`.
26897
 *
26898
 * @private
26899
 * @param {Array|Object} args The provided arguments.
26900
 * @param {Array} partials The arguments to append to those provided.
26901
 * @param {Array} holders The `partials` placeholder indexes.
26902
 * @returns {Array} Returns the new array of composed arguments.
26903
 */
26904
function composeArgsRight(args, partials, holders) {
26905
  var holdersIndex = -1,
26906
      holdersLength = holders.length,
26907
      argsIndex = -1,
26908
      argsLength = nativeMax(args.length - holdersLength, 0),
26909
      rightIndex = -1,
26910
      rightLength = partials.length,
26911
      result = Array(argsLength + rightLength);
26912
26913
  while (++argsIndex < argsLength) {
26914
    result[argsIndex] = args[argsIndex];
26915
  }
26916
  var offset = argsIndex;
26917
  while (++rightIndex < rightLength) {
26918
    result[offset + rightIndex] = partials[rightIndex];
26919
  }
26920
  while (++holdersIndex < holdersLength) {
26921
    result[offset + holders[holdersIndex]] = args[argsIndex++];
26922
  }
26923
  return result;
26924
}
26925
26926
module.exports = composeArgsRight;
26927
26928
},{}],101:[function(require,module,exports){
26929
var getLength = require('./getLength'),
26930
    isLength = require('./isLength'),
26931
    toObject = require('./toObject');
26932
26933
/**
26934
 * Creates a `baseEach` or `baseEachRight` function.
26935
 *
26936
 * @private
26937
 * @param {Function} eachFunc The function to iterate over a collection.
26938
 * @param {boolean} [fromRight] Specify iterating from right to left.
26939
 * @returns {Function} Returns the new base function.
26940
 */
26941
function createBaseEach(eachFunc, fromRight) {
26942
  return function(collection, iteratee) {
26943
    var length = collection ? getLength(collection) : 0;
26944
    if (!isLength(length)) {
26945
      return eachFunc(collection, iteratee);
26946
    }
26947
    var index = fromRight ? length : -1,
26948
        iterable = toObject(collection);
26949
26950
    while ((fromRight ? index-- : ++index < length)) {
26951
      if (iteratee(iterable[index], index, iterable) === false) {
26952
        break;
26953
      }
26954
    }
26955
    return collection;
26956
  };
26957
}
26958
26959
module.exports = createBaseEach;
26960
26961
},{"./getLength":115,"./isLength":128,"./toObject":138}],102:[function(require,module,exports){
26962
var toObject = require('./toObject');
26963
26964
/**
26965
 * Creates a base function for `_.forIn` or `_.forInRight`.
26966
 *
26967
 * @private
26968
 * @param {boolean} [fromRight] Specify iterating from right to left.
26969
 * @returns {Function} Returns the new base function.
26970
 */
26971
function createBaseFor(fromRight) {
26972
  return function(object, iteratee, keysFunc) {
26973
    var iterable = toObject(object),
26974
        props = keysFunc(object),
26975
        length = props.length,
26976
        index = fromRight ? length : -1;
26977
26978
    while ((fromRight ? index-- : ++index < length)) {
26979
      var key = props[index];
26980
      if (iteratee(iterable[key], key, iterable) === false) {
26981
        break;
26982
      }
26983
    }
26984
    return object;
26985
  };
26986
}
26987
26988
module.exports = createBaseFor;
26989
26990
},{"./toObject":138}],103:[function(require,module,exports){
26991
(function (global){
26992
var createCtorWrapper = require('./createCtorWrapper');
26993
26994
/**
26995
 * Creates a function that wraps `func` and invokes it with the `this`
26996
 * binding of `thisArg`.
26997
 *
26998
 * @private
26999
 * @param {Function} func The function to bind.
27000
 * @param {*} [thisArg] The `this` binding of `func`.
27001
 * @returns {Function} Returns the new bound function.
27002
 */
27003
function createBindWrapper(func, thisArg) {
27004
  var Ctor = createCtorWrapper(func);
27005
27006
  function wrapper() {
27007
    var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
27008
    return fn.apply(thisArg, arguments);
27009
  }
27010
  return wrapper;
27011
}
27012
27013
module.exports = createBindWrapper;
27014
27015
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27016
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUJpbmRXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgY3JlYXRlQ3RvcldyYXBwZXIgPSByZXF1aXJlKCcuL2NyZWF0ZUN0b3JXcmFwcGVyJyk7XG5cbi8qKlxuICogQ3JlYXRlcyBhIGZ1bmN0aW9uIHRoYXQgd3JhcHMgYGZ1bmNgIGFuZCBpbnZva2VzIGl0IHdpdGggdGhlIGB0aGlzYFxuICogYmluZGluZyBvZiBgdGhpc0FyZ2AuXG4gKlxuICogQHByaXZhdGVcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGZ1bmMgVGhlIGZ1bmN0aW9uIHRvIGJpbmQuXG4gKiBAcGFyYW0geyp9IFt0aGlzQXJnXSBUaGUgYHRoaXNgIGJpbmRpbmcgb2YgYGZ1bmNgLlxuICogQHJldHVybnMge0Z1bmN0aW9ufSBSZXR1cm5zIHRoZSBuZXcgYm91bmQgZnVuY3Rpb24uXG4gKi9cbmZ1bmN0aW9uIGNyZWF0ZUJpbmRXcmFwcGVyKGZ1bmMsIHRoaXNBcmcpIHtcbiAgdmFyIEN0b3IgPSBjcmVhdGVDdG9yV3JhcHBlcihmdW5jKTtcblxuICBmdW5jdGlvbiB3cmFwcGVyKCkge1xuICAgIHZhciBmbiA9ICh0aGlzICYmIHRoaXMgIT09IGdsb2JhbCAmJiB0aGlzIGluc3RhbmNlb2Ygd3JhcHBlcikgPyBDdG9yIDogZnVuYztcbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJndW1lbnRzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVCaW5kV3JhcHBlcjtcbiJdfQ==
27017
},{"./createCtorWrapper":104}],104:[function(require,module,exports){
27018
var baseCreate = require('./baseCreate'),
27019
    isObject = require('../lang/isObject');
27020
27021
/**
27022
 * Creates a function that produces an instance of `Ctor` regardless of
27023
 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
27024
 *
27025
 * @private
27026
 * @param {Function} Ctor The constructor to wrap.
27027
 * @returns {Function} Returns the new wrapped function.
27028
 */
27029
function createCtorWrapper(Ctor) {
27030
  return function() {
27031
    // Use a `switch` statement to work with class constructors.
27032
    // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
27033
    // for more details.
27034
    var args = arguments;
27035
    switch (args.length) {
27036
      case 0: return new Ctor;
27037
      case 1: return new Ctor(args[0]);
27038
      case 2: return new Ctor(args[0], args[1]);
27039
      case 3: return new Ctor(args[0], args[1], args[2]);
27040
      case 4: return new Ctor(args[0], args[1], args[2], args[3]);
27041
      case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
27042
      case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
27043
      case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
27044
    }
27045
    var thisBinding = baseCreate(Ctor.prototype),
27046
        result = Ctor.apply(thisBinding, args);
27047
27048
    // Mimic the constructor's `return` behavior.
27049
    // See https://es5.github.io/#x13.2.2 for more details.
27050
    return isObject(result) ? result : thisBinding;
27051
  };
27052
}
27053
27054
module.exports = createCtorWrapper;
27055
27056
},{"../lang/isObject":147,"./baseCreate":73}],105:[function(require,module,exports){
27057
var baseCallback = require('./baseCallback'),
27058
    baseFind = require('./baseFind'),
27059
    baseFindIndex = require('./baseFindIndex'),
27060
    isArray = require('../lang/isArray');
27061
27062
/**
27063
 * Creates a `_.find` or `_.findLast` function.
27064
 *
27065
 * @private
27066
 * @param {Function} eachFunc The function to iterate over a collection.
27067
 * @param {boolean} [fromRight] Specify iterating from right to left.
27068
 * @returns {Function} Returns the new find function.
27069
 */
27070
function createFind(eachFunc, fromRight) {
27071
  return function(collection, predicate, thisArg) {
27072
    predicate = baseCallback(predicate, thisArg, 3);
27073
    if (isArray(collection)) {
27074
      var index = baseFindIndex(collection, predicate, fromRight);
27075
      return index > -1 ? collection[index] : undefined;
27076
    }
27077
    return baseFind(collection, predicate, eachFunc);
27078
  };
27079
}
27080
27081
module.exports = createFind;
27082
27083
},{"../lang/isArray":143,"./baseCallback":70,"./baseFind":75,"./baseFindIndex":76}],106:[function(require,module,exports){
27084
var bindCallback = require('./bindCallback'),
27085
    isArray = require('../lang/isArray');
27086
27087
/**
27088
 * Creates a function for `_.forEach` or `_.forEachRight`.
27089
 *
27090
 * @private
27091
 * @param {Function} arrayFunc The function to iterate over an array.
27092
 * @param {Function} eachFunc The function to iterate over a collection.
27093
 * @returns {Function} Returns the new each function.
27094
 */
27095
function createForEach(arrayFunc, eachFunc) {
27096
  return function(collection, iteratee, thisArg) {
27097
    return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
27098
      ? arrayFunc(collection, iteratee)
27099
      : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
27100
  };
27101
}
27102
27103
module.exports = createForEach;
27104
27105
},{"../lang/isArray":143,"./bindCallback":97}],107:[function(require,module,exports){
27106
(function (global){
27107
var arrayCopy = require('./arrayCopy'),
27108
    composeArgs = require('./composeArgs'),
27109
    composeArgsRight = require('./composeArgsRight'),
27110
    createCtorWrapper = require('./createCtorWrapper'),
27111
    isLaziable = require('./isLaziable'),
27112
    reorder = require('./reorder'),
27113
    replaceHolders = require('./replaceHolders'),
27114
    setData = require('./setData');
27115
27116
/** Used to compose bitmasks for wrapper metadata. */
27117
var BIND_FLAG = 1,
27118
    BIND_KEY_FLAG = 2,
27119
    CURRY_BOUND_FLAG = 4,
27120
    CURRY_FLAG = 8,
27121
    CURRY_RIGHT_FLAG = 16,
27122
    PARTIAL_FLAG = 32,
27123
    PARTIAL_RIGHT_FLAG = 64,
27124
    ARY_FLAG = 128;
27125
27126
/* Native method references for those with the same name as other `lodash` methods. */
27127
var nativeMax = Math.max;
27128
27129
/**
27130
 * Creates a function that wraps `func` and invokes it with optional `this`
27131
 * binding of, partial application, and currying.
27132
 *
27133
 * @private
27134
 * @param {Function|string} func The function or method name to reference.
27135
 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
27136
 * @param {*} [thisArg] The `this` binding of `func`.
27137
 * @param {Array} [partials] The arguments to prepend to those provided to the new function.
27138
 * @param {Array} [holders] The `partials` placeholder indexes.
27139
 * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
27140
 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
27141
 * @param {Array} [argPos] The argument positions of the new function.
27142
 * @param {number} [ary] The arity cap of `func`.
27143
 * @param {number} [arity] The arity of `func`.
27144
 * @returns {Function} Returns the new wrapped function.
27145
 */
27146
function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
27147
  var isAry = bitmask & ARY_FLAG,
27148
      isBind = bitmask & BIND_FLAG,
27149
      isBindKey = bitmask & BIND_KEY_FLAG,
27150
      isCurry = bitmask & CURRY_FLAG,
27151
      isCurryBound = bitmask & CURRY_BOUND_FLAG,
27152
      isCurryRight = bitmask & CURRY_RIGHT_FLAG,
27153
      Ctor = isBindKey ? undefined : createCtorWrapper(func);
27154
27155
  function wrapper() {
27156
    // Avoid `arguments` object use disqualifying optimizations by
27157
    // converting it to an array before providing it to other functions.
27158
    var length = arguments.length,
27159
        index = length,
27160
        args = Array(length);
27161
27162
    while (index--) {
27163
      args[index] = arguments[index];
27164
    }
27165
    if (partials) {
27166
      args = composeArgs(args, partials, holders);
27167
    }
27168
    if (partialsRight) {
27169
      args = composeArgsRight(args, partialsRight, holdersRight);
27170
    }
27171
    if (isCurry || isCurryRight) {
27172
      var placeholder = wrapper.placeholder,
27173
          argsHolders = replaceHolders(args, placeholder);
27174
27175
      length -= argsHolders.length;
27176
      if (length < arity) {
27177
        var newArgPos = argPos ? arrayCopy(argPos) : undefined,
27178
            newArity = nativeMax(arity - length, 0),
27179
            newsHolders = isCurry ? argsHolders : undefined,
27180
            newHoldersRight = isCurry ? undefined : argsHolders,
27181
            newPartials = isCurry ? args : undefined,
27182
            newPartialsRight = isCurry ? undefined : args;
27183
27184
        bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
27185
        bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
27186
27187
        if (!isCurryBound) {
27188
          bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
27189
        }
27190
        var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
27191
            result = createHybridWrapper.apply(undefined, newData);
27192
27193
        if (isLaziable(func)) {
27194
          setData(result, newData);
27195
        }
27196
        result.placeholder = placeholder;
27197
        return result;
27198
      }
27199
    }
27200
    var thisBinding = isBind ? thisArg : this,
27201
        fn = isBindKey ? thisBinding[func] : func;
27202
27203
    if (argPos) {
27204
      args = reorder(args, argPos);
27205
    }
27206
    if (isAry && ary < args.length) {
27207
      args.length = ary;
27208
    }
27209
    if (this && this !== global && this instanceof wrapper) {
27210
      fn = Ctor || createCtorWrapper(func);
27211
    }
27212
    return fn.apply(thisBinding, args);
27213
  }
27214
  return wrapper;
27215
}
27216
27217
module.exports = createHybridWrapper;
27218
27219
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27220
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUh5YnJpZFdyYXBwZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO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composeArgsRight":100,"./createCtorWrapper":104,"./isLaziable":127,"./reorder":134,"./replaceHolders":135,"./setData":136}],108:[function(require,module,exports){
27222
(function (global){
27223
var createCtorWrapper = require('./createCtorWrapper');
27224
27225
/** Used to compose bitmasks for wrapper metadata. */
27226
var BIND_FLAG = 1;
27227
27228
/**
27229
 * Creates a function that wraps `func` and invokes it with the optional `this`
27230
 * binding of `thisArg` and the `partials` prepended to those provided to
27231
 * the wrapper.
27232
 *
27233
 * @private
27234
 * @param {Function} func The function to partially apply arguments to.
27235
 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
27236
 * @param {*} thisArg The `this` binding of `func`.
27237
 * @param {Array} partials The arguments to prepend to those provided to the new function.
27238
 * @returns {Function} Returns the new bound function.
27239
 */
27240
function createPartialWrapper(func, bitmask, thisArg, partials) {
27241
  var isBind = bitmask & BIND_FLAG,
27242
      Ctor = createCtorWrapper(func);
27243
27244
  function wrapper() {
27245
    // Avoid `arguments` object use disqualifying optimizations by
27246
    // converting it to an array before providing it `func`.
27247
    var argsIndex = -1,
27248
        argsLength = arguments.length,
27249
        leftIndex = -1,
27250
        leftLength = partials.length,
27251
        args = Array(leftLength + argsLength);
27252
27253
    while (++leftIndex < leftLength) {
27254
      args[leftIndex] = partials[leftIndex];
27255
    }
27256
    while (argsLength--) {
27257
      args[leftIndex++] = arguments[++argsIndex];
27258
    }
27259
    var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
27260
    return fn.apply(isBind ? thisArg : this, args);
27261
  }
27262
  return wrapper;
27263
}
27264
27265
module.exports = createPartialWrapper;
27266
27267
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27268
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZVBhcnRpYWxXcmFwcGVyLmpzIl0sIm5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gICAgd2hpbGUgKGFyZ3NMZW5ndGgtLSkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXgrK10gPSBhcmd1bWVudHNbKythcmdzSW5kZXhdO1xuICAgIH1cbiAgICB2YXIgZm4gPSAodGhpcyAmJiB0aGlzICE9PSBnbG9iYWwgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgcmV0dXJuIGZuLmFwcGx5KGlzQmluZCA/IHRoaXNBcmcgOiB0aGlzLCBhcmdzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVQYXJ0aWFsV3JhcHBlcjtcbiJdfQ==
27269
},{"./createCtorWrapper":104}],109:[function(require,module,exports){
27270
var baseSetData = require('./baseSetData'),
27271
    createBindWrapper = require('./createBindWrapper'),
27272
    createHybridWrapper = require('./createHybridWrapper'),
27273
    createPartialWrapper = require('./createPartialWrapper'),
27274
    getData = require('./getData'),
27275
    mergeData = require('./mergeData'),
27276
    setData = require('./setData');
27277
27278
/** Used to compose bitmasks for wrapper metadata. */
27279
var BIND_FLAG = 1,
27280
    BIND_KEY_FLAG = 2,
27281
    PARTIAL_FLAG = 32,
27282
    PARTIAL_RIGHT_FLAG = 64;
27283
27284
/** Used as the `TypeError` message for "Functions" methods. */
27285
var FUNC_ERROR_TEXT = 'Expected a function';
27286
27287
/* Native method references for those with the same name as other `lodash` methods. */
27288
var nativeMax = Math.max;
27289
27290
/**
27291
 * Creates a function that either curries or invokes `func` with optional
27292
 * `this` binding and partially applied arguments.
27293
 *
27294
 * @private
27295
 * @param {Function|string} func The function or method name to reference.
27296
 * @param {number} bitmask The bitmask of flags.
27297
 *  The bitmask may be composed of the following flags:
27298
 *     1 - `_.bind`
27299
 *     2 - `_.bindKey`
27300
 *     4 - `_.curry` or `_.curryRight` of a bound function
27301
 *     8 - `_.curry`
27302
 *    16 - `_.curryRight`
27303
 *    32 - `_.partial`
27304
 *    64 - `_.partialRight`
27305
 *   128 - `_.rearg`
27306
 *   256 - `_.ary`
27307
 * @param {*} [thisArg] The `this` binding of `func`.
27308
 * @param {Array} [partials] The arguments to be partially applied.
27309
 * @param {Array} [holders] The `partials` placeholder indexes.
27310
 * @param {Array} [argPos] The argument positions of the new function.
27311
 * @param {number} [ary] The arity cap of `func`.
27312
 * @param {number} [arity] The arity of `func`.
27313
 * @returns {Function} Returns the new wrapped function.
27314
 */
27315
function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
27316
  var isBindKey = bitmask & BIND_KEY_FLAG;
27317
  if (!isBindKey && typeof func != 'function') {
27318
    throw new TypeError(FUNC_ERROR_TEXT);
27319
  }
27320
  var length = partials ? partials.length : 0;
27321
  if (!length) {
27322
    bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
27323
    partials = holders = undefined;
27324
  }
27325
  length -= (holders ? holders.length : 0);
27326
  if (bitmask & PARTIAL_RIGHT_FLAG) {
27327
    var partialsRight = partials,
27328
        holdersRight = holders;
27329
27330
    partials = holders = undefined;
27331
  }
27332
  var data = isBindKey ? undefined : getData(func),
27333
      newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
27334
27335
  if (data) {
27336
    mergeData(newData, data);
27337
    bitmask = newData[1];
27338
    arity = newData[9];
27339
  }
27340
  newData[9] = arity == null
27341
    ? (isBindKey ? 0 : func.length)
27342
    : (nativeMax(arity - length, 0) || 0);
27343
27344
  if (bitmask == BIND_FLAG) {
27345
    var result = createBindWrapper(newData[0], newData[2]);
27346
  } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
27347
    result = createPartialWrapper.apply(undefined, newData);
27348
  } else {
27349
    result = createHybridWrapper.apply(undefined, newData);
27350
  }
27351
  var setter = data ? baseSetData : setData;
27352
  return setter(result, newData);
27353
}
27354
27355
module.exports = createWrapper;
27356
27357
},{"./baseSetData":91,"./createBindWrapper":103,"./createHybridWrapper":107,"./createPartialWrapper":108,"./getData":113,"./mergeData":131,"./setData":136}],110:[function(require,module,exports){
27358
var arraySome = require('./arraySome');
27359
27360
/**
27361
 * A specialized version of `baseIsEqualDeep` for arrays with support for
27362
 * partial deep comparisons.
27363
 *
27364
 * @private
27365
 * @param {Array} array The array to compare.
27366
 * @param {Array} other The other array to compare.
27367
 * @param {Function} equalFunc The function to determine equivalents of values.
27368
 * @param {Function} [customizer] The function to customize comparing arrays.
27369
 * @param {boolean} [isLoose] Specify performing partial comparisons.
27370
 * @param {Array} [stackA] Tracks traversed `value` objects.
27371
 * @param {Array} [stackB] Tracks traversed `other` objects.
27372
 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
27373
 */
27374
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
27375
  var index = -1,
27376
      arrLength = array.length,
27377
      othLength = other.length;
27378
27379
  if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
27380
    return false;
27381
  }
27382
  // Ignore non-index properties.
27383
  while (++index < arrLength) {
27384
    var arrValue = array[index],
27385
        othValue = other[index],
27386
        result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
27387
27388
    if (result !== undefined) {
27389
      if (result) {
27390
        continue;
27391
      }
27392
      return false;
27393
    }
27394
    // Recursively compare arrays (susceptible to call stack limits).
27395
    if (isLoose) {
27396
      if (!arraySome(other, function(othValue) {
27397
            return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
27398
          })) {
27399
        return false;
27400
      }
27401
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
27402
      return false;
27403
    }
27404
  }
27405
  return true;
27406
}
27407
27408
module.exports = equalArrays;
27409
27410
},{"./arraySome":68}],111:[function(require,module,exports){
27411
/** `Object#toString` result references. */
27412
var boolTag = '[object Boolean]',
27413
    dateTag = '[object Date]',
27414
    errorTag = '[object Error]',
27415
    numberTag = '[object Number]',
27416
    regexpTag = '[object RegExp]',
27417
    stringTag = '[object String]';
27418
27419
/**
27420
 * A specialized version of `baseIsEqualDeep` for comparing objects of
27421
 * the same `toStringTag`.
27422
 *
27423
 * **Note:** This function only supports comparing values with tags of
27424
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
27425
 *
27426
 * @private
27427
 * @param {Object} object The object to compare.
27428
 * @param {Object} other The other object to compare.
27429
 * @param {string} tag The `toStringTag` of the objects to compare.
27430
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27431
 */
27432
function equalByTag(object, other, tag) {
27433
  switch (tag) {
27434
    case boolTag:
27435
    case dateTag:
27436
      // Coerce dates and booleans to numbers, dates to milliseconds and booleans
27437
      // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
27438
      return +object == +other;
27439
27440
    case errorTag:
27441
      return object.name == other.name && object.message == other.message;
27442
27443
    case numberTag:
27444
      // Treat `NaN` vs. `NaN` as equal.
27445
      return (object != +object)
27446
        ? other != +other
27447
        : object == +other;
27448
27449
    case regexpTag:
27450
    case stringTag:
27451
      // Coerce regexes to strings and treat strings primitives and string
27452
      // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
27453
      return object == (other + '');
27454
  }
27455
  return false;
27456
}
27457
27458
module.exports = equalByTag;
27459
27460
},{}],112:[function(require,module,exports){
27461
var keys = require('../object/keys');
27462
27463
/** Used for native method references. */
27464
var objectProto = Object.prototype;
27465
27466
/** Used to check objects for own properties. */
27467
var hasOwnProperty = objectProto.hasOwnProperty;
27468
27469
/**
27470
 * A specialized version of `baseIsEqualDeep` for objects with support for
27471
 * partial deep comparisons.
27472
 *
27473
 * @private
27474
 * @param {Object} object The object to compare.
27475
 * @param {Object} other The other object to compare.
27476
 * @param {Function} equalFunc The function to determine equivalents of values.
27477
 * @param {Function} [customizer] The function to customize comparing values.
27478
 * @param {boolean} [isLoose] Specify performing partial comparisons.
27479
 * @param {Array} [stackA] Tracks traversed `value` objects.
27480
 * @param {Array} [stackB] Tracks traversed `other` objects.
27481
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27482
 */
27483
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
27484
  var objProps = keys(object),
27485
      objLength = objProps.length,
27486
      othProps = keys(other),
27487
      othLength = othProps.length;
27488
27489
  if (objLength != othLength && !isLoose) {
27490
    return false;
27491
  }
27492
  var index = objLength;
27493
  while (index--) {
27494
    var key = objProps[index];
27495
    if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
27496
      return false;
27497
    }
27498
  }
27499
  var skipCtor = isLoose;
27500
  while (++index < objLength) {
27501
    key = objProps[index];
27502
    var objValue = object[key],
27503
        othValue = other[key],
27504
        result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
27505
27506
    // Recursively compare objects (susceptible to call stack limits).
27507
    if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
27508
      return false;
27509
    }
27510
    skipCtor || (skipCtor = key == 'constructor');
27511
  }
27512
  if (!skipCtor) {
27513
    var objCtor = object.constructor,
27514
        othCtor = other.constructor;
27515
27516
    // Non `Object` object instances with different constructors are not equal.
27517
    if (objCtor != othCtor &&
27518
        ('constructor' in object && 'constructor' in other) &&
27519
        !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
27520
          typeof othCtor == 'function' && othCtor instanceof othCtor)) {
27521
      return false;
27522
    }
27523
  }
27524
  return true;
27525
}
27526
27527
module.exports = equalObjects;
27528
27529
},{"../object/keys":152}],113:[function(require,module,exports){
27530
var metaMap = require('./metaMap'),
27531
    noop = require('../utility/noop');
27532
27533
/**
27534
 * Gets metadata for `func`.
27535
 *
27536
 * @private
27537
 * @param {Function} func The function to query.
27538
 * @returns {*} Returns the metadata for `func`.
27539
 */
27540
var getData = !metaMap ? noop : function(func) {
27541
  return metaMap.get(func);
27542
};
27543
27544
module.exports = getData;
27545
27546
},{"../utility/noop":158,"./metaMap":132}],114:[function(require,module,exports){
27547
var realNames = require('./realNames');
27548
27549
/**
27550
 * Gets the name of `func`.
27551
 *
27552
 * @private
27553
 * @param {Function} func The function to query.
27554
 * @returns {string} Returns the function name.
27555
 */
27556
function getFuncName(func) {
27557
  var result = func.name,
27558
      array = realNames[result],
27559
      length = array ? array.length : 0;
27560
27561
  while (length--) {
27562
    var data = array[length],
27563
        otherFunc = data.func;
27564
    if (otherFunc == null || otherFunc == func) {
27565
      return data.name;
27566
    }
27567
  }
27568
  return result;
27569
}
27570
27571
module.exports = getFuncName;
27572
27573
},{"./realNames":133}],115:[function(require,module,exports){
27574
var baseProperty = require('./baseProperty');
27575
27576
/**
27577
 * Gets the "length" property value of `object`.
27578
 *
27579
 * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
27580
 * that affects Safari on at least iOS 8.1-8.3 ARM64.
27581
 *
27582
 * @private
27583
 * @param {Object} object The object to query.
27584
 * @returns {*} Returns the "length" value.
27585
 */
27586
var getLength = baseProperty('length');
27587
27588
module.exports = getLength;
27589
27590
},{"./baseProperty":89}],116:[function(require,module,exports){
27591
var isStrictComparable = require('./isStrictComparable'),
27592
    pairs = require('../object/pairs');
27593
27594
/**
27595
 * Gets the propery names, values, and compare flags of `object`.
27596
 *
27597
 * @private
27598
 * @param {Object} object The object to query.
27599
 * @returns {Array} Returns the match data of `object`.
27600
 */
27601
function getMatchData(object) {
27602
  var result = pairs(object),
27603
      length = result.length;
27604
27605
  while (length--) {
27606
    result[length][2] = isStrictComparable(result[length][1]);
27607
  }
27608
  return result;
27609
}
27610
27611
module.exports = getMatchData;
27612
27613
},{"../object/pairs":154,"./isStrictComparable":130}],117:[function(require,module,exports){
27614
var isNative = require('../lang/isNative');
27615
27616
/**
27617
 * Gets the native function at `key` of `object`.
27618
 *
27619
 * @private
27620
 * @param {Object} object The object to query.
27621
 * @param {string} key The key of the method to get.
27622
 * @returns {*} Returns the function if it's native, else `undefined`.
27623
 */
27624
function getNative(object, key) {
27625
  var value = object == null ? undefined : object[key];
27626
  return isNative(value) ? value : undefined;
27627
}
27628
27629
module.exports = getNative;
27630
27631
},{"../lang/isNative":146}],118:[function(require,module,exports){
27632
/**
27633
 * Gets the index at which the first occurrence of `NaN` is found in `array`.
27634
 *
27635
 * @private
27636
 * @param {Array} array The array to search.
27637
 * @param {number} fromIndex The index to search from.
27638
 * @param {boolean} [fromRight] Specify iterating from right to left.
27639
 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
27640
 */
27641
function indexOfNaN(array, fromIndex, fromRight) {
27642
  var length = array.length,
27643
      index = fromIndex + (fromRight ? 0 : -1);
27644
27645
  while ((fromRight ? index-- : ++index < length)) {
27646
    var other = array[index];
27647
    if (other !== other) {
27648
      return index;
27649
    }
27650
  }
27651
  return -1;
27652
}
27653
27654
module.exports = indexOfNaN;
27655
27656
},{}],119:[function(require,module,exports){
27657
/** Used for native method references. */
27658
var objectProto = Object.prototype;
27659
27660
/** Used to check objects for own properties. */
27661
var hasOwnProperty = objectProto.hasOwnProperty;
27662
27663
/**
27664
 * Initializes an array clone.
27665
 *
27666
 * @private
27667
 * @param {Array} array The array to clone.
27668
 * @returns {Array} Returns the initialized clone.
27669
 */
27670
function initCloneArray(array) {
27671
  var length = array.length,
27672
      result = new array.constructor(length);
27673
27674
  // Add array properties assigned by `RegExp#exec`.
27675
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
27676
    result.index = array.index;
27677
    result.input = array.input;
27678
  }
27679
  return result;
27680
}
27681
27682
module.exports = initCloneArray;
27683
27684
},{}],120:[function(require,module,exports){
27685
(function (global){
27686
var bufferClone = require('./bufferClone');
27687
27688
/** `Object#toString` result references. */
27689
var boolTag = '[object Boolean]',
27690
    dateTag = '[object Date]',
27691
    numberTag = '[object Number]',
27692
    regexpTag = '[object RegExp]',
27693
    stringTag = '[object String]';
27694
27695
var arrayBufferTag = '[object ArrayBuffer]',
27696
    float32Tag = '[object Float32Array]',
27697
    float64Tag = '[object Float64Array]',
27698
    int8Tag = '[object Int8Array]',
27699
    int16Tag = '[object Int16Array]',
27700
    int32Tag = '[object Int32Array]',
27701
    uint8Tag = '[object Uint8Array]',
27702
    uint8ClampedTag = '[object Uint8ClampedArray]',
27703
    uint16Tag = '[object Uint16Array]',
27704
    uint32Tag = '[object Uint32Array]';
27705
27706
/** Used to match `RegExp` flags from their coerced string values. */
27707
var reFlags = /\w*$/;
27708
27709
/** Native method references. */
27710
var Uint8Array = global.Uint8Array;
27711
27712
/** Used to lookup a type array constructors by `toStringTag`. */
27713
var ctorByTag = {};
27714
ctorByTag[float32Tag] = global.Float32Array;
27715
ctorByTag[float64Tag] = global.Float64Array;
27716
ctorByTag[int8Tag] = global.Int8Array;
27717
ctorByTag[int16Tag] = global.Int16Array;
27718
ctorByTag[int32Tag] = global.Int32Array;
27719
ctorByTag[uint8Tag] = Uint8Array;
27720
ctorByTag[uint8ClampedTag] = global.Uint8ClampedArray;
27721
ctorByTag[uint16Tag] = global.Uint16Array;
27722
ctorByTag[uint32Tag] = global.Uint32Array;
27723
27724
/**
27725
 * Initializes an object clone based on its `toStringTag`.
27726
 *
27727
 * **Note:** This function only supports cloning values with tags of
27728
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
27729
 *
27730
 * @private
27731
 * @param {Object} object The object to clone.
27732
 * @param {string} tag The `toStringTag` of the object to clone.
27733
 * @param {boolean} [isDeep] Specify a deep clone.
27734
 * @returns {Object} Returns the initialized clone.
27735
 */
27736
function initCloneByTag(object, tag, isDeep) {
27737
  var Ctor = object.constructor;
27738
  switch (tag) {
27739
    case arrayBufferTag:
27740
      return bufferClone(object);
27741
27742
    case boolTag:
27743
    case dateTag:
27744
      return new Ctor(+object);
27745
27746
    case float32Tag: case float64Tag:
27747
    case int8Tag: case int16Tag: case int32Tag:
27748
    case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
27749
      // Safari 5 mobile incorrectly has `Object` as the constructor of typed arrays.
27750
      if (Ctor instanceof Ctor) {
27751
        Ctor = ctorByTag[tag];
27752
      }
27753
      var buffer = object.buffer;
27754
      return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
27755
27756
    case numberTag:
27757
    case stringTag:
27758
      return new Ctor(object);
27759
27760
    case regexpTag:
27761
      var result = new Ctor(object.source, reFlags.exec(object));
27762
      result.lastIndex = object.lastIndex;
27763
  }
27764
  return result;
27765
}
27766
27767
module.exports = initCloneByTag;
27768
27769
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27770
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2luaXRDbG9uZUJ5VGFnLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUN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3RvciA9IGN0b3JCeVRhZ1t0YWddO1xuICAgICAgfVxuICAgICAgdmFyIGJ1ZmZlciA9IG9iamVjdC5idWZmZXI7XG4gICAgICByZXR1cm4gbmV3IEN0b3IoaXNEZWVwID8gYnVmZmVyQ2xvbmUoYnVmZmVyKSA6IGJ1ZmZlciwgb2JqZWN0LmJ5dGVPZmZzZXQsIG9iamVjdC5sZW5ndGgpO1xuXG4gICAgY2FzZSBudW1iZXJUYWc6XG4gICAgY2FzZSBzdHJpbmdUYWc6XG4gICAgICByZXR1cm4gbmV3IEN0b3Iob2JqZWN0KTtcblxuICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgdmFyIHJlc3VsdCA9IG5ldyBDdG9yKG9iamVjdC5zb3VyY2UsIHJlRmxhZ3MuZXhlYyhvYmplY3QpKTtcbiAgICAgIHJlc3VsdC5sYXN0SW5kZXggPSBvYmplY3QubGFzdEluZGV4O1xuICB9XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gaW5pdENsb25lQnlUYWc7XG4iXX0=
27771
},{"./bufferClone":98}],121:[function(require,module,exports){
27772
/**
27773
 * Initializes an object clone.
27774
 *
27775
 * @private
27776
 * @param {Object} object The object to clone.
27777
 * @returns {Object} Returns the initialized clone.
27778
 */
27779
function initCloneObject(object) {
27780
  var Ctor = object.constructor;
27781
  if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
27782
    Ctor = Object;
27783
  }
27784
  return new Ctor;
27785
}
27786
27787
module.exports = initCloneObject;
27788
27789
},{}],122:[function(require,module,exports){
27790
var getLength = require('./getLength'),
27791
    isLength = require('./isLength');
27792
27793
/**
27794
 * Checks if `value` is array-like.
27795
 *
27796
 * @private
27797
 * @param {*} value The value to check.
27798
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
27799
 */
27800
function isArrayLike(value) {
27801
  return value != null && isLength(getLength(value));
27802
}
27803
27804
module.exports = isArrayLike;
27805
27806
},{"./getLength":115,"./isLength":128}],123:[function(require,module,exports){
27807
/**
27808
 * Checks if `value` is a host object in IE < 9.
27809
 *
27810
 * @private
27811
 * @param {*} value The value to check.
27812
 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
27813
 */
27814
var isHostObject = (function() {
27815
  try {
27816
    Object({ 'toString': 0 } + '');
27817
  } catch(e) {
27818
    return function() { return false; };
27819
  }
27820
  return function(value) {
27821
    // IE < 9 presents many host objects as `Object` objects that can coerce
27822
    // to strings despite having improperly defined `toString` methods.
27823
    return typeof value.toString != 'function' && typeof (value + '') == 'string';
27824
  };
27825
}());
27826
27827
module.exports = isHostObject;
27828
27829
},{}],124:[function(require,module,exports){
27830
/** Used to detect unsigned integer values. */
27831
var reIsUint = /^\d+$/;
27832
27833
/**
27834
 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
27835
 * of an array-like value.
27836
 */
27837
var MAX_SAFE_INTEGER = 9007199254740991;
27838
27839
/**
27840
 * Checks if `value` is a valid array-like index.
27841
 *
27842
 * @private
27843
 * @param {*} value The value to check.
27844
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
27845
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
27846
 */
27847
function isIndex(value, length) {
27848
  value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
27849
  length = length == null ? MAX_SAFE_INTEGER : length;
27850
  return value > -1 && value % 1 == 0 && value < length;
27851
}
27852
27853
module.exports = isIndex;
27854
27855
},{}],125:[function(require,module,exports){
27856
var isArrayLike = require('./isArrayLike'),
27857
    isIndex = require('./isIndex'),
27858
    isObject = require('../lang/isObject');
27859
27860
/**
27861
 * Checks if the provided arguments are from an iteratee call.
27862
 *
27863
 * @private
27864
 * @param {*} value The potential iteratee value argument.
27865
 * @param {*} index The potential iteratee index or key argument.
27866
 * @param {*} object The potential iteratee object argument.
27867
 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
27868
 */
27869
function isIterateeCall(value, index, object) {
27870
  if (!isObject(object)) {
27871
    return false;
27872
  }
27873
  var type = typeof index;
27874
  if (type == 'number'
27875
      ? (isArrayLike(object) && isIndex(index, object.length))
27876
      : (type == 'string' && index in object)) {
27877
    var other = object[index];
27878
    return value === value ? (value === other) : (other !== other);
27879
  }
27880
  return false;
27881
}
27882
27883
module.exports = isIterateeCall;
27884
27885
},{"../lang/isObject":147,"./isArrayLike":122,"./isIndex":124}],126:[function(require,module,exports){
27886
var isArray = require('../lang/isArray'),
27887
    toObject = require('./toObject');
27888
27889
/** Used to match property names within property paths. */
27890
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
27891
    reIsPlainProp = /^\w*$/;
27892
27893
/**
27894
 * Checks if `value` is a property name and not a property path.
27895
 *
27896
 * @private
27897
 * @param {*} value The value to check.
27898
 * @param {Object} [object] The object to query keys on.
27899
 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
27900
 */
27901
function isKey(value, object) {
27902
  var type = typeof value;
27903
  if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
27904
    return true;
27905
  }
27906
  if (isArray(value)) {
27907
    return false;
27908
  }
27909
  var result = !reIsDeepProp.test(value);
27910
  return result || (object != null && value in toObject(object));
27911
}
27912
27913
module.exports = isKey;
27914
27915
},{"../lang/isArray":143,"./toObject":138}],127:[function(require,module,exports){
27916
var LazyWrapper = require('./LazyWrapper'),
27917
    getData = require('./getData'),
27918
    getFuncName = require('./getFuncName'),
27919
    lodash = require('../chain/lodash');
27920
27921
/**
27922
 * Checks if `func` has a lazy counterpart.
27923
 *
27924
 * @private
27925
 * @param {Function} func The function to check.
27926
 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
27927
 */
27928
function isLaziable(func) {
27929
  var funcName = getFuncName(func);
27930
  if (!(funcName in LazyWrapper.prototype)) {
27931
    return false;
27932
  }
27933
  var other = lodash[funcName];
27934
  if (func === other) {
27935
    return true;
27936
  }
27937
  var data = getData(other);
27938
  return !!data && func === data[0];
27939
}
27940
27941
module.exports = isLaziable;
27942
27943
},{"../chain/lodash":54,"./LazyWrapper":63,"./getData":113,"./getFuncName":114}],128:[function(require,module,exports){
27944
/**
27945
 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
27946
 * of an array-like value.
27947
 */
27948
var MAX_SAFE_INTEGER = 9007199254740991;
27949
27950
/**
27951
 * Checks if `value` is a valid array-like length.
27952
 *
27953
 * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
27954
 *
27955
 * @private
27956
 * @param {*} value The value to check.
27957
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
27958
 */
27959
function isLength(value) {
27960
  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
27961
}
27962
27963
module.exports = isLength;
27964
27965
},{}],129:[function(require,module,exports){
27966
/**
27967
 * Checks if `value` is object-like.
27968
 *
27969
 * @private
27970
 * @param {*} value The value to check.
27971
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
27972
 */
27973
function isObjectLike(value) {
27974
  return !!value && typeof value == 'object';
27975
}
27976
27977
module.exports = isObjectLike;
27978
27979
},{}],130:[function(require,module,exports){
27980
var isObject = require('../lang/isObject');
27981
27982
/**
27983
 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
27984
 *
27985
 * @private
27986
 * @param {*} value The value to check.
27987
 * @returns {boolean} Returns `true` if `value` if suitable for strict
27988
 *  equality comparisons, else `false`.
27989
 */
27990
function isStrictComparable(value) {
27991
  return value === value && !isObject(value);
27992
}
27993
27994
module.exports = isStrictComparable;
27995
27996
},{"../lang/isObject":147}],131:[function(require,module,exports){
27997
var arrayCopy = require('./arrayCopy'),
27998
    composeArgs = require('./composeArgs'),
27999
    composeArgsRight = require('./composeArgsRight'),
28000
    replaceHolders = require('./replaceHolders');
28001
28002
/** Used to compose bitmasks for wrapper metadata. */
28003
var BIND_FLAG = 1,
28004
    CURRY_BOUND_FLAG = 4,
28005
    CURRY_FLAG = 8,
28006
    ARY_FLAG = 128,
28007
    REARG_FLAG = 256;
28008
28009
/** Used as the internal argument placeholder. */
28010
var PLACEHOLDER = '__lodash_placeholder__';
28011
28012
/* Native method references for those with the same name as other `lodash` methods. */
28013
var nativeMin = Math.min;
28014
28015
/**
28016
 * Merges the function metadata of `source` into `data`.
28017
 *
28018
 * Merging metadata reduces the number of wrappers required to invoke a function.
28019
 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
28020
 * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
28021
 * augment function arguments, making the order in which they are executed important,
28022
 * preventing the merging of metadata. However, we make an exception for a safe
28023
 * common case where curried functions have `_.ary` and or `_.rearg` applied.
28024
 *
28025
 * @private
28026
 * @param {Array} data The destination metadata.
28027
 * @param {Array} source The source metadata.
28028
 * @returns {Array} Returns `data`.
28029
 */
28030
function mergeData(data, source) {
28031
  var bitmask = data[1],
28032
      srcBitmask = source[1],
28033
      newBitmask = bitmask | srcBitmask,
28034
      isCommon = newBitmask < ARY_FLAG;
28035
28036
  var isCombo =
28037
    (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
28038
    (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
28039
    (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
28040
28041
  // Exit early if metadata can't be merged.
28042
  if (!(isCommon || isCombo)) {
28043
    return data;
28044
  }
28045
  // Use source `thisArg` if available.
28046
  if (srcBitmask & BIND_FLAG) {
28047
    data[2] = source[2];
28048
    // Set when currying a bound function.
28049
    newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
28050
  }
28051
  // Compose partial arguments.
28052
  var value = source[3];
28053
  if (value) {
28054
    var partials = data[3];
28055
    data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
28056
    data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
28057
  }
28058
  // Compose partial right arguments.
28059
  value = source[5];
28060
  if (value) {
28061
    partials = data[5];
28062
    data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
28063
    data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
28064
  }
28065
  // Use source `argPos` if available.
28066
  value = source[7];
28067
  if (value) {
28068
    data[7] = arrayCopy(value);
28069
  }
28070
  // Use source `ary` if it's smaller.
28071
  if (srcBitmask & ARY_FLAG) {
28072
    data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
28073
  }
28074
  // Use source `arity` if one is not provided.
28075
  if (data[9] == null) {
28076
    data[9] = source[9];
28077
  }
28078
  // Use source `func` and merge bitmasks.
28079
  data[0] = source[0];
28080
  data[1] = newBitmask;
28081
28082
  return data;
28083
}
28084
28085
module.exports = mergeData;
28086
28087
},{"./arrayCopy":65,"./composeArgs":99,"./composeArgsRight":100,"./replaceHolders":135}],132:[function(require,module,exports){
28088
(function (global){
28089
var getNative = require('./getNative');
28090
28091
/** Native method references. */
28092
var WeakMap = getNative(global, 'WeakMap');
28093
28094
/** Used to store function metadata. */
28095
var metaMap = WeakMap && new WeakMap;
28096
28097
module.exports = metaMap;
28098
28099
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28100
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL21ldGFNYXAuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2V0TmF0aXZlID0gcmVxdWlyZSgnLi9nZXROYXRpdmUnKTtcblxuLyoqIE5hdGl2ZSBtZXRob2QgcmVmZXJlbmNlcy4gKi9cbnZhciBXZWFrTWFwID0gZ2V0TmF0aXZlKGdsb2JhbCwgJ1dlYWtNYXAnKTtcblxuLyoqIFVzZWQgdG8gc3RvcmUgZnVuY3Rpb24gbWV0YWRhdGEuICovXG52YXIgbWV0YU1hcCA9IFdlYWtNYXAgJiYgbmV3IFdlYWtNYXA7XG5cbm1vZHVsZS5leHBvcnRzID0gbWV0YU1hcDtcbiJdfQ==
28101
},{"./getNative":117}],133:[function(require,module,exports){
28102
/** Used to lookup unminified function names. */
28103
var realNames = {};
28104
28105
module.exports = realNames;
28106
28107
},{}],134:[function(require,module,exports){
28108
var arrayCopy = require('./arrayCopy'),
28109
    isIndex = require('./isIndex');
28110
28111
/* Native method references for those with the same name as other `lodash` methods. */
28112
var nativeMin = Math.min;
28113
28114
/**
28115
 * Reorder `array` according to the specified indexes where the element at
28116
 * the first index is assigned as the first element, the element at
28117
 * the second index is assigned as the second element, and so on.
28118
 *
28119
 * @private
28120
 * @param {Array} array The array to reorder.
28121
 * @param {Array} indexes The arranged array indexes.
28122
 * @returns {Array} Returns `array`.
28123
 */
28124
function reorder(array, indexes) {
28125
  var arrLength = array.length,
28126
      length = nativeMin(indexes.length, arrLength),
28127
      oldArray = arrayCopy(array);
28128
28129
  while (length--) {
28130
    var index = indexes[length];
28131
    array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
28132
  }
28133
  return array;
28134
}
28135
28136
module.exports = reorder;
28137
28138
},{"./arrayCopy":65,"./isIndex":124}],135:[function(require,module,exports){
28139
/** Used as the internal argument placeholder. */
28140
var PLACEHOLDER = '__lodash_placeholder__';
28141
28142
/**
28143
 * Replaces all `placeholder` elements in `array` with an internal placeholder
28144
 * and returns an array of their indexes.
28145
 *
28146
 * @private
28147
 * @param {Array} array The array to modify.
28148
 * @param {*} placeholder The placeholder to replace.
28149
 * @returns {Array} Returns the new array of placeholder indexes.
28150
 */
28151
function replaceHolders(array, placeholder) {
28152
  var index = -1,
28153
      length = array.length,
28154
      resIndex = -1,
28155
      result = [];
28156
28157
  while (++index < length) {
28158
    if (array[index] === placeholder) {
28159
      array[index] = PLACEHOLDER;
28160
      result[++resIndex] = index;
28161
    }
28162
  }
28163
  return result;
28164
}
28165
28166
module.exports = replaceHolders;
28167
28168
},{}],136:[function(require,module,exports){
28169
var baseSetData = require('./baseSetData'),
28170
    now = require('../date/now');
28171
28172
/** Used to detect when a function becomes hot. */
28173
var HOT_COUNT = 150,
28174
    HOT_SPAN = 16;
28175
28176
/**
28177
 * Sets metadata for `func`.
28178
 *
28179
 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
28180
 * period of time, it will trip its breaker and transition to an identity function
28181
 * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
28182
 * for more details.
28183
 *
28184
 * @private
28185
 * @param {Function} func The function to associate metadata with.
28186
 * @param {*} data The metadata.
28187
 * @returns {Function} Returns `func`.
28188
 */
28189
var setData = (function() {
28190
  var count = 0,
28191
      lastCalled = 0;
28192
28193
  return function(key, value) {
28194
    var stamp = now(),
28195
        remaining = HOT_SPAN - (stamp - lastCalled);
28196
28197
    lastCalled = stamp;
28198
    if (remaining > 0) {
28199
      if (++count >= HOT_COUNT) {
28200
        return key;
28201
      }
28202
    } else {
28203
      count = 0;
28204
    }
28205
    return baseSetData(key, value);
28206
  };
28207
}());
28208
28209
module.exports = setData;
28210
28211
},{"../date/now":60,"./baseSetData":91}],137:[function(require,module,exports){
28212
var isArguments = require('../lang/isArguments'),
28213
    isArray = require('../lang/isArray'),
28214
    isIndex = require('./isIndex'),
28215
    isLength = require('./isLength'),
28216
    isString = require('../lang/isString'),
28217
    keysIn = require('../object/keysIn');
28218
28219
/** Used for native method references. */
28220
var objectProto = Object.prototype;
28221
28222
/** Used to check objects for own properties. */
28223
var hasOwnProperty = objectProto.hasOwnProperty;
28224
28225
/**
28226
 * A fallback implementation of `Object.keys` which creates an array of the
28227
 * own enumerable property names of `object`.
28228
 *
28229
 * @private
28230
 * @param {Object} object The object to query.
28231
 * @returns {Array} Returns the array of property names.
28232
 */
28233
function shimKeys(object) {
28234
  var props = keysIn(object),
28235
      propsLength = props.length,
28236
      length = propsLength && object.length;
28237
28238
  var allowIndexes = !!length && isLength(length) &&
28239
    (isArray(object) || isArguments(object) || isString(object));
28240
28241
  var index = -1,
28242
      result = [];
28243
28244
  while (++index < propsLength) {
28245
    var key = props[index];
28246
    if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
28247
      result.push(key);
28248
    }
28249
  }
28250
  return result;
28251
}
28252
28253
module.exports = shimKeys;
28254
28255
},{"../lang/isArguments":142,"../lang/isArray":143,"../lang/isString":149,"../object/keysIn":153,"./isIndex":124,"./isLength":128}],138:[function(require,module,exports){
28256
var isObject = require('../lang/isObject'),
28257
    isString = require('../lang/isString'),
28258
    support = require('../support');
28259
28260
/**
28261
 * Converts `value` to an object if it's not one.
28262
 *
28263
 * @private
28264
 * @param {*} value The value to process.
28265
 * @returns {Object} Returns the object.
28266
 */
28267
function toObject(value) {
28268
  if (support.unindexedChars && isString(value)) {
28269
    var index = -1,
28270
        length = value.length,
28271
        result = Object(value);
28272
28273
    while (++index < length) {
28274
      result[index] = value.charAt(index);
28275
    }
28276
    return result;
28277
  }
28278
  return isObject(value) ? value : Object(value);
28279
}
28280
28281
module.exports = toObject;
28282
28283
},{"../lang/isObject":147,"../lang/isString":149,"../support":156}],139:[function(require,module,exports){
28284
var baseToString = require('./baseToString'),
28285
    isArray = require('../lang/isArray');
28286
28287
/** Used to match property names within property paths. */
28288
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
28289
28290
/** Used to match backslashes in property paths. */
28291
var reEscapeChar = /\\(\\)?/g;
28292
28293
/**
28294
 * Converts `value` to property path array if it's not one.
28295
 *
28296
 * @private
28297
 * @param {*} value The value to process.
28298
 * @returns {Array} Returns the property path array.
28299
 */
28300
function toPath(value) {
28301
  if (isArray(value)) {
28302
    return value;
28303
  }
28304
  var result = [];
28305
  baseToString(value).replace(rePropName, function(match, number, quote, string) {
28306
    result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
28307
  });
28308
  return result;
28309
}
28310
28311
module.exports = toPath;
28312
28313
},{"../lang/isArray":143,"./baseToString":93}],140:[function(require,module,exports){
28314
var LazyWrapper = require('./LazyWrapper'),
28315
    LodashWrapper = require('./LodashWrapper'),
28316
    arrayCopy = require('./arrayCopy');
28317
28318
/**
28319
 * Creates a clone of `wrapper`.
28320
 *
28321
 * @private
28322
 * @param {Object} wrapper The wrapper to clone.
28323
 * @returns {Object} Returns the cloned wrapper.
28324
 */
28325
function wrapperClone(wrapper) {
28326
  return wrapper instanceof LazyWrapper
28327
    ? wrapper.clone()
28328
    : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
28329
}
28330
28331
module.exports = wrapperClone;
28332
28333
},{"./LazyWrapper":63,"./LodashWrapper":64,"./arrayCopy":65}],141:[function(require,module,exports){
28334
var baseClone = require('../internal/baseClone'),
28335
    bindCallback = require('../internal/bindCallback');
28336
28337
/**
28338
 * Creates a deep clone of `value`. If `customizer` is provided it is invoked
28339
 * to produce the cloned values. If `customizer` returns `undefined` cloning
28340
 * is handled by the method instead. The `customizer` is bound to `thisArg`
28341
 * and invoked with two argument; (value [, index|key, object]).
28342
 *
28343
 * **Note:** This method is loosely based on the
28344
 * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
28345
 * The enumerable properties of `arguments` objects and objects created by
28346
 * constructors other than `Object` are cloned to plain `Object` objects. An
28347
 * empty object is returned for uncloneable values such as functions, DOM nodes,
28348
 * Maps, Sets, and WeakMaps.
28349
 *
28350
 * @static
28351
 * @memberOf _
28352
 * @category Lang
28353
 * @param {*} value The value to deep clone.
28354
 * @param {Function} [customizer] The function to customize cloning values.
28355
 * @param {*} [thisArg] The `this` binding of `customizer`.
28356
 * @returns {*} Returns the deep cloned value.
28357
 * @example
28358
 *
28359
 * var users = [
28360
 *   { 'user': 'barney' },
28361
 *   { 'user': 'fred' }
28362
 * ];
28363
 *
28364
 * var deep = _.cloneDeep(users);
28365
 * deep[0] === users[0];
28366
 * // => false
28367
 *
28368
 * // using a customizer callback
28369
 * var el = _.cloneDeep(document.body, function(value) {
28370
 *   if (_.isElement(value)) {
28371
 *     return value.cloneNode(true);
28372
 *   }
28373
 * });
28374
 *
28375
 * el === document.body
28376
 * // => false
28377
 * el.nodeName
28378
 * // => BODY
28379
 * el.childNodes.length;
28380
 * // => 20
28381
 */
28382
function cloneDeep(value, customizer, thisArg) {
28383
  return typeof customizer == 'function'
28384
    ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
28385
    : baseClone(value, true);
28386
}
28387
28388
module.exports = cloneDeep;
28389
28390
},{"../internal/baseClone":71,"../internal/bindCallback":97}],142:[function(require,module,exports){
28391
var isArrayLike = require('../internal/isArrayLike'),
28392
    isObjectLike = require('../internal/isObjectLike');
28393
28394
/** Used for native method references. */
28395
var objectProto = Object.prototype;
28396
28397
/** Used to check objects for own properties. */
28398
var hasOwnProperty = objectProto.hasOwnProperty;
28399
28400
/** Native method references. */
28401
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
28402
28403
/**
28404
 * Checks if `value` is classified as an `arguments` object.
28405
 *
28406
 * @static
28407
 * @memberOf _
28408
 * @category Lang
28409
 * @param {*} value The value to check.
28410
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28411
 * @example
28412
 *
28413
 * _.isArguments(function() { return arguments; }());
28414
 * // => true
28415
 *
28416
 * _.isArguments([1, 2, 3]);
28417
 * // => false
28418
 */
28419
function isArguments(value) {
28420
  return isObjectLike(value) && isArrayLike(value) &&
28421
    hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
28422
}
28423
28424
module.exports = isArguments;
28425
28426
},{"../internal/isArrayLike":122,"../internal/isObjectLike":129}],143:[function(require,module,exports){
28427
var getNative = require('../internal/getNative'),
28428
    isLength = require('../internal/isLength'),
28429
    isObjectLike = require('../internal/isObjectLike');
28430
28431
/** `Object#toString` result references. */
28432
var arrayTag = '[object Array]';
28433
28434
/** Used for native method references. */
28435
var objectProto = Object.prototype;
28436
28437
/**
28438
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28439
 * of values.
28440
 */
28441
var objToString = objectProto.toString;
28442
28443
/* Native method references for those with the same name as other `lodash` methods. */
28444
var nativeIsArray = getNative(Array, 'isArray');
28445
28446
/**
28447
 * Checks if `value` is classified as an `Array` object.
28448
 *
28449
 * @static
28450
 * @memberOf _
28451
 * @category Lang
28452
 * @param {*} value The value to check.
28453
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28454
 * @example
28455
 *
28456
 * _.isArray([1, 2, 3]);
28457
 * // => true
28458
 *
28459
 * _.isArray(function() { return arguments; }());
28460
 * // => false
28461
 */
28462
var isArray = nativeIsArray || function(value) {
28463
  return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
28464
};
28465
28466
module.exports = isArray;
28467
28468
},{"../internal/getNative":117,"../internal/isLength":128,"../internal/isObjectLike":129}],144:[function(require,module,exports){
28469
var isArguments = require('./isArguments'),
28470
    isArray = require('./isArray'),
28471
    isArrayLike = require('../internal/isArrayLike'),
28472
    isFunction = require('./isFunction'),
28473
    isObjectLike = require('../internal/isObjectLike'),
28474
    isString = require('./isString'),
28475
    keys = require('../object/keys');
28476
28477
/**
28478
 * Checks if `value` is empty. A value is considered empty unless it is an
28479
 * `arguments` object, array, string, or jQuery-like collection with a length
28480
 * greater than `0` or an object with own enumerable properties.
28481
 *
28482
 * @static
28483
 * @memberOf _
28484
 * @category Lang
28485
 * @param {Array|Object|string} value The value to inspect.
28486
 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
28487
 * @example
28488
 *
28489
 * _.isEmpty(null);
28490
 * // => true
28491
 *
28492
 * _.isEmpty(true);
28493
 * // => true
28494
 *
28495
 * _.isEmpty(1);
28496
 * // => true
28497
 *
28498
 * _.isEmpty([1, 2, 3]);
28499
 * // => false
28500
 *
28501
 * _.isEmpty({ 'a': 1 });
28502
 * // => false
28503
 */
28504
function isEmpty(value) {
28505
  if (value == null) {
28506
    return true;
28507
  }
28508
  if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
28509
      (isObjectLike(value) && isFunction(value.splice)))) {
28510
    return !value.length;
28511
  }
28512
  return !keys(value).length;
28513
}
28514
28515
module.exports = isEmpty;
28516
28517
},{"../internal/isArrayLike":122,"../internal/isObjectLike":129,"../object/keys":152,"./isArguments":142,"./isArray":143,"./isFunction":145,"./isString":149}],145:[function(require,module,exports){
28518
var isObject = require('./isObject');
28519
28520
/** `Object#toString` result references. */
28521
var funcTag = '[object Function]';
28522
28523
/** Used for native method references. */
28524
var objectProto = Object.prototype;
28525
28526
/**
28527
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28528
 * of values.
28529
 */
28530
var objToString = objectProto.toString;
28531
28532
/**
28533
 * Checks if `value` is classified as a `Function` object.
28534
 *
28535
 * @static
28536
 * @memberOf _
28537
 * @category Lang
28538
 * @param {*} value The value to check.
28539
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28540
 * @example
28541
 *
28542
 * _.isFunction(_);
28543
 * // => true
28544
 *
28545
 * _.isFunction(/abc/);
28546
 * // => false
28547
 */
28548
function isFunction(value) {
28549
  // The use of `Object#toString` avoids issues with the `typeof` operator
28550
  // in older versions of Chrome and Safari which return 'function' for regexes
28551
  // and Safari 8 equivalents which return 'object' for typed array constructors.
28552
  return isObject(value) && objToString.call(value) == funcTag;
28553
}
28554
28555
module.exports = isFunction;
28556
28557
},{"./isObject":147}],146:[function(require,module,exports){
28558
var isFunction = require('./isFunction'),
28559
    isHostObject = require('../internal/isHostObject'),
28560
    isObjectLike = require('../internal/isObjectLike');
28561
28562
/** Used to detect host constructors (Safari > 5). */
28563
var reIsHostCtor = /^\[object .+?Constructor\]$/;
28564
28565
/** Used for native method references. */
28566
var objectProto = Object.prototype;
28567
28568
/** Used to resolve the decompiled source of functions. */
28569
var fnToString = Function.prototype.toString;
28570
28571
/** Used to check objects for own properties. */
28572
var hasOwnProperty = objectProto.hasOwnProperty;
28573
28574
/** Used to detect if a method is native. */
28575
var reIsNative = RegExp('^' +
28576
  fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
28577
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
28578
);
28579
28580
/**
28581
 * Checks if `value` is a native function.
28582
 *
28583
 * @static
28584
 * @memberOf _
28585
 * @category Lang
28586
 * @param {*} value The value to check.
28587
 * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
28588
 * @example
28589
 *
28590
 * _.isNative(Array.prototype.push);
28591
 * // => true
28592
 *
28593
 * _.isNative(_);
28594
 * // => false
28595
 */
28596
function isNative(value) {
28597
  if (value == null) {
28598
    return false;
28599
  }
28600
  if (isFunction(value)) {
28601
    return reIsNative.test(fnToString.call(value));
28602
  }
28603
  return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
28604
}
28605
28606
module.exports = isNative;
28607
28608
},{"../internal/isHostObject":123,"../internal/isObjectLike":129,"./isFunction":145}],147:[function(require,module,exports){
28609
/**
28610
 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
28611
 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
28612
 *
28613
 * @static
28614
 * @memberOf _
28615
 * @category Lang
28616
 * @param {*} value The value to check.
28617
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
28618
 * @example
28619
 *
28620
 * _.isObject({});
28621
 * // => true
28622
 *
28623
 * _.isObject([1, 2, 3]);
28624
 * // => true
28625
 *
28626
 * _.isObject(1);
28627
 * // => false
28628
 */
28629
function isObject(value) {
28630
  // Avoid a V8 JIT bug in Chrome 19-20.
28631
  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
28632
  var type = typeof value;
28633
  return !!value && (type == 'object' || type == 'function');
28634
}
28635
28636
module.exports = isObject;
28637
28638
},{}],148:[function(require,module,exports){
28639
var baseForIn = require('../internal/baseForIn'),
28640
    isArguments = require('./isArguments'),
28641
    isHostObject = require('../internal/isHostObject'),
28642
    isObjectLike = require('../internal/isObjectLike'),
28643
    support = require('../support');
28644
28645
/** `Object#toString` result references. */
28646
var objectTag = '[object Object]';
28647
28648
/** Used for native method references. */
28649
var objectProto = Object.prototype;
28650
28651
/** Used to check objects for own properties. */
28652
var hasOwnProperty = objectProto.hasOwnProperty;
28653
28654
/**
28655
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28656
 * of values.
28657
 */
28658
var objToString = objectProto.toString;
28659
28660
/**
28661
 * Checks if `value` is a plain object, that is, an object created by the
28662
 * `Object` constructor or one with a `[[Prototype]]` of `null`.
28663
 *
28664
 * **Note:** This method assumes objects created by the `Object` constructor
28665
 * have no inherited enumerable properties.
28666
 *
28667
 * @static
28668
 * @memberOf _
28669
 * @category Lang
28670
 * @param {*} value The value to check.
28671
 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
28672
 * @example
28673
 *
28674
 * function Foo() {
28675
 *   this.a = 1;
28676
 * }
28677
 *
28678
 * _.isPlainObject(new Foo);
28679
 * // => false
28680
 *
28681
 * _.isPlainObject([1, 2, 3]);
28682
 * // => false
28683
 *
28684
 * _.isPlainObject({ 'x': 0, 'y': 0 });
28685
 * // => true
28686
 *
28687
 * _.isPlainObject(Object.create(null));
28688
 * // => true
28689
 */
28690
function isPlainObject(value) {
28691
  var Ctor;
28692
28693
  // Exit early for non `Object` objects.
28694
  if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) ||
28695
      (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
28696
    return false;
28697
  }
28698
  // IE < 9 iterates inherited properties before own properties. If the first
28699
  // iterated property is an object's own property then there are no inherited
28700
  // enumerable properties.
28701
  var result;
28702
  if (support.ownLast) {
28703
    baseForIn(value, function(subValue, key, object) {
28704
      result = hasOwnProperty.call(object, key);
28705
      return false;
28706
    });
28707
    return result !== false;
28708
  }
28709
  // In most environments an object's own properties are iterated before
28710
  // its inherited properties. If the last iterated property is an object's
28711
  // own property then there are no inherited enumerable properties.
28712
  baseForIn(value, function(subValue, key) {
28713
    result = key;
28714
  });
28715
  return result === undefined || hasOwnProperty.call(value, result);
28716
}
28717
28718
module.exports = isPlainObject;
28719
28720
},{"../internal/baseForIn":78,"../internal/isHostObject":123,"../internal/isObjectLike":129,"../support":156,"./isArguments":142}],149:[function(require,module,exports){
28721
var isObjectLike = require('../internal/isObjectLike');
28722
28723
/** `Object#toString` result references. */
28724
var stringTag = '[object String]';
28725
28726
/** Used for native method references. */
28727
var objectProto = Object.prototype;
28728
28729
/**
28730
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28731
 * of values.
28732
 */
28733
var objToString = objectProto.toString;
28734
28735
/**
28736
 * Checks if `value` is classified as a `String` primitive or object.
28737
 *
28738
 * @static
28739
 * @memberOf _
28740
 * @category Lang
28741
 * @param {*} value The value to check.
28742
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28743
 * @example
28744
 *
28745
 * _.isString('abc');
28746
 * // => true
28747
 *
28748
 * _.isString(1);
28749
 * // => false
28750
 */
28751
function isString(value) {
28752
  return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
28753
}
28754
28755
module.exports = isString;
28756
28757
},{"../internal/isObjectLike":129}],150:[function(require,module,exports){
28758
var isLength = require('../internal/isLength'),
28759
    isObjectLike = require('../internal/isObjectLike');
28760
28761
/** `Object#toString` result references. */
28762
var argsTag = '[object Arguments]',
28763
    arrayTag = '[object Array]',
28764
    boolTag = '[object Boolean]',
28765
    dateTag = '[object Date]',
28766
    errorTag = '[object Error]',
28767
    funcTag = '[object Function]',
28768
    mapTag = '[object Map]',
28769
    numberTag = '[object Number]',
28770
    objectTag = '[object Object]',
28771
    regexpTag = '[object RegExp]',
28772
    setTag = '[object Set]',
28773
    stringTag = '[object String]',
28774
    weakMapTag = '[object WeakMap]';
28775
28776
var arrayBufferTag = '[object ArrayBuffer]',
28777
    float32Tag = '[object Float32Array]',
28778
    float64Tag = '[object Float64Array]',
28779
    int8Tag = '[object Int8Array]',
28780
    int16Tag = '[object Int16Array]',
28781
    int32Tag = '[object Int32Array]',
28782
    uint8Tag = '[object Uint8Array]',
28783
    uint8ClampedTag = '[object Uint8ClampedArray]',
28784
    uint16Tag = '[object Uint16Array]',
28785
    uint32Tag = '[object Uint32Array]';
28786
28787
/** Used to identify `toStringTag` values of typed arrays. */
28788
var typedArrayTags = {};
28789
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
28790
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
28791
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
28792
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
28793
typedArrayTags[uint32Tag] = true;
28794
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
28795
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
28796
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
28797
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
28798
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
28799
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
28800
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
28801
28802
/** Used for native method references. */
28803
var objectProto = Object.prototype;
28804
28805
/**
28806
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28807
 * of values.
28808
 */
28809
var objToString = objectProto.toString;
28810
28811
/**
28812
 * Checks if `value` is classified as a typed array.
28813
 *
28814
 * @static
28815
 * @memberOf _
28816
 * @category Lang
28817
 * @param {*} value The value to check.
28818
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28819
 * @example
28820
 *
28821
 * _.isTypedArray(new Uint8Array);
28822
 * // => true
28823
 *
28824
 * _.isTypedArray([]);
28825
 * // => false
28826
 */
28827
function isTypedArray(value) {
28828
  return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
28829
}
28830
28831
module.exports = isTypedArray;
28832
28833
},{"../internal/isLength":128,"../internal/isObjectLike":129}],151:[function(require,module,exports){
28834
/**
28835
 * Checks if `value` is `undefined`.
28836
 *
28837
 * @static
28838
 * @memberOf _
28839
 * @category Lang
28840
 * @param {*} value The value to check.
28841
 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
28842
 * @example
28843
 *
28844
 * _.isUndefined(void 0);
28845
 * // => true
28846
 *
28847
 * _.isUndefined(null);
28848
 * // => false
28849
 */
28850
function isUndefined(value) {
28851
  return value === undefined;
28852
}
28853
28854
module.exports = isUndefined;
28855
28856
},{}],152:[function(require,module,exports){
28857
var getNative = require('../internal/getNative'),
28858
    isArrayLike = require('../internal/isArrayLike'),
28859
    isObject = require('../lang/isObject'),
28860
    shimKeys = require('../internal/shimKeys'),
28861
    support = require('../support');
28862
28863
/* Native method references for those with the same name as other `lodash` methods. */
28864
var nativeKeys = getNative(Object, 'keys');
28865
28866
/**
28867
 * Creates an array of the own enumerable property names of `object`.
28868
 *
28869
 * **Note:** Non-object values are coerced to objects. See the
28870
 * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
28871
 * for more details.
28872
 *
28873
 * @static
28874
 * @memberOf _
28875
 * @category Object
28876
 * @param {Object} object The object to query.
28877
 * @returns {Array} Returns the array of property names.
28878
 * @example
28879
 *
28880
 * function Foo() {
28881
 *   this.a = 1;
28882
 *   this.b = 2;
28883
 * }
28884
 *
28885
 * Foo.prototype.c = 3;
28886
 *
28887
 * _.keys(new Foo);
28888
 * // => ['a', 'b'] (iteration order is not guaranteed)
28889
 *
28890
 * _.keys('hi');
28891
 * // => ['0', '1']
28892
 */
28893
var keys = !nativeKeys ? shimKeys : function(object) {
28894
  var Ctor = object == null ? undefined : object.constructor;
28895
  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
28896
      (typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) {
28897
    return shimKeys(object);
28898
  }
28899
  return isObject(object) ? nativeKeys(object) : [];
28900
};
28901
28902
module.exports = keys;
28903
28904
},{"../internal/getNative":117,"../internal/isArrayLike":122,"../internal/shimKeys":137,"../lang/isObject":147,"../support":156}],153:[function(require,module,exports){
28905
var arrayEach = require('../internal/arrayEach'),
28906
    isArguments = require('../lang/isArguments'),
28907
    isArray = require('../lang/isArray'),
28908
    isFunction = require('../lang/isFunction'),
28909
    isIndex = require('../internal/isIndex'),
28910
    isLength = require('../internal/isLength'),
28911
    isObject = require('../lang/isObject'),
28912
    isString = require('../lang/isString'),
28913
    support = require('../support');
28914
28915
/** `Object#toString` result references. */
28916
var arrayTag = '[object Array]',
28917
    boolTag = '[object Boolean]',
28918
    dateTag = '[object Date]',
28919
    errorTag = '[object Error]',
28920
    funcTag = '[object Function]',
28921
    numberTag = '[object Number]',
28922
    objectTag = '[object Object]',
28923
    regexpTag = '[object RegExp]',
28924
    stringTag = '[object String]';
28925
28926
/** Used to fix the JScript `[[DontEnum]]` bug. */
28927
var shadowProps = [
28928
  'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
28929
  'toLocaleString', 'toString', 'valueOf'
28930
];
28931
28932
/** Used for native method references. */
28933
var errorProto = Error.prototype,
28934
    objectProto = Object.prototype,
28935
    stringProto = String.prototype;
28936
28937
/** Used to check objects for own properties. */
28938
var hasOwnProperty = objectProto.hasOwnProperty;
28939
28940
/**
28941
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28942
 * of values.
28943
 */
28944
var objToString = objectProto.toString;
28945
28946
/** Used to avoid iterating over non-enumerable properties in IE < 9. */
28947
var nonEnumProps = {};
28948
nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
28949
nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true };
28950
nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true };
28951
nonEnumProps[objectTag] = { 'constructor': true };
28952
28953
arrayEach(shadowProps, function(key) {
28954
  for (var tag in nonEnumProps) {
28955
    if (hasOwnProperty.call(nonEnumProps, tag)) {
28956
      var props = nonEnumProps[tag];
28957
      props[key] = hasOwnProperty.call(props, key);
28958
    }
28959
  }
28960
});
28961
28962
/**
28963
 * Creates an array of the own and inherited enumerable property names of `object`.
28964
 *
28965
 * **Note:** Non-object values are coerced to objects.
28966
 *
28967
 * @static
28968
 * @memberOf _
28969
 * @category Object
28970
 * @param {Object} object The object to query.
28971
 * @returns {Array} Returns the array of property names.
28972
 * @example
28973
 *
28974
 * function Foo() {
28975
 *   this.a = 1;
28976
 *   this.b = 2;
28977
 * }
28978
 *
28979
 * Foo.prototype.c = 3;
28980
 *
28981
 * _.keysIn(new Foo);
28982
 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
28983
 */
28984
function keysIn(object) {
28985
  if (object == null) {
28986
    return [];
28987
  }
28988
  if (!isObject(object)) {
28989
    object = Object(object);
28990
  }
28991
  var length = object.length;
28992
28993
  length = (length && isLength(length) &&
28994
    (isArray(object) || isArguments(object) || isString(object)) && length) || 0;
28995
28996
  var Ctor = object.constructor,
28997
      index = -1,
28998
      proto = (isFunction(Ctor) && Ctor.prototype) || objectProto,
28999
      isProto = proto === object,
29000
      result = Array(length),
29001
      skipIndexes = length > 0,
29002
      skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
29003
      skipProto = support.enumPrototypes && isFunction(object);
29004
29005
  while (++index < length) {
29006
    result[index] = (index + '');
29007
  }
29008
  // lodash skips the `constructor` property when it infers it is iterating
29009
  // over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
29010
  // attribute of an existing property and the `constructor` property of a
29011
  // prototype defaults to non-enumerable.
29012
  for (var key in object) {
29013
    if (!(skipProto && key == 'prototype') &&
29014
        !(skipErrorProps && (key == 'message' || key == 'name')) &&
29015
        !(skipIndexes && isIndex(key, length)) &&
29016
        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
29017
      result.push(key);
29018
    }
29019
  }
29020
  if (support.nonEnumShadows && object !== objectProto) {
29021
    var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)),
29022
        nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag];
29023
29024
    if (tag == objectTag) {
29025
      proto = objectProto;
29026
    }
29027
    length = shadowProps.length;
29028
    while (length--) {
29029
      key = shadowProps[length];
29030
      var nonEnum = nonEnums[key];
29031
      if (!(isProto && nonEnum) &&
29032
          (nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
29033
        result.push(key);
29034
      }
29035
    }
29036
  }
29037
  return result;
29038
}
29039
29040
module.exports = keysIn;
29041
29042
},{"../internal/arrayEach":66,"../internal/isIndex":124,"../internal/isLength":128,"../lang/isArguments":142,"../lang/isArray":143,"../lang/isFunction":145,"../lang/isObject":147,"../lang/isString":149,"../support":156}],154:[function(require,module,exports){
29043
var keys = require('./keys'),
29044
    toObject = require('../internal/toObject');
29045
29046
/**
29047
 * Creates a two dimensional array of the key-value pairs for `object`,
29048
 * e.g. `[[key1, value1], [key2, value2]]`.
29049
 *
29050
 * @static
29051
 * @memberOf _
29052
 * @category Object
29053
 * @param {Object} object The object to query.
29054
 * @returns {Array} Returns the new array of key-value pairs.
29055
 * @example
29056
 *
29057
 * _.pairs({ 'barney': 36, 'fred': 40 });
29058
 * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
29059
 */
29060
function pairs(object) {
29061
  object = toObject(object);
29062
29063
  var index = -1,
29064
      props = keys(object),
29065
      length = props.length,
29066
      result = Array(length);
29067
29068
  while (++index < length) {
29069
    var key = props[index];
29070
    result[index] = [key, object[key]];
29071
  }
29072
  return result;
29073
}
29074
29075
module.exports = pairs;
29076
29077
},{"../internal/toObject":138,"./keys":152}],155:[function(require,module,exports){
29078
var baseValues = require('../internal/baseValues'),
29079
    keys = require('./keys');
29080
29081
/**
29082
 * Creates an array of the own enumerable property values of `object`.
29083
 *
29084
 * **Note:** Non-object values are coerced to objects.
29085
 *
29086
 * @static
29087
 * @memberOf _
29088
 * @category Object
29089
 * @param {Object} object The object to query.
29090
 * @returns {Array} Returns the array of property values.
29091
 * @example
29092
 *
29093
 * function Foo() {
29094
 *   this.a = 1;
29095
 *   this.b = 2;
29096
 * }
29097
 *
29098
 * Foo.prototype.c = 3;
29099
 *
29100
 * _.values(new Foo);
29101
 * // => [1, 2] (iteration order is not guaranteed)
29102
 *
29103
 * _.values('hi');
29104
 * // => ['h', 'i']
29105
 */
29106
function values(object) {
29107
  return baseValues(object, keys(object));
29108
}
29109
29110
module.exports = values;
29111
29112
},{"../internal/baseValues":94,"./keys":152}],156:[function(require,module,exports){
29113
/** Used for native method references. */
29114
var arrayProto = Array.prototype,
29115
    errorProto = Error.prototype,
29116
    objectProto = Object.prototype;
29117
29118
/** Native method references. */
29119
var propertyIsEnumerable = objectProto.propertyIsEnumerable,
29120
    splice = arrayProto.splice;
29121
29122
/**
29123
 * An object environment feature flags.
29124
 *
29125
 * @static
29126
 * @memberOf _
29127
 * @type Object
29128
 */
29129
var support = {};
29130
29131
(function(x) {
29132
  var Ctor = function() { this.x = x; },
29133
      object = { '0': x, 'length': x },
29134
      props = [];
29135
29136
  Ctor.prototype = { 'valueOf': x, 'y': x };
29137
  for (var key in new Ctor) { props.push(key); }
29138
29139
  /**
29140
   * Detect if `name` or `message` properties of `Error.prototype` are
29141
   * enumerable by default (IE < 9, Safari < 5.1).
29142
   *
29143
   * @memberOf _.support
29144
   * @type boolean
29145
   */
29146
  support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') ||
29147
    propertyIsEnumerable.call(errorProto, 'name');
29148
29149
  /**
29150
   * Detect if `prototype` properties are enumerable by default.
29151
   *
29152
   * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
29153
   * (if the prototype or a property on the prototype has been set)
29154
   * incorrectly set the `[[Enumerable]]` value of a function's `prototype`
29155
   * property to `true`.
29156
   *
29157
   * @memberOf _.support
29158
   * @type boolean
29159
   */
29160
  support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
29161
29162
  /**
29163
   * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
29164
   *
29165
   * In IE < 9 an object's own properties, shadowing non-enumerable ones,
29166
   * are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
29167
   *
29168
   * @memberOf _.support
29169
   * @type boolean
29170
   */
29171
  support.nonEnumShadows = !/valueOf/.test(props);
29172
29173
  /**
29174
   * Detect if own properties are iterated after inherited properties (IE < 9).
29175
   *
29176
   * @memberOf _.support
29177
   * @type boolean
29178
   */
29179
  support.ownLast = props[0] != 'x';
29180
29181
  /**
29182
   * Detect if `Array#shift` and `Array#splice` augment array-like objects
29183
   * correctly.
29184
   *
29185
   * Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
29186
   * `shift()` and `splice()` functions that fail to remove the last element,
29187
   * `value[0]`, of array-like objects even though the "length" property is
29188
   * set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
29189
   * while `splice()` is buggy regardless of mode in IE < 9.
29190
   *
29191
   * @memberOf _.support
29192
   * @type boolean
29193
   */
29194
  support.spliceObjects = (splice.call(object, 0, 1), !object[0]);
29195
29196
  /**
29197
   * Detect lack of support for accessing string characters by index.
29198
   *
29199
   * IE < 8 can't access characters by index. IE 8 can only access characters
29200
   * by index on string literals, not string objects.
29201
   *
29202
   * @memberOf _.support
29203
   * @type boolean
29204
   */
29205
  support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
29206
}(1, 0));
29207
29208
module.exports = support;
29209
29210
},{}],157:[function(require,module,exports){
29211
/**
29212
 * This method returns the first argument provided to it.
29213
 *
29214
 * @static
29215
 * @memberOf _
29216
 * @category Utility
29217
 * @param {*} value Any value.
29218
 * @returns {*} Returns `value`.
29219
 * @example
29220
 *
29221
 * var object = { 'user': 'fred' };
29222
 *
29223
 * _.identity(object) === object;
29224
 * // => true
29225
 */
29226
function identity(value) {
29227
  return value;
29228
}
29229
29230
module.exports = identity;
29231
29232
},{}],158:[function(require,module,exports){
29233
/**
29234
 * A no-operation function that returns `undefined` regardless of the
29235
 * arguments it receives.
29236
 *
29237
 * @static
29238
 * @memberOf _
29239
 * @category Utility
29240
 * @example
29241
 *
29242
 * var object = { 'user': 'fred' };
29243
 *
29244
 * _.noop(object) === undefined;
29245
 * // => true
29246
 */
29247
function noop() {
29248
  // No operation performed.
29249
}
29250
29251
module.exports = noop;
29252
29253
},{}],159:[function(require,module,exports){
29254
var baseProperty = require('../internal/baseProperty'),
29255
    basePropertyDeep = require('../internal/basePropertyDeep'),
29256
    isKey = require('../internal/isKey');
29257
29258
/**
29259
 * Creates a function that returns the property value at `path` on a
29260
 * given object.
29261
 *
29262
 * @static
29263
 * @memberOf _
29264
 * @category Utility
29265
 * @param {Array|string} path The path of the property to get.
29266
 * @returns {Function} Returns the new function.
29267
 * @example
29268
 *
29269
 * var objects = [
29270
 *   { 'a': { 'b': { 'c': 2 } } },
29271
 *   { 'a': { 'b': { 'c': 1 } } }
29272
 * ];
29273
 *
29274
 * _.map(objects, _.property('a.b.c'));
29275
 * // => [2, 1]
29276
 *
29277
 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
29278
 * // => [1, 2]
29279
 */
29280
function property(path) {
29281
  return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
29282
}
29283
29284
module.exports = property;
29285
29286
},{"../internal/baseProperty":89,"../internal/basePropertyDeep":90,"../internal/isKey":126}],160:[function(require,module,exports){
29287
/**
29288
 * Module dependencies.
29289
 */
29290
29291
var Emitter = require('emitter');
29292
var reduce = require('reduce');
29293
29294
/**
29295
 * Root reference for iframes.
29296
 */
29297
29298
var root = 'undefined' == typeof window
29299
  ? (this || self)
29300
  : window;
29301
29302
/**
29303
 * Noop.
29304
 */
29305
29306
function noop(){};
29307
29308
/**
29309
 * Check if `obj` is a host object,
29310
 * we don't want to serialize these :)
29311
 *
29312
 * TODO: future proof, move to compoent land
29313
 *
29314
 * @param {Object} obj
29315
 * @return {Boolean}
29316
 * @api private
29317
 */
29318
29319
function isHost(obj) {
29320
  var str = {}.toString.call(obj);
29321
29322
  switch (str) {
29323
    case '[object File]':
29324
    case '[object Blob]':
29325
    case '[object FormData]':
29326
      return true;
29327
    default:
29328
      return false;
29329
  }
29330
}
29331
29332
/**
29333
 * Determine XHR.
29334
 */
29335
29336
request.getXHR = function () {
29337
  if (root.XMLHttpRequest
29338
      && (!root.location || 'file:' != root.location.protocol
29339
          || !root.ActiveXObject)) {
29340
    return new XMLHttpRequest;
29341
  } else {
29342
    try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
29343
    try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
29344
    try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
29345
    try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
29346
  }
29347
  return false;
29348
};
29349
29350
/**
29351
 * Removes leading and trailing whitespace, added to support IE.
29352
 *
29353
 * @param {String} s
29354
 * @return {String}
29355
 * @api private
29356
 */
29357
29358
var trim = ''.trim
29359
  ? function(s) { return s.trim(); }
29360
  : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
29361
29362
/**
29363
 * Check if `obj` is an object.
29364
 *
29365
 * @param {Object} obj
29366
 * @return {Boolean}
29367
 * @api private
29368
 */
29369
29370
function isObject(obj) {
29371
  return obj === Object(obj);
29372
}
29373
29374
/**
29375
 * Serialize the given `obj`.
29376
 *
29377
 * @param {Object} obj
29378
 * @return {String}
29379
 * @api private
29380
 */
29381
29382
function serialize(obj) {
29383
  if (!isObject(obj)) return obj;
29384
  var pairs = [];
29385
  for (var key in obj) {
29386
    if (null != obj[key]) {
29387
      pairs.push(encodeURIComponent(key)
29388
        + '=' + encodeURIComponent(obj[key]));
29389
    }
29390
  }
29391
  return pairs.join('&');
29392
}
29393
29394
/**
29395
 * Expose serialization method.
29396
 */
29397
29398
 request.serializeObject = serialize;
29399
29400
 /**
29401
  * Parse the given x-www-form-urlencoded `str`.
29402
  *
29403
  * @param {String} str
29404
  * @return {Object}
29405
  * @api private
29406
  */
29407
29408
function parseString(str) {
29409
  var obj = {};
29410
  var pairs = str.split('&');
29411
  var parts;
29412
  var pair;
29413
29414
  for (var i = 0, len = pairs.length; i < len; ++i) {
29415
    pair = pairs[i];
29416
    parts = pair.split('=');
29417
    obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
29418
  }
29419
29420
  return obj;
29421
}
29422
29423
/**
29424
 * Expose parser.
29425
 */
29426
29427
request.parseString = parseString;
29428
29429
/**
29430
 * Default MIME type map.
29431
 *
29432
 *     superagent.types.xml = 'application/xml';
29433
 *
29434
 */
29435
29436
request.types = {
29437
  html: 'text/html',
29438
  json: 'application/json',
29439
  xml: 'application/xml',
29440
  urlencoded: 'application/x-www-form-urlencoded',
29441
  'form': 'application/x-www-form-urlencoded',
29442
  'form-data': 'application/x-www-form-urlencoded'
29443
};
29444
29445
/**
29446
 * Default serialization map.
29447
 *
29448
 *     superagent.serialize['application/xml'] = function(obj){
29449
 *       return 'generated xml here';
29450
 *     };
29451
 *
29452
 */
29453
29454
 request.serialize = {
29455
   'application/x-www-form-urlencoded': serialize,
29456
   'application/json': JSON.stringify
29457
 };
29458
29459
 /**
29460
  * Default parsers.
29461
  *
29462
  *     superagent.parse['application/xml'] = function(str){
29463
  *       return { object parsed from str };
29464
  *     };
29465
  *
29466
  */
29467
29468
request.parse = {
29469
  'application/x-www-form-urlencoded': parseString,
29470
  'application/json': JSON.parse
29471
};
29472
29473
/**
29474
 * Parse the given header `str` into
29475
 * an object containing the mapped fields.
29476
 *
29477
 * @param {String} str
29478
 * @return {Object}
29479
 * @api private
29480
 */
29481
29482
function parseHeader(str) {
29483
  var lines = str.split(/\r?\n/);
29484
  var fields = {};
29485
  var index;
29486
  var line;
29487
  var field;
29488
  var val;
29489
29490
  lines.pop(); // trailing CRLF
29491
29492
  for (var i = 0, len = lines.length; i < len; ++i) {
29493
    line = lines[i];
29494
    index = line.indexOf(':');
29495
    field = line.slice(0, index).toLowerCase();
29496
    val = trim(line.slice(index + 1));
29497
    fields[field] = val;
29498
  }
29499
29500
  return fields;
29501
}
29502
29503
/**
29504
 * Return the mime type for the given `str`.
29505
 *
29506
 * @param {String} str
29507
 * @return {String}
29508
 * @api private
29509
 */
29510
29511
function type(str){
29512
  return str.split(/ *; */).shift();
29513
};
29514
29515
/**
29516
 * Return header field parameters.
29517
 *
29518
 * @param {String} str
29519
 * @return {Object}
29520
 * @api private
29521
 */
29522
29523
function params(str){
29524
  return reduce(str.split(/ *; */), function(obj, str){
29525
    var parts = str.split(/ *= */)
29526
      , key = parts.shift()
29527
      , val = parts.shift();
29528
29529
    if (key && val) obj[key] = val;
29530
    return obj;
29531
  }, {});
29532
};
29533
29534
/**
29535
 * Initialize a new `Response` with the given `xhr`.
29536
 *
29537
 *  - set flags (.ok, .error, etc)
29538
 *  - parse header
29539
 *
29540
 * Examples:
29541
 *
29542
 *  Aliasing `superagent` as `request` is nice:
29543
 *
29544
 *      request = superagent;
29545
 *
29546
 *  We can use the promise-like API, or pass callbacks:
29547
 *
29548
 *      request.get('/').end(function(res){});
29549
 *      request.get('/', function(res){});
29550
 *
29551
 *  Sending data can be chained:
29552
 *
29553
 *      request
29554
 *        .post('/user')
29555
 *        .send({ name: 'tj' })
29556
 *        .end(function(res){});
29557
 *
29558
 *  Or passed to `.send()`:
29559
 *
29560
 *      request
29561
 *        .post('/user')
29562
 *        .send({ name: 'tj' }, function(res){});
29563
 *
29564
 *  Or passed to `.post()`:
29565
 *
29566
 *      request
29567
 *        .post('/user', { name: 'tj' })
29568
 *        .end(function(res){});
29569
 *
29570
 * Or further reduced to a single call for simple cases:
29571
 *
29572
 *      request
29573
 *        .post('/user', { name: 'tj' }, function(res){});
29574
 *
29575
 * @param {XMLHTTPRequest} xhr
29576
 * @param {Object} options
29577
 * @api private
29578
 */
29579
29580
function Response(req, options) {
29581
  options = options || {};
29582
  this.req = req;
29583
  this.xhr = this.req.xhr;
29584
  // responseText is accessible only if responseType is '' or 'text' and on older browsers
29585
  this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')
29586
     ? this.xhr.responseText
29587
     : null;
29588
  this.statusText = this.req.xhr.statusText;
29589
  this.setStatusProperties(this.xhr.status);
29590
  this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
29591
  // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
29592
  // getResponseHeader still works. so we get content-type even if getting
29593
  // other headers fails.
29594
  this.header['content-type'] = this.xhr.getResponseHeader('content-type');
29595
  this.setHeaderProperties(this.header);
29596
  this.body = this.req.method != 'HEAD'
29597
    ? this.parseBody(this.text ? this.text : this.xhr.response)
29598
    : null;
29599
}
29600
29601
/**
29602
 * Get case-insensitive `field` value.
29603
 *
29604
 * @param {String} field
29605
 * @return {String}
29606
 * @api public
29607
 */
29608
29609
Response.prototype.get = function(field){
29610
  return this.header[field.toLowerCase()];
29611
};
29612
29613
/**
29614
 * Set header related properties:
29615
 *
29616
 *   - `.type` the content type without params
29617
 *
29618
 * A response of "Content-Type: text/plain; charset=utf-8"
29619
 * will provide you with a `.type` of "text/plain".
29620
 *
29621
 * @param {Object} header
29622
 * @api private
29623
 */
29624
29625
Response.prototype.setHeaderProperties = function(header){
29626
  // content-type
29627
  var ct = this.header['content-type'] || '';
29628
  this.type = type(ct);
29629
29630
  // params
29631
  var obj = params(ct);
29632
  for (var key in obj) this[key] = obj[key];
29633
};
29634
29635
/**
29636
 * Parse the given body `str`.
29637
 *
29638
 * Used for auto-parsing of bodies. Parsers
29639
 * are defined on the `superagent.parse` object.
29640
 *
29641
 * @param {String} str
29642
 * @return {Mixed}
29643
 * @api private
29644
 */
29645
29646
Response.prototype.parseBody = function(str){
29647
  var parse = request.parse[this.type];
29648
  return parse && str && (str.length || str instanceof Object)
29649
    ? parse(str)
29650
    : null;
29651
};
29652
29653
/**
29654
 * Set flags such as `.ok` based on `status`.
29655
 *
29656
 * For example a 2xx response will give you a `.ok` of __true__
29657
 * whereas 5xx will be __false__ and `.error` will be __true__. The
29658
 * `.clientError` and `.serverError` are also available to be more
29659
 * specific, and `.statusType` is the class of error ranging from 1..5
29660
 * sometimes useful for mapping respond colors etc.
29661
 *
29662
 * "sugar" properties are also defined for common cases. Currently providing:
29663
 *
29664
 *   - .noContent
29665
 *   - .badRequest
29666
 *   - .unauthorized
29667
 *   - .notAcceptable
29668
 *   - .notFound
29669
 *
29670
 * @param {Number} status
29671
 * @api private
29672
 */
29673
29674
Response.prototype.setStatusProperties = function(status){
29675
  // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
29676
  if (status === 1223) {
29677
    status = 204;
29678
  }
29679
29680
  var type = status / 100 | 0;
29681
29682
  // status / class
29683
  this.status = status;
29684
  this.statusType = type;
29685
29686
  // basics
29687
  this.info = 1 == type;
29688
  this.ok = 2 == type;
29689
  this.clientError = 4 == type;
29690
  this.serverError = 5 == type;
29691
  this.error = (4 == type || 5 == type)
29692
    ? this.toError()
29693
    : false;
29694
29695
  // sugar
29696
  this.accepted = 202 == status;
29697
  this.noContent = 204 == status;
29698
  this.badRequest = 400 == status;
29699
  this.unauthorized = 401 == status;
29700
  this.notAcceptable = 406 == status;
29701
  this.notFound = 404 == status;
29702
  this.forbidden = 403 == status;
29703
};
29704
29705
/**
29706
 * Return an `Error` representative of this response.
29707
 *
29708
 * @return {Error}
29709
 * @api public
29710
 */
29711
29712
Response.prototype.toError = function(){
29713
  var req = this.req;
29714
  var method = req.method;
29715
  var url = req.url;
29716
29717
  var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';
29718
  var err = new Error(msg);
29719
  err.status = this.status;
29720
  err.method = method;
29721
  err.url = url;
29722
29723
  return err;
29724
};
29725
29726
/**
29727
 * Expose `Response`.
29728
 */
29729
29730
request.Response = Response;
29731
29732
/**
29733
 * Initialize a new `Request` with the given `method` and `url`.
29734
 *
29735
 * @param {String} method
29736
 * @param {String} url
29737
 * @api public
29738
 */
29739
29740
function Request(method, url) {
29741
  var self = this;
29742
  Emitter.call(this);
29743
  this._query = this._query || [];
29744
  this.method = method;
29745
  this.url = url;
29746
  this.header = {};
29747
  this._header = {};
29748
  this.on('end', function(){
29749
    var err = null;
29750
    var res = null;
29751
29752
    try {
29753
      res = new Response(self);
29754
    } catch(e) {
29755
      err = new Error('Parser is unable to parse the response');
29756
      err.parse = true;
29757
      err.original = e;
29758
      return self.callback(err);
29759
    }
29760
29761
    self.emit('response', res);
29762
29763
    if (err) {
29764
      return self.callback(err, res);
29765
    }
29766
29767
    if (res.status >= 200 && res.status < 300) {
29768
      return self.callback(err, res);
29769
    }
29770
29771
    var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
29772
    new_err.original = err;
29773
    new_err.response = res;
29774
    new_err.status = res.status;
29775
29776
    self.callback(err || new_err, res);
29777
  });
29778
}
29779
29780
/**
29781
 * Mixin `Emitter`.
29782
 */
29783
29784
Emitter(Request.prototype);
29785
29786
/**
29787
 * Allow for extension
29788
 */
29789
29790
Request.prototype.use = function(fn) {
29791
  fn(this);
29792
  return this;
29793
}
29794
29795
/**
29796
 * Set timeout to `ms`.
29797
 *
29798
 * @param {Number} ms
29799
 * @return {Request} for chaining
29800
 * @api public
29801
 */
29802
29803
Request.prototype.timeout = function(ms){
29804
  this._timeout = ms;
29805
  return this;
29806
};
29807
29808
/**
29809
 * Clear previous timeout.
29810
 *
29811
 * @return {Request} for chaining
29812
 * @api public
29813
 */
29814
29815
Request.prototype.clearTimeout = function(){
29816
  this._timeout = 0;
29817
  clearTimeout(this._timer);
29818
  return this;
29819
};
29820
29821
/**
29822
 * Abort the request, and clear potential timeout.
29823
 *
29824
 * @return {Request}
29825
 * @api public
29826
 */
29827
29828
Request.prototype.abort = function(){
29829
  if (this.aborted) return;
29830
  this.aborted = true;
29831
  this.xhr.abort();
29832
  this.clearTimeout();
29833
  this.emit('abort');
29834
  return this;
29835
};
29836
29837
/**
29838
 * Set header `field` to `val`, or multiple fields with one object.
29839
 *
29840
 * Examples:
29841
 *
29842
 *      req.get('/')
29843
 *        .set('Accept', 'application/json')
29844
 *        .set('X-API-Key', 'foobar')
29845
 *        .end(callback);
29846
 *
29847
 *      req.get('/')
29848
 *        .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
29849
 *        .end(callback);
29850
 *
29851
 * @param {String|Object} field
29852
 * @param {String} val
29853
 * @return {Request} for chaining
29854
 * @api public
29855
 */
29856
29857
Request.prototype.set = function(field, val){
29858
  if (isObject(field)) {
29859
    for (var key in field) {
29860
      this.set(key, field[key]);
29861
    }
29862
    return this;
29863
  }
29864
  this._header[field.toLowerCase()] = val;
29865
  this.header[field] = val;
29866
  return this;
29867
};
29868
29869
/**
29870
 * Remove header `field`.
29871
 *
29872
 * Example:
29873
 *
29874
 *      req.get('/')
29875
 *        .unset('User-Agent')
29876
 *        .end(callback);
29877
 *
29878
 * @param {String} field
29879
 * @return {Request} for chaining
29880
 * @api public
29881
 */
29882
29883
Request.prototype.unset = function(field){
29884
  delete this._header[field.toLowerCase()];
29885
  delete this.header[field];
29886
  return this;
29887
};
29888
29889
/**
29890
 * Get case-insensitive header `field` value.
29891
 *
29892
 * @param {String} field
29893
 * @return {String}
29894
 * @api private
29895
 */
29896
29897
Request.prototype.getHeader = function(field){
29898
  return this._header[field.toLowerCase()];
29899
};
29900
29901
/**
29902
 * Set Content-Type to `type`, mapping values from `request.types`.
29903
 *
29904
 * Examples:
29905
 *
29906
 *      superagent.types.xml = 'application/xml';
29907
 *
29908
 *      request.post('/')
29909
 *        .type('xml')
29910
 *        .send(xmlstring)
29911
 *        .end(callback);
29912
 *
29913
 *      request.post('/')
29914
 *        .type('application/xml')
29915
 *        .send(xmlstring)
29916
 *        .end(callback);
29917
 *
29918
 * @param {String} type
29919
 * @return {Request} for chaining
29920
 * @api public
29921
 */
29922
29923
Request.prototype.type = function(type){
29924
  this.set('Content-Type', request.types[type] || type);
29925
  return this;
29926
};
29927
29928
/**
29929
 * Set Accept to `type`, mapping values from `request.types`.
29930
 *
29931
 * Examples:
29932
 *
29933
 *      superagent.types.json = 'application/json';
29934
 *
29935
 *      request.get('/agent')
29936
 *        .accept('json')
29937
 *        .end(callback);
29938
 *
29939
 *      request.get('/agent')
29940
 *        .accept('application/json')
29941
 *        .end(callback);
29942
 *
29943
 * @param {String} accept
29944
 * @return {Request} for chaining
29945
 * @api public
29946
 */
29947
29948
Request.prototype.accept = function(type){
29949
  this.set('Accept', request.types[type] || type);
29950
  return this;
29951
};
29952
29953
/**
29954
 * Set Authorization field value with `user` and `pass`.
29955
 *
29956
 * @param {String} user
29957
 * @param {String} pass
29958
 * @return {Request} for chaining
29959
 * @api public
29960
 */
29961
29962
Request.prototype.auth = function(user, pass){
29963
  var str = btoa(user + ':' + pass);
29964
  this.set('Authorization', 'Basic ' + str);
29965
  return this;
29966
};
29967
29968
/**
29969
* Add query-string `val`.
29970
*
29971
* Examples:
29972
*
29973
*   request.get('/shoes')
29974
*     .query('size=10')
29975
*     .query({ color: 'blue' })
29976
*
29977
* @param {Object|String} val
29978
* @return {Request} for chaining
29979
* @api public
29980
*/
29981
29982
Request.prototype.query = function(val){
29983
  if ('string' != typeof val) val = serialize(val);
29984
  if (val) this._query.push(val);
29985
  return this;
29986
};
29987
29988
/**
29989
 * Write the field `name` and `val` for "multipart/form-data"
29990
 * request bodies.
29991
 *
29992
 * ``` js
29993
 * request.post('/upload')
29994
 *   .field('foo', 'bar')
29995
 *   .end(callback);
29996
 * ```
29997
 *
29998
 * @param {String} name
29999
 * @param {String|Blob|File} val
30000
 * @return {Request} for chaining
30001
 * @api public
30002
 */
30003
30004
Request.prototype.field = function(name, val){
30005
  if (!this._formData) this._formData = new root.FormData();
30006
  this._formData.append(name, val);
30007
  return this;
30008
};
30009
30010
/**
30011
 * Queue the given `file` as an attachment to the specified `field`,
30012
 * with optional `filename`.
30013
 *
30014
 * ``` js
30015
 * request.post('/upload')
30016
 *   .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
30017
 *   .end(callback);
30018
 * ```
30019
 *
30020
 * @param {String} field
30021
 * @param {Blob|File} file
30022
 * @param {String} filename
30023
 * @return {Request} for chaining
30024
 * @api public
30025
 */
30026
30027
Request.prototype.attach = function(field, file, filename){
30028
  if (!this._formData) this._formData = new root.FormData();
30029
  this._formData.append(field, file, filename);
30030
  return this;
30031
};
30032
30033
/**
30034
 * Send `data`, defaulting the `.type()` to "json" when
30035
 * an object is given.
30036
 *
30037
 * Examples:
30038
 *
30039
 *       // querystring
30040
 *       request.get('/search')
30041
 *         .end(callback)
30042
 *
30043
 *       // multiple data "writes"
30044
 *       request.get('/search')
30045
 *         .send({ search: 'query' })
30046
 *         .send({ range: '1..5' })
30047
 *         .send({ order: 'desc' })
30048
 *         .end(callback)
30049
 *
30050
 *       // manual json
30051
 *       request.post('/user')
30052
 *         .type('json')
30053
 *         .send('{"name":"tj"})
30054
 *         .end(callback)
30055
 *
30056
 *       // auto json
30057
 *       request.post('/user')
30058
 *         .send({ name: 'tj' })
30059
 *         .end(callback)
30060
 *
30061
 *       // manual x-www-form-urlencoded
30062
 *       request.post('/user')
30063
 *         .type('form')
30064
 *         .send('name=tj')
30065
 *         .end(callback)
30066
 *
30067
 *       // auto x-www-form-urlencoded
30068
 *       request.post('/user')
30069
 *         .type('form')
30070
 *         .send({ name: 'tj' })
30071
 *         .end(callback)
30072
 *
30073
 *       // defaults to x-www-form-urlencoded
30074
  *      request.post('/user')
30075
  *        .send('name=tobi')
30076
  *        .send('species=ferret')
30077
  *        .end(callback)
30078
 *
30079
 * @param {String|Object} data
30080
 * @return {Request} for chaining
30081
 * @api public
30082
 */
30083
30084
Request.prototype.send = function(data){
30085
  var obj = isObject(data);
30086
  var type = this.getHeader('Content-Type');
30087
30088
  // merge
30089
  if (obj && isObject(this._data)) {
30090
    for (var key in data) {
30091
      this._data[key] = data[key];
30092
    }
30093
  } else if ('string' == typeof data) {
30094
    if (!type) this.type('form');
30095
    type = this.getHeader('Content-Type');
30096
    if ('application/x-www-form-urlencoded' == type) {
30097
      this._data = this._data
30098
        ? this._data + '&' + data
30099
        : data;
30100
    } else {
30101
      this._data = (this._data || '') + data;
30102
    }
30103
  } else {
30104
    this._data = data;
30105
  }
30106
30107
  if (!obj || isHost(data)) return this;
30108
  if (!type) this.type('json');
30109
  return this;
30110
};
30111
30112
/**
30113
 * Invoke the callback with `err` and `res`
30114
 * and handle arity check.
30115
 *
30116
 * @param {Error} err
30117
 * @param {Response} res
30118
 * @api private
30119
 */
30120
30121
Request.prototype.callback = function(err, res){
30122
  var fn = this._callback;
30123
  this.clearTimeout();
30124
  fn(err, res);
30125
};
30126
30127
/**
30128
 * Invoke callback with x-domain error.
30129
 *
30130
 * @api private
30131
 */
30132
30133
Request.prototype.crossDomainError = function(){
30134
  var err = new Error('Origin is not allowed by Access-Control-Allow-Origin');
30135
  err.crossDomain = true;
30136
  this.callback(err);
30137
};
30138
30139
/**
30140
 * Invoke callback with timeout error.
30141
 *
30142
 * @api private
30143
 */
30144
30145
Request.prototype.timeoutError = function(){
30146
  var timeout = this._timeout;
30147
  var err = new Error('timeout of ' + timeout + 'ms exceeded');
30148
  err.timeout = timeout;
30149
  this.callback(err);
30150
};
30151
30152
/**
30153
 * Enable transmission of cookies with x-domain requests.
30154
 *
30155
 * Note that for this to work the origin must not be
30156
 * using "Access-Control-Allow-Origin" with a wildcard,
30157
 * and also must set "Access-Control-Allow-Credentials"
30158
 * to "true".
30159
 *
30160
 * @api public
30161
 */
30162
30163
Request.prototype.withCredentials = function(){
30164
  this._withCredentials = true;
30165
  return this;
30166
};
30167
30168
/**
30169
 * Initiate request, invoking callback `fn(res)`
30170
 * with an instanceof `Response`.
30171
 *
30172
 * @param {Function} fn
30173
 * @return {Request} for chaining
30174
 * @api public
30175
 */
30176
30177
Request.prototype.end = function(fn){
30178
  var self = this;
30179
  var xhr = this.xhr = request.getXHR();
30180
  var query = this._query.join('&');
30181
  var timeout = this._timeout;
30182
  var data = this._formData || this._data;
30183
30184
  // store callback
30185
  this._callback = fn || noop;
30186
30187
  // state change
30188
  xhr.onreadystatechange = function(){
30189
    if (4 != xhr.readyState) return;
30190
30191
    // In IE9, reads to any property (e.g. status) off of an aborted XHR will
30192
    // result in the error "Could not complete the operation due to error c00c023f"
30193
    var status;
30194
    try { status = xhr.status } catch(e) { status = 0; }
30195
30196
    if (0 == status) {
30197
      if (self.timedout) return self.timeoutError();
30198
      if (self.aborted) return;
30199
      return self.crossDomainError();
30200
    }
30201
    self.emit('end');
30202
  };
30203
30204
  // progress
30205
  var handleProgress = function(e){
30206
    if (e.total > 0) {
30207
      e.percent = e.loaded / e.total * 100;
30208
    }
30209
    self.emit('progress', e);
30210
  };
30211
  if (this.hasListeners('progress')) {
30212
    xhr.onprogress = handleProgress;
30213
  }
30214
  try {
30215
    if (xhr.upload && this.hasListeners('progress')) {
30216
      xhr.upload.onprogress = handleProgress;
30217
    }
30218
  } catch(e) {
30219
    // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
30220
    // Reported here:
30221
    // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
30222
  }
30223
30224
  // timeout
30225
  if (timeout && !this._timer) {
30226
    this._timer = setTimeout(function(){
30227
      self.timedout = true;
30228
      self.abort();
30229
    }, timeout);
30230
  }
30231
30232
  // querystring
30233
  if (query) {
30234
    query = request.serializeObject(query);
30235
    this.url += ~this.url.indexOf('?')
30236
      ? '&' + query
30237
      : '?' + query;
30238
  }
30239
30240
  // initiate request
30241
  xhr.open(this.method, this.url, true);
30242
30243
  // CORS
30244
  if (this._withCredentials) xhr.withCredentials = true;
30245
30246
  // body
30247
  if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
30248
    // serialize stuff
30249
    var serialize = request.serialize[this.getHeader('Content-Type')];
30250
    if (serialize) data = serialize(data);
30251
  }
30252
30253
  // set header fields
30254
  for (var field in this.header) {
30255
    if (null == this.header[field]) continue;
30256
    xhr.setRequestHeader(field, this.header[field]);
30257
  }
30258
30259
  // send stuff
30260
  this.emit('request', this);
30261
  xhr.send(data);
30262
  return this;
30263
};
30264
30265
/**
30266
 * Expose `Request`.
30267
 */
30268
30269
request.Request = Request;
30270
30271
/**
30272
 * Issue a request:
30273
 *
30274
 * Examples:
30275
 *
30276
 *    request('GET', '/users').end(callback)
30277
 *    request('/users').end(callback)
30278
 *    request('/users', callback)
30279
 *
30280
 * @param {String} method
30281
 * @param {String|Function} url or callback
30282
 * @return {Request}
30283
 * @api public
30284
 */
30285
30286
function request(method, url) {
30287
  // callback
30288
  if ('function' == typeof url) {
30289
    return new Request('GET', method).end(url);
30290
  }
30291
30292
  // url first
30293
  if (1 == arguments.length) {
30294
    return new Request('GET', method);
30295
  }
30296
30297
  return new Request(method, url);
30298
}
30299
30300
/**
30301
 * GET `url` with optional callback `fn(res)`.
30302
 *
30303
 * @param {String} url
30304
 * @param {Mixed|Function} data or fn
30305
 * @param {Function} fn
30306
 * @return {Request}
30307
 * @api public
30308
 */
30309
30310
request.get = function(url, data, fn){
30311
  var req = request('GET', url);
30312
  if ('function' == typeof data) fn = data, data = null;
30313
  if (data) req.query(data);
30314
  if (fn) req.end(fn);
30315
  return req;
30316
};
30317
30318
/**
30319
 * HEAD `url` with optional callback `fn(res)`.
30320
 *
30321
 * @param {String} url
30322
 * @param {Mixed|Function} data or fn
30323
 * @param {Function} fn
30324
 * @return {Request}
30325
 * @api public
30326
 */
30327
30328
request.head = function(url, data, fn){
30329
  var req = request('HEAD', url);
30330
  if ('function' == typeof data) fn = data, data = null;
30331
  if (data) req.send(data);
30332
  if (fn) req.end(fn);
30333
  return req;
30334
};
30335
30336
/**
30337
 * DELETE `url` with optional callback `fn(res)`.
30338
 *
30339
 * @param {String} url
30340
 * @param {Function} fn
30341
 * @return {Request}
30342
 * @api public
30343
 */
30344
30345
request.del = function(url, fn){
30346
  var req = request('DELETE', url);
30347
  if (fn) req.end(fn);
30348
  return req;
30349
};
30350
30351
/**
30352
 * PATCH `url` with optional `data` and callback `fn(res)`.
30353
 *
30354
 * @param {String} url
30355
 * @param {Mixed} data
30356
 * @param {Function} fn
30357
 * @return {Request}
30358
 * @api public
30359
 */
30360
30361
request.patch = function(url, data, fn){
30362
  var req = request('PATCH', url);
30363
  if ('function' == typeof data) fn = data, data = null;
30364
  if (data) req.send(data);
30365
  if (fn) req.end(fn);
30366
  return req;
30367
};
30368
30369
/**
30370
 * POST `url` with optional `data` and callback `fn(res)`.
30371
 *
30372
 * @param {String} url
30373
 * @param {Mixed} data
30374
 * @param {Function} fn
30375
 * @return {Request}
30376
 * @api public
30377
 */
30378
30379
request.post = function(url, data, fn){
30380
  var req = request('POST', url);
30381
  if ('function' == typeof data) fn = data, data = null;
30382
  if (data) req.send(data);
30383
  if (fn) req.end(fn);
30384
  return req;
30385
};
30386
30387
/**
30388
 * PUT `url` with optional `data` and callback `fn(res)`.
30389
 *
30390
 * @param {String} url
30391
 * @param {Mixed|Function} data or fn
30392
 * @param {Function} fn
30393
 * @return {Request}
30394
 * @api public
30395
 */
30396
30397
request.put = function(url, data, fn){
30398
  var req = request('PUT', url);
30399
  if ('function' == typeof data) fn = data, data = null;
30400
  if (data) req.send(data);
30401
  if (fn) req.end(fn);
30402
  return req;
30403
};
30404
30405
/**
30406
 * Expose `request`.
30407
 */
30408
30409
module.exports = request;
30410
30411
},{"emitter":161,"reduce":162}],161:[function(require,module,exports){
30412
30413
/**
30414
 * Expose `Emitter`.
30415
 */
30416
30417
module.exports = Emitter;
30418
30419
/**
30420
 * Initialize a new `Emitter`.
30421
 *
30422
 * @api public
30423
 */
30424
30425
function Emitter(obj) {
30426
  if (obj) return mixin(obj);
30427
};
30428
30429
/**
30430
 * Mixin the emitter properties.
30431
 *
30432
 * @param {Object} obj
30433
 * @return {Object}
30434
 * @api private
30435
 */
30436
30437
function mixin(obj) {
30438
  for (var key in Emitter.prototype) {
30439
    obj[key] = Emitter.prototype[key];
30440
  }
30441
  return obj;
30442
}
30443
30444
/**
30445
 * Listen on the given `event` with `fn`.
30446
 *
30447
 * @param {String} event
30448
 * @param {Function} fn
30449
 * @return {Emitter}
30450
 * @api public
30451
 */
30452
30453
Emitter.prototype.on =
30454
Emitter.prototype.addEventListener = function(event, fn){
30455
  this._callbacks = this._callbacks || {};
30456
  (this._callbacks[event] = this._callbacks[event] || [])
30457
    .push(fn);
30458
  return this;
30459
};
30460
30461
/**
30462
 * Adds an `event` listener that will be invoked a single
30463
 * time then automatically removed.
30464
 *
30465
 * @param {String} event
30466
 * @param {Function} fn
30467
 * @return {Emitter}
30468
 * @api public
30469
 */
30470
30471
Emitter.prototype.once = function(event, fn){
30472
  var self = this;
30473
  this._callbacks = this._callbacks || {};
30474
30475
  function on() {
30476
    self.off(event, on);
30477
    fn.apply(this, arguments);
30478
  }
30479
30480
  on.fn = fn;
30481
  this.on(event, on);
30482
  return this;
30483
};
30484
30485
/**
30486
 * Remove the given callback for `event` or all
30487
 * registered callbacks.
30488
 *
30489
 * @param {String} event
30490
 * @param {Function} fn
30491
 * @return {Emitter}
30492
 * @api public
30493
 */
30494
30495
Emitter.prototype.off =
30496
Emitter.prototype.removeListener =
30497
Emitter.prototype.removeAllListeners =
30498
Emitter.prototype.removeEventListener = function(event, fn){
30499
  this._callbacks = this._callbacks || {};
30500
30501
  // all
30502
  if (0 == arguments.length) {
30503
    this._callbacks = {};
30504
    return this;
30505
  }
30506
30507
  // specific event
30508
  var callbacks = this._callbacks[event];
30509
  if (!callbacks) return this;
30510
30511
  // remove all handlers
30512
  if (1 == arguments.length) {
30513
    delete this._callbacks[event];
30514
    return this;
30515
  }
30516
30517
  // remove specific handler
30518
  var cb;
30519
  for (var i = 0; i < callbacks.length; i++) {
30520
    cb = callbacks[i];
30521
    if (cb === fn || cb.fn === fn) {
30522
      callbacks.splice(i, 1);
30523
      break;
30524
    }
30525
  }
30526
  return this;
30527
};
30528
30529
/**
30530
 * Emit `event` with the given args.
30531
 *
30532
 * @param {String} event
30533
 * @param {Mixed} ...
30534
 * @return {Emitter}
30535
 */
30536
30537
Emitter.prototype.emit = function(event){
30538
  this._callbacks = this._callbacks || {};
30539
  var args = [].slice.call(arguments, 1)
30540
    , callbacks = this._callbacks[event];
30541
30542
  if (callbacks) {
30543
    callbacks = callbacks.slice(0);
30544
    for (var i = 0, len = callbacks.length; i < len; ++i) {
30545
      callbacks[i].apply(this, args);
30546
    }
30547
  }
30548
30549
  return this;
30550
};
30551
30552
/**
30553
 * Return array of callbacks for `event`.
30554
 *
30555
 * @param {String} event
30556
 * @return {Array}
30557
 * @api public
30558
 */
30559
30560
Emitter.prototype.listeners = function(event){
30561
  this._callbacks = this._callbacks || {};
30562
  return this._callbacks[event] || [];
30563
};
30564
30565
/**
30566
 * Check if this emitter has `event` handlers.
30567
 *
30568
 * @param {String} event
30569
 * @return {Boolean}
30570
 * @api public
30571
 */
30572
30573
Emitter.prototype.hasListeners = function(event){
30574
  return !! this.listeners(event).length;
30575
};
30576
30577
},{}],162:[function(require,module,exports){
30578
30579
/**
30580
 * Reduce `arr` with `fn`.
30581
 *
30582
 * @param {Array} arr
30583
 * @param {Function} fn
30584
 * @param {Mixed} initial
30585
 *
30586
 * TODO: combatible error handling?
30587
 */
30588
30589
module.exports = function(arr, fn, initial){  
30590
  var idx = 0;
30591
  var len = arr.length;
30592
  var curr = arguments.length == 3
30593
    ? initial
30594
    : arr[idx++];
30595
30596
  while (idx < len) {
30597
    curr = fn.call(null, curr, arr[idx], ++idx, arr);
30598
  }
30599
  
30600
  return curr;
30601
};
30602
},{}]},{},[1])(1)
30603
});
30604
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hdXRoLmpzIiwibGliL2NsaWVudC5qcyIsImxpYi9oZWxwZXJzLmpzIiwibGliL2h0dHAuanMiLCJsaWIvcmVzb2x2ZXIuanMiLCJsaWIvc2NoZW1hLW1hcmt1cC5qcyIsImxpYi9zcGVjLWNvbnZlcnRlci5qcyIsImxpYi90eXBlcy9tb2RlbC5qcyIsImxpYi90eXBlcy9vcGVyYXRpb24uanMiLCJsaWIvdHlwZXMvb3BlcmF0aW9uR3JvdXAuanMiLCJub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1yZXNvbHZlL2VtcHR5LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2J1ZmZlci9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9idWZmZXIvbm9kZV9tb2R1bGVzL2Jhc2U2NC1qcy9saWIvYjY0LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2J1ZmZlci9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qc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gPSBvcGVyYXRpb25Hcm91cFtvcGVyYXRpb25JZF0uaGVscCA9IF8uYmluZChvcGVyYXRpb25PYmplY3QuaGVscCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvbk9iamVjdCk7XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdLmFzQ3VybCA9IG9wZXJhdGlvbkdyb3VwW29wZXJhdGlvbklkXS5hc0N1cmwgPSBfLmJpbmQob3BlcmF0aW9uT2JqZWN0LmFzQ3VybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRpb25PYmplY3QpO1xuXG4gICAgICAgIG9wZXJhdGlvbkdyb3VwLmFwaXNbb3BlcmF0aW9uSWRdID0gb3BlcmF0aW9uR3JvdXAub3BlcmF0aW9uc1tvcGVyYXRpb25JZF0gPSBvcGVyYXRpb25PYmplY3Q7XG5cbiAgICAgICAgLy8gbGVnYWN5IFVJIGZlYXR1cmVcbiAgICAgICAgdmFyIGFwaSA9IF8uZmluZChzZWxmLmFwaXNBcnJheSwgZnVuY3Rpb24gKGFwaSkge1xuICAgICAgICAgIHJldHVybiBhcGkudGFnID09PSB0YWc7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChhcGkpIHtcbiAgICAgICAgICBhcGkub3BlcmF0aW9uc0FycmF5LnB1c2gob3BlcmF0aW9uT2JqZWN0KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgfSk7XG4gIH0pO1xuXG4gIHRoaXMuaXNCdWlsdCA9IHRydWU7XG5cbiAgaWYgKHRoaXMuc3VjY2Vzcykge1xuICAgIHRoaXMuaXNWYWxpZCA9IHRydWU7XG4gICAgdGhp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UYWJsZTtcblxuICBmb3IoaSA9IDA7IGkgPCBhbGwubGVuZ3RoOyBpKyspIHtcbiAgICB2YXIgYSA9IGFsbFtpXTtcbiAgICBpZihyb290ID09PSBhLnJvb3QpIHtcbiAgICAgIGlmKGEucmVzb2x2ZUFzID09PSAncmVmJykge1xuICAgICAgICAvLyByZXNvbHZlIGFueSBwYXRoIHdhbGtpbmdcbiAgICAgICAgdmFyIGpvaW5lZCA9ICgoYS5yb290IHx8ICcnKSArICcvJyArIGEua2V5KS5zcGxpdCgnLycpO1xuICAgICAgICB2YXIgbm9ybWFsaXplZCA9IFtdO1xuICAgICAgICB2YXIgdXJsID0gJyc7XG4gICAgICAgIHZhciBrO1xuXG4gICAgICAgIGlmKGEua2V5LmluZGV4T2YoJy4uLycpID49IDApIHtcbiAgICAgICAgICBmb3IodmFyIGogPSAwOyBqIDwgam9pbmVkLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICBpZihqb2luZWRbal0gPT09ICcuLicpIHtcbiAgICAgICAgICAgICAgbm9ybWFsaXplZCA9IG5vcm1hbGl6ZWQuc2xpY2UoMCwgbm9ybWFsaXplZC5sZW5ndGgtMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgbm9ybWFsaXplZC5wdXNoKGpvaW5lZFtqXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGZvcihrID0gMDsgayA8IG5vcm1hbGl6ZWQubGVuZ3RoOyBrICsrKSB7XG4gICAgICAgICAgICBpZihrID4gMCkge1xuICAgICAgICAgICAgICB1cmwgKz0gJy8nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdXJsICs9IG5vcm1hbGl6ZWRba107XG4gICAgICAgICAgfVxuICAgICAgICAgIC8vIHdlIG5vdyBoYXZlIHRvIHJlbW90ZSByZXNvbHZlIHRoaXMgYmVjYXVzZSB0aGUgcGF0aCBoYXMgY2hhbmdlZFxuICAgICAgICAgIGEucm9vdCA9IHVybDtcbiAgICAgICAgICB0b1Jlc29sdmUucHVzaChhKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICB2YXIgcGFydHMgPSBhLmtleS5zcGxpdCgnIycpO1xuICAgICAgICAgIGlmKHBhcnRzLmxlbmd0aCA9PT0gMikge1xuICAgICAgICAgICAgaWYocGFydHNbMF0uaW5kZXhPZignaHR0cDovLycpID09PSAwIHx8IHBhcnRzWzBdLmluZGV4T2YoJ2h0dHBzOi8vJykgPT09IDApIHtcbiAgICAgICAgICAgICAgYS5yb290ID0gcGFydHNbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2NhdGlvbiA9IHBhcnRzWzFdLnNwbGl0KCcvJyk7XG4gICAgICAgICAgICB2YXIgcjtcbiAgICAgICAgICAgIHZhciBzID0gc3BlYztcbiAgICAgICAgICAgIGZvcihrID0gMDsgayA8IGxvY2F0aW9uLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIHZhciBwYXJ0ID0gbG9jYXRpb25ba107XG4gICAgICAgICAgICAgIGlmKHBhcnQgIT09ICcnKSB7XG4gICAgICAgICAgICAgICAgcyA9IHNbcGFydF07XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICByID0gcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICByID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYociA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAvLyBtdXN0IHJlc29sdmUgdGhpcyB0b29cbiAgICAgICAgICAgICAgdG9SZXNvbHZlLnB1c2goYSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgIC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c2V0IHJvb3RcbiAgICAgIHAgPSByZWYuc3BsaXQoJy4uLycpO1xuICAgICAgcDIgPSByb290LnNwbGl0KCcvJyk7XG4gICAgICByZWYgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHAubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYocFtpXSA9PT0gJycpIHtcbiAgICAgICAgICBwMiA9IHAyLnNsaWNlKDAsIHAyLmxlbmd0aC0xKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICByZWYgKz0gcFtpXTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcm9vdCA9ICcnO1xuICAgICAgZm9yKGkgPSAwOyBpIDwgcDIubGVuZ3RoIC0gMTsgaSsrKSB7XG4gICAgICAgIGlmKGkgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgIHJvb3QgKz0gcDJbaV07XG4gICAgICB9XG4gICAgICByb290VHJpbW1lZCA9IHRydWU7XG4gICAgfVxuICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgaWYocmVmLmluZGV4T2YoJy8nKSA9PT0gMCkge1xuICAgICAgICBycyA9IHJlZi5zcGxpdCgnIycpO1xuICAgICAgICBwICA9IHJvb3Quc3BsaXQoJy8vJyk7XG4gICAgICAgIHAyID0gcFsxXS5zcGxpdCgnLycpO1xuICAgICAgICByb290ID0gcFswXSArICcvLycgKyBwMlswXSArIHJzWzBdO1xuICAgICAgICBsb2NhdGlvbiA9IHJzWzFdO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIHJzID0gcmVmLnNwbGl0KCcjJyk7XG4gICAgICAgIGlmKHJzWzBdICE9PSAnJykge1xuICAgICAgICAgIHAyID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgICAgIHAyID0gcDIuc2xpY2UoMCwgcDIubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgaWYoIXJvb3RUcmltbWVkKSB7XG4gICAgICAgICAgICByb290ID0gJyc7XG4gICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IHAyLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIGlmKGsgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgICAgICAgIHJvb3QgKz0gcDJba107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIHJvb3QgKz0gJy8nICsgcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIH1cbiAgICAgICAgbG9jYXRpb24gPSByc1sxXTtcbiAgICAgIH1cbiAgICB9XG4gICAgaWYgKHJlZi5pbmRleE9mKCdodHRwJykgPT09IDApIHtcbiAgICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgICByb290ID0gcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIGxvY2F0aW9uID0gcmVmLnNwbGl0KCcjJylbMV07XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgcm9vdCA9IHJlZjtcbiAgICAgICAgbG9jYXRpb24gPSAnJztcbiAgICAgIH1cbiAgICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtvYmo6IHByb3BlcnR5LCByZXNvbHZlQXM6ICdpbmxpbmUnLCByb290OiByb290LCBrZXk6IGtleSwgbG9jYXRpb246IGxvY2F0aW9ufSk7XG4gICAgfSBlbHNlIGlmIChyZWYuaW5kZXhPZignIycpID09PSAwKSB7XG4gICAgICBsb2NhdGlvbiA9IHJlZi5zcGxpdCgnIycpWzFdO1xuICAgICAgcmVzb2x1dGlvblRhYmxlLnB1c2goe29iajogcHJvcGVydHksIHJlc29sdmVBczogJ2lubGluZScsIHJvb3Q6IHJvb3QsIGtleToga2V5LCBsb2NhdGlvbjogbG9jYXRpb259KTtcbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICByZXNvbHV0aW9uVGFibGUucHVzaCh7b2JqOiBwcm9wZXJ0eSwgcmVzb2x2ZUFzOiAna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gICAgICAgIHNvdXJjZSA9IGNvbXBvbmVudFsneC1yZXNvbHZlZC1mcm9tJ11bMF07XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgZm9yKHZhciBwYXJ0IGluIGNvbXBvbmVudCkge1xuICAgICAgICAgICAgaWYoIW91dHB1dC5oYXNPd25Qcm9wZXJ0eShwYXJ0KSkge1xuICAgICAgICAgICAgICBvdXRwdXRbcGFydF0gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KGNvbXBvbmVudFtwYXJ0XSkpO1xuICAgICAgICAgICAgICBpZihwYXJ0ID09PSAncHJvcGVydGllcycpIHtcbiAgICAgICAgICAgICAgICBmb3IobmFtZSBpbiBvdXRwdXRbcGFydF0pIHtcbiAgICAgICAgICAgICAgICAgIG91dHB1dFtwYXJ0XVtuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgaWYocGFydCA9PT0gJ3Byb3BlcnRpZXMnKSB7XG4gICAgICAgICAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb21wb25lbnRbcGFydF07XG4gICAgICAgICAgICAgICAgZm9yKG5hbWUgaW4gcHJvcGVydGllcykge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByb3BlcnRpZXNbbmFtZV0gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KHByb3BlcnRpZXNbbmFtZV0pKTtcbiAgICAgICAgICAgICAgICAgIHZhciByZXNvbHZlZEZyb20gPSBwcm9wZXJ0aWVzW25hbWVdWyd4LXJlc29sdmVkLWZyb20nXTtcbiAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVzb2x2ZWRGcm9tID09PSAndW5kZWZpbmVkJyB8fCByZXNvbHZlZEZyb20gPT09ICdzZWxmJykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlZEZyb20gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBvdXRwdXQucHJvcGVydGllc1tuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSByZXNvbHZlZEZyb207XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2UgaWYocGFydCA9PT0gJ3JlcXVpcmVkJykge1xuICAgICAgICAgICAgICAgIC8vIG1lcmdlICYgZGVkdXAgdGhlIHJlcXVpcmVkIGFycmF5XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBvdXRwdXQucmVxdWlyZWQuY29uY2F0KGNvbXBvbmVudFtwYXJ0XSk7XG4gICAgICAgICAgICAgICAgZm9yKHZhciBrID0gMDsgayA8IGEubGVuZ3RoOyArK2spIHtcbiAgICAgICAgICAgICAgICAgIGZvcih2YXIgaiA9IGsgKyAxOyBqIDwgYS5sZW5ndGg7ICsraikge1xuICAgICAgICAgICAgICAgICAgICBpZihhW2tdID09PSBhW2pdKSB7IGEuc3BsaWNlKGotLSwgMSk7IH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb3V0cHV0LnJlcXVpcmVkID0gYTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBlbHNlIGlmKHBhcnQgPT09ICd4LXJlc29sdmVkLWZyb20nKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0Wyd4LXJlc29sdmVkLWZyb20nXS5wdXNoKHNvdXJjZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gVE9ETzogbmVlZCB0byBtZXJnZSB0aGlzIHByb3BlcnR5XG4gICAgICAgICAgICAgICAgLy8gY29uc29sZS5sb2coJ3doYXQgdG8gZG8gd2l0aCAnICsgcGFydClcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgIC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GlzQXJyYXkgPSBzY2hlbWEudHlwZSA9PT0gJ2FycmF5JztcbiAgICB2YXIgaHRtbCA9IHN0cm9uZ09wZW4gKyBuYW1lICsgJyAnICsgKGlzQXJyYXkgPyAnWycgOiAneycpICsgc3Ryb25nQ2xvc2U7XG5cbiAgICBpZiAobmFtZSkge1xuICAgICAgc2Vlbk1vZGVscy5wdXNoKG5hbWUpO1xuICAgIH1cblxuICAgIGlmIChpc0FycmF5KSB7XG4gICAgICBpZiAoXy5pc0FycmF5KHNjaGVtYS5pdGVtcykpIHtcbiAgICAgICAgaHRtbCArPSAnPGRpdj4nICsgXy5tYXAoc2NoZW1hLml0ZW1zLCBmdW5jdGlvbiAoaXRlbSkge1xuICAgICAgICAgIHZhciB0eXBlID0gaXRlbS50eXBlIHx8ICdvYmplY3QnO1xuXG4gICAgICAgICAgaWYgKF8uaXNVbmRlZmluZWQoaXRlbS4kcmVmKSkge1xuICAgICAgICAgICAgaWYgKF8uaW5kZXhPZihbJ2FycmF5JywgJ29iamVjdCddLCB0eXBlKSA+IC0xKSB7XG4gICAgICAgICAgICAgIGlmICh0eXBlID09PSAnb2JqZWN0JyAmJiBfLmlzVW5kZWZpbmVkKGl0ZW0ucHJvcGVydGllcykpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCc7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFkZFJlZmVyZW5jZShpdGVtKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHByaW1pdGl2ZVRvT3B0aW9uc0hUTUwoaXRlbSwgdHlwZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBhZGRSZWZlcmVuY2UoaXRlbSwgSGVscGVycy5zaW1wbGVSZWYoaXRlbS4kcmVmKSk7XG4gICAgICAgICAgfVxuICAgICAgIC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VzID0gc2NvcGVzO1xuICAgICAgICB9XG4gICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlcykge1xuICAgICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlcy5pbXBsaWNpdCkge1xuICAgICAgICAgICAgdmFyIGltcGxpY2l0ID0gZGVmaW5pdGlvbi5ncmFudFR5cGVzLmltcGxpY2l0O1xuICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmZsb3cgPSAnaW1wbGljaXQnO1xuICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmF1dGhvcml6YXRpb25VcmwgPSBpbXBsaWNpdC5sb2dpbkVuZHBvaW50O1xuICAgICAgICAgICAgaXNWYWxpZCA9IHRydWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIC8qIGpzaGludCBpZ25vcmU6c3RhcnQgKi9cbiAgICAgICAgICBpZihkZWZpbml0aW9uLmdyYW50VHlwZXNbJ2F1dGhvcml6YXRpb25fY29kZSddKSB7XG4gICAgICAgICAgICBpZighc2VjdXJpdHlEZWZpbml0aW9uLmZsb3cpIHtcbiAgICAgICAgICAgICAgLy8gY2Fubm90IHNldCBpZiBmbG93IGlzIGFscmVhZHkgZGVmaW5lZFxuICAgICAgICAgICAgICB2YXIgYXV0aENvZGUgPSBkZWZpbml0aW9uLmdyYW50VHlwZXNbJ2F1dGhvcml6YXRpb25fY29kZSddO1xuICAgICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uZmxvdyA9ICdhY2Nlc3NDb2RlJztcbiAgICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmF1dGhvcml6YXRpb25VcmwgPSBhdXRoQ29kZS50b2tlblJlcXVlc3RFbmRwb2ludC51cmw7XG4gICAgICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi50b2tlblVybCA9IGF1dGhDb2RlLnRva2VuRW5kcG9pbnQudXJsO1xuICAgICAgICAgICAgICBpc1ZhbGlkID0gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgLyoganNoaW50IGlnbm9yZTplbmQgKi9cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgaWYoaXNWYWxpZCkge1xuICAgICAgICBzd2FnZ2VyLnNlY3VyaXR5RGVmaW5pdGlvbnMgPSBzd2FnZ2VyLnNlY3VyaXR5RGVmaW5pdGlvbnMgfHwge307XG4gICAgICAgIHN3YWdnZXIuc2VjdXJpdHlEZWZpbml0aW9uc1tuYW1lXSA9IHNlY3VyaXR5RGVmaW5pdGlvbjtcbiAgICAgIH1cbiAgICB9XG4gIH1cbn07XG5cblN3YWdnZXJTcGVjQ29udmVydGVyLnByb3RvdHlwZS5hcGlJbmZvID0gZnVuY3Rpb24ob2JqLCBzd2FnZ2VyKSB7XG4gIC8vIGluZm8gc2VjdGlvblxuICBpZihvYmouaW5mbykge1xuICAgIHZhciBpbmZvID0gb2JqLmluZm87XG4gICAgc3dhZ2dlci5pbmZvID0ge307XG5cbiAgICBpZihpbmZvLmNvbnRhY3QpIHtcbiAgICAgIHN3YWdnZXIuaW5mby5jb250YWN0ID0ge307XG4gICAgICBzd2FnZ2VyLmluZm8uY29udGFjdC5lbWFpbCA9IGluZm8uY29udGFjdDtcbiAgICB9XG4gICAgaWYoaW5mby5kZXNjcmlwdGlvbikge1xuICAgICAgc3dhZ2dlci5pbmZvLmRlc2NyaXB0aW9uID0gaW5mby5kZXNjcmlwdGlvbjtcbiAgICB9XG4gICAgaWYoaW5mby50aXRsZSkge1xuICAgICAgc3dhZ2dlci5pbmZvLnRpdGxlID0gaW5mby50aXRsZTtcbiAgICB9XG4gICAgaWYoaW5mby50ZXJtc09mU2VydmljZVVybCkge1xuICAgICAgc3dhZ2dlci5pbmZvLnRlcm1zT2ZTZXJ2aWNlID0gaW5mby50ZXJtc09mU2VydmljZVVybDtcbiAgICB9XG4gICAgaWYoaW5mby5saWNlbnNlIHx8IGluZm8ubGljZW5zZVVybCkge1xuICAg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ERDMDApIHtcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG4gICAgICAgICAgY29udGludWVcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyB2YWxpZCBzdXJyb2dhdGUgcGFpclxuICAgICAgICAgIGNvZGVQb2ludCA9IGxlYWRTdXJyb2dhdGUgLSAweEQ4MDAgPDwgMTAgfCBjb2RlUG9pbnQgLSAweERDMDAgfCAweDEwMDAwXG4gICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IG51bGxcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gbm8gbGVhZCB5ZXRcblxuICAgICAgICBpZiAoY29kZVBvaW50ID4gMHhEQkZGKSB7XG4gICAgICAgICAgLy8gdW5leHBlY3RlZCB0cmFpbFxuICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkgYnl0ZXMucHVzaCgweEVGLCAweEJGLCAweEJEKVxuICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgIC8vIHVucGFpcmVkIGxlYWRcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIHZhbGlkIGxlYWRcbiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG4gICAgICAgICAgY29udGludWVcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkge1xuICAgICAgLy8gdmFsaWQgYm1wIGNoYXIsIGJ1dCBsYXN0IGNoYXIgd2FzIGEgb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Db29raWVBY2Nlc3NJbmZvKGRvbWFpbiwgcGF0aCwgc2VjdXJlLCBzY3JpcHQpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZUFjY2Vzc0luZm8gPSBDb29raWVBY2Nlc3NJbmZvO1xuXG4gICAgZnVuY3Rpb24gQ29va2llKGNvb2tpZXN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBpZiAoY29va2llc3RyIGluc3RhbmNlb2YgQ29va2llKSB7XG4gICAgICAgICAgICByZXR1cm4gY29va2llc3RyO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgQ29va2llKSB7XG4gICAgICAgICAgICB0aGlzLm5hbWUgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLmV4cGlyYXRpb25fZGF0ZSA9IEluZmluaXR5O1xuICAgICAgICAgICAgdGhpcy5wYXRoID0gU3RyaW5nKHJlcXVlc3RfcGF0aCB8fCBcIi9cIik7XG4gICAgICAgICAgICB0aGlzLmV4cGxpY2l0X3BhdGggPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuZG9tYWluID0gcmVxdWVzdF9kb21haW4gfHwgbnVsbDtcbiAgICAgICAgICAgIHRoaXMuZXhwbGljaXRfZG9tYWluID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLnNlY3VyZSA9IGZhbHNlOyAvL2hvdyB0byBkZWZpbmUgZGVmYXVsdD9cbiAgICAgICAgICAgIHRoaXMubm9zY3JpcHQgPSBmYWxzZTsgLy9odHRwb25seVxuICAgICAgICAgICAgaWYgKGNvb2tpZXN0cikge1xuICAgICAgICAgICAgICAgIHRoaXMucGFyc2UoY29va2llc3RyLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgQ29va2llKGNvb2tpZXN0cik7XG4gICAgfVxuICAgIGV4cG9ydHMuQ29va2llID0gQ29va2llO1xuXG4gICAgQ29va2llLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkge1xuICAgICAgICB2YXIgc3RyID0gW3RoaXMubmFtZSArIFwiPVwiICsgdGhpcy52YWx1ZV07XG4gICAgICAgIGlmICh0aGlzLmV4cGlyYXRpb25fZGF0ZSAhPT0gSW5maW5pdHkpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwiZXhwaXJlcz1cIiArIChuZXcgRGF0ZSh0aGlzLmV4cGlyYXRpb25fZGF0ZSkpLnRvR01UU3RyaW5nKCkpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLmRvbWFpbikge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJkb21haW49XCIgKyB0aGlzLmRvbWFpbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMucGF0aCkge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJwYXRoPVwiICsgdGhpcy5wYXRoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5zZWN1cmUpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwic2VjdXJlXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm5vc2NyaXB0KSB7XG4gICAgICAgICAgICBzdHIucHVzaChcImh0dHBvbmx5XCIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzdHIuam9pbihcIjsgXCIpO1xuICAgIH07XG5cbiAgICBDb29raWUucHJvdG90eXBlLnRvVmFsdWVTdHJpbmcgPSBmdW5jdGlvbiB0b1ZhbHVlU3RyaW5nKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5uYW1lICsgXCI9XCIgKyB0aGlzLnZhbHVlO1xuICAgIH07XG5cbiAgICB2YXIgY29va2llX3N0cl9zcGxpdHRlciA9IC9bOl0oPz1cXHMqW2EtekEtWjAtOV9cXC1dK1xccypbPV0pL2c7XG4gICAgQ29va2llLnByb3RvdHlwZS5wYXJzZSA9IGZ1bmN0aW9uIHBhcnNlKHN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBpZiAodGhpcyBpbnN0YW5jZW9mIENvb2tpZSkge1xuICAgICAgICAgICAgdmFyIHBhcnRzID0gc3RyLnNwbGl0KFwiO1wiKS5maWx0ZXIoZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXZhbHVlO1xuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIHBhaXIgPSBwYXJ0c1swXS5tYXRjaCgvKFtePV0rKT0oW1xcc1xcU10qKS8pLFxuICAgICAgICAgICAgICAgIGtleSA9IHBhaXJbMV0sXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYWlyWzJdLFxuICAgICAgICAgICAgICAgIGk7XG4gICAgICAgICAgICB0aGlzLm5hbWUgPSBrZXk7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG5cbiAgICAgICAgICAgIGZvciAoaSA9IDE7IGkgPCBwYXJ0cy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgIHBhaXIgPSBwYXJ0c1tpXS5tYXRjaCgvKFtePV0rKSg/Oj0oW1xcc1xcU10qKSk/Lyk7XG4gICAgICAgICAgICAgICAga2V5ID0gcGFpclsxXS50cmltKCkudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhaXJbMl07XG4gICAgICAgICAgICAgICAgc3dpdGNoIChrZXkpIHtcbiAgICAgICAgICAgICAgICBjYXNlIFwiaHR0cG9ubHlcIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ub3NjcmlwdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJleHBpcmVzXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZXhwaXJhdGlvbl9kYXRlID0gdmFsdWUgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bWJlcihEYXRlLnBhcnNlKHZhbHVlKSkgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEluZmluaXR5O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwicGF0aFwiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnBhdGggPSB2YWx1ZSA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUudHJpbSgpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlwiO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmV4cGxpY2l0X3BhdGggPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwiZG9tYWluXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZG9tYWluID0gdmFsdWUgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnRyaW0oKSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJcIjtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5leHBsaWNpdF9kb21haW4gPSAhIXRoaXMuZG9tYWluO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwic2VjdXJlXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VjdXJlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIXRoaXMuZXhwbGljaXRfcGF0aCkge1xuICAgICAgICAgICAgICAgdGhpcy5wYXRoID0gcmVxdWVzdF9wYXRoIHx8IFwiL1wiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCF0aGlzLmV4cGxpY2l0X2RvbWFpbikge1xuICAgICAgICAgICAgICAgdGhpcy5kb21haW4gPSByZXF1ZXN0X2RvbWFpbjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBDb29raWUoKS5wYXJzZShzdHIsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgIH07XG5cbiAgICBDb29raWUucHJvdG90eXBlLm1hdGNoZXMgPSBmdW5jdGlvbiBtYXRjaGVzKGFjY2Vzc19pbmZvKSB7XG4gICAgICAgIGlmICh0aGlzLm5vc2NyaXB0ICYmIGFjY2Vzc19pbmZvLnNjcmlwdCB8fFxuICAgICAgICAgICAgICAgIHRoaXMuc2VjdXJlICYmICFhY2Nlc3NfaW5mby5zZWN1cmUgfHxcbiAgICAgICAgICAgICAgICAhdGhpcy5jb2xsaWRlc1dpdGgoYWNjZXNzX2luZm8pKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfTtcblxuICAgIENvb2tpZS5wcm90b3R5cGUuY29sbGlkZXNXaXRoID0gZnVuY3Rpb24gY29sbGlkZXNXaXRoKGFjY2Vzc19pbmZvKSB7XG4gICAgICAgIGlmICgodGhpcy5wYXRoICYmICFhY2Nlc3NfaW5mby5wYXRoKSB8fCAodGhpcy5kb21haW4gJiYgIWFjY2Vzc19pbmZvLmRvbWFpbikpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wYXRoICYmIGFjY2Vzc19pbmZvLnBhdGguaW5kZXhPZih0aGlzLnBhdGgpICE9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF0aGlzLmV4cGxpY2l0X3BhdGgpIHtcbiAgICAgICAgICAgaWYgKHRoaXMucGF0aCAhPT0gYWNjZXNzX2luZm8ucGF0aCkge1xuICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGFjY2Vzc19kb21haW4gPSBhY2Nlc3NfaW5mby5kb21haW4gJiYgYWNjZXNzX2luZm8uZG9tYWluLnJlcGxhY2UoL15bXFwuXS8sJycpO1xuICAgICAgICB2YXIgY29va2llX2RvbWFpbiA9IHRoaXMuZG9tYWluICYmIHRoaXMuZG9tYWluLnJlcGxhY2UoL15bXFwuXS8sJycpO1xuICAgICAgICBpZiAoY29va2llX2RvbWFpbiA9PT0gYWNjZXNzX2RvbWFpbikge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvb2tpZV9kb21haW4pIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5leHBsaWNpdF9kb21haW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7IC8vIHdlIGFscmVhZHkgY2hlY2tlZCBpZiB0aGUgZG9tYWlucyB3ZXJlIGV4YWN0bHkgdGhlIHNhbWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB3aWxkY2FyZCA9IGFjY2Vzc19kb21haW4uaW5kZXhPZihjb29raWVfZG9tYWluKTtcbiAgICAgICAgICAgIGlmICh3aWxkY2FyZCA9PT0gLTEgfHwgd2lsZGNhcmQgIT09IGFjY2Vzc19kb21haW4ubGVuZ3RoIC0gY29va2llX2RvbWFpbi5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9O1xuXG4gICAgZnVuY3Rpb24gQ29va2llSmFyKCkge1xuICAgICAgICB2YXIgY29va2llcywgY29va2llc19saXN0LCBjb2xsaWRhYmxlX2Nvb2tpZTtcbiAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBDb29raWVKYXIpIHtcbiAgICAgICAgICAgIGNvb2tpZXMgPSBPYmplY3QuY3JlYXRlKG51bGwpOyAvL25hbWU6IFtDb29raWVdXG5cbiAgICAgICAgICAgIHRoaXMuc2V0Q29va2llID0gZnVuY3Rpb24gc2V0Q29va2llKGNvb2tpZSwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICAgICAgICAgIHZhciByZW1vdmUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llID0gbmV3IENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgICAgICAgICAgICAgIC8vRGVsZXRlIHRoZSBjb29raWUgaWYgdGhlIHNldCBpcyBwYXN0IHRoZSBjdXJyZW50IHRpbWVcbiAgICAgICAgICAgICAgICByZW1vdmUgPSBjb29raWUuZXhwaXJhdGlvbl9kYXRlIDw9IERhdGUubm93KCk7XG4gICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNbY29va2llLm5hbWVdICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjb29raWVzX2xpc3QubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbGxpZGFibGVfY29va2llID0gY29va2llc19saXN0W2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbGxpZGFibGVfY29va2llLmNvbGxpZGVzV2l0aChjb29raWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVzX2xpc3Quc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llc19saXN0Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGNvb2tpZXNbY29va2llLm5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0W2ldID0gY29va2llO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdC5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChyZW1vdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb29raWVzW2Nvb2tpZS5uYW1lXSA9IFtjb29raWVdO1xuICAgICAgICAgICAgICAgIHJldHVybiBjb29raWVzW2Nvb2tpZS5uYW1lXTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvL3JldHVybnMgYSBjb29raWVcbiAgICAgICAgICAgIHRoaXMuZ2V0Q29va2llID0gZnVuY3Rpb24gZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBjb29raWUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWVfbmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKCFjb29raWVzX2xpc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llc19saXN0Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IGNvb2tpZXNfbGlzdFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZS5leHBpcmF0aW9uX2RhdGUgPD0gRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNfbGlzdC5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llLm1hdGNoZXMoYWNjZXNzX2luZm8pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29va2llO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vcmV0dXJucyBhIGxpc3Qgb2YgY29va2llc1xuICAgICAgICAgICAgdGhpcy5nZXRDb29raWVzID0gZnVuY3Rpb24gZ2V0Q29va2llcyhhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBtYXRjaGVzID0gW10sIGNvb2tpZV9uYW1lLCBjb29raWU7XG4gICAgICAgICAgICAgICAgZm9yIChjb29raWVfbmFtZSBpbiBjb29raWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IHRoaXMuZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbyk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXMucHVzaChjb29raWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG1hdGNoZXMudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXMuam9pbihcIjpcIik7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBtYXRjaGVzLnRvVmFsdWVTdHJpbmcgPSBmdW5jdGlvbiB0b1ZhbHVlU3RyaW5nKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hlcy5tYXAoZnVuY3Rpb24gKGMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnRvVmFsdWVTdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignOycpO1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXM7XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IENvb2tpZUphcigpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZUphciA9IENvb2tpZUphcjtcblxuICAgIC8vcmV0dXJucyBsaXN0IG9mIGNvb2tpZXMgdGhhdCB3ZXJlIHNldCBjb3JyZWN0bHkuIENvb2tpZXMgdGhhdCBhcmUgZXhwaXJlZCBhbmQgcmVtb3ZlZCBhcmUgbm90IHJldHVybmVkLlxuICAgIENvb2tpZUphci5wcm90b3R5cGUuc2V0Q29va2llcyA9IGZ1bmN0aW9uIHNldENvb2tpZXMoY29va2llcywgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBjb29raWVzID0gQXJyYXkuaXNBcnJheShjb29raWVzKSA/XG4gICAgICAgICAgICAgICAgY29va2llcyA6XG4gICAgICAgICAgICAgICAgY29va2llcy5zcGxpdChjb29raWVfc3RyX3NwbGl0dGVyKTtcbiAgICAgICAgdmFyIHN1Y2Nlc3NmdWwgPSBbXSxcbiAgICAgICAgICAgIGksXG4gICAgICAgICAgICBjb29raWU7XG4gICAgICAgIGNvb2tpZXMgPSBjb29raWVzLm1hcChDb29raWUpO1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llcy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgY29va2llID0gY29va2llc1tpXTtcbiAgICAgICAgICAgIGlmICh0aGlzLnNldENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpKSB7XG4gICAgICAgICAgICAgICAgc3VjY2Vzc2Z1bC5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHN1Y2Nlc3NmdWw7XG4gICAgfTtcbn0oKSk7XG4iLCIvKiFcbiAqIGpRdWVyeSBKYXZhU2NyaXB0IExpYnJhcnkgdjIuMS40XG4gKiBodHRwOi8vanF1ZXJ5LmNvbS9cbiAqXG4gKiBJbmNsdWRlcyBTaXp6bGUuanNcbiAqIGh0dHA6Ly9zaXp6bGVqcy5jb20vXG4gKlxuICogQ29weXJpZ2h0IDIwMDUsIDIwMTQgalF1ZXJ5IEZvdW5kYXRpb24sIEluYy4gYW5kIG90aGVyIGNvbnRyaWJ1dG9yc1xuICogUmVsZWFzZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlXG4gKiBodHRwOi8vanF1ZXJ5Lm9yZy9saWNlbnNlXG4gKlxuICogRGF0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V4dGVuZDtcbiIsIid1c2Ugc3RyaWN0JztcblxuLyplc2xpbnQtZGlzYWJsZSBuby11c2UtYmVmb3JlLWRlZmluZSovXG5cbnZhciBjb21tb24gICAgICAgICAgICAgID0gcmVxdWlyZSgnLi9jb21tb24nKTtcbnZhciBZQU1MRXhjZXB0aW9uICAgICAgID0gcmVxdWlyZSgnLi9leGNlcHRpb24nKTtcbnZhciBERUZBVUxUX0ZVTExfU0NIRU1BID0gcmVxdWlyZSgnLi9zY2hlbWEvZGVmYXVsdF9mdWxsJyk7XG52YXIgREVGQVVMVF9TQUZFX1NDSEVNQSA9IHJlcXVpcmUoJy4vc2NoZW1hL2RlZmF1bHRfc2FmZScpO1xuXG52YXIgX3RvU3RyaW5nICAgICAgID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcbnZhciBfaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG52YXIgQ0hBUl9UQUIgICAgICAgICAgICAgICAgICA9IDB4MDk7IC8qIFRhYiAqL1xudmFyIENIQVJfTElORV9GRUVEICAgICAgICAgICAgPSAweDBBOyAvKiBMRiAqL1xudmFyIENIQVJfQ0FSUklBR0VfUkVUVVJOICAgICAgPSAweDBEOyAvKiBDUiAqL1xudmFyIENIQVJfU1BBQ0UgICAgICAgICAgICAgICAgPSAweDIwOyAvKiBTcGFjZSAqL1xudmFyIENIQVJfRVhDTEFNQVRJT04gICAgICAgICAgPSAweDIxOyAvKiAhICovXG52YXIgQ0hBUl9ET1VCTEVfUVVPVEUgICAgICAgICA9IDB4MjI7IC8qIFwiICovXG52YXIgQ0hBUl9TSEFSUCAgICAgICAgICAgICAgICA9IDB4MjM7IC8qICMgKi9cbnZhciBDSEFSX1BFUkNFTlQgICAgICAgICAgICAgID0gMHgyNTsgLyogJSAqL1xudmFyIENIQVJfQU1QRVJTQU5EICAgICAgICAgICAgPSAweDI2OyAvKiAmICovXG52YXIgQ0hBUl9TSU5HTEVf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0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX0NBUlJJQUdFX1JFVFVSTiAgICAgICE9PSBjaGFyYWN0ZXIgJiZcbiAgICAgICAgIENIQVJfQ09NTUEgICAgICAgICAgICAgICAgIT09IGNoYXJhY3RlciAmJlxuICAgICAgICAgQ0hBUl9MRUZUX1NRVUFSRV9CUkFDS0VUICAhPT0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX1JJR0hUX1NRVUFSRV9CUkFDS0VUICE9PSBjaGFyYWN0ZXIgJiZcbiAgICAgICAgIENIQVJfTEVGVF9DVVJMWV9CUkFDS0VUICAgIT09IGNoYXJhY3RlciAmJlxuICAgICAgICAgQ0hBUl9SSUdIVF9DVVJMWV9CUkFDS0VUICAhPT0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX1NIQVJQICAgICAgICAgICAgICAgICE9PSBjaGFyYWN0ZXIgJiZcbiAgICAgICAgIENIQVJfQU1QRVJTQU5EICAgICAgICAgICAgIT09IGNoYXJhY3RlciAmJlxuICAgICAgICAgQ0hBUl9BU1RFUklTSyAgICAgICAgICAgICAhPT0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX0VYQ0xBTUFUSU9OICAgICAgICAgICE9PSBjaGFyYWN0ZXIgJiZcbiAgICAgICAgIENIQVJfVkVSVElDQUxfTElORSAgICAgICAgIT09IGNoYXJhY3RlciAmJlxuICAgICAgICAgQ0hBUl9HUkVBVEVSX1RIQU4gICAgICAgICAhPT0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX1NJTkdMRV9RVU9URSAgICAgICAgICE9PSBjaGFyYWN0ZXIgJiZcbiAgICAgICAgIENIQVJfRE9VQkxFX1FVT1RFICAgICAgICAgIT09IGNoYXJhY3RlciAmJlxuICAgICAgICAgQ0hBUl9QRVJDRU5UICAgICAgICAgICAgICAhPT0gY2hhcmFjdGVyICYmXG4gICAgICAgICBDSEFSX0NPTE9OICAgICAgICAgICAgICAgICE9PSB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MDtcbiAgfVxuXG4gIHJldHVybiAtMTtcbn1cblxuZnVuY3Rpb24gZXNjYXBlZEhleExlbihjKSB7XG4gIGlmIChjID09PSAweDc4LyogeCAqLykgeyByZXR1cm4gMjsgfVxuICBpZiAoYyA9PT0gMHg3NS8qIHUgKi8pIHsgcmV0dXJuIDQ7IH1cbiAgaWYgKGMgPT09IDB4NTUvKiBVICovKSB7IHJldHVybiA4OyB9XG4gIHJldHVybiAwO1xufVxuXG5mdW5jdGlvbiBmcm9tRGVjaW1hbENvZGUoYykge1xuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIHJldHVybiAtMTtcbn1cblxuZnVuY3Rpb24gc2ltcGxlRXNjYXBlU2VxdWVuY2UoYykge1xuICByZXR1cm4gKGMgPT09IDB4MzAvKiAwICovKSA/ICdcXHgwMCcgOlxuICAgICAgICAoYyA9PT0gMHg2MS8qIGEgKi8pID8gJ1xceDA3JyA6XG4gICAgICAgIChjID09PSAweDYyLyogYiAqLykgPyAnXFx4MDgnIDpcbiAgICAgICAgKGMgPT09IDB4NzQvKiB0ICovKSA/ICdcXHgwOScgOlxuICAgICAgICAoYyA9PT0gMHgwOS8qIFRhYiAqLykgPyAnXFx4MDknIDpcbiAgICAgICAgKGMgPT09IDB4NkUvKiBuICovKSA/ICdcXHgwQScgOlxuICAgICAgICAoYyA9PT0gMHg3Ni8qIHYgKi8pID8gJ1xceDBCJyA6XG4gICAgICAgIChjID09PSAweDY2LyogZiAqLykgPyAnXFx4MEMnIDpcbiAgICAgICAgKGMgPT09IDB4NzIvKiByICovKSA/ICdcXHgwRCcgOlxuICAgICAgICAoYyA9PT0gMHg2NS8qIGUgKi8pID8gJ1xceDFCJyA6XG4gICAgICAgIChjID09PSAweDIwLyogU3BhY2UgKi8pID8gJyAnIDpcbiAgICAgICAgKGMgPT09IDB4MjIvKiBcIiAqLykgP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gMHg3Qy8qIHwgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgzRS8qID4gKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyNy8qICcgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyMi8qIFwiICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4MjUvKiAlICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NDAvKiBAICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NjAvKiBgICovICAgICAgICAgICA9PT0gY2gpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBpZiAoMHgzRi8qID8gKi8gPT09IGNoIHx8IDB4MkQvKiAtICovID09PSBjaCkge1xuICAgIGZvbGxvd2luZyA9IHN0YXRlLmlucHV0LmNoYXJDb2RlQXQoc3RhdGUucG9zaXRpb24gKyAxKTtcblxuICAgIGlmIChpc19XU19PUl9FT0woZm9sbG93aW5nKSB8fFxuICAgICAgICB3aXRoaW5GbG93Q29sbGVjdGlvbiAmJiBpc19GTE9XX0lORElDQVRPUihmb2xsb3dpbmcpKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgc3RhdGUua2luZCA9ICdzY2FsYXInO1xuICBzdGF0ZS5yZXN1bHQgPSAnJztcbiAgY2FwdHVyZVN0YXJ0ID0gY2FwdHVyZUVuZCA9IHN0YXRlLnBvc2l0aW9uO1xuICBoYXNQZW5kaW5nQ29udGVudCA9IGZhbHNlO1xuXG4gIHdoaWxlICgwICE9PSBjaCkge1xuICAgIGlmICgweDNBLyogOiAqLyA9PT0gY2gpIHtcbiAgICAgIGZvbGxvd2luZyA9IHN0YXRlLmlucHV0LmNoYXJDb2RlQXQoc3RhdGUucG9zaXRpb24gKyAxKTtcblxuICAgICAgaWYgKGlzX1dTX09SX0VPTChmb2xsb3dpbmcpIHx8XG4gICAgICAgICAgd2l0aGluRmxvd0NvbGx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AnbWFwcGluZycsXG4gIHJlc29sdmU6IHJlc29sdmVZYW1sU2V0LFxuICBjb25zdHJ1Y3Q6IGNvbnN0cnVjdFlhbWxTZXRcbn0pO1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgVHlwZSA9IHJlcXVpcmUoJy4uL3R5cGUnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBuZXcgVHlwZSgndGFnOnlhbWwub3JnLDIwMDI6c3RyJywge1xuICBraW5kOiAnc2NhbGFyJyxcbiAgY29uc3RydWN0OiBmdW5jdGlvbiAoZGF0YSkgeyByZXR1cm4gbnVsbCAhPT0gZGF0YSA/IGRhdGEgOiAnJzsgfVxufSk7XG4iLCIndXNlIHN0cmljdCc7XG5cbnZhciBUeXBlID0gcmVxdWlyZSgnLi4vdHlwZScpO1xuXG52YXIgWUFNTF9USU1FU1RBTVBfUkVHRVhQID0gbmV3IFJlZ0V4cChcbiAgJ14oWzAtOV1bMC05XVswLTldWzAtOV0pJyAgICAgICAgICArIC8vIFsxXSB5ZWFyXG4gICctKFswLTldWzAtOV0/KScgICAgICAgICAgICAgICAgICAgKyAvLyBbMl0gbW9udGhcbiAgJy0oWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICArIC8vIFszXSBkYXlcbiAgJyg/Oig/OltUdF18WyBcXFxcdF0rKScgICAgICAgICAgICAgICsgLy8gLi4uXG4gICcoWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICAgKyAvLyBbNF0gaG91clxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzVdIG1pbnV0ZVxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzZdIHNlY29uZFxuICAnKD86XFxcXC4oWzAtOV0qKSk/JyAgICAgICAgICAgICAgICAgKyAvLyBbN10gZnJhY3Rpb25cbiAgJyg/OlsgXFxcXHRdKihafChbLStdKShbMC05XVswLTldPyknICsgLy8gWzhdIHR6IFs5XSB0el9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uTmFtZVtUb2tlbi5UZW1wbGF0ZV0gPSAnVGVtcGxhdGUnO1xuXG4gICAgLy8gQSBmdW5jdGlvbiBmb2xsb3dpbmcgb25lIG9mIHRob3NlIHRva2VucyBpcyBhbiBleHByZXNzaW9uLlxuICAgIEZuRXhwclRva2VucyA9IFsnKCcsICd7JywgJ1snLCAnaW4nLCAndHlwZW9mJywgJ2luc3RhbmNlb2YnLCAnbmV3JyxcbiAgICAgICAgICAgICAgICAgICAgJ3JldHVybicsICdjYXNlJywgJ2RlbGV0ZScsICd0aHJvdycsICd2b2lkJyxcbiAgICAgICAgICAgICAgICAgICAgLy8gYXNzaWdubWVudCBvcGVyYXRvcnNcbiAgICAgICAgICAgICAgICAgICAgJz0nLCAnKz0nLCAnLT0nLCAnKj0nLCAnLz0nLCAnJT0nLCAnPDw9JywgJz4+PScsICc+Pj49JyxcbiAgICAgICAgICAgICAgICAgICAgJyY9JywgJ3w9JywgJ149JywgJywnLFxuICAgICAgICAgICAgICAgICAgICAvLyBiaW5hcnkvdW5hcnkgb3BlcmF0b3JzXG4gICAgICAgICAgICAgICAgICAgICcrJywgJy0nLCAnKicsICcvJywgJyUnLCAnKysnLCAnLS0nLCAnPDwnLCAnPj4nLCAnPj4+JywgJyYnLFxuICAgICAgICAgICAgICAgICAgICAnfCcsICdeJywgJyEnLCAnficsICcmJicsICd8fCcsICc/JywgJzonLCAnPT09JywgJz09JywgJz49JyxcbiAgICAgICAgICAgICAgICAgICAgJzw9JywgJzwnLCAnPicsICchPScsICchPT0nXTtcblxuICAgIFN5bnRheCA9IHtcbiAgICAgICAgQXNzaWdubWVudEV4cHJlc3Npb246ICdBc3NpZ25tZW50RXhwcmVzc2lvbicsXG4gICAgICAgIEFzc2lnbm1lbnRQYXR0ZXJuOiAnQXNzaWdubWVudFBhdHRlcm4nLFxuICAgICAgICBBcnJheUV4cHJlc3Npb246ICdBcnJheUV4cHJlc3Npb24nLFxuICAgICAgICBBcnJheVBhdHRlcm46ICdBcnJheVB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6ZWQgYXMgS2V5d29yZCBpbiBWOC5cbiAgICAgICAgLy8gJ3lpZWxkJyBhbmQgJ2xldCcgYXJlIGZvciBjb21wYXRpYmlsaXR5IHdpdGggU3BpZGVyTW9ua2V5IGFuZCBFUy5uZXh0LlxuICAgICAgICAvLyBTb21lIG90aGVycyBhcmUgZnJvbSBmdXR1cmUgcmVzZXJ2ZWQgd29yZHMuXG5cbiAgICAgICAgc3dpdGNoIChpZC5sZW5ndGgpIHtcbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ2lmJykgfHwgKGlkID09PSAnaW4nKSB8fCAoaWQgPT09ICdkbycpO1xuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAndmFyJykgfHwgKGlkID09PSAnZm9yJykgfHwgKGlkID09PSAnbmV3JykgfHxcbiAgICAgICAgICAgICAgICAoaWQgPT09ICd0cnknKSB8fCAoaWQgPT09ICdsZXQnKTtcbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ3RoaXMnKSB8fCAoaWQgPT09ICdlbHNlJykgfHwgKGlkID09PSAnY2FzZScpIHx8XG4gICAgICAgICAgICAgICAgKGlkID09PSAndm9pZCcpIHx8IChpZCA9PT0gJ3dpdGgnKSB8fCAoaWQgPT09ICdlbnVtJyk7XG4gICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIHJldHVybiAoaWQgPT09ICd3aGlsZScpIHx8IChpZCA9PT0gJ2JyZWFrJykgfHwgKGlkID09PSAnY2F0Y2gnKSB8fFxuICAgICAgICAgICAgICAgIChpZCA9PT0gJ3Rocm93JykgfHwgKGlkID09PSAnY29uc3QnKSB8fCAoaWQgPT09ICd5aWVsZCcpIHx8XG4gICAgICAgICAgICAgICAgKGlkID09PSAnY2xhc3MnKSB8fCAoaWQgPT09ICdzdXBlcicpO1xuICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAncmV0dXJuJykgfHwgKGlkID09PSAndHlwZW9mJykgfHwgKGlkID09PSAnZGVsZXRlJykgfHxcbiAgICAgICAgICAgICAgICAoaWQgPT09ICdzd2l0Y2gnKSB8fCAoaWQgPT09ICdleHBvcnQnKSB8fCAoaWQgPT09ICdpbXBvcnQnKTtcbiAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ2RlZmF1bHQnKSB8fCAoaWQgPT09ICdmaW5hbGx5JykgfHwgKGlkID09PSAnZXh0ZW5kcycpO1xuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAnZnVuY3Rpb24nKSB8fCAoaWQgPT09ICdjb250aW51ZScpIHx8IChpZCA9PT0gJ2RlYnVnZ2VyJyk7XG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAnaW5zdGFuY2VvZicpO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gNy40IENvbW1lbnRzXG5cbiAgICBmdW5jdGlvbiBhZGRDb21tZW50KHR5cGUsIHZhbHVlLCBzdGFydCwgZW5kLCBsb2MpIHtcbiAgICAgICAgdmFyIGNvbW1lbnQ7XG5cbiAgICAgICAgYXNzZXJ0KHR5cGVvZiBzdGFydCA9PT0gJ251bWJlcicsICdDb21tZW50IG11c3QgaGF2ZSB2YWxpZCBwb3NpdGlvbicpO1xuXG4gICAgICAgIHN0YXRlLmxhc3RDb21tZW50U3RhcnQgPSBzdGFydDtcblxuICAgICAgICBjb21tZW50ID0ge1xuICAgICAgICAgICAgdHlwZTogdHlwZSxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZVxuICAgICAgICB9O1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIGNvbW1lbnQucmFuZ2UgPSBbc3RhcnQsIGVuZF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgY29tbWVudC5sb2MgPSBsb2M7XG4gICAgICAgIH1cbiAgICAgICAgZXh0cmEuY29tbWVudHMucHVzaChjb21tZW50KTtcbiAgICAgICAgaWYgKGV4dHJhLmF0dGFjaENvbW1lbnQpIHtcbiAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICAgICAgZXh0cmEudHJhaWxpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2tpcFNpbmdsZUxpbmVDb21tZW50KG9mZnNldCkge1xuICAgICAgICB2YXIgc3RhcnQsIGxvYywgY2gsIGNvbW1lbnQ7XG5cbiAgICAgICAgc3RhcnQgPSBpbmRleCAtIG9mZnNldDtcbiAgICAgICAgbG9jID0ge1xuICAgICAgICAgICAgc3RhcnQ6IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnQgLSBvZmZzZXRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoKSkge1xuICAgICAgICAgICAgICAgIGhhc0xpbmVUZXJtaW5hdG9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgY29tbWVudCA9IHNvdXJjZS5zbGljZShzdGFydCArIG9mZnNldCwgaW5kZXggLSAxKTtcbiAgICAgICAgICAgICAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0IC0gMVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBhZGRDb21tZW50KCdMaW5lJywgY29tbWVudCwgc3RhcnQsIGluZGV4IC0gMSwgbG9jKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAxMyAmJiBzb3VyY2UuY2hhckNvZGVBdChpbmRleCkgPT09IDEwKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICBsaW5lU3RhcnQgPSBpbmRleDtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgIGNvbW1lbnQgPSBzb3VyY2Uuc2xpY2Uoc3RhcnQgKyBvZmZzZXQsIGluZGV4KTtcbiAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgYWRkQ29tbWVudCgnTGluZScsIGNvbW1lbnQsIHN0YXJ0LCBpbmRleCwgbG9jKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNraXBNdWx0aUxpbmVDb21tZW50KCkge1xuICAgICAgICB2YXIgc3RhcnQsIGxvYywgY2gsIGNvbW1lbnQ7XG5cbiAgICAgICAgaWYgKGV4dHJhLmNvbW1lbnRzKSB7XG4gICAgICAgICAgICBzdGFydCA9IGluZGV4IC0gMjtcbiAgICAgICAgICAgIGxvYyA9IHtcbiAgICAgICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0IC0gMlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuICAgICAgICAgICAgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2gpKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAweDBEICYmIHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkgPT09IDB4MEEpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIGxpbmVTdGFydCA9IGluZGV4O1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgyQSkge1xuICAgICAgICAgICAgICAgIC8vIEJsb2NrIGNvbW1lbnQgZW5kcyB3aXRoICcqLycuXG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkgPT09IDB4MkYpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV4dHJhLmNvbW1lbnRzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gc291cmNlLnNsaWNlKHN0YXJ0ICsgMiwgaW5kZXggLSAyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAgICAgYWRkQ29tbWVudCgnQmxvY2snLCBjb21tZW50LCBzdGFydCwgaW5kZXgsIGxvYyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gUmFuIG9mZiB0aGUgZW5kIG9mIHRoZSBmaWxlIC0gdGhlIHdob2xlIHRoaW5nIGlzIGEgY29tbWVudFxuICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29tbWVudCA9IHNvdXJjZS5zbGljZShzdGFydCArIDIsIGluZGV4KTtcbiAgICAgICAgICAgIGFkZENvbW1lbnQoJ0Jsb2NrJywgY29tbWVudCwgc3RhcnQsIGluZGV4LCBsb2MpO1xuICAgICAgICB9XG4gICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2tpcENvbW1lbnQoKSB7XG4gICAgICAgIHZhciBjaCwgc3RhcnQ7XG4gICAgICAgIGhhc0xpbmVUZXJtaW5hdG9yID0gZmFsc2U7XG5cbiAgICAgICAgc3RhcnQgPSAoaW5kZXggPT09IDApO1xuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuXG4gICAgICAgICAgICBpZiAoaXNXaGl0ZVNwYWNlKGNoKSkge1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2gpKSB7XG4gICAgICAgICAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAweDBEICYmIHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSA9PT0gMHgwQSkge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2xpbmVOdW1iZXI7XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgc3RhcnQgPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgyRikgeyAvLyBVKzAwMkYgaXMgJy8nXG4gICAgICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCArIDEpO1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gMHgyRikge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoMik7XG4gICAgICAgICAgICAgICAgICAgIHN0YXJ0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAweDJBKSB7ICAvLyBVKzAwMkEgaXMgJyonXG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHNraXBNdWx0aUxpbmVDb21tZW50KCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChzdGFydCAmJiBjaCA9PT0gMHgyRCkgeyAvLyBVKzAwMkQgaXMgJy0nXG4gICAgICAgICAgICAgICAgLy8gVSswMDNFIGlzICc+J1xuICAgICAgICAgICAgICAgIGlmICgoc291cmNlLmNoYXJDb2RlQXQoaW5kZXggKyAxKSA9PT0gMHgyRCkgJiYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMikgPT09IDB4M0UpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vICctLT4nIGlzIGEgc2luZ2xlLWxpbmUgY29tbWVudFxuICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAzO1xuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoMyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgzQykgeyAvLyBVKzAwM0MgaXMgJzwnXG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5zbGljZShpbmRleCArIDEsIGluZGV4ICsgNCkgPT09ICchLS0nKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7IC8vIGA8YFxuICAgICAgICAgICAgICAgICAgICArK2luZGV4OyAvLyBgIWBcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDsgLy8gYC1gXG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7IC8vIGAtYFxuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoNCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5IZXhFc2NhcGUocHJlZml4KSB7XG4gICAgICAgIHZhciBpLCBsZW4sIGNoLCBjb2RlID0gMDtcblxuICAgICAgICBsZW4gPSAocHJlZml4ID09PSAndScpID8gNCA6IDI7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47ICsraSkge1xuICAgICAgICAgICAgaWYgKGluZGV4IDwgbGVuZ3RoICYmIGlzSGV4RGlnaXQoc291cmNlW2luZGV4XSkpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgICAgICBjb2RlID0gY29kZSAqIDE2ICsgJzAxMjM0NTY3ODlhYmNkZWYnLmluZGV4T2YoY2gudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZShjb2RlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpIHtcbiAgICAgICAgdmFyIGNoLCBjb2RlLCBjdTEsIGN1MjtcblxuICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIGNvZGUgPSAwO1xuXG4gICAgICAgIC8vIEF0IGxlYXN0LCBvbmUgaGV4IGRpZ2l0IGlzIHJlcXVpcmVkLlxuICAgICAgICBpZiAoY2ggPT09ICd9Jykge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICBpZiAoIWlzSGV4RGlnaXQoY2gpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb2RlID0gY29kZSAqIDE2ICsgJzAxMjM0NTY3ODlhYmNkZWYnLmluZGV4T2YoY2gudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoY29kZSA+IDB4MTBGRkZGIHx8IGNoICE9PSAnfScpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBVVEYtMTYgRW5jb2RpbmdcbiAgICAgICAgaWYgKGNvZGUgPD0gMHhGRkZGKSB7XG4gICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZShjb2RlKTtcbiAgICAgICAgfVxuICAgICAgICBjdTEgPSAoKGNvZGUgLSAweDEwMDAwKSA+PiAxMCkgKyAweEQ4MDA7XG4gICAgICAgIGN1MiA9ICgoY29kZSAtIDB4MTAwMDApICYgMTAyMykgKyAweERDMDA7XG4gICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlKGN1MSwgY3UyKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBnZXRFc2NhcGVkSWRlbnRpZmllcigpIHtcbiAgICAgICAgdmFyIGNoLCBpZDtcblxuICAgICAgICBjaCA9IHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KyspO1xuICAgICAgICBpZCA9IFN0cmluZy5mcm9tQ2hhckNvZGUoY2gpO1xuXG4gICAgICAgIC8vICdcXHUnIChVKzAwNUMsIFUrMDA3NSkgZGVub3RlcyBhbiBlc2NhcGVkIGNoYXJhY3Rlci5cbiAgICAgICAgaWYgKGNoID09PSAweDVDKSB7XG4gICAgICAgICAgICBpZiAoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpICE9PSAweDc1KSB7XG4gICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgIGlmICghY2ggfHwgY2ggPT09ICdcXFxcJyB8fCAhaXNJZGVudGlmaWVyU3RhcnQoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWQgPSBjaDtcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoIWlzSWRlbnRpZmllclBhcnQoY2gpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgaWQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjaCk7XG5cbiAgICAgICAgICAgIC8vICdcXHUnIChVKzAwNUMsIFUrMDA3NSkgZGVub3RlcyBhbiBlc2NhcGVkIGNoYXJhY3Rlci5cbiAgICAgICAgICAgIGlmIChjaCA9PT0gMHg1Qykge1xuICAgICAgICAgICAgICAgIGlkID0gaWQuc3Vic3RyKDAsIGlkLmxlbmd0aCAtIDEpO1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkgIT09IDB4NzUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgICAgICBpZiAoIWNoIHx8IGNoID09PSAnXFxcXCcgfHwgIWlzSWRlbnRpZmllclBhcnQoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaWQ7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZ2V0SWRlbnRpZmllcigpIHtcbiAgICAgICAgdmFyIHN0YXJ0LCBjaDtcblxuICAgICAgICBzdGFydCA9IGluZGV4Kys7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoY2ggPT09IDB4NUMpIHtcbiAgICAgICAgICAgICAgICAvLyBCbGFja3NsYXNoIChVKzAwNUMpIG1hcmtzIFVuaWNvZGUgZXNjYXBlIHNlcXVlbmNlLlxuICAgICAgICAgICAgICAgIGluZGV4ID0gc3RhcnQ7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldEVzY2FwZWRJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaXNJZGVudGlmaWVyUGFydChjaCkpIHtcbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBzb3VyY2Uuc2xpY2Uoc3RhcnQsIG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bmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cblxuICAgIC8vIDcuNyBQdW5jdHVhdG9yc1xuXG4gICAgZnVuY3Rpb24gc2NhblB1bmN0dWF0b3IoKSB7XG4gICAgICAgIHZhciB0b2tlbiwgc3RyO1xuXG4gICAgICAgIHRva2VuID0ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uUHVuY3R1YXRvcixcbiAgICAgICAgICAgIHZhbHVlOiAnJyxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBpbmRleCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcblxuICAgICAgICAvLyBDaGVjayBmb3IgbW9zdCBjb21tb24gc2luZ2xlLWNoYXJhY3RlciBwdW5jdHVhdG9ycy5cbiAgICAgICAgc3RyID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgc3dpdGNoIChzdHIpIHtcblxuICAgICAgICBjYXNlICcoJzpcbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgICAgIGV4dHJhLm9wZW5QYXJlblRva2VuID0gZXh0cmEudG9rZW5zLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICd7JzpcbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgICAgIGV4dHJhLm9wZW5DdXJseVRva2VuID0gZXh0cmEudG9rZW5zLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucHVzaCgneycpO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJy4nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAnLicgJiYgc291cmNlW2luZGV4ICsgMV0gPT09ICcuJykge1xuICAgICAgICAgICAgICAgIC8vIFNwcmVhZCBvcGVyYXRvcjogLi4uXG4gICAgICAgICAgICAgICAgaW5kZXggKz0gMjtcbiAgICAgICAgICAgICAgICBzdHIgPSAnLi4uJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ30nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAnKSc6XG4gICAgICAgIGNhc2UgJzsnOlxuICAgICAgICBjYXNlICcsJzpcbiAgICAgICAgY2FzZSAnWyc6XG4gICAgICAgIGNhc2UgJ10nOlxuICAgICAgICBjYXNlICc6JzpcbiAgICAgICAgY2FzZSAnPyc6XG4gICAgICAgIGNhc2UgJ34nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAvLyA0LWNoYXJhY3RlciBwdW5jdHVhdG9yLlxuICAgICAgICAgICAgc3RyID0gc291cmNlLnN1YnN0cihpbmRleCwgNCk7XG4gICAgICAgICAgICBpZiAoc3RyID09PSAnPj4+PScpIHtcbiAgICAgICAgICAgICAgICBpbmRleCArPSA0O1xuICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgIC8vIDMtY2hhcmFjdGVyIHB1bmN0dWF0b3JzLlxuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMyk7XG4gICAgICAgICAgICAgICAgaWYgKHN0ciA9PT0gJz09PScgfHwgc3RyID09PSAnIT09JyB8fCBzdHIgPT09ICc+Pj4nIHx8XG4gICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw8PScgfHwgc3RyID09PSAnPj49Jykge1xuICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAzO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gMi1jaGFyYWN0ZXIgcHVuY3R1YXRvcnMuXG4gICAgICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdHIgPT09ICcmJicgfHwgc3RyID09PSAnfHwnIHx8IHN0ciA9PT0gJz09JyB8fCBzdHIgPT09ICchPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJys9JyB8fCBzdHIgPT09ICctPScgfHwgc3RyID09PSAnKj0nIHx8IHN0ciA9PT0gJy89JyB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyID09PSAnKysnIHx8IHN0ciA9PT0gJy0tJyB8fCBzdHIgPT09ICc8PCcgfHwgc3RyID09PSAnPj4nIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgPT09ICcmPScgfHwgc3RyID09PSAnfD0nIHx8IHN0ciA9PT0gJ149JyB8fCBzdHIgPT09ICclPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw9JyB8fCBzdHIgPT09ICc+PScgfHwgc3RyID09PSAnPT4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAyO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxLWNoYXJhY3RlciBwdW5jdHVhdG9ycy5cbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzw+PSErLSolJnxeLycuaW5kZXhPZihzdHIpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4ID09PSB0b2tlbi5zdGFydCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRva2VuLmVuZCA9IGluZGV4O1xuICAgICAgICB0b2tlbi52YWx1ZSA9IHN0cjtcbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIC8vIDcuOC4zIE51bWVyaWMgTGl0ZXJhbHNcblxuICAgIGZ1bmN0aW9uIHNjYW5IZXhMaXRlcmFsKHN0YXJ0KSB7XG4gICAgICAgIHZhciBudW1iZXIgPSAnJztcblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGlmICghaXNIZXhEaWdpdChzb3VyY2VbaW5kZXhdKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChudW1iZXIubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VJbnQoJzB4JyArIG51bWJlciwgMTYpLFxuICAgICAgICAgICAgbGluZU51bWJlcjogbGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5CaW5hcnlMaXRlcmFsKHN0YXJ0KSB7XG4gICAgICAgIHZhciBjaCwgbnVtYmVyO1xuXG4gICAgICAgIG51bWJlciA9ICcnO1xuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKGNoICE9PSAnMCcgJiYgY2ggIT09ICcxJykge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChudW1iZXIubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAvLyBvbmx5IDBiIG9yIDBCXG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KTtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICAgICAgICBpZiAoaXNJZGVudGlmaWVyU3RhcnQoY2gpIHx8IGlzRGVjaW1hbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VJbnQobnVtYmVyLCAyKSxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuT2N0YWxMaXRlcmFsKHByZWZpeCwgc3RhcnQpIHtcbiAgICAgICAgdmFyIG51bWJlciwgb2N0YWw7XG5cbiAgICAgICAgaWYgKGlzT2N0YWxEaWdpdChwcmVmaXgpKSB7XG4gICAgICAgICAgICBvY3RhbCA9IHRydWU7XG4gICAgICAgICAgICBudW1iZXIgPSAnMCcgKyBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvY3RhbCA9IGZhbHNlO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIG51bWJlciA9ICcnO1xuICAgICAgICB9XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAoIWlzT2N0YWxEaWdpdChzb3VyY2VbaW5kZXhdKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghb2N0YWwgJiYgbnVtYmVyLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgLy8gb25seSAwbyBvciAwT1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc0lkZW50aWZpZXJTdGFydChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpIHx8IGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VJbnQobnVtYmVyLCA4KSxcbiAgICAgICAgICAgIG9jdGFsOiBvY3RhbCxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBpc0ltcGxpY2l0T2N0YWxMaXRlcmFsKCkge1xuICAgICAgICB2YXIgaSwgY2g7XG5cbiAgICAgICAgLy8gSW1wbGljaXQgb2N0YWwsIHVubGVzcyB0aGVyZSBpcyBhIG5vbi1vY3RhbCBkaWdpdC5cbiAgICAgICAgLy8gKEFubmV4IEIuMS4xIG9uIE51bWVyaWMgTGl0ZXJhbHMpXG4gICAgICAgIGZvciAoaSA9IGluZGV4ICsgMTsgaSA8IGxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpXTtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJzgnIHx8IGNoID09PSAnOScpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWlzT2N0YWxEaWdpdChjaCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5OdW1lcmljTGl0ZXJhbCgpIHtcbiAgICAgICAgdmFyIG51bWJlciwgc3RhcnQsIGNoO1xuXG4gICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgYXNzZXJ0KGlzRGVjaW1hbERpZ2l0KGNoLmNoYXJDb2RlQXQoMCkpIHx8IChjaCA9PT0gJy4nKSxcbiAgICAgICAgICAgICdOdW1lcmljIGxpdGVyYWwgbXVzdCBzdGFydCB3aXRoIGEgZGVjaW1hbCBkaWdpdCBvciBhIGRlY2ltYWwgcG9pbnQnKTtcblxuICAgICAgICBzdGFydCA9IGluZGV4O1xuICAgICAgICBudW1iZXIgPSAnJztcbiAgICAgICAgaWYgKGNoICE9PSAnLicpIHtcbiAgICAgICAgICAgIG51bWJlciA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcblxuICAgICAgICAgICAgLy8gSGV4IG51bWJlciBzdGFydHMgd2l0aCAnMHgnLlxuICAgICAgICAgICAgLy8gT2N0YWwgbnVtYmVyIHN0YXJ0cyB3aXRoICcwJy5cbiAgICAgICAgICAgIC8vIE9jdGFsIG51bWJlciBpbiBFUzYgc3RhcnRzIHdpdGggJzBvJy5cbiAgICAgICAgICAgIC8vIEJpbmFyeSBudW1iZXIgaW4gRVM2IHN0YXJ0cyB3aXRoICcwYicuXG4gICAgICAgICAgICBpZiAobnVtYmVyID09PSAnMCcpIHtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd4JyB8fCBjaCA9PT0gJ1gnKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuSGV4TGl0ZXJhbChzdGFydCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ2InIHx8IGNoID09PSAnQicpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5CaW5hcnlMaXRlcmFsKHN0YXJ0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAnbycgfHwgY2ggPT09ICdPJykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Nhbk9jdGFsTGl0ZXJhbChjaCwgc3RhcnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChpc09jdGFsRGlnaXQoY2gpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0ltcGxpY2l0T2N0YWxMaXRlcmFsKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuT2N0YWxMaXRlcmFsKGNoLCBzdGFydCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHdoaWxlIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjaCA9PT0gJy4nKSB7XG4gICAgICAgICAgICBudW1iZXIgKz0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgd2hpbGUgKGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgICAgICBudW1iZXIgKz0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNoID09PSAnZScgfHwgY2ggPT09ICdFJykge1xuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcblxuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKGNoID09PSAnKycgfHwgY2ggPT09ICctJykge1xuICAgICAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaXNEZWNpbWFsRGlnaXQoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpKSkge1xuICAgICAgICAgICAgICAgIHdoaWxlIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VGbG9hdChudW1iZXIpLFxuICAgICAgICAgICAgbGluZU51bWJlcjogbGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuICAgIH1cblxuICAgIC8vIDcuOC40IFN0cmluZyBMaXRlcmFsc1xuXG4gICAgZnVuY3Rpb24gc2NhblN0cmluZ0xpdGVyYWwoKSB7XG4gICAgICAgIHZhciBzdHIgPSAnJywgcXVvdGUsIHN0YXJ0LCBjaCwgdW5lc2NhcGVkLCBvY3RUb0RlYywgb2N0YWwgPSBmYWxzZTtcblxuICAgICAgICBxdW90ZSA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIGFzc2VydCgocXVvdGUgPT09ICdcXCcnIHx8IHF1b3RlID09PSAnXCInKSxcbiAgICAgICAgICAgICdTdHJpbmcgbGl0ZXJhbCBtdXN0IHN0YXJ0cyB3aXRoIGEgcXVvdGUnKTtcblxuICAgICAgICBzdGFydCA9IGluZGV4O1xuICAgICAgICArK2luZGV4O1xuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG5cbiAgICAgICAgICAgIGlmIChjaCA9PT0gcXVvdGUpIHtcbiAgICAgICAgICAgICAgICBxdW90ZSA9ICcnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xcXFwnKSB7XG4gICAgICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICAgICAgaWYgKCFjaCB8fCAhaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICd4JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmVzY2FwZWQgPSBzY2FuSGV4RXNjYXBlKGNoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXVuZXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gdW5lc2NhcGVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ24nOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXG4nO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3InOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3QnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHQnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2InOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXGInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2YnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXGYnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3YnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHgwQic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnOCc6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJzknOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcblxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzT2N0YWxEaWdpdChjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvY3RUb0RlYyA9IG9jdGFsVG9EZWNpbWFsKGNoKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9jdGFsID0gb2N0VG9EZWMub2N0YWwgfHwgb2N0YWw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9IFN0cmluZy5mcm9tQ2hhckNvZGUob2N0VG9EZWMuY29kZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICdcXHInICYmIHNvdXJjZVtpbmRleF0gPT09ICdcXG4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGxpbmVTdGFydCA9IGluZGV4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzdHIgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocXVvdGUgIT09ICcnKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IFRva2VuLlN0cmluZ0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogc3RyLFxuICAgICAgICAgICAgb2N0YWw6IG9jdGFsLFxuICAgICAgICAgICAgbGluZU51bWJlcjogc3RhcnRMaW5lTnVtYmVyLFxuICAgICAgICAgICAgbGluZVN0YXJ0OiBzdGFydExpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuVGVtcGxhdGUoKSB7XG4gICAgICAgIHZhciBjb29rZWQgPSAnJywgY2gsIHN0YXJ0LCByYXdPZmZzZXQsIHRlcm1pbmF0ZWQsIGhlYWQsIHRhaWwsIHJlc3RvcmUsIHVuZXNjYXBlZDtcblxuICAgICAgICB0ZXJtaW5hdGVkID0gZmFsc2U7XG4gICAgICAgIHRhaWwgPSBmYWxzZTtcbiAgICAgICAgc3RhcnQgPSBpbmRleDtcbiAgICAgICAgaGVhZCA9IChzb3VyY2VbaW5kZXhdID09PSAnYCcpO1xuICAgICAgICByYXdPZmZzZXQgPSAyO1xuXG4gICAgICAgICsraW5kZXg7XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJ2AnKSB7XG4gICAgICAgICAgICAgICAgcmF3T2Zmc2V0ID0gMTtcbiAgICAgICAgICAgICAgICB0YWlsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICckJykge1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY3VybHlTdGFjay5wdXNoKCckeycpO1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvb2tlZCArPSBjaDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcXFxcJykge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgICAgIGlmICghaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ24nOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3InOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3QnOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHQnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICd4JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5lc2NhcGVkID0gc2NhbkhleEVzY2FwZShjaCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVuZXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29rZWQgKz0gdW5lc2NhcGVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcmVzdG9yZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdiJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxiJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdmJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxmJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICd2JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFx2JztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICcwJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMDEgXFwwMiBhbmQgc28gb25cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihNZXNzYWdlcy5UZW1wbGF0ZU9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFwwJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNPY3RhbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMSBcXDJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLlRlbXBsYXRlT2N0YWxMaXRlcmFsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICArK2xpbmVOdW1iZXI7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb29rZWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhlYWQpIHtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uVGVtcGxhdGUsXG4gICAgICAgICAgICB2YWx1ZToge1xuICAgICAgICAgICAgICAgIGNvb2tlZDogY29va2VkLFxuICAgICAgICAgICAgICAgIHJhdzogc291cmNlLnNsaWNlKHN0YXJ0ICsgMSwgaW5kZXggLSByYXdPZmZzZXQpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaGVhZDogaGVhZCxcbiAgICAgICAgICAgIHRhaWw6IHRhaWwsXG4gICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgbG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ZXJyb3IuXG4gICAgICAgICAgICB0bXAgPSB0bXBcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxcXHVcXHsoWzAtOWEtZkEtRl0rKVxcfS9nLCBmdW5jdGlvbiAoJDAsICQxKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwYXJzZUludCgkMSwgMTYpIDw9IDB4MTBGRkZGKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3gnO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLkludmFsaWRSZWdFeHApO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoXG4gICAgICAgICAgICAgICAgICAgIC9cXFxcdShbYS1mQS1GMC05XXs0fSl8W1xcdUQ4MDAtXFx1REJGRl1bXFx1REMwMC1cXHVERkZGXS9nLFxuICAgICAgICAgICAgICAgICAgICAneCdcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gRmlyc3QsIGRldGVjdCBpbnZhbGlkIHJlZ3VsYXIgZXhwcmVzc2lvbnMuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBSZWdFeHAodG1wKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obnVsbCwgTWVzc2FnZXMuSW52YWxpZFJlZ0V4cCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBSZXR1cm4gYSByZWd1bGFyIGV4cHJlc3Npb24gb2JqZWN0IGZvciB0aGlzIHBhdHRlcm4tZmxhZyBwYWlyLCBvclxuICAgICAgICAvLyBgbnVsbGAgaW4gY2FzZSB0aGUgY3VycmVudCBlbnZpcm9ubWVudCBkb2Vzbid0IHN1cHBvcnQgdGhlIGZsYWdzIGl0XG4gICAgICAgIC8vIHVzZXMuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFJlZ0V4cChwYXR0ZXJuLCBmbGFncyk7XG4gICAgICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbikge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuUmVnRXhwQm9keSgpIHtcbiAgICAgICAgdmFyIGNoLCBzdHIsIGNsYXNzTWFya2VyLCB0ZXJtaW5hdGVkLCBib2R5O1xuXG4gICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgYXNzZXJ0KGNoID09PSAnLycsICdSZWd1bGFyIGV4cHJlc3Npb24gbGl0ZXJhbCBtdXN0IHN0YXJ0IHdpdGggYSBzbGFzaCcpO1xuICAgICAgICBzdHIgPSBzb3VyY2VbaW5kZXgrK107XG5cbiAgICAgICAgY2xhc3NNYXJrZXIgPSBmYWxzZTtcbiAgICAgICAgdGVybWluYXRlZCA9IGZhbHNlO1xuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgc3RyICs9IGNoO1xuICAgICAgICAgICAgaWYgKGNoID09PSAnXFxcXCcpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAvLyBFQ01BLTI2MiA3LjguNVxuICAgICAgICAgICAgICAgIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLlVudGVybWluYXRlZFJlZ0V4cCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLlVudGVybWluYXRlZFJlZ0V4cCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNsYXNzTWFya2VyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAnXScpIHtcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NNYXJrZXIgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJy8nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRlcm1pbmF0ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnWycpIHtcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NNYXJrZXIgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghdGVybWluYXRlZCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obnVsbCwgTWVzc2FnZXMuVW50ZXJtaW5hdGVkUmVnRXhwKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEV4Y2x1ZGUgbGVhZGluZyBhbmQgdHJhaWxpbmcgc2xhc2guXG4gICAgICAgIGJvZHkgPSBzdHIuc3Vic3RyKDEsIHN0ci5sZW5ndGggLSAyKTtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBib2R5LFxuICAgICAgICAgICAgbGl0ZXJhbDogc3RyXG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2NhblJlZ0V4cEZsYWdzKCkge1xuICAgICAgICB2YXIgY2gsIHN0ciwgZmxhZ3MsIHJlc3RvcmU7XG5cbiAgICAgICAgc3RyID0gJyc7XG4gICAgICAgIGZsYWdzID0gJyc7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKCFpc0lkZW50aWZpZXJQYXJ0KGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBpZiAoY2ggPT09ICdcXFxcJyAmJiBpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd1Jykge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICByZXN0b3JlID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIGNoID0gc2NhbkhleEVzY2FwZSgndScpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzdHIgKz0gJ1xcXFx1JzsgcmVzdG9yZSA8IGluZGV4OyArK3Jlc3RvcmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gc291cmNlW3Jlc3RvcmVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSByZXN0b3JlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgKz0gJ3UnO1xuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXFxcdSc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcXFwnO1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZmxhZ3MgKz0gY2g7XG4gICAgICAgICAgICAgICAgc3RyICs9IGNoO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBmbGFncyxcbiAgICAgICAgICAgIGxpdGVyYWw6IHN0clxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5SZWdFeHAoKSB7XG4gICAgICAgIHNjYW5uaW5nID0gdHJ1ZTtcbiAgICAgICAgdmFyIHN0YXJ0LCBib2R5LCBmbGFncywgdmFsdWU7XG5cbiAgICAgICAgbG9va2FoZWFkID0gbnVsbDtcbiAgICAgICAgc2tpcENvbW1lbnQoKTtcbiAgICAgICAgc3RhcnQgPSBpbmRleDtcblxuICAgICAgICBib2R5ID0gc2NhblJlZ0V4cEJvZHkoKTtcbiAgICAgICAgZmxhZ3MgPSBzY2FuUmVnRXhwRmxhZ3MoKTtcbiAgICAgICAgdmFsdWUgPSB0ZXN0UmVnRXhwKGJvZHkudmFsdWUsIGZsYWdzLnZhbHVlKTtcbiAgICAgICAgc2Nhbm5pbmcgPSBmYWxzZTtcbiAgICAgICAgaWYgKGV4dHJhLnRva2VuaXplKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuLlJlZ3VsYXJFeHByZXNzaW9uLFxuICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICByZWdleDoge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiBib2R5LnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogZmxhZ3MudmFsdWVcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0OiBsaW5lU3RhcnQsXG4gICAgICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgbGl0ZXJhbDogYm9keS5saXRlcmFsICsgZmxhZ3MubGl0ZXJhbCxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgIHJlZ2V4OiB7XG4gICAgICAgICAgICAgICAgcGF0dGVybjogYm9keS52YWx1ZSxcbiAgICAgICAgICAgICAgICBmbGFnczogZmxhZ3MudmFsdWVcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY29sbGVjdFJlZ2V4KCkge1xuICAgICAgICB2YXIgcG9zLCBsb2MsIHJlZ2V4LCB0b2tlbjtcblxuICAgICAgICBza2lwQ29tbWVudCgpO1xuXG4gICAgICAgIHBvcyA9IGluZGV4O1xuICAgICAgICBsb2MgPSB7XG4gICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIHJlZ2V4ID0gc2NhblJlZ0V4cCgpO1xuXG4gICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICB9O1xuXG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgIGlmICghZXh0cmEudG9rZW5pemUpIHtcbiAgICAgICAgICAgIC8vIFBvcCB0aGUgcHJldmlvdXMgdG9rZW4sIHdoaWNoIGlzIGxpa2VseSAnLycgb3IgJy89J1xuICAgICAgICAgICAgaWYgKGV4dHJhLnRva2Vucy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEudG9rZW5zLmxlbmd0aCAtIDFdO1xuICAgICAgICAgICAgICAgIGlmICh0b2tlbi5yYW5nZVswXSA9PT0gcG9zICYmIHRva2VuLnR5cGUgPT09ICdQdW5jdHVhdG9yJykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodG9rZW4udmFsdWUgPT09ICcvJyB8fCB0b2tlbi52YWx1ZSA9PT0gJy89Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmEudG9rZW5zLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHRyYS50b2tlbnMucHVzaCh7XG4gICAgICAgICAgICAgICAgdHlwZTogJ1JlZ3VsYXJFeHByZXNzaW9uJyxcbiAgICAgICAgICAgICAgICB2YWx1ZTogcmVnZXgubGl0ZXJhbCxcbiAgICAgICAgICAgICAgICByZWdleDogcmVnZXgucmVnZXgsXG4gICAgICAgICAgICAgICAgcmFuZ2U6IFtwb3MsIGluZGV4XSxcbiAgICAgICAgICAgICAgICBsb2M6IGxvY1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVnZXg7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gaXNJZGVudGlmaWVyTmFtZSh0b2tlbikge1xuICAgICAgICByZXR1cm4gdG9rZW4udHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllciB8fFxuICAgICAgICAgICAgdG9rZW4udHlwZSA9PT0gVG9rZW4uS2V5d29yZCB8fFxuICAgICAgICAgICAgdG9rZW4udHlwZSA9PT0gVG9rZW4uQm9vbGVhbkxpdGVyYWwgfHxcbiAgICAgICAgICAgIHRva2VuLnR5cGUgPT09IFRva2VuLk51bGxMaXRlcmFsO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGFkdmFuY2VTbGFzaCgpIHtcbiAgICAgICAgdmFyIHByZXZUb2tlbixcbiAgICAgICAgICAgIGNoZWNrVG9rZW47XG4gICAgICAgIC8vIFVzaW5nIHRoZSBmb2xsb3dpbmcgYWxnb3JpdGhtOlxuICAgICAgICAvLyBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zd2VldC5qcy93aWtpL2Rlc2lnblxuICAgICAgICBwcmV2VG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEudG9rZW5zLmxlbmd0aCAtIDFdO1xuICAgICAgICBpZiAoIXByZXZUb2tlbikge1xuICAgICAgICAgICAgLy8gTm90aGluZyBiZWZvcmUgdGhhdDogaXQgY2Fubm90IGJlIGEgZGl2aXNpb24uXG4gICAgICAgICAgICByZXR1cm4gY29sbGVjdFJlZ2V4KCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByZXZUb2tlbi50eXBlID09PSAnUHVuY3R1YXRvcicpIHtcbiAgICAgICAgICAgIGlmIChwcmV2VG9rZW4udmFsdWUgPT09ICddJykge1xuICAgICAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByZXZUb2tlbi52YWx1ZSA9PT0gJyknKSB7XG4gICAgICAgICAgICAgICAgY2hlY2tUb2tlbiA9IGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuUGFyZW5Ub2tlbiAtIDFdO1xuICAgICAgICAgICAgICAgIGlmIChjaGVja1Rva2VuICYmXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnR5cGUgPT09ICdLZXl3b3JkJyAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgKGNoZWNrVG9rZW4udmFsdWUgPT09ICdpZicgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnZhbHVlID09PSAnd2hpbGUnIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tUb2tlbi52YWx1ZSA9PT0gJ2ZvcicgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnZhbHVlID09PSAnd2l0aCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJldlRva2VuLnZhbHVlID09PSAnfScpIHtcbiAgICAgICAgICAgICAgICAvLyBEaXZpZGluZyBhIGZ1bmN0aW9uIGJ5IGFueXRoaW5nIG1ha2VzIGxpdHRsZSBzZW5zZSxcbiAgICAgICAgICAgICAgICAvLyBidXQgd2UgaGF2ZSB0byBjaGVjayBmb3IgdGhhdC5cbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEudG9rZW5zW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gM10gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDNdLnR5cGUgPT09ICdLZXl3b3JkJykge1xuICAgICAgICAgICAgICAgICAgICAvLyBBbm9ueW1vdXMgZnVuY3Rpb24uXG4gICAgICAgICAgICAgICAgICAgIGNoZWNrVG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEub3BlbkN1cmx5VG9rZW4gLSA0XTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjaGVja1Rva2VuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NhblB1bmN0dWF0b3IoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXh0cmEudG9rZW5zW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gNF0gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDRdLnR5cGUgPT09ICdLZXl3b3JkJykge1xuICAgICAgICAgICAgICAgICAgICAvLyBOYW1lZCBmdW5jdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgY2hlY2tUb2tlbiA9IGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDVdO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoZWNrVG9rZW4pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjaGVja1Rva2VuIGRldGVybWluZXMgd2hldGhlciB0aGUgZnVuY3Rpb24gaXNcbiAgICAgICAgICAgICAgICAvLyBhIGRlY2xhcmF0aW9uIG9yIGFuIGV4cHJlc3Npb24uXG4gICAgICAgICAgICAgICAgaWYgKEZuRXhwclRva2Vucy5pbmRleE9mKGNoZWNrVG9rZW4udmFsdWUpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gSXQgaXMgYW4gZXhwcmVzc2lvbi5cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIEl0IGlzIGEgZGVjbGFyYXRpb24uXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvbGxlY3RSZWdleCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGNvbGxlY3RSZWdleCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcmV2VG9rZW4udHlwZSA9PT0gJ0tleXdvcmQnICYmIHByZXZUb2tlbi52YWx1ZSAhPT0gJ3RoaXMnKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sbGVjdFJlZ2V4KCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gYWR2YW5jZSgpIHtcbiAgICAgICAgdmFyIGNoLCB0b2tlbjtcblxuICAgICAgICBpZiAoaW5kZXggPj0gbGVuZ3RoKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuLkVPRixcbiAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgICAgIHN0YXJ0OiBpbmRleCxcbiAgICAgICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KGNoKSkge1xuICAgICAgICAgICAgdG9rZW4gPSBzY2FuSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4udHlwZSA9IFRva2VuLktleXdvcmQ7XG4gICAgIC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EgcmVnZXguXG4gICAgICAgIGlmIChleHRyYS50b2tlbml6ZSAmJiBjaCA9PT0gMHgyRikge1xuICAgICAgICAgICAgcmV0dXJuIGFkdmFuY2VTbGFzaCgpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gVGVtcGxhdGUgbGl0ZXJhbHMgc3RhcnQgd2l0aCBgIChVKzAwNjApIGZvciB0ZW1wbGF0ZSBoZWFkXG4gICAgICAgIC8vIG9yIH0gKFUrMDA3RCkgZm9yIHRlbXBsYXRlIG1pZGRsZSBvciB0ZW1wbGF0ZSB0YWlsLlxuICAgICAgICBpZiAoY2ggPT09IDB4NjAgfHwgKGNoID09PSAweDdEICYmIHN0YXRlLmN1cmx5U3RhY2tbc3RhdGUuY3VybHlTdGFjay5sZW5ndGggLSAxXSA9PT0gJyR7JykpIHtcbiAgICAgICAgICAgIHJldHVybiBzY2FuVGVtcGxhdGUoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbGxlY3RUb2tlbigpIHtcbiAgICAgICAgdmFyIGxvYywgdG9rZW4sIHZhbHVlLCBlbnRyeTtcblxuICAgICAgICBsb2MgPSB7XG4gICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIHRva2VuID0gYWR2YW5jZSgpO1xuICAgICAgICBsb2MuZW5kID0ge1xuICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgfTtcblxuICAgICAgICBpZiAodG9rZW4udHlwZSAhPT0gVG9rZW4uRU9GKSB7XG4gICAgICAgICAgICB2YWx1ZSA9IHNvdXJjZS5zbGljZSh0b2tlbi5zdGFydCwgdG9rZW4uZW5kKTtcbiAgICAgICAgICAgIGVudHJ5ID0ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuTmFtZVt0b2tlbi50eXBlXSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogdmFsdWUsXG4gICAgICAgICAgICAgICAgcmFuZ2U6IFt0b2tlbi5zdGFydCwgdG9rZW4uZW5kXSxcbiAgICAgICAgICAgICAgICBsb2M6IGxvY1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmICh0b2tlbi5yZWdleCkge1xuICAgICAgICAgICAgICAgIGVudHJ5LnJlZ2V4ID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiB0b2tlbi5yZWdleC5wYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogdG9rZW4ucmVnZXguZmxhZ3NcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXh0cmEudG9rZW5zLnB1c2goZW50cnkpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGxleCgpIHtcbiAgICAgICAgdmFyIHRva2VuO1xuICAgICAgICBzY2FubmluZyA9IHRydWU7XG5cbiAgICAgICAgbGFzdEluZGV4ID0gaW5kZXg7XG4gICAgICAgIGxhc3RMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgbGFzdExpbmVTdGFydCA9IGxpbmVTdGFydDtcblxuICAgICAgICBza2lwQ29tbWVudCgpO1xuXG4gICAgICAgIHRva2VuID0gbG9va2FoZWFkO1xuXG4gICAgICAgIHN0YXJ0SW5kZXggPSBpbmRleDtcbiAgICAgICAgc3RhcnRMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgc3RhcnRMaW5lU3RhcnQgPSBsaW5lU3RhcnQ7XG5cbiAgICAgICAgbG9va2FoZWFkID0g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aXMuc3RhcnQgPSB7XG4gICAgICAgICAgICBsaW5lOiBzdGFydFRva2VuLmxpbmVOdW1iZXIsXG4gICAgICAgICAgICBjb2x1bW46IHN0YXJ0VG9rZW4uc3RhcnQgLSBzdGFydFRva2VuLmxpbmVTdGFydFxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmVuZCA9IG51bGw7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gTm9kZSgpIHtcbiAgICAgICAgaWYgKGV4dHJhLnJhbmdlKSB7XG4gICAgICAgICAgICB0aGlzLnJhbmdlID0gW3N0YXJ0SW5kZXgsIDBdO1xuICAgICAgICB9XG4gICAgICAgIGlmIChleHRyYS5sb2MpIHtcbiAgICAgICAgICAgIHRoaXMubG9jID0gbmV3IFNvdXJjZUxvY2F0aW9uKCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikge1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIHRoaXMucmFuZ2UgPSBbc3RhcnRUb2tlbi5zdGFydCwgMF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgdGhpcy5sb2MgPSBuZXcgV3JhcHBpbmdTb3VyY2VMb2NhdGlvbihzdGFydFRva2VuKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFdyYXBwaW5nTm9kZS5wcm90b3R5cGUgPSBOb2RlLnByb3RvdHlwZSA9IHtcblxuICAgICAgICBwcm9jZXNzQ29tbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGxhc3RDaGlsZCxcbiAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMsXG4gICAgICAgICAgICAgICAgdHJhaWxpbmdDb21tZW50cyxcbiAgICAgICAgICAgICAgICBib3R0b21SaWdodCA9IGV4dHJhLmJvdHRvbVJpZ2h0U3RhY2ssXG4gICAgICAgICAgICAgICAgaSxcbiAgICAgICAgICAgICAgICBjb21tZW50LFxuICAgICAgICAgICAgICAgIGxhc3QgPSBib3R0b21SaWdodFtib3R0b21SaWdodC5sZW5ndGggLSAxXTtcblxuICAgICAgICAgICAgaWYgKHRoaXMudHlwZSA9PT0gU3ludGF4LlByb2dyYW0pIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5ib2R5Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGV4dHJhLnRyYWlsaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRyYWlsaW5nQ29tbWVudHMgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSBleHRyYS50cmFpbGluZ0NvbW1lbnRzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbW1lbnQgPSBleHRyYS50cmFpbGluZ0NvbW1lbnRzW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVswXSA+PSB0aGlzLnJhbmdlWzFdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzLnVuc2hpZnQoY29tbWVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChsYXN0ICYmIGxhc3QudHJhaWxpbmdDb21tZW50cyAmJiBsYXN0LnRyYWlsaW5nQ29tbWVudHNbMF0ucmFuZ2VbMF0gPj0gdGhpcy5yYW5nZVsxXSkge1xuICAgICAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzID0gbGFzdC50cmFpbGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgbGFzdC50cmFpbGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gRWF0aW5nIHRoZSBzdGFjay5cbiAgICAgICAgICAgIGlmIChsYXN0KSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKGxhc3QgJiYgbGFzdC5yYW5nZVswXSA+PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgIGxhc3RDaGlsZCA9IGxhc3Q7XG4gICAgICAgICAgICAgICAgICAgIGxhc3QgPSBib3R0b21SaWdodC5wb3AoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChsYXN0Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICBpZiAobGFzdENoaWxkLmxlYWRpbmdDb21tZW50cyAmJiBsYXN0Q2hpbGQubGVhZGluZ0NvbW1lbnRzW2xhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHMubGVuZ3RoIC0gMV0ucmFuZ2VbMV0gPD0gdGhpcy5yYW5nZVswXSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxlYWRpbmdDb21tZW50cyA9IGxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHM7XG4gICAgICAgICAgICAgICAgICAgIGxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHMgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChleHRyYS5sZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGxlYWRpbmdDb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGZvciAoaSA9IGV4dHJhLmxlYWRpbmdDb21tZW50cy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gZXh0cmEubGVhZGluZ0NvbW1lbnRzW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVsxXSA8PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMudW5zaGlmdChjb21tZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgaWYgKGxlYWRpbmdDb21tZW50cyAmJiBsZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubGVhZGluZ0NvbW1lbnRzID0gbGVhZGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRyYWlsaW5nQ29tbWVudHMgJiYgdHJhaWxpbmdDb21tZW50cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy50cmFpbGluZ0NvbW1lbnRzID0gdHJhaWxpbmdDb21tZW50cztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYm90dG9tUmlnaHQucHVzaCh0aGlzKTtcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2g6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmIChleHRyYS5yYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMucmFuZ2VbMV0gPSBsYXN0SW5kZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEubG9jKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2MuZW5kID0ge1xuICAgICAgICAgICAgICAgICAgICBsaW5lOiBsYXN0TGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uOiBsYXN0SW5kZXggLSBsYXN0TGluZVN0YXJ0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuc291cmNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9jLnNvdXJjZSA9IGV4dHJhLnNvdXJjZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChleHRyYS5hdHRhY2hDb21tZW50KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzQ29tbWVudCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5RXhwcmVzc2lvbjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5UGF0dGVybjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlQYXR0ZXJuO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycm93RnVuY3Rpb25FeHByZXNzaW9uOiBmdW5jdGlvbiAocGFyYW1zLCBkZWZhdWx0cywgYm9keSwgZXhwcmVzc2lvbikge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFycm93RnVuY3Rpb25FeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50RXhwcmVzc2lvbjogZnVuY3Rpb24gKG9wZXJhdG9yLCBsZWZ0LCByaWdodCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFzc2lnbm1lbnRFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5vcGVyYXRvciA9IG9wZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5sZWZ0ID0gbGVmdDtcbiAgICAgICAgICAgIHRoaXMucmlnaHQgPSByaWdodDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50UGF0dGVybjogZnVuY3Rpb24gKGxlZnQsIHJpZ2h0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXNzaWdubWVudFBhdHRlcm47XG4gICAgICAgICAgICB0aGlzLmxlZnQgPSBsZWZ0O1xuICAgICAgICAgICAgdGhpcy5yaWdodCA9IHJpZ2h0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJpbmFyeUV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgbGVmdCwgcmlnaHQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IChvcGVyYXRvciA9PT0gJ3x8JyB8fCBvcGVyYXRvciA9PT0gJyYmJykgPyBTeW50YXguTG9naWNhbEV4cHJlc3Npb24gOiBTeW50YXguQmluYXJ5RXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMub3BlcmF0b3IgPSBvcGVyYXRvcjtcbiAgICAgICAgICAgIHRoaXMubGVmdCA9IGxlZnQ7XG4gICAgICAgICAgICB0aGlzLnJpZ2h0ID0gcmlnaHQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQmxvY2tTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQmxvY2tTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmJvZHkgPSBib2R5O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJyZWFrU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5CcmVha1N0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDYWxsRXhwcmVzc2lvbjogZnVuY3Rpb24gKGNhbGxlZSwgYXJncykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhbGxFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5jYWxsZWUgPSBjYWxsZWU7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50cyA9IGFyZ3M7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2F0Y2hDbGF1c2U6IGZ1bmN0aW9uIChwYXJhbSwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhdGNoQ2xhdXNlO1xuICAgICAgICAgICAgdGhpcy5wYXJhbSA9IHBhcmFtO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0JvZHk6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQ2xhc3NCb2R5O1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0RlY2xhcmF0aW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0RlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IGlkO1xuICAgICAgICAgICAgdGhpcy5zdXBlckNsYXNzID0gc3VwZXJDbGFzcztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2xhc3NFeHByZXNzaW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0V4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnN1cGVyQ2xhc3MgPSBzdXBlckNsYXNzO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDb25kaXRpb25hbEV4cHJlc3Npb246IGZ1bmN0aW9uICh0ZXN0LCBjb25zZXF1ZW50LCBhbHRlcm5hdGUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db25kaXRpb25hbEV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5jb25zZXF1ZW50ID0gY29uc2VxdWVudDtcbiAgICAgICAgICAgIHRoaXMuYWx0ZXJuYXRlID0gYWx0ZXJuYXRlO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaENvbnRpbnVlU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db250aW51ZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hEZWJ1Z2dlclN0YXRlbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkRlYnVnZ2VyU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaERvV2hpbGVTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5LCB0ZXN0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRG9XaGlsZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEVtcHR5U3RhdGVtZW50OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRW1wdHlTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwcmVzc2lvblN0YXRlbWVudDogZnVuY3Rpb24gKGV4cHJlc3Npb24pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHByZXNzaW9uU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hGb3JTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChpbml0LCB0ZXN0LCB1cGRhdGUsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Gb3JTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmluaXQgPSBpbml0O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMudXBkYXRlID0gdXBkYXRlO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hGb3JJblN0YXRlbWVudDogZnVuY3Rpb24gKGxlZnQsIHJpZ2h0LCBib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRm9ySW5TdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmxlZnQgPSBsZWZ0O1xuICAgICAgICAgICAgdGhpcy5yaWdodCA9IHJpZ2h0O1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZWFjaCA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEZ1bmN0aW9uRGVjbGFyYXRpb246IGZ1bmN0aW9uIChpZCwgcGFyYW1zLCBkZWZhdWx0cywgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkZ1bmN0aW9uRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRnVuY3Rpb25FeHByZXNzaW9uOiBmdW5jdGlvbiAoaWQsIHBhcmFtcywgZGVmYXVsdHMsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5GdW5jdGlvbkV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSWRlbnRpZmllcjogZnVuY3Rpb24gKG5hbWUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JZGVudGlmaWVyO1xuICAgICAgICAgICAgdGhpcy5uYW1lID0gbmFtZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJZlN0YXRlbWVudDogZnVuY3Rpb24gKHRlc3QsIGNvbnNlcXVlbnQsIGFsdGVybmF0ZSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LklmU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMuY29uc2VxdWVudCA9IGNvbnNlcXVlbnQ7XG4gICAgICAgICAgICB0aGlzLmFsdGVybmF0ZSA9IGFsdGVybmF0ZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMYWJlbGVkU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MYWJlbGVkU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5sYWJlbCA9IGxhYmVsO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMaXRlcmFsOiBmdW5jdGlvbiAodG9rZW4pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MaXRlcmFsO1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHRva2VuLnZhbHVlO1xuICAgICAgICAgICAgdGhpcy5yYXcgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQsIHRva2VuLmVuZCk7XG4gICAgICAgICAgICBpZiAodG9rZW4ucmVnZXgpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZ2V4ID0gdG9rZW4ucmVnZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTWVtYmVyRXhwcmVzc2lvbjogZnVuY3Rpb24gKGFjY2Vzc29yLCBvYmplY3QsIHByb3BlcnR5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguTWVtYmVyRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuY29tcHV0ZWQgPSBhY2Nlc3NvciA9PT0gJ1snO1xuICAgICAgICAgICAgdGhpcy5vYmplY3QgPSBvYmplY3Q7XG4gICAgICAgICAgICB0aGlzLnByb3BlcnR5ID0gcHJvcGVydHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTmV3RXhwcmVzc2lvbjogZnVuY3Rpb24gKGNhbGxlZSwgYXJncykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4Lk5ld0V4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmNhbGxlZSA9IGNhbGxlZTtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnRzID0gYXJncztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hPYmplY3RFeHByZXNzaW9uOiBmdW5jdGlvbiAocHJvcGVydGllcykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4Lk9iamVjdEV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLnByb3BlcnRpZXMgPSBwcm9wZXJ0aWVzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaE9iamVjdFBhdHRlcm46IGZ1bmN0aW9uIChwcm9wZXJ0aWVzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguT2JqZWN0UGF0dGVybjtcbiAgICAgICAgICAgIHRoaXMucHJvcGVydGllcyA9IHByb3BlcnRpZXM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoUG9zdGZpeEV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5VcGRhdGVFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5vcGVyYXRvciA9IG9wZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5hcmd1bWVudCA9IGFyZ3VtZW50O1xuICAgICAgICAgICAgdGhpcy5wcmVmaXggPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hQcm9ncmFtOiBmdW5jdGlvbiAoYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlByb2dyYW07XG4gICAgICAgICAgICB0aGlzLmJvZHkgPSBib2R5O1xuICAgICAgICAgICAgaWYgKHNvdXJjZVR5cGUgPT09ICdtb2R1bGUnKSB7XG4gICAgICAgICAgICAgICAgLy8gdmVyeSByZXN0cmljdGl2ZSBmb3Igbm93XG4gICAgICAgICAgICAgICAgdGhpcy5zb3VyY2VUeXBlID0gc291cmNlVHlwZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hQcm9wZXJ0eTogZnVuY3Rpb24gKGtpbmQsIGtleSwgY29tcHV0ZWQsIHZhbHVlLCBtZXRob2QsIHNob3J0aGFuZCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlByb3BlcnR5O1xuICAgICAgICAgICAgdGhpcy5rZXkgPSBrZXk7XG4gICAgICAgICAgICB0aGlzLmNvbXB1dGVkID0gY29tcHV0ZWQ7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG4gICAgICAgICAgICB0aGlzLmtpbmQgPSBraW5kO1xuICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBtZXRob2Q7XG4gICAgICAgICAgICB0aGlzLnNob3J0aGFuZCA9IHNob3J0aGFuZDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hSZXN0RWxlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguUmVzdEVsZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoUmV0dXJuU3RhdGVtZW50OiBmdW5jdGlvbiAoYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5SZXR1cm5TdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uOiBmdW5jdGlvbiAoZXhwcmVzc2lvbnMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5TZXF1ZW5jZUV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmV4cHJlc3Npb25zID0gZXhwcmVzc2lvbnM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoU3ByZWFkRWxlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguU3ByZWFkRWxlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hTd2l0Y2hDYXNlOiBmdW5jdGlvbiAodGVzdCwgY29uc2VxdWVudCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlN3aXRjaENhc2U7XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5jb25zZXF1ZW50ID0gY29uc2VxdWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hTdXBlcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlN1cGVyO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFN3aXRjaFN0YXRlbWVudDogZnVuY3Rpb24gKGRpc2NyaW1pbmFudCwgY2FzZXMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Td2l0Y2hTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmRpc2NyaW1pbmFudCA9IGRpc2NyaW1pbmFudDtcbiAgICAgICAgICAgIHRoaXMuY2FzZXMgPSBjYXNlcztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUYWdnZWRUZW1wbGF0ZUV4cHJlc3Npb246IGZ1bmN0aW9uICh0YWcsIHF1YXNpKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVGFnZ2VkVGVtcGxhdGVFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy50YWcgPSB0YWc7XG4gICAgICAgICAgICB0aGlzLnF1YXNpID0gcXVhc2k7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVGVtcGxhdGVFbGVtZW50OiBmdW5jdGlvbiAodmFsdWUsIHRhaWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UZW1wbGF0ZUVsZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG4gICAgICAgICAgICB0aGlzLnRhaWwgPSB0YWlsO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFRlbXBsYXRlTGl0ZXJhbDogZnVuY3Rpb24gKHF1YXNpcywgZXhwcmVzc2lvbnMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UZW1wbGF0ZUxpdGVyYWw7XG4gICAgICAgICAgICB0aGlzLnF1YXNpcyA9IHF1YXNpcztcbiAgICAgICAgICAgIHRoaXMuZXhwcmVzc2lvbnMgPSBleHByZXNzaW9ucztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUaGlzRXhwcmVzc2lvbjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlRoaXNFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFRocm93U3RhdGVtZW50OiBmdW5jdGlvbiAoYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UaHJvd1N0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUcnlTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChibG9jaywgaGFuZGxlciwgZmluYWxpemVyKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVHJ5U3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5ibG9jayA9IGJsb2NrO1xuICAgICAgICAgICAgdGhpcy5ndWFyZGVkSGFuZGxlcnMgPSBbXTtcbiAgICAgICAgICAgIHRoaXMuaGFuZGxlcnMgPSBoYW5kbGVyID8gWyBoYW5kbGVyIF0gOiBbXTtcbiAgICAgICAgICAgIHRoaXMuaGFuZGxlciA9IGhhbmRsZXI7XG4gICAgICAgICAgICB0aGlzLmZpbmFsaXplciA9IGZpbmFsaXplcjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hVbmFyeUV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IChvcGVyYXRvciA9PT0gJysrJyB8fCBvcGVyYXRvciA9PT0gJy0tJykgPyBTeW50YXguVXBkYXRlRXhwcmVzc2lvbiA6IFN5bnRheC5VbmFyeUV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLm9wZXJhdG9yID0gb3BlcmF0b3I7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLnByZWZpeCA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9ucykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlZhcmlhYmxlRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9ucyA9IGRlY2xhcmF0aW9ucztcbiAgICAgICAgICAgIHRoaXMua2luZCA9ICd2YXInO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaExleGljYWxEZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9ucywga2luZCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlZhcmlhYmxlRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9ucyA9IGRlY2xhcmF0aW9ucztcbiAgICAgICAgICAgIHRoaXMua2luZCA9IGtpbmQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVmFyaWFibGVEZWNsYXJhdG9yOiBmdW5jdGlvbiAoaWQsIGluaXQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5WYXJpYWJsZURlY2xhcmF0b3I7XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLmluaXQgPSBpbml0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFdoaWxlU3RhdGVtZW50OiBmdW5jdGlvbiAodGVzdCwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LldoaWxlU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoV2l0aFN0YXRlbWVudDogZnVuY3Rpb24gKG9iamVjdCwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LldpdGhTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLm9iamVjdCA9IG9iamVjdDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0U3BlY2lmaWVyOiBmdW5jdGlvbiAobG9jYWwsIGV4cG9ydGVkKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0U3BlY2lmaWVyO1xuICAgICAgICAgICAgdGhpcy5leHBvcnRlZCA9IGV4cG9ydGVkIHx8IGxvY2FsO1xuICAgICAgICAgICAgdGhpcy5sb2NhbCA9IGxvY2FsO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEltcG9ydERlZmF1bHRTcGVjaWZpZXI6IGZ1bmN0aW9uIChsb2NhbCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkltcG9ydERlZmF1bHRTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWw7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSW1wb3J0TmFtZXNwYWNlU3BlY2lmaWVyOiBmdW5jdGlvbiAobG9jYWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnROYW1lc3BhY2VTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWw7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0TmFtZWREZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9uLCBzcGVjaWZpZXJzLCBzcmMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHBvcnROYW1lZERlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5kZWNsYXJhdGlvbiA9IGRlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5zcGVjaWZpZXJzID0gc3BlY2lmaWVycztcbiAgICAgICAgICAgIHRoaXMuc291cmNlID0gc3JjO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEV4cG9ydERlZmF1bHREZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9uKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5kZWNsYXJhdGlvbiA9IGRlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEV4cG9ydEFsbERlY2xhcmF0aW9uOiBmdW5jdGlvbiAoc3JjKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0QWxsRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLnNvdXJjZSA9IHNyYztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJbXBvcnRTcGVjaWZpZXI6IGZ1bmN0aW9uIChsb2NhbCwgaW1wb3J0ZWQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnRTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWwgfHwgaW1wb3J0ZWQ7XG4gICAgICAgICAgICB0aGlzLmltcG9ydGVkID0gaW1wb3J0ZWQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSW1wb3J0RGVjbGFyYXRpb246IGZ1bmN0aW9uIChzcGVjaWZpZXJzLCBzcmMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnREZWNsYXJhdGlvbjtcbiAgICAgICAgICAgIHRoaXMuc3BlY2lmaWVycyA9IHNwZWNpZmllcnM7XG4gICAgICAgICAgICB0aGlzLnNvdXJjZSA9IHNyYztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgIH07XG5cblxuICAgIGZ1bmN0aW9uIHJlY29yZEVycm9yKGVycm9yKSB7XG4gICAgICAgIHZhciBlLCBleGlzdGluZztcblxuICAgICAgICBmb3IgKGUgPSAwOyBlIDwgZXh0cmEuZXJyb3JzLmxlbmd0aDsgZSsrKSB7XG4gICAgICAgICAgICBleGlzdGluZyA9IGV4dHJhLmVycm9yc1tlXTtcbiAgICAgICAgICAgIC8vIFByZXZlbnQgZHVwbGljYXRlZCBlcnJvci5cbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBpZiAoZXhpc3RpbmcuaW5kZXggPT09IGVycm9yLmluZGV4ICYmIGV4aXN0aW5nLm1lc3NhZ2UgPT09IGVycm9yLm1lc3NhZ2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHRyYS5lcnJvcnMucHVzaChlcnJvcik7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY3JlYXRlRXJyb3IobGluZSwgcG9zLCBkZXNjcmlwdGlvbikge1xuICAgICAgICB2YXIgZXJyb3IgPSBuZXcgRXJyb3IoJ0xpbmUgJyArIGxpbmUgKyAnOiAnICsgZGVzY3JpcHRpb24pO1xuICAgICAgICBlcnJvci5pbmRleCA9IHBvcztcbiAgICAgICAgZXJyb3IubGluZU51bWJlciA9IGxpbmU7XG4gICAgICAgIGVycm9yLmNvbHVtbiA9IHBvcyAtIChzY2FubmluZyA/IGxpbmVTdGFydCA6IGxhc3RMaW5lU3RhcnQpICsgMTtcbiAgICAgICAgZXJyb3IuZGVzY3JpcHRpb24gPSBkZXNjcmlwdGlvbjtcbiAgICAgICAgcmV0dXJuIGVycm9yO1xuICAgIH1cblxuICAgIC8vIFRocm93IGFuIGV4Y2VwdGlvblxuXG4gICAgZnVuY3Rpb24gdGhyb3dFcnJvcihtZXNzYWdlRm9ybWF0KSB7XG4gICAgICAgIHZhciBhcmdzLCBtc2c7XG5cbiAgICAgICAgYXJncyA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7XG4gICAgICAgIG1zZyA9IG1lc3NhZ2VGb3JtYXQucmVwbGFjZSgvJShcXGQpL2csXG4gICAgICAgICAgICBm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yBhbiBleGNlcHRpb24gYmVjYXVzZSBvZiB0aGUgdG9rZW4uXG5cbiAgICBmdW5jdGlvbiB1bmV4cGVjdGVkVG9rZW5FcnJvcih0b2tlbiwgbWVzc2FnZSkge1xuICAgICAgICB2YXIgdmFsdWUsIG1zZyA9IG1lc3NhZ2UgfHwgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgIGlmICh0b2tlbikge1xuICAgICAgICAgICAgaWYgKCFtZXNzYWdlKSB7XG4gICAgICAgICAgICAgICAgbXNnID0gKHRva2VuLnR5cGUgPT09IFRva2VuLkVPRikgPyBNZXNzYWdlcy5VbmV4cGVjdGVkRU9TIDpcbiAgICAgICAgICAgICAgICAgICAgKHRva2VuLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpID8gTWVzc2FnZXMuVW5leHBlY3RlZElkZW50aWZpZXIgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uTnVtZXJpY0xpdGVyYWwpID8gTWVzc2FnZXMuVW5leHBlY3RlZE51bWJlciA6XG4gICAgICAgICAgICAgICAgICAgICh0b2tlbi50eXBlID09PSBUb2tlbi5TdHJpbmdMaXRlcmFsKSA/IE1lc3NhZ2VzLlVuZXhwZWN0ZWRTdHJpbmcgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uVGVtcGxhdGUpID8gTWVzc2FnZXMuVW5leHBlY3RlZFRlbXBsYXRlIDpcbiAgICAgICAgICAgICAgICAgICAgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRva2VuLnR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzRnV0dXJlUmVzZXJ2ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbXNnID0gTWVzc2FnZXMuVW5leHBlY3RlZF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gICAgICAgICAgb3AgPT09ICcvPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnJT0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJys9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICctPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnPDw9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICc+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJz4+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJyY9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICdePScgfHxcbiAgICAgICAgICAgIG9wID09PSAnfD0nO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbnN1bWVTZW1pY29sb24oKSB7XG4gICAgICAgIC8vIENhdGNoIHRoZSB2ZXJ5IGNvbW1vbiBjYXNlIGZpcnN0OiBpbW1lZGlhdGVseSBhIHNlbWljb2xvbiAoVSswMDNCKS5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCIHx8IG1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBGSVhNRShpa2FyaWVuYXRvcik6IHRoaXMgaXMgc2VlbWluZ2x5IGFuIGlzc3VlIGluIHRoZSBwcmV2aW91cyBsb2NhdGlvbiBpbmZvIGNvbnZlbnRpb24uXG4gICAgICAgIGxhc3RJbmRleCA9IHN0YXJ0SW5kZXg7XG4gICAgICAgIGxhc3RMaW5lTnVtYmVyID0gc3RhcnRMaW5lTnVtYmVyO1xuICAgICAgICBsYXN0TGluZVN0YXJ0ID0gc3RhcnRMaW5lU3RhcnQ7XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBU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dubWVudFRhcmdldDtcbiAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gb2xkRmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yIHx8IGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvcjtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycmF5UGF0dGVybigpIHtcbiAgICAgICAgdmFyIG5vZGUgPSBuZXcgTm9kZSgpLCBlbGVtZW50cyA9IFtdLCByZXN0LCByZXN0Tm9kZTtcbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgd2hpbGUgKCFtYXRjaCgnXScpKSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIGVsZW1lbnRzLnB1c2gobnVsbCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLi4uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdE5vZGUgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzdCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnRzLnB1c2gocmVzdE5vZGUuZmluaXNoUmVzdEVsZW1lbnQocmVzdCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50cy5wdXNoKHBhcnNlUGF0dGVybldpdGhEZWZhdWx0KCkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIW1hdGNoKCddJykpIHtcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCcsJyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJ10nKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hBcnJheVBhdHRlcm4oZWxlbWVudHMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvcGVydHlQYXR0ZXJuKCkge1xuICAgICAgICB2YXIgbm9kZSA9IG5ldyBOb2RlKCksIGtleSwgY29tcHV0ZWQgPSBtYXRjaCgnWycpLCBpbml0O1xuICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpIHtcbiAgICAgICAgICAgIGtleSA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICBpZiAobWF0Y2goJz0nKSkge1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIGluaXQgPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvcGVydHkoXG4gICAgICAgICAgICAgICAgICAgICdpbml0Jywga2V5LCBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgbmV3IFdyYXBwaW5nTm9kZShrZXkpLmZpbmlzaEFzc2lnbm1lbnRQYXR0ZXJuKGtleSwgaW5pdCksIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKCFtYXRjaCgnOicpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvcGVydHkoJ2luaXQnLCBrZXksIGZhbHNlLCBrZXksIGZhbHNlLCB0cnVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGtleSA9IHBhcnNlT2JqZWN0UHJvcGVydHlLZXkoKTtcbiAgICAgICAgfVxuICAgICAgICBleHBlY3QoJzonKTtcbiAgICAgICAgaW5pdCA9IHBhcnNlUGF0dGVybldpdGhEZWZhdWx0KCk7XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb3BlcnR5KCdpbml0Jywga2V5LCBjb21wdXRlZCwgaW5pdCwgZmFsc2UsIGZhbHNlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU9iamVjdFBhdHRlcm4oKSB7XG4gICAgICAgIHZhciBub2RlID0gbmV3IE5vZGUoKSwgcHJvcGVydGllcyA9IFtdO1xuXG4gICAgICAgIGV4cGVjdCgneycpO1xuXG4gICAgICAgIHdoaWxlICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgcHJvcGVydGllcy5wdXNoKHBhcnNlUHJvcGVydHlQYXR0ZXJuKCkpO1xuICAgICAgICAgICAgaWYgKCFtYXRjaCgnfScpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcsJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsZXgoKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hPYmplY3RQYXR0ZXJuKHByb3BlcnRpZXMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUGF0dGVybigpIHtcbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VWYXJpYWJsZUlkZW50aWZpZXIoKTtcbiAgICAgICAgfSBlbHNlIGlmIChtYXRjaCgnWycpKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VBcnJheVBhdHRlcm4oKTtcbiAgICAgICAgfSBlbHNlIGlmIChtYXRjaCgneycpKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VPYmplY3RQYXR0ZXJuKCk7XG4gICAgICAgIH1cbiAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtcbiAgICB9XG5cbiAgICBmdW5jdGl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cihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKSk7XG5cbiAgICAgICAgICAgICAgICBpZiAoIW1hdGNoKCddJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChyZXN0U3ByZWFkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pKTtcblxuICAgICAgICAgICAgICAgIGlmICghbWF0Y2goJ10nKSkge1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsZXgoKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hBcnJheUV4cHJlc3Npb24oZWxlbWVudHMpO1xuICAgIH1cblxuICAgIC8vIDExLjEuNSBPYmplY3QgSW5pdGlhbGlzZXJcblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvcGVydHlGdW5jdGlvbihub2RlLCBwYXJhbUluZm8pIHtcbiAgICAgICAgdmFyIHByZXZpb3VzU3RyaWN0LCBib2R5O1xuXG4gICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcblxuICAgICAgICBwcmV2aW91c1N0cmljdCA9IHN0cmljdDtcbiAgICAgICAgYm9keSA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VGdW5jdGlvblNvdXJjZUVsZW1lbnRzKTtcblxuICAgICAgICBpZiAoc3RyaWN0ICYmIHBhcmFtSW5mby5maXJzdFJlc3Rya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B0b2tlbnMgYXJlIGFscmVhZHkgZmlsdGVyZWQgb3V0LlxuXG4gICAgICAgIHN3aXRjaCAodG9rZW4udHlwZSkge1xuICAgICAgICBjYXNlIFRva2VuLlN0cmluZ0xpdGVyYWw6XG4gICAgICAgIGNhc2UgVG9rZW4uTnVtZXJpY0xpdGVyYWw6XG4gICAgICAgICAgICBpZiAoc3RyaWN0ICYmIHRva2VuLm9jdGFsKSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4odG9rZW4sIE1lc3NhZ2VzLlN0cmljdE9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hMaXRlcmFsKHRva2VuKTtcbiAgICAgICAgY2FzZSBUb2tlbi5JZGVudGlmaWVyOlxuICAgICAgICBjYXNlIFRva2VuLkJvb2xlYW5MaXRlcmFsOlxuICAgICAgICBjYXNlIFRva2VuLk51bGxMaXRlcmFsOlxuICAgICAgICBjYXNlIFRva2VuLktleXdvcmQ6XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hJZGVudGlmaWVyKHRva2VuLnZhbHVlKTtcbiAgICAgICAgY2FzZSBUb2tlbi5QdW5jdHVhdG9yOlxuICAgICAgICAgICAgaWYgKHRva2VuLnZhbHVlID09PSAnWycpIHtcbiAgICAgICAgICAgICAgICBleHByID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcbiAgICAgICAgICAgICAgICBleHBlY3QoJ10nKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZXhwcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKHRva2VuKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSB7XG4gICAgICA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xuICAgIC8vIGlzIHJlc3BvbnNpYmxlIHRvIHZpc2l0IG90aGVyIG9wdGlvbnMuXG4gICAgZnVuY3Rpb24gdHJ5UGFyc2VNZXRob2REZWZpbml0aW9uKHRva2VuLCBrZXksIGNvbXB1dGVkLCBub2RlKSB7XG4gICAgICAgIHZhciB2YWx1ZSwgb3B0aW9ucywgbWV0aG9kTm9kZTtcblxuICAgICAgICBpZiAodG9rZW4udHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllcikge1xuICAgICAgICAgICAgLy8gY2hlY2sgZm9yIGBnZXRgIGFuZCBgc2V0YDtcblxuICAgICAgICAgICAgaWYgKHRva2VuLnZhbHVlID09PSAnZ2V0JyAmJiBsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSkge1xuICAgICAgICAgICAgICAgIGNvbXB1dGVkID0gbWF0Y2goJ1snKTtcbiAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgbWV0aG9kTm9kZSA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcoJyk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYXJzZVByb3BlcnR5RnVuY3Rpb24obWV0aG9kTm9kZSwge1xuICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0czogW10sXG4gICAgICAgICAgICAgICAgICAgIHN0cmljdGVkOiBudWxsLFxuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IG51bGxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnZ2V0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRva2VuLnZhbHVlID09PSAnc2V0JyAmJiBsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSkge1xuICAgICAgICAgICAgICAgIGNvbXB1dGVkID0gbWF0Y2goJ1snKTtcbiAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgbWV0aG9kTm9kZSA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcoJyk7XG5cbiAgICAgICAgICAgICAgICBvcHRpb25zID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q291bnQ6IDAsXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHRzOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkOiBudWxsLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbVNldDoge31cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnKScpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VQYXJhbShvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGVmYXVsdENvdW50ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmRlZmF1bHRzID0gW107XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhcnNlUHJvcGVydHlGdW5jdGlvbihtZXRob2ROb2RlLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnc2V0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobWF0Y2goJygnKSkge1xuICAgICAgICAgICAgdmFsdWUgPSBwYXJzZVByb3BlcnR5TWV0aG9kRnVuY3Rpb24oKTtcbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb3BlcnR5KCdpbml0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIHRydWUsIGZhbHNlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIE5vdCBhIE1ldGhvZERlZmluaXRpb24uXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrUHJvdG8oa2V5LCBjb21wdXRlZCwgaGFzUHJvdG8pIHtcbiAgICAgICAgaWYgKGNvbXB1dGVkID09PSBmYWxzZSAmJiAoa2V5LnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGtleS5uYW1lID09PSAnX19wcm90b19fJyB8fFxuICAgICAgICAgICAga2V5LnR5cGUgPT09IFN5bnRheC5MaXRlcmFsICYmIGtleS52YWx1ZSA9PT0gJ19fcHJvdG9fXycpKSB7XG4gICAgICAgICAgICBpZiAoaGFzUHJvdG8udmFsdWUpIHtcbiAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkR1cGxpY2F0ZVByb3RvUHJvcGVydHkpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBoYXNQcm90by52YWx1ZSA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU9iamVjdFByb3BlcnR5KGhhc1Byb3RvKSB7XG4gICAgICAgIHZhciB0b2tlbiA9IGxvb2thaGVhZCwgbm9kZSA9IG5ldyBOb2RlKCksIGNvbXB1dGVkLCBrZXksIG1heWJlTWV0aG9kLCB2YWx1ZTtcblxuICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgIGtleSA9IHBhcnNlT2JqZWN0UHJvcGVydHlLZXkoKTtcbiAgICAgICAgbWF5YmVNZXRob2QgPSB0cnlQYXJzZU1ldGhvZERlZmluaXRpb24odG9rZW4sIGtleSwgY29tcHV0ZWQsIG5vZGUpO1xuXG4gICAgICAgIGlmIChtYXliZU1ldGhvZCkge1xuICAgICAgICAgICAgY2hlY2tQcm90byhtYXliZU1ldGhvZC5rZXksIG1heWJlTWV0aG9kLmNvbXB1dGVkLCBoYXNQcm90byk7XG4gICAgICAgICAgICAvLyBmaW5pc2hlZFxuICAgICAgICAgICAgcmV0dXJuIG1heWJlTWV0aG9kO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gaW5pdCBwcm9wZXJ0eSBvciBzaG9ydCBoYW5kIHByb3BlcnR5LlxuICAgICAgICBjaGVja1Byb3RvKGtleSwgY29tcHV0ZWQsIGhhc1Byb3RvKTtcblxuICAgICAgICBpZiAobWF0Y2goJzonKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICB2YWx1ZSA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnaW5pdCcsIGtleSwgY29tcHV0ZWQsIHZhbHVlLCBmYWxzZSwgZmFsc2UpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRva2VuLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnPScpKSB7XG4gICAgICAgICAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gbG9va2FoZWFkO1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIHZhbHVlID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnaW5pdCcsIGtleSwgY29tcHV0ZWQsXG4gICAgICAgICAgICAgICAgICAgIG5ldyBXcmFwcGluZ05vZGUodG9rZW4pLmZpbmlzaEFzc2lnbm1lbnRQYXR0ZXJuKGtleSwgdmFsdWUpLCBmYWxzZSwgdHJ1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnaW5pdCcsIGtleSwgY29tcHV0ZWQsIGtleSwgZmFsc2UsIHRydWUpO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU9iamVjdEluaXRpYWxpc2VyKCkge1xuICAgICAgICB2YXIgcHJvcGVydGllcyA9IFtdLCBoYXNQcm90byA9IHt2YWx1ZTogZmFsc2V9LCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcblxuICAgICAgICB3aGlsZSAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIHByb3BlcnRpZXMucHVzaChwYXJzZU9iamVjdFByb3BlcnR5KGhhc1Byb3RvKSk7XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgICAgIGV4cGVjdENvbW1hU2VwYXJhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJ30nKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hPYmplY3RFeHByZXNzaW9uKHByb3BlcnRpZXMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHJlaW50ZXJwcmV0RXhwcmVzc2lvbkFzUGF0dGVybihleHByKSB7XG4gICAgICAgIHZhciBpO1xuICAgICAgICBzd2l0Y2ggKGV4cHIudHlwZSkge1xuICAgICAgICBjYXNlIFN5bnRheC5JZGVudGlmaWVyOlxuICAgICAgICBjYXNlIFN5bnRheC5NZW1iZXJFeHByZXNzaW9uOlxuICAgICAgICBjYXNlIFN5bnRheC5SZXN0RWxlbWVudDpcbiAgICAgICAgY2FzZSBTeW50YXguQXNzaWdubWVudFBhdHRlcm46XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguU3ByZWFkRWxlbWVudDpcbiAgICAgICAgICAgIGV4cHIudHlwZSA9IFN5bnRheC5SZXN0RWxlbWVudDtcbiAgICAgICAgICAgIHJlaW50ZXJwcmV0RXhwcmVzc2lvbkFzUGF0dGVybihleHByLmFyZ3VtZW50KTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5BcnJheUV4cHJlc3Npb246XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguQXJyYXlQYXR0ZXJuO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cHIuZWxlbWVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAoZXhwci5lbGVtZW50c1tpXSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5lbGVtZW50c1tpXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4Lk9iamVjdEV4cHJlc3Npb246XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguT2JqZWN0UGF0dGVybjtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHByLnByb3BlcnRpZXMubGVu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gdmFyIHF1YXNpLCBxdWFzaXMsIGV4cHJlc3Npb25zLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBxdWFzaSA9IHBhcnNlVGVtcGxhdGVFbGVtZW50KHsgaGVhZDogdHJ1ZSB9KTtcbiAgICAgICAgcXVhc2lzID0gWyBxdWFzaSBdO1xuICAgICAgICBleHByZXNzaW9ucyA9IFtdO1xuXG4gICAgICAgIHdoaWxlICghcXVhc2kudGFpbCkge1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChwYXJzZUV4cHJlc3Npb24oKSk7XG4gICAgICAgICAgICBxdWFzaSA9IHBhcnNlVGVtcGxhdGVFbGVtZW50KHsgaGVhZDogZmFsc2UgfSk7XG4gICAgICAgICAgICBxdWFzaXMucHVzaChxdWFzaSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hUZW1wbGF0ZUxpdGVyYWwocXVhc2lzLCBleHByZXNzaW9ucyk7XG4gICAgfVxuXG4gICAgLy8gMTEuMS42IFRoZSBHcm91cGluZyBPcGVyYXRvclxuXG4gICAgZnVuY3Rpb24gcGFyc2VHcm91cEV4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciBleHByLCBleHByZXNzaW9ucywgc3RhcnRUb2tlbiwgaTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBpZiAobWF0Y2goJyknKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCc9PicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcixcbiAgICAgICAgICAgICAgICBwYXJhbXM6IFtdXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgc3RhcnRUb2tlbiA9IGxvb2thaGVhZDtcbiAgICAgICAgaWYgKG1hdGNoKCcuLi4nKSkge1xuICAgICAgICAgICAgZXhwciA9IHBhcnNlUmVzdEVsZW1lbnQoKTtcbiAgICAgICAgICAgIGV4cGVjdCgnKScpO1xuICAgICAgICAgICAgaWYgKCFtYXRjaCgnPT4nKSkge1xuICAgICAgICAgICAgICAgIGV4cGVjdCgnPT4nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgdHlwZTogUGxhY2VIb2xkZXJzLkFycm93UGFyYW1ldGVyUGxhY2VIb2xkZXIsXG4gICAgICAgICAgICAgICAgcGFyYW1zOiBbZXhwcl1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gdHJ1ZTtcbiAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG5cbiAgICAgICAgaWYgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGZhbHNlO1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMgPSBbZXhwcl07XG5cbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsZXgoKTtcblxuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLi4uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc0JpbmRpbmdFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGV4cHJlc3Npb25zLnB1c2gocGFyc2VSZXN0RWxlbWVudCgpKTtcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghbWF0Y2goJz0+JykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdCgnPT4nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHByZXNzaW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHJlc3Npb25zW2ldKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogUGxhY2VIb2xkZXJzLkFycm93UGFyYW1ldGVyUGxhY2VIb2xkZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IGV4cHJlc3Npb25zXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uKGV4cHJlc3Npb25zKTtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgaWYgKG1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICBpZiAoIWlzQmluZGluZ0VsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoZXhwci50eXBlID09PSBTeW50YXguU2VxdWVuY2VFeHByZXNzaW9uKSB7XG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cHIuZXhwcmVzc2lvbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIuZXhwcmVzc2lvbnNbaV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHByID0ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFBsYWNlSG9sZGVycy5BcnJvd1BhcmFtZXRlclBsYWNlSG9sZGVyLFxuICAgICAgICAgICAgICAgIHBhcmFtczogZXhwci50eXBlID09PSBTeW50YXguU2VxdWVuY2VFeHByZXNzaW9uID8gZXhwci5leHByZXNzaW9ucyA6IFtleHByXVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuXG4gICAgLy8gMTEuMSBQcmltYXJ5IEV4cHJlc3Npb25zXG5cbiAgICBmdW5jdGlvbiBwYXJzZVByaW1hcnlFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgdHlwZSwgdG9rZW4sIGV4cHIsIG5vZGU7XG5cbiAgICAgICAgaWYgKG1hdGNoKCcoJykpIHtcbiAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgIHJldHVybiBpbmhlcml0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dFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdmdW5jdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRnVuY3Rpb25FeHByZXNzaW9uKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCd0aGlzJykpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hUaGlzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG1hdGNoS2V5d29yZCgnY2xhc3MnKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUNsYXNzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obGV4KCkpO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLkJvb2xlYW5MaXRlcmFsKSB7XG4gICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgdG9rZW4udmFsdWUgPSAodG9rZW4udmFsdWUgPT09ICd0cnVlJyk7XG4gICAgICAgICAgICBleHByID0gbm9kZS5maW5pc2hMaXRlcmFsKHRva2VuKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlID09PSBUb2tlbi5OdWxsTGl0ZXJhbCkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgdG9rZW4gPSBsZXgoKTtcbiAgICAgICAgICAgIHRva2VuLnZhbHVlID0gbnVsbDtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcvJykgfHwgbWF0Y2goJy89JykpIHtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgIGluZGV4ID0gc3RhcnRJbmRleDtcblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS50b2tlbnMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBzY2FuUmVnRXhwKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLlRlbXBsYXRlKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VUZW1wbGF0ZUxpdGVyYWwoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxleCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuICAgIC8vIDExLjIgTGVmdC1IYW5kLVNpZGUgRXhwcmVzc2lvbnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlQXJndW1lbnRzKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdO1xuXG4gICAgICAgIGV4cGVjdCgnKCcpO1xuXG4gICAgICAgIGlmICghbWF0Y2goJyknKSkge1xuICAgICAgICAgICAgd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBhcmdzLnB1c2goaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKSk7XG4gICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGV4cGVjdENvbW1hU2VwYXJhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICByZXR1cm4gYXJncztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkUHJvcGVydHkoKSB7XG4gICAgICAgIHZhciB0b2tlbiwgbm9kZSA9IG5ldyBOb2RlKCk7XG5cbiAgICAgICAgdG9rZW4gPSBsZXgoKTtcblxuICAgICAgICBpZiAoIWlzSWRlbnRpZmllck5hbWUodG9rZW4pKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hJZGVudGlmaWVyKHRva2VuLnZhbHVlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCkge1xuICAgICAgICBleHBlY3QoJy4nKTtcblxuICAgICAgICByZXR1cm4gcGFyc2VOb25Db21wdXRlZFByb3BlcnR5KCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb21wdXRlZE1lbWJlcigpIHtcbiAgICAgICAgdmFyIGV4cHI7XG5cbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgZXhwciA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VFeHByZXNzaW9uKTtcblxuICAgICAgICBleHBlY3QoJ10nKTtcblxuICAgICAgICByZXR1cm4gZXhwcjtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5ld0V4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciBjYWxsZWUsIGFy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mhlcml0Q292ZXJHcmFtbWFyKG1hdGNoS2V5d29yZCgnbmV3JykgPyBwYXJzZU5ld0V4cHJlc3Npb24gOiBwYXJzZVByaW1hcnlFeHByZXNzaW9uKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoOzspIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnLicpKSB7XG4gICAgICAgICAgICAgICAgaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgcHJvcGVydHkgPSBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoTWVtYmVyRXhwcmVzc2lvbignLicsIGV4cHIsIHByb3BlcnR5KTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJygnKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBhcmdzID0gcGFyc2VBcmd1bWVudHMoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hDYWxsRXhwcmVzc2lvbihleHByLCBhcmdzKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJ1snKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHByb3BlcnR5ID0gcGFyc2VDb21wdXRlZE1lbWJlcigpO1xuICAgICAgICAgICAgICAgIGV4cHIgPSBuZXcgV3JhcHBpbm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goJy4nKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBleHByID0gaW5oZXJpdENvdmVyR3JhbW1hcihtYXRjaEtleXdvcmQoJ25ldycpID8gcGFyc2VOZXdFeHByZXNzaW9uIDogcGFyc2VQcmltYXJ5RXhwcmVzc2lvbik7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKDs7KSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJ1snKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHByb3BlcnR5ID0gcGFyc2VDb21wdXRlZE1lbWJlcigpO1xuICAgICAgICAgICAgICAgIGV4cHIgPSBuZXcgV3JhcHBpbmdOb2RlKHN0YXJ0VG9rZW4pLmZpbmlzaE1lbWJlckV4cHJlc3Npb24oJ1snLCBleHByLCBwcm9wZXJ0eSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcuJykpIHtcbiAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0eSA9IHBhcnNlTm9uQ29tcHV0ZWRNZW1iZXIoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hNZW1iZXJFeHByZXNzaW9uKCcuJywgZXhwciwgcHJvcGVydHkpO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uVGVtcGxhdGUgJiYgbG9va2FoZWFkLmhlY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gICAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkludmFsaWRMSFNJbkFzc2lnbm1lbnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICAgIHRva2VuID0gbGV4KCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoUG9zdGZpeEV4cHJlc3Npb24odG9rZW4udmFsdWUsIGV4cHIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGV4cHI7XG4gICAgfVxuXG4gICAgLy8gMTEuNCBVbmFyeSBPcGVyYXRvcnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlVW5hcnlFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgdG9rZW4sIGV4cHIsIHN0YXJ0VG9rZW47XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5QdW5jdHVhdG9yICYmIGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VQb3N0Zml4RXhwcmVzc2lvbigpO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcrKycpIHx8IG1hdGNoKCctLScpKSB7XG4gICAgICAgICAgICBzdGFydFRva2VuID0gbG9va2FoZWFkO1xuICAgICAgICAgICAgdG9rZW4gPSBsZXgoKTtcbiAgICAgICAgICAgIGV4cHIgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlVW5hcnlFeHByZXNzaW9uKTtcbiAgICAgICAgICAgIC8vIDExLjQuNCwgMTEuNC41XG4gICAgICAgICAgICBpZiAoc3RyaWN0ICYmIGV4cHIudHlwZSA9PT0gU3ludGF4LklkZW50aWZpZXIgJiYgaXNSZXN0cmljdGVkV29yZChleHByLm5hbWUpKSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5TdHJpY3RMSFNQcmVmaXgpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIWlzQXNzaWdubWVudFRhcmdldCkge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlRXJyb3IoTWVzc2FnZXMuSW52YWxpZExIU0luQXNzaWdubWVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hVbmFyeUV4cHJlc3Npb24odG9rZW4udmFsdWUsIGV4cHIpO1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcrJykgfHwgbWF0Y2goJy0nKSB8fCBtYXRjaCgnficpIHx8IG1hdGNoKCchJykpIHtcbiAgICAgICAgICAgIHN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VVbmFyeUV4cHJlc3Npb24pO1xuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoVW5hcnlFeHByZXNzaW9uKHRva2VuLnZhbHVlLCBleHByKTtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChtYXRjaEtleXdvcmQoJ2RlbGV0ZScpIHx8IG1hdGNoS2V5d29yZCgndm9pZCcpIHx8IG1hdGNoS2V5d29yZCgndHlwZW9mJykpIHtcbiAgICAgICAgICAgIHN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VVbmFyeUV4cHJlc3Npb24pO1xuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoVW5hcnlFeHByZXNzaW9uKHRva2VuLnZhbHVlLCBleHByKTtcbiAgICAgICAgICAgIGlmIChzdHJpY3QgJiYgZXhwci5vcGVyYXRvciA9PT0gJ2RlbGV0ZScgJiYgZXhwci5hcmd1bWVudC50eXBlID09PSBTeW50YXguSWRlbnRpZmllcikge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlRXJyb3IoTWVzc2FnZXMuU3RyaWN0RGVsZXRlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGV4cHIgPSBwYXJzZVBvc3RmaXhFeHByZXNzaW9uKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZXhwcjtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBiaW5hcnlQcmVjZWRlbmNlKHRva2VuLCBhbGxvd0luKSB7XG4gICAgICAgIHZhciBwcmVjID0gMDtcblxuICAgICAgICBpZiAodG9rZW4udHlwZSAhPT0gVG9rZW4uUHVuY3R1YXRvciAmJiB0b2tlbi50eXBlICE9PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgfVxuXG4gICAgICAgIHN3aXRjaCAodG9rZW4udmFsdWUpIHtcbiAgICAgICAgY2FzZSAnfHwnOlxuICAgICAgICAgICAgcHJlYyA9IDE7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICcmJic6XG4gICAgICAgICAgICBwcmVjID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ3wnOlxuICAgICAgICAgICAgcHJlYyA9IDM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdeJzpcbiAgICAgICAgICAgIHByZWMgPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnJic6XG4gICAgICAgICAgICBwcmVjID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJz09JzpcbiAgICAgICAgY2FzZSAnIT0nOlxuICAgICAgICBjYXNlICc9PT0nOlxuICAgICAgICBjYXNlICchPT0nOlxuICAgICAgICAgICAgcHJlYyA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICc8JzpcbiAgICAgICAgY2FzZSAnPic6XG4gICAgICAgIGNhc2UgJzw9JzpcbiAgICAgICAgY2FzZSAnPj0nOlxuICAgICAgICBjYXNlICdpbnN0YW5jZW9mJzpcbiAgICAgICAgICAgIHByZWMgPSA3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnaW4nOlxuICAgICAgICAgICAgcHJlYyA9IGFsbG93SW4gPyA3IDogMDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJzw8JzpcbiAgICAgICAgY2FzZSAnPj4nOlxuICAgICAgICBjYXNlICc+Pj4nOlxuICAgICAgICAgICAgcHJlYyA9IDg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICcrJzpcbiAgICAgICAgY2FzZSAnLSc6XG4gICAgICAgICAgICBwcmVjID0gOTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJyonOlxuICAgICAgICBjYXNlICcvJzpcbiAgICAgICAgY2FzZSAnJSc6XG4gICAgICAgICAgICBwcmVjID0gMTE7XG4gICAgICAgICAgICBicmVhaztcblxuICAgIC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AgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4LlJlc3RFbGVtZW50OlxuICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0uYXJndW1lbnQpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4LkFzc2lnbm1lbnRQYXR0ZXJuOlxuICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0ubGVmdCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguQXJyYXlQYXR0ZXJuOlxuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBhcmFtLmVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtLmVsZW1lbnRzW2ldICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGNoZWNrUGF0dGVyblBhcmFtKG9wdGlvbnMsIHBhcmFtLmVsZW1lbnRzW2ldKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGFzc2VydChwYXJhbS50eXBlID09PSBTeW50YXguT2JqZWN0UGF0dGVybiwgJ0ludmFsaWQgdHlwZScpO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBhcmFtLnByb3BlcnRpZXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbS5wcm9wZXJ0aWVzW2ldLnZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgfVxuICAgIGZ1bmN0aW9uIHJlaW50ZXJwcmV0QXNDb3ZlckZvcm1hbHNMaXN0KGV4cHIpIHtcbiAgICAgICAgdmFyIGksIGxlbiwgcGFyYW0sIHBhcmFtcywgZGVmYXVsdHMsIGRlZmF1bHRDb3VudCwgb3B0aW9ucywgdG9rZW47XG5cbiAgICAgICAgZGVmYXVsdHMgPSBbXTtcbiAgICAgICAgZGVmYXVsdENvdW50ID0gMDtcbiAgICAgICAgcGFyYW1zID0gW2V4cHJdO1xuXG4gICAgICAgIHN3aXRjaCAoZXhwci50eXBlKSB7XG4gICAgICAgIGNhc2UgU3ludGF4LklkZW50aWZpZXI6XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcjpcbiAgICAgICAgICAgIHBhcmFtcyA9IGV4cHIucGFyYW1zO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuXG4gICAgICAgIG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBwYXJhbVNldDoge31cbiAgICAgICAgfTtcblxuICAgICAgICBmb3IgKGkgPSAwLCBsZW4gPSBwYXJhbXMubGVuZ3RoOyBpIDwgbGVuOyBpICs9IDEpIHtcbiAgICAgICAgICAgIHBhcmFtID0gcGFyYW1zW2ldO1xuICAgICAgICAgICAgc3dpdGNoIChwYXJhbS50eXBlKSB7XG4gICAgICAgICAgICBjYXNlIFN5bnRheC5Bc3NpZ25tZW50UGF0dGVybjpcbiAgICAgICAgICAgICAgICBwYXJhbXNbaV0gPSBwYXJhbS5sZWZ0O1xuICAgICAgICAgICAgICAgIGRlZmF1bHRzLnB1c2gocGFyYW0ucmlnaHQpO1xuICAgICAgICAgICAgICAgICsrZGVmYXVsdENvdW50O1xuICAgICAgICAgICAgICAgIGNoZWNrUGF0dGVyblBhcmFtKG9wdGlvbnMsIHBhcmFtLmxlZnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbSk7XG4gICAgICAgICAgICAgICAgcGFyYW1zW2ldID0gcGFyYW07XG4gICAgICAgICAgICAgICAgZGVmYXVsdHMucHVzaChudWxsKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChvcHRpb25zLm1lc3NhZ2UgPT09IE1lc3NhZ2VzLlN0cmljdFBhcmFtRHVwZSkge1xuICAgICAgICAgICAgdG9rZW4gPSBzdHJpY3QgPyBvcHRpb25zLnN0cmljdGVkIDogb3B0aW9ucy5maXJzdFJlc3RyaWN0ZWQ7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbiwgb3B0aW9ucy5tZXNzYWdlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChkZWZhdWx0Q291bnQgPT09IDApIHtcbiAgICAgICAgICAgIGRlZmF1bHRzID0gW107XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgcGFyYW1zOiBwYXJhbXMsXG4gICAgICAgICAgICBkZWZhdWx0czogZGVmYXVsdHMsXG4gICAgICAgICAgICBzdHJpY3RlZDogb3B0aW9ucy5zdHJpY3RlZCxcbiAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZDogb3B0aW9ucy5maXJzdFJlc3RyaWN0ZWQsXG4gICAgICAgICAgICBtZXNzYWdlOiBvcHRpb25zLm1lc3NhZ2VcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycm93RnVuY3Rpb25FeHByZXNzaW9uKG9wdGlvbnMsIG5vZGUpIHtcbiAgICAgICAgdmFyIHByZXZpb3VzU3RyaWN0LCBib2R5O1xuXG4gICAgICAgIGlmIChoYXNMaW5lVGVybWluYXRvcikge1xuICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG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PSBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlciB8fCBtYXRjaCgnPT4nKSkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgbGlzdCA9IHJlaW50ZXJwcmV0QXNDb3ZlckZvcm1hbHNMaXN0KGV4cHIpO1xuXG4gICAgICAgICAgICBpZiAobGlzdCkge1xuICAgICAgICAgICAgICAgIGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvciA9IG51bGw7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQXJyb3dGdW5jdGlvbkV4cHJlc3Npb24obGlzdCwgbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBleHByO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG1hdGNoQXNzaWduKCkpIHtcbiAgICAgICAgICAgIGlmICghaXNBc3NpZ25tZW50VGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5JbnZhbGlkTEhTSW5Bc3NpZ25tZW50KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gMTEuMTMuMVxuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBleHByLnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGlzUmVzdHJpY3RlZFdvcmQoZXhwci5uYW1lKSkge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5TdHJpY3RMSFNBc3NpZ25tZW50KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFtYXRjaCgnPScpKSB7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwcik7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRva2VuID0gbGV4KCk7XG4gICAgICAgICAgICByaWdodCA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hBc3NpZ25tZW50RXhwcmVzc2lvbih0b2tlbi52YWx1ZSwgZXhwciwgcmlnaHQpO1xuICAgICAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gbnVsbDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuICAgIC8vIDExLjE0IENvbW1hIE9wZXJhdG9yXG5cbiAgICBmdW5jdGlvbiBwYXJzZUV4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciBleHByLCBzdGFydFRva2VuID0gbG9va2FoZWFkLCBleHByZXNzaW9ucztcblxuICAgICAgICBleHByID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcblxuICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMgPSBbZXhwcl07XG5cbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICBleHByZXNzaW9ucy5wdXNoKGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hTZXF1ZW5jZUV4cHJlc3Npb24oZXhwcmVzc2lvbnMpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGV4cHI7XG4gICAgfVxuXG4gICAgLy8gMTIuMSBCbG9ja1xuXG4gICAgZnVuY3Rpb24gcGFyc2VTdGF0ZW1lbnRMaXN0SXRlbSgpIHtcbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKGxvb2thaGVhZC52YWx1ZSkge1xuICAgICAgICAgICAgY2FzZSAnZXhwb3J0JzpcbiAgICAgICAgICAgICAgICBpZiAoc291cmNlVHlwZSAhPT0gJ21vZHVsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkLCBNZXNzYWdlcy5JbGxlZ2FsRXhwb3J0RGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VFeHBvcnREZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgY2FzZSAnaW1wb3J0JzpcbiAgICAgICAgICAgICAgICBpZiAoc291cmNlVHlwZSAhPT0gJ21vZHVsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkLCBNZXNzYWdlcy5JbGxlZ2FsSW1wb3J0RGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbXBvcnREZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgY2FzZSAnY29uc3QnOlxuICAgICAgICAgICAgY2FzZSAnbGV0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VMZXhpY2FsRGVjbGFyYXRpb24oe2luRm9yOiBmYWxzZX0pO1xuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUZ1bmN0aW9uRGVjbGFyYXRpb24obmV3IE5vZGUoKSk7XG4gICAgICAgICAgICBjYXNlICdjbGFzcyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQ2xhc3NEZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHBhcnNlU3RhdGVtZW50KCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VTdGF0ZW1lbnRMaXN0KCkge1xuICAgICAgICB2YXIgbGlzdCA9IFtdO1xuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgaWYgKG1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxpc3QucHVzaChwYXJzZVN0YXRlbWVudExpc3RJdGVtKCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGxpc3Q7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VCbG9jaygpIHtcbiAgICAgICAgdmFyIGJsb2NrLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcblxuICAgICAgICBibG9jayA9IHBhcnNlU3RhdGVtZW50TGlzdCgpO1xuXG4gICAgICAgIGV4cGVjdCgnfScpO1xuXG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaEJsb2NrU3RhdGVtZW50KGJsb2NrKTtcbiAgICB9XG5cbiAgICAvLyAxMi4yIFZhcmlhYmxlIFN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VWYXJpYWJsZUlkZW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tcbiAgICAgICAgfSBlbHNlIGlmIChpZC50eXBlICE9PSBTeW50YXguSWRlbnRpZmllcikge1xuICAgICAgICAgICAgZXhwZWN0KCc9Jyk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hWYXJpYWJsZURlY2xhcmF0b3IoaWQsIGluaXQpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbkxpc3QoKSB7XG4gICAgICAgIHZhciBsaXN0ID0gW107XG5cbiAgICAgICAgZG8ge1xuICAgICAgICAgICAgbGlzdC5wdXNoKHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbigpKTtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgIH0gd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpO1xuXG4gICAgICAgIHJldHVybiBsaXN0O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlVmFyaWFibGVTdGF0ZW1lbnQobm9kZSkge1xuICAgICAgICB2YXIgZGVjbGFyYXRpb25zO1xuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ3ZhcicpO1xuXG4gICAgICAgIGRlY2xhcmF0aW9ucyA9IHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbkxpc3QoKTtcblxuICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG5cbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlTGV4aWNhbEJpbmRpbmcoa2luZCwgb3B0aW9ucykge1xuICAgICAgICB2YXIgaW5pdCA9IG51bGwsIGlkLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBpZCA9I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gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaFZhcmlhYmxlRGVjbGFyYXRpb24ocGFyc2VWYXJpYWJsZURlY2xhcmF0aW9uTGlzdCgpKTtcbiAgICAgICAgICAgICAgICBzdGF0ZS5hbGxvd0luID0gcHJldmlvdXNBbGxvd0luO1xuXG4gICAgICAgICAgICAgICAgaWYgKGluaXQuZGVjbGFyYXRpb25zLmxlbmd0aCA9PT0gMSAmJiBtYXRjaEtleXdvcmQoJ2luJykpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJzsnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoS2V5d29yZCgnY29uc3QnKSB8fCBtYXRjaEtleXdvcmQoJ2xldCcpKSB7XG4gICAgICAgICAgICAgICAgaW5pdCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAga2luZCA9IGxleCgpLnZhbHVlO1xuXG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGRlY2xhcmF0aW9ucyA9IHBhcnNlQmluZGluZ0xpc3Qoa2luZCwge2luRm9yOiB0cnVlfSk7XG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IHByZXZpb3VzQWxsb3dJbjtcblxuICAgICAgICAgICAgICAgIGlmIChkZWNsYXJhdGlvbnMubGVuZ3RoID09PSAxICYmIGRlY2xhcmF0aW9uc1swXS5pbml0ID09PSBudWxsICYmIG1hdGNoS2V5d29yZCgnaW4nKSkge1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gaW5pdC5maW5pc2hMZXhpY2FsRGVjbGFyYXRpb24oZGVjbGFyYXRpb25zLCBraW5kKTtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaExleGljYWxEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMsIGtpbmQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5pdFN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGluaXQgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93SW4gPSBwcmV2aW91c0FsbG93SW47XG5cbiAgICAgICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdpbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNBc3NpZ25tZW50VGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkludmFsaWRMSFNJbkZvckluKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oaW5pdCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNlcSA9IFtpbml0XTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNlcS5wdXNoKGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdCA9IG5ldyBXcmFwcGluZ05vZGUoaW5pdFN0YXJ0VG9rZW4pLmZpbmlzaFNlcXVlbmNlRXhwcmVzc2lvbihpbml0U2VxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJzsnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodHlwZW9mIGxlZnQgPT09ICd1bmRlZmluZWQnKSB7XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJzsnKSkge1xuICAgICAgICAgICAgICAgIHRlc3QgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGV4cGVjdCgnOycpO1xuXG4gICAgICAgICAgICBpZiAoIW1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgICAgICB1cGRhdGUgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdCgnKScpO1xuXG4gICAgICAgIG9sZEluSXRlcmF0aW9uID0gc3RhdGUuaW5JdGVyYXRpb247XG4gICAgICAgIHN0YXRlLmluSXRlcmF0aW9uID0gdHJ1ZTtcblxuICAgICAgICBib2R5ID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZVN0YXRlbWVudCk7XG5cbiAgICAgICAgc3RhdGUuaW5JdGVyYXRpb24gPSBvbGRJbkl0ZXJhdGlvbjtcblxuICAgICAgICByZXR1cm4gKHR5cGVvZiBsZWZ0ID09PSAndW5kZWZpbmVkJykgP1xuICAgICAgICAgICAgICAgIG5vZGUuZmluaXNoRm9yU3RhdGVtZW50KGluaXQsIHRlc3QsIHVwZGF0ZSwgYm9keSkgOlxuICAgICAgICAgICAgICAgIG5vZGUuZmluaXNoRm9ySW5TdGF0ZW1lbnQobGVmdCwgcmlnaHQsIGJvZHkpO1xuICAgIH1cblxuICAgIC8vIDEyLjcgVGhlIGNvbnRpbnVlIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb250aW51ZVN0YXRlbWVudChub2RlKSB7XG4gICAgICAgIHZhciBsYWJlbCA9IG51bGwsIGtleTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdjb250aW51ZScpO1xuXG4gICAgICAgIC8vIE9wdGltaXplIHRoZSBtb3N0IGNvbW1vbiBmb3JtOiAnY29udGludWU7Jy5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCKSB7XG4gICAgICAgICAgICBsZXgoKTtcblxuICAgICAgICAgICAgaWYgKCFzdGF0ZS5pbkl0ZXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbENvbnRpbnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQ29udGludWVTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIGlmICghc3RhdGUuaW5JdGVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaENvbnRpbnVlU3RhdGVtZW50KG51bGwpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICBsYWJlbCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG5cbiAgICAgICAgICAgIGtleSA9ICckJyArIGxhYmVsLm5hbWU7XG4gICAgICAgICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChzdGF0ZS5sYWJlbFNldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuVW5rbm93bkxhYmVsLCBsYWJlbC5uYW1lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICBpZiAobGFiZWwgPT09IG51bGwgJiYgIXN0YXRlLmluSXRlcmF0aW9uKSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hDb250aW51ZVN0YXRlbWVudChsYWJlbCk7XG4gICAgfVxuXG4gICAgLy8gMTIuOCBUaGUgYnJlYWsgc3RhdGVtZW50XG5cbiAgICBmdW5jdGlvbiBwYXJzZUJyZWFrU3RhdGVtZW50KG5vZGUpIHtcbiAgICAgICAgdmFyIGxhYmVsID0gbnVsbCwga2V5O1xuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ2JyZWFrJyk7XG5cbiAgICAgICAgLy8gQ2F0Y2ggdGhlIHZlcnkgY29tbW9uIGNhc2UgZmlyc3Q6IGltbWVkaWF0ZWx5IGEgc2VtaWNvbG9uIChVKzAwM0IpLlxuICAgICAgICBpZiAoc291cmNlLmNoYXJDb2RlQXQobGFzdEluZGV4KSA9PT0gMHgzQikge1xuICAgICAgICAgICAgbGV4KCk7XG5cbiAgICAgICAgICAgIGlmICghKHN0YXRlLmluSXRlcmF0aW9uIHx8IHN0YXRlLmluU3dpdGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbEJyZWFrKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQnJlYWtTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIGlmICghKHN0YXRlLmluSXRlcmF0aW9uIHx8IHN0YXRlLmluU3dpdGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbEJyZWFrKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQnJlYWtTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpIHtcbiAgICAgICAgICAgIGxhYmVsID0gcGFyc2VWYXJpYWJsZUlkZW50aWZpZXIoKTtcblxuICAgICAgICAgICAga2V5ID0gJyQnICsgbGFiZWwubmFtZTtcbiAgICAgICAgICAgIGlmICghT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ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lRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQoYXJndW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICAvLyBIQUNLXG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJ30nKSAmJiBsb29rYWhlYWQudHlwZSAhPT0gVG9rZW4uRU9GKSB7XG4gICAgICAgICAgICAgICAgYXJndW1lbnQgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQoYXJndW1lbnQpO1xuICAgIH1cblxuICAgIC8vIDEyLjEwIFRoZSB3aXRoIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VXaXRoU3RhdGVtZW50KG5vZGUpIHtcbiAgICAgICAgdmFyIG9iamVjdCwgYm9keTtcblxuICAgICAgICBpZiAoc3RyaWN0KSB7XG4gICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLlN0cmljdE1vZGVXaXRoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ3dpdGgnKTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBvYmplY3QgPSBwYXJzZUV4cHJlc3Npb24oKTtcblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICBib2R5ID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ltaW5hbnQsIGNhc2VzLCBjbGF1c2UsIG9sZEluU3dpdGNoLCBkZWZhdWx0Rm91bmQ7XG5cbiAgICAgICAgZXhwZWN0S2V5d29yZCgnc3dpdGNoJyk7XG5cbiAgICAgICAgZXhwZWN0KCcoJyk7XG5cbiAgICAgICAgZGlzY3JpbWluYW50ID0gcGFyc2VFeHByZXNzaW9uKCk7XG5cbiAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgZXhwZWN0KCd7Jyk7XG5cbiAgICAgICAgY2FzZXMgPSBbXTtcblxuICAgICAgICBpZiAobWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hTd2l0Y2hTdGF0ZW1lbnQoZGlzY3JpbWluYW50LCBjYXNlcyk7XG4gICAgICAgIH1cblxuICAgICAgICBvbGRJblN3aXRjaCA9IHN0YXRlLmluU3dpdGNoO1xuICAgICAgICBzdGF0ZS5pblN3aXRjaCA9IHRydWU7XG4gICAgICAgIGRlZmF1bHRGb3VuZCA9IGZhbHNlO1xuXG4gICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2xhdXNlID0gcGFyc2VTd2l0Y2hDYXNlKCk7XG4gICAgICAgICAgICBpZiAoY2xhdXNlLnRlc3QgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAoZGVmYXVsdEZvdW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuTXVsdGlwbGVEZWZhdWx0c0luU3dpdGNoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZGVmYXVsdEZvdW5kID0gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2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nZ2VyIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VEZWJ1Z2dlclN0YXRlbWVudChub2RlKSB7XG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ2RlYnVnZ2VyJyk7XG5cbiAgICAgICAgY29uc3VtZVNlbWljb2xvbigpO1xuXG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaERlYnVnZ2VyU3RhdGVtZW50KCk7XG4gICAgfVxuXG4gICAgLy8gMTIgU3RhdGVtZW50c1xuXG4gICAgZnVuY3Rpb24gcGFyc2VTdGF0ZW1lbnQoKSB7XG4gICAgICAgIHZhciB0eXBlID0gbG9va2FoZWFkLnR5cGUsXG4gICAgICAgICAgICBleHByLFxuICAgICAgICAgICAgbGFiZWxlZEJvZHksXG4gICAgICAgICAgICBrZXksXG4gICAgICAgICAgICBub2RlO1xuXG4gICAgICAgIGlmICh0eXBlID09PSBUb2tlbi5FT0YpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodHlwZSA9PT0gVG9rZW4uUHVuY3R1YXRvciAmJiBsb29rYWhlYWQudmFsdWUgPT09ICd7Jykge1xuICAgICAgICAgICAgcmV0dXJuIHBhcnNlQmxvY2soKTtcbiAgICAgICAgfVxuICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gdHJ1ZTtcbiAgICAgICAgbm9kZSA9IG5ldyBOb2RlKCk7XG5cbiAgICAgICAgaWYgKHR5cGUgPT09IFRva2VuLlB1bmN0dWF0b3IpIHtcbiAgICAgICAgICAgIHN3aXRjaCAobG9va2FoZWFkLnZhbHVlKSB7XG4gICAgICAgICAgICBjYXNlICc7JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VFbXB0eVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJygnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUV4cHJlc3Npb25TdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgIHN3aXRjaCAobG9va2FoZWFkLnZhbHVlKSB7XG4gICAgICAgICAgICBjYXNlICdicmVhayc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQnJlYWtTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdjb250aW51ZSc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQ29udGludWVTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdkZWJ1Z2dlcic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRGVidWdnZXJTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdkbyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRG9XaGlsZVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2Zvcic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRm9yU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUZ1bmN0aW9uRGVjbGFyYXRpb24obm9kZSk7XG4gICAgICAgICAgICBjYXNlICdpZic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSWZTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdyZXR1cm4nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVJldHVyblN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ3N3aXRjaCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlU3dpdGNoU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAndGhyb3cnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVRocm93U3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAndHJ5JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VUcnlTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd2YXInOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVZhcmlhYmxlU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnd2hpbGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVdoaWxlU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnd2l0aCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlV2l0aFN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHByID0gcGFyc2VFeHByZXNzaW9uKCk7XG5cbiAgICAgICAgLy8gMTIuMTIgTGFiZWxsZWQgU3RhdGVtZW50c1xuICAgICAgICBpZiAoKGV4cHIudHlwZSA9PT0gU3ludGF4LklkZW50aWZpZXIpICYmIG1hdGNoKCc6JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuXG4gICAgICAgICAgICBrZXkgPSAnJCcgKyBleHByLm5hbWU7XG4gICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHN0YXRlLmxhYmVsU2V0LCBrZXkpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3dFcnJvcihNZXNzYWdlcy5SZWRlY2xhcmF0aW9uLCAnTGFiZWwnLCBleHByLm5hbWUpO1xuICAgICAgICAgICAgfVxuXG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S5wdXNoKHN0YXRlbWVudCk7XG4gICAgICAgICAgICBpZiAoc3RhdGVtZW50LmV4cHJlc3Npb24udHlwZSAhPT0gU3ludGF4LkxpdGVyYWwpIHtcbiAgICAgICAgICAgICAgICAvLyB0aGlzIGlzIG5vdCBkaXJlY3RpdmVcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRpcmVjdGl2ZSA9IHNvdXJjZS5zbGljZSh0b2tlbi5zdGFydCArIDEsIHRva2VuLmVuZCAtIDEpO1xuICAgICAgICAgICAgaWYgKGRpcmVjdGl2ZSA9PT0gJ3VzZSBzdHJpY3QnKSB7XG4gICAgICAgICAgICAgICAgc3RyaWN0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RSZXN0cmljdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKGZpcnN0UmVzdHJpY3RlZCwgTWVzc2FnZXMuU3RyaWN0T2N0YWxMaXRlcmFsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICghZmlyc3RSZXN0cmljdGVkICYmIHRva2VuLm9jdGFsKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZCA9IHRva2VuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG9sZExhYmVsU2V0ID0gc3RhdGUubGFiZWxTZXQ7XG4gICAgICAgIG9sZEluSXRlcmF0aW9uID0gc3RhdGUuaW5JdGVyYXRpb247XG4gICAgICAgIG9sZEluU3dpdGNoID0gc3RhdGUuaW5Td2l0Y2g7XG4gICAgICAgIG9sZEluRnVuY3Rpb25Cb2R5ID0gc3RhdGUuaW5GdW5jdGlvbkJvZHk7XG4gICAgICAgIG9sZFBhcmVudGhlc2lzQ291bnQgPSBzdGF0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VmKTtcblxuICAgICAgICByZXR1cm4gIW1hdGNoKCcpJyk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VQYXJhbXMoZmlyc3RSZXN0cmljdGVkKSB7XG4gICAgICAgIHZhciBvcHRpb25zO1xuXG4gICAgICAgIG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgZGVmYXVsdENvdW50OiAwLFxuICAgICAgICAgICAgZGVmYXVsdHM6IFtdLFxuICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkOiBmaXJzdFJlc3RyaWN0ZWRcbiAgICAgICAgfTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBpZiAoIW1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgIG9wdGlvbnMucGFyYW1TZXQgPSB7fTtcbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwYXJzZVBhcmFtKG9wdGlvbnMpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdCgnKScpO1xuXG4gICAgICAgIGlmIChvcHRpb25zLmRlZmF1bHRDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgb3B0aW9ucy5kZWZhdWx0cyA9IFtdO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHBhcmFtczogb3B0aW9ucy5wYXJhbXMsXG4gICAgICAgICAgICBkZWZhdWx0czogb3B0aW9ucy5kZWZhdWx0cyxcbiAgICAgICAgICAgIHN0cmljdGVkOiBvcHRpb25zLnN0cmljdGVkLFxuICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkOiBvcHRpb25zLmZpcnN0UmVzdHJpY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biAgICAgICAgdmFyIGNsYXNzQm9keSwgdG9rZW4sIGlzU3RhdGljLCBoYXNDb25zdHJ1Y3RvciA9IGZhbHNlLCBib2R5LCBtZXRob2QsIGNvbXB1dGVkLCBrZXk7XG5cbiAgICAgICAgY2xhc3NCb2R5ID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcbiAgICAgICAgYm9keSA9IFtdO1xuICAgICAgICB3aGlsZSAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnOycpKSB7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG1ldGhvZCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgaXNTdGF0aWMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICAgICAga2V5ID0gcGFyc2VPYmplY3RQcm9wZXJ0eUtleSgpO1xuICAgICAgICAgICAgICAgIGlmIChrZXkubmFtZSA9PT0gJ3N0YXRpYycgJiYgbG9va2FoZWFkUHJvcGVydHlOYW1lKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgICAgIGlzU3RhdGljID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWQgPSBtYXRjaCgnWycpO1xuICAgICAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG1ldGhvZCA9IHRyeVBhcnNlTWV0aG9kRGVmaW5pdGlvbih0b2tlbiwga2V5LCBjb21wdXRlZCwgbWV0aG9kKTtcbiAgICAgICAgICAgICAgICBpZiAobWV0aG9kKSB7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZFsnc3RhdGljJ10gPSBpc1N0YXRpYztcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kID09PSAnaW5pdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ21ldGhvZCc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc1N0YXRpYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtZXRob2QuY29tcHV0ZWQgJiYgKG1ldGhvZC5rZXkubmFtZSB8fCBtZXRob2Qua2V5LnZhbHVlLnRvU3RyaW5nKCkpID09PSAnY29uc3RydWN0b3InKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kICE9PSAnbWV0aG9kJyB8fCAhbWV0aG9kLm1ldGhvZCB8fCBtZXRob2QudmFsdWUuZ2VuZXJhdG9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5Db25zdHJ1Y3RvclNwZWNpYWxNZXRob2QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGFzQ29uc3RydWN0b3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4odG9rZW4sIE1lc3NhZ2VzLkR1cGxpY2F0ZUNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNDb25zdHJ1Y3RvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ2NvbnN0cnVjdG9yJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbWV0aG9kLmNvbXB1dGVkICYmIChtZXRob2Qua2V5Lm5hbWUgfHwgbWV0aG9kLmtleS52YWx1ZS50b1N0cmluZygpKSA9PT0gJ3Byb3RvdHlwZScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RhdGljUHJvdG90eXBlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBtZXRob2QudHlwZSA9IFN5bnRheC5NZXRob2REZWZpbml0aW9uO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgbWV0aG9kLm1ldGhvZDtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG1ldGhvZC5zaG9ydGhhbmQ7XG4gICAgICAgICAgICAgICAgICAgIGJvZHkucHVzaChtZXRob2QpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxleCgpO1xuICAgICAgICByZXR1cm4gY2xhc3NCb2R5LmZpbmlzaENsYXNzQm9keShib2R5KTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUNsYXNzRGVjbGFyYXRpb24oaWRlbnRpZmllcklzT3B0aW9uYWwpIHtcbiAgICAgICAgdmFyIGlkID0gbnVsbCwgc3VwZXJDbGFzcyA9IG51bGwsIGNsYXNzTm9kZSA9IG5ldyBOb2RlKCksIGNsYXNzQm9keSwgcHJldmlvdXNTdHJpY3QgPSBzdHJpY3Q7XG4g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AgICAgICAgICAgIGRlZiA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIGxvY2FsID0gZGVmLmZpbmlzaElkZW50aWZpZXIoJ2RlZmF1bHQnKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGxvY2FsID0gcGFyc2VWYXJpYWJsZUlkZW50aWZpZXIoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWF0Y2hDb250ZXh0dWFsS2V5d29yZCgnYXMnKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBleHBvcnRlZCA9IHBhcnNlTm9uQ29tcHV0ZWRQcm9wZXJ0eSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydFNwZWNpZmllcihsb2NhbCwgZXhwb3J0ZWQpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlRXhwb3J0TmFtZWREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIHZhciBkZWNsYXJhdGlvbiA9IG51bGwsXG4gICAgICAgICAgICBpc0V4cG9ydEZyb21JZGVudGlmaWVyLFxuICAgICAgICAgICAgc3JjID0gbnVsbCwgc3BlY2lmaWVycyA9IFtdO1xuXG4gICAgICAgIC8vIG5vbi1kZWZhdWx0IGV4cG9ydFxuICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgIC8vIGNvdmVyczpcbiAgICAgICAgICAgIC8vIGV4cG9ydCB2YXIgZiA9IDE7XG4gICAgICAgICAgICBzd2l0Y2ggKGxvb2thaGVhZC52YWx1ZSkge1xuICAgICAgICAgICAgICAgIGNhc2UgJ2xldCc6XG4gICAgICAgICAgICAgICAgY2FzZSAnY29uc3QnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ3Zhcic6XG4gICAgICAgICAgICAgICAgY2FzZSAnY2xhc3MnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ2Z1bmN0aW9uJzpcbiAgICAgICAgICAgICAgICAgICAgZGVjbGFyYXRpb24gPSBwYXJzZVN0YXRlbWVudExpc3RJdGVtKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydE5hbWVkRGVjbGFyYXRpb24oZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIG51bGwpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCd7Jyk7XG4gICAgICAgIGlmICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlzRXhwb3J0RnJvbUlkZW50aWZpZXIgPSBpc0V4cG9ydEZyb21JZGVudGlmaWVyIHx8IG1hdGNoS2V5d29yZCgnZGVmYXVsdCcpO1xuICAgICAgICAgICAgICAgIHNwZWNpZmllcnMucHVzaChwYXJzZUV4cG9ydFNwZWNpZmllcigpKTtcbiAgICAgICAgICAgIH0gd2hpbGUgKG1hdGNoKCcsJykgJiYgbGV4KCkpO1xuICAgICAgICB9XG4gICAgICAgIGV4cGVjdCgnfScpO1xuXG4gICAgICAgIGlmIChtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdmcm9tJykpIHtcbiAgICAgICAgICAgIC8vIGNvdmVyaW5nOlxuICAgICAgICAgICAgLy8gZXhwb3J0IHtkZWZhdWx0fSBmcm9tICdmb28nO1xuICAgICAgICAgICAgLy8gZXhwb3J0IHtmb299IGZyb20gJ2Zvbyc7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIHNyYyA9IHBhcnNlTW9kdWxlU3BlY2lmaWVyKCk7XG4gICAgICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG4gICAgICAgIH0gZWxzZSBpZiAoaXNFeHBvcnRGcm9tSWRlbnRpZmllcikge1xuICAgICAgICAgICAgLy8gY292ZXJpbmc6XG4gICAgICAgICAgICAvLyBleHBvcnQ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3RLZXl3b3JkKCdpbXBvcnQnKTtcbiAgICAgICAgc3BlY2lmaWVycyA9IFtdO1xuXG4gICAgICAgIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uU3RyaW5nTGl0ZXJhbCkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0ICdmb28nO1xuICAgICAgICAgICAgc3JjID0gcGFyc2VNb2R1bGVTcGVjaWZpZXIoKTtcbiAgICAgICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEltcG9ydERlY2xhcmF0aW9uKHNwZWNpZmllcnMsIHNyYyk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW1hdGNoS2V5d29yZCgnZGVmYXVsdCcpICYmIGlzSWRlbnRpZmllck5hbWUobG9va2FoZWFkKSkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0IGZvb1xuICAgICAgICAgICAgLy8gaW1wb3J0IGZvbywgLi4uXG4gICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VJbXBvcnREZWZhdWx0U3BlY2lmaWVyKCkpO1xuICAgICAgICAgICAgaWYgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAobWF0Y2goJyonKSkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0IGZvbywgKiBhcyBmb29cbiAgICAgICAgICAgIC8vIGltcG9ydCAqIGFzIGZvb1xuICAgICAgICAgICAgc3BlY2lmaWVycy5wdXNoKHBhcnNlSW1wb3J0TmFtZXNwYWNlU3BlY2lmaWVyKCkpO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCd7JykpIHtcbiAgICAgICAgICAgIC8vIGNvdmVyczpcbiAgICAgIC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TtcbiAgICAgICAgICAgIGJvZHkucHVzaChzdGF0ZW1lbnQpO1xuICAgICAgICAgICAgaWYgKHN0YXRlbWVudC5leHByZXNzaW9uLnR5cGUgIT09IFN5bnRheC5MaXRlcmFsKSB7XG4gICAgICAgICAgICAgICAgLy8gdGhpcyBpcyBub3QgZGlyZWN0aXZlXG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkaXJlY3RpdmUgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQgKyAxLCB0b2tlbi5lbmQgLSAxKTtcbiAgICAgICAgICAgIGlmIChkaXJlY3RpdmUgPT09ICd1c2Ugc3RyaWN0Jykge1xuICAgICAgICAgICAgICAgIHN0cmljdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0UmVzdHJpY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbihmaXJzdFJlc3RyaWN0ZWQsIE1lc3NhZ2VzLlN0cmljdE9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAoIWZpcnN0UmVzdHJpY3RlZCAmJiB0b2tlbi5vY3RhbCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQgPSB0b2tlbjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgc3RhdGVtZW50ID0gcGFyc2VTdGF0ZW1lbnRMaXN0SXRlbSgpO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICAgICAgICBpZiAodHlwZW9mIHN0YXRlbWVudCA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJvZHkucHVzaChzdGF0ZW1lbnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBib2R5O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvZ3JhbSgpIHtcbiAgICAgICAgdmFyIGJvZHksIG5vZGU7XG5cbiAgICAgICAgcGVlaygpO1xuICAgICAgICBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBib2R5ID0gcGFyc2VTY3JpcHRCb2R5KCk7XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb2dyYW0oYm9keSk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZmlsdGVyVG9rZW5Mb2NhdGlvbigpIHtcbiAgICAgICAgdmFyIGksIGVudHJ5LCB0b2tlbiwgdG9rZW5zID0gW107XG5cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4dHJhLnRva2Vucy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgZW50cnkgPSBleHRyYS50b2tlbnNbaV07XG4gICAgICAgICAgICB0b2tlbiA9IHtcbiAgICAgICAgICAgICAgICB0eXBlOiBlbnRyeS50eXBlLFxuICAgICAgICAgICAgICAgIHZhbHVlOiBlbnRyeS52YWx1ZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChlbnRyeS5yZWdleCkge1xuICAgICAgICAgICAgICAgIHRva2VuLnJlZ2V4ID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiBlbnRyeS5yZWdleC5wYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogZW50cnkucmVnZXguZmxhZ3NcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGV4dHJhLnJhbmdlKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4ucmFuZ2UgPSBlbnRyeS5yYW5nZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChleHRyYS5sb2MpIHtcbiAgICAgICAgICAgICAgICB0b2tlbi5sb2MgPSBlbnRyeS5sb2M7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0b2tlbnMucHVzaCh0b2tlbik7XG4gICAgICAgIH1cblxuICAgICAgICBleHRyYS50b2tlbnMgPSB0b2tlbnM7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gdG9rZW5pemUoY29kZSwgb3B0aW9ucykge1xuICAgICAgICB2YXIgdG9TdHJpbmcsXG4gICAgICAgICAgICB0b2tlbnM7XG5cbiAgICAgICAgdG9TdHJpbmcgPSBTdHJpbmc7XG4gICAgICAgIGlmICh0eXBlb2YgY29kZSAhPT0gJ3N0cmluZycgJiYgIShjb2RlIGluc3RhbmNlb2YgU3RyaW5nKSkge1xuICAgICAgICAgICAgY29kZSA9IHRvU3RyaW5nKGNvZGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgc291cmNlID0gY29kZTtcbiAgICAgICAgaW5kZXggPSAwO1xuICAgICAgICBsaW5lTnVtYmVyID0gKHNvdXJjZS5sZW5ndGggPiAwKSA/IDEgOiAwO1xuICAgICAgICBsaW5lU3RhcnQgPSAwO1xuICAgICAgICBzdGFydEluZGV4ID0gaW5kZXg7XG4gICAgICAgIHN0YXJ0TGluZU51bWJlciA9IGxpbmVOdW1iZXI7XG4gICAgICAgIHN0YXJ0TGluZVN0YXJ0ID0gbGluZVN0YXJ0O1xuICAgICAgICBsZW5ndGggPSBzb3VyY2UubGVuZ3RoO1xuICAgICAgICBsb29rYWhlYWQgPSBudWxsO1xuICAgICAgICBzdGF0ZSA9IHtcbiAgICAgICAgICAgIGFsbG93SW46IHRydWUsXG4gICAgICAgICAgICBsYWJlbFNldDoge30sXG4gICAgICAgICAgICBpbkZ1bmN0aW9uQm9keTogZmFsc2UsXG4gICAgICAgICAgICBpbkl0ZXJhdGlvbjogZmFsc2UsXG4gICAgICAgICAgICBpblN3aXRjaDogZmFsc2UsXG4gICAgIC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ICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwZWVrKCk7XG4gICAgICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLkVPRikge1xuICAgICAgICAgICAgICAgIHJldHVybiBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgd2hpbGUgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5FT0YpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChsZXhFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmEuZXJyb3JzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWNvcmRFcnJvcihsZXhFcnJvcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBoYXZlIHRvIGJyZWFrIG9uIHRoZSBmaXJzdCBlcnJvclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gYXZvaWQgaW5maW5pdGUgbG9vcHMuXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGxleEVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmaWx0ZXJUb2tlbkxvY2F0aW9uKCk7XG4gICAgICAgICAgICB0b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmNvbW1lbnRzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgIHRva2Vucy5jb21tZW50cyA9IGV4dHJhLmNvbW1lbnRzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS5lcnJvcnMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdG9rZW5zLmVycm9ycyA9IGV4dHJhLmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGV4dHJhID0ge307XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRva2VucztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZShjb2RlLCBvcHRpb25zKSB7XG4gICAgICAgIHZhciBwcm9ncmFtLCB0b1N0cmluZztcblxuICAgICAgICB0b1N0cmluZyA9IFN0cmluZztcbiAgICAgICAgaWYgKHR5cGVvZiBjb2RlICE9PSAnc3RyaW5nJyAmJiAhKGNvZGUgaW5zdGFuY2VvZiBTdHJpbmcpKSB7XG4gICAgICAgICAgICBjb2RlID0gdG9TdHJpbmcoY29kZSk7XG4gICAgICAgIH1cblxuICAgICAgICBzb3VyY2UgPSBjb2RlO1xuICAgICAgICBpbmRleCA9IDA7XG4gICAgICAgIGxpbmVOdW1iZXIgPSAoc291cmNlLmxlbmd0aCA+IDApID8gMSA6IDA7XG4gICAgICAgIGxpbmVTdGFydCA9IDA7XG4gICAgICAgIHN0YXJ0SW5kZXggPSBpbmRleDtcbiAgICAgICAgc3RhcnRMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgc3RhcnRMaW5lU3RhcnQgPSBsaW5lU3RhcnQ7XG4gICAgICAgIGxlbmd0aCA9IHNvdXJjZS5sZW5ndGg7XG4gICAgICAgIGxvb2thaGVhZCA9IG51bGw7XG4gICAgICAgIHN0YXRlID0ge1xuICAgICAgICAgICAgYWxsb3dJbjogdHJ1ZSxcbiAgICAgICAgICAgIGxhYmVsU2V0OiB7fSxcbiAgICAgICAgICAgIGluRnVuY3Rpb25Cb2R5OiBmYWxzZSxcbiAgICAgICAgICAgIGluSXRlcmF0a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gJ2Jvb2xlYW4nICYmIG9wdGlvbnMuY29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLmNvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMudG9sZXJhbnQgPT09ICdib29sZWFuJyAmJiBvcHRpb25zLnRvbGVyYW50KSB7XG4gICAgICAgICAgICAgICAgZXh0cmEuZXJyb3JzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEuYXR0YWNoQ29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLnJhbmdlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBleHRyYS5jb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGV4dHJhLmJvdHRvbVJpZ2h0U3RhY2sgPSBbXTtcbiAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICAgICAgZXh0cmEubGVhZGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5zb3VyY2VUeXBlID09PSAnbW9kdWxlJykge1xuICAgICAgICAgICAgICAgIC8vIHZlcnkgcmVzdHJpY3RpdmUgY29uZGl0aW9uIGZvciBub3dcbiAgICAgICAgICAgICAgICBzb3VyY2VUeXBlID0gb3B0aW9ucy5zb3VyY2VUeXBlO1xuICAgICAgICAgICAgICAgIHN0cmljdCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcHJvZ3JhbSA9IHBhcnNlUHJvZ3JhbSgpO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS5jb21tZW50cyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmNvbW1lbnRzID0gZXh0cmEuY29tbWVudHM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLnRva2VucyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBmaWx0ZXJUb2tlbkxvY2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgcHJvZ3JhbS50b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmVycm9ycyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmVycm9ycyA9IGV4dHJhLmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGV4dHJhID0ge307XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcHJvZ3JhbTtcbiAgICB9XG5cbiAgICAvLyBTeW5jIHdpdGggKi5qc29uIG1hbmlmZXN0cy5cbiAgICBleHBvcnRzLnZlcnNpb24gPSAnMi4yLjAnO1xuXG4gICAgZXhwb3J0cy50b2tlbml6ZSA9IHRva2VuaXplO1xuXG4gICAgZXhwb3J0cy5wYXJzZSA9IHBhcnNlO1xuXG4gICAgLy8gRGVlcCBjb3B5LlxuICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgZXhwb3J0cy5TeW50YXggPSAoZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgbmFtZSwgdHlwZXMgPSB7fTtcblxuICAgICAgICBpZiAodHlwZW9mIE9iamVjdC5jcmVhdGUgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIHR5cGVzID0gT2JqZWN0LmNyZWF0ZShudWxsKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAobmFtZSBpbiBTeW50YXgpIHtcbiAgICAgICAgICAgIGlmIChTeW50YXguaGFzT3duUHJvc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cnR5IGFuZCB0aGUgYGNvbnN0cnVjdG9yYCBwcm9wZXJ0eSBvZiBhXG4gIC8vIHByb3RvdHlwZSBkZWZhdWx0cyB0byBub24tZW51bWVyYWJsZS5cbiAgZm9yICh2YXIga2V5IGluIG9iamVjdCkge1xuICAgIGlmICghKHNraXBQcm90byAmJiBrZXkgPT0gJ3Byb3RvdHlwZScpICYmXG4gICAgICAgICEoc2tpcEVycm9yUHJvcHMgJiYgKGtleSA9PSAnbWVzc2FnZScgfHwga2V5ID09ICduYW1lJykpICYmXG4gICAgICAgICEoc2tpcEluZGV4ZXMgJiYgaXNJbmRleChrZXksIGxlbmd0aCkpICYmXG4gICAgICAgICEoa2V5ID09ICdjb25zdHJ1Y3RvcicgJiYgKGlzUHJvdG8gfHwgIWhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBrZXkpKSkpIHtcbiAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgfVxuICB9XG4gIGlmIChzdXBwb3J0Lm5vbkVudW1TaGFkb3dzICYmIG9iamVjdCAhPT0gb2JqZWN0UHJvdG8pIHtcbiAgICB2YXIgdGFnID0gb2JqZWN0ID09PSBzdHJpbmdQcm90byA/IHN0cmluZ1RhZyA6IChvYmplY3QgPT09IGVycm9yUHJvdG8gPyBlcnJvclRhZyA6IG9ialRvU3RyaW5nLmNhbGwob2JqZWN0KSksXG4gICAgICAgIG5vbkVudW1zID0gbm9uRW51bVByb3BzW3RhZ10gfHwgbm9uRW51bVByb3BzW29iamVjdFRhZ107XG5cbiAgICBpZiAodGFnID09IG9iamVjdFRhZykge1xuICAgICAgcHJvdG8gPSBvYmplY3RQcm90bztcbiAgICB9XG4gICAgbGVuZ3RoID0gc2hhZG93UHJvcHMubGVuZ3RoO1xuICAgIHdoaWxlIChsZW5ndGgtLSkge1xuICAgICAga2V5ID0gc2hhZG93UHJvcHNbbGVuZ3RoXTtcbiAgICAgIHZhciBub25FbnVtID0gbm9uRW51bXNba2V5XTtcbiAgICAgIGl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ZW5kKCd7XCJuYW1lXCI6XCJ0alwifSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBtYW51YWwgeC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCgnbmFtZT10aicpXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGRlZmF1bHRzIHRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICAqICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gICogICAgICAgIC5zZW5kKCduYW1lPXRvYmknKVxuICAqICAgICAgICAuc2VuZCgnc3BlY2llcz1mZXJyZXQnKVxuICAqICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqIEBwYXJhbSB7U3RyaW5nfE9iamVjdH0gZGF0YVxuICogQHJldHVybiB7UmVxdWVzdH0gZm9yIGNoYWluaW5nXG4gKiBAYXBpIHB1YmxpY1xuICovXG5cblJlcXVlc3QucHJvdG90eXBlLnNlbmQgPSBmdW5jdGlvbihkYXRhKXtcbiAgdmFyIG9iaiA9IGlzT2JqZWN0KGRhdGEpO1xuICB2YXIgdHlwZ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Y3Rpb24oZXZlbnQpe1xuICByZXR1cm4gISEgdGhpcy5saXN0ZW5lcnMoZXZlbnQpLmxlbmd0aDtcbn07XG4iLCJcbi8qKlxuICogUmVkdWNlIGBhcnJgIHdpdGggYGZuYC5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhcnJcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGZuXG4gKiBAcGFyYW0ge01peGVkfSBpbml0aWFsXG4gKlxuICogVE9ETzogY29tYmF0aWJsZSBlcnJvciBoYW5kbGluZz9cbiAqL1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uKGFyciwgZm4sIGluaXRpYWwpeyAgXG4gIHZhciBpZHggPSAwO1xuICB2YXIgbGVuID0gYXJyLmxlbmd0aDtcbiAgdmFyIGN1cnIgPSBhcmd1bWVudHMubGVuZ3RoID09IDNcbiAgICA/IGluaXRpYWxcbiAgICA6IGFycltpZHgrK107XG5cbiAgd2hpbGUgKGlkeCA8IGxlbikge1xuICAgIGN1cnIgPSBmbi5jYWxsKG51bGwsIGN1cnIsIGFycltpZHhdLCArK2lkeCwgYXJyKTtcbiAgfVxuICBcbiAgcmV0dXJuIGN1cnI7XG59OyJdfQ==
30605
30606
'use strict';
30607
30608
window.SwaggerUi = Backbone.Router.extend({
30609
30610
  dom_id: 'swagger_ui',
30611
30612
  // Attributes
30613
  options: null,
30614
  api: null,
30615
  headerView: null,
30616
  mainView: null,
30617
30618
  // SwaggerUi accepts all the same options as SwaggerApi
30619
  initialize: function(options) {
30620
    options = options || {};
30621
    if(!options.highlightSizeThreshold) {
30622
      options.highlightSizeThreshold = 100000;
30623
    }
30624
30625
    // Allow dom_id to be overridden
30626
    if (options.dom_id) {
30627
      this.dom_id = options.dom_id;
30628
      delete options.dom_id;
30629
    }
30630
30631
    if (!options.supportedSubmitMethods){
30632
      options.supportedSubmitMethods = [
30633
        'get',
30634
        'put',
30635
        'post',
30636
        'delete',
30637
        'head',
30638
        'options',
30639
        'patch'
30640
      ];
30641
    }
30642
30643
    if (typeof options.oauth2RedirectUrl === 'string') {
30644
      window.oAuthRedirectUrl = options.redirectUrl;
30645
    }
30646
30647
    // Create an empty div which contains the dom_id
30648
    if (! $('#' + this.dom_id).length){
30649
      $('body').append('<div id="' + this.dom_id + '"></div>') ;
30650
    }
30651
30652
    this.options = options;
30653
30654
    // set marked options
30655
    marked.setOptions({gfm: true});
30656
30657
    // Set the callbacks
30658
    var that = this;
30659
    this.options.success = function() { return that.render(); };
30660
    this.options.progress = function(d) { return that.showMessage(d); };
30661
    this.options.failure = function(d) { return that.onLoadFailure(d); };
30662
30663
    // Create view to handle the header inputs
30664
    this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});
30665
30666
    // Event handler for when the baseUrl/apiKey is entered by user
30667
    this.headerView.on('update-swagger-ui', function(data) {
30668
      return that.updateSwaggerUi(data);
30669
    });
30670
  },
30671
30672
  // Set an option after initializing
30673
  setOption: function(option, value) {
30674
    this.options[option] = value;
30675
  },
30676
30677
  // Get the value of a previously set option
30678
  getOption: function(option) {
30679
    return this.options[option];
30680
  },
30681
30682
  // Event handler for when url/key is received from user
30683
  updateSwaggerUi: function(data){
30684
    this.options.url = data.url;
30685
    this.load();
30686
  },
30687
30688
  // Create an api and render
30689
  load: function(){
30690
    // Initialize the API object
30691
    if (this.mainView) {
30692
      this.mainView.clear();
30693
    }
30694
    var url = this.options.url;
30695
    if (url && url.indexOf('http') !== 0) {
30696
      url = this.buildUrl(window.location.href.toString(), url);
30697
    }
30698
    if(this.api) {
30699
      this.options.authorizations = this.api.clientAuthorizations.authz;
30700
    }
30701
    this.options.url = url;
30702
    this.headerView.update(url);
30703
30704
    this.api = new SwaggerClient(this.options);
30705
  },
30706
30707
  // collapse all sections
30708
  collapseAll: function(){
30709
    Docs.collapseEndpointListForResource('');
30710
  },
30711
30712
  // list operations for all sections
30713
  listAll: function(){
30714
    Docs.collapseOperationsForResource('');
30715
  },
30716
30717
  // expand operations for all sections
30718
  expandAll: function(){
30719
    Docs.expandOperationsForResource('');
30720
  },
30721
30722
  // This is bound to success handler for SwaggerApi
30723
  //  so it gets called when SwaggerApi completes loading
30724
  render: function(){
30725
    this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
30726
    this.mainView = new SwaggerUi.Views.MainView({
30727
      model: this.api,
30728
      el: $('#' + this.dom_id),
30729
      swaggerOptions: this.options,
30730
      router: this
30731
    }).render();
30732
    this.showMessage();
30733
    switch (this.options.docExpansion) {
30734
      case 'full':
30735
        this.expandAll(); break;
30736
      case 'list':
30737
        this.listAll(); break;
30738
      default:
30739
        break;
30740
    }
30741
    this.renderGFM();
30742
30743
    if (this.options.onComplete){
30744
      this.options.onComplete(this.api, this);
30745
    }
30746
30747
    setTimeout(Docs.shebang.bind(this), 100);
30748
  },
30749
30750
  buildUrl: function(base, url){
30751
    if (url.indexOf('/') === 0) {
30752
      var parts = base.split('/');
30753
      base = parts[0] + '//' + parts[2];
30754
      return base + url;
30755
    } else {
30756
      var endOfPath = base.length;
30757
30758
      if (base.indexOf('?') > -1){
30759
        endOfPath = Math.min(endOfPath, base.indexOf('?'));
30760
      }
30761
30762
      if (base.indexOf('#') > -1){
30763
        endOfPath = Math.min(endOfPath, base.indexOf('#'));
30764
      }
30765
30766
      base = base.substring(0, endOfPath);
30767
30768
      if (base.indexOf('/', base.length - 1 ) !== -1){
30769
        return base + url;
30770
      }
30771
30772
      return base + '/' + url;
30773
    }
30774
  },
30775
30776
  // Shows message on topbar of the ui
30777
  showMessage: function(data){
30778
    if (data === undefined) {
30779
      data = '';
30780
    }
30781
    var $msgbar = $('#message-bar');
30782
    $msgbar.removeClass('message-fail');
30783
    $msgbar.addClass('message-success');
30784
    $msgbar.html(data);
30785
    if(window.SwaggerTranslator) {
30786
      window.SwaggerTranslator.translate($msgbar);
30787
    }
30788
  },
30789
30790
  // shows message in red
30791
  onLoadFailure: function(data){
30792
    if (data === undefined) {
30793
      data = '';
30794
    }
30795
    $('#message-bar').removeClass('message-success');
30796
    $('#message-bar').addClass('message-fail');
30797
30798
    var val = $('#message-bar').text(data);
30799
30800
    if (this.options.onFailure) {
30801
      this.options.onFailure(data);
30802
    }
30803
30804
    return val;
30805
  },
30806
30807
  // Renders GFM for elements with 'markdown' class
30808
  renderGFM: function(){
30809
    $('.markdown').each(function(){
30810
      $(this).html(marked($(this).html()));
30811
    });
30812
30813
    $('.propDesc', '.model-signature .description').each(function () {
30814
      $(this).html(marked($(this).html())).addClass('markdown');
30815
    });
30816
  }
30817
30818
});
30819
30820
window.SwaggerUi.Views = {};
30821
30822
// don't break backward compatibility with previous versions and warn users to upgrade their code
30823
(function(){
30824
  window.authorizations = {
30825
    add: function() {
30826
      warn('Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add().');
30827
30828
      if (typeof window.swaggerUi === 'undefined') {
30829
        throw new TypeError('window.swaggerUi is not defined');
30830
      }
30831
30832
      if (window.swaggerUi instanceof SwaggerUi) {
30833
        window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments);
30834
      }
30835
    }
30836
  };
30837
30838
  window.ApiKeyAuthorization = function() {
30839
    warn('window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.');
30840
    SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
30841
  };
30842
30843
  window.PasswordAuthorization = function() {
30844
    warn('window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization.');
30845
    SwaggerClient.PasswordAuthorization.apply(window, arguments);
30846
  };
30847
30848
  function warn(message) {
30849
    if ('console' in window && typeof window.console.warn === 'function') {
30850
      console.warn(message);
30851
    }
30852
  }
30853
})();
30854
30855
30856
// UMD
30857
(function (root, factory) {
30858
    if (typeof define === 'function' && define.amd) {
30859
        // AMD. Register as an anonymous module.
30860
        define(['b'], function (b) {
30861
            return (root.SwaggerUi = factory(b));
30862
        });
30863
    } else if (typeof exports === 'object') {
30864
        // Node. Does not work with strict CommonJS, but
30865
        // only CommonJS-like environments that support module.exports,
30866
        // like Node.
30867
        module.exports = factory(require('b'));
30868
    } else {
30869
        // Browser globals
30870
        root.SwaggerUi = factory(root.b);
30871
    }
30872
}(this, function () {
30873
    return SwaggerUi;
30874
}));
30875
30876
'use strict';
30877
30878
SwaggerUi.Views.ApiKeyButton = Backbone.View.extend({ // TODO: append this to global SwaggerUi
30879
30880
  events:{
30881
    'click #apikey_button' : 'toggleApiKeyContainer',
30882
    'click #apply_api_key' : 'applyApiKey'
30883
  },
30884
30885
  initialize: function(opts){
30886
    this.options = opts || {};
30887
    this.router = this.options.router;
30888
  },
30889
30890
  render: function(){
30891
    var template = this.template();
30892
    $(this.el).html(template(this.model));
30893
30894
    return this;
30895
  },
30896
30897
30898
  applyApiKey: function(){
30899
    var keyAuth = new SwaggerClient.ApiKeyAuthorization(
30900
      this.model.name,
30901
      $('#input_apiKey_entry').val(),
30902
      this.model.in
30903
    );
30904
    this.router.api.clientAuthorizations.add(this.model.name, keyAuth);
30905
    this.router.load();
30906
    $('#apikey_container').show();
30907
  },
30908
30909
  toggleApiKeyContainer: function(){
30910
    if ($('#apikey_container').length) {
30911
30912
      var elem = $('#apikey_container').first();
30913
30914
      if (elem.is(':visible')){
30915
        elem.hide();
30916
      } else {
30917
30918
        // hide others
30919
        $('.auth_container').hide();
30920
        elem.show();
30921
      }
30922
    }
30923
  },
30924
30925
  template: function(){
30926
    return Handlebars.templates.apikey_button_view;
30927
  }
30928
30929
});
30930
'use strict';
30931
30932
SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
30933
30934
30935
  initialize: function (opts) {
30936
    this.options = opts || {};
30937
    this.router = this.options.router;
30938
  },
30939
30940
  render: function(){
30941
    var template = this.template();
30942
    $(this.el).html(template(this.model));
30943
30944
    return this;
30945
  },
30946
30947
  events: {
30948
    'click #basic_auth_button' : 'togglePasswordContainer',
30949
    'click #apply_basic_auth' : 'applyPassword'
30950
  },
30951
30952
  applyPassword: function(){
30953
    var username = $('.input_username').val();
30954
    var password = $('.input_password').val();
30955
    var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
30956
    this.router.api.clientAuthorizations.add(this.model.type, basicAuth);
30957
    this.router.load();
30958
    $('#basic_auth_container').hide();
30959
  },
30960
30961
  togglePasswordContainer: function(){
30962
    if ($('#basic_auth_container').length) {
30963
      var elem = $('#basic_auth_container').show();
30964
      if (elem.is(':visible')){
30965
        elem.slideUp();
30966
      } else {
30967
        // hide others
30968
        $('.auth_container').hide();
30969
        elem.show();
30970
      }
30971
    }
30972
  },
30973
30974
  template: function(){
30975
    return Handlebars.templates.basic_auth_button_view;
30976
  }
30977
30978
});
30979
'use strict';
30980
30981
SwaggerUi.Views.ContentTypeView = Backbone.View.extend({
30982
  initialize: function() {},
30983
30984
  render: function(){
30985
  	this.model.contentTypeId = 'ct' + Math.random();
30986
    $(this.el).html(Handlebars.templates.content_type(this.model));
30987
    return this;
30988
  }
30989
});
30990
'use strict';
30991
30992
SwaggerUi.Views.HeaderView = Backbone.View.extend({
30993
  events: {
30994
    'click #show-pet-store-icon'    : 'showPetStore',
30995
    'click #explore'                : 'showCustom',
30996
    'keyup #input_baseUrl'          : 'showCustomOnKeyup',
30997
    'keyup #input_apiKey'           : 'showCustomOnKeyup'
30998
  },
30999
31000
  initialize: function(){},
31001
31002
  showPetStore: function(){
31003
    this.trigger('update-swagger-ui', {
31004
      url:'http://petstore.swagger.io/v2/swagger.json'
31005
    });
31006
  },
31007
31008
  showCustomOnKeyup: function(e){
31009
    if (e.keyCode === 13) {
31010
      this.showCustom();
31011
    }
31012
  },
31013
31014
  showCustom: function(e){
31015
    if (e) {
31016
      e.preventDefault();
31017
    }
31018
31019
    this.trigger('update-swagger-ui', {
31020
      url: $('#input_baseUrl').val(),
31021
      apiKey: $('#input_apiKey').val()
31022
    });
31023
  },
31024
31025
  update: function(url, apiKey, trigger){
31026
    if (trigger === undefined) {
31027
      trigger = false;
31028
    }
31029
31030
    $('#input_baseUrl').val(url);
31031
31032
    //$('#input_apiKey').val(apiKey);
31033
    if (trigger) {
31034
      this.trigger('update-swagger-ui', {url:url});
31035
    }
31036
  }
31037
});
31038
31039
'use strict';
31040
31041
SwaggerUi.Views.MainView = Backbone.View.extend({
31042
  apisSorter : {
31043
    alpha   : function(a,b){ return a.name.localeCompare(b.name); }
31044
  },
31045
  operationsSorters : {
31046
    alpha   : function(a,b){ return a.path.localeCompare(b.path); },
31047
    method  : function(a,b){ return a.method.localeCompare(b.method); }
31048
  },
31049
  initialize: function(opts){
31050
    var sorterOption, sorterFn, key, value;
31051
    opts = opts || {};
31052
31053
    this.router = opts.router;
31054
31055
    // Sort APIs
31056
    if (opts.swaggerOptions.apisSorter) {
31057
      sorterOption = opts.swaggerOptions.apisSorter;
31058
      if (_.isFunction(sorterOption)) {
31059
        sorterFn = sorterOption;
31060
      } else {
31061
        sorterFn = this.apisSorter[sorterOption];
31062
      }
31063
      if (_.isFunction(sorterFn)) {
31064
        this.model.apisArray.sort(sorterFn);
31065
      }
31066
    }
31067
    // Sort operations of each API
31068
    if (opts.swaggerOptions.operationsSorter) {
31069
      sorterOption = opts.swaggerOptions.operationsSorter;
31070
      if (_.isFunction(sorterOption)) {
31071
        sorterFn = sorterOption;
31072
      } else {
31073
        sorterFn = this.operationsSorters[sorterOption];
31074
      }
31075
      if (_.isFunction(sorterFn)) {
31076
        for (key in this.model.apisArray) {
31077
          this.model.apisArray[key].operationsArray.sort(sorterFn);
31078
        }
31079
      }
31080
    }
31081
31082
    // set up the UI for input
31083
    this.model.auths = [];
31084
31085
    for (key in this.model.securityDefinitions) {
31086
      value = this.model.securityDefinitions[key];
31087
31088
      this.model.auths.push({
31089
        name: key,
31090
        type: value.type,
31091
        value: value
31092
      });
31093
    }
31094
31095
    if ('validatorUrl' in opts.swaggerOptions) {
31096
      // Validator URL specified explicitly
31097
      this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
31098
    } else if (this.model.url.indexOf('localhost') > 0) {
31099
      // Localhost override
31100
      this.model.validatorUrl = null;
31101
    } else {
31102
      // Default validator
31103
      if(window.location.protocol === 'https:') {
31104
        this.model.validatorUrl = 'https://online.swagger.io/validator';
31105
      }
31106
      else {
31107
        this.model.validatorUrl = 'http://online.swagger.io/validator';
31108
      }
31109
    }
31110
  },
31111
31112
  render: function(){
31113
    if (this.model.securityDefinitions) {
31114
      for (var name in this.model.securityDefinitions) {
31115
        var auth = this.model.securityDefinitions[name];
31116
        var button;
31117
31118
        if (auth.type === 'apiKey' && $('#apikey_button').length === 0) {
31119
          button = new SwaggerUi.Views.ApiKeyButton({model: auth, router:  this.router}).render().el;
31120
          $('.auth_main_container').append(button);
31121
        }
31122
31123
        if (auth.type === 'basicAuth' && $('#basic_auth_button').length === 0) {
31124
          button = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
31125
          $('.auth_main_container').append(button);
31126
        }
31127
      }
31128
    }
31129
31130
    // Render the outer container for resources
31131
    $(this.el).html(Handlebars.templates.main(this.model));
31132
31133
    // Render each resource
31134
31135
    var resources = {};
31136
    var counter = 0;
31137
    for (var i = 0; i < this.model.apisArray.length; i++) {
31138
      var resource = this.model.apisArray[i];
31139
      var id = resource.name;
31140
      while (typeof resources[id] !== 'undefined') {
31141
        id = id + '_' + counter;
31142
        counter += 1;
31143
      }
31144
      resource.id = id;
31145
      resources[id] = resource;
31146
      this.addResource(resource, this.model.auths);
31147
    }
31148
31149
    $('.propWrap').hover(function onHover(){
31150
      $('.optionsWrapper', $(this)).show();
31151
    }, function offhover(){
31152
      $('.optionsWrapper', $(this)).hide();
31153
    });
31154
    return this;
31155
  },
31156
31157
  addResource: function(resource, auths){
31158
    // Render a resource and add it to resources li
31159
    resource.id = resource.id.replace(/\s/g, '_');
31160
    var resourceView = new SwaggerUi.Views.ResourceView({
31161
      model: resource,
31162
      router: this.router,
31163
      tagName: 'li',
31164
      id: 'resource_' + resource.id,
31165
      className: 'resource',
31166
      auths: auths,
31167
      swaggerOptions: this.options.swaggerOptions
31168
    });
31169
    $('#resources', this.el).append(resourceView.render().el);
31170
  },
31171
31172
  clear: function(){
31173
    $(this.el).html('');
31174
  }
31175
});
31176
31177
'use strict';
31178
31179
SwaggerUi.Views.OperationView = Backbone.View.extend({
31180
  invocationUrl: null,
31181
31182
  events: {
31183
    'submit .sandbox'         : 'submitOperation',
31184
    'click .submit'           : 'submitOperation',
31185
    'click .response_hider'   : 'hideResponse',
31186
    'click .toggleOperation'  : 'toggleOperationContent',
31187
    'mouseenter .api-ic'      : 'mouseEnter',
31188
    'dblclick .curl'          : 'selectText',
31189
  },
31190
31191
  initialize: function(opts) {
31192
    opts = opts || {};
31193
    this.router = opts.router;
31194
    this.auths = opts.auths;
31195
    this.parentId = this.model.parentId;
31196
    this.nickname = this.model.nickname;
31197
    this.model.encodedParentId = encodeURIComponent(this.parentId);
31198
    return this;
31199
  },
31200
31201
  selectText: function(event) {
31202
      var doc = document,
31203
          text = event.target.firstChild,
31204
          range,
31205
          selection;
31206
      if (doc.body.createTextRange) {
31207
          range = document.body.createTextRange();
31208
          range.moveToElementText(text);
31209
          range.select();
31210
      } else if (window.getSelection) {
31211
          selection = window.getSelection();
31212
          range = document.createRange();
31213
          range.selectNodeContents(text);
31214
          selection.removeAllRanges();
31215
          selection.addRange(range);
31216
      }
31217
  },
31218
31219
  mouseEnter: function(e) {
31220
    var elem = $(this.el).find('.content');
31221
    var x = e.pageX;
31222
    var y = e.pageY;
31223
    var scX = $(window).scrollLeft();
31224
    var scY = $(window).scrollTop();
31225
    var scMaxX = scX + $(window).width();
31226
    var scMaxY = scY + $(window).height();
31227
    var wd = elem.width();
31228
    var hgh = elem.height();
31229
31230
    if (x + wd > scMaxX) {
31231
      x = scMaxX - wd;
31232
    }
31233
31234
    if (x < scX) {
31235
      x = scX;
31236
    }
31237
31238
    if (y + hgh > scMaxY) {
31239
      y = scMaxY - hgh;
31240
    }
31241
31242
    if (y < scY) {
31243
      y = scY;
31244
    }
31245
31246
    var pos = {};
31247
    pos.top = y;
31248
    pos.left = x;
31249
    elem.css(pos);
31250
  },
31251
31252
  // Note: copied from CoffeeScript compiled file
31253
  // TODO: redactor
31254
  render: function() {
31255
    var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
31256
    isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
31257
    if (!isMethodSubmissionSupported) {
31258
      this.model.isReadOnly = true;
31259
    }
31260
    this.model.description = this.model.description || this.model.notes;
31261
    this.model.oauth = null;
31262
    modelAuths = this.model.authorizations || this.model.security;
31263
    if (modelAuths) {
31264
      if (Array.isArray(modelAuths)) {
31265
        for (l = 0, len = modelAuths.length; l < len; l++) {
31266
          auths = modelAuths[l];
31267
          for (key in auths) {
31268
            for (a in this.auths) {
31269
              auth = this.auths[a];
31270
              if (key === auth.name) {
31271
                if (auth.type === 'oauth2') {
31272
                  this.model.oauth = {};
31273
                  this.model.oauth.scopes = [];
31274
                  ref1 = auth.value.scopes;
31275
                  for (k in ref1) {
31276
                    v = ref1[k];
31277
                    scopeIndex = auths[key].indexOf(k);
31278
                    if (scopeIndex >= 0) {
31279
                      o = {
31280
                        scope: k,
31281
                        description: v
31282
                      };
31283
                      this.model.oauth.scopes.push(o);
31284
                    }
31285
                  }
31286
                }
31287
              }
31288
            }
31289
          }
31290
        }
31291
      } else {
31292
        for (k in modelAuths) {
31293
          v = modelAuths[k];
31294
          if (k === 'oauth2') {
31295
            if (this.model.oauth === null) {
31296
              this.model.oauth = {};
31297
            }
31298
            if (this.model.oauth.scopes === void 0) {
31299
              this.model.oauth.scopes = [];
31300
            }
31301
            for (m = 0, len1 = v.length; m < len1; m++) {
31302
              o = v[m];
31303
              this.model.oauth.scopes.push(o);
31304
            }
31305
          }
31306
        }
31307
      }
31308
    }
31309
    if (typeof this.model.responses !== 'undefined') {
31310
      this.model.responseMessages = [];
31311
      ref2 = this.model.responses;
31312
      for (code in ref2) {
31313
        value = ref2[code];
31314
        schema = null;
31315
        schemaObj = this.model.responses[code].schema;
31316
        if (schemaObj && schemaObj.$ref) {
31317
          schema = schemaObj.$ref;
31318
          if (schema.indexOf('#/definitions/') === 0) {
31319
            schema = schema.substring('#/definitions/'.length);
31320
          }
31321
        }
31322
        this.model.responseMessages.push({
31323
          code: code,
31324
          message: value.description,
31325
          responseModel: schema
31326
        });
31327
      }
31328
    }
31329
    if (typeof this.model.responseMessages === 'undefined') {
31330
      this.model.responseMessages = [];
31331
    }
31332
    signatureModel = null;
31333
    if (this.model.successResponse) {
31334
      successResponse = this.model.successResponse;
31335
      for (key in successResponse) {
31336
        value = successResponse[key];
31337
        this.model.successCode = key;
31338
        if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
31339
          signatureModel = {
31340
            sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
31341
            isParam: false,
31342
            signature: value.getMockSignature()
31343
          };
31344
        }
31345
      }
31346
    } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
31347
      signatureModel = {
31348
        sampleJSON: this.model.responseSampleJSON,
31349
        isParam: false,
31350
        signature: this.model.responseClassSignature
31351
      };
31352
    }
31353
    var opts = this.options.swaggerOptions;
31354
    if (opts.showRequestHeaders) {
31355
      this.model.showRequestHeaders = true;
31356
    }
31357
    $(this.el).html(Handlebars.templates.operation(this.model));
31358
    if (signatureModel) {
31359
      responseSignatureView = new SwaggerUi.Views.SignatureView({
31360
        model: signatureModel,
31361
        router: this.router,
31362
        tagName: 'div'
31363
      });
31364
      $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
31365
    } else {
31366
      this.model.responseClassSignature = 'string';
31367
      $('.model-signature', $(this.el)).html(this.model.type);
31368
    }
31369
    contentTypeModel = {
31370
      isParam: false
31371
    };
31372
    contentTypeModel.consumes = this.model.consumes;
31373
    contentTypeModel.produces = this.model.produces;
31374
    ref3 = this.model.parameters;
31375
    for (n = 0, len2 = ref3.length; n < len2; n++) {
31376
      param = ref3[n];
31377
      type = param.type || param.dataType || '';
31378
      if (typeof type === 'undefined') {
31379
        schema = param.schema;
31380
        if (schema && schema.$ref) {
31381
          ref = schema.$ref;
31382
          if (ref.indexOf('#/definitions/') === 0) {
31383
            type = ref.substring('#/definitions/'.length);
31384
          } else {
31385
            type = ref;
31386
          }
31387
        }
31388
      }
31389
      if (type && type.toLowerCase() === 'file') {
31390
        if (!contentTypeModel.consumes) {
31391
          contentTypeModel.consumes = 'multipart/form-data';
31392
        }
31393
      }
31394
      param.type = type;
31395
    }
31396
    responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({
31397
      model: contentTypeModel,
31398
      router: this.router
31399
    });
31400
    $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
31401
    ref4 = this.model.parameters;
31402
    for (p = 0, len3 = ref4.length; p < len3; p++) {
31403
      param = ref4[p];
31404
      this.addParameter(param, contentTypeModel.consumes);
31405
    }
31406
    ref5 = this.model.responseMessages;
31407
    for (q = 0, len4 = ref5.length; q < len4; q++) {
31408
      statusCode = ref5[q];
31409
      this.addStatusCode(statusCode);
31410
    }
31411
    return this;
31412
  },
31413
31414
  addParameter: function(param, consumes) {
31415
    // Render a parameter
31416
    param.consumes = consumes;
31417
    var paramView = new SwaggerUi.Views.ParameterView({
31418
      model: param,
31419
      tagName: 'tr',
31420
      readOnly: this.model.isReadOnly
31421
    });
31422
    $('.operation-params', $(this.el)).append(paramView.render().el);
31423
  },
31424
31425
  addStatusCode: function(statusCode) {
31426
    // Render status codes
31427
    var statusCodeView = new SwaggerUi.Views.StatusCodeView({
31428
      model: statusCode,
31429
      tagName: 'tr',
31430
      router: this.router
31431
    });
31432
    $('.operation-status', $(this.el)).append(statusCodeView.render().el);
31433
  },
31434
31435
  // Note: copied from CoffeeScript compiled file
31436
  // TODO: redactor
31437
  submitOperation: function(e) {
31438
    var error_free, form, isFileUpload, map, opts;
31439
    if (e !== null) {
31440
      e.preventDefault();
31441
    }
31442
    form = $('.sandbox', $(this.el));
31443
    error_free = true;
31444
    form.find('input.required').each(function() {
31445
      $(this).removeClass('error');
31446
      if (jQuery.trim($(this).val()) === '') {
31447
        $(this).addClass('error');
31448
        $(this).wiggle({
31449
          callback: (function(_this) {
31450
            return function() {
31451
              $(_this).focus();
31452
            };
31453
          })(this)
31454
        });
31455
        error_free = false;
31456
      }
31457
    });
31458
    form.find('textarea.required').each(function() {
31459
      $(this).removeClass('error');
31460
      if (jQuery.trim($(this).val()) === '') {
31461
        $(this).addClass('error');
31462
        $(this).wiggle({
31463
          callback: (function(_this) {
31464
            return function() {
31465
              return $(_this).focus();
31466
            };
31467
          })(this)
31468
        });
31469
        error_free = false;
31470
      }
31471
    });
31472
    form.find('select.required').each(function() {
31473
      $(this).removeClass('error');
31474
      if (this.selectedIndex === -1) {
31475
        $(this).addClass('error');
31476
        $(this).wiggle({
31477
          callback: (function(_this) {
31478
            return function() {
31479
              $(_this).focus();
31480
            };
31481
          })(this)
31482
        });
31483
        error_free = false;
31484
      }
31485
    });
31486
    if (error_free) {
31487
      map = this.getInputMap(form);
31488
      isFileUpload = this.isFileUpload(form);
31489
      opts = {
31490
        parent: this
31491
      };
31492
      if (this.options.swaggerOptions) {
31493
        for(var key in this.options.swaggerOptions) {
31494
          opts[key] = this.options.swaggerOptions[key];
31495
        }
31496
      }
31497
      opts.responseContentType = $('div select[name=responseContentType]', $(this.el)).val();
31498
      opts.requestContentType = $('div select[name=parameterContentType]', $(this.el)).val();
31499
      $('.response_throbber', $(this.el)).show();
31500
      if (isFileUpload) {
31501
        $('.request_url', $(this.el)).html('<pre></pre>');
31502
        $('.request_url pre', $(this.el)).text(this.invocationUrl);
31503
31504
        opts.useJQuery = true;
31505
        map.parameterContentType = 'multipart/form-data';
31506
31507
        return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
31508
      } else {
31509
        this.map = map;
31510
        return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
31511
      }
31512
    }
31513
  },
31514
31515
  getInputMap: function (form) {
31516
    var map, ref1, l, len, o, ref2, m, len1, val, ref3, n, len2;
31517
    map = {};
31518
    ref1 = form.find('input');
31519
    for (l = 0, len = ref1.length; l < len; l++) {
31520
      o = ref1[l];
31521
      if ((o.value !== null) && jQuery.trim(o.value).length > 0) {
31522
        map[o.name] = o.value;
31523
      }
31524
      if (o.type === 'file') {
31525
        map[o.name] = o.files[0];
31526
      }
31527
    }
31528
    ref2 = form.find('textarea');
31529
    for (m = 0, len1 = ref2.length; m < len1; m++) {
31530
      o = ref2[m];
31531
      val = this.getTextAreaValue(o);
31532
      if ((val !== null) && jQuery.trim(val).length > 0) {
31533
        map[o.name] = val;
31534
      }
31535
    }
31536
    ref3 = form.find('select');
31537
    for (n = 0, len2 = ref3.length; n < len2; n++) {
31538
      o = ref3[n];
31539
      val = this.getSelectedValue(o);
31540
      if ((val !== null) && jQuery.trim(val).length > 0) {
31541
        map[o.name] = val;
31542
      }
31543
    }
31544
    return map;
31545
  },
31546
31547
  isFileUpload: function (form) {
31548
    var ref1, l, len, o;
31549
    var isFileUpload = false;
31550
    ref1 = form.find('input');
31551
    for (l = 0, len = ref1.length; l < len; l++) {
31552
      o = ref1[l];
31553
      if (o.type === 'file') {
31554
        isFileUpload = true;
31555
      }
31556
    }
31557
    return isFileUpload;
31558
  },
31559
31560
  success: function(response, parent) {
31561
    parent.showCompleteStatus(response);
31562
  },
31563
31564
  // wraps a jquery response as a shred response
31565
  wrap: function(data) {
31566
   var h, headerArray, headers, i, l, len, o;
31567
    headers = {};
31568
    headerArray = data.getAllResponseHeaders().split('\r');
31569
    for (l = 0, len = headerArray.length; l < len; l++) {
31570
      i = headerArray[l];
31571
      h = i.match(/^([^:]*?):(.*)$/);
31572
      if (!h) {
31573
        h = [];
31574
      }
31575
      h.shift();
31576
      if (h[0] !== void 0 && h[1] !== void 0) {
31577
        headers[h[0].trim()] = h[1].trim();
31578
      }
31579
    }
31580
    o = {};
31581
    o.content = {};
31582
    o.content.data = data.responseText;
31583
    o.headers = headers;
31584
    o.request = {};
31585
    o.request.url = this.invocationUrl;
31586
    o.status = data.status;
31587
    return o;
31588
  },
31589
31590
  getSelectedValue: function(select) {
31591
    if (!select.multiple) {
31592
      return select.value;
31593
    } else {
31594
      var options = [];
31595
      for (var l = 0, len = select.options.length; l < len; l++) {
31596
        var opt = select.options[l];
31597
        if (opt.selected) {
31598
          options.push(opt.value);
31599
        }
31600
      }
31601
      if (options.length > 0) {
31602
        return options;
31603
      } else {
31604
        return null;
31605
      }
31606
    }
31607
  },
31608
31609
  // handler for hide response link
31610
  hideResponse: function(e) {
31611
    if (e) { e.preventDefault(); }
31612
    $('.response', $(this.el)).slideUp();
31613
    $('.response_hider', $(this.el)).fadeOut();
31614
  },
31615
31616
  // Show response from server
31617
  showResponse: function(response) {
31618
    var prettyJson = JSON.stringify(response, null, '\t').replace(/\n/g, '<br>');
31619
    $('.response_body', $(this.el)).html(_.escape(prettyJson));
31620
  },
31621
31622
  // Show error from server
31623
  showErrorStatus: function(data, parent) {
31624
    parent.showStatus(data);
31625
  },
31626
31627
  // show the status codes
31628
  showCompleteStatus: function(data, parent){
31629
    parent.showStatus(data);
31630
  },
31631
31632
  // Adapted from http://stackoverflow.com/a/2893259/454004
31633
  // Note: directly ported from CoffeeScript
31634
  // TODO: Cleanup CoffeeScript artifacts
31635
  formatXml: function(xml) {
31636
    var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
31637
    reg = /(>)(<)(\/*)/g;
31638
    wsexp = /[ ]*(.*)[ ]+\n/g;
31639
    contexp = /(<.+>)(.+\n)/g;
31640
    xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
31641
    pad = 0;
31642
    formatted = '';
31643
    lines = xml.split('\n');
31644
    indent = 0;
31645
    lastType = 'other';
31646
    transitions = {
31647
      'single->single': 0,
31648
      'single->closing': -1,
31649
      'single->opening': 0,
31650
      'single->other': 0,
31651
      'closing->single': 0,
31652
      'closing->closing': -1,
31653
      'closing->opening': 0,
31654
      'closing->other': 0,
31655
      'opening->single': 1,
31656
      'opening->closing': 0,
31657
      'opening->opening': 1,
31658
      'opening->other': 1,
31659
      'other->single': 0,
31660
      'other->closing': -1,
31661
      'other->opening': 0,
31662
      'other->other': 0
31663
    };
31664
    fn = function(ln) {
31665
      var fromTo, j, key, padding, type, types, value;
31666
      types = {
31667
        single: Boolean(ln.match(/<.+\/>/)),
31668
        closing: Boolean(ln.match(/<\/.+>/)),
31669
        opening: Boolean(ln.match(/<[^!?].*>/))
31670
      };
31671
      type = ((function() {
31672
        var results;
31673
        results = [];
31674
        for (key in types) {
31675
          value = types[key];
31676
          if (value) {
31677
            results.push(key);
31678
          }
31679
        }
31680
        return results;
31681
      })())[0];
31682
      type = type === void 0 ? 'other' : type;
31683
      fromTo = lastType + '->' + type;
31684
      lastType = type;
31685
      padding = '';
31686
      indent += transitions[fromTo];
31687
      padding = ((function() {
31688
        var m, ref1, results;
31689
        results = [];
31690
        for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
31691
          results.push('  ');
31692
        }
31693
        return results;
31694
      })()).join('');
31695
      if (fromTo === 'opening->closing') {
31696
        formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
31697
      } else {
31698
        formatted += padding + ln + '\n';
31699
      }
31700
    };
31701
    for (l = 0, len = lines.length; l < len; l++) {
31702
      ln = lines[l];
31703
      fn(ln);
31704
    }
31705
    return formatted;
31706
  },
31707
31708
  // puts the response data in UI
31709
  showStatus: function(response) {
31710
    var url, content;
31711
    if (response.content === undefined) {
31712
      content = response.data;
31713
      url = response.url;
31714
    } else {
31715
      content = response.content.data;
31716
      url = response.request.url;
31717
    }
31718
    var headers = response.headers;
31719
    content = jQuery.trim(content);
31720
31721
    // if server is nice, and sends content-type back, we can use it
31722
    var contentType = null;
31723
    if (headers) {
31724
      contentType = headers['Content-Type'] || headers['content-type'];
31725
      if (contentType) {
31726
        contentType = contentType.split(';')[0].trim();
31727
      }
31728
    }
31729
    $('.response_body', $(this.el)).removeClass('json');
31730
    $('.response_body', $(this.el)).removeClass('xml');
31731
31732
    var supportsAudioPlayback = function(contentType){
31733
      var audioElement = document.createElement('audio');
31734
      return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, ''));
31735
    };
31736
31737
    var pre;
31738
    var code;
31739
    if (!content) {
31740
      code = $('<code />').text('no content');
31741
      pre = $('<pre class="json" />').append(code);
31742
31743
    // JSON
31744
    } else if (contentType === 'application/json' || /\+json$/.test(contentType)) {
31745
      var json = null;
31746
      try {
31747
        json = JSON.stringify(JSON.parse(content), null, '  ');
31748
      } catch (_error) {
31749
        json = 'can\'t parse JSON.  Raw result:\n\n' + content;
31750
      }
31751
      code = $('<code />').text(json);
31752
      pre = $('<pre class="json" />').append(code);
31753
31754
    // XML
31755
    } else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) {
31756
      code = $('<code />').text(this.formatXml(content));
31757
      pre = $('<pre class="xml" />').append(code);
31758
31759
    // HTML
31760
    } else if (contentType === 'text/html') {
31761
      code = $('<code />').html(_.escape(content));
31762
      pre = $('<pre class="xml" />').append(code);
31763
31764
    // Plain Text
31765
    } else if (/text\/plain/.test(contentType)) {
31766
      code = $('<code />').text(content);
31767
      pre = $('<pre class="plain" />').append(code);
31768
31769
31770
    // Image
31771
    } else if (/^image\//.test(contentType)) {
31772
      pre = $('<img>').attr('src', url);
31773
31774
    // Audio
31775
    } else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
31776
      pre = $('<audio controls>').append($('<source>').attr('src', url).attr('type', contentType));
31777
31778
    // Download
31779
    } else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
31780
               headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
31781
               headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
31782
               headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
31783
31784
      if ('Blob' in window) {
31785
        var type = contentType || 'text/html';
31786
        var blob = new Blob([content], {type: type});
31787
        var a = document.createElement('a');
31788
        var href = window.URL.createObjectURL(blob);
31789
        var fileName = response.url.substr(response.url.lastIndexOf('/') + 1);
31790
        var download = [type, fileName, href].join(':');
31791
31792
        a.setAttribute('href', href);
31793
        a.setAttribute('download', download);
31794
        a.innerText = 'Download ' + fileName;
31795
31796
        pre = $('<div/>').append(a);
31797
      } else {
31798
        pre = $('<pre class="json" />').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
31799
      }
31800
31801
    // Location header based redirect download
31802
    } else if(headers.location || headers.Location) {
31803
      window.location = response.url;
31804
31805
    // Anything else (CORS)
31806
    } else {
31807
      code = $('<code />').text(content);
31808
      pre = $('<pre class="json" />').append(code);
31809
    }
31810
    var response_body = pre;
31811
    $('.request_url', $(this.el)).html('<pre></pre>');
31812
    $('.request_url pre', $(this.el)).text(url);
31813
    $('.response_code', $(this.el)).html('<pre>' + response.status + '</pre>');
31814
    $('.response_body', $(this.el)).html(response_body);
31815
    $('.response_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(response.headers, null, '  ')).replace(/\n/g, '<br>') + '</pre>');
31816
    $('.response', $(this.el)).slideDown();
31817
    $('.response_hider', $(this.el)).show();
31818
    $('.response_throbber', $(this.el)).hide();
31819
31820
31821
    //adds curl output
31822
    var curlCommand = this.model.asCurl(this.map);
31823
    curlCommand = curlCommand.replace('!', '&#33;');
31824
    $( '.curl', $(this.el)).html('<pre>' + curlCommand + '</pre>');
31825
31826
    // only highlight the response if response is less than threshold, default state is highlight response
31827
    var opts = this.options.swaggerOptions;
31828
31829
    if (opts.showRequestHeaders) {
31830
      var form = $('.sandbox', $(this.el)),
31831
        map = this.getInputMap(form),
31832
        requestHeaders = this.model.getHeaderParams(map);
31833
      delete requestHeaders['Content-Type'];
31834
      $('.request_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(requestHeaders, null, '  ')).replace(/\n/g, '<br>') + '</pre>');
31835
    }
31836
31837
    var response_body_el = $('.response_body', $(this.el))[0];
31838
    // only highlight the response if response is less than threshold, default state is highlight response
31839
    if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold) {
31840
      return response_body_el;
31841
    } else {
31842
      return hljs.highlightBlock(response_body_el);
31843
    }
31844
  },
31845
31846
  toggleOperationContent: function (event) {
31847
    var elem = $('#' + Docs.escapeResourceName(this.parentId + '_' + this.nickname + '_content'));
31848
    if (elem.is(':visible')){
31849
      event.preventDefault();
31850
      $.bbq.pushState('#/', 2);
31851
      Docs.collapseOperation(elem);
31852
    } else {
31853
      Docs.expandOperation(elem);
31854
    }
31855
  },
31856
31857
  getTextAreaValue: function(textArea) {
31858
    var param, parsed, result, i;
31859
    if (textArea.value === null || jQuery.trim(textArea.value).length === 0) {
31860
      return null;
31861
    }
31862
    param = this.getParamByName(textArea.name);
31863
    if (param && param.type && param.type.toLowerCase() === 'array') {
31864
      parsed = textArea.value.split('\n');
31865
      result = [];
31866
      for (i = 0; i < parsed.length; i++) {
31867
        if (parsed[i] !== null && jQuery.trim(parsed[i]).length > 0) {
31868
          result.push(parsed[i]);
31869
        }
31870
      }
31871
      return result.length > 0 ? result : null;
31872
    } else {
31873
      return textArea.value;
31874
    }
31875
  },
31876
31877
  getParamByName: function(name) {
31878
    var i;
31879
    if (this.model.parameters) {
31880
      for(i = 0; i < this.model.parameters.length; i++) {
31881
        if (this.model.parameters[i].name === name) {
31882
          return this.model.parameters[i];
31883
        }
31884
      }
31885
    }
31886
    return null;
31887
  }
31888
31889
});
31890
31891
'use strict';
31892
31893
SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
31894
  initialize: function  () {},
31895
31896
  render: function(){
31897
    this.model.parameterContentTypeId = 'pct' + Math.random();
31898
    $(this.el).html(Handlebars.templates.parameter_content_type(this.model));
31899
    return this;
31900
  }
31901
31902
});
31903
'use strict';
31904
31905
SwaggerUi.Views.ParameterView = Backbone.View.extend({
31906
  initialize: function(){
31907
    Handlebars.registerHelper('isArray', function(param, opts) {
31908
      if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
31909
        return opts.fn(this);
31910
      } else {
31911
        return opts.inverse(this);
31912
      }
31913
    });
31914
  },
31915
31916
  render: function() {
31917
    var type = this.model.type || this.model.dataType;
31918
31919
    if (typeof type === 'undefined') {
31920
      var schema = this.model.schema;
31921
      if (schema && schema.$ref) {
31922
        var ref = schema.$ref;
31923
        if (ref.indexOf('#/definitions/') === 0) {
31924
          type = ref.substring('#/definitions/'.length);
31925
        } else {
31926
          type = ref;
31927
        }
31928
      }
31929
    }
31930
31931
    this.model.type = type;
31932
    this.model.paramType = this.model.in || this.model.paramType;
31933
    this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body';
31934
    this.model.isFile = type && type.toLowerCase() === 'file';
31935
31936
    // Allow for default === false
31937
    if(typeof this.model.default === 'undefined') {
31938
      this.model.default = this.model.defaultValue;
31939
    }
31940
31941
    this.model.hasDefault = (typeof this.model.default !== 'undefined');
31942
    this.model.valueId = 'm' + this.model.name + Math.random();
31943
31944
    if (this.model.allowableValues) {
31945
      this.model.isList = true;
31946
    }
31947
31948
    var template = this.template();
31949
    $(this.el).html(template(this.model));
31950
31951
    var signatureModel = {
31952
      sampleJSON: this.model.sampleJSON,
31953
      isParam: true,
31954
      signature: this.model.signature
31955
    };
31956
31957
    if (this.model.sampleJSON) {
31958
      var signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'});
31959
      $('.model-signature', $(this.el)).append(signatureView.render().el);
31960
    }
31961
    else {
31962
      $('.model-signature', $(this.el)).html(this.model.signature);
31963
    }
31964
31965
    var isParam = false;
31966
31967
    if (this.model.isBody) {
31968
      isParam = true;
31969
    }
31970
31971
    var contentTypeModel = {
31972
      isParam: isParam
31973
    };
31974
31975
    contentTypeModel.consumes = this.model.consumes;
31976
31977
    if (isParam) {
31978
      var parameterContentTypeView = new SwaggerUi.Views.ParameterContentTypeView({model: contentTypeModel});
31979
      $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
31980
    }
31981
31982
    else {
31983
      var responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({model: contentTypeModel});
31984
      $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
31985
    }
31986
31987
    return this;
31988
  },
31989
31990
  // Return an appropriate template based on if the parameter is a list, readonly, required
31991
  template: function(){
31992
    if (this.model.isList) {
31993
      return Handlebars.templates.param_list;
31994
    } else {
31995
      if (this.options.readOnly) {
31996
        if (this.model.required) {
31997
          return Handlebars.templates.param_readonly_required;
31998
        } else {
31999
          return Handlebars.templates.param_readonly;
32000
        }
32001
      } else {
32002
        if (this.model.required) {
32003
          return Handlebars.templates.param_required;
32004
        } else {
32005
          return Handlebars.templates.param;
32006
        }
32007
      }
32008
    }
32009
  }
32010
});
32011
32012
'use strict';
32013
32014
SwaggerUi.Views.ResourceView = Backbone.View.extend({
32015
  initialize: function(opts) {
32016
    opts = opts || {};
32017
    this.router = opts.router;
32018
    this.auths = opts.auths;
32019
    if ('' === this.model.description) {
32020
      this.model.description = null;
32021
    }
32022
    if (this.model.description) {
32023
      this.model.summary = this.model.description;
32024
    }
32025
  },
32026
32027
  render: function(){
32028
    var methods = {};
32029
32030
32031
    $(this.el).html(Handlebars.templates.resource(this.model));
32032
32033
    // Render each operation
32034
    for (var i = 0; i < this.model.operationsArray.length; i++) {
32035
      var operation = this.model.operationsArray[i];
32036
      var counter = 0;
32037
      var id = operation.nickname;
32038
32039
      while (typeof methods[id] !== 'undefined') {
32040
        id = id + '_' + counter;
32041
        counter += 1;
32042
      }
32043
32044
      methods[id] = operation;
32045
32046
      operation.nickname = id;
32047
      operation.parentId = this.model.id;
32048
      this.addOperation(operation);
32049
    }
32050
32051
    $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
32052
    $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
32053
    $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
32054
32055
    return this;
32056
  },
32057
32058
  addOperation: function(operation) {
32059
32060
    operation.number = this.number;
32061
32062
    // Render an operation and add it to operations li
32063
    var operationView = new SwaggerUi.Views.OperationView({
32064
      model: operation,
32065
      router: this.router,
32066
      tagName: 'li',
32067
      className: 'endpoint',
32068
      swaggerOptions: this.options.swaggerOptions,
32069
      auths: this.auths
32070
    });
32071
32072
    $('.endpoints', $(this.el)).append(operationView.render().el);
32073
32074
    this.number++;
32075
32076
  },
32077
  // Generic Event handler (`Docs` is global)
32078
32079
32080
  callDocs: function(fnName, e) {
32081
    e.preventDefault();
32082
    Docs[fnName](e.currentTarget.getAttribute('data-id'));
32083
  }
32084
});
32085
'use strict';
32086
32087
SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({
32088
  initialize: function(){},
32089
32090
  render: function(){
32091
    this.model.responseContentTypeId = 'rct' + Math.random();
32092
    $(this.el).html(Handlebars.templates.response_content_type(this.model));
32093
    return this;
32094
  }
32095
});
32096
'use strict';
32097
32098
SwaggerUi.Views.SignatureView = Backbone.View.extend({
32099
  events: {
32100
    'click a.description-link'       : 'switchToDescription',
32101
    'click a.snippet-link'           : 'switchToSnippet',
32102
    'mousedown .snippet'          : 'snippetToTextArea'
32103
  },
32104
32105
  initialize: function () {
32106
32107
  },
32108
32109
  render: function(){
32110
32111
    $(this.el).html(Handlebars.templates.signature(this.model));
32112
32113
    this.switchToSnippet();
32114
32115
    this.isParam = this.model.isParam;
32116
32117
    if (this.isParam) {
32118
      $('.notice', $(this.el)).text('Click to set as parameter value');
32119
    }
32120
32121
    return this;
32122
  },
32123
32124
  // handler for show signature
32125
  switchToDescription: function(e){
32126
    if (e) { e.preventDefault(); }
32127
32128
    $('.snippet', $(this.el)).hide();
32129
    $('.description', $(this.el)).show();
32130
    $('.description-link', $(this.el)).addClass('selected');
32131
    $('.snippet-link', $(this.el)).removeClass('selected');
32132
  },
32133
32134
  // handler for show sample
32135
  switchToSnippet: function(e){
32136
    if (e) { e.preventDefault(); }
32137
32138
    $('.description', $(this.el)).hide();
32139
    $('.snippet', $(this.el)).show();
32140
    $('.snippet-link', $(this.el)).addClass('selected');
32141
    $('.description-link', $(this.el)).removeClass('selected');
32142
  },
32143
32144
  // handler for snippet to text area
32145
  snippetToTextArea: function(e) {
32146
    if (this.isParam) {
32147
      if (e) { e.preventDefault(); }
32148
32149
      var textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
32150
32151
      // Fix for bug in IE 10/11 which causes placeholder text to be copied to "value"
32152
      if ($.trim(textArea.val()) === '' || textArea.prop('placeholder') === textArea.val()) {
32153
        textArea.val(this.model.sampleJSON);
32154
      }
32155
    }
32156
  }
32157
});
32158
'use strict';
32159
32160
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
32161
  initialize: function (opts) {
32162
    this.options = opts || {};
32163
    this.router = this.options.router;
32164
  },
32165
32166
  render: function(){
32167
    $(this.el).html(Handlebars.templates.status_code(this.model));
32168
32169
    if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
32170
      var responseModel = {
32171
        sampleJSON: JSON.stringify(this.router.api.models[this.model.responseModel].createJSONSample(), null, 2),
32172
        isParam: false,
32173
        signature: this.router.api.models[this.model.responseModel].getMockSignature(),
32174
      };
32175
32176
      var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
32177
      $('.model-signature', this.$el).append(responseModelView.render().el);
32178
    } else {
32179
      $('.model-signature', this.$el).html('');
32180
    }
32181
    return this;
32182
  }
32183
});}).call(this);
(-)a/api/v1/doc/swagger-ui.min.js (-1 / +32183 lines)
Line 0 Link Here
0
- 
1
/**
2
 * swagger-ui - Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
3
 * @version v2.1.1
4
 * @link http://swagger.io
5
 * @license Apache-2.0
6
 */
7
(function(){this["Handlebars"] = this["Handlebars"] || {};
8
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
9
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
10
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
11
  return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n  <div class='key_input_container'>\n    <div class='auth_label'><label for='input_apiKey_entry'>"
12
    + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
13
    + "</label></div>\n    <input placeholder='api_key' class='auth_input' id='input_apiKey_entry' name='apiKey' type='text'/>\n    <div class='auth_submit'><a class='auth_submit_button' id='apply_api_key' href='#' data-sw-translate>apply</a></div>\n  </div>\n</div>\n";
14
},"useData":true});
15
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
16
  return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n  <div class='key_input_container'>\n    <div class=\"auth_label\"><label for=\"input_username\" data-sw-translate>Username</label></div>\n    <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n    <div class=\"auth_label\"><label for=\"password\" data-sw-translate>Password</label></div>\n    <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
17
  },"useData":true});
18
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
19
  var stack1, buffer = "";
20
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
21
  if (stack1 != null) { buffer += stack1; }
22
  return buffer;
23
},"2":function(depth0,helpers,partials,data) {
24
  var stack1, lambda=this.lambda, buffer = "	<option value=\"";
25
  stack1 = lambda(depth0, depth0);
26
  if (stack1 != null) { buffer += stack1; }
27
  buffer += "\">";
28
  stack1 = lambda(depth0, depth0);
29
  if (stack1 != null) { buffer += stack1; }
30
  return buffer + "</option>\n";
31
},"4":function(depth0,helpers,partials,data) {
32
  return "  <option value=\"application/json\">application/json</option>\n";
33
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
34
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
35
    + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
36
    + "\">Response Content Type</label>\n<select name=\"contentType\" id=\""
37
    + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
38
    + "\">\n";
39
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
40
  if (stack1 != null) { buffer += stack1; }
41
  return buffer + "</select>\n";
42
},"useData":true});
43
'use strict';
44
45
46
$(function() {
47
48
	// Helper function for vertically aligning DOM elements
49
	// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
50
	$.fn.vAlign = function() {
51
		return this.each(function(){
52
			var ah = $(this).height();
53
			var ph = $(this).parent().height();
54
			var mh = (ph - ah) / 2;
55
			$(this).css('margin-top', mh);
56
		});
57
	};
58
59
	$.fn.stretchFormtasticInputWidthToParent = function() {
60
		return this.each(function(){
61
			var p_width = $(this).closest("form").innerWidth();
62
			var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10);
63
			var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
64
			$(this).css('width', p_width - p_padding - this_padding);
65
		});
66
	};
67
68
	$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
69
70
	// Vertically center these paragraphs
71
	// Parent may need a min-height for this to work..
72
	$('ul.downplayed li div.content p').vAlign();
73
74
	// When a sandbox form is submitted..
75
	$("form.sandbox").submit(function(){
76
77
		var error_free = true;
78
79
		// Cycle through the forms required inputs
80
 		$(this).find("input.required").each(function() {
81
82
			// Remove any existing error styles from the input
83
			$(this).removeClass('error');
84
85
			// Tack the error style on if the input is empty..
86
			if ($(this).val() === '') {
87
				$(this).addClass('error');
88
				$(this).wiggle();
89
				error_free = false;
90
			}
91
92
		});
93
94
		return error_free;
95
	});
96
97
});
98
99
function clippyCopiedCallback() {
100
  $('#api_key_copied').fadeIn().delay(1000).fadeOut();
101
102
  // var b = $("#clippy_tooltip_" + a);
103
  // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
104
  //   b.attr("title", "copy to clipboard")
105
  // },
106
  // 500))
107
}
108
109
// Logging function that accounts for browsers that don't have window.console
110
function log(){
111
  log.history = log.history || [];
112
  log.history.push(arguments);
113
  if(this.console){
114
    console.log( Array.prototype.slice.call(arguments)[0] );
115
  }
116
}
117
118
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
119
if (Function.prototype.bind && console && typeof console.log === "object") {
120
    [
121
      "log","info","warn","error","assert","dir","clear","profile","profileEnd"
122
    ].forEach(function (method) {
123
        console[method] = this.bind(console[method], console);
124
    }, Function.prototype.call);
125
}
126
127
window.Docs = {
128
129
	shebang: function() {
130
131
		// If shebang has an operation nickname in it..
132
		// e.g. /docs/#!/words/get_search
133
		var fragments = $.param.fragment().split('/');
134
		fragments.shift(); // get rid of the bang
135
136
		switch (fragments.length) {
137
			case 1:
138
        if (fragments[0].length > 0) { // prevent matching "#/"
139
          // Expand all operations for the resource and scroll to it
140
          var dom_id = 'resource_' + fragments[0];
141
142
          Docs.expandEndpointListForResource(fragments[0]);
143
          $("#"+dom_id).slideto({highlight: false});
144
        }
145
				break;
146
			case 2:
147
				// Refer to the endpoint DOM element, e.g. #words_get_search
148
149
        // Expand Resource
150
        Docs.expandEndpointListForResource(fragments[0]);
151
        $("#"+dom_id).slideto({highlight: false});
152
153
        // Expand operation
154
				var li_dom_id = fragments.join('_');
155
				var li_content_dom_id = li_dom_id + "_content";
156
157
158
				Docs.expandOperation($('#'+li_content_dom_id));
159
				$('#'+li_dom_id).slideto({highlight: false});
160
				break;
161
		}
162
163
	},
164
165
	toggleEndpointListForResource: function(resource) {
166
		var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
167
		if (elem.is(':visible')) {
168
			Docs.collapseEndpointListForResource(resource);
169
		} else {
170
			Docs.expandEndpointListForResource(resource);
171
		}
172
	},
173
174
	// Expand resource
175
	expandEndpointListForResource: function(resource) {
176
		var resource = Docs.escapeResourceName(resource);
177
		if (resource == '') {
178
			$('.resource ul.endpoints').slideDown();
179
			return;
180
		}
181
182
		$('li#resource_' + resource).addClass('active');
183
184
		var elem = $('li#resource_' + resource + ' ul.endpoints');
185
		elem.slideDown();
186
	},
187
188
	// Collapse resource and mark as explicitly closed
189
	collapseEndpointListForResource: function(resource) {
190
		var resource = Docs.escapeResourceName(resource);
191
		if (resource == '') {
192
			$('.resource ul.endpoints').slideUp();
193
			return;
194
		}
195
196
		$('li#resource_' + resource).removeClass('active');
197
198
		var elem = $('li#resource_' + resource + ' ul.endpoints');
199
		elem.slideUp();
200
	},
201
202
	expandOperationsForResource: function(resource) {
203
		// Make sure the resource container is open..
204
		Docs.expandEndpointListForResource(resource);
205
206
		if (resource == '') {
207
			$('.resource ul.endpoints li.operation div.content').slideDown();
208
			return;
209
		}
210
211
		$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
212
			Docs.expandOperation($(this));
213
		});
214
	},
215
216
	collapseOperationsForResource: function(resource) {
217
		// Make sure the resource container is open..
218
		Docs.expandEndpointListForResource(resource);
219
220
		if (resource == '') {
221
			$('.resource ul.endpoints li.operation div.content').slideUp();
222
			return;
223
		}
224
225
		$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
226
			Docs.collapseOperation($(this));
227
		});
228
	},
229
230
	escapeResourceName: function(resource) {
231
		return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
232
	},
233
234
	expandOperation: function(elem) {
235
		elem.slideDown();
236
	},
237
238
	collapseOperation: function(elem) {
239
		elem.slideUp();
240
	}
241
};
242
243
'use strict';
244
245
Handlebars.registerHelper('sanitize', function(html) {
246
    // Strip the script tags from the html, and return it as a Handlebars.SafeString
247
    html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
248
    return new Handlebars.SafeString(html);
249
});
250
251
Handlebars.registerHelper('renderTextParam', function(param) {
252
    var result, type = 'text', idAtt = '';
253
    var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple;
254
    var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default;
255
256
    var dataVendorExtensions = Object.keys(param).filter(function(property) {
257
        // filter X-data- properties
258
        return property.match(/^X-data-/i) !== null;
259
    }).reduce(function(result, property) {
260
        // remove X- from property name, so it results in html attributes like data-foo='bar'
261
        return result += ' ' + property.substring(2, property.length) + '=\'' + param[property] + '\'';
262
    }, '');
263
264
    if (typeof defaultValue === 'undefined') {
265
        defaultValue = '';
266
    }
267
268
    if(param.format && param.format === 'password') {
269
        type = 'password';
270
    }
271
272
    if(param.valueId) {
273
        idAtt = ' id=\'' + param.valueId + '\'';
274
    }
275
276
    if(isArray) {
277
        result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt + dataVendorExtensions;
278
        result += ' placeholder=\'Provide multiple values in new lines' + (param.required ? ' (at least one required).' : '.') + '\'>';
279
        result += defaultValue + '</textarea>';
280
    } else {
281
        var parameterClass = 'parameter';
282
        if(param.required) {
283
          parameterClass += ' required';
284
        }
285
        result = '<input class=\'' + parameterClass + '\' minlength=\'' + (param.required ? 1 : 0) + '\'';
286
        result += ' name=\'' + param.name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions;
287
        result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
288
    }
289
    return new Handlebars.SafeString(result);
290
});
291
292
this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
293
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "  <div class=\"info_title\">"
294
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
295
    + "</div>\n  <div class=\"info_description markdown\">";
296
  stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
297
  if (stack1 != null) { buffer += stack1; }
298
  buffer += "</div>\n";
299
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
300
  if (stack1 != null) { buffer += stack1; }
301
  buffer += "  ";
302
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
303
  if (stack1 != null) { buffer += stack1; }
304
  buffer += "\n  ";
305
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
306
  if (stack1 != null) { buffer += stack1; }
307
  buffer += "\n  ";
308
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
309
  if (stack1 != null) { buffer += stack1; }
310
  buffer += "\n  ";
311
  stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
312
  if (stack1 != null) { buffer += stack1; }
313
  buffer += "\n  ";
314
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
315
  if (stack1 != null) { buffer += stack1; }
316
  return buffer + "\n";
317
},"2":function(depth0,helpers,partials,data) {
318
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
319
  return "  <p>"
320
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.description : stack1), depth0))
321
    + "</p>\n  <a href=\""
322
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
323
    + "\" target=\"_blank\">"
324
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
325
    + "</a>\n";
326
},"4":function(depth0,helpers,partials,data) {
327
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
328
  return "<div class=\"info_tos\"><a href=\""
329
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
330
    + "\" data-sw-translate>Terms of service</a></div>";
331
},"6":function(depth0,helpers,partials,data) {
332
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
333
  return "<div class='info_name' data-sw-translate>Created by "
334
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
335
    + "</div>";
336
},"8":function(depth0,helpers,partials,data) {
337
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
338
  return "<div class='info_url' data-sw-translate>See more at <a href=\""
339
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
340
    + "\">"
341
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
342
    + "</a></div>";
343
},"10":function(depth0,helpers,partials,data) {
344
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
345
  return "<div class='info_email'><a href=\"mailto:"
346
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
347
    + "?subject="
348
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
349
    + "\" data-sw-translate>Contact the developer</a></div>";
350
},"12":function(depth0,helpers,partials,data) {
351
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
352
  return "<div class='info_license'><a href='"
353
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
354
    + "'>"
355
    + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
356
    + "</a></div>";
357
},"14":function(depth0,helpers,partials,data) {
358
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
359
  return "  , <span style=\"font-variant: small-caps\" data-sw-translate>api version</span>: "
360
    + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
361
    + "\n    ";
362
},"16":function(depth0,helpers,partials,data) {
363
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
364
  return "    <span style=\"float:right\"><a href=\""
365
    + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
366
    + "/debug?url="
367
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
368
    + "\"><img id=\"validator\" src=\""
369
    + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
370
    + "?url="
371
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
372
    + "\"></a>\n    </span>\n";
373
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
374
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
375
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
376
  if (stack1 != null) { buffer += stack1; }
377
  buffer += "</div>\n<div class='container' id='resources_container'>\n  <ul id='resources'></ul>\n\n  <div class=\"footer\">\n    <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
378
    + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
379
    + "\n";
380
  stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
381
  if (stack1 != null) { buffer += stack1; }
382
  buffer += "]\n";
383
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
384
  if (stack1 != null) { buffer += stack1; }
385
  return buffer + "    </h4>\n    </div>\n</div>\n";
386
},"useData":true});
387
this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
388
  return "deprecated";
389
  },"3":function(depth0,helpers,partials,data) {
390
  return "            <h4>Warning: Deprecated</h4>\n";
391
  },"5":function(depth0,helpers,partials,data) {
392
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "        <h4>Implementation Notes</h4>\n        <div class=\"markdown\">";
393
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
394
  if (stack1 != null) { buffer += stack1; }
395
  return buffer + "</div>\n";
396
},"7":function(depth0,helpers,partials,data) {
397
  return "        <div class=\"auth\">\n        <span class=\"api-ic ic-error\">";
398
  },"9":function(depth0,helpers,partials,data) {
399
  var stack1, buffer = "          <div class=\"api_information_panel\">\n";
400
  stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
401
  if (stack1 != null) { buffer += stack1; }
402
  return buffer + "          </div>\n";
403
},"10":function(depth0,helpers,partials,data) {
404
  var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "            <div title='";
405
  stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
406
  if (stack1 != null) { buffer += stack1; }
407
  return buffer + "'>"
408
    + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
409
    + "</div>\n";
410
},"12":function(depth0,helpers,partials,data) {
411
  return "</span></div>";
412
  },"14":function(depth0,helpers,partials,data) {
413
  return "        <div class='access'>\n          <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n        </div>\n";
414
  },"16":function(depth0,helpers,partials,data) {
415
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
416
  return "          <h4><span data-sw-translate>Response Class</span> (<span data-sw-translate>Status</span> "
417
    + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
418
    + ")</h4>\n          <p><span class=\"model-signature\" /></p>\n          <br/>\n          <div class=\"response-content-type\" />\n";
419
},"18":function(depth0,helpers,partials,data) {
420
  return "          <h4 data-sw-translate>Parameters</h4>\n          <table class='fullwidth'>\n          <thead>\n            <tr>\n            <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter</th>\n            <th style=\"width: 310px; max-width: 310px\" data-sw-translate>Value</th>\n            <th style=\"width: 200px; max-width: 200px\" data-sw-translate>Description</th>\n            <th style=\"width: 100px; max-width: 100px\" data-sw-translate>Parameter Type</th>\n            <th style=\"width: 220px; max-width: 230px\" data-sw-translate>Data Type</th>\n            </tr>\n          </thead>\n          <tbody class=\"operation-params\">\n\n          </tbody>\n          </table>\n";
421
  },"20":function(depth0,helpers,partials,data) {
422
  return "          <div style='margin:0;padding:0;display:inline'></div>\n          <h4 data-sw-translate>Response Messages</h4>\n          <table class='fullwidth'>\n            <thead>\n            <tr>\n              <th data-sw-translate>HTTP Status Code</th>\n              <th data-sw-translate>Reason</th>\n              <th data-sw-translate>Response Model</th>\n              <th data-sw-translate>Headers</th>\n            </tr>\n            </thead>\n            <tbody class=\"operation-status\">\n\n            </tbody>\n          </table>\n";
423
  },"22":function(depth0,helpers,partials,data) {
424
  return "";
425
},"24":function(depth0,helpers,partials,data) {
426
  return "          <div class='sandbox_header'>\n            <input class='submit' type='button' value='Try it out!' data-sw-translate/>\n            <a href='#' class='response_hider' style='display:none' data-sw-translate>Hide Response</a>\n            <span class='response_throbber' style='display:none'></span>\n          </div>\n";
427
  },"26":function(depth0,helpers,partials,data) {
428
  return "          <h4 data-sw-translate>Request Headers</h4>\n          <div class='block request_headers'></div>\n";
429
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
430
  var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n  <ul class='operations' >\n    <li class='"
431
    + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
432
    + " operation' id='"
433
    + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
434
    + "_"
435
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
436
    + "'>\n      <div class='heading'>\n        <h3>\n          <span class='http_method'>\n          <a href='#!/"
437
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
438
    + "/"
439
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
440
    + "' class=\"toggleOperation\">"
441
    + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
442
    + "</a>\n          </span>\n          <span class='path'>\n          <a href='#!/"
443
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
444
    + "/"
445
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
446
    + "' class=\"toggleOperation ";
447
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
448
  if (stack1 != null) { buffer += stack1; }
449
  buffer += "\">"
450
    + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
451
    + "</a>\n          </span>\n        </h3>\n        <ul class='options'>\n          <li>\n          <a href='#!/"
452
    + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
453
    + "/"
454
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
455
    + "' class=\"toggleOperation\">";
456
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
457
  if (stack1 != null) { buffer += stack1; }
458
  buffer += "</a>\n          </li>\n        </ul>\n      </div>\n      <div class='content' id='"
459
    + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
460
    + "_"
461
    + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
462
    + "_content' style='display:none'>\n";
463
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
464
  if (stack1 != null) { buffer += stack1; }
465
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
466
  if (stack1 != null) { buffer += stack1; }
467
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
468
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
469
  if (stack1 != null) { buffer += stack1; }
470
  buffer += "\n";
471
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
472
  if (stack1 != null) { buffer += stack1; }
473
  buffer += "        ";
474
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
475
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
476
  if (stack1 != null) { buffer += stack1; }
477
  buffer += "\n";
478
  stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
479
  if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
480
  if (stack1 != null) { buffer += stack1; }
481
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
482
  if (stack1 != null) { buffer += stack1; }
483
  buffer += "        <form accept-charset='UTF-8' class='sandbox'>\n          <div style='margin:0;padding:0;display:inline'></div>\n";
484
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
485
  if (stack1 != null) { buffer += stack1; }
486
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
487
  if (stack1 != null) { buffer += stack1; }
488
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
489
  if (stack1 != null) { buffer += stack1; }
490
  buffer += "        </form>\n        <div class='response' style='display:none'>\n          <h4>Curl</h4>\n          <div class='block curl'></div>\n          <h4 data-sw-translate>Request URL</h4>\n          <div class='block request_url'></div>\n";
491
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showRequestHeaders : depth0), {"name":"if","hash":{},"fn":this.program(26, data),"inverse":this.noop,"data":data});
492
  if (stack1 != null) { buffer += stack1; }
493
  return buffer + "          <h4 data-sw-translate>Response Body</h4>\n          <div class='block response_body'></div>\n          <h4 data-sw-translate>Response Code</h4>\n          <div class='block response_code'></div>\n          <h4 data-sw-translate>Response Headers</h4>\n          <div class='block response_headers'></div>\n        </div>\n      </div>\n    </li>\n  </ul>\n";
494
},"useData":true});
495
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
496
  return " required";
497
  },"3":function(depth0,helpers,partials,data) {
498
  return " multiple=\"multiple\"";
499
  },"5":function(depth0,helpers,partials,data) {
500
  return " required ";
501
  },"7":function(depth0,helpers,partials,data) {
502
  var stack1, buffer = "      <option ";
503
  stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.hasDefault : depth0), {"name":"unless","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
504
  if (stack1 != null) { buffer += stack1; }
505
  return buffer + " value=''></option>\n";
506
},"8":function(depth0,helpers,partials,data) {
507
  return "  selected=\"\" ";
508
  },"10":function(depth0,helpers,partials,data) {
509
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "\n      <option ";
510
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data});
511
  if (stack1 != null) { buffer += stack1; }
512
  buffer += "  value='"
513
    + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
514
    + "'> "
515
    + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
516
    + " ";
517
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data});
518
  if (stack1 != null) { buffer += stack1; }
519
  return buffer + " </option>\n\n";
520
},"11":function(depth0,helpers,partials,data) {
521
  return " selected=\"\"  ";
522
  },"13":function(depth0,helpers,partials,data) {
523
  return " (default) ";
524
  },"15":function(depth0,helpers,partials,data) {
525
  return "<strong>";
526
  },"17":function(depth0,helpers,partials,data) {
527
  return "</strong>";
528
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
529
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code";
530
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
531
  if (stack1 != null) { buffer += stack1; }
532
  buffer += "'><label for='"
533
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
534
    + "'>"
535
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
536
    + "</label></td>\n<td>\n  <select ";
537
  stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}));
538
  if (stack1 != null) { buffer += stack1; }
539
  buffer += " class=\"parameter ";
540
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
541
  if (stack1 != null) { buffer += stack1; }
542
  buffer += "\" name=\""
543
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
544
    + "\" id=\""
545
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
546
    + "\">\n\n";
547
  stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"unless","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data});
548
  if (stack1 != null) { buffer += stack1; }
549
  buffer += "\n";
550
  stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
551
  if (stack1 != null) { buffer += stack1; }
552
  buffer += "\n  </select>\n</td>\n<td class=\"markdown\">";
553
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(15, data),"inverse":this.noop,"data":data});
554
  if (stack1 != null) { buffer += stack1; }
555
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
556
  if (stack1 != null) { buffer += stack1; }
557
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(17, data),"inverse":this.noop,"data":data});
558
  if (stack1 != null) { buffer += stack1; }
559
  buffer += "</td>\n<td>";
560
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
561
  if (stack1 != null) { buffer += stack1; }
562
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
563
},"useData":true});
564
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
565
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
566
  return "        <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
567
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
568
    + "' id='"
569
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
570
    + "'>"
571
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
572
    + "</textarea>\n";
573
},"3":function(depth0,helpers,partials,data) {
574
  var stack1, buffer = "";
575
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
576
  if (stack1 != null) { buffer += stack1; }
577
  return buffer;
578
},"4":function(depth0,helpers,partials,data) {
579
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
580
  return "            "
581
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
582
    + "\n";
583
},"6":function(depth0,helpers,partials,data) {
584
  return "            (empty)\n";
585
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
586
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
587
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
588
    + "'>"
589
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
590
    + "</label></td>\n<td>\n";
591
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
592
  if (stack1 != null) { buffer += stack1; }
593
  buffer += "</td>\n<td class=\"markdown\">";
594
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
595
  if (stack1 != null) { buffer += stack1; }
596
  buffer += "</td>\n<td>";
597
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
598
  if (stack1 != null) { buffer += stack1; }
599
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
600
},"useData":true});
601
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
602
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
603
  return "        <textarea class='body-textarea' readonly='readonly' name='"
604
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
605
    + "' id='"
606
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
607
    + "'>"
608
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
609
    + "</textarea>\n";
610
},"3":function(depth0,helpers,partials,data) {
611
  var stack1, buffer = "";
612
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
613
  if (stack1 != null) { buffer += stack1; }
614
  return buffer;
615
},"4":function(depth0,helpers,partials,data) {
616
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
617
  return "            "
618
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
619
    + "\n";
620
},"6":function(depth0,helpers,partials,data) {
621
  return "            (empty)\n";
622
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
623
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
624
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
625
    + "'>"
626
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
627
    + "</label></td>\n<td>\n";
628
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
629
  if (stack1 != null) { buffer += stack1; }
630
  buffer += "</td>\n<td class=\"markdown\">";
631
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
632
  if (stack1 != null) { buffer += stack1; }
633
  buffer += "</td>\n<td>";
634
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
635
  if (stack1 != null) { buffer += stack1; }
636
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
637
},"useData":true});
638
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
639
  var stack1, buffer = "";
640
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
641
  if (stack1 != null) { buffer += stack1; }
642
  return buffer;
643
},"2":function(depth0,helpers,partials,data) {
644
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
645
  return "			<input type=\"file\" name='"
646
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
647
    + "' id='"
648
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
649
    + "'/>\n";
650
},"4":function(depth0,helpers,partials,data) {
651
  var stack1, buffer = "";
652
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
653
  if (stack1 != null) { buffer += stack1; }
654
  return buffer;
655
},"5":function(depth0,helpers,partials,data) {
656
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
657
  return "				<textarea class='body-textarea required' placeholder='(required)' name='"
658
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
659
    + "' id=\""
660
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
661
    + "\">"
662
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
663
    + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
664
},"7":function(depth0,helpers,partials,data) {
665
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
666
  return "				<textarea class='body-textarea required' placeholder='(required)' name='"
667
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
668
    + "' id='"
669
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
670
    + "'></textarea>\n				<br />\n				<div class=\"parameter-content-type\" />\n";
671
},"9":function(depth0,helpers,partials,data) {
672
  var stack1, buffer = "";
673
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
674
  if (stack1 != null) { buffer += stack1; }
675
  return buffer;
676
},"10":function(depth0,helpers,partials,data) {
677
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
678
  return "			<input class='parameter' class='required' type='file' name='"
679
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
680
    + "' id='"
681
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
682
    + "'/>\n";
683
},"12":function(depth0,helpers,partials,data) {
684
  var stack1, helperMissing=helpers.helperMissing, buffer = "";
685
  stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data}));
686
  if (stack1 != null) { buffer += stack1; }
687
  return buffer;
688
},"13":function(depth0,helpers,partials,data) {
689
  return "";
690
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
691
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
692
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
693
    + "'>"
694
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
695
    + "</label></td>\n<td>\n";
696
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
697
  if (stack1 != null) { buffer += stack1; }
698
  buffer += "</td>\n<td>\n	<strong><span class=\"markdown\">";
699
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
700
  if (stack1 != null) { buffer += stack1; }
701
  buffer += "</span></strong>\n</td>\n<td>";
702
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
703
  if (stack1 != null) { buffer += stack1; }
704
  return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
705
},"useData":true});
706
this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
707
  var stack1, buffer = "";
708
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
709
  if (stack1 != null) { buffer += stack1; }
710
  return buffer;
711
},"2":function(depth0,helpers,partials,data) {
712
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
713
  return "			<input type=\"file\" name='"
714
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
715
    + "' id='"
716
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
717
    + "'/>\n			<div class=\"parameter-content-type\" />\n";
718
},"4":function(depth0,helpers,partials,data) {
719
  var stack1, buffer = "";
720
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
721
  if (stack1 != null) { buffer += stack1; }
722
  return buffer;
723
},"5":function(depth0,helpers,partials,data) {
724
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
725
  return "				<textarea class='body-textarea' name='"
726
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
727
    + "' id='"
728
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
729
    + "'>"
730
    + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
731
    + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
732
},"7":function(depth0,helpers,partials,data) {
733
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
734
  return "				<textarea class='body-textarea' name='"
735
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
736
    + "' id='"
737
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
738
    + "'></textarea>\n				<br />\n				<div class=\"parameter-content-type\" />\n";
739
},"9":function(depth0,helpers,partials,data) {
740
  var stack1, buffer = "";
741
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
742
  if (stack1 != null) { buffer += stack1; }
743
  return buffer;
744
},"10":function(depth0,helpers,partials,data) {
745
  var stack1, helperMissing=helpers.helperMissing, buffer = "";
746
  stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data}));
747
  if (stack1 != null) { buffer += stack1; }
748
  return buffer;
749
},"11":function(depth0,helpers,partials,data) {
750
  return "";
751
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
752
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
753
    + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
754
    + "'>"
755
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
756
    + "</label></td>\n<td>\n\n";
757
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
758
  if (stack1 != null) { buffer += stack1; }
759
  buffer += "\n</td>\n<td class=\"markdown\">";
760
  stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
761
  if (stack1 != null) { buffer += stack1; }
762
  buffer += "</td>\n<td>";
763
  stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
764
  if (stack1 != null) { buffer += stack1; }
765
  return buffer + "</td>\n<td>\n	<span class=\"model-signature\"></span>\n</td>\n";
766
},"useData":true});
767
this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
768
  var stack1, buffer = "";
769
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
770
  if (stack1 != null) { buffer += stack1; }
771
  return buffer;
772
},"2":function(depth0,helpers,partials,data) {
773
  var stack1, lambda=this.lambda, buffer = "  <option value=\"";
774
  stack1 = lambda(depth0, depth0);
775
  if (stack1 != null) { buffer += stack1; }
776
  buffer += "\">";
777
  stack1 = lambda(depth0, depth0);
778
  if (stack1 != null) { buffer += stack1; }
779
  return buffer + "</option>\n";
780
},"4":function(depth0,helpers,partials,data) {
781
  return "  <option value=\"application/json\">application/json</option>\n";
782
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
783
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label for=\""
784
    + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
785
    + "\">Parameter content type:</label>\n<select name=\"parameterContentType\" id=\""
786
    + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
787
    + "\">\n";
788
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
789
  if (stack1 != null) { buffer += stack1; }
790
  return buffer + "</select>\n";
791
},"useData":true});
792
this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
793
  return " : ";
794
  },"3":function(depth0,helpers,partials,data) {
795
  var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
796
  return "    <li>\n      <a href='"
797
    + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
798
    + "' data-sw-translate>Raw</a>\n    </li>\n";
799
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
800
  var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n  <h2>\n    <a href='#!/"
801
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
802
    + "' class=\"toggleEndpointList\" data-id=\""
803
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
804
    + "\">"
805
    + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
806
    + "</a> ";
807
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
808
  if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
809
  if (stack1 != null) { buffer += stack1; }
810
  stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
811
  if (stack1 != null) { buffer += stack1; }
812
  buffer += "\n  </h2>\n  <ul class='options'>\n    <li>\n      <a href='#!/"
813
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
814
    + "' id='endpointListTogger_"
815
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
816
    + "' class=\"toggleEndpointList\" data-id=\""
817
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
818
    + "\" data-sw-translate>Show/Hide</a>\n    </li>\n    <li>\n      <a href='#' class=\"collapseResource\" data-id=\""
819
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
820
    + "\" data-sw-translate>\n        List Operations\n      </a>\n    </li>\n    <li>\n      <a href='#' class=\"expandResource\" data-id=\""
821
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
822
    + "\" data-sw-translate>\n        Expand Operations\n      </a>\n    </li>\n";
823
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.url : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
824
  if (stack1 != null) { buffer += stack1; }
825
  return buffer + "  </ul>\n</div>\n<ul class='endpoints' id='"
826
    + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
827
    + "_endpoint_list' style='display:none'>\n\n</ul>\n";
828
},"useData":true});
829
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
830
  var stack1, buffer = "";
831
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
832
  if (stack1 != null) { buffer += stack1; }
833
  return buffer;
834
},"2":function(depth0,helpers,partials,data) {
835
  var stack1, lambda=this.lambda, buffer = "  <option value=\"";
836
  stack1 = lambda(depth0, depth0);
837
  if (stack1 != null) { buffer += stack1; }
838
  buffer += "\">";
839
  stack1 = lambda(depth0, depth0);
840
  if (stack1 != null) { buffer += stack1; }
841
  return buffer + "</option>\n";
842
},"4":function(depth0,helpers,partials,data) {
843
  return "  <option value=\"application/json\">application/json</option>\n";
844
  },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
845
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
846
    + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
847
    + "\">Response Content Type</label>\n<select name=\"responseContentType\" id=\""
848
    + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
849
    + "\">\n";
850
  stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
851
  if (stack1 != null) { buffer += stack1; }
852
  return buffer + "</select>\n";
853
},"useData":true});
854
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
855
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n  <li><a class=\"description-link\" href=\"#\" data-sw-translate>Model</a></li>\n  <li><a class=\"snippet-link\" href=\"#\" data-sw-translate>Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n  <div class=\"description\">\n    ";
856
  stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
857
  if (stack1 != null) { buffer += stack1; }
858
  return buffer + "\n  </div>\n\n  <div class=\"snippet\">\n    <pre><code>"
859
    + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
860
    + "</code></pre>\n    <small class=\"notice\"></small>\n  </div>\n</div>\n\n";
861
},"useData":true});
862
this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
863
  var lambda=this.lambda, escapeExpression=this.escapeExpression;
864
  return "      <tr>\n        <td>"
865
    + escapeExpression(lambda((data && data.key), depth0))
866
    + "</td>\n        <td>"
867
    + escapeExpression(lambda((depth0 != null ? depth0.description : depth0), depth0))
868
    + "</td>\n        <td>"
869
    + escapeExpression(lambda((depth0 != null ? depth0.type : depth0), depth0))
870
    + "</td>\n      </tr>\n";
871
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
872
  var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
873
    + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
874
    + "</td>\n<td class=\"markdown\">";
875
  stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
876
  if (stack1 != null) { buffer += stack1; }
877
  buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>\n<td class=\"headers\">\n  <table>\n    <tbody>\n";
878
  stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
879
  if (stack1 != null) { buffer += stack1; }
880
  return buffer + "    </tbody>\n  </table>\n</td>";
881
},"useData":true});
882
/**
883
 * swagger-client - swagger-client is a javascript client for use with swaggering APIs.
884
 * @version v2.1.2
885
 * @link http://swagger.io
886
 * @license Apache-2.0
887
 */
888
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SwaggerClient = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
889
'use strict';
890
891
var auth = require('./lib/auth');
892
var helpers = require('./lib/helpers');
893
var SwaggerClient = require('./lib/client');
894
var deprecationWrapper = function (url, options) {
895
  helpers.log('This is deprecated, use "new SwaggerClient" instead.');
896
897
  return new SwaggerClient(url, options);
898
};
899
900
/* Here for IE8 Support */
901
if (!Array.prototype.indexOf) {
902
  Array.prototype.indexOf = function(obj, start) {
903
    for (var i = (start || 0), j = this.length; i < j; i++) {
904
      if (this[i] === obj) { return i; }
905
    }
906
    return -1;
907
  };
908
}
909
910
/* Here for IE8 Support */
911
if (!String.prototype.trim) {
912
  String.prototype.trim = function () {
913
    return this.replace(/^\s+|\s+$/g, '');
914
  };
915
}
916
917
/* Here for node 10.x support */
918
if (!String.prototype.endsWith) {
919
  String.prototype.endsWith = function(suffix) {
920
    return this.indexOf(suffix, this.length - suffix.length) !== -1;
921
  };
922
}
923
924
module.exports = SwaggerClient;
925
926
SwaggerClient.ApiKeyAuthorization = auth.ApiKeyAuthorization;
927
SwaggerClient.PasswordAuthorization = auth.PasswordAuthorization;
928
SwaggerClient.CookieAuthorization = auth.CookieAuthorization;
929
SwaggerClient.SwaggerApi = deprecationWrapper;
930
SwaggerClient.SwaggerClient = deprecationWrapper;
931
SwaggerClient.SchemaMarkup = require('./lib/schema-markup');
932
933
},{"./lib/auth":2,"./lib/client":3,"./lib/helpers":4,"./lib/schema-markup":7}],2:[function(require,module,exports){
934
'use strict';
935
936
var helpers = require('./helpers');
937
var btoa = require('btoa'); // jshint ignore:line
938
var CookieJar = require('cookiejar');
939
var _ = {
940
  each: require('lodash-compat/collection/each'),
941
  includes: require('lodash-compat/collection/includes'),
942
  isObject: require('lodash-compat/lang/isObject'),
943
  isArray: require('lodash-compat/lang/isArray')
944
};
945
946
/**
947
 * SwaggerAuthorizations applys the correct authorization to an operation being executed
948
 */
949
var SwaggerAuthorizations = module.exports.SwaggerAuthorizations = function (authz) {
950
  this.authz = authz || {};
951
};
952
953
/**
954
 * Add auths to the hash
955
 * Will overwrite any existing
956
 *
957
 */
958
SwaggerAuthorizations.prototype.add = function (name, auth) {
959
  if(_.isObject(name)) {
960
    for (var key in name) {
961
      this.authz[key] = name[key];
962
    }
963
  } else if(typeof name === 'string' ){
964
    this.authz[name] = auth;
965
  }
966
967
  return auth;
968
};
969
970
SwaggerAuthorizations.prototype.remove = function (name) {
971
  return delete this.authz[name];
972
};
973
974
SwaggerAuthorizations.prototype.apply = function (obj, securities) {
975
  var status = true;
976
  var applyAll = !securities;
977
  var flattenedSecurities = [];
978
979
  // Securities could be [ {} ]
980
  _.each(securities, function (obj, key) {
981
982
    // Make sure we account for securities being [ str ]
983
    if(typeof key === 'string') {
984
      flattenedSecurities.push(key);
985
    }
986
987
    // Flatten keys in to our array
988
    _.each(obj, function (val, key) {
989
      flattenedSecurities.push(key);
990
    });
991
  });
992
993
  _.each(this.authz, function (auth, authName) {
994
    if(applyAll || _.includes(flattenedSecurities, authName)) {
995
      var newStatus = auth.apply(obj);
996
      status = status && !!newStatus; // logical ORs regarding status
997
    }
998
  });
999
1000
  return status;
1001
};
1002
1003
/**
1004
 * ApiKeyAuthorization allows a query param or header to be injected
1005
 */
1006
var ApiKeyAuthorization = module.exports.ApiKeyAuthorization = function (name, value, type) {
1007
  this.name = name;
1008
  this.value = value;
1009
  this.type = type;
1010
};
1011
1012
ApiKeyAuthorization.prototype.apply = function (obj) {
1013
  if (this.type === 'query') {
1014
    if (obj.url.indexOf('?') > 0) {
1015
      obj.url = obj.url + '&' + this.name + '=' + this.value;
1016
    } else {
1017
      obj.url = obj.url + '?' + this.name + '=' + this.value;
1018
    }
1019
1020
    return true;
1021
  } else if (this.type === 'header') {
1022
    if(typeof obj.headers[this.name] === 'undefined') {
1023
      obj.headers[this.name] = this.value;
1024
    }
1025
1026
    return true;
1027
  }
1028
};
1029
1030
var CookieAuthorization = module.exports.CookieAuthorization = function (cookie) {
1031
  this.cookie = cookie;
1032
};
1033
1034
CookieAuthorization.prototype.apply = function (obj) {
1035
  obj.cookieJar = obj.cookieJar || new CookieJar();
1036
  obj.cookieJar.setCookie(this.cookie);
1037
1038
  return true;
1039
};
1040
1041
/**
1042
 * Password Authorization is a basic auth implementation
1043
 */
1044
var PasswordAuthorization = module.exports.PasswordAuthorization = function (username, password) {
1045
  if (arguments.length === 3) {
1046
    helpers.log('PasswordAuthorization: the \'name\' argument has been removed, pass only username and password');
1047
    username = arguments[1];
1048
    password = arguments[2];
1049
  }
1050
  this.username = username;
1051
  this.password = password;
1052
};
1053
1054
PasswordAuthorization.prototype.apply = function (obj) {
1055
  if(typeof obj.headers.Authorization === 'undefined') {
1056
    obj.headers.Authorization = 'Basic ' + btoa(this.username + ':' + this.password);
1057
  }
1058
1059
  return true;
1060
};
1061
1062
},{"./helpers":4,"btoa":18,"cookiejar":19,"lodash-compat/collection/each":55,"lodash-compat/collection/includes":58,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isObject":147}],3:[function(require,module,exports){
1063
'use strict';
1064
1065
var _ = {
1066
  bind: require('lodash-compat/function/bind'),
1067
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
1068
  find: require('lodash-compat/collection/find'),
1069
  forEach: require('lodash-compat/collection/forEach'),
1070
  indexOf: require('lodash-compat/array/indexOf'),
1071
  isArray: require('lodash-compat/lang/isArray'),
1072
  isObject: require('lodash-compat/lang/isObject'),
1073
  isFunction: require('lodash-compat/lang/isFunction'),
1074
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
1075
  isUndefined: require('lodash-compat/lang/isUndefined')
1076
};
1077
var auth = require('./auth');
1078
var helpers = require('./helpers');
1079
var Model = require('./types/model');
1080
var Operation = require('./types/operation');
1081
var OperationGroup = require('./types/operationGroup');
1082
var Resolver = require('./resolver');
1083
var SwaggerHttp = require('./http');
1084
var SwaggerSpecConverter = require('./spec-converter');
1085
1086
// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1087
// following usage: 'client.{tagName}'
1088
var reservedClientTags = [
1089
  'apis',
1090
  'authorizationScheme',
1091
  'authorizations',
1092
  'basePath',
1093
  'build',
1094
  'buildFrom1_1Spec',
1095
  'buildFrom1_2Spec',
1096
  'buildFromSpec',
1097
  'clientAuthorizations',
1098
  'convertInfo',
1099
  'debug',
1100
  'defaultErrorCallback',
1101
  'defaultSuccessCallback',
1102
  'fail',
1103
  'failure',
1104
  'finish',
1105
  'help',
1106
  'idFromOp',
1107
  'info',
1108
  'initialize',
1109
  'isBuilt',
1110
  'isValid',
1111
  'modelPropertyMacro',
1112
  'models',
1113
  'modelsArray',
1114
  'options',
1115
  'parameterMacro',
1116
  'parseUri',
1117
  'progress',
1118
  'resourceCount',
1119
  'sampleModels',
1120
  'selfReflect',
1121
  'setConsolidatedModels',
1122
  'spec',
1123
  'supportedSubmitMethods',
1124
  'swaggerRequestHeaders',
1125
  'tagFromLabel',
1126
  'url',
1127
  'useJQuery'
1128
];
1129
// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1130
// following usage: 'client.apis.{tagName}'
1131
var reservedApiTags = [
1132
  'apis',
1133
  'asCurl',
1134
  'description',
1135
  'externalDocs',
1136
  'help',
1137
  'label',
1138
  'name',
1139
  'operation',
1140
  'operations',
1141
  'operationsArray',
1142
  'path',
1143
  'tag'
1144
];
1145
var supportedOperationMethods = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put'];
1146
var SwaggerClient = module.exports = function (url, options) {
1147
  this.authorizations = null;
1148
  this.authorizationScheme = null;
1149
  this.basePath = null;
1150
  this.debug = false;
1151
  this.info = null;
1152
  this.isBuilt = false;
1153
  this.isValid = false;
1154
  this.modelsArray = [];
1155
  this.resourceCount = 0;
1156
  this.url = null;
1157
  this.useJQuery = false;
1158
  this.swaggerObject = {}
1159
1160
  this.clientAuthorizations = new auth.SwaggerAuthorizations();
1161
1162
  if (typeof url !== 'undefined') {
1163
    return this.initialize(url, options);
1164
  } else {
1165
    return this;
1166
  }
1167
};
1168
1169
SwaggerClient.prototype.initialize = function (url, options) {
1170
  this.models = {};
1171
  this.sampleModels = {};
1172
1173
  if (typeof url === 'string') {
1174
    this.url = url;
1175
  } else if (_.isObject(url)) {
1176
    options = url;
1177
    this.url = options.url;
1178
  }
1179
1180
  options = options || {};
1181
  this.clientAuthorizations.add(options.authorizations);
1182
  this.swaggerRequestHeaders = options.swaggerRequestHeaders || 'application/json;charset=utf-8,*/*';
1183
  this.defaultSuccessCallback = options.defaultSuccessCallback || null;
1184
  this.defaultErrorCallback = options.defaultErrorCallback || null;
1185
  this.modelPropertyMacro = options.modelPropertyMacro || null;
1186
  this.parameterMacro = options.modelPropertyMacro || null;
1187
1188
  if (typeof options.success === 'function') {
1189
    this.success = options.success;
1190
  }
1191
1192
  if (options.useJQuery) {
1193
    this.useJQuery = options.useJQuery;
1194
  }
1195
1196
  this.options = options || {};
1197
1198
  this.supportedSubmitMethods = options.supportedSubmitMethods || [];
1199
  this.failure = options.failure || function () {};
1200
  this.progress = options.progress || function () {};
1201
  this.spec = _.cloneDeep(options.spec); // Clone so we do not alter the provided document
1202
1203
  if (typeof options.success === 'function') {
1204
    this.ready = true;
1205
    this.build();
1206
  }
1207
};
1208
1209
SwaggerClient.prototype.build = function (mock) {
1210
  if (this.isBuilt) {
1211
    return this;
1212
  }
1213
1214
  var self = this;
1215
1216
  this.progress('fetching resource list: ' + this.url);
1217
1218
  var obj = {
1219
    useJQuery: this.useJQuery,
1220
    url: this.url,
1221
    method: 'get',
1222
    headers: {
1223
      accept: this.swaggerRequestHeaders
1224
    },
1225
    on: {
1226
      error: function (response) {
1227
        if (self.url.substring(0, 4) !== 'http') {
1228
          return self.fail('Please specify the protocol for ' + self.url);
1229
        } else if (response.status === 0) {
1230
          return self.fail('Can\'t read from server.  It may not have the appropriate access-control-origin settings.');
1231
        } else if (response.status === 404) {
1232
          return self.fail('Can\'t read swagger JSON from ' + self.url);
1233
        } else {
1234
          return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
1235
        }
1236
      },
1237
      response: function (resp) {
1238
1239
        var responseObj = resp.obj;
1240
        if(!responseObj) {
1241
          return self.fail('failed to parse JSON/YAML response');
1242
        }
1243
1244
        self.swaggerVersion = responseObj.swaggerVersion;
1245
        self.swaggerObject = responseObj
1246
1247
        if (responseObj.swagger && parseInt(responseObj.swagger) === 2) {
1248
          self.swaggerVersion = responseObj.swagger;
1249
1250
          new Resolver().resolve(responseObj, self.url, self.buildFromSpec, self);
1251
1252
          self.isValid = true;
1253
        } else {
1254
          var converter = new SwaggerSpecConverter();
1255
          self.oldSwaggerObject = self.swaggerObject
1256
1257
          converter.setDocumentationLocation(self.url);
1258
          converter.convert(responseObj, self.clientAuthorizations, function(spec) {
1259
            self.swaggerObject = spec
1260
            new Resolver().resolve(spec, self.url, self.buildFromSpec, self);
1261
            self.isValid = true;
1262
          });
1263
        }
1264
      }
1265
    }
1266
  };
1267
1268
  if (this.spec) {
1269
    self.swaggerObject = this.spec
1270
    setTimeout(function () {
1271
      new Resolver().resolve(self.spec, self.buildFromSpec, self);
1272
    }, 10);
1273
  } else {
1274
    this.clientAuthorizations.apply(obj);
1275
1276
    if (mock) {
1277
      return obj;
1278
    }
1279
1280
    new SwaggerHttp().execute(obj, this.options);
1281
  }
1282
1283
  return this;
1284
};
1285
1286
SwaggerClient.prototype.buildFromSpec = function (response) {
1287
  if (this.isBuilt) {
1288
    return this;
1289
  }
1290
1291
  this.apis = {};
1292
  this.apisArray = [];
1293
  this.basePath = response.basePath || '';
1294
  this.consumes = response.consumes;
1295
  this.host = response.host || '';
1296
  this.info = response.info || {};
1297
  this.produces = response.produces;
1298
  this.schemes = response.schemes || [];
1299
  this.securityDefinitions = response.securityDefinitions;
1300
  this.title = response.title || '';
1301
1302
  if (response.externalDocs) {
1303
    this.externalDocs = response.externalDocs;
1304
  }
1305
1306
  // legacy support
1307
  this.authSchemes = response.securityDefinitions;
1308
1309
  var definedTags = {};
1310
  var k;
1311
1312
  if (Array.isArray(response.tags)) {
1313
    definedTags = {};
1314
1315
    for (k = 0; k < response.tags.length; k++) {
1316
      var t = response.tags[k];
1317
      definedTags[t.name] = t;
1318
    }
1319
  }
1320
1321
  var location;
1322
1323
  if (typeof this.url === 'string') {
1324
    location = this.parseUri(this.url);
1325
    if (typeof this.schemes === 'undefined' || this.schemes.length === 0) {
1326
      this.scheme = location.scheme || 'http';
1327
    } else {
1328
      this.scheme = this.schemes[0];
1329
    }
1330
1331
    if (typeof this.host === 'undefined' || this.host === '') {
1332
      this.host = location.host;
1333
1334
      if (location.port) {
1335
        this.host = this.host + ':' + location.port;
1336
      }
1337
    }
1338
  }
1339
  else {
1340
    if (typeof this.schemes === 'undefined' || this.schemes.length === 0) {
1341
      this.scheme = 'http';
1342
    }
1343
    else {
1344
      this.scheme = this.schemes[0];
1345
    }
1346
  }
1347
1348
  this.definitions = response.definitions;
1349
1350
  var key;
1351
1352
  for (key in this.definitions) {
1353
    var model = new Model(key, this.definitions[key], this.models, this.modelPropertyMacro);
1354
1355
    if (model) {
1356
      this.models[key] = model;
1357
    }
1358
  }
1359
1360
  // get paths, create functions for each operationId
1361
  var self = this;
1362
1363
  // Bind help to 'client.apis'
1364
  self.apis.help = _.bind(self.help, self);
1365
1366
  _.forEach(response.paths, function (pathObj, path) {
1367
    // Only process a path if it's an object
1368
    if (!_.isPlainObject(pathObj)) {
1369
      return;
1370
    }
1371
1372
    _.forEach(supportedOperationMethods, function (method) {
1373
      var operation = pathObj[method];
1374
1375
      if (_.isUndefined(operation)) {
1376
        // Operation does not exist
1377
        return;
1378
      } else if (!_.isPlainObject(operation)) {
1379
        // Operation exists but it is not an Operation Object.  Since this is invalid, log it.
1380
        helpers.log('The \'' + method + '\' operation for \'' + path + '\' path is not an Operation Object');
1381
1382
        return;
1383
      }
1384
1385
      var tags = operation.tags;
1386
1387
      if (_.isUndefined(tags) || !_.isArray(tags) || tags.length === 0) {
1388
        tags = operation.tags = [ 'default' ];
1389
      }
1390
1391
      var operationId = self.idFromOp(path, method, operation);
1392
      var operationObject = new Operation(self,
1393
        operation.scheme,
1394
        operationId,
1395
        method,
1396
        path,
1397
        operation,
1398
        self.definitions,
1399
        self.models,
1400
        self.clientAuthorizations);
1401
1402
      // bind self operation's execute command to the api
1403
      _.forEach(tags, function (tag) {
1404
        var clientProperty = _.indexOf(reservedClientTags, tag) > -1 ? '_' + tag : tag;
1405
        var apiProperty = _.indexOf(reservedApiTags, tag) > -1 ? '_' + tag : tag;
1406
        var operationGroup = self[clientProperty];
1407
1408
        if (clientProperty !== tag) {
1409
          helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient function/property name.  Use \'client.' +
1410
                      clientProperty + '\' or \'client.apis.' + tag + '\' instead of \'client.' + tag + '\'.');
1411
        }
1412
1413
        if (apiProperty !== tag) {
1414
          helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient operation function/property name.  Use ' +
1415
                      '\'client.apis.' + apiProperty + '\' instead of \'client.apis.' + tag + '\'.');
1416
        }
1417
1418
        if (_.indexOf(reservedApiTags, operationId) > -1) {
1419
          helpers.log('The \'' + operationId + '\' operationId conflicts with a SwaggerClient operation ' +
1420
                      'function/property name.  Use \'client.apis.' + apiProperty + '._' + operationId +
1421
                      '\' instead of \'client.apis.' + apiProperty + '.' + operationId + '\'.');
1422
1423
          operationId = '_' + operationId;
1424
          operationObject.nickname = operationId; // So 'client.apis.[tag].operationId.help() works properly
1425
        }
1426
1427
        if (_.isUndefined(operationGroup)) {
1428
          operationGroup = self[clientProperty] = self.apis[apiProperty] = {};
1429
1430
          operationGroup.operations = {};
1431
          operationGroup.label = apiProperty;
1432
          operationGroup.apis = {};
1433
1434
          var tagDef = definedTags[tag];
1435
1436
          if (!_.isUndefined(tagDef)) {
1437
            operationGroup.description = tagDef.description;
1438
            operationGroup.externalDocs = tagDef.externalDocs;
1439
          }
1440
1441
          self[clientProperty].help = _.bind(self.help, operationGroup);
1442
          self.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
1443
        }
1444
1445
        // Bind tag help
1446
        if (!_.isFunction(operationGroup.help)) {
1447
          operationGroup.help = _.bind(self.help, operationGroup);
1448
        }
1449
1450
        // bind to the apis object
1451
        self.apis[apiProperty][operationId] = operationGroup[operationId] = _.bind(operationObject.execute,
1452
                                                                                  operationObject);
1453
        self.apis[apiProperty][operationId].help = operationGroup[operationId].help = _.bind(operationObject.help,
1454
                                                                                             operationObject);
1455
        self.apis[apiProperty][operationId].asCurl = operationGroup[operationId].asCurl = _.bind(operationObject.asCurl,
1456
                                                                                                 operationObject);
1457
1458
        operationGroup.apis[operationId] = operationGroup.operations[operationId] = operationObject;
1459
1460
        // legacy UI feature
1461
        var api = _.find(self.apisArray, function (api) {
1462
          return api.tag === tag;
1463
        });
1464
1465
        if (api) {
1466
          api.operationsArray.push(operationObject);
1467
        }
1468
      });
1469
    });
1470
  });
1471
1472
  this.isBuilt = true;
1473
1474
  if (this.success) {
1475
    this.isValid = true;
1476
    this.isBuilt = true;
1477
    this.success();
1478
  }
1479
1480
  return this;
1481
};
1482
1483
SwaggerClient.prototype.parseUri = function (uri) {
1484
  var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
1485
  var parts = urlParseRE.exec(uri);
1486
1487
  return {
1488
    scheme: parts[4].replace(':',''),
1489
    host: parts[11],
1490
    port: parts[12],
1491
    path: parts[15]
1492
  };
1493
};
1494
1495
SwaggerClient.prototype.help = function (dontPrint) {
1496
  var output = '';
1497
1498
  if (this instanceof SwaggerClient) {
1499
    _.forEach(this.apis, function (api, name) {
1500
      if (_.isPlainObject(api)) {
1501
        output += 'operations for the \'' + name + '\' tag\n';
1502
1503
        _.forEach(api.operations, function (operation, name) {
1504
          output += '  * ' + name + ': ' + operation.summary + '\n';
1505
        });
1506
      }
1507
    });
1508
  } else if (this instanceof OperationGroup || _.isPlainObject(this)) {
1509
    output += 'operations for the \'' + this.label + '\' tag\n';
1510
1511
    _.forEach(this.apis, function (operation, name) {
1512
      output += '  * ' + name + ': ' + operation.summary + '\n';
1513
    });
1514
  }
1515
1516
  if (dontPrint) {
1517
    return output;
1518
  } else {
1519
    helpers.log(output);
1520
1521
    return output;
1522
  }
1523
};
1524
1525
SwaggerClient.prototype.tagFromLabel = function (label) {
1526
  return label;
1527
};
1528
1529
SwaggerClient.prototype.idFromOp = function (path, httpMethod, op) {
1530
  if(!op || !op.operationId) {
1531
    op = op || {};
1532
    op.operationId = httpMethod + '_' + path;
1533
  }
1534
  var opId = op.operationId.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_') || (path.substring(1) + '_' + httpMethod);
1535
1536
  opId = opId.replace(/((_){2,})/g, '_');
1537
  opId = opId.replace(/^(_)*/g, '');
1538
  opId = opId.replace(/([_])*$/g, '');
1539
  return opId;
1540
};
1541
1542
SwaggerClient.prototype.setHost = function (host) {
1543
  this.host = host;
1544
1545
  if(this.apis) {
1546
    _.forEach(this.apis, function(api) {
1547
      if(api.operations) {
1548
        _.forEach(api.operations, function(operation) {
1549
          operation.host = host;
1550
        });
1551
      }
1552
    });
1553
  }
1554
};
1555
1556
SwaggerClient.prototype.setBasePath = function (basePath) {
1557
  this.basePath = basePath;
1558
1559
  if(this.apis) {
1560
    _.forEach(this.apis, function(api) {
1561
      if(api.operations) {
1562
        _.forEach(api.operations, function(operation) {
1563
          operation.basePath = basePath;
1564
        });
1565
      }
1566
    });
1567
  }
1568
};
1569
1570
SwaggerClient.prototype.fail = function (message) {
1571
  this.failure(message);
1572
1573
  throw message;
1574
};
1575
},{"./auth":2,"./helpers":4,"./http":5,"./resolver":6,"./spec-converter":8,"./types/model":9,"./types/operation":10,"./types/operationGroup":11,"lodash-compat/array/indexOf":52,"lodash-compat/collection/find":56,"lodash-compat/collection/forEach":57,"lodash-compat/function/bind":61,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isFunction":145,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isUndefined":151}],4:[function(require,module,exports){
1576
(function (process){
1577
'use strict';
1578
1579
var _ = {
1580
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
1581
  indexOf: require('lodash-compat/array/indexOf')
1582
};
1583
1584
module.exports.__bind = function (fn, me) {
1585
  return function(){
1586
    return fn.apply(me, arguments);
1587
  };
1588
};
1589
1590
var log = module.exports.log = function() {
1591
  // Only log if available and we're not testing
1592
  if (console && process.env.NODE_ENV !== 'test') {
1593
    console.log(Array.prototype.slice.call(arguments)[0]);
1594
  }
1595
};
1596
1597
module.exports.fail = function (message) {
1598
  log(message);
1599
};
1600
1601
var optionHtml = module.exports.optionHtml = function (label, value) {
1602
  return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
1603
};
1604
1605
var resolveSchema = module.exports.resolveSchema = function (schema) {
1606
  if (_.isPlainObject(schema.schema)) {
1607
    schema = resolveSchema(schema.schema);
1608
  }
1609
1610
  return schema;
1611
};
1612
1613
var simpleRef = module.exports.simpleRef = function (name) {
1614
  if (typeof name === 'undefined') {
1615
    return null;
1616
  }
1617
1618
  if (name.indexOf('#/definitions/') === 0) {
1619
    return name.substring('#/definitions/'.length);
1620
  } else {
1621
    return name;
1622
  }
1623
};
1624
1625
1626
}).call(this,require('_process'))
1627
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9oZWxwZXJzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgXyA9IHtcbiAgaXNQbGFpbk9iamVjdDogcmVxdWlyZSgnbG9kYXNoLWNvbXBhdC9sYW5nL2lzUGxhaW5PYmplY3QnKSxcbiAgaW5kZXhPZjogcm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ltcGxlUmVmID0gbW9kdWxlLmV4cG9ydHMuc2ltcGxlUmVmID0gZnVuY3Rpb24gKG5hbWUpIHtcbiAgaWYgKHR5cGVvZiBuYW1lID09PSAndW5kZWZpbmVkJykge1xuICAgIHJldHVybiBudWxsO1xuICB9XG5cbiAgaWYgKG5hbWUuaW5kZXhPZignIy9kZWZpbml0aW9ucy8nKSA9PT0gMCkge1xuICAgIHJldHVybiBuYW1lLnN1YnN0cmluZygnIy9kZWZpbml0aW9ucy8nLmxlbmd0aCk7XG4gIH0gZWxzZSB7XG4gICAgcmV0dXJuIG5hbWU7XG4gIH1cbn07XG5cbiJdfQ==
1628
},{"_process":17,"lodash-compat/array/indexOf":52,"lodash-compat/lang/isPlainObject":148}],5:[function(require,module,exports){
1629
'use strict';
1630
1631
var helpers = require('./helpers');
1632
var jQuery = require('jquery');
1633
var request = require('superagent');
1634
var jsyaml = require('js-yaml');
1635
var _ = {
1636
  isObject: require('lodash-compat/lang/isObject')
1637
};
1638
1639
/*
1640
 * JQueryHttpClient is a light-weight, node or browser HTTP client
1641
 */
1642
var JQueryHttpClient = function () {};
1643
1644
/*
1645
 * SuperagentHttpClient is a light-weight, node or browser HTTP client
1646
 */
1647
var SuperagentHttpClient = function () {};
1648
1649
/**
1650
 * SwaggerHttp is a wrapper for executing requests
1651
 */
1652
var SwaggerHttp = module.exports = function () {};
1653
1654
SwaggerHttp.prototype.execute = function (obj, opts) {
1655
  var client;
1656
1657
  if(opts && opts.client) {
1658
    client = opts.client;
1659
  }
1660
  else {
1661
    client = new SuperagentHttpClient(opts);
1662
  }
1663
1664
  // legacy support
1665
  if ((obj && obj.useJQuery === true) || this.isInternetExplorer()) {
1666
    client = new JQueryHttpClient(opts);
1667
  }
1668
1669
  var success = obj.on.response;
1670
1671
  var responseInterceptor = function(data) {
1672
    if(opts && opts.responseInterceptor) {
1673
      data = opts.responseInterceptor.apply(data);
1674
    }
1675
    success(data);
1676
  };
1677
1678
  obj.on.response = function(data) {
1679
    responseInterceptor(data);
1680
  };
1681
1682
1683
  if (_.isObject(obj) && _.isObject(obj.body)) {
1684
    // special processing for file uploads via jquery
1685
    if (obj.body.type && obj.body.type === 'formData'){
1686
      obj.contentType = false;
1687
      obj.processData = false;
1688
1689
      delete obj.headers['Content-Type'];
1690
    } else {
1691
      obj.body = JSON.stringify(obj.body);
1692
    }
1693
  }
1694
  client.execute(obj);
1695
};
1696
1697
SwaggerHttp.prototype.isInternetExplorer = function () {
1698
  var detectedIE = false;
1699
1700
  if (typeof navigator !== 'undefined' && navigator.userAgent) {
1701
    var nav = navigator.userAgent.toLowerCase();
1702
1703
    if (nav.indexOf('msie') !== -1) {
1704
      var version = parseInt(nav.split('msie')[1]);
1705
1706
      if (version <= 8) {
1707
        detectedIE = true;
1708
      }
1709
    }
1710
  }
1711
1712
  return detectedIE;
1713
};
1714
1715
JQueryHttpClient.prototype.execute = function (obj) {
1716
  var cb = obj.on;
1717
  var request = obj;
1718
1719
  obj.type = obj.method;
1720
  obj.cache = false;
1721
  delete obj.useJQuery;
1722
1723
  /*
1724
  obj.beforeSend = function (xhr) {
1725
    var key, results;
1726
    if (obj.headers) {
1727
      results = [];
1728
      for (key in obj.headers) {
1729
        if (key.toLowerCase() === 'content-type') {
1730
          results.push(obj.contentType = obj.headers[key]);
1731
        } else if (key.toLowerCase() === 'accept') {
1732
          results.push(obj.accepts = obj.headers[key]);
1733
        } else {
1734
          results.push(xhr.setRequestHeader(key, obj.headers[key]));
1735
        }
1736
      }
1737
      return results;
1738
    }
1739
  };*/
1740
1741
  obj.data = obj.body;
1742
1743
  delete obj.body;
1744
1745
  obj.complete = function (response) {
1746
    var headers = {};
1747
    var headerArray = response.getAllResponseHeaders().split('\n');
1748
1749
    for (var i = 0; i < headerArray.length; i++) {
1750
      var toSplit = headerArray[i].trim();
1751
1752
      if (toSplit.length === 0) {
1753
        continue;
1754
      }
1755
1756
      var separator = toSplit.indexOf(':');
1757
1758
      if (separator === -1) {
1759
        // Name but no value in the header
1760
        headers[toSplit] = null;
1761
1762
        continue;
1763
      }
1764
1765
      var name = toSplit.substring(0, separator).trim();
1766
      var value = toSplit.substring(separator + 1).trim();
1767
1768
      headers[name] = value;
1769
    }
1770
1771
    var out = {
1772
      url: request.url,
1773
      method: request.method,
1774
      status: response.status,
1775
      statusText: response.statusText,
1776
      data: response.responseText,
1777
      headers: headers
1778
    };
1779
1780
    try {
1781
      var possibleObj =  response.responseJSON || jsyaml.safeLoad(response.responseText);
1782
      out.obj = (typeof possibleObj === 'string') ? {} : possibleObj;
1783
    } catch (ex) {
1784
      // do not set out.obj
1785
      helpers.log('unable to parse JSON/YAML content');
1786
    }
1787
1788
    // I can throw, or parse null?
1789
    out.obj = out.obj || null;
1790
1791
    if (response.status >= 200 && response.status < 300) {
1792
      cb.response(out);
1793
    } else if (response.status === 0 || (response.status >= 400 && response.status < 599)) {
1794
      cb.error(out);
1795
    } else {
1796
      return cb.response(out);
1797
    }
1798
  };
1799
1800
  jQuery.support.cors = true;
1801
1802
  return jQuery.ajax(obj);
1803
};
1804
1805
SuperagentHttpClient.prototype.execute = function (obj) {
1806
  var method = obj.method.toLowerCase();
1807
1808
  if (method === 'delete') {
1809
    method = 'del';
1810
  }
1811
  var headers = obj.headers || {};
1812
  var r = request[method](obj.url);
1813
  var name;
1814
  for (name in headers) {
1815
    r.set(name, headers[name]);
1816
  }
1817
1818
  if (obj.body) {
1819
    r.send(obj.body);
1820
  }
1821
1822
  if(typeof r.buffer === 'function') {
1823
    r.buffer(); // force superagent to populate res.text with the raw response data
1824
  }
1825
1826
  r.end(function (err, res) {
1827
    res = res || {
1828
      status: 0,
1829
      headers: {error: 'no response from server'}
1830
    };
1831
    var response = {
1832
      url: obj.url,
1833
      method: obj.method,
1834
      headers: res.headers
1835
    };
1836
    var cb;
1837
1838
    if (!err && res.error) {
1839
      err = res.error;
1840
    }
1841
1842
    if (err && obj.on && obj.on.error) {
1843
      response.obj = err;
1844
      response.status = res ? res.status : 500;
1845
      response.statusText = res ? res.text : err.message;
1846
      cb = obj.on.error;
1847
    } else if (res && obj.on && obj.on.response) {
1848
      var possibleObj;
1849
1850
      // Already parsed by by superagent?
1851
      if(res.body && Object.keys(res.body).length > 0) {
1852
        possibleObj = res.body;
1853
      } else {
1854
          try {
1855
            possibleObj = jsyaml.safeLoad(res.text);
1856
            // can parse into a string... which we don't need running around in the system
1857
            possibleObj = (typeof possibleObj === 'string') ? null : possibleObj;
1858
          } catch(e) {
1859
            helpers.log('cannot parse JSON/YAML content');
1860
          }
1861
      }
1862
1863
      // null means we can't parse into object
1864
      response.obj = possibleObj || null;
1865
1866
      response.status = res.status;
1867
      response.statusText = res.text;
1868
      cb = obj.on.response;
1869
    }
1870
    response.data = response.statusText;
1871
1872
    if (cb) {
1873
      cb(response);
1874
    }
1875
  });
1876
};
1877
1878
},{"./helpers":4,"jquery":20,"js-yaml":21,"lodash-compat/lang/isObject":147,"superagent":160}],6:[function(require,module,exports){
1879
'use strict';
1880
1881
var SwaggerHttp = require('./http');
1882
var _ = {
1883
  isObject: require('lodash-compat/lang/isObject'),
1884
  isArray: require('lodash-compat/lang/isArray')
1885
};
1886
1887
1888
/**
1889
 * Resolves a spec's remote references
1890
 */
1891
var Resolver = module.exports = function () {};
1892
1893
Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
1894
  var root = arg1, callback = arg2, scope = arg3, location, i;
1895
  if(typeof arg1 === 'function') {
1896
    root = null;
1897
    callback = arg1;
1898
    scope = arg2;
1899
  }
1900
  var _root = root;
1901
  this.scope = (scope || this);
1902
  this.iteration = this.iteration || 0;
1903
1904
  var name, path, property, propertyName;
1905
  var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {};
1906
  var resolutionTable = []; // store objects for dereferencing
1907
1908
  // definitions
1909
  for (name in spec.definitions) {
1910
    var definition = spec.definitions[name];
1911
    for (propertyName in definition.properties) {
1912
      property = definition.properties[propertyName];
1913
      this.resolveTo(root, property, resolutionTable, '/definitions');
1914
    }
1915
1916
    if(definition.allOf) {
1917
      definition['x-resolved-from'] = [ '#/definitions/' + name ];
1918
      var allOf = definition.allOf;
1919
      // the refs go first
1920
      allOf.sort(function(a, b) {
1921
        if(a.$ref && b.$ref) { return 0; }
1922
        else if(a.$ref) { return -1; }
1923
        else { return 1; }
1924
      });
1925
      for (i = 0; i < allOf.length; i++) {
1926
        property = allOf[i];
1927
        location = '/definitions/' + name + '/allOf';
1928
        this.resolveInline(null, spec, property, resolutionTable, unresolvedRefs, location);
1929
      }
1930
    }
1931
  }
1932
1933
  // operations
1934
  for (name in spec.paths) {
1935
    var method, operation, responseCode;
1936
    path = spec.paths[name];
1937
1938
    for (method in path) {
1939
      // operation reference
1940
      if(method === '$ref') {
1941
        // location = path[method];
1942
        location = '/paths' + name;
1943
        this.resolveInline(root, spec, path, resolutionTable, unresolvedRefs, location);
1944
      }
1945
      else {
1946
        operation = path[method];
1947
1948
        var parameters = operation.parameters;
1949
        for (i in parameters) {
1950
          var parameter = parameters[i];
1951
          location = '/paths' + name + '/' + method + '/parameters';
1952
1953
          if (parameter.in === 'body' && parameter.schema) {
1954
            this.resolveTo(root, parameter.schema, resolutionTable, location);
1955
          }
1956
1957
          if (parameter.$ref) {
1958
            // parameter reference
1959
            this.resolveInline(root, spec, parameter, resolutionTable, unresolvedRefs, parameter.$ref);
1960
          }
1961
        }
1962
1963
        for (responseCode in operation.responses) {
1964
          var response = operation.responses[responseCode];
1965
          location = '/paths' + name + '/' + method + '/responses/' + responseCode;
1966
1967
          if(_.isObject(response)) {
1968
            if(response.$ref) {
1969
              // response reference
1970
              this.resolveInline(root, spec, response, resolutionTable, unresolvedRefs, location);
1971
            }
1972
            if (response.schema) {
1973
              this.resolveTo(root, response.schema, resolutionTable, location);
1974
            }
1975
          }
1976
        }
1977
      }
1978
    }
1979
  }
1980
1981
  var expectedCalls = 0, toResolve = [];
1982
  // if the root is same as obj[i].root we can resolve locally
1983
  var all = resolutionTable;
1984
1985
  for(i = 0; i < all.length; i++) {
1986
    var a = all[i];
1987
    if(root === a.root) {
1988
      if(a.resolveAs === 'ref') {
1989
        // resolve any path walking
1990
        var joined = ((a.root || '') + '/' + a.key).split('/');
1991
        var normalized = [];
1992
        var url = '';
1993
        var k;
1994
1995
        if(a.key.indexOf('../') >= 0) {
1996
          for(var j = 0; j < joined.length; j++) {
1997
            if(joined[j] === '..') {
1998
              normalized = normalized.slice(0, normalized.length-1);
1999
            }
2000
            else {
2001
              normalized.push(joined[j]);
2002
            }
2003
          }
2004
          for(k = 0; k < normalized.length; k ++) {
2005
            if(k > 0) {
2006
              url += '/';
2007
            }
2008
            url += normalized[k];
2009
          }
2010
          // we now have to remote resolve this because the path has changed
2011
          a.root = url;
2012
          toResolve.push(a);
2013
        }
2014
        else {
2015
          var parts = a.key.split('#');
2016
          if(parts.length === 2) {
2017
            if(parts[0].indexOf('http://') === 0 || parts[0].indexOf('https://') === 0) {
2018
              a.root = parts[0];
2019
            }
2020
            location = parts[1].split('/');
2021
            var r;
2022
            var s = spec;
2023
            for(k = 0; k < location.length; k++) {
2024
              var part = location[k];
2025
              if(part !== '') {
2026
                s = s[part];
2027
                if(typeof s !== 'undefined') {
2028
                  r = s;
2029
                }
2030
                else {
2031
                  r = null;
2032
                  break;
2033
                }
2034
              }
2035
            }
2036
            if(r === null) {
2037
              // must resolve this too
2038
              toResolve.push(a);
2039
            }
2040
          }
2041
        }
2042
      }
2043
      else {
2044
        if (a.resolveAs === 'inline') {
2045
          toResolve.push(a);
2046
        }
2047
      }
2048
    }
2049
    else {
2050
      toResolve.push(a);
2051
    }
2052
  }
2053
  expectedCalls = toResolve.length;
2054
2055
  // resolve anything that is local
2056
  for(var ii = 0; ii < toResolve.length; ii++) {
2057
    (function(item, self) {
2058
      if(item.root === null) {
2059
        // local resolve
2060
        self.resolveItem(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, item);
2061
        processedCalls += 1;
2062
2063
        if(processedCalls === expectedCalls) {
2064
          self.finish(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2065
        }
2066
      }
2067
      else {
2068
        var obj = {
2069
          useJQuery: false,  // TODO
2070
          url: item.root,
2071
          method: 'get',
2072
          headers: {
2073
            accept: self.scope.swaggerRequestHeaders || 'application/json'
2074
          },
2075
          on: {
2076
            error: function () {
2077
              processedCalls += 1;
2078
              unresolvedRefs[item.key] = null;
2079
2080
              if (processedCalls === expectedCalls) {
2081
                self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2082
              }
2083
            },  // jshint ignore:line
2084
            response: function (response) {
2085
              var swagger = response.obj;
2086
              self.resolveItem(swagger, _root, resolutionTable, resolvedRefs, unresolvedRefs, item);
2087
              processedCalls += 1;
2088
2089
              if (processedCalls === expectedCalls) {
2090
                self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2091
              }
2092
            }
2093
          } // jshint ignore:line
2094
        };
2095
2096
        if (scope && scope.clientAuthorizations) {
2097
          scope.clientAuthorizations.apply(obj);
2098
        }
2099
        new SwaggerHttp().execute(obj);
2100
      }
2101
    }(toResolve[ii], this));
2102
  }
2103
2104
  if (Object.keys(toResolve).length === 0) {
2105
    this.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2106
  }
2107
};
2108
2109
Resolver.prototype.resolveItem = function(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, item) {
2110
  var path = item.location;
2111
  var location = spec, parts = path.split('/');
2112
  for (var j = 0; j < parts.length; j++) {
2113
    var segment = parts[j];
2114
    if(segment.indexOf('~1') !== -1) {
2115
      segment = parts[j].replace(/~0/g, '~').replace(/~1/g, '/');
2116
      if(segment.charAt(0) !== '/') {
2117
        segment = '/' + segment;
2118
      }
2119
    }
2120
    if (typeof location === 'undefined' || location === null) {
2121
      break;
2122
    }
2123
    if(segment === '' && j === (parts.length - 1)  && parts.length > 1) {
2124
      location = null;
2125
      break;
2126
    }
2127
    if (segment.length > 0) {
2128
      location = location[segment];
2129
    }
2130
  }
2131
  var resolved = item.key;
2132
  parts = item.key.split('/');
2133
  var resolvedName = parts[parts.length-1];
2134
2135
  if(resolvedName.indexOf('#') >= 0) {
2136
    resolvedName = resolvedName.split('#')[1];
2137
  }
2138
2139
  if (location !== null && typeof location !== 'undefined') {
2140
    resolvedRefs[resolved] = {
2141
      name: resolvedName,
2142
      obj: location,
2143
      key: item.key,
2144
      root: item.root
2145
    };
2146
  } else {
2147
    unresolvedRefs[resolved] = {
2148
      root: item.root,
2149
      location: item.location
2150
    };
2151
  }
2152
};
2153
2154
Resolver.prototype.finish = function (spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback) {
2155
  // walk resolution table and replace with resolved refs
2156
  var ref;
2157
  for (ref in resolutionTable) {
2158
    var item = resolutionTable[ref];
2159
2160
    var key = item.key;
2161
    var resolvedTo = resolvedRefs[key];
2162
    if (resolvedTo) {
2163
      spec.definitions = spec.definitions || {};
2164
      if (item.resolveAs === 'ref') {
2165
        spec.definitions[resolvedTo.name] = resolvedTo.obj;
2166
        item.obj.$ref = '#/definitions/' + resolvedTo.name;
2167
      } else if (item.resolveAs === 'inline') {
2168
        var targetObj = item.obj;
2169
        targetObj['x-resolved-from'] = [ item.key ];
2170
        delete targetObj.$ref;
2171
2172
        for (key in resolvedTo.obj) {
2173
          var abs = this.retainRoot(resolvedTo.obj[key], item.root);
2174
          targetObj[key] = abs;
2175
        }
2176
      }
2177
    }
2178
  }
2179
  var existingUnresolved = this.countUnresolvedRefs(spec);
2180
2181
  if(existingUnresolved.length === 0 || this.iteration > 5) {
2182
    this.resolveAllOf(spec.definitions);
2183
    callback.call(this.scope, spec, unresolvedRefs);
2184
  }
2185
  else {
2186
    this.iteration += 1;
2187
    this.resolve(spec, root, callback, this.scope);
2188
  }
2189
};
2190
2191
Resolver.prototype.countUnresolvedRefs = function(spec) {
2192
  var i;
2193
  var refs = this.getRefs(spec);
2194
  var keys = [];
2195
  var unresolvedKeys = [];
2196
  for(i in refs) {
2197
    if(i.indexOf('#') === 0) {
2198
      keys.push(i.substring(1));
2199
    }
2200
    else {
2201
      unresolvedKeys.push(i);
2202
    }
2203
  }
2204
2205
  // verify possible keys
2206
  for (i = 0; i < keys.length; i++) {
2207
    var part = keys[i];
2208
    var parts = part.split('/');
2209
    var obj = spec;
2210
2211
    for (var k = 0; k < parts.length; k++) {
2212
      var key = parts[k];
2213
      if(key !== '') {
2214
        obj = obj[key];
2215
        if(typeof obj === 'undefined') {
2216
          unresolvedKeys.push(part);
2217
          break;
2218
        }
2219
      }
2220
    }
2221
  }
2222
  return unresolvedKeys.length;
2223
};
2224
2225
Resolver.prototype.getRefs = function(spec, obj) {
2226
  obj = obj || spec;
2227
  var output = {};
2228
  for(var key in obj) {
2229
    var item = obj[key];
2230
    if(key === '$ref' && typeof item === 'string') {
2231
      output[item] = null;
2232
    }
2233
    else if(_.isObject(item)) {
2234
      var o = this.getRefs(item);
2235
      for(var k in o) {
2236
        output[k] = null;
2237
      }
2238
    }
2239
  }
2240
  return output;
2241
};
2242
2243
Resolver.prototype.retainRoot = function(obj, root) {
2244
  // walk object and look for relative $refs
2245
  for(var key in obj) {
2246
    var item = obj[key];
2247
    if(key === '$ref' && typeof item === 'string') {
2248
      // stop and inspect
2249
      if(item.indexOf('http://') !== 0 && item.indexOf('https://') !== 0) {
2250
        if(item.indexOf('#') !== 0) {
2251
          item = '#' + item;
2252
        }
2253
        item = (root || '') + item;
2254
        obj[key] = item;
2255
      }
2256
    }
2257
    else if(_.isObject(item)) {
2258
      this.retainRoot(item, root);
2259
    }
2260
  }
2261
  return obj;
2262
};
2263
2264
/**
2265
 * immediately in-lines local refs, queues remote refs
2266
 * for inline resolution
2267
 */
2268
Resolver.prototype.resolveInline = function (root, spec, property, resolutionTable, unresolvedRefs, location) {
2269
  var key = property.$ref, ref = property.$ref, i, p, p2, rs;
2270
  var rootTrimmed = false;
2271
  if (ref) {
2272
    if(ref.indexOf('../') === 0) {
2273
      // reset root
2274
      p = ref.split('../');
2275
      p2 = root.split('/');
2276
      ref = '';
2277
      for(i = 0; i < p.length; i++) {
2278
        if(p[i] === '') {
2279
          p2 = p2.slice(0, p2.length-1);
2280
        }
2281
        else {
2282
          ref += p[i];
2283
        }
2284
      }
2285
      root = '';
2286
      for(i = 0; i < p2.length - 1; i++) {
2287
        if(i > 0) { root += '/'; }
2288
        root += p2[i];
2289
      }
2290
      rootTrimmed = true;
2291
    }
2292
    if(ref.indexOf('#') >= 0) {
2293
      if(ref.indexOf('/') === 0) {
2294
        rs = ref.split('#');
2295
        p  = root.split('//');
2296
        p2 = p[1].split('/');
2297
        root = p[0] + '//' + p2[0] + rs[0];
2298
        location = rs[1];
2299
      }
2300
      else {
2301
        rs = ref.split('#');
2302
        if(rs[0] !== '') {
2303
          p2 = root.split('/');
2304
          p2 = p2.slice(0, p2.length - 1);
2305
          if(!rootTrimmed) {
2306
            root = '';
2307
            for (var k = 0; k < p2.length; k++) {
2308
              if(k > 0) { root += '/'; }
2309
              root += p2[k];
2310
            }
2311
          }
2312
          root += '/' + ref.split('#')[0];
2313
        }
2314
        location = rs[1];
2315
      }
2316
    }
2317
    if (ref.indexOf('http') === 0) {
2318
      if(ref.indexOf('#') >= 0) {
2319
        root = ref.split('#')[0];
2320
        location = ref.split('#')[1];
2321
      }
2322
      else {
2323
        root = ref;
2324
        location = '';
2325
      }
2326
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2327
    } else if (ref.indexOf('#') === 0) {
2328
      location = ref.split('#')[1];
2329
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2330
    }
2331
    else {
2332
      resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2333
    }
2334
  } else if (property.type === 'array') {
2335
    this.resolveTo(root, property.items, resolutionTable, location);
2336
  }
2337
};
2338
2339
Resolver.prototype.resolveTo = function (root, property, resolutionTable, location) {
2340
  var ref = property.$ref;
2341
2342
  if (ref) {
2343
    if(ref.indexOf('#') >= 0) {
2344
      location = ref.split('#')[1];
2345
    }
2346
    resolutionTable.push({
2347
      obj: property, resolveAs: 'ref', root: root, key: ref, location: location
2348
    });
2349
  } else if (property.type === 'array') {
2350
    var items = property.items;
2351
    this.resolveTo(root, items, resolutionTable, location);
2352
  }
2353
};
2354
2355
Resolver.prototype.resolveAllOf = function(spec, obj, depth) {
2356
  depth = depth || 0;
2357
  obj = obj || spec;
2358
  var name;
2359
  for(var key in obj) {
2360
    var item = obj[key];
2361
    if(item === null) {
2362
      throw new TypeError("Swagger 2.0 does not support null types (" + obj + ").  See https://github.com/swagger-api/swagger-spec/issues/229.")
2363
    }
2364
    if(typeof item === 'object') {
2365
      this.resolveAllOf(spec, item, depth + 1);
2366
    }
2367
    if(item && typeof item.allOf !== 'undefined') {
2368
      var allOf = item.allOf;
2369
      if(_.isArray(allOf)) {
2370
        var output = {};
2371
        output['x-composed'] = true;
2372
        if (typeof item['x-resolved-from'] !== 'undefined') {
2373
          output['x-resolved-from'] = item['x-resolved-from'];
2374
        }
2375
        output.properties = {};
2376
        for(var i = 0; i < allOf.length; i++) {
2377
          var component = allOf[i];
2378
          var source = 'self';
2379
          if(typeof component['x-resolved-from'] !== 'undefined') {
2380
            source = component['x-resolved-from'][0];
2381
          }
2382
2383
          for(var part in component) {
2384
            if(!output.hasOwnProperty(part)) {
2385
              output[part] = JSON.parse(JSON.stringify(component[part]));
2386
              if(part === 'properties') {
2387
                for(name in output[part]) {
2388
                  output[part][name]['x-resolved-from'] = source;
2389
                }
2390
              }
2391
            }
2392
            else {
2393
              if(part === 'properties') {
2394
                var properties = component[part];
2395
                for(name in properties) {
2396
                  output.properties[name] = JSON.parse(JSON.stringify(properties[name]));
2397
                  var resolvedFrom = properties[name]['x-resolved-from'];
2398
                  if (typeof resolvedFrom === 'undefined' || resolvedFrom === 'self') {
2399
                    resolvedFrom = source;
2400
                  }
2401
                  output.properties[name]['x-resolved-from'] = resolvedFrom;
2402
                }
2403
              }
2404
              else if(part === 'required') {
2405
                // merge & dedup the required array
2406
                var a = output.required.concat(component[part]);
2407
                for(var k = 0; k < a.length; ++k) {
2408
                  for(var j = k + 1; j < a.length; ++j) {
2409
                    if(a[k] === a[j]) { a.splice(j--, 1); }
2410
                  }
2411
                }
2412
                output.required = a;
2413
              }
2414
              else if(part === 'x-resolved-from') {
2415
                output['x-resolved-from'].push(source);
2416
              }
2417
              else {
2418
                // TODO: need to merge this property
2419
                // console.log('what to do with ' + part)
2420
              }
2421
            }
2422
          }
2423
        }
2424
        obj[key] = output;
2425
      }
2426
    }
2427
    if(_.isObject(item)) {
2428
      this.resolveAllOf(spec, item, depth + 1);
2429
    }
2430
  }
2431
};
2432
2433
},{"./http":5,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isObject":147}],7:[function(require,module,exports){
2434
'use strict';
2435
2436
var Helpers = require('./helpers');
2437
2438
var _ = {
2439
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
2440
  isUndefined: require('lodash-compat/lang/isUndefined'),
2441
  isArray: require('lodash-compat/lang/isArray'),
2442
  isObject: require('lodash-compat/lang/isObject'),
2443
  isEmpty: require('lodash-compat/lang/isEmpty'),
2444
  map: require('lodash-compat/collection/map'),
2445
  indexOf: require('lodash-compat/array/indexOf'),
2446
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
2447
  keys: require('lodash-compat/object/keys'),
2448
  forEach: require('lodash-compat/collection/forEach')
2449
};
2450
2451
module.exports.optionHtml = optionHtml;
2452
module.exports.typeFromJsonSchema = typeFromJsonSchema;
2453
module.exports.getStringSignature = getStringSignature;
2454
module.exports.schemaToHTML = schemaToHTML;
2455
module.exports.schemaToJSON = schemaToJSON;
2456
2457
function optionHtml(label, value) {
2458
  return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
2459
};
2460
2461
function typeFromJsonSchema(type, format) {
2462
  var str;
2463
2464
  if (type === 'integer' && format === 'int32') {
2465
    str = 'integer';
2466
  } else if (type === 'integer' && format === 'int64') {
2467
    str = 'long';
2468
  } else if (type === 'integer' && typeof format === 'undefined') {
2469
    str = 'long';
2470
  } else if (type === 'string' && format === 'date-time') {
2471
    str = 'date-time';
2472
  } else if (type === 'string' && format === 'date') {
2473
    str = 'date';
2474
  } else if (type === 'number' && format === 'float') {
2475
    str = 'float';
2476
  } else if (type === 'number' && format === 'double') {
2477
    str = 'double';
2478
  } else if (type === 'number' && typeof format === 'undefined') {
2479
    str = 'double';
2480
  } else if (type === 'boolean') {
2481
    str = 'boolean';
2482
  } else if (type === 'string') {
2483
    str = 'string';
2484
  }
2485
2486
  return str;
2487
};
2488
2489
function getStringSignature(obj, baseComponent) {
2490
  var str = '';
2491
2492
  if (typeof obj.$ref !== 'undefined') {
2493
    str += Helpers.simpleRef(obj.$ref);
2494
  } else if (typeof obj.type === 'undefined') {
2495
    str += 'object';
2496
  } else if (obj.type === 'array') {
2497
    if (baseComponent) {
2498
      str += getStringSignature((obj.items || obj.$ref || {}));
2499
    } else {
2500
      str += 'Array[';
2501
      str += getStringSignature((obj.items || obj.$ref || {}));
2502
      str += ']';
2503
    }
2504
  } else if (obj.type === 'integer' && obj.format === 'int32') {
2505
    str += 'integer';
2506
  } else if (obj.type === 'integer' && obj.format === 'int64') {
2507
    str += 'long';
2508
  } else if (obj.type === 'integer' && typeof obj.format === 'undefined') {
2509
    str += 'long';
2510
  } else if (obj.type === 'string' && obj.format === 'date-time') {
2511
    str += 'date-time';
2512
  } else if (obj.type === 'string' && obj.format === 'date') {
2513
    str += 'date';
2514
  } else if (obj.type === 'string' && typeof obj.format === 'undefined') {
2515
    str += 'string';
2516
  } else if (obj.type === 'number' && obj.format === 'float') {
2517
    str += 'float';
2518
  } else if (obj.type === 'number' && obj.format === 'double') {
2519
    str += 'double';
2520
  } else if (obj.type === 'number' && typeof obj.format === 'undefined') {
2521
    str += 'double';
2522
  } else if (obj.type === 'boolean') {
2523
    str += 'boolean';
2524
  } else if (obj.$ref) {
2525
    str += Helpers.simpleRef(obj.$ref);
2526
  } else {
2527
    str += obj.type;
2528
  }
2529
2530
  return str;
2531
};
2532
2533
function schemaToJSON(schema, models, modelsToIgnore, modelPropertyMacro) {
2534
  // Resolve the schema (Handle nested schemas)
2535
  schema = Helpers.resolveSchema(schema);
2536
2537
  if(typeof modelPropertyMacro !== 'function') {
2538
    modelPropertyMacro = function(prop){
2539
      return (prop || {}).default;
2540
    }
2541
  }
2542
2543
  modelsToIgnore= modelsToIgnore || {};
2544
2545
  var type = schema.type || 'object';
2546
  var format = schema.format;
2547
  var model;
2548
  var output;
2549
2550
  if (schema.example) {
2551
    output = schema.example;
2552
  } else if (_.isUndefined(schema.items) && _.isArray(schema.enum)) {
2553
    output = schema.enum[0];
2554
  }
2555
2556
  if (_.isUndefined(output)) {
2557
    if (schema.$ref) {
2558
      model = models[Helpers.simpleRef(schema.$ref)];
2559
2560
      if (!_.isUndefined(model)) {
2561
        if (_.isUndefined(modelsToIgnore[model.name])) {
2562
          modelsToIgnore[model.name] = model;
2563
          output = schemaToJSON(model.definition, models, modelsToIgnore, modelPropertyMacro);
2564
          delete modelsToIgnore[model.name];
2565
        } else {
2566
          if (model.type === 'array') {
2567
            output = [];
2568
          } else {
2569
            output = {};
2570
          }
2571
        }
2572
      }
2573
    } else if (!_.isUndefined(schema.default)) {
2574
      output = schema.default;
2575
    } else if (type === 'string') {
2576
      if (format === 'date-time') {
2577
        output = new Date().toISOString();
2578
      } else if (format === 'date') {
2579
        output = new Date().toISOString().split('T')[0];
2580
      } else {
2581
        output = 'string';
2582
      }
2583
    } else if (type === 'integer') {
2584
      output = 0;
2585
    } else if (type === 'number') {
2586
      output = 0.0;
2587
    } else if (type === 'boolean') {
2588
      output = true;
2589
    } else if (type === 'object') {
2590
      output = {};
2591
2592
      _.forEach(schema.properties, function (property, name) {
2593
        var cProperty = _.cloneDeep(property);
2594
2595
        // Allow macro to set the default value
2596
        cProperty.default = modelPropertyMacro(property);
2597
2598
        output[name] = schemaToJSON(cProperty, models, modelsToIgnore, modelPropertyMacro);
2599
      });
2600
    } else if (type === 'array') {
2601
      output = [];
2602
2603
      if (_.isArray(schema.items)) {
2604
        _.forEach(schema.items, function (item) {
2605
          output.push(schemaToJSON(item, models, modelsToIgnore, modelPropertyMacro));
2606
        });
2607
      } else if (_.isPlainObject(schema.items)) {
2608
        output.push(schemaToJSON(schema.items, models, modelsToIgnore, modelPropertyMacro));
2609
      } else if (_.isUndefined(schema.items)) {
2610
        output.push({});
2611
      } else {
2612
        Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
2613
      }
2614
    }
2615
  }
2616
2617
  return output;
2618
};
2619
2620
function schemaToHTML(name, schema, models, modelPropertyMacro) {
2621
2622
  var strongOpen = '<span class="strong">';
2623
  var strongClose = '</span>';
2624
2625
  // Allow for ignoring the 'name' argument.... shifting the rest
2626
  if(_.isObject(arguments[0])) {
2627
    name = void 0;
2628
    schema = arguments[0];
2629
    models = arguments[1];
2630
    modelPropertyMacro = arguments[2];
2631
  }
2632
2633
  models = models || {};
2634
2635
  // Resolve the schema (Handle nested schemas)
2636
  schema = Helpers.resolveSchema(schema);
2637
2638
  // Return for empty object
2639
  if(_.isEmpty(schema)) {
2640
    return strongOpen + 'Empty' + strongClose;
2641
  }
2642
2643
  // Dereference $ref from 'models'
2644
  if(typeof schema.$ref === 'string') {
2645
    name = Helpers.simpleRef(schema.$ref);
2646
    schema = models[name];
2647
  }
2648
2649
  if(typeof name !== 'string') {
2650
    name = schema.title || 'Inline Model';
2651
  }
2652
2653
  // If we are a Model object... adjust accordingly
2654
  if(schema.definition) {
2655
    schema = schema.definition;
2656
  }
2657
2658
  if(typeof modelPropertyMacro !== 'function') {
2659
    modelPropertyMacro = function(prop){
2660
      return (prop || {}).default;
2661
    }
2662
  }
2663
2664
  var references = {};
2665
  var seenModels = [];
2666
  var inlineModels = 0;
2667
2668
2669
2670
  // Generate current HTML
2671
  var html = processModel(schema, name);
2672
2673
  // Generate references HTML
2674
  while (_.keys(references).length > 0) {
2675
    /* jshint ignore:start */
2676
    _.forEach(references, function (schema, name) {
2677
      var seenModel = _.indexOf(seenModels, name) > -1;
2678
2679
      delete references[name];
2680
2681
      if (!seenModel) {
2682
        seenModels.push(name);
2683
2684
        html += '<br />' + processModel(schema, name);
2685
      }
2686
    });
2687
    /* jshint ignore:end */
2688
  }
2689
2690
  return html;
2691
2692
  /////////////////////////////////
2693
2694
  function addReference(schema, name, skipRef) {
2695
    var modelName = name;
2696
    var model;
2697
2698
    if (schema.$ref) {
2699
      modelName = schema.title || Helpers.simpleRef(schema.$ref);
2700
      model = models[modelName];
2701
    } else if (_.isUndefined(name)) {
2702
      modelName = schema.title || 'Inline Model ' + (++inlineModels);
2703
      model = {definition: schema};
2704
    }
2705
2706
    if (skipRef !== true) {
2707
      references[modelName] = _.isUndefined(model) ? {} : model.definition;
2708
    }
2709
2710
    return modelName;
2711
  };
2712
2713
  function primitiveToHTML(schema) {
2714
    var html = '<span class="propType">';
2715
    var type = schema.type || 'object';
2716
2717
    if (schema.$ref) {
2718
      html += addReference(schema, Helpers.simpleRef(schema.$ref));
2719
    } else if (type === 'object') {
2720
      if (!_.isUndefined(schema.properties)) {
2721
        html += addReference(schema);
2722
      } else {
2723
        html += 'object';
2724
      }
2725
    } else if (type === 'array') {
2726
      html += 'Array[';
2727
2728
      if (_.isArray(schema.items)) {
2729
        html += _.map(schema.items, addReference).join(',');
2730
      } else if (_.isPlainObject(schema.items)) {
2731
        if (_.isUndefined(schema.items.$ref)) {
2732
          if (!_.isUndefined(schema.items.type) && _.indexOf(['array', 'object'], schema.items.type) === -1) {
2733
            html += schema.items.type;
2734
          } else {
2735
            html += addReference(schema.items);
2736
          }
2737
        } else {
2738
          html += addReference(schema.items, Helpers.simpleRef(schema.items.$ref));
2739
        }
2740
      } else {
2741
        Helpers.log('Array type\'s \'items\' schema is not an array or an object, cannot process');
2742
        html += 'object';
2743
      }
2744
2745
      html += ']';
2746
    } else {
2747
      html += schema.type;
2748
    }
2749
2750
    html += '</span>';
2751
2752
    return html;
2753
  };
2754
  function primitiveToOptionsHTML(schema, html) {
2755
    var options = '';
2756
    var type = schema.type || 'object';
2757
    var isArray = type === 'array';
2758
2759
    if (isArray) {
2760
      if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) {
2761
        type = schema.items.type;
2762
      } else {
2763
        type = 'object';
2764
      }
2765
    }
2766
2767
    if (!_.isUndefined(schema.default)) {
2768
      options += optionHtml('Default', schema.default);
2769
    }
2770
2771
    switch (type) {
2772
    case 'string':
2773
      if (schema.minLength) {
2774
        options += optionHtml('Min. Length', schema.minLength);
2775
      }
2776
2777
      if (schema.maxLength) {
2778
        options += optionHtml('Max. Length', schema.maxLength);
2779
      }
2780
2781
      if (schema.pattern) {
2782
        options += optionHtml('Reg. Exp.', schema.pattern);
2783
      }
2784
      break;
2785
    case 'integer':
2786
    case 'number':
2787
      if (schema.minimum) {
2788
        options += optionHtml('Min. Value', schema.minimum);
2789
      }
2790
2791
      if (schema.exclusiveMinimum) {
2792
        options += optionHtml('Exclusive Min.', 'true');
2793
      }
2794
2795
      if (schema.maximum) {
2796
        options += optionHtml('Max. Value', schema.maximum);
2797
      }
2798
2799
      if (schema.exclusiveMaximum) {
2800
        options += optionHtml('Exclusive Max.', 'true');
2801
      }
2802
2803
      if (schema.multipleOf) {
2804
        options += optionHtml('Multiple Of', schema.multipleOf);
2805
      }
2806
2807
      break;
2808
    }
2809
2810
    if (isArray) {
2811
      if (schema.minItems) {
2812
        options += optionHtml('Min. Items', schema.minItems);
2813
      }
2814
2815
      if (schema.maxItems) {
2816
        options += optionHtml('Max. Items', schema.maxItems);
2817
      }
2818
2819
      if (schema.uniqueItems) {
2820
        options += optionHtml('Unique Items', 'true');
2821
      }
2822
2823
      if (schema.collectionFormat) {
2824
        options += optionHtml('Coll. Format', schema.collectionFormat);
2825
      }
2826
    }
2827
2828
    if (_.isUndefined(schema.items)) {
2829
      if (_.isArray(schema.enum)) {
2830
        var enumString;
2831
2832
        if (type === 'number' || type === 'integer') {
2833
          enumString = schema.enum.join(', ');
2834
        } else {
2835
          enumString = '"' + schema.enum.join('", "') + '"';
2836
        }
2837
2838
        options += optionHtml('Enum', enumString);
2839
      }
2840
    }
2841
2842
    if (options.length > 0) {
2843
      html = '<span class="propWrap">' + html + '<table class="optionsWrapper"><tr><th colspan="2">' + type + '</th></tr>' + options + '</table></span>';
2844
    }
2845
2846
    return html;
2847
  };
2848
  function processModel(schema, name) {
2849
    var type = schema.type || 'object';
2850
    var isArray = schema.type === 'array';
2851
    var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose;
2852
2853
    if (name) {
2854
      seenModels.push(name);
2855
    }
2856
2857
    if (isArray) {
2858
      if (_.isArray(schema.items)) {
2859
        html += '<div>' + _.map(schema.items, function (item) {
2860
          var type = item.type || 'object';
2861
2862
          if (_.isUndefined(item.$ref)) {
2863
            if (_.indexOf(['array', 'object'], type) > -1) {
2864
              if (type === 'object' && _.isUndefined(item.properties)) {
2865
                return 'object';
2866
              } else {
2867
                return addReference(item);
2868
              }
2869
            } else {
2870
              return primitiveToOptionsHTML(item, type);
2871
            }
2872
          } else {
2873
            return addReference(item, Helpers.simpleRef(item.$ref));
2874
          }
2875
        }).join(',</div><div>');
2876
      } else if (_.isPlainObject(schema.items)) {
2877
        if (_.isUndefined(schema.items.$ref)) {
2878
          if (_.indexOf(['array', 'object'], schema.items.type || 'object') > -1) {
2879
            if ((_.isUndefined(schema.items.type) || schema.items.type === 'object') && _.isUndefined(schema.items.properties)) {
2880
              html += '<div>object</div>';
2881
            } else {
2882
              html += '<div>' + addReference(schema.items) + '</div>';
2883
            }
2884
          } else {
2885
            html += '<div>' + primitiveToOptionsHTML(schema.items, schema.items.type) + '</div>';
2886
          }
2887
        } else {
2888
          html += '<div>' + addReference(schema.items, Helpers.simpleRef(schema.items.$ref)) + '</div>';
2889
        }
2890
      } else {
2891
        Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
2892
        html += '<div>object</div>';
2893
      }
2894
    } else {
2895
      if (schema.$ref) {
2896
        html += '<div>' + addReference(schema, name) + '</div>';
2897
      } else if (type === 'object') {
2898
        html += '<div>';
2899
2900
        if (_.isPlainObject(schema.properties)) {
2901
          html += _.map(schema.properties, function (property, name) {
2902
            var propertyIsRequired = (_.indexOf(schema.required, name) >= 0);
2903
            var cProperty = _.cloneDeep(property);
2904
2905
            var requiredClass = propertyIsRequired ? 'required' : '';
2906
            var html = '<span class="propName ' + requiredClass + '">' + name + '</span> (';
2907
            var model;
2908
2909
            // Allow macro to set the default value
2910
            cProperty.default = modelPropertyMacro(cProperty);
2911
2912
            // Resolve the schema (Handle nested schemas)
2913
            cProperty = Helpers.resolveSchema(cProperty);
2914
2915
            // We need to handle property references to primitives (Issue 339)
2916
            if (!_.isUndefined(cProperty.$ref)) {
2917
              model = models[Helpers.simpleRef(cProperty.$ref)];
2918
2919
              if (!_.isUndefined(model) && _.indexOf([undefined, 'array', 'object'], model.definition.type) === -1) {
2920
                // Use referenced schema
2921
                cProperty = Helpers.resolveSchema(model.definition);
2922
              }
2923
            }
2924
2925
            html += primitiveToHTML(cProperty);
2926
2927
            if(!propertyIsRequired) {
2928
              html += ', <span class="propOptKey">optional</span>';
2929
            }
2930
2931
            html += ')';
2932
2933
            if (!_.isUndefined(cProperty.description)) {
2934
              html += ': ' + '<span class="propDesc">' + cProperty.description + '</span>';
2935
            }
2936
2937
            if (cProperty.enum) {
2938
              html += ' = <span class="propVals">[\'' + cProperty.enum.join('\', \'') + '\']</span>';
2939
            }
2940
2941
            return primitiveToOptionsHTML(cProperty, html);
2942
          }).join(',</div><div>');
2943
        }
2944
2945
        html += '</div>';
2946
      } else {
2947
        html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>';
2948
      }
2949
    }
2950
2951
    return html + strongOpen + (isArray ? ']' : '}') + strongClose;
2952
  };
2953
2954
};
2955
2956
},{"./helpers":4,"lodash-compat/array/indexOf":52,"lodash-compat/collection/forEach":57,"lodash-compat/collection/map":59,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isArray":143,"lodash-compat/lang/isEmpty":144,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isUndefined":151,"lodash-compat/object/keys":152}],8:[function(require,module,exports){
2957
'use strict';
2958
2959
var SwaggerHttp = require('./http');
2960
var _ = {
2961
  isObject: require('lodash-compat/lang/isObject')
2962
};
2963
2964
var SwaggerSpecConverter = module.exports = function () {
2965
  this.errors = [];
2966
  this.warnings = [];
2967
  this.modelMap = {};
2968
};
2969
2970
SwaggerSpecConverter.prototype.setDocumentationLocation = function (location) {
2971
  this.docLocation = location;
2972
};
2973
2974
/**
2975
 * converts a resource listing OR api declaration
2976
 **/
2977
SwaggerSpecConverter.prototype.convert = function (obj, clientAuthorizations, callback) {
2978
  // not a valid spec
2979
  if(!obj || !Array.isArray(obj.apis)) {
2980
    return this.finish(callback, null);
2981
  }
2982
  this.clientAuthorizations = clientAuthorizations;
2983
2984
  // create a new swagger object to return
2985
  var swagger = { swagger: '2.0' };
2986
2987
  swagger.originalVersion = obj.swaggerVersion;
2988
2989
  // add the info
2990
  this.apiInfo(obj, swagger);
2991
2992
  // add security definitions
2993
  this.securityDefinitions(obj, swagger);
2994
2995
  // take basePath into account
2996
  if (obj.basePath) {
2997
    this.setDocumentationLocation(obj.basePath);
2998
  }
2999
3000
  // see if this is a single-file swagger definition
3001
  var isSingleFileSwagger = false;
3002
  var i;
3003
  for(i = 0; i < obj.apis.length; i++) {
3004
    var api = obj.apis[i];
3005
    if(Array.isArray(api.operations)) {
3006
      isSingleFileSwagger = true;
3007
    }
3008
  }
3009
  if(isSingleFileSwagger) {
3010
    this.declaration(obj, swagger);
3011
    this.finish(callback, swagger);
3012
  }
3013
  else {
3014
    this.resourceListing(obj, swagger, callback);
3015
  }
3016
};
3017
3018
SwaggerSpecConverter.prototype.declaration = function(obj, swagger) {
3019
  var name, i, p, pos;
3020
  if(!obj.apis) {
3021
    return;
3022
  }
3023
3024
  if (obj.basePath.indexOf('http://') === 0) {
3025
    p = obj.basePath.substring('http://'.length);
3026
    pos = p.indexOf('/');
3027
    if (pos > 0) {
3028
      swagger.host = p.substring(0, pos);
3029
      swagger.basePath = p.substring(pos);
3030
    }
3031
    else {
3032
      swagger.host = p;
3033
      swagger.basePath = '/';
3034
    }
3035
  } else if (obj.basePath.indexOf('https://') === 0) {
3036
    p = obj.basePath.substring('https://'.length);
3037
    pos = p.indexOf('/');
3038
    if (pos > 0) {
3039
      swagger.host = p.substring(0, pos);
3040
      swagger.basePath = p.substring(pos);
3041
    }
3042
    else {
3043
      swagger.host = p;
3044
      swagger.basePath = '/';
3045
    }
3046
  } else {
3047
    swagger.basePath = obj.basePath;
3048
  }
3049
3050
  var resourceLevelAuth;
3051
  if(obj.authorizations) {
3052
    resourceLevelAuth = obj.authorizations;
3053
  }
3054
  if(obj.consumes) {
3055
    swagger.consumes = obj.consumes;
3056
  }
3057
  if(obj.produces) {
3058
    swagger.produces = obj.produces;
3059
  }
3060
3061
  // build a mapping of id to name for 1.0 model resolutions
3062
  if(_.isObject(obj)) {
3063
    for(name in obj.models) {
3064
      var existingModel = obj.models[name];
3065
      var key = (existingModel.id || name);
3066
      this.modelMap[key] = name;
3067
    }
3068
  }
3069
3070
  for(i = 0; i < obj.apis.length; i++) {
3071
    var api = obj.apis[i];
3072
    var path = api.path;
3073
    var operations = api.operations;
3074
    this.operations(path, obj.resourcePath, operations, resourceLevelAuth, swagger);
3075
  }
3076
3077
  var models = obj.models || {};
3078
  this.models(models, swagger);
3079
};
3080
3081
SwaggerSpecConverter.prototype.models = function(obj, swagger) {
3082
  if(!_.isObject(obj)) {
3083
    return;
3084
  }
3085
  var name;
3086
3087
  swagger.definitions = swagger.definitions || {};
3088
  for(name in obj) {
3089
    var existingModel = obj[name];
3090
    var _enum = [];
3091
    var schema = { properties: {}};
3092
    var propertyName;
3093
    for(propertyName in existingModel.properties) {
3094
      var existingProperty = existingModel.properties[propertyName];
3095
      var property = {};
3096
      this.dataType(existingProperty, property);
3097
      if(existingProperty.description) {
3098
        property.description = existingProperty.description;
3099
      }
3100
      if(existingProperty['enum']) {
3101
        property['enum'] = existingProperty['enum'];
3102
      }
3103
      if(typeof existingProperty.required === 'boolean' && existingProperty.required === true) {
3104
        _enum.push(propertyName);
3105
      }
3106
      if(typeof existingProperty.required === 'string' && existingProperty.required === 'true') {
3107
        _enum.push(propertyName);
3108
      }
3109
      schema.properties[propertyName] = property;
3110
    }
3111
    if(_enum.length > 0) {
3112
      schema['enum'] = _enum;
3113
    }
3114
3115
    schema.required = existingModel.required;
3116
    swagger.definitions[name] = schema;
3117
  }
3118
};
3119
3120
SwaggerSpecConverter.prototype.extractTag = function(resourcePath) {
3121
  var pathString = resourcePath || 'default';
3122
  if(pathString.indexOf('http:') === 0 || pathString.indexOf('https:') === 0) {
3123
    pathString = pathString.split(['/']);
3124
    pathString = pathString[pathString.length -1].substring();
3125
  }
3126
  if(pathString.endsWith('.json')) {
3127
    pathString = pathString.substring(0, pathString.length - '.json'.length);
3128
  }
3129
  return pathString.replace('/','');
3130
};
3131
3132
SwaggerSpecConverter.prototype.operations = function(path, resourcePath, obj, resourceLevelAuth, swagger) {
3133
  if(!Array.isArray(obj)) {
3134
    return;
3135
  }
3136
  var i;
3137
3138
  if(!swagger.paths) {
3139
    swagger.paths = {};
3140
  }
3141
3142
  var pathObj = swagger.paths[path] || {};
3143
  var tag = this.extractTag(resourcePath);
3144
  swagger.tags = swagger.tags || [];
3145
  var matched = false;
3146
  for(i = 0; i < swagger.tags.length; i++) {
3147
    var tagObject = swagger.tags[i];
3148
    if(tagObject.name === tag) {
3149
      matched = true;
3150
    }
3151
  }
3152
  if(!matched) {
3153
    swagger.tags.push({name: tag});
3154
  }
3155
3156
  for(i = 0; i < obj.length; i++) {
3157
    var existingOperation = obj[i];
3158
    var method = (existingOperation.method || existingOperation.httpMethod).toLowerCase();
3159
    var operation = {tags: [tag]};
3160
    var existingAuthorizations = existingOperation.authorizations;
3161
3162
    if(existingAuthorizations && Object.keys(existingAuthorizations).length === 0) {
3163
      existingAuthorizations = resourceLevelAuth;
3164
    }
3165
3166
    if(typeof existingAuthorizations !== 'undefined') {
3167
      var scopesObject;
3168
      for(var key in existingAuthorizations) {
3169
        operation.security = operation.security || [];
3170
        var scopes = existingAuthorizations[key];
3171
        if(scopes) {
3172
          var securityScopes = [];
3173
          for(var j in scopes) {
3174
            securityScopes.push(scopes[j].scope);
3175
          }
3176
          scopesObject = {};
3177
          scopesObject[key] = securityScopes;
3178
          operation.security.push(scopesObject);
3179
        }
3180
        else {
3181
          scopesObject = {};
3182
          scopesObject[key] = [];
3183
          operation.security.push(scopesObject);
3184
        }
3185
      }
3186
    }
3187
3188
    if(existingOperation.consumes) {
3189
      operation.consumes = existingOperation.consumes;
3190
    }
3191
    else if(swagger.consumes) {
3192
      operation.consumes = swagger.consumes;
3193
    }
3194
    if(existingOperation.produces) {
3195
      operation.produces = existingOperation.produces;
3196
    }
3197
    else if(swagger.produces) {
3198
      operation.produces = swagger.produces;
3199
    }
3200
    if(existingOperation.summary) {
3201
      operation.summary = existingOperation.summary;
3202
    }
3203
    if(existingOperation.notes) {
3204
      operation.description = existingOperation.notes;
3205
    }
3206
    if(existingOperation.nickname) {
3207
      operation.operationId = existingOperation.nickname;
3208
    }
3209
    if(existingOperation.deprecated) {
3210
      operation.deprecated = existingOperation.deprecated;
3211
    }
3212
3213
    this.authorizations(existingAuthorizations, swagger);
3214
    this.parameters(operation, existingOperation.parameters, swagger);
3215
    this.responseMessages(operation, existingOperation, swagger);
3216
3217
    pathObj[method] = operation;
3218
  }
3219
3220
  swagger.paths[path] = pathObj;
3221
};
3222
3223
SwaggerSpecConverter.prototype.responseMessages = function(operation, existingOperation) {
3224
  if(!_.isObject(existingOperation)) {
3225
    return;
3226
  }
3227
  // build default response from the operation (1.x)
3228
  var defaultResponse = {};
3229
  this.dataType(existingOperation, defaultResponse);
3230
  // TODO: look into the real problem of rendering responses in swagger-ui
3231
  // ....should reponseType have an implicit schema?
3232
  if(!defaultResponse.schema && defaultResponse.type) {
3233
    defaultResponse = {schema: defaultResponse};
3234
  }
3235
3236
  operation.responses = operation.responses || {};
3237
3238
  // grab from responseMessages (1.2)
3239
  var has200 = false;
3240
  if(Array.isArray(existingOperation.responseMessages)) {
3241
    var i;
3242
    var existingResponses = existingOperation.responseMessages;
3243
    for(i = 0; i < existingResponses.length; i++) {
3244
      var existingResponse = existingResponses[i];
3245
      var response = { description: existingResponse.message };
3246
      if(existingResponse.code === 200) {
3247
        has200 = true;
3248
      }
3249
      // Convert responseModel -> schema{$ref: responseModel}
3250
      if(existingResponse.responseModel) {
3251
        response.schema = {'$ref': existingResponse.responseModel};
3252
      }
3253
      operation.responses['' + existingResponse.code] = response;
3254
    }
3255
  }
3256
3257
  if(has200) {
3258
    operation.responses['default'] = defaultResponse;
3259
  }
3260
  else {
3261
    operation.responses['200'] = defaultResponse;
3262
  }
3263
};
3264
3265
SwaggerSpecConverter.prototype.authorizations = function(obj) {
3266
  // TODO
3267
  if(!_.isObject(obj)) {
3268
    return;
3269
  }
3270
};
3271
3272
SwaggerSpecConverter.prototype.parameters = function(operation, obj) {
3273
  if(!Array.isArray(obj)) {
3274
    return;
3275
  }
3276
  var i;
3277
  for(i = 0; i < obj.length; i++) {
3278
    var existingParameter = obj[i];
3279
    var parameter = {};
3280
    parameter.name = existingParameter.name;
3281
    parameter.description = existingParameter.description;
3282
    parameter.required = existingParameter.required;
3283
    parameter.in = existingParameter.paramType;
3284
3285
    // per #168
3286
    if(parameter.in === 'body') {
3287
      parameter.name = 'body';
3288
    }
3289
    if(parameter.in === 'form') {
3290
      parameter.in = 'formData';
3291
    }
3292
3293
    if(existingParameter.enum) {
3294
      parameter.enum = existingParameter.enum;
3295
    }
3296
3297
    if(existingParameter.allowMultiple === true || existingParameter.allowMultiple === 'true') {
3298
      var innerType = {};
3299
      this.dataType(existingParameter, innerType);
3300
      parameter.type = 'array';
3301
      parameter.items = innerType;
3302
3303
      if(existingParameter.allowableValues) {
3304
        var av = existingParameter.allowableValues;
3305
        if(av.valueType === 'LIST') {
3306
          parameter['enum'] = av.values;
3307
        }
3308
      }
3309
    }
3310
    else {
3311
      this.dataType(existingParameter, parameter);
3312
    }
3313
3314
    operation.parameters = operation.parameters || [];
3315
    operation.parameters.push(parameter);
3316
  }
3317
};
3318
3319
SwaggerSpecConverter.prototype.dataType = function(source, target) {
3320
  if(!_.isObject(source)) {
3321
    return;
3322
  }
3323
3324
  if(source.minimum) {
3325
    target.minimum = source.minimum;
3326
  }
3327
  if(source.maximum) {
3328
    target.maximum = source.maximum;
3329
  }
3330
  if (source.format) {
3331
    target.format = source.format;
3332
  }
3333
3334
  // default can be 'false'
3335
  if(typeof source.defaultValue !== 'undefined') {
3336
    target.default = source.defaultValue;
3337
  }
3338
3339
  var jsonSchemaType = this.toJsonSchema(source);
3340
  if(jsonSchemaType) {
3341
    target = target || {};
3342
    if(jsonSchemaType.type) {
3343
      target.type = jsonSchemaType.type;
3344
    }
3345
    if(jsonSchemaType.format) {
3346
      target.format = jsonSchemaType.format;
3347
    }
3348
    if(jsonSchemaType.$ref) {
3349
      target.schema = {$ref: jsonSchemaType.$ref};
3350
    }
3351
    if(jsonSchemaType.items) {
3352
      target.items = jsonSchemaType.items;
3353
    }
3354
  }
3355
};
3356
3357
SwaggerSpecConverter.prototype.toJsonSchema = function(source) {
3358
  if(!source) {
3359
    return 'object';
3360
  }
3361
  var detectedType = (source.type || source.dataType || source.responseClass || '');
3362
  var lcType = detectedType.toLowerCase();
3363
  var format = (source.format || '').toLowerCase();
3364
3365
  if(lcType.indexOf('list[') === 0) {
3366
    var innerType = detectedType.substring(5, detectedType.length - 1);
3367
    var jsonType = this.toJsonSchema({type: innerType});
3368
    return {type: 'array', items: jsonType};
3369
  }
3370
  else if(lcType === 'int' || (lcType === 'integer' && format === 'int32'))
3371
    {return {type: 'integer', format: 'int32'};}
3372
  else if(lcType === 'long' || (lcType === 'integer' && format === 'int64'))
3373
    {return {type: 'integer', format: 'int64'};}
3374
  else if(lcType === 'integer')
3375
    {return {type: 'integer', format: 'int64'};}
3376
  else if(lcType === 'float' || (lcType === 'number' && format === 'float'))
3377
    {return {type: 'number', format: 'float'};}
3378
  else if(lcType === 'double' || (lcType === 'number' && format === 'double'))
3379
    {return {type: 'number', format: 'double'};}
3380
  else if((lcType === 'string' && format === 'date-time') || (lcType === 'date'))
3381
    {return {type: 'string', format: 'date-time'};}
3382
  else if(lcType === 'string')
3383
    {return {type: 'string'};}
3384
  else if(lcType === 'file')
3385
    {return {type: 'file'};}
3386
  else if(lcType === 'boolean')
3387
    {return {type: 'boolean'};}
3388
  else if(lcType === 'array' || lcType === 'list') {
3389
    if(source.items) {
3390
      var it = this.toJsonSchema(source.items);
3391
      return {type: 'array', items: it};
3392
    }
3393
    else {
3394
      return {type: 'array', items: {type: 'object'}};
3395
    }
3396
  }
3397
  else if(source.$ref) {
3398
    return {$ref: '#/definitions/' + this.modelMap[source.$ref] || source.$ref};
3399
  }
3400
  else if(lcType === 'void' || lcType === '')
3401
    {return {};}
3402
  else {
3403
    return {$ref: '#/definitions/' + this.modelMap[source.type] || source.type};
3404
  }
3405
};
3406
3407
SwaggerSpecConverter.prototype.resourceListing = function(obj, swagger, callback) {
3408
  var i;
3409
  var processedCount = 0;   // jshint ignore:line
3410
  var self = this;          // jshint ignore:line
3411
  var expectedCount = obj.apis.length;
3412
  var _swagger = swagger;   // jshint ignore:line
3413
3414
  if(expectedCount === 0) {
3415
    this.finish(callback, swagger);
3416
  }
3417
3418
  for(i = 0; i < expectedCount; i++) {
3419
    var api = obj.apis[i];
3420
    var path = api.path;
3421
    var absolutePath = this.getAbsolutePath(obj.swaggerVersion, this.docLocation, path);
3422
3423
    if(api.description) {
3424
      swagger.tags = swagger.tags || [];
3425
      swagger.tags.push({
3426
        name : this.extractTag(api.path),
3427
        description : api.description || ''
3428
      });
3429
    }
3430
    var http = {
3431
      url: absolutePath,
3432
      headers: {accept: 'application/json'},
3433
      on: {},
3434
      method: 'get'
3435
    };
3436
    /* jshint ignore:start */
3437
    http.on.response = function(data) {
3438
      processedCount += 1;
3439
      var obj = data.obj;
3440
      if(obj) {
3441
        self.declaration(obj, _swagger);
3442
      }
3443
      if(processedCount === expectedCount) {
3444
        self.finish(callback, _swagger);
3445
      }
3446
    };
3447
    http.on.error = function(data) {
3448
      console.error(data);
3449
      processedCount += 1;
3450
      if(processedCount === expectedCount) {
3451
        self.finish(callback, _swagger);
3452
      }
3453
    };
3454
    /* jshint ignore:end */
3455
3456
    if(this.clientAuthorizations && typeof this.clientAuthorizations.apply === 'function') {
3457
      this.clientAuthorizations.apply(http);
3458
    }
3459
3460
    new SwaggerHttp().execute(http);
3461
  }
3462
};
3463
3464
SwaggerSpecConverter.prototype.getAbsolutePath = function(version, docLocation, path)  {
3465
  if(version === '1.0') {
3466
    if(docLocation.endsWith('.json')) {
3467
      // get root path
3468
      var pos = docLocation.lastIndexOf('/');
3469
      if(pos > 0) {
3470
        docLocation = docLocation.substring(0, pos);
3471
      }
3472
    }
3473
  }
3474
3475
  var location = docLocation;
3476
  if(path.indexOf('http://') === 0 || path.indexOf('https://') === 0) {
3477
    location = path;
3478
  }
3479
  else {
3480
    if(docLocation.endsWith('/')) {
3481
      location = docLocation.substring(0, docLocation.length - 1);
3482
    }
3483
    location += path;
3484
  }
3485
  location = location.replace('{format}', 'json');
3486
  return location;
3487
};
3488
3489
SwaggerSpecConverter.prototype.securityDefinitions = function(obj, swagger) {
3490
  if(obj.authorizations) {
3491
    var name;
3492
    for(name in obj.authorizations) {
3493
      var isValid = false;
3494
      var securityDefinition = {};
3495
      var definition = obj.authorizations[name];
3496
      if(definition.type === 'apiKey') {
3497
        securityDefinition.type = 'apiKey';
3498
        securityDefinition.in = definition.passAs;
3499
        securityDefinition.name = definition.keyname || name;
3500
        isValid = true;
3501
      }
3502
      else if(definition.type === 'oauth2') {
3503
        var existingScopes = definition.scopes || [];
3504
        var scopes = {};
3505
        var i;
3506
        for(i in existingScopes) {
3507
          var scope = existingScopes[i];
3508
          scopes[scope.scope] = scope.description;
3509
        }
3510
        securityDefinition.type = 'oauth2';
3511
        if(i > 0) {
3512
          securityDefinition.scopes = scopes;
3513
        }
3514
        if(definition.grantTypes) {
3515
          if(definition.grantTypes.implicit) {
3516
            var implicit = definition.grantTypes.implicit;
3517
            securityDefinition.flow = 'implicit';
3518
            securityDefinition.authorizationUrl = implicit.loginEndpoint;
3519
            isValid = true;
3520
          }
3521
          /* jshint ignore:start */
3522
          if(definition.grantTypes['authorization_code']) {
3523
            if(!securityDefinition.flow) {
3524
              // cannot set if flow is already defined
3525
              var authCode = definition.grantTypes['authorization_code'];
3526
              securityDefinition.flow = 'accessCode';
3527
              securityDefinition.authorizationUrl = authCode.tokenRequestEndpoint.url;
3528
              securityDefinition.tokenUrl = authCode.tokenEndpoint.url;
3529
              isValid = true;
3530
            }
3531
          }
3532
          /* jshint ignore:end */
3533
        }
3534
      }
3535
      if(isValid) {
3536
        swagger.securityDefinitions = swagger.securityDefinitions || {};
3537
        swagger.securityDefinitions[name] = securityDefinition;
3538
      }
3539
    }
3540
  }
3541
};
3542
3543
SwaggerSpecConverter.prototype.apiInfo = function(obj, swagger) {
3544
  // info section
3545
  if(obj.info) {
3546
    var info = obj.info;
3547
    swagger.info = {};
3548
3549
    if(info.contact) {
3550
      swagger.info.contact = {};
3551
      swagger.info.contact.email = info.contact;
3552
    }
3553
    if(info.description) {
3554
      swagger.info.description = info.description;
3555
    }
3556
    if(info.title) {
3557
      swagger.info.title = info.title;
3558
    }
3559
    if(info.termsOfServiceUrl) {
3560
      swagger.info.termsOfService = info.termsOfServiceUrl;
3561
    }
3562
    if(info.license || info.licenseUrl) {
3563
      swagger.license = {};
3564
      if(info.license) {
3565
        swagger.license.name = info.license;
3566
      }
3567
      if(info.licenseUrl) {
3568
        swagger.license.url = info.licenseUrl;
3569
      }
3570
    }
3571
  }
3572
  else {
3573
    this.warnings.push('missing info section');
3574
  }
3575
};
3576
3577
SwaggerSpecConverter.prototype.finish = function (callback, obj) {
3578
  callback(obj);
3579
};
3580
3581
},{"./http":5,"lodash-compat/lang/isObject":147}],9:[function(require,module,exports){
3582
'use strict';
3583
3584
var _ = {
3585
  isPlainObject: require('lodash-compat/lang/isPlainObject'),
3586
  isString: require('lodash-compat/lang/isString'),
3587
};
3588
3589
var SchemaMarkup = require('../schema-markup.js');
3590
var jsyaml = require('js-yaml');
3591
3592
var Model = module.exports = function (name, definition, models, modelPropertyMacro) {
3593
  this.definition = definition || {};
3594
  this.isArray = definition.type === 'array';
3595
  this.models = models || {};
3596
  this.name = definition.title || name || 'Inline Model';
3597
  this.modelPropertyMacro = modelPropertyMacro || function (property) {
3598
    return property.default;
3599
  };
3600
3601
  return this;
3602
};
3603
3604
Model.prototype.createJSONSample = Model.prototype.getSampleValue = function (modelsToIgnore) {
3605
  modelsToIgnore = modelsToIgnore || {};
3606
3607
  modelsToIgnore[this.name] = this;
3608
3609
  // Response support
3610
  if (this.examples && _.isPlainObject(this.examples) && this.examples['application/json']) {
3611
    this.definition.example = this.examples['application/json'];
3612
3613
    if (_.isString(this.definition.example)) {
3614
      this.definition.example = jsyaml.safeLoad(this.definition.example);
3615
    }
3616
  } else if (!this.definition.example) {
3617
    this.definition.example = this.examples;
3618
  }
3619
3620
  return SchemaMarkup.schemaToJSON(this.definition, this.models, modelsToIgnore, this.modelPropertyMacro);
3621
};
3622
3623
Model.prototype.getMockSignature = function () {
3624
  return SchemaMarkup.schemaToHTML(this.name, this.definition, this.models, this.modelPropertyMacro);
3625
};
3626
3627
},{"../schema-markup.js":7,"js-yaml":21,"lodash-compat/lang/isPlainObject":148,"lodash-compat/lang/isString":149}],10:[function(require,module,exports){
3628
'use strict';
3629
3630
var _ = {
3631
  cloneDeep: require('lodash-compat/lang/cloneDeep'),
3632
  isUndefined: require('lodash-compat/lang/isUndefined'),
3633
  isEmpty: require('lodash-compat/lang/isEmpty'),
3634
  isObject: require('lodash-compat/lang/isObject')
3635
};
3636
var helpers = require('../helpers');
3637
var Model = require('./model');
3638
var SwaggerHttp = require('../http');
3639
3640
var Operation = module.exports = function (parent, scheme, operationId, httpMethod, path, args, definitions, models, clientAuthorizations) {
3641
  var errors = [];
3642
3643
  parent = parent || {};
3644
  args = args || {};
3645
3646
  if(parent && parent.options) {
3647
    this.client = parent.options.client || null;
3648
    this.responseInterceptor = parent.options.responseInterceptor || null;
3649
  }
3650
  this.authorizations = args.security;
3651
  this.basePath = parent.basePath || '/';
3652
  this.clientAuthorizations = clientAuthorizations;
3653
  this.consumes = args.consumes || parent.consumes || ['application/json'];
3654
  this.produces = args.produces || parent.produces || ['application/json'];
3655
  this.deprecated = args.deprecated;
3656
  this.description = args.description;
3657
  this.host = parent.host || 'localhost';
3658
  this.method = (httpMethod || errors.push('Operation ' + operationId + ' is missing method.'));
3659
  this.models = models || {};
3660
  this.nickname = (operationId || errors.push('Operations must have a nickname.'));
3661
  this.operation = args;
3662
  this.operations = {};
3663
  this.parameters = args !== null ? (args.parameters || []) : {};
3664
  this.parent = parent;
3665
  this.path = (path || errors.push('Operation ' + this.nickname + ' is missing path.'));
3666
  this.responses = (args.responses || {});
3667
  this.scheme = scheme || parent.scheme || 'http';
3668
  this.schemes = args.schemes || parent.schemes;
3669
  this.security = args.security;
3670
  this.summary = args.summary || '';
3671
  this.type = null;
3672
  this.useJQuery = parent.useJQuery;
3673
  this.parameterMacro = parent.parameterMacro || function (parameter) {
3674
    return parameter.default;
3675
  };
3676
3677
  this.inlineModels = [];
3678
3679
  if (typeof this.deprecated === 'string') {
3680
    switch(this.deprecated.toLowerCase()) {
3681
      case 'true': case 'yes': case '1': {
3682
        this.deprecated = true;
3683
        break;
3684
      }
3685
3686
      case 'false': case 'no': case '0': case null: {
3687
        this.deprecated = false;
3688
        break;
3689
      }
3690
3691
      default: this.deprecated = Boolean(this.deprecated);
3692
    }
3693
  }
3694
3695
  var i, model;
3696
3697
  if (definitions) {
3698
    // add to global models
3699
    var key;
3700
3701
    for (key in definitions) {
3702
      model = new Model(key, definitions[key], this.models, parent.modelPropertyMacro);
3703
3704
      if (model) {
3705
        this.models[key] = model;
3706
      }
3707
    }
3708
  }
3709
3710
  for (i = 0; i < this.parameters.length; i++) {
3711
    var param = this.parameters[i];
3712
3713
    // Allow macro to set the default value
3714
    param.default = this.parameterMacro(param);
3715
3716
    if (param.type === 'array') {
3717
      param.isList = true;
3718
      param.allowMultiple = true;
3719
      // the enum can be defined at the items level
3720
      if (param.items && param.items.enum) {
3721
        param['enum'] = param.items.enum;
3722
      }
3723
    }
3724
3725
    var innerType = this.getType(param);
3726
3727
    if (innerType && innerType.toString().toLowerCase() === 'boolean') {
3728
      param.allowableValues = {};
3729
      param.isList = true;
3730
      param['enum'] = [true, false]; // use actual primitives
3731
    }
3732
3733
    if (typeof param['enum'] !== 'undefined') {
3734
      var id;
3735
3736
      param.allowableValues = {};
3737
      param.allowableValues.values = [];
3738
      param.allowableValues.descriptiveValues = [];
3739
3740
      for (id = 0; id < param['enum'].length; id++) {
3741
        var value = param['enum'][id];
3742
        var isDefault = (value === param.default || value+'' === param.default);
3743
3744
        param.allowableValues.values.push(value);
3745
        // Always have string for descriptive values....
3746
        param.allowableValues.descriptiveValues.push({value : value+'', isDefault: isDefault});
3747
      }
3748
    }
3749
3750
    if (param.type === 'array') {
3751
      innerType = [innerType];
3752
3753
      if (typeof param.allowableValues === 'undefined') {
3754
        // can't show as a list if no values to select from
3755
        delete param.isList;
3756
        delete param.allowMultiple;
3757
      }
3758
    }
3759
3760
    param.signature = this.getModelSignature(innerType, this.models).toString();
3761
    param.sampleJSON = this.getModelSampleJSON(innerType, this.models);
3762
    param.responseClassSignature = param.signature;
3763
  }
3764
3765
  var defaultResponseCode, response, responses = this.responses;
3766
3767
  if (responses['200']) {
3768
    response = responses['200'];
3769
    defaultResponseCode = '200';
3770
  } else if (responses['201']) {
3771
    response = responses['201'];
3772
    defaultResponseCode = '201';
3773
  } else if (responses['202']) {
3774
    response = responses['202'];
3775
    defaultResponseCode = '202';
3776
  } else if (responses['203']) {
3777
    response = responses['203'];
3778
    defaultResponseCode = '203';
3779
  } else if (responses['204']) {
3780
    response = responses['204'];
3781
    defaultResponseCode = '204';
3782
  } else if (responses['205']) {
3783
    response = responses['205'];
3784
    defaultResponseCode = '205';
3785
  } else if (responses['206']) {
3786
    response = responses['206'];
3787
    defaultResponseCode = '206';
3788
  } else if (responses['default']) {
3789
    response = responses['default'];
3790
    defaultResponseCode = 'default';
3791
  }
3792
3793
  if (response && response.schema) {
3794
    var resolvedModel = this.resolveModel(response.schema, definitions);
3795
    var successResponse;
3796
3797
    delete responses[defaultResponseCode];
3798
3799
    if (resolvedModel) {
3800
      this.successResponse = {};
3801
      successResponse = this.successResponse[defaultResponseCode] = resolvedModel;
3802
    } else if (!response.schema.type || response.schema.type === 'object' || response.schema.type === 'array') {
3803
      // Inline model
3804
      this.successResponse = {};
3805
      successResponse = this.successResponse[defaultResponseCode] = new Model(undefined, response.schema || {}, this.models, parent.modelPropertyMacro);
3806
    } else {
3807
      // Primitive
3808
      this.successResponse = {};
3809
      successResponse = this.successResponse[defaultResponseCode] = response.schema;
3810
    }
3811
3812
    if (successResponse) {
3813
      // Attach response properties
3814
      if (response.description) {
3815
        successResponse.description = response.description;
3816
      }
3817
3818
      if (response.examples) {
3819
        successResponse.examples = response.examples;
3820
      }
3821
3822
      if (response.headers) {
3823
        successResponse.headers = response.headers;
3824
      }
3825
    }
3826
3827
    this.type = response;
3828
  }
3829
3830
  if (errors.length > 0) {
3831
    if (this.resource && this.resource.api && this.resource.api.fail) {
3832
      this.resource.api.fail(errors);
3833
    }
3834
  }
3835
3836
  return this;
3837
};
3838
3839
Operation.prototype.isDefaultArrayItemValue = function(value, param) {
3840
  if (param.default && Array.isArray(param.default)) {
3841
    return param.default.indexOf(value) !== -1;
3842
  }
3843
  return value === param.default;
3844
};
3845
3846
Operation.prototype.getType = function (param) {
3847
  var type = param.type;
3848
  var format = param.format;
3849
  var isArray = false;
3850
  var str;
3851
3852
  if (type === 'integer' && format === 'int32') {
3853
    str = 'integer';
3854
  } else if (type === 'integer' && format === 'int64') {
3855
    str = 'long';
3856
  } else if (type === 'integer') {
3857
    str = 'integer';
3858
  } else if (type === 'string') {
3859
    if (format === 'date-time') {
3860
      str = 'date-time';
3861
    } else if (format === 'date') {
3862
      str = 'date';
3863
    } else {
3864
      str = 'string';
3865
    }
3866
  } else if (type === 'number' && format === 'float') {
3867
    str = 'float';
3868
  } else if (type === 'number' && format === 'double') {
3869
    str = 'double';
3870
  } else if (type === 'number') {
3871
    str = 'double';
3872
  } else if (type === 'boolean') {
3873
    str = 'boolean';
3874
  } else if (type === 'array') {
3875
    isArray = true;
3876
3877
    if (param.items) {
3878
      str = this.getType(param.items);
3879
    }
3880
  }
3881
3882
  if (param.$ref) {
3883
    str = helpers.simpleRef(param.$ref);
3884
  }
3885
3886
  var schema = param.schema;
3887
3888
  if (schema) {
3889
    var ref = schema.$ref;
3890
3891
    if (ref) {
3892
      ref = helpers.simpleRef(ref);
3893
3894
      if (isArray) {
3895
        return [ ref ];
3896
      } else {
3897
        return ref;
3898
      }
3899
    } else {
3900
      // If inline schema, we add it our interal hash -> which gives us it's ID (int)
3901
      if(schema.type === 'object') {
3902
        return this.addInlineModel(schema);
3903
      }
3904
      return this.getType(schema);
3905
    }
3906
  }
3907
  if (isArray) {
3908
    return [ str ];
3909
  } else {
3910
    return str;
3911
  }
3912
};
3913
3914
/**
3915
 * adds an inline schema (model) to a hash, where we can ref it later
3916
 * @param {object} schema a schema
3917
 * @return {number} the ID of the schema being added, or null
3918
 **/
3919
Operation.prototype.addInlineModel = function (schema) {
3920
  var len = this.inlineModels.length;
3921
  var model = this.resolveModel(schema, {});
3922
  if(model) {
3923
    this.inlineModels.push(model);
3924
    return 'Inline Model '+len; // return string ref of the inline model (used with #getInlineModel)
3925
  }
3926
  return null; // report errors?
3927
};
3928
3929
/**
3930
 * gets the internal ref to an inline model
3931
 * @param {string} inline_str a string reference to an inline model
3932
 * @return {Model} the model being referenced. Or null
3933
 **/
3934
Operation.prototype.getInlineModel = function(inlineStr) {
3935
  if(/^Inline Model \d+$/.test(inlineStr)) {
3936
    var id = parseInt(inlineStr.substr('Inline Model'.length).trim(),10); //
3937
    var model = this.inlineModels[id];
3938
    return model;
3939
  }
3940
  // I'm returning null here, should I rather throw an error?
3941
  return null;
3942
};
3943
3944
Operation.prototype.resolveModel = function (schema, definitions) {
3945
  if (typeof schema.$ref !== 'undefined') {
3946
    var ref = schema.$ref;
3947
3948
    if (ref.indexOf('#/definitions/') === 0) {
3949
      ref = ref.substring('#/definitions/'.length);
3950
    }
3951
3952
    if (definitions[ref]) {
3953
      return new Model(ref, definitions[ref], this.models, this.parent.modelPropertyMacro);
3954
    }
3955
  // schema must at least be an object to get resolved to an inline Model
3956
  } else if (schema && typeof schema === 'object' &&
3957
            (schema.type === 'object' || _.isUndefined(schema.type))) {
3958
    return new Model(undefined, schema, this.models, this.parent.modelPropertyMacro);
3959
  }
3960
3961
  return null;
3962
};
3963
3964
Operation.prototype.help = function (dontPrint) {
3965
  var out = this.nickname + ': ' + this.summary + '\n';
3966
3967
  for (var i = 0; i < this.parameters.length; i++) {
3968
    var param = this.parameters[i];
3969
    var typeInfo = param.signature;
3970
3971
    out += '\n  * ' + param.name + ' (' + typeInfo + '): ' + param.description;
3972
  }
3973
3974
  if (typeof dontPrint === 'undefined') {
3975
    helpers.log(out);
3976
  }
3977
3978
  return out;
3979
};
3980
3981
Operation.prototype.getModelSignature = function (type, definitions) {
3982
  var isPrimitive, listType;
3983
3984
  if (type instanceof Array) {
3985
    listType = true;
3986
    type = type[0];
3987
  }
3988
3989
  // Convert undefined to string of 'undefined'
3990
  if (typeof type === 'undefined') {
3991
    type = 'undefined';
3992
    isPrimitive = true;
3993
3994
  } else if (definitions[type]){
3995
    // a model def exists?
3996
    type = definitions[type]; /* Model */
3997
    isPrimitive = false;
3998
3999
  } else if (this.getInlineModel(type)) {
4000
    type = this.getInlineModel(type); /* Model */
4001
    isPrimitive = false;
4002
4003
  } else {
4004
    // We default to primitive
4005
    isPrimitive = true;
4006
  }
4007
4008
  if (isPrimitive) {
4009
    if (listType) {
4010
      return 'Array[' + type + ']';
4011
    } else {
4012
      return type.toString();
4013
    }
4014
  } else {
4015
    if (listType) {
4016
      return 'Array[' + type.getMockSignature() + ']';
4017
    } else {
4018
      return type.getMockSignature();
4019
    }
4020
  }
4021
};
4022
4023
Operation.prototype.supportHeaderParams = function () {
4024
  return true;
4025
};
4026
4027
Operation.prototype.supportedSubmitMethods = function () {
4028
  return this.parent.supportedSubmitMethods;
4029
};
4030
4031
Operation.prototype.getHeaderParams = function (args) {
4032
  var headers = this.setContentTypes(args, {});
4033
4034
  for (var i = 0; i < this.parameters.length; i++) {
4035
    var param = this.parameters[i];
4036
4037
    if (typeof args[param.name] !== 'undefined') {
4038
      if (param.in === 'header') {
4039
        var value = args[param.name];
4040
4041
        if (Array.isArray(value)) {
4042
          value = value.toString();
4043
        }
4044
4045
        headers[param.name] = value;
4046
      }
4047
    }
4048
  }
4049
4050
  return headers;
4051
};
4052
4053
Operation.prototype.urlify = function (args) {
4054
  var formParams = {};
4055
  var requestUrl = this.path;
4056
  var querystring = ''; // grab params from the args, build the querystring along the way
4057
4058
  for (var i = 0; i < this.parameters.length; i++) {
4059
    var param = this.parameters[i];
4060
4061
    if (typeof args[param.name] !== 'undefined') {
4062
      if (param.in === 'path') {
4063
        var reg = new RegExp('\{' + param.name + '\}', 'gi');
4064
        var value = args[param.name];
4065
4066
        if (Array.isArray(value)) {
4067
          value = this.encodePathCollection(param.collectionFormat, param.name, value);
4068
        } else {
4069
          value = this.encodePathParam(value);
4070
        }
4071
4072
        requestUrl = requestUrl.replace(reg, value);
4073
      } else if (param.in === 'query' && typeof args[param.name] !== 'undefined') {
4074
        if (querystring === '') {
4075
          querystring += '?';
4076
        } else {
4077
          querystring += '&';
4078
        }
4079
4080
        if (typeof param.collectionFormat !== 'undefined') {
4081
          var qp = args[param.name];
4082
4083
          if (Array.isArray(qp)) {
4084
            querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp);
4085
          } else {
4086
            querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4087
          }
4088
        } else {
4089
          querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4090
        }
4091
      } else if (param.in === 'formData') {
4092
        formParams[param.name] = args[param.name];
4093
      }
4094
    }
4095
  }
4096
  var url = this.scheme + '://' + this.host;
4097
4098
  if (this.basePath !== '/') {
4099
    url += this.basePath;
4100
  }
4101
  return url + requestUrl + querystring;
4102
};
4103
4104
Operation.prototype.getMissingParams = function (args) {
4105
  var missingParams = []; // check required params, track the ones that are missing
4106
  var i;
4107
4108
  for (i = 0; i < this.parameters.length; i++) {
4109
    var param = this.parameters[i];
4110
4111
    if (param.required === true) {
4112
      if (typeof args[param.name] === 'undefined') {
4113
        missingParams = param.name;
4114
      }
4115
    }
4116
  }
4117
4118
  return missingParams;
4119
};
4120
4121
Operation.prototype.getBody = function (headers, args, opts) {
4122
  var formParams = {}, body, key, value, hasBody = false;
4123
4124
  for (var i = 0; i < this.parameters.length; i++) {
4125
    var param = this.parameters[i];
4126
4127
    if (typeof args[param.name] !== 'undefined') {
4128
      if (param.in === 'body') {
4129
        body = args[param.name];
4130
      } else if (param.in === 'formData') {
4131
        formParams[param.name] = args[param.name];
4132
      }
4133
    }
4134
    else {
4135
      if(param.in === 'body') {
4136
        hasBody = true;
4137
      }
4138
    }
4139
  }
4140
4141
  // if body is null and hasBody is true, AND a JSON body is requested, send empty {}
4142
  if(hasBody && typeof body === 'undefined') {
4143
    var contentType = headers['Content-Type'];
4144
    if(contentType && contentType.indexOf('application/json') === 0) {
4145
      body = '{}';
4146
    }
4147
  }
4148
4149
  // handle form params
4150
  if (headers['Content-Type'] === 'application/x-www-form-urlencoded') {
4151
    var encoded = '';
4152
4153
    for (key in formParams) {
4154
      value = formParams[key];
4155
4156
      if (typeof value !== 'undefined') {
4157
        if (encoded !== '') {
4158
          encoded += '&';
4159
        }
4160
4161
        encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
4162
      }
4163
    }
4164
4165
    body = encoded;
4166
  } else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
4167
    if (opts.useJQuery) {
4168
      var bodyParam = new FormData();
4169
4170
      bodyParam.type = 'formData';
4171
4172
      for (key in formParams) {
4173
        value = args[key];
4174
4175
        if (typeof value !== 'undefined') {
4176
          // required for jquery file upload
4177
          if (value.type === 'file' && value.value) {
4178
            delete headers['Content-Type'];
4179
4180
            bodyParam.append(key, value.value);
4181
          } else {
4182
            bodyParam.append(key, value);
4183
          }
4184
        }
4185
      }
4186
4187
      body = bodyParam;
4188
    }
4189
  }
4190
4191
  return body;
4192
};
4193
4194
/**
4195
 * gets sample response for a single operation
4196
 **/
4197
Operation.prototype.getModelSampleJSON = function (type, models) {
4198
  var listType, sampleJson, innerType;
4199
  models = models || {};
4200
4201
  listType = (type instanceof Array);
4202
  innerType = listType ? type[0] : type;
4203
4204
  if(models[innerType]) {
4205
    sampleJson = models[innerType].createJSONSample();
4206
  } else if (this.getInlineModel(innerType)){
4207
    sampleJson = this.getInlineModel(innerType).createJSONSample(); // may return null, if type isn't correct
4208
  }
4209
4210
4211
  if (sampleJson) {
4212
    sampleJson = listType ? [sampleJson] : sampleJson;
4213
4214
    if (typeof sampleJson === 'string') {
4215
      return sampleJson;
4216
    } else if (_.isObject(sampleJson)) {
4217
      var t = sampleJson;
4218
4219
      if (sampleJson instanceof Array && sampleJson.length > 0) {
4220
        t = sampleJson[0];
4221
      }
4222
4223
      if (t.nodeName) {
4224
        var xmlString = new XMLSerializer().serializeToString(t);
4225
4226
        return this.formatXml(xmlString);
4227
      } else {
4228
        return JSON.stringify(sampleJson, null, 2);
4229
      }
4230
    } else {
4231
      return sampleJson;
4232
    }
4233
  }
4234
};
4235
4236
/**
4237
 * legacy binding
4238
 **/
4239
Operation.prototype.do = function (args, opts, callback, error, parent) {
4240
  return this.execute(args, opts, callback, error, parent);
4241
};
4242
4243
/**
4244
 * executes an operation
4245
 **/
4246
Operation.prototype.execute = function (arg1, arg2, arg3, arg4, parent) {
4247
  var args = arg1 || {};
4248
  var opts = {}, success, error;
4249
4250
  if (_.isObject(arg2)) {
4251
    opts = arg2;
4252
    success = arg3;
4253
    error = arg4;
4254
  }
4255
4256
  if(this.client) {
4257
    opts.client = this.client;
4258
  }
4259
  if(this.responseInterceptor) {
4260
    opts.responseInterceptor = this.responseInterceptor;
4261
  }
4262
4263
4264
  if (typeof arg2 === 'function') {
4265
    success = arg2;
4266
    error = arg3;
4267
  }
4268
4269
  success = (success || this.parent.defaultSuccessCallback || helpers.log);
4270
  error = (error || this.parent.defaultErrorCallback || helpers.log);
4271
4272
4273
  if (typeof opts.useJQuery === 'undefined') {
4274
    opts.useJQuery = this.useJQuery;
4275
  }
4276
  var missingParams = this.getMissingParams(args);
4277
4278
  if (missingParams.length > 0) {
4279
    var message = 'missing required params: ' + missingParams;
4280
4281
    helpers.fail(message);
4282
    error(message);
4283
4284
    return;
4285
  }
4286
4287
  var allHeaders = this.getHeaderParams(args);
4288
  var contentTypeHeaders = this.setContentTypes(args, opts);
4289
  var headers = {}, attrname;
4290
4291
  for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
4292
  for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
4293
4294
  var body = this.getBody(contentTypeHeaders, args, opts);
4295
  var url = this.urlify(args);
4296
4297
  if(url.indexOf('.{format}') > 0) {
4298
    if(headers) {
4299
      var format = headers.Accept || headers.accept;
4300
      if(format && format.indexOf('json') > 0) {
4301
        url = url.replace('.{format}', '.json');
4302
      }
4303
      else if(format && format.indexOf('xml') > 0) {
4304
        url = url.replace('.{format}', '.xml');
4305
      }
4306
    }
4307
  }
4308
4309
  var obj = {
4310
    url: url,
4311
    method: this.method.toUpperCase(),
4312
    body: body,
4313
    useJQuery: opts.useJQuery,
4314
    headers: headers,
4315
    on: {
4316
      response: function (response) {
4317
        return success(response, parent);
4318
      },
4319
      error: function (response) {
4320
        return error(response, parent);
4321
      }
4322
    }
4323
  };
4324
4325
  this.clientAuthorizations.apply(obj, this.operation.security);
4326
  if (opts.mock === true) {
4327
    return obj;
4328
  } else {
4329
    new SwaggerHttp().execute(obj, opts);
4330
  }
4331
};
4332
4333
function itemByPriority(col, itemPriority) {
4334
4335
  // No priorities? return first...
4336
  if(_.isEmpty(itemPriority)) {
4337
    return col[0];
4338
  }
4339
4340
  for (var i = 0, len = itemPriority.length; i < len; i++) {
4341
    if(col.indexOf(itemPriority[i]) > -1) {
4342
      return itemPriority[i];
4343
    }
4344
  }
4345
4346
  // Otherwise return first
4347
  return col[0];
4348
}
4349
4350
Operation.prototype.setContentTypes = function (args, opts) {
4351
  // default type
4352
  var allDefinedParams = this.parameters;
4353
  var body;
4354
  var consumes = args.parameterContentType || itemByPriority(this.consumes, ['application/json', 'application/yaml']);
4355
  var accepts = opts.responseContentType || itemByPriority(this.produces, ['application/json', 'application/yaml']);
4356
  var definedFileParams = [];
4357
  var definedFormParams = [];
4358
  var headers = {};
4359
  var i;
4360
4361
  // get params from the operation and set them in definedFileParams, definedFormParams, headers
4362
  for (i = 0; i < allDefinedParams.length; i++) {
4363
    var param = allDefinedParams[i];
4364
4365
    if (param.in === 'formData') {
4366
      if (param.type === 'file') {
4367
        definedFileParams.push(param);
4368
      } else {
4369
        definedFormParams.push(param);
4370
      }
4371
    } else if (param.in === 'header' && opts) {
4372
      var key = param.name;
4373
      var headerValue = opts[param.name];
4374
4375
      if (typeof opts[param.name] !== 'undefined') {
4376
        headers[key] = headerValue;
4377
      }
4378
    } else if (param.in === 'body' && typeof args[param.name] !== 'undefined') {
4379
      body = args[param.name];
4380
    }
4381
  }
4382
4383
  // if there's a body, need to set the consumes header via requestContentType
4384
  if (this.method === 'post' || this.method === 'put' || this.method === 'patch' ||
4385
      (this.method === 'delete' && body) ) {
4386
    if (opts.requestContentType) {
4387
      consumes = opts.requestContentType;
4388
    }
4389
    // if any form params, content type must be set
4390
    if (definedFormParams.length > 0) {
4391
      if (opts.requestContentType) {             // override if set
4392
        consumes = opts.requestContentType;
4393
      } else if (definedFileParams.length > 0) { // if a file, must be multipart/form-data
4394
        consumes = 'multipart/form-data';
4395
      } else {                                   // default to x-www-from-urlencoded
4396
        consumes = 'application/x-www-form-urlencoded';
4397
      }
4398
    }
4399
  }
4400
  else {
4401
    consumes = null;
4402
  }
4403
4404
  if (consumes && this.consumes) {
4405
    if (this.consumes.indexOf(consumes) === -1) {
4406
      helpers.log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes));
4407
    }
4408
  }
4409
4410
  if (!this.matchesAccept(accepts)) {
4411
    helpers.log('server can\'t produce ' + accepts);
4412
  }
4413
4414
  if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded')) {
4415
    headers['Content-Type'] = consumes;
4416
  }
4417
4418
  if (accepts) {
4419
    headers.Accept = accepts;
4420
  }
4421
4422
  return headers;
4423
};
4424
4425
/**
4426
 * Returns true if the request accepts header matches anything in this.produces.
4427
 *  If this.produces contains * / *, ignore the accept header.
4428
 * @param {string=} accepts The client request accept header.
4429
 * @return {boolean}
4430
 */
4431
Operation.prototype.matchesAccept = function(accepts) {
4432
  // no accepts or produces, no problem!
4433
  if (!accepts || !this.produces) {
4434
    return true;
4435
  }
4436
  return this.produces.indexOf(accepts) !== -1 || this.produces.indexOf('*/*') !== -1;
4437
};
4438
4439
Operation.prototype.asCurl = function (args1, args2) {
4440
  var opts = {mock: true};
4441
  if (typeof args2 === 'object') {
4442
    for (var argKey in args2) {
4443
      opts[argKey] = args2[argKey];
4444
    }
4445
  }
4446
  var obj = this.execute(args1, opts);
4447
4448
  this.clientAuthorizations.apply(obj);
4449
4450
  var results = [];
4451
4452
  results.push('-X ' + this.method.toUpperCase());
4453
4454
  if (obj.headers) {
4455
    var key;
4456
4457
    for (key in obj.headers) {
4458
      results.push('--header "' + key + ': ' + obj.headers[key] + '"');
4459
    }
4460
  }
4461
4462
  if (obj.body) {
4463
    var body;
4464
4465
    if (_.isObject(obj.body)) {
4466
      body = JSON.stringify(obj.body);
4467
    } else {
4468
      body = obj.body;
4469
    }
4470
4471
    results.push('-d "' + body.replace(/"/g, '\\"') + '"');
4472
  }
4473
4474
  return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
4475
};
4476
4477
Operation.prototype.encodePathCollection = function (type, name, value) {
4478
  var encoded = '';
4479
  var i;
4480
  var separator = '';
4481
4482
  if (type === 'ssv') {
4483
    separator = '%20';
4484
  } else if (type === 'tsv') {
4485
    separator = '\\t';
4486
  } else if (type === 'pipes') {
4487
    separator = '|';
4488
  } else {
4489
    separator = ',';
4490
  }
4491
4492
  for (i = 0; i < value.length; i++) {
4493
    if (i === 0) {
4494
      encoded = this.encodeQueryParam(value[i]);
4495
    } else {
4496
      encoded += separator + this.encodeQueryParam(value[i]);
4497
    }
4498
  }
4499
4500
  return encoded;
4501
};
4502
4503
Operation.prototype.encodeQueryCollection = function (type, name, value) {
4504
  var encoded = '';
4505
  var i;
4506
4507
  if (type === 'default' || type === 'multi') {
4508
    for (i = 0; i < value.length; i++) {
4509
      if (i > 0) {encoded += '&';}
4510
4511
      encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4512
    }
4513
  } else {
4514
    var separator = '';
4515
4516
    if (type === 'csv') {
4517
      separator = ',';
4518
    } else if (type === 'ssv') {
4519
      separator = '%20';
4520
    } else if (type === 'tsv') {
4521
      separator = '\\t';
4522
    } else if (type === 'pipes') {
4523
      separator = '|';
4524
    } else if (type === 'brackets') {
4525
      for (i = 0; i < value.length; i++) {
4526
        if (i !== 0) {
4527
          encoded += '&';
4528
        }
4529
4530
        encoded += this.encodeQueryParam(name) + '[]=' + this.encodeQueryParam(value[i]);
4531
      }
4532
    }
4533
4534
    if (separator !== '') {
4535
      for (i = 0; i < value.length; i++) {
4536
        if (i === 0) {
4537
          encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4538
        } else {
4539
          encoded += separator + this.encodeQueryParam(value[i]);
4540
        }
4541
      }
4542
    }
4543
  }
4544
4545
  return encoded;
4546
};
4547
4548
Operation.prototype.encodeQueryParam = function (arg) {
4549
  return encodeURIComponent(arg);
4550
};
4551
4552
/**
4553
 * TODO revisit, might not want to leave '/'
4554
 **/
4555
Operation.prototype.encodePathParam = function (pathParam) {
4556
  return encodeURIComponent(pathParam);
4557
};
4558
4559
},{"../helpers":4,"../http":5,"./model":9,"lodash-compat/lang/cloneDeep":141,"lodash-compat/lang/isEmpty":144,"lodash-compat/lang/isObject":147,"lodash-compat/lang/isUndefined":151}],11:[function(require,module,exports){
4560
'use strict';
4561
4562
var OperationGroup = module.exports = function (tag, description, externalDocs, operation) {
4563
  this.description = description;
4564
  this.externalDocs = externalDocs;
4565
  this.name = tag;
4566
  this.operation = operation;
4567
  this.operationsArray = [];
4568
  this.path = tag;
4569
  this.tag = tag;
4570
};
4571
4572
OperationGroup.prototype.sort = function () {
4573
4574
};
4575
4576
4577
},{}],12:[function(require,module,exports){
4578
4579
},{}],13:[function(require,module,exports){
4580
/*!
4581
 * The buffer module from node.js, for the browser.
4582
 *
4583
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
4584
 * @license  MIT
4585
 */
4586
4587
var base64 = require('base64-js')
4588
var ieee754 = require('ieee754')
4589
var isArray = require('is-array')
4590
4591
exports.Buffer = Buffer
4592
exports.SlowBuffer = SlowBuffer
4593
exports.INSPECT_MAX_BYTES = 50
4594
Buffer.poolSize = 8192 // not used by this implementation
4595
4596
var rootParent = {}
4597
4598
/**
4599
 * If `Buffer.TYPED_ARRAY_SUPPORT`:
4600
 *   === true    Use Uint8Array implementation (fastest)
4601
 *   === false   Use Object implementation (most compatible, even IE6)
4602
 *
4603
 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
4604
 * Opera 11.6+, iOS 4.2+.
4605
 *
4606
 * Note:
4607
 *
4608
 * - Implementation must support adding new properties to `Uint8Array` instances.
4609
 *   Firefox 4-29 lacked support, fixed in Firefox 30+.
4610
 *   See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
4611
 *
4612
 *  - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
4613
 *
4614
 *  - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
4615
 *    incorrect length in some situations.
4616
 *
4617
 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will
4618
 * get the Object implementation, which is slower but will work correctly.
4619
 */
4620
Buffer.TYPED_ARRAY_SUPPORT = (function () {
4621
  function Foo () {}
4622
  try {
4623
    var buf = new ArrayBuffer(0)
4624
    var arr = new Uint8Array(buf)
4625
    arr.foo = function () { return 42 }
4626
    arr.constructor = Foo
4627
    return arr.foo() === 42 && // typed array instances can be augmented
4628
        arr.constructor === Foo && // constructor can be set
4629
        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
4630
        new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
4631
  } catch (e) {
4632
    return false
4633
  }
4634
})()
4635
4636
function kMaxLength () {
4637
  return Buffer.TYPED_ARRAY_SUPPORT
4638
    ? 0x7fffffff
4639
    : 0x3fffffff
4640
}
4641
4642
/**
4643
 * Class: Buffer
4644
 * =============
4645
 *
4646
 * The Buffer constructor returns instances of `Uint8Array` that are augmented
4647
 * with function properties for all the node `Buffer` API functions. We use
4648
 * `Uint8Array` so that square bracket notation works as expected -- it returns
4649
 * a single octet.
4650
 *
4651
 * By augmenting the instances, we can avoid modifying the `Uint8Array`
4652
 * prototype.
4653
 */
4654
function Buffer (arg) {
4655
  if (!(this instanceof Buffer)) {
4656
    // Avoid going through an ArgumentsAdaptorTrampoline in the common case.
4657
    if (arguments.length > 1) return new Buffer(arg, arguments[1])
4658
    return new Buffer(arg)
4659
  }
4660
4661
  this.length = 0
4662
  this.parent = undefined
4663
4664
  // Common case.
4665
  if (typeof arg === 'number') {
4666
    return fromNumber(this, arg)
4667
  }
4668
4669
  // Slightly less common case.
4670
  if (typeof arg === 'string') {
4671
    return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
4672
  }
4673
4674
  // Unusual.
4675
  return fromObject(this, arg)
4676
}
4677
4678
function fromNumber (that, length) {
4679
  that = allocate(that, length < 0 ? 0 : checked(length) | 0)
4680
  if (!Buffer.TYPED_ARRAY_SUPPORT) {
4681
    for (var i = 0; i < length; i++) {
4682
      that[i] = 0
4683
    }
4684
  }
4685
  return that
4686
}
4687
4688
function fromString (that, string, encoding) {
4689
  if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
4690
4691
  // Assumption: byteLength() return value is always < kMaxLength.
4692
  var length = byteLength(string, encoding) | 0
4693
  that = allocate(that, length)
4694
4695
  that.write(string, encoding)
4696
  return that
4697
}
4698
4699
function fromObject (that, object) {
4700
  if (Buffer.isBuffer(object)) return fromBuffer(that, object)
4701
4702
  if (isArray(object)) return fromArray(that, object)
4703
4704
  if (object == null) {
4705
    throw new TypeError('must start with number, buffer, array or string')
4706
  }
4707
4708
  if (typeof ArrayBuffer !== 'undefined' && object.buffer instanceof ArrayBuffer) {
4709
    return fromTypedArray(that, object)
4710
  }
4711
4712
  if (object.length) return fromArrayLike(that, object)
4713
4714
  return fromJsonObject(that, object)
4715
}
4716
4717
function fromBuffer (that, buffer) {
4718
  var length = checked(buffer.length) | 0
4719
  that = allocate(that, length)
4720
  buffer.copy(that, 0, 0, length)
4721
  return that
4722
}
4723
4724
function fromArray (that, array) {
4725
  var length = checked(array.length) | 0
4726
  that = allocate(that, length)
4727
  for (var i = 0; i < length; i += 1) {
4728
    that[i] = array[i] & 255
4729
  }
4730
  return that
4731
}
4732
4733
// Duplicate of fromArray() to keep fromArray() monomorphic.
4734
function fromTypedArray (that, array) {
4735
  var length = checked(array.length) | 0
4736
  that = allocate(that, length)
4737
  // Truncating the elements is probably not what people expect from typed
4738
  // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
4739
  // of the old Buffer constructor.
4740
  for (var i = 0; i < length; i += 1) {
4741
    that[i] = array[i] & 255
4742
  }
4743
  return that
4744
}
4745
4746
function fromArrayLike (that, array) {
4747
  var length = checked(array.length) | 0
4748
  that = allocate(that, length)
4749
  for (var i = 0; i < length; i += 1) {
4750
    that[i] = array[i] & 255
4751
  }
4752
  return that
4753
}
4754
4755
// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
4756
// Returns a zero-length buffer for inputs that don't conform to the spec.
4757
function fromJsonObject (that, object) {
4758
  var array
4759
  var length = 0
4760
4761
  if (object.type === 'Buffer' && isArray(object.data)) {
4762
    array = object.data
4763
    length = checked(array.length) | 0
4764
  }
4765
  that = allocate(that, length)
4766
4767
  for (var i = 0; i < length; i += 1) {
4768
    that[i] = array[i] & 255
4769
  }
4770
  return that
4771
}
4772
4773
function allocate (that, length) {
4774
  if (Buffer.TYPED_ARRAY_SUPPORT) {
4775
    // Return an augmented `Uint8Array` instance, for best performance
4776
    that = Buffer._augment(new Uint8Array(length))
4777
  } else {
4778
    // Fallback: Return an object instance of the Buffer class
4779
    that.length = length
4780
    that._isBuffer = true
4781
  }
4782
4783
  var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
4784
  if (fromPool) that.parent = rootParent
4785
4786
  return that
4787
}
4788
4789
function checked (length) {
4790
  // Note: cannot use `length < kMaxLength` here because that fails when
4791
  // length is NaN (which is otherwise coerced to zero.)
4792
  if (length >= kMaxLength()) {
4793
    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
4794
                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
4795
  }
4796
  return length | 0
4797
}
4798
4799
function SlowBuffer (subject, encoding) {
4800
  if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
4801
4802
  var buf = new Buffer(subject, encoding)
4803
  delete buf.parent
4804
  return buf
4805
}
4806
4807
Buffer.isBuffer = function isBuffer (b) {
4808
  return !!(b != null && b._isBuffer)
4809
}
4810
4811
Buffer.compare = function compare (a, b) {
4812
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
4813
    throw new TypeError('Arguments must be Buffers')
4814
  }
4815
4816
  if (a === b) return 0
4817
4818
  var x = a.length
4819
  var y = b.length
4820
4821
  var i = 0
4822
  var len = Math.min(x, y)
4823
  while (i < len) {
4824
    if (a[i] !== b[i]) break
4825
4826
    ++i
4827
  }
4828
4829
  if (i !== len) {
4830
    x = a[i]
4831
    y = b[i]
4832
  }
4833
4834
  if (x < y) return -1
4835
  if (y < x) return 1
4836
  return 0
4837
}
4838
4839
Buffer.isEncoding = function isEncoding (encoding) {
4840
  switch (String(encoding).toLowerCase()) {
4841
    case 'hex':
4842
    case 'utf8':
4843
    case 'utf-8':
4844
    case 'ascii':
4845
    case 'binary':
4846
    case 'base64':
4847
    case 'raw':
4848
    case 'ucs2':
4849
    case 'ucs-2':
4850
    case 'utf16le':
4851
    case 'utf-16le':
4852
      return true
4853
    default:
4854
      return false
4855
  }
4856
}
4857
4858
Buffer.concat = function concat (list, length) {
4859
  if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
4860
4861
  if (list.length === 0) {
4862
    return new Buffer(0)
4863
  } else if (list.length === 1) {
4864
    return list[0]
4865
  }
4866
4867
  var i
4868
  if (length === undefined) {
4869
    length = 0
4870
    for (i = 0; i < list.length; i++) {
4871
      length += list[i].length
4872
    }
4873
  }
4874
4875
  var buf = new Buffer(length)
4876
  var pos = 0
4877
  for (i = 0; i < list.length; i++) {
4878
    var item = list[i]
4879
    item.copy(buf, pos)
4880
    pos += item.length
4881
  }
4882
  return buf
4883
}
4884
4885
function byteLength (string, encoding) {
4886
  if (typeof string !== 'string') string = '' + string
4887
4888
  var len = string.length
4889
  if (len === 0) return 0
4890
4891
  // Use a for loop to avoid recursion
4892
  var loweredCase = false
4893
  for (;;) {
4894
    switch (encoding) {
4895
      case 'ascii':
4896
      case 'binary':
4897
      // Deprecated
4898
      case 'raw':
4899
      case 'raws':
4900
        return len
4901
      case 'utf8':
4902
      case 'utf-8':
4903
        return utf8ToBytes(string).length
4904
      case 'ucs2':
4905
      case 'ucs-2':
4906
      case 'utf16le':
4907
      case 'utf-16le':
4908
        return len * 2
4909
      case 'hex':
4910
        return len >>> 1
4911
      case 'base64':
4912
        return base64ToBytes(string).length
4913
      default:
4914
        if (loweredCase) return utf8ToBytes(string).length // assume utf8
4915
        encoding = ('' + encoding).toLowerCase()
4916
        loweredCase = true
4917
    }
4918
  }
4919
}
4920
Buffer.byteLength = byteLength
4921
4922
// pre-set for values that may exist in the future
4923
Buffer.prototype.length = undefined
4924
Buffer.prototype.parent = undefined
4925
4926
function slowToString (encoding, start, end) {
4927
  var loweredCase = false
4928
4929
  start = start | 0
4930
  end = end === undefined || end === Infinity ? this.length : end | 0
4931
4932
  if (!encoding) encoding = 'utf8'
4933
  if (start < 0) start = 0
4934
  if (end > this.length) end = this.length
4935
  if (end <= start) return ''
4936
4937
  while (true) {
4938
    switch (encoding) {
4939
      case 'hex':
4940
        return hexSlice(this, start, end)
4941
4942
      case 'utf8':
4943
      case 'utf-8':
4944
        return utf8Slice(this, start, end)
4945
4946
      case 'ascii':
4947
        return asciiSlice(this, start, end)
4948
4949
      case 'binary':
4950
        return binarySlice(this, start, end)
4951
4952
      case 'base64':
4953
        return base64Slice(this, start, end)
4954
4955
      case 'ucs2':
4956
      case 'ucs-2':
4957
      case 'utf16le':
4958
      case 'utf-16le':
4959
        return utf16leSlice(this, start, end)
4960
4961
      default:
4962
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
4963
        encoding = (encoding + '').toLowerCase()
4964
        loweredCase = true
4965
    }
4966
  }
4967
}
4968
4969
Buffer.prototype.toString = function toString () {
4970
  var length = this.length | 0
4971
  if (length === 0) return ''
4972
  if (arguments.length === 0) return utf8Slice(this, 0, length)
4973
  return slowToString.apply(this, arguments)
4974
}
4975
4976
Buffer.prototype.equals = function equals (b) {
4977
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
4978
  if (this === b) return true
4979
  return Buffer.compare(this, b) === 0
4980
}
4981
4982
Buffer.prototype.inspect = function inspect () {
4983
  var str = ''
4984
  var max = exports.INSPECT_MAX_BYTES
4985
  if (this.length > 0) {
4986
    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
4987
    if (this.length > max) str += ' ... '
4988
  }
4989
  return '<Buffer ' + str + '>'
4990
}
4991
4992
Buffer.prototype.compare = function compare (b) {
4993
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
4994
  if (this === b) return 0
4995
  return Buffer.compare(this, b)
4996
}
4997
4998
Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
4999
  if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
5000
  else if (byteOffset < -0x80000000) byteOffset = -0x80000000
5001
  byteOffset >>= 0
5002
5003
  if (this.length === 0) return -1
5004
  if (byteOffset >= this.length) return -1
5005
5006
  // Negative offsets start from the end of the buffer
5007
  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
5008
5009
  if (typeof val === 'string') {
5010
    if (val.length === 0) return -1 // special case: looking for empty string always fails
5011
    return String.prototype.indexOf.call(this, val, byteOffset)
5012
  }
5013
  if (Buffer.isBuffer(val)) {
5014
    return arrayIndexOf(this, val, byteOffset)
5015
  }
5016
  if (typeof val === 'number') {
5017
    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
5018
      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
5019
    }
5020
    return arrayIndexOf(this, [ val ], byteOffset)
5021
  }
5022
5023
  function arrayIndexOf (arr, val, byteOffset) {
5024
    var foundIndex = -1
5025
    for (var i = 0; byteOffset + i < arr.length; i++) {
5026
      if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
5027
        if (foundIndex === -1) foundIndex = i
5028
        if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
5029
      } else {
5030
        foundIndex = -1
5031
      }
5032
    }
5033
    return -1
5034
  }
5035
5036
  throw new TypeError('val must be string, number or Buffer')
5037
}
5038
5039
// `get` will be removed in Node 0.13+
5040
Buffer.prototype.get = function get (offset) {
5041
  console.log('.get() is deprecated. Access using array indexes instead.')
5042
  return this.readUInt8(offset)
5043
}
5044
5045
// `set` will be removed in Node 0.13+
5046
Buffer.prototype.set = function set (v, offset) {
5047
  console.log('.set() is deprecated. Access using array indexes instead.')
5048
  return this.writeUInt8(v, offset)
5049
}
5050
5051
function hexWrite (buf, string, offset, length) {
5052
  offset = Number(offset) || 0
5053
  var remaining = buf.length - offset
5054
  if (!length) {
5055
    length = remaining
5056
  } else {
5057
    length = Number(length)
5058
    if (length > remaining) {
5059
      length = remaining
5060
    }
5061
  }
5062
5063
  // must be an even number of digits
5064
  var strLen = string.length
5065
  if (strLen % 2 !== 0) throw new Error('Invalid hex string')
5066
5067
  if (length > strLen / 2) {
5068
    length = strLen / 2
5069
  }
5070
  for (var i = 0; i < length; i++) {
5071
    var parsed = parseInt(string.substr(i * 2, 2), 16)
5072
    if (isNaN(parsed)) throw new Error('Invalid hex string')
5073
    buf[offset + i] = parsed
5074
  }
5075
  return i
5076
}
5077
5078
function utf8Write (buf, string, offset, length) {
5079
  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
5080
}
5081
5082
function asciiWrite (buf, string, offset, length) {
5083
  return blitBuffer(asciiToBytes(string), buf, offset, length)
5084
}
5085
5086
function binaryWrite (buf, string, offset, length) {
5087
  return asciiWrite(buf, string, offset, length)
5088
}
5089
5090
function base64Write (buf, string, offset, length) {
5091
  return blitBuffer(base64ToBytes(string), buf, offset, length)
5092
}
5093
5094
function ucs2Write (buf, string, offset, length) {
5095
  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
5096
}
5097
5098
Buffer.prototype.write = function write (string, offset, length, encoding) {
5099
  // Buffer#write(string)
5100
  if (offset === undefined) {
5101
    encoding = 'utf8'
5102
    length = this.length
5103
    offset = 0
5104
  // Buffer#write(string, encoding)
5105
  } else if (length === undefined && typeof offset === 'string') {
5106
    encoding = offset
5107
    length = this.length
5108
    offset = 0
5109
  // Buffer#write(string, offset[, length][, encoding])
5110
  } else if (isFinite(offset)) {
5111
    offset = offset | 0
5112
    if (isFinite(length)) {
5113
      length = length | 0
5114
      if (encoding === undefined) encoding = 'utf8'
5115
    } else {
5116
      encoding = length
5117
      length = undefined
5118
    }
5119
  // legacy write(string, encoding, offset, length) - remove in v0.13
5120
  } else {
5121
    var swap = encoding
5122
    encoding = offset
5123
    offset = length | 0
5124
    length = swap
5125
  }
5126
5127
  var remaining = this.length - offset
5128
  if (length === undefined || length > remaining) length = remaining
5129
5130
  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
5131
    throw new RangeError('attempt to write outside buffer bounds')
5132
  }
5133
5134
  if (!encoding) encoding = 'utf8'
5135
5136
  var loweredCase = false
5137
  for (;;) {
5138
    switch (encoding) {
5139
      case 'hex':
5140
        return hexWrite(this, string, offset, length)
5141
5142
      case 'utf8':
5143
      case 'utf-8':
5144
        return utf8Write(this, string, offset, length)
5145
5146
      case 'ascii':
5147
        return asciiWrite(this, string, offset, length)
5148
5149
      case 'binary':
5150
        return binaryWrite(this, string, offset, length)
5151
5152
      case 'base64':
5153
        // Warning: maxLength not taken into account in base64Write
5154
        return base64Write(this, string, offset, length)
5155
5156
      case 'ucs2':
5157
      case 'ucs-2':
5158
      case 'utf16le':
5159
      case 'utf-16le':
5160
        return ucs2Write(this, string, offset, length)
5161
5162
      default:
5163
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5164
        encoding = ('' + encoding).toLowerCase()
5165
        loweredCase = true
5166
    }
5167
  }
5168
}
5169
5170
Buffer.prototype.toJSON = function toJSON () {
5171
  return {
5172
    type: 'Buffer',
5173
    data: Array.prototype.slice.call(this._arr || this, 0)
5174
  }
5175
}
5176
5177
function base64Slice (buf, start, end) {
5178
  if (start === 0 && end === buf.length) {
5179
    return base64.fromByteArray(buf)
5180
  } else {
5181
    return base64.fromByteArray(buf.slice(start, end))
5182
  }
5183
}
5184
5185
function utf8Slice (buf, start, end) {
5186
  var res = ''
5187
  var tmp = ''
5188
  end = Math.min(buf.length, end)
5189
5190
  for (var i = start; i < end; i++) {
5191
    if (buf[i] <= 0x7F) {
5192
      res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
5193
      tmp = ''
5194
    } else {
5195
      tmp += '%' + buf[i].toString(16)
5196
    }
5197
  }
5198
5199
  return res + decodeUtf8Char(tmp)
5200
}
5201
5202
function asciiSlice (buf, start, end) {
5203
  var ret = ''
5204
  end = Math.min(buf.length, end)
5205
5206
  for (var i = start; i < end; i++) {
5207
    ret += String.fromCharCode(buf[i] & 0x7F)
5208
  }
5209
  return ret
5210
}
5211
5212
function binarySlice (buf, start, end) {
5213
  var ret = ''
5214
  end = Math.min(buf.length, end)
5215
5216
  for (var i = start; i < end; i++) {
5217
    ret += String.fromCharCode(buf[i])
5218
  }
5219
  return ret
5220
}
5221
5222
function hexSlice (buf, start, end) {
5223
  var len = buf.length
5224
5225
  if (!start || start < 0) start = 0
5226
  if (!end || end < 0 || end > len) end = len
5227
5228
  var out = ''
5229
  for (var i = start; i < end; i++) {
5230
    out += toHex(buf[i])
5231
  }
5232
  return out
5233
}
5234
5235
function utf16leSlice (buf, start, end) {
5236
  var bytes = buf.slice(start, end)
5237
  var res = ''
5238
  for (var i = 0; i < bytes.length; i += 2) {
5239
    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
5240
  }
5241
  return res
5242
}
5243
5244
Buffer.prototype.slice = function slice (start, end) {
5245
  var len = this.length
5246
  start = ~~start
5247
  end = end === undefined ? len : ~~end
5248
5249
  if (start < 0) {
5250
    start += len
5251
    if (start < 0) start = 0
5252
  } else if (start > len) {
5253
    start = len
5254
  }
5255
5256
  if (end < 0) {
5257
    end += len
5258
    if (end < 0) end = 0
5259
  } else if (end > len) {
5260
    end = len
5261
  }
5262
5263
  if (end < start) end = start
5264
5265
  var newBuf
5266
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5267
    newBuf = Buffer._augment(this.subarray(start, end))
5268
  } else {
5269
    var sliceLen = end - start
5270
    newBuf = new Buffer(sliceLen, undefined)
5271
    for (var i = 0; i < sliceLen; i++) {
5272
      newBuf[i] = this[i + start]
5273
    }
5274
  }
5275
5276
  if (newBuf.length) newBuf.parent = this.parent || this
5277
5278
  return newBuf
5279
}
5280
5281
/*
5282
 * Need to make sure that buffer isn't trying to write out of bounds.
5283
 */
5284
function checkOffset (offset, ext, length) {
5285
  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
5286
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
5287
}
5288
5289
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
5290
  offset = offset | 0
5291
  byteLength = byteLength | 0
5292
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5293
5294
  var val = this[offset]
5295
  var mul = 1
5296
  var i = 0
5297
  while (++i < byteLength && (mul *= 0x100)) {
5298
    val += this[offset + i] * mul
5299
  }
5300
5301
  return val
5302
}
5303
5304
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
5305
  offset = offset | 0
5306
  byteLength = byteLength | 0
5307
  if (!noAssert) {
5308
    checkOffset(offset, byteLength, this.length)
5309
  }
5310
5311
  var val = this[offset + --byteLength]
5312
  var mul = 1
5313
  while (byteLength > 0 && (mul *= 0x100)) {
5314
    val += this[offset + --byteLength] * mul
5315
  }
5316
5317
  return val
5318
}
5319
5320
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
5321
  if (!noAssert) checkOffset(offset, 1, this.length)
5322
  return this[offset]
5323
}
5324
5325
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
5326
  if (!noAssert) checkOffset(offset, 2, this.length)
5327
  return this[offset] | (this[offset + 1] << 8)
5328
}
5329
5330
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
5331
  if (!noAssert) checkOffset(offset, 2, this.length)
5332
  return (this[offset] << 8) | this[offset + 1]
5333
}
5334
5335
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
5336
  if (!noAssert) checkOffset(offset, 4, this.length)
5337
5338
  return ((this[offset]) |
5339
      (this[offset + 1] << 8) |
5340
      (this[offset + 2] << 16)) +
5341
      (this[offset + 3] * 0x1000000)
5342
}
5343
5344
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
5345
  if (!noAssert) checkOffset(offset, 4, this.length)
5346
5347
  return (this[offset] * 0x1000000) +
5348
    ((this[offset + 1] << 16) |
5349
    (this[offset + 2] << 8) |
5350
    this[offset + 3])
5351
}
5352
5353
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
5354
  offset = offset | 0
5355
  byteLength = byteLength | 0
5356
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5357
5358
  var val = this[offset]
5359
  var mul = 1
5360
  var i = 0
5361
  while (++i < byteLength && (mul *= 0x100)) {
5362
    val += this[offset + i] * mul
5363
  }
5364
  mul *= 0x80
5365
5366
  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5367
5368
  return val
5369
}
5370
5371
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
5372
  offset = offset | 0
5373
  byteLength = byteLength | 0
5374
  if (!noAssert) checkOffset(offset, byteLength, this.length)
5375
5376
  var i = byteLength
5377
  var mul = 1
5378
  var val = this[offset + --i]
5379
  while (i > 0 && (mul *= 0x100)) {
5380
    val += this[offset + --i] * mul
5381
  }
5382
  mul *= 0x80
5383
5384
  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5385
5386
  return val
5387
}
5388
5389
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
5390
  if (!noAssert) checkOffset(offset, 1, this.length)
5391
  if (!(this[offset] & 0x80)) return (this[offset])
5392
  return ((0xff - this[offset] + 1) * -1)
5393
}
5394
5395
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
5396
  if (!noAssert) checkOffset(offset, 2, this.length)
5397
  var val = this[offset] | (this[offset + 1] << 8)
5398
  return (val & 0x8000) ? val | 0xFFFF0000 : val
5399
}
5400
5401
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
5402
  if (!noAssert) checkOffset(offset, 2, this.length)
5403
  var val = this[offset + 1] | (this[offset] << 8)
5404
  return (val & 0x8000) ? val | 0xFFFF0000 : val
5405
}
5406
5407
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
5408
  if (!noAssert) checkOffset(offset, 4, this.length)
5409
5410
  return (this[offset]) |
5411
    (this[offset + 1] << 8) |
5412
    (this[offset + 2] << 16) |
5413
    (this[offset + 3] << 24)
5414
}
5415
5416
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
5417
  if (!noAssert) checkOffset(offset, 4, this.length)
5418
5419
  return (this[offset] << 24) |
5420
    (this[offset + 1] << 16) |
5421
    (this[offset + 2] << 8) |
5422
    (this[offset + 3])
5423
}
5424
5425
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
5426
  if (!noAssert) checkOffset(offset, 4, this.length)
5427
  return ieee754.read(this, offset, true, 23, 4)
5428
}
5429
5430
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
5431
  if (!noAssert) checkOffset(offset, 4, this.length)
5432
  return ieee754.read(this, offset, false, 23, 4)
5433
}
5434
5435
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
5436
  if (!noAssert) checkOffset(offset, 8, this.length)
5437
  return ieee754.read(this, offset, true, 52, 8)
5438
}
5439
5440
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
5441
  if (!noAssert) checkOffset(offset, 8, this.length)
5442
  return ieee754.read(this, offset, false, 52, 8)
5443
}
5444
5445
function checkInt (buf, value, offset, ext, max, min) {
5446
  if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
5447
  if (value > max || value < min) throw new RangeError('value is out of bounds')
5448
  if (offset + ext > buf.length) throw new RangeError('index out of range')
5449
}
5450
5451
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
5452
  value = +value
5453
  offset = offset | 0
5454
  byteLength = byteLength | 0
5455
  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
5456
5457
  var mul = 1
5458
  var i = 0
5459
  this[offset] = value & 0xFF
5460
  while (++i < byteLength && (mul *= 0x100)) {
5461
    this[offset + i] = (value / mul) & 0xFF
5462
  }
5463
5464
  return offset + byteLength
5465
}
5466
5467
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
5468
  value = +value
5469
  offset = offset | 0
5470
  byteLength = byteLength | 0
5471
  if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
5472
5473
  var i = byteLength - 1
5474
  var mul = 1
5475
  this[offset + i] = value & 0xFF
5476
  while (--i >= 0 && (mul *= 0x100)) {
5477
    this[offset + i] = (value / mul) & 0xFF
5478
  }
5479
5480
  return offset + byteLength
5481
}
5482
5483
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
5484
  value = +value
5485
  offset = offset | 0
5486
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
5487
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
5488
  this[offset] = value
5489
  return offset + 1
5490
}
5491
5492
function objectWriteUInt16 (buf, value, offset, littleEndian) {
5493
  if (value < 0) value = 0xffff + value + 1
5494
  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
5495
    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
5496
      (littleEndian ? i : 1 - i) * 8
5497
  }
5498
}
5499
5500
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
5501
  value = +value
5502
  offset = offset | 0
5503
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5504
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5505
    this[offset] = value
5506
    this[offset + 1] = (value >>> 8)
5507
  } else {
5508
    objectWriteUInt16(this, value, offset, true)
5509
  }
5510
  return offset + 2
5511
}
5512
5513
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
5514
  value = +value
5515
  offset = offset | 0
5516
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5517
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5518
    this[offset] = (value >>> 8)
5519
    this[offset + 1] = value
5520
  } else {
5521
    objectWriteUInt16(this, value, offset, false)
5522
  }
5523
  return offset + 2
5524
}
5525
5526
function objectWriteUInt32 (buf, value, offset, littleEndian) {
5527
  if (value < 0) value = 0xffffffff + value + 1
5528
  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
5529
    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
5530
  }
5531
}
5532
5533
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
5534
  value = +value
5535
  offset = offset | 0
5536
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5537
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5538
    this[offset + 3] = (value >>> 24)
5539
    this[offset + 2] = (value >>> 16)
5540
    this[offset + 1] = (value >>> 8)
5541
    this[offset] = value
5542
  } else {
5543
    objectWriteUInt32(this, value, offset, true)
5544
  }
5545
  return offset + 4
5546
}
5547
5548
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
5549
  value = +value
5550
  offset = offset | 0
5551
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5552
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5553
    this[offset] = (value >>> 24)
5554
    this[offset + 1] = (value >>> 16)
5555
    this[offset + 2] = (value >>> 8)
5556
    this[offset + 3] = value
5557
  } else {
5558
    objectWriteUInt32(this, value, offset, false)
5559
  }
5560
  return offset + 4
5561
}
5562
5563
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
5564
  value = +value
5565
  offset = offset | 0
5566
  if (!noAssert) {
5567
    var limit = Math.pow(2, 8 * byteLength - 1)
5568
5569
    checkInt(this, value, offset, byteLength, limit - 1, -limit)
5570
  }
5571
5572
  var i = 0
5573
  var mul = 1
5574
  var sub = value < 0 ? 1 : 0
5575
  this[offset] = value & 0xFF
5576
  while (++i < byteLength && (mul *= 0x100)) {
5577
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5578
  }
5579
5580
  return offset + byteLength
5581
}
5582
5583
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
5584
  value = +value
5585
  offset = offset | 0
5586
  if (!noAssert) {
5587
    var limit = Math.pow(2, 8 * byteLength - 1)
5588
5589
    checkInt(this, value, offset, byteLength, limit - 1, -limit)
5590
  }
5591
5592
  var i = byteLength - 1
5593
  var mul = 1
5594
  var sub = value < 0 ? 1 : 0
5595
  this[offset + i] = value & 0xFF
5596
  while (--i >= 0 && (mul *= 0x100)) {
5597
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5598
  }
5599
5600
  return offset + byteLength
5601
}
5602
5603
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
5604
  value = +value
5605
  offset = offset | 0
5606
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
5607
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
5608
  if (value < 0) value = 0xff + value + 1
5609
  this[offset] = value
5610
  return offset + 1
5611
}
5612
5613
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
5614
  value = +value
5615
  offset = offset | 0
5616
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5617
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5618
    this[offset] = value
5619
    this[offset + 1] = (value >>> 8)
5620
  } else {
5621
    objectWriteUInt16(this, value, offset, true)
5622
  }
5623
  return offset + 2
5624
}
5625
5626
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
5627
  value = +value
5628
  offset = offset | 0
5629
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5630
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5631
    this[offset] = (value >>> 8)
5632
    this[offset + 1] = value
5633
  } else {
5634
    objectWriteUInt16(this, value, offset, false)
5635
  }
5636
  return offset + 2
5637
}
5638
5639
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
5640
  value = +value
5641
  offset = offset | 0
5642
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5643
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5644
    this[offset] = value
5645
    this[offset + 1] = (value >>> 8)
5646
    this[offset + 2] = (value >>> 16)
5647
    this[offset + 3] = (value >>> 24)
5648
  } else {
5649
    objectWriteUInt32(this, value, offset, true)
5650
  }
5651
  return offset + 4
5652
}
5653
5654
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
5655
  value = +value
5656
  offset = offset | 0
5657
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5658
  if (value < 0) value = 0xffffffff + value + 1
5659
  if (Buffer.TYPED_ARRAY_SUPPORT) {
5660
    this[offset] = (value >>> 24)
5661
    this[offset + 1] = (value >>> 16)
5662
    this[offset + 2] = (value >>> 8)
5663
    this[offset + 3] = value
5664
  } else {
5665
    objectWriteUInt32(this, value, offset, false)
5666
  }
5667
  return offset + 4
5668
}
5669
5670
function checkIEEE754 (buf, value, offset, ext, max, min) {
5671
  if (value > max || value < min) throw new RangeError('value is out of bounds')
5672
  if (offset + ext > buf.length) throw new RangeError('index out of range')
5673
  if (offset < 0) throw new RangeError('index out of range')
5674
}
5675
5676
function writeFloat (buf, value, offset, littleEndian, noAssert) {
5677
  if (!noAssert) {
5678
    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
5679
  }
5680
  ieee754.write(buf, value, offset, littleEndian, 23, 4)
5681
  return offset + 4
5682
}
5683
5684
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
5685
  return writeFloat(this, value, offset, true, noAssert)
5686
}
5687
5688
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
5689
  return writeFloat(this, value, offset, false, noAssert)
5690
}
5691
5692
function writeDouble (buf, value, offset, littleEndian, noAssert) {
5693
  if (!noAssert) {
5694
    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
5695
  }
5696
  ieee754.write(buf, value, offset, littleEndian, 52, 8)
5697
  return offset + 8
5698
}
5699
5700
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
5701
  return writeDouble(this, value, offset, true, noAssert)
5702
}
5703
5704
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
5705
  return writeDouble(this, value, offset, false, noAssert)
5706
}
5707
5708
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
5709
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
5710
  if (!start) start = 0
5711
  if (!end && end !== 0) end = this.length
5712
  if (targetStart >= target.length) targetStart = target.length
5713
  if (!targetStart) targetStart = 0
5714
  if (end > 0 && end < start) end = start
5715
5716
  // Copy 0 bytes; we're done
5717
  if (end === start) return 0
5718
  if (target.length === 0 || this.length === 0) return 0
5719
5720
  // Fatal error conditions
5721
  if (targetStart < 0) {
5722
    throw new RangeError('targetStart out of bounds')
5723
  }
5724
  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
5725
  if (end < 0) throw new RangeError('sourceEnd out of bounds')
5726
5727
  // Are we oob?
5728
  if (end > this.length) end = this.length
5729
  if (target.length - targetStart < end - start) {
5730
    end = target.length - targetStart + start
5731
  }
5732
5733
  var len = end - start
5734
5735
  if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
5736
    for (var i = 0; i < len; i++) {
5737
      target[i + targetStart] = this[i + start]
5738
    }
5739
  } else {
5740
    target._set(this.subarray(start, start + len), targetStart)
5741
  }
5742
5743
  return len
5744
}
5745
5746
// fill(value, start=0, end=buffer.length)
5747
Buffer.prototype.fill = function fill (value, start, end) {
5748
  if (!value) value = 0
5749
  if (!start) start = 0
5750
  if (!end) end = this.length
5751
5752
  if (end < start) throw new RangeError('end < start')
5753
5754
  // Fill 0 bytes; we're done
5755
  if (end === start) return
5756
  if (this.length === 0) return
5757
5758
  if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
5759
  if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
5760
5761
  var i
5762
  if (typeof value === 'number') {
5763
    for (i = start; i < end; i++) {
5764
      this[i] = value
5765
    }
5766
  } else {
5767
    var bytes = utf8ToBytes(value.toString())
5768
    var len = bytes.length
5769
    for (i = start; i < end; i++) {
5770
      this[i] = bytes[i % len]
5771
    }
5772
  }
5773
5774
  return this
5775
}
5776
5777
/**
5778
 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
5779
 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
5780
 */
5781
Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
5782
  if (typeof Uint8Array !== 'undefined') {
5783
    if (Buffer.TYPED_ARRAY_SUPPORT) {
5784
      return (new Buffer(this)).buffer
5785
    } else {
5786
      var buf = new Uint8Array(this.length)
5787
      for (var i = 0, len = buf.length; i < len; i += 1) {
5788
        buf[i] = this[i]
5789
      }
5790
      return buf.buffer
5791
    }
5792
  } else {
5793
    throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
5794
  }
5795
}
5796
5797
// HELPER FUNCTIONS
5798
// ================
5799
5800
var BP = Buffer.prototype
5801
5802
/**
5803
 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
5804
 */
5805
Buffer._augment = function _augment (arr) {
5806
  arr.constructor = Buffer
5807
  arr._isBuffer = true
5808
5809
  // save reference to original Uint8Array set method before overwriting
5810
  arr._set = arr.set
5811
5812
  // deprecated, will be removed in node 0.13+
5813
  arr.get = BP.get
5814
  arr.set = BP.set
5815
5816
  arr.write = BP.write
5817
  arr.toString = BP.toString
5818
  arr.toLocaleString = BP.toString
5819
  arr.toJSON = BP.toJSON
5820
  arr.equals = BP.equals
5821
  arr.compare = BP.compare
5822
  arr.indexOf = BP.indexOf
5823
  arr.copy = BP.copy
5824
  arr.slice = BP.slice
5825
  arr.readUIntLE = BP.readUIntLE
5826
  arr.readUIntBE = BP.readUIntBE
5827
  arr.readUInt8 = BP.readUInt8
5828
  arr.readUInt16LE = BP.readUInt16LE
5829
  arr.readUInt16BE = BP.readUInt16BE
5830
  arr.readUInt32LE = BP.readUInt32LE
5831
  arr.readUInt32BE = BP.readUInt32BE
5832
  arr.readIntLE = BP.readIntLE
5833
  arr.readIntBE = BP.readIntBE
5834
  arr.readInt8 = BP.readInt8
5835
  arr.readInt16LE = BP.readInt16LE
5836
  arr.readInt16BE = BP.readInt16BE
5837
  arr.readInt32LE = BP.readInt32LE
5838
  arr.readInt32BE = BP.readInt32BE
5839
  arr.readFloatLE = BP.readFloatLE
5840
  arr.readFloatBE = BP.readFloatBE
5841
  arr.readDoubleLE = BP.readDoubleLE
5842
  arr.readDoubleBE = BP.readDoubleBE
5843
  arr.writeUInt8 = BP.writeUInt8
5844
  arr.writeUIntLE = BP.writeUIntLE
5845
  arr.writeUIntBE = BP.writeUIntBE
5846
  arr.writeUInt16LE = BP.writeUInt16LE
5847
  arr.writeUInt16BE = BP.writeUInt16BE
5848
  arr.writeUInt32LE = BP.writeUInt32LE
5849
  arr.writeUInt32BE = BP.writeUInt32BE
5850
  arr.writeIntLE = BP.writeIntLE
5851
  arr.writeIntBE = BP.writeIntBE
5852
  arr.writeInt8 = BP.writeInt8
5853
  arr.writeInt16LE = BP.writeInt16LE
5854
  arr.writeInt16BE = BP.writeInt16BE
5855
  arr.writeInt32LE = BP.writeInt32LE
5856
  arr.writeInt32BE = BP.writeInt32BE
5857
  arr.writeFloatLE = BP.writeFloatLE
5858
  arr.writeFloatBE = BP.writeFloatBE
5859
  arr.writeDoubleLE = BP.writeDoubleLE
5860
  arr.writeDoubleBE = BP.writeDoubleBE
5861
  arr.fill = BP.fill
5862
  arr.inspect = BP.inspect
5863
  arr.toArrayBuffer = BP.toArrayBuffer
5864
5865
  return arr
5866
}
5867
5868
var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
5869
5870
function base64clean (str) {
5871
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
5872
  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
5873
  // Node converts strings with length < 2 to ''
5874
  if (str.length < 2) return ''
5875
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
5876
  while (str.length % 4 !== 0) {
5877
    str = str + '='
5878
  }
5879
  return str
5880
}
5881
5882
function stringtrim (str) {
5883
  if (str.trim) return str.trim()
5884
  return str.replace(/^\s+|\s+$/g, '')
5885
}
5886
5887
function toHex (n) {
5888
  if (n < 16) return '0' + n.toString(16)
5889
  return n.toString(16)
5890
}
5891
5892
function utf8ToBytes (string, units) {
5893
  units = units || Infinity
5894
  var codePoint
5895
  var length = string.length
5896
  var leadSurrogate = null
5897
  var bytes = []
5898
  var i = 0
5899
5900
  for (; i < length; i++) {
5901
    codePoint = string.charCodeAt(i)
5902
5903
    // is surrogate component
5904
    if (codePoint > 0xD7FF && codePoint < 0xE000) {
5905
      // last char was a lead
5906
      if (leadSurrogate) {
5907
        // 2 leads in a row
5908
        if (codePoint < 0xDC00) {
5909
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5910
          leadSurrogate = codePoint
5911
          continue
5912
        } else {
5913
          // valid surrogate pair
5914
          codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
5915
          leadSurrogate = null
5916
        }
5917
      } else {
5918
        // no lead yet
5919
5920
        if (codePoint > 0xDBFF) {
5921
          // unexpected trail
5922
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5923
          continue
5924
        } else if (i + 1 === length) {
5925
          // unpaired lead
5926
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5927
          continue
5928
        } else {
5929
          // valid lead
5930
          leadSurrogate = codePoint
5931
          continue
5932
        }
5933
      }
5934
    } else if (leadSurrogate) {
5935
      // valid bmp char, but last char was a lead
5936
      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5937
      leadSurrogate = null
5938
    }
5939
5940
    // encode utf8
5941
    if (codePoint < 0x80) {
5942
      if ((units -= 1) < 0) break
5943
      bytes.push(codePoint)
5944
    } else if (codePoint < 0x800) {
5945
      if ((units -= 2) < 0) break
5946
      bytes.push(
5947
        codePoint >> 0x6 | 0xC0,
5948
        codePoint & 0x3F | 0x80
5949
      )
5950
    } else if (codePoint < 0x10000) {
5951
      if ((units -= 3) < 0) break
5952
      bytes.push(
5953
        codePoint >> 0xC | 0xE0,
5954
        codePoint >> 0x6 & 0x3F | 0x80,
5955
        codePoint & 0x3F | 0x80
5956
      )
5957
    } else if (codePoint < 0x200000) {
5958
      if ((units -= 4) < 0) break
5959
      bytes.push(
5960
        codePoint >> 0x12 | 0xF0,
5961
        codePoint >> 0xC & 0x3F | 0x80,
5962
        codePoint >> 0x6 & 0x3F | 0x80,
5963
        codePoint & 0x3F | 0x80
5964
      )
5965
    } else {
5966
      throw new Error('Invalid code point')
5967
    }
5968
  }
5969
5970
  return bytes
5971
}
5972
5973
function asciiToBytes (str) {
5974
  var byteArray = []
5975
  for (var i = 0; i < str.length; i++) {
5976
    // Node's code seems to be doing this and not & 0x7F..
5977
    byteArray.push(str.charCodeAt(i) & 0xFF)
5978
  }
5979
  return byteArray
5980
}
5981
5982
function utf16leToBytes (str, units) {
5983
  var c, hi, lo
5984
  var byteArray = []
5985
  for (var i = 0; i < str.length; i++) {
5986
    if ((units -= 2) < 0) break
5987
5988
    c = str.charCodeAt(i)
5989
    hi = c >> 8
5990
    lo = c % 256
5991
    byteArray.push(lo)
5992
    byteArray.push(hi)
5993
  }
5994
5995
  return byteArray
5996
}
5997
5998
function base64ToBytes (str) {
5999
  return base64.toByteArray(base64clean(str))
6000
}
6001
6002
function blitBuffer (src, dst, offset, length) {
6003
  for (var i = 0; i < length; i++) {
6004
    if ((i + offset >= dst.length) || (i >= src.length)) break
6005
    dst[i + offset] = src[i]
6006
  }
6007
  return i
6008
}
6009
6010
function decodeUtf8Char (str) {
6011
  try {
6012
    return decodeURIComponent(str)
6013
  } catch (err) {
6014
    return String.fromCharCode(0xFFFD) // UTF 8 invalid char
6015
  }
6016
}
6017
6018
},{"base64-js":14,"ieee754":15,"is-array":16}],14:[function(require,module,exports){
6019
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6020
6021
;(function (exports) {
6022
	'use strict';
6023
6024
  var Arr = (typeof Uint8Array !== 'undefined')
6025
    ? Uint8Array
6026
    : Array
6027
6028
	var PLUS   = '+'.charCodeAt(0)
6029
	var SLASH  = '/'.charCodeAt(0)
6030
	var NUMBER = '0'.charCodeAt(0)
6031
	var LOWER  = 'a'.charCodeAt(0)
6032
	var UPPER  = 'A'.charCodeAt(0)
6033
	var PLUS_URL_SAFE = '-'.charCodeAt(0)
6034
	var SLASH_URL_SAFE = '_'.charCodeAt(0)
6035
6036
	function decode (elt) {
6037
		var code = elt.charCodeAt(0)
6038
		if (code === PLUS ||
6039
		    code === PLUS_URL_SAFE)
6040
			return 62 // '+'
6041
		if (code === SLASH ||
6042
		    code === SLASH_URL_SAFE)
6043
			return 63 // '/'
6044
		if (code < NUMBER)
6045
			return -1 //no match
6046
		if (code < NUMBER + 10)
6047
			return code - NUMBER + 26 + 26
6048
		if (code < UPPER + 26)
6049
			return code - UPPER
6050
		if (code < LOWER + 26)
6051
			return code - LOWER + 26
6052
	}
6053
6054
	function b64ToByteArray (b64) {
6055
		var i, j, l, tmp, placeHolders, arr
6056
6057
		if (b64.length % 4 > 0) {
6058
			throw new Error('Invalid string. Length must be a multiple of 4')
6059
		}
6060
6061
		// the number of equal signs (place holders)
6062
		// if there are two placeholders, than the two characters before it
6063
		// represent one byte
6064
		// if there is only one, then the three characters before it represent 2 bytes
6065
		// this is just a cheap hack to not do indexOf twice
6066
		var len = b64.length
6067
		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
6068
6069
		// base64 is 4/3 + up to two characters of the original data
6070
		arr = new Arr(b64.length * 3 / 4 - placeHolders)
6071
6072
		// if there are placeholders, only get up to the last complete 4 chars
6073
		l = placeHolders > 0 ? b64.length - 4 : b64.length
6074
6075
		var L = 0
6076
6077
		function push (v) {
6078
			arr[L++] = v
6079
		}
6080
6081
		for (i = 0, j = 0; i < l; i += 4, j += 3) {
6082
			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
6083
			push((tmp & 0xFF0000) >> 16)
6084
			push((tmp & 0xFF00) >> 8)
6085
			push(tmp & 0xFF)
6086
		}
6087
6088
		if (placeHolders === 2) {
6089
			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
6090
			push(tmp & 0xFF)
6091
		} else if (placeHolders === 1) {
6092
			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
6093
			push((tmp >> 8) & 0xFF)
6094
			push(tmp & 0xFF)
6095
		}
6096
6097
		return arr
6098
	}
6099
6100
	function uint8ToBase64 (uint8) {
6101
		var i,
6102
			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
6103
			output = "",
6104
			temp, length
6105
6106
		function encode (num) {
6107
			return lookup.charAt(num)
6108
		}
6109
6110
		function tripletToBase64 (num) {
6111
			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
6112
		}
6113
6114
		// go through the array every three bytes, we'll deal with trailing stuff later
6115
		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
6116
			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
6117
			output += tripletToBase64(temp)
6118
		}
6119
6120
		// pad the end with zeros, but make sure to not forget the extra bytes
6121
		switch (extraBytes) {
6122
			case 1:
6123
				temp = uint8[uint8.length - 1]
6124
				output += encode(temp >> 2)
6125
				output += encode((temp << 4) & 0x3F)
6126
				output += '=='
6127
				break
6128
			case 2:
6129
				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
6130
				output += encode(temp >> 10)
6131
				output += encode((temp >> 4) & 0x3F)
6132
				output += encode((temp << 2) & 0x3F)
6133
				output += '='
6134
				break
6135
		}
6136
6137
		return output
6138
	}
6139
6140
	exports.toByteArray = b64ToByteArray
6141
	exports.fromByteArray = uint8ToBase64
6142
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
6143
6144
},{}],15:[function(require,module,exports){
6145
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
6146
  var e, m
6147
  var eLen = nBytes * 8 - mLen - 1
6148
  var eMax = (1 << eLen) - 1
6149
  var eBias = eMax >> 1
6150
  var nBits = -7
6151
  var i = isLE ? (nBytes - 1) : 0
6152
  var d = isLE ? -1 : 1
6153
  var s = buffer[offset + i]
6154
6155
  i += d
6156
6157
  e = s & ((1 << (-nBits)) - 1)
6158
  s >>= (-nBits)
6159
  nBits += eLen
6160
  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6161
6162
  m = e & ((1 << (-nBits)) - 1)
6163
  e >>= (-nBits)
6164
  nBits += mLen
6165
  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6166
6167
  if (e === 0) {
6168
    e = 1 - eBias
6169
  } else if (e === eMax) {
6170
    return m ? NaN : ((s ? -1 : 1) * Infinity)
6171
  } else {
6172
    m = m + Math.pow(2, mLen)
6173
    e = e - eBias
6174
  }
6175
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
6176
}
6177
6178
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6179
  var e, m, c
6180
  var eLen = nBytes * 8 - mLen - 1
6181
  var eMax = (1 << eLen) - 1
6182
  var eBias = eMax >> 1
6183
  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
6184
  var i = isLE ? 0 : (nBytes - 1)
6185
  var d = isLE ? 1 : -1
6186
  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
6187
6188
  value = Math.abs(value)
6189
6190
  if (isNaN(value) || value === Infinity) {
6191
    m = isNaN(value) ? 1 : 0
6192
    e = eMax
6193
  } else {
6194
    e = Math.floor(Math.log(value) / Math.LN2)
6195
    if (value * (c = Math.pow(2, -e)) < 1) {
6196
      e--
6197
      c *= 2
6198
    }
6199
    if (e + eBias >= 1) {
6200
      value += rt / c
6201
    } else {
6202
      value += rt * Math.pow(2, 1 - eBias)
6203
    }
6204
    if (value * c >= 2) {
6205
      e++
6206
      c /= 2
6207
    }
6208
6209
    if (e + eBias >= eMax) {
6210
      m = 0
6211
      e = eMax
6212
    } else if (e + eBias >= 1) {
6213
      m = (value * c - 1) * Math.pow(2, mLen)
6214
      e = e + eBias
6215
    } else {
6216
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
6217
      e = 0
6218
    }
6219
  }
6220
6221
  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
6222
6223
  e = (e << mLen) | m
6224
  eLen += mLen
6225
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
6226
6227
  buffer[offset + i - d] |= s * 128
6228
}
6229
6230
},{}],16:[function(require,module,exports){
6231
6232
/**
6233
 * isArray
6234
 */
6235
6236
var isArray = Array.isArray;
6237
6238
/**
6239
 * toString
6240
 */
6241
6242
var str = Object.prototype.toString;
6243
6244
/**
6245
 * Whether or not the given `val`
6246
 * is an array.
6247
 *
6248
 * example:
6249
 *
6250
 *        isArray([]);
6251
 *        // > true
6252
 *        isArray(arguments);
6253
 *        // > false
6254
 *        isArray('');
6255
 *        // > false
6256
 *
6257
 * @param {mixed} val
6258
 * @return {bool}
6259
 */
6260
6261
module.exports = isArray || function (val) {
6262
  return !! val && '[object Array]' == str.call(val);
6263
};
6264
6265
},{}],17:[function(require,module,exports){
6266
// shim for using process in browser
6267
6268
var process = module.exports = {};
6269
var queue = [];
6270
var draining = false;
6271
6272
function drainQueue() {
6273
    if (draining) {
6274
        return;
6275
    }
6276
    draining = true;
6277
    var currentQueue;
6278
    var len = queue.length;
6279
    while(len) {
6280
        currentQueue = queue;
6281
        queue = [];
6282
        var i = -1;
6283
        while (++i < len) {
6284
            currentQueue[i]();
6285
        }
6286
        len = queue.length;
6287
    }
6288
    draining = false;
6289
}
6290
process.nextTick = function (fun) {
6291
    queue.push(fun);
6292
    if (!draining) {
6293
        setTimeout(drainQueue, 0);
6294
    }
6295
};
6296
6297
process.title = 'browser';
6298
process.browser = true;
6299
process.env = {};
6300
process.argv = [];
6301
process.version = ''; // empty string to avoid regexp issues
6302
process.versions = {};
6303
6304
function noop() {}
6305
6306
process.on = noop;
6307
process.addListener = noop;
6308
process.once = noop;
6309
process.off = noop;
6310
process.removeListener = noop;
6311
process.removeAllListeners = noop;
6312
process.emit = noop;
6313
6314
process.binding = function (name) {
6315
    throw new Error('process.binding is not supported');
6316
};
6317
6318
// TODO(shtylman)
6319
process.cwd = function () { return '/' };
6320
process.chdir = function (dir) {
6321
    throw new Error('process.chdir is not supported');
6322
};
6323
process.umask = function() { return 0; };
6324
6325
},{}],18:[function(require,module,exports){
6326
(function (Buffer){
6327
(function () {
6328
  "use strict";
6329
6330
  function btoa(str) {
6331
    var buffer
6332
      ;
6333
6334
    if (str instanceof Buffer) {
6335
      buffer = str;
6336
    } else {
6337
      buffer = new Buffer(str.toString(), 'binary');
6338
    }
6339
6340
    return buffer.toString('base64');
6341
  }
6342
6343
  module.exports = btoa;
6344
}());
6345
6346
}).call(this,require("buffer").Buffer)
6347
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idG9hL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uICgpIHtcbiAgXCJ1c2Ugc3RyaWN0XCI7XG5cbiAgZnVuY3Rpb24gYnRvYShzdHIpIHtcbiAgICB2YXIgYnVmZmVyXG4gICAgICA7XG5cbiAgICBpZiAoc3RyIGluc3RhbmNlb2YgQnVmZmVyKSB7XG4gICAgICBidWZmZXIgPSBzdHI7XG4gICAgfSBlbHNlIHtcbiAgICAgIGJ1ZmZlciA9IG5ldyBCdWZmZXIoc3RyLnRvU3RyaW5nKCksICdiaW5hcnknKTtcbiAgICB9XG5cbiAgICByZXR1cm4gYnVmZmVyLnRvU3RyaW5nKCdiYXNlNjQnKTtcbiAgfVxuXG4gIG1vZHVsZS5leHBvcnRzID0gYnRvYTtcbn0oKSk7XG4iXX0=
6348
},{"buffer":13}],19:[function(require,module,exports){
6349
/* jshint node: true */
6350
(function () {
6351
    "use strict";
6352
6353
    function CookieAccessInfo(domain, path, secure, script) {
6354
        if (this instanceof CookieAccessInfo) {
6355
            this.domain = domain || undefined;
6356
            this.path = path || "/";
6357
            this.secure = !!secure;
6358
            this.script = !!script;
6359
            return this;
6360
        }
6361
        return new CookieAccessInfo(domain, path, secure, script);
6362
    }
6363
    exports.CookieAccessInfo = CookieAccessInfo;
6364
6365
    function Cookie(cookiestr, request_domain, request_path) {
6366
        if (cookiestr instanceof Cookie) {
6367
            return cookiestr;
6368
        }
6369
        if (this instanceof Cookie) {
6370
            this.name = null;
6371
            this.value = null;
6372
            this.expiration_date = Infinity;
6373
            this.path = String(request_path || "/");
6374
            this.explicit_path = false;
6375
            this.domain = request_domain || null;
6376
            this.explicit_domain = false;
6377
            this.secure = false; //how to define default?
6378
            this.noscript = false; //httponly
6379
            if (cookiestr) {
6380
                this.parse(cookiestr, request_domain, request_path);
6381
            }
6382
            return this;
6383
        }
6384
        return new Cookie(cookiestr);
6385
    }
6386
    exports.Cookie = Cookie;
6387
6388
    Cookie.prototype.toString = function toString() {
6389
        var str = [this.name + "=" + this.value];
6390
        if (this.expiration_date !== Infinity) {
6391
            str.push("expires=" + (new Date(this.expiration_date)).toGMTString());
6392
        }
6393
        if (this.domain) {
6394
            str.push("domain=" + this.domain);
6395
        }
6396
        if (this.path) {
6397
            str.push("path=" + this.path);
6398
        }
6399
        if (this.secure) {
6400
            str.push("secure");
6401
        }
6402
        if (this.noscript) {
6403
            str.push("httponly");
6404
        }
6405
        return str.join("; ");
6406
    };
6407
6408
    Cookie.prototype.toValueString = function toValueString() {
6409
        return this.name + "=" + this.value;
6410
    };
6411
6412
    var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
6413
    Cookie.prototype.parse = function parse(str, request_domain, request_path) {
6414
        if (this instanceof Cookie) {
6415
            var parts = str.split(";").filter(function (value) {
6416
                    return !!value;
6417
                }),
6418
                pair = parts[0].match(/([^=]+)=([\s\S]*)/),
6419
                key = pair[1],
6420
                value = pair[2],
6421
                i;
6422
            this.name = key;
6423
            this.value = value;
6424
6425
            for (i = 1; i < parts.length; i += 1) {
6426
                pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/);
6427
                key = pair[1].trim().toLowerCase();
6428
                value = pair[2];
6429
                switch (key) {
6430
                case "httponly":
6431
                    this.noscript = true;
6432
                    break;
6433
                case "expires":
6434
                    this.expiration_date = value ?
6435
                            Number(Date.parse(value)) :
6436
                            Infinity;
6437
                    break;
6438
                case "path":
6439
                    this.path = value ?
6440
                            value.trim() :
6441
                            "";
6442
                    this.explicit_path = true;
6443
                    break;
6444
                case "domain":
6445
                    this.domain = value ?
6446
                            value.trim() :
6447
                            "";
6448
                    this.explicit_domain = !!this.domain;
6449
                    break;
6450
                case "secure":
6451
                    this.secure = true;
6452
                    break;
6453
                }
6454
            }
6455
6456
            if (!this.explicit_path) {
6457
               this.path = request_path || "/";
6458
            }
6459
            if (!this.explicit_domain) {
6460
               this.domain = request_domain;
6461
            }
6462
6463
            return this;
6464
        }
6465
        return new Cookie().parse(str, request_domain, request_path);
6466
    };
6467
6468
    Cookie.prototype.matches = function matches(access_info) {
6469
        if (this.noscript && access_info.script ||
6470
                this.secure && !access_info.secure ||
6471
                !this.collidesWith(access_info)) {
6472
            return false;
6473
        }
6474
        return true;
6475
    };
6476
6477
    Cookie.prototype.collidesWith = function collidesWith(access_info) {
6478
        if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
6479
            return false;
6480
        }
6481
        if (this.path && access_info.path.indexOf(this.path) !== 0) {
6482
            return false;
6483
        }
6484
        if (!this.explicit_path) {
6485
           if (this.path !== access_info.path) {
6486
               return false;
6487
           }
6488
        }
6489
        var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
6490
        var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
6491
        if (cookie_domain === access_domain) {
6492
            return true;
6493
        }
6494
        if (cookie_domain) {
6495
            if (!this.explicit_domain) {
6496
                return false; // we already checked if the domains were exactly the same
6497
            }
6498
            var wildcard = access_domain.indexOf(cookie_domain);
6499
            if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) {
6500
                return false;
6501
            }
6502
            return true;
6503
        }
6504
        return true;
6505
    };
6506
6507
    function CookieJar() {
6508
        var cookies, cookies_list, collidable_cookie;
6509
        if (this instanceof CookieJar) {
6510
            cookies = Object.create(null); //name: [Cookie]
6511
6512
            this.setCookie = function setCookie(cookie, request_domain, request_path) {
6513
                var remove, i;
6514
                cookie = new Cookie(cookie, request_domain, request_path);
6515
                //Delete the cookie if the set is past the current time
6516
                remove = cookie.expiration_date <= Date.now();
6517
                if (cookies[cookie.name] !== undefined) {
6518
                    cookies_list = cookies[cookie.name];
6519
                    for (i = 0; i < cookies_list.length; i += 1) {
6520
                        collidable_cookie = cookies_list[i];
6521
                        if (collidable_cookie.collidesWith(cookie)) {
6522
                            if (remove) {
6523
                                cookies_list.splice(i, 1);
6524
                                if (cookies_list.length === 0) {
6525
                                    delete cookies[cookie.name];
6526
                                }
6527
                                return false;
6528
                            }
6529
                            cookies_list[i] = cookie;
6530
                            return cookie;
6531
                        }
6532
                    }
6533
                    if (remove) {
6534
                        return false;
6535
                    }
6536
                    cookies_list.push(cookie);
6537
                    return cookie;
6538
                }
6539
                if (remove) {
6540
                    return false;
6541
                }
6542
                cookies[cookie.name] = [cookie];
6543
                return cookies[cookie.name];
6544
            };
6545
            //returns a cookie
6546
            this.getCookie = function getCookie(cookie_name, access_info) {
6547
                var cookie, i;
6548
                cookies_list = cookies[cookie_name];
6549
                if (!cookies_list) {
6550
                    return;
6551
                }
6552
                for (i = 0; i < cookies_list.length; i += 1) {
6553
                    cookie = cookies_list[i];
6554
                    if (cookie.expiration_date <= Date.now()) {
6555
                        if (cookies_list.length === 0) {
6556
                            delete cookies[cookie.name];
6557
                        }
6558
                        continue;
6559
                    }
6560
                    if (cookie.matches(access_info)) {
6561
                        return cookie;
6562
                    }
6563
                }
6564
            };
6565
            //returns a list of cookies
6566
            this.getCookies = function getCookies(access_info) {
6567
                var matches = [], cookie_name, cookie;
6568
                for (cookie_name in cookies) {
6569
                    cookie = this.getCookie(cookie_name, access_info);
6570
                    if (cookie) {
6571
                        matches.push(cookie);
6572
                    }
6573
                }
6574
                matches.toString = function toString() {
6575
                    return matches.join(":");
6576
                };
6577
                matches.toValueString = function toValueString() {
6578
                    return matches.map(function (c) {
6579
                        return c.toValueString();
6580
                    }).join(';');
6581
                };
6582
                return matches;
6583
            };
6584
6585
            return this;
6586
        }
6587
        return new CookieJar();
6588
    }
6589
    exports.CookieJar = CookieJar;
6590
6591
    //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned.
6592
    CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) {
6593
        cookies = Array.isArray(cookies) ?
6594
                cookies :
6595
                cookies.split(cookie_str_splitter);
6596
        var successful = [],
6597
            i,
6598
            cookie;
6599
        cookies = cookies.map(Cookie);
6600
        for (i = 0; i < cookies.length; i += 1) {
6601
            cookie = cookies[i];
6602
            if (this.setCookie(cookie, request_domain, request_path)) {
6603
                successful.push(cookie);
6604
            }
6605
        }
6606
        return successful;
6607
    };
6608
}());
6609
6610
},{}],20:[function(require,module,exports){
6611
/*!
6612
 * jQuery JavaScript Library v2.1.4
6613
 * http://jquery.com/
6614
 *
6615
 * Includes Sizzle.js
6616
 * http://sizzlejs.com/
6617
 *
6618
 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
6619
 * Released under the MIT license
6620
 * http://jquery.org/license
6621
 *
6622
 * Date: 2015-04-28T16:01Z
6623
 */
6624
6625
(function( global, factory ) {
6626
6627
	if ( typeof module === "object" && typeof module.exports === "object" ) {
6628
		// For CommonJS and CommonJS-like environments where a proper `window`
6629
		// is present, execute the factory and get jQuery.
6630
		// For environments that do not have a `window` with a `document`
6631
		// (such as Node.js), expose a factory as module.exports.
6632
		// This accentuates the need for the creation of a real `window`.
6633
		// e.g. var jQuery = require("jquery")(window);
6634
		// See ticket #14549 for more info.
6635
		module.exports = global.document ?
6636
			factory( global, true ) :
6637
			function( w ) {
6638
				if ( !w.document ) {
6639
					throw new Error( "jQuery requires a window with a document" );
6640
				}
6641
				return factory( w );
6642
			};
6643
	} else {
6644
		factory( global );
6645
	}
6646
6647
// Pass this if window is not defined yet
6648
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
6649
6650
// Support: Firefox 18+
6651
// Can't be in strict mode, several libs including ASP.NET trace
6652
// the stack via arguments.caller.callee and Firefox dies if
6653
// you try to trace through "use strict" call chains. (#13335)
6654
//
6655
6656
var arr = [];
6657
6658
var slice = arr.slice;
6659
6660
var concat = arr.concat;
6661
6662
var push = arr.push;
6663
6664
var indexOf = arr.indexOf;
6665
6666
var class2type = {};
6667
6668
var toString = class2type.toString;
6669
6670
var hasOwn = class2type.hasOwnProperty;
6671
6672
var support = {};
6673
6674
6675
6676
var
6677
	// Use the correct document accordingly with window argument (sandbox)
6678
	document = window.document,
6679
6680
	version = "2.1.4",
6681
6682
	// Define a local copy of jQuery
6683
	jQuery = function( selector, context ) {
6684
		// The jQuery object is actually just the init constructor 'enhanced'
6685
		// Need init if jQuery is called (just allow error to be thrown if not included)
6686
		return new jQuery.fn.init( selector, context );
6687
	},
6688
6689
	// Support: Android<4.1
6690
	// Make sure we trim BOM and NBSP
6691
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
6692
6693
	// Matches dashed string for camelizing
6694
	rmsPrefix = /^-ms-/,
6695
	rdashAlpha = /-([\da-z])/gi,
6696
6697
	// Used by jQuery.camelCase as callback to replace()
6698
	fcamelCase = function( all, letter ) {
6699
		return letter.toUpperCase();
6700
	};
6701
6702
jQuery.fn = jQuery.prototype = {
6703
	// The current version of jQuery being used
6704
	jquery: version,
6705
6706
	constructor: jQuery,
6707
6708
	// Start with an empty selector
6709
	selector: "",
6710
6711
	// The default length of a jQuery object is 0
6712
	length: 0,
6713
6714
	toArray: function() {
6715
		return slice.call( this );
6716
	},
6717
6718
	// Get the Nth element in the matched element set OR
6719
	// Get the whole matched element set as a clean array
6720
	get: function( num ) {
6721
		return num != null ?
6722
6723
			// Return just the one element from the set
6724
			( num < 0 ? this[ num + this.length ] : this[ num ] ) :
6725
6726
			// Return all the elements in a clean array
6727
			slice.call( this );
6728
	},
6729
6730
	// Take an array of elements and push it onto the stack
6731
	// (returning the new matched element set)
6732
	pushStack: function( elems ) {
6733
6734
		// Build a new jQuery matched element set
6735
		var ret = jQuery.merge( this.constructor(), elems );
6736
6737
		// Add the old object onto the stack (as a reference)
6738
		ret.prevObject = this;
6739
		ret.context = this.context;
6740
6741
		// Return the newly-formed element set
6742
		return ret;
6743
	},
6744
6745
	// Execute a callback for every element in the matched set.
6746
	// (You can seed the arguments with an array of args, but this is
6747
	// only used internally.)
6748
	each: function( callback, args ) {
6749
		return jQuery.each( this, callback, args );
6750
	},
6751
6752
	map: function( callback ) {
6753
		return this.pushStack( jQuery.map(this, function( elem, i ) {
6754
			return callback.call( elem, i, elem );
6755
		}));
6756
	},
6757
6758
	slice: function() {
6759
		return this.pushStack( slice.apply( this, arguments ) );
6760
	},
6761
6762
	first: function() {
6763
		return this.eq( 0 );
6764
	},
6765
6766
	last: function() {
6767
		return this.eq( -1 );
6768
	},
6769
6770
	eq: function( i ) {
6771
		var len = this.length,
6772
			j = +i + ( i < 0 ? len : 0 );
6773
		return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
6774
	},
6775
6776
	end: function() {
6777
		return this.prevObject || this.constructor(null);
6778
	},
6779
6780
	// For internal use only.
6781
	// Behaves like an Array's method, not like a jQuery method.
6782
	push: push,
6783
	sort: arr.sort,
6784
	splice: arr.splice
6785
};
6786
6787
jQuery.extend = jQuery.fn.extend = function() {
6788
	var options, name, src, copy, copyIsArray, clone,
6789
		target = arguments[0] || {},
6790
		i = 1,
6791
		length = arguments.length,
6792
		deep = false;
6793
6794
	// Handle a deep copy situation
6795
	if ( typeof target === "boolean" ) {
6796
		deep = target;
6797
6798
		// Skip the boolean and the target
6799
		target = arguments[ i ] || {};
6800
		i++;
6801
	}
6802
6803
	// Handle case when target is a string or something (possible in deep copy)
6804
	if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
6805
		target = {};
6806
	}
6807
6808
	// Extend jQuery itself if only one argument is passed
6809
	if ( i === length ) {
6810
		target = this;
6811
		i--;
6812
	}
6813
6814
	for ( ; i < length; i++ ) {
6815
		// Only deal with non-null/undefined values
6816
		if ( (options = arguments[ i ]) != null ) {
6817
			// Extend the base object
6818
			for ( name in options ) {
6819
				src = target[ name ];
6820
				copy = options[ name ];
6821
6822
				// Prevent never-ending loop
6823
				if ( target === copy ) {
6824
					continue;
6825
				}
6826
6827
				// Recurse if we're merging plain objects or arrays
6828
				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
6829
					if ( copyIsArray ) {
6830
						copyIsArray = false;
6831
						clone = src && jQuery.isArray(src) ? src : [];
6832
6833
					} else {
6834
						clone = src && jQuery.isPlainObject(src) ? src : {};
6835
					}
6836
6837
					// Never move original objects, clone them
6838
					target[ name ] = jQuery.extend( deep, clone, copy );
6839
6840
				// Don't bring in undefined values
6841
				} else if ( copy !== undefined ) {
6842
					target[ name ] = copy;
6843
				}
6844
			}
6845
		}
6846
	}
6847
6848
	// Return the modified object
6849
	return target;
6850
};
6851
6852
jQuery.extend({
6853
	// Unique for each copy of jQuery on the page
6854
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
6855
6856
	// Assume jQuery is ready without the ready module
6857
	isReady: true,
6858
6859
	error: function( msg ) {
6860
		throw new Error( msg );
6861
	},
6862
6863
	noop: function() {},
6864
6865
	isFunction: function( obj ) {
6866
		return jQuery.type(obj) === "function";
6867
	},
6868
6869
	isArray: Array.isArray,
6870
6871
	isWindow: function( obj ) {
6872
		return obj != null && obj === obj.window;
6873
	},
6874
6875
	isNumeric: function( obj ) {
6876
		// parseFloat NaNs numeric-cast false positives (null|true|false|"")
6877
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
6878
		// subtraction forces infinities to NaN
6879
		// adding 1 corrects loss of precision from parseFloat (#15100)
6880
		return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
6881
	},
6882
6883
	isPlainObject: function( obj ) {
6884
		// Not plain objects:
6885
		// - Any object or value whose internal [[Class]] property is not "[object Object]"
6886
		// - DOM nodes
6887
		// - window
6888
		if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
6889
			return false;
6890
		}
6891
6892
		if ( obj.constructor &&
6893
				!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
6894
			return false;
6895
		}
6896
6897
		// If the function hasn't returned already, we're confident that
6898
		// |obj| is a plain object, created by {} or constructed with new Object
6899
		return true;
6900
	},
6901
6902
	isEmptyObject: function( obj ) {
6903
		var name;
6904
		for ( name in obj ) {
6905
			return false;
6906
		}
6907
		return true;
6908
	},
6909
6910
	type: function( obj ) {
6911
		if ( obj == null ) {
6912
			return obj + "";
6913
		}
6914
		// Support: Android<4.0, iOS<6 (functionish RegExp)
6915
		return typeof obj === "object" || typeof obj === "function" ?
6916
			class2type[ toString.call(obj) ] || "object" :
6917
			typeof obj;
6918
	},
6919
6920
	// Evaluates a script in a global context
6921
	globalEval: function( code ) {
6922
		var script,
6923
			indirect = eval;
6924
6925
		code = jQuery.trim( code );
6926
6927
		if ( code ) {
6928
			// If the code includes a valid, prologue position
6929
			// strict mode pragma, execute code by injecting a
6930
			// script tag into the document.
6931
			if ( code.indexOf("use strict") === 1 ) {
6932
				script = document.createElement("script");
6933
				script.text = code;
6934
				document.head.appendChild( script ).parentNode.removeChild( script );
6935
			} else {
6936
			// Otherwise, avoid the DOM node creation, insertion
6937
			// and removal by using an indirect global eval
6938
				indirect( code );
6939
			}
6940
		}
6941
	},
6942
6943
	// Convert dashed to camelCase; used by the css and data modules
6944
	// Support: IE9-11+
6945
	// Microsoft forgot to hump their vendor prefix (#9572)
6946
	camelCase: function( string ) {
6947
		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
6948
	},
6949
6950
	nodeName: function( elem, name ) {
6951
		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
6952
	},
6953
6954
	// args is for internal usage only
6955
	each: function( obj, callback, args ) {
6956
		var value,
6957
			i = 0,
6958
			length = obj.length,
6959
			isArray = isArraylike( obj );
6960
6961
		if ( args ) {
6962
			if ( isArray ) {
6963
				for ( ; i < length; i++ ) {
6964
					value = callback.apply( obj[ i ], args );
6965
6966
					if ( value === false ) {
6967
						break;
6968
					}
6969
				}
6970
			} else {
6971
				for ( i in obj ) {
6972
					value = callback.apply( obj[ i ], args );
6973
6974
					if ( value === false ) {
6975
						break;
6976
					}
6977
				}
6978
			}
6979
6980
		// A special, fast, case for the most common use of each
6981
		} else {
6982
			if ( isArray ) {
6983
				for ( ; i < length; i++ ) {
6984
					value = callback.call( obj[ i ], i, obj[ i ] );
6985
6986
					if ( value === false ) {
6987
						break;
6988
					}
6989
				}
6990
			} else {
6991
				for ( i in obj ) {
6992
					value = callback.call( obj[ i ], i, obj[ i ] );
6993
6994
					if ( value === false ) {
6995
						break;
6996
					}
6997
				}
6998
			}
6999
		}
7000
7001
		return obj;
7002
	},
7003
7004
	// Support: Android<4.1
7005
	trim: function( text ) {
7006
		return text == null ?
7007
			"" :
7008
			( text + "" ).replace( rtrim, "" );
7009
	},
7010
7011
	// results is for internal usage only
7012
	makeArray: function( arr, results ) {
7013
		var ret = results || [];
7014
7015
		if ( arr != null ) {
7016
			if ( isArraylike( Object(arr) ) ) {
7017
				jQuery.merge( ret,
7018
					typeof arr === "string" ?
7019
					[ arr ] : arr
7020
				);
7021
			} else {
7022
				push.call( ret, arr );
7023
			}
7024
		}
7025
7026
		return ret;
7027
	},
7028
7029
	inArray: function( elem, arr, i ) {
7030
		return arr == null ? -1 : indexOf.call( arr, elem, i );
7031
	},
7032
7033
	merge: function( first, second ) {
7034
		var len = +second.length,
7035
			j = 0,
7036
			i = first.length;
7037
7038
		for ( ; j < len; j++ ) {
7039
			first[ i++ ] = second[ j ];
7040
		}
7041
7042
		first.length = i;
7043
7044
		return first;
7045
	},
7046
7047
	grep: function( elems, callback, invert ) {
7048
		var callbackInverse,
7049
			matches = [],
7050
			i = 0,
7051
			length = elems.length,
7052
			callbackExpect = !invert;
7053
7054
		// Go through the array, only saving the items
7055
		// that pass the validator function
7056
		for ( ; i < length; i++ ) {
7057
			callbackInverse = !callback( elems[ i ], i );
7058
			if ( callbackInverse !== callbackExpect ) {
7059
				matches.push( elems[ i ] );
7060
			}
7061
		}
7062
7063
		return matches;
7064
	},
7065
7066
	// arg is for internal usage only
7067
	map: function( elems, callback, arg ) {
7068
		var value,
7069
			i = 0,
7070
			length = elems.length,
7071
			isArray = isArraylike( elems ),
7072
			ret = [];
7073
7074
		// Go through the array, translating each of the items to their new values
7075
		if ( isArray ) {
7076
			for ( ; i < length; i++ ) {
7077
				value = callback( elems[ i ], i, arg );
7078
7079
				if ( value != null ) {
7080
					ret.push( value );
7081
				}
7082
			}
7083
7084
		// Go through every key on the object,
7085
		} else {
7086
			for ( i in elems ) {
7087
				value = callback( elems[ i ], i, arg );
7088
7089
				if ( value != null ) {
7090
					ret.push( value );
7091
				}
7092
			}
7093
		}
7094
7095
		// Flatten any nested arrays
7096
		return concat.apply( [], ret );
7097
	},
7098
7099
	// A global GUID counter for objects
7100
	guid: 1,
7101
7102
	// Bind a function to a context, optionally partially applying any
7103
	// arguments.
7104
	proxy: function( fn, context ) {
7105
		var tmp, args, proxy;
7106
7107
		if ( typeof context === "string" ) {
7108
			tmp = fn[ context ];
7109
			context = fn;
7110
			fn = tmp;
7111
		}
7112
7113
		// Quick check to determine if target is callable, in the spec
7114
		// this throws a TypeError, but we will just return undefined.
7115
		if ( !jQuery.isFunction( fn ) ) {
7116
			return undefined;
7117
		}
7118
7119
		// Simulated bind
7120
		args = slice.call( arguments, 2 );
7121
		proxy = function() {
7122
			return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
7123
		};
7124
7125
		// Set the guid of unique handler to the same of original handler, so it can be removed
7126
		proxy.guid = fn.guid = fn.guid || jQuery.guid++;
7127
7128
		return proxy;
7129
	},
7130
7131
	now: Date.now,
7132
7133
	// jQuery.support is not used in Core but other projects attach their
7134
	// properties to it so it needs to exist.
7135
	support: support
7136
});
7137
7138
// Populate the class2type map
7139
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
7140
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
7141
});
7142
7143
function isArraylike( obj ) {
7144
7145
	// Support: iOS 8.2 (not reproducible in simulator)
7146
	// `in` check used to prevent JIT error (gh-2145)
7147
	// hasOwn isn't used here due to false negatives
7148
	// regarding Nodelist length in IE
7149
	var length = "length" in obj && obj.length,
7150
		type = jQuery.type( obj );
7151
7152
	if ( type === "function" || jQuery.isWindow( obj ) ) {
7153
		return false;
7154
	}
7155
7156
	if ( obj.nodeType === 1 && length ) {
7157
		return true;
7158
	}
7159
7160
	return type === "array" || length === 0 ||
7161
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
7162
}
7163
var Sizzle =
7164
/*!
7165
 * Sizzle CSS Selector Engine v2.2.0-pre
7166
 * http://sizzlejs.com/
7167
 *
7168
 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
7169
 * Released under the MIT license
7170
 * http://jquery.org/license
7171
 *
7172
 * Date: 2014-12-16
7173
 */
7174
(function( window ) {
7175
7176
var i,
7177
	support,
7178
	Expr,
7179
	getText,
7180
	isXML,
7181
	tokenize,
7182
	compile,
7183
	select,
7184
	outermostContext,
7185
	sortInput,
7186
	hasDuplicate,
7187
7188
	// Local document vars
7189
	setDocument,
7190
	document,
7191
	docElem,
7192
	documentIsHTML,
7193
	rbuggyQSA,
7194
	rbuggyMatches,
7195
	matches,
7196
	contains,
7197
7198
	// Instance-specific data
7199
	expando = "sizzle" + 1 * new Date(),
7200
	preferredDoc = window.document,
7201
	dirruns = 0,
7202
	done = 0,
7203
	classCache = createCache(),
7204
	tokenCache = createCache(),
7205
	compilerCache = createCache(),
7206
	sortOrder = function( a, b ) {
7207
		if ( a === b ) {
7208
			hasDuplicate = true;
7209
		}
7210
		return 0;
7211
	},
7212
7213
	// General-purpose constants
7214
	MAX_NEGATIVE = 1 << 31,
7215
7216
	// Instance methods
7217
	hasOwn = ({}).hasOwnProperty,
7218
	arr = [],
7219
	pop = arr.pop,
7220
	push_native = arr.push,
7221
	push = arr.push,
7222
	slice = arr.slice,
7223
	// Use a stripped-down indexOf as it's faster than native
7224
	// http://jsperf.com/thor-indexof-vs-for/5
7225
	indexOf = function( list, elem ) {
7226
		var i = 0,
7227
			len = list.length;
7228
		for ( ; i < len; i++ ) {
7229
			if ( list[i] === elem ) {
7230
				return i;
7231
			}
7232
		}
7233
		return -1;
7234
	},
7235
7236
	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
7237
7238
	// Regular expressions
7239
7240
	// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
7241
	whitespace = "[\\x20\\t\\r\\n\\f]",
7242
	// http://www.w3.org/TR/css3-syntax/#characters
7243
	characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
7244
7245
	// Loosely modeled on CSS identifier characters
7246
	// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
7247
	// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
7248
	identifier = characterEncoding.replace( "w", "w#" ),
7249
7250
	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
7251
	attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
7252
		// Operator (capture 2)
7253
		"*([*^$|!~]?=)" + whitespace +
7254
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
7255
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
7256
		"*\\]",
7257
7258
	pseudos = ":(" + characterEncoding + ")(?:\\((" +
7259
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
7260
		// 1. quoted (capture 3; capture 4 or capture 5)
7261
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
7262
		// 2. simple (capture 6)
7263
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
7264
		// 3. anything else (capture 2)
7265
		".*" +
7266
		")\\)|)",
7267
7268
	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
7269
	rwhitespace = new RegExp( whitespace + "+", "g" ),
7270
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
7271
7272
	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
7273
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
7274
7275
	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
7276
7277
	rpseudo = new RegExp( pseudos ),
7278
	ridentifier = new RegExp( "^" + identifier + "$" ),
7279
7280
	matchExpr = {
7281
		"ID": new RegExp( "^#(" + characterEncoding + ")" ),
7282
		"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
7283
		"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
7284
		"ATTR": new RegExp( "^" + attributes ),
7285
		"PSEUDO": new RegExp( "^" + pseudos ),
7286
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
7287
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
7288
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
7289
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
7290
		// For use in libraries implementing .is()
7291
		// We use this for POS matching in `select`
7292
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
7293
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
7294
	},
7295
7296
	rinputs = /^(?:input|select|textarea|button)$/i,
7297
	rheader = /^h\d$/i,
7298
7299
	rnative = /^[^{]+\{\s*\[native \w/,
7300
7301
	// Easily-parseable/retrievable ID or TAG or CLASS selectors
7302
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
7303
7304
	rsibling = /[+~]/,
7305
	rescape = /'|\\/g,
7306
7307
	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
7308
	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
7309
	funescape = function( _, escaped, escapedWhitespace ) {
7310
		var high = "0x" + escaped - 0x10000;
7311
		// NaN means non-codepoint
7312
		// Support: Firefox<24
7313
		// Workaround erroneous numeric interpretation of +"0x"
7314
		return high !== high || escapedWhitespace ?
7315
			escaped :
7316
			high < 0 ?
7317
				// BMP codepoint
7318
				String.fromCharCode( high + 0x10000 ) :
7319
				// Supplemental Plane codepoint (surrogate pair)
7320
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
7321
	},
7322
7323
	// Used for iframes
7324
	// See setDocument()
7325
	// Removing the function wrapper causes a "Permission Denied"
7326
	// error in IE
7327
	unloadHandler = function() {
7328
		setDocument();
7329
	};
7330
7331
// Optimize for push.apply( _, NodeList )
7332
try {
7333
	push.apply(
7334
		(arr = slice.call( preferredDoc.childNodes )),
7335
		preferredDoc.childNodes
7336
	);
7337
	// Support: Android<4.0
7338
	// Detect silently failing push.apply
7339
	arr[ preferredDoc.childNodes.length ].nodeType;
7340
} catch ( e ) {
7341
	push = { apply: arr.length ?
7342
7343
		// Leverage slice if possible
7344
		function( target, els ) {
7345
			push_native.apply( target, slice.call(els) );
7346
		} :
7347
7348
		// Support: IE<9
7349
		// Otherwise append directly
7350
		function( target, els ) {
7351
			var j = target.length,
7352
				i = 0;
7353
			// Can't trust NodeList.length
7354
			while ( (target[j++] = els[i++]) ) {}
7355
			target.length = j - 1;
7356
		}
7357
	};
7358
}
7359
7360
function Sizzle( selector, context, results, seed ) {
7361
	var match, elem, m, nodeType,
7362
		// QSA vars
7363
		i, groups, old, nid, newContext, newSelector;
7364
7365
	if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
7366
		setDocument( context );
7367
	}
7368
7369
	context = context || document;
7370
	results = results || [];
7371
	nodeType = context.nodeType;
7372
7373
	if ( typeof selector !== "string" || !selector ||
7374
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
7375
7376
		return results;
7377
	}
7378
7379
	if ( !seed && documentIsHTML ) {
7380
7381
		// Try to shortcut find operations when possible (e.g., not under DocumentFragment)
7382
		if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
7383
			// Speed-up: Sizzle("#ID")
7384
			if ( (m = match[1]) ) {
7385
				if ( nodeType === 9 ) {
7386
					elem = context.getElementById( m );
7387
					// Check parentNode to catch when Blackberry 4.6 returns
7388
					// nodes that are no longer in the document (jQuery #6963)
7389
					if ( elem && elem.parentNode ) {
7390
						// Handle the case where IE, Opera, and Webkit return items
7391
						// by name instead of ID
7392
						if ( elem.id === m ) {
7393
							results.push( elem );
7394
							return results;
7395
						}
7396
					} else {
7397
						return results;
7398
					}
7399
				} else {
7400
					// Context is not a document
7401
					if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
7402
						contains( context, elem ) && elem.id === m ) {
7403
						results.push( elem );
7404
						return results;
7405
					}
7406
				}
7407
7408
			// Speed-up: Sizzle("TAG")
7409
			} else if ( match[2] ) {
7410
				push.apply( results, context.getElementsByTagName( selector ) );
7411
				return results;
7412
7413
			// Speed-up: Sizzle(".CLASS")
7414
			} else if ( (m = match[3]) && support.getElementsByClassName ) {
7415
				push.apply( results, context.getElementsByClassName( m ) );
7416
				return results;
7417
			}
7418
		}
7419
7420
		// QSA path
7421
		if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
7422
			nid = old = expando;
7423
			newContext = context;
7424
			newSelector = nodeType !== 1 && selector;
7425
7426
			// qSA works strangely on Element-rooted queries
7427
			// We can work around this by specifying an extra ID on the root
7428
			// and working up from there (Thanks to Andrew Dupont for the technique)
7429
			// IE 8 doesn't work on object elements
7430
			if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
7431
				groups = tokenize( selector );
7432
7433
				if ( (old = context.getAttribute("id")) ) {
7434
					nid = old.replace( rescape, "\\$&" );
7435
				} else {
7436
					context.setAttribute( "id", nid );
7437
				}
7438
				nid = "[id='" + nid + "'] ";
7439
7440
				i = groups.length;
7441
				while ( i-- ) {
7442
					groups[i] = nid + toSelector( groups[i] );
7443
				}
7444
				newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
7445
				newSelector = groups.join(",");
7446
			}
7447
7448
			if ( newSelector ) {
7449
				try {
7450
					push.apply( results,
7451
						newContext.querySelectorAll( newSelector )
7452
					);
7453
					return results;
7454
				} catch(qsaError) {
7455
				} finally {
7456
					if ( !old ) {
7457
						context.removeAttribute("id");
7458
					}
7459
				}
7460
			}
7461
		}
7462
	}
7463
7464
	// All others
7465
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
7466
}
7467
7468
/**
7469
 * Create key-value caches of limited size
7470
 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
7471
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
7472
 *	deleting the oldest entry
7473
 */
7474
function createCache() {
7475
	var keys = [];
7476
7477
	function cache( key, value ) {
7478
		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
7479
		if ( keys.push( key + " " ) > Expr.cacheLength ) {
7480
			// Only keep the most recent entries
7481
			delete cache[ keys.shift() ];
7482
		}
7483
		return (cache[ key + " " ] = value);
7484
	}
7485
	return cache;
7486
}
7487
7488
/**
7489
 * Mark a function for special use by Sizzle
7490
 * @param {Function} fn The function to mark
7491
 */
7492
function markFunction( fn ) {
7493
	fn[ expando ] = true;
7494
	return fn;
7495
}
7496
7497
/**
7498
 * Support testing using an element
7499
 * @param {Function} fn Passed the created div and expects a boolean result
7500
 */
7501
function assert( fn ) {
7502
	var div = document.createElement("div");
7503
7504
	try {
7505
		return !!fn( div );
7506
	} catch (e) {
7507
		return false;
7508
	} finally {
7509
		// Remove from its parent by default
7510
		if ( div.parentNode ) {
7511
			div.parentNode.removeChild( div );
7512
		}
7513
		// release memory in IE
7514
		div = null;
7515
	}
7516
}
7517
7518
/**
7519
 * Adds the same handler for all of the specified attrs
7520
 * @param {String} attrs Pipe-separated list of attributes
7521
 * @param {Function} handler The method that will be applied
7522
 */
7523
function addHandle( attrs, handler ) {
7524
	var arr = attrs.split("|"),
7525
		i = attrs.length;
7526
7527
	while ( i-- ) {
7528
		Expr.attrHandle[ arr[i] ] = handler;
7529
	}
7530
}
7531
7532
/**
7533
 * Checks document order of two siblings
7534
 * @param {Element} a
7535
 * @param {Element} b
7536
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
7537
 */
7538
function siblingCheck( a, b ) {
7539
	var cur = b && a,
7540
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
7541
			( ~b.sourceIndex || MAX_NEGATIVE ) -
7542
			( ~a.sourceIndex || MAX_NEGATIVE );
7543
7544
	// Use IE sourceIndex if available on both nodes
7545
	if ( diff ) {
7546
		return diff;
7547
	}
7548
7549
	// Check if b follows a
7550
	if ( cur ) {
7551
		while ( (cur = cur.nextSibling) ) {
7552
			if ( cur === b ) {
7553
				return -1;
7554
			}
7555
		}
7556
	}
7557
7558
	return a ? 1 : -1;
7559
}
7560
7561
/**
7562
 * Returns a function to use in pseudos for input types
7563
 * @param {String} type
7564
 */
7565
function createInputPseudo( type ) {
7566
	return function( elem ) {
7567
		var name = elem.nodeName.toLowerCase();
7568
		return name === "input" && elem.type === type;
7569
	};
7570
}
7571
7572
/**
7573
 * Returns a function to use in pseudos for buttons
7574
 * @param {String} type
7575
 */
7576
function createButtonPseudo( type ) {
7577
	return function( elem ) {
7578
		var name = elem.nodeName.toLowerCase();
7579
		return (name === "input" || name === "button") && elem.type === type;
7580
	};
7581
}
7582
7583
/**
7584
 * Returns a function to use in pseudos for positionals
7585
 * @param {Function} fn
7586
 */
7587
function createPositionalPseudo( fn ) {
7588
	return markFunction(function( argument ) {
7589
		argument = +argument;
7590
		return markFunction(function( seed, matches ) {
7591
			var j,
7592
				matchIndexes = fn( [], seed.length, argument ),
7593
				i = matchIndexes.length;
7594
7595
			// Match elements found at the specified indexes
7596
			while ( i-- ) {
7597
				if ( seed[ (j = matchIndexes[i]) ] ) {
7598
					seed[j] = !(matches[j] = seed[j]);
7599
				}
7600
			}
7601
		});
7602
	});
7603
}
7604
7605
/**
7606
 * Checks a node for validity as a Sizzle context
7607
 * @param {Element|Object=} context
7608
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
7609
 */
7610
function testContext( context ) {
7611
	return context && typeof context.getElementsByTagName !== "undefined" && context;
7612
}
7613
7614
// Expose support vars for convenience
7615
support = Sizzle.support = {};
7616
7617
/**
7618
 * Detects XML nodes
7619
 * @param {Element|Object} elem An element or a document
7620
 * @returns {Boolean} True iff elem is a non-HTML XML node
7621
 */
7622
isXML = Sizzle.isXML = function( elem ) {
7623
	// documentElement is verified for cases where it doesn't yet exist
7624
	// (such as loading iframes in IE - #4833)
7625
	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
7626
	return documentElement ? documentElement.nodeName !== "HTML" : false;
7627
};
7628
7629
/**
7630
 * Sets document-related variables once based on the current document
7631
 * @param {Element|Object} [doc] An element or document object to use to set the document
7632
 * @returns {Object} Returns the current document
7633
 */
7634
setDocument = Sizzle.setDocument = function( node ) {
7635
	var hasCompare, parent,
7636
		doc = node ? node.ownerDocument || node : preferredDoc;
7637
7638
	// If no document and documentElement is available, return
7639
	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
7640
		return document;
7641
	}
7642
7643
	// Set our document
7644
	document = doc;
7645
	docElem = doc.documentElement;
7646
	parent = doc.defaultView;
7647
7648
	// Support: IE>8
7649
	// If iframe document is assigned to "document" variable and if iframe has been reloaded,
7650
	// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
7651
	// IE6-8 do not support the defaultView property so parent will be undefined
7652
	if ( parent && parent !== parent.top ) {
7653
		// IE11 does not have attachEvent, so all must suffer
7654
		if ( parent.addEventListener ) {
7655
			parent.addEventListener( "unload", unloadHandler, false );
7656
		} else if ( parent.attachEvent ) {
7657
			parent.attachEvent( "onunload", unloadHandler );
7658
		}
7659
	}
7660
7661
	/* Support tests
7662
	---------------------------------------------------------------------- */
7663
	documentIsHTML = !isXML( doc );
7664
7665
	/* Attributes
7666
	---------------------------------------------------------------------- */
7667
7668
	// Support: IE<8
7669
	// Verify that getAttribute really returns attributes and not properties
7670
	// (excepting IE8 booleans)
7671
	support.attributes = assert(function( div ) {
7672
		div.className = "i";
7673
		return !div.getAttribute("className");
7674
	});
7675
7676
	/* getElement(s)By*
7677
	---------------------------------------------------------------------- */
7678
7679
	// Check if getElementsByTagName("*") returns only elements
7680
	support.getElementsByTagName = assert(function( div ) {
7681
		div.appendChild( doc.createComment("") );
7682
		return !div.getElementsByTagName("*").length;
7683
	});
7684
7685
	// Support: IE<9
7686
	support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
7687
7688
	// Support: IE<10
7689
	// Check if getElementById returns elements by name
7690
	// The broken getElementById methods don't pick up programatically-set names,
7691
	// so use a roundabout getElementsByName test
7692
	support.getById = assert(function( div ) {
7693
		docElem.appendChild( div ).id = expando;
7694
		return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
7695
	});
7696
7697
	// ID find and filter
7698
	if ( support.getById ) {
7699
		Expr.find["ID"] = function( id, context ) {
7700
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
7701
				var m = context.getElementById( id );
7702
				// Check parentNode to catch when Blackberry 4.6 returns
7703
				// nodes that are no longer in the document #6963
7704
				return m && m.parentNode ? [ m ] : [];
7705
			}
7706
		};
7707
		Expr.filter["ID"] = function( id ) {
7708
			var attrId = id.replace( runescape, funescape );
7709
			return function( elem ) {
7710
				return elem.getAttribute("id") === attrId;
7711
			};
7712
		};
7713
	} else {
7714
		// Support: IE6/7
7715
		// getElementById is not reliable as a find shortcut
7716
		delete Expr.find["ID"];
7717
7718
		Expr.filter["ID"] =  function( id ) {
7719
			var attrId = id.replace( runescape, funescape );
7720
			return function( elem ) {
7721
				var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
7722
				return node && node.value === attrId;
7723
			};
7724
		};
7725
	}
7726
7727
	// Tag
7728
	Expr.find["TAG"] = support.getElementsByTagName ?
7729
		function( tag, context ) {
7730
			if ( typeof context.getElementsByTagName !== "undefined" ) {
7731
				return context.getElementsByTagName( tag );
7732
7733
			// DocumentFragment nodes don't have gEBTN
7734
			} else if ( support.qsa ) {
7735
				return context.querySelectorAll( tag );
7736
			}
7737
		} :
7738
7739
		function( tag, context ) {
7740
			var elem,
7741
				tmp = [],
7742
				i = 0,
7743
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
7744
				results = context.getElementsByTagName( tag );
7745
7746
			// Filter out possible comments
7747
			if ( tag === "*" ) {
7748
				while ( (elem = results[i++]) ) {
7749
					if ( elem.nodeType === 1 ) {
7750
						tmp.push( elem );
7751
					}
7752
				}
7753
7754
				return tmp;
7755
			}
7756
			return results;
7757
		};
7758
7759
	// Class
7760
	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
7761
		if ( documentIsHTML ) {
7762
			return context.getElementsByClassName( className );
7763
		}
7764
	};
7765
7766
	/* QSA/matchesSelector
7767
	---------------------------------------------------------------------- */
7768
7769
	// QSA and matchesSelector support
7770
7771
	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
7772
	rbuggyMatches = [];
7773
7774
	// qSa(:focus) reports false when true (Chrome 21)
7775
	// We allow this because of a bug in IE8/9 that throws an error
7776
	// whenever `document.activeElement` is accessed on an iframe
7777
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
7778
	// See http://bugs.jquery.com/ticket/13378
7779
	rbuggyQSA = [];
7780
7781
	if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
7782
		// Build QSA regex
7783
		// Regex strategy adopted from Diego Perini
7784
		assert(function( div ) {
7785
			// Select is set to empty string on purpose
7786
			// This is to test IE's treatment of not explicitly
7787
			// setting a boolean content attribute,
7788
			// since its presence should be enough
7789
			// http://bugs.jquery.com/ticket/12359
7790
			docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
7791
				"<select id='" + expando + "-\f]' msallowcapture=''>" +
7792
				"<option selected=''></option></select>";
7793
7794
			// Support: IE8, Opera 11-12.16
7795
			// Nothing should be selected when empty strings follow ^= or $= or *=
7796
			// The test attribute must be unknown in Opera but "safe" for WinRT
7797
			// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
7798
			if ( div.querySelectorAll("[msallowcapture^='']").length ) {
7799
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
7800
			}
7801
7802
			// Support: IE8
7803
			// Boolean attributes and "value" are not treated correctly
7804
			if ( !div.querySelectorAll("[selected]").length ) {
7805
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
7806
			}
7807
7808
			// Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
7809
			if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
7810
				rbuggyQSA.push("~=");
7811
			}
7812
7813
			// Webkit/Opera - :checked should return selected option elements
7814
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
7815
			// IE8 throws error here and will not see later tests
7816
			if ( !div.querySelectorAll(":checked").length ) {
7817
				rbuggyQSA.push(":checked");
7818
			}
7819
7820
			// Support: Safari 8+, iOS 8+
7821
			// https://bugs.webkit.org/show_bug.cgi?id=136851
7822
			// In-page `selector#id sibing-combinator selector` fails
7823
			if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
7824
				rbuggyQSA.push(".#.+[+~]");
7825
			}
7826
		});
7827
7828
		assert(function( div ) {
7829
			// Support: Windows 8 Native Apps
7830
			// The type and name attributes are restricted during .innerHTML assignment
7831
			var input = doc.createElement("input");
7832
			input.setAttribute( "type", "hidden" );
7833
			div.appendChild( input ).setAttribute( "name", "D" );
7834
7835
			// Support: IE8
7836
			// Enforce case-sensitivity of name attribute
7837
			if ( div.querySelectorAll("[name=d]").length ) {
7838
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
7839
			}
7840
7841
			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
7842
			// IE8 throws error here and will not see later tests
7843
			if ( !div.querySelectorAll(":enabled").length ) {
7844
				rbuggyQSA.push( ":enabled", ":disabled" );
7845
			}
7846
7847
			// Opera 10-11 does not throw on post-comma invalid pseudos
7848
			div.querySelectorAll("*,:x");
7849
			rbuggyQSA.push(",.*:");
7850
		});
7851
	}
7852
7853
	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
7854
		docElem.webkitMatchesSelector ||
7855
		docElem.mozMatchesSelector ||
7856
		docElem.oMatchesSelector ||
7857
		docElem.msMatchesSelector) )) ) {
7858
7859
		assert(function( div ) {
7860
			// Check to see if it's possible to do matchesSelector
7861
			// on a disconnected node (IE 9)
7862
			support.disconnectedMatch = matches.call( div, "div" );
7863
7864
			// This should fail with an exception
7865
			// Gecko does not error, returns false instead
7866
			matches.call( div, "[s!='']:x" );
7867
			rbuggyMatches.push( "!=", pseudos );
7868
		});
7869
	}
7870
7871
	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
7872
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
7873
7874
	/* Contains
7875
	---------------------------------------------------------------------- */
7876
	hasCompare = rnative.test( docElem.compareDocumentPosition );
7877
7878
	// Element contains another
7879
	// Purposefully does not implement inclusive descendent
7880
	// As in, an element does not contain itself
7881
	contains = hasCompare || rnative.test( docElem.contains ) ?
7882
		function( a, b ) {
7883
			var adown = a.nodeType === 9 ? a.documentElement : a,
7884
				bup = b && b.parentNode;
7885
			return a === bup || !!( bup && bup.nodeType === 1 && (
7886
				adown.contains ?
7887
					adown.contains( bup ) :
7888
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
7889
			));
7890
		} :
7891
		function( a, b ) {
7892
			if ( b ) {
7893
				while ( (b = b.parentNode) ) {
7894
					if ( b === a ) {
7895
						return true;
7896
					}
7897
				}
7898
			}
7899
			return false;
7900
		};
7901
7902
	/* Sorting
7903
	---------------------------------------------------------------------- */
7904
7905
	// Document order sorting
7906
	sortOrder = hasCompare ?
7907
	function( a, b ) {
7908
7909
		// Flag for duplicate removal
7910
		if ( a === b ) {
7911
			hasDuplicate = true;
7912
			return 0;
7913
		}
7914
7915
		// Sort on method existence if only one input has compareDocumentPosition
7916
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
7917
		if ( compare ) {
7918
			return compare;
7919
		}
7920
7921
		// Calculate position if both inputs belong to the same document
7922
		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
7923
			a.compareDocumentPosition( b ) :
7924
7925
			// Otherwise we know they are disconnected
7926
			1;
7927
7928
		// Disconnected nodes
7929
		if ( compare & 1 ||
7930
			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
7931
7932
			// Choose the first element that is related to our preferred document
7933
			if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
7934
				return -1;
7935
			}
7936
			if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
7937
				return 1;
7938
			}
7939
7940
			// Maintain original order
7941
			return sortInput ?
7942
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
7943
				0;
7944
		}
7945
7946
		return compare & 4 ? -1 : 1;
7947
	} :
7948
	function( a, b ) {
7949
		// Exit early if the nodes are identical
7950
		if ( a === b ) {
7951
			hasDuplicate = true;
7952
			return 0;
7953
		}
7954
7955
		var cur,
7956
			i = 0,
7957
			aup = a.parentNode,
7958
			bup = b.parentNode,
7959
			ap = [ a ],
7960
			bp = [ b ];
7961
7962
		// Parentless nodes are either documents or disconnected
7963
		if ( !aup || !bup ) {
7964
			return a === doc ? -1 :
7965
				b === doc ? 1 :
7966
				aup ? -1 :
7967
				bup ? 1 :
7968
				sortInput ?
7969
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
7970
				0;
7971
7972
		// If the nodes are siblings, we can do a quick check
7973
		} else if ( aup === bup ) {
7974
			return siblingCheck( a, b );
7975
		}
7976
7977
		// Otherwise we need full lists of their ancestors for comparison
7978
		cur = a;
7979
		while ( (cur = cur.parentNode) ) {
7980
			ap.unshift( cur );
7981
		}
7982
		cur = b;
7983
		while ( (cur = cur.parentNode) ) {
7984
			bp.unshift( cur );
7985
		}
7986
7987
		// Walk down the tree looking for a discrepancy
7988
		while ( ap[i] === bp[i] ) {
7989
			i++;
7990
		}
7991
7992
		return i ?
7993
			// Do a sibling check if the nodes have a common ancestor
7994
			siblingCheck( ap[i], bp[i] ) :
7995
7996
			// Otherwise nodes in our document sort first
7997
			ap[i] === preferredDoc ? -1 :
7998
			bp[i] === preferredDoc ? 1 :
7999
			0;
8000
	};
8001
8002
	return doc;
8003
};
8004
8005
Sizzle.matches = function( expr, elements ) {
8006
	return Sizzle( expr, null, null, elements );
8007
};
8008
8009
Sizzle.matchesSelector = function( elem, expr ) {
8010
	// Set document vars if needed
8011
	if ( ( elem.ownerDocument || elem ) !== document ) {
8012
		setDocument( elem );
8013
	}
8014
8015
	// Make sure that attribute selectors are quoted
8016
	expr = expr.replace( rattributeQuotes, "='$1']" );
8017
8018
	if ( support.matchesSelector && documentIsHTML &&
8019
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
8020
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
8021
8022
		try {
8023
			var ret = matches.call( elem, expr );
8024
8025
			// IE 9's matchesSelector returns false on disconnected nodes
8026
			if ( ret || support.disconnectedMatch ||
8027
					// As well, disconnected nodes are said to be in a document
8028
					// fragment in IE 9
8029
					elem.document && elem.document.nodeType !== 11 ) {
8030
				return ret;
8031
			}
8032
		} catch (e) {}
8033
	}
8034
8035
	return Sizzle( expr, document, null, [ elem ] ).length > 0;
8036
};
8037
8038
Sizzle.contains = function( context, elem ) {
8039
	// Set document vars if needed
8040
	if ( ( context.ownerDocument || context ) !== document ) {
8041
		setDocument( context );
8042
	}
8043
	return contains( context, elem );
8044
};
8045
8046
Sizzle.attr = function( elem, name ) {
8047
	// Set document vars if needed
8048
	if ( ( elem.ownerDocument || elem ) !== document ) {
8049
		setDocument( elem );
8050
	}
8051
8052
	var fn = Expr.attrHandle[ name.toLowerCase() ],
8053
		// Don't get fooled by Object.prototype properties (jQuery #13807)
8054
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
8055
			fn( elem, name, !documentIsHTML ) :
8056
			undefined;
8057
8058
	return val !== undefined ?
8059
		val :
8060
		support.attributes || !documentIsHTML ?
8061
			elem.getAttribute( name ) :
8062
			(val = elem.getAttributeNode(name)) && val.specified ?
8063
				val.value :
8064
				null;
8065
};
8066
8067
Sizzle.error = function( msg ) {
8068
	throw new Error( "Syntax error, unrecognized expression: " + msg );
8069
};
8070
8071
/**
8072
 * Document sorting and removing duplicates
8073
 * @param {ArrayLike} results
8074
 */
8075
Sizzle.uniqueSort = function( results ) {
8076
	var elem,
8077
		duplicates = [],
8078
		j = 0,
8079
		i = 0;
8080
8081
	// Unless we *know* we can detect duplicates, assume their presence
8082
	hasDuplicate = !support.detectDuplicates;
8083
	sortInput = !support.sortStable && results.slice( 0 );
8084
	results.sort( sortOrder );
8085
8086
	if ( hasDuplicate ) {
8087
		while ( (elem = results[i++]) ) {
8088
			if ( elem === results[ i ] ) {
8089
				j = duplicates.push( i );
8090
			}
8091
		}
8092
		while ( j-- ) {
8093
			results.splice( duplicates[ j ], 1 );
8094
		}
8095
	}
8096
8097
	// Clear input after sorting to release objects
8098
	// See https://github.com/jquery/sizzle/pull/225
8099
	sortInput = null;
8100
8101
	return results;
8102
};
8103
8104
/**
8105
 * Utility function for retrieving the text value of an array of DOM nodes
8106
 * @param {Array|Element} elem
8107
 */
8108
getText = Sizzle.getText = function( elem ) {
8109
	var node,
8110
		ret = "",
8111
		i = 0,
8112
		nodeType = elem.nodeType;
8113
8114
	if ( !nodeType ) {
8115
		// If no nodeType, this is expected to be an array
8116
		while ( (node = elem[i++]) ) {
8117
			// Do not traverse comment nodes
8118
			ret += getText( node );
8119
		}
8120
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
8121
		// Use textContent for elements
8122
		// innerText usage removed for consistency of new lines (jQuery #11153)
8123
		if ( typeof elem.textContent === "string" ) {
8124
			return elem.textContent;
8125
		} else {
8126
			// Traverse its children
8127
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8128
				ret += getText( elem );
8129
			}
8130
		}
8131
	} else if ( nodeType === 3 || nodeType === 4 ) {
8132
		return elem.nodeValue;
8133
	}
8134
	// Do not include comment or processing instruction nodes
8135
8136
	return ret;
8137
};
8138
8139
Expr = Sizzle.selectors = {
8140
8141
	// Can be adjusted by the user
8142
	cacheLength: 50,
8143
8144
	createPseudo: markFunction,
8145
8146
	match: matchExpr,
8147
8148
	attrHandle: {},
8149
8150
	find: {},
8151
8152
	relative: {
8153
		">": { dir: "parentNode", first: true },
8154
		" ": { dir: "parentNode" },
8155
		"+": { dir: "previousSibling", first: true },
8156
		"~": { dir: "previousSibling" }
8157
	},
8158
8159
	preFilter: {
8160
		"ATTR": function( match ) {
8161
			match[1] = match[1].replace( runescape, funescape );
8162
8163
			// Move the given value to match[3] whether quoted or unquoted
8164
			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
8165
8166
			if ( match[2] === "~=" ) {
8167
				match[3] = " " + match[3] + " ";
8168
			}
8169
8170
			return match.slice( 0, 4 );
8171
		},
8172
8173
		"CHILD": function( match ) {
8174
			/* matches from matchExpr["CHILD"]
8175
				1 type (only|nth|...)
8176
				2 what (child|of-type)
8177
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
8178
				4 xn-component of xn+y argument ([+-]?\d*n|)
8179
				5 sign of xn-component
8180
				6 x of xn-component
8181
				7 sign of y-component
8182
				8 y of y-component
8183
			*/
8184
			match[1] = match[1].toLowerCase();
8185
8186
			if ( match[1].slice( 0, 3 ) === "nth" ) {
8187
				// nth-* requires argument
8188
				if ( !match[3] ) {
8189
					Sizzle.error( match[0] );
8190
				}
8191
8192
				// numeric x and y parameters for Expr.filter.CHILD
8193
				// remember that false/true cast respectively to 0/1
8194
				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
8195
				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
8196
8197
			// other types prohibit arguments
8198
			} else if ( match[3] ) {
8199
				Sizzle.error( match[0] );
8200
			}
8201
8202
			return match;
8203
		},
8204
8205
		"PSEUDO": function( match ) {
8206
			var excess,
8207
				unquoted = !match[6] && match[2];
8208
8209
			if ( matchExpr["CHILD"].test( match[0] ) ) {
8210
				return null;
8211
			}
8212
8213
			// Accept quoted arguments as-is
8214
			if ( match[3] ) {
8215
				match[2] = match[4] || match[5] || "";
8216
8217
			// Strip excess characters from unquoted arguments
8218
			} else if ( unquoted && rpseudo.test( unquoted ) &&
8219
				// Get excess from tokenize (recursively)
8220
				(excess = tokenize( unquoted, true )) &&
8221
				// advance to the next closing parenthesis
8222
				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
8223
8224
				// excess is a negative index
8225
				match[0] = match[0].slice( 0, excess );
8226
				match[2] = unquoted.slice( 0, excess );
8227
			}
8228
8229
			// Return only captures needed by the pseudo filter method (type and argument)
8230
			return match.slice( 0, 3 );
8231
		}
8232
	},
8233
8234
	filter: {
8235
8236
		"TAG": function( nodeNameSelector ) {
8237
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
8238
			return nodeNameSelector === "*" ?
8239
				function() { return true; } :
8240
				function( elem ) {
8241
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
8242
				};
8243
		},
8244
8245
		"CLASS": function( className ) {
8246
			var pattern = classCache[ className + " " ];
8247
8248
			return pattern ||
8249
				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
8250
				classCache( className, function( elem ) {
8251
					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
8252
				});
8253
		},
8254
8255
		"ATTR": function( name, operator, check ) {
8256
			return function( elem ) {
8257
				var result = Sizzle.attr( elem, name );
8258
8259
				if ( result == null ) {
8260
					return operator === "!=";
8261
				}
8262
				if ( !operator ) {
8263
					return true;
8264
				}
8265
8266
				result += "";
8267
8268
				return operator === "=" ? result === check :
8269
					operator === "!=" ? result !== check :
8270
					operator === "^=" ? check && result.indexOf( check ) === 0 :
8271
					operator === "*=" ? check && result.indexOf( check ) > -1 :
8272
					operator === "$=" ? check && result.slice( -check.length ) === check :
8273
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
8274
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
8275
					false;
8276
			};
8277
		},
8278
8279
		"CHILD": function( type, what, argument, first, last ) {
8280
			var simple = type.slice( 0, 3 ) !== "nth",
8281
				forward = type.slice( -4 ) !== "last",
8282
				ofType = what === "of-type";
8283
8284
			return first === 1 && last === 0 ?
8285
8286
				// Shortcut for :nth-*(n)
8287
				function( elem ) {
8288
					return !!elem.parentNode;
8289
				} :
8290
8291
				function( elem, context, xml ) {
8292
					var cache, outerCache, node, diff, nodeIndex, start,
8293
						dir = simple !== forward ? "nextSibling" : "previousSibling",
8294
						parent = elem.parentNode,
8295
						name = ofType && elem.nodeName.toLowerCase(),
8296
						useCache = !xml && !ofType;
8297
8298
					if ( parent ) {
8299
8300
						// :(first|last|only)-(child|of-type)
8301
						if ( simple ) {
8302
							while ( dir ) {
8303
								node = elem;
8304
								while ( (node = node[ dir ]) ) {
8305
									if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
8306
										return false;
8307
									}
8308
								}
8309
								// Reverse direction for :only-* (if we haven't yet done so)
8310
								start = dir = type === "only" && !start && "nextSibling";
8311
							}
8312
							return true;
8313
						}
8314
8315
						start = [ forward ? parent.firstChild : parent.lastChild ];
8316
8317
						// non-xml :nth-child(...) stores cache data on `parent`
8318
						if ( forward && useCache ) {
8319
							// Seek `elem` from a previously-cached index
8320
							outerCache = parent[ expando ] || (parent[ expando ] = {});
8321
							cache = outerCache[ type ] || [];
8322
							nodeIndex = cache[0] === dirruns && cache[1];
8323
							diff = cache[0] === dirruns && cache[2];
8324
							node = nodeIndex && parent.childNodes[ nodeIndex ];
8325
8326
							while ( (node = ++nodeIndex && node && node[ dir ] ||
8327
8328
								// Fallback to seeking `elem` from the start
8329
								(diff = nodeIndex = 0) || start.pop()) ) {
8330
8331
								// When found, cache indexes on `parent` and break
8332
								if ( node.nodeType === 1 && ++diff && node === elem ) {
8333
									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
8334
									break;
8335
								}
8336
							}
8337
8338
						// Use previously-cached element index if available
8339
						} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
8340
							diff = cache[1];
8341
8342
						// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
8343
						} else {
8344
							// Use the same loop as above to seek `elem` from the start
8345
							while ( (node = ++nodeIndex && node && node[ dir ] ||
8346
								(diff = nodeIndex = 0) || start.pop()) ) {
8347
8348
								if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
8349
									// Cache the index of each encountered element
8350
									if ( useCache ) {
8351
										(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
8352
									}
8353
8354
									if ( node === elem ) {
8355
										break;
8356
									}
8357
								}
8358
							}
8359
						}
8360
8361
						// Incorporate the offset, then check against cycle size
8362
						diff -= last;
8363
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
8364
					}
8365
				};
8366
		},
8367
8368
		"PSEUDO": function( pseudo, argument ) {
8369
			// pseudo-class names are case-insensitive
8370
			// http://www.w3.org/TR/selectors/#pseudo-classes
8371
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
8372
			// Remember that setFilters inherits from pseudos
8373
			var args,
8374
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
8375
					Sizzle.error( "unsupported pseudo: " + pseudo );
8376
8377
			// The user may use createPseudo to indicate that
8378
			// arguments are needed to create the filter function
8379
			// just as Sizzle does
8380
			if ( fn[ expando ] ) {
8381
				return fn( argument );
8382
			}
8383
8384
			// But maintain support for old signatures
8385
			if ( fn.length > 1 ) {
8386
				args = [ pseudo, pseudo, "", argument ];
8387
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
8388
					markFunction(function( seed, matches ) {
8389
						var idx,
8390
							matched = fn( seed, argument ),
8391
							i = matched.length;
8392
						while ( i-- ) {
8393
							idx = indexOf( seed, matched[i] );
8394
							seed[ idx ] = !( matches[ idx ] = matched[i] );
8395
						}
8396
					}) :
8397
					function( elem ) {
8398
						return fn( elem, 0, args );
8399
					};
8400
			}
8401
8402
			return fn;
8403
		}
8404
	},
8405
8406
	pseudos: {
8407
		// Potentially complex pseudos
8408
		"not": markFunction(function( selector ) {
8409
			// Trim the selector passed to compile
8410
			// to avoid treating leading and trailing
8411
			// spaces as combinators
8412
			var input = [],
8413
				results = [],
8414
				matcher = compile( selector.replace( rtrim, "$1" ) );
8415
8416
			return matcher[ expando ] ?
8417
				markFunction(function( seed, matches, context, xml ) {
8418
					var elem,
8419
						unmatched = matcher( seed, null, xml, [] ),
8420
						i = seed.length;
8421
8422
					// Match elements unmatched by `matcher`
8423
					while ( i-- ) {
8424
						if ( (elem = unmatched[i]) ) {
8425
							seed[i] = !(matches[i] = elem);
8426
						}
8427
					}
8428
				}) :
8429
				function( elem, context, xml ) {
8430
					input[0] = elem;
8431
					matcher( input, null, xml, results );
8432
					// Don't keep the element (issue #299)
8433
					input[0] = null;
8434
					return !results.pop();
8435
				};
8436
		}),
8437
8438
		"has": markFunction(function( selector ) {
8439
			return function( elem ) {
8440
				return Sizzle( selector, elem ).length > 0;
8441
			};
8442
		}),
8443
8444
		"contains": markFunction(function( text ) {
8445
			text = text.replace( runescape, funescape );
8446
			return function( elem ) {
8447
				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
8448
			};
8449
		}),
8450
8451
		// "Whether an element is represented by a :lang() selector
8452
		// is based solely on the element's language value
8453
		// being equal to the identifier C,
8454
		// or beginning with the identifier C immediately followed by "-".
8455
		// The matching of C against the element's language value is performed case-insensitively.
8456
		// The identifier C does not have to be a valid language name."
8457
		// http://www.w3.org/TR/selectors/#lang-pseudo
8458
		"lang": markFunction( function( lang ) {
8459
			// lang value must be a valid identifier
8460
			if ( !ridentifier.test(lang || "") ) {
8461
				Sizzle.error( "unsupported lang: " + lang );
8462
			}
8463
			lang = lang.replace( runescape, funescape ).toLowerCase();
8464
			return function( elem ) {
8465
				var elemLang;
8466
				do {
8467
					if ( (elemLang = documentIsHTML ?
8468
						elem.lang :
8469
						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
8470
8471
						elemLang = elemLang.toLowerCase();
8472
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
8473
					}
8474
				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
8475
				return false;
8476
			};
8477
		}),
8478
8479
		// Miscellaneous
8480
		"target": function( elem ) {
8481
			var hash = window.location && window.location.hash;
8482
			return hash && hash.slice( 1 ) === elem.id;
8483
		},
8484
8485
		"root": function( elem ) {
8486
			return elem === docElem;
8487
		},
8488
8489
		"focus": function( elem ) {
8490
			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
8491
		},
8492
8493
		// Boolean properties
8494
		"enabled": function( elem ) {
8495
			return elem.disabled === false;
8496
		},
8497
8498
		"disabled": function( elem ) {
8499
			return elem.disabled === true;
8500
		},
8501
8502
		"checked": function( elem ) {
8503
			// In CSS3, :checked should return both checked and selected elements
8504
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
8505
			var nodeName = elem.nodeName.toLowerCase();
8506
			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
8507
		},
8508
8509
		"selected": function( elem ) {
8510
			// Accessing this property makes selected-by-default
8511
			// options in Safari work properly
8512
			if ( elem.parentNode ) {
8513
				elem.parentNode.selectedIndex;
8514
			}
8515
8516
			return elem.selected === true;
8517
		},
8518
8519
		// Contents
8520
		"empty": function( elem ) {
8521
			// http://www.w3.org/TR/selectors/#empty-pseudo
8522
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
8523
			//   but not by others (comment: 8; processing instruction: 7; etc.)
8524
			// nodeType < 6 works because attributes (2) do not appear as children
8525
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8526
				if ( elem.nodeType < 6 ) {
8527
					return false;
8528
				}
8529
			}
8530
			return true;
8531
		},
8532
8533
		"parent": function( elem ) {
8534
			return !Expr.pseudos["empty"]( elem );
8535
		},
8536
8537
		// Element/input types
8538
		"header": function( elem ) {
8539
			return rheader.test( elem.nodeName );
8540
		},
8541
8542
		"input": function( elem ) {
8543
			return rinputs.test( elem.nodeName );
8544
		},
8545
8546
		"button": function( elem ) {
8547
			var name = elem.nodeName.toLowerCase();
8548
			return name === "input" && elem.type === "button" || name === "button";
8549
		},
8550
8551
		"text": function( elem ) {
8552
			var attr;
8553
			return elem.nodeName.toLowerCase() === "input" &&
8554
				elem.type === "text" &&
8555
8556
				// Support: IE<8
8557
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
8558
				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
8559
		},
8560
8561
		// Position-in-collection
8562
		"first": createPositionalPseudo(function() {
8563
			return [ 0 ];
8564
		}),
8565
8566
		"last": createPositionalPseudo(function( matchIndexes, length ) {
8567
			return [ length - 1 ];
8568
		}),
8569
8570
		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
8571
			return [ argument < 0 ? argument + length : argument ];
8572
		}),
8573
8574
		"even": createPositionalPseudo(function( matchIndexes, length ) {
8575
			var i = 0;
8576
			for ( ; i < length; i += 2 ) {
8577
				matchIndexes.push( i );
8578
			}
8579
			return matchIndexes;
8580
		}),
8581
8582
		"odd": createPositionalPseudo(function( matchIndexes, length ) {
8583
			var i = 1;
8584
			for ( ; i < length; i += 2 ) {
8585
				matchIndexes.push( i );
8586
			}
8587
			return matchIndexes;
8588
		}),
8589
8590
		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8591
			var i = argument < 0 ? argument + length : argument;
8592
			for ( ; --i >= 0; ) {
8593
				matchIndexes.push( i );
8594
			}
8595
			return matchIndexes;
8596
		}),
8597
8598
		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8599
			var i = argument < 0 ? argument + length : argument;
8600
			for ( ; ++i < length; ) {
8601
				matchIndexes.push( i );
8602
			}
8603
			return matchIndexes;
8604
		})
8605
	}
8606
};
8607
8608
Expr.pseudos["nth"] = Expr.pseudos["eq"];
8609
8610
// Add button/input type pseudos
8611
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
8612
	Expr.pseudos[ i ] = createInputPseudo( i );
8613
}
8614
for ( i in { submit: true, reset: true } ) {
8615
	Expr.pseudos[ i ] = createButtonPseudo( i );
8616
}
8617
8618
// Easy API for creating new setFilters
8619
function setFilters() {}
8620
setFilters.prototype = Expr.filters = Expr.pseudos;
8621
Expr.setFilters = new setFilters();
8622
8623
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
8624
	var matched, match, tokens, type,
8625
		soFar, groups, preFilters,
8626
		cached = tokenCache[ selector + " " ];
8627
8628
	if ( cached ) {
8629
		return parseOnly ? 0 : cached.slice( 0 );
8630
	}
8631
8632
	soFar = selector;
8633
	groups = [];
8634
	preFilters = Expr.preFilter;
8635
8636
	while ( soFar ) {
8637
8638
		// Comma and first run
8639
		if ( !matched || (match = rcomma.exec( soFar )) ) {
8640
			if ( match ) {
8641
				// Don't consume trailing commas as valid
8642
				soFar = soFar.slice( match[0].length ) || soFar;
8643
			}
8644
			groups.push( (tokens = []) );
8645
		}
8646
8647
		matched = false;
8648
8649
		// Combinators
8650
		if ( (match = rcombinators.exec( soFar )) ) {
8651
			matched = match.shift();
8652
			tokens.push({
8653
				value: matched,
8654
				// Cast descendant combinators to space
8655
				type: match[0].replace( rtrim, " " )
8656
			});
8657
			soFar = soFar.slice( matched.length );
8658
		}
8659
8660
		// Filters
8661
		for ( type in Expr.filter ) {
8662
			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
8663
				(match = preFilters[ type ]( match ))) ) {
8664
				matched = match.shift();
8665
				tokens.push({
8666
					value: matched,
8667
					type: type,
8668
					matches: match
8669
				});
8670
				soFar = soFar.slice( matched.length );
8671
			}
8672
		}
8673
8674
		if ( !matched ) {
8675
			break;
8676
		}
8677
	}
8678
8679
	// Return the length of the invalid excess
8680
	// if we're just parsing
8681
	// Otherwise, throw an error or return tokens
8682
	return parseOnly ?
8683
		soFar.length :
8684
		soFar ?
8685
			Sizzle.error( selector ) :
8686
			// Cache the tokens
8687
			tokenCache( selector, groups ).slice( 0 );
8688
};
8689
8690
function toSelector( tokens ) {
8691
	var i = 0,
8692
		len = tokens.length,
8693
		selector = "";
8694
	for ( ; i < len; i++ ) {
8695
		selector += tokens[i].value;
8696
	}
8697
	return selector;
8698
}
8699
8700
function addCombinator( matcher, combinator, base ) {
8701
	var dir = combinator.dir,
8702
		checkNonElements = base && dir === "parentNode",
8703
		doneName = done++;
8704
8705
	return combinator.first ?
8706
		// Check against closest ancestor/preceding element
8707
		function( elem, context, xml ) {
8708
			while ( (elem = elem[ dir ]) ) {
8709
				if ( elem.nodeType === 1 || checkNonElements ) {
8710
					return matcher( elem, context, xml );
8711
				}
8712
			}
8713
		} :
8714
8715
		// Check against all ancestor/preceding elements
8716
		function( elem, context, xml ) {
8717
			var oldCache, outerCache,
8718
				newCache = [ dirruns, doneName ];
8719
8720
			// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
8721
			if ( xml ) {
8722
				while ( (elem = elem[ dir ]) ) {
8723
					if ( elem.nodeType === 1 || checkNonElements ) {
8724
						if ( matcher( elem, context, xml ) ) {
8725
							return true;
8726
						}
8727
					}
8728
				}
8729
			} else {
8730
				while ( (elem = elem[ dir ]) ) {
8731
					if ( elem.nodeType === 1 || checkNonElements ) {
8732
						outerCache = elem[ expando ] || (elem[ expando ] = {});
8733
						if ( (oldCache = outerCache[ dir ]) &&
8734
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
8735
8736
							// Assign to newCache so results back-propagate to previous elements
8737
							return (newCache[ 2 ] = oldCache[ 2 ]);
8738
						} else {
8739
							// Reuse newcache so results back-propagate to previous elements
8740
							outerCache[ dir ] = newCache;
8741
8742
							// A match means we're done; a fail means we have to keep checking
8743
							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
8744
								return true;
8745
							}
8746
						}
8747
					}
8748
				}
8749
			}
8750
		};
8751
}
8752
8753
function elementMatcher( matchers ) {
8754
	return matchers.length > 1 ?
8755
		function( elem, context, xml ) {
8756
			var i = matchers.length;
8757
			while ( i-- ) {
8758
				if ( !matchers[i]( elem, context, xml ) ) {
8759
					return false;
8760
				}
8761
			}
8762
			return true;
8763
		} :
8764
		matchers[0];
8765
}
8766
8767
function multipleContexts( selector, contexts, results ) {
8768
	var i = 0,
8769
		len = contexts.length;
8770
	for ( ; i < len; i++ ) {
8771
		Sizzle( selector, contexts[i], results );
8772
	}
8773
	return results;
8774
}
8775
8776
function condense( unmatched, map, filter, context, xml ) {
8777
	var elem,
8778
		newUnmatched = [],
8779
		i = 0,
8780
		len = unmatched.length,
8781
		mapped = map != null;
8782
8783
	for ( ; i < len; i++ ) {
8784
		if ( (elem = unmatched[i]) ) {
8785
			if ( !filter || filter( elem, context, xml ) ) {
8786
				newUnmatched.push( elem );
8787
				if ( mapped ) {
8788
					map.push( i );
8789
				}
8790
			}
8791
		}
8792
	}
8793
8794
	return newUnmatched;
8795
}
8796
8797
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
8798
	if ( postFilter && !postFilter[ expando ] ) {
8799
		postFilter = setMatcher( postFilter );
8800
	}
8801
	if ( postFinder && !postFinder[ expando ] ) {
8802
		postFinder = setMatcher( postFinder, postSelector );
8803
	}
8804
	return markFunction(function( seed, results, context, xml ) {
8805
		var temp, i, elem,
8806
			preMap = [],
8807
			postMap = [],
8808
			preexisting = results.length,
8809
8810
			// Get initial elements from seed or context
8811
			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
8812
8813
			// Prefilter to get matcher input, preserving a map for seed-results synchronization
8814
			matcherIn = preFilter && ( seed || !selector ) ?
8815
				condense( elems, preMap, preFilter, context, xml ) :
8816
				elems,
8817
8818
			matcherOut = matcher ?
8819
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
8820
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
8821
8822
					// ...intermediate processing is necessary
8823
					[] :
8824
8825
					// ...otherwise use results directly
8826
					results :
8827
				matcherIn;
8828
8829
		// Find primary matches
8830
		if ( matcher ) {
8831
			matcher( matcherIn, matcherOut, context, xml );
8832
		}
8833
8834
		// Apply postFilter
8835
		if ( postFilter ) {
8836
			temp = condense( matcherOut, postMap );
8837
			postFilter( temp, [], context, xml );
8838
8839
			// Un-match failing elements by moving them back to matcherIn
8840
			i = temp.length;
8841
			while ( i-- ) {
8842
				if ( (elem = temp[i]) ) {
8843
					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
8844
				}
8845
			}
8846
		}
8847
8848
		if ( seed ) {
8849
			if ( postFinder || preFilter ) {
8850
				if ( postFinder ) {
8851
					// Get the final matcherOut by condensing this intermediate into postFinder contexts
8852
					temp = [];
8853
					i = matcherOut.length;
8854
					while ( i-- ) {
8855
						if ( (elem = matcherOut[i]) ) {
8856
							// Restore matcherIn since elem is not yet a final match
8857
							temp.push( (matcherIn[i] = elem) );
8858
						}
8859
					}
8860
					postFinder( null, (matcherOut = []), temp, xml );
8861
				}
8862
8863
				// Move matched elements from seed to results to keep them synchronized
8864
				i = matcherOut.length;
8865
				while ( i-- ) {
8866
					if ( (elem = matcherOut[i]) &&
8867
						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
8868
8869
						seed[temp] = !(results[temp] = elem);
8870
					}
8871
				}
8872
			}
8873
8874
		// Add elements to results, through postFinder if defined
8875
		} else {
8876
			matcherOut = condense(
8877
				matcherOut === results ?
8878
					matcherOut.splice( preexisting, matcherOut.length ) :
8879
					matcherOut
8880
			);
8881
			if ( postFinder ) {
8882
				postFinder( null, results, matcherOut, xml );
8883
			} else {
8884
				push.apply( results, matcherOut );
8885
			}
8886
		}
8887
	});
8888
}
8889
8890
function matcherFromTokens( tokens ) {
8891
	var checkContext, matcher, j,
8892
		len = tokens.length,
8893
		leadingRelative = Expr.relative[ tokens[0].type ],
8894
		implicitRelative = leadingRelative || Expr.relative[" "],
8895
		i = leadingRelative ? 1 : 0,
8896
8897
		// The foundational matcher ensures that elements are reachable from top-level context(s)
8898
		matchContext = addCombinator( function( elem ) {
8899
			return elem === checkContext;
8900
		}, implicitRelative, true ),
8901
		matchAnyContext = addCombinator( function( elem ) {
8902
			return indexOf( checkContext, elem ) > -1;
8903
		}, implicitRelative, true ),
8904
		matchers = [ function( elem, context, xml ) {
8905
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
8906
				(checkContext = context).nodeType ?
8907
					matchContext( elem, context, xml ) :
8908
					matchAnyContext( elem, context, xml ) );
8909
			// Avoid hanging onto element (issue #299)
8910
			checkContext = null;
8911
			return ret;
8912
		} ];
8913
8914
	for ( ; i < len; i++ ) {
8915
		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
8916
			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
8917
		} else {
8918
			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
8919
8920
			// Return special upon seeing a positional matcher
8921
			if ( matcher[ expando ] ) {
8922
				// Find the next relative operator (if any) for proper handling
8923
				j = ++i;
8924
				for ( ; j < len; j++ ) {
8925
					if ( Expr.relative[ tokens[j].type ] ) {
8926
						break;
8927
					}
8928
				}
8929
				return setMatcher(
8930
					i > 1 && elementMatcher( matchers ),
8931
					i > 1 && toSelector(
8932
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
8933
						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
8934
					).replace( rtrim, "$1" ),
8935
					matcher,
8936
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
8937
					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
8938
					j < len && toSelector( tokens )
8939
				);
8940
			}
8941
			matchers.push( matcher );
8942
		}
8943
	}
8944
8945
	return elementMatcher( matchers );
8946
}
8947
8948
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
8949
	var bySet = setMatchers.length > 0,
8950
		byElement = elementMatchers.length > 0,
8951
		superMatcher = function( seed, context, xml, results, outermost ) {
8952
			var elem, j, matcher,
8953
				matchedCount = 0,
8954
				i = "0",
8955
				unmatched = seed && [],
8956
				setMatched = [],
8957
				contextBackup = outermostContext,
8958
				// We must always have either seed elements or outermost context
8959
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
8960
				// Use integer dirruns iff this is the outermost matcher
8961
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
8962
				len = elems.length;
8963
8964
			if ( outermost ) {
8965
				outermostContext = context !== document && context;
8966
			}
8967
8968
			// Add elements passing elementMatchers directly to results
8969
			// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
8970
			// Support: IE<9, Safari
8971
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
8972
			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
8973
				if ( byElement && elem ) {
8974
					j = 0;
8975
					while ( (matcher = elementMatchers[j++]) ) {
8976
						if ( matcher( elem, context, xml ) ) {
8977
							results.push( elem );
8978
							break;
8979
						}
8980
					}
8981
					if ( outermost ) {
8982
						dirruns = dirrunsUnique;
8983
					}
8984
				}
8985
8986
				// Track unmatched elements for set filters
8987
				if ( bySet ) {
8988
					// They will have gone through all possible matchers
8989
					if ( (elem = !matcher && elem) ) {
8990
						matchedCount--;
8991
					}
8992
8993
					// Lengthen the array for every element, matched or not
8994
					if ( seed ) {
8995
						unmatched.push( elem );
8996
					}
8997
				}
8998
			}
8999
9000
			// Apply set filters to unmatched elements
9001
			matchedCount += i;
9002
			if ( bySet && i !== matchedCount ) {
9003
				j = 0;
9004
				while ( (matcher = setMatchers[j++]) ) {
9005
					matcher( unmatched, setMatched, context, xml );
9006
				}
9007
9008
				if ( seed ) {
9009
					// Reintegrate element matches to eliminate the need for sorting
9010
					if ( matchedCount > 0 ) {
9011
						while ( i-- ) {
9012
							if ( !(unmatched[i] || setMatched[i]) ) {
9013
								setMatched[i] = pop.call( results );
9014
							}
9015
						}
9016
					}
9017
9018
					// Discard index placeholder values to get only actual matches
9019
					setMatched = condense( setMatched );
9020
				}
9021
9022
				// Add matches to results
9023
				push.apply( results, setMatched );
9024
9025
				// Seedless set matches succeeding multiple successful matchers stipulate sorting
9026
				if ( outermost && !seed && setMatched.length > 0 &&
9027
					( matchedCount + setMatchers.length ) > 1 ) {
9028
9029
					Sizzle.uniqueSort( results );
9030
				}
9031
			}
9032
9033
			// Override manipulation of globals by nested matchers
9034
			if ( outermost ) {
9035
				dirruns = dirrunsUnique;
9036
				outermostContext = contextBackup;
9037
			}
9038
9039
			return unmatched;
9040
		};
9041
9042
	return bySet ?
9043
		markFunction( superMatcher ) :
9044
		superMatcher;
9045
}
9046
9047
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
9048
	var i,
9049
		setMatchers = [],
9050
		elementMatchers = [],
9051
		cached = compilerCache[ selector + " " ];
9052
9053
	if ( !cached ) {
9054
		// Generate a function of recursive functions that can be used to check each element
9055
		if ( !match ) {
9056
			match = tokenize( selector );
9057
		}
9058
		i = match.length;
9059
		while ( i-- ) {
9060
			cached = matcherFromTokens( match[i] );
9061
			if ( cached[ expando ] ) {
9062
				setMatchers.push( cached );
9063
			} else {
9064
				elementMatchers.push( cached );
9065
			}
9066
		}
9067
9068
		// Cache the compiled function
9069
		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
9070
9071
		// Save selector and tokenization
9072
		cached.selector = selector;
9073
	}
9074
	return cached;
9075
};
9076
9077
/**
9078
 * A low-level selection function that works with Sizzle's compiled
9079
 *  selector functions
9080
 * @param {String|Function} selector A selector or a pre-compiled
9081
 *  selector function built with Sizzle.compile
9082
 * @param {Element} context
9083
 * @param {Array} [results]
9084
 * @param {Array} [seed] A set of elements to match against
9085
 */
9086
select = Sizzle.select = function( selector, context, results, seed ) {
9087
	var i, tokens, token, type, find,
9088
		compiled = typeof selector === "function" && selector,
9089
		match = !seed && tokenize( (selector = compiled.selector || selector) );
9090
9091
	results = results || [];
9092
9093
	// Try to minimize operations if there is no seed and only one group
9094
	if ( match.length === 1 ) {
9095
9096
		// Take a shortcut and set the context if the root selector is an ID
9097
		tokens = match[0] = match[0].slice( 0 );
9098
		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
9099
				support.getById && context.nodeType === 9 && documentIsHTML &&
9100
				Expr.relative[ tokens[1].type ] ) {
9101
9102
			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
9103
			if ( !context ) {
9104
				return results;
9105
9106
			// Precompiled matchers will still verify ancestry, so step up a level
9107
			} else if ( compiled ) {
9108
				context = context.parentNode;
9109
			}
9110
9111
			selector = selector.slice( tokens.shift().value.length );
9112
		}
9113
9114
		// Fetch a seed set for right-to-left matching
9115
		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
9116
		while ( i-- ) {
9117
			token = tokens[i];
9118
9119
			// Abort if we hit a combinator
9120
			if ( Expr.relative[ (type = token.type) ] ) {
9121
				break;
9122
			}
9123
			if ( (find = Expr.find[ type ]) ) {
9124
				// Search, expanding context for leading sibling combinators
9125
				if ( (seed = find(
9126
					token.matches[0].replace( runescape, funescape ),
9127
					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
9128
				)) ) {
9129
9130
					// If seed is empty or no tokens remain, we can return early
9131
					tokens.splice( i, 1 );
9132
					selector = seed.length && toSelector( tokens );
9133
					if ( !selector ) {
9134
						push.apply( results, seed );
9135
						return results;
9136
					}
9137
9138
					break;
9139
				}
9140
			}
9141
		}
9142
	}
9143
9144
	// Compile and execute a filtering function if one is not provided
9145
	// Provide `match` to avoid retokenization if we modified the selector above
9146
	( compiled || compile( selector, match ) )(
9147
		seed,
9148
		context,
9149
		!documentIsHTML,
9150
		results,
9151
		rsibling.test( selector ) && testContext( context.parentNode ) || context
9152
	);
9153
	return results;
9154
};
9155
9156
// One-time assignments
9157
9158
// Sort stability
9159
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
9160
9161
// Support: Chrome 14-35+
9162
// Always assume duplicates if they aren't passed to the comparison function
9163
support.detectDuplicates = !!hasDuplicate;
9164
9165
// Initialize against the default document
9166
setDocument();
9167
9168
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
9169
// Detached nodes confoundingly follow *each other*
9170
support.sortDetached = assert(function( div1 ) {
9171
	// Should return 1, but returns 4 (following)
9172
	return div1.compareDocumentPosition( document.createElement("div") ) & 1;
9173
});
9174
9175
// Support: IE<8
9176
// Prevent attribute/property "interpolation"
9177
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
9178
if ( !assert(function( div ) {
9179
	div.innerHTML = "<a href='#'></a>";
9180
	return div.firstChild.getAttribute("href") === "#" ;
9181
}) ) {
9182
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
9183
		if ( !isXML ) {
9184
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
9185
		}
9186
	});
9187
}
9188
9189
// Support: IE<9
9190
// Use defaultValue in place of getAttribute("value")
9191
if ( !support.attributes || !assert(function( div ) {
9192
	div.innerHTML = "<input/>";
9193
	div.firstChild.setAttribute( "value", "" );
9194
	return div.firstChild.getAttribute( "value" ) === "";
9195
}) ) {
9196
	addHandle( "value", function( elem, name, isXML ) {
9197
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
9198
			return elem.defaultValue;
9199
		}
9200
	});
9201
}
9202
9203
// Support: IE<9
9204
// Use getAttributeNode to fetch booleans when getAttribute lies
9205
if ( !assert(function( div ) {
9206
	return div.getAttribute("disabled") == null;
9207
}) ) {
9208
	addHandle( booleans, function( elem, name, isXML ) {
9209
		var val;
9210
		if ( !isXML ) {
9211
			return elem[ name ] === true ? name.toLowerCase() :
9212
					(val = elem.getAttributeNode( name )) && val.specified ?
9213
					val.value :
9214
				null;
9215
		}
9216
	});
9217
}
9218
9219
return Sizzle;
9220
9221
})( window );
9222
9223
9224
9225
jQuery.find = Sizzle;
9226
jQuery.expr = Sizzle.selectors;
9227
jQuery.expr[":"] = jQuery.expr.pseudos;
9228
jQuery.unique = Sizzle.uniqueSort;
9229
jQuery.text = Sizzle.getText;
9230
jQuery.isXMLDoc = Sizzle.isXML;
9231
jQuery.contains = Sizzle.contains;
9232
9233
9234
9235
var rneedsContext = jQuery.expr.match.needsContext;
9236
9237
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
9238
9239
9240
9241
var risSimple = /^.[^:#\[\.,]*$/;
9242
9243
// Implement the identical functionality for filter and not
9244
function winnow( elements, qualifier, not ) {
9245
	if ( jQuery.isFunction( qualifier ) ) {
9246
		return jQuery.grep( elements, function( elem, i ) {
9247
			/* jshint -W018 */
9248
			return !!qualifier.call( elem, i, elem ) !== not;
9249
		});
9250
9251
	}
9252
9253
	if ( qualifier.nodeType ) {
9254
		return jQuery.grep( elements, function( elem ) {
9255
			return ( elem === qualifier ) !== not;
9256
		});
9257
9258
	}
9259
9260
	if ( typeof qualifier === "string" ) {
9261
		if ( risSimple.test( qualifier ) ) {
9262
			return jQuery.filter( qualifier, elements, not );
9263
		}
9264
9265
		qualifier = jQuery.filter( qualifier, elements );
9266
	}
9267
9268
	return jQuery.grep( elements, function( elem ) {
9269
		return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
9270
	});
9271
}
9272
9273
jQuery.filter = function( expr, elems, not ) {
9274
	var elem = elems[ 0 ];
9275
9276
	if ( not ) {
9277
		expr = ":not(" + expr + ")";
9278
	}
9279
9280
	return elems.length === 1 && elem.nodeType === 1 ?
9281
		jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
9282
		jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
9283
			return elem.nodeType === 1;
9284
		}));
9285
};
9286
9287
jQuery.fn.extend({
9288
	find: function( selector ) {
9289
		var i,
9290
			len = this.length,
9291
			ret = [],
9292
			self = this;
9293
9294
		if ( typeof selector !== "string" ) {
9295
			return this.pushStack( jQuery( selector ).filter(function() {
9296
				for ( i = 0; i < len; i++ ) {
9297
					if ( jQuery.contains( self[ i ], this ) ) {
9298
						return true;
9299
					}
9300
				}
9301
			}) );
9302
		}
9303
9304
		for ( i = 0; i < len; i++ ) {
9305
			jQuery.find( selector, self[ i ], ret );
9306
		}
9307
9308
		// Needed because $( selector, context ) becomes $( context ).find( selector )
9309
		ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
9310
		ret.selector = this.selector ? this.selector + " " + selector : selector;
9311
		return ret;
9312
	},
9313
	filter: function( selector ) {
9314
		return this.pushStack( winnow(this, selector || [], false) );
9315
	},
9316
	not: function( selector ) {
9317
		return this.pushStack( winnow(this, selector || [], true) );
9318
	},
9319
	is: function( selector ) {
9320
		return !!winnow(
9321
			this,
9322
9323
			// If this is a positional/relative selector, check membership in the returned set
9324
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
9325
			typeof selector === "string" && rneedsContext.test( selector ) ?
9326
				jQuery( selector ) :
9327
				selector || [],
9328
			false
9329
		).length;
9330
	}
9331
});
9332
9333
9334
// Initialize a jQuery object
9335
9336
9337
// A central reference to the root jQuery(document)
9338
var rootjQuery,
9339
9340
	// A simple way to check for HTML strings
9341
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
9342
	// Strict HTML recognition (#11290: must start with <)
9343
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
9344
9345
	init = jQuery.fn.init = function( selector, context ) {
9346
		var match, elem;
9347
9348
		// HANDLE: $(""), $(null), $(undefined), $(false)
9349
		if ( !selector ) {
9350
			return this;
9351
		}
9352
9353
		// Handle HTML strings
9354
		if ( typeof selector === "string" ) {
9355
			if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
9356
				// Assume that strings that start and end with <> are HTML and skip the regex check
9357
				match = [ null, selector, null ];
9358
9359
			} else {
9360
				match = rquickExpr.exec( selector );
9361
			}
9362
9363
			// Match html or make sure no context is specified for #id
9364
			if ( match && (match[1] || !context) ) {
9365
9366
				// HANDLE: $(html) -> $(array)
9367
				if ( match[1] ) {
9368
					context = context instanceof jQuery ? context[0] : context;
9369
9370
					// Option to run scripts is true for back-compat
9371
					// Intentionally let the error be thrown if parseHTML is not present
9372
					jQuery.merge( this, jQuery.parseHTML(
9373
						match[1],
9374
						context && context.nodeType ? context.ownerDocument || context : document,
9375
						true
9376
					) );
9377
9378
					// HANDLE: $(html, props)
9379
					if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
9380
						for ( match in context ) {
9381
							// Properties of context are called as methods if possible
9382
							if ( jQuery.isFunction( this[ match ] ) ) {
9383
								this[ match ]( context[ match ] );
9384
9385
							// ...and otherwise set as attributes
9386
							} else {
9387
								this.attr( match, context[ match ] );
9388
							}
9389
						}
9390
					}
9391
9392
					return this;
9393
9394
				// HANDLE: $(#id)
9395
				} else {
9396
					elem = document.getElementById( match[2] );
9397
9398
					// Support: Blackberry 4.6
9399
					// gEBID returns nodes no longer in the document (#6963)
9400
					if ( elem && elem.parentNode ) {
9401
						// Inject the element directly into the jQuery object
9402
						this.length = 1;
9403
						this[0] = elem;
9404
					}
9405
9406
					this.context = document;
9407
					this.selector = selector;
9408
					return this;
9409
				}
9410
9411
			// HANDLE: $(expr, $(...))
9412
			} else if ( !context || context.jquery ) {
9413
				return ( context || rootjQuery ).find( selector );
9414
9415
			// HANDLE: $(expr, context)
9416
			// (which is just equivalent to: $(context).find(expr)
9417
			} else {
9418
				return this.constructor( context ).find( selector );
9419
			}
9420
9421
		// HANDLE: $(DOMElement)
9422
		} else if ( selector.nodeType ) {
9423
			this.context = this[0] = selector;
9424
			this.length = 1;
9425
			return this;
9426
9427
		// HANDLE: $(function)
9428
		// Shortcut for document ready
9429
		} else if ( jQuery.isFunction( selector ) ) {
9430
			return typeof rootjQuery.ready !== "undefined" ?
9431
				rootjQuery.ready( selector ) :
9432
				// Execute immediately if ready is not present
9433
				selector( jQuery );
9434
		}
9435
9436
		if ( selector.selector !== undefined ) {
9437
			this.selector = selector.selector;
9438
			this.context = selector.context;
9439
		}
9440
9441
		return jQuery.makeArray( selector, this );
9442
	};
9443
9444
// Give the init function the jQuery prototype for later instantiation
9445
init.prototype = jQuery.fn;
9446
9447
// Initialize central reference
9448
rootjQuery = jQuery( document );
9449
9450
9451
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
9452
	// Methods guaranteed to produce a unique set when starting from a unique set
9453
	guaranteedUnique = {
9454
		children: true,
9455
		contents: true,
9456
		next: true,
9457
		prev: true
9458
	};
9459
9460
jQuery.extend({
9461
	dir: function( elem, dir, until ) {
9462
		var matched = [],
9463
			truncate = until !== undefined;
9464
9465
		while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
9466
			if ( elem.nodeType === 1 ) {
9467
				if ( truncate && jQuery( elem ).is( until ) ) {
9468
					break;
9469
				}
9470
				matched.push( elem );
9471
			}
9472
		}
9473
		return matched;
9474
	},
9475
9476
	sibling: function( n, elem ) {
9477
		var matched = [];
9478
9479
		for ( ; n; n = n.nextSibling ) {
9480
			if ( n.nodeType === 1 && n !== elem ) {
9481
				matched.push( n );
9482
			}
9483
		}
9484
9485
		return matched;
9486
	}
9487
});
9488
9489
jQuery.fn.extend({
9490
	has: function( target ) {
9491
		var targets = jQuery( target, this ),
9492
			l = targets.length;
9493
9494
		return this.filter(function() {
9495
			var i = 0;
9496
			for ( ; i < l; i++ ) {
9497
				if ( jQuery.contains( this, targets[i] ) ) {
9498
					return true;
9499
				}
9500
			}
9501
		});
9502
	},
9503
9504
	closest: function( selectors, context ) {
9505
		var cur,
9506
			i = 0,
9507
			l = this.length,
9508
			matched = [],
9509
			pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
9510
				jQuery( selectors, context || this.context ) :
9511
				0;
9512
9513
		for ( ; i < l; i++ ) {
9514
			for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
9515
				// Always skip document fragments
9516
				if ( cur.nodeType < 11 && (pos ?
9517
					pos.index(cur) > -1 :
9518
9519
					// Don't pass non-elements to Sizzle
9520
					cur.nodeType === 1 &&
9521
						jQuery.find.matchesSelector(cur, selectors)) ) {
9522
9523
					matched.push( cur );
9524
					break;
9525
				}
9526
			}
9527
		}
9528
9529
		return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
9530
	},
9531
9532
	// Determine the position of an element within the set
9533
	index: function( elem ) {
9534
9535
		// No argument, return index in parent
9536
		if ( !elem ) {
9537
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
9538
		}
9539
9540
		// Index in selector
9541
		if ( typeof elem === "string" ) {
9542
			return indexOf.call( jQuery( elem ), this[ 0 ] );
9543
		}
9544
9545
		// Locate the position of the desired element
9546
		return indexOf.call( this,
9547
9548
			// If it receives a jQuery object, the first element is used
9549
			elem.jquery ? elem[ 0 ] : elem
9550
		);
9551
	},
9552
9553
	add: function( selector, context ) {
9554
		return this.pushStack(
9555
			jQuery.unique(
9556
				jQuery.merge( this.get(), jQuery( selector, context ) )
9557
			)
9558
		);
9559
	},
9560
9561
	addBack: function( selector ) {
9562
		return this.add( selector == null ?
9563
			this.prevObject : this.prevObject.filter(selector)
9564
		);
9565
	}
9566
});
9567
9568
function sibling( cur, dir ) {
9569
	while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
9570
	return cur;
9571
}
9572
9573
jQuery.each({
9574
	parent: function( elem ) {
9575
		var parent = elem.parentNode;
9576
		return parent && parent.nodeType !== 11 ? parent : null;
9577
	},
9578
	parents: function( elem ) {
9579
		return jQuery.dir( elem, "parentNode" );
9580
	},
9581
	parentsUntil: function( elem, i, until ) {
9582
		return jQuery.dir( elem, "parentNode", until );
9583
	},
9584
	next: function( elem ) {
9585
		return sibling( elem, "nextSibling" );
9586
	},
9587
	prev: function( elem ) {
9588
		return sibling( elem, "previousSibling" );
9589
	},
9590
	nextAll: function( elem ) {
9591
		return jQuery.dir( elem, "nextSibling" );
9592
	},
9593
	prevAll: function( elem ) {
9594
		return jQuery.dir( elem, "previousSibling" );
9595
	},
9596
	nextUntil: function( elem, i, until ) {
9597
		return jQuery.dir( elem, "nextSibling", until );
9598
	},
9599
	prevUntil: function( elem, i, until ) {
9600
		return jQuery.dir( elem, "previousSibling", until );
9601
	},
9602
	siblings: function( elem ) {
9603
		return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
9604
	},
9605
	children: function( elem ) {
9606
		return jQuery.sibling( elem.firstChild );
9607
	},
9608
	contents: function( elem ) {
9609
		return elem.contentDocument || jQuery.merge( [], elem.childNodes );
9610
	}
9611
}, function( name, fn ) {
9612
	jQuery.fn[ name ] = function( until, selector ) {
9613
		var matched = jQuery.map( this, fn, until );
9614
9615
		if ( name.slice( -5 ) !== "Until" ) {
9616
			selector = until;
9617
		}
9618
9619
		if ( selector && typeof selector === "string" ) {
9620
			matched = jQuery.filter( selector, matched );
9621
		}
9622
9623
		if ( this.length > 1 ) {
9624
			// Remove duplicates
9625
			if ( !guaranteedUnique[ name ] ) {
9626
				jQuery.unique( matched );
9627
			}
9628
9629
			// Reverse order for parents* and prev-derivatives
9630
			if ( rparentsprev.test( name ) ) {
9631
				matched.reverse();
9632
			}
9633
		}
9634
9635
		return this.pushStack( matched );
9636
	};
9637
});
9638
var rnotwhite = (/\S+/g);
9639
9640
9641
9642
// String to Object options format cache
9643
var optionsCache = {};
9644
9645
// Convert String-formatted options into Object-formatted ones and store in cache
9646
function createOptions( options ) {
9647
	var object = optionsCache[ options ] = {};
9648
	jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
9649
		object[ flag ] = true;
9650
	});
9651
	return object;
9652
}
9653
9654
/*
9655
 * Create a callback list using the following parameters:
9656
 *
9657
 *	options: an optional list of space-separated options that will change how
9658
 *			the callback list behaves or a more traditional option object
9659
 *
9660
 * By default a callback list will act like an event callback list and can be
9661
 * "fired" multiple times.
9662
 *
9663
 * Possible options:
9664
 *
9665
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
9666
 *
9667
 *	memory:			will keep track of previous values and will call any callback added
9668
 *					after the list has been fired right away with the latest "memorized"
9669
 *					values (like a Deferred)
9670
 *
9671
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
9672
 *
9673
 *	stopOnFalse:	interrupt callings when a callback returns false
9674
 *
9675
 */
9676
jQuery.Callbacks = function( options ) {
9677
9678
	// Convert options from String-formatted to Object-formatted if needed
9679
	// (we check in cache first)
9680
	options = typeof options === "string" ?
9681
		( optionsCache[ options ] || createOptions( options ) ) :
9682
		jQuery.extend( {}, options );
9683
9684
	var // Last fire value (for non-forgettable lists)
9685
		memory,
9686
		// Flag to know if list was already fired
9687
		fired,
9688
		// Flag to know if list is currently firing
9689
		firing,
9690
		// First callback to fire (used internally by add and fireWith)
9691
		firingStart,
9692
		// End of the loop when firing
9693
		firingLength,
9694
		// Index of currently firing callback (modified by remove if needed)
9695
		firingIndex,
9696
		// Actual callback list
9697
		list = [],
9698
		// Stack of fire calls for repeatable lists
9699
		stack = !options.once && [],
9700
		// Fire callbacks
9701
		fire = function( data ) {
9702
			memory = options.memory && data;
9703
			fired = true;
9704
			firingIndex = firingStart || 0;
9705
			firingStart = 0;
9706
			firingLength = list.length;
9707
			firing = true;
9708
			for ( ; list && firingIndex < firingLength; firingIndex++ ) {
9709
				if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
9710
					memory = false; // To prevent further calls using add
9711
					break;
9712
				}
9713
			}
9714
			firing = false;
9715
			if ( list ) {
9716
				if ( stack ) {
9717
					if ( stack.length ) {
9718
						fire( stack.shift() );
9719
					}
9720
				} else if ( memory ) {
9721
					list = [];
9722
				} else {
9723
					self.disable();
9724
				}
9725
			}
9726
		},
9727
		// Actual Callbacks object
9728
		self = {
9729
			// Add a callback or a collection of callbacks to the list
9730
			add: function() {
9731
				if ( list ) {
9732
					// First, we save the current length
9733
					var start = list.length;
9734
					(function add( args ) {
9735
						jQuery.each( args, function( _, arg ) {
9736
							var type = jQuery.type( arg );
9737
							if ( type === "function" ) {
9738
								if ( !options.unique || !self.has( arg ) ) {
9739
									list.push( arg );
9740
								}
9741
							} else if ( arg && arg.length && type !== "string" ) {
9742
								// Inspect recursively
9743
								add( arg );
9744
							}
9745
						});
9746
					})( arguments );
9747
					// Do we need to add the callbacks to the
9748
					// current firing batch?
9749
					if ( firing ) {
9750
						firingLength = list.length;
9751
					// With memory, if we're not firing then
9752
					// we should call right away
9753
					} else if ( memory ) {
9754
						firingStart = start;
9755
						fire( memory );
9756
					}
9757
				}
9758
				return this;
9759
			},
9760
			// Remove a callback from the list
9761
			remove: function() {
9762
				if ( list ) {
9763
					jQuery.each( arguments, function( _, arg ) {
9764
						var index;
9765
						while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
9766
							list.splice( index, 1 );
9767
							// Handle firing indexes
9768
							if ( firing ) {
9769
								if ( index <= firingLength ) {
9770
									firingLength--;
9771
								}
9772
								if ( index <= firingIndex ) {
9773
									firingIndex--;
9774
								}
9775
							}
9776
						}
9777
					});
9778
				}
9779
				return this;
9780
			},
9781
			// Check if a given callback is in the list.
9782
			// If no argument is given, return whether or not list has callbacks attached.
9783
			has: function( fn ) {
9784
				return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
9785
			},
9786
			// Remove all callbacks from the list
9787
			empty: function() {
9788
				list = [];
9789
				firingLength = 0;
9790
				return this;
9791
			},
9792
			// Have the list do nothing anymore
9793
			disable: function() {
9794
				list = stack = memory = undefined;
9795
				return this;
9796
			},
9797
			// Is it disabled?
9798
			disabled: function() {
9799
				return !list;
9800
			},
9801
			// Lock the list in its current state
9802
			lock: function() {
9803
				stack = undefined;
9804
				if ( !memory ) {
9805
					self.disable();
9806
				}
9807
				return this;
9808
			},
9809
			// Is it locked?
9810
			locked: function() {
9811
				return !stack;
9812
			},
9813
			// Call all callbacks with the given context and arguments
9814
			fireWith: function( context, args ) {
9815
				if ( list && ( !fired || stack ) ) {
9816
					args = args || [];
9817
					args = [ context, args.slice ? args.slice() : args ];
9818
					if ( firing ) {
9819
						stack.push( args );
9820
					} else {
9821
						fire( args );
9822
					}
9823
				}
9824
				return this;
9825
			},
9826
			// Call all the callbacks with the given arguments
9827
			fire: function() {
9828
				self.fireWith( this, arguments );
9829
				return this;
9830
			},
9831
			// To know if the callbacks have already been called at least once
9832
			fired: function() {
9833
				return !!fired;
9834
			}
9835
		};
9836
9837
	return self;
9838
};
9839
9840
9841
jQuery.extend({
9842
9843
	Deferred: function( func ) {
9844
		var tuples = [
9845
				// action, add listener, listener list, final state
9846
				[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
9847
				[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
9848
				[ "notify", "progress", jQuery.Callbacks("memory") ]
9849
			],
9850
			state = "pending",
9851
			promise = {
9852
				state: function() {
9853
					return state;
9854
				},
9855
				always: function() {
9856
					deferred.done( arguments ).fail( arguments );
9857
					return this;
9858
				},
9859
				then: function( /* fnDone, fnFail, fnProgress */ ) {
9860
					var fns = arguments;
9861
					return jQuery.Deferred(function( newDefer ) {
9862
						jQuery.each( tuples, function( i, tuple ) {
9863
							var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
9864
							// deferred[ done | fail | progress ] for forwarding actions to newDefer
9865
							deferred[ tuple[1] ](function() {
9866
								var returned = fn && fn.apply( this, arguments );
9867
								if ( returned && jQuery.isFunction( returned.promise ) ) {
9868
									returned.promise()
9869
										.done( newDefer.resolve )
9870
										.fail( newDefer.reject )
9871
										.progress( newDefer.notify );
9872
								} else {
9873
									newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
9874
								}
9875
							});
9876
						});
9877
						fns = null;
9878
					}).promise();
9879
				},
9880
				// Get a promise for this deferred
9881
				// If obj is provided, the promise aspect is added to the object
9882
				promise: function( obj ) {
9883
					return obj != null ? jQuery.extend( obj, promise ) : promise;
9884
				}
9885
			},
9886
			deferred = {};
9887
9888
		// Keep pipe for back-compat
9889
		promise.pipe = promise.then;
9890
9891
		// Add list-specific methods
9892
		jQuery.each( tuples, function( i, tuple ) {
9893
			var list = tuple[ 2 ],
9894
				stateString = tuple[ 3 ];
9895
9896
			// promise[ done | fail | progress ] = list.add
9897
			promise[ tuple[1] ] = list.add;
9898
9899
			// Handle state
9900
			if ( stateString ) {
9901
				list.add(function() {
9902
					// state = [ resolved | rejected ]
9903
					state = stateString;
9904
9905
				// [ reject_list | resolve_list ].disable; progress_list.lock
9906
				}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
9907
			}
9908
9909
			// deferred[ resolve | reject | notify ]
9910
			deferred[ tuple[0] ] = function() {
9911
				deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
9912
				return this;
9913
			};
9914
			deferred[ tuple[0] + "With" ] = list.fireWith;
9915
		});
9916
9917
		// Make the deferred a promise
9918
		promise.promise( deferred );
9919
9920
		// Call given func if any
9921
		if ( func ) {
9922
			func.call( deferred, deferred );
9923
		}
9924
9925
		// All done!
9926
		return deferred;
9927
	},
9928
9929
	// Deferred helper
9930
	when: function( subordinate /* , ..., subordinateN */ ) {
9931
		var i = 0,
9932
			resolveValues = slice.call( arguments ),
9933
			length = resolveValues.length,
9934
9935
			// the count of uncompleted subordinates
9936
			remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
9937
9938
			// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
9939
			deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
9940
9941
			// Update function for both resolve and progress values
9942
			updateFunc = function( i, contexts, values ) {
9943
				return function( value ) {
9944
					contexts[ i ] = this;
9945
					values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
9946
					if ( values === progressValues ) {
9947
						deferred.notifyWith( contexts, values );
9948
					} else if ( !( --remaining ) ) {
9949
						deferred.resolveWith( contexts, values );
9950
					}
9951
				};
9952
			},
9953
9954
			progressValues, progressContexts, resolveContexts;
9955
9956
		// Add listeners to Deferred subordinates; treat others as resolved
9957
		if ( length > 1 ) {
9958
			progressValues = new Array( length );
9959
			progressContexts = new Array( length );
9960
			resolveContexts = new Array( length );
9961
			for ( ; i < length; i++ ) {
9962
				if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
9963
					resolveValues[ i ].promise()
9964
						.done( updateFunc( i, resolveContexts, resolveValues ) )
9965
						.fail( deferred.reject )
9966
						.progress( updateFunc( i, progressContexts, progressValues ) );
9967
				} else {
9968
					--remaining;
9969
				}
9970
			}
9971
		}
9972
9973
		// If we're not waiting on anything, resolve the master
9974
		if ( !remaining ) {
9975
			deferred.resolveWith( resolveContexts, resolveValues );
9976
		}
9977
9978
		return deferred.promise();
9979
	}
9980
});
9981
9982
9983
// The deferred used on DOM ready
9984
var readyList;
9985
9986
jQuery.fn.ready = function( fn ) {
9987
	// Add the callback
9988
	jQuery.ready.promise().done( fn );
9989
9990
	return this;
9991
};
9992
9993
jQuery.extend({
9994
	// Is the DOM ready to be used? Set to true once it occurs.
9995
	isReady: false,
9996
9997
	// A counter to track how many items to wait for before
9998
	// the ready event fires. See #6781
9999
	readyWait: 1,
10000
10001
	// Hold (or release) the ready event
10002
	holdReady: function( hold ) {
10003
		if ( hold ) {
10004
			jQuery.readyWait++;
10005
		} else {
10006
			jQuery.ready( true );
10007
		}
10008
	},
10009
10010
	// Handle when the DOM is ready
10011
	ready: function( wait ) {
10012
10013
		// Abort if there are pending holds or we're already ready
10014
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
10015
			return;
10016
		}
10017
10018
		// Remember that the DOM is ready
10019
		jQuery.isReady = true;
10020
10021
		// If a normal DOM Ready event fired, decrement, and wait if need be
10022
		if ( wait !== true && --jQuery.readyWait > 0 ) {
10023
			return;
10024
		}
10025
10026
		// If there are functions bound, to execute
10027
		readyList.resolveWith( document, [ jQuery ] );
10028
10029
		// Trigger any bound ready events
10030
		if ( jQuery.fn.triggerHandler ) {
10031
			jQuery( document ).triggerHandler( "ready" );
10032
			jQuery( document ).off( "ready" );
10033
		}
10034
	}
10035
});
10036
10037
/**
10038
 * The ready event handler and self cleanup method
10039
 */
10040
function completed() {
10041
	document.removeEventListener( "DOMContentLoaded", completed, false );
10042
	window.removeEventListener( "load", completed, false );
10043
	jQuery.ready();
10044
}
10045
10046
jQuery.ready.promise = function( obj ) {
10047
	if ( !readyList ) {
10048
10049
		readyList = jQuery.Deferred();
10050
10051
		// Catch cases where $(document).ready() is called after the browser event has already occurred.
10052
		// We once tried to use readyState "interactive" here, but it caused issues like the one
10053
		// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
10054
		if ( document.readyState === "complete" ) {
10055
			// Handle it asynchronously to allow scripts the opportunity to delay ready
10056
			setTimeout( jQuery.ready );
10057
10058
		} else {
10059
10060
			// Use the handy event callback
10061
			document.addEventListener( "DOMContentLoaded", completed, false );
10062
10063
			// A fallback to window.onload, that will always work
10064
			window.addEventListener( "load", completed, false );
10065
		}
10066
	}
10067
	return readyList.promise( obj );
10068
};
10069
10070
// Kick off the DOM ready check even if the user does not
10071
jQuery.ready.promise();
10072
10073
10074
10075
10076
// Multifunctional method to get and set values of a collection
10077
// The value/s can optionally be executed if it's a function
10078
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
10079
	var i = 0,
10080
		len = elems.length,
10081
		bulk = key == null;
10082
10083
	// Sets many values
10084
	if ( jQuery.type( key ) === "object" ) {
10085
		chainable = true;
10086
		for ( i in key ) {
10087
			jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
10088
		}
10089
10090
	// Sets one value
10091
	} else if ( value !== undefined ) {
10092
		chainable = true;
10093
10094
		if ( !jQuery.isFunction( value ) ) {
10095
			raw = true;
10096
		}
10097
10098
		if ( bulk ) {
10099
			// Bulk operations run against the entire set
10100
			if ( raw ) {
10101
				fn.call( elems, value );
10102
				fn = null;
10103
10104
			// ...except when executing function values
10105
			} else {
10106
				bulk = fn;
10107
				fn = function( elem, key, value ) {
10108
					return bulk.call( jQuery( elem ), value );
10109
				};
10110
			}
10111
		}
10112
10113
		if ( fn ) {
10114
			for ( ; i < len; i++ ) {
10115
				fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
10116
			}
10117
		}
10118
	}
10119
10120
	return chainable ?
10121
		elems :
10122
10123
		// Gets
10124
		bulk ?
10125
			fn.call( elems ) :
10126
			len ? fn( elems[0], key ) : emptyGet;
10127
};
10128
10129
10130
/**
10131
 * Determines whether an object can have data
10132
 */
10133
jQuery.acceptData = function( owner ) {
10134
	// Accepts only:
10135
	//  - Node
10136
	//    - Node.ELEMENT_NODE
10137
	//    - Node.DOCUMENT_NODE
10138
	//  - Object
10139
	//    - Any
10140
	/* jshint -W018 */
10141
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
10142
};
10143
10144
10145
function Data() {
10146
	// Support: Android<4,
10147
	// Old WebKit does not have Object.preventExtensions/freeze method,
10148
	// return new empty object instead with no [[set]] accessor
10149
	Object.defineProperty( this.cache = {}, 0, {
10150
		get: function() {
10151
			return {};
10152
		}
10153
	});
10154
10155
	this.expando = jQuery.expando + Data.uid++;
10156
}
10157
10158
Data.uid = 1;
10159
Data.accepts = jQuery.acceptData;
10160
10161
Data.prototype = {
10162
	key: function( owner ) {
10163
		// We can accept data for non-element nodes in modern browsers,
10164
		// but we should not, see #8335.
10165
		// Always return the key for a frozen object.
10166
		if ( !Data.accepts( owner ) ) {
10167
			return 0;
10168
		}
10169
10170
		var descriptor = {},
10171
			// Check if the owner object already has a cache key
10172
			unlock = owner[ this.expando ];
10173
10174
		// If not, create one
10175
		if ( !unlock ) {
10176
			unlock = Data.uid++;
10177
10178
			// Secure it in a non-enumerable, non-writable property
10179
			try {
10180
				descriptor[ this.expando ] = { value: unlock };
10181
				Object.defineProperties( owner, descriptor );
10182
10183
			// Support: Android<4
10184
			// Fallback to a less secure definition
10185
			} catch ( e ) {
10186
				descriptor[ this.expando ] = unlock;
10187
				jQuery.extend( owner, descriptor );
10188
			}
10189
		}
10190
10191
		// Ensure the cache object
10192
		if ( !this.cache[ unlock ] ) {
10193
			this.cache[ unlock ] = {};
10194
		}
10195
10196
		return unlock;
10197
	},
10198
	set: function( owner, data, value ) {
10199
		var prop,
10200
			// There may be an unlock assigned to this node,
10201
			// if there is no entry for this "owner", create one inline
10202
			// and set the unlock as though an owner entry had always existed
10203
			unlock = this.key( owner ),
10204
			cache = this.cache[ unlock ];
10205
10206
		// Handle: [ owner, key, value ] args
10207
		if ( typeof data === "string" ) {
10208
			cache[ data ] = value;
10209
10210
		// Handle: [ owner, { properties } ] args
10211
		} else {
10212
			// Fresh assignments by object are shallow copied
10213
			if ( jQuery.isEmptyObject( cache ) ) {
10214
				jQuery.extend( this.cache[ unlock ], data );
10215
			// Otherwise, copy the properties one-by-one to the cache object
10216
			} else {
10217
				for ( prop in data ) {
10218
					cache[ prop ] = data[ prop ];
10219
				}
10220
			}
10221
		}
10222
		return cache;
10223
	},
10224
	get: function( owner, key ) {
10225
		// Either a valid cache is found, or will be created.
10226
		// New caches will be created and the unlock returned,
10227
		// allowing direct access to the newly created
10228
		// empty data object. A valid owner object must be provided.
10229
		var cache = this.cache[ this.key( owner ) ];
10230
10231
		return key === undefined ?
10232
			cache : cache[ key ];
10233
	},
10234
	access: function( owner, key, value ) {
10235
		var stored;
10236
		// In cases where either:
10237
		//
10238
		//   1. No key was specified
10239
		//   2. A string key was specified, but no value provided
10240
		//
10241
		// Take the "read" path and allow the get method to determine
10242
		// which value to return, respectively either:
10243
		//
10244
		//   1. The entire cache object
10245
		//   2. The data stored at the key
10246
		//
10247
		if ( key === undefined ||
10248
				((key && typeof key === "string") && value === undefined) ) {
10249
10250
			stored = this.get( owner, key );
10251
10252
			return stored !== undefined ?
10253
				stored : this.get( owner, jQuery.camelCase(key) );
10254
		}
10255
10256
		// [*]When the key is not a string, or both a key and value
10257
		// are specified, set or extend (existing objects) with either:
10258
		//
10259
		//   1. An object of properties
10260
		//   2. A key and value
10261
		//
10262
		this.set( owner, key, value );
10263
10264
		// Since the "set" path can have two possible entry points
10265
		// return the expected data based on which path was taken[*]
10266
		return value !== undefined ? value : key;
10267
	},
10268
	remove: function( owner, key ) {
10269
		var i, name, camel,
10270
			unlock = this.key( owner ),
10271
			cache = this.cache[ unlock ];
10272
10273
		if ( key === undefined ) {
10274
			this.cache[ unlock ] = {};
10275
10276
		} else {
10277
			// Support array or space separated string of keys
10278
			if ( jQuery.isArray( key ) ) {
10279
				// If "name" is an array of keys...
10280
				// When data is initially created, via ("key", "val") signature,
10281
				// keys will be converted to camelCase.
10282
				// Since there is no way to tell _how_ a key was added, remove
10283
				// both plain key and camelCase key. #12786
10284
				// This will only penalize the array argument path.
10285
				name = key.concat( key.map( jQuery.camelCase ) );
10286
			} else {
10287
				camel = jQuery.camelCase( key );
10288
				// Try the string as a key before any manipulation
10289
				if ( key in cache ) {
10290
					name = [ key, camel ];
10291
				} else {
10292
					// If a key with the spaces exists, use it.
10293
					// Otherwise, create an array by matching non-whitespace
10294
					name = camel;
10295
					name = name in cache ?
10296
						[ name ] : ( name.match( rnotwhite ) || [] );
10297
				}
10298
			}
10299
10300
			i = name.length;
10301
			while ( i-- ) {
10302
				delete cache[ name[ i ] ];
10303
			}
10304
		}
10305
	},
10306
	hasData: function( owner ) {
10307
		return !jQuery.isEmptyObject(
10308
			this.cache[ owner[ this.expando ] ] || {}
10309
		);
10310
	},
10311
	discard: function( owner ) {
10312
		if ( owner[ this.expando ] ) {
10313
			delete this.cache[ owner[ this.expando ] ];
10314
		}
10315
	}
10316
};
10317
var data_priv = new Data();
10318
10319
var data_user = new Data();
10320
10321
10322
10323
//	Implementation Summary
10324
//
10325
//	1. Enforce API surface and semantic compatibility with 1.9.x branch
10326
//	2. Improve the module's maintainability by reducing the storage
10327
//		paths to a single mechanism.
10328
//	3. Use the same single mechanism to support "private" and "user" data.
10329
//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
10330
//	5. Avoid exposing implementation details on user objects (eg. expando properties)
10331
//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
10332
10333
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
10334
	rmultiDash = /([A-Z])/g;
10335
10336
function dataAttr( elem, key, data ) {
10337
	var name;
10338
10339
	// If nothing was found internally, try to fetch any
10340
	// data from the HTML5 data-* attribute
10341
	if ( data === undefined && elem.nodeType === 1 ) {
10342
		name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
10343
		data = elem.getAttribute( name );
10344
10345
		if ( typeof data === "string" ) {
10346
			try {
10347
				data = data === "true" ? true :
10348
					data === "false" ? false :
10349
					data === "null" ? null :
10350
					// Only convert to a number if it doesn't change the string
10351
					+data + "" === data ? +data :
10352
					rbrace.test( data ) ? jQuery.parseJSON( data ) :
10353
					data;
10354
			} catch( e ) {}
10355
10356
			// Make sure we set the data so it isn't changed later
10357
			data_user.set( elem, key, data );
10358
		} else {
10359
			data = undefined;
10360
		}
10361
	}
10362
	return data;
10363
}
10364
10365
jQuery.extend({
10366
	hasData: function( elem ) {
10367
		return data_user.hasData( elem ) || data_priv.hasData( elem );
10368
	},
10369
10370
	data: function( elem, name, data ) {
10371
		return data_user.access( elem, name, data );
10372
	},
10373
10374
	removeData: function( elem, name ) {
10375
		data_user.remove( elem, name );
10376
	},
10377
10378
	// TODO: Now that all calls to _data and _removeData have been replaced
10379
	// with direct calls to data_priv methods, these can be deprecated.
10380
	_data: function( elem, name, data ) {
10381
		return data_priv.access( elem, name, data );
10382
	},
10383
10384
	_removeData: function( elem, name ) {
10385
		data_priv.remove( elem, name );
10386
	}
10387
});
10388
10389
jQuery.fn.extend({
10390
	data: function( key, value ) {
10391
		var i, name, data,
10392
			elem = this[ 0 ],
10393
			attrs = elem && elem.attributes;
10394
10395
		// Gets all values
10396
		if ( key === undefined ) {
10397
			if ( this.length ) {
10398
				data = data_user.get( elem );
10399
10400
				if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
10401
					i = attrs.length;
10402
					while ( i-- ) {
10403
10404
						// Support: IE11+
10405
						// The attrs elements can be null (#14894)
10406
						if ( attrs[ i ] ) {
10407
							name = attrs[ i ].name;
10408
							if ( name.indexOf( "data-" ) === 0 ) {
10409
								name = jQuery.camelCase( name.slice(5) );
10410
								dataAttr( elem, name, data[ name ] );
10411
							}
10412
						}
10413
					}
10414
					data_priv.set( elem, "hasDataAttrs", true );
10415
				}
10416
			}
10417
10418
			return data;
10419
		}
10420
10421
		// Sets multiple values
10422
		if ( typeof key === "object" ) {
10423
			return this.each(function() {
10424
				data_user.set( this, key );
10425
			});
10426
		}
10427
10428
		return access( this, function( value ) {
10429
			var data,
10430
				camelKey = jQuery.camelCase( key );
10431
10432
			// The calling jQuery object (element matches) is not empty
10433
			// (and therefore has an element appears at this[ 0 ]) and the
10434
			// `value` parameter was not undefined. An empty jQuery object
10435
			// will result in `undefined` for elem = this[ 0 ] which will
10436
			// throw an exception if an attempt to read a data cache is made.
10437
			if ( elem && value === undefined ) {
10438
				// Attempt to get data from the cache
10439
				// with the key as-is
10440
				data = data_user.get( elem, key );
10441
				if ( data !== undefined ) {
10442
					return data;
10443
				}
10444
10445
				// Attempt to get data from the cache
10446
				// with the key camelized
10447
				data = data_user.get( elem, camelKey );
10448
				if ( data !== undefined ) {
10449
					return data;
10450
				}
10451
10452
				// Attempt to "discover" the data in
10453
				// HTML5 custom data-* attrs
10454
				data = dataAttr( elem, camelKey, undefined );
10455
				if ( data !== undefined ) {
10456
					return data;
10457
				}
10458
10459
				// We tried really hard, but the data doesn't exist.
10460
				return;
10461
			}
10462
10463
			// Set the data...
10464
			this.each(function() {
10465
				// First, attempt to store a copy or reference of any
10466
				// data that might've been store with a camelCased key.
10467
				var data = data_user.get( this, camelKey );
10468
10469
				// For HTML5 data-* attribute interop, we have to
10470
				// store property names with dashes in a camelCase form.
10471
				// This might not apply to all properties...*
10472
				data_user.set( this, camelKey, value );
10473
10474
				// *... In the case of properties that might _actually_
10475
				// have dashes, we need to also store a copy of that
10476
				// unchanged property.
10477
				if ( key.indexOf("-") !== -1 && data !== undefined ) {
10478
					data_user.set( this, key, value );
10479
				}
10480
			});
10481
		}, null, value, arguments.length > 1, null, true );
10482
	},
10483
10484
	removeData: function( key ) {
10485
		return this.each(function() {
10486
			data_user.remove( this, key );
10487
		});
10488
	}
10489
});
10490
10491
10492
jQuery.extend({
10493
	queue: function( elem, type, data ) {
10494
		var queue;
10495
10496
		if ( elem ) {
10497
			type = ( type || "fx" ) + "queue";
10498
			queue = data_priv.get( elem, type );
10499
10500
			// Speed up dequeue by getting out quickly if this is just a lookup
10501
			if ( data ) {
10502
				if ( !queue || jQuery.isArray( data ) ) {
10503
					queue = data_priv.access( elem, type, jQuery.makeArray(data) );
10504
				} else {
10505
					queue.push( data );
10506
				}
10507
			}
10508
			return queue || [];
10509
		}
10510
	},
10511
10512
	dequeue: function( elem, type ) {
10513
		type = type || "fx";
10514
10515
		var queue = jQuery.queue( elem, type ),
10516
			startLength = queue.length,
10517
			fn = queue.shift(),
10518
			hooks = jQuery._queueHooks( elem, type ),
10519
			next = function() {
10520
				jQuery.dequeue( elem, type );
10521
			};
10522
10523
		// If the fx queue is dequeued, always remove the progress sentinel
10524
		if ( fn === "inprogress" ) {
10525
			fn = queue.shift();
10526
			startLength--;
10527
		}
10528
10529
		if ( fn ) {
10530
10531
			// Add a progress sentinel to prevent the fx queue from being
10532
			// automatically dequeued
10533
			if ( type === "fx" ) {
10534
				queue.unshift( "inprogress" );
10535
			}
10536
10537
			// Clear up the last queue stop function
10538
			delete hooks.stop;
10539
			fn.call( elem, next, hooks );
10540
		}
10541
10542
		if ( !startLength && hooks ) {
10543
			hooks.empty.fire();
10544
		}
10545
	},
10546
10547
	// Not public - generate a queueHooks object, or return the current one
10548
	_queueHooks: function( elem, type ) {
10549
		var key = type + "queueHooks";
10550
		return data_priv.get( elem, key ) || data_priv.access( elem, key, {
10551
			empty: jQuery.Callbacks("once memory").add(function() {
10552
				data_priv.remove( elem, [ type + "queue", key ] );
10553
			})
10554
		});
10555
	}
10556
});
10557
10558
jQuery.fn.extend({
10559
	queue: function( type, data ) {
10560
		var setter = 2;
10561
10562
		if ( typeof type !== "string" ) {
10563
			data = type;
10564
			type = "fx";
10565
			setter--;
10566
		}
10567
10568
		if ( arguments.length < setter ) {
10569
			return jQuery.queue( this[0], type );
10570
		}
10571
10572
		return data === undefined ?
10573
			this :
10574
			this.each(function() {
10575
				var queue = jQuery.queue( this, type, data );
10576
10577
				// Ensure a hooks for this queue
10578
				jQuery._queueHooks( this, type );
10579
10580
				if ( type === "fx" && queue[0] !== "inprogress" ) {
10581
					jQuery.dequeue( this, type );
10582
				}
10583
			});
10584
	},
10585
	dequeue: function( type ) {
10586
		return this.each(function() {
10587
			jQuery.dequeue( this, type );
10588
		});
10589
	},
10590
	clearQueue: function( type ) {
10591
		return this.queue( type || "fx", [] );
10592
	},
10593
	// Get a promise resolved when queues of a certain type
10594
	// are emptied (fx is the type by default)
10595
	promise: function( type, obj ) {
10596
		var tmp,
10597
			count = 1,
10598
			defer = jQuery.Deferred(),
10599
			elements = this,
10600
			i = this.length,
10601
			resolve = function() {
10602
				if ( !( --count ) ) {
10603
					defer.resolveWith( elements, [ elements ] );
10604
				}
10605
			};
10606
10607
		if ( typeof type !== "string" ) {
10608
			obj = type;
10609
			type = undefined;
10610
		}
10611
		type = type || "fx";
10612
10613
		while ( i-- ) {
10614
			tmp = data_priv.get( elements[ i ], type + "queueHooks" );
10615
			if ( tmp && tmp.empty ) {
10616
				count++;
10617
				tmp.empty.add( resolve );
10618
			}
10619
		}
10620
		resolve();
10621
		return defer.promise( obj );
10622
	}
10623
});
10624
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
10625
10626
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
10627
10628
var isHidden = function( elem, el ) {
10629
		// isHidden might be called from jQuery#filter function;
10630
		// in that case, element will be second argument
10631
		elem = el || elem;
10632
		return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
10633
	};
10634
10635
var rcheckableType = (/^(?:checkbox|radio)$/i);
10636
10637
10638
10639
(function() {
10640
	var fragment = document.createDocumentFragment(),
10641
		div = fragment.appendChild( document.createElement( "div" ) ),
10642
		input = document.createElement( "input" );
10643
10644
	// Support: Safari<=5.1
10645
	// Check state lost if the name is set (#11217)
10646
	// Support: Windows Web Apps (WWA)
10647
	// `name` and `type` must use .setAttribute for WWA (#14901)
10648
	input.setAttribute( "type", "radio" );
10649
	input.setAttribute( "checked", "checked" );
10650
	input.setAttribute( "name", "t" );
10651
10652
	div.appendChild( input );
10653
10654
	// Support: Safari<=5.1, Android<4.2
10655
	// Older WebKit doesn't clone checked state correctly in fragments
10656
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
10657
10658
	// Support: IE<=11+
10659
	// Make sure textarea (and checkbox) defaultValue is properly cloned
10660
	div.innerHTML = "<textarea>x</textarea>";
10661
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
10662
})();
10663
var strundefined = typeof undefined;
10664
10665
10666
10667
support.focusinBubbles = "onfocusin" in window;
10668
10669
10670
var
10671
	rkeyEvent = /^key/,
10672
	rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
10673
	rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
10674
	rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
10675
10676
function returnTrue() {
10677
	return true;
10678
}
10679
10680
function returnFalse() {
10681
	return false;
10682
}
10683
10684
function safeActiveElement() {
10685
	try {
10686
		return document.activeElement;
10687
	} catch ( err ) { }
10688
}
10689
10690
/*
10691
 * Helper functions for managing events -- not part of the public interface.
10692
 * Props to Dean Edwards' addEvent library for many of the ideas.
10693
 */
10694
jQuery.event = {
10695
10696
	global: {},
10697
10698
	add: function( elem, types, handler, data, selector ) {
10699
10700
		var handleObjIn, eventHandle, tmp,
10701
			events, t, handleObj,
10702
			special, handlers, type, namespaces, origType,
10703
			elemData = data_priv.get( elem );
10704
10705
		// Don't attach events to noData or text/comment nodes (but allow plain objects)
10706
		if ( !elemData ) {
10707
			return;
10708
		}
10709
10710
		// Caller can pass in an object of custom data in lieu of the handler
10711
		if ( handler.handler ) {
10712
			handleObjIn = handler;
10713
			handler = handleObjIn.handler;
10714
			selector = handleObjIn.selector;
10715
		}
10716
10717
		// Make sure that the handler has a unique ID, used to find/remove it later
10718
		if ( !handler.guid ) {
10719
			handler.guid = jQuery.guid++;
10720
		}
10721
10722
		// Init the element's event structure and main handler, if this is the first
10723
		if ( !(events = elemData.events) ) {
10724
			events = elemData.events = {};
10725
		}
10726
		if ( !(eventHandle = elemData.handle) ) {
10727
			eventHandle = elemData.handle = function( e ) {
10728
				// Discard the second event of a jQuery.event.trigger() and
10729
				// when an event is called after a page has unloaded
10730
				return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
10731
					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
10732
			};
10733
		}
10734
10735
		// Handle multiple events separated by a space
10736
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
10737
		t = types.length;
10738
		while ( t-- ) {
10739
			tmp = rtypenamespace.exec( types[t] ) || [];
10740
			type = origType = tmp[1];
10741
			namespaces = ( tmp[2] || "" ).split( "." ).sort();
10742
10743
			// There *must* be a type, no attaching namespace-only handlers
10744
			if ( !type ) {
10745
				continue;
10746
			}
10747
10748
			// If event changes its type, use the special event handlers for the changed type
10749
			special = jQuery.event.special[ type ] || {};
10750
10751
			// If selector defined, determine special event api type, otherwise given type
10752
			type = ( selector ? special.delegateType : special.bindType ) || type;
10753
10754
			// Update special based on newly reset type
10755
			special = jQuery.event.special[ type ] || {};
10756
10757
			// handleObj is passed to all event handlers
10758
			handleObj = jQuery.extend({
10759
				type: type,
10760
				origType: origType,
10761
				data: data,
10762
				handler: handler,
10763
				guid: handler.guid,
10764
				selector: selector,
10765
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
10766
				namespace: namespaces.join(".")
10767
			}, handleObjIn );
10768
10769
			// Init the event handler queue if we're the first
10770
			if ( !(handlers = events[ type ]) ) {
10771
				handlers = events[ type ] = [];
10772
				handlers.delegateCount = 0;
10773
10774
				// Only use addEventListener if the special events handler returns false
10775
				if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
10776
					if ( elem.addEventListener ) {
10777
						elem.addEventListener( type, eventHandle, false );
10778
					}
10779
				}
10780
			}
10781
10782
			if ( special.add ) {
10783
				special.add.call( elem, handleObj );
10784
10785
				if ( !handleObj.handler.guid ) {
10786
					handleObj.handler.guid = handler.guid;
10787
				}
10788
			}
10789
10790
			// Add to the element's handler list, delegates in front
10791
			if ( selector ) {
10792
				handlers.splice( handlers.delegateCount++, 0, handleObj );
10793
			} else {
10794
				handlers.push( handleObj );
10795
			}
10796
10797
			// Keep track of which events have ever been used, for event optimization
10798
			jQuery.event.global[ type ] = true;
10799
		}
10800
10801
	},
10802
10803
	// Detach an event or set of events from an element
10804
	remove: function( elem, types, handler, selector, mappedTypes ) {
10805
10806
		var j, origCount, tmp,
10807
			events, t, handleObj,
10808
			special, handlers, type, namespaces, origType,
10809
			elemData = data_priv.hasData( elem ) && data_priv.get( elem );
10810
10811
		if ( !elemData || !(events = elemData.events) ) {
10812
			return;
10813
		}
10814
10815
		// Once for each type.namespace in types; type may be omitted
10816
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
10817
		t = types.length;
10818
		while ( t-- ) {
10819
			tmp = rtypenamespace.exec( types[t] ) || [];
10820
			type = origType = tmp[1];
10821
			namespaces = ( tmp[2] || "" ).split( "." ).sort();
10822
10823
			// Unbind all events (on this namespace, if provided) for the element
10824
			if ( !type ) {
10825
				for ( type in events ) {
10826
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
10827
				}
10828
				continue;
10829
			}
10830
10831
			special = jQuery.event.special[ type ] || {};
10832
			type = ( selector ? special.delegateType : special.bindType ) || type;
10833
			handlers = events[ type ] || [];
10834
			tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
10835
10836
			// Remove matching events
10837
			origCount = j = handlers.length;
10838
			while ( j-- ) {
10839
				handleObj = handlers[ j ];
10840
10841
				if ( ( mappedTypes || origType === handleObj.origType ) &&
10842
					( !handler || handler.guid === handleObj.guid ) &&
10843
					( !tmp || tmp.test( handleObj.namespace ) ) &&
10844
					( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
10845
					handlers.splice( j, 1 );
10846
10847
					if ( handleObj.selector ) {
10848
						handlers.delegateCount--;
10849
					}
10850
					if ( special.remove ) {
10851
						special.remove.call( elem, handleObj );
10852
					}
10853
				}
10854
			}
10855
10856
			// Remove generic event handler if we removed something and no more handlers exist
10857
			// (avoids potential for endless recursion during removal of special event handlers)
10858
			if ( origCount && !handlers.length ) {
10859
				if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
10860
					jQuery.removeEvent( elem, type, elemData.handle );
10861
				}
10862
10863
				delete events[ type ];
10864
			}
10865
		}
10866
10867
		// Remove the expando if it's no longer used
10868
		if ( jQuery.isEmptyObject( events ) ) {
10869
			delete elemData.handle;
10870
			data_priv.remove( elem, "events" );
10871
		}
10872
	},
10873
10874
	trigger: function( event, data, elem, onlyHandlers ) {
10875
10876
		var i, cur, tmp, bubbleType, ontype, handle, special,
10877
			eventPath = [ elem || document ],
10878
			type = hasOwn.call( event, "type" ) ? event.type : event,
10879
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
10880
10881
		cur = tmp = elem = elem || document;
10882
10883
		// Don't do events on text and comment nodes
10884
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
10885
			return;
10886
		}
10887
10888
		// focus/blur morphs to focusin/out; ensure we're not firing them right now
10889
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
10890
			return;
10891
		}
10892
10893
		if ( type.indexOf(".") >= 0 ) {
10894
			// Namespaced trigger; create a regexp to match event type in handle()
10895
			namespaces = type.split(".");
10896
			type = namespaces.shift();
10897
			namespaces.sort();
10898
		}
10899
		ontype = type.indexOf(":") < 0 && "on" + type;
10900
10901
		// Caller can pass in a jQuery.Event object, Object, or just an event type string
10902
		event = event[ jQuery.expando ] ?
10903
			event :
10904
			new jQuery.Event( type, typeof event === "object" && event );
10905
10906
		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
10907
		event.isTrigger = onlyHandlers ? 2 : 3;
10908
		event.namespace = namespaces.join(".");
10909
		event.namespace_re = event.namespace ?
10910
			new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
10911
			null;
10912
10913
		// Clean up the event in case it is being reused
10914
		event.result = undefined;
10915
		if ( !event.target ) {
10916
			event.target = elem;
10917
		}
10918
10919
		// Clone any incoming data and prepend the event, creating the handler arg list
10920
		data = data == null ?
10921
			[ event ] :
10922
			jQuery.makeArray( data, [ event ] );
10923
10924
		// Allow special events to draw outside the lines
10925
		special = jQuery.event.special[ type ] || {};
10926
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
10927
			return;
10928
		}
10929
10930
		// Determine event propagation path in advance, per W3C events spec (#9951)
10931
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
10932
		if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
10933
10934
			bubbleType = special.delegateType || type;
10935
			if ( !rfocusMorph.test( bubbleType + type ) ) {
10936
				cur = cur.parentNode;
10937
			}
10938
			for ( ; cur; cur = cur.parentNode ) {
10939
				eventPath.push( cur );
10940
				tmp = cur;
10941
			}
10942
10943
			// Only add window if we got to document (e.g., not plain obj or detached DOM)
10944
			if ( tmp === (elem.ownerDocument || document) ) {
10945
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
10946
			}
10947
		}
10948
10949
		// Fire handlers on the event path
10950
		i = 0;
10951
		while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
10952
10953
			event.type = i > 1 ?
10954
				bubbleType :
10955
				special.bindType || type;
10956
10957
			// jQuery handler
10958
			handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
10959
			if ( handle ) {
10960
				handle.apply( cur, data );
10961
			}
10962
10963
			// Native handler
10964
			handle = ontype && cur[ ontype ];
10965
			if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
10966
				event.result = handle.apply( cur, data );
10967
				if ( event.result === false ) {
10968
					event.preventDefault();
10969
				}
10970
			}
10971
		}
10972
		event.type = type;
10973
10974
		// If nobody prevented the default action, do it now
10975
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
10976
10977
			if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
10978
				jQuery.acceptData( elem ) ) {
10979
10980
				// Call a native DOM method on the target with the same name name as the event.
10981
				// Don't do default actions on window, that's where global variables be (#6170)
10982
				if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
10983
10984
					// Don't re-trigger an onFOO event when we call its FOO() method
10985
					tmp = elem[ ontype ];
10986
10987
					if ( tmp ) {
10988
						elem[ ontype ] = null;
10989
					}
10990
10991
					// Prevent re-triggering of the same event, since we already bubbled it above
10992
					jQuery.event.triggered = type;
10993
					elem[ type ]();
10994
					jQuery.event.triggered = undefined;
10995
10996
					if ( tmp ) {
10997
						elem[ ontype ] = tmp;
10998
					}
10999
				}
11000
			}
11001
		}
11002
11003
		return event.result;
11004
	},
11005
11006
	dispatch: function( event ) {
11007
11008
		// Make a writable jQuery.Event from the native event object
11009
		event = jQuery.event.fix( event );
11010
11011
		var i, j, ret, matched, handleObj,
11012
			handlerQueue = [],
11013
			args = slice.call( arguments ),
11014
			handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
11015
			special = jQuery.event.special[ event.type ] || {};
11016
11017
		// Use the fix-ed jQuery.Event rather than the (read-only) native event
11018
		args[0] = event;
11019
		event.delegateTarget = this;
11020
11021
		// Call the preDispatch hook for the mapped type, and let it bail if desired
11022
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
11023
			return;
11024
		}
11025
11026
		// Determine handlers
11027
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
11028
11029
		// Run delegates first; they may want to stop propagation beneath us
11030
		i = 0;
11031
		while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
11032
			event.currentTarget = matched.elem;
11033
11034
			j = 0;
11035
			while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
11036
11037
				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
11038
				// a subset or equal to those in the bound event (both can have no namespace).
11039
				if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
11040
11041
					event.handleObj = handleObj;
11042
					event.data = handleObj.data;
11043
11044
					ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
11045
							.apply( matched.elem, args );
11046
11047
					if ( ret !== undefined ) {
11048
						if ( (event.result = ret) === false ) {
11049
							event.preventDefault();
11050
							event.stopPropagation();
11051
						}
11052
					}
11053
				}
11054
			}
11055
		}
11056
11057
		// Call the postDispatch hook for the mapped type
11058
		if ( special.postDispatch ) {
11059
			special.postDispatch.call( this, event );
11060
		}
11061
11062
		return event.result;
11063
	},
11064
11065
	handlers: function( event, handlers ) {
11066
		var i, matches, sel, handleObj,
11067
			handlerQueue = [],
11068
			delegateCount = handlers.delegateCount,
11069
			cur = event.target;
11070
11071
		// Find delegate handlers
11072
		// Black-hole SVG <use> instance trees (#13180)
11073
		// Avoid non-left-click bubbling in Firefox (#3861)
11074
		if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
11075
11076
			for ( ; cur !== this; cur = cur.parentNode || this ) {
11077
11078
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
11079
				if ( cur.disabled !== true || event.type !== "click" ) {
11080
					matches = [];
11081
					for ( i = 0; i < delegateCount; i++ ) {
11082
						handleObj = handlers[ i ];
11083
11084
						// Don't conflict with Object.prototype properties (#13203)
11085
						sel = handleObj.selector + " ";
11086
11087
						if ( matches[ sel ] === undefined ) {
11088
							matches[ sel ] = handleObj.needsContext ?
11089
								jQuery( sel, this ).index( cur ) >= 0 :
11090
								jQuery.find( sel, this, null, [ cur ] ).length;
11091
						}
11092
						if ( matches[ sel ] ) {
11093
							matches.push( handleObj );
11094
						}
11095
					}
11096
					if ( matches.length ) {
11097
						handlerQueue.push({ elem: cur, handlers: matches });
11098
					}
11099
				}
11100
			}
11101
		}
11102
11103
		// Add the remaining (directly-bound) handlers
11104
		if ( delegateCount < handlers.length ) {
11105
			handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
11106
		}
11107
11108
		return handlerQueue;
11109
	},
11110
11111
	// Includes some event props shared by KeyEvent and MouseEvent
11112
	props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
11113
11114
	fixHooks: {},
11115
11116
	keyHooks: {
11117
		props: "char charCode key keyCode".split(" "),
11118
		filter: function( event, original ) {
11119
11120
			// Add which for key events
11121
			if ( event.which == null ) {
11122
				event.which = original.charCode != null ? original.charCode : original.keyCode;
11123
			}
11124
11125
			return event;
11126
		}
11127
	},
11128
11129
	mouseHooks: {
11130
		props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
11131
		filter: function( event, original ) {
11132
			var eventDoc, doc, body,
11133
				button = original.button;
11134
11135
			// Calculate pageX/Y if missing and clientX/Y available
11136
			if ( event.pageX == null && original.clientX != null ) {
11137
				eventDoc = event.target.ownerDocument || document;
11138
				doc = eventDoc.documentElement;
11139
				body = eventDoc.body;
11140
11141
				event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
11142
				event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
11143
			}
11144
11145
			// Add which for click: 1 === left; 2 === middle; 3 === right
11146
			// Note: button is not normalized, so don't use it
11147
			if ( !event.which && button !== undefined ) {
11148
				event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
11149
			}
11150
11151
			return event;
11152
		}
11153
	},
11154
11155
	fix: function( event ) {
11156
		if ( event[ jQuery.expando ] ) {
11157
			return event;
11158
		}
11159
11160
		// Create a writable copy of the event object and normalize some properties
11161
		var i, prop, copy,
11162
			type = event.type,
11163
			originalEvent = event,
11164
			fixHook = this.fixHooks[ type ];
11165
11166
		if ( !fixHook ) {
11167
			this.fixHooks[ type ] = fixHook =
11168
				rmouseEvent.test( type ) ? this.mouseHooks :
11169
				rkeyEvent.test( type ) ? this.keyHooks :
11170
				{};
11171
		}
11172
		copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
11173
11174
		event = new jQuery.Event( originalEvent );
11175
11176
		i = copy.length;
11177
		while ( i-- ) {
11178
			prop = copy[ i ];
11179
			event[ prop ] = originalEvent[ prop ];
11180
		}
11181
11182
		// Support: Cordova 2.5 (WebKit) (#13255)
11183
		// All events should have a target; Cordova deviceready doesn't
11184
		if ( !event.target ) {
11185
			event.target = document;
11186
		}
11187
11188
		// Support: Safari 6.0+, Chrome<28
11189
		// Target should not be a text node (#504, #13143)
11190
		if ( event.target.nodeType === 3 ) {
11191
			event.target = event.target.parentNode;
11192
		}
11193
11194
		return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
11195
	},
11196
11197
	special: {
11198
		load: {
11199
			// Prevent triggered image.load events from bubbling to window.load
11200
			noBubble: true
11201
		},
11202
		focus: {
11203
			// Fire native event if possible so blur/focus sequence is correct
11204
			trigger: function() {
11205
				if ( this !== safeActiveElement() && this.focus ) {
11206
					this.focus();
11207
					return false;
11208
				}
11209
			},
11210
			delegateType: "focusin"
11211
		},
11212
		blur: {
11213
			trigger: function() {
11214
				if ( this === safeActiveElement() && this.blur ) {
11215
					this.blur();
11216
					return false;
11217
				}
11218
			},
11219
			delegateType: "focusout"
11220
		},
11221
		click: {
11222
			// For checkbox, fire native event so checked state will be right
11223
			trigger: function() {
11224
				if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
11225
					this.click();
11226
					return false;
11227
				}
11228
			},
11229
11230
			// For cross-browser consistency, don't fire native .click() on links
11231
			_default: function( event ) {
11232
				return jQuery.nodeName( event.target, "a" );
11233
			}
11234
		},
11235
11236
		beforeunload: {
11237
			postDispatch: function( event ) {
11238
11239
				// Support: Firefox 20+
11240
				// Firefox doesn't alert if the returnValue field is not set.
11241
				if ( event.result !== undefined && event.originalEvent ) {
11242
					event.originalEvent.returnValue = event.result;
11243
				}
11244
			}
11245
		}
11246
	},
11247
11248
	simulate: function( type, elem, event, bubble ) {
11249
		// Piggyback on a donor event to simulate a different one.
11250
		// Fake originalEvent to avoid donor's stopPropagation, but if the
11251
		// simulated event prevents default then we do the same on the donor.
11252
		var e = jQuery.extend(
11253
			new jQuery.Event(),
11254
			event,
11255
			{
11256
				type: type,
11257
				isSimulated: true,
11258
				originalEvent: {}
11259
			}
11260
		);
11261
		if ( bubble ) {
11262
			jQuery.event.trigger( e, null, elem );
11263
		} else {
11264
			jQuery.event.dispatch.call( elem, e );
11265
		}
11266
		if ( e.isDefaultPrevented() ) {
11267
			event.preventDefault();
11268
		}
11269
	}
11270
};
11271
11272
jQuery.removeEvent = function( elem, type, handle ) {
11273
	if ( elem.removeEventListener ) {
11274
		elem.removeEventListener( type, handle, false );
11275
	}
11276
};
11277
11278
jQuery.Event = function( src, props ) {
11279
	// Allow instantiation without the 'new' keyword
11280
	if ( !(this instanceof jQuery.Event) ) {
11281
		return new jQuery.Event( src, props );
11282
	}
11283
11284
	// Event object
11285
	if ( src && src.type ) {
11286
		this.originalEvent = src;
11287
		this.type = src.type;
11288
11289
		// Events bubbling up the document may have been marked as prevented
11290
		// by a handler lower down the tree; reflect the correct value.
11291
		this.isDefaultPrevented = src.defaultPrevented ||
11292
				src.defaultPrevented === undefined &&
11293
				// Support: Android<4.0
11294
				src.returnValue === false ?
11295
			returnTrue :
11296
			returnFalse;
11297
11298
	// Event type
11299
	} else {
11300
		this.type = src;
11301
	}
11302
11303
	// Put explicitly provided properties onto the event object
11304
	if ( props ) {
11305
		jQuery.extend( this, props );
11306
	}
11307
11308
	// Create a timestamp if incoming event doesn't have one
11309
	this.timeStamp = src && src.timeStamp || jQuery.now();
11310
11311
	// Mark it as fixed
11312
	this[ jQuery.expando ] = true;
11313
};
11314
11315
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
11316
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
11317
jQuery.Event.prototype = {
11318
	isDefaultPrevented: returnFalse,
11319
	isPropagationStopped: returnFalse,
11320
	isImmediatePropagationStopped: returnFalse,
11321
11322
	preventDefault: function() {
11323
		var e = this.originalEvent;
11324
11325
		this.isDefaultPrevented = returnTrue;
11326
11327
		if ( e && e.preventDefault ) {
11328
			e.preventDefault();
11329
		}
11330
	},
11331
	stopPropagation: function() {
11332
		var e = this.originalEvent;
11333
11334
		this.isPropagationStopped = returnTrue;
11335
11336
		if ( e && e.stopPropagation ) {
11337
			e.stopPropagation();
11338
		}
11339
	},
11340
	stopImmediatePropagation: function() {
11341
		var e = this.originalEvent;
11342
11343
		this.isImmediatePropagationStopped = returnTrue;
11344
11345
		if ( e && e.stopImmediatePropagation ) {
11346
			e.stopImmediatePropagation();
11347
		}
11348
11349
		this.stopPropagation();
11350
	}
11351
};
11352
11353
// Create mouseenter/leave events using mouseover/out and event-time checks
11354
// Support: Chrome 15+
11355
jQuery.each({
11356
	mouseenter: "mouseover",
11357
	mouseleave: "mouseout",
11358
	pointerenter: "pointerover",
11359
	pointerleave: "pointerout"
11360
}, function( orig, fix ) {
11361
	jQuery.event.special[ orig ] = {
11362
		delegateType: fix,
11363
		bindType: fix,
11364
11365
		handle: function( event ) {
11366
			var ret,
11367
				target = this,
11368
				related = event.relatedTarget,
11369
				handleObj = event.handleObj;
11370
11371
			// For mousenter/leave call the handler if related is outside the target.
11372
			// NB: No relatedTarget if the mouse left/entered the browser window
11373
			if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
11374
				event.type = handleObj.origType;
11375
				ret = handleObj.handler.apply( this, arguments );
11376
				event.type = fix;
11377
			}
11378
			return ret;
11379
		}
11380
	};
11381
});
11382
11383
// Support: Firefox, Chrome, Safari
11384
// Create "bubbling" focus and blur events
11385
if ( !support.focusinBubbles ) {
11386
	jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
11387
11388
		// Attach a single capturing handler on the document while someone wants focusin/focusout
11389
		var handler = function( event ) {
11390
				jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
11391
			};
11392
11393
		jQuery.event.special[ fix ] = {
11394
			setup: function() {
11395
				var doc = this.ownerDocument || this,
11396
					attaches = data_priv.access( doc, fix );
11397
11398
				if ( !attaches ) {
11399
					doc.addEventListener( orig, handler, true );
11400
				}
11401
				data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
11402
			},
11403
			teardown: function() {
11404
				var doc = this.ownerDocument || this,
11405
					attaches = data_priv.access( doc, fix ) - 1;
11406
11407
				if ( !attaches ) {
11408
					doc.removeEventListener( orig, handler, true );
11409
					data_priv.remove( doc, fix );
11410
11411
				} else {
11412
					data_priv.access( doc, fix, attaches );
11413
				}
11414
			}
11415
		};
11416
	});
11417
}
11418
11419
jQuery.fn.extend({
11420
11421
	on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
11422
		var origFn, type;
11423
11424
		// Types can be a map of types/handlers
11425
		if ( typeof types === "object" ) {
11426
			// ( types-Object, selector, data )
11427
			if ( typeof selector !== "string" ) {
11428
				// ( types-Object, data )
11429
				data = data || selector;
11430
				selector = undefined;
11431
			}
11432
			for ( type in types ) {
11433
				this.on( type, selector, data, types[ type ], one );
11434
			}
11435
			return this;
11436
		}
11437
11438
		if ( data == null && fn == null ) {
11439
			// ( types, fn )
11440
			fn = selector;
11441
			data = selector = undefined;
11442
		} else if ( fn == null ) {
11443
			if ( typeof selector === "string" ) {
11444
				// ( types, selector, fn )
11445
				fn = data;
11446
				data = undefined;
11447
			} else {
11448
				// ( types, data, fn )
11449
				fn = data;
11450
				data = selector;
11451
				selector = undefined;
11452
			}
11453
		}
11454
		if ( fn === false ) {
11455
			fn = returnFalse;
11456
		} else if ( !fn ) {
11457
			return this;
11458
		}
11459
11460
		if ( one === 1 ) {
11461
			origFn = fn;
11462
			fn = function( event ) {
11463
				// Can use an empty set, since event contains the info
11464
				jQuery().off( event );
11465
				return origFn.apply( this, arguments );
11466
			};
11467
			// Use same guid so caller can remove using origFn
11468
			fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
11469
		}
11470
		return this.each( function() {
11471
			jQuery.event.add( this, types, fn, data, selector );
11472
		});
11473
	},
11474
	one: function( types, selector, data, fn ) {
11475
		return this.on( types, selector, data, fn, 1 );
11476
	},
11477
	off: function( types, selector, fn ) {
11478
		var handleObj, type;
11479
		if ( types && types.preventDefault && types.handleObj ) {
11480
			// ( event )  dispatched jQuery.Event
11481
			handleObj = types.handleObj;
11482
			jQuery( types.delegateTarget ).off(
11483
				handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
11484
				handleObj.selector,
11485
				handleObj.handler
11486
			);
11487
			return this;
11488
		}
11489
		if ( typeof types === "object" ) {
11490
			// ( types-object [, selector] )
11491
			for ( type in types ) {
11492
				this.off( type, selector, types[ type ] );
11493
			}
11494
			return this;
11495
		}
11496
		if ( selector === false || typeof selector === "function" ) {
11497
			// ( types [, fn] )
11498
			fn = selector;
11499
			selector = undefined;
11500
		}
11501
		if ( fn === false ) {
11502
			fn = returnFalse;
11503
		}
11504
		return this.each(function() {
11505
			jQuery.event.remove( this, types, fn, selector );
11506
		});
11507
	},
11508
11509
	trigger: function( type, data ) {
11510
		return this.each(function() {
11511
			jQuery.event.trigger( type, data, this );
11512
		});
11513
	},
11514
	triggerHandler: function( type, data ) {
11515
		var elem = this[0];
11516
		if ( elem ) {
11517
			return jQuery.event.trigger( type, data, elem, true );
11518
		}
11519
	}
11520
});
11521
11522
11523
var
11524
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
11525
	rtagName = /<([\w:]+)/,
11526
	rhtml = /<|&#?\w+;/,
11527
	rnoInnerhtml = /<(?:script|style|link)/i,
11528
	// checked="checked" or checked
11529
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
11530
	rscriptType = /^$|\/(?:java|ecma)script/i,
11531
	rscriptTypeMasked = /^true\/(.*)/,
11532
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
11533
11534
	// We have to close these tags to support XHTML (#13200)
11535
	wrapMap = {
11536
11537
		// Support: IE9
11538
		option: [ 1, "<select multiple='multiple'>", "</select>" ],
11539
11540
		thead: [ 1, "<table>", "</table>" ],
11541
		col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
11542
		tr: [ 2, "<table><tbody>", "</tbody></table>" ],
11543
		td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
11544
11545
		_default: [ 0, "", "" ]
11546
	};
11547
11548
// Support: IE9
11549
wrapMap.optgroup = wrapMap.option;
11550
11551
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
11552
wrapMap.th = wrapMap.td;
11553
11554
// Support: 1.x compatibility
11555
// Manipulating tables requires a tbody
11556
function manipulationTarget( elem, content ) {
11557
	return jQuery.nodeName( elem, "table" ) &&
11558
		jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
11559
11560
		elem.getElementsByTagName("tbody")[0] ||
11561
			elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
11562
		elem;
11563
}
11564
11565
// Replace/restore the type attribute of script elements for safe DOM manipulation
11566
function disableScript( elem ) {
11567
	elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
11568
	return elem;
11569
}
11570
function restoreScript( elem ) {
11571
	var match = rscriptTypeMasked.exec( elem.type );
11572
11573
	if ( match ) {
11574
		elem.type = match[ 1 ];
11575
	} else {
11576
		elem.removeAttribute("type");
11577
	}
11578
11579
	return elem;
11580
}
11581
11582
// Mark scripts as having already been evaluated
11583
function setGlobalEval( elems, refElements ) {
11584
	var i = 0,
11585
		l = elems.length;
11586
11587
	for ( ; i < l; i++ ) {
11588
		data_priv.set(
11589
			elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
11590
		);
11591
	}
11592
}
11593
11594
function cloneCopyEvent( src, dest ) {
11595
	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
11596
11597
	if ( dest.nodeType !== 1 ) {
11598
		return;
11599
	}
11600
11601
	// 1. Copy private data: events, handlers, etc.
11602
	if ( data_priv.hasData( src ) ) {
11603
		pdataOld = data_priv.access( src );
11604
		pdataCur = data_priv.set( dest, pdataOld );
11605
		events = pdataOld.events;
11606
11607
		if ( events ) {
11608
			delete pdataCur.handle;
11609
			pdataCur.events = {};
11610
11611
			for ( type in events ) {
11612
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
11613
					jQuery.event.add( dest, type, events[ type ][ i ] );
11614
				}
11615
			}
11616
		}
11617
	}
11618
11619
	// 2. Copy user data
11620
	if ( data_user.hasData( src ) ) {
11621
		udataOld = data_user.access( src );
11622
		udataCur = jQuery.extend( {}, udataOld );
11623
11624
		data_user.set( dest, udataCur );
11625
	}
11626
}
11627
11628
function getAll( context, tag ) {
11629
	var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
11630
			context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
11631
			[];
11632
11633
	return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
11634
		jQuery.merge( [ context ], ret ) :
11635
		ret;
11636
}
11637
11638
// Fix IE bugs, see support tests
11639
function fixInput( src, dest ) {
11640
	var nodeName = dest.nodeName.toLowerCase();
11641
11642
	// Fails to persist the checked state of a cloned checkbox or radio button.
11643
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
11644
		dest.checked = src.checked;
11645
11646
	// Fails to return the selected option to the default selected state when cloning options
11647
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
11648
		dest.defaultValue = src.defaultValue;
11649
	}
11650
}
11651
11652
jQuery.extend({
11653
	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
11654
		var i, l, srcElements, destElements,
11655
			clone = elem.cloneNode( true ),
11656
			inPage = jQuery.contains( elem.ownerDocument, elem );
11657
11658
		// Fix IE cloning issues
11659
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
11660
				!jQuery.isXMLDoc( elem ) ) {
11661
11662
			// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
11663
			destElements = getAll( clone );
11664
			srcElements = getAll( elem );
11665
11666
			for ( i = 0, l = srcElements.length; i < l; i++ ) {
11667
				fixInput( srcElements[ i ], destElements[ i ] );
11668
			}
11669
		}
11670
11671
		// Copy the events from the original to the clone
11672
		if ( dataAndEvents ) {
11673
			if ( deepDataAndEvents ) {
11674
				srcElements = srcElements || getAll( elem );
11675
				destElements = destElements || getAll( clone );
11676
11677
				for ( i = 0, l = srcElements.length; i < l; i++ ) {
11678
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
11679
				}
11680
			} else {
11681
				cloneCopyEvent( elem, clone );
11682
			}
11683
		}
11684
11685
		// Preserve script evaluation history
11686
		destElements = getAll( clone, "script" );
11687
		if ( destElements.length > 0 ) {
11688
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
11689
		}
11690
11691
		// Return the cloned set
11692
		return clone;
11693
	},
11694
11695
	buildFragment: function( elems, context, scripts, selection ) {
11696
		var elem, tmp, tag, wrap, contains, j,
11697
			fragment = context.createDocumentFragment(),
11698
			nodes = [],
11699
			i = 0,
11700
			l = elems.length;
11701
11702
		for ( ; i < l; i++ ) {
11703
			elem = elems[ i ];
11704
11705
			if ( elem || elem === 0 ) {
11706
11707
				// Add nodes directly
11708
				if ( jQuery.type( elem ) === "object" ) {
11709
					// Support: QtWebKit, PhantomJS
11710
					// push.apply(_, arraylike) throws on ancient WebKit
11711
					jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
11712
11713
				// Convert non-html into a text node
11714
				} else if ( !rhtml.test( elem ) ) {
11715
					nodes.push( context.createTextNode( elem ) );
11716
11717
				// Convert html into DOM nodes
11718
				} else {
11719
					tmp = tmp || fragment.appendChild( context.createElement("div") );
11720
11721
					// Deserialize a standard representation
11722
					tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
11723
					wrap = wrapMap[ tag ] || wrapMap._default;
11724
					tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
11725
11726
					// Descend through wrappers to the right content
11727
					j = wrap[ 0 ];
11728
					while ( j-- ) {
11729
						tmp = tmp.lastChild;
11730
					}
11731
11732
					// Support: QtWebKit, PhantomJS
11733
					// push.apply(_, arraylike) throws on ancient WebKit
11734
					jQuery.merge( nodes, tmp.childNodes );
11735
11736
					// Remember the top-level container
11737
					tmp = fragment.firstChild;
11738
11739
					// Ensure the created nodes are orphaned (#12392)
11740
					tmp.textContent = "";
11741
				}
11742
			}
11743
		}
11744
11745
		// Remove wrapper from fragment
11746
		fragment.textContent = "";
11747
11748
		i = 0;
11749
		while ( (elem = nodes[ i++ ]) ) {
11750
11751
			// #4087 - If origin and destination elements are the same, and this is
11752
			// that element, do not do anything
11753
			if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
11754
				continue;
11755
			}
11756
11757
			contains = jQuery.contains( elem.ownerDocument, elem );
11758
11759
			// Append to fragment
11760
			tmp = getAll( fragment.appendChild( elem ), "script" );
11761
11762
			// Preserve script evaluation history
11763
			if ( contains ) {
11764
				setGlobalEval( tmp );
11765
			}
11766
11767
			// Capture executables
11768
			if ( scripts ) {
11769
				j = 0;
11770
				while ( (elem = tmp[ j++ ]) ) {
11771
					if ( rscriptType.test( elem.type || "" ) ) {
11772
						scripts.push( elem );
11773
					}
11774
				}
11775
			}
11776
		}
11777
11778
		return fragment;
11779
	},
11780
11781
	cleanData: function( elems ) {
11782
		var data, elem, type, key,
11783
			special = jQuery.event.special,
11784
			i = 0;
11785
11786
		for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
11787
			if ( jQuery.acceptData( elem ) ) {
11788
				key = elem[ data_priv.expando ];
11789
11790
				if ( key && (data = data_priv.cache[ key ]) ) {
11791
					if ( data.events ) {
11792
						for ( type in data.events ) {
11793
							if ( special[ type ] ) {
11794
								jQuery.event.remove( elem, type );
11795
11796
							// This is a shortcut to avoid jQuery.event.remove's overhead
11797
							} else {
11798
								jQuery.removeEvent( elem, type, data.handle );
11799
							}
11800
						}
11801
					}
11802
					if ( data_priv.cache[ key ] ) {
11803
						// Discard any remaining `private` data
11804
						delete data_priv.cache[ key ];
11805
					}
11806
				}
11807
			}
11808
			// Discard any remaining `user` data
11809
			delete data_user.cache[ elem[ data_user.expando ] ];
11810
		}
11811
	}
11812
});
11813
11814
jQuery.fn.extend({
11815
	text: function( value ) {
11816
		return access( this, function( value ) {
11817
			return value === undefined ?
11818
				jQuery.text( this ) :
11819
				this.empty().each(function() {
11820
					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11821
						this.textContent = value;
11822
					}
11823
				});
11824
		}, null, value, arguments.length );
11825
	},
11826
11827
	append: function() {
11828
		return this.domManip( arguments, function( elem ) {
11829
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11830
				var target = manipulationTarget( this, elem );
11831
				target.appendChild( elem );
11832
			}
11833
		});
11834
	},
11835
11836
	prepend: function() {
11837
		return this.domManip( arguments, function( elem ) {
11838
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11839
				var target = manipulationTarget( this, elem );
11840
				target.insertBefore( elem, target.firstChild );
11841
			}
11842
		});
11843
	},
11844
11845
	before: function() {
11846
		return this.domManip( arguments, function( elem ) {
11847
			if ( this.parentNode ) {
11848
				this.parentNode.insertBefore( elem, this );
11849
			}
11850
		});
11851
	},
11852
11853
	after: function() {
11854
		return this.domManip( arguments, function( elem ) {
11855
			if ( this.parentNode ) {
11856
				this.parentNode.insertBefore( elem, this.nextSibling );
11857
			}
11858
		});
11859
	},
11860
11861
	remove: function( selector, keepData /* Internal Use Only */ ) {
11862
		var elem,
11863
			elems = selector ? jQuery.filter( selector, this ) : this,
11864
			i = 0;
11865
11866
		for ( ; (elem = elems[i]) != null; i++ ) {
11867
			if ( !keepData && elem.nodeType === 1 ) {
11868
				jQuery.cleanData( getAll( elem ) );
11869
			}
11870
11871
			if ( elem.parentNode ) {
11872
				if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
11873
					setGlobalEval( getAll( elem, "script" ) );
11874
				}
11875
				elem.parentNode.removeChild( elem );
11876
			}
11877
		}
11878
11879
		return this;
11880
	},
11881
11882
	empty: function() {
11883
		var elem,
11884
			i = 0;
11885
11886
		for ( ; (elem = this[i]) != null; i++ ) {
11887
			if ( elem.nodeType === 1 ) {
11888
11889
				// Prevent memory leaks
11890
				jQuery.cleanData( getAll( elem, false ) );
11891
11892
				// Remove any remaining nodes
11893
				elem.textContent = "";
11894
			}
11895
		}
11896
11897
		return this;
11898
	},
11899
11900
	clone: function( dataAndEvents, deepDataAndEvents ) {
11901
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
11902
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
11903
11904
		return this.map(function() {
11905
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
11906
		});
11907
	},
11908
11909
	html: function( value ) {
11910
		return access( this, function( value ) {
11911
			var elem = this[ 0 ] || {},
11912
				i = 0,
11913
				l = this.length;
11914
11915
			if ( value === undefined && elem.nodeType === 1 ) {
11916
				return elem.innerHTML;
11917
			}
11918
11919
			// See if we can take a shortcut and just use innerHTML
11920
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
11921
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
11922
11923
				value = value.replace( rxhtmlTag, "<$1></$2>" );
11924
11925
				try {
11926
					for ( ; i < l; i++ ) {
11927
						elem = this[ i ] || {};
11928
11929
						// Remove element nodes and prevent memory leaks
11930
						if ( elem.nodeType === 1 ) {
11931
							jQuery.cleanData( getAll( elem, false ) );
11932
							elem.innerHTML = value;
11933
						}
11934
					}
11935
11936
					elem = 0;
11937
11938
				// If using innerHTML throws an exception, use the fallback method
11939
				} catch( e ) {}
11940
			}
11941
11942
			if ( elem ) {
11943
				this.empty().append( value );
11944
			}
11945
		}, null, value, arguments.length );
11946
	},
11947
11948
	replaceWith: function() {
11949
		var arg = arguments[ 0 ];
11950
11951
		// Make the changes, replacing each context element with the new content
11952
		this.domManip( arguments, function( elem ) {
11953
			arg = this.parentNode;
11954
11955
			jQuery.cleanData( getAll( this ) );
11956
11957
			if ( arg ) {
11958
				arg.replaceChild( elem, this );
11959
			}
11960
		});
11961
11962
		// Force removal if there was no new content (e.g., from empty arguments)
11963
		return arg && (arg.length || arg.nodeType) ? this : this.remove();
11964
	},
11965
11966
	detach: function( selector ) {
11967
		return this.remove( selector, true );
11968
	},
11969
11970
	domManip: function( args, callback ) {
11971
11972
		// Flatten any nested arrays
11973
		args = concat.apply( [], args );
11974
11975
		var fragment, first, scripts, hasScripts, node, doc,
11976
			i = 0,
11977
			l = this.length,
11978
			set = this,
11979
			iNoClone = l - 1,
11980
			value = args[ 0 ],
11981
			isFunction = jQuery.isFunction( value );
11982
11983
		// We can't cloneNode fragments that contain checked, in WebKit
11984
		if ( isFunction ||
11985
				( l > 1 && typeof value === "string" &&
11986
					!support.checkClone && rchecked.test( value ) ) ) {
11987
			return this.each(function( index ) {
11988
				var self = set.eq( index );
11989
				if ( isFunction ) {
11990
					args[ 0 ] = value.call( this, index, self.html() );
11991
				}
11992
				self.domManip( args, callback );
11993
			});
11994
		}
11995
11996
		if ( l ) {
11997
			fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
11998
			first = fragment.firstChild;
11999
12000
			if ( fragment.childNodes.length === 1 ) {
12001
				fragment = first;
12002
			}
12003
12004
			if ( first ) {
12005
				scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
12006
				hasScripts = scripts.length;
12007
12008
				// Use the original fragment for the last item instead of the first because it can end up
12009
				// being emptied incorrectly in certain situations (#8070).
12010
				for ( ; i < l; i++ ) {
12011
					node = fragment;
12012
12013
					if ( i !== iNoClone ) {
12014
						node = jQuery.clone( node, true, true );
12015
12016
						// Keep references to cloned scripts for later restoration
12017
						if ( hasScripts ) {
12018
							// Support: QtWebKit
12019
							// jQuery.merge because push.apply(_, arraylike) throws
12020
							jQuery.merge( scripts, getAll( node, "script" ) );
12021
						}
12022
					}
12023
12024
					callback.call( this[ i ], node, i );
12025
				}
12026
12027
				if ( hasScripts ) {
12028
					doc = scripts[ scripts.length - 1 ].ownerDocument;
12029
12030
					// Reenable scripts
12031
					jQuery.map( scripts, restoreScript );
12032
12033
					// Evaluate executable scripts on first document insertion
12034
					for ( i = 0; i < hasScripts; i++ ) {
12035
						node = scripts[ i ];
12036
						if ( rscriptType.test( node.type || "" ) &&
12037
							!data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
12038
12039
							if ( node.src ) {
12040
								// Optional AJAX dependency, but won't run scripts if not present
12041
								if ( jQuery._evalUrl ) {
12042
									jQuery._evalUrl( node.src );
12043
								}
12044
							} else {
12045
								jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
12046
							}
12047
						}
12048
					}
12049
				}
12050
			}
12051
		}
12052
12053
		return this;
12054
	}
12055
});
12056
12057
jQuery.each({
12058
	appendTo: "append",
12059
	prependTo: "prepend",
12060
	insertBefore: "before",
12061
	insertAfter: "after",
12062
	replaceAll: "replaceWith"
12063
}, function( name, original ) {
12064
	jQuery.fn[ name ] = function( selector ) {
12065
		var elems,
12066
			ret = [],
12067
			insert = jQuery( selector ),
12068
			last = insert.length - 1,
12069
			i = 0;
12070
12071
		for ( ; i <= last; i++ ) {
12072
			elems = i === last ? this : this.clone( true );
12073
			jQuery( insert[ i ] )[ original ]( elems );
12074
12075
			// Support: QtWebKit
12076
			// .get() because push.apply(_, arraylike) throws
12077
			push.apply( ret, elems.get() );
12078
		}
12079
12080
		return this.pushStack( ret );
12081
	};
12082
});
12083
12084
12085
var iframe,
12086
	elemdisplay = {};
12087
12088
/**
12089
 * Retrieve the actual display of a element
12090
 * @param {String} name nodeName of the element
12091
 * @param {Object} doc Document object
12092
 */
12093
// Called only from within defaultDisplay
12094
function actualDisplay( name, doc ) {
12095
	var style,
12096
		elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
12097
12098
		// getDefaultComputedStyle might be reliably used only on attached element
12099
		display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
12100
12101
			// Use of this method is a temporary fix (more like optimization) until something better comes along,
12102
			// since it was removed from specification and supported only in FF
12103
			style.display : jQuery.css( elem[ 0 ], "display" );
12104
12105
	// We don't have any data stored on the element,
12106
	// so use "detach" method as fast way to get rid of the element
12107
	elem.detach();
12108
12109
	return display;
12110
}
12111
12112
/**
12113
 * Try to determine the default display value of an element
12114
 * @param {String} nodeName
12115
 */
12116
function defaultDisplay( nodeName ) {
12117
	var doc = document,
12118
		display = elemdisplay[ nodeName ];
12119
12120
	if ( !display ) {
12121
		display = actualDisplay( nodeName, doc );
12122
12123
		// If the simple way fails, read from inside an iframe
12124
		if ( display === "none" || !display ) {
12125
12126
			// Use the already-created iframe if possible
12127
			iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
12128
12129
			// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
12130
			doc = iframe[ 0 ].contentDocument;
12131
12132
			// Support: IE
12133
			doc.write();
12134
			doc.close();
12135
12136
			display = actualDisplay( nodeName, doc );
12137
			iframe.detach();
12138
		}
12139
12140
		// Store the correct default display
12141
		elemdisplay[ nodeName ] = display;
12142
	}
12143
12144
	return display;
12145
}
12146
var rmargin = (/^margin/);
12147
12148
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
12149
12150
var getStyles = function( elem ) {
12151
		// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
12152
		// IE throws on elements created in popups
12153
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
12154
		if ( elem.ownerDocument.defaultView.opener ) {
12155
			return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
12156
		}
12157
12158
		return window.getComputedStyle( elem, null );
12159
	};
12160
12161
12162
12163
function curCSS( elem, name, computed ) {
12164
	var width, minWidth, maxWidth, ret,
12165
		style = elem.style;
12166
12167
	computed = computed || getStyles( elem );
12168
12169
	// Support: IE9
12170
	// getPropertyValue is only needed for .css('filter') (#12537)
12171
	if ( computed ) {
12172
		ret = computed.getPropertyValue( name ) || computed[ name ];
12173
	}
12174
12175
	if ( computed ) {
12176
12177
		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
12178
			ret = jQuery.style( elem, name );
12179
		}
12180
12181
		// Support: iOS < 6
12182
		// A tribute to the "awesome hack by Dean Edwards"
12183
		// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
12184
		// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
12185
		if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
12186
12187
			// Remember the original values
12188
			width = style.width;
12189
			minWidth = style.minWidth;
12190
			maxWidth = style.maxWidth;
12191
12192
			// Put in the new values to get a computed value out
12193
			style.minWidth = style.maxWidth = style.width = ret;
12194
			ret = computed.width;
12195
12196
			// Revert the changed values
12197
			style.width = width;
12198
			style.minWidth = minWidth;
12199
			style.maxWidth = maxWidth;
12200
		}
12201
	}
12202
12203
	return ret !== undefined ?
12204
		// Support: IE
12205
		// IE returns zIndex value as an integer.
12206
		ret + "" :
12207
		ret;
12208
}
12209
12210
12211
function addGetHookIf( conditionFn, hookFn ) {
12212
	// Define the hook, we'll check on the first run if it's really needed.
12213
	return {
12214
		get: function() {
12215
			if ( conditionFn() ) {
12216
				// Hook not needed (or it's not possible to use it due
12217
				// to missing dependency), remove it.
12218
				delete this.get;
12219
				return;
12220
			}
12221
12222
			// Hook needed; redefine it so that the support test is not executed again.
12223
			return (this.get = hookFn).apply( this, arguments );
12224
		}
12225
	};
12226
}
12227
12228
12229
(function() {
12230
	var pixelPositionVal, boxSizingReliableVal,
12231
		docElem = document.documentElement,
12232
		container = document.createElement( "div" ),
12233
		div = document.createElement( "div" );
12234
12235
	if ( !div.style ) {
12236
		return;
12237
	}
12238
12239
	// Support: IE9-11+
12240
	// Style of cloned element affects source element cloned (#8908)
12241
	div.style.backgroundClip = "content-box";
12242
	div.cloneNode( true ).style.backgroundClip = "";
12243
	support.clearCloneStyle = div.style.backgroundClip === "content-box";
12244
12245
	container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
12246
		"position:absolute";
12247
	container.appendChild( div );
12248
12249
	// Executing both pixelPosition & boxSizingReliable tests require only one layout
12250
	// so they're executed at the same time to save the second computation.
12251
	function computePixelPositionAndBoxSizingReliable() {
12252
		div.style.cssText =
12253
			// Support: Firefox<29, Android 2.3
12254
			// Vendor-prefix box-sizing
12255
			"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
12256
			"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
12257
			"border:1px;padding:1px;width:4px;position:absolute";
12258
		div.innerHTML = "";
12259
		docElem.appendChild( container );
12260
12261
		var divStyle = window.getComputedStyle( div, null );
12262
		pixelPositionVal = divStyle.top !== "1%";
12263
		boxSizingReliableVal = divStyle.width === "4px";
12264
12265
		docElem.removeChild( container );
12266
	}
12267
12268
	// Support: node.js jsdom
12269
	// Don't assume that getComputedStyle is a property of the global object
12270
	if ( window.getComputedStyle ) {
12271
		jQuery.extend( support, {
12272
			pixelPosition: function() {
12273
12274
				// This test is executed only once but we still do memoizing
12275
				// since we can use the boxSizingReliable pre-computing.
12276
				// No need to check if the test was already performed, though.
12277
				computePixelPositionAndBoxSizingReliable();
12278
				return pixelPositionVal;
12279
			},
12280
			boxSizingReliable: function() {
12281
				if ( boxSizingReliableVal == null ) {
12282
					computePixelPositionAndBoxSizingReliable();
12283
				}
12284
				return boxSizingReliableVal;
12285
			},
12286
			reliableMarginRight: function() {
12287
12288
				// Support: Android 2.3
12289
				// Check if div with explicit width and no margin-right incorrectly
12290
				// gets computed margin-right based on width of container. (#3333)
12291
				// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
12292
				// This support function is only executed once so no memoizing is needed.
12293
				var ret,
12294
					marginDiv = div.appendChild( document.createElement( "div" ) );
12295
12296
				// Reset CSS: box-sizing; display; margin; border; padding
12297
				marginDiv.style.cssText = div.style.cssText =
12298
					// Support: Firefox<29, Android 2.3
12299
					// Vendor-prefix box-sizing
12300
					"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
12301
					"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
12302
				marginDiv.style.marginRight = marginDiv.style.width = "0";
12303
				div.style.width = "1px";
12304
				docElem.appendChild( container );
12305
12306
				ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
12307
12308
				docElem.removeChild( container );
12309
				div.removeChild( marginDiv );
12310
12311
				return ret;
12312
			}
12313
		});
12314
	}
12315
})();
12316
12317
12318
// A method for quickly swapping in/out CSS properties to get correct calculations.
12319
jQuery.swap = function( elem, options, callback, args ) {
12320
	var ret, name,
12321
		old = {};
12322
12323
	// Remember the old values, and insert the new ones
12324
	for ( name in options ) {
12325
		old[ name ] = elem.style[ name ];
12326
		elem.style[ name ] = options[ name ];
12327
	}
12328
12329
	ret = callback.apply( elem, args || [] );
12330
12331
	// Revert the old values
12332
	for ( name in options ) {
12333
		elem.style[ name ] = old[ name ];
12334
	}
12335
12336
	return ret;
12337
};
12338
12339
12340
var
12341
	// Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
12342
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
12343
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
12344
	rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
12345
	rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
12346
12347
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
12348
	cssNormalTransform = {
12349
		letterSpacing: "0",
12350
		fontWeight: "400"
12351
	},
12352
12353
	cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
12354
12355
// Return a css property mapped to a potentially vendor prefixed property
12356
function vendorPropName( style, name ) {
12357
12358
	// Shortcut for names that are not vendor prefixed
12359
	if ( name in style ) {
12360
		return name;
12361
	}
12362
12363
	// Check for vendor prefixed names
12364
	var capName = name[0].toUpperCase() + name.slice(1),
12365
		origName = name,
12366
		i = cssPrefixes.length;
12367
12368
	while ( i-- ) {
12369
		name = cssPrefixes[ i ] + capName;
12370
		if ( name in style ) {
12371
			return name;
12372
		}
12373
	}
12374
12375
	return origName;
12376
}
12377
12378
function setPositiveNumber( elem, value, subtract ) {
12379
	var matches = rnumsplit.exec( value );
12380
	return matches ?
12381
		// Guard against undefined "subtract", e.g., when used as in cssHooks
12382
		Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
12383
		value;
12384
}
12385
12386
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
12387
	var i = extra === ( isBorderBox ? "border" : "content" ) ?
12388
		// If we already have the right measurement, avoid augmentation
12389
		4 :
12390
		// Otherwise initialize for horizontal or vertical properties
12391
		name === "width" ? 1 : 0,
12392
12393
		val = 0;
12394
12395
	for ( ; i < 4; i += 2 ) {
12396
		// Both box models exclude margin, so add it if we want it
12397
		if ( extra === "margin" ) {
12398
			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
12399
		}
12400
12401
		if ( isBorderBox ) {
12402
			// border-box includes padding, so remove it if we want content
12403
			if ( extra === "content" ) {
12404
				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12405
			}
12406
12407
			// At this point, extra isn't border nor margin, so remove border
12408
			if ( extra !== "margin" ) {
12409
				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12410
			}
12411
		} else {
12412
			// At this point, extra isn't content, so add padding
12413
			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12414
12415
			// At this point, extra isn't content nor padding, so add border
12416
			if ( extra !== "padding" ) {
12417
				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12418
			}
12419
		}
12420
	}
12421
12422
	return val;
12423
}
12424
12425
function getWidthOrHeight( elem, name, extra ) {
12426
12427
	// Start with offset property, which is equivalent to the border-box value
12428
	var valueIsBorderBox = true,
12429
		val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
12430
		styles = getStyles( elem ),
12431
		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
12432
12433
	// Some non-html elements return undefined for offsetWidth, so check for null/undefined
12434
	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
12435
	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
12436
	if ( val <= 0 || val == null ) {
12437
		// Fall back to computed then uncomputed css if necessary
12438
		val = curCSS( elem, name, styles );
12439
		if ( val < 0 || val == null ) {
12440
			val = elem.style[ name ];
12441
		}
12442
12443
		// Computed unit is not pixels. Stop here and return.
12444
		if ( rnumnonpx.test(val) ) {
12445
			return val;
12446
		}
12447
12448
		// Check for style in case a browser which returns unreliable values
12449
		// for getComputedStyle silently falls back to the reliable elem.style
12450
		valueIsBorderBox = isBorderBox &&
12451
			( support.boxSizingReliable() || val === elem.style[ name ] );
12452
12453
		// Normalize "", auto, and prepare for extra
12454
		val = parseFloat( val ) || 0;
12455
	}
12456
12457
	// Use the active box-sizing model to add/subtract irrelevant styles
12458
	return ( val +
12459
		augmentWidthOrHeight(
12460
			elem,
12461
			name,
12462
			extra || ( isBorderBox ? "border" : "content" ),
12463
			valueIsBorderBox,
12464
			styles
12465
		)
12466
	) + "px";
12467
}
12468
12469
function showHide( elements, show ) {
12470
	var display, elem, hidden,
12471
		values = [],
12472
		index = 0,
12473
		length = elements.length;
12474
12475
	for ( ; index < length; index++ ) {
12476
		elem = elements[ index ];
12477
		if ( !elem.style ) {
12478
			continue;
12479
		}
12480
12481
		values[ index ] = data_priv.get( elem, "olddisplay" );
12482
		display = elem.style.display;
12483
		if ( show ) {
12484
			// Reset the inline display of this element to learn if it is
12485
			// being hidden by cascaded rules or not
12486
			if ( !values[ index ] && display === "none" ) {
12487
				elem.style.display = "";
12488
			}
12489
12490
			// Set elements which have been overridden with display: none
12491
			// in a stylesheet to whatever the default browser style is
12492
			// for such an element
12493
			if ( elem.style.display === "" && isHidden( elem ) ) {
12494
				values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
12495
			}
12496
		} else {
12497
			hidden = isHidden( elem );
12498
12499
			if ( display !== "none" || !hidden ) {
12500
				data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
12501
			}
12502
		}
12503
	}
12504
12505
	// Set the display of most of the elements in a second loop
12506
	// to avoid the constant reflow
12507
	for ( index = 0; index < length; index++ ) {
12508
		elem = elements[ index ];
12509
		if ( !elem.style ) {
12510
			continue;
12511
		}
12512
		if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
12513
			elem.style.display = show ? values[ index ] || "" : "none";
12514
		}
12515
	}
12516
12517
	return elements;
12518
}
12519
12520
jQuery.extend({
12521
12522
	// Add in style property hooks for overriding the default
12523
	// behavior of getting and setting a style property
12524
	cssHooks: {
12525
		opacity: {
12526
			get: function( elem, computed ) {
12527
				if ( computed ) {
12528
12529
					// We should always get a number back from opacity
12530
					var ret = curCSS( elem, "opacity" );
12531
					return ret === "" ? "1" : ret;
12532
				}
12533
			}
12534
		}
12535
	},
12536
12537
	// Don't automatically add "px" to these possibly-unitless properties
12538
	cssNumber: {
12539
		"columnCount": true,
12540
		"fillOpacity": true,
12541
		"flexGrow": true,
12542
		"flexShrink": true,
12543
		"fontWeight": true,
12544
		"lineHeight": true,
12545
		"opacity": true,
12546
		"order": true,
12547
		"orphans": true,
12548
		"widows": true,
12549
		"zIndex": true,
12550
		"zoom": true
12551
	},
12552
12553
	// Add in properties whose names you wish to fix before
12554
	// setting or getting the value
12555
	cssProps: {
12556
		"float": "cssFloat"
12557
	},
12558
12559
	// Get and set the style property on a DOM Node
12560
	style: function( elem, name, value, extra ) {
12561
12562
		// Don't set styles on text and comment nodes
12563
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
12564
			return;
12565
		}
12566
12567
		// Make sure that we're working with the right name
12568
		var ret, type, hooks,
12569
			origName = jQuery.camelCase( name ),
12570
			style = elem.style;
12571
12572
		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
12573
12574
		// Gets hook for the prefixed version, then unprefixed version
12575
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12576
12577
		// Check if we're setting a value
12578
		if ( value !== undefined ) {
12579
			type = typeof value;
12580
12581
			// Convert "+=" or "-=" to relative numbers (#7345)
12582
			if ( type === "string" && (ret = rrelNum.exec( value )) ) {
12583
				value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
12584
				// Fixes bug #9237
12585
				type = "number";
12586
			}
12587
12588
			// Make sure that null and NaN values aren't set (#7116)
12589
			if ( value == null || value !== value ) {
12590
				return;
12591
			}
12592
12593
			// If a number, add 'px' to the (except for certain CSS properties)
12594
			if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
12595
				value += "px";
12596
			}
12597
12598
			// Support: IE9-11+
12599
			// background-* props affect original clone's values
12600
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
12601
				style[ name ] = "inherit";
12602
			}
12603
12604
			// If a hook was provided, use that value, otherwise just set the specified value
12605
			if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
12606
				style[ name ] = value;
12607
			}
12608
12609
		} else {
12610
			// If a hook was provided get the non-computed value from there
12611
			if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
12612
				return ret;
12613
			}
12614
12615
			// Otherwise just get the value from the style object
12616
			return style[ name ];
12617
		}
12618
	},
12619
12620
	css: function( elem, name, extra, styles ) {
12621
		var val, num, hooks,
12622
			origName = jQuery.camelCase( name );
12623
12624
		// Make sure that we're working with the right name
12625
		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
12626
12627
		// Try prefixed name followed by the unprefixed name
12628
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12629
12630
		// If a hook was provided get the computed value from there
12631
		if ( hooks && "get" in hooks ) {
12632
			val = hooks.get( elem, true, extra );
12633
		}
12634
12635
		// Otherwise, if a way to get the computed value exists, use that
12636
		if ( val === undefined ) {
12637
			val = curCSS( elem, name, styles );
12638
		}
12639
12640
		// Convert "normal" to computed value
12641
		if ( val === "normal" && name in cssNormalTransform ) {
12642
			val = cssNormalTransform[ name ];
12643
		}
12644
12645
		// Make numeric if forced or a qualifier was provided and val looks numeric
12646
		if ( extra === "" || extra ) {
12647
			num = parseFloat( val );
12648
			return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
12649
		}
12650
		return val;
12651
	}
12652
});
12653
12654
jQuery.each([ "height", "width" ], function( i, name ) {
12655
	jQuery.cssHooks[ name ] = {
12656
		get: function( elem, computed, extra ) {
12657
			if ( computed ) {
12658
12659
				// Certain elements can have dimension info if we invisibly show them
12660
				// but it must have a current display style that would benefit
12661
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
12662
					jQuery.swap( elem, cssShow, function() {
12663
						return getWidthOrHeight( elem, name, extra );
12664
					}) :
12665
					getWidthOrHeight( elem, name, extra );
12666
			}
12667
		},
12668
12669
		set: function( elem, value, extra ) {
12670
			var styles = extra && getStyles( elem );
12671
			return setPositiveNumber( elem, value, extra ?
12672
				augmentWidthOrHeight(
12673
					elem,
12674
					name,
12675
					extra,
12676
					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
12677
					styles
12678
				) : 0
12679
			);
12680
		}
12681
	};
12682
});
12683
12684
// Support: Android 2.3
12685
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
12686
	function( elem, computed ) {
12687
		if ( computed ) {
12688
			return jQuery.swap( elem, { "display": "inline-block" },
12689
				curCSS, [ elem, "marginRight" ] );
12690
		}
12691
	}
12692
);
12693
12694
// These hooks are used by animate to expand properties
12695
jQuery.each({
12696
	margin: "",
12697
	padding: "",
12698
	border: "Width"
12699
}, function( prefix, suffix ) {
12700
	jQuery.cssHooks[ prefix + suffix ] = {
12701
		expand: function( value ) {
12702
			var i = 0,
12703
				expanded = {},
12704
12705
				// Assumes a single number if not a string
12706
				parts = typeof value === "string" ? value.split(" ") : [ value ];
12707
12708
			for ( ; i < 4; i++ ) {
12709
				expanded[ prefix + cssExpand[ i ] + suffix ] =
12710
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
12711
			}
12712
12713
			return expanded;
12714
		}
12715
	};
12716
12717
	if ( !rmargin.test( prefix ) ) {
12718
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
12719
	}
12720
});
12721
12722
jQuery.fn.extend({
12723
	css: function( name, value ) {
12724
		return access( this, function( elem, name, value ) {
12725
			var styles, len,
12726
				map = {},
12727
				i = 0;
12728
12729
			if ( jQuery.isArray( name ) ) {
12730
				styles = getStyles( elem );
12731
				len = name.length;
12732
12733
				for ( ; i < len; i++ ) {
12734
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
12735
				}
12736
12737
				return map;
12738
			}
12739
12740
			return value !== undefined ?
12741
				jQuery.style( elem, name, value ) :
12742
				jQuery.css( elem, name );
12743
		}, name, value, arguments.length > 1 );
12744
	},
12745
	show: function() {
12746
		return showHide( this, true );
12747
	},
12748
	hide: function() {
12749
		return showHide( this );
12750
	},
12751
	toggle: function( state ) {
12752
		if ( typeof state === "boolean" ) {
12753
			return state ? this.show() : this.hide();
12754
		}
12755
12756
		return this.each(function() {
12757
			if ( isHidden( this ) ) {
12758
				jQuery( this ).show();
12759
			} else {
12760
				jQuery( this ).hide();
12761
			}
12762
		});
12763
	}
12764
});
12765
12766
12767
function Tween( elem, options, prop, end, easing ) {
12768
	return new Tween.prototype.init( elem, options, prop, end, easing );
12769
}
12770
jQuery.Tween = Tween;
12771
12772
Tween.prototype = {
12773
	constructor: Tween,
12774
	init: function( elem, options, prop, end, easing, unit ) {
12775
		this.elem = elem;
12776
		this.prop = prop;
12777
		this.easing = easing || "swing";
12778
		this.options = options;
12779
		this.start = this.now = this.cur();
12780
		this.end = end;
12781
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
12782
	},
12783
	cur: function() {
12784
		var hooks = Tween.propHooks[ this.prop ];
12785
12786
		return hooks && hooks.get ?
12787
			hooks.get( this ) :
12788
			Tween.propHooks._default.get( this );
12789
	},
12790
	run: function( percent ) {
12791
		var eased,
12792
			hooks = Tween.propHooks[ this.prop ];
12793
12794
		if ( this.options.duration ) {
12795
			this.pos = eased = jQuery.easing[ this.easing ](
12796
				percent, this.options.duration * percent, 0, 1, this.options.duration
12797
			);
12798
		} else {
12799
			this.pos = eased = percent;
12800
		}
12801
		this.now = ( this.end - this.start ) * eased + this.start;
12802
12803
		if ( this.options.step ) {
12804
			this.options.step.call( this.elem, this.now, this );
12805
		}
12806
12807
		if ( hooks && hooks.set ) {
12808
			hooks.set( this );
12809
		} else {
12810
			Tween.propHooks._default.set( this );
12811
		}
12812
		return this;
12813
	}
12814
};
12815
12816
Tween.prototype.init.prototype = Tween.prototype;
12817
12818
Tween.propHooks = {
12819
	_default: {
12820
		get: function( tween ) {
12821
			var result;
12822
12823
			if ( tween.elem[ tween.prop ] != null &&
12824
				(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
12825
				return tween.elem[ tween.prop ];
12826
			}
12827
12828
			// Passing an empty string as a 3rd parameter to .css will automatically
12829
			// attempt a parseFloat and fallback to a string if the parse fails.
12830
			// Simple values such as "10px" are parsed to Float;
12831
			// complex values such as "rotate(1rad)" are returned as-is.
12832
			result = jQuery.css( tween.elem, tween.prop, "" );
12833
			// Empty strings, null, undefined and "auto" are converted to 0.
12834
			return !result || result === "auto" ? 0 : result;
12835
		},
12836
		set: function( tween ) {
12837
			// Use step hook for back compat.
12838
			// Use cssHook if its there.
12839
			// Use .style if available and use plain properties where available.
12840
			if ( jQuery.fx.step[ tween.prop ] ) {
12841
				jQuery.fx.step[ tween.prop ]( tween );
12842
			} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
12843
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
12844
			} else {
12845
				tween.elem[ tween.prop ] = tween.now;
12846
			}
12847
		}
12848
	}
12849
};
12850
12851
// Support: IE9
12852
// Panic based approach to setting things on disconnected nodes
12853
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
12854
	set: function( tween ) {
12855
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
12856
			tween.elem[ tween.prop ] = tween.now;
12857
		}
12858
	}
12859
};
12860
12861
jQuery.easing = {
12862
	linear: function( p ) {
12863
		return p;
12864
	},
12865
	swing: function( p ) {
12866
		return 0.5 - Math.cos( p * Math.PI ) / 2;
12867
	}
12868
};
12869
12870
jQuery.fx = Tween.prototype.init;
12871
12872
// Back Compat <1.8 extension point
12873
jQuery.fx.step = {};
12874
12875
12876
12877
12878
var
12879
	fxNow, timerId,
12880
	rfxtypes = /^(?:toggle|show|hide)$/,
12881
	rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
12882
	rrun = /queueHooks$/,
12883
	animationPrefilters = [ defaultPrefilter ],
12884
	tweeners = {
12885
		"*": [ function( prop, value ) {
12886
			var tween = this.createTween( prop, value ),
12887
				target = tween.cur(),
12888
				parts = rfxnum.exec( value ),
12889
				unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
12890
12891
				// Starting value computation is required for potential unit mismatches
12892
				start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
12893
					rfxnum.exec( jQuery.css( tween.elem, prop ) ),
12894
				scale = 1,
12895
				maxIterations = 20;
12896
12897
			if ( start && start[ 3 ] !== unit ) {
12898
				// Trust units reported by jQuery.css
12899
				unit = unit || start[ 3 ];
12900
12901
				// Make sure we update the tween properties later on
12902
				parts = parts || [];
12903
12904
				// Iteratively approximate from a nonzero starting point
12905
				start = +target || 1;
12906
12907
				do {
12908
					// If previous iteration zeroed out, double until we get *something*.
12909
					// Use string for doubling so we don't accidentally see scale as unchanged below
12910
					scale = scale || ".5";
12911
12912
					// Adjust and apply
12913
					start = start / scale;
12914
					jQuery.style( tween.elem, prop, start + unit );
12915
12916
				// Update scale, tolerating zero or NaN from tween.cur(),
12917
				// break the loop if scale is unchanged or perfect, or if we've just had enough
12918
				} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
12919
			}
12920
12921
			// Update tween properties
12922
			if ( parts ) {
12923
				start = tween.start = +start || +target || 0;
12924
				tween.unit = unit;
12925
				// If a +=/-= token was provided, we're doing a relative animation
12926
				tween.end = parts[ 1 ] ?
12927
					start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
12928
					+parts[ 2 ];
12929
			}
12930
12931
			return tween;
12932
		} ]
12933
	};
12934
12935
// Animations created synchronously will run synchronously
12936
function createFxNow() {
12937
	setTimeout(function() {
12938
		fxNow = undefined;
12939
	});
12940
	return ( fxNow = jQuery.now() );
12941
}
12942
12943
// Generate parameters to create a standard animation
12944
function genFx( type, includeWidth ) {
12945
	var which,
12946
		i = 0,
12947
		attrs = { height: type };
12948
12949
	// If we include width, step value is 1 to do all cssExpand values,
12950
	// otherwise step value is 2 to skip over Left and Right
12951
	includeWidth = includeWidth ? 1 : 0;
12952
	for ( ; i < 4 ; i += 2 - includeWidth ) {
12953
		which = cssExpand[ i ];
12954
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
12955
	}
12956
12957
	if ( includeWidth ) {
12958
		attrs.opacity = attrs.width = type;
12959
	}
12960
12961
	return attrs;
12962
}
12963
12964
function createTween( value, prop, animation ) {
12965
	var tween,
12966
		collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
12967
		index = 0,
12968
		length = collection.length;
12969
	for ( ; index < length; index++ ) {
12970
		if ( (tween = collection[ index ].call( animation, prop, value )) ) {
12971
12972
			// We're done with this property
12973
			return tween;
12974
		}
12975
	}
12976
}
12977
12978
function defaultPrefilter( elem, props, opts ) {
12979
	/* jshint validthis: true */
12980
	var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
12981
		anim = this,
12982
		orig = {},
12983
		style = elem.style,
12984
		hidden = elem.nodeType && isHidden( elem ),
12985
		dataShow = data_priv.get( elem, "fxshow" );
12986
12987
	// Handle queue: false promises
12988
	if ( !opts.queue ) {
12989
		hooks = jQuery._queueHooks( elem, "fx" );
12990
		if ( hooks.unqueued == null ) {
12991
			hooks.unqueued = 0;
12992
			oldfire = hooks.empty.fire;
12993
			hooks.empty.fire = function() {
12994
				if ( !hooks.unqueued ) {
12995
					oldfire();
12996
				}
12997
			};
12998
		}
12999
		hooks.unqueued++;
13000
13001
		anim.always(function() {
13002
			// Ensure the complete handler is called before this completes
13003
			anim.always(function() {
13004
				hooks.unqueued--;
13005
				if ( !jQuery.queue( elem, "fx" ).length ) {
13006
					hooks.empty.fire();
13007
				}
13008
			});
13009
		});
13010
	}
13011
13012
	// Height/width overflow pass
13013
	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
13014
		// Make sure that nothing sneaks out
13015
		// Record all 3 overflow attributes because IE9-10 do not
13016
		// change the overflow attribute when overflowX and
13017
		// overflowY are set to the same value
13018
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
13019
13020
		// Set display property to inline-block for height/width
13021
		// animations on inline elements that are having width/height animated
13022
		display = jQuery.css( elem, "display" );
13023
13024
		// Test default display if display is currently "none"
13025
		checkDisplay = display === "none" ?
13026
			data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
13027
13028
		if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
13029
			style.display = "inline-block";
13030
		}
13031
	}
13032
13033
	if ( opts.overflow ) {
13034
		style.overflow = "hidden";
13035
		anim.always(function() {
13036
			style.overflow = opts.overflow[ 0 ];
13037
			style.overflowX = opts.overflow[ 1 ];
13038
			style.overflowY = opts.overflow[ 2 ];
13039
		});
13040
	}
13041
13042
	// show/hide pass
13043
	for ( prop in props ) {
13044
		value = props[ prop ];
13045
		if ( rfxtypes.exec( value ) ) {
13046
			delete props[ prop ];
13047
			toggle = toggle || value === "toggle";
13048
			if ( value === ( hidden ? "hide" : "show" ) ) {
13049
13050
				// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
13051
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
13052
					hidden = true;
13053
				} else {
13054
					continue;
13055
				}
13056
			}
13057
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
13058
13059
		// Any non-fx value stops us from restoring the original display value
13060
		} else {
13061
			display = undefined;
13062
		}
13063
	}
13064
13065
	if ( !jQuery.isEmptyObject( orig ) ) {
13066
		if ( dataShow ) {
13067
			if ( "hidden" in dataShow ) {
13068
				hidden = dataShow.hidden;
13069
			}
13070
		} else {
13071
			dataShow = data_priv.access( elem, "fxshow", {} );
13072
		}
13073
13074
		// Store state if its toggle - enables .stop().toggle() to "reverse"
13075
		if ( toggle ) {
13076
			dataShow.hidden = !hidden;
13077
		}
13078
		if ( hidden ) {
13079
			jQuery( elem ).show();
13080
		} else {
13081
			anim.done(function() {
13082
				jQuery( elem ).hide();
13083
			});
13084
		}
13085
		anim.done(function() {
13086
			var prop;
13087
13088
			data_priv.remove( elem, "fxshow" );
13089
			for ( prop in orig ) {
13090
				jQuery.style( elem, prop, orig[ prop ] );
13091
			}
13092
		});
13093
		for ( prop in orig ) {
13094
			tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
13095
13096
			if ( !( prop in dataShow ) ) {
13097
				dataShow[ prop ] = tween.start;
13098
				if ( hidden ) {
13099
					tween.end = tween.start;
13100
					tween.start = prop === "width" || prop === "height" ? 1 : 0;
13101
				}
13102
			}
13103
		}
13104
13105
	// If this is a noop like .hide().hide(), restore an overwritten display value
13106
	} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
13107
		style.display = display;
13108
	}
13109
}
13110
13111
function propFilter( props, specialEasing ) {
13112
	var index, name, easing, value, hooks;
13113
13114
	// camelCase, specialEasing and expand cssHook pass
13115
	for ( index in props ) {
13116
		name = jQuery.camelCase( index );
13117
		easing = specialEasing[ name ];
13118
		value = props[ index ];
13119
		if ( jQuery.isArray( value ) ) {
13120
			easing = value[ 1 ];
13121
			value = props[ index ] = value[ 0 ];
13122
		}
13123
13124
		if ( index !== name ) {
13125
			props[ name ] = value;
13126
			delete props[ index ];
13127
		}
13128
13129
		hooks = jQuery.cssHooks[ name ];
13130
		if ( hooks && "expand" in hooks ) {
13131
			value = hooks.expand( value );
13132
			delete props[ name ];
13133
13134
			// Not quite $.extend, this won't overwrite existing keys.
13135
			// Reusing 'index' because we have the correct "name"
13136
			for ( index in value ) {
13137
				if ( !( index in props ) ) {
13138
					props[ index ] = value[ index ];
13139
					specialEasing[ index ] = easing;
13140
				}
13141
			}
13142
		} else {
13143
			specialEasing[ name ] = easing;
13144
		}
13145
	}
13146
}
13147
13148
function Animation( elem, properties, options ) {
13149
	var result,
13150
		stopped,
13151
		index = 0,
13152
		length = animationPrefilters.length,
13153
		deferred = jQuery.Deferred().always( function() {
13154
			// Don't match elem in the :animated selector
13155
			delete tick.elem;
13156
		}),
13157
		tick = function() {
13158
			if ( stopped ) {
13159
				return false;
13160
			}
13161
			var currentTime = fxNow || createFxNow(),
13162
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
13163
				// Support: Android 2.3
13164
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
13165
				temp = remaining / animation.duration || 0,
13166
				percent = 1 - temp,
13167
				index = 0,
13168
				length = animation.tweens.length;
13169
13170
			for ( ; index < length ; index++ ) {
13171
				animation.tweens[ index ].run( percent );
13172
			}
13173
13174
			deferred.notifyWith( elem, [ animation, percent, remaining ]);
13175
13176
			if ( percent < 1 && length ) {
13177
				return remaining;
13178
			} else {
13179
				deferred.resolveWith( elem, [ animation ] );
13180
				return false;
13181
			}
13182
		},
13183
		animation = deferred.promise({
13184
			elem: elem,
13185
			props: jQuery.extend( {}, properties ),
13186
			opts: jQuery.extend( true, { specialEasing: {} }, options ),
13187
			originalProperties: properties,
13188
			originalOptions: options,
13189
			startTime: fxNow || createFxNow(),
13190
			duration: options.duration,
13191
			tweens: [],
13192
			createTween: function( prop, end ) {
13193
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
13194
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
13195
				animation.tweens.push( tween );
13196
				return tween;
13197
			},
13198
			stop: function( gotoEnd ) {
13199
				var index = 0,
13200
					// If we are going to the end, we want to run all the tweens
13201
					// otherwise we skip this part
13202
					length = gotoEnd ? animation.tweens.length : 0;
13203
				if ( stopped ) {
13204
					return this;
13205
				}
13206
				stopped = true;
13207
				for ( ; index < length ; index++ ) {
13208
					animation.tweens[ index ].run( 1 );
13209
				}
13210
13211
				// Resolve when we played the last frame; otherwise, reject
13212
				if ( gotoEnd ) {
13213
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
13214
				} else {
13215
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
13216
				}
13217
				return this;
13218
			}
13219
		}),
13220
		props = animation.props;
13221
13222
	propFilter( props, animation.opts.specialEasing );
13223
13224
	for ( ; index < length ; index++ ) {
13225
		result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
13226
		if ( result ) {
13227
			return result;
13228
		}
13229
	}
13230
13231
	jQuery.map( props, createTween, animation );
13232
13233
	if ( jQuery.isFunction( animation.opts.start ) ) {
13234
		animation.opts.start.call( elem, animation );
13235
	}
13236
13237
	jQuery.fx.timer(
13238
		jQuery.extend( tick, {
13239
			elem: elem,
13240
			anim: animation,
13241
			queue: animation.opts.queue
13242
		})
13243
	);
13244
13245
	// attach callbacks from options
13246
	return animation.progress( animation.opts.progress )
13247
		.done( animation.opts.done, animation.opts.complete )
13248
		.fail( animation.opts.fail )
13249
		.always( animation.opts.always );
13250
}
13251
13252
jQuery.Animation = jQuery.extend( Animation, {
13253
13254
	tweener: function( props, callback ) {
13255
		if ( jQuery.isFunction( props ) ) {
13256
			callback = props;
13257
			props = [ "*" ];
13258
		} else {
13259
			props = props.split(" ");
13260
		}
13261
13262
		var prop,
13263
			index = 0,
13264
			length = props.length;
13265
13266
		for ( ; index < length ; index++ ) {
13267
			prop = props[ index ];
13268
			tweeners[ prop ] = tweeners[ prop ] || [];
13269
			tweeners[ prop ].unshift( callback );
13270
		}
13271
	},
13272
13273
	prefilter: function( callback, prepend ) {
13274
		if ( prepend ) {
13275
			animationPrefilters.unshift( callback );
13276
		} else {
13277
			animationPrefilters.push( callback );
13278
		}
13279
	}
13280
});
13281
13282
jQuery.speed = function( speed, easing, fn ) {
13283
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
13284
		complete: fn || !fn && easing ||
13285
			jQuery.isFunction( speed ) && speed,
13286
		duration: speed,
13287
		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
13288
	};
13289
13290
	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
13291
		opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
13292
13293
	// Normalize opt.queue - true/undefined/null -> "fx"
13294
	if ( opt.queue == null || opt.queue === true ) {
13295
		opt.queue = "fx";
13296
	}
13297
13298
	// Queueing
13299
	opt.old = opt.complete;
13300
13301
	opt.complete = function() {
13302
		if ( jQuery.isFunction( opt.old ) ) {
13303
			opt.old.call( this );
13304
		}
13305
13306
		if ( opt.queue ) {
13307
			jQuery.dequeue( this, opt.queue );
13308
		}
13309
	};
13310
13311
	return opt;
13312
};
13313
13314
jQuery.fn.extend({
13315
	fadeTo: function( speed, to, easing, callback ) {
13316
13317
		// Show any hidden elements after setting opacity to 0
13318
		return this.filter( isHidden ).css( "opacity", 0 ).show()
13319
13320
			// Animate to the value specified
13321
			.end().animate({ opacity: to }, speed, easing, callback );
13322
	},
13323
	animate: function( prop, speed, easing, callback ) {
13324
		var empty = jQuery.isEmptyObject( prop ),
13325
			optall = jQuery.speed( speed, easing, callback ),
13326
			doAnimation = function() {
13327
				// Operate on a copy of prop so per-property easing won't be lost
13328
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
13329
13330
				// Empty animations, or finishing resolves immediately
13331
				if ( empty || data_priv.get( this, "finish" ) ) {
13332
					anim.stop( true );
13333
				}
13334
			};
13335
			doAnimation.finish = doAnimation;
13336
13337
		return empty || optall.queue === false ?
13338
			this.each( doAnimation ) :
13339
			this.queue( optall.queue, doAnimation );
13340
	},
13341
	stop: function( type, clearQueue, gotoEnd ) {
13342
		var stopQueue = function( hooks ) {
13343
			var stop = hooks.stop;
13344
			delete hooks.stop;
13345
			stop( gotoEnd );
13346
		};
13347
13348
		if ( typeof type !== "string" ) {
13349
			gotoEnd = clearQueue;
13350
			clearQueue = type;
13351
			type = undefined;
13352
		}
13353
		if ( clearQueue && type !== false ) {
13354
			this.queue( type || "fx", [] );
13355
		}
13356
13357
		return this.each(function() {
13358
			var dequeue = true,
13359
				index = type != null && type + "queueHooks",
13360
				timers = jQuery.timers,
13361
				data = data_priv.get( this );
13362
13363
			if ( index ) {
13364
				if ( data[ index ] && data[ index ].stop ) {
13365
					stopQueue( data[ index ] );
13366
				}
13367
			} else {
13368
				for ( index in data ) {
13369
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
13370
						stopQueue( data[ index ] );
13371
					}
13372
				}
13373
			}
13374
13375
			for ( index = timers.length; index--; ) {
13376
				if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
13377
					timers[ index ].anim.stop( gotoEnd );
13378
					dequeue = false;
13379
					timers.splice( index, 1 );
13380
				}
13381
			}
13382
13383
			// Start the next in the queue if the last step wasn't forced.
13384
			// Timers currently will call their complete callbacks, which
13385
			// will dequeue but only if they were gotoEnd.
13386
			if ( dequeue || !gotoEnd ) {
13387
				jQuery.dequeue( this, type );
13388
			}
13389
		});
13390
	},
13391
	finish: function( type ) {
13392
		if ( type !== false ) {
13393
			type = type || "fx";
13394
		}
13395
		return this.each(function() {
13396
			var index,
13397
				data = data_priv.get( this ),
13398
				queue = data[ type + "queue" ],
13399
				hooks = data[ type + "queueHooks" ],
13400
				timers = jQuery.timers,
13401
				length = queue ? queue.length : 0;
13402
13403
			// Enable finishing flag on private data
13404
			data.finish = true;
13405
13406
			// Empty the queue first
13407
			jQuery.queue( this, type, [] );
13408
13409
			if ( hooks && hooks.stop ) {
13410
				hooks.stop.call( this, true );
13411
			}
13412
13413
			// Look for any active animations, and finish them
13414
			for ( index = timers.length; index--; ) {
13415
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
13416
					timers[ index ].anim.stop( true );
13417
					timers.splice( index, 1 );
13418
				}
13419
			}
13420
13421
			// Look for any animations in the old queue and finish them
13422
			for ( index = 0; index < length; index++ ) {
13423
				if ( queue[ index ] && queue[ index ].finish ) {
13424
					queue[ index ].finish.call( this );
13425
				}
13426
			}
13427
13428
			// Turn off finishing flag
13429
			delete data.finish;
13430
		});
13431
	}
13432
});
13433
13434
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
13435
	var cssFn = jQuery.fn[ name ];
13436
	jQuery.fn[ name ] = function( speed, easing, callback ) {
13437
		return speed == null || typeof speed === "boolean" ?
13438
			cssFn.apply( this, arguments ) :
13439
			this.animate( genFx( name, true ), speed, easing, callback );
13440
	};
13441
});
13442
13443
// Generate shortcuts for custom animations
13444
jQuery.each({
13445
	slideDown: genFx("show"),
13446
	slideUp: genFx("hide"),
13447
	slideToggle: genFx("toggle"),
13448
	fadeIn: { opacity: "show" },
13449
	fadeOut: { opacity: "hide" },
13450
	fadeToggle: { opacity: "toggle" }
13451
}, function( name, props ) {
13452
	jQuery.fn[ name ] = function( speed, easing, callback ) {
13453
		return this.animate( props, speed, easing, callback );
13454
	};
13455
});
13456
13457
jQuery.timers = [];
13458
jQuery.fx.tick = function() {
13459
	var timer,
13460
		i = 0,
13461
		timers = jQuery.timers;
13462
13463
	fxNow = jQuery.now();
13464
13465
	for ( ; i < timers.length; i++ ) {
13466
		timer = timers[ i ];
13467
		// Checks the timer has not already been removed
13468
		if ( !timer() && timers[ i ] === timer ) {
13469
			timers.splice( i--, 1 );
13470
		}
13471
	}
13472
13473
	if ( !timers.length ) {
13474
		jQuery.fx.stop();
13475
	}
13476
	fxNow = undefined;
13477
};
13478
13479
jQuery.fx.timer = function( timer ) {
13480
	jQuery.timers.push( timer );
13481
	if ( timer() ) {
13482
		jQuery.fx.start();
13483
	} else {
13484
		jQuery.timers.pop();
13485
	}
13486
};
13487
13488
jQuery.fx.interval = 13;
13489
13490
jQuery.fx.start = function() {
13491
	if ( !timerId ) {
13492
		timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
13493
	}
13494
};
13495
13496
jQuery.fx.stop = function() {
13497
	clearInterval( timerId );
13498
	timerId = null;
13499
};
13500
13501
jQuery.fx.speeds = {
13502
	slow: 600,
13503
	fast: 200,
13504
	// Default speed
13505
	_default: 400
13506
};
13507
13508
13509
// Based off of the plugin by Clint Helfers, with permission.
13510
// http://blindsignals.com/index.php/2009/07/jquery-delay/
13511
jQuery.fn.delay = function( time, type ) {
13512
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
13513
	type = type || "fx";
13514
13515
	return this.queue( type, function( next, hooks ) {
13516
		var timeout = setTimeout( next, time );
13517
		hooks.stop = function() {
13518
			clearTimeout( timeout );
13519
		};
13520
	});
13521
};
13522
13523
13524
(function() {
13525
	var input = document.createElement( "input" ),
13526
		select = document.createElement( "select" ),
13527
		opt = select.appendChild( document.createElement( "option" ) );
13528
13529
	input.type = "checkbox";
13530
13531
	// Support: iOS<=5.1, Android<=4.2+
13532
	// Default value for a checkbox should be "on"
13533
	support.checkOn = input.value !== "";
13534
13535
	// Support: IE<=11+
13536
	// Must access selectedIndex to make default options select
13537
	support.optSelected = opt.selected;
13538
13539
	// Support: Android<=2.3
13540
	// Options inside disabled selects are incorrectly marked as disabled
13541
	select.disabled = true;
13542
	support.optDisabled = !opt.disabled;
13543
13544
	// Support: IE<=11+
13545
	// An input loses its value after becoming a radio
13546
	input = document.createElement( "input" );
13547
	input.value = "t";
13548
	input.type = "radio";
13549
	support.radioValue = input.value === "t";
13550
})();
13551
13552
13553
var nodeHook, boolHook,
13554
	attrHandle = jQuery.expr.attrHandle;
13555
13556
jQuery.fn.extend({
13557
	attr: function( name, value ) {
13558
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
13559
	},
13560
13561
	removeAttr: function( name ) {
13562
		return this.each(function() {
13563
			jQuery.removeAttr( this, name );
13564
		});
13565
	}
13566
});
13567
13568
jQuery.extend({
13569
	attr: function( elem, name, value ) {
13570
		var hooks, ret,
13571
			nType = elem.nodeType;
13572
13573
		// don't get/set attributes on text, comment and attribute nodes
13574
		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
13575
			return;
13576
		}
13577
13578
		// Fallback to prop when attributes are not supported
13579
		if ( typeof elem.getAttribute === strundefined ) {
13580
			return jQuery.prop( elem, name, value );
13581
		}
13582
13583
		// All attributes are lowercase
13584
		// Grab necessary hook if one is defined
13585
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
13586
			name = name.toLowerCase();
13587
			hooks = jQuery.attrHooks[ name ] ||
13588
				( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
13589
		}
13590
13591
		if ( value !== undefined ) {
13592
13593
			if ( value === null ) {
13594
				jQuery.removeAttr( elem, name );
13595
13596
			} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
13597
				return ret;
13598
13599
			} else {
13600
				elem.setAttribute( name, value + "" );
13601
				return value;
13602
			}
13603
13604
		} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
13605
			return ret;
13606
13607
		} else {
13608
			ret = jQuery.find.attr( elem, name );
13609
13610
			// Non-existent attributes return null, we normalize to undefined
13611
			return ret == null ?
13612
				undefined :
13613
				ret;
13614
		}
13615
	},
13616
13617
	removeAttr: function( elem, value ) {
13618
		var name, propName,
13619
			i = 0,
13620
			attrNames = value && value.match( rnotwhite );
13621
13622
		if ( attrNames && elem.nodeType === 1 ) {
13623
			while ( (name = attrNames[i++]) ) {
13624
				propName = jQuery.propFix[ name ] || name;
13625
13626
				// Boolean attributes get special treatment (#10870)
13627
				if ( jQuery.expr.match.bool.test( name ) ) {
13628
					// Set corresponding property to false
13629
					elem[ propName ] = false;
13630
				}
13631
13632
				elem.removeAttribute( name );
13633
			}
13634
		}
13635
	},
13636
13637
	attrHooks: {
13638
		type: {
13639
			set: function( elem, value ) {
13640
				if ( !support.radioValue && value === "radio" &&
13641
					jQuery.nodeName( elem, "input" ) ) {
13642
					var val = elem.value;
13643
					elem.setAttribute( "type", value );
13644
					if ( val ) {
13645
						elem.value = val;
13646
					}
13647
					return value;
13648
				}
13649
			}
13650
		}
13651
	}
13652
});
13653
13654
// Hooks for boolean attributes
13655
boolHook = {
13656
	set: function( elem, value, name ) {
13657
		if ( value === false ) {
13658
			// Remove boolean attributes when set to false
13659
			jQuery.removeAttr( elem, name );
13660
		} else {
13661
			elem.setAttribute( name, name );
13662
		}
13663
		return name;
13664
	}
13665
};
13666
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
13667
	var getter = attrHandle[ name ] || jQuery.find.attr;
13668
13669
	attrHandle[ name ] = function( elem, name, isXML ) {
13670
		var ret, handle;
13671
		if ( !isXML ) {
13672
			// Avoid an infinite loop by temporarily removing this function from the getter
13673
			handle = attrHandle[ name ];
13674
			attrHandle[ name ] = ret;
13675
			ret = getter( elem, name, isXML ) != null ?
13676
				name.toLowerCase() :
13677
				null;
13678
			attrHandle[ name ] = handle;
13679
		}
13680
		return ret;
13681
	};
13682
});
13683
13684
13685
13686
13687
var rfocusable = /^(?:input|select|textarea|button)$/i;
13688
13689
jQuery.fn.extend({
13690
	prop: function( name, value ) {
13691
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
13692
	},
13693
13694
	removeProp: function( name ) {
13695
		return this.each(function() {
13696
			delete this[ jQuery.propFix[ name ] || name ];
13697
		});
13698
	}
13699
});
13700
13701
jQuery.extend({
13702
	propFix: {
13703
		"for": "htmlFor",
13704
		"class": "className"
13705
	},
13706
13707
	prop: function( elem, name, value ) {
13708
		var ret, hooks, notxml,
13709
			nType = elem.nodeType;
13710
13711
		// Don't get/set properties on text, comment and attribute nodes
13712
		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
13713
			return;
13714
		}
13715
13716
		notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
13717
13718
		if ( notxml ) {
13719
			// Fix name and attach hooks
13720
			name = jQuery.propFix[ name ] || name;
13721
			hooks = jQuery.propHooks[ name ];
13722
		}
13723
13724
		if ( value !== undefined ) {
13725
			return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
13726
				ret :
13727
				( elem[ name ] = value );
13728
13729
		} else {
13730
			return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
13731
				ret :
13732
				elem[ name ];
13733
		}
13734
	},
13735
13736
	propHooks: {
13737
		tabIndex: {
13738
			get: function( elem ) {
13739
				return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
13740
					elem.tabIndex :
13741
					-1;
13742
			}
13743
		}
13744
	}
13745
});
13746
13747
if ( !support.optSelected ) {
13748
	jQuery.propHooks.selected = {
13749
		get: function( elem ) {
13750
			var parent = elem.parentNode;
13751
			if ( parent && parent.parentNode ) {
13752
				parent.parentNode.selectedIndex;
13753
			}
13754
			return null;
13755
		}
13756
	};
13757
}
13758
13759
jQuery.each([
13760
	"tabIndex",
13761
	"readOnly",
13762
	"maxLength",
13763
	"cellSpacing",
13764
	"cellPadding",
13765
	"rowSpan",
13766
	"colSpan",
13767
	"useMap",
13768
	"frameBorder",
13769
	"contentEditable"
13770
], function() {
13771
	jQuery.propFix[ this.toLowerCase() ] = this;
13772
});
13773
13774
13775
13776
13777
var rclass = /[\t\r\n\f]/g;
13778
13779
jQuery.fn.extend({
13780
	addClass: function( value ) {
13781
		var classes, elem, cur, clazz, j, finalValue,
13782
			proceed = typeof value === "string" && value,
13783
			i = 0,
13784
			len = this.length;
13785
13786
		if ( jQuery.isFunction( value ) ) {
13787
			return this.each(function( j ) {
13788
				jQuery( this ).addClass( value.call( this, j, this.className ) );
13789
			});
13790
		}
13791
13792
		if ( proceed ) {
13793
			// The disjunction here is for better compressibility (see removeClass)
13794
			classes = ( value || "" ).match( rnotwhite ) || [];
13795
13796
			for ( ; i < len; i++ ) {
13797
				elem = this[ i ];
13798
				cur = elem.nodeType === 1 && ( elem.className ?
13799
					( " " + elem.className + " " ).replace( rclass, " " ) :
13800
					" "
13801
				);
13802
13803
				if ( cur ) {
13804
					j = 0;
13805
					while ( (clazz = classes[j++]) ) {
13806
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
13807
							cur += clazz + " ";
13808
						}
13809
					}
13810
13811
					// only assign if different to avoid unneeded rendering.
13812
					finalValue = jQuery.trim( cur );
13813
					if ( elem.className !== finalValue ) {
13814
						elem.className = finalValue;
13815
					}
13816
				}
13817
			}
13818
		}
13819
13820
		return this;
13821
	},
13822
13823
	removeClass: function( value ) {
13824
		var classes, elem, cur, clazz, j, finalValue,
13825
			proceed = arguments.length === 0 || typeof value === "string" && value,
13826
			i = 0,
13827
			len = this.length;
13828
13829
		if ( jQuery.isFunction( value ) ) {
13830
			return this.each(function( j ) {
13831
				jQuery( this ).removeClass( value.call( this, j, this.className ) );
13832
			});
13833
		}
13834
		if ( proceed ) {
13835
			classes = ( value || "" ).match( rnotwhite ) || [];
13836
13837
			for ( ; i < len; i++ ) {
13838
				elem = this[ i ];
13839
				// This expression is here for better compressibility (see addClass)
13840
				cur = elem.nodeType === 1 && ( elem.className ?
13841
					( " " + elem.className + " " ).replace( rclass, " " ) :
13842
					""
13843
				);
13844
13845
				if ( cur ) {
13846
					j = 0;
13847
					while ( (clazz = classes[j++]) ) {
13848
						// Remove *all* instances
13849
						while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
13850
							cur = cur.replace( " " + clazz + " ", " " );
13851
						}
13852
					}
13853
13854
					// Only assign if different to avoid unneeded rendering.
13855
					finalValue = value ? jQuery.trim( cur ) : "";
13856
					if ( elem.className !== finalValue ) {
13857
						elem.className = finalValue;
13858
					}
13859
				}
13860
			}
13861
		}
13862
13863
		return this;
13864
	},
13865
13866
	toggleClass: function( value, stateVal ) {
13867
		var type = typeof value;
13868
13869
		if ( typeof stateVal === "boolean" && type === "string" ) {
13870
			return stateVal ? this.addClass( value ) : this.removeClass( value );
13871
		}
13872
13873
		if ( jQuery.isFunction( value ) ) {
13874
			return this.each(function( i ) {
13875
				jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
13876
			});
13877
		}
13878
13879
		return this.each(function() {
13880
			if ( type === "string" ) {
13881
				// Toggle individual class names
13882
				var className,
13883
					i = 0,
13884
					self = jQuery( this ),
13885
					classNames = value.match( rnotwhite ) || [];
13886
13887
				while ( (className = classNames[ i++ ]) ) {
13888
					// Check each className given, space separated list
13889
					if ( self.hasClass( className ) ) {
13890
						self.removeClass( className );
13891
					} else {
13892
						self.addClass( className );
13893
					}
13894
				}
13895
13896
			// Toggle whole class name
13897
			} else if ( type === strundefined || type === "boolean" ) {
13898
				if ( this.className ) {
13899
					// store className if set
13900
					data_priv.set( this, "__className__", this.className );
13901
				}
13902
13903
				// If the element has a class name or if we're passed `false`,
13904
				// then remove the whole classname (if there was one, the above saved it).
13905
				// Otherwise bring back whatever was previously saved (if anything),
13906
				// falling back to the empty string if nothing was stored.
13907
				this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
13908
			}
13909
		});
13910
	},
13911
13912
	hasClass: function( selector ) {
13913
		var className = " " + selector + " ",
13914
			i = 0,
13915
			l = this.length;
13916
		for ( ; i < l; i++ ) {
13917
			if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
13918
				return true;
13919
			}
13920
		}
13921
13922
		return false;
13923
	}
13924
});
13925
13926
13927
13928
13929
var rreturn = /\r/g;
13930
13931
jQuery.fn.extend({
13932
	val: function( value ) {
13933
		var hooks, ret, isFunction,
13934
			elem = this[0];
13935
13936
		if ( !arguments.length ) {
13937
			if ( elem ) {
13938
				hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
13939
13940
				if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
13941
					return ret;
13942
				}
13943
13944
				ret = elem.value;
13945
13946
				return typeof ret === "string" ?
13947
					// Handle most common string cases
13948
					ret.replace(rreturn, "") :
13949
					// Handle cases where value is null/undef or number
13950
					ret == null ? "" : ret;
13951
			}
13952
13953
			return;
13954
		}
13955
13956
		isFunction = jQuery.isFunction( value );
13957
13958
		return this.each(function( i ) {
13959
			var val;
13960
13961
			if ( this.nodeType !== 1 ) {
13962
				return;
13963
			}
13964
13965
			if ( isFunction ) {
13966
				val = value.call( this, i, jQuery( this ).val() );
13967
			} else {
13968
				val = value;
13969
			}
13970
13971
			// Treat null/undefined as ""; convert numbers to string
13972
			if ( val == null ) {
13973
				val = "";
13974
13975
			} else if ( typeof val === "number" ) {
13976
				val += "";
13977
13978
			} else if ( jQuery.isArray( val ) ) {
13979
				val = jQuery.map( val, function( value ) {
13980
					return value == null ? "" : value + "";
13981
				});
13982
			}
13983
13984
			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
13985
13986
			// If set returns undefined, fall back to normal setting
13987
			if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
13988
				this.value = val;
13989
			}
13990
		});
13991
	}
13992
});
13993
13994
jQuery.extend({
13995
	valHooks: {
13996
		option: {
13997
			get: function( elem ) {
13998
				var val = jQuery.find.attr( elem, "value" );
13999
				return val != null ?
14000
					val :
14001
					// Support: IE10-11+
14002
					// option.text throws exceptions (#14686, #14858)
14003
					jQuery.trim( jQuery.text( elem ) );
14004
			}
14005
		},
14006
		select: {
14007
			get: function( elem ) {
14008
				var value, option,
14009
					options = elem.options,
14010
					index = elem.selectedIndex,
14011
					one = elem.type === "select-one" || index < 0,
14012
					values = one ? null : [],
14013
					max = one ? index + 1 : options.length,
14014
					i = index < 0 ?
14015
						max :
14016
						one ? index : 0;
14017
14018
				// Loop through all the selected options
14019
				for ( ; i < max; i++ ) {
14020
					option = options[ i ];
14021
14022
					// IE6-9 doesn't update selected after form reset (#2551)
14023
					if ( ( option.selected || i === index ) &&
14024
							// Don't return options that are disabled or in a disabled optgroup
14025
							( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
14026
							( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
14027
14028
						// Get the specific value for the option
14029
						value = jQuery( option ).val();
14030
14031
						// We don't need an array for one selects
14032
						if ( one ) {
14033
							return value;
14034
						}
14035
14036
						// Multi-Selects return an array
14037
						values.push( value );
14038
					}
14039
				}
14040
14041
				return values;
14042
			},
14043
14044
			set: function( elem, value ) {
14045
				var optionSet, option,
14046
					options = elem.options,
14047
					values = jQuery.makeArray( value ),
14048
					i = options.length;
14049
14050
				while ( i-- ) {
14051
					option = options[ i ];
14052
					if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
14053
						optionSet = true;
14054
					}
14055
				}
14056
14057
				// Force browsers to behave consistently when non-matching value is set
14058
				if ( !optionSet ) {
14059
					elem.selectedIndex = -1;
14060
				}
14061
				return values;
14062
			}
14063
		}
14064
	}
14065
});
14066
14067
// Radios and checkboxes getter/setter
14068
jQuery.each([ "radio", "checkbox" ], function() {
14069
	jQuery.valHooks[ this ] = {
14070
		set: function( elem, value ) {
14071
			if ( jQuery.isArray( value ) ) {
14072
				return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
14073
			}
14074
		}
14075
	};
14076
	if ( !support.checkOn ) {
14077
		jQuery.valHooks[ this ].get = function( elem ) {
14078
			return elem.getAttribute("value") === null ? "on" : elem.value;
14079
		};
14080
	}
14081
});
14082
14083
14084
14085
14086
// Return jQuery for attributes-only inclusion
14087
14088
14089
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
14090
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
14091
	"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
14092
14093
	// Handle event binding
14094
	jQuery.fn[ name ] = function( data, fn ) {
14095
		return arguments.length > 0 ?
14096
			this.on( name, null, data, fn ) :
14097
			this.trigger( name );
14098
	};
14099
});
14100
14101
jQuery.fn.extend({
14102
	hover: function( fnOver, fnOut ) {
14103
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
14104
	},
14105
14106
	bind: function( types, data, fn ) {
14107
		return this.on( types, null, data, fn );
14108
	},
14109
	unbind: function( types, fn ) {
14110
		return this.off( types, null, fn );
14111
	},
14112
14113
	delegate: function( selector, types, data, fn ) {
14114
		return this.on( types, selector, data, fn );
14115
	},
14116
	undelegate: function( selector, types, fn ) {
14117
		// ( namespace ) or ( selector, types [, fn] )
14118
		return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
14119
	}
14120
});
14121
14122
14123
var nonce = jQuery.now();
14124
14125
var rquery = (/\?/);
14126
14127
14128
14129
// Support: Android 2.3
14130
// Workaround failure to string-cast null input
14131
jQuery.parseJSON = function( data ) {
14132
	return JSON.parse( data + "" );
14133
};
14134
14135
14136
// Cross-browser xml parsing
14137
jQuery.parseXML = function( data ) {
14138
	var xml, tmp;
14139
	if ( !data || typeof data !== "string" ) {
14140
		return null;
14141
	}
14142
14143
	// Support: IE9
14144
	try {
14145
		tmp = new DOMParser();
14146
		xml = tmp.parseFromString( data, "text/xml" );
14147
	} catch ( e ) {
14148
		xml = undefined;
14149
	}
14150
14151
	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
14152
		jQuery.error( "Invalid XML: " + data );
14153
	}
14154
	return xml;
14155
};
14156
14157
14158
var
14159
	rhash = /#.*$/,
14160
	rts = /([?&])_=[^&]*/,
14161
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
14162
	// #7653, #8125, #8152: local protocol detection
14163
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
14164
	rnoContent = /^(?:GET|HEAD)$/,
14165
	rprotocol = /^\/\//,
14166
	rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
14167
14168
	/* Prefilters
14169
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
14170
	 * 2) These are called:
14171
	 *    - BEFORE asking for a transport
14172
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
14173
	 * 3) key is the dataType
14174
	 * 4) the catchall symbol "*" can be used
14175
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
14176
	 */
14177
	prefilters = {},
14178
14179
	/* Transports bindings
14180
	 * 1) key is the dataType
14181
	 * 2) the catchall symbol "*" can be used
14182
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
14183
	 */
14184
	transports = {},
14185
14186
	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
14187
	allTypes = "*/".concat( "*" ),
14188
14189
	// Document location
14190
	ajaxLocation = window.location.href,
14191
14192
	// Segment location into parts
14193
	ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
14194
14195
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
14196
function addToPrefiltersOrTransports( structure ) {
14197
14198
	// dataTypeExpression is optional and defaults to "*"
14199
	return function( dataTypeExpression, func ) {
14200
14201
		if ( typeof dataTypeExpression !== "string" ) {
14202
			func = dataTypeExpression;
14203
			dataTypeExpression = "*";
14204
		}
14205
14206
		var dataType,
14207
			i = 0,
14208
			dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
14209
14210
		if ( jQuery.isFunction( func ) ) {
14211
			// For each dataType in the dataTypeExpression
14212
			while ( (dataType = dataTypes[i++]) ) {
14213
				// Prepend if requested
14214
				if ( dataType[0] === "+" ) {
14215
					dataType = dataType.slice( 1 ) || "*";
14216
					(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
14217
14218
				// Otherwise append
14219
				} else {
14220
					(structure[ dataType ] = structure[ dataType ] || []).push( func );
14221
				}
14222
			}
14223
		}
14224
	};
14225
}
14226
14227
// Base inspection function for prefilters and transports
14228
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
14229
14230
	var inspected = {},
14231
		seekingTransport = ( structure === transports );
14232
14233
	function inspect( dataType ) {
14234
		var selected;
14235
		inspected[ dataType ] = true;
14236
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
14237
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
14238
			if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
14239
				options.dataTypes.unshift( dataTypeOrTransport );
14240
				inspect( dataTypeOrTransport );
14241
				return false;
14242
			} else if ( seekingTransport ) {
14243
				return !( selected = dataTypeOrTransport );
14244
			}
14245
		});
14246
		return selected;
14247
	}
14248
14249
	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
14250
}
14251
14252
// A special extend for ajax options
14253
// that takes "flat" options (not to be deep extended)
14254
// Fixes #9887
14255
function ajaxExtend( target, src ) {
14256
	var key, deep,
14257
		flatOptions = jQuery.ajaxSettings.flatOptions || {};
14258
14259
	for ( key in src ) {
14260
		if ( src[ key ] !== undefined ) {
14261
			( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
14262
		}
14263
	}
14264
	if ( deep ) {
14265
		jQuery.extend( true, target, deep );
14266
	}
14267
14268
	return target;
14269
}
14270
14271
/* Handles responses to an ajax request:
14272
 * - finds the right dataType (mediates between content-type and expected dataType)
14273
 * - returns the corresponding response
14274
 */
14275
function ajaxHandleResponses( s, jqXHR, responses ) {
14276
14277
	var ct, type, finalDataType, firstDataType,
14278
		contents = s.contents,
14279
		dataTypes = s.dataTypes;
14280
14281
	// Remove auto dataType and get content-type in the process
14282
	while ( dataTypes[ 0 ] === "*" ) {
14283
		dataTypes.shift();
14284
		if ( ct === undefined ) {
14285
			ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
14286
		}
14287
	}
14288
14289
	// Check if we're dealing with a known content-type
14290
	if ( ct ) {
14291
		for ( type in contents ) {
14292
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
14293
				dataTypes.unshift( type );
14294
				break;
14295
			}
14296
		}
14297
	}
14298
14299
	// Check to see if we have a response for the expected dataType
14300
	if ( dataTypes[ 0 ] in responses ) {
14301
		finalDataType = dataTypes[ 0 ];
14302
	} else {
14303
		// Try convertible dataTypes
14304
		for ( type in responses ) {
14305
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
14306
				finalDataType = type;
14307
				break;
14308
			}
14309
			if ( !firstDataType ) {
14310
				firstDataType = type;
14311
			}
14312
		}
14313
		// Or just use first one
14314
		finalDataType = finalDataType || firstDataType;
14315
	}
14316
14317
	// If we found a dataType
14318
	// We add the dataType to the list if needed
14319
	// and return the corresponding response
14320
	if ( finalDataType ) {
14321
		if ( finalDataType !== dataTypes[ 0 ] ) {
14322
			dataTypes.unshift( finalDataType );
14323
		}
14324
		return responses[ finalDataType ];
14325
	}
14326
}
14327
14328
/* Chain conversions given the request and the original response
14329
 * Also sets the responseXXX fields on the jqXHR instance
14330
 */
14331
function ajaxConvert( s, response, jqXHR, isSuccess ) {
14332
	var conv2, current, conv, tmp, prev,
14333
		converters = {},
14334
		// Work with a copy of dataTypes in case we need to modify it for conversion
14335
		dataTypes = s.dataTypes.slice();
14336
14337
	// Create converters map with lowercased keys
14338
	if ( dataTypes[ 1 ] ) {
14339
		for ( conv in s.converters ) {
14340
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
14341
		}
14342
	}
14343
14344
	current = dataTypes.shift();
14345
14346
	// Convert to each sequential dataType
14347
	while ( current ) {
14348
14349
		if ( s.responseFields[ current ] ) {
14350
			jqXHR[ s.responseFields[ current ] ] = response;
14351
		}
14352
14353
		// Apply the dataFilter if provided
14354
		if ( !prev && isSuccess && s.dataFilter ) {
14355
			response = s.dataFilter( response, s.dataType );
14356
		}
14357
14358
		prev = current;
14359
		current = dataTypes.shift();
14360
14361
		if ( current ) {
14362
14363
		// There's only work to do if current dataType is non-auto
14364
			if ( current === "*" ) {
14365
14366
				current = prev;
14367
14368
			// Convert response if prev dataType is non-auto and differs from current
14369
			} else if ( prev !== "*" && prev !== current ) {
14370
14371
				// Seek a direct converter
14372
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
14373
14374
				// If none found, seek a pair
14375
				if ( !conv ) {
14376
					for ( conv2 in converters ) {
14377
14378
						// If conv2 outputs current
14379
						tmp = conv2.split( " " );
14380
						if ( tmp[ 1 ] === current ) {
14381
14382
							// If prev can be converted to accepted input
14383
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
14384
								converters[ "* " + tmp[ 0 ] ];
14385
							if ( conv ) {
14386
								// Condense equivalence converters
14387
								if ( conv === true ) {
14388
									conv = converters[ conv2 ];
14389
14390
								// Otherwise, insert the intermediate dataType
14391
								} else if ( converters[ conv2 ] !== true ) {
14392
									current = tmp[ 0 ];
14393
									dataTypes.unshift( tmp[ 1 ] );
14394
								}
14395
								break;
14396
							}
14397
						}
14398
					}
14399
				}
14400
14401
				// Apply converter (if not an equivalence)
14402
				if ( conv !== true ) {
14403
14404
					// Unless errors are allowed to bubble, catch and return them
14405
					if ( conv && s[ "throws" ] ) {
14406
						response = conv( response );
14407
					} else {
14408
						try {
14409
							response = conv( response );
14410
						} catch ( e ) {
14411
							return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
14412
						}
14413
					}
14414
				}
14415
			}
14416
		}
14417
	}
14418
14419
	return { state: "success", data: response };
14420
}
14421
14422
jQuery.extend({
14423
14424
	// Counter for holding the number of active queries
14425
	active: 0,
14426
14427
	// Last-Modified header cache for next request
14428
	lastModified: {},
14429
	etag: {},
14430
14431
	ajaxSettings: {
14432
		url: ajaxLocation,
14433
		type: "GET",
14434
		isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
14435
		global: true,
14436
		processData: true,
14437
		async: true,
14438
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
14439
		/*
14440
		timeout: 0,
14441
		data: null,
14442
		dataType: null,
14443
		username: null,
14444
		password: null,
14445
		cache: null,
14446
		throws: false,
14447
		traditional: false,
14448
		headers: {},
14449
		*/
14450
14451
		accepts: {
14452
			"*": allTypes,
14453
			text: "text/plain",
14454
			html: "text/html",
14455
			xml: "application/xml, text/xml",
14456
			json: "application/json, text/javascript"
14457
		},
14458
14459
		contents: {
14460
			xml: /xml/,
14461
			html: /html/,
14462
			json: /json/
14463
		},
14464
14465
		responseFields: {
14466
			xml: "responseXML",
14467
			text: "responseText",
14468
			json: "responseJSON"
14469
		},
14470
14471
		// Data converters
14472
		// Keys separate source (or catchall "*") and destination types with a single space
14473
		converters: {
14474
14475
			// Convert anything to text
14476
			"* text": String,
14477
14478
			// Text to html (true = no transformation)
14479
			"text html": true,
14480
14481
			// Evaluate text as a json expression
14482
			"text json": jQuery.parseJSON,
14483
14484
			// Parse text as xml
14485
			"text xml": jQuery.parseXML
14486
		},
14487
14488
		// For options that shouldn't be deep extended:
14489
		// you can add your own custom options here if
14490
		// and when you create one that shouldn't be
14491
		// deep extended (see ajaxExtend)
14492
		flatOptions: {
14493
			url: true,
14494
			context: true
14495
		}
14496
	},
14497
14498
	// Creates a full fledged settings object into target
14499
	// with both ajaxSettings and settings fields.
14500
	// If target is omitted, writes into ajaxSettings.
14501
	ajaxSetup: function( target, settings ) {
14502
		return settings ?
14503
14504
			// Building a settings object
14505
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
14506
14507
			// Extending ajaxSettings
14508
			ajaxExtend( jQuery.ajaxSettings, target );
14509
	},
14510
14511
	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
14512
	ajaxTransport: addToPrefiltersOrTransports( transports ),
14513
14514
	// Main method
14515
	ajax: function( url, options ) {
14516
14517
		// If url is an object, simulate pre-1.5 signature
14518
		if ( typeof url === "object" ) {
14519
			options = url;
14520
			url = undefined;
14521
		}
14522
14523
		// Force options to be an object
14524
		options = options || {};
14525
14526
		var transport,
14527
			// URL without anti-cache param
14528
			cacheURL,
14529
			// Response headers
14530
			responseHeadersString,
14531
			responseHeaders,
14532
			// timeout handle
14533
			timeoutTimer,
14534
			// Cross-domain detection vars
14535
			parts,
14536
			// To know if global events are to be dispatched
14537
			fireGlobals,
14538
			// Loop variable
14539
			i,
14540
			// Create the final options object
14541
			s = jQuery.ajaxSetup( {}, options ),
14542
			// Callbacks context
14543
			callbackContext = s.context || s,
14544
			// Context for global events is callbackContext if it is a DOM node or jQuery collection
14545
			globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
14546
				jQuery( callbackContext ) :
14547
				jQuery.event,
14548
			// Deferreds
14549
			deferred = jQuery.Deferred(),
14550
			completeDeferred = jQuery.Callbacks("once memory"),
14551
			// Status-dependent callbacks
14552
			statusCode = s.statusCode || {},
14553
			// Headers (they are sent all at once)
14554
			requestHeaders = {},
14555
			requestHeadersNames = {},
14556
			// The jqXHR state
14557
			state = 0,
14558
			// Default abort message
14559
			strAbort = "canceled",
14560
			// Fake xhr
14561
			jqXHR = {
14562
				readyState: 0,
14563
14564
				// Builds headers hashtable if needed
14565
				getResponseHeader: function( key ) {
14566
					var match;
14567
					if ( state === 2 ) {
14568
						if ( !responseHeaders ) {
14569
							responseHeaders = {};
14570
							while ( (match = rheaders.exec( responseHeadersString )) ) {
14571
								responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
14572
							}
14573
						}
14574
						match = responseHeaders[ key.toLowerCase() ];
14575
					}
14576
					return match == null ? null : match;
14577
				},
14578
14579
				// Raw string
14580
				getAllResponseHeaders: function() {
14581
					return state === 2 ? responseHeadersString : null;
14582
				},
14583
14584
				// Caches the header
14585
				setRequestHeader: function( name, value ) {
14586
					var lname = name.toLowerCase();
14587
					if ( !state ) {
14588
						name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
14589
						requestHeaders[ name ] = value;
14590
					}
14591
					return this;
14592
				},
14593
14594
				// Overrides response content-type header
14595
				overrideMimeType: function( type ) {
14596
					if ( !state ) {
14597
						s.mimeType = type;
14598
					}
14599
					return this;
14600
				},
14601
14602
				// Status-dependent callbacks
14603
				statusCode: function( map ) {
14604
					var code;
14605
					if ( map ) {
14606
						if ( state < 2 ) {
14607
							for ( code in map ) {
14608
								// Lazy-add the new callback in a way that preserves old ones
14609
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
14610
							}
14611
						} else {
14612
							// Execute the appropriate callbacks
14613
							jqXHR.always( map[ jqXHR.status ] );
14614
						}
14615
					}
14616
					return this;
14617
				},
14618
14619
				// Cancel the request
14620
				abort: function( statusText ) {
14621
					var finalText = statusText || strAbort;
14622
					if ( transport ) {
14623
						transport.abort( finalText );
14624
					}
14625
					done( 0, finalText );
14626
					return this;
14627
				}
14628
			};
14629
14630
		// Attach deferreds
14631
		deferred.promise( jqXHR ).complete = completeDeferred.add;
14632
		jqXHR.success = jqXHR.done;
14633
		jqXHR.error = jqXHR.fail;
14634
14635
		// Remove hash character (#7531: and string promotion)
14636
		// Add protocol if not provided (prefilters might expect it)
14637
		// Handle falsy url in the settings object (#10093: consistency with old signature)
14638
		// We also use the url parameter if available
14639
		s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
14640
			.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
14641
14642
		// Alias method option to type as per ticket #12004
14643
		s.type = options.method || options.type || s.method || s.type;
14644
14645
		// Extract dataTypes list
14646
		s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
14647
14648
		// A cross-domain request is in order when we have a protocol:host:port mismatch
14649
		if ( s.crossDomain == null ) {
14650
			parts = rurl.exec( s.url.toLowerCase() );
14651
			s.crossDomain = !!( parts &&
14652
				( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
14653
					( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
14654
						( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
14655
			);
14656
		}
14657
14658
		// Convert data if not already a string
14659
		if ( s.data && s.processData && typeof s.data !== "string" ) {
14660
			s.data = jQuery.param( s.data, s.traditional );
14661
		}
14662
14663
		// Apply prefilters
14664
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
14665
14666
		// If request was aborted inside a prefilter, stop there
14667
		if ( state === 2 ) {
14668
			return jqXHR;
14669
		}
14670
14671
		// We can fire global events as of now if asked to
14672
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
14673
		fireGlobals = jQuery.event && s.global;
14674
14675
		// Watch for a new set of requests
14676
		if ( fireGlobals && jQuery.active++ === 0 ) {
14677
			jQuery.event.trigger("ajaxStart");
14678
		}
14679
14680
		// Uppercase the type
14681
		s.type = s.type.toUpperCase();
14682
14683
		// Determine if request has content
14684
		s.hasContent = !rnoContent.test( s.type );
14685
14686
		// Save the URL in case we're toying with the If-Modified-Since
14687
		// and/or If-None-Match header later on
14688
		cacheURL = s.url;
14689
14690
		// More options handling for requests with no content
14691
		if ( !s.hasContent ) {
14692
14693
			// If data is available, append data to url
14694
			if ( s.data ) {
14695
				cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
14696
				// #9682: remove data so that it's not used in an eventual retry
14697
				delete s.data;
14698
			}
14699
14700
			// Add anti-cache in url if needed
14701
			if ( s.cache === false ) {
14702
				s.url = rts.test( cacheURL ) ?
14703
14704
					// If there is already a '_' parameter, set its value
14705
					cacheURL.replace( rts, "$1_=" + nonce++ ) :
14706
14707
					// Otherwise add one to the end
14708
					cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
14709
			}
14710
		}
14711
14712
		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14713
		if ( s.ifModified ) {
14714
			if ( jQuery.lastModified[ cacheURL ] ) {
14715
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
14716
			}
14717
			if ( jQuery.etag[ cacheURL ] ) {
14718
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
14719
			}
14720
		}
14721
14722
		// Set the correct header, if data is being sent
14723
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
14724
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
14725
		}
14726
14727
		// Set the Accepts header for the server, depending on the dataType
14728
		jqXHR.setRequestHeader(
14729
			"Accept",
14730
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
14731
				s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
14732
				s.accepts[ "*" ]
14733
		);
14734
14735
		// Check for headers option
14736
		for ( i in s.headers ) {
14737
			jqXHR.setRequestHeader( i, s.headers[ i ] );
14738
		}
14739
14740
		// Allow custom headers/mimetypes and early abort
14741
		if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
14742
			// Abort if not done already and return
14743
			return jqXHR.abort();
14744
		}
14745
14746
		// Aborting is no longer a cancellation
14747
		strAbort = "abort";
14748
14749
		// Install callbacks on deferreds
14750
		for ( i in { success: 1, error: 1, complete: 1 } ) {
14751
			jqXHR[ i ]( s[ i ] );
14752
		}
14753
14754
		// Get transport
14755
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
14756
14757
		// If no transport, we auto-abort
14758
		if ( !transport ) {
14759
			done( -1, "No Transport" );
14760
		} else {
14761
			jqXHR.readyState = 1;
14762
14763
			// Send global event
14764
			if ( fireGlobals ) {
14765
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
14766
			}
14767
			// Timeout
14768
			if ( s.async && s.timeout > 0 ) {
14769
				timeoutTimer = setTimeout(function() {
14770
					jqXHR.abort("timeout");
14771
				}, s.timeout );
14772
			}
14773
14774
			try {
14775
				state = 1;
14776
				transport.send( requestHeaders, done );
14777
			} catch ( e ) {
14778
				// Propagate exception as error if not done
14779
				if ( state < 2 ) {
14780
					done( -1, e );
14781
				// Simply rethrow otherwise
14782
				} else {
14783
					throw e;
14784
				}
14785
			}
14786
		}
14787
14788
		// Callback for when everything is done
14789
		function done( status, nativeStatusText, responses, headers ) {
14790
			var isSuccess, success, error, response, modified,
14791
				statusText = nativeStatusText;
14792
14793
			// Called once
14794
			if ( state === 2 ) {
14795
				return;
14796
			}
14797
14798
			// State is "done" now
14799
			state = 2;
14800
14801
			// Clear timeout if it exists
14802
			if ( timeoutTimer ) {
14803
				clearTimeout( timeoutTimer );
14804
			}
14805
14806
			// Dereference transport for early garbage collection
14807
			// (no matter how long the jqXHR object will be used)
14808
			transport = undefined;
14809
14810
			// Cache response headers
14811
			responseHeadersString = headers || "";
14812
14813
			// Set readyState
14814
			jqXHR.readyState = status > 0 ? 4 : 0;
14815
14816
			// Determine if successful
14817
			isSuccess = status >= 200 && status < 300 || status === 304;
14818
14819
			// Get response data
14820
			if ( responses ) {
14821
				response = ajaxHandleResponses( s, jqXHR, responses );
14822
			}
14823
14824
			// Convert no matter what (that way responseXXX fields are always set)
14825
			response = ajaxConvert( s, response, jqXHR, isSuccess );
14826
14827
			// If successful, handle type chaining
14828
			if ( isSuccess ) {
14829
14830
				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14831
				if ( s.ifModified ) {
14832
					modified = jqXHR.getResponseHeader("Last-Modified");
14833
					if ( modified ) {
14834
						jQuery.lastModified[ cacheURL ] = modified;
14835
					}
14836
					modified = jqXHR.getResponseHeader("etag");
14837
					if ( modified ) {
14838
						jQuery.etag[ cacheURL ] = modified;
14839
					}
14840
				}
14841
14842
				// if no content
14843
				if ( status === 204 || s.type === "HEAD" ) {
14844
					statusText = "nocontent";
14845
14846
				// if not modified
14847
				} else if ( status === 304 ) {
14848
					statusText = "notmodified";
14849
14850
				// If we have data, let's convert it
14851
				} else {
14852
					statusText = response.state;
14853
					success = response.data;
14854
					error = response.error;
14855
					isSuccess = !error;
14856
				}
14857
			} else {
14858
				// Extract error from statusText and normalize for non-aborts
14859
				error = statusText;
14860
				if ( status || !statusText ) {
14861
					statusText = "error";
14862
					if ( status < 0 ) {
14863
						status = 0;
14864
					}
14865
				}
14866
			}
14867
14868
			// Set data for the fake xhr object
14869
			jqXHR.status = status;
14870
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
14871
14872
			// Success/Error
14873
			if ( isSuccess ) {
14874
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
14875
			} else {
14876
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
14877
			}
14878
14879
			// Status-dependent callbacks
14880
			jqXHR.statusCode( statusCode );
14881
			statusCode = undefined;
14882
14883
			if ( fireGlobals ) {
14884
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
14885
					[ jqXHR, s, isSuccess ? success : error ] );
14886
			}
14887
14888
			// Complete
14889
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
14890
14891
			if ( fireGlobals ) {
14892
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
14893
				// Handle the global AJAX counter
14894
				if ( !( --jQuery.active ) ) {
14895
					jQuery.event.trigger("ajaxStop");
14896
				}
14897
			}
14898
		}
14899
14900
		return jqXHR;
14901
	},
14902
14903
	getJSON: function( url, data, callback ) {
14904
		return jQuery.get( url, data, callback, "json" );
14905
	},
14906
14907
	getScript: function( url, callback ) {
14908
		return jQuery.get( url, undefined, callback, "script" );
14909
	}
14910
});
14911
14912
jQuery.each( [ "get", "post" ], function( i, method ) {
14913
	jQuery[ method ] = function( url, data, callback, type ) {
14914
		// Shift arguments if data argument was omitted
14915
		if ( jQuery.isFunction( data ) ) {
14916
			type = type || callback;
14917
			callback = data;
14918
			data = undefined;
14919
		}
14920
14921
		return jQuery.ajax({
14922
			url: url,
14923
			type: method,
14924
			dataType: type,
14925
			data: data,
14926
			success: callback
14927
		});
14928
	};
14929
});
14930
14931
14932
jQuery._evalUrl = function( url ) {
14933
	return jQuery.ajax({
14934
		url: url,
14935
		type: "GET",
14936
		dataType: "script",
14937
		async: false,
14938
		global: false,
14939
		"throws": true
14940
	});
14941
};
14942
14943
14944
jQuery.fn.extend({
14945
	wrapAll: function( html ) {
14946
		var wrap;
14947
14948
		if ( jQuery.isFunction( html ) ) {
14949
			return this.each(function( i ) {
14950
				jQuery( this ).wrapAll( html.call(this, i) );
14951
			});
14952
		}
14953
14954
		if ( this[ 0 ] ) {
14955
14956
			// The elements to wrap the target around
14957
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
14958
14959
			if ( this[ 0 ].parentNode ) {
14960
				wrap.insertBefore( this[ 0 ] );
14961
			}
14962
14963
			wrap.map(function() {
14964
				var elem = this;
14965
14966
				while ( elem.firstElementChild ) {
14967
					elem = elem.firstElementChild;
14968
				}
14969
14970
				return elem;
14971
			}).append( this );
14972
		}
14973
14974
		return this;
14975
	},
14976
14977
	wrapInner: function( html ) {
14978
		if ( jQuery.isFunction( html ) ) {
14979
			return this.each(function( i ) {
14980
				jQuery( this ).wrapInner( html.call(this, i) );
14981
			});
14982
		}
14983
14984
		return this.each(function() {
14985
			var self = jQuery( this ),
14986
				contents = self.contents();
14987
14988
			if ( contents.length ) {
14989
				contents.wrapAll( html );
14990
14991
			} else {
14992
				self.append( html );
14993
			}
14994
		});
14995
	},
14996
14997
	wrap: function( html ) {
14998
		var isFunction = jQuery.isFunction( html );
14999
15000
		return this.each(function( i ) {
15001
			jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
15002
		});
15003
	},
15004
15005
	unwrap: function() {
15006
		return this.parent().each(function() {
15007
			if ( !jQuery.nodeName( this, "body" ) ) {
15008
				jQuery( this ).replaceWith( this.childNodes );
15009
			}
15010
		}).end();
15011
	}
15012
});
15013
15014
15015
jQuery.expr.filters.hidden = function( elem ) {
15016
	// Support: Opera <= 12.12
15017
	// Opera reports offsetWidths and offsetHeights less than zero on some elements
15018
	return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
15019
};
15020
jQuery.expr.filters.visible = function( elem ) {
15021
	return !jQuery.expr.filters.hidden( elem );
15022
};
15023
15024
15025
15026
15027
var r20 = /%20/g,
15028
	rbracket = /\[\]$/,
15029
	rCRLF = /\r?\n/g,
15030
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
15031
	rsubmittable = /^(?:input|select|textarea|keygen)/i;
15032
15033
function buildParams( prefix, obj, traditional, add ) {
15034
	var name;
15035
15036
	if ( jQuery.isArray( obj ) ) {
15037
		// Serialize array item.
15038
		jQuery.each( obj, function( i, v ) {
15039
			if ( traditional || rbracket.test( prefix ) ) {
15040
				// Treat each array item as a scalar.
15041
				add( prefix, v );
15042
15043
			} else {
15044
				// Item is non-scalar (array or object), encode its numeric index.
15045
				buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
15046
			}
15047
		});
15048
15049
	} else if ( !traditional && jQuery.type( obj ) === "object" ) {
15050
		// Serialize object item.
15051
		for ( name in obj ) {
15052
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
15053
		}
15054
15055
	} else {
15056
		// Serialize scalar item.
15057
		add( prefix, obj );
15058
	}
15059
}
15060
15061
// Serialize an array of form elements or a set of
15062
// key/values into a query string
15063
jQuery.param = function( a, traditional ) {
15064
	var prefix,
15065
		s = [],
15066
		add = function( key, value ) {
15067
			// If value is a function, invoke it and return its value
15068
			value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
15069
			s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
15070
		};
15071
15072
	// Set traditional to true for jQuery <= 1.3.2 behavior.
15073
	if ( traditional === undefined ) {
15074
		traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
15075
	}
15076
15077
	// If an array was passed in, assume that it is an array of form elements.
15078
	if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
15079
		// Serialize the form elements
15080
		jQuery.each( a, function() {
15081
			add( this.name, this.value );
15082
		});
15083
15084
	} else {
15085
		// If traditional, encode the "old" way (the way 1.3.2 or older
15086
		// did it), otherwise encode params recursively.
15087
		for ( prefix in a ) {
15088
			buildParams( prefix, a[ prefix ], traditional, add );
15089
		}
15090
	}
15091
15092
	// Return the resulting serialization
15093
	return s.join( "&" ).replace( r20, "+" );
15094
};
15095
15096
jQuery.fn.extend({
15097
	serialize: function() {
15098
		return jQuery.param( this.serializeArray() );
15099
	},
15100
	serializeArray: function() {
15101
		return this.map(function() {
15102
			// Can add propHook for "elements" to filter or add form elements
15103
			var elements = jQuery.prop( this, "elements" );
15104
			return elements ? jQuery.makeArray( elements ) : this;
15105
		})
15106
		.filter(function() {
15107
			var type = this.type;
15108
15109
			// Use .is( ":disabled" ) so that fieldset[disabled] works
15110
			return this.name && !jQuery( this ).is( ":disabled" ) &&
15111
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
15112
				( this.checked || !rcheckableType.test( type ) );
15113
		})
15114
		.map(function( i, elem ) {
15115
			var val = jQuery( this ).val();
15116
15117
			return val == null ?
15118
				null :
15119
				jQuery.isArray( val ) ?
15120
					jQuery.map( val, function( val ) {
15121
						return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15122
					}) :
15123
					{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15124
		}).get();
15125
	}
15126
});
15127
15128
15129
jQuery.ajaxSettings.xhr = function() {
15130
	try {
15131
		return new XMLHttpRequest();
15132
	} catch( e ) {}
15133
};
15134
15135
var xhrId = 0,
15136
	xhrCallbacks = {},
15137
	xhrSuccessStatus = {
15138
		// file protocol always yields status code 0, assume 200
15139
		0: 200,
15140
		// Support: IE9
15141
		// #1450: sometimes IE returns 1223 when it should be 204
15142
		1223: 204
15143
	},
15144
	xhrSupported = jQuery.ajaxSettings.xhr();
15145
15146
// Support: IE9
15147
// Open requests must be manually aborted on unload (#5280)
15148
// See https://support.microsoft.com/kb/2856746 for more info
15149
if ( window.attachEvent ) {
15150
	window.attachEvent( "onunload", function() {
15151
		for ( var key in xhrCallbacks ) {
15152
			xhrCallbacks[ key ]();
15153
		}
15154
	});
15155
}
15156
15157
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
15158
support.ajax = xhrSupported = !!xhrSupported;
15159
15160
jQuery.ajaxTransport(function( options ) {
15161
	var callback;
15162
15163
	// Cross domain only allowed if supported through XMLHttpRequest
15164
	if ( support.cors || xhrSupported && !options.crossDomain ) {
15165
		return {
15166
			send: function( headers, complete ) {
15167
				var i,
15168
					xhr = options.xhr(),
15169
					id = ++xhrId;
15170
15171
				xhr.open( options.type, options.url, options.async, options.username, options.password );
15172
15173
				// Apply custom fields if provided
15174
				if ( options.xhrFields ) {
15175
					for ( i in options.xhrFields ) {
15176
						xhr[ i ] = options.xhrFields[ i ];
15177
					}
15178
				}
15179
15180
				// Override mime type if needed
15181
				if ( options.mimeType && xhr.overrideMimeType ) {
15182
					xhr.overrideMimeType( options.mimeType );
15183
				}
15184
15185
				// X-Requested-With header
15186
				// For cross-domain requests, seeing as conditions for a preflight are
15187
				// akin to a jigsaw puzzle, we simply never set it to be sure.
15188
				// (it can always be set on a per-request basis or even using ajaxSetup)
15189
				// For same-domain requests, won't change header if already provided.
15190
				if ( !options.crossDomain && !headers["X-Requested-With"] ) {
15191
					headers["X-Requested-With"] = "XMLHttpRequest";
15192
				}
15193
15194
				// Set headers
15195
				for ( i in headers ) {
15196
					xhr.setRequestHeader( i, headers[ i ] );
15197
				}
15198
15199
				// Callback
15200
				callback = function( type ) {
15201
					return function() {
15202
						if ( callback ) {
15203
							delete xhrCallbacks[ id ];
15204
							callback = xhr.onload = xhr.onerror = null;
15205
15206
							if ( type === "abort" ) {
15207
								xhr.abort();
15208
							} else if ( type === "error" ) {
15209
								complete(
15210
									// file: protocol always yields status 0; see #8605, #14207
15211
									xhr.status,
15212
									xhr.statusText
15213
								);
15214
							} else {
15215
								complete(
15216
									xhrSuccessStatus[ xhr.status ] || xhr.status,
15217
									xhr.statusText,
15218
									// Support: IE9
15219
									// Accessing binary-data responseText throws an exception
15220
									// (#11426)
15221
									typeof xhr.responseText === "string" ? {
15222
										text: xhr.responseText
15223
									} : undefined,
15224
									xhr.getAllResponseHeaders()
15225
								);
15226
							}
15227
						}
15228
					};
15229
				};
15230
15231
				// Listen to events
15232
				xhr.onload = callback();
15233
				xhr.onerror = callback("error");
15234
15235
				// Create the abort callback
15236
				callback = xhrCallbacks[ id ] = callback("abort");
15237
15238
				try {
15239
					// Do send the request (this may raise an exception)
15240
					xhr.send( options.hasContent && options.data || null );
15241
				} catch ( e ) {
15242
					// #14683: Only rethrow if this hasn't been notified as an error yet
15243
					if ( callback ) {
15244
						throw e;
15245
					}
15246
				}
15247
			},
15248
15249
			abort: function() {
15250
				if ( callback ) {
15251
					callback();
15252
				}
15253
			}
15254
		};
15255
	}
15256
});
15257
15258
15259
15260
15261
// Install script dataType
15262
jQuery.ajaxSetup({
15263
	accepts: {
15264
		script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
15265
	},
15266
	contents: {
15267
		script: /(?:java|ecma)script/
15268
	},
15269
	converters: {
15270
		"text script": function( text ) {
15271
			jQuery.globalEval( text );
15272
			return text;
15273
		}
15274
	}
15275
});
15276
15277
// Handle cache's special case and crossDomain
15278
jQuery.ajaxPrefilter( "script", function( s ) {
15279
	if ( s.cache === undefined ) {
15280
		s.cache = false;
15281
	}
15282
	if ( s.crossDomain ) {
15283
		s.type = "GET";
15284
	}
15285
});
15286
15287
// Bind script tag hack transport
15288
jQuery.ajaxTransport( "script", function( s ) {
15289
	// This transport only deals with cross domain requests
15290
	if ( s.crossDomain ) {
15291
		var script, callback;
15292
		return {
15293
			send: function( _, complete ) {
15294
				script = jQuery("<script>").prop({
15295
					async: true,
15296
					charset: s.scriptCharset,
15297
					src: s.url
15298
				}).on(
15299
					"load error",
15300
					callback = function( evt ) {
15301
						script.remove();
15302
						callback = null;
15303
						if ( evt ) {
15304
							complete( evt.type === "error" ? 404 : 200, evt.type );
15305
						}
15306
					}
15307
				);
15308
				document.head.appendChild( script[ 0 ] );
15309
			},
15310
			abort: function() {
15311
				if ( callback ) {
15312
					callback();
15313
				}
15314
			}
15315
		};
15316
	}
15317
});
15318
15319
15320
15321
15322
var oldCallbacks = [],
15323
	rjsonp = /(=)\?(?=&|$)|\?\?/;
15324
15325
// Default jsonp settings
15326
jQuery.ajaxSetup({
15327
	jsonp: "callback",
15328
	jsonpCallback: function() {
15329
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
15330
		this[ callback ] = true;
15331
		return callback;
15332
	}
15333
});
15334
15335
// Detect, normalize options and install callbacks for jsonp requests
15336
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
15337
15338
	var callbackName, overwritten, responseContainer,
15339
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
15340
			"url" :
15341
			typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
15342
		);
15343
15344
	// Handle iff the expected data type is "jsonp" or we have a parameter to set
15345
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
15346
15347
		// Get callback name, remembering preexisting value associated with it
15348
		callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
15349
			s.jsonpCallback() :
15350
			s.jsonpCallback;
15351
15352
		// Insert callback into url or form data
15353
		if ( jsonProp ) {
15354
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
15355
		} else if ( s.jsonp !== false ) {
15356
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
15357
		}
15358
15359
		// Use data converter to retrieve json after script execution
15360
		s.converters["script json"] = function() {
15361
			if ( !responseContainer ) {
15362
				jQuery.error( callbackName + " was not called" );
15363
			}
15364
			return responseContainer[ 0 ];
15365
		};
15366
15367
		// force json dataType
15368
		s.dataTypes[ 0 ] = "json";
15369
15370
		// Install callback
15371
		overwritten = window[ callbackName ];
15372
		window[ callbackName ] = function() {
15373
			responseContainer = arguments;
15374
		};
15375
15376
		// Clean-up function (fires after converters)
15377
		jqXHR.always(function() {
15378
			// Restore preexisting value
15379
			window[ callbackName ] = overwritten;
15380
15381
			// Save back as free
15382
			if ( s[ callbackName ] ) {
15383
				// make sure that re-using the options doesn't screw things around
15384
				s.jsonpCallback = originalSettings.jsonpCallback;
15385
15386
				// save the callback name for future use
15387
				oldCallbacks.push( callbackName );
15388
			}
15389
15390
			// Call if it was a function and we have a response
15391
			if ( responseContainer && jQuery.isFunction( overwritten ) ) {
15392
				overwritten( responseContainer[ 0 ] );
15393
			}
15394
15395
			responseContainer = overwritten = undefined;
15396
		});
15397
15398
		// Delegate to script
15399
		return "script";
15400
	}
15401
});
15402
15403
15404
15405
15406
// data: string of html
15407
// context (optional): If specified, the fragment will be created in this context, defaults to document
15408
// keepScripts (optional): If true, will include scripts passed in the html string
15409
jQuery.parseHTML = function( data, context, keepScripts ) {
15410
	if ( !data || typeof data !== "string" ) {
15411
		return null;
15412
	}
15413
	if ( typeof context === "boolean" ) {
15414
		keepScripts = context;
15415
		context = false;
15416
	}
15417
	context = context || document;
15418
15419
	var parsed = rsingleTag.exec( data ),
15420
		scripts = !keepScripts && [];
15421
15422
	// Single tag
15423
	if ( parsed ) {
15424
		return [ context.createElement( parsed[1] ) ];
15425
	}
15426
15427
	parsed = jQuery.buildFragment( [ data ], context, scripts );
15428
15429
	if ( scripts && scripts.length ) {
15430
		jQuery( scripts ).remove();
15431
	}
15432
15433
	return jQuery.merge( [], parsed.childNodes );
15434
};
15435
15436
15437
// Keep a copy of the old load method
15438
var _load = jQuery.fn.load;
15439
15440
/**
15441
 * Load a url into a page
15442
 */
15443
jQuery.fn.load = function( url, params, callback ) {
15444
	if ( typeof url !== "string" && _load ) {
15445
		return _load.apply( this, arguments );
15446
	}
15447
15448
	var selector, type, response,
15449
		self = this,
15450
		off = url.indexOf(" ");
15451
15452
	if ( off >= 0 ) {
15453
		selector = jQuery.trim( url.slice( off ) );
15454
		url = url.slice( 0, off );
15455
	}
15456
15457
	// If it's a function
15458
	if ( jQuery.isFunction( params ) ) {
15459
15460
		// We assume that it's the callback
15461
		callback = params;
15462
		params = undefined;
15463
15464
	// Otherwise, build a param string
15465
	} else if ( params && typeof params === "object" ) {
15466
		type = "POST";
15467
	}
15468
15469
	// If we have elements to modify, make the request
15470
	if ( self.length > 0 ) {
15471
		jQuery.ajax({
15472
			url: url,
15473
15474
			// if "type" variable is undefined, then "GET" method will be used
15475
			type: type,
15476
			dataType: "html",
15477
			data: params
15478
		}).done(function( responseText ) {
15479
15480
			// Save response for use in complete callback
15481
			response = arguments;
15482
15483
			self.html( selector ?
15484
15485
				// If a selector was specified, locate the right elements in a dummy div
15486
				// Exclude scripts to avoid IE 'Permission Denied' errors
15487
				jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
15488
15489
				// Otherwise use the full result
15490
				responseText );
15491
15492
		}).complete( callback && function( jqXHR, status ) {
15493
			self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
15494
		});
15495
	}
15496
15497
	return this;
15498
};
15499
15500
15501
15502
15503
// Attach a bunch of functions for handling common AJAX events
15504
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
15505
	jQuery.fn[ type ] = function( fn ) {
15506
		return this.on( type, fn );
15507
	};
15508
});
15509
15510
15511
15512
15513
jQuery.expr.filters.animated = function( elem ) {
15514
	return jQuery.grep(jQuery.timers, function( fn ) {
15515
		return elem === fn.elem;
15516
	}).length;
15517
};
15518
15519
15520
15521
15522
var docElem = window.document.documentElement;
15523
15524
/**
15525
 * Gets a window from an element
15526
 */
15527
function getWindow( elem ) {
15528
	return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
15529
}
15530
15531
jQuery.offset = {
15532
	setOffset: function( elem, options, i ) {
15533
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
15534
			position = jQuery.css( elem, "position" ),
15535
			curElem = jQuery( elem ),
15536
			props = {};
15537
15538
		// Set position first, in-case top/left are set even on static elem
15539
		if ( position === "static" ) {
15540
			elem.style.position = "relative";
15541
		}
15542
15543
		curOffset = curElem.offset();
15544
		curCSSTop = jQuery.css( elem, "top" );
15545
		curCSSLeft = jQuery.css( elem, "left" );
15546
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
15547
			( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
15548
15549
		// Need to be able to calculate position if either
15550
		// top or left is auto and position is either absolute or fixed
15551
		if ( calculatePosition ) {
15552
			curPosition = curElem.position();
15553
			curTop = curPosition.top;
15554
			curLeft = curPosition.left;
15555
15556
		} else {
15557
			curTop = parseFloat( curCSSTop ) || 0;
15558
			curLeft = parseFloat( curCSSLeft ) || 0;
15559
		}
15560
15561
		if ( jQuery.isFunction( options ) ) {
15562
			options = options.call( elem, i, curOffset );
15563
		}
15564
15565
		if ( options.top != null ) {
15566
			props.top = ( options.top - curOffset.top ) + curTop;
15567
		}
15568
		if ( options.left != null ) {
15569
			props.left = ( options.left - curOffset.left ) + curLeft;
15570
		}
15571
15572
		if ( "using" in options ) {
15573
			options.using.call( elem, props );
15574
15575
		} else {
15576
			curElem.css( props );
15577
		}
15578
	}
15579
};
15580
15581
jQuery.fn.extend({
15582
	offset: function( options ) {
15583
		if ( arguments.length ) {
15584
			return options === undefined ?
15585
				this :
15586
				this.each(function( i ) {
15587
					jQuery.offset.setOffset( this, options, i );
15588
				});
15589
		}
15590
15591
		var docElem, win,
15592
			elem = this[ 0 ],
15593
			box = { top: 0, left: 0 },
15594
			doc = elem && elem.ownerDocument;
15595
15596
		if ( !doc ) {
15597
			return;
15598
		}
15599
15600
		docElem = doc.documentElement;
15601
15602
		// Make sure it's not a disconnected DOM node
15603
		if ( !jQuery.contains( docElem, elem ) ) {
15604
			return box;
15605
		}
15606
15607
		// Support: BlackBerry 5, iOS 3 (original iPhone)
15608
		// If we don't have gBCR, just use 0,0 rather than error
15609
		if ( typeof elem.getBoundingClientRect !== strundefined ) {
15610
			box = elem.getBoundingClientRect();
15611
		}
15612
		win = getWindow( doc );
15613
		return {
15614
			top: box.top + win.pageYOffset - docElem.clientTop,
15615
			left: box.left + win.pageXOffset - docElem.clientLeft
15616
		};
15617
	},
15618
15619
	position: function() {
15620
		if ( !this[ 0 ] ) {
15621
			return;
15622
		}
15623
15624
		var offsetParent, offset,
15625
			elem = this[ 0 ],
15626
			parentOffset = { top: 0, left: 0 };
15627
15628
		// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
15629
		if ( jQuery.css( elem, "position" ) === "fixed" ) {
15630
			// Assume getBoundingClientRect is there when computed position is fixed
15631
			offset = elem.getBoundingClientRect();
15632
15633
		} else {
15634
			// Get *real* offsetParent
15635
			offsetParent = this.offsetParent();
15636
15637
			// Get correct offsets
15638
			offset = this.offset();
15639
			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
15640
				parentOffset = offsetParent.offset();
15641
			}
15642
15643
			// Add offsetParent borders
15644
			parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
15645
			parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
15646
		}
15647
15648
		// Subtract parent offsets and element margins
15649
		return {
15650
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
15651
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
15652
		};
15653
	},
15654
15655
	offsetParent: function() {
15656
		return this.map(function() {
15657
			var offsetParent = this.offsetParent || docElem;
15658
15659
			while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
15660
				offsetParent = offsetParent.offsetParent;
15661
			}
15662
15663
			return offsetParent || docElem;
15664
		});
15665
	}
15666
});
15667
15668
// Create scrollLeft and scrollTop methods
15669
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
15670
	var top = "pageYOffset" === prop;
15671
15672
	jQuery.fn[ method ] = function( val ) {
15673
		return access( this, function( elem, method, val ) {
15674
			var win = getWindow( elem );
15675
15676
			if ( val === undefined ) {
15677
				return win ? win[ prop ] : elem[ method ];
15678
			}
15679
15680
			if ( win ) {
15681
				win.scrollTo(
15682
					!top ? val : window.pageXOffset,
15683
					top ? val : window.pageYOffset
15684
				);
15685
15686
			} else {
15687
				elem[ method ] = val;
15688
			}
15689
		}, method, val, arguments.length, null );
15690
	};
15691
});
15692
15693
// Support: Safari<7+, Chrome<37+
15694
// Add the top/left cssHooks using jQuery.fn.position
15695
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
15696
// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
15697
// getComputedStyle returns percent when specified for top/left/bottom/right;
15698
// rather than make the css module depend on the offset module, just check for it here
15699
jQuery.each( [ "top", "left" ], function( i, prop ) {
15700
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
15701
		function( elem, computed ) {
15702
			if ( computed ) {
15703
				computed = curCSS( elem, prop );
15704
				// If curCSS returns percentage, fallback to offset
15705
				return rnumnonpx.test( computed ) ?
15706
					jQuery( elem ).position()[ prop ] + "px" :
15707
					computed;
15708
			}
15709
		}
15710
	);
15711
});
15712
15713
15714
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
15715
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
15716
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
15717
		// Margin is only for outerHeight, outerWidth
15718
		jQuery.fn[ funcName ] = function( margin, value ) {
15719
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
15720
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
15721
15722
			return access( this, function( elem, type, value ) {
15723
				var doc;
15724
15725
				if ( jQuery.isWindow( elem ) ) {
15726
					// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
15727
					// isn't a whole lot we can do. See pull request at this URL for discussion:
15728
					// https://github.com/jquery/jquery/pull/764
15729
					return elem.document.documentElement[ "client" + name ];
15730
				}
15731
15732
				// Get document width or height
15733
				if ( elem.nodeType === 9 ) {
15734
					doc = elem.documentElement;
15735
15736
					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
15737
					// whichever is greatest
15738
					return Math.max(
15739
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
15740
						elem.body[ "offset" + name ], doc[ "offset" + name ],
15741
						doc[ "client" + name ]
15742
					);
15743
				}
15744
15745
				return value === undefined ?
15746
					// Get width or height on the element, requesting but not forcing parseFloat
15747
					jQuery.css( elem, type, extra ) :
15748
15749
					// Set width or height on the element
15750
					jQuery.style( elem, type, value, extra );
15751
			}, type, chainable ? margin : undefined, chainable, null );
15752
		};
15753
	});
15754
});
15755
15756
15757
// The number of elements contained in the matched element set
15758
jQuery.fn.size = function() {
15759
	return this.length;
15760
};
15761
15762
jQuery.fn.andSelf = jQuery.fn.addBack;
15763
15764
15765
15766
15767
// Register as a named AMD module, since jQuery can be concatenated with other
15768
// files that may use define, but not via a proper concatenation script that
15769
// understands anonymous AMD modules. A named AMD is safest and most robust
15770
// way to register. Lowercase jquery is used because AMD module names are
15771
// derived from file names, and jQuery is normally delivered in a lowercase
15772
// file name. Do this after creating the global so that if an AMD module wants
15773
// to call noConflict to hide this version of jQuery, it will work.
15774
15775
// Note that for maximum portability, libraries that are not jQuery should
15776
// declare themselves as anonymous modules, and avoid setting a global if an
15777
// AMD loader is present. jQuery is a special case. For more information, see
15778
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
15779
15780
if ( typeof define === "function" && define.amd ) {
15781
	define( "jquery", [], function() {
15782
		return jQuery;
15783
	});
15784
}
15785
15786
15787
15788
15789
var
15790
	// Map over jQuery in case of overwrite
15791
	_jQuery = window.jQuery,
15792
15793
	// Map over the $ in case of overwrite
15794
	_$ = window.$;
15795
15796
jQuery.noConflict = function( deep ) {
15797
	if ( window.$ === jQuery ) {
15798
		window.$ = _$;
15799
	}
15800
15801
	if ( deep && window.jQuery === jQuery ) {
15802
		window.jQuery = _jQuery;
15803
	}
15804
15805
	return jQuery;
15806
};
15807
15808
// Expose jQuery and $ identifiers, even in AMD
15809
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
15810
// and CommonJS for browser emulators (#13566)
15811
if ( typeof noGlobal === strundefined ) {
15812
	window.jQuery = window.$ = jQuery;
15813
}
15814
15815
15816
15817
15818
return jQuery;
15819
15820
}));
15821
15822
},{}],21:[function(require,module,exports){
15823
'use strict';
15824
15825
15826
var yaml = require('./lib/js-yaml.js');
15827
15828
15829
module.exports = yaml;
15830
15831
},{"./lib/js-yaml.js":22}],22:[function(require,module,exports){
15832
'use strict';
15833
15834
15835
var loader = require('./js-yaml/loader');
15836
var dumper = require('./js-yaml/dumper');
15837
15838
15839
function deprecated(name) {
15840
  return function () {
15841
    throw new Error('Function ' + name + ' is deprecated and cannot be used.');
15842
  };
15843
}
15844
15845
15846
module.exports.Type                = require('./js-yaml/type');
15847
module.exports.Schema              = require('./js-yaml/schema');
15848
module.exports.FAILSAFE_SCHEMA     = require('./js-yaml/schema/failsafe');
15849
module.exports.JSON_SCHEMA         = require('./js-yaml/schema/json');
15850
module.exports.CORE_SCHEMA         = require('./js-yaml/schema/core');
15851
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
15852
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
15853
module.exports.load                = loader.load;
15854
module.exports.loadAll             = loader.loadAll;
15855
module.exports.safeLoad            = loader.safeLoad;
15856
module.exports.safeLoadAll         = loader.safeLoadAll;
15857
module.exports.dump                = dumper.dump;
15858
module.exports.safeDump            = dumper.safeDump;
15859
module.exports.YAMLException       = require('./js-yaml/exception');
15860
15861
// Deprecared schema names from JS-YAML 2.0.x
15862
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
15863
module.exports.SAFE_SCHEMA    = require('./js-yaml/schema/default_safe');
15864
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
15865
15866
// Deprecated functions from JS-YAML 1.x.x
15867
module.exports.scan           = deprecated('scan');
15868
module.exports.parse          = deprecated('parse');
15869
module.exports.compose        = deprecated('compose');
15870
module.exports.addConstructor = deprecated('addConstructor');
15871
15872
},{"./js-yaml/dumper":24,"./js-yaml/exception":25,"./js-yaml/loader":26,"./js-yaml/schema":28,"./js-yaml/schema/core":29,"./js-yaml/schema/default_full":30,"./js-yaml/schema/default_safe":31,"./js-yaml/schema/failsafe":32,"./js-yaml/schema/json":33,"./js-yaml/type":34}],23:[function(require,module,exports){
15873
'use strict';
15874
15875
15876
function isNothing(subject) {
15877
  return (typeof subject === 'undefined') || (null === subject);
15878
}
15879
15880
15881
function isObject(subject) {
15882
  return (typeof subject === 'object') && (null !== subject);
15883
}
15884
15885
15886
function toArray(sequence) {
15887
  if (Array.isArray(sequence)) {
15888
    return sequence;
15889
  } else if (isNothing(sequence)) {
15890
    return [];
15891
  }
15892
  return [ sequence ];
15893
}
15894
15895
15896
function extend(target, source) {
15897
  var index, length, key, sourceKeys;
15898
15899
  if (source) {
15900
    sourceKeys = Object.keys(source);
15901
15902
    for (index = 0, length = sourceKeys.length; index < length; index += 1) {
15903
      key = sourceKeys[index];
15904
      target[key] = source[key];
15905
    }
15906
  }
15907
15908
  return target;
15909
}
15910
15911
15912
function repeat(string, count) {
15913
  var result = '', cycle;
15914
15915
  for (cycle = 0; cycle < count; cycle += 1) {
15916
    result += string;
15917
  }
15918
15919
  return result;
15920
}
15921
15922
15923
function isNegativeZero(number) {
15924
  return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
15925
}
15926
15927
15928
module.exports.isNothing      = isNothing;
15929
module.exports.isObject       = isObject;
15930
module.exports.toArray        = toArray;
15931
module.exports.repeat         = repeat;
15932
module.exports.isNegativeZero = isNegativeZero;
15933
module.exports.extend         = extend;
15934
15935
},{}],24:[function(require,module,exports){
15936
'use strict';
15937
15938
/*eslint-disable no-use-before-define*/
15939
15940
var common              = require('./common');
15941
var YAMLException       = require('./exception');
15942
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
15943
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
15944
15945
var _toString       = Object.prototype.toString;
15946
var _hasOwnProperty = Object.prototype.hasOwnProperty;
15947
15948
var CHAR_TAB                  = 0x09; /* Tab */
15949
var CHAR_LINE_FEED            = 0x0A; /* LF */
15950
var CHAR_CARRIAGE_RETURN      = 0x0D; /* CR */
15951
var CHAR_SPACE                = 0x20; /* Space */
15952
var CHAR_EXCLAMATION          = 0x21; /* ! */
15953
var CHAR_DOUBLE_QUOTE         = 0x22; /* " */
15954
var CHAR_SHARP                = 0x23; /* # */
15955
var CHAR_PERCENT              = 0x25; /* % */
15956
var CHAR_AMPERSAND            = 0x26; /* & */
15957
var CHAR_SINGLE_QUOTE         = 0x27; /* ' */
15958
var CHAR_ASTERISK             = 0x2A; /* * */
15959
var CHAR_COMMA                = 0x2C; /* , */
15960
var CHAR_MINUS                = 0x2D; /* - */
15961
var CHAR_COLON                = 0x3A; /* : */
15962
var CHAR_GREATER_THAN         = 0x3E; /* > */
15963
var CHAR_QUESTION             = 0x3F; /* ? */
15964
var CHAR_COMMERCIAL_AT        = 0x40; /* @ */
15965
var CHAR_LEFT_SQUARE_BRACKET  = 0x5B; /* [ */
15966
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
15967
var CHAR_GRAVE_ACCENT         = 0x60; /* ` */
15968
var CHAR_LEFT_CURLY_BRACKET   = 0x7B; /* { */
15969
var CHAR_VERTICAL_LINE        = 0x7C; /* | */
15970
var CHAR_RIGHT_CURLY_BRACKET  = 0x7D; /* } */
15971
15972
var ESCAPE_SEQUENCES = {};
15973
15974
ESCAPE_SEQUENCES[0x00]   = '\\0';
15975
ESCAPE_SEQUENCES[0x07]   = '\\a';
15976
ESCAPE_SEQUENCES[0x08]   = '\\b';
15977
ESCAPE_SEQUENCES[0x09]   = '\\t';
15978
ESCAPE_SEQUENCES[0x0A]   = '\\n';
15979
ESCAPE_SEQUENCES[0x0B]   = '\\v';
15980
ESCAPE_SEQUENCES[0x0C]   = '\\f';
15981
ESCAPE_SEQUENCES[0x0D]   = '\\r';
15982
ESCAPE_SEQUENCES[0x1B]   = '\\e';
15983
ESCAPE_SEQUENCES[0x22]   = '\\"';
15984
ESCAPE_SEQUENCES[0x5C]   = '\\\\';
15985
ESCAPE_SEQUENCES[0x85]   = '\\N';
15986
ESCAPE_SEQUENCES[0xA0]   = '\\_';
15987
ESCAPE_SEQUENCES[0x2028] = '\\L';
15988
ESCAPE_SEQUENCES[0x2029] = '\\P';
15989
15990
var DEPRECATED_BOOLEANS_SYNTAX = [
15991
  'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
15992
  'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
15993
];
15994
15995
function compileStyleMap(schema, map) {
15996
  var result, keys, index, length, tag, style, type;
15997
15998
  if (null === map) {
15999
    return {};
16000
  }
16001
16002
  result = {};
16003
  keys = Object.keys(map);
16004
16005
  for (index = 0, length = keys.length; index < length; index += 1) {
16006
    tag = keys[index];
16007
    style = String(map[tag]);
16008
16009
    if ('!!' === tag.slice(0, 2)) {
16010
      tag = 'tag:yaml.org,2002:' + tag.slice(2);
16011
    }
16012
16013
    type = schema.compiledTypeMap[tag];
16014
16015
    if (type && _hasOwnProperty.call(type.styleAliases, style)) {
16016
      style = type.styleAliases[style];
16017
    }
16018
16019
    result[tag] = style;
16020
  }
16021
16022
  return result;
16023
}
16024
16025
function encodeHex(character) {
16026
  var string, handle, length;
16027
16028
  string = character.toString(16).toUpperCase();
16029
16030
  if (character <= 0xFF) {
16031
    handle = 'x';
16032
    length = 2;
16033
  } else if (character <= 0xFFFF) {
16034
    handle = 'u';
16035
    length = 4;
16036
  } else if (character <= 0xFFFFFFFF) {
16037
    handle = 'U';
16038
    length = 8;
16039
  } else {
16040
    throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
16041
  }
16042
16043
  return '\\' + handle + common.repeat('0', length - string.length) + string;
16044
}
16045
16046
function State(options) {
16047
  this.schema      = options['schema'] || DEFAULT_FULL_SCHEMA;
16048
  this.indent      = Math.max(1, (options['indent'] || 2));
16049
  this.skipInvalid = options['skipInvalid'] || false;
16050
  this.flowLevel   = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
16051
  this.styleMap    = compileStyleMap(this.schema, options['styles'] || null);
16052
  this.sortKeys    = options['sortKeys'] || false;
16053
16054
  this.implicitTypes = this.schema.compiledImplicit;
16055
  this.explicitTypes = this.schema.compiledExplicit;
16056
16057
  this.tag = null;
16058
  this.result = '';
16059
16060
  this.duplicates = [];
16061
  this.usedDuplicates = null;
16062
}
16063
16064
function indentString(string, spaces) {
16065
  var ind = common.repeat(' ', spaces),
16066
      position = 0,
16067
      next = -1,
16068
      result = '',
16069
      line,
16070
      length = string.length;
16071
16072
  while (position < length) {
16073
    next = string.indexOf('\n', position);
16074
    if (next === -1) {
16075
      line = string.slice(position);
16076
      position = length;
16077
    } else {
16078
      line = string.slice(position, next + 1);
16079
      position = next + 1;
16080
    }
16081
    if (line.length && line !== '\n') {
16082
      result += ind;
16083
    }
16084
    result += line;
16085
  }
16086
16087
  return result;
16088
}
16089
16090
function generateNextLine(state, level) {
16091
  return '\n' + common.repeat(' ', state.indent * level);
16092
}
16093
16094
function testImplicitResolving(state, str) {
16095
  var index, length, type;
16096
16097
  for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
16098
    type = state.implicitTypes[index];
16099
16100
    if (type.resolve(str)) {
16101
      return true;
16102
    }
16103
  }
16104
16105
  return false;
16106
}
16107
16108
function StringBuilder(source) {
16109
  this.source = source;
16110
  this.result = '';
16111
  this.checkpoint = 0;
16112
}
16113
16114
StringBuilder.prototype.takeUpTo = function (position) {
16115
  var er;
16116
16117
  if (position < this.checkpoint) {
16118
    er = new Error('position should be > checkpoint');
16119
    er.position = position;
16120
    er.checkpoint = this.checkpoint;
16121
    throw er;
16122
  }
16123
16124
  this.result += this.source.slice(this.checkpoint, position);
16125
  this.checkpoint = position;
16126
  return this;
16127
};
16128
16129
StringBuilder.prototype.escapeChar = function () {
16130
  var character, esc;
16131
16132
  character = this.source.charCodeAt(this.checkpoint);
16133
  esc = ESCAPE_SEQUENCES[character] || encodeHex(character);
16134
  this.result += esc;
16135
  this.checkpoint += 1;
16136
16137
  return this;
16138
};
16139
16140
StringBuilder.prototype.finish = function () {
16141
  if (this.source.length > this.checkpoint) {
16142
    this.takeUpTo(this.source.length);
16143
  }
16144
};
16145
16146
function writeScalar(state, object, level) {
16147
  var simple, first, spaceWrap, folded, literal, single, double,
16148
      sawLineFeed, linePosition, longestLine, indent, max, character,
16149
      position, escapeSeq, hexEsc, previous, lineLength, modifier,
16150
      trailingLineBreaks, result;
16151
16152
  if (0 === object.length) {
16153
    state.dump = "''";
16154
    return;
16155
  }
16156
16157
  if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
16158
    state.dump = "'" + object + "'";
16159
    return;
16160
  }
16161
16162
  simple = true;
16163
  first = object.length ? object.charCodeAt(0) : 0;
16164
  spaceWrap = (CHAR_SPACE === first ||
16165
               CHAR_SPACE === object.charCodeAt(object.length - 1));
16166
16167
  // Simplified check for restricted first characters
16168
  // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29
16169
  if (CHAR_MINUS         === first ||
16170
      CHAR_QUESTION      === first ||
16171
      CHAR_COMMERCIAL_AT === first ||
16172
      CHAR_GRAVE_ACCENT  === first) {
16173
    simple = false;
16174
  }
16175
16176
  // can only use > and | if not wrapped in spaces.
16177
  if (spaceWrap) {
16178
    simple = false;
16179
    folded = false;
16180
    literal = false;
16181
  } else {
16182
    folded = true;
16183
    literal = true;
16184
  }
16185
16186
  single = true;
16187
  double = new StringBuilder(object);
16188
16189
  sawLineFeed = false;
16190
  linePosition = 0;
16191
  longestLine = 0;
16192
16193
  indent = state.indent * level;
16194
  max = 80;
16195
  if (indent < 40) {
16196
    max -= indent;
16197
  } else {
16198
    max = 40;
16199
  }
16200
16201
  for (position = 0; position < object.length; position++) {
16202
    character = object.charCodeAt(position);
16203
    if (simple) {
16204
      // Characters that can never appear in the simple scalar
16205
      if (!simpleChar(character)) {
16206
        simple = false;
16207
      } else {
16208
        // Still simple.  If we make it all the way through like
16209
        // this, then we can just dump the string as-is.
16210
        continue;
16211
      }
16212
    }
16213
16214
    if (single && character === CHAR_SINGLE_QUOTE) {
16215
      single = false;
16216
    }
16217
16218
    escapeSeq = ESCAPE_SEQUENCES[character];
16219
    hexEsc = needsHexEscape(character);
16220
16221
    if (!escapeSeq && !hexEsc) {
16222
      continue;
16223
    }
16224
16225
    if (character !== CHAR_LINE_FEED &&
16226
        character !== CHAR_DOUBLE_QUOTE &&
16227
        character !== CHAR_SINGLE_QUOTE) {
16228
      folded = false;
16229
      literal = false;
16230
    } else if (character === CHAR_LINE_FEED) {
16231
      sawLineFeed = true;
16232
      single = false;
16233
      if (position > 0) {
16234
        previous = object.charCodeAt(position - 1);
16235
        if (previous === CHAR_SPACE) {
16236
          literal = false;
16237
          folded = false;
16238
        }
16239
      }
16240
      if (folded) {
16241
        lineLength = position - linePosition;
16242
        linePosition = position;
16243
        if (lineLength > longestLine) {
16244
          longestLine = lineLength;
16245
        }
16246
      }
16247
    }
16248
16249
    if (character !== CHAR_DOUBLE_QUOTE) {
16250
      single = false;
16251
    }
16252
16253
    double.takeUpTo(position);
16254
    double.escapeChar();
16255
  }
16256
16257
  if (simple && testImplicitResolving(state, object)) {
16258
    simple = false;
16259
  }
16260
16261
  modifier = '';
16262
  if (folded || literal) {
16263
    trailingLineBreaks = 0;
16264
    if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {
16265
      trailingLineBreaks += 1;
16266
      if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {
16267
        trailingLineBreaks += 1;
16268
      }
16269
    }
16270
16271
    if (trailingLineBreaks === 0) {
16272
      modifier = '-';
16273
    } else if (trailingLineBreaks === 2) {
16274
      modifier = '+';
16275
    }
16276
  }
16277
16278
  if (literal && longestLine < max) {
16279
    folded = false;
16280
  }
16281
16282
  // If it's literally one line, then don't bother with the literal.
16283
  // We may still want to do a fold, though, if it's a super long line.
16284
  if (!sawLineFeed) {
16285
    literal = false;
16286
  }
16287
16288
  if (simple) {
16289
    state.dump = object;
16290
  } else if (single) {
16291
    state.dump = '\'' + object + '\'';
16292
  } else if (folded) {
16293
    result = fold(object, max);
16294
    state.dump = '>' + modifier + '\n' + indentString(result, indent);
16295
  } else if (literal) {
16296
    if (!modifier) {
16297
      object = object.replace(/\n$/, '');
16298
    }
16299
    state.dump = '|' + modifier + '\n' + indentString(object, indent);
16300
  } else if (double) {
16301
    double.finish();
16302
    state.dump = '"' + double.result + '"';
16303
  } else {
16304
    throw new Error('Failed to dump scalar value');
16305
  }
16306
16307
  return;
16308
}
16309
16310
// The `trailing` var is a regexp match of any trailing `\n` characters.
16311
//
16312
// There are three cases we care about:
16313
//
16314
// 1. One trailing `\n` on the string.  Just use `|` or `>`.
16315
//    This is the assumed default. (trailing = null)
16316
// 2. No trailing `\n` on the string.  Use `|-` or `>-` to "chomp" the end.
16317
// 3. More than one trailing `\n` on the string.  Use `|+` or `>+`.
16318
//
16319
// In the case of `>+`, these line breaks are *not* doubled (like the line
16320
// breaks within the string), so it's important to only end with the exact
16321
// same number as we started.
16322
function fold(object, max) {
16323
  var result = '',
16324
      position = 0,
16325
      length = object.length,
16326
      trailing = /\n+$/.exec(object),
16327
      newLine;
16328
16329
  if (trailing) {
16330
    length = trailing.index + 1;
16331
  }
16332
16333
  while (position < length) {
16334
    newLine = object.indexOf('\n', position);
16335
    if (newLine > length || newLine === -1) {
16336
      if (result) {
16337
        result += '\n\n';
16338
      }
16339
      result += foldLine(object.slice(position, length), max);
16340
      position = length;
16341
    } else {
16342
      if (result) {
16343
        result += '\n\n';
16344
      }
16345
      result += foldLine(object.slice(position, newLine), max);
16346
      position = newLine + 1;
16347
    }
16348
  }
16349
  if (trailing && trailing[0] !== '\n') {
16350
    result += trailing[0];
16351
  }
16352
16353
  return result;
16354
}
16355
16356
function foldLine(line, max) {
16357
  if (line === '') {
16358
    return line;
16359
  }
16360
16361
  var foldRe = /[^\s] [^\s]/g,
16362
      result = '',
16363
      prevMatch = 0,
16364
      foldStart = 0,
16365
      match = foldRe.exec(line),
16366
      index,
16367
      foldEnd,
16368
      folded;
16369
16370
  while (match) {
16371
    index = match.index;
16372
16373
    // when we cross the max len, if the previous match would've
16374
    // been ok, use that one, and carry on.  If there was no previous
16375
    // match on this fold section, then just have a long line.
16376
    if (index - foldStart > max) {
16377
      if (prevMatch !== foldStart) {
16378
        foldEnd = prevMatch;
16379
      } else {
16380
        foldEnd = index;
16381
      }
16382
16383
      if (result) {
16384
        result += '\n';
16385
      }
16386
      folded = line.slice(foldStart, foldEnd);
16387
      result += folded;
16388
      foldStart = foldEnd + 1;
16389
    }
16390
    prevMatch = index + 1;
16391
    match = foldRe.exec(line);
16392
  }
16393
16394
  if (result) {
16395
    result += '\n';
16396
  }
16397
16398
  // if we end up with one last word at the end, then the last bit might
16399
  // be slightly bigger than we wanted, because we exited out of the loop.
16400
  if (foldStart !== prevMatch && line.length - foldStart > max) {
16401
    result += line.slice(foldStart, prevMatch) + '\n' +
16402
              line.slice(prevMatch + 1);
16403
  } else {
16404
    result += line.slice(foldStart);
16405
  }
16406
16407
  return result;
16408
}
16409
16410
// Returns true if character can be found in a simple scalar
16411
function simpleChar(character) {
16412
  return CHAR_TAB                  !== character &&
16413
         CHAR_LINE_FEED            !== character &&
16414
         CHAR_CARRIAGE_RETURN      !== character &&
16415
         CHAR_COMMA                !== character &&
16416
         CHAR_LEFT_SQUARE_BRACKET  !== character &&
16417
         CHAR_RIGHT_SQUARE_BRACKET !== character &&
16418
         CHAR_LEFT_CURLY_BRACKET   !== character &&
16419
         CHAR_RIGHT_CURLY_BRACKET  !== character &&
16420
         CHAR_SHARP                !== character &&
16421
         CHAR_AMPERSAND            !== character &&
16422
         CHAR_ASTERISK             !== character &&
16423
         CHAR_EXCLAMATION          !== character &&
16424
         CHAR_VERTICAL_LINE        !== character &&
16425
         CHAR_GREATER_THAN         !== character &&
16426
         CHAR_SINGLE_QUOTE         !== character &&
16427
         CHAR_DOUBLE_QUOTE         !== character &&
16428
         CHAR_PERCENT              !== character &&
16429
         CHAR_COLON                !== character &&
16430
         !ESCAPE_SEQUENCES[character]            &&
16431
         !needsHexEscape(character);
16432
}
16433
16434
// Returns true if the character code needs to be escaped.
16435
function needsHexEscape(character) {
16436
  return !((0x00020 <= character && character <= 0x00007E) ||
16437
           (0x00085 === character)                         ||
16438
           (0x000A0 <= character && character <= 0x00D7FF) ||
16439
           (0x0E000 <= character && character <= 0x00FFFD) ||
16440
           (0x10000 <= character && character <= 0x10FFFF));
16441
}
16442
16443
function writeFlowSequence(state, level, object) {
16444
  var _result = '',
16445
      _tag    = state.tag,
16446
      index,
16447
      length;
16448
16449
  for (index = 0, length = object.length; index < length; index += 1) {
16450
    // Write only valid elements.
16451
    if (writeNode(state, level, object[index], false, false)) {
16452
      if (0 !== index) {
16453
        _result += ', ';
16454
      }
16455
      _result += state.dump;
16456
    }
16457
  }
16458
16459
  state.tag = _tag;
16460
  state.dump = '[' + _result + ']';
16461
}
16462
16463
function writeBlockSequence(state, level, object, compact) {
16464
  var _result = '',
16465
      _tag    = state.tag,
16466
      index,
16467
      length;
16468
16469
  for (index = 0, length = object.length; index < length; index += 1) {
16470
    // Write only valid elements.
16471
    if (writeNode(state, level + 1, object[index], true, true)) {
16472
      if (!compact || 0 !== index) {
16473
        _result += generateNextLine(state, level);
16474
      }
16475
      _result += '- ' + state.dump;
16476
    }
16477
  }
16478
16479
  state.tag = _tag;
16480
  state.dump = _result || '[]'; // Empty sequence if no valid values.
16481
}
16482
16483
function writeFlowMapping(state, level, object) {
16484
  var _result       = '',
16485
      _tag          = state.tag,
16486
      objectKeyList = Object.keys(object),
16487
      index,
16488
      length,
16489
      objectKey,
16490
      objectValue,
16491
      pairBuffer;
16492
16493
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16494
    pairBuffer = '';
16495
16496
    if (0 !== index) {
16497
      pairBuffer += ', ';
16498
    }
16499
16500
    objectKey = objectKeyList[index];
16501
    objectValue = object[objectKey];
16502
16503
    if (!writeNode(state, level, objectKey, false, false)) {
16504
      continue; // Skip this pair because of invalid key;
16505
    }
16506
16507
    if (state.dump.length > 1024) {
16508
      pairBuffer += '? ';
16509
    }
16510
16511
    pairBuffer += state.dump + ': ';
16512
16513
    if (!writeNode(state, level, objectValue, false, false)) {
16514
      continue; // Skip this pair because of invalid value.
16515
    }
16516
16517
    pairBuffer += state.dump;
16518
16519
    // Both key and value are valid.
16520
    _result += pairBuffer;
16521
  }
16522
16523
  state.tag = _tag;
16524
  state.dump = '{' + _result + '}';
16525
}
16526
16527
function writeBlockMapping(state, level, object, compact) {
16528
  var _result       = '',
16529
      _tag          = state.tag,
16530
      objectKeyList = Object.keys(object),
16531
      index,
16532
      length,
16533
      objectKey,
16534
      objectValue,
16535
      explicitPair,
16536
      pairBuffer;
16537
16538
  // Allow sorting keys so that the output file is deterministic
16539
  if (state.sortKeys === true) {
16540
    // Default sorting
16541
    objectKeyList.sort();
16542
  } else if (typeof state.sortKeys === 'function') {
16543
    // Custom sort function
16544
    objectKeyList.sort(state.sortKeys);
16545
  } else if (state.sortKeys) {
16546
    // Something is wrong
16547
    throw new YAMLException('sortKeys must be a boolean or a function');
16548
  }
16549
16550
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16551
    pairBuffer = '';
16552
16553
    if (!compact || 0 !== index) {
16554
      pairBuffer += generateNextLine(state, level);
16555
    }
16556
16557
    objectKey = objectKeyList[index];
16558
    objectValue = object[objectKey];
16559
16560
    if (!writeNode(state, level + 1, objectKey, true, true)) {
16561
      continue; // Skip this pair because of invalid key.
16562
    }
16563
16564
    explicitPair = (null !== state.tag && '?' !== state.tag) ||
16565
                   (state.dump && state.dump.length > 1024);
16566
16567
    if (explicitPair) {
16568
      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
16569
        pairBuffer += '?';
16570
      } else {
16571
        pairBuffer += '? ';
16572
      }
16573
    }
16574
16575
    pairBuffer += state.dump;
16576
16577
    if (explicitPair) {
16578
      pairBuffer += generateNextLine(state, level);
16579
    }
16580
16581
    if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
16582
      continue; // Skip this pair because of invalid value.
16583
    }
16584
16585
    if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
16586
      pairBuffer += ':';
16587
    } else {
16588
      pairBuffer += ': ';
16589
    }
16590
16591
    pairBuffer += state.dump;
16592
16593
    // Both key and value are valid.
16594
    _result += pairBuffer;
16595
  }
16596
16597
  state.tag = _tag;
16598
  state.dump = _result || '{}'; // Empty mapping if no valid pairs.
16599
}
16600
16601
function detectType(state, object, explicit) {
16602
  var _result, typeList, index, length, type, style;
16603
16604
  typeList = explicit ? state.explicitTypes : state.implicitTypes;
16605
16606
  for (index = 0, length = typeList.length; index < length; index += 1) {
16607
    type = typeList[index];
16608
16609
    if ((type.instanceOf  || type.predicate) &&
16610
        (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
16611
        (!type.predicate  || type.predicate(object))) {
16612
16613
      state.tag = explicit ? type.tag : '?';
16614
16615
      if (type.represent) {
16616
        style = state.styleMap[type.tag] || type.defaultStyle;
16617
16618
        if ('[object Function]' === _toString.call(type.represent)) {
16619
          _result = type.represent(object, style);
16620
        } else if (_hasOwnProperty.call(type.represent, style)) {
16621
          _result = type.represent[style](object, style);
16622
        } else {
16623
          throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
16624
        }
16625
16626
        state.dump = _result;
16627
      }
16628
16629
      return true;
16630
    }
16631
  }
16632
16633
  return false;
16634
}
16635
16636
// Serializes `object` and writes it to global `result`.
16637
// Returns true on success, or false on invalid object.
16638
//
16639
function writeNode(state, level, object, block, compact) {
16640
  state.tag = null;
16641
  state.dump = object;
16642
16643
  if (!detectType(state, object, false)) {
16644
    detectType(state, object, true);
16645
  }
16646
16647
  var type = _toString.call(state.dump);
16648
16649
  if (block) {
16650
    block = (0 > state.flowLevel || state.flowLevel > level);
16651
  }
16652
16653
  if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) {
16654
    compact = false;
16655
  }
16656
16657
  var objectOrArray = '[object Object]' === type || '[object Array]' === type,
16658
      duplicateIndex,
16659
      duplicate;
16660
16661
  if (objectOrArray) {
16662
    duplicateIndex = state.duplicates.indexOf(object);
16663
    duplicate = duplicateIndex !== -1;
16664
  }
16665
16666
  if (duplicate && state.usedDuplicates[duplicateIndex]) {
16667
    state.dump = '*ref_' + duplicateIndex;
16668
  } else {
16669
    if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
16670
      state.usedDuplicates[duplicateIndex] = true;
16671
    }
16672
    if ('[object Object]' === type) {
16673
      if (block && (0 !== Object.keys(state.dump).length)) {
16674
        writeBlockMapping(state, level, state.dump, compact);
16675
        if (duplicate) {
16676
          state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
16677
        }
16678
      } else {
16679
        writeFlowMapping(state, level, state.dump);
16680
        if (duplicate) {
16681
          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
16682
        }
16683
      }
16684
    } else if ('[object Array]' === type) {
16685
      if (block && (0 !== state.dump.length)) {
16686
        writeBlockSequence(state, level, state.dump, compact);
16687
        if (duplicate) {
16688
          state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
16689
        }
16690
      } else {
16691
        writeFlowSequence(state, level, state.dump);
16692
        if (duplicate) {
16693
          state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
16694
        }
16695
      }
16696
    } else if ('[object String]' === type) {
16697
      if ('?' !== state.tag) {
16698
        writeScalar(state, state.dump, level);
16699
      }
16700
    } else {
16701
      if (state.skipInvalid) {
16702
        return false;
16703
      }
16704
      throw new YAMLException('unacceptable kind of an object to dump ' + type);
16705
    }
16706
16707
    if (null !== state.tag && '?' !== state.tag) {
16708
      state.dump = '!<' + state.tag + '> ' + state.dump;
16709
    }
16710
  }
16711
16712
  return true;
16713
}
16714
16715
function getDuplicateReferences(object, state) {
16716
  var objects = [],
16717
      duplicatesIndexes = [],
16718
      index,
16719
      length;
16720
16721
  inspectNode(object, objects, duplicatesIndexes);
16722
16723
  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
16724
    state.duplicates.push(objects[duplicatesIndexes[index]]);
16725
  }
16726
  state.usedDuplicates = new Array(length);
16727
}
16728
16729
function inspectNode(object, objects, duplicatesIndexes) {
16730
  var type = _toString.call(object),
16731
      objectKeyList,
16732
      index,
16733
      length;
16734
16735
  if (null !== object && 'object' === typeof object) {
16736
    index = objects.indexOf(object);
16737
    if (-1 !== index) {
16738
      if (-1 === duplicatesIndexes.indexOf(index)) {
16739
        duplicatesIndexes.push(index);
16740
      }
16741
    } else {
16742
      objects.push(object);
16743
16744
      if (Array.isArray(object)) {
16745
        for (index = 0, length = object.length; index < length; index += 1) {
16746
          inspectNode(object[index], objects, duplicatesIndexes);
16747
        }
16748
      } else {
16749
        objectKeyList = Object.keys(object);
16750
16751
        for (index = 0, length = objectKeyList.length; index < length; index += 1) {
16752
          inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
16753
        }
16754
      }
16755
    }
16756
  }
16757
}
16758
16759
function dump(input, options) {
16760
  options = options || {};
16761
16762
  var state = new State(options);
16763
16764
  getDuplicateReferences(input, state);
16765
16766
  if (writeNode(state, 0, input, true, true)) {
16767
    return state.dump + '\n';
16768
  }
16769
  return '';
16770
}
16771
16772
function safeDump(input, options) {
16773
  return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
16774
}
16775
16776
module.exports.dump     = dump;
16777
module.exports.safeDump = safeDump;
16778
16779
},{"./common":23,"./exception":25,"./schema/default_full":30,"./schema/default_safe":31}],25:[function(require,module,exports){
16780
'use strict';
16781
16782
16783
function YAMLException(reason, mark) {
16784
  this.name    = 'YAMLException';
16785
  this.reason  = reason;
16786
  this.mark    = mark;
16787
  this.message = this.toString(false);
16788
}
16789
16790
16791
YAMLException.prototype.toString = function toString(compact) {
16792
  var result;
16793
16794
  result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
16795
16796
  if (!compact && this.mark) {
16797
    result += ' ' + this.mark.toString();
16798
  }
16799
16800
  return result;
16801
};
16802
16803
16804
module.exports = YAMLException;
16805
16806
},{}],26:[function(require,module,exports){
16807
'use strict';
16808
16809
/*eslint-disable max-len,no-use-before-define*/
16810
16811
var common              = require('./common');
16812
var YAMLException       = require('./exception');
16813
var Mark                = require('./mark');
16814
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
16815
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
16816
16817
16818
var _hasOwnProperty = Object.prototype.hasOwnProperty;
16819
16820
16821
var CONTEXT_FLOW_IN   = 1;
16822
var CONTEXT_FLOW_OUT  = 2;
16823
var CONTEXT_BLOCK_IN  = 3;
16824
var CONTEXT_BLOCK_OUT = 4;
16825
16826
16827
var CHOMPING_CLIP  = 1;
16828
var CHOMPING_STRIP = 2;
16829
var CHOMPING_KEEP  = 3;
16830
16831
16832
var PATTERN_NON_PRINTABLE         = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
16833
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
16834
var PATTERN_FLOW_INDICATORS       = /[,\[\]\{\}]/;
16835
var PATTERN_TAG_HANDLE            = /^(?:!|!!|![a-z\-]+!)$/i;
16836
var PATTERN_TAG_URI               = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
16837
16838
16839
function is_EOL(c) {
16840
  return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
16841
}
16842
16843
function is_WHITE_SPACE(c) {
16844
  return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
16845
}
16846
16847
function is_WS_OR_EOL(c) {
16848
  return (c === 0x09/* Tab */) ||
16849
         (c === 0x20/* Space */) ||
16850
         (c === 0x0A/* LF */) ||
16851
         (c === 0x0D/* CR */);
16852
}
16853
16854
function is_FLOW_INDICATOR(c) {
16855
  return 0x2C/* , */ === c ||
16856
         0x5B/* [ */ === c ||
16857
         0x5D/* ] */ === c ||
16858
         0x7B/* { */ === c ||
16859
         0x7D/* } */ === c;
16860
}
16861
16862
function fromHexCode(c) {
16863
  var lc;
16864
16865
  if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
16866
    return c - 0x30;
16867
  }
16868
16869
  /*eslint-disable no-bitwise*/
16870
  lc = c | 0x20;
16871
16872
  if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
16873
    return lc - 0x61 + 10;
16874
  }
16875
16876
  return -1;
16877
}
16878
16879
function escapedHexLen(c) {
16880
  if (c === 0x78/* x */) { return 2; }
16881
  if (c === 0x75/* u */) { return 4; }
16882
  if (c === 0x55/* U */) { return 8; }
16883
  return 0;
16884
}
16885
16886
function fromDecimalCode(c) {
16887
  if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
16888
    return c - 0x30;
16889
  }
16890
16891
  return -1;
16892
}
16893
16894
function simpleEscapeSequence(c) {
16895
  return (c === 0x30/* 0 */) ? '\x00' :
16896
        (c === 0x61/* a */) ? '\x07' :
16897
        (c === 0x62/* b */) ? '\x08' :
16898
        (c === 0x74/* t */) ? '\x09' :
16899
        (c === 0x09/* Tab */) ? '\x09' :
16900
        (c === 0x6E/* n */) ? '\x0A' :
16901
        (c === 0x76/* v */) ? '\x0B' :
16902
        (c === 0x66/* f */) ? '\x0C' :
16903
        (c === 0x72/* r */) ? '\x0D' :
16904
        (c === 0x65/* e */) ? '\x1B' :
16905
        (c === 0x20/* Space */) ? ' ' :
16906
        (c === 0x22/* " */) ? '\x22' :
16907
        (c === 0x2F/* / */) ? '/' :
16908
        (c === 0x5C/* \ */) ? '\x5C' :
16909
        (c === 0x4E/* N */) ? '\x85' :
16910
        (c === 0x5F/* _ */) ? '\xA0' :
16911
        (c === 0x4C/* L */) ? '\u2028' :
16912
        (c === 0x50/* P */) ? '\u2029' : '';
16913
}
16914
16915
function charFromCodepoint(c) {
16916
  if (c <= 0xFFFF) {
16917
    return String.fromCharCode(c);
16918
  }
16919
  // Encode UTF-16 surrogate pair
16920
  // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
16921
  return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
16922
                             ((c - 0x010000) & 0x03FF) + 0xDC00);
16923
}
16924
16925
var simpleEscapeCheck = new Array(256); // integer, for fast access
16926
var simpleEscapeMap = new Array(256);
16927
for (var i = 0; i < 256; i++) {
16928
  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
16929
  simpleEscapeMap[i] = simpleEscapeSequence(i);
16930
}
16931
16932
16933
function State(input, options) {
16934
  this.input = input;
16935
16936
  this.filename  = options['filename']  || null;
16937
  this.schema    = options['schema']    || DEFAULT_FULL_SCHEMA;
16938
  this.onWarning = options['onWarning'] || null;
16939
  this.legacy    = options['legacy']    || false;
16940
16941
  this.implicitTypes = this.schema.compiledImplicit;
16942
  this.typeMap       = this.schema.compiledTypeMap;
16943
16944
  this.length     = input.length;
16945
  this.position   = 0;
16946
  this.line       = 0;
16947
  this.lineStart  = 0;
16948
  this.lineIndent = 0;
16949
16950
  this.documents = [];
16951
16952
  /*
16953
  this.version;
16954
  this.checkLineBreaks;
16955
  this.tagMap;
16956
  this.anchorMap;
16957
  this.tag;
16958
  this.anchor;
16959
  this.kind;
16960
  this.result;*/
16961
16962
}
16963
16964
16965
function generateError(state, message) {
16966
  return new YAMLException(
16967
    message,
16968
    new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
16969
}
16970
16971
function throwError(state, message) {
16972
  throw generateError(state, message);
16973
}
16974
16975
function throwWarning(state, message) {
16976
  var error = generateError(state, message);
16977
16978
  if (state.onWarning) {
16979
    state.onWarning.call(null, error);
16980
  } else {
16981
    throw error;
16982
  }
16983
}
16984
16985
16986
var directiveHandlers = {
16987
16988
  YAML: function handleYamlDirective(state, name, args) {
16989
16990
      var match, major, minor;
16991
16992
      if (null !== state.version) {
16993
        throwError(state, 'duplication of %YAML directive');
16994
      }
16995
16996
      if (1 !== args.length) {
16997
        throwError(state, 'YAML directive accepts exactly one argument');
16998
      }
16999
17000
      match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
17001
17002
      if (null === match) {
17003
        throwError(state, 'ill-formed argument of the YAML directive');
17004
      }
17005
17006
      major = parseInt(match[1], 10);
17007
      minor = parseInt(match[2], 10);
17008
17009
      if (1 !== major) {
17010
        throwError(state, 'unacceptable YAML version of the document');
17011
      }
17012
17013
      state.version = args[0];
17014
      state.checkLineBreaks = (minor < 2);
17015
17016
      if (1 !== minor && 2 !== minor) {
17017
        throwWarning(state, 'unsupported YAML version of the document');
17018
      }
17019
    },
17020
17021
  TAG: function handleTagDirective(state, name, args) {
17022
17023
      var handle, prefix;
17024
17025
      if (2 !== args.length) {
17026
        throwError(state, 'TAG directive accepts exactly two arguments');
17027
      }
17028
17029
      handle = args[0];
17030
      prefix = args[1];
17031
17032
      if (!PATTERN_TAG_HANDLE.test(handle)) {
17033
        throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
17034
      }
17035
17036
      if (_hasOwnProperty.call(state.tagMap, handle)) {
17037
        throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
17038
      }
17039
17040
      if (!PATTERN_TAG_URI.test(prefix)) {
17041
        throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
17042
      }
17043
17044
      state.tagMap[handle] = prefix;
17045
    }
17046
};
17047
17048
17049
function captureSegment(state, start, end, checkJson) {
17050
  var _position, _length, _character, _result;
17051
17052
  if (start < end) {
17053
    _result = state.input.slice(start, end);
17054
17055
    if (checkJson) {
17056
      for (_position = 0, _length = _result.length;
17057
           _position < _length;
17058
           _position += 1) {
17059
        _character = _result.charCodeAt(_position);
17060
        if (!(0x09 === _character ||
17061
              0x20 <= _character && _character <= 0x10FFFF)) {
17062
          throwError(state, 'expected valid JSON character');
17063
        }
17064
      }
17065
    }
17066
17067
    state.result += _result;
17068
  }
17069
}
17070
17071
function mergeMappings(state, destination, source) {
17072
  var sourceKeys, key, index, quantity;
17073
17074
  if (!common.isObject(source)) {
17075
    throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
17076
  }
17077
17078
  sourceKeys = Object.keys(source);
17079
17080
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
17081
    key = sourceKeys[index];
17082
17083
    if (!_hasOwnProperty.call(destination, key)) {
17084
      destination[key] = source[key];
17085
    }
17086
  }
17087
}
17088
17089
function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
17090
  var index, quantity;
17091
17092
  keyNode = String(keyNode);
17093
17094
  if (null === _result) {
17095
    _result = {};
17096
  }
17097
17098
  if ('tag:yaml.org,2002:merge' === keyTag) {
17099
    if (Array.isArray(valueNode)) {
17100
      for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
17101
        mergeMappings(state, _result, valueNode[index]);
17102
      }
17103
    } else {
17104
      mergeMappings(state, _result, valueNode);
17105
    }
17106
  } else {
17107
    _result[keyNode] = valueNode;
17108
  }
17109
17110
  return _result;
17111
}
17112
17113
function readLineBreak(state) {
17114
  var ch;
17115
17116
  ch = state.input.charCodeAt(state.position);
17117
17118
  if (0x0A/* LF */ === ch) {
17119
    state.position++;
17120
  } else if (0x0D/* CR */ === ch) {
17121
    state.position++;
17122
    if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {
17123
      state.position++;
17124
    }
17125
  } else {
17126
    throwError(state, 'a line break is expected');
17127
  }
17128
17129
  state.line += 1;
17130
  state.lineStart = state.position;
17131
}
17132
17133
function skipSeparationSpace(state, allowComments, checkIndent) {
17134
  var lineBreaks = 0,
17135
      ch = state.input.charCodeAt(state.position);
17136
17137
  while (0 !== ch) {
17138
    while (is_WHITE_SPACE(ch)) {
17139
      ch = state.input.charCodeAt(++state.position);
17140
    }
17141
17142
    if (allowComments && 0x23/* # */ === ch) {
17143
      do {
17144
        ch = state.input.charCodeAt(++state.position);
17145
      } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);
17146
    }
17147
17148
    if (is_EOL(ch)) {
17149
      readLineBreak(state);
17150
17151
      ch = state.input.charCodeAt(state.position);
17152
      lineBreaks++;
17153
      state.lineIndent = 0;
17154
17155
      while (0x20/* Space */ === ch) {
17156
        state.lineIndent++;
17157
        ch = state.input.charCodeAt(++state.position);
17158
      }
17159
    } else {
17160
      break;
17161
    }
17162
  }
17163
17164
  if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {
17165
    throwWarning(state, 'deficient indentation');
17166
  }
17167
17168
  return lineBreaks;
17169
}
17170
17171
function testDocumentSeparator(state) {
17172
  var _position = state.position,
17173
      ch;
17174
17175
  ch = state.input.charCodeAt(_position);
17176
17177
  // Condition state.position === state.lineStart is tested
17178
  // in parent on each call, for efficiency. No needs to test here again.
17179
  if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&
17180
      state.input.charCodeAt(_position + 1) === ch &&
17181
      state.input.charCodeAt(_position + 2) === ch) {
17182
17183
    _position += 3;
17184
17185
    ch = state.input.charCodeAt(_position);
17186
17187
    if (ch === 0 || is_WS_OR_EOL(ch)) {
17188
      return true;
17189
    }
17190
  }
17191
17192
  return false;
17193
}
17194
17195
function writeFoldedLines(state, count) {
17196
  if (1 === count) {
17197
    state.result += ' ';
17198
  } else if (count > 1) {
17199
    state.result += common.repeat('\n', count - 1);
17200
  }
17201
}
17202
17203
17204
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
17205
  var preceding,
17206
      following,
17207
      captureStart,
17208
      captureEnd,
17209
      hasPendingContent,
17210
      _line,
17211
      _lineStart,
17212
      _lineIndent,
17213
      _kind = state.kind,
17214
      _result = state.result,
17215
      ch;
17216
17217
  ch = state.input.charCodeAt(state.position);
17218
17219
  if (is_WS_OR_EOL(ch)             ||
17220
      is_FLOW_INDICATOR(ch)        ||
17221
      0x23/* # */           === ch ||
17222
      0x26/* & */           === ch ||
17223
      0x2A/* * */           === ch ||
17224
      0x21/* ! */           === ch ||
17225
      0x7C/* | */           === ch ||
17226
      0x3E/* > */           === ch ||
17227
      0x27/* ' */           === ch ||
17228
      0x22/* " */           === ch ||
17229
      0x25/* % */           === ch ||
17230
      0x40/* @ */           === ch ||
17231
      0x60/* ` */           === ch) {
17232
    return false;
17233
  }
17234
17235
  if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {
17236
    following = state.input.charCodeAt(state.position + 1);
17237
17238
    if (is_WS_OR_EOL(following) ||
17239
        withinFlowCollection && is_FLOW_INDICATOR(following)) {
17240
      return false;
17241
    }
17242
  }
17243
17244
  state.kind = 'scalar';
17245
  state.result = '';
17246
  captureStart = captureEnd = state.position;
17247
  hasPendingContent = false;
17248
17249
  while (0 !== ch) {
17250
    if (0x3A/* : */ === ch) {
17251
      following = state.input.charCodeAt(state.position + 1);
17252
17253
      if (is_WS_OR_EOL(following) ||
17254
          withinFlowCollection && is_FLOW_INDICATOR(following)) {
17255
        break;
17256
      }
17257
17258
    } else if (0x23/* # */ === ch) {
17259
      preceding = state.input.charCodeAt(state.position - 1);
17260
17261
      if (is_WS_OR_EOL(preceding)) {
17262
        break;
17263
      }
17264
17265
    } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
17266
               withinFlowCollection && is_FLOW_INDICATOR(ch)) {
17267
      break;
17268
17269
    } else if (is_EOL(ch)) {
17270
      _line = state.line;
17271
      _lineStart = state.lineStart;
17272
      _lineIndent = state.lineIndent;
17273
      skipSeparationSpace(state, false, -1);
17274
17275
      if (state.lineIndent >= nodeIndent) {
17276
        hasPendingContent = true;
17277
        ch = state.input.charCodeAt(state.position);
17278
        continue;
17279
      } else {
17280
        state.position = captureEnd;
17281
        state.line = _line;
17282
        state.lineStart = _lineStart;
17283
        state.lineIndent = _lineIndent;
17284
        break;
17285
      }
17286
    }
17287
17288
    if (hasPendingContent) {
17289
      captureSegment(state, captureStart, captureEnd, false);
17290
      writeFoldedLines(state, state.line - _line);
17291
      captureStart = captureEnd = state.position;
17292
      hasPendingContent = false;
17293
    }
17294
17295
    if (!is_WHITE_SPACE(ch)) {
17296
      captureEnd = state.position + 1;
17297
    }
17298
17299
    ch = state.input.charCodeAt(++state.position);
17300
  }
17301
17302
  captureSegment(state, captureStart, captureEnd, false);
17303
17304
  if (state.result) {
17305
    return true;
17306
  }
17307
17308
  state.kind = _kind;
17309
  state.result = _result;
17310
  return false;
17311
}
17312
17313
function readSingleQuotedScalar(state, nodeIndent) {
17314
  var ch,
17315
      captureStart, captureEnd;
17316
17317
  ch = state.input.charCodeAt(state.position);
17318
17319
  if (0x27/* ' */ !== ch) {
17320
    return false;
17321
  }
17322
17323
  state.kind = 'scalar';
17324
  state.result = '';
17325
  state.position++;
17326
  captureStart = captureEnd = state.position;
17327
17328
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
17329
    if (0x27/* ' */ === ch) {
17330
      captureSegment(state, captureStart, state.position, true);
17331
      ch = state.input.charCodeAt(++state.position);
17332
17333
      if (0x27/* ' */ === ch) {
17334
        captureStart = captureEnd = state.position;
17335
        state.position++;
17336
      } else {
17337
        return true;
17338
      }
17339
17340
    } else if (is_EOL(ch)) {
17341
      captureSegment(state, captureStart, captureEnd, true);
17342
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
17343
      captureStart = captureEnd = state.position;
17344
17345
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
17346
      throwError(state, 'unexpected end of the document within a single quoted scalar');
17347
17348
    } else {
17349
      state.position++;
17350
      captureEnd = state.position;
17351
    }
17352
  }
17353
17354
  throwError(state, 'unexpected end of the stream within a single quoted scalar');
17355
}
17356
17357
function readDoubleQuotedScalar(state, nodeIndent) {
17358
  var captureStart,
17359
      captureEnd,
17360
      hexLength,
17361
      hexResult,
17362
      tmp, tmpEsc,
17363
      ch;
17364
17365
  ch = state.input.charCodeAt(state.position);
17366
17367
  if (0x22/* " */ !== ch) {
17368
    return false;
17369
  }
17370
17371
  state.kind = 'scalar';
17372
  state.result = '';
17373
  state.position++;
17374
  captureStart = captureEnd = state.position;
17375
17376
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
17377
    if (0x22/* " */ === ch) {
17378
      captureSegment(state, captureStart, state.position, true);
17379
      state.position++;
17380
      return true;
17381
17382
    } else if (0x5C/* \ */ === ch) {
17383
      captureSegment(state, captureStart, state.position, true);
17384
      ch = state.input.charCodeAt(++state.position);
17385
17386
      if (is_EOL(ch)) {
17387
        skipSeparationSpace(state, false, nodeIndent);
17388
17389
        // TODO: rework to inline fn with no type cast?
17390
      } else if (ch < 256 && simpleEscapeCheck[ch]) {
17391
        state.result += simpleEscapeMap[ch];
17392
        state.position++;
17393
17394
      } else if ((tmp = escapedHexLen(ch)) > 0) {
17395
        hexLength = tmp;
17396
        hexResult = 0;
17397
17398
        for (; hexLength > 0; hexLength--) {
17399
          ch = state.input.charCodeAt(++state.position);
17400
17401
          if ((tmp = fromHexCode(ch)) >= 0) {
17402
            hexResult = (hexResult << 4) + tmp;
17403
17404
          } else {
17405
            throwError(state, 'expected hexadecimal character');
17406
          }
17407
        }
17408
17409
        state.result += charFromCodepoint(hexResult);
17410
17411
        state.position++;
17412
17413
      } else {
17414
        throwError(state, 'unknown escape sequence');
17415
      }
17416
17417
      captureStart = captureEnd = state.position;
17418
17419
    } else if (is_EOL(ch)) {
17420
      captureSegment(state, captureStart, captureEnd, true);
17421
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
17422
      captureStart = captureEnd = state.position;
17423
17424
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
17425
      throwError(state, 'unexpected end of the document within a double quoted scalar');
17426
17427
    } else {
17428
      state.position++;
17429
      captureEnd = state.position;
17430
    }
17431
  }
17432
17433
  throwError(state, 'unexpected end of the stream within a double quoted scalar');
17434
}
17435
17436
function readFlowCollection(state, nodeIndent) {
17437
  var readNext = true,
17438
      _line,
17439
      _tag     = state.tag,
17440
      _result,
17441
      _anchor  = state.anchor,
17442
      following,
17443
      terminator,
17444
      isPair,
17445
      isExplicitPair,
17446
      isMapping,
17447
      keyNode,
17448
      keyTag,
17449
      valueNode,
17450
      ch;
17451
17452
  ch = state.input.charCodeAt(state.position);
17453
17454
  if (ch === 0x5B/* [ */) {
17455
    terminator = 0x5D;/* ] */
17456
    isMapping = false;
17457
    _result = [];
17458
  } else if (ch === 0x7B/* { */) {
17459
    terminator = 0x7D;/* } */
17460
    isMapping = true;
17461
    _result = {};
17462
  } else {
17463
    return false;
17464
  }
17465
17466
  if (null !== state.anchor) {
17467
    state.anchorMap[state.anchor] = _result;
17468
  }
17469
17470
  ch = state.input.charCodeAt(++state.position);
17471
17472
  while (0 !== ch) {
17473
    skipSeparationSpace(state, true, nodeIndent);
17474
17475
    ch = state.input.charCodeAt(state.position);
17476
17477
    if (ch === terminator) {
17478
      state.position++;
17479
      state.tag = _tag;
17480
      state.anchor = _anchor;
17481
      state.kind = isMapping ? 'mapping' : 'sequence';
17482
      state.result = _result;
17483
      return true;
17484
    } else if (!readNext) {
17485
      throwError(state, 'missed comma between flow collection entries');
17486
    }
17487
17488
    keyTag = keyNode = valueNode = null;
17489
    isPair = isExplicitPair = false;
17490
17491
    if (0x3F/* ? */ === ch) {
17492
      following = state.input.charCodeAt(state.position + 1);
17493
17494
      if (is_WS_OR_EOL(following)) {
17495
        isPair = isExplicitPair = true;
17496
        state.position++;
17497
        skipSeparationSpace(state, true, nodeIndent);
17498
      }
17499
    }
17500
17501
    _line = state.line;
17502
    composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
17503
    keyTag = state.tag;
17504
    keyNode = state.result;
17505
    skipSeparationSpace(state, true, nodeIndent);
17506
17507
    ch = state.input.charCodeAt(state.position);
17508
17509
    if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {
17510
      isPair = true;
17511
      ch = state.input.charCodeAt(++state.position);
17512
      skipSeparationSpace(state, true, nodeIndent);
17513
      composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
17514
      valueNode = state.result;
17515
    }
17516
17517
    if (isMapping) {
17518
      storeMappingPair(state, _result, keyTag, keyNode, valueNode);
17519
    } else if (isPair) {
17520
      _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));
17521
    } else {
17522
      _result.push(keyNode);
17523
    }
17524
17525
    skipSeparationSpace(state, true, nodeIndent);
17526
17527
    ch = state.input.charCodeAt(state.position);
17528
17529
    if (0x2C/* , */ === ch) {
17530
      readNext = true;
17531
      ch = state.input.charCodeAt(++state.position);
17532
    } else {
17533
      readNext = false;
17534
    }
17535
  }
17536
17537
  throwError(state, 'unexpected end of the stream within a flow collection');
17538
}
17539
17540
function readBlockScalar(state, nodeIndent) {
17541
  var captureStart,
17542
      folding,
17543
      chomping       = CHOMPING_CLIP,
17544
      detectedIndent = false,
17545
      textIndent     = nodeIndent,
17546
      emptyLines     = 0,
17547
      atMoreIndented = false,
17548
      tmp,
17549
      ch;
17550
17551
  ch = state.input.charCodeAt(state.position);
17552
17553
  if (ch === 0x7C/* | */) {
17554
    folding = false;
17555
  } else if (ch === 0x3E/* > */) {
17556
    folding = true;
17557
  } else {
17558
    return false;
17559
  }
17560
17561
  state.kind = 'scalar';
17562
  state.result = '';
17563
17564
  while (0 !== ch) {
17565
    ch = state.input.charCodeAt(++state.position);
17566
17567
    if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {
17568
      if (CHOMPING_CLIP === chomping) {
17569
        chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;
17570
      } else {
17571
        throwError(state, 'repeat of a chomping mode identifier');
17572
      }
17573
17574
    } else if ((tmp = fromDecimalCode(ch)) >= 0) {
17575
      if (tmp === 0) {
17576
        throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
17577
      } else if (!detectedIndent) {
17578
        textIndent = nodeIndent + tmp - 1;
17579
        detectedIndent = true;
17580
      } else {
17581
        throwError(state, 'repeat of an indentation width identifier');
17582
      }
17583
17584
    } else {
17585
      break;
17586
    }
17587
  }
17588
17589
  if (is_WHITE_SPACE(ch)) {
17590
    do { ch = state.input.charCodeAt(++state.position); }
17591
    while (is_WHITE_SPACE(ch));
17592
17593
    if (0x23/* # */ === ch) {
17594
      do { ch = state.input.charCodeAt(++state.position); }
17595
      while (!is_EOL(ch) && (0 !== ch));
17596
    }
17597
  }
17598
17599
  while (0 !== ch) {
17600
    readLineBreak(state);
17601
    state.lineIndent = 0;
17602
17603
    ch = state.input.charCodeAt(state.position);
17604
17605
    while ((!detectedIndent || state.lineIndent < textIndent) &&
17606
           (0x20/* Space */ === ch)) {
17607
      state.lineIndent++;
17608
      ch = state.input.charCodeAt(++state.position);
17609
    }
17610
17611
    if (!detectedIndent && state.lineIndent > textIndent) {
17612
      textIndent = state.lineIndent;
17613
    }
17614
17615
    if (is_EOL(ch)) {
17616
      emptyLines++;
17617
      continue;
17618
    }
17619
17620
    // End of the scalar.
17621
    if (state.lineIndent < textIndent) {
17622
17623
      // Perform the chomping.
17624
      if (chomping === CHOMPING_KEEP) {
17625
        state.result += common.repeat('\n', emptyLines);
17626
      } else if (chomping === CHOMPING_CLIP) {
17627
        if (detectedIndent) { // i.e. only if the scalar is not empty.
17628
          state.result += '\n';
17629
        }
17630
      }
17631
17632
      // Break this `while` cycle and go to the funciton's epilogue.
17633
      break;
17634
    }
17635
17636
    // Folded style: use fancy rules to handle line breaks.
17637
    if (folding) {
17638
17639
      // Lines starting with white space characters (more-indented lines) are not folded.
17640
      if (is_WHITE_SPACE(ch)) {
17641
        atMoreIndented = true;
17642
        state.result += common.repeat('\n', emptyLines + 1);
17643
17644
      // End of more-indented block.
17645
      } else if (atMoreIndented) {
17646
        atMoreIndented = false;
17647
        state.result += common.repeat('\n', emptyLines + 1);
17648
17649
      // Just one line break - perceive as the same line.
17650
      } else if (0 === emptyLines) {
17651
        if (detectedIndent) { // i.e. only if we have already read some scalar content.
17652
          state.result += ' ';
17653
        }
17654
17655
      // Several line breaks - perceive as different lines.
17656
      } else {
17657
        state.result += common.repeat('\n', emptyLines);
17658
      }
17659
17660
    // Literal style: just add exact number of line breaks between content lines.
17661
    } else if (detectedIndent) {
17662
      // If current line isn't the first one - count line break from the last content line.
17663
      state.result += common.repeat('\n', emptyLines + 1);
17664
    } else {
17665
      // In case of the first content line - count only empty lines.
17666
    }
17667
17668
    detectedIndent = true;
17669
    emptyLines = 0;
17670
    captureStart = state.position;
17671
17672
    while (!is_EOL(ch) && (0 !== ch)) {
17673
      ch = state.input.charCodeAt(++state.position);
17674
    }
17675
17676
    captureSegment(state, captureStart, state.position, false);
17677
  }
17678
17679
  return true;
17680
}
17681
17682
function readBlockSequence(state, nodeIndent) {
17683
  var _line,
17684
      _tag      = state.tag,
17685
      _anchor   = state.anchor,
17686
      _result   = [],
17687
      following,
17688
      detected  = false,
17689
      ch;
17690
17691
  if (null !== state.anchor) {
17692
    state.anchorMap[state.anchor] = _result;
17693
  }
17694
17695
  ch = state.input.charCodeAt(state.position);
17696
17697
  while (0 !== ch) {
17698
17699
    if (0x2D/* - */ !== ch) {
17700
      break;
17701
    }
17702
17703
    following = state.input.charCodeAt(state.position + 1);
17704
17705
    if (!is_WS_OR_EOL(following)) {
17706
      break;
17707
    }
17708
17709
    detected = true;
17710
    state.position++;
17711
17712
    if (skipSeparationSpace(state, true, -1)) {
17713
      if (state.lineIndent <= nodeIndent) {
17714
        _result.push(null);
17715
        ch = state.input.charCodeAt(state.position);
17716
        continue;
17717
      }
17718
    }
17719
17720
    _line = state.line;
17721
    composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
17722
    _result.push(state.result);
17723
    skipSeparationSpace(state, true, -1);
17724
17725
    ch = state.input.charCodeAt(state.position);
17726
17727
    if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {
17728
      throwError(state, 'bad indentation of a sequence entry');
17729
    } else if (state.lineIndent < nodeIndent) {
17730
      break;
17731
    }
17732
  }
17733
17734
  if (detected) {
17735
    state.tag = _tag;
17736
    state.anchor = _anchor;
17737
    state.kind = 'sequence';
17738
    state.result = _result;
17739
    return true;
17740
  }
17741
  return false;
17742
}
17743
17744
function readBlockMapping(state, nodeIndent, flowIndent) {
17745
  var following,
17746
      allowCompact,
17747
      _line,
17748
      _tag          = state.tag,
17749
      _anchor       = state.anchor,
17750
      _result       = {},
17751
      keyTag        = null,
17752
      keyNode       = null,
17753
      valueNode     = null,
17754
      atExplicitKey = false,
17755
      detected      = false,
17756
      ch;
17757
17758
  if (null !== state.anchor) {
17759
    state.anchorMap[state.anchor] = _result;
17760
  }
17761
17762
  ch = state.input.charCodeAt(state.position);
17763
17764
  while (0 !== ch) {
17765
    following = state.input.charCodeAt(state.position + 1);
17766
    _line = state.line; // Save the current line.
17767
17768
    //
17769
    // Explicit notation case. There are two separate blocks:
17770
    // first for the key (denoted by "?") and second for the value (denoted by ":")
17771
    //
17772
    if ((0x3F/* ? */ === ch || 0x3A/* : */  === ch) && is_WS_OR_EOL(following)) {
17773
17774
      if (0x3F/* ? */ === ch) {
17775
        if (atExplicitKey) {
17776
          storeMappingPair(state, _result, keyTag, keyNode, null);
17777
          keyTag = keyNode = valueNode = null;
17778
        }
17779
17780
        detected = true;
17781
        atExplicitKey = true;
17782
        allowCompact = true;
17783
17784
      } else if (atExplicitKey) {
17785
        // i.e. 0x3A/* : */ === character after the explicit key.
17786
        atExplicitKey = false;
17787
        allowCompact = true;
17788
17789
      } else {
17790
        throwError(state, 'incomplete explicit mapping pair; a key node is missed');
17791
      }
17792
17793
      state.position += 1;
17794
      ch = following;
17795
17796
    //
17797
    // Implicit notation case. Flow-style node as the key first, then ":", and the value.
17798
    //
17799
    } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
17800
17801
      if (state.line === _line) {
17802
        ch = state.input.charCodeAt(state.position);
17803
17804
        while (is_WHITE_SPACE(ch)) {
17805
          ch = state.input.charCodeAt(++state.position);
17806
        }
17807
17808
        if (0x3A/* : */ === ch) {
17809
          ch = state.input.charCodeAt(++state.position);
17810
17811
          if (!is_WS_OR_EOL(ch)) {
17812
            throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
17813
          }
17814
17815
          if (atExplicitKey) {
17816
            storeMappingPair(state, _result, keyTag, keyNode, null);
17817
            keyTag = keyNode = valueNode = null;
17818
          }
17819
17820
          detected = true;
17821
          atExplicitKey = false;
17822
          allowCompact = false;
17823
          keyTag = state.tag;
17824
          keyNode = state.result;
17825
17826
        } else if (detected) {
17827
          throwError(state, 'can not read an implicit mapping pair; a colon is missed');
17828
17829
        } else {
17830
          state.tag = _tag;
17831
          state.anchor = _anchor;
17832
          return true; // Keep the result of `composeNode`.
17833
        }
17834
17835
      } else if (detected) {
17836
        throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
17837
17838
      } else {
17839
        state.tag = _tag;
17840
        state.anchor = _anchor;
17841
        return true; // Keep the result of `composeNode`.
17842
      }
17843
17844
    } else {
17845
      break; // Reading is done. Go to the epilogue.
17846
    }
17847
17848
    //
17849
    // Common reading code for both explicit and implicit notations.
17850
    //
17851
    if (state.line === _line || state.lineIndent > nodeIndent) {
17852
      if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
17853
        if (atExplicitKey) {
17854
          keyNode = state.result;
17855
        } else {
17856
          valueNode = state.result;
17857
        }
17858
      }
17859
17860
      if (!atExplicitKey) {
17861
        storeMappingPair(state, _result, keyTag, keyNode, valueNode);
17862
        keyTag = keyNode = valueNode = null;
17863
      }
17864
17865
      skipSeparationSpace(state, true, -1);
17866
      ch = state.input.charCodeAt(state.position);
17867
    }
17868
17869
    if (state.lineIndent > nodeIndent && (0 !== ch)) {
17870
      throwError(state, 'bad indentation of a mapping entry');
17871
    } else if (state.lineIndent < nodeIndent) {
17872
      break;
17873
    }
17874
  }
17875
17876
  //
17877
  // Epilogue.
17878
  //
17879
17880
  // Special case: last mapping's node contains only the key in explicit notation.
17881
  if (atExplicitKey) {
17882
    storeMappingPair(state, _result, keyTag, keyNode, null);
17883
  }
17884
17885
  // Expose the resulting mapping.
17886
  if (detected) {
17887
    state.tag = _tag;
17888
    state.anchor = _anchor;
17889
    state.kind = 'mapping';
17890
    state.result = _result;
17891
  }
17892
17893
  return detected;
17894
}
17895
17896
function readTagProperty(state) {
17897
  var _position,
17898
      isVerbatim = false,
17899
      isNamed    = false,
17900
      tagHandle,
17901
      tagName,
17902
      ch;
17903
17904
  ch = state.input.charCodeAt(state.position);
17905
17906
  if (0x21/* ! */ !== ch) {
17907
    return false;
17908
  }
17909
17910
  if (null !== state.tag) {
17911
    throwError(state, 'duplication of a tag property');
17912
  }
17913
17914
  ch = state.input.charCodeAt(++state.position);
17915
17916
  if (0x3C/* < */ === ch) {
17917
    isVerbatim = true;
17918
    ch = state.input.charCodeAt(++state.position);
17919
17920
  } else if (0x21/* ! */ === ch) {
17921
    isNamed = true;
17922
    tagHandle = '!!';
17923
    ch = state.input.charCodeAt(++state.position);
17924
17925
  } else {
17926
    tagHandle = '!';
17927
  }
17928
17929
  _position = state.position;
17930
17931
  if (isVerbatim) {
17932
    do { ch = state.input.charCodeAt(++state.position); }
17933
    while (0 !== ch && 0x3E/* > */ !== ch);
17934
17935
    if (state.position < state.length) {
17936
      tagName = state.input.slice(_position, state.position);
17937
      ch = state.input.charCodeAt(++state.position);
17938
    } else {
17939
      throwError(state, 'unexpected end of the stream within a verbatim tag');
17940
    }
17941
  } else {
17942
    while (0 !== ch && !is_WS_OR_EOL(ch)) {
17943
17944
      if (0x21/* ! */ === ch) {
17945
        if (!isNamed) {
17946
          tagHandle = state.input.slice(_position - 1, state.position + 1);
17947
17948
          if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
17949
            throwError(state, 'named tag handle cannot contain such characters');
17950
          }
17951
17952
          isNamed = true;
17953
          _position = state.position + 1;
17954
        } else {
17955
          throwError(state, 'tag suffix cannot contain exclamation marks');
17956
        }
17957
      }
17958
17959
      ch = state.input.charCodeAt(++state.position);
17960
    }
17961
17962
    tagName = state.input.slice(_position, state.position);
17963
17964
    if (PATTERN_FLOW_INDICATORS.test(tagName)) {
17965
      throwError(state, 'tag suffix cannot contain flow indicator characters');
17966
    }
17967
  }
17968
17969
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
17970
    throwError(state, 'tag name cannot contain such characters: ' + tagName);
17971
  }
17972
17973
  if (isVerbatim) {
17974
    state.tag = tagName;
17975
17976
  } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
17977
    state.tag = state.tagMap[tagHandle] + tagName;
17978
17979
  } else if ('!' === tagHandle) {
17980
    state.tag = '!' + tagName;
17981
17982
  } else if ('!!' === tagHandle) {
17983
    state.tag = 'tag:yaml.org,2002:' + tagName;
17984
17985
  } else {
17986
    throwError(state, 'undeclared tag handle "' + tagHandle + '"');
17987
  }
17988
17989
  return true;
17990
}
17991
17992
function readAnchorProperty(state) {
17993
  var _position,
17994
      ch;
17995
17996
  ch = state.input.charCodeAt(state.position);
17997
17998
  if (0x26/* & */ !== ch) {
17999
    return false;
18000
  }
18001
18002
  if (null !== state.anchor) {
18003
    throwError(state, 'duplication of an anchor property');
18004
  }
18005
18006
  ch = state.input.charCodeAt(++state.position);
18007
  _position = state.position;
18008
18009
  while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
18010
    ch = state.input.charCodeAt(++state.position);
18011
  }
18012
18013
  if (state.position === _position) {
18014
    throwError(state, 'name of an anchor node must contain at least one character');
18015
  }
18016
18017
  state.anchor = state.input.slice(_position, state.position);
18018
  return true;
18019
}
18020
18021
function readAlias(state) {
18022
  var _position, alias,
18023
      len = state.length,
18024
      input = state.input,
18025
      ch;
18026
18027
  ch = state.input.charCodeAt(state.position);
18028
18029
  if (0x2A/* * */ !== ch) {
18030
    return false;
18031
  }
18032
18033
  ch = state.input.charCodeAt(++state.position);
18034
  _position = state.position;
18035
18036
  while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
18037
    ch = state.input.charCodeAt(++state.position);
18038
  }
18039
18040
  if (state.position === _position) {
18041
    throwError(state, 'name of an alias node must contain at least one character');
18042
  }
18043
18044
  alias = state.input.slice(_position, state.position);
18045
18046
  if (!state.anchorMap.hasOwnProperty(alias)) {
18047
    throwError(state, 'unidentified alias "' + alias + '"');
18048
  }
18049
18050
  state.result = state.anchorMap[alias];
18051
  skipSeparationSpace(state, true, -1);
18052
  return true;
18053
}
18054
18055
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
18056
  var allowBlockStyles,
18057
      allowBlockScalars,
18058
      allowBlockCollections,
18059
      indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
18060
      atNewLine  = false,
18061
      hasContent = false,
18062
      typeIndex,
18063
      typeQuantity,
18064
      type,
18065
      flowIndent,
18066
      blockIndent,
18067
      _result;
18068
18069
  state.tag    = null;
18070
  state.anchor = null;
18071
  state.kind   = null;
18072
  state.result = null;
18073
18074
  allowBlockStyles = allowBlockScalars = allowBlockCollections =
18075
    CONTEXT_BLOCK_OUT === nodeContext ||
18076
    CONTEXT_BLOCK_IN  === nodeContext;
18077
18078
  if (allowToSeek) {
18079
    if (skipSeparationSpace(state, true, -1)) {
18080
      atNewLine = true;
18081
18082
      if (state.lineIndent > parentIndent) {
18083
        indentStatus = 1;
18084
      } else if (state.lineIndent === parentIndent) {
18085
        indentStatus = 0;
18086
      } else if (state.lineIndent < parentIndent) {
18087
        indentStatus = -1;
18088
      }
18089
    }
18090
  }
18091
18092
  if (1 === indentStatus) {
18093
    while (readTagProperty(state) || readAnchorProperty(state)) {
18094
      if (skipSeparationSpace(state, true, -1)) {
18095
        atNewLine = true;
18096
        allowBlockCollections = allowBlockStyles;
18097
18098
        if (state.lineIndent > parentIndent) {
18099
          indentStatus = 1;
18100
        } else if (state.lineIndent === parentIndent) {
18101
          indentStatus = 0;
18102
        } else if (state.lineIndent < parentIndent) {
18103
          indentStatus = -1;
18104
        }
18105
      } else {
18106
        allowBlockCollections = false;
18107
      }
18108
    }
18109
  }
18110
18111
  if (allowBlockCollections) {
18112
    allowBlockCollections = atNewLine || allowCompact;
18113
  }
18114
18115
  if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
18116
    if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
18117
      flowIndent = parentIndent;
18118
    } else {
18119
      flowIndent = parentIndent + 1;
18120
    }
18121
18122
    blockIndent = state.position - state.lineStart;
18123
18124
    if (1 === indentStatus) {
18125
      if (allowBlockCollections &&
18126
          (readBlockSequence(state, blockIndent) ||
18127
           readBlockMapping(state, blockIndent, flowIndent)) ||
18128
          readFlowCollection(state, flowIndent)) {
18129
        hasContent = true;
18130
      } else {
18131
        if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
18132
            readSingleQuotedScalar(state, flowIndent) ||
18133
            readDoubleQuotedScalar(state, flowIndent)) {
18134
          hasContent = true;
18135
18136
        } else if (readAlias(state)) {
18137
          hasContent = true;
18138
18139
          if (null !== state.tag || null !== state.anchor) {
18140
            throwError(state, 'alias node should not have any properties');
18141
          }
18142
18143
        } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
18144
          hasContent = true;
18145
18146
          if (null === state.tag) {
18147
            state.tag = '?';
18148
          }
18149
        }
18150
18151
        if (null !== state.anchor) {
18152
          state.anchorMap[state.anchor] = state.result;
18153
        }
18154
      }
18155
    } else if (0 === indentStatus) {
18156
      // Special case: block sequences are allowed to have same indentation level as the parent.
18157
      // http://www.yaml.org/spec/1.2/spec.html#id2799784
18158
      hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
18159
    }
18160
  }
18161
18162
  if (null !== state.tag && '!' !== state.tag) {
18163
    if ('?' === state.tag) {
18164
      for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
18165
           typeIndex < typeQuantity;
18166
           typeIndex += 1) {
18167
        type = state.implicitTypes[typeIndex];
18168
18169
        // Implicit resolving is not allowed for non-scalar types, and '?'
18170
        // non-specific tag is only assigned to plain scalars. So, it isn't
18171
        // needed to check for 'kind' conformity.
18172
18173
        if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
18174
          state.result = type.construct(state.result);
18175
          state.tag = type.tag;
18176
          if (null !== state.anchor) {
18177
            state.anchorMap[state.anchor] = state.result;
18178
          }
18179
          break;
18180
        }
18181
      }
18182
    } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
18183
      type = state.typeMap[state.tag];
18184
18185
      if (null !== state.result && type.kind !== state.kind) {
18186
        throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
18187
      }
18188
18189
      if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
18190
        throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
18191
      } else {
18192
        state.result = type.construct(state.result);
18193
        if (null !== state.anchor) {
18194
          state.anchorMap[state.anchor] = state.result;
18195
        }
18196
      }
18197
    } else {
18198
      throwWarning(state, 'unknown tag !<' + state.tag + '>');
18199
    }
18200
  }
18201
18202
  return null !== state.tag || null !== state.anchor || hasContent;
18203
}
18204
18205
function readDocument(state) {
18206
  var documentStart = state.position,
18207
      _position,
18208
      directiveName,
18209
      directiveArgs,
18210
      hasDirectives = false,
18211
      ch;
18212
18213
  state.version = null;
18214
  state.checkLineBreaks = state.legacy;
18215
  state.tagMap = {};
18216
  state.anchorMap = {};
18217
18218
  while (0 !== (ch = state.input.charCodeAt(state.position))) {
18219
    skipSeparationSpace(state, true, -1);
18220
18221
    ch = state.input.charCodeAt(state.position);
18222
18223
    if (state.lineIndent > 0 || 0x25/* % */ !== ch) {
18224
      break;
18225
    }
18226
18227
    hasDirectives = true;
18228
    ch = state.input.charCodeAt(++state.position);
18229
    _position = state.position;
18230
18231
    while (0 !== ch && !is_WS_OR_EOL(ch)) {
18232
      ch = state.input.charCodeAt(++state.position);
18233
    }
18234
18235
    directiveName = state.input.slice(_position, state.position);
18236
    directiveArgs = [];
18237
18238
    if (directiveName.length < 1) {
18239
      throwError(state, 'directive name must not be less than one character in length');
18240
    }
18241
18242
    while (0 !== ch) {
18243
      while (is_WHITE_SPACE(ch)) {
18244
        ch = state.input.charCodeAt(++state.position);
18245
      }
18246
18247
      if (0x23/* # */ === ch) {
18248
        do { ch = state.input.charCodeAt(++state.position); }
18249
        while (0 !== ch && !is_EOL(ch));
18250
        break;
18251
      }
18252
18253
      if (is_EOL(ch)) {
18254
        break;
18255
      }
18256
18257
      _position = state.position;
18258
18259
      while (0 !== ch && !is_WS_OR_EOL(ch)) {
18260
        ch = state.input.charCodeAt(++state.position);
18261
      }
18262
18263
      directiveArgs.push(state.input.slice(_position, state.position));
18264
    }
18265
18266
    if (0 !== ch) {
18267
      readLineBreak(state);
18268
    }
18269
18270
    if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
18271
      directiveHandlers[directiveName](state, directiveName, directiveArgs);
18272
    } else {
18273
      throwWarning(state, 'unknown document directive "' + directiveName + '"');
18274
    }
18275
  }
18276
18277
  skipSeparationSpace(state, true, -1);
18278
18279
  if (0 === state.lineIndent &&
18280
      0x2D/* - */ === state.input.charCodeAt(state.position) &&
18281
      0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&
18282
      0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {
18283
    state.position += 3;
18284
    skipSeparationSpace(state, true, -1);
18285
18286
  } else if (hasDirectives) {
18287
    throwError(state, 'directives end mark is expected');
18288
  }
18289
18290
  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
18291
  skipSeparationSpace(state, true, -1);
18292
18293
  if (state.checkLineBreaks &&
18294
      PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
18295
    throwWarning(state, 'non-ASCII line breaks are interpreted as content');
18296
  }
18297
18298
  state.documents.push(state.result);
18299
18300
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
18301
18302
    if (0x2E/* . */ === state.input.charCodeAt(state.position)) {
18303
      state.position += 3;
18304
      skipSeparationSpace(state, true, -1);
18305
    }
18306
    return;
18307
  }
18308
18309
  if (state.position < (state.length - 1)) {
18310
    throwError(state, 'end of the stream or a document separator is expected');
18311
  } else {
18312
    return;
18313
  }
18314
}
18315
18316
18317
function loadDocuments(input, options) {
18318
  input = String(input);
18319
  options = options || {};
18320
18321
  if (input.length !== 0) {
18322
18323
    // Add tailing `\n` if not exists
18324
    if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
18325
        0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
18326
      input += '\n';
18327
    }
18328
18329
    // Strip BOM
18330
    if (input.charCodeAt(0) === 0xFEFF) {
18331
      input = input.slice(1);
18332
    }
18333
  }
18334
18335
  var state = new State(input, options);
18336
18337
  if (PATTERN_NON_PRINTABLE.test(state.input)) {
18338
    throwError(state, 'the stream contains non-printable characters');
18339
  }
18340
18341
  // Use 0 as string terminator. That significantly simplifies bounds check.
18342
  state.input += '\0';
18343
18344
  while (0x20/* Space */ === state.input.charCodeAt(state.position)) {
18345
    state.lineIndent += 1;
18346
    state.position += 1;
18347
  }
18348
18349
  while (state.position < (state.length - 1)) {
18350
    readDocument(state);
18351
  }
18352
18353
  return state.documents;
18354
}
18355
18356
18357
function loadAll(input, iterator, options) {
18358
  var documents = loadDocuments(input, options), index, length;
18359
18360
  for (index = 0, length = documents.length; index < length; index += 1) {
18361
    iterator(documents[index]);
18362
  }
18363
}
18364
18365
18366
function load(input, options) {
18367
  var documents = loadDocuments(input, options), index, length;
18368
18369
  if (0 === documents.length) {
18370
    /*eslint-disable no-undefined*/
18371
    return undefined;
18372
  } else if (1 === documents.length) {
18373
    return documents[0];
18374
  }
18375
  throw new YAMLException('expected a single document in the stream, but found more');
18376
}
18377
18378
18379
function safeLoadAll(input, output, options) {
18380
  loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
18381
}
18382
18383
18384
function safeLoad(input, options) {
18385
  return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
18386
}
18387
18388
18389
module.exports.loadAll     = loadAll;
18390
module.exports.load        = load;
18391
module.exports.safeLoadAll = safeLoadAll;
18392
module.exports.safeLoad    = safeLoad;
18393
18394
},{"./common":23,"./exception":25,"./mark":27,"./schema/default_full":30,"./schema/default_safe":31}],27:[function(require,module,exports){
18395
'use strict';
18396
18397
18398
var common = require('./common');
18399
18400
18401
function Mark(name, buffer, position, line, column) {
18402
  this.name     = name;
18403
  this.buffer   = buffer;
18404
  this.position = position;
18405
  this.line     = line;
18406
  this.column   = column;
18407
}
18408
18409
18410
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
18411
  var head, start, tail, end, snippet;
18412
18413
  if (!this.buffer) {
18414
    return null;
18415
  }
18416
18417
  indent = indent || 4;
18418
  maxLength = maxLength || 75;
18419
18420
  head = '';
18421
  start = this.position;
18422
18423
  while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
18424
    start -= 1;
18425
    if (this.position - start > (maxLength / 2 - 1)) {
18426
      head = ' ... ';
18427
      start += 5;
18428
      break;
18429
    }
18430
  }
18431
18432
  tail = '';
18433
  end = this.position;
18434
18435
  while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
18436
    end += 1;
18437
    if (end - this.position > (maxLength / 2 - 1)) {
18438
      tail = ' ... ';
18439
      end -= 5;
18440
      break;
18441
    }
18442
  }
18443
18444
  snippet = this.buffer.slice(start, end);
18445
18446
  return common.repeat(' ', indent) + head + snippet + tail + '\n' +
18447
         common.repeat(' ', indent + this.position - start + head.length) + '^';
18448
};
18449
18450
18451
Mark.prototype.toString = function toString(compact) {
18452
  var snippet, where = '';
18453
18454
  if (this.name) {
18455
    where += 'in "' + this.name + '" ';
18456
  }
18457
18458
  where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
18459
18460
  if (!compact) {
18461
    snippet = this.getSnippet();
18462
18463
    if (snippet) {
18464
      where += ':\n' + snippet;
18465
    }
18466
  }
18467
18468
  return where;
18469
};
18470
18471
18472
module.exports = Mark;
18473
18474
},{"./common":23}],28:[function(require,module,exports){
18475
'use strict';
18476
18477
/*eslint-disable max-len*/
18478
18479
var common        = require('./common');
18480
var YAMLException = require('./exception');
18481
var Type          = require('./type');
18482
18483
18484
function compileList(schema, name, result) {
18485
  var exclude = [];
18486
18487
  schema.include.forEach(function (includedSchema) {
18488
    result = compileList(includedSchema, name, result);
18489
  });
18490
18491
  schema[name].forEach(function (currentType) {
18492
    result.forEach(function (previousType, previousIndex) {
18493
      if (previousType.tag === currentType.tag) {
18494
        exclude.push(previousIndex);
18495
      }
18496
    });
18497
18498
    result.push(currentType);
18499
  });
18500
18501
  return result.filter(function (type, index) {
18502
    return -1 === exclude.indexOf(index);
18503
  });
18504
}
18505
18506
18507
function compileMap(/* lists... */) {
18508
  var result = {}, index, length;
18509
18510
  function collectType(type) {
18511
    result[type.tag] = type;
18512
  }
18513
18514
  for (index = 0, length = arguments.length; index < length; index += 1) {
18515
    arguments[index].forEach(collectType);
18516
  }
18517
18518
  return result;
18519
}
18520
18521
18522
function Schema(definition) {
18523
  this.include  = definition.include  || [];
18524
  this.implicit = definition.implicit || [];
18525
  this.explicit = definition.explicit || [];
18526
18527
  this.implicit.forEach(function (type) {
18528
    if (type.loadKind && 'scalar' !== type.loadKind) {
18529
      throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
18530
    }
18531
  });
18532
18533
  this.compiledImplicit = compileList(this, 'implicit', []);
18534
  this.compiledExplicit = compileList(this, 'explicit', []);
18535
  this.compiledTypeMap  = compileMap(this.compiledImplicit, this.compiledExplicit);
18536
}
18537
18538
18539
Schema.DEFAULT = null;
18540
18541
18542
Schema.create = function createSchema() {
18543
  var schemas, types;
18544
18545
  switch (arguments.length) {
18546
  case 1:
18547
    schemas = Schema.DEFAULT;
18548
    types = arguments[0];
18549
    break;
18550
18551
  case 2:
18552
    schemas = arguments[0];
18553
    types = arguments[1];
18554
    break;
18555
18556
  default:
18557
    throw new YAMLException('Wrong number of arguments for Schema.create function');
18558
  }
18559
18560
  schemas = common.toArray(schemas);
18561
  types = common.toArray(types);
18562
18563
  if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
18564
    throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
18565
  }
18566
18567
  if (!types.every(function (type) { return type instanceof Type; })) {
18568
    throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
18569
  }
18570
18571
  return new Schema({
18572
    include: schemas,
18573
    explicit: types
18574
  });
18575
};
18576
18577
18578
module.exports = Schema;
18579
18580
},{"./common":23,"./exception":25,"./type":34}],29:[function(require,module,exports){
18581
// Standard YAML's Core schema.
18582
// http://www.yaml.org/spec/1.2/spec.html#id2804923
18583
//
18584
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
18585
// So, Core schema has no distinctions from JSON schema is JS-YAML.
18586
18587
18588
'use strict';
18589
18590
18591
var Schema = require('../schema');
18592
18593
18594
module.exports = new Schema({
18595
  include: [
18596
    require('./json')
18597
  ]
18598
});
18599
18600
},{"../schema":28,"./json":33}],30:[function(require,module,exports){
18601
// JS-YAML's default schema for `load` function.
18602
// It is not described in the YAML specification.
18603
//
18604
// This schema is based on JS-YAML's default safe schema and includes
18605
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
18606
//
18607
// Also this schema is used as default base schema at `Schema.create` function.
18608
18609
18610
'use strict';
18611
18612
18613
var Schema = require('../schema');
18614
18615
18616
module.exports = Schema.DEFAULT = new Schema({
18617
  include: [
18618
    require('./default_safe')
18619
  ],
18620
  explicit: [
18621
    require('../type/js/undefined'),
18622
    require('../type/js/regexp'),
18623
    require('../type/js/function')
18624
  ]
18625
});
18626
18627
},{"../schema":28,"../type/js/function":39,"../type/js/regexp":40,"../type/js/undefined":41,"./default_safe":31}],31:[function(require,module,exports){
18628
// JS-YAML's default schema for `safeLoad` function.
18629
// It is not described in the YAML specification.
18630
//
18631
// This schema is based on standard YAML's Core schema and includes most of
18632
// extra types described at YAML tag repository. (http://yaml.org/type/)
18633
18634
18635
'use strict';
18636
18637
18638
var Schema = require('../schema');
18639
18640
18641
module.exports = new Schema({
18642
  include: [
18643
    require('./core')
18644
  ],
18645
  implicit: [
18646
    require('../type/timestamp'),
18647
    require('../type/merge')
18648
  ],
18649
  explicit: [
18650
    require('../type/binary'),
18651
    require('../type/omap'),
18652
    require('../type/pairs'),
18653
    require('../type/set')
18654
  ]
18655
});
18656
18657
},{"../schema":28,"../type/binary":35,"../type/merge":43,"../type/omap":45,"../type/pairs":46,"../type/set":48,"../type/timestamp":50,"./core":29}],32:[function(require,module,exports){
18658
// Standard YAML's Failsafe schema.
18659
// http://www.yaml.org/spec/1.2/spec.html#id2802346
18660
18661
18662
'use strict';
18663
18664
18665
var Schema = require('../schema');
18666
18667
18668
module.exports = new Schema({
18669
  explicit: [
18670
    require('../type/str'),
18671
    require('../type/seq'),
18672
    require('../type/map')
18673
  ]
18674
});
18675
18676
},{"../schema":28,"../type/map":42,"../type/seq":47,"../type/str":49}],33:[function(require,module,exports){
18677
// Standard YAML's JSON schema.
18678
// http://www.yaml.org/spec/1.2/spec.html#id2803231
18679
//
18680
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
18681
// So, this schema is not such strict as defined in the YAML specification.
18682
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
18683
18684
18685
'use strict';
18686
18687
18688
var Schema = require('../schema');
18689
18690
18691
module.exports = new Schema({
18692
  include: [
18693
    require('./failsafe')
18694
  ],
18695
  implicit: [
18696
    require('../type/null'),
18697
    require('../type/bool'),
18698
    require('../type/int'),
18699
    require('../type/float')
18700
  ]
18701
});
18702
18703
},{"../schema":28,"../type/bool":36,"../type/float":37,"../type/int":38,"../type/null":44,"./failsafe":32}],34:[function(require,module,exports){
18704
'use strict';
18705
18706
var YAMLException = require('./exception');
18707
18708
var TYPE_CONSTRUCTOR_OPTIONS = [
18709
  'kind',
18710
  'resolve',
18711
  'construct',
18712
  'instanceOf',
18713
  'predicate',
18714
  'represent',
18715
  'defaultStyle',
18716
  'styleAliases'
18717
];
18718
18719
var YAML_NODE_KINDS = [
18720
  'scalar',
18721
  'sequence',
18722
  'mapping'
18723
];
18724
18725
function compileStyleAliases(map) {
18726
  var result = {};
18727
18728
  if (null !== map) {
18729
    Object.keys(map).forEach(function (style) {
18730
      map[style].forEach(function (alias) {
18731
        result[String(alias)] = style;
18732
      });
18733
    });
18734
  }
18735
18736
  return result;
18737
}
18738
18739
function Type(tag, options) {
18740
  options = options || {};
18741
18742
  Object.keys(options).forEach(function (name) {
18743
    if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
18744
      throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
18745
    }
18746
  });
18747
18748
  // TODO: Add tag format check.
18749
  this.tag          = tag;
18750
  this.kind         = options['kind']         || null;
18751
  this.resolve      = options['resolve']      || function () { return true; };
18752
  this.construct    = options['construct']    || function (data) { return data; };
18753
  this.instanceOf   = options['instanceOf']   || null;
18754
  this.predicate    = options['predicate']    || null;
18755
  this.represent    = options['represent']    || null;
18756
  this.defaultStyle = options['defaultStyle'] || null;
18757
  this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
18758
18759
  if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
18760
    throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
18761
  }
18762
}
18763
18764
module.exports = Type;
18765
18766
},{"./exception":25}],35:[function(require,module,exports){
18767
'use strict';
18768
18769
/*eslint-disable no-bitwise*/
18770
18771
// A trick for browserified version.
18772
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
18773
var NodeBuffer = require('buffer').Buffer;
18774
var Type       = require('../type');
18775
18776
18777
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
18778
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
18779
18780
18781
function resolveYamlBinary(data) {
18782
  if (null === data) {
18783
    return false;
18784
  }
18785
18786
  var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP;
18787
18788
  // Convert one by one.
18789
  for (idx = 0; idx < max; idx++) {
18790
    code = map.indexOf(data.charAt(idx));
18791
18792
    // Skip CR/LF
18793
    if (code > 64) { continue; }
18794
18795
    // Fail on illegal characters
18796
    if (code < 0) { return false; }
18797
18798
    bitlen += 6;
18799
  }
18800
18801
  // If there are any bits left, source was corrupted
18802
  return (bitlen % 8) === 0;
18803
}
18804
18805
function constructYamlBinary(data) {
18806
  var code, idx, tailbits,
18807
      input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
18808
      max = input.length,
18809
      map = BASE64_MAP,
18810
      bits = 0,
18811
      result = [];
18812
18813
  // Collect by 6*4 bits (3 bytes)
18814
18815
  for (idx = 0; idx < max; idx++) {
18816
    if ((idx % 4 === 0) && idx) {
18817
      result.push((bits >> 16) & 0xFF);
18818
      result.push((bits >> 8) & 0xFF);
18819
      result.push(bits & 0xFF);
18820
    }
18821
18822
    bits = (bits << 6) | map.indexOf(input.charAt(idx));
18823
  }
18824
18825
  // Dump tail
18826
18827
  tailbits = (max % 4) * 6;
18828
18829
  if (tailbits === 0) {
18830
    result.push((bits >> 16) & 0xFF);
18831
    result.push((bits >> 8) & 0xFF);
18832
    result.push(bits & 0xFF);
18833
  } else if (tailbits === 18) {
18834
    result.push((bits >> 10) & 0xFF);
18835
    result.push((bits >> 2) & 0xFF);
18836
  } else if (tailbits === 12) {
18837
    result.push((bits >> 4) & 0xFF);
18838
  }
18839
18840
  // Wrap into Buffer for NodeJS and leave Array for browser
18841
  if (NodeBuffer) {
18842
    return new NodeBuffer(result);
18843
  }
18844
18845
  return result;
18846
}
18847
18848
function representYamlBinary(object /*, style*/) {
18849
  var result = '', bits = 0, idx, tail,
18850
      max = object.length,
18851
      map = BASE64_MAP;
18852
18853
  // Convert every three bytes to 4 ASCII characters.
18854
18855
  for (idx = 0; idx < max; idx++) {
18856
    if ((idx % 3 === 0) && idx) {
18857
      result += map[(bits >> 18) & 0x3F];
18858
      result += map[(bits >> 12) & 0x3F];
18859
      result += map[(bits >> 6) & 0x3F];
18860
      result += map[bits & 0x3F];
18861
    }
18862
18863
    bits = (bits << 8) + object[idx];
18864
  }
18865
18866
  // Dump tail
18867
18868
  tail = max % 3;
18869
18870
  if (tail === 0) {
18871
    result += map[(bits >> 18) & 0x3F];
18872
    result += map[(bits >> 12) & 0x3F];
18873
    result += map[(bits >> 6) & 0x3F];
18874
    result += map[bits & 0x3F];
18875
  } else if (tail === 2) {
18876
    result += map[(bits >> 10) & 0x3F];
18877
    result += map[(bits >> 4) & 0x3F];
18878
    result += map[(bits << 2) & 0x3F];
18879
    result += map[64];
18880
  } else if (tail === 1) {
18881
    result += map[(bits >> 2) & 0x3F];
18882
    result += map[(bits << 4) & 0x3F];
18883
    result += map[64];
18884
    result += map[64];
18885
  }
18886
18887
  return result;
18888
}
18889
18890
function isBinary(object) {
18891
  return NodeBuffer && NodeBuffer.isBuffer(object);
18892
}
18893
18894
module.exports = new Type('tag:yaml.org,2002:binary', {
18895
  kind: 'scalar',
18896
  resolve: resolveYamlBinary,
18897
  construct: constructYamlBinary,
18898
  predicate: isBinary,
18899
  represent: representYamlBinary
18900
});
18901
18902
},{"../type":34,"buffer":12}],36:[function(require,module,exports){
18903
'use strict';
18904
18905
var Type = require('../type');
18906
18907
function resolveYamlBoolean(data) {
18908
  if (null === data) {
18909
    return false;
18910
  }
18911
18912
  var max = data.length;
18913
18914
  return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
18915
         (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
18916
}
18917
18918
function constructYamlBoolean(data) {
18919
  return data === 'true' ||
18920
         data === 'True' ||
18921
         data === 'TRUE';
18922
}
18923
18924
function isBoolean(object) {
18925
  return '[object Boolean]' === Object.prototype.toString.call(object);
18926
}
18927
18928
module.exports = new Type('tag:yaml.org,2002:bool', {
18929
  kind: 'scalar',
18930
  resolve: resolveYamlBoolean,
18931
  construct: constructYamlBoolean,
18932
  predicate: isBoolean,
18933
  represent: {
18934
    lowercase: function (object) { return object ? 'true' : 'false'; },
18935
    uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
18936
    camelcase: function (object) { return object ? 'True' : 'False'; }
18937
  },
18938
  defaultStyle: 'lowercase'
18939
});
18940
18941
},{"../type":34}],37:[function(require,module,exports){
18942
'use strict';
18943
18944
var common = require('../common');
18945
var Type   = require('../type');
18946
18947
var YAML_FLOAT_PATTERN = new RegExp(
18948
  '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
18949
  '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
18950
  '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
18951
  '|[-+]?\\.(?:inf|Inf|INF)' +
18952
  '|\\.(?:nan|NaN|NAN))$');
18953
18954
function resolveYamlFloat(data) {
18955
  if (null === data) {
18956
    return false;
18957
  }
18958
18959
  var value, sign, base, digits;
18960
18961
  if (!YAML_FLOAT_PATTERN.test(data)) {
18962
    return false;
18963
  }
18964
  return true;
18965
}
18966
18967
function constructYamlFloat(data) {
18968
  var value, sign, base, digits;
18969
18970
  value  = data.replace(/_/g, '').toLowerCase();
18971
  sign   = '-' === value[0] ? -1 : 1;
18972
  digits = [];
18973
18974
  if (0 <= '+-'.indexOf(value[0])) {
18975
    value = value.slice(1);
18976
  }
18977
18978
  if ('.inf' === value) {
18979
    return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
18980
18981
  } else if ('.nan' === value) {
18982
    return NaN;
18983
18984
  } else if (0 <= value.indexOf(':')) {
18985
    value.split(':').forEach(function (v) {
18986
      digits.unshift(parseFloat(v, 10));
18987
    });
18988
18989
    value = 0.0;
18990
    base = 1;
18991
18992
    digits.forEach(function (d) {
18993
      value += d * base;
18994
      base *= 60;
18995
    });
18996
18997
    return sign * value;
18998
18999
  }
19000
  return sign * parseFloat(value, 10);
19001
}
19002
19003
function representYamlFloat(object, style) {
19004
  if (isNaN(object)) {
19005
    switch (style) {
19006
    case 'lowercase':
19007
      return '.nan';
19008
    case 'uppercase':
19009
      return '.NAN';
19010
    case 'camelcase':
19011
      return '.NaN';
19012
    }
19013
  } else if (Number.POSITIVE_INFINITY === object) {
19014
    switch (style) {
19015
    case 'lowercase':
19016
      return '.inf';
19017
    case 'uppercase':
19018
      return '.INF';
19019
    case 'camelcase':
19020
      return '.Inf';
19021
    }
19022
  } else if (Number.NEGATIVE_INFINITY === object) {
19023
    switch (style) {
19024
    case 'lowercase':
19025
      return '-.inf';
19026
    case 'uppercase':
19027
      return '-.INF';
19028
    case 'camelcase':
19029
      return '-.Inf';
19030
    }
19031
  } else if (common.isNegativeZero(object)) {
19032
    return '-0.0';
19033
  }
19034
  return object.toString(10);
19035
}
19036
19037
function isFloat(object) {
19038
  return ('[object Number]' === Object.prototype.toString.call(object)) &&
19039
         (0 !== object % 1 || common.isNegativeZero(object));
19040
}
19041
19042
module.exports = new Type('tag:yaml.org,2002:float', {
19043
  kind: 'scalar',
19044
  resolve: resolveYamlFloat,
19045
  construct: constructYamlFloat,
19046
  predicate: isFloat,
19047
  represent: representYamlFloat,
19048
  defaultStyle: 'lowercase'
19049
});
19050
19051
},{"../common":23,"../type":34}],38:[function(require,module,exports){
19052
'use strict';
19053
19054
var common = require('../common');
19055
var Type   = require('../type');
19056
19057
function isHexCode(c) {
19058
  return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
19059
         ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
19060
         ((0x61/* a */ <= c) && (c <= 0x66/* f */));
19061
}
19062
19063
function isOctCode(c) {
19064
  return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
19065
}
19066
19067
function isDecCode(c) {
19068
  return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
19069
}
19070
19071
function resolveYamlInteger(data) {
19072
  if (null === data) {
19073
    return false;
19074
  }
19075
19076
  var max = data.length,
19077
      index = 0,
19078
      hasDigits = false,
19079
      ch;
19080
19081
  if (!max) { return false; }
19082
19083
  ch = data[index];
19084
19085
  // sign
19086
  if (ch === '-' || ch === '+') {
19087
    ch = data[++index];
19088
  }
19089
19090
  if (ch === '0') {
19091
    // 0
19092
    if (index + 1 === max) { return true; }
19093
    ch = data[++index];
19094
19095
    // base 2, base 8, base 16
19096
19097
    if (ch === 'b') {
19098
      // base 2
19099
      index++;
19100
19101
      for (; index < max; index++) {
19102
        ch = data[index];
19103
        if (ch === '_') { continue; }
19104
        if (ch !== '0' && ch !== '1') {
19105
          return false;
19106
        }
19107
        hasDigits = true;
19108
      }
19109
      return hasDigits;
19110
    }
19111
19112
19113
    if (ch === 'x') {
19114
      // base 16
19115
      index++;
19116
19117
      for (; index < max; index++) {
19118
        ch = data[index];
19119
        if (ch === '_') { continue; }
19120
        if (!isHexCode(data.charCodeAt(index))) {
19121
          return false;
19122
        }
19123
        hasDigits = true;
19124
      }
19125
      return hasDigits;
19126
    }
19127
19128
    // base 8
19129
    for (; index < max; index++) {
19130
      ch = data[index];
19131
      if (ch === '_') { continue; }
19132
      if (!isOctCode(data.charCodeAt(index))) {
19133
        return false;
19134
      }
19135
      hasDigits = true;
19136
    }
19137
    return hasDigits;
19138
  }
19139
19140
  // base 10 (except 0) or base 60
19141
19142
  for (; index < max; index++) {
19143
    ch = data[index];
19144
    if (ch === '_') { continue; }
19145
    if (ch === ':') { break; }
19146
    if (!isDecCode(data.charCodeAt(index))) {
19147
      return false;
19148
    }
19149
    hasDigits = true;
19150
  }
19151
19152
  if (!hasDigits) { return false; }
19153
19154
  // if !base60 - done;
19155
  if (ch !== ':') { return true; }
19156
19157
  // base60 almost not used, no needs to optimize
19158
  return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
19159
}
19160
19161
function constructYamlInteger(data) {
19162
  var value = data, sign = 1, ch, base, digits = [];
19163
19164
  if (value.indexOf('_') !== -1) {
19165
    value = value.replace(/_/g, '');
19166
  }
19167
19168
  ch = value[0];
19169
19170
  if (ch === '-' || ch === '+') {
19171
    if (ch === '-') { sign = -1; }
19172
    value = value.slice(1);
19173
    ch = value[0];
19174
  }
19175
19176
  if ('0' === value) {
19177
    return 0;
19178
  }
19179
19180
  if (ch === '0') {
19181
    if (value[1] === 'b') {
19182
      return sign * parseInt(value.slice(2), 2);
19183
    }
19184
    if (value[1] === 'x') {
19185
      return sign * parseInt(value, 16);
19186
    }
19187
    return sign * parseInt(value, 8);
19188
19189
  }
19190
19191
  if (value.indexOf(':') !== -1) {
19192
    value.split(':').forEach(function (v) {
19193
      digits.unshift(parseInt(v, 10));
19194
    });
19195
19196
    value = 0;
19197
    base = 1;
19198
19199
    digits.forEach(function (d) {
19200
      value += (d * base);
19201
      base *= 60;
19202
    });
19203
19204
    return sign * value;
19205
19206
  }
19207
19208
  return sign * parseInt(value, 10);
19209
}
19210
19211
function isInteger(object) {
19212
  return ('[object Number]' === Object.prototype.toString.call(object)) &&
19213
         (0 === object % 1 && !common.isNegativeZero(object));
19214
}
19215
19216
module.exports = new Type('tag:yaml.org,2002:int', {
19217
  kind: 'scalar',
19218
  resolve: resolveYamlInteger,
19219
  construct: constructYamlInteger,
19220
  predicate: isInteger,
19221
  represent: {
19222
    binary:      function (object) { return '0b' + object.toString(2); },
19223
    octal:       function (object) { return '0'  + object.toString(8); },
19224
    decimal:     function (object) { return        object.toString(10); },
19225
    hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
19226
  },
19227
  defaultStyle: 'decimal',
19228
  styleAliases: {
19229
    binary:      [ 2,  'bin' ],
19230
    octal:       [ 8,  'oct' ],
19231
    decimal:     [ 10, 'dec' ],
19232
    hexadecimal: [ 16, 'hex' ]
19233
  }
19234
});
19235
19236
},{"../common":23,"../type":34}],39:[function(require,module,exports){
19237
'use strict';
19238
19239
var esprima;
19240
19241
// Browserified version does not have esprima
19242
//
19243
// 1. For node.js just require module as deps
19244
// 2. For browser try to require mudule via external AMD system.
19245
//    If not found - try to fallback to window.esprima. If not
19246
//    found too - then fail to parse.
19247
//
19248
try {
19249
  esprima = require('esprima');
19250
} catch (_) {
19251
  /*global window */
19252
  if (typeof window !== 'undefined') { esprima = window.esprima; }
19253
}
19254
19255
var Type = require('../../type');
19256
19257
function resolveJavascriptFunction(data) {
19258
  if (null === data) {
19259
    return false;
19260
  }
19261
19262
  try {
19263
    var source = '(' + data + ')',
19264
        ast    = esprima.parse(source, { range: true }),
19265
        params = [],
19266
        body;
19267
19268
    if ('Program'             !== ast.type         ||
19269
        1                     !== ast.body.length  ||
19270
        'ExpressionStatement' !== ast.body[0].type ||
19271
        'FunctionExpression'  !== ast.body[0].expression.type) {
19272
      return false;
19273
    }
19274
19275
    return true;
19276
  } catch (err) {
19277
    return false;
19278
  }
19279
}
19280
19281
function constructJavascriptFunction(data) {
19282
  /*jslint evil:true*/
19283
19284
  var source = '(' + data + ')',
19285
      ast    = esprima.parse(source, { range: true }),
19286
      params = [],
19287
      body;
19288
19289
  if ('Program'             !== ast.type         ||
19290
      1                     !== ast.body.length  ||
19291
      'ExpressionStatement' !== ast.body[0].type ||
19292
      'FunctionExpression'  !== ast.body[0].expression.type) {
19293
    throw new Error('Failed to resolve function');
19294
  }
19295
19296
  ast.body[0].expression.params.forEach(function (param) {
19297
    params.push(param.name);
19298
  });
19299
19300
  body = ast.body[0].expression.body.range;
19301
19302
  // Esprima's ranges include the first '{' and the last '}' characters on
19303
  // function expressions. So cut them out.
19304
  /*eslint-disable no-new-func*/
19305
  return new Function(params, source.slice(body[0] + 1, body[1] - 1));
19306
}
19307
19308
function representJavascriptFunction(object /*, style*/) {
19309
  return object.toString();
19310
}
19311
19312
function isFunction(object) {
19313
  return '[object Function]' === Object.prototype.toString.call(object);
19314
}
19315
19316
module.exports = new Type('tag:yaml.org,2002:js/function', {
19317
  kind: 'scalar',
19318
  resolve: resolveJavascriptFunction,
19319
  construct: constructJavascriptFunction,
19320
  predicate: isFunction,
19321
  represent: representJavascriptFunction
19322
});
19323
19324
},{"../../type":34,"esprima":51}],40:[function(require,module,exports){
19325
'use strict';
19326
19327
var Type = require('../../type');
19328
19329
function resolveJavascriptRegExp(data) {
19330
  if (null === data) {
19331
    return false;
19332
  }
19333
19334
  if (0 === data.length) {
19335
    return false;
19336
  }
19337
19338
  var regexp = data,
19339
      tail   = /\/([gim]*)$/.exec(data),
19340
      modifiers = '';
19341
19342
  // if regexp starts with '/' it can have modifiers and must be properly closed
19343
  // `/foo/gim` - modifiers tail can be maximum 3 chars
19344
  if ('/' === regexp[0]) {
19345
    if (tail) {
19346
      modifiers = tail[1];
19347
    }
19348
19349
    if (modifiers.length > 3) { return false; }
19350
    // if expression starts with /, is should be properly terminated
19351
    if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
19352
19353
    regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
19354
  }
19355
19356
  try {
19357
    var dummy = new RegExp(regexp, modifiers);
19358
    return true;
19359
  } catch (error) {
19360
    return false;
19361
  }
19362
}
19363
19364
function constructJavascriptRegExp(data) {
19365
  var regexp = data,
19366
      tail   = /\/([gim]*)$/.exec(data),
19367
      modifiers = '';
19368
19369
  // `/foo/gim` - tail can be maximum 4 chars
19370
  if ('/' === regexp[0]) {
19371
    if (tail) {
19372
      modifiers = tail[1];
19373
    }
19374
    regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
19375
  }
19376
19377
  return new RegExp(regexp, modifiers);
19378
}
19379
19380
function representJavascriptRegExp(object /*, style*/) {
19381
  var result = '/' + object.source + '/';
19382
19383
  if (object.global) {
19384
    result += 'g';
19385
  }
19386
19387
  if (object.multiline) {
19388
    result += 'm';
19389
  }
19390
19391
  if (object.ignoreCase) {
19392
    result += 'i';
19393
  }
19394
19395
  return result;
19396
}
19397
19398
function isRegExp(object) {
19399
  return '[object RegExp]' === Object.prototype.toString.call(object);
19400
}
19401
19402
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
19403
  kind: 'scalar',
19404
  resolve: resolveJavascriptRegExp,
19405
  construct: constructJavascriptRegExp,
19406
  predicate: isRegExp,
19407
  represent: representJavascriptRegExp
19408
});
19409
19410
},{"../../type":34}],41:[function(require,module,exports){
19411
'use strict';
19412
19413
var Type = require('../../type');
19414
19415
function resolveJavascriptUndefined() {
19416
  return true;
19417
}
19418
19419
function constructJavascriptUndefined() {
19420
  /*eslint-disable no-undefined*/
19421
  return undefined;
19422
}
19423
19424
function representJavascriptUndefined() {
19425
  return '';
19426
}
19427
19428
function isUndefined(object) {
19429
  return 'undefined' === typeof object;
19430
}
19431
19432
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
19433
  kind: 'scalar',
19434
  resolve: resolveJavascriptUndefined,
19435
  construct: constructJavascriptUndefined,
19436
  predicate: isUndefined,
19437
  represent: representJavascriptUndefined
19438
});
19439
19440
},{"../../type":34}],42:[function(require,module,exports){
19441
'use strict';
19442
19443
var Type = require('../type');
19444
19445
module.exports = new Type('tag:yaml.org,2002:map', {
19446
  kind: 'mapping',
19447
  construct: function (data) { return null !== data ? data : {}; }
19448
});
19449
19450
},{"../type":34}],43:[function(require,module,exports){
19451
'use strict';
19452
19453
var Type = require('../type');
19454
19455
function resolveYamlMerge(data) {
19456
  return '<<' === data || null === data;
19457
}
19458
19459
module.exports = new Type('tag:yaml.org,2002:merge', {
19460
  kind: 'scalar',
19461
  resolve: resolveYamlMerge
19462
});
19463
19464
},{"../type":34}],44:[function(require,module,exports){
19465
'use strict';
19466
19467
var Type = require('../type');
19468
19469
function resolveYamlNull(data) {
19470
  if (null === data) {
19471
    return true;
19472
  }
19473
19474
  var max = data.length;
19475
19476
  return (max === 1 && data === '~') ||
19477
         (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
19478
}
19479
19480
function constructYamlNull() {
19481
  return null;
19482
}
19483
19484
function isNull(object) {
19485
  return null === object;
19486
}
19487
19488
module.exports = new Type('tag:yaml.org,2002:null', {
19489
  kind: 'scalar',
19490
  resolve: resolveYamlNull,
19491
  construct: constructYamlNull,
19492
  predicate: isNull,
19493
  represent: {
19494
    canonical: function () { return '~';    },
19495
    lowercase: function () { return 'null'; },
19496
    uppercase: function () { return 'NULL'; },
19497
    camelcase: function () { return 'Null'; }
19498
  },
19499
  defaultStyle: 'lowercase'
19500
});
19501
19502
},{"../type":34}],45:[function(require,module,exports){
19503
'use strict';
19504
19505
var Type = require('../type');
19506
19507
var _hasOwnProperty = Object.prototype.hasOwnProperty;
19508
var _toString       = Object.prototype.toString;
19509
19510
function resolveYamlOmap(data) {
19511
  if (null === data) {
19512
    return true;
19513
  }
19514
19515
  var objectKeys = [], index, length, pair, pairKey, pairHasKey,
19516
      object = data;
19517
19518
  for (index = 0, length = object.length; index < length; index += 1) {
19519
    pair = object[index];
19520
    pairHasKey = false;
19521
19522
    if ('[object Object]' !== _toString.call(pair)) {
19523
      return false;
19524
    }
19525
19526
    for (pairKey in pair) {
19527
      if (_hasOwnProperty.call(pair, pairKey)) {
19528
        if (!pairHasKey) {
19529
          pairHasKey = true;
19530
        } else {
19531
          return false;
19532
        }
19533
      }
19534
    }
19535
19536
    if (!pairHasKey) {
19537
      return false;
19538
    }
19539
19540
    if (-1 === objectKeys.indexOf(pairKey)) {
19541
      objectKeys.push(pairKey);
19542
    } else {
19543
      return false;
19544
    }
19545
  }
19546
19547
  return true;
19548
}
19549
19550
function constructYamlOmap(data) {
19551
  return null !== data ? data : [];
19552
}
19553
19554
module.exports = new Type('tag:yaml.org,2002:omap', {
19555
  kind: 'sequence',
19556
  resolve: resolveYamlOmap,
19557
  construct: constructYamlOmap
19558
});
19559
19560
},{"../type":34}],46:[function(require,module,exports){
19561
'use strict';
19562
19563
var Type = require('../type');
19564
19565
var _toString = Object.prototype.toString;
19566
19567
function resolveYamlPairs(data) {
19568
  if (null === data) {
19569
    return true;
19570
  }
19571
19572
  var index, length, pair, keys, result,
19573
      object = data;
19574
19575
  result = new Array(object.length);
19576
19577
  for (index = 0, length = object.length; index < length; index += 1) {
19578
    pair = object[index];
19579
19580
    if ('[object Object]' !== _toString.call(pair)) {
19581
      return false;
19582
    }
19583
19584
    keys = Object.keys(pair);
19585
19586
    if (1 !== keys.length) {
19587
      return false;
19588
    }
19589
19590
    result[index] = [ keys[0], pair[keys[0]] ];
19591
  }
19592
19593
  return true;
19594
}
19595
19596
function constructYamlPairs(data) {
19597
  if (null === data) {
19598
    return [];
19599
  }
19600
19601
  var index, length, pair, keys, result,
19602
      object = data;
19603
19604
  result = new Array(object.length);
19605
19606
  for (index = 0, length = object.length; index < length; index += 1) {
19607
    pair = object[index];
19608
19609
    keys = Object.keys(pair);
19610
19611
    result[index] = [ keys[0], pair[keys[0]] ];
19612
  }
19613
19614
  return result;
19615
}
19616
19617
module.exports = new Type('tag:yaml.org,2002:pairs', {
19618
  kind: 'sequence',
19619
  resolve: resolveYamlPairs,
19620
  construct: constructYamlPairs
19621
});
19622
19623
},{"../type":34}],47:[function(require,module,exports){
19624
'use strict';
19625
19626
var Type = require('../type');
19627
19628
module.exports = new Type('tag:yaml.org,2002:seq', {
19629
  kind: 'sequence',
19630
  construct: function (data) { return null !== data ? data : []; }
19631
});
19632
19633
},{"../type":34}],48:[function(require,module,exports){
19634
'use strict';
19635
19636
var Type = require('../type');
19637
19638
var _hasOwnProperty = Object.prototype.hasOwnProperty;
19639
19640
function resolveYamlSet(data) {
19641
  if (null === data) {
19642
    return true;
19643
  }
19644
19645
  var key, object = data;
19646
19647
  for (key in object) {
19648
    if (_hasOwnProperty.call(object, key)) {
19649
      if (null !== object[key]) {
19650
        return false;
19651
      }
19652
    }
19653
  }
19654
19655
  return true;
19656
}
19657
19658
function constructYamlSet(data) {
19659
  return null !== data ? data : {};
19660
}
19661
19662
module.exports = new Type('tag:yaml.org,2002:set', {
19663
  kind: 'mapping',
19664
  resolve: resolveYamlSet,
19665
  construct: constructYamlSet
19666
});
19667
19668
},{"../type":34}],49:[function(require,module,exports){
19669
'use strict';
19670
19671
var Type = require('../type');
19672
19673
module.exports = new Type('tag:yaml.org,2002:str', {
19674
  kind: 'scalar',
19675
  construct: function (data) { return null !== data ? data : ''; }
19676
});
19677
19678
},{"../type":34}],50:[function(require,module,exports){
19679
'use strict';
19680
19681
var Type = require('../type');
19682
19683
var YAML_TIMESTAMP_REGEXP = new RegExp(
19684
  '^([0-9][0-9][0-9][0-9])'          + // [1] year
19685
  '-([0-9][0-9]?)'                   + // [2] month
19686
  '-([0-9][0-9]?)'                   + // [3] day
19687
  '(?:(?:[Tt]|[ \\t]+)'              + // ...
19688
  '([0-9][0-9]?)'                    + // [4] hour
19689
  ':([0-9][0-9])'                    + // [5] minute
19690
  ':([0-9][0-9])'                    + // [6] second
19691
  '(?:\\.([0-9]*))?'                 + // [7] fraction
19692
  '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
19693
  '(?::([0-9][0-9]))?))?)?$');         // [11] tz_minute
19694
19695
function resolveYamlTimestamp(data) {
19696
  if (null === data) {
19697
    return false;
19698
  }
19699
19700
  var match, year, month, day, hour, minute, second, fraction = 0,
19701
      delta = null, tz_hour, tz_minute, date;
19702
19703
  match = YAML_TIMESTAMP_REGEXP.exec(data);
19704
19705
  if (null === match) {
19706
    return false;
19707
  }
19708
19709
  return true;
19710
}
19711
19712
function constructYamlTimestamp(data) {
19713
  var match, year, month, day, hour, minute, second, fraction = 0,
19714
      delta = null, tz_hour, tz_minute, date;
19715
19716
  match = YAML_TIMESTAMP_REGEXP.exec(data);
19717
19718
  if (null === match) {
19719
    throw new Error('Date resolve error');
19720
  }
19721
19722
  // match: [1] year [2] month [3] day
19723
19724
  year = +(match[1]);
19725
  month = +(match[2]) - 1; // JS month starts with 0
19726
  day = +(match[3]);
19727
19728
  if (!match[4]) { // no hour
19729
    return new Date(Date.UTC(year, month, day));
19730
  }
19731
19732
  // match: [4] hour [5] minute [6] second [7] fraction
19733
19734
  hour = +(match[4]);
19735
  minute = +(match[5]);
19736
  second = +(match[6]);
19737
19738
  if (match[7]) {
19739
    fraction = match[7].slice(0, 3);
19740
    while (fraction.length < 3) { // milli-seconds
19741
      fraction += '0';
19742
    }
19743
    fraction = +fraction;
19744
  }
19745
19746
  // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
19747
19748
  if (match[9]) {
19749
    tz_hour = +(match[10]);
19750
    tz_minute = +(match[11] || 0);
19751
    delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
19752
    if ('-' === match[9]) {
19753
      delta = -delta;
19754
    }
19755
  }
19756
19757
  date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
19758
19759
  if (delta) {
19760
    date.setTime(date.getTime() - delta);
19761
  }
19762
19763
  return date;
19764
}
19765
19766
function representYamlTimestamp(object /*, style*/) {
19767
  return object.toISOString();
19768
}
19769
19770
module.exports = new Type('tag:yaml.org,2002:timestamp', {
19771
  kind: 'scalar',
19772
  resolve: resolveYamlTimestamp,
19773
  construct: constructYamlTimestamp,
19774
  instanceOf: Date,
19775
  represent: representYamlTimestamp
19776
});
19777
19778
},{"../type":34}],51:[function(require,module,exports){
19779
/*
19780
  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
19781
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
19782
  Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
19783
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
19784
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
19785
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
19786
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
19787
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
19788
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
19789
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
19790
19791
  Redistribution and use in source and binary forms, with or without
19792
  modification, are permitted provided that the following conditions are met:
19793
19794
    * Redistributions of source code must retain the above copyright
19795
      notice, this list of conditions and the following disclaimer.
19796
    * Redistributions in binary form must reproduce the above copyright
19797
      notice, this list of conditions and the following disclaimer in the
19798
      documentation and/or other materials provided with the distribution.
19799
19800
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19801
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19802
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19803
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19804
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19805
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19806
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19807
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19808
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19809
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19810
*/
19811
19812
(function (root, factory) {
19813
    'use strict';
19814
19815
    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
19816
    // Rhino, and plain browser loading.
19817
19818
    /* istanbul ignore next */
19819
    if (typeof define === 'function' && define.amd) {
19820
        define(['exports'], factory);
19821
    } else if (typeof exports !== 'undefined') {
19822
        factory(exports);
19823
    } else {
19824
        factory((root.esprima = {}));
19825
    }
19826
}(this, function (exports) {
19827
    'use strict';
19828
19829
    var Token,
19830
        TokenName,
19831
        FnExprTokens,
19832
        Syntax,
19833
        PlaceHolders,
19834
        Messages,
19835
        Regex,
19836
        source,
19837
        strict,
19838
        sourceType,
19839
        index,
19840
        lineNumber,
19841
        lineStart,
19842
        hasLineTerminator,
19843
        lastIndex,
19844
        lastLineNumber,
19845
        lastLineStart,
19846
        startIndex,
19847
        startLineNumber,
19848
        startLineStart,
19849
        scanning,
19850
        length,
19851
        lookahead,
19852
        state,
19853
        extra,
19854
        isBindingElement,
19855
        isAssignmentTarget,
19856
        firstCoverInitializedNameError;
19857
19858
    Token = {
19859
        BooleanLiteral: 1,
19860
        EOF: 2,
19861
        Identifier: 3,
19862
        Keyword: 4,
19863
        NullLiteral: 5,
19864
        NumericLiteral: 6,
19865
        Punctuator: 7,
19866
        StringLiteral: 8,
19867
        RegularExpression: 9,
19868
        Template: 10
19869
    };
19870
19871
    TokenName = {};
19872
    TokenName[Token.BooleanLiteral] = 'Boolean';
19873
    TokenName[Token.EOF] = '<end>';
19874
    TokenName[Token.Identifier] = 'Identifier';
19875
    TokenName[Token.Keyword] = 'Keyword';
19876
    TokenName[Token.NullLiteral] = 'Null';
19877
    TokenName[Token.NumericLiteral] = 'Numeric';
19878
    TokenName[Token.Punctuator] = 'Punctuator';
19879
    TokenName[Token.StringLiteral] = 'String';
19880
    TokenName[Token.RegularExpression] = 'RegularExpression';
19881
    TokenName[Token.Template] = 'Template';
19882
19883
    // A function following one of those tokens is an expression.
19884
    FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
19885
                    'return', 'case', 'delete', 'throw', 'void',
19886
                    // assignment operators
19887
                    '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
19888
                    '&=', '|=', '^=', ',',
19889
                    // binary/unary operators
19890
                    '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
19891
                    '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
19892
                    '<=', '<', '>', '!=', '!=='];
19893
19894
    Syntax = {
19895
        AssignmentExpression: 'AssignmentExpression',
19896
        AssignmentPattern: 'AssignmentPattern',
19897
        ArrayExpression: 'ArrayExpression',
19898
        ArrayPattern: 'ArrayPattern',
19899
        ArrowFunctionExpression: 'ArrowFunctionExpression',
19900
        BlockStatement: 'BlockStatement',
19901
        BinaryExpression: 'BinaryExpression',
19902
        BreakStatement: 'BreakStatement',
19903
        CallExpression: 'CallExpression',
19904
        CatchClause: 'CatchClause',
19905
        ClassBody: 'ClassBody',
19906
        ClassDeclaration: 'ClassDeclaration',
19907
        ClassExpression: 'ClassExpression',
19908
        ConditionalExpression: 'ConditionalExpression',
19909
        ContinueStatement: 'ContinueStatement',
19910
        DoWhileStatement: 'DoWhileStatement',
19911
        DebuggerStatement: 'DebuggerStatement',
19912
        EmptyStatement: 'EmptyStatement',
19913
        ExportAllDeclaration: 'ExportAllDeclaration',
19914
        ExportDefaultDeclaration: 'ExportDefaultDeclaration',
19915
        ExportNamedDeclaration: 'ExportNamedDeclaration',
19916
        ExportSpecifier: 'ExportSpecifier',
19917
        ExpressionStatement: 'ExpressionStatement',
19918
        ForStatement: 'ForStatement',
19919
        ForInStatement: 'ForInStatement',
19920
        FunctionDeclaration: 'FunctionDeclaration',
19921
        FunctionExpression: 'FunctionExpression',
19922
        Identifier: 'Identifier',
19923
        IfStatement: 'IfStatement',
19924
        ImportDeclaration: 'ImportDeclaration',
19925
        ImportDefaultSpecifier: 'ImportDefaultSpecifier',
19926
        ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
19927
        ImportSpecifier: 'ImportSpecifier',
19928
        Literal: 'Literal',
19929
        LabeledStatement: 'LabeledStatement',
19930
        LogicalExpression: 'LogicalExpression',
19931
        MemberExpression: 'MemberExpression',
19932
        MethodDefinition: 'MethodDefinition',
19933
        NewExpression: 'NewExpression',
19934
        ObjectExpression: 'ObjectExpression',
19935
        ObjectPattern: 'ObjectPattern',
19936
        Program: 'Program',
19937
        Property: 'Property',
19938
        RestElement: 'RestElement',
19939
        ReturnStatement: 'ReturnStatement',
19940
        SequenceExpression: 'SequenceExpression',
19941
        SpreadElement: 'SpreadElement',
19942
        Super: 'Super',
19943
        SwitchCase: 'SwitchCase',
19944
        SwitchStatement: 'SwitchStatement',
19945
        TaggedTemplateExpression: 'TaggedTemplateExpression',
19946
        TemplateElement: 'TemplateElement',
19947
        TemplateLiteral: 'TemplateLiteral',
19948
        ThisExpression: 'ThisExpression',
19949
        ThrowStatement: 'ThrowStatement',
19950
        TryStatement: 'TryStatement',
19951
        UnaryExpression: 'UnaryExpression',
19952
        UpdateExpression: 'UpdateExpression',
19953
        VariableDeclaration: 'VariableDeclaration',
19954
        VariableDeclarator: 'VariableDeclarator',
19955
        WhileStatement: 'WhileStatement',
19956
        WithStatement: 'WithStatement'
19957
    };
19958
19959
    PlaceHolders = {
19960
        ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder'
19961
    };
19962
19963
    // Error messages should be identical to V8.
19964
    Messages = {
19965
        UnexpectedToken: 'Unexpected token %0',
19966
        UnexpectedNumber: 'Unexpected number',
19967
        UnexpectedString: 'Unexpected string',
19968
        UnexpectedIdentifier: 'Unexpected identifier',
19969
        UnexpectedReserved: 'Unexpected reserved word',
19970
        UnexpectedTemplate: 'Unexpected quasi %0',
19971
        UnexpectedEOS: 'Unexpected end of input',
19972
        NewlineAfterThrow: 'Illegal newline after throw',
19973
        InvalidRegExp: 'Invalid regular expression',
19974
        UnterminatedRegExp: 'Invalid regular expression: missing /',
19975
        InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
19976
        InvalidLHSInForIn: 'Invalid left-hand side in for-in',
19977
        MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
19978
        NoCatchOrFinally: 'Missing catch or finally after try',
19979
        UnknownLabel: 'Undefined label \'%0\'',
19980
        Redeclaration: '%0 \'%1\' has already been declared',
19981
        IllegalContinue: 'Illegal continue statement',
19982
        IllegalBreak: 'Illegal break statement',
19983
        IllegalReturn: 'Illegal return statement',
19984
        StrictModeWith: 'Strict mode code may not include a with statement',
19985
        StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
19986
        StrictVarName: 'Variable name may not be eval or arguments in strict mode',
19987
        StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
19988
        StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
19989
        StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
19990
        StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
19991
        StrictDelete: 'Delete of an unqualified identifier in strict mode.',
19992
        StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
19993
        StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
19994
        StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
19995
        StrictReservedWord: 'Use of future reserved word in strict mode',
19996
        TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
19997
        ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
19998
        DefaultRestParameter: 'Unexpected token =',
19999
        ObjectPatternAsRestParameter: 'Unexpected token {',
20000
        DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
20001
        ConstructorSpecialMethod: 'Class constructor may not be an accessor',
20002
        DuplicateConstructor: 'A class may only have one constructor',
20003
        StaticPrototype: 'Classes may not have static property named prototype',
20004
        MissingFromClause: 'Unexpected token',
20005
        NoAsAfterImportNamespace: 'Unexpected token',
20006
        InvalidModuleSpecifier: 'Unexpected token',
20007
        IllegalImportDeclaration: 'Unexpected token',
20008
        IllegalExportDeclaration: 'Unexpected token'
20009
    };
20010
20011
    // See also tools/generate-unicode-regex.py.
20012
    Regex = {
20013
        NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'),
20014
        NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u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u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]')
20015
    };
20016
20017
    // Ensure the condition is true, otherwise throw an error.
20018
    // This is only to have a better contract semantic, i.e. another safety net
20019
    // to catch a logic error. The condition shall be fulfilled in normal case.
20020
    // Do NOT use this to enforce a certain condition on any user input.
20021
20022
    function assert(condition, message) {
20023
        /* istanbul ignore if */
20024
        if (!condition) {
20025
            throw new Error('ASSERT: ' + message);
20026
        }
20027
    }
20028
20029
    function isDecimalDigit(ch) {
20030
        return (ch >= 0x30 && ch <= 0x39);   // 0..9
20031
    }
20032
20033
    function isHexDigit(ch) {
20034
        return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
20035
    }
20036
20037
    function isOctalDigit(ch) {
20038
        return '01234567'.indexOf(ch) >= 0;
20039
    }
20040
20041
    function octalToDecimal(ch) {
20042
        // \0 is not octal escape sequence
20043
        var octal = (ch !== '0'), code = '01234567'.indexOf(ch);
20044
20045
        if (index < length && isOctalDigit(source[index])) {
20046
            octal = true;
20047
            code = code * 8 + '01234567'.indexOf(source[index++]);
20048
20049
            // 3 digits are only allowed when string starts
20050
            // with 0, 1, 2, 3
20051
            if ('0123'.indexOf(ch) >= 0 &&
20052
                    index < length &&
20053
                    isOctalDigit(source[index])) {
20054
                code = code * 8 + '01234567'.indexOf(source[index++]);
20055
            }
20056
        }
20057
20058
        return {
20059
            code: code,
20060
            octal: octal
20061
        };
20062
    }
20063
20064
    // 7.2 White Space
20065
20066
    function isWhiteSpace(ch) {
20067
        return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||
20068
            (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);
20069
    }
20070
20071
    // 7.3 Line Terminators
20072
20073
    function isLineTerminator(ch) {
20074
        return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);
20075
    }
20076
20077
    // 7.6 Identifier Names and Identifiers
20078
20079
    function isIdentifierStart(ch) {
20080
        return (ch === 0x24) || (ch === 0x5F) ||  // $ (dollar) and _ (underscore)
20081
            (ch >= 0x41 && ch <= 0x5A) ||         // A..Z
20082
            (ch >= 0x61 && ch <= 0x7A) ||         // a..z
20083
            (ch === 0x5C) ||                      // \ (backslash)
20084
            ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
20085
    }
20086
20087
    function isIdentifierPart(ch) {
20088
        return (ch === 0x24) || (ch === 0x5F) ||  // $ (dollar) and _ (underscore)
20089
            (ch >= 0x41 && ch <= 0x5A) ||         // A..Z
20090
            (ch >= 0x61 && ch <= 0x7A) ||         // a..z
20091
            (ch >= 0x30 && ch <= 0x39) ||         // 0..9
20092
            (ch === 0x5C) ||                      // \ (backslash)
20093
            ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
20094
    }
20095
20096
    // 7.6.1.2 Future Reserved Words
20097
20098
    function isFutureReservedWord(id) {
20099
        switch (id) {
20100
        case 'enum':
20101
        case 'export':
20102
        case 'import':
20103
        case 'super':
20104
            return true;
20105
        default:
20106
            return false;
20107
        }
20108
    }
20109
20110
    // 11.6.2.2 Future Reserved Words
20111
20112
    function isStrictModeReservedWord(id) {
20113
        switch (id) {
20114
        case 'implements':
20115
        case 'interface':
20116
        case 'package':
20117
        case 'private':
20118
        case 'protected':
20119
        case 'public':
20120
        case 'static':
20121
        case 'yield':
20122
        case 'let':
20123
            return true;
20124
        default:
20125
            return false;
20126
        }
20127
    }
20128
20129
    function isRestrictedWord(id) {
20130
        return id === 'eval' || id === 'arguments';
20131
    }
20132
20133
    // 7.6.1.1 Keywords
20134
20135
    function isKeyword(id) {
20136
20137
        // 'const' is specialized as Keyword in V8.
20138
        // 'yield' and 'let' are for compatibility with SpiderMonkey and ES.next.
20139
        // Some others are from future reserved words.
20140
20141
        switch (id.length) {
20142
        case 2:
20143
            return (id === 'if') || (id === 'in') || (id === 'do');
20144
        case 3:
20145
            return (id === 'var') || (id === 'for') || (id === 'new') ||
20146
                (id === 'try') || (id === 'let');
20147
        case 4:
20148
            return (id === 'this') || (id === 'else') || (id === 'case') ||
20149
                (id === 'void') || (id === 'with') || (id === 'enum');
20150
        case 5:
20151
            return (id === 'while') || (id === 'break') || (id === 'catch') ||
20152
                (id === 'throw') || (id === 'const') || (id === 'yield') ||
20153
                (id === 'class') || (id === 'super');
20154
        case 6:
20155
            return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
20156
                (id === 'switch') || (id === 'export') || (id === 'import');
20157
        case 7:
20158
            return (id === 'default') || (id === 'finally') || (id === 'extends');
20159
        case 8:
20160
            return (id === 'function') || (id === 'continue') || (id === 'debugger');
20161
        case 10:
20162
            return (id === 'instanceof');
20163
        default:
20164
            return false;
20165
        }
20166
    }
20167
20168
    // 7.4 Comments
20169
20170
    function addComment(type, value, start, end, loc) {
20171
        var comment;
20172
20173
        assert(typeof start === 'number', 'Comment must have valid position');
20174
20175
        state.lastCommentStart = start;
20176
20177
        comment = {
20178
            type: type,
20179
            value: value
20180
        };
20181
        if (extra.range) {
20182
            comment.range = [start, end];
20183
        }
20184
        if (extra.loc) {
20185
            comment.loc = loc;
20186
        }
20187
        extra.comments.push(comment);
20188
        if (extra.attachComment) {
20189
            extra.leadingComments.push(comment);
20190
            extra.trailingComments.push(comment);
20191
        }
20192
    }
20193
20194
    function skipSingleLineComment(offset) {
20195
        var start, loc, ch, comment;
20196
20197
        start = index - offset;
20198
        loc = {
20199
            start: {
20200
                line: lineNumber,
20201
                column: index - lineStart - offset
20202
            }
20203
        };
20204
20205
        while (index < length) {
20206
            ch = source.charCodeAt(index);
20207
            ++index;
20208
            if (isLineTerminator(ch)) {
20209
                hasLineTerminator = true;
20210
                if (extra.comments) {
20211
                    comment = source.slice(start + offset, index - 1);
20212
                    loc.end = {
20213
                        line: lineNumber,
20214
                        column: index - lineStart - 1
20215
                    };
20216
                    addComment('Line', comment, start, index - 1, loc);
20217
                }
20218
                if (ch === 13 && source.charCodeAt(index) === 10) {
20219
                    ++index;
20220
                }
20221
                ++lineNumber;
20222
                lineStart = index;
20223
                return;
20224
            }
20225
        }
20226
20227
        if (extra.comments) {
20228
            comment = source.slice(start + offset, index);
20229
            loc.end = {
20230
                line: lineNumber,
20231
                column: index - lineStart
20232
            };
20233
            addComment('Line', comment, start, index, loc);
20234
        }
20235
    }
20236
20237
    function skipMultiLineComment() {
20238
        var start, loc, ch, comment;
20239
20240
        if (extra.comments) {
20241
            start = index - 2;
20242
            loc = {
20243
                start: {
20244
                    line: lineNumber,
20245
                    column: index - lineStart - 2
20246
                }
20247
            };
20248
        }
20249
20250
        while (index < length) {
20251
            ch = source.charCodeAt(index);
20252
            if (isLineTerminator(ch)) {
20253
                if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) {
20254
                    ++index;
20255
                }
20256
                hasLineTerminator = true;
20257
                ++lineNumber;
20258
                ++index;
20259
                lineStart = index;
20260
            } else if (ch === 0x2A) {
20261
                // Block comment ends with '*/'.
20262
                if (source.charCodeAt(index + 1) === 0x2F) {
20263
                    ++index;
20264
                    ++index;
20265
                    if (extra.comments) {
20266
                        comment = source.slice(start + 2, index - 2);
20267
                        loc.end = {
20268
                            line: lineNumber,
20269
                            column: index - lineStart
20270
                        };
20271
                        addComment('Block', comment, start, index, loc);
20272
                    }
20273
                    return;
20274
                }
20275
                ++index;
20276
            } else {
20277
                ++index;
20278
            }
20279
        }
20280
20281
        // Ran off the end of the file - the whole thing is a comment
20282
        if (extra.comments) {
20283
            loc.end = {
20284
                line: lineNumber,
20285
                column: index - lineStart
20286
            };
20287
            comment = source.slice(start + 2, index);
20288
            addComment('Block', comment, start, index, loc);
20289
        }
20290
        tolerateUnexpectedToken();
20291
    }
20292
20293
    function skipComment() {
20294
        var ch, start;
20295
        hasLineTerminator = false;
20296
20297
        start = (index === 0);
20298
        while (index < length) {
20299
            ch = source.charCodeAt(index);
20300
20301
            if (isWhiteSpace(ch)) {
20302
                ++index;
20303
            } else if (isLineTerminator(ch)) {
20304
                hasLineTerminator = true;
20305
                ++index;
20306
                if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {
20307
                    ++index;
20308
                }
20309
                ++lineNumber;
20310
                lineStart = index;
20311
                start = true;
20312
            } else if (ch === 0x2F) { // U+002F is '/'
20313
                ch = source.charCodeAt(index + 1);
20314
                if (ch === 0x2F) {
20315
                    ++index;
20316
                    ++index;
20317
                    skipSingleLineComment(2);
20318
                    start = true;
20319
                } else if (ch === 0x2A) {  // U+002A is '*'
20320
                    ++index;
20321
                    ++index;
20322
                    skipMultiLineComment();
20323
                } else {
20324
                    break;
20325
                }
20326
            } else if (start && ch === 0x2D) { // U+002D is '-'
20327
                // U+003E is '>'
20328
                if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) {
20329
                    // '-->' is a single-line comment
20330
                    index += 3;
20331
                    skipSingleLineComment(3);
20332
                } else {
20333
                    break;
20334
                }
20335
            } else if (ch === 0x3C) { // U+003C is '<'
20336
                if (source.slice(index + 1, index + 4) === '!--') {
20337
                    ++index; // `<`
20338
                    ++index; // `!`
20339
                    ++index; // `-`
20340
                    ++index; // `-`
20341
                    skipSingleLineComment(4);
20342
                } else {
20343
                    break;
20344
                }
20345
            } else {
20346
                break;
20347
            }
20348
        }
20349
    }
20350
20351
    function scanHexEscape(prefix) {
20352
        var i, len, ch, code = 0;
20353
20354
        len = (prefix === 'u') ? 4 : 2;
20355
        for (i = 0; i < len; ++i) {
20356
            if (index < length && isHexDigit(source[index])) {
20357
                ch = source[index++];
20358
                code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
20359
            } else {
20360
                return '';
20361
            }
20362
        }
20363
        return String.fromCharCode(code);
20364
    }
20365
20366
    function scanUnicodeCodePointEscape() {
20367
        var ch, code, cu1, cu2;
20368
20369
        ch = source[index];
20370
        code = 0;
20371
20372
        // At least, one hex digit is required.
20373
        if (ch === '}') {
20374
            throwUnexpectedToken();
20375
        }
20376
20377
        while (index < length) {
20378
            ch = source[index++];
20379
            if (!isHexDigit(ch)) {
20380
                break;
20381
            }
20382
            code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
20383
        }
20384
20385
        if (code > 0x10FFFF || ch !== '}') {
20386
            throwUnexpectedToken();
20387
        }
20388
20389
        // UTF-16 Encoding
20390
        if (code <= 0xFFFF) {
20391
            return String.fromCharCode(code);
20392
        }
20393
        cu1 = ((code - 0x10000) >> 10) + 0xD800;
20394
        cu2 = ((code - 0x10000) & 1023) + 0xDC00;
20395
        return String.fromCharCode(cu1, cu2);
20396
    }
20397
20398
    function getEscapedIdentifier() {
20399
        var ch, id;
20400
20401
        ch = source.charCodeAt(index++);
20402
        id = String.fromCharCode(ch);
20403
20404
        // '\u' (U+005C, U+0075) denotes an escaped character.
20405
        if (ch === 0x5C) {
20406
            if (source.charCodeAt(index) !== 0x75) {
20407
                throwUnexpectedToken();
20408
            }
20409
            ++index;
20410
            ch = scanHexEscape('u');
20411
            if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
20412
                throwUnexpectedToken();
20413
            }
20414
            id = ch;
20415
        }
20416
20417
        while (index < length) {
20418
            ch = source.charCodeAt(index);
20419
            if (!isIdentifierPart(ch)) {
20420
                break;
20421
            }
20422
            ++index;
20423
            id += String.fromCharCode(ch);
20424
20425
            // '\u' (U+005C, U+0075) denotes an escaped character.
20426
            if (ch === 0x5C) {
20427
                id = id.substr(0, id.length - 1);
20428
                if (source.charCodeAt(index) !== 0x75) {
20429
                    throwUnexpectedToken();
20430
                }
20431
                ++index;
20432
                ch = scanHexEscape('u');
20433
                if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
20434
                    throwUnexpectedToken();
20435
                }
20436
                id += ch;
20437
            }
20438
        }
20439
20440
        return id;
20441
    }
20442
20443
    function getIdentifier() {
20444
        var start, ch;
20445
20446
        start = index++;
20447
        while (index < length) {
20448
            ch = source.charCodeAt(index);
20449
            if (ch === 0x5C) {
20450
                // Blackslash (U+005C) marks Unicode escape sequence.
20451
                index = start;
20452
                return getEscapedIdentifier();
20453
            }
20454
            if (isIdentifierPart(ch)) {
20455
                ++index;
20456
            } else {
20457
                break;
20458
            }
20459
        }
20460
20461
        return source.slice(start, index);
20462
    }
20463
20464
    function scanIdentifier() {
20465
        var start, id, type;
20466
20467
        start = index;
20468
20469
        // Backslash (U+005C) starts an escaped character.
20470
        id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier();
20471
20472
        // There is no keyword or literal with only one character.
20473
        // Thus, it must be an identifier.
20474
        if (id.length === 1) {
20475
            type = Token.Identifier;
20476
        } else if (isKeyword(id)) {
20477
            type = Token.Keyword;
20478
        } else if (id === 'null') {
20479
            type = Token.NullLiteral;
20480
        } else if (id === 'true' || id === 'false') {
20481
            type = Token.BooleanLiteral;
20482
        } else {
20483
            type = Token.Identifier;
20484
        }
20485
20486
        return {
20487
            type: type,
20488
            value: id,
20489
            lineNumber: lineNumber,
20490
            lineStart: lineStart,
20491
            start: start,
20492
            end: index
20493
        };
20494
    }
20495
20496
20497
    // 7.7 Punctuators
20498
20499
    function scanPunctuator() {
20500
        var token, str;
20501
20502
        token = {
20503
            type: Token.Punctuator,
20504
            value: '',
20505
            lineNumber: lineNumber,
20506
            lineStart: lineStart,
20507
            start: index,
20508
            end: index
20509
        };
20510
20511
        // Check for most common single-character punctuators.
20512
        str = source[index];
20513
        switch (str) {
20514
20515
        case '(':
20516
            if (extra.tokenize) {
20517
                extra.openParenToken = extra.tokens.length;
20518
            }
20519
            ++index;
20520
            break;
20521
20522
        case '{':
20523
            if (extra.tokenize) {
20524
                extra.openCurlyToken = extra.tokens.length;
20525
            }
20526
            state.curlyStack.push('{');
20527
            ++index;
20528
            break;
20529
20530
        case '.':
20531
            ++index;
20532
            if (source[index] === '.' && source[index + 1] === '.') {
20533
                // Spread operator: ...
20534
                index += 2;
20535
                str = '...';
20536
            }
20537
            break;
20538
20539
        case '}':
20540
            ++index;
20541
            state.curlyStack.pop();
20542
            break;
20543
        case ')':
20544
        case ';':
20545
        case ',':
20546
        case '[':
20547
        case ']':
20548
        case ':':
20549
        case '?':
20550
        case '~':
20551
            ++index;
20552
            break;
20553
20554
        default:
20555
            // 4-character punctuator.
20556
            str = source.substr(index, 4);
20557
            if (str === '>>>=') {
20558
                index += 4;
20559
            } else {
20560
20561
                // 3-character punctuators.
20562
                str = str.substr(0, 3);
20563
                if (str === '===' || str === '!==' || str === '>>>' ||
20564
                    str === '<<=' || str === '>>=') {
20565
                    index += 3;
20566
                } else {
20567
20568
                    // 2-character punctuators.
20569
                    str = str.substr(0, 2);
20570
                    if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
20571
                        str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
20572
                        str === '++' || str === '--' || str === '<<' || str === '>>' ||
20573
                        str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
20574
                        str === '<=' || str === '>=' || str === '=>') {
20575
                        index += 2;
20576
                    } else {
20577
20578
                        // 1-character punctuators.
20579
                        str = source[index];
20580
                        if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
20581
                            ++index;
20582
                        }
20583
                    }
20584
                }
20585
            }
20586
        }
20587
20588
        if (index === token.start) {
20589
            throwUnexpectedToken();
20590
        }
20591
20592
        token.end = index;
20593
        token.value = str;
20594
        return token;
20595
    }
20596
20597
    // 7.8.3 Numeric Literals
20598
20599
    function scanHexLiteral(start) {
20600
        var number = '';
20601
20602
        while (index < length) {
20603
            if (!isHexDigit(source[index])) {
20604
                break;
20605
            }
20606
            number += source[index++];
20607
        }
20608
20609
        if (number.length === 0) {
20610
            throwUnexpectedToken();
20611
        }
20612
20613
        if (isIdentifierStart(source.charCodeAt(index))) {
20614
            throwUnexpectedToken();
20615
        }
20616
20617
        return {
20618
            type: Token.NumericLiteral,
20619
            value: parseInt('0x' + number, 16),
20620
            lineNumber: lineNumber,
20621
            lineStart: lineStart,
20622
            start: start,
20623
            end: index
20624
        };
20625
    }
20626
20627
    function scanBinaryLiteral(start) {
20628
        var ch, number;
20629
20630
        number = '';
20631
20632
        while (index < length) {
20633
            ch = source[index];
20634
            if (ch !== '0' && ch !== '1') {
20635
                break;
20636
            }
20637
            number += source[index++];
20638
        }
20639
20640
        if (number.length === 0) {
20641
            // only 0b or 0B
20642
            throwUnexpectedToken();
20643
        }
20644
20645
        if (index < length) {
20646
            ch = source.charCodeAt(index);
20647
            /* istanbul ignore else */
20648
            if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
20649
                throwUnexpectedToken();
20650
            }
20651
        }
20652
20653
        return {
20654
            type: Token.NumericLiteral,
20655
            value: parseInt(number, 2),
20656
            lineNumber: lineNumber,
20657
            lineStart: lineStart,
20658
            start: start,
20659
            end: index
20660
        };
20661
    }
20662
20663
    function scanOctalLiteral(prefix, start) {
20664
        var number, octal;
20665
20666
        if (isOctalDigit(prefix)) {
20667
            octal = true;
20668
            number = '0' + source[index++];
20669
        } else {
20670
            octal = false;
20671
            ++index;
20672
            number = '';
20673
        }
20674
20675
        while (index < length) {
20676
            if (!isOctalDigit(source[index])) {
20677
                break;
20678
            }
20679
            number += source[index++];
20680
        }
20681
20682
        if (!octal && number.length === 0) {
20683
            // only 0o or 0O
20684
            throwUnexpectedToken();
20685
        }
20686
20687
        if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
20688
            throwUnexpectedToken();
20689
        }
20690
20691
        return {
20692
            type: Token.NumericLiteral,
20693
            value: parseInt(number, 8),
20694
            octal: octal,
20695
            lineNumber: lineNumber,
20696
            lineStart: lineStart,
20697
            start: start,
20698
            end: index
20699
        };
20700
    }
20701
20702
    function isImplicitOctalLiteral() {
20703
        var i, ch;
20704
20705
        // Implicit octal, unless there is a non-octal digit.
20706
        // (Annex B.1.1 on Numeric Literals)
20707
        for (i = index + 1; i < length; ++i) {
20708
            ch = source[i];
20709
            if (ch === '8' || ch === '9') {
20710
                return false;
20711
            }
20712
            if (!isOctalDigit(ch)) {
20713
                return true;
20714
            }
20715
        }
20716
20717
        return true;
20718
    }
20719
20720
    function scanNumericLiteral() {
20721
        var number, start, ch;
20722
20723
        ch = source[index];
20724
        assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
20725
            'Numeric literal must start with a decimal digit or a decimal point');
20726
20727
        start = index;
20728
        number = '';
20729
        if (ch !== '.') {
20730
            number = source[index++];
20731
            ch = source[index];
20732
20733
            // Hex number starts with '0x'.
20734
            // Octal number starts with '0'.
20735
            // Octal number in ES6 starts with '0o'.
20736
            // Binary number in ES6 starts with '0b'.
20737
            if (number === '0') {
20738
                if (ch === 'x' || ch === 'X') {
20739
                    ++index;
20740
                    return scanHexLiteral(start);
20741
                }
20742
                if (ch === 'b' || ch === 'B') {
20743
                    ++index;
20744
                    return scanBinaryLiteral(start);
20745
                }
20746
                if (ch === 'o' || ch === 'O') {
20747
                    return scanOctalLiteral(ch, start);
20748
                }
20749
20750
                if (isOctalDigit(ch)) {
20751
                    if (isImplicitOctalLiteral()) {
20752
                        return scanOctalLiteral(ch, start);
20753
                    }
20754
                }
20755
            }
20756
20757
            while (isDecimalDigit(source.charCodeAt(index))) {
20758
                number += source[index++];
20759
            }
20760
            ch = source[index];
20761
        }
20762
20763
        if (ch === '.') {
20764
            number += source[index++];
20765
            while (isDecimalDigit(source.charCodeAt(index))) {
20766
                number += source[index++];
20767
            }
20768
            ch = source[index];
20769
        }
20770
20771
        if (ch === 'e' || ch === 'E') {
20772
            number += source[index++];
20773
20774
            ch = source[index];
20775
            if (ch === '+' || ch === '-') {
20776
                number += source[index++];
20777
            }
20778
            if (isDecimalDigit(source.charCodeAt(index))) {
20779
                while (isDecimalDigit(source.charCodeAt(index))) {
20780
                    number += source[index++];
20781
                }
20782
            } else {
20783
                throwUnexpectedToken();
20784
            }
20785
        }
20786
20787
        if (isIdentifierStart(source.charCodeAt(index))) {
20788
            throwUnexpectedToken();
20789
        }
20790
20791
        return {
20792
            type: Token.NumericLiteral,
20793
            value: parseFloat(number),
20794
            lineNumber: lineNumber,
20795
            lineStart: lineStart,
20796
            start: start,
20797
            end: index
20798
        };
20799
    }
20800
20801
    // 7.8.4 String Literals
20802
20803
    function scanStringLiteral() {
20804
        var str = '', quote, start, ch, unescaped, octToDec, octal = false;
20805
20806
        quote = source[index];
20807
        assert((quote === '\'' || quote === '"'),
20808
            'String literal must starts with a quote');
20809
20810
        start = index;
20811
        ++index;
20812
20813
        while (index < length) {
20814
            ch = source[index++];
20815
20816
            if (ch === quote) {
20817
                quote = '';
20818
                break;
20819
            } else if (ch === '\\') {
20820
                ch = source[index++];
20821
                if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
20822
                    switch (ch) {
20823
                    case 'u':
20824
                    case 'x':
20825
                        if (source[index] === '{') {
20826
                            ++index;
20827
                            str += scanUnicodeCodePointEscape();
20828
                        } else {
20829
                            unescaped = scanHexEscape(ch);
20830
                            if (!unescaped) {
20831
                                throw throwUnexpectedToken();
20832
                            }
20833
                            str += unescaped;
20834
                        }
20835
                        break;
20836
                    case 'n':
20837
                        str += '\n';
20838
                        break;
20839
                    case 'r':
20840
                        str += '\r';
20841
                        break;
20842
                    case 't':
20843
                        str += '\t';
20844
                        break;
20845
                    case 'b':
20846
                        str += '\b';
20847
                        break;
20848
                    case 'f':
20849
                        str += '\f';
20850
                        break;
20851
                    case 'v':
20852
                        str += '\x0B';
20853
                        break;
20854
                    case '8':
20855
                    case '9':
20856
                        throw throwUnexpectedToken();
20857
20858
                    default:
20859
                        if (isOctalDigit(ch)) {
20860
                            octToDec = octalToDecimal(ch);
20861
20862
                            octal = octToDec.octal || octal;
20863
                            str += String.fromCharCode(octToDec.code);
20864
                        } else {
20865
                            str += ch;
20866
                        }
20867
                        break;
20868
                    }
20869
                } else {
20870
                    ++lineNumber;
20871
                    if (ch === '\r' && source[index] === '\n') {
20872
                        ++index;
20873
                    }
20874
                    lineStart = index;
20875
                }
20876
            } else if (isLineTerminator(ch.charCodeAt(0))) {
20877
                break;
20878
            } else {
20879
                str += ch;
20880
            }
20881
        }
20882
20883
        if (quote !== '') {
20884
            throwUnexpectedToken();
20885
        }
20886
20887
        return {
20888
            type: Token.StringLiteral,
20889
            value: str,
20890
            octal: octal,
20891
            lineNumber: startLineNumber,
20892
            lineStart: startLineStart,
20893
            start: start,
20894
            end: index
20895
        };
20896
    }
20897
20898
    function scanTemplate() {
20899
        var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
20900
20901
        terminated = false;
20902
        tail = false;
20903
        start = index;
20904
        head = (source[index] === '`');
20905
        rawOffset = 2;
20906
20907
        ++index;
20908
20909
        while (index < length) {
20910
            ch = source[index++];
20911
            if (ch === '`') {
20912
                rawOffset = 1;
20913
                tail = true;
20914
                terminated = true;
20915
                break;
20916
            } else if (ch === '$') {
20917
                if (source[index] === '{') {
20918
                    state.curlyStack.push('${');
20919
                    ++index;
20920
                    terminated = true;
20921
                    break;
20922
                }
20923
                cooked += ch;
20924
            } else if (ch === '\\') {
20925
                ch = source[index++];
20926
                if (!isLineTerminator(ch.charCodeAt(0))) {
20927
                    switch (ch) {
20928
                    case 'n':
20929
                        cooked += '\n';
20930
                        break;
20931
                    case 'r':
20932
                        cooked += '\r';
20933
                        break;
20934
                    case 't':
20935
                        cooked += '\t';
20936
                        break;
20937
                    case 'u':
20938
                    case 'x':
20939
                        if (source[index] === '{') {
20940
                            ++index;
20941
                            cooked += scanUnicodeCodePointEscape();
20942
                        } else {
20943
                            restore = index;
20944
                            unescaped = scanHexEscape(ch);
20945
                            if (unescaped) {
20946
                                cooked += unescaped;
20947
                            } else {
20948
                                index = restore;
20949
                                cooked += ch;
20950
                            }
20951
                        }
20952
                        break;
20953
                    case 'b':
20954
                        cooked += '\b';
20955
                        break;
20956
                    case 'f':
20957
                        cooked += '\f';
20958
                        break;
20959
                    case 'v':
20960
                        cooked += '\v';
20961
                        break;
20962
20963
                    default:
20964
                        if (ch === '0') {
20965
                            if (isDecimalDigit(source.charCodeAt(index))) {
20966
                                // Illegal: \01 \02 and so on
20967
                                throwError(Messages.TemplateOctalLiteral);
20968
                            }
20969
                            cooked += '\0';
20970
                        } else if (isOctalDigit(ch)) {
20971
                            // Illegal: \1 \2
20972
                            throwError(Messages.TemplateOctalLiteral);
20973
                        } else {
20974
                            cooked += ch;
20975
                        }
20976
                        break;
20977
                    }
20978
                } else {
20979
                    ++lineNumber;
20980
                    if (ch === '\r' && source[index] === '\n') {
20981
                        ++index;
20982
                    }
20983
                    lineStart = index;
20984
                }
20985
            } else if (isLineTerminator(ch.charCodeAt(0))) {
20986
                ++lineNumber;
20987
                if (ch === '\r' && source[index] === '\n') {
20988
                    ++index;
20989
                }
20990
                lineStart = index;
20991
                cooked += '\n';
20992
            } else {
20993
                cooked += ch;
20994
            }
20995
        }
20996
20997
        if (!terminated) {
20998
            throwUnexpectedToken();
20999
        }
21000
21001
        if (!head) {
21002
            state.curlyStack.pop();
21003
        }
21004
21005
        return {
21006
            type: Token.Template,
21007
            value: {
21008
                cooked: cooked,
21009
                raw: source.slice(start + 1, index - rawOffset)
21010
            },
21011
            head: head,
21012
            tail: tail,
21013
            lineNumber: lineNumber,
21014
            lineStart: lineStart,
21015
            start: start,
21016
            end: index
21017
        };
21018
    }
21019
21020
    function testRegExp(pattern, flags) {
21021
        var tmp = pattern;
21022
21023
        if (flags.indexOf('u') >= 0) {
21024
            // Replace each astral symbol and every Unicode escape sequence
21025
            // that possibly represents an astral symbol or a paired surrogate
21026
            // with a single ASCII symbol to avoid throwing on regular
21027
            // expressions that are only valid in combination with the `/u`
21028
            // flag.
21029
            // Note: replacing with the ASCII symbol `x` might cause false
21030
            // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
21031
            // perfectly valid pattern that is equivalent to `[a-b]`, but it
21032
            // would be replaced by `[x-b]` which throws an error.
21033
            tmp = tmp
21034
                .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
21035
                    if (parseInt($1, 16) <= 0x10FFFF) {
21036
                        return 'x';
21037
                    }
21038
                    throwUnexpectedToken(null, Messages.InvalidRegExp);
21039
                })
21040
                .replace(
21041
                    /\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
21042
                    'x'
21043
                );
21044
        }
21045
21046
        // First, detect invalid regular expressions.
21047
        try {
21048
            RegExp(tmp);
21049
        } catch (e) {
21050
            throwUnexpectedToken(null, Messages.InvalidRegExp);
21051
        }
21052
21053
        // Return a regular expression object for this pattern-flag pair, or
21054
        // `null` in case the current environment doesn't support the flags it
21055
        // uses.
21056
        try {
21057
            return new RegExp(pattern, flags);
21058
        } catch (exception) {
21059
            return null;
21060
        }
21061
    }
21062
21063
    function scanRegExpBody() {
21064
        var ch, str, classMarker, terminated, body;
21065
21066
        ch = source[index];
21067
        assert(ch === '/', 'Regular expression literal must start with a slash');
21068
        str = source[index++];
21069
21070
        classMarker = false;
21071
        terminated = false;
21072
        while (index < length) {
21073
            ch = source[index++];
21074
            str += ch;
21075
            if (ch === '\\') {
21076
                ch = source[index++];
21077
                // ECMA-262 7.8.5
21078
                if (isLineTerminator(ch.charCodeAt(0))) {
21079
                    throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21080
                }
21081
                str += ch;
21082
            } else if (isLineTerminator(ch.charCodeAt(0))) {
21083
                throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21084
            } else if (classMarker) {
21085
                if (ch === ']') {
21086
                    classMarker = false;
21087
                }
21088
            } else {
21089
                if (ch === '/') {
21090
                    terminated = true;
21091
                    break;
21092
                } else if (ch === '[') {
21093
                    classMarker = true;
21094
                }
21095
            }
21096
        }
21097
21098
        if (!terminated) {
21099
            throwUnexpectedToken(null, Messages.UnterminatedRegExp);
21100
        }
21101
21102
        // Exclude leading and trailing slash.
21103
        body = str.substr(1, str.length - 2);
21104
        return {
21105
            value: body,
21106
            literal: str
21107
        };
21108
    }
21109
21110
    function scanRegExpFlags() {
21111
        var ch, str, flags, restore;
21112
21113
        str = '';
21114
        flags = '';
21115
        while (index < length) {
21116
            ch = source[index];
21117
            if (!isIdentifierPart(ch.charCodeAt(0))) {
21118
                break;
21119
            }
21120
21121
            ++index;
21122
            if (ch === '\\' && index < length) {
21123
                ch = source[index];
21124
                if (ch === 'u') {
21125
                    ++index;
21126
                    restore = index;
21127
                    ch = scanHexEscape('u');
21128
                    if (ch) {
21129
                        flags += ch;
21130
                        for (str += '\\u'; restore < index; ++restore) {
21131
                            str += source[restore];
21132
                        }
21133
                    } else {
21134
                        index = restore;
21135
                        flags += 'u';
21136
                        str += '\\u';
21137
                    }
21138
                    tolerateUnexpectedToken();
21139
                } else {
21140
                    str += '\\';
21141
                    tolerateUnexpectedToken();
21142
                }
21143
            } else {
21144
                flags += ch;
21145
                str += ch;
21146
            }
21147
        }
21148
21149
        return {
21150
            value: flags,
21151
            literal: str
21152
        };
21153
    }
21154
21155
    function scanRegExp() {
21156
        scanning = true;
21157
        var start, body, flags, value;
21158
21159
        lookahead = null;
21160
        skipComment();
21161
        start = index;
21162
21163
        body = scanRegExpBody();
21164
        flags = scanRegExpFlags();
21165
        value = testRegExp(body.value, flags.value);
21166
        scanning = false;
21167
        if (extra.tokenize) {
21168
            return {
21169
                type: Token.RegularExpression,
21170
                value: value,
21171
                regex: {
21172
                    pattern: body.value,
21173
                    flags: flags.value
21174
                },
21175
                lineNumber: lineNumber,
21176
                lineStart: lineStart,
21177
                start: start,
21178
                end: index
21179
            };
21180
        }
21181
21182
        return {
21183
            literal: body.literal + flags.literal,
21184
            value: value,
21185
            regex: {
21186
                pattern: body.value,
21187
                flags: flags.value
21188
            },
21189
            start: start,
21190
            end: index
21191
        };
21192
    }
21193
21194
    function collectRegex() {
21195
        var pos, loc, regex, token;
21196
21197
        skipComment();
21198
21199
        pos = index;
21200
        loc = {
21201
            start: {
21202
                line: lineNumber,
21203
                column: index - lineStart
21204
            }
21205
        };
21206
21207
        regex = scanRegExp();
21208
21209
        loc.end = {
21210
            line: lineNumber,
21211
            column: index - lineStart
21212
        };
21213
21214
        /* istanbul ignore next */
21215
        if (!extra.tokenize) {
21216
            // Pop the previous token, which is likely '/' or '/='
21217
            if (extra.tokens.length > 0) {
21218
                token = extra.tokens[extra.tokens.length - 1];
21219
                if (token.range[0] === pos && token.type === 'Punctuator') {
21220
                    if (token.value === '/' || token.value === '/=') {
21221
                        extra.tokens.pop();
21222
                    }
21223
                }
21224
            }
21225
21226
            extra.tokens.push({
21227
                type: 'RegularExpression',
21228
                value: regex.literal,
21229
                regex: regex.regex,
21230
                range: [pos, index],
21231
                loc: loc
21232
            });
21233
        }
21234
21235
        return regex;
21236
    }
21237
21238
    function isIdentifierName(token) {
21239
        return token.type === Token.Identifier ||
21240
            token.type === Token.Keyword ||
21241
            token.type === Token.BooleanLiteral ||
21242
            token.type === Token.NullLiteral;
21243
    }
21244
21245
    function advanceSlash() {
21246
        var prevToken,
21247
            checkToken;
21248
        // Using the following algorithm:
21249
        // https://github.com/mozilla/sweet.js/wiki/design
21250
        prevToken = extra.tokens[extra.tokens.length - 1];
21251
        if (!prevToken) {
21252
            // Nothing before that: it cannot be a division.
21253
            return collectRegex();
21254
        }
21255
        if (prevToken.type === 'Punctuator') {
21256
            if (prevToken.value === ']') {
21257
                return scanPunctuator();
21258
            }
21259
            if (prevToken.value === ')') {
21260
                checkToken = extra.tokens[extra.openParenToken - 1];
21261
                if (checkToken &&
21262
                        checkToken.type === 'Keyword' &&
21263
                        (checkToken.value === 'if' ||
21264
                         checkToken.value === 'while' ||
21265
                         checkToken.value === 'for' ||
21266
                         checkToken.value === 'with')) {
21267
                    return collectRegex();
21268
                }
21269
                return scanPunctuator();
21270
            }
21271
            if (prevToken.value === '}') {
21272
                // Dividing a function by anything makes little sense,
21273
                // but we have to check for that.
21274
                if (extra.tokens[extra.openCurlyToken - 3] &&
21275
                        extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
21276
                    // Anonymous function.
21277
                    checkToken = extra.tokens[extra.openCurlyToken - 4];
21278
                    if (!checkToken) {
21279
                        return scanPunctuator();
21280
                    }
21281
                } else if (extra.tokens[extra.openCurlyToken - 4] &&
21282
                        extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
21283
                    // Named function.
21284
                    checkToken = extra.tokens[extra.openCurlyToken - 5];
21285
                    if (!checkToken) {
21286
                        return collectRegex();
21287
                    }
21288
                } else {
21289
                    return scanPunctuator();
21290
                }
21291
                // checkToken determines whether the function is
21292
                // a declaration or an expression.
21293
                if (FnExprTokens.indexOf(checkToken.value) >= 0) {
21294
                    // It is an expression.
21295
                    return scanPunctuator();
21296
                }
21297
                // It is a declaration.
21298
                return collectRegex();
21299
            }
21300
            return collectRegex();
21301
        }
21302
        if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
21303
            return collectRegex();
21304
        }
21305
        return scanPunctuator();
21306
    }
21307
21308
    function advance() {
21309
        var ch, token;
21310
21311
        if (index >= length) {
21312
            return {
21313
                type: Token.EOF,
21314
                lineNumber: lineNumber,
21315
                lineStart: lineStart,
21316
                start: index,
21317
                end: index
21318
            };
21319
        }
21320
21321
        ch = source.charCodeAt(index);
21322
21323
        if (isIdentifierStart(ch)) {
21324
            token = scanIdentifier();
21325
            if (strict && isStrictModeReservedWord(token.value)) {
21326
                token.type = Token.Keyword;
21327
            }
21328
            return token;
21329
        }
21330
21331
        // Very common: ( and ) and ;
21332
        if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
21333
            return scanPunctuator();
21334
        }
21335
21336
        // String literal starts with single quote (U+0027) or double quote (U+0022).
21337
        if (ch === 0x27 || ch === 0x22) {
21338
            return scanStringLiteral();
21339
        }
21340
21341
        // Dot (.) U+002E can also start a floating-point number, hence the need
21342
        // to check the next character.
21343
        if (ch === 0x2E) {
21344
            if (isDecimalDigit(source.charCodeAt(index + 1))) {
21345
                return scanNumericLiteral();
21346
            }
21347
            return scanPunctuator();
21348
        }
21349
21350
        if (isDecimalDigit(ch)) {
21351
            return scanNumericLiteral();
21352
        }
21353
21354
        // Slash (/) U+002F can also start a regex.
21355
        if (extra.tokenize && ch === 0x2F) {
21356
            return advanceSlash();
21357
        }
21358
21359
        // Template literals start with ` (U+0060) for template head
21360
        // or } (U+007D) for template middle or template tail.
21361
        if (ch === 0x60 || (ch === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) {
21362
            return scanTemplate();
21363
        }
21364
21365
        return scanPunctuator();
21366
    }
21367
21368
    function collectToken() {
21369
        var loc, token, value, entry;
21370
21371
        loc = {
21372
            start: {
21373
                line: lineNumber,
21374
                column: index - lineStart
21375
            }
21376
        };
21377
21378
        token = advance();
21379
        loc.end = {
21380
            line: lineNumber,
21381
            column: index - lineStart
21382
        };
21383
21384
        if (token.type !== Token.EOF) {
21385
            value = source.slice(token.start, token.end);
21386
            entry = {
21387
                type: TokenName[token.type],
21388
                value: value,
21389
                range: [token.start, token.end],
21390
                loc: loc
21391
            };
21392
            if (token.regex) {
21393
                entry.regex = {
21394
                    pattern: token.regex.pattern,
21395
                    flags: token.regex.flags
21396
                };
21397
            }
21398
            extra.tokens.push(entry);
21399
        }
21400
21401
        return token;
21402
    }
21403
21404
    function lex() {
21405
        var token;
21406
        scanning = true;
21407
21408
        lastIndex = index;
21409
        lastLineNumber = lineNumber;
21410
        lastLineStart = lineStart;
21411
21412
        skipComment();
21413
21414
        token = lookahead;
21415
21416
        startIndex = index;
21417
        startLineNumber = lineNumber;
21418
        startLineStart = lineStart;
21419
21420
        lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
21421
        scanning = false;
21422
        return token;
21423
    }
21424
21425
    function peek() {
21426
        scanning = true;
21427
21428
        skipComment();
21429
21430
        lastIndex = index;
21431
        lastLineNumber = lineNumber;
21432
        lastLineStart = lineStart;
21433
21434
        startIndex = index;
21435
        startLineNumber = lineNumber;
21436
        startLineStart = lineStart;
21437
21438
        lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
21439
        scanning = false;
21440
    }
21441
21442
    function Position() {
21443
        this.line = startLineNumber;
21444
        this.column = startIndex - startLineStart;
21445
    }
21446
21447
    function SourceLocation() {
21448
        this.start = new Position();
21449
        this.end = null;
21450
    }
21451
21452
    function WrappingSourceLocation(startToken) {
21453
        this.start = {
21454
            line: startToken.lineNumber,
21455
            column: startToken.start - startToken.lineStart
21456
        };
21457
        this.end = null;
21458
    }
21459
21460
    function Node() {
21461
        if (extra.range) {
21462
            this.range = [startIndex, 0];
21463
        }
21464
        if (extra.loc) {
21465
            this.loc = new SourceLocation();
21466
        }
21467
    }
21468
21469
    function WrappingNode(startToken) {
21470
        if (extra.range) {
21471
            this.range = [startToken.start, 0];
21472
        }
21473
        if (extra.loc) {
21474
            this.loc = new WrappingSourceLocation(startToken);
21475
        }
21476
    }
21477
21478
    WrappingNode.prototype = Node.prototype = {
21479
21480
        processComment: function () {
21481
            var lastChild,
21482
                leadingComments,
21483
                trailingComments,
21484
                bottomRight = extra.bottomRightStack,
21485
                i,
21486
                comment,
21487
                last = bottomRight[bottomRight.length - 1];
21488
21489
            if (this.type === Syntax.Program) {
21490
                if (this.body.length > 0) {
21491
                    return;
21492
                }
21493
            }
21494
21495
            if (extra.trailingComments.length > 0) {
21496
                trailingComments = [];
21497
                for (i = extra.trailingComments.length - 1; i >= 0; --i) {
21498
                    comment = extra.trailingComments[i];
21499
                    if (comment.range[0] >= this.range[1]) {
21500
                        trailingComments.unshift(comment);
21501
                        extra.trailingComments.splice(i, 1);
21502
                    }
21503
                }
21504
                extra.trailingComments = [];
21505
            } else {
21506
                if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) {
21507
                    trailingComments = last.trailingComments;
21508
                    delete last.trailingComments;
21509
                }
21510
            }
21511
21512
            // Eating the stack.
21513
            if (last) {
21514
                while (last && last.range[0] >= this.range[0]) {
21515
                    lastChild = last;
21516
                    last = bottomRight.pop();
21517
                }
21518
            }
21519
21520
            if (lastChild) {
21521
                if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= this.range[0]) {
21522
                    this.leadingComments = lastChild.leadingComments;
21523
                    lastChild.leadingComments = undefined;
21524
                }
21525
            } else if (extra.leadingComments.length > 0) {
21526
                leadingComments = [];
21527
                for (i = extra.leadingComments.length - 1; i >= 0; --i) {
21528
                    comment = extra.leadingComments[i];
21529
                    if (comment.range[1] <= this.range[0]) {
21530
                        leadingComments.unshift(comment);
21531
                        extra.leadingComments.splice(i, 1);
21532
                    }
21533
                }
21534
            }
21535
21536
21537
            if (leadingComments && leadingComments.length > 0) {
21538
                this.leadingComments = leadingComments;
21539
            }
21540
            if (trailingComments && trailingComments.length > 0) {
21541
                this.trailingComments = trailingComments;
21542
            }
21543
21544
            bottomRight.push(this);
21545
        },
21546
21547
        finish: function () {
21548
            if (extra.range) {
21549
                this.range[1] = lastIndex;
21550
            }
21551
            if (extra.loc) {
21552
                this.loc.end = {
21553
                    line: lastLineNumber,
21554
                    column: lastIndex - lastLineStart
21555
                };
21556
                if (extra.source) {
21557
                    this.loc.source = extra.source;
21558
                }
21559
            }
21560
21561
            if (extra.attachComment) {
21562
                this.processComment();
21563
            }
21564
        },
21565
21566
        finishArrayExpression: function (elements) {
21567
            this.type = Syntax.ArrayExpression;
21568
            this.elements = elements;
21569
            this.finish();
21570
            return this;
21571
        },
21572
21573
        finishArrayPattern: function (elements) {
21574
            this.type = Syntax.ArrayPattern;
21575
            this.elements = elements;
21576
            this.finish();
21577
            return this;
21578
        },
21579
21580
        finishArrowFunctionExpression: function (params, defaults, body, expression) {
21581
            this.type = Syntax.ArrowFunctionExpression;
21582
            this.id = null;
21583
            this.params = params;
21584
            this.defaults = defaults;
21585
            this.body = body;
21586
            this.generator = false;
21587
            this.expression = expression;
21588
            this.finish();
21589
            return this;
21590
        },
21591
21592
        finishAssignmentExpression: function (operator, left, right) {
21593
            this.type = Syntax.AssignmentExpression;
21594
            this.operator = operator;
21595
            this.left = left;
21596
            this.right = right;
21597
            this.finish();
21598
            return this;
21599
        },
21600
21601
        finishAssignmentPattern: function (left, right) {
21602
            this.type = Syntax.AssignmentPattern;
21603
            this.left = left;
21604
            this.right = right;
21605
            this.finish();
21606
            return this;
21607
        },
21608
21609
        finishBinaryExpression: function (operator, left, right) {
21610
            this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;
21611
            this.operator = operator;
21612
            this.left = left;
21613
            this.right = right;
21614
            this.finish();
21615
            return this;
21616
        },
21617
21618
        finishBlockStatement: function (body) {
21619
            this.type = Syntax.BlockStatement;
21620
            this.body = body;
21621
            this.finish();
21622
            return this;
21623
        },
21624
21625
        finishBreakStatement: function (label) {
21626
            this.type = Syntax.BreakStatement;
21627
            this.label = label;
21628
            this.finish();
21629
            return this;
21630
        },
21631
21632
        finishCallExpression: function (callee, args) {
21633
            this.type = Syntax.CallExpression;
21634
            this.callee = callee;
21635
            this.arguments = args;
21636
            this.finish();
21637
            return this;
21638
        },
21639
21640
        finishCatchClause: function (param, body) {
21641
            this.type = Syntax.CatchClause;
21642
            this.param = param;
21643
            this.body = body;
21644
            this.finish();
21645
            return this;
21646
        },
21647
21648
        finishClassBody: function (body) {
21649
            this.type = Syntax.ClassBody;
21650
            this.body = body;
21651
            this.finish();
21652
            return this;
21653
        },
21654
21655
        finishClassDeclaration: function (id, superClass, body) {
21656
            this.type = Syntax.ClassDeclaration;
21657
            this.id = id;
21658
            this.superClass = superClass;
21659
            this.body = body;
21660
            this.finish();
21661
            return this;
21662
        },
21663
21664
        finishClassExpression: function (id, superClass, body) {
21665
            this.type = Syntax.ClassExpression;
21666
            this.id = id;
21667
            this.superClass = superClass;
21668
            this.body = body;
21669
            this.finish();
21670
            return this;
21671
        },
21672
21673
        finishConditionalExpression: function (test, consequent, alternate) {
21674
            this.type = Syntax.ConditionalExpression;
21675
            this.test = test;
21676
            this.consequent = consequent;
21677
            this.alternate = alternate;
21678
            this.finish();
21679
            return this;
21680
        },
21681
21682
        finishContinueStatement: function (label) {
21683
            this.type = Syntax.ContinueStatement;
21684
            this.label = label;
21685
            this.finish();
21686
            return this;
21687
        },
21688
21689
        finishDebuggerStatement: function () {
21690
            this.type = Syntax.DebuggerStatement;
21691
            this.finish();
21692
            return this;
21693
        },
21694
21695
        finishDoWhileStatement: function (body, test) {
21696
            this.type = Syntax.DoWhileStatement;
21697
            this.body = body;
21698
            this.test = test;
21699
            this.finish();
21700
            return this;
21701
        },
21702
21703
        finishEmptyStatement: function () {
21704
            this.type = Syntax.EmptyStatement;
21705
            this.finish();
21706
            return this;
21707
        },
21708
21709
        finishExpressionStatement: function (expression) {
21710
            this.type = Syntax.ExpressionStatement;
21711
            this.expression = expression;
21712
            this.finish();
21713
            return this;
21714
        },
21715
21716
        finishForStatement: function (init, test, update, body) {
21717
            this.type = Syntax.ForStatement;
21718
            this.init = init;
21719
            this.test = test;
21720
            this.update = update;
21721
            this.body = body;
21722
            this.finish();
21723
            return this;
21724
        },
21725
21726
        finishForInStatement: function (left, right, body) {
21727
            this.type = Syntax.ForInStatement;
21728
            this.left = left;
21729
            this.right = right;
21730
            this.body = body;
21731
            this.each = false;
21732
            this.finish();
21733
            return this;
21734
        },
21735
21736
        finishFunctionDeclaration: function (id, params, defaults, body) {
21737
            this.type = Syntax.FunctionDeclaration;
21738
            this.id = id;
21739
            this.params = params;
21740
            this.defaults = defaults;
21741
            this.body = body;
21742
            this.generator = false;
21743
            this.expression = false;
21744
            this.finish();
21745
            return this;
21746
        },
21747
21748
        finishFunctionExpression: function (id, params, defaults, body) {
21749
            this.type = Syntax.FunctionExpression;
21750
            this.id = id;
21751
            this.params = params;
21752
            this.defaults = defaults;
21753
            this.body = body;
21754
            this.generator = false;
21755
            this.expression = false;
21756
            this.finish();
21757
            return this;
21758
        },
21759
21760
        finishIdentifier: function (name) {
21761
            this.type = Syntax.Identifier;
21762
            this.name = name;
21763
            this.finish();
21764
            return this;
21765
        },
21766
21767
        finishIfStatement: function (test, consequent, alternate) {
21768
            this.type = Syntax.IfStatement;
21769
            this.test = test;
21770
            this.consequent = consequent;
21771
            this.alternate = alternate;
21772
            this.finish();
21773
            return this;
21774
        },
21775
21776
        finishLabeledStatement: function (label, body) {
21777
            this.type = Syntax.LabeledStatement;
21778
            this.label = label;
21779
            this.body = body;
21780
            this.finish();
21781
            return this;
21782
        },
21783
21784
        finishLiteral: function (token) {
21785
            this.type = Syntax.Literal;
21786
            this.value = token.value;
21787
            this.raw = source.slice(token.start, token.end);
21788
            if (token.regex) {
21789
                this.regex = token.regex;
21790
            }
21791
            this.finish();
21792
            return this;
21793
        },
21794
21795
        finishMemberExpression: function (accessor, object, property) {
21796
            this.type = Syntax.MemberExpression;
21797
            this.computed = accessor === '[';
21798
            this.object = object;
21799
            this.property = property;
21800
            this.finish();
21801
            return this;
21802
        },
21803
21804
        finishNewExpression: function (callee, args) {
21805
            this.type = Syntax.NewExpression;
21806
            this.callee = callee;
21807
            this.arguments = args;
21808
            this.finish();
21809
            return this;
21810
        },
21811
21812
        finishObjectExpression: function (properties) {
21813
            this.type = Syntax.ObjectExpression;
21814
            this.properties = properties;
21815
            this.finish();
21816
            return this;
21817
        },
21818
21819
        finishObjectPattern: function (properties) {
21820
            this.type = Syntax.ObjectPattern;
21821
            this.properties = properties;
21822
            this.finish();
21823
            return this;
21824
        },
21825
21826
        finishPostfixExpression: function (operator, argument) {
21827
            this.type = Syntax.UpdateExpression;
21828
            this.operator = operator;
21829
            this.argument = argument;
21830
            this.prefix = false;
21831
            this.finish();
21832
            return this;
21833
        },
21834
21835
        finishProgram: function (body) {
21836
            this.type = Syntax.Program;
21837
            this.body = body;
21838
            if (sourceType === 'module') {
21839
                // very restrictive for now
21840
                this.sourceType = sourceType;
21841
            }
21842
            this.finish();
21843
            return this;
21844
        },
21845
21846
        finishProperty: function (kind, key, computed, value, method, shorthand) {
21847
            this.type = Syntax.Property;
21848
            this.key = key;
21849
            this.computed = computed;
21850
            this.value = value;
21851
            this.kind = kind;
21852
            this.method = method;
21853
            this.shorthand = shorthand;
21854
            this.finish();
21855
            return this;
21856
        },
21857
21858
        finishRestElement: function (argument) {
21859
            this.type = Syntax.RestElement;
21860
            this.argument = argument;
21861
            this.finish();
21862
            return this;
21863
        },
21864
21865
        finishReturnStatement: function (argument) {
21866
            this.type = Syntax.ReturnStatement;
21867
            this.argument = argument;
21868
            this.finish();
21869
            return this;
21870
        },
21871
21872
        finishSequenceExpression: function (expressions) {
21873
            this.type = Syntax.SequenceExpression;
21874
            this.expressions = expressions;
21875
            this.finish();
21876
            return this;
21877
        },
21878
21879
        finishSpreadElement: function (argument) {
21880
            this.type = Syntax.SpreadElement;
21881
            this.argument = argument;
21882
            this.finish();
21883
            return this;
21884
        },
21885
21886
        finishSwitchCase: function (test, consequent) {
21887
            this.type = Syntax.SwitchCase;
21888
            this.test = test;
21889
            this.consequent = consequent;
21890
            this.finish();
21891
            return this;
21892
        },
21893
21894
        finishSuper: function () {
21895
            this.type = Syntax.Super;
21896
            this.finish();
21897
            return this;
21898
        },
21899
21900
        finishSwitchStatement: function (discriminant, cases) {
21901
            this.type = Syntax.SwitchStatement;
21902
            this.discriminant = discriminant;
21903
            this.cases = cases;
21904
            this.finish();
21905
            return this;
21906
        },
21907
21908
        finishTaggedTemplateExpression: function (tag, quasi) {
21909
            this.type = Syntax.TaggedTemplateExpression;
21910
            this.tag = tag;
21911
            this.quasi = quasi;
21912
            this.finish();
21913
            return this;
21914
        },
21915
21916
        finishTemplateElement: function (value, tail) {
21917
            this.type = Syntax.TemplateElement;
21918
            this.value = value;
21919
            this.tail = tail;
21920
            this.finish();
21921
            return this;
21922
        },
21923
21924
        finishTemplateLiteral: function (quasis, expressions) {
21925
            this.type = Syntax.TemplateLiteral;
21926
            this.quasis = quasis;
21927
            this.expressions = expressions;
21928
            this.finish();
21929
            return this;
21930
        },
21931
21932
        finishThisExpression: function () {
21933
            this.type = Syntax.ThisExpression;
21934
            this.finish();
21935
            return this;
21936
        },
21937
21938
        finishThrowStatement: function (argument) {
21939
            this.type = Syntax.ThrowStatement;
21940
            this.argument = argument;
21941
            this.finish();
21942
            return this;
21943
        },
21944
21945
        finishTryStatement: function (block, handler, finalizer) {
21946
            this.type = Syntax.TryStatement;
21947
            this.block = block;
21948
            this.guardedHandlers = [];
21949
            this.handlers = handler ? [ handler ] : [];
21950
            this.handler = handler;
21951
            this.finalizer = finalizer;
21952
            this.finish();
21953
            return this;
21954
        },
21955
21956
        finishUnaryExpression: function (operator, argument) {
21957
            this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression;
21958
            this.operator = operator;
21959
            this.argument = argument;
21960
            this.prefix = true;
21961
            this.finish();
21962
            return this;
21963
        },
21964
21965
        finishVariableDeclaration: function (declarations) {
21966
            this.type = Syntax.VariableDeclaration;
21967
            this.declarations = declarations;
21968
            this.kind = 'var';
21969
            this.finish();
21970
            return this;
21971
        },
21972
21973
        finishLexicalDeclaration: function (declarations, kind) {
21974
            this.type = Syntax.VariableDeclaration;
21975
            this.declarations = declarations;
21976
            this.kind = kind;
21977
            this.finish();
21978
            return this;
21979
        },
21980
21981
        finishVariableDeclarator: function (id, init) {
21982
            this.type = Syntax.VariableDeclarator;
21983
            this.id = id;
21984
            this.init = init;
21985
            this.finish();
21986
            return this;
21987
        },
21988
21989
        finishWhileStatement: function (test, body) {
21990
            this.type = Syntax.WhileStatement;
21991
            this.test = test;
21992
            this.body = body;
21993
            this.finish();
21994
            return this;
21995
        },
21996
21997
        finishWithStatement: function (object, body) {
21998
            this.type = Syntax.WithStatement;
21999
            this.object = object;
22000
            this.body = body;
22001
            this.finish();
22002
            return this;
22003
        },
22004
22005
        finishExportSpecifier: function (local, exported) {
22006
            this.type = Syntax.ExportSpecifier;
22007
            this.exported = exported || local;
22008
            this.local = local;
22009
            this.finish();
22010
            return this;
22011
        },
22012
22013
        finishImportDefaultSpecifier: function (local) {
22014
            this.type = Syntax.ImportDefaultSpecifier;
22015
            this.local = local;
22016
            this.finish();
22017
            return this;
22018
        },
22019
22020
        finishImportNamespaceSpecifier: function (local) {
22021
            this.type = Syntax.ImportNamespaceSpecifier;
22022
            this.local = local;
22023
            this.finish();
22024
            return this;
22025
        },
22026
22027
        finishExportNamedDeclaration: function (declaration, specifiers, src) {
22028
            this.type = Syntax.ExportNamedDeclaration;
22029
            this.declaration = declaration;
22030
            this.specifiers = specifiers;
22031
            this.source = src;
22032
            this.finish();
22033
            return this;
22034
        },
22035
22036
        finishExportDefaultDeclaration: function (declaration) {
22037
            this.type = Syntax.ExportDefaultDeclaration;
22038
            this.declaration = declaration;
22039
            this.finish();
22040
            return this;
22041
        },
22042
22043
        finishExportAllDeclaration: function (src) {
22044
            this.type = Syntax.ExportAllDeclaration;
22045
            this.source = src;
22046
            this.finish();
22047
            return this;
22048
        },
22049
22050
        finishImportSpecifier: function (local, imported) {
22051
            this.type = Syntax.ImportSpecifier;
22052
            this.local = local || imported;
22053
            this.imported = imported;
22054
            this.finish();
22055
            return this;
22056
        },
22057
22058
        finishImportDeclaration: function (specifiers, src) {
22059
            this.type = Syntax.ImportDeclaration;
22060
            this.specifiers = specifiers;
22061
            this.source = src;
22062
            this.finish();
22063
            return this;
22064
        }
22065
    };
22066
22067
22068
    function recordError(error) {
22069
        var e, existing;
22070
22071
        for (e = 0; e < extra.errors.length; e++) {
22072
            existing = extra.errors[e];
22073
            // Prevent duplicated error.
22074
            /* istanbul ignore next */
22075
            if (existing.index === error.index && existing.message === error.message) {
22076
                return;
22077
            }
22078
        }
22079
22080
        extra.errors.push(error);
22081
    }
22082
22083
    function createError(line, pos, description) {
22084
        var error = new Error('Line ' + line + ': ' + description);
22085
        error.index = pos;
22086
        error.lineNumber = line;
22087
        error.column = pos - (scanning ? lineStart : lastLineStart) + 1;
22088
        error.description = description;
22089
        return error;
22090
    }
22091
22092
    // Throw an exception
22093
22094
    function throwError(messageFormat) {
22095
        var args, msg;
22096
22097
        args = Array.prototype.slice.call(arguments, 1);
22098
        msg = messageFormat.replace(/%(\d)/g,
22099
            function (whole, idx) {
22100
                assert(idx < args.length, 'Message reference must be in range');
22101
                return args[idx];
22102
            }
22103
        );
22104
22105
        throw createError(lastLineNumber, lastIndex, msg);
22106
    }
22107
22108
    function tolerateError(messageFormat) {
22109
        var args, msg, error;
22110
22111
        args = Array.prototype.slice.call(arguments, 1);
22112
        /* istanbul ignore next */
22113
        msg = messageFormat.replace(/%(\d)/g,
22114
            function (whole, idx) {
22115
                assert(idx < args.length, 'Message reference must be in range');
22116
                return args[idx];
22117
            }
22118
        );
22119
22120
        error = createError(lineNumber, lastIndex, msg);
22121
        if (extra.errors) {
22122
            recordError(error);
22123
        } else {
22124
            throw error;
22125
        }
22126
    }
22127
22128
    // Throw an exception because of the token.
22129
22130
    function unexpectedTokenError(token, message) {
22131
        var value, msg = message || Messages.UnexpectedToken;
22132
22133
        if (token) {
22134
            if (!message) {
22135
                msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :
22136
                    (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :
22137
                    (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :
22138
                    (token.type === Token.StringLiteral) ? Messages.UnexpectedString :
22139
                    (token.type === Token.Template) ? Messages.UnexpectedTemplate :
22140
                    Messages.UnexpectedToken;
22141
22142
                if (token.type === Token.Keyword) {
22143
                    if (isFutureReservedWord(token.value)) {
22144
                        msg = Messages.UnexpectedReserved;
22145
                    } else if (strict && isStrictModeReservedWord(token.value)) {
22146
                        msg = Messages.StrictReservedWord;
22147
                    }
22148
                }
22149
            }
22150
22151
            value = (token.type === Token.Template) ? token.value.raw : token.value;
22152
        } else {
22153
            value = 'ILLEGAL';
22154
        }
22155
22156
        msg = msg.replace('%0', value);
22157
22158
        return (token && typeof token.lineNumber === 'number') ?
22159
            createError(token.lineNumber, token.start, msg) :
22160
            createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);
22161
    }
22162
22163
    function throwUnexpectedToken(token, message) {
22164
        throw unexpectedTokenError(token, message);
22165
    }
22166
22167
    function tolerateUnexpectedToken(token, message) {
22168
        var error = unexpectedTokenError(token, message);
22169
        if (extra.errors) {
22170
            recordError(error);
22171
        } else {
22172
            throw error;
22173
        }
22174
    }
22175
22176
    // Expect the next token to match the specified punctuator.
22177
    // If not, an exception will be thrown.
22178
22179
    function expect(value) {
22180
        var token = lex();
22181
        if (token.type !== Token.Punctuator || token.value !== value) {
22182
            throwUnexpectedToken(token);
22183
        }
22184
    }
22185
22186
    /**
22187
     * @name expectCommaSeparator
22188
     * @description Quietly expect a comma when in tolerant mode, otherwise delegates
22189
     * to <code>expect(value)</code>
22190
     * @since 2.0
22191
     */
22192
    function expectCommaSeparator() {
22193
        var token;
22194
22195
        if (extra.errors) {
22196
            token = lookahead;
22197
            if (token.type === Token.Punctuator && token.value === ',') {
22198
                lex();
22199
            } else if (token.type === Token.Punctuator && token.value === ';') {
22200
                lex();
22201
                tolerateUnexpectedToken(token);
22202
            } else {
22203
                tolerateUnexpectedToken(token, Messages.UnexpectedToken);
22204
            }
22205
        } else {
22206
            expect(',');
22207
        }
22208
    }
22209
22210
    // Expect the next token to match the specified keyword.
22211
    // If not, an exception will be thrown.
22212
22213
    function expectKeyword(keyword) {
22214
        var token = lex();
22215
        if (token.type !== Token.Keyword || token.value !== keyword) {
22216
            throwUnexpectedToken(token);
22217
        }
22218
    }
22219
22220
    // Return true if the next token matches the specified punctuator.
22221
22222
    function match(value) {
22223
        return lookahead.type === Token.Punctuator && lookahead.value === value;
22224
    }
22225
22226
    // Return true if the next token matches the specified keyword
22227
22228
    function matchKeyword(keyword) {
22229
        return lookahead.type === Token.Keyword && lookahead.value === keyword;
22230
    }
22231
22232
    // Return true if the next token matches the specified contextual keyword
22233
    // (where an identifier is sometimes a keyword depending on the context)
22234
22235
    function matchContextualKeyword(keyword) {
22236
        return lookahead.type === Token.Identifier && lookahead.value === keyword;
22237
    }
22238
22239
    // Return true if the next token is an assignment operator
22240
22241
    function matchAssign() {
22242
        var op;
22243
22244
        if (lookahead.type !== Token.Punctuator) {
22245
            return false;
22246
        }
22247
        op = lookahead.value;
22248
        return op === '=' ||
22249
            op === '*=' ||
22250
            op === '/=' ||
22251
            op === '%=' ||
22252
            op === '+=' ||
22253
            op === '-=' ||
22254
            op === '<<=' ||
22255
            op === '>>=' ||
22256
            op === '>>>=' ||
22257
            op === '&=' ||
22258
            op === '^=' ||
22259
            op === '|=';
22260
    }
22261
22262
    function consumeSemicolon() {
22263
        // Catch the very common case first: immediately a semicolon (U+003B).
22264
        if (source.charCodeAt(startIndex) === 0x3B || match(';')) {
22265
            lex();
22266
            return;
22267
        }
22268
22269
        if (hasLineTerminator) {
22270
            return;
22271
        }
22272
22273
        // FIXME(ikarienator): this is seemingly an issue in the previous location info convention.
22274
        lastIndex = startIndex;
22275
        lastLineNumber = startLineNumber;
22276
        lastLineStart = startLineStart;
22277
22278
        if (lookahead.type !== Token.EOF && !match('}')) {
22279
            throwUnexpectedToken(lookahead);
22280
        }
22281
    }
22282
22283
    // Cover grammar support.
22284
    //
22285
    // When an assignment expression position starts with an left parenthesis, the determination of the type
22286
    // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
22287
    // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
22288
    //
22289
    // There are three productions that can be parsed in a parentheses pair that needs to be determined
22290
    // after the outermost pair is closed. They are:
22291
    //
22292
    //   1. AssignmentExpression
22293
    //   2. BindingElements
22294
    //   3. AssignmentTargets
22295
    //
22296
    // In order to avoid exponential backtracking, we use two flags to denote if the production can be
22297
    // binding element or assignment target.
22298
    //
22299
    // The three productions have the relationship:
22300
    //
22301
    //   BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
22302
    //
22303
    // with a single exception that CoverInitializedName when used directly in an Expression, generates
22304
    // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
22305
    // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
22306
    //
22307
    // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
22308
    // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
22309
    // the CoverInitializedName check is conducted.
22310
    //
22311
    // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
22312
    // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
22313
    // pattern. The CoverInitializedName check is deferred.
22314
    function isolateCoverGrammar(parser) {
22315
        var oldIsBindingElement = isBindingElement,
22316
            oldIsAssignmentTarget = isAssignmentTarget,
22317
            oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
22318
            result;
22319
        isBindingElement = true;
22320
        isAssignmentTarget = true;
22321
        firstCoverInitializedNameError = null;
22322
        result = parser();
22323
        if (firstCoverInitializedNameError !== null) {
22324
            throwUnexpectedToken(firstCoverInitializedNameError);
22325
        }
22326
        isBindingElement = oldIsBindingElement;
22327
        isAssignmentTarget = oldIsAssignmentTarget;
22328
        firstCoverInitializedNameError = oldFirstCoverInitializedNameError;
22329
        return result;
22330
    }
22331
22332
    function inheritCoverGrammar(parser) {
22333
        var oldIsBindingElement = isBindingElement,
22334
            oldIsAssignmentTarget = isAssignmentTarget,
22335
            oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
22336
            result;
22337
        isBindingElement = true;
22338
        isAssignmentTarget = true;
22339
        firstCoverInitializedNameError = null;
22340
        result = parser();
22341
        isBindingElement = isBindingElement && oldIsBindingElement;
22342
        isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget;
22343
        firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError;
22344
        return result;
22345
    }
22346
22347
    function parseArrayPattern() {
22348
        var node = new Node(), elements = [], rest, restNode;
22349
        expect('[');
22350
22351
        while (!match(']')) {
22352
            if (match(',')) {
22353
                lex();
22354
                elements.push(null);
22355
            } else {
22356
                if (match('...')) {
22357
                    restNode = new Node();
22358
                    lex();
22359
                    rest = parseVariableIdentifier();
22360
                    elements.push(restNode.finishRestElement(rest));
22361
                    break;
22362
                } else {
22363
                    elements.push(parsePatternWithDefault());
22364
                }
22365
                if (!match(']')) {
22366
                    expect(',');
22367
                }
22368
            }
22369
22370
        }
22371
22372
        expect(']');
22373
22374
        return node.finishArrayPattern(elements);
22375
    }
22376
22377
    function parsePropertyPattern() {
22378
        var node = new Node(), key, computed = match('['), init;
22379
        if (lookahead.type === Token.Identifier) {
22380
            key = parseVariableIdentifier();
22381
            if (match('=')) {
22382
                lex();
22383
                init = parseAssignmentExpression();
22384
                return node.finishProperty(
22385
                    'init', key, false,
22386
                    new WrappingNode(key).finishAssignmentPattern(key, init), false, false);
22387
            } else if (!match(':')) {
22388
                return node.finishProperty('init', key, false, key, false, true);
22389
            }
22390
        } else {
22391
            key = parseObjectPropertyKey();
22392
        }
22393
        expect(':');
22394
        init = parsePatternWithDefault();
22395
        return node.finishProperty('init', key, computed, init, false, false);
22396
    }
22397
22398
    function parseObjectPattern() {
22399
        var node = new Node(), properties = [];
22400
22401
        expect('{');
22402
22403
        while (!match('}')) {
22404
            properties.push(parsePropertyPattern());
22405
            if (!match('}')) {
22406
                expect(',');
22407
            }
22408
        }
22409
22410
        lex();
22411
22412
        return node.finishObjectPattern(properties);
22413
    }
22414
22415
    function parsePattern() {
22416
        if (lookahead.type === Token.Identifier) {
22417
            return parseVariableIdentifier();
22418
        } else if (match('[')) {
22419
            return parseArrayPattern();
22420
        } else if (match('{')) {
22421
            return parseObjectPattern();
22422
        }
22423
        throwUnexpectedToken(lookahead);
22424
    }
22425
22426
    function parsePatternWithDefault() {
22427
        var startToken = lookahead, pattern, right;
22428
        pattern = parsePattern();
22429
        if (match('=')) {
22430
            lex();
22431
            right = isolateCoverGrammar(parseAssignmentExpression);
22432
            pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right);
22433
        }
22434
        return pattern;
22435
    }
22436
22437
    // 11.1.4 Array Initialiser
22438
22439
    function parseArrayInitialiser() {
22440
        var elements = [], node = new Node(), restSpread;
22441
22442
        expect('[');
22443
22444
        while (!match(']')) {
22445
            if (match(',')) {
22446
                lex();
22447
                elements.push(null);
22448
            } else if (match('...')) {
22449
                restSpread = new Node();
22450
                lex();
22451
                restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));
22452
22453
                if (!match(']')) {
22454
                    isAssignmentTarget = isBindingElement = false;
22455
                    expect(',');
22456
                }
22457
                elements.push(restSpread);
22458
            } else {
22459
                elements.push(inheritCoverGrammar(parseAssignmentExpression));
22460
22461
                if (!match(']')) {
22462
                    expect(',');
22463
                }
22464
            }
22465
        }
22466
22467
        lex();
22468
22469
        return node.finishArrayExpression(elements);
22470
    }
22471
22472
    // 11.1.5 Object Initialiser
22473
22474
    function parsePropertyFunction(node, paramInfo) {
22475
        var previousStrict, body;
22476
22477
        isAssignmentTarget = isBindingElement = false;
22478
22479
        previousStrict = strict;
22480
        body = isolateCoverGrammar(parseFunctionSourceElements);
22481
22482
        if (strict && paramInfo.firstRestricted) {
22483
            tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);
22484
        }
22485
        if (strict && paramInfo.stricted) {
22486
            tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);
22487
        }
22488
22489
        strict = previousStrict;
22490
        return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body);
22491
    }
22492
22493
    function parsePropertyMethodFunction() {
22494
        var params, method, node = new Node();
22495
22496
        params = parseParams();
22497
        method = parsePropertyFunction(node, params);
22498
22499
        return method;
22500
    }
22501
22502
    function parseObjectPropertyKey() {
22503
        var token, node = new Node(), expr;
22504
22505
        token = lex();
22506
22507
        // Note: This function is called only from parseObjectProperty(), where
22508
        // EOF and Punctuator tokens are already filtered out.
22509
22510
        switch (token.type) {
22511
        case Token.StringLiteral:
22512
        case Token.NumericLiteral:
22513
            if (strict && token.octal) {
22514
                tolerateUnexpectedToken(token, Messages.StrictOctalLiteral);
22515
            }
22516
            return node.finishLiteral(token);
22517
        case Token.Identifier:
22518
        case Token.BooleanLiteral:
22519
        case Token.NullLiteral:
22520
        case Token.Keyword:
22521
            return node.finishIdentifier(token.value);
22522
        case Token.Punctuator:
22523
            if (token.value === '[') {
22524
                expr = isolateCoverGrammar(parseAssignmentExpression);
22525
                expect(']');
22526
                return expr;
22527
            }
22528
            break;
22529
        }
22530
        throwUnexpectedToken(token);
22531
    }
22532
22533
    function lookaheadPropertyName() {
22534
        switch (lookahead.type) {
22535
        case Token.Identifier:
22536
        case Token.StringLiteral:
22537
        case Token.BooleanLiteral:
22538
        case Token.NullLiteral:
22539
        case Token.NumericLiteral:
22540
        case Token.Keyword:
22541
            return true;
22542
        case Token.Punctuator:
22543
            return lookahead.value === '[';
22544
        }
22545
        return false;
22546
    }
22547
22548
    // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals,
22549
    // it might be called at a position where there is in fact a short hand identifier pattern or a data property.
22550
    // This can only be determined after we consumed up to the left parentheses.
22551
    //
22552
    // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller
22553
    // is responsible to visit other options.
22554
    function tryParseMethodDefinition(token, key, computed, node) {
22555
        var value, options, methodNode;
22556
22557
        if (token.type === Token.Identifier) {
22558
            // check for `get` and `set`;
22559
22560
            if (token.value === 'get' && lookaheadPropertyName()) {
22561
                computed = match('[');
22562
                key = parseObjectPropertyKey();
22563
                methodNode = new Node();
22564
                expect('(');
22565
                expect(')');
22566
                value = parsePropertyFunction(methodNode, {
22567
                    params: [],
22568
                    defaults: [],
22569
                    stricted: null,
22570
                    firstRestricted: null,
22571
                    message: null
22572
                });
22573
                return node.finishProperty('get', key, computed, value, false, false);
22574
            } else if (token.value === 'set' && lookaheadPropertyName()) {
22575
                computed = match('[');
22576
                key = parseObjectPropertyKey();
22577
                methodNode = new Node();
22578
                expect('(');
22579
22580
                options = {
22581
                    params: [],
22582
                    defaultCount: 0,
22583
                    defaults: [],
22584
                    firstRestricted: null,
22585
                    paramSet: {}
22586
                };
22587
                if (match(')')) {
22588
                    tolerateUnexpectedToken(lookahead);
22589
                } else {
22590
                    parseParam(options);
22591
                    if (options.defaultCount === 0) {
22592
                        options.defaults = [];
22593
                    }
22594
                }
22595
                expect(')');
22596
22597
                value = parsePropertyFunction(methodNode, options);
22598
                return node.finishProperty('set', key, computed, value, false, false);
22599
            }
22600
        }
22601
22602
        if (match('(')) {
22603
            value = parsePropertyMethodFunction();
22604
            return node.finishProperty('init', key, computed, value, true, false);
22605
        }
22606
22607
        // Not a MethodDefinition.
22608
        return null;
22609
    }
22610
22611
    function checkProto(key, computed, hasProto) {
22612
        if (computed === false && (key.type === Syntax.Identifier && key.name === '__proto__' ||
22613
            key.type === Syntax.Literal && key.value === '__proto__')) {
22614
            if (hasProto.value) {
22615
                tolerateError(Messages.DuplicateProtoProperty);
22616
            } else {
22617
                hasProto.value = true;
22618
            }
22619
        }
22620
    }
22621
22622
    function parseObjectProperty(hasProto) {
22623
        var token = lookahead, node = new Node(), computed, key, maybeMethod, value;
22624
22625
        computed = match('[');
22626
        key = parseObjectPropertyKey();
22627
        maybeMethod = tryParseMethodDefinition(token, key, computed, node);
22628
22629
        if (maybeMethod) {
22630
            checkProto(maybeMethod.key, maybeMethod.computed, hasProto);
22631
            // finished
22632
            return maybeMethod;
22633
        }
22634
22635
        // init property or short hand property.
22636
        checkProto(key, computed, hasProto);
22637
22638
        if (match(':')) {
22639
            lex();
22640
            value = inheritCoverGrammar(parseAssignmentExpression);
22641
            return node.finishProperty('init', key, computed, value, false, false);
22642
        }
22643
22644
        if (token.type === Token.Identifier) {
22645
            if (match('=')) {
22646
                firstCoverInitializedNameError = lookahead;
22647
                lex();
22648
                value = isolateCoverGrammar(parseAssignmentExpression);
22649
                return node.finishProperty('init', key, computed,
22650
                    new WrappingNode(token).finishAssignmentPattern(key, value), false, true);
22651
            }
22652
            return node.finishProperty('init', key, computed, key, false, true);
22653
        }
22654
22655
        throwUnexpectedToken(lookahead);
22656
    }
22657
22658
    function parseObjectInitialiser() {
22659
        var properties = [], hasProto = {value: false}, node = new Node();
22660
22661
        expect('{');
22662
22663
        while (!match('}')) {
22664
            properties.push(parseObjectProperty(hasProto));
22665
22666
            if (!match('}')) {
22667
                expectCommaSeparator();
22668
            }
22669
        }
22670
22671
        expect('}');
22672
22673
        return node.finishObjectExpression(properties);
22674
    }
22675
22676
    function reinterpretExpressionAsPattern(expr) {
22677
        var i;
22678
        switch (expr.type) {
22679
        case Syntax.Identifier:
22680
        case Syntax.MemberExpression:
22681
        case Syntax.RestElement:
22682
        case Syntax.AssignmentPattern:
22683
            break;
22684
        case Syntax.SpreadElement:
22685
            expr.type = Syntax.RestElement;
22686
            reinterpretExpressionAsPattern(expr.argument);
22687
            break;
22688
        case Syntax.ArrayExpression:
22689
            expr.type = Syntax.ArrayPattern;
22690
            for (i = 0; i < expr.elements.length; i++) {
22691
                if (expr.elements[i] !== null) {
22692
                    reinterpretExpressionAsPattern(expr.elements[i]);
22693
                }
22694
            }
22695
            break;
22696
        case Syntax.ObjectExpression:
22697
            expr.type = Syntax.ObjectPattern;
22698
            for (i = 0; i < expr.properties.length; i++) {
22699
                reinterpretExpressionAsPattern(expr.properties[i].value);
22700
            }
22701
            break;
22702
        case Syntax.AssignmentExpression:
22703
            expr.type = Syntax.AssignmentPattern;
22704
            reinterpretExpressionAsPattern(expr.left);
22705
            break;
22706
        default:
22707
            // Allow other node type for tolerant parsing.
22708
            break;
22709
        }
22710
    }
22711
22712
    function parseTemplateElement(option) {
22713
        var node, token;
22714
22715
        if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
22716
            throwUnexpectedToken();
22717
        }
22718
22719
        node = new Node();
22720
        token = lex();
22721
22722
        return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
22723
    }
22724
22725
    function parseTemplateLiteral() {
22726
        var quasi, quasis, expressions, node = new Node();
22727
22728
        quasi = parseTemplateElement({ head: true });
22729
        quasis = [ quasi ];
22730
        expressions = [];
22731
22732
        while (!quasi.tail) {
22733
            expressions.push(parseExpression());
22734
            quasi = parseTemplateElement({ head: false });
22735
            quasis.push(quasi);
22736
        }
22737
22738
        return node.finishTemplateLiteral(quasis, expressions);
22739
    }
22740
22741
    // 11.1.6 The Grouping Operator
22742
22743
    function parseGroupExpression() {
22744
        var expr, expressions, startToken, i;
22745
22746
        expect('(');
22747
22748
        if (match(')')) {
22749
            lex();
22750
            if (!match('=>')) {
22751
                expect('=>');
22752
            }
22753
            return {
22754
                type: PlaceHolders.ArrowParameterPlaceHolder,
22755
                params: []
22756
            };
22757
        }
22758
22759
        startToken = lookahead;
22760
        if (match('...')) {
22761
            expr = parseRestElement();
22762
            expect(')');
22763
            if (!match('=>')) {
22764
                expect('=>');
22765
            }
22766
            return {
22767
                type: PlaceHolders.ArrowParameterPlaceHolder,
22768
                params: [expr]
22769
            };
22770
        }
22771
22772
        isBindingElement = true;
22773
        expr = inheritCoverGrammar(parseAssignmentExpression);
22774
22775
        if (match(',')) {
22776
            isAssignmentTarget = false;
22777
            expressions = [expr];
22778
22779
            while (startIndex < length) {
22780
                if (!match(',')) {
22781
                    break;
22782
                }
22783
                lex();
22784
22785
                if (match('...')) {
22786
                    if (!isBindingElement) {
22787
                        throwUnexpectedToken(lookahead);
22788
                    }
22789
                    expressions.push(parseRestElement());
22790
                    expect(')');
22791
                    if (!match('=>')) {
22792
                        expect('=>');
22793
                    }
22794
                    isBindingElement = false;
22795
                    for (i = 0; i < expressions.length; i++) {
22796
                        reinterpretExpressionAsPattern(expressions[i]);
22797
                    }
22798
                    return {
22799
                        type: PlaceHolders.ArrowParameterPlaceHolder,
22800
                        params: expressions
22801
                    };
22802
                }
22803
22804
                expressions.push(inheritCoverGrammar(parseAssignmentExpression));
22805
            }
22806
22807
            expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
22808
        }
22809
22810
22811
        expect(')');
22812
22813
        if (match('=>')) {
22814
            if (!isBindingElement) {
22815
                throwUnexpectedToken(lookahead);
22816
            }
22817
22818
            if (expr.type === Syntax.SequenceExpression) {
22819
                for (i = 0; i < expr.expressions.length; i++) {
22820
                    reinterpretExpressionAsPattern(expr.expressions[i]);
22821
                }
22822
            } else {
22823
                reinterpretExpressionAsPattern(expr);
22824
            }
22825
22826
            expr = {
22827
                type: PlaceHolders.ArrowParameterPlaceHolder,
22828
                params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
22829
            };
22830
        }
22831
        isBindingElement = false;
22832
        return expr;
22833
    }
22834
22835
22836
    // 11.1 Primary Expressions
22837
22838
    function parsePrimaryExpression() {
22839
        var type, token, expr, node;
22840
22841
        if (match('(')) {
22842
            isBindingElement = false;
22843
            return inheritCoverGrammar(parseGroupExpression);
22844
        }
22845
22846
        if (match('[')) {
22847
            return inheritCoverGrammar(parseArrayInitialiser);
22848
        }
22849
22850
        if (match('{')) {
22851
            return inheritCoverGrammar(parseObjectInitialiser);
22852
        }
22853
22854
        type = lookahead.type;
22855
        node = new Node();
22856
22857
        if (type === Token.Identifier) {
22858
            expr = node.finishIdentifier(lex().value);
22859
        } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
22860
            isAssignmentTarget = isBindingElement = false;
22861
            if (strict && lookahead.octal) {
22862
                tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);
22863
            }
22864
            expr = node.finishLiteral(lex());
22865
        } else if (type === Token.Keyword) {
22866
            isAssignmentTarget = isBindingElement = false;
22867
            if (matchKeyword('function')) {
22868
                return parseFunctionExpression();
22869
            }
22870
            if (matchKeyword('this')) {
22871
                lex();
22872
                return node.finishThisExpression();
22873
            }
22874
            if (matchKeyword('class')) {
22875
                return parseClassExpression();
22876
            }
22877
            throwUnexpectedToken(lex());
22878
        } else if (type === Token.BooleanLiteral) {
22879
            isAssignmentTarget = isBindingElement = false;
22880
            token = lex();
22881
            token.value = (token.value === 'true');
22882
            expr = node.finishLiteral(token);
22883
        } else if (type === Token.NullLiteral) {
22884
            isAssignmentTarget = isBindingElement = false;
22885
            token = lex();
22886
            token.value = null;
22887
            expr = node.finishLiteral(token);
22888
        } else if (match('/') || match('/=')) {
22889
            isAssignmentTarget = isBindingElement = false;
22890
            index = startIndex;
22891
22892
            if (typeof extra.tokens !== 'undefined') {
22893
                token = collectRegex();
22894
            } else {
22895
                token = scanRegExp();
22896
            }
22897
            lex();
22898
            expr = node.finishLiteral(token);
22899
        } else if (type === Token.Template) {
22900
            expr = parseTemplateLiteral();
22901
        } else {
22902
            throwUnexpectedToken(lex());
22903
        }
22904
22905
        return expr;
22906
    }
22907
22908
    // 11.2 Left-Hand-Side Expressions
22909
22910
    function parseArguments() {
22911
        var args = [];
22912
22913
        expect('(');
22914
22915
        if (!match(')')) {
22916
            while (startIndex < length) {
22917
                args.push(isolateCoverGrammar(parseAssignmentExpression));
22918
                if (match(')')) {
22919
                    break;
22920
                }
22921
                expectCommaSeparator();
22922
            }
22923
        }
22924
22925
        expect(')');
22926
22927
        return args;
22928
    }
22929
22930
    function parseNonComputedProperty() {
22931
        var token, node = new Node();
22932
22933
        token = lex();
22934
22935
        if (!isIdentifierName(token)) {
22936
            throwUnexpectedToken(token);
22937
        }
22938
22939
        return node.finishIdentifier(token.value);
22940
    }
22941
22942
    function parseNonComputedMember() {
22943
        expect('.');
22944
22945
        return parseNonComputedProperty();
22946
    }
22947
22948
    function parseComputedMember() {
22949
        var expr;
22950
22951
        expect('[');
22952
22953
        expr = isolateCoverGrammar(parseExpression);
22954
22955
        expect(']');
22956
22957
        return expr;
22958
    }
22959
22960
    function parseNewExpression() {
22961
        var callee, args, node = new Node();
22962
22963
        expectKeyword('new');
22964
        callee = isolateCoverGrammar(parseLeftHandSideExpression);
22965
        args = match('(') ? parseArguments() : [];
22966
22967
        isAssignmentTarget = isBindingElement = false;
22968
22969
        return node.finishNewExpression(callee, args);
22970
    }
22971
22972
    function parseLeftHandSideExpressionAllowCall() {
22973
        var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
22974
22975
        startToken = lookahead;
22976
        state.allowIn = true;
22977
22978
        if (matchKeyword('super') && state.inFunctionBody) {
22979
            expr = new Node();
22980
            lex();
22981
            expr = expr.finishSuper();
22982
            if (!match('(') && !match('.') && !match('[')) {
22983
                throwUnexpectedToken(lookahead);
22984
            }
22985
        } else {
22986
            expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
22987
        }
22988
22989
        for (;;) {
22990
            if (match('.')) {
22991
                isBindingElement = false;
22992
                isAssignmentTarget = true;
22993
                property = parseNonComputedMember();
22994
                expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
22995
            } else if (match('(')) {
22996
                isBindingElement = false;
22997
                isAssignmentTarget = false;
22998
                args = parseArguments();
22999
                expr = new WrappingNode(startToken).finishCallExpression(expr, args);
23000
            } else if (match('[')) {
23001
                isBindingElement = false;
23002
                isAssignmentTarget = true;
23003
                property = parseComputedMember();
23004
                expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
23005
            } else if (lookahead.type === Token.Template && lookahead.head) {
23006
                quasi = parseTemplateLiteral();
23007
                expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
23008
            } else {
23009
                break;
23010
            }
23011
        }
23012
        state.allowIn = previousAllowIn;
23013
23014
        return expr;
23015
    }
23016
23017
    function parseLeftHandSideExpression() {
23018
        var quasi, expr, property, startToken;
23019
        assert(state.allowIn, 'callee of new expression always allow in keyword.');
23020
23021
        startToken = lookahead;
23022
23023
        if (matchKeyword('super') && state.inFunctionBody) {
23024
            expr = new Node();
23025
            lex();
23026
            expr = expr.finishSuper();
23027
            if (!match('[') && !match('.')) {
23028
                throwUnexpectedToken(lookahead);
23029
            }
23030
        } else {
23031
            expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
23032
        }
23033
23034
        for (;;) {
23035
            if (match('[')) {
23036
                isBindingElement = false;
23037
                isAssignmentTarget = true;
23038
                property = parseComputedMember();
23039
                expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
23040
            } else if (match('.')) {
23041
                isBindingElement = false;
23042
                isAssignmentTarget = true;
23043
                property = parseNonComputedMember();
23044
                expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
23045
            } else if (lookahead.type === Token.Template && lookahead.head) {
23046
                quasi = parseTemplateLiteral();
23047
                expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
23048
            } else {
23049
                break;
23050
            }
23051
        }
23052
        return expr;
23053
    }
23054
23055
    // 11.3 Postfix Expressions
23056
23057
    function parsePostfixExpression() {
23058
        var expr, token, startToken = lookahead;
23059
23060
        expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
23061
23062
        if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
23063
            if (match('++') || match('--')) {
23064
                // 11.3.1, 11.3.2
23065
                if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23066
                    tolerateError(Messages.StrictLHSPostfix);
23067
                }
23068
23069
                if (!isAssignmentTarget) {
23070
                    tolerateError(Messages.InvalidLHSInAssignment);
23071
                }
23072
23073
                isAssignmentTarget = isBindingElement = false;
23074
23075
                token = lex();
23076
                expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);
23077
            }
23078
        }
23079
23080
        return expr;
23081
    }
23082
23083
    // 11.4 Unary Operators
23084
23085
    function parseUnaryExpression() {
23086
        var token, expr, startToken;
23087
23088
        if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
23089
            expr = parsePostfixExpression();
23090
        } else if (match('++') || match('--')) {
23091
            startToken = lookahead;
23092
            token = lex();
23093
            expr = inheritCoverGrammar(parseUnaryExpression);
23094
            // 11.4.4, 11.4.5
23095
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23096
                tolerateError(Messages.StrictLHSPrefix);
23097
            }
23098
23099
            if (!isAssignmentTarget) {
23100
                tolerateError(Messages.InvalidLHSInAssignment);
23101
            }
23102
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23103
            isAssignmentTarget = isBindingElement = false;
23104
        } else if (match('+') || match('-') || match('~') || match('!')) {
23105
            startToken = lookahead;
23106
            token = lex();
23107
            expr = inheritCoverGrammar(parseUnaryExpression);
23108
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23109
            isAssignmentTarget = isBindingElement = false;
23110
        } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
23111
            startToken = lookahead;
23112
            token = lex();
23113
            expr = inheritCoverGrammar(parseUnaryExpression);
23114
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
23115
            if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
23116
                tolerateError(Messages.StrictDelete);
23117
            }
23118
            isAssignmentTarget = isBindingElement = false;
23119
        } else {
23120
            expr = parsePostfixExpression();
23121
        }
23122
23123
        return expr;
23124
    }
23125
23126
    function binaryPrecedence(token, allowIn) {
23127
        var prec = 0;
23128
23129
        if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
23130
            return 0;
23131
        }
23132
23133
        switch (token.value) {
23134
        case '||':
23135
            prec = 1;
23136
            break;
23137
23138
        case '&&':
23139
            prec = 2;
23140
            break;
23141
23142
        case '|':
23143
            prec = 3;
23144
            break;
23145
23146
        case '^':
23147
            prec = 4;
23148
            break;
23149
23150
        case '&':
23151
            prec = 5;
23152
            break;
23153
23154
        case '==':
23155
        case '!=':
23156
        case '===':
23157
        case '!==':
23158
            prec = 6;
23159
            break;
23160
23161
        case '<':
23162
        case '>':
23163
        case '<=':
23164
        case '>=':
23165
        case 'instanceof':
23166
            prec = 7;
23167
            break;
23168
23169
        case 'in':
23170
            prec = allowIn ? 7 : 0;
23171
            break;
23172
23173
        case '<<':
23174
        case '>>':
23175
        case '>>>':
23176
            prec = 8;
23177
            break;
23178
23179
        case '+':
23180
        case '-':
23181
            prec = 9;
23182
            break;
23183
23184
        case '*':
23185
        case '/':
23186
        case '%':
23187
            prec = 11;
23188
            break;
23189
23190
        default:
23191
            break;
23192
        }
23193
23194
        return prec;
23195
    }
23196
23197
    // 11.5 Multiplicative Operators
23198
    // 11.6 Additive Operators
23199
    // 11.7 Bitwise Shift Operators
23200
    // 11.8 Relational Operators
23201
    // 11.9 Equality Operators
23202
    // 11.10 Binary Bitwise Operators
23203
    // 11.11 Binary Logical Operators
23204
23205
    function parseBinaryExpression() {
23206
        var marker, markers, expr, token, prec, stack, right, operator, left, i;
23207
23208
        marker = lookahead;
23209
        left = inheritCoverGrammar(parseUnaryExpression);
23210
23211
        token = lookahead;
23212
        prec = binaryPrecedence(token, state.allowIn);
23213
        if (prec === 0) {
23214
            return left;
23215
        }
23216
        isAssignmentTarget = isBindingElement = false;
23217
        token.prec = prec;
23218
        lex();
23219
23220
        markers = [marker, lookahead];
23221
        right = isolateCoverGrammar(parseUnaryExpression);
23222
23223
        stack = [left, token, right];
23224
23225
        while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) {
23226
23227
            // Reduce: make a binary expression from the three topmost entries.
23228
            while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
23229
                right = stack.pop();
23230
                operator = stack.pop().value;
23231
                left = stack.pop();
23232
                markers.pop();
23233
                expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right);
23234
                stack.push(expr);
23235
            }
23236
23237
            // Shift.
23238
            token = lex();
23239
            token.prec = prec;
23240
            stack.push(token);
23241
            markers.push(lookahead);
23242
            expr = isolateCoverGrammar(parseUnaryExpression);
23243
            stack.push(expr);
23244
        }
23245
23246
        // Final reduce to clean-up the stack.
23247
        i = stack.length - 1;
23248
        expr = stack[i];
23249
        markers.pop();
23250
        while (i > 1) {
23251
            expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
23252
            i -= 2;
23253
        }
23254
23255
        return expr;
23256
    }
23257
23258
23259
    // 11.12 Conditional Operator
23260
23261
    function parseConditionalExpression() {
23262
        var expr, previousAllowIn, consequent, alternate, startToken;
23263
23264
        startToken = lookahead;
23265
23266
        expr = inheritCoverGrammar(parseBinaryExpression);
23267
        if (match('?')) {
23268
            lex();
23269
            previousAllowIn = state.allowIn;
23270
            state.allowIn = true;
23271
            consequent = isolateCoverGrammar(parseAssignmentExpression);
23272
            state.allowIn = previousAllowIn;
23273
            expect(':');
23274
            alternate = isolateCoverGrammar(parseAssignmentExpression);
23275
23276
            expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);
23277
            isAssignmentTarget = isBindingElement = false;
23278
        }
23279
23280
        return expr;
23281
    }
23282
23283
    // [ES6] 14.2 Arrow Function
23284
23285
    function parseConciseBody() {
23286
        if (match('{')) {
23287
            return parseFunctionSourceElements();
23288
        }
23289
        return isolateCoverGrammar(parseAssignmentExpression);
23290
    }
23291
23292
    function checkPatternParam(options, param) {
23293
        var i;
23294
        switch (param.type) {
23295
        case Syntax.Identifier:
23296
            validateParam(options, param, param.name);
23297
            break;
23298
        case Syntax.RestElement:
23299
            checkPatternParam(options, param.argument);
23300
            break;
23301
        case Syntax.AssignmentPattern:
23302
            checkPatternParam(options, param.left);
23303
            break;
23304
        case Syntax.ArrayPattern:
23305
            for (i = 0; i < param.elements.length; i++) {
23306
                if (param.elements[i] !== null) {
23307
                    checkPatternParam(options, param.elements[i]);
23308
                }
23309
            }
23310
            break;
23311
        default:
23312
            assert(param.type === Syntax.ObjectPattern, 'Invalid type');
23313
            for (i = 0; i < param.properties.length; i++) {
23314
                checkPatternParam(options, param.properties[i].value);
23315
            }
23316
            break;
23317
        }
23318
    }
23319
    function reinterpretAsCoverFormalsList(expr) {
23320
        var i, len, param, params, defaults, defaultCount, options, token;
23321
23322
        defaults = [];
23323
        defaultCount = 0;
23324
        params = [expr];
23325
23326
        switch (expr.type) {
23327
        case Syntax.Identifier:
23328
            break;
23329
        case PlaceHolders.ArrowParameterPlaceHolder:
23330
            params = expr.params;
23331
            break;
23332
        default:
23333
            return null;
23334
        }
23335
23336
        options = {
23337
            paramSet: {}
23338
        };
23339
23340
        for (i = 0, len = params.length; i < len; i += 1) {
23341
            param = params[i];
23342
            switch (param.type) {
23343
            case Syntax.AssignmentPattern:
23344
                params[i] = param.left;
23345
                defaults.push(param.right);
23346
                ++defaultCount;
23347
                checkPatternParam(options, param.left);
23348
                break;
23349
            default:
23350
                checkPatternParam(options, param);
23351
                params[i] = param;
23352
                defaults.push(null);
23353
                break;
23354
            }
23355
        }
23356
23357
        if (options.message === Messages.StrictParamDupe) {
23358
            token = strict ? options.stricted : options.firstRestricted;
23359
            throwUnexpectedToken(token, options.message);
23360
        }
23361
23362
        if (defaultCount === 0) {
23363
            defaults = [];
23364
        }
23365
23366
        return {
23367
            params: params,
23368
            defaults: defaults,
23369
            stricted: options.stricted,
23370
            firstRestricted: options.firstRestricted,
23371
            message: options.message
23372
        };
23373
    }
23374
23375
    function parseArrowFunctionExpression(options, node) {
23376
        var previousStrict, body;
23377
23378
        if (hasLineTerminator) {
23379
            tolerateUnexpectedToken(lookahead);
23380
        }
23381
        expect('=>');
23382
        previousStrict = strict;
23383
23384
        body = parseConciseBody();
23385
23386
        if (strict && options.firstRestricted) {
23387
            throwUnexpectedToken(options.firstRestricted, options.message);
23388
        }
23389
        if (strict && options.stricted) {
23390
            tolerateUnexpectedToken(options.stricted, options.message);
23391
        }
23392
23393
        strict = previousStrict;
23394
23395
        return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement);
23396
    }
23397
23398
    // 11.13 Assignment Operators
23399
23400
    function parseAssignmentExpression() {
23401
        var token, expr, right, list, startToken;
23402
23403
        startToken = lookahead;
23404
        token = lookahead;
23405
23406
        expr = parseConditionalExpression();
23407
23408
        if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {
23409
            isAssignmentTarget = isBindingElement = false;
23410
            list = reinterpretAsCoverFormalsList(expr);
23411
23412
            if (list) {
23413
                firstCoverInitializedNameError = null;
23414
                return parseArrowFunctionExpression(list, new WrappingNode(startToken));
23415
            }
23416
23417
            return expr;
23418
        }
23419
23420
        if (matchAssign()) {
23421
            if (!isAssignmentTarget) {
23422
                tolerateError(Messages.InvalidLHSInAssignment);
23423
            }
23424
23425
            // 11.13.1
23426
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
23427
                tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);
23428
            }
23429
23430
            if (!match('=')) {
23431
                isAssignmentTarget = isBindingElement = false;
23432
            } else {
23433
                reinterpretExpressionAsPattern(expr);
23434
            }
23435
23436
            token = lex();
23437
            right = isolateCoverGrammar(parseAssignmentExpression);
23438
            expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);
23439
            firstCoverInitializedNameError = null;
23440
        }
23441
23442
        return expr;
23443
    }
23444
23445
    // 11.14 Comma Operator
23446
23447
    function parseExpression() {
23448
        var expr, startToken = lookahead, expressions;
23449
23450
        expr = isolateCoverGrammar(parseAssignmentExpression);
23451
23452
        if (match(',')) {
23453
            expressions = [expr];
23454
23455
            while (startIndex < length) {
23456
                if (!match(',')) {
23457
                    break;
23458
                }
23459
                lex();
23460
                expressions.push(isolateCoverGrammar(parseAssignmentExpression));
23461
            }
23462
23463
            expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
23464
        }
23465
23466
        return expr;
23467
    }
23468
23469
    // 12.1 Block
23470
23471
    function parseStatementListItem() {
23472
        if (lookahead.type === Token.Keyword) {
23473
            switch (lookahead.value) {
23474
            case 'export':
23475
                if (sourceType !== 'module') {
23476
                    tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
23477
                }
23478
                return parseExportDeclaration();
23479
            case 'import':
23480
                if (sourceType !== 'module') {
23481
                    tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);
23482
                }
23483
                return parseImportDeclaration();
23484
            case 'const':
23485
            case 'let':
23486
                return parseLexicalDeclaration({inFor: false});
23487
            case 'function':
23488
                return parseFunctionDeclaration(new Node());
23489
            case 'class':
23490
                return parseClassDeclaration();
23491
            }
23492
        }
23493
23494
        return parseStatement();
23495
    }
23496
23497
    function parseStatementList() {
23498
        var list = [];
23499
        while (startIndex < length) {
23500
            if (match('}')) {
23501
                break;
23502
            }
23503
            list.push(parseStatementListItem());
23504
        }
23505
23506
        return list;
23507
    }
23508
23509
    function parseBlock() {
23510
        var block, node = new Node();
23511
23512
        expect('{');
23513
23514
        block = parseStatementList();
23515
23516
        expect('}');
23517
23518
        return node.finishBlockStatement(block);
23519
    }
23520
23521
    // 12.2 Variable Statement
23522
23523
    function parseVariableIdentifier() {
23524
        var token, node = new Node();
23525
23526
        token = lex();
23527
23528
        if (token.type !== Token.Identifier) {
23529
            if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {
23530
                tolerateUnexpectedToken(token, Messages.StrictReservedWord);
23531
            } else {
23532
                throwUnexpectedToken(token);
23533
            }
23534
        }
23535
23536
        return node.finishIdentifier(token.value);
23537
    }
23538
23539
    function parseVariableDeclaration() {
23540
        var init = null, id, node = new Node();
23541
23542
        id = parsePattern();
23543
23544
        // 12.2.1
23545
        if (strict && isRestrictedWord(id.name)) {
23546
            tolerateError(Messages.StrictVarName);
23547
        }
23548
23549
        if (match('=')) {
23550
            lex();
23551
            init = isolateCoverGrammar(parseAssignmentExpression);
23552
        } else if (id.type !== Syntax.Identifier) {
23553
            expect('=');
23554
        }
23555
23556
        return node.finishVariableDeclarator(id, init);
23557
    }
23558
23559
    function parseVariableDeclarationList() {
23560
        var list = [];
23561
23562
        do {
23563
            list.push(parseVariableDeclaration());
23564
            if (!match(',')) {
23565
                break;
23566
            }
23567
            lex();
23568
        } while (startIndex < length);
23569
23570
        return list;
23571
    }
23572
23573
    function parseVariableStatement(node) {
23574
        var declarations;
23575
23576
        expectKeyword('var');
23577
23578
        declarations = parseVariableDeclarationList();
23579
23580
        consumeSemicolon();
23581
23582
        return node.finishVariableDeclaration(declarations);
23583
    }
23584
23585
    function parseLexicalBinding(kind, options) {
23586
        var init = null, id, node = new Node();
23587
23588
        id = parsePattern();
23589
23590
        // 12.2.1
23591
        if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
23592
            tolerateError(Messages.StrictVarName);
23593
        }
23594
23595
        if (kind === 'const') {
23596
            if (!matchKeyword('in')) {
23597
                expect('=');
23598
                init = isolateCoverGrammar(parseAssignmentExpression);
23599
            }
23600
        } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {
23601
            expect('=');
23602
            init = isolateCoverGrammar(parseAssignmentExpression);
23603
        }
23604
23605
        return node.finishVariableDeclarator(id, init);
23606
    }
23607
23608
    function parseBindingList(kind, options) {
23609
        var list = [];
23610
23611
        do {
23612
            list.push(parseLexicalBinding(kind, options));
23613
            if (!match(',')) {
23614
                break;
23615
            }
23616
            lex();
23617
        } while (startIndex < length);
23618
23619
        return list;
23620
    }
23621
23622
    function parseLexicalDeclaration(options) {
23623
        var kind, declarations, node = new Node();
23624
23625
        kind = lex().value;
23626
        assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
23627
23628
        declarations = parseBindingList(kind, options);
23629
23630
        consumeSemicolon();
23631
23632
        return node.finishLexicalDeclaration(declarations, kind);
23633
    }
23634
23635
    function parseRestElement() {
23636
        var param, node = new Node();
23637
23638
        lex();
23639
23640
        if (match('{')) {
23641
            throwError(Messages.ObjectPatternAsRestParameter);
23642
        }
23643
23644
        param = parseVariableIdentifier();
23645
23646
        if (match('=')) {
23647
            throwError(Messages.DefaultRestParameter);
23648
        }
23649
23650
        if (!match(')')) {
23651
            throwError(Messages.ParameterAfterRestParameter);
23652
        }
23653
23654
        return node.finishRestElement(param);
23655
    }
23656
23657
    // 12.3 Empty Statement
23658
23659
    function parseEmptyStatement(node) {
23660
        expect(';');
23661
        return node.finishEmptyStatement();
23662
    }
23663
23664
    // 12.4 Expression Statement
23665
23666
    function parseExpressionStatement(node) {
23667
        var expr = parseExpression();
23668
        consumeSemicolon();
23669
        return node.finishExpressionStatement(expr);
23670
    }
23671
23672
    // 12.5 If statement
23673
23674
    function parseIfStatement(node) {
23675
        var test, consequent, alternate;
23676
23677
        expectKeyword('if');
23678
23679
        expect('(');
23680
23681
        test = parseExpression();
23682
23683
        expect(')');
23684
23685
        consequent = parseStatement();
23686
23687
        if (matchKeyword('else')) {
23688
            lex();
23689
            alternate = parseStatement();
23690
        } else {
23691
            alternate = null;
23692
        }
23693
23694
        return node.finishIfStatement(test, consequent, alternate);
23695
    }
23696
23697
    // 12.6 Iteration Statements
23698
23699
    function parseDoWhileStatement(node) {
23700
        var body, test, oldInIteration;
23701
23702
        expectKeyword('do');
23703
23704
        oldInIteration = state.inIteration;
23705
        state.inIteration = true;
23706
23707
        body = parseStatement();
23708
23709
        state.inIteration = oldInIteration;
23710
23711
        expectKeyword('while');
23712
23713
        expect('(');
23714
23715
        test = parseExpression();
23716
23717
        expect(')');
23718
23719
        if (match(';')) {
23720
            lex();
23721
        }
23722
23723
        return node.finishDoWhileStatement(body, test);
23724
    }
23725
23726
    function parseWhileStatement(node) {
23727
        var test, body, oldInIteration;
23728
23729
        expectKeyword('while');
23730
23731
        expect('(');
23732
23733
        test = parseExpression();
23734
23735
        expect(')');
23736
23737
        oldInIteration = state.inIteration;
23738
        state.inIteration = true;
23739
23740
        body = parseStatement();
23741
23742
        state.inIteration = oldInIteration;
23743
23744
        return node.finishWhileStatement(test, body);
23745
    }
23746
23747
    function parseForStatement(node) {
23748
        var init, initSeq, initStartToken, test, update, left, right, kind, declarations,
23749
            body, oldInIteration, previousAllowIn = state.allowIn;
23750
23751
        init = test = update = null;
23752
23753
        expectKeyword('for');
23754
23755
        expect('(');
23756
23757
        if (match(';')) {
23758
            lex();
23759
        } else {
23760
            if (matchKeyword('var')) {
23761
                init = new Node();
23762
                lex();
23763
23764
                state.allowIn = false;
23765
                init = init.finishVariableDeclaration(parseVariableDeclarationList());
23766
                state.allowIn = previousAllowIn;
23767
23768
                if (init.declarations.length === 1 && matchKeyword('in')) {
23769
                    lex();
23770
                    left = init;
23771
                    right = parseExpression();
23772
                    init = null;
23773
                } else {
23774
                    expect(';');
23775
                }
23776
            } else if (matchKeyword('const') || matchKeyword('let')) {
23777
                init = new Node();
23778
                kind = lex().value;
23779
23780
                state.allowIn = false;
23781
                declarations = parseBindingList(kind, {inFor: true});
23782
                state.allowIn = previousAllowIn;
23783
23784
                if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) {
23785
                    init = init.finishLexicalDeclaration(declarations, kind);
23786
                    lex();
23787
                    left = init;
23788
                    right = parseExpression();
23789
                    init = null;
23790
                } else {
23791
                    consumeSemicolon();
23792
                    init = init.finishLexicalDeclaration(declarations, kind);
23793
                }
23794
            } else {
23795
                initStartToken = lookahead;
23796
                state.allowIn = false;
23797
                init = inheritCoverGrammar(parseAssignmentExpression);
23798
                state.allowIn = previousAllowIn;
23799
23800
                if (matchKeyword('in')) {
23801
                    if (!isAssignmentTarget) {
23802
                        tolerateError(Messages.InvalidLHSInForIn);
23803
                    }
23804
23805
                    lex();
23806
                    reinterpretExpressionAsPattern(init);
23807
                    left = init;
23808
                    right = parseExpression();
23809
                    init = null;
23810
                } else {
23811
                    if (match(',')) {
23812
                        initSeq = [init];
23813
                        while (match(',')) {
23814
                            lex();
23815
                            initSeq.push(isolateCoverGrammar(parseAssignmentExpression));
23816
                        }
23817
                        init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq);
23818
                    }
23819
                    expect(';');
23820
                }
23821
            }
23822
        }
23823
23824
        if (typeof left === 'undefined') {
23825
23826
            if (!match(';')) {
23827
                test = parseExpression();
23828
            }
23829
            expect(';');
23830
23831
            if (!match(')')) {
23832
                update = parseExpression();
23833
            }
23834
        }
23835
23836
        expect(')');
23837
23838
        oldInIteration = state.inIteration;
23839
        state.inIteration = true;
23840
23841
        body = isolateCoverGrammar(parseStatement);
23842
23843
        state.inIteration = oldInIteration;
23844
23845
        return (typeof left === 'undefined') ?
23846
                node.finishForStatement(init, test, update, body) :
23847
                node.finishForInStatement(left, right, body);
23848
    }
23849
23850
    // 12.7 The continue statement
23851
23852
    function parseContinueStatement(node) {
23853
        var label = null, key;
23854
23855
        expectKeyword('continue');
23856
23857
        // Optimize the most common form: 'continue;'.
23858
        if (source.charCodeAt(startIndex) === 0x3B) {
23859
            lex();
23860
23861
            if (!state.inIteration) {
23862
                throwError(Messages.IllegalContinue);
23863
            }
23864
23865
            return node.finishContinueStatement(null);
23866
        }
23867
23868
        if (hasLineTerminator) {
23869
            if (!state.inIteration) {
23870
                throwError(Messages.IllegalContinue);
23871
            }
23872
23873
            return node.finishContinueStatement(null);
23874
        }
23875
23876
        if (lookahead.type === Token.Identifier) {
23877
            label = parseVariableIdentifier();
23878
23879
            key = '$' + label.name;
23880
            if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
23881
                throwError(Messages.UnknownLabel, label.name);
23882
            }
23883
        }
23884
23885
        consumeSemicolon();
23886
23887
        if (label === null && !state.inIteration) {
23888
            throwError(Messages.IllegalContinue);
23889
        }
23890
23891
        return node.finishContinueStatement(label);
23892
    }
23893
23894
    // 12.8 The break statement
23895
23896
    function parseBreakStatement(node) {
23897
        var label = null, key;
23898
23899
        expectKeyword('break');
23900
23901
        // Catch the very common case first: immediately a semicolon (U+003B).
23902
        if (source.charCodeAt(lastIndex) === 0x3B) {
23903
            lex();
23904
23905
            if (!(state.inIteration || state.inSwitch)) {
23906
                throwError(Messages.IllegalBreak);
23907
            }
23908
23909
            return node.finishBreakStatement(null);
23910
        }
23911
23912
        if (hasLineTerminator) {
23913
            if (!(state.inIteration || state.inSwitch)) {
23914
                throwError(Messages.IllegalBreak);
23915
            }
23916
23917
            return node.finishBreakStatement(null);
23918
        }
23919
23920
        if (lookahead.type === Token.Identifier) {
23921
            label = parseVariableIdentifier();
23922
23923
            key = '$' + label.name;
23924
            if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
23925
                throwError(Messages.UnknownLabel, label.name);
23926
            }
23927
        }
23928
23929
        consumeSemicolon();
23930
23931
        if (label === null && !(state.inIteration || state.inSwitch)) {
23932
            throwError(Messages.IllegalBreak);
23933
        }
23934
23935
        return node.finishBreakStatement(label);
23936
    }
23937
23938
    // 12.9 The return statement
23939
23940
    function parseReturnStatement(node) {
23941
        var argument = null;
23942
23943
        expectKeyword('return');
23944
23945
        if (!state.inFunctionBody) {
23946
            tolerateError(Messages.IllegalReturn);
23947
        }
23948
23949
        // 'return' followed by a space and an identifier is very common.
23950
        if (source.charCodeAt(lastIndex) === 0x20) {
23951
            if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {
23952
                argument = parseExpression();
23953
                consumeSemicolon();
23954
                return node.finishReturnStatement(argument);
23955
            }
23956
        }
23957
23958
        if (hasLineTerminator) {
23959
            // HACK
23960
            return node.finishReturnStatement(null);
23961
        }
23962
23963
        if (!match(';')) {
23964
            if (!match('}') && lookahead.type !== Token.EOF) {
23965
                argument = parseExpression();
23966
            }
23967
        }
23968
23969
        consumeSemicolon();
23970
23971
        return node.finishReturnStatement(argument);
23972
    }
23973
23974
    // 12.10 The with statement
23975
23976
    function parseWithStatement(node) {
23977
        var object, body;
23978
23979
        if (strict) {
23980
            tolerateError(Messages.StrictModeWith);
23981
        }
23982
23983
        expectKeyword('with');
23984
23985
        expect('(');
23986
23987
        object = parseExpression();
23988
23989
        expect(')');
23990
23991
        body = parseStatement();
23992
23993
        return node.finishWithStatement(object, body);
23994
    }
23995
23996
    // 12.10 The swith statement
23997
23998
    function parseSwitchCase() {
23999
        var test, consequent = [], statement, node = new Node();
24000
24001
        if (matchKeyword('default')) {
24002
            lex();
24003
            test = null;
24004
        } else {
24005
            expectKeyword('case');
24006
            test = parseExpression();
24007
        }
24008
        expect(':');
24009
24010
        while (startIndex < length) {
24011
            if (match('}') || matchKeyword('default') || matchKeyword('case')) {
24012
                break;
24013
            }
24014
            statement = parseStatementListItem();
24015
            consequent.push(statement);
24016
        }
24017
24018
        return node.finishSwitchCase(test, consequent);
24019
    }
24020
24021
    function parseSwitchStatement(node) {
24022
        var discriminant, cases, clause, oldInSwitch, defaultFound;
24023
24024
        expectKeyword('switch');
24025
24026
        expect('(');
24027
24028
        discriminant = parseExpression();
24029
24030
        expect(')');
24031
24032
        expect('{');
24033
24034
        cases = [];
24035
24036
        if (match('}')) {
24037
            lex();
24038
            return node.finishSwitchStatement(discriminant, cases);
24039
        }
24040
24041
        oldInSwitch = state.inSwitch;
24042
        state.inSwitch = true;
24043
        defaultFound = false;
24044
24045
        while (startIndex < length) {
24046
            if (match('}')) {
24047
                break;
24048
            }
24049
            clause = parseSwitchCase();
24050
            if (clause.test === null) {
24051
                if (defaultFound) {
24052
                    throwError(Messages.MultipleDefaultsInSwitch);
24053
                }
24054
                defaultFound = true;
24055
            }
24056
            cases.push(clause);
24057
        }
24058
24059
        state.inSwitch = oldInSwitch;
24060
24061
        expect('}');
24062
24063
        return node.finishSwitchStatement(discriminant, cases);
24064
    }
24065
24066
    // 12.13 The throw statement
24067
24068
    function parseThrowStatement(node) {
24069
        var argument;
24070
24071
        expectKeyword('throw');
24072
24073
        if (hasLineTerminator) {
24074
            throwError(Messages.NewlineAfterThrow);
24075
        }
24076
24077
        argument = parseExpression();
24078
24079
        consumeSemicolon();
24080
24081
        return node.finishThrowStatement(argument);
24082
    }
24083
24084
    // 12.14 The try statement
24085
24086
    function parseCatchClause() {
24087
        var param, body, node = new Node();
24088
24089
        expectKeyword('catch');
24090
24091
        expect('(');
24092
        if (match(')')) {
24093
            throwUnexpectedToken(lookahead);
24094
        }
24095
24096
        param = parsePattern();
24097
24098
        // 12.14.1
24099
        if (strict && isRestrictedWord(param.name)) {
24100
            tolerateError(Messages.StrictCatchVariable);
24101
        }
24102
24103
        expect(')');
24104
        body = parseBlock();
24105
        return node.finishCatchClause(param, body);
24106
    }
24107
24108
    function parseTryStatement(node) {
24109
        var block, handler = null, finalizer = null;
24110
24111
        expectKeyword('try');
24112
24113
        block = parseBlock();
24114
24115
        if (matchKeyword('catch')) {
24116
            handler = parseCatchClause();
24117
        }
24118
24119
        if (matchKeyword('finally')) {
24120
            lex();
24121
            finalizer = parseBlock();
24122
        }
24123
24124
        if (!handler && !finalizer) {
24125
            throwError(Messages.NoCatchOrFinally);
24126
        }
24127
24128
        return node.finishTryStatement(block, handler, finalizer);
24129
    }
24130
24131
    // 12.15 The debugger statement
24132
24133
    function parseDebuggerStatement(node) {
24134
        expectKeyword('debugger');
24135
24136
        consumeSemicolon();
24137
24138
        return node.finishDebuggerStatement();
24139
    }
24140
24141
    // 12 Statements
24142
24143
    function parseStatement() {
24144
        var type = lookahead.type,
24145
            expr,
24146
            labeledBody,
24147
            key,
24148
            node;
24149
24150
        if (type === Token.EOF) {
24151
            throwUnexpectedToken(lookahead);
24152
        }
24153
24154
        if (type === Token.Punctuator && lookahead.value === '{') {
24155
            return parseBlock();
24156
        }
24157
        isAssignmentTarget = isBindingElement = true;
24158
        node = new Node();
24159
24160
        if (type === Token.Punctuator) {
24161
            switch (lookahead.value) {
24162
            case ';':
24163
                return parseEmptyStatement(node);
24164
            case '(':
24165
                return parseExpressionStatement(node);
24166
            default:
24167
                break;
24168
            }
24169
        } else if (type === Token.Keyword) {
24170
            switch (lookahead.value) {
24171
            case 'break':
24172
                return parseBreakStatement(node);
24173
            case 'continue':
24174
                return parseContinueStatement(node);
24175
            case 'debugger':
24176
                return parseDebuggerStatement(node);
24177
            case 'do':
24178
                return parseDoWhileStatement(node);
24179
            case 'for':
24180
                return parseForStatement(node);
24181
            case 'function':
24182
                return parseFunctionDeclaration(node);
24183
            case 'if':
24184
                return parseIfStatement(node);
24185
            case 'return':
24186
                return parseReturnStatement(node);
24187
            case 'switch':
24188
                return parseSwitchStatement(node);
24189
            case 'throw':
24190
                return parseThrowStatement(node);
24191
            case 'try':
24192
                return parseTryStatement(node);
24193
            case 'var':
24194
                return parseVariableStatement(node);
24195
            case 'while':
24196
                return parseWhileStatement(node);
24197
            case 'with':
24198
                return parseWithStatement(node);
24199
            default:
24200
                break;
24201
            }
24202
        }
24203
24204
        expr = parseExpression();
24205
24206
        // 12.12 Labelled Statements
24207
        if ((expr.type === Syntax.Identifier) && match(':')) {
24208
            lex();
24209
24210
            key = '$' + expr.name;
24211
            if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
24212
                throwError(Messages.Redeclaration, 'Label', expr.name);
24213
            }
24214
24215
            state.labelSet[key] = true;
24216
            labeledBody = parseStatement();
24217
            delete state.labelSet[key];
24218
            return node.finishLabeledStatement(expr, labeledBody);
24219
        }
24220
24221
        consumeSemicolon();
24222
24223
        return node.finishExpressionStatement(expr);
24224
    }
24225
24226
    // 13 Function Definition
24227
24228
    function parseFunctionSourceElements() {
24229
        var statement, body = [], token, directive, firstRestricted,
24230
            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
24231
            node = new Node();
24232
24233
        expect('{');
24234
24235
        while (startIndex < length) {
24236
            if (lookahead.type !== Token.StringLiteral) {
24237
                break;
24238
            }
24239
            token = lookahead;
24240
24241
            statement = parseStatementListItem();
24242
            body.push(statement);
24243
            if (statement.expression.type !== Syntax.Literal) {
24244
                // this is not directive
24245
                break;
24246
            }
24247
            directive = source.slice(token.start + 1, token.end - 1);
24248
            if (directive === 'use strict') {
24249
                strict = true;
24250
                if (firstRestricted) {
24251
                    tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
24252
                }
24253
            } else {
24254
                if (!firstRestricted && token.octal) {
24255
                    firstRestricted = token;
24256
                }
24257
            }
24258
        }
24259
24260
        oldLabelSet = state.labelSet;
24261
        oldInIteration = state.inIteration;
24262
        oldInSwitch = state.inSwitch;
24263
        oldInFunctionBody = state.inFunctionBody;
24264
        oldParenthesisCount = state.parenthesizedCount;
24265
24266
        state.labelSet = {};
24267
        state.inIteration = false;
24268
        state.inSwitch = false;
24269
        state.inFunctionBody = true;
24270
        state.parenthesizedCount = 0;
24271
24272
        while (startIndex < length) {
24273
            if (match('}')) {
24274
                break;
24275
            }
24276
            body.push(parseStatementListItem());
24277
        }
24278
24279
        expect('}');
24280
24281
        state.labelSet = oldLabelSet;
24282
        state.inIteration = oldInIteration;
24283
        state.inSwitch = oldInSwitch;
24284
        state.inFunctionBody = oldInFunctionBody;
24285
        state.parenthesizedCount = oldParenthesisCount;
24286
24287
        return node.finishBlockStatement(body);
24288
    }
24289
24290
    function validateParam(options, param, name) {
24291
        var key = '$' + name;
24292
        if (strict) {
24293
            if (isRestrictedWord(name)) {
24294
                options.stricted = param;
24295
                options.message = Messages.StrictParamName;
24296
            }
24297
            if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
24298
                options.stricted = param;
24299
                options.message = Messages.StrictParamDupe;
24300
            }
24301
        } else if (!options.firstRestricted) {
24302
            if (isRestrictedWord(name)) {
24303
                options.firstRestricted = param;
24304
                options.message = Messages.StrictParamName;
24305
            } else if (isStrictModeReservedWord(name)) {
24306
                options.firstRestricted = param;
24307
                options.message = Messages.StrictReservedWord;
24308
            } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
24309
                options.firstRestricted = param;
24310
                options.message = Messages.StrictParamDupe;
24311
            }
24312
        }
24313
        options.paramSet[key] = true;
24314
    }
24315
24316
    function parseParam(options) {
24317
        var token, param, def;
24318
24319
        token = lookahead;
24320
        if (token.value === '...') {
24321
            param = parseRestElement();
24322
            validateParam(options, param.argument, param.argument.name);
24323
            options.params.push(param);
24324
            options.defaults.push(null);
24325
            return false;
24326
        }
24327
24328
        param = parsePatternWithDefault();
24329
        validateParam(options, token, token.value);
24330
24331
        if (param.type === Syntax.AssignmentPattern) {
24332
            def = param.right;
24333
            param = param.left;
24334
            ++options.defaultCount;
24335
        }
24336
24337
        options.params.push(param);
24338
        options.defaults.push(def);
24339
24340
        return !match(')');
24341
    }
24342
24343
    function parseParams(firstRestricted) {
24344
        var options;
24345
24346
        options = {
24347
            params: [],
24348
            defaultCount: 0,
24349
            defaults: [],
24350
            firstRestricted: firstRestricted
24351
        };
24352
24353
        expect('(');
24354
24355
        if (!match(')')) {
24356
            options.paramSet = {};
24357
            while (startIndex < length) {
24358
                if (!parseParam(options)) {
24359
                    break;
24360
                }
24361
                expect(',');
24362
            }
24363
        }
24364
24365
        expect(')');
24366
24367
        if (options.defaultCount === 0) {
24368
            options.defaults = [];
24369
        }
24370
24371
        return {
24372
            params: options.params,
24373
            defaults: options.defaults,
24374
            stricted: options.stricted,
24375
            firstRestricted: options.firstRestricted,
24376
            message: options.message
24377
        };
24378
    }
24379
24380
    function parseFunctionDeclaration(node, identifierIsOptional) {
24381
        var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict;
24382
24383
        expectKeyword('function');
24384
        if (!identifierIsOptional || !match('(')) {
24385
            token = lookahead;
24386
            id = parseVariableIdentifier();
24387
            if (strict) {
24388
                if (isRestrictedWord(token.value)) {
24389
                    tolerateUnexpectedToken(token, Messages.StrictFunctionName);
24390
                }
24391
            } else {
24392
                if (isRestrictedWord(token.value)) {
24393
                    firstRestricted = token;
24394
                    message = Messages.StrictFunctionName;
24395
                } else if (isStrictModeReservedWord(token.value)) {
24396
                    firstRestricted = token;
24397
                    message = Messages.StrictReservedWord;
24398
                }
24399
            }
24400
        }
24401
24402
        tmp = parseParams(firstRestricted);
24403
        params = tmp.params;
24404
        defaults = tmp.defaults;
24405
        stricted = tmp.stricted;
24406
        firstRestricted = tmp.firstRestricted;
24407
        if (tmp.message) {
24408
            message = tmp.message;
24409
        }
24410
24411
        previousStrict = strict;
24412
        body = parseFunctionSourceElements();
24413
        if (strict && firstRestricted) {
24414
            throwUnexpectedToken(firstRestricted, message);
24415
        }
24416
        if (strict && stricted) {
24417
            tolerateUnexpectedToken(stricted, message);
24418
        }
24419
        strict = previousStrict;
24420
24421
        return node.finishFunctionDeclaration(id, params, defaults, body);
24422
    }
24423
24424
    function parseFunctionExpression() {
24425
        var token, id = null, stricted, firstRestricted, message, tmp,
24426
            params = [], defaults = [], body, previousStrict, node = new Node();
24427
24428
        expectKeyword('function');
24429
24430
        if (!match('(')) {
24431
            token = lookahead;
24432
            id = parseVariableIdentifier();
24433
            if (strict) {
24434
                if (isRestrictedWord(token.value)) {
24435
                    tolerateUnexpectedToken(token, Messages.StrictFunctionName);
24436
                }
24437
            } else {
24438
                if (isRestrictedWord(token.value)) {
24439
                    firstRestricted = token;
24440
                    message = Messages.StrictFunctionName;
24441
                } else if (isStrictModeReservedWord(token.value)) {
24442
                    firstRestricted = token;
24443
                    message = Messages.StrictReservedWord;
24444
                }
24445
            }
24446
        }
24447
24448
        tmp = parseParams(firstRestricted);
24449
        params = tmp.params;
24450
        defaults = tmp.defaults;
24451
        stricted = tmp.stricted;
24452
        firstRestricted = tmp.firstRestricted;
24453
        if (tmp.message) {
24454
            message = tmp.message;
24455
        }
24456
24457
        previousStrict = strict;
24458
        body = parseFunctionSourceElements();
24459
        if (strict && firstRestricted) {
24460
            throwUnexpectedToken(firstRestricted, message);
24461
        }
24462
        if (strict && stricted) {
24463
            tolerateUnexpectedToken(stricted, message);
24464
        }
24465
        strict = previousStrict;
24466
24467
        return node.finishFunctionExpression(id, params, defaults, body);
24468
    }
24469
24470
24471
    function parseClassBody() {
24472
        var classBody, token, isStatic, hasConstructor = false, body, method, computed, key;
24473
24474
        classBody = new Node();
24475
24476
        expect('{');
24477
        body = [];
24478
        while (!match('}')) {
24479
            if (match(';')) {
24480
                lex();
24481
            } else {
24482
                method = new Node();
24483
                token = lookahead;
24484
                isStatic = false;
24485
                computed = match('[');
24486
                key = parseObjectPropertyKey();
24487
                if (key.name === 'static' && lookaheadPropertyName()) {
24488
                    token = lookahead;
24489
                    isStatic = true;
24490
                    computed = match('[');
24491
                    key = parseObjectPropertyKey();
24492
                }
24493
                method = tryParseMethodDefinition(token, key, computed, method);
24494
                if (method) {
24495
                    method['static'] = isStatic;
24496
                    if (method.kind === 'init') {
24497
                        method.kind = 'method';
24498
                    }
24499
                    if (!isStatic) {
24500
                        if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') {
24501
                            if (method.kind !== 'method' || !method.method || method.value.generator) {
24502
                                throwUnexpectedToken(token, Messages.ConstructorSpecialMethod);
24503
                            }
24504
                            if (hasConstructor) {
24505
                                throwUnexpectedToken(token, Messages.DuplicateConstructor);
24506
                            } else {
24507
                                hasConstructor = true;
24508
                            }
24509
                            method.kind = 'constructor';
24510
                        }
24511
                    } else {
24512
                        if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') {
24513
                            throwUnexpectedToken(token, Messages.StaticPrototype);
24514
                        }
24515
                    }
24516
                    method.type = Syntax.MethodDefinition;
24517
                    delete method.method;
24518
                    delete method.shorthand;
24519
                    body.push(method);
24520
                } else {
24521
                    throwUnexpectedToken(lookahead);
24522
                }
24523
            }
24524
        }
24525
        lex();
24526
        return classBody.finishClassBody(body);
24527
    }
24528
24529
    function parseClassDeclaration(identifierIsOptional) {
24530
        var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
24531
        strict = true;
24532
24533
        expectKeyword('class');
24534
24535
        if (!identifierIsOptional || lookahead.type === Token.Identifier) {
24536
            id = parseVariableIdentifier();
24537
        }
24538
24539
        if (matchKeyword('extends')) {
24540
            lex();
24541
            superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
24542
        }
24543
        classBody = parseClassBody();
24544
        strict = previousStrict;
24545
24546
        return classNode.finishClassDeclaration(id, superClass, classBody);
24547
    }
24548
24549
    function parseClassExpression() {
24550
        var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
24551
        strict = true;
24552
24553
        expectKeyword('class');
24554
24555
        if (lookahead.type === Token.Identifier) {
24556
            id = parseVariableIdentifier();
24557
        }
24558
24559
        if (matchKeyword('extends')) {
24560
            lex();
24561
            superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
24562
        }
24563
        classBody = parseClassBody();
24564
        strict = previousStrict;
24565
24566
        return classNode.finishClassExpression(id, superClass, classBody);
24567
    }
24568
24569
    // Modules grammar from:
24570
    // people.mozilla.org/~jorendorff/es6-draft.html
24571
24572
    function parseModuleSpecifier() {
24573
        var node = new Node();
24574
24575
        if (lookahead.type !== Token.StringLiteral) {
24576
            throwError(Messages.InvalidModuleSpecifier);
24577
        }
24578
        return node.finishLiteral(lex());
24579
    }
24580
24581
    function parseExportSpecifier() {
24582
        var exported, local, node = new Node(), def;
24583
        if (matchKeyword('default')) {
24584
            // export {default} from 'something';
24585
            def = new Node();
24586
            lex();
24587
            local = def.finishIdentifier('default');
24588
        } else {
24589
            local = parseVariableIdentifier();
24590
        }
24591
        if (matchContextualKeyword('as')) {
24592
            lex();
24593
            exported = parseNonComputedProperty();
24594
        }
24595
        return node.finishExportSpecifier(local, exported);
24596
    }
24597
24598
    function parseExportNamedDeclaration(node) {
24599
        var declaration = null,
24600
            isExportFromIdentifier,
24601
            src = null, specifiers = [];
24602
24603
        // non-default export
24604
        if (lookahead.type === Token.Keyword) {
24605
            // covers:
24606
            // export var f = 1;
24607
            switch (lookahead.value) {
24608
                case 'let':
24609
                case 'const':
24610
                case 'var':
24611
                case 'class':
24612
                case 'function':
24613
                    declaration = parseStatementListItem();
24614
                    return node.finishExportNamedDeclaration(declaration, specifiers, null);
24615
            }
24616
        }
24617
24618
        expect('{');
24619
        if (!match('}')) {
24620
            do {
24621
                isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');
24622
                specifiers.push(parseExportSpecifier());
24623
            } while (match(',') && lex());
24624
        }
24625
        expect('}');
24626
24627
        if (matchContextualKeyword('from')) {
24628
            // covering:
24629
            // export {default} from 'foo';
24630
            // export {foo} from 'foo';
24631
            lex();
24632
            src = parseModuleSpecifier();
24633
            consumeSemicolon();
24634
        } else if (isExportFromIdentifier) {
24635
            // covering:
24636
            // export {default}; // missing fromClause
24637
            throwError(lookahead.value ?
24638
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24639
        } else {
24640
            // cover
24641
            // export {foo};
24642
            consumeSemicolon();
24643
        }
24644
        return node.finishExportNamedDeclaration(declaration, specifiers, src);
24645
    }
24646
24647
    function parseExportDefaultDeclaration(node) {
24648
        var declaration = null,
24649
            expression = null;
24650
24651
        // covers:
24652
        // export default ...
24653
        expectKeyword('default');
24654
24655
        if (matchKeyword('function')) {
24656
            // covers:
24657
            // export default function foo () {}
24658
            // export default function () {}
24659
            declaration = parseFunctionDeclaration(new Node(), true);
24660
            return node.finishExportDefaultDeclaration(declaration);
24661
        }
24662
        if (matchKeyword('class')) {
24663
            declaration = parseClassDeclaration(true);
24664
            return node.finishExportDefaultDeclaration(declaration);
24665
        }
24666
24667
        if (matchContextualKeyword('from')) {
24668
            throwError(Messages.UnexpectedToken, lookahead.value);
24669
        }
24670
24671
        // covers:
24672
        // export default {};
24673
        // export default [];
24674
        // export default (1 + 2);
24675
        if (match('{')) {
24676
            expression = parseObjectInitialiser();
24677
        } else if (match('[')) {
24678
            expression = parseArrayInitialiser();
24679
        } else {
24680
            expression = parseAssignmentExpression();
24681
        }
24682
        consumeSemicolon();
24683
        return node.finishExportDefaultDeclaration(expression);
24684
    }
24685
24686
    function parseExportAllDeclaration(node) {
24687
        var src;
24688
24689
        // covers:
24690
        // export * from 'foo';
24691
        expect('*');
24692
        if (!matchContextualKeyword('from')) {
24693
            throwError(lookahead.value ?
24694
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24695
        }
24696
        lex();
24697
        src = parseModuleSpecifier();
24698
        consumeSemicolon();
24699
24700
        return node.finishExportAllDeclaration(src);
24701
    }
24702
24703
    function parseExportDeclaration() {
24704
        var node = new Node();
24705
        if (state.inFunctionBody) {
24706
            throwError(Messages.IllegalExportDeclaration);
24707
        }
24708
24709
        expectKeyword('export');
24710
24711
        if (matchKeyword('default')) {
24712
            return parseExportDefaultDeclaration(node);
24713
        }
24714
        if (match('*')) {
24715
            return parseExportAllDeclaration(node);
24716
        }
24717
        return parseExportNamedDeclaration(node);
24718
    }
24719
24720
    function parseImportSpecifier() {
24721
        // import {<foo as bar>} ...;
24722
        var local, imported, node = new Node();
24723
24724
        imported = parseNonComputedProperty();
24725
        if (matchContextualKeyword('as')) {
24726
            lex();
24727
            local = parseVariableIdentifier();
24728
        }
24729
24730
        return node.finishImportSpecifier(local, imported);
24731
    }
24732
24733
    function parseNamedImports() {
24734
        var specifiers = [];
24735
        // {foo, bar as bas}
24736
        expect('{');
24737
        if (!match('}')) {
24738
            do {
24739
                specifiers.push(parseImportSpecifier());
24740
            } while (match(',') && lex());
24741
        }
24742
        expect('}');
24743
        return specifiers;
24744
    }
24745
24746
    function parseImportDefaultSpecifier() {
24747
        // import <foo> ...;
24748
        var local, node = new Node();
24749
24750
        local = parseNonComputedProperty();
24751
24752
        return node.finishImportDefaultSpecifier(local);
24753
    }
24754
24755
    function parseImportNamespaceSpecifier() {
24756
        // import <* as foo> ...;
24757
        var local, node = new Node();
24758
24759
        expect('*');
24760
        if (!matchContextualKeyword('as')) {
24761
            throwError(Messages.NoAsAfterImportNamespace);
24762
        }
24763
        lex();
24764
        local = parseNonComputedProperty();
24765
24766
        return node.finishImportNamespaceSpecifier(local);
24767
    }
24768
24769
    function parseImportDeclaration() {
24770
        var specifiers, src, node = new Node();
24771
24772
        if (state.inFunctionBody) {
24773
            throwError(Messages.IllegalImportDeclaration);
24774
        }
24775
24776
        expectKeyword('import');
24777
        specifiers = [];
24778
24779
        if (lookahead.type === Token.StringLiteral) {
24780
            // covers:
24781
            // import 'foo';
24782
            src = parseModuleSpecifier();
24783
            consumeSemicolon();
24784
            return node.finishImportDeclaration(specifiers, src);
24785
        }
24786
24787
        if (!matchKeyword('default') && isIdentifierName(lookahead)) {
24788
            // covers:
24789
            // import foo
24790
            // import foo, ...
24791
            specifiers.push(parseImportDefaultSpecifier());
24792
            if (match(',')) {
24793
                lex();
24794
            }
24795
        }
24796
        if (match('*')) {
24797
            // covers:
24798
            // import foo, * as foo
24799
            // import * as foo
24800
            specifiers.push(parseImportNamespaceSpecifier());
24801
        } else if (match('{')) {
24802
            // covers:
24803
            // import foo, {bar}
24804
            // import {bar}
24805
            specifiers = specifiers.concat(parseNamedImports());
24806
        }
24807
24808
        if (!matchContextualKeyword('from')) {
24809
            throwError(lookahead.value ?
24810
                    Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
24811
        }
24812
        lex();
24813
        src = parseModuleSpecifier();
24814
        consumeSemicolon();
24815
24816
        return node.finishImportDeclaration(specifiers, src);
24817
    }
24818
24819
    // 14 Program
24820
24821
    function parseScriptBody() {
24822
        var statement, body = [], token, directive, firstRestricted;
24823
24824
        while (startIndex < length) {
24825
            token = lookahead;
24826
            if (token.type !== Token.StringLiteral) {
24827
                break;
24828
            }
24829
24830
            statement = parseStatementListItem();
24831
            body.push(statement);
24832
            if (statement.expression.type !== Syntax.Literal) {
24833
                // this is not directive
24834
                break;
24835
            }
24836
            directive = source.slice(token.start + 1, token.end - 1);
24837
            if (directive === 'use strict') {
24838
                strict = true;
24839
                if (firstRestricted) {
24840
                    tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
24841
                }
24842
            } else {
24843
                if (!firstRestricted && token.octal) {
24844
                    firstRestricted = token;
24845
                }
24846
            }
24847
        }
24848
24849
        while (startIndex < length) {
24850
            statement = parseStatementListItem();
24851
            /* istanbul ignore if */
24852
            if (typeof statement === 'undefined') {
24853
                break;
24854
            }
24855
            body.push(statement);
24856
        }
24857
        return body;
24858
    }
24859
24860
    function parseProgram() {
24861
        var body, node;
24862
24863
        peek();
24864
        node = new Node();
24865
24866
        body = parseScriptBody();
24867
        return node.finishProgram(body);
24868
    }
24869
24870
    function filterTokenLocation() {
24871
        var i, entry, token, tokens = [];
24872
24873
        for (i = 0; i < extra.tokens.length; ++i) {
24874
            entry = extra.tokens[i];
24875
            token = {
24876
                type: entry.type,
24877
                value: entry.value
24878
            };
24879
            if (entry.regex) {
24880
                token.regex = {
24881
                    pattern: entry.regex.pattern,
24882
                    flags: entry.regex.flags
24883
                };
24884
            }
24885
            if (extra.range) {
24886
                token.range = entry.range;
24887
            }
24888
            if (extra.loc) {
24889
                token.loc = entry.loc;
24890
            }
24891
            tokens.push(token);
24892
        }
24893
24894
        extra.tokens = tokens;
24895
    }
24896
24897
    function tokenize(code, options) {
24898
        var toString,
24899
            tokens;
24900
24901
        toString = String;
24902
        if (typeof code !== 'string' && !(code instanceof String)) {
24903
            code = toString(code);
24904
        }
24905
24906
        source = code;
24907
        index = 0;
24908
        lineNumber = (source.length > 0) ? 1 : 0;
24909
        lineStart = 0;
24910
        startIndex = index;
24911
        startLineNumber = lineNumber;
24912
        startLineStart = lineStart;
24913
        length = source.length;
24914
        lookahead = null;
24915
        state = {
24916
            allowIn: true,
24917
            labelSet: {},
24918
            inFunctionBody: false,
24919
            inIteration: false,
24920
            inSwitch: false,
24921
            lastCommentStart: -1,
24922
            curlyStack: []
24923
        };
24924
24925
        extra = {};
24926
24927
        // Options matching.
24928
        options = options || {};
24929
24930
        // Of course we collect tokens here.
24931
        options.tokens = true;
24932
        extra.tokens = [];
24933
        extra.tokenize = true;
24934
        // The following two fields are necessary to compute the Regex tokens.
24935
        extra.openParenToken = -1;
24936
        extra.openCurlyToken = -1;
24937
24938
        extra.range = (typeof options.range === 'boolean') && options.range;
24939
        extra.loc = (typeof options.loc === 'boolean') && options.loc;
24940
24941
        if (typeof options.comment === 'boolean' && options.comment) {
24942
            extra.comments = [];
24943
        }
24944
        if (typeof options.tolerant === 'boolean' && options.tolerant) {
24945
            extra.errors = [];
24946
        }
24947
24948
        try {
24949
            peek();
24950
            if (lookahead.type === Token.EOF) {
24951
                return extra.tokens;
24952
            }
24953
24954
            lex();
24955
            while (lookahead.type !== Token.EOF) {
24956
                try {
24957
                    lex();
24958
                } catch (lexError) {
24959
                    if (extra.errors) {
24960
                        recordError(lexError);
24961
                        // We have to break on the first error
24962
                        // to avoid infinite loops.
24963
                        break;
24964
                    } else {
24965
                        throw lexError;
24966
                    }
24967
                }
24968
            }
24969
24970
            filterTokenLocation();
24971
            tokens = extra.tokens;
24972
            if (typeof extra.comments !== 'undefined') {
24973
                tokens.comments = extra.comments;
24974
            }
24975
            if (typeof extra.errors !== 'undefined') {
24976
                tokens.errors = extra.errors;
24977
            }
24978
        } catch (e) {
24979
            throw e;
24980
        } finally {
24981
            extra = {};
24982
        }
24983
        return tokens;
24984
    }
24985
24986
    function parse(code, options) {
24987
        var program, toString;
24988
24989
        toString = String;
24990
        if (typeof code !== 'string' && !(code instanceof String)) {
24991
            code = toString(code);
24992
        }
24993
24994
        source = code;
24995
        index = 0;
24996
        lineNumber = (source.length > 0) ? 1 : 0;
24997
        lineStart = 0;
24998
        startIndex = index;
24999
        startLineNumber = lineNumber;
25000
        startLineStart = lineStart;
25001
        length = source.length;
25002
        lookahead = null;
25003
        state = {
25004
            allowIn: true,
25005
            labelSet: {},
25006
            inFunctionBody: false,
25007
            inIteration: false,
25008
            inSwitch: false,
25009
            lastCommentStart: -1,
25010
            curlyStack: []
25011
        };
25012
        sourceType = 'script';
25013
        strict = false;
25014
25015
        extra = {};
25016
        if (typeof options !== 'undefined') {
25017
            extra.range = (typeof options.range === 'boolean') && options.range;
25018
            extra.loc = (typeof options.loc === 'boolean') && options.loc;
25019
            extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;
25020
25021
            if (extra.loc && options.source !== null && options.source !== undefined) {
25022
                extra.source = toString(options.source);
25023
            }
25024
25025
            if (typeof options.tokens === 'boolean' && options.tokens) {
25026
                extra.tokens = [];
25027
            }
25028
            if (typeof options.comment === 'boolean' && options.comment) {
25029
                extra.comments = [];
25030
            }
25031
            if (typeof options.tolerant === 'boolean' && options.tolerant) {
25032
                extra.errors = [];
25033
            }
25034
            if (extra.attachComment) {
25035
                extra.range = true;
25036
                extra.comments = [];
25037
                extra.bottomRightStack = [];
25038
                extra.trailingComments = [];
25039
                extra.leadingComments = [];
25040
            }
25041
            if (options.sourceType === 'module') {
25042
                // very restrictive condition for now
25043
                sourceType = options.sourceType;
25044
                strict = true;
25045
            }
25046
        }
25047
25048
        try {
25049
            program = parseProgram();
25050
            if (typeof extra.comments !== 'undefined') {
25051
                program.comments = extra.comments;
25052
            }
25053
            if (typeof extra.tokens !== 'undefined') {
25054
                filterTokenLocation();
25055
                program.tokens = extra.tokens;
25056
            }
25057
            if (typeof extra.errors !== 'undefined') {
25058
                program.errors = extra.errors;
25059
            }
25060
        } catch (e) {
25061
            throw e;
25062
        } finally {
25063
            extra = {};
25064
        }
25065
25066
        return program;
25067
    }
25068
25069
    // Sync with *.json manifests.
25070
    exports.version = '2.2.0';
25071
25072
    exports.tokenize = tokenize;
25073
25074
    exports.parse = parse;
25075
25076
    // Deep copy.
25077
    /* istanbul ignore next */
25078
    exports.Syntax = (function () {
25079
        var name, types = {};
25080
25081
        if (typeof Object.create === 'function') {
25082
            types = Object.create(null);
25083
        }
25084
25085
        for (name in Syntax) {
25086
            if (Syntax.hasOwnProperty(name)) {
25087
                types[name] = Syntax[name];
25088
            }
25089
        }
25090
25091
        if (typeof Object.freeze === 'function') {
25092
            Object.freeze(types);
25093
        }
25094
25095
        return types;
25096
    }());
25097
25098
}));
25099
/* vim: set sw=4 ts=4 et tw=80 : */
25100
25101
},{}],52:[function(require,module,exports){
25102
var baseIndexOf = require('../internal/baseIndexOf'),
25103
    binaryIndex = require('../internal/binaryIndex');
25104
25105
/* Native method references for those with the same name as other `lodash` methods. */
25106
var nativeMax = Math.max;
25107
25108
/**
25109
 * Gets the index at which the first occurrence of `value` is found in `array`
25110
 * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
25111
 * for equality comparisons. If `fromIndex` is negative, it is used as the offset
25112
 * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
25113
 * performs a faster binary search.
25114
 *
25115
 * @static
25116
 * @memberOf _
25117
 * @category Array
25118
 * @param {Array} array The array to search.
25119
 * @param {*} value The value to search for.
25120
 * @param {boolean|number} [fromIndex=0] The index to search from or `true`
25121
 *  to perform a binary search on a sorted array.
25122
 * @returns {number} Returns the index of the matched value, else `-1`.
25123
 * @example
25124
 *
25125
 * _.indexOf([1, 2, 1, 2], 2);
25126
 * // => 1
25127
 *
25128
 * // using `fromIndex`
25129
 * _.indexOf([1, 2, 1, 2], 2, 2);
25130
 * // => 3
25131
 *
25132
 * // performing a binary search
25133
 * _.indexOf([1, 1, 2, 2], 2, true);
25134
 * // => 2
25135
 */
25136
function indexOf(array, value, fromIndex) {
25137
  var length = array ? array.length : 0;
25138
  if (!length) {
25139
    return -1;
25140
  }
25141
  if (typeof fromIndex == 'number') {
25142
    fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
25143
  } else if (fromIndex) {
25144
    var index = binaryIndex(array, value);
25145
    if (index < length &&
25146
        (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
25147
      return index;
25148
    }
25149
    return -1;
25150
  }
25151
  return baseIndexOf(array, value, fromIndex || 0);
25152
}
25153
25154
module.exports = indexOf;
25155
25156
},{"../internal/baseIndexOf":81,"../internal/binaryIndex":95}],53:[function(require,module,exports){
25157
/**
25158
 * Gets the last element of `array`.
25159
 *
25160
 * @static
25161
 * @memberOf _
25162
 * @category Array
25163
 * @param {Array} array The array to query.
25164
 * @returns {*} Returns the last element of `array`.
25165
 * @example
25166
 *
25167
 * _.last([1, 2, 3]);
25168
 * // => 3
25169
 */
25170
function last(array) {
25171
  var length = array ? array.length : 0;
25172
  return length ? array[length - 1] : undefined;
25173
}
25174
25175
module.exports = last;
25176
25177
},{}],54:[function(require,module,exports){
25178
var LazyWrapper = require('../internal/LazyWrapper'),
25179
    LodashWrapper = require('../internal/LodashWrapper'),
25180
    baseLodash = require('../internal/baseLodash'),
25181
    isArray = require('../lang/isArray'),
25182
    isObjectLike = require('../internal/isObjectLike'),
25183
    wrapperClone = require('../internal/wrapperClone');
25184
25185
/** Used for native method references. */
25186
var objectProto = Object.prototype;
25187
25188
/** Used to check objects for own properties. */
25189
var hasOwnProperty = objectProto.hasOwnProperty;
25190
25191
/**
25192
 * Creates a `lodash` object which wraps `value` to enable implicit chaining.
25193
 * Methods that operate on and return arrays, collections, and functions can
25194
 * be chained together. Methods that retrieve a single value or may return a
25195
 * primitive value will automatically end the chain returning the unwrapped
25196
 * value. Explicit chaining may be enabled using `_.chain`. The execution of
25197
 * chained methods is lazy, that is, execution is deferred until `_#value`
25198
 * is implicitly or explicitly called.
25199
 *
25200
 * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
25201
 * fusion is an optimization strategy which merge iteratee calls; this can help
25202
 * to avoid the creation of intermediate data structures and greatly reduce the
25203
 * number of iteratee executions.
25204
 *
25205
 * Chaining is supported in custom builds as long as the `_#value` method is
25206
 * directly or indirectly included in the build.
25207
 *
25208
 * In addition to lodash methods, wrappers have `Array` and `String` methods.
25209
 *
25210
 * The wrapper `Array` methods are:
25211
 * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
25212
 * `splice`, and `unshift`
25213
 *
25214
 * The wrapper `String` methods are:
25215
 * `replace` and `split`
25216
 *
25217
 * The wrapper methods that support shortcut fusion are:
25218
 * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
25219
 * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
25220
 * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
25221
 * and `where`
25222
 *
25223
 * The chainable wrapper methods are:
25224
 * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
25225
 * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
25226
 * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
25227
 * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
25228
 * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
25229
 * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
25230
 * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
25231
 * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
25232
 * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
25233
 * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
25234
 * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
25235
 * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
25236
 * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
25237
 * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
25238
 * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
25239
 * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
25240
 * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
25241
 *
25242
 * The wrapper methods that are **not** chainable by default are:
25243
 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
25244
 * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
25245
 * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
25246
 * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
25247
 * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
25248
 * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
25249
 * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
25250
 * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
25251
 * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
25252
 * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
25253
 * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
25254
 * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
25255
 * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
25256
 * `unescape`, `uniqueId`, `value`, and `words`
25257
 *
25258
 * The wrapper method `sample` will return a wrapped value when `n` is provided,
25259
 * otherwise an unwrapped value is returned.
25260
 *
25261
 * @name _
25262
 * @constructor
25263
 * @category Chain
25264
 * @param {*} value The value to wrap in a `lodash` instance.
25265
 * @returns {Object} Returns the new `lodash` wrapper instance.
25266
 * @example
25267
 *
25268
 * var wrapped = _([1, 2, 3]);
25269
 *
25270
 * // returns an unwrapped value
25271
 * wrapped.reduce(function(total, n) {
25272
 *   return total + n;
25273
 * });
25274
 * // => 6
25275
 *
25276
 * // returns a wrapped value
25277
 * var squares = wrapped.map(function(n) {
25278
 *   return n * n;
25279
 * });
25280
 *
25281
 * _.isArray(squares);
25282
 * // => false
25283
 *
25284
 * _.isArray(squares.value());
25285
 * // => true
25286
 */
25287
function lodash(value) {
25288
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
25289
    if (value instanceof LodashWrapper) {
25290
      return value;
25291
    }
25292
    if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
25293
      return wrapperClone(value);
25294
    }
25295
  }
25296
  return new LodashWrapper(value);
25297
}
25298
25299
// Ensure wrappers are instances of `baseLodash`.
25300
lodash.prototype = baseLodash.prototype;
25301
25302
module.exports = lodash;
25303
25304
},{"../internal/LazyWrapper":63,"../internal/LodashWrapper":64,"../internal/baseLodash":85,"../internal/isObjectLike":129,"../internal/wrapperClone":140,"../lang/isArray":143}],55:[function(require,module,exports){
25305
module.exports = require('./forEach');
25306
25307
},{"./forEach":57}],56:[function(require,module,exports){
25308
var baseEach = require('../internal/baseEach'),
25309
    createFind = require('../internal/createFind');
25310
25311
/**
25312
 * Iterates over elements of `collection`, returning the first element
25313
 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
25314
 * invoked with three arguments: (value, index|key, collection).
25315
 *
25316
 * If a property name is provided for `predicate` the created `_.property`
25317
 * style callback returns the property value of the given element.
25318
 *
25319
 * If a value is also provided for `thisArg` the created `_.matchesProperty`
25320
 * style callback returns `true` for elements that have a matching property
25321
 * value, else `false`.
25322
 *
25323
 * If an object is provided for `predicate` the created `_.matches` style
25324
 * callback returns `true` for elements that have the properties of the given
25325
 * object, else `false`.
25326
 *
25327
 * @static
25328
 * @memberOf _
25329
 * @alias detect
25330
 * @category Collection
25331
 * @param {Array|Object|string} collection The collection to search.
25332
 * @param {Function|Object|string} [predicate=_.identity] The function invoked
25333
 *  per iteration.
25334
 * @param {*} [thisArg] The `this` binding of `predicate`.
25335
 * @returns {*} Returns the matched element, else `undefined`.
25336
 * @example
25337
 *
25338
 * var users = [
25339
 *   { 'user': 'barney',  'age': 36, 'active': true },
25340
 *   { 'user': 'fred',    'age': 40, 'active': false },
25341
 *   { 'user': 'pebbles', 'age': 1,  'active': true }
25342
 * ];
25343
 *
25344
 * _.result(_.find(users, function(chr) {
25345
 *   return chr.age < 40;
25346
 * }), 'user');
25347
 * // => 'barney'
25348
 *
25349
 * // using the `_.matches` callback shorthand
25350
 * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
25351
 * // => 'pebbles'
25352
 *
25353
 * // using the `_.matchesProperty` callback shorthand
25354
 * _.result(_.find(users, 'active', false), 'user');
25355
 * // => 'fred'
25356
 *
25357
 * // using the `_.property` callback shorthand
25358
 * _.result(_.find(users, 'active'), 'user');
25359
 * // => 'barney'
25360
 */
25361
var find = createFind(baseEach);
25362
25363
module.exports = find;
25364
25365
},{"../internal/baseEach":74,"../internal/createFind":105}],57:[function(require,module,exports){
25366
var arrayEach = require('../internal/arrayEach'),
25367
    baseEach = require('../internal/baseEach'),
25368
    createForEach = require('../internal/createForEach');
25369
25370
/**
25371
 * Iterates over elements of `collection` invoking `iteratee` for each element.
25372
 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
25373
 * (value, index|key, collection). Iteratee functions may exit iteration early
25374
 * by explicitly returning `false`.
25375
 *
25376
 * **Note:** As with other "Collections" methods, objects with a "length" property
25377
 * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
25378
 * may be used for object iteration.
25379
 *
25380
 * @static
25381
 * @memberOf _
25382
 * @alias each
25383
 * @category Collection
25384
 * @param {Array|Object|string} collection The collection to iterate over.
25385
 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
25386
 * @param {*} [thisArg] The `this` binding of `iteratee`.
25387
 * @returns {Array|Object|string} Returns `collection`.
25388
 * @example
25389
 *
25390
 * _([1, 2]).forEach(function(n) {
25391
 *   console.log(n);
25392
 * }).value();
25393
 * // => logs each value from left to right and returns the array
25394
 *
25395
 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
25396
 *   console.log(n, key);
25397
 * });
25398
 * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
25399
 */
25400
var forEach = createForEach(arrayEach, baseEach);
25401
25402
module.exports = forEach;
25403
25404
},{"../internal/arrayEach":66,"../internal/baseEach":74,"../internal/createForEach":106}],58:[function(require,module,exports){
25405
var baseIndexOf = require('../internal/baseIndexOf'),
25406
    getLength = require('../internal/getLength'),
25407
    isArray = require('../lang/isArray'),
25408
    isIterateeCall = require('../internal/isIterateeCall'),
25409
    isLength = require('../internal/isLength'),
25410
    isString = require('../lang/isString'),
25411
    values = require('../object/values');
25412
25413
/* Native method references for those with the same name as other `lodash` methods. */
25414
var nativeMax = Math.max;
25415
25416
/**
25417
 * Checks if `value` is in `collection` using
25418
 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
25419
 * for equality comparisons. If `fromIndex` is negative, it is used as the offset
25420
 * from the end of `collection`.
25421
 *
25422
 * @static
25423
 * @memberOf _
25424
 * @alias contains, include
25425
 * @category Collection
25426
 * @param {Array|Object|string} collection The collection to search.
25427
 * @param {*} target The value to search for.
25428
 * @param {number} [fromIndex=0] The index to search from.
25429
 * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
25430
 * @returns {boolean} Returns `true` if a matching element is found, else `false`.
25431
 * @example
25432
 *
25433
 * _.includes([1, 2, 3], 1);
25434
 * // => true
25435
 *
25436
 * _.includes([1, 2, 3], 1, 2);
25437
 * // => false
25438
 *
25439
 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
25440
 * // => true
25441
 *
25442
 * _.includes('pebbles', 'eb');
25443
 * // => true
25444
 */
25445
function includes(collection, target, fromIndex, guard) {
25446
  var length = collection ? getLength(collection) : 0;
25447
  if (!isLength(length)) {
25448
    collection = values(collection);
25449
    length = collection.length;
25450
  }
25451
  if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
25452
    fromIndex = 0;
25453
  } else {
25454
    fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
25455
  }
25456
  return (typeof collection == 'string' || !isArray(collection) && isString(collection))
25457
    ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
25458
    : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
25459
}
25460
25461
module.exports = includes;
25462
25463
},{"../internal/baseIndexOf":81,"../internal/getLength":115,"../internal/isIterateeCall":125,"../internal/isLength":128,"../lang/isArray":143,"../lang/isString":149,"../object/values":155}],59:[function(require,module,exports){
25464
var arrayMap = require('../internal/arrayMap'),
25465
    baseCallback = require('../internal/baseCallback'),
25466
    baseMap = require('../internal/baseMap'),
25467
    isArray = require('../lang/isArray');
25468
25469
/**
25470
 * Creates an array of values by running each element in `collection` through
25471
 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
25472
 * arguments: (value, index|key, collection).
25473
 *
25474
 * If a property name is provided for `iteratee` the created `_.property`
25475
 * style callback returns the property value of the given element.
25476
 *
25477
 * If a value is also provided for `thisArg` the created `_.matchesProperty`
25478
 * style callback returns `true` for elements that have a matching property
25479
 * value, else `false`.
25480
 *
25481
 * If an object is provided for `iteratee` the created `_.matches` style
25482
 * callback returns `true` for elements that have the properties of the given
25483
 * object, else `false`.
25484
 *
25485
 * Many lodash methods are guarded to work as iteratees for methods like
25486
 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
25487
 *
25488
 * The guarded methods are:
25489
 * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
25490
 * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
25491
 * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
25492
 * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
25493
 * `sum`, `uniq`, and `words`
25494
 *
25495
 * @static
25496
 * @memberOf _
25497
 * @alias collect
25498
 * @category Collection
25499
 * @param {Array|Object|string} collection The collection to iterate over.
25500
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked
25501
 *  per iteration.
25502
 * @param {*} [thisArg] The `this` binding of `iteratee`.
25503
 * @returns {Array} Returns the new mapped array.
25504
 * @example
25505
 *
25506
 * function timesThree(n) {
25507
 *   return n * 3;
25508
 * }
25509
 *
25510
 * _.map([1, 2], timesThree);
25511
 * // => [3, 6]
25512
 *
25513
 * _.map({ 'a': 1, 'b': 2 }, timesThree);
25514
 * // => [3, 6] (iteration order is not guaranteed)
25515
 *
25516
 * var users = [
25517
 *   { 'user': 'barney' },
25518
 *   { 'user': 'fred' }
25519
 * ];
25520
 *
25521
 * // using the `_.property` callback shorthand
25522
 * _.map(users, 'user');
25523
 * // => ['barney', 'fred']
25524
 */
25525
function map(collection, iteratee, thisArg) {
25526
  var func = isArray(collection) ? arrayMap : baseMap;
25527
  iteratee = baseCallback(iteratee, thisArg, 3);
25528
  return func(collection, iteratee);
25529
}
25530
25531
module.exports = map;
25532
25533
},{"../internal/arrayMap":67,"../internal/baseCallback":70,"../internal/baseMap":86,"../lang/isArray":143}],60:[function(require,module,exports){
25534
var getNative = require('../internal/getNative');
25535
25536
/* Native method references for those with the same name as other `lodash` methods. */
25537
var nativeNow = getNative(Date, 'now');
25538
25539
/**
25540
 * Gets the number of milliseconds that have elapsed since the Unix epoch
25541
 * (1 January 1970 00:00:00 UTC).
25542
 *
25543
 * @static
25544
 * @memberOf _
25545
 * @category Date
25546
 * @example
25547
 *
25548
 * _.defer(function(stamp) {
25549
 *   console.log(_.now() - stamp);
25550
 * }, _.now());
25551
 * // => logs the number of milliseconds it took for the deferred function to be invoked
25552
 */
25553
var now = nativeNow || function() {
25554
  return new Date().getTime();
25555
};
25556
25557
module.exports = now;
25558
25559
},{"../internal/getNative":117}],61:[function(require,module,exports){
25560
var createWrapper = require('../internal/createWrapper'),
25561
    replaceHolders = require('../internal/replaceHolders'),
25562
    restParam = require('./restParam');
25563
25564
/** Used to compose bitmasks for wrapper metadata. */
25565
var BIND_FLAG = 1,
25566
    PARTIAL_FLAG = 32;
25567
25568
/**
25569
 * Creates a function that invokes `func` with the `this` binding of `thisArg`
25570
 * and prepends any additional `_.bind` arguments to those provided to the
25571
 * bound function.
25572
 *
25573
 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
25574
 * may be used as a placeholder for partially applied arguments.
25575
 *
25576
 * **Note:** Unlike native `Function#bind` this method does not set the "length"
25577
 * property of bound functions.
25578
 *
25579
 * @static
25580
 * @memberOf _
25581
 * @category Function
25582
 * @param {Function} func The function to bind.
25583
 * @param {*} thisArg The `this` binding of `func`.
25584
 * @param {...*} [partials] The arguments to be partially applied.
25585
 * @returns {Function} Returns the new bound function.
25586
 * @example
25587
 *
25588
 * var greet = function(greeting, punctuation) {
25589
 *   return greeting + ' ' + this.user + punctuation;
25590
 * };
25591
 *
25592
 * var object = { 'user': 'fred' };
25593
 *
25594
 * var bound = _.bind(greet, object, 'hi');
25595
 * bound('!');
25596
 * // => 'hi fred!'
25597
 *
25598
 * // using placeholders
25599
 * var bound = _.bind(greet, object, _, '!');
25600
 * bound('hi');
25601
 * // => 'hi fred!'
25602
 */
25603
var bind = restParam(function(func, thisArg, partials) {
25604
  var bitmask = BIND_FLAG;
25605
  if (partials.length) {
25606
    var holders = replaceHolders(partials, bind.placeholder);
25607
    bitmask |= PARTIAL_FLAG;
25608
  }
25609
  return createWrapper(func, bitmask, thisArg, partials, holders);
25610
});
25611
25612
// Assign default placeholders.
25613
bind.placeholder = {};
25614
25615
module.exports = bind;
25616
25617
},{"../internal/createWrapper":109,"../internal/replaceHolders":135,"./restParam":62}],62:[function(require,module,exports){
25618
/** Used as the `TypeError` message for "Functions" methods. */
25619
var FUNC_ERROR_TEXT = 'Expected a function';
25620
25621
/* Native method references for those with the same name as other `lodash` methods. */
25622
var nativeMax = Math.max;
25623
25624
/**
25625
 * Creates a function that invokes `func` with the `this` binding of the
25626
 * created function and arguments from `start` and beyond provided as an array.
25627
 *
25628
 * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
25629
 *
25630
 * @static
25631
 * @memberOf _
25632
 * @category Function
25633
 * @param {Function} func The function to apply a rest parameter to.
25634
 * @param {number} [start=func.length-1] The start position of the rest parameter.
25635
 * @returns {Function} Returns the new function.
25636
 * @example
25637
 *
25638
 * var say = _.restParam(function(what, names) {
25639
 *   return what + ' ' + _.initial(names).join(', ') +
25640
 *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
25641
 * });
25642
 *
25643
 * say('hello', 'fred', 'barney', 'pebbles');
25644
 * // => 'hello fred, barney, & pebbles'
25645
 */
25646
function restParam(func, start) {
25647
  if (typeof func != 'function') {
25648
    throw new TypeError(FUNC_ERROR_TEXT);
25649
  }
25650
  start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
25651
  return function() {
25652
    var args = arguments,
25653
        index = -1,
25654
        length = nativeMax(args.length - start, 0),
25655
        rest = Array(length);
25656
25657
    while (++index < length) {
25658
      rest[index] = args[start + index];
25659
    }
25660
    switch (start) {
25661
      case 0: return func.call(this, rest);
25662
      case 1: return func.call(this, args[0], rest);
25663
      case 2: return func.call(this, args[0], args[1], rest);
25664
    }
25665
    var otherArgs = Array(start + 1);
25666
    index = -1;
25667
    while (++index < start) {
25668
      otherArgs[index] = args[index];
25669
    }
25670
    otherArgs[start] = rest;
25671
    return func.apply(this, otherArgs);
25672
  };
25673
}
25674
25675
module.exports = restParam;
25676
25677
},{}],63:[function(require,module,exports){
25678
var baseCreate = require('./baseCreate'),
25679
    baseLodash = require('./baseLodash');
25680
25681
/** Used as references for `-Infinity` and `Infinity`. */
25682
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
25683
25684
/**
25685
 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
25686
 *
25687
 * @private
25688
 * @param {*} value The value to wrap.
25689
 */
25690
function LazyWrapper(value) {
25691
  this.__wrapped__ = value;
25692
  this.__actions__ = [];
25693
  this.__dir__ = 1;
25694
  this.__filtered__ = false;
25695
  this.__iteratees__ = [];
25696
  this.__takeCount__ = POSITIVE_INFINITY;
25697
  this.__views__ = [];
25698
}
25699
25700
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
25701
LazyWrapper.prototype.constructor = LazyWrapper;
25702
25703
module.exports = LazyWrapper;
25704
25705
},{"./baseCreate":73,"./baseLodash":85}],64:[function(require,module,exports){
25706
var baseCreate = require('./baseCreate'),
25707
    baseLodash = require('./baseLodash');
25708
25709
/**
25710
 * The base constructor for creating `lodash` wrapper objects.
25711
 *
25712
 * @private
25713
 * @param {*} value The value to wrap.
25714
 * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
25715
 * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
25716
 */
25717
function LodashWrapper(value, chainAll, actions) {
25718
  this.__wrapped__ = value;
25719
  this.__actions__ = actions || [];
25720
  this.__chain__ = !!chainAll;
25721
}
25722
25723
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
25724
LodashWrapper.prototype.constructor = LodashWrapper;
25725
25726
module.exports = LodashWrapper;
25727
25728
},{"./baseCreate":73,"./baseLodash":85}],65:[function(require,module,exports){
25729
/**
25730
 * Copies the values of `source` to `array`.
25731
 *
25732
 * @private
25733
 * @param {Array} source The array to copy values from.
25734
 * @param {Array} [array=[]] The array to copy values to.
25735
 * @returns {Array} Returns `array`.
25736
 */
25737
function arrayCopy(source, array) {
25738
  var index = -1,
25739
      length = source.length;
25740
25741
  array || (array = Array(length));
25742
  while (++index < length) {
25743
    array[index] = source[index];
25744
  }
25745
  return array;
25746
}
25747
25748
module.exports = arrayCopy;
25749
25750
},{}],66:[function(require,module,exports){
25751
/**
25752
 * A specialized version of `_.forEach` for arrays without support for callback
25753
 * shorthands and `this` binding.
25754
 *
25755
 * @private
25756
 * @param {Array} array The array to iterate over.
25757
 * @param {Function} iteratee The function invoked per iteration.
25758
 * @returns {Array} Returns `array`.
25759
 */
25760
function arrayEach(array, iteratee) {
25761
  var index = -1,
25762
      length = array.length;
25763
25764
  while (++index < length) {
25765
    if (iteratee(array[index], index, array) === false) {
25766
      break;
25767
    }
25768
  }
25769
  return array;
25770
}
25771
25772
module.exports = arrayEach;
25773
25774
},{}],67:[function(require,module,exports){
25775
/**
25776
 * A specialized version of `_.map` for arrays without support for callback
25777
 * shorthands and `this` binding.
25778
 *
25779
 * @private
25780
 * @param {Array} array The array to iterate over.
25781
 * @param {Function} iteratee The function invoked per iteration.
25782
 * @returns {Array} Returns the new mapped array.
25783
 */
25784
function arrayMap(array, iteratee) {
25785
  var index = -1,
25786
      length = array.length,
25787
      result = Array(length);
25788
25789
  while (++index < length) {
25790
    result[index] = iteratee(array[index], index, array);
25791
  }
25792
  return result;
25793
}
25794
25795
module.exports = arrayMap;
25796
25797
},{}],68:[function(require,module,exports){
25798
/**
25799
 * A specialized version of `_.some` for arrays without support for callback
25800
 * shorthands and `this` binding.
25801
 *
25802
 * @private
25803
 * @param {Array} array The array to iterate over.
25804
 * @param {Function} predicate The function invoked per iteration.
25805
 * @returns {boolean} Returns `true` if any element passes the predicate check,
25806
 *  else `false`.
25807
 */
25808
function arraySome(array, predicate) {
25809
  var index = -1,
25810
      length = array.length;
25811
25812
  while (++index < length) {
25813
    if (predicate(array[index], index, array)) {
25814
      return true;
25815
    }
25816
  }
25817
  return false;
25818
}
25819
25820
module.exports = arraySome;
25821
25822
},{}],69:[function(require,module,exports){
25823
var baseCopy = require('./baseCopy'),
25824
    keys = require('../object/keys');
25825
25826
/**
25827
 * The base implementation of `_.assign` without support for argument juggling,
25828
 * multiple sources, and `customizer` functions.
25829
 *
25830
 * @private
25831
 * @param {Object} object The destination object.
25832
 * @param {Object} source The source object.
25833
 * @returns {Object} Returns `object`.
25834
 */
25835
function baseAssign(object, source) {
25836
  return source == null
25837
    ? object
25838
    : baseCopy(source, keys(source), object);
25839
}
25840
25841
module.exports = baseAssign;
25842
25843
},{"../object/keys":152,"./baseCopy":72}],70:[function(require,module,exports){
25844
var baseMatches = require('./baseMatches'),
25845
    baseMatchesProperty = require('./baseMatchesProperty'),
25846
    bindCallback = require('./bindCallback'),
25847
    identity = require('../utility/identity'),
25848
    property = require('../utility/property');
25849
25850
/**
25851
 * The base implementation of `_.callback` which supports specifying the
25852
 * number of arguments to provide to `func`.
25853
 *
25854
 * @private
25855
 * @param {*} [func=_.identity] The value to convert to a callback.
25856
 * @param {*} [thisArg] The `this` binding of `func`.
25857
 * @param {number} [argCount] The number of arguments to provide to `func`.
25858
 * @returns {Function} Returns the callback.
25859
 */
25860
function baseCallback(func, thisArg, argCount) {
25861
  var type = typeof func;
25862
  if (type == 'function') {
25863
    return thisArg === undefined
25864
      ? func
25865
      : bindCallback(func, thisArg, argCount);
25866
  }
25867
  if (func == null) {
25868
    return identity;
25869
  }
25870
  if (type == 'object') {
25871
    return baseMatches(func);
25872
  }
25873
  return thisArg === undefined
25874
    ? property(func)
25875
    : baseMatchesProperty(func, thisArg);
25876
}
25877
25878
module.exports = baseCallback;
25879
25880
},{"../utility/identity":157,"../utility/property":159,"./baseMatches":87,"./baseMatchesProperty":88,"./bindCallback":97}],71:[function(require,module,exports){
25881
var arrayCopy = require('./arrayCopy'),
25882
    arrayEach = require('./arrayEach'),
25883
    baseAssign = require('./baseAssign'),
25884
    baseForOwn = require('./baseForOwn'),
25885
    initCloneArray = require('./initCloneArray'),
25886
    initCloneByTag = require('./initCloneByTag'),
25887
    initCloneObject = require('./initCloneObject'),
25888
    isArray = require('../lang/isArray'),
25889
    isHostObject = require('./isHostObject'),
25890
    isObject = require('../lang/isObject');
25891
25892
/** `Object#toString` result references. */
25893
var argsTag = '[object Arguments]',
25894
    arrayTag = '[object Array]',
25895
    boolTag = '[object Boolean]',
25896
    dateTag = '[object Date]',
25897
    errorTag = '[object Error]',
25898
    funcTag = '[object Function]',
25899
    mapTag = '[object Map]',
25900
    numberTag = '[object Number]',
25901
    objectTag = '[object Object]',
25902
    regexpTag = '[object RegExp]',
25903
    setTag = '[object Set]',
25904
    stringTag = '[object String]',
25905
    weakMapTag = '[object WeakMap]';
25906
25907
var arrayBufferTag = '[object ArrayBuffer]',
25908
    float32Tag = '[object Float32Array]',
25909
    float64Tag = '[object Float64Array]',
25910
    int8Tag = '[object Int8Array]',
25911
    int16Tag = '[object Int16Array]',
25912
    int32Tag = '[object Int32Array]',
25913
    uint8Tag = '[object Uint8Array]',
25914
    uint8ClampedTag = '[object Uint8ClampedArray]',
25915
    uint16Tag = '[object Uint16Array]',
25916
    uint32Tag = '[object Uint32Array]';
25917
25918
/** Used to identify `toStringTag` values supported by `_.clone`. */
25919
var cloneableTags = {};
25920
cloneableTags[argsTag] = cloneableTags[arrayTag] =
25921
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
25922
cloneableTags[dateTag] = cloneableTags[float32Tag] =
25923
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
25924
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
25925
cloneableTags[numberTag] = cloneableTags[objectTag] =
25926
cloneableTags[regexpTag] = cloneableTags[stringTag] =
25927
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
25928
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
25929
cloneableTags[errorTag] = cloneableTags[funcTag] =
25930
cloneableTags[mapTag] = cloneableTags[setTag] =
25931
cloneableTags[weakMapTag] = false;
25932
25933
/** Used for native method references. */
25934
var objectProto = Object.prototype;
25935
25936
/**
25937
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
25938
 * of values.
25939
 */
25940
var objToString = objectProto.toString;
25941
25942
/**
25943
 * The base implementation of `_.clone` without support for argument juggling
25944
 * and `this` binding `customizer` functions.
25945
 *
25946
 * @private
25947
 * @param {*} value The value to clone.
25948
 * @param {boolean} [isDeep] Specify a deep clone.
25949
 * @param {Function} [customizer] The function to customize cloning values.
25950
 * @param {string} [key] The key of `value`.
25951
 * @param {Object} [object] The object `value` belongs to.
25952
 * @param {Array} [stackA=[]] Tracks traversed source objects.
25953
 * @param {Array} [stackB=[]] Associates clones with source counterparts.
25954
 * @returns {*} Returns the cloned value.
25955
 */
25956
function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
25957
  var result;
25958
  if (customizer) {
25959
    result = object ? customizer(value, key, object) : customizer(value);
25960
  }
25961
  if (result !== undefined) {
25962
    return result;
25963
  }
25964
  if (!isObject(value)) {
25965
    return value;
25966
  }
25967
  var isArr = isArray(value);
25968
  if (isArr) {
25969
    result = initCloneArray(value);
25970
    if (!isDeep) {
25971
      return arrayCopy(value, result);
25972
    }
25973
  } else {
25974
    var tag = objToString.call(value),
25975
        isFunc = tag == funcTag;
25976
25977
    if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
25978
      if (isHostObject(value)) {
25979
        return object ? value : {};
25980
      }
25981
      result = initCloneObject(isFunc ? {} : value);
25982
      if (!isDeep) {
25983
        return baseAssign(result, value);
25984
      }
25985
    } else {
25986
      return cloneableTags[tag]
25987
        ? initCloneByTag(value, tag, isDeep)
25988
        : (object ? value : {});
25989
    }
25990
  }
25991
  // Check for circular references and return its corresponding clone.
25992
  stackA || (stackA = []);
25993
  stackB || (stackB = []);
25994
25995
  var length = stackA.length;
25996
  while (length--) {
25997
    if (stackA[length] == value) {
25998
      return stackB[length];
25999
    }
26000
  }
26001
  // Add the source value to the stack of traversed objects and associate it with its clone.
26002
  stackA.push(value);
26003
  stackB.push(result);
26004
26005
  // Recursively populate clone (susceptible to call stack limits).
26006
  (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
26007
    result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
26008
  });
26009
  return result;
26010
}
26011
26012
module.exports = baseClone;
26013
26014
},{"../lang/isArray":143,"../lang/isObject":147,"./arrayCopy":65,"./arrayEach":66,"./baseAssign":69,"./baseForOwn":79,"./initCloneArray":119,"./initCloneByTag":120,"./initCloneObject":121,"./isHostObject":123}],72:[function(require,module,exports){
26015
/**
26016
 * Copies properties of `source` to `object`.
26017
 *
26018
 * @private
26019
 * @param {Object} source The object to copy properties from.
26020
 * @param {Array} props The property names to copy.
26021
 * @param {Object} [object={}] The object to copy properties to.
26022
 * @returns {Object} Returns `object`.
26023
 */
26024
function baseCopy(source, props, object) {
26025
  object || (object = {});
26026
26027
  var index = -1,
26028
      length = props.length;
26029
26030
  while (++index < length) {
26031
    var key = props[index];
26032
    object[key] = source[key];
26033
  }
26034
  return object;
26035
}
26036
26037
module.exports = baseCopy;
26038
26039
},{}],73:[function(require,module,exports){
26040
var isObject = require('../lang/isObject');
26041
26042
/**
26043
 * The base implementation of `_.create` without support for assigning
26044
 * properties to the created object.
26045
 *
26046
 * @private
26047
 * @param {Object} prototype The object to inherit from.
26048
 * @returns {Object} Returns the new object.
26049
 */
26050
var baseCreate = (function() {
26051
  function object() {}
26052
  return function(prototype) {
26053
    if (isObject(prototype)) {
26054
      object.prototype = prototype;
26055
      var result = new object;
26056
      object.prototype = undefined;
26057
    }
26058
    return result || {};
26059
  };
26060
}());
26061
26062
module.exports = baseCreate;
26063
26064
},{"../lang/isObject":147}],74:[function(require,module,exports){
26065
var baseForOwn = require('./baseForOwn'),
26066
    createBaseEach = require('./createBaseEach');
26067
26068
/**
26069
 * The base implementation of `_.forEach` without support for callback
26070
 * shorthands and `this` binding.
26071
 *
26072
 * @private
26073
 * @param {Array|Object|string} collection The collection to iterate over.
26074
 * @param {Function} iteratee The function invoked per iteration.
26075
 * @returns {Array|Object|string} Returns `collection`.
26076
 */
26077
var baseEach = createBaseEach(baseForOwn);
26078
26079
module.exports = baseEach;
26080
26081
},{"./baseForOwn":79,"./createBaseEach":101}],75:[function(require,module,exports){
26082
/**
26083
 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
26084
 * without support for callback shorthands and `this` binding, which iterates
26085
 * over `collection` using the provided `eachFunc`.
26086
 *
26087
 * @private
26088
 * @param {Array|Object|string} collection The collection to search.
26089
 * @param {Function} predicate The function invoked per iteration.
26090
 * @param {Function} eachFunc The function to iterate over `collection`.
26091
 * @param {boolean} [retKey] Specify returning the key of the found element
26092
 *  instead of the element itself.
26093
 * @returns {*} Returns the found element or its key, else `undefined`.
26094
 */
26095
function baseFind(collection, predicate, eachFunc, retKey) {
26096
  var result;
26097
  eachFunc(collection, function(value, key, collection) {
26098
    if (predicate(value, key, collection)) {
26099
      result = retKey ? key : value;
26100
      return false;
26101
    }
26102
  });
26103
  return result;
26104
}
26105
26106
module.exports = baseFind;
26107
26108
},{}],76:[function(require,module,exports){
26109
/**
26110
 * The base implementation of `_.findIndex` and `_.findLastIndex` without
26111
 * support for callback shorthands and `this` binding.
26112
 *
26113
 * @private
26114
 * @param {Array} array The array to search.
26115
 * @param {Function} predicate The function invoked per iteration.
26116
 * @param {boolean} [fromRight] Specify iterating from right to left.
26117
 * @returns {number} Returns the index of the matched value, else `-1`.
26118
 */
26119
function baseFindIndex(array, predicate, fromRight) {
26120
  var length = array.length,
26121
      index = fromRight ? length : -1;
26122
26123
  while ((fromRight ? index-- : ++index < length)) {
26124
    if (predicate(array[index], index, array)) {
26125
      return index;
26126
    }
26127
  }
26128
  return -1;
26129
}
26130
26131
module.exports = baseFindIndex;
26132
26133
},{}],77:[function(require,module,exports){
26134
var createBaseFor = require('./createBaseFor');
26135
26136
/**
26137
 * The base implementation of `baseForIn` and `baseForOwn` which iterates
26138
 * over `object` properties returned by `keysFunc` invoking `iteratee` for
26139
 * each property. Iteratee functions may exit iteration early by explicitly
26140
 * returning `false`.
26141
 *
26142
 * @private
26143
 * @param {Object} object The object to iterate over.
26144
 * @param {Function} iteratee The function invoked per iteration.
26145
 * @param {Function} keysFunc The function to get the keys of `object`.
26146
 * @returns {Object} Returns `object`.
26147
 */
26148
var baseFor = createBaseFor();
26149
26150
module.exports = baseFor;
26151
26152
},{"./createBaseFor":102}],78:[function(require,module,exports){
26153
var baseFor = require('./baseFor'),
26154
    keysIn = require('../object/keysIn');
26155
26156
/**
26157
 * The base implementation of `_.forIn` without support for callback
26158
 * shorthands and `this` binding.
26159
 *
26160
 * @private
26161
 * @param {Object} object The object to iterate over.
26162
 * @param {Function} iteratee The function invoked per iteration.
26163
 * @returns {Object} Returns `object`.
26164
 */
26165
function baseForIn(object, iteratee) {
26166
  return baseFor(object, iteratee, keysIn);
26167
}
26168
26169
module.exports = baseForIn;
26170
26171
},{"../object/keysIn":153,"./baseFor":77}],79:[function(require,module,exports){
26172
var baseFor = require('./baseFor'),
26173
    keys = require('../object/keys');
26174
26175
/**
26176
 * The base implementation of `_.forOwn` without support for callback
26177
 * shorthands and `this` binding.
26178
 *
26179
 * @private
26180
 * @param {Object} object The object to iterate over.
26181
 * @param {Function} iteratee The function invoked per iteration.
26182
 * @returns {Object} Returns `object`.
26183
 */
26184
function baseForOwn(object, iteratee) {
26185
  return baseFor(object, iteratee, keys);
26186
}
26187
26188
module.exports = baseForOwn;
26189
26190
},{"../object/keys":152,"./baseFor":77}],80:[function(require,module,exports){
26191
var toObject = require('./toObject');
26192
26193
/**
26194
 * The base implementation of `get` without support for string paths
26195
 * and default values.
26196
 *
26197
 * @private
26198
 * @param {Object} object The object to query.
26199
 * @param {Array} path The path of the property to get.
26200
 * @param {string} [pathKey] The key representation of path.
26201
 * @returns {*} Returns the resolved value.
26202
 */
26203
function baseGet(object, path, pathKey) {
26204
  if (object == null) {
26205
    return;
26206
  }
26207
  object = toObject(object);
26208
  if (pathKey !== undefined && pathKey in object) {
26209
    path = [pathKey];
26210
  }
26211
  var index = 0,
26212
      length = path.length;
26213
26214
  while (object != null && index < length) {
26215
    object = toObject(object)[path[index++]];
26216
  }
26217
  return (index && index == length) ? object : undefined;
26218
}
26219
26220
module.exports = baseGet;
26221
26222
},{"./toObject":138}],81:[function(require,module,exports){
26223
var indexOfNaN = require('./indexOfNaN');
26224
26225
/**
26226
 * The base implementation of `_.indexOf` without support for binary searches.
26227
 *
26228
 * @private
26229
 * @param {Array} array The array to search.
26230
 * @param {*} value The value to search for.
26231
 * @param {number} fromIndex The index to search from.
26232
 * @returns {number} Returns the index of the matched value, else `-1`.
26233
 */
26234
function baseIndexOf(array, value, fromIndex) {
26235
  if (value !== value) {
26236
    return indexOfNaN(array, fromIndex);
26237
  }
26238
  var index = fromIndex - 1,
26239
      length = array.length;
26240
26241
  while (++index < length) {
26242
    if (array[index] === value) {
26243
      return index;
26244
    }
26245
  }
26246
  return -1;
26247
}
26248
26249
module.exports = baseIndexOf;
26250
26251
},{"./indexOfNaN":118}],82:[function(require,module,exports){
26252
var baseIsEqualDeep = require('./baseIsEqualDeep'),
26253
    isObject = require('../lang/isObject'),
26254
    isObjectLike = require('./isObjectLike');
26255
26256
/**
26257
 * The base implementation of `_.isEqual` without support for `this` binding
26258
 * `customizer` functions.
26259
 *
26260
 * @private
26261
 * @param {*} value The value to compare.
26262
 * @param {*} other The other value to compare.
26263
 * @param {Function} [customizer] The function to customize comparing values.
26264
 * @param {boolean} [isLoose] Specify performing partial comparisons.
26265
 * @param {Array} [stackA] Tracks traversed `value` objects.
26266
 * @param {Array} [stackB] Tracks traversed `other` objects.
26267
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
26268
 */
26269
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
26270
  if (value === other) {
26271
    return true;
26272
  }
26273
  if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
26274
    return value !== value && other !== other;
26275
  }
26276
  return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
26277
}
26278
26279
module.exports = baseIsEqual;
26280
26281
},{"../lang/isObject":147,"./baseIsEqualDeep":83,"./isObjectLike":129}],83:[function(require,module,exports){
26282
var equalArrays = require('./equalArrays'),
26283
    equalByTag = require('./equalByTag'),
26284
    equalObjects = require('./equalObjects'),
26285
    isArray = require('../lang/isArray'),
26286
    isHostObject = require('./isHostObject'),
26287
    isTypedArray = require('../lang/isTypedArray');
26288
26289
/** `Object#toString` result references. */
26290
var argsTag = '[object Arguments]',
26291
    arrayTag = '[object Array]',
26292
    objectTag = '[object Object]';
26293
26294
/** Used for native method references. */
26295
var objectProto = Object.prototype;
26296
26297
/** Used to check objects for own properties. */
26298
var hasOwnProperty = objectProto.hasOwnProperty;
26299
26300
/**
26301
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
26302
 * of values.
26303
 */
26304
var objToString = objectProto.toString;
26305
26306
/**
26307
 * A specialized version of `baseIsEqual` for arrays and objects which performs
26308
 * deep comparisons and tracks traversed objects enabling objects with circular
26309
 * references to be compared.
26310
 *
26311
 * @private
26312
 * @param {Object} object The object to compare.
26313
 * @param {Object} other The other object to compare.
26314
 * @param {Function} equalFunc The function to determine equivalents of values.
26315
 * @param {Function} [customizer] The function to customize comparing objects.
26316
 * @param {boolean} [isLoose] Specify performing partial comparisons.
26317
 * @param {Array} [stackA=[]] Tracks traversed `value` objects.
26318
 * @param {Array} [stackB=[]] Tracks traversed `other` objects.
26319
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
26320
 */
26321
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
26322
  var objIsArr = isArray(object),
26323
      othIsArr = isArray(other),
26324
      objTag = arrayTag,
26325
      othTag = arrayTag;
26326
26327
  if (!objIsArr) {
26328
    objTag = objToString.call(object);
26329
    if (objTag == argsTag) {
26330
      objTag = objectTag;
26331
    } else if (objTag != objectTag) {
26332
      objIsArr = isTypedArray(object);
26333
    }
26334
  }
26335
  if (!othIsArr) {
26336
    othTag = objToString.call(other);
26337
    if (othTag == argsTag) {
26338
      othTag = objectTag;
26339
    } else if (othTag != objectTag) {
26340
      othIsArr = isTypedArray(other);
26341
    }
26342
  }
26343
  var objIsObj = objTag == objectTag && !isHostObject(object),
26344
      othIsObj = othTag == objectTag && !isHostObject(other),
26345
      isSameTag = objTag == othTag;
26346
26347
  if (isSameTag && !(objIsArr || objIsObj)) {
26348
    return equalByTag(object, other, objTag);
26349
  }
26350
  if (!isLoose) {
26351
    var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
26352
        othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
26353
26354
    if (objIsWrapped || othIsWrapped) {
26355
      return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
26356
    }
26357
  }
26358
  if (!isSameTag) {
26359
    return false;
26360
  }
26361
  // Assume cyclic values are equal.
26362
  // For more information on detecting circular references see https://es5.github.io/#JO.
26363
  stackA || (stackA = []);
26364
  stackB || (stackB = []);
26365
26366
  var length = stackA.length;
26367
  while (length--) {
26368
    if (stackA[length] == object) {
26369
      return stackB[length] == other;
26370
    }
26371
  }
26372
  // Add `object` and `other` to the stack of traversed objects.
26373
  stackA.push(object);
26374
  stackB.push(other);
26375
26376
  var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
26377
26378
  stackA.pop();
26379
  stackB.pop();
26380
26381
  return result;
26382
}
26383
26384
module.exports = baseIsEqualDeep;
26385
26386
},{"../lang/isArray":143,"../lang/isTypedArray":150,"./equalArrays":110,"./equalByTag":111,"./equalObjects":112,"./isHostObject":123}],84:[function(require,module,exports){
26387
var baseIsEqual = require('./baseIsEqual'),
26388
    toObject = require('./toObject');
26389
26390
/**
26391
 * The base implementation of `_.isMatch` without support for callback
26392
 * shorthands and `this` binding.
26393
 *
26394
 * @private
26395
 * @param {Object} object The object to inspect.
26396
 * @param {Array} matchData The propery names, values, and compare flags to match.
26397
 * @param {Function} [customizer] The function to customize comparing objects.
26398
 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
26399
 */
26400
function baseIsMatch(object, matchData, customizer) {
26401
  var index = matchData.length,
26402
      length = index,
26403
      noCustomizer = !customizer;
26404
26405
  if (object == null) {
26406
    return !length;
26407
  }
26408
  object = toObject(object);
26409
  while (index--) {
26410
    var data = matchData[index];
26411
    if ((noCustomizer && data[2])
26412
          ? data[1] !== object[data[0]]
26413
          : !(data[0] in object)
26414
        ) {
26415
      return false;
26416
    }
26417
  }
26418
  while (++index < length) {
26419
    data = matchData[index];
26420
    var key = data[0],
26421
        objValue = object[key],
26422
        srcValue = data[1];
26423
26424
    if (noCustomizer && data[2]) {
26425
      if (objValue === undefined && !(key in object)) {
26426
        return false;
26427
      }
26428
    } else {
26429
      var result = customizer ? customizer(objValue, srcValue, key) : undefined;
26430
      if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
26431
        return false;
26432
      }
26433
    }
26434
  }
26435
  return true;
26436
}
26437
26438
module.exports = baseIsMatch;
26439
26440
},{"./baseIsEqual":82,"./toObject":138}],85:[function(require,module,exports){
26441
/**
26442
 * The function whose prototype all chaining wrappers inherit from.
26443
 *
26444
 * @private
26445
 */
26446
function baseLodash() {
26447
  // No operation performed.
26448
}
26449
26450
module.exports = baseLodash;
26451
26452
},{}],86:[function(require,module,exports){
26453
var baseEach = require('./baseEach'),
26454
    isArrayLike = require('./isArrayLike');
26455
26456
/**
26457
 * The base implementation of `_.map` without support for callback shorthands
26458
 * and `this` binding.
26459
 *
26460
 * @private
26461
 * @param {Array|Object|string} collection The collection to iterate over.
26462
 * @param {Function} iteratee The function invoked per iteration.
26463
 * @returns {Array} Returns the new mapped array.
26464
 */
26465
function baseMap(collection, iteratee) {
26466
  var index = -1,
26467
      result = isArrayLike(collection) ? Array(collection.length) : [];
26468
26469
  baseEach(collection, function(value, key, collection) {
26470
    result[++index] = iteratee(value, key, collection);
26471
  });
26472
  return result;
26473
}
26474
26475
module.exports = baseMap;
26476
26477
},{"./baseEach":74,"./isArrayLike":122}],87:[function(require,module,exports){
26478
var baseIsMatch = require('./baseIsMatch'),
26479
    getMatchData = require('./getMatchData'),
26480
    toObject = require('./toObject');
26481
26482
/**
26483
 * The base implementation of `_.matches` which does not clone `source`.
26484
 *
26485
 * @private
26486
 * @param {Object} source The object of property values to match.
26487
 * @returns {Function} Returns the new function.
26488
 */
26489
function baseMatches(source) {
26490
  var matchData = getMatchData(source);
26491
  if (matchData.length == 1 && matchData[0][2]) {
26492
    var key = matchData[0][0],
26493
        value = matchData[0][1];
26494
26495
    return function(object) {
26496
      if (object == null) {
26497
        return false;
26498
      }
26499
      object = toObject(object);
26500
      return object[key] === value && (value !== undefined || (key in object));
26501
    };
26502
  }
26503
  return function(object) {
26504
    return baseIsMatch(object, matchData);
26505
  };
26506
}
26507
26508
module.exports = baseMatches;
26509
26510
},{"./baseIsMatch":84,"./getMatchData":116,"./toObject":138}],88:[function(require,module,exports){
26511
var baseGet = require('./baseGet'),
26512
    baseIsEqual = require('./baseIsEqual'),
26513
    baseSlice = require('./baseSlice'),
26514
    isArray = require('../lang/isArray'),
26515
    isKey = require('./isKey'),
26516
    isStrictComparable = require('./isStrictComparable'),
26517
    last = require('../array/last'),
26518
    toObject = require('./toObject'),
26519
    toPath = require('./toPath');
26520
26521
/**
26522
 * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
26523
 *
26524
 * @private
26525
 * @param {string} path The path of the property to get.
26526
 * @param {*} srcValue The value to compare.
26527
 * @returns {Function} Returns the new function.
26528
 */
26529
function baseMatchesProperty(path, srcValue) {
26530
  var isArr = isArray(path),
26531
      isCommon = isKey(path) && isStrictComparable(srcValue),
26532
      pathKey = (path + '');
26533
26534
  path = toPath(path);
26535
  return function(object) {
26536
    if (object == null) {
26537
      return false;
26538
    }
26539
    var key = pathKey;
26540
    object = toObject(object);
26541
    if ((isArr || !isCommon) && !(key in object)) {
26542
      object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
26543
      if (object == null) {
26544
        return false;
26545
      }
26546
      key = last(path);
26547
      object = toObject(object);
26548
    }
26549
    return object[key] === srcValue
26550
      ? (srcValue !== undefined || (key in object))
26551
      : baseIsEqual(srcValue, object[key], undefined, true);
26552
  };
26553
}
26554
26555
module.exports = baseMatchesProperty;
26556
26557
},{"../array/last":53,"../lang/isArray":143,"./baseGet":80,"./baseIsEqual":82,"./baseSlice":92,"./isKey":126,"./isStrictComparable":130,"./toObject":138,"./toPath":139}],89:[function(require,module,exports){
26558
var toObject = require('./toObject');
26559
26560
/**
26561
 * The base implementation of `_.property` without support for deep paths.
26562
 *
26563
 * @private
26564
 * @param {string} key The key of the property to get.
26565
 * @returns {Function} Returns the new function.
26566
 */
26567
function baseProperty(key) {
26568
  return function(object) {
26569
    return object == null ? undefined : toObject(object)[key];
26570
  };
26571
}
26572
26573
module.exports = baseProperty;
26574
26575
},{"./toObject":138}],90:[function(require,module,exports){
26576
var baseGet = require('./baseGet'),
26577
    toPath = require('./toPath');
26578
26579
/**
26580
 * A specialized version of `baseProperty` which supports deep paths.
26581
 *
26582
 * @private
26583
 * @param {Array|string} path The path of the property to get.
26584
 * @returns {Function} Returns the new function.
26585
 */
26586
function basePropertyDeep(path) {
26587
  var pathKey = (path + '');
26588
  path = toPath(path);
26589
  return function(object) {
26590
    return baseGet(object, path, pathKey);
26591
  };
26592
}
26593
26594
module.exports = basePropertyDeep;
26595
26596
},{"./baseGet":80,"./toPath":139}],91:[function(require,module,exports){
26597
var identity = require('../utility/identity'),
26598
    metaMap = require('./metaMap');
26599
26600
/**
26601
 * The base implementation of `setData` without support for hot loop detection.
26602
 *
26603
 * @private
26604
 * @param {Function} func The function to associate metadata with.
26605
 * @param {*} data The metadata.
26606
 * @returns {Function} Returns `func`.
26607
 */
26608
var baseSetData = !metaMap ? identity : function(func, data) {
26609
  metaMap.set(func, data);
26610
  return func;
26611
};
26612
26613
module.exports = baseSetData;
26614
26615
},{"../utility/identity":157,"./metaMap":132}],92:[function(require,module,exports){
26616
/**
26617
 * The base implementation of `_.slice` without an iteratee call guard.
26618
 *
26619
 * @private
26620
 * @param {Array} array The array to slice.
26621
 * @param {number} [start=0] The start position.
26622
 * @param {number} [end=array.length] The end position.
26623
 * @returns {Array} Returns the slice of `array`.
26624
 */
26625
function baseSlice(array, start, end) {
26626
  var index = -1,
26627
      length = array.length;
26628
26629
  start = start == null ? 0 : (+start || 0);
26630
  if (start < 0) {
26631
    start = -start > length ? 0 : (length + start);
26632
  }
26633
  end = (end === undefined || end > length) ? length : (+end || 0);
26634
  if (end < 0) {
26635
    end += length;
26636
  }
26637
  length = start > end ? 0 : ((end - start) >>> 0);
26638
  start >>>= 0;
26639
26640
  var result = Array(length);
26641
  while (++index < length) {
26642
    result[index] = array[index + start];
26643
  }
26644
  return result;
26645
}
26646
26647
module.exports = baseSlice;
26648
26649
},{}],93:[function(require,module,exports){
26650
/**
26651
 * Converts `value` to a string if it's not one. An empty string is returned
26652
 * for `null` or `undefined` values.
26653
 *
26654
 * @private
26655
 * @param {*} value The value to process.
26656
 * @returns {string} Returns the string.
26657
 */
26658
function baseToString(value) {
26659
  return value == null ? '' : (value + '');
26660
}
26661
26662
module.exports = baseToString;
26663
26664
},{}],94:[function(require,module,exports){
26665
/**
26666
 * The base implementation of `_.values` and `_.valuesIn` which creates an
26667
 * array of `object` property values corresponding to the property names
26668
 * of `props`.
26669
 *
26670
 * @private
26671
 * @param {Object} object The object to query.
26672
 * @param {Array} props The property names to get values for.
26673
 * @returns {Object} Returns the array of property values.
26674
 */
26675
function baseValues(object, props) {
26676
  var index = -1,
26677
      length = props.length,
26678
      result = Array(length);
26679
26680
  while (++index < length) {
26681
    result[index] = object[props[index]];
26682
  }
26683
  return result;
26684
}
26685
26686
module.exports = baseValues;
26687
26688
},{}],95:[function(require,module,exports){
26689
var binaryIndexBy = require('./binaryIndexBy'),
26690
    identity = require('../utility/identity');
26691
26692
/** Used as references for the maximum length and index of an array. */
26693
var MAX_ARRAY_LENGTH = 4294967295,
26694
    HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
26695
26696
/**
26697
 * Performs a binary search of `array` to determine the index at which `value`
26698
 * should be inserted into `array` in order to maintain its sort order.
26699
 *
26700
 * @private
26701
 * @param {Array} array The sorted array to inspect.
26702
 * @param {*} value The value to evaluate.
26703
 * @param {boolean} [retHighest] Specify returning the highest qualified index.
26704
 * @returns {number} Returns the index at which `value` should be inserted
26705
 *  into `array`.
26706
 */
26707
function binaryIndex(array, value, retHighest) {
26708
  var low = 0,
26709
      high = array ? array.length : low;
26710
26711
  if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
26712
    while (low < high) {
26713
      var mid = (low + high) >>> 1,
26714
          computed = array[mid];
26715
26716
      if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
26717
        low = mid + 1;
26718
      } else {
26719
        high = mid;
26720
      }
26721
    }
26722
    return high;
26723
  }
26724
  return binaryIndexBy(array, value, identity, retHighest);
26725
}
26726
26727
module.exports = binaryIndex;
26728
26729
},{"../utility/identity":157,"./binaryIndexBy":96}],96:[function(require,module,exports){
26730
/* Native method references for those with the same name as other `lodash` methods. */
26731
var nativeFloor = Math.floor,
26732
    nativeMin = Math.min;
26733
26734
/** Used as references for the maximum length and index of an array. */
26735
var MAX_ARRAY_LENGTH = 4294967295,
26736
    MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
26737
26738
/**
26739
 * This function is like `binaryIndex` except that it invokes `iteratee` for
26740
 * `value` and each element of `array` to compute their sort ranking. The
26741
 * iteratee is invoked with one argument; (value).
26742
 *
26743
 * @private
26744
 * @param {Array} array The sorted array to inspect.
26745
 * @param {*} value The value to evaluate.
26746
 * @param {Function} iteratee The function invoked per iteration.
26747
 * @param {boolean} [retHighest] Specify returning the highest qualified index.
26748
 * @returns {number} Returns the index at which `value` should be inserted
26749
 *  into `array`.
26750
 */
26751
function binaryIndexBy(array, value, iteratee, retHighest) {
26752
  value = iteratee(value);
26753
26754
  var low = 0,
26755
      high = array ? array.length : 0,
26756
      valIsNaN = value !== value,
26757
      valIsNull = value === null,
26758
      valIsUndef = value === undefined;
26759
26760
  while (low < high) {
26761
    var mid = nativeFloor((low + high) / 2),
26762
        computed = iteratee(array[mid]),
26763
        isDef = computed !== undefined,
26764
        isReflexive = computed === computed;
26765
26766
    if (valIsNaN) {
26767
      var setLow = isReflexive || retHighest;
26768
    } else if (valIsNull) {
26769
      setLow = isReflexive && isDef && (retHighest || computed != null);
26770
    } else if (valIsUndef) {
26771
      setLow = isReflexive && (retHighest || isDef);
26772
    } else if (computed == null) {
26773
      setLow = false;
26774
    } else {
26775
      setLow = retHighest ? (computed <= value) : (computed < value);
26776
    }
26777
    if (setLow) {
26778
      low = mid + 1;
26779
    } else {
26780
      high = mid;
26781
    }
26782
  }
26783
  return nativeMin(high, MAX_ARRAY_INDEX);
26784
}
26785
26786
module.exports = binaryIndexBy;
26787
26788
},{}],97:[function(require,module,exports){
26789
var identity = require('../utility/identity');
26790
26791
/**
26792
 * A specialized version of `baseCallback` which only supports `this` binding
26793
 * and specifying the number of arguments to provide to `func`.
26794
 *
26795
 * @private
26796
 * @param {Function} func The function to bind.
26797
 * @param {*} thisArg The `this` binding of `func`.
26798
 * @param {number} [argCount] The number of arguments to provide to `func`.
26799
 * @returns {Function} Returns the callback.
26800
 */
26801
function bindCallback(func, thisArg, argCount) {
26802
  if (typeof func != 'function') {
26803
    return identity;
26804
  }
26805
  if (thisArg === undefined) {
26806
    return func;
26807
  }
26808
  switch (argCount) {
26809
    case 1: return function(value) {
26810
      return func.call(thisArg, value);
26811
    };
26812
    case 3: return function(value, index, collection) {
26813
      return func.call(thisArg, value, index, collection);
26814
    };
26815
    case 4: return function(accumulator, value, index, collection) {
26816
      return func.call(thisArg, accumulator, value, index, collection);
26817
    };
26818
    case 5: return function(value, other, key, object, source) {
26819
      return func.call(thisArg, value, other, key, object, source);
26820
    };
26821
  }
26822
  return function() {
26823
    return func.apply(thisArg, arguments);
26824
  };
26825
}
26826
26827
module.exports = bindCallback;
26828
26829
},{"../utility/identity":157}],98:[function(require,module,exports){
26830
(function (global){
26831
/** Native method references. */
26832
var ArrayBuffer = global.ArrayBuffer,
26833
    Uint8Array = global.Uint8Array;
26834
26835
/**
26836
 * Creates a clone of the given array buffer.
26837
 *
26838
 * @private
26839
 * @param {ArrayBuffer} buffer The array buffer to clone.
26840
 * @returns {ArrayBuffer} Returns the cloned array buffer.
26841
 */
26842
function bufferClone(buffer) {
26843
  var result = new ArrayBuffer(buffer.byteLength),
26844
      view = new Uint8Array(result);
26845
26846
  view.set(new Uint8Array(buffer));
26847
  return result;
26848
}
26849
26850
module.exports = bufferClone;
26851
26852
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
26853
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2J1ZmZlckNsb25lLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBOYXRpdmUgbWV0aG9kIHJlZmVyZW5jZXMuICovXG52YXIgQXJyYXlCdWZmZXIgPSBnbG9iYWwuQXJyYXlCdWZmZXIsXG4gICAgVWludDhBcnJheSA9IGdsb2JhbC5VaW50OEFycmF5O1xuXG4vKipcbiAqIENyZWF0ZXMgYSBjbG9uZSBvZiB0aGUgZ2l2ZW4gYXJyYXkgYnVmZmVyLlxuICpcbiAqIEBwcml2YXRlXG4gKiBAcGFyYW0ge0FycmF5QnVmZmVyfSBidWZmZXIgVGhlIGFycmF5IGJ1ZmZlciB0byBjbG9uZS5cbiAqIEByZXR1cm5zIHtBcnJheUJ1ZmZlcn0gUmV0dXJucyB0aGUgY2xvbmVkIGFycmF5IGJ1ZmZlci5cbiAqL1xuZnVuY3Rpb24gYnVmZmVyQ2xvbmUoYnVmZmVyKSB7XG4gIHZhciByZXN1bHQgPSBuZXcgQXJyYXlCdWZmZXIoYnVmZmVyLmJ5dGVMZW5ndGgpLFxuICAgICAgdmlldyA9IG5ldyBVaW50OEFycmF5KHJlc3VsdCk7XG5cbiAgdmlldy5zZXQobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSk7XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gYnVmZmVyQ2xvbmU7XG4iXX0=
26854
},{}],99:[function(require,module,exports){
26855
/* Native method references for those with the same name as other `lodash` methods. */
26856
var nativeMax = Math.max;
26857
26858
/**
26859
 * Creates an array that is the composition of partially applied arguments,
26860
 * placeholders, and provided arguments into a single array of arguments.
26861
 *
26862
 * @private
26863
 * @param {Array|Object} args The provided arguments.
26864
 * @param {Array} partials The arguments to prepend to those provided.
26865
 * @param {Array} holders The `partials` placeholder indexes.
26866
 * @returns {Array} Returns the new array of composed arguments.
26867
 */
26868
function composeArgs(args, partials, holders) {
26869
  var holdersLength = holders.length,
26870
      argsIndex = -1,
26871
      argsLength = nativeMax(args.length - holdersLength, 0),
26872
      leftIndex = -1,
26873
      leftLength = partials.length,
26874
      result = Array(leftLength + argsLength);
26875
26876
  while (++leftIndex < leftLength) {
26877
    result[leftIndex] = partials[leftIndex];
26878
  }
26879
  while (++argsIndex < holdersLength) {
26880
    result[holders[argsIndex]] = args[argsIndex];
26881
  }
26882
  while (argsLength--) {
26883
    result[leftIndex++] = args[argsIndex++];
26884
  }
26885
  return result;
26886
}
26887
26888
module.exports = composeArgs;
26889
26890
},{}],100:[function(require,module,exports){
26891
/* Native method references for those with the same name as other `lodash` methods. */
26892
var nativeMax = Math.max;
26893
26894
/**
26895
 * This function is like `composeArgs` except that the arguments composition
26896
 * is tailored for `_.partialRight`.
26897
 *
26898
 * @private
26899
 * @param {Array|Object} args The provided arguments.
26900
 * @param {Array} partials The arguments to append to those provided.
26901
 * @param {Array} holders The `partials` placeholder indexes.
26902
 * @returns {Array} Returns the new array of composed arguments.
26903
 */
26904
function composeArgsRight(args, partials, holders) {
26905
  var holdersIndex = -1,
26906
      holdersLength = holders.length,
26907
      argsIndex = -1,
26908
      argsLength = nativeMax(args.length - holdersLength, 0),
26909
      rightIndex = -1,
26910
      rightLength = partials.length,
26911
      result = Array(argsLength + rightLength);
26912
26913
  while (++argsIndex < argsLength) {
26914
    result[argsIndex] = args[argsIndex];
26915
  }
26916
  var offset = argsIndex;
26917
  while (++rightIndex < rightLength) {
26918
    result[offset + rightIndex] = partials[rightIndex];
26919
  }
26920
  while (++holdersIndex < holdersLength) {
26921
    result[offset + holders[holdersIndex]] = args[argsIndex++];
26922
  }
26923
  return result;
26924
}
26925
26926
module.exports = composeArgsRight;
26927
26928
},{}],101:[function(require,module,exports){
26929
var getLength = require('./getLength'),
26930
    isLength = require('./isLength'),
26931
    toObject = require('./toObject');
26932
26933
/**
26934
 * Creates a `baseEach` or `baseEachRight` function.
26935
 *
26936
 * @private
26937
 * @param {Function} eachFunc The function to iterate over a collection.
26938
 * @param {boolean} [fromRight] Specify iterating from right to left.
26939
 * @returns {Function} Returns the new base function.
26940
 */
26941
function createBaseEach(eachFunc, fromRight) {
26942
  return function(collection, iteratee) {
26943
    var length = collection ? getLength(collection) : 0;
26944
    if (!isLength(length)) {
26945
      return eachFunc(collection, iteratee);
26946
    }
26947
    var index = fromRight ? length : -1,
26948
        iterable = toObject(collection);
26949
26950
    while ((fromRight ? index-- : ++index < length)) {
26951
      if (iteratee(iterable[index], index, iterable) === false) {
26952
        break;
26953
      }
26954
    }
26955
    return collection;
26956
  };
26957
}
26958
26959
module.exports = createBaseEach;
26960
26961
},{"./getLength":115,"./isLength":128,"./toObject":138}],102:[function(require,module,exports){
26962
var toObject = require('./toObject');
26963
26964
/**
26965
 * Creates a base function for `_.forIn` or `_.forInRight`.
26966
 *
26967
 * @private
26968
 * @param {boolean} [fromRight] Specify iterating from right to left.
26969
 * @returns {Function} Returns the new base function.
26970
 */
26971
function createBaseFor(fromRight) {
26972
  return function(object, iteratee, keysFunc) {
26973
    var iterable = toObject(object),
26974
        props = keysFunc(object),
26975
        length = props.length,
26976
        index = fromRight ? length : -1;
26977
26978
    while ((fromRight ? index-- : ++index < length)) {
26979
      var key = props[index];
26980
      if (iteratee(iterable[key], key, iterable) === false) {
26981
        break;
26982
      }
26983
    }
26984
    return object;
26985
  };
26986
}
26987
26988
module.exports = createBaseFor;
26989
26990
},{"./toObject":138}],103:[function(require,module,exports){
26991
(function (global){
26992
var createCtorWrapper = require('./createCtorWrapper');
26993
26994
/**
26995
 * Creates a function that wraps `func` and invokes it with the `this`
26996
 * binding of `thisArg`.
26997
 *
26998
 * @private
26999
 * @param {Function} func The function to bind.
27000
 * @param {*} [thisArg] The `this` binding of `func`.
27001
 * @returns {Function} Returns the new bound function.
27002
 */
27003
function createBindWrapper(func, thisArg) {
27004
  var Ctor = createCtorWrapper(func);
27005
27006
  function wrapper() {
27007
    var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
27008
    return fn.apply(thisArg, arguments);
27009
  }
27010
  return wrapper;
27011
}
27012
27013
module.exports = createBindWrapper;
27014
27015
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27016
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUJpbmRXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwc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1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVCaW5kV3JhcHBlcjtcbiJdfQ==
27017
},{"./createCtorWrapper":104}],104:[function(require,module,exports){
27018
var baseCreate = require('./baseCreate'),
27019
    isObject = require('../lang/isObject');
27020
27021
/**
27022
 * Creates a function that produces an instance of `Ctor` regardless of
27023
 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
27024
 *
27025
 * @private
27026
 * @param {Function} Ctor The constructor to wrap.
27027
 * @returns {Function} Returns the new wrapped function.
27028
 */
27029
function createCtorWrapper(Ctor) {
27030
  return function() {
27031
    // Use a `switch` statement to work with class constructors.
27032
    // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
27033
    // for more details.
27034
    var args = arguments;
27035
    switch (args.length) {
27036
      case 0: return new Ctor;
27037
      case 1: return new Ctor(args[0]);
27038
      case 2: return new Ctor(args[0], args[1]);
27039
      case 3: return new Ctor(args[0], args[1], args[2]);
27040
      case 4: return new Ctor(args[0], args[1], args[2], args[3]);
27041
      case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
27042
      case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
27043
      case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
27044
    }
27045
    var thisBinding = baseCreate(Ctor.prototype),
27046
        result = Ctor.apply(thisBinding, args);
27047
27048
    // Mimic the constructor's `return` behavior.
27049
    // See https://es5.github.io/#x13.2.2 for more details.
27050
    return isObject(result) ? result : thisBinding;
27051
  };
27052
}
27053
27054
module.exports = createCtorWrapper;
27055
27056
},{"../lang/isObject":147,"./baseCreate":73}],105:[function(require,module,exports){
27057
var baseCallback = require('./baseCallback'),
27058
    baseFind = require('./baseFind'),
27059
    baseFindIndex = require('./baseFindIndex'),
27060
    isArray = require('../lang/isArray');
27061
27062
/**
27063
 * Creates a `_.find` or `_.findLast` function.
27064
 *
27065
 * @private
27066
 * @param {Function} eachFunc The function to iterate over a collection.
27067
 * @param {boolean} [fromRight] Specify iterating from right to left.
27068
 * @returns {Function} Returns the new find function.
27069
 */
27070
function createFind(eachFunc, fromRight) {
27071
  return function(collection, predicate, thisArg) {
27072
    predicate = baseCallback(predicate, thisArg, 3);
27073
    if (isArray(collection)) {
27074
      var index = baseFindIndex(collection, predicate, fromRight);
27075
      return index > -1 ? collection[index] : undefined;
27076
    }
27077
    return baseFind(collection, predicate, eachFunc);
27078
  };
27079
}
27080
27081
module.exports = createFind;
27082
27083
},{"../lang/isArray":143,"./baseCallback":70,"./baseFind":75,"./baseFindIndex":76}],106:[function(require,module,exports){
27084
var bindCallback = require('./bindCallback'),
27085
    isArray = require('../lang/isArray');
27086
27087
/**
27088
 * Creates a function for `_.forEach` or `_.forEachRight`.
27089
 *
27090
 * @private
27091
 * @param {Function} arrayFunc The function to iterate over an array.
27092
 * @param {Function} eachFunc The function to iterate over a collection.
27093
 * @returns {Function} Returns the new each function.
27094
 */
27095
function createForEach(arrayFunc, eachFunc) {
27096
  return function(collection, iteratee, thisArg) {
27097
    return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
27098
      ? arrayFunc(collection, iteratee)
27099
      : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
27100
  };
27101
}
27102
27103
module.exports = createForEach;
27104
27105
},{"../lang/isArray":143,"./bindCallback":97}],107:[function(require,module,exports){
27106
(function (global){
27107
var arrayCopy = require('./arrayCopy'),
27108
    composeArgs = require('./composeArgs'),
27109
    composeArgsRight = require('./composeArgsRight'),
27110
    createCtorWrapper = require('./createCtorWrapper'),
27111
    isLaziable = require('./isLaziable'),
27112
    reorder = require('./reorder'),
27113
    replaceHolders = require('./replaceHolders'),
27114
    setData = require('./setData');
27115
27116
/** Used to compose bitmasks for wrapper metadata. */
27117
var BIND_FLAG = 1,
27118
    BIND_KEY_FLAG = 2,
27119
    CURRY_BOUND_FLAG = 4,
27120
    CURRY_FLAG = 8,
27121
    CURRY_RIGHT_FLAG = 16,
27122
    PARTIAL_FLAG = 32,
27123
    PARTIAL_RIGHT_FLAG = 64,
27124
    ARY_FLAG = 128;
27125
27126
/* Native method references for those with the same name as other `lodash` methods. */
27127
var nativeMax = Math.max;
27128
27129
/**
27130
 * Creates a function that wraps `func` and invokes it with optional `this`
27131
 * binding of, partial application, and currying.
27132
 *
27133
 * @private
27134
 * @param {Function|string} func The function or method name to reference.
27135
 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
27136
 * @param {*} [thisArg] The `this` binding of `func`.
27137
 * @param {Array} [partials] The arguments to prepend to those provided to the new function.
27138
 * @param {Array} [holders] The `partials` placeholder indexes.
27139
 * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
27140
 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
27141
 * @param {Array} [argPos] The argument positions of the new function.
27142
 * @param {number} [ary] The arity cap of `func`.
27143
 * @param {number} [arity] The arity of `func`.
27144
 * @returns {Function} Returns the new wrapped function.
27145
 */
27146
function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
27147
  var isAry = bitmask & ARY_FLAG,
27148
      isBind = bitmask & BIND_FLAG,
27149
      isBindKey = bitmask & BIND_KEY_FLAG,
27150
      isCurry = bitmask & CURRY_FLAG,
27151
      isCurryBound = bitmask & CURRY_BOUND_FLAG,
27152
      isCurryRight = bitmask & CURRY_RIGHT_FLAG,
27153
      Ctor = isBindKey ? undefined : createCtorWrapper(func);
27154
27155
  function wrapper() {
27156
    // Avoid `arguments` object use disqualifying optimizations by
27157
    // converting it to an array before providing it to other functions.
27158
    var length = arguments.length,
27159
        index = length,
27160
        args = Array(length);
27161
27162
    while (index--) {
27163
      args[index] = arguments[index];
27164
    }
27165
    if (partials) {
27166
      args = composeArgs(args, partials, holders);
27167
    }
27168
    if (partialsRight) {
27169
      args = composeArgsRight(args, partialsRight, holdersRight);
27170
    }
27171
    if (isCurry || isCurryRight) {
27172
      var placeholder = wrapper.placeholder,
27173
          argsHolders = replaceHolders(args, placeholder);
27174
27175
      length -= argsHolders.length;
27176
      if (length < arity) {
27177
        var newArgPos = argPos ? arrayCopy(argPos) : undefined,
27178
            newArity = nativeMax(arity - length, 0),
27179
            newsHolders = isCurry ? argsHolders : undefined,
27180
            newHoldersRight = isCurry ? undefined : argsHolders,
27181
            newPartials = isCurry ? args : undefined,
27182
            newPartialsRight = isCurry ? undefined : args;
27183
27184
        bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
27185
        bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
27186
27187
        if (!isCurryBound) {
27188
          bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
27189
        }
27190
        var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
27191
            result = createHybridWrapper.apply(undefined, newData);
27192
27193
        if (isLaziable(func)) {
27194
          setData(result, newData);
27195
        }
27196
        result.placeholder = placeholder;
27197
        return result;
27198
      }
27199
    }
27200
    var thisBinding = isBind ? thisArg : this,
27201
        fn = isBindKey ? thisBinding[func] : func;
27202
27203
    if (argPos) {
27204
      args = reorder(args, argPos);
27205
    }
27206
    if (isAry && ary < args.length) {
27207
      args.length = ary;
27208
    }
27209
    if (this && this !== global && this instanceof wrapper) {
27210
      fn = Ctor || createCtorWrapper(func);
27211
    }
27212
    return fn.apply(thisBinding, args);
27213
  }
27214
  return wrapper;
27215
}
27216
27217
module.exports = createHybridWrapper;
27218
27219
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27220
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUh5YnJpZFdyYXBwZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTt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YXJncyk7XG4gIH1cbiAgcmV0dXJuIHdyYXBwZXI7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gY3JlYXRlSHlicmlkV3JhcHBlcjtcbiJdfQ==
27221
},{"./arrayCopy":65,"./composeArgs":99,"./composeArgsRight":100,"./createCtorWrapper":104,"./isLaziable":127,"./reorder":134,"./replaceHolders":135,"./setData":136}],108:[function(require,module,exports){
27222
(function (global){
27223
var createCtorWrapper = require('./createCtorWrapper');
27224
27225
/** Used to compose bitmasks for wrapper metadata. */
27226
var BIND_FLAG = 1;
27227
27228
/**
27229
 * Creates a function that wraps `func` and invokes it with the optional `this`
27230
 * binding of `thisArg` and the `partials` prepended to those provided to
27231
 * the wrapper.
27232
 *
27233
 * @private
27234
 * @param {Function} func The function to partially apply arguments to.
27235
 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
27236
 * @param {*} thisArg The `this` binding of `func`.
27237
 * @param {Array} partials The arguments to prepend to those provided to the new function.
27238
 * @returns {Function} Returns the new bound function.
27239
 */
27240
function createPartialWrapper(func, bitmask, thisArg, partials) {
27241
  var isBind = bitmask & BIND_FLAG,
27242
      Ctor = createCtorWrapper(func);
27243
27244
  function wrapper() {
27245
    // Avoid `arguments` object use disqualifying optimizations by
27246
    // converting it to an array before providing it `func`.
27247
    var argsIndex = -1,
27248
        argsLength = arguments.length,
27249
        leftIndex = -1,
27250
        leftLength = partials.length,
27251
        args = Array(leftLength + argsLength);
27252
27253
    while (++leftIndex < leftLength) {
27254
      args[leftIndex] = partials[leftIndex];
27255
    }
27256
    while (argsLength--) {
27257
      args[leftIndex++] = arguments[++argsIndex];
27258
    }
27259
    var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
27260
    return fn.apply(isBind ? thisArg : this, args);
27261
  }
27262
  return wrapper;
27263
}
27264
27265
module.exports = createPartialWrapper;
27266
27267
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27268
//# sourceMappingURL=data:application/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NMZW5ndGgpO1xuXG4gICAgd2hpbGUgKCsrbGVmdEluZGV4IDwgbGVmdExlbmd0aCkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXhdID0gcGFydGlhbHNbbGVmdEluZGV4XTtcbiAgICB9XG4gICAgd2hpbGUgKGFyZ3NMZW5ndGgtLSkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXgrK10gPSBhcmd1bWVudHNbKythcmdzSW5kZXhdO1xuICAgIH1cbiAgICB2YXIgZm4gPSAodGhpcyAmJiB0aGlzICE9PSBnbG9iYWwgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgcmV0dXJuIGZuLmFwcGx5KGlzQmluZCA/IHRoaXNBcmcgOiB0aGlzLCBhcmdzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVQYXJ0aWFsV3JhcHBlcjtcbiJdfQ==
27269
},{"./createCtorWrapper":104}],109:[function(require,module,exports){
27270
var baseSetData = require('./baseSetData'),
27271
    createBindWrapper = require('./createBindWrapper'),
27272
    createHybridWrapper = require('./createHybridWrapper'),
27273
    createPartialWrapper = require('./createPartialWrapper'),
27274
    getData = require('./getData'),
27275
    mergeData = require('./mergeData'),
27276
    setData = require('./setData');
27277
27278
/** Used to compose bitmasks for wrapper metadata. */
27279
var BIND_FLAG = 1,
27280
    BIND_KEY_FLAG = 2,
27281
    PARTIAL_FLAG = 32,
27282
    PARTIAL_RIGHT_FLAG = 64;
27283
27284
/** Used as the `TypeError` message for "Functions" methods. */
27285
var FUNC_ERROR_TEXT = 'Expected a function';
27286
27287
/* Native method references for those with the same name as other `lodash` methods. */
27288
var nativeMax = Math.max;
27289
27290
/**
27291
 * Creates a function that either curries or invokes `func` with optional
27292
 * `this` binding and partially applied arguments.
27293
 *
27294
 * @private
27295
 * @param {Function|string} func The function or method name to reference.
27296
 * @param {number} bitmask The bitmask of flags.
27297
 *  The bitmask may be composed of the following flags:
27298
 *     1 - `_.bind`
27299
 *     2 - `_.bindKey`
27300
 *     4 - `_.curry` or `_.curryRight` of a bound function
27301
 *     8 - `_.curry`
27302
 *    16 - `_.curryRight`
27303
 *    32 - `_.partial`
27304
 *    64 - `_.partialRight`
27305
 *   128 - `_.rearg`
27306
 *   256 - `_.ary`
27307
 * @param {*} [thisArg] The `this` binding of `func`.
27308
 * @param {Array} [partials] The arguments to be partially applied.
27309
 * @param {Array} [holders] The `partials` placeholder indexes.
27310
 * @param {Array} [argPos] The argument positions of the new function.
27311
 * @param {number} [ary] The arity cap of `func`.
27312
 * @param {number} [arity] The arity of `func`.
27313
 * @returns {Function} Returns the new wrapped function.
27314
 */
27315
function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
27316
  var isBindKey = bitmask & BIND_KEY_FLAG;
27317
  if (!isBindKey && typeof func != 'function') {
27318
    throw new TypeError(FUNC_ERROR_TEXT);
27319
  }
27320
  var length = partials ? partials.length : 0;
27321
  if (!length) {
27322
    bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
27323
    partials = holders = undefined;
27324
  }
27325
  length -= (holders ? holders.length : 0);
27326
  if (bitmask & PARTIAL_RIGHT_FLAG) {
27327
    var partialsRight = partials,
27328
        holdersRight = holders;
27329
27330
    partials = holders = undefined;
27331
  }
27332
  var data = isBindKey ? undefined : getData(func),
27333
      newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
27334
27335
  if (data) {
27336
    mergeData(newData, data);
27337
    bitmask = newData[1];
27338
    arity = newData[9];
27339
  }
27340
  newData[9] = arity == null
27341
    ? (isBindKey ? 0 : func.length)
27342
    : (nativeMax(arity - length, 0) || 0);
27343
27344
  if (bitmask == BIND_FLAG) {
27345
    var result = createBindWrapper(newData[0], newData[2]);
27346
  } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
27347
    result = createPartialWrapper.apply(undefined, newData);
27348
  } else {
27349
    result = createHybridWrapper.apply(undefined, newData);
27350
  }
27351
  var setter = data ? baseSetData : setData;
27352
  return setter(result, newData);
27353
}
27354
27355
module.exports = createWrapper;
27356
27357
},{"./baseSetData":91,"./createBindWrapper":103,"./createHybridWrapper":107,"./createPartialWrapper":108,"./getData":113,"./mergeData":131,"./setData":136}],110:[function(require,module,exports){
27358
var arraySome = require('./arraySome');
27359
27360
/**
27361
 * A specialized version of `baseIsEqualDeep` for arrays with support for
27362
 * partial deep comparisons.
27363
 *
27364
 * @private
27365
 * @param {Array} array The array to compare.
27366
 * @param {Array} other The other array to compare.
27367
 * @param {Function} equalFunc The function to determine equivalents of values.
27368
 * @param {Function} [customizer] The function to customize comparing arrays.
27369
 * @param {boolean} [isLoose] Specify performing partial comparisons.
27370
 * @param {Array} [stackA] Tracks traversed `value` objects.
27371
 * @param {Array} [stackB] Tracks traversed `other` objects.
27372
 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
27373
 */
27374
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
27375
  var index = -1,
27376
      arrLength = array.length,
27377
      othLength = other.length;
27378
27379
  if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
27380
    return false;
27381
  }
27382
  // Ignore non-index properties.
27383
  while (++index < arrLength) {
27384
    var arrValue = array[index],
27385
        othValue = other[index],
27386
        result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
27387
27388
    if (result !== undefined) {
27389
      if (result) {
27390
        continue;
27391
      }
27392
      return false;
27393
    }
27394
    // Recursively compare arrays (susceptible to call stack limits).
27395
    if (isLoose) {
27396
      if (!arraySome(other, function(othValue) {
27397
            return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
27398
          })) {
27399
        return false;
27400
      }
27401
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
27402
      return false;
27403
    }
27404
  }
27405
  return true;
27406
}
27407
27408
module.exports = equalArrays;
27409
27410
},{"./arraySome":68}],111:[function(require,module,exports){
27411
/** `Object#toString` result references. */
27412
var boolTag = '[object Boolean]',
27413
    dateTag = '[object Date]',
27414
    errorTag = '[object Error]',
27415
    numberTag = '[object Number]',
27416
    regexpTag = '[object RegExp]',
27417
    stringTag = '[object String]';
27418
27419
/**
27420
 * A specialized version of `baseIsEqualDeep` for comparing objects of
27421
 * the same `toStringTag`.
27422
 *
27423
 * **Note:** This function only supports comparing values with tags of
27424
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
27425
 *
27426
 * @private
27427
 * @param {Object} object The object to compare.
27428
 * @param {Object} other The other object to compare.
27429
 * @param {string} tag The `toStringTag` of the objects to compare.
27430
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27431
 */
27432
function equalByTag(object, other, tag) {
27433
  switch (tag) {
27434
    case boolTag:
27435
    case dateTag:
27436
      // Coerce dates and booleans to numbers, dates to milliseconds and booleans
27437
      // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
27438
      return +object == +other;
27439
27440
    case errorTag:
27441
      return object.name == other.name && object.message == other.message;
27442
27443
    case numberTag:
27444
      // Treat `NaN` vs. `NaN` as equal.
27445
      return (object != +object)
27446
        ? other != +other
27447
        : object == +other;
27448
27449
    case regexpTag:
27450
    case stringTag:
27451
      // Coerce regexes to strings and treat strings primitives and string
27452
      // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
27453
      return object == (other + '');
27454
  }
27455
  return false;
27456
}
27457
27458
module.exports = equalByTag;
27459
27460
},{}],112:[function(require,module,exports){
27461
var keys = require('../object/keys');
27462
27463
/** Used for native method references. */
27464
var objectProto = Object.prototype;
27465
27466
/** Used to check objects for own properties. */
27467
var hasOwnProperty = objectProto.hasOwnProperty;
27468
27469
/**
27470
 * A specialized version of `baseIsEqualDeep` for objects with support for
27471
 * partial deep comparisons.
27472
 *
27473
 * @private
27474
 * @param {Object} object The object to compare.
27475
 * @param {Object} other The other object to compare.
27476
 * @param {Function} equalFunc The function to determine equivalents of values.
27477
 * @param {Function} [customizer] The function to customize comparing values.
27478
 * @param {boolean} [isLoose] Specify performing partial comparisons.
27479
 * @param {Array} [stackA] Tracks traversed `value` objects.
27480
 * @param {Array} [stackB] Tracks traversed `other` objects.
27481
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27482
 */
27483
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
27484
  var objProps = keys(object),
27485
      objLength = objProps.length,
27486
      othProps = keys(other),
27487
      othLength = othProps.length;
27488
27489
  if (objLength != othLength && !isLoose) {
27490
    return false;
27491
  }
27492
  var index = objLength;
27493
  while (index--) {
27494
    var key = objProps[index];
27495
    if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
27496
      return false;
27497
    }
27498
  }
27499
  var skipCtor = isLoose;
27500
  while (++index < objLength) {
27501
    key = objProps[index];
27502
    var objValue = object[key],
27503
        othValue = other[key],
27504
        result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
27505
27506
    // Recursively compare objects (susceptible to call stack limits).
27507
    if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
27508
      return false;
27509
    }
27510
    skipCtor || (skipCtor = key == 'constructor');
27511
  }
27512
  if (!skipCtor) {
27513
    var objCtor = object.constructor,
27514
        othCtor = other.constructor;
27515
27516
    // Non `Object` object instances with different constructors are not equal.
27517
    if (objCtor != othCtor &&
27518
        ('constructor' in object && 'constructor' in other) &&
27519
        !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
27520
          typeof othCtor == 'function' && othCtor instanceof othCtor)) {
27521
      return false;
27522
    }
27523
  }
27524
  return true;
27525
}
27526
27527
module.exports = equalObjects;
27528
27529
},{"../object/keys":152}],113:[function(require,module,exports){
27530
var metaMap = require('./metaMap'),
27531
    noop = require('../utility/noop');
27532
27533
/**
27534
 * Gets metadata for `func`.
27535
 *
27536
 * @private
27537
 * @param {Function} func The function to query.
27538
 * @returns {*} Returns the metadata for `func`.
27539
 */
27540
var getData = !metaMap ? noop : function(func) {
27541
  return metaMap.get(func);
27542
};
27543
27544
module.exports = getData;
27545
27546
},{"../utility/noop":158,"./metaMap":132}],114:[function(require,module,exports){
27547
var realNames = require('./realNames');
27548
27549
/**
27550
 * Gets the name of `func`.
27551
 *
27552
 * @private
27553
 * @param {Function} func The function to query.
27554
 * @returns {string} Returns the function name.
27555
 */
27556
function getFuncName(func) {
27557
  var result = func.name,
27558
      array = realNames[result],
27559
      length = array ? array.length : 0;
27560
27561
  while (length--) {
27562
    var data = array[length],
27563
        otherFunc = data.func;
27564
    if (otherFunc == null || otherFunc == func) {
27565
      return data.name;
27566
    }
27567
  }
27568
  return result;
27569
}
27570
27571
module.exports = getFuncName;
27572
27573
},{"./realNames":133}],115:[function(require,module,exports){
27574
var baseProperty = require('./baseProperty');
27575
27576
/**
27577
 * Gets the "length" property value of `object`.
27578
 *
27579
 * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
27580
 * that affects Safari on at least iOS 8.1-8.3 ARM64.
27581
 *
27582
 * @private
27583
 * @param {Object} object The object to query.
27584
 * @returns {*} Returns the "length" value.
27585
 */
27586
var getLength = baseProperty('length');
27587
27588
module.exports = getLength;
27589
27590
},{"./baseProperty":89}],116:[function(require,module,exports){
27591
var isStrictComparable = require('./isStrictComparable'),
27592
    pairs = require('../object/pairs');
27593
27594
/**
27595
 * Gets the propery names, values, and compare flags of `object`.
27596
 *
27597
 * @private
27598
 * @param {Object} object The object to query.
27599
 * @returns {Array} Returns the match data of `object`.
27600
 */
27601
function getMatchData(object) {
27602
  var result = pairs(object),
27603
      length = result.length;
27604
27605
  while (length--) {
27606
    result[length][2] = isStrictComparable(result[length][1]);
27607
  }
27608
  return result;
27609
}
27610
27611
module.exports = getMatchData;
27612
27613
},{"../object/pairs":154,"./isStrictComparable":130}],117:[function(require,module,exports){
27614
var isNative = require('../lang/isNative');
27615
27616
/**
27617
 * Gets the native function at `key` of `object`.
27618
 *
27619
 * @private
27620
 * @param {Object} object The object to query.
27621
 * @param {string} key The key of the method to get.
27622
 * @returns {*} Returns the function if it's native, else `undefined`.
27623
 */
27624
function getNative(object, key) {
27625
  var value = object == null ? undefined : object[key];
27626
  return isNative(value) ? value : undefined;
27627
}
27628
27629
module.exports = getNative;
27630
27631
},{"../lang/isNative":146}],118:[function(require,module,exports){
27632
/**
27633
 * Gets the index at which the first occurrence of `NaN` is found in `array`.
27634
 *
27635
 * @private
27636
 * @param {Array} array The array to search.
27637
 * @param {number} fromIndex The index to search from.
27638
 * @param {boolean} [fromRight] Specify iterating from right to left.
27639
 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
27640
 */
27641
function indexOfNaN(array, fromIndex, fromRight) {
27642
  var length = array.length,
27643
      index = fromIndex + (fromRight ? 0 : -1);
27644
27645
  while ((fromRight ? index-- : ++index < length)) {
27646
    var other = array[index];
27647
    if (other !== other) {
27648
      return index;
27649
    }
27650
  }
27651
  return -1;
27652
}
27653
27654
module.exports = indexOfNaN;
27655
27656
},{}],119:[function(require,module,exports){
27657
/** Used for native method references. */
27658
var objectProto = Object.prototype;
27659
27660
/** Used to check objects for own properties. */
27661
var hasOwnProperty = objectProto.hasOwnProperty;
27662
27663
/**
27664
 * Initializes an array clone.
27665
 *
27666
 * @private
27667
 * @param {Array} array The array to clone.
27668
 * @returns {Array} Returns the initialized clone.
27669
 */
27670
function initCloneArray(array) {
27671
  var length = array.length,
27672
      result = new array.constructor(length);
27673
27674
  // Add array properties assigned by `RegExp#exec`.
27675
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
27676
    result.index = array.index;
27677
    result.input = array.input;
27678
  }
27679
  return result;
27680
}
27681
27682
module.exports = initCloneArray;
27683
27684
},{}],120:[function(require,module,exports){
27685
(function (global){
27686
var bufferClone = require('./bufferClone');
27687
27688
/** `Object#toString` result references. */
27689
var boolTag = '[object Boolean]',
27690
    dateTag = '[object Date]',
27691
    numberTag = '[object Number]',
27692
    regexpTag = '[object RegExp]',
27693
    stringTag = '[object String]';
27694
27695
var arrayBufferTag = '[object ArrayBuffer]',
27696
    float32Tag = '[object Float32Array]',
27697
    float64Tag = '[object Float64Array]',
27698
    int8Tag = '[object Int8Array]',
27699
    int16Tag = '[object Int16Array]',
27700
    int32Tag = '[object Int32Array]',
27701
    uint8Tag = '[object Uint8Array]',
27702
    uint8ClampedTag = '[object Uint8ClampedArray]',
27703
    uint16Tag = '[object Uint16Array]',
27704
    uint32Tag = '[object Uint32Array]';
27705
27706
/** Used to match `RegExp` flags from their coerced string values. */
27707
var reFlags = /\w*$/;
27708
27709
/** Native method references. */
27710
var Uint8Array = global.Uint8Array;
27711
27712
/** Used to lookup a type array constructors by `toStringTag`. */
27713
var ctorByTag = {};
27714
ctorByTag[float32Tag] = global.Float32Array;
27715
ctorByTag[float64Tag] = global.Float64Array;
27716
ctorByTag[int8Tag] = global.Int8Array;
27717
ctorByTag[int16Tag] = global.Int16Array;
27718
ctorByTag[int32Tag] = global.Int32Array;
27719
ctorByTag[uint8Tag] = Uint8Array;
27720
ctorByTag[uint8ClampedTag] = global.Uint8ClampedArray;
27721
ctorByTag[uint16Tag] = global.Uint16Array;
27722
ctorByTag[uint32Tag] = global.Uint32Array;
27723
27724
/**
27725
 * Initializes an object clone based on its `toStringTag`.
27726
 *
27727
 * **Note:** This function only supports cloning values with tags of
27728
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
27729
 *
27730
 * @private
27731
 * @param {Object} object The object to clone.
27732
 * @param {string} tag The `toStringTag` of the object to clone.
27733
 * @param {boolean} [isDeep] Specify a deep clone.
27734
 * @returns {Object} Returns the initialized clone.
27735
 */
27736
function initCloneByTag(object, tag, isDeep) {
27737
  var Ctor = object.constructor;
27738
  switch (tag) {
27739
    case arrayBufferTag:
27740
      return bufferClone(object);
27741
27742
    case boolTag:
27743
    case dateTag:
27744
      return new Ctor(+object);
27745
27746
    case float32Tag: case float64Tag:
27747
    case int8Tag: case int16Tag: case int32Tag:
27748
    case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
27749
      // Safari 5 mobile incorrectly has `Object` as the constructor of typed arrays.
27750
      if (Ctor instanceof Ctor) {
27751
        Ctor = ctorByTag[tag];
27752
      }
27753
      var buffer = object.buffer;
27754
      return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
27755
27756
    case numberTag:
27757
    case stringTag:
27758
      return new Ctor(object);
27759
27760
    case regexpTag:
27761
      var result = new Ctor(object.source, reFlags.exec(object));
27762
      result.lastIndex = object.lastIndex;
27763
  }
27764
  return result;
27765
}
27766
27767
module.exports = initCloneByTag;
27768
27769
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27770
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2luaXRDbG9uZUJ5VGFnLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQ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b3JyZWN0bHkgaGFzIGBPYmplY3RgIGFzIHRoZSBjb25zdHJ1Y3RvciBvZiB0eXBlZCBhcnJheXMuXG4gICAgICBpZiAoQ3RvciBpbnN0YW5jZW9mIEN0b3IpIHtcbiAgICAgICAgQ3RvciA9IGN0b3JCeVRhZ1t0YWddO1xuICAgICAgfVxuICAgICAgdmFyIGJ1ZmZlciA9IG9iamVjdC5idWZmZXI7XG4gICAgICByZXR1cm4gbmV3IEN0b3IoaXNEZWVwID8gYnVmZmVyQ2xvbmUoYnVmZmVyKSA6IGJ1ZmZlciwgb2JqZWN0LmJ5dGVPZmZzZXQsIG9iamVjdC5sZW5ndGgpO1xuXG4gICAgY2FzZSBudW1iZXJUYWc6XG4gICAgY2FzZSBzdHJpbmdUYWc6XG4gICAgICByZXR1cm4gbmV3IEN0b3Iob2JqZWN0KTtcblxuICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgdmFyIHJlc3VsdCA9IG5ldyBDdG9yKG9iamVjdC5zb3VyY2UsIHJlRmxhZ3MuZXhlYyhvYmplY3QpKTtcbiAgICAgIHJlc3VsdC5sYXN0SW5kZXggPSBvYmplY3QubGFzdEluZGV4O1xuICB9XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gaW5pdENsb25lQnlUYWc7XG4iXX0=
27771
},{"./bufferClone":98}],121:[function(require,module,exports){
27772
/**
27773
 * Initializes an object clone.
27774
 *
27775
 * @private
27776
 * @param {Object} object The object to clone.
27777
 * @returns {Object} Returns the initialized clone.
27778
 */
27779
function initCloneObject(object) {
27780
  var Ctor = object.constructor;
27781
  if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
27782
    Ctor = Object;
27783
  }
27784
  return new Ctor;
27785
}
27786
27787
module.exports = initCloneObject;
27788
27789
},{}],122:[function(require,module,exports){
27790
var getLength = require('./getLength'),
27791
    isLength = require('./isLength');
27792
27793
/**
27794
 * Checks if `value` is array-like.
27795
 *
27796
 * @private
27797
 * @param {*} value The value to check.
27798
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
27799
 */
27800
function isArrayLike(value) {
27801
  return value != null && isLength(getLength(value));
27802
}
27803
27804
module.exports = isArrayLike;
27805
27806
},{"./getLength":115,"./isLength":128}],123:[function(require,module,exports){
27807
/**
27808
 * Checks if `value` is a host object in IE < 9.
27809
 *
27810
 * @private
27811
 * @param {*} value The value to check.
27812
 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
27813
 */
27814
var isHostObject = (function() {
27815
  try {
27816
    Object({ 'toString': 0 } + '');
27817
  } catch(e) {
27818
    return function() { return false; };
27819
  }
27820
  return function(value) {
27821
    // IE < 9 presents many host objects as `Object` objects that can coerce
27822
    // to strings despite having improperly defined `toString` methods.
27823
    return typeof value.toString != 'function' && typeof (value + '') == 'string';
27824
  };
27825
}());
27826
27827
module.exports = isHostObject;
27828
27829
},{}],124:[function(require,module,exports){
27830
/** Used to detect unsigned integer values. */
27831
var reIsUint = /^\d+$/;
27832
27833
/**
27834
 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
27835
 * of an array-like value.
27836
 */
27837
var MAX_SAFE_INTEGER = 9007199254740991;
27838
27839
/**
27840
 * Checks if `value` is a valid array-like index.
27841
 *
27842
 * @private
27843
 * @param {*} value The value to check.
27844
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
27845
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
27846
 */
27847
function isIndex(value, length) {
27848
  value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
27849
  length = length == null ? MAX_SAFE_INTEGER : length;
27850
  return value > -1 && value % 1 == 0 && value < length;
27851
}
27852
27853
module.exports = isIndex;
27854
27855
},{}],125:[function(require,module,exports){
27856
var isArrayLike = require('./isArrayLike'),
27857
    isIndex = require('./isIndex'),
27858
    isObject = require('../lang/isObject');
27859
27860
/**
27861
 * Checks if the provided arguments are from an iteratee call.
27862
 *
27863
 * @private
27864
 * @param {*} value The potential iteratee value argument.
27865
 * @param {*} index The potential iteratee index or key argument.
27866
 * @param {*} object The potential iteratee object argument.
27867
 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
27868
 */
27869
function isIterateeCall(value, index, object) {
27870
  if (!isObject(object)) {
27871
    return false;
27872
  }
27873
  var type = typeof index;
27874
  if (type == 'number'
27875
      ? (isArrayLike(object) && isIndex(index, object.length))
27876
      : (type == 'string' && index in object)) {
27877
    var other = object[index];
27878
    return value === value ? (value === other) : (other !== other);
27879
  }
27880
  return false;
27881
}
27882
27883
module.exports = isIterateeCall;
27884
27885
},{"../lang/isObject":147,"./isArrayLike":122,"./isIndex":124}],126:[function(require,module,exports){
27886
var isArray = require('../lang/isArray'),
27887
    toObject = require('./toObject');
27888
27889
/** Used to match property names within property paths. */
27890
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
27891
    reIsPlainProp = /^\w*$/;
27892
27893
/**
27894
 * Checks if `value` is a property name and not a property path.
27895
 *
27896
 * @private
27897
 * @param {*} value The value to check.
27898
 * @param {Object} [object] The object to query keys on.
27899
 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
27900
 */
27901
function isKey(value, object) {
27902
  var type = typeof value;
27903
  if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
27904
    return true;
27905
  }
27906
  if (isArray(value)) {
27907
    return false;
27908
  }
27909
  var result = !reIsDeepProp.test(value);
27910
  return result || (object != null && value in toObject(object));
27911
}
27912
27913
module.exports = isKey;
27914
27915
},{"../lang/isArray":143,"./toObject":138}],127:[function(require,module,exports){
27916
var LazyWrapper = require('./LazyWrapper'),
27917
    getData = require('./getData'),
27918
    getFuncName = require('./getFuncName'),
27919
    lodash = require('../chain/lodash');
27920
27921
/**
27922
 * Checks if `func` has a lazy counterpart.
27923
 *
27924
 * @private
27925
 * @param {Function} func The function to check.
27926
 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
27927
 */
27928
function isLaziable(func) {
27929
  var funcName = getFuncName(func);
27930
  if (!(funcName in LazyWrapper.prototype)) {
27931
    return false;
27932
  }
27933
  var other = lodash[funcName];
27934
  if (func === other) {
27935
    return true;
27936
  }
27937
  var data = getData(other);
27938
  return !!data && func === data[0];
27939
}
27940
27941
module.exports = isLaziable;
27942
27943
},{"../chain/lodash":54,"./LazyWrapper":63,"./getData":113,"./getFuncName":114}],128:[function(require,module,exports){
27944
/**
27945
 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
27946
 * of an array-like value.
27947
 */
27948
var MAX_SAFE_INTEGER = 9007199254740991;
27949
27950
/**
27951
 * Checks if `value` is a valid array-like length.
27952
 *
27953
 * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
27954
 *
27955
 * @private
27956
 * @param {*} value The value to check.
27957
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
27958
 */
27959
function isLength(value) {
27960
  return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
27961
}
27962
27963
module.exports = isLength;
27964
27965
},{}],129:[function(require,module,exports){
27966
/**
27967
 * Checks if `value` is object-like.
27968
 *
27969
 * @private
27970
 * @param {*} value The value to check.
27971
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
27972
 */
27973
function isObjectLike(value) {
27974
  return !!value && typeof value == 'object';
27975
}
27976
27977
module.exports = isObjectLike;
27978
27979
},{}],130:[function(require,module,exports){
27980
var isObject = require('../lang/isObject');
27981
27982
/**
27983
 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
27984
 *
27985
 * @private
27986
 * @param {*} value The value to check.
27987
 * @returns {boolean} Returns `true` if `value` if suitable for strict
27988
 *  equality comparisons, else `false`.
27989
 */
27990
function isStrictComparable(value) {
27991
  return value === value && !isObject(value);
27992
}
27993
27994
module.exports = isStrictComparable;
27995
27996
},{"../lang/isObject":147}],131:[function(require,module,exports){
27997
var arrayCopy = require('./arrayCopy'),
27998
    composeArgs = require('./composeArgs'),
27999
    composeArgsRight = require('./composeArgsRight'),
28000
    replaceHolders = require('./replaceHolders');
28001
28002
/** Used to compose bitmasks for wrapper metadata. */
28003
var BIND_FLAG = 1,
28004
    CURRY_BOUND_FLAG = 4,
28005
    CURRY_FLAG = 8,
28006
    ARY_FLAG = 128,
28007
    REARG_FLAG = 256;
28008
28009
/** Used as the internal argument placeholder. */
28010
var PLACEHOLDER = '__lodash_placeholder__';
28011
28012
/* Native method references for those with the same name as other `lodash` methods. */
28013
var nativeMin = Math.min;
28014
28015
/**
28016
 * Merges the function metadata of `source` into `data`.
28017
 *
28018
 * Merging metadata reduces the number of wrappers required to invoke a function.
28019
 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
28020
 * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
28021
 * augment function arguments, making the order in which they are executed important,
28022
 * preventing the merging of metadata. However, we make an exception for a safe
28023
 * common case where curried functions have `_.ary` and or `_.rearg` applied.
28024
 *
28025
 * @private
28026
 * @param {Array} data The destination metadata.
28027
 * @param {Array} source The source metadata.
28028
 * @returns {Array} Returns `data`.
28029
 */
28030
function mergeData(data, source) {
28031
  var bitmask = data[1],
28032
      srcBitmask = source[1],
28033
      newBitmask = bitmask | srcBitmask,
28034
      isCommon = newBitmask < ARY_FLAG;
28035
28036
  var isCombo =
28037
    (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
28038
    (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
28039
    (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
28040
28041
  // Exit early if metadata can't be merged.
28042
  if (!(isCommon || isCombo)) {
28043
    return data;
28044
  }
28045
  // Use source `thisArg` if available.
28046
  if (srcBitmask & BIND_FLAG) {
28047
    data[2] = source[2];
28048
    // Set when currying a bound function.
28049
    newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
28050
  }
28051
  // Compose partial arguments.
28052
  var value = source[3];
28053
  if (value) {
28054
    var partials = data[3];
28055
    data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
28056
    data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
28057
  }
28058
  // Compose partial right arguments.
28059
  value = source[5];
28060
  if (value) {
28061
    partials = data[5];
28062
    data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
28063
    data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
28064
  }
28065
  // Use source `argPos` if available.
28066
  value = source[7];
28067
  if (value) {
28068
    data[7] = arrayCopy(value);
28069
  }
28070
  // Use source `ary` if it's smaller.
28071
  if (srcBitmask & ARY_FLAG) {
28072
    data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
28073
  }
28074
  // Use source `arity` if one is not provided.
28075
  if (data[9] == null) {
28076
    data[9] = source[9];
28077
  }
28078
  // Use source `func` and merge bitmasks.
28079
  data[0] = source[0];
28080
  data[1] = newBitmask;
28081
28082
  return data;
28083
}
28084
28085
module.exports = mergeData;
28086
28087
},{"./arrayCopy":65,"./composeArgs":99,"./composeArgsRight":100,"./replaceHolders":135}],132:[function(require,module,exports){
28088
(function (global){
28089
var getNative = require('./getNative');
28090
28091
/** Native method references. */
28092
var WeakMap = getNative(global, 'WeakMap');
28093
28094
/** Used to store function metadata. */
28095
var metaMap = WeakMap && new WeakMap;
28096
28097
module.exports = metaMap;
28098
28099
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28100
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL21ldGFNYXAuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2V0TmF0aXZlID0gcmVxdWlyZSgnLi9nZXROYXRpdmUnKTtcblxuLyoqIE5hdGl2ZSBtZXRob2QgcmVmZXJlbmNlcy4gKi9cbnZhciBXZWFrTWFwID0gZ2V0TmF0aXZlKGdsb2JhbCwgJ1dlYWtNYXAnKTtcblxuLyoqIFVzZWQgdG8gc3RvcmUgZnVuY3Rpb24gbWV0YWRhdGEuICovXG52YXIgbWV0YU1hcCA9IFdlYWtNYXAgJiYgbmV3IFdlYWtNYXA7XG5cbm1vZHVsZS5leHBvcnRzID0gbWV0YU1hcDtcbiJdfQ==
28101
},{"./getNative":117}],133:[function(require,module,exports){
28102
/** Used to lookup unminified function names. */
28103
var realNames = {};
28104
28105
module.exports = realNames;
28106
28107
},{}],134:[function(require,module,exports){
28108
var arrayCopy = require('./arrayCopy'),
28109
    isIndex = require('./isIndex');
28110
28111
/* Native method references for those with the same name as other `lodash` methods. */
28112
var nativeMin = Math.min;
28113
28114
/**
28115
 * Reorder `array` according to the specified indexes where the element at
28116
 * the first index is assigned as the first element, the element at
28117
 * the second index is assigned as the second element, and so on.
28118
 *
28119
 * @private
28120
 * @param {Array} array The array to reorder.
28121
 * @param {Array} indexes The arranged array indexes.
28122
 * @returns {Array} Returns `array`.
28123
 */
28124
function reorder(array, indexes) {
28125
  var arrLength = array.length,
28126
      length = nativeMin(indexes.length, arrLength),
28127
      oldArray = arrayCopy(array);
28128
28129
  while (length--) {
28130
    var index = indexes[length];
28131
    array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
28132
  }
28133
  return array;
28134
}
28135
28136
module.exports = reorder;
28137
28138
},{"./arrayCopy":65,"./isIndex":124}],135:[function(require,module,exports){
28139
/** Used as the internal argument placeholder. */
28140
var PLACEHOLDER = '__lodash_placeholder__';
28141
28142
/**
28143
 * Replaces all `placeholder` elements in `array` with an internal placeholder
28144
 * and returns an array of their indexes.
28145
 *
28146
 * @private
28147
 * @param {Array} array The array to modify.
28148
 * @param {*} placeholder The placeholder to replace.
28149
 * @returns {Array} Returns the new array of placeholder indexes.
28150
 */
28151
function replaceHolders(array, placeholder) {
28152
  var index = -1,
28153
      length = array.length,
28154
      resIndex = -1,
28155
      result = [];
28156
28157
  while (++index < length) {
28158
    if (array[index] === placeholder) {
28159
      array[index] = PLACEHOLDER;
28160
      result[++resIndex] = index;
28161
    }
28162
  }
28163
  return result;
28164
}
28165
28166
module.exports = replaceHolders;
28167
28168
},{}],136:[function(require,module,exports){
28169
var baseSetData = require('./baseSetData'),
28170
    now = require('../date/now');
28171
28172
/** Used to detect when a function becomes hot. */
28173
var HOT_COUNT = 150,
28174
    HOT_SPAN = 16;
28175
28176
/**
28177
 * Sets metadata for `func`.
28178
 *
28179
 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
28180
 * period of time, it will trip its breaker and transition to an identity function
28181
 * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
28182
 * for more details.
28183
 *
28184
 * @private
28185
 * @param {Function} func The function to associate metadata with.
28186
 * @param {*} data The metadata.
28187
 * @returns {Function} Returns `func`.
28188
 */
28189
var setData = (function() {
28190
  var count = 0,
28191
      lastCalled = 0;
28192
28193
  return function(key, value) {
28194
    var stamp = now(),
28195
        remaining = HOT_SPAN - (stamp - lastCalled);
28196
28197
    lastCalled = stamp;
28198
    if (remaining > 0) {
28199
      if (++count >= HOT_COUNT) {
28200
        return key;
28201
      }
28202
    } else {
28203
      count = 0;
28204
    }
28205
    return baseSetData(key, value);
28206
  };
28207
}());
28208
28209
module.exports = setData;
28210
28211
},{"../date/now":60,"./baseSetData":91}],137:[function(require,module,exports){
28212
var isArguments = require('../lang/isArguments'),
28213
    isArray = require('../lang/isArray'),
28214
    isIndex = require('./isIndex'),
28215
    isLength = require('./isLength'),
28216
    isString = require('../lang/isString'),
28217
    keysIn = require('../object/keysIn');
28218
28219
/** Used for native method references. */
28220
var objectProto = Object.prototype;
28221
28222
/** Used to check objects for own properties. */
28223
var hasOwnProperty = objectProto.hasOwnProperty;
28224
28225
/**
28226
 * A fallback implementation of `Object.keys` which creates an array of the
28227
 * own enumerable property names of `object`.
28228
 *
28229
 * @private
28230
 * @param {Object} object The object to query.
28231
 * @returns {Array} Returns the array of property names.
28232
 */
28233
function shimKeys(object) {
28234
  var props = keysIn(object),
28235
      propsLength = props.length,
28236
      length = propsLength && object.length;
28237
28238
  var allowIndexes = !!length && isLength(length) &&
28239
    (isArray(object) || isArguments(object) || isString(object));
28240
28241
  var index = -1,
28242
      result = [];
28243
28244
  while (++index < propsLength) {
28245
    var key = props[index];
28246
    if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
28247
      result.push(key);
28248
    }
28249
  }
28250
  return result;
28251
}
28252
28253
module.exports = shimKeys;
28254
28255
},{"../lang/isArguments":142,"../lang/isArray":143,"../lang/isString":149,"../object/keysIn":153,"./isIndex":124,"./isLength":128}],138:[function(require,module,exports){
28256
var isObject = require('../lang/isObject'),
28257
    isString = require('../lang/isString'),
28258
    support = require('../support');
28259
28260
/**
28261
 * Converts `value` to an object if it's not one.
28262
 *
28263
 * @private
28264
 * @param {*} value The value to process.
28265
 * @returns {Object} Returns the object.
28266
 */
28267
function toObject(value) {
28268
  if (support.unindexedChars && isString(value)) {
28269
    var index = -1,
28270
        length = value.length,
28271
        result = Object(value);
28272
28273
    while (++index < length) {
28274
      result[index] = value.charAt(index);
28275
    }
28276
    return result;
28277
  }
28278
  return isObject(value) ? value : Object(value);
28279
}
28280
28281
module.exports = toObject;
28282
28283
},{"../lang/isObject":147,"../lang/isString":149,"../support":156}],139:[function(require,module,exports){
28284
var baseToString = require('./baseToString'),
28285
    isArray = require('../lang/isArray');
28286
28287
/** Used to match property names within property paths. */
28288
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
28289
28290
/** Used to match backslashes in property paths. */
28291
var reEscapeChar = /\\(\\)?/g;
28292
28293
/**
28294
 * Converts `value` to property path array if it's not one.
28295
 *
28296
 * @private
28297
 * @param {*} value The value to process.
28298
 * @returns {Array} Returns the property path array.
28299
 */
28300
function toPath(value) {
28301
  if (isArray(value)) {
28302
    return value;
28303
  }
28304
  var result = [];
28305
  baseToString(value).replace(rePropName, function(match, number, quote, string) {
28306
    result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
28307
  });
28308
  return result;
28309
}
28310
28311
module.exports = toPath;
28312
28313
},{"../lang/isArray":143,"./baseToString":93}],140:[function(require,module,exports){
28314
var LazyWrapper = require('./LazyWrapper'),
28315
    LodashWrapper = require('./LodashWrapper'),
28316
    arrayCopy = require('./arrayCopy');
28317
28318
/**
28319
 * Creates a clone of `wrapper`.
28320
 *
28321
 * @private
28322
 * @param {Object} wrapper The wrapper to clone.
28323
 * @returns {Object} Returns the cloned wrapper.
28324
 */
28325
function wrapperClone(wrapper) {
28326
  return wrapper instanceof LazyWrapper
28327
    ? wrapper.clone()
28328
    : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
28329
}
28330
28331
module.exports = wrapperClone;
28332
28333
},{"./LazyWrapper":63,"./LodashWrapper":64,"./arrayCopy":65}],141:[function(require,module,exports){
28334
var baseClone = require('../internal/baseClone'),
28335
    bindCallback = require('../internal/bindCallback');
28336
28337
/**
28338
 * Creates a deep clone of `value`. If `customizer` is provided it is invoked
28339
 * to produce the cloned values. If `customizer` returns `undefined` cloning
28340
 * is handled by the method instead. The `customizer` is bound to `thisArg`
28341
 * and invoked with two argument; (value [, index|key, object]).
28342
 *
28343
 * **Note:** This method is loosely based on the
28344
 * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
28345
 * The enumerable properties of `arguments` objects and objects created by
28346
 * constructors other than `Object` are cloned to plain `Object` objects. An
28347
 * empty object is returned for uncloneable values such as functions, DOM nodes,
28348
 * Maps, Sets, and WeakMaps.
28349
 *
28350
 * @static
28351
 * @memberOf _
28352
 * @category Lang
28353
 * @param {*} value The value to deep clone.
28354
 * @param {Function} [customizer] The function to customize cloning values.
28355
 * @param {*} [thisArg] The `this` binding of `customizer`.
28356
 * @returns {*} Returns the deep cloned value.
28357
 * @example
28358
 *
28359
 * var users = [
28360
 *   { 'user': 'barney' },
28361
 *   { 'user': 'fred' }
28362
 * ];
28363
 *
28364
 * var deep = _.cloneDeep(users);
28365
 * deep[0] === users[0];
28366
 * // => false
28367
 *
28368
 * // using a customizer callback
28369
 * var el = _.cloneDeep(document.body, function(value) {
28370
 *   if (_.isElement(value)) {
28371
 *     return value.cloneNode(true);
28372
 *   }
28373
 * });
28374
 *
28375
 * el === document.body
28376
 * // => false
28377
 * el.nodeName
28378
 * // => BODY
28379
 * el.childNodes.length;
28380
 * // => 20
28381
 */
28382
function cloneDeep(value, customizer, thisArg) {
28383
  return typeof customizer == 'function'
28384
    ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
28385
    : baseClone(value, true);
28386
}
28387
28388
module.exports = cloneDeep;
28389
28390
},{"../internal/baseClone":71,"../internal/bindCallback":97}],142:[function(require,module,exports){
28391
var isArrayLike = require('../internal/isArrayLike'),
28392
    isObjectLike = require('../internal/isObjectLike');
28393
28394
/** Used for native method references. */
28395
var objectProto = Object.prototype;
28396
28397
/** Used to check objects for own properties. */
28398
var hasOwnProperty = objectProto.hasOwnProperty;
28399
28400
/** Native method references. */
28401
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
28402
28403
/**
28404
 * Checks if `value` is classified as an `arguments` object.
28405
 *
28406
 * @static
28407
 * @memberOf _
28408
 * @category Lang
28409
 * @param {*} value The value to check.
28410
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28411
 * @example
28412
 *
28413
 * _.isArguments(function() { return arguments; }());
28414
 * // => true
28415
 *
28416
 * _.isArguments([1, 2, 3]);
28417
 * // => false
28418
 */
28419
function isArguments(value) {
28420
  return isObjectLike(value) && isArrayLike(value) &&
28421
    hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
28422
}
28423
28424
module.exports = isArguments;
28425
28426
},{"../internal/isArrayLike":122,"../internal/isObjectLike":129}],143:[function(require,module,exports){
28427
var getNative = require('../internal/getNative'),
28428
    isLength = require('../internal/isLength'),
28429
    isObjectLike = require('../internal/isObjectLike');
28430
28431
/** `Object#toString` result references. */
28432
var arrayTag = '[object Array]';
28433
28434
/** Used for native method references. */
28435
var objectProto = Object.prototype;
28436
28437
/**
28438
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28439
 * of values.
28440
 */
28441
var objToString = objectProto.toString;
28442
28443
/* Native method references for those with the same name as other `lodash` methods. */
28444
var nativeIsArray = getNative(Array, 'isArray');
28445
28446
/**
28447
 * Checks if `value` is classified as an `Array` object.
28448
 *
28449
 * @static
28450
 * @memberOf _
28451
 * @category Lang
28452
 * @param {*} value The value to check.
28453
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28454
 * @example
28455
 *
28456
 * _.isArray([1, 2, 3]);
28457
 * // => true
28458
 *
28459
 * _.isArray(function() { return arguments; }());
28460
 * // => false
28461
 */
28462
var isArray = nativeIsArray || function(value) {
28463
  return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
28464
};
28465
28466
module.exports = isArray;
28467
28468
},{"../internal/getNative":117,"../internal/isLength":128,"../internal/isObjectLike":129}],144:[function(require,module,exports){
28469
var isArguments = require('./isArguments'),
28470
    isArray = require('./isArray'),
28471
    isArrayLike = require('../internal/isArrayLike'),
28472
    isFunction = require('./isFunction'),
28473
    isObjectLike = require('../internal/isObjectLike'),
28474
    isString = require('./isString'),
28475
    keys = require('../object/keys');
28476
28477
/**
28478
 * Checks if `value` is empty. A value is considered empty unless it is an
28479
 * `arguments` object, array, string, or jQuery-like collection with a length
28480
 * greater than `0` or an object with own enumerable properties.
28481
 *
28482
 * @static
28483
 * @memberOf _
28484
 * @category Lang
28485
 * @param {Array|Object|string} value The value to inspect.
28486
 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
28487
 * @example
28488
 *
28489
 * _.isEmpty(null);
28490
 * // => true
28491
 *
28492
 * _.isEmpty(true);
28493
 * // => true
28494
 *
28495
 * _.isEmpty(1);
28496
 * // => true
28497
 *
28498
 * _.isEmpty([1, 2, 3]);
28499
 * // => false
28500
 *
28501
 * _.isEmpty({ 'a': 1 });
28502
 * // => false
28503
 */
28504
function isEmpty(value) {
28505
  if (value == null) {
28506
    return true;
28507
  }
28508
  if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
28509
      (isObjectLike(value) && isFunction(value.splice)))) {
28510
    return !value.length;
28511
  }
28512
  return !keys(value).length;
28513
}
28514
28515
module.exports = isEmpty;
28516
28517
},{"../internal/isArrayLike":122,"../internal/isObjectLike":129,"../object/keys":152,"./isArguments":142,"./isArray":143,"./isFunction":145,"./isString":149}],145:[function(require,module,exports){
28518
var isObject = require('./isObject');
28519
28520
/** `Object#toString` result references. */
28521
var funcTag = '[object Function]';
28522
28523
/** Used for native method references. */
28524
var objectProto = Object.prototype;
28525
28526
/**
28527
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28528
 * of values.
28529
 */
28530
var objToString = objectProto.toString;
28531
28532
/**
28533
 * Checks if `value` is classified as a `Function` object.
28534
 *
28535
 * @static
28536
 * @memberOf _
28537
 * @category Lang
28538
 * @param {*} value The value to check.
28539
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28540
 * @example
28541
 *
28542
 * _.isFunction(_);
28543
 * // => true
28544
 *
28545
 * _.isFunction(/abc/);
28546
 * // => false
28547
 */
28548
function isFunction(value) {
28549
  // The use of `Object#toString` avoids issues with the `typeof` operator
28550
  // in older versions of Chrome and Safari which return 'function' for regexes
28551
  // and Safari 8 equivalents which return 'object' for typed array constructors.
28552
  return isObject(value) && objToString.call(value) == funcTag;
28553
}
28554
28555
module.exports = isFunction;
28556
28557
},{"./isObject":147}],146:[function(require,module,exports){
28558
var isFunction = require('./isFunction'),
28559
    isHostObject = require('../internal/isHostObject'),
28560
    isObjectLike = require('../internal/isObjectLike');
28561
28562
/** Used to detect host constructors (Safari > 5). */
28563
var reIsHostCtor = /^\[object .+?Constructor\]$/;
28564
28565
/** Used for native method references. */
28566
var objectProto = Object.prototype;
28567
28568
/** Used to resolve the decompiled source of functions. */
28569
var fnToString = Function.prototype.toString;
28570
28571
/** Used to check objects for own properties. */
28572
var hasOwnProperty = objectProto.hasOwnProperty;
28573
28574
/** Used to detect if a method is native. */
28575
var reIsNative = RegExp('^' +
28576
  fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
28577
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
28578
);
28579
28580
/**
28581
 * Checks if `value` is a native function.
28582
 *
28583
 * @static
28584
 * @memberOf _
28585
 * @category Lang
28586
 * @param {*} value The value to check.
28587
 * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
28588
 * @example
28589
 *
28590
 * _.isNative(Array.prototype.push);
28591
 * // => true
28592
 *
28593
 * _.isNative(_);
28594
 * // => false
28595
 */
28596
function isNative(value) {
28597
  if (value == null) {
28598
    return false;
28599
  }
28600
  if (isFunction(value)) {
28601
    return reIsNative.test(fnToString.call(value));
28602
  }
28603
  return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
28604
}
28605
28606
module.exports = isNative;
28607
28608
},{"../internal/isHostObject":123,"../internal/isObjectLike":129,"./isFunction":145}],147:[function(require,module,exports){
28609
/**
28610
 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
28611
 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
28612
 *
28613
 * @static
28614
 * @memberOf _
28615
 * @category Lang
28616
 * @param {*} value The value to check.
28617
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
28618
 * @example
28619
 *
28620
 * _.isObject({});
28621
 * // => true
28622
 *
28623
 * _.isObject([1, 2, 3]);
28624
 * // => true
28625
 *
28626
 * _.isObject(1);
28627
 * // => false
28628
 */
28629
function isObject(value) {
28630
  // Avoid a V8 JIT bug in Chrome 19-20.
28631
  // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
28632
  var type = typeof value;
28633
  return !!value && (type == 'object' || type == 'function');
28634
}
28635
28636
module.exports = isObject;
28637
28638
},{}],148:[function(require,module,exports){
28639
var baseForIn = require('../internal/baseForIn'),
28640
    isArguments = require('./isArguments'),
28641
    isHostObject = require('../internal/isHostObject'),
28642
    isObjectLike = require('../internal/isObjectLike'),
28643
    support = require('../support');
28644
28645
/** `Object#toString` result references. */
28646
var objectTag = '[object Object]';
28647
28648
/** Used for native method references. */
28649
var objectProto = Object.prototype;
28650
28651
/** Used to check objects for own properties. */
28652
var hasOwnProperty = objectProto.hasOwnProperty;
28653
28654
/**
28655
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28656
 * of values.
28657
 */
28658
var objToString = objectProto.toString;
28659
28660
/**
28661
 * Checks if `value` is a plain object, that is, an object created by the
28662
 * `Object` constructor or one with a `[[Prototype]]` of `null`.
28663
 *
28664
 * **Note:** This method assumes objects created by the `Object` constructor
28665
 * have no inherited enumerable properties.
28666
 *
28667
 * @static
28668
 * @memberOf _
28669
 * @category Lang
28670
 * @param {*} value The value to check.
28671
 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
28672
 * @example
28673
 *
28674
 * function Foo() {
28675
 *   this.a = 1;
28676
 * }
28677
 *
28678
 * _.isPlainObject(new Foo);
28679
 * // => false
28680
 *
28681
 * _.isPlainObject([1, 2, 3]);
28682
 * // => false
28683
 *
28684
 * _.isPlainObject({ 'x': 0, 'y': 0 });
28685
 * // => true
28686
 *
28687
 * _.isPlainObject(Object.create(null));
28688
 * // => true
28689
 */
28690
function isPlainObject(value) {
28691
  var Ctor;
28692
28693
  // Exit early for non `Object` objects.
28694
  if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) ||
28695
      (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
28696
    return false;
28697
  }
28698
  // IE < 9 iterates inherited properties before own properties. If the first
28699
  // iterated property is an object's own property then there are no inherited
28700
  // enumerable properties.
28701
  var result;
28702
  if (support.ownLast) {
28703
    baseForIn(value, function(subValue, key, object) {
28704
      result = hasOwnProperty.call(object, key);
28705
      return false;
28706
    });
28707
    return result !== false;
28708
  }
28709
  // In most environments an object's own properties are iterated before
28710
  // its inherited properties. If the last iterated property is an object's
28711
  // own property then there are no inherited enumerable properties.
28712
  baseForIn(value, function(subValue, key) {
28713
    result = key;
28714
  });
28715
  return result === undefined || hasOwnProperty.call(value, result);
28716
}
28717
28718
module.exports = isPlainObject;
28719
28720
},{"../internal/baseForIn":78,"../internal/isHostObject":123,"../internal/isObjectLike":129,"../support":156,"./isArguments":142}],149:[function(require,module,exports){
28721
var isObjectLike = require('../internal/isObjectLike');
28722
28723
/** `Object#toString` result references. */
28724
var stringTag = '[object String]';
28725
28726
/** Used for native method references. */
28727
var objectProto = Object.prototype;
28728
28729
/**
28730
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28731
 * of values.
28732
 */
28733
var objToString = objectProto.toString;
28734
28735
/**
28736
 * Checks if `value` is classified as a `String` primitive or object.
28737
 *
28738
 * @static
28739
 * @memberOf _
28740
 * @category Lang
28741
 * @param {*} value The value to check.
28742
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28743
 * @example
28744
 *
28745
 * _.isString('abc');
28746
 * // => true
28747
 *
28748
 * _.isString(1);
28749
 * // => false
28750
 */
28751
function isString(value) {
28752
  return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
28753
}
28754
28755
module.exports = isString;
28756
28757
},{"../internal/isObjectLike":129}],150:[function(require,module,exports){
28758
var isLength = require('../internal/isLength'),
28759
    isObjectLike = require('../internal/isObjectLike');
28760
28761
/** `Object#toString` result references. */
28762
var argsTag = '[object Arguments]',
28763
    arrayTag = '[object Array]',
28764
    boolTag = '[object Boolean]',
28765
    dateTag = '[object Date]',
28766
    errorTag = '[object Error]',
28767
    funcTag = '[object Function]',
28768
    mapTag = '[object Map]',
28769
    numberTag = '[object Number]',
28770
    objectTag = '[object Object]',
28771
    regexpTag = '[object RegExp]',
28772
    setTag = '[object Set]',
28773
    stringTag = '[object String]',
28774
    weakMapTag = '[object WeakMap]';
28775
28776
var arrayBufferTag = '[object ArrayBuffer]',
28777
    float32Tag = '[object Float32Array]',
28778
    float64Tag = '[object Float64Array]',
28779
    int8Tag = '[object Int8Array]',
28780
    int16Tag = '[object Int16Array]',
28781
    int32Tag = '[object Int32Array]',
28782
    uint8Tag = '[object Uint8Array]',
28783
    uint8ClampedTag = '[object Uint8ClampedArray]',
28784
    uint16Tag = '[object Uint16Array]',
28785
    uint32Tag = '[object Uint32Array]';
28786
28787
/** Used to identify `toStringTag` values of typed arrays. */
28788
var typedArrayTags = {};
28789
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
28790
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
28791
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
28792
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
28793
typedArrayTags[uint32Tag] = true;
28794
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
28795
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
28796
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
28797
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
28798
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
28799
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
28800
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
28801
28802
/** Used for native method references. */
28803
var objectProto = Object.prototype;
28804
28805
/**
28806
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28807
 * of values.
28808
 */
28809
var objToString = objectProto.toString;
28810
28811
/**
28812
 * Checks if `value` is classified as a typed array.
28813
 *
28814
 * @static
28815
 * @memberOf _
28816
 * @category Lang
28817
 * @param {*} value The value to check.
28818
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
28819
 * @example
28820
 *
28821
 * _.isTypedArray(new Uint8Array);
28822
 * // => true
28823
 *
28824
 * _.isTypedArray([]);
28825
 * // => false
28826
 */
28827
function isTypedArray(value) {
28828
  return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
28829
}
28830
28831
module.exports = isTypedArray;
28832
28833
},{"../internal/isLength":128,"../internal/isObjectLike":129}],151:[function(require,module,exports){
28834
/**
28835
 * Checks if `value` is `undefined`.
28836
 *
28837
 * @static
28838
 * @memberOf _
28839
 * @category Lang
28840
 * @param {*} value The value to check.
28841
 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
28842
 * @example
28843
 *
28844
 * _.isUndefined(void 0);
28845
 * // => true
28846
 *
28847
 * _.isUndefined(null);
28848
 * // => false
28849
 */
28850
function isUndefined(value) {
28851
  return value === undefined;
28852
}
28853
28854
module.exports = isUndefined;
28855
28856
},{}],152:[function(require,module,exports){
28857
var getNative = require('../internal/getNative'),
28858
    isArrayLike = require('../internal/isArrayLike'),
28859
    isObject = require('../lang/isObject'),
28860
    shimKeys = require('../internal/shimKeys'),
28861
    support = require('../support');
28862
28863
/* Native method references for those with the same name as other `lodash` methods. */
28864
var nativeKeys = getNative(Object, 'keys');
28865
28866
/**
28867
 * Creates an array of the own enumerable property names of `object`.
28868
 *
28869
 * **Note:** Non-object values are coerced to objects. See the
28870
 * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
28871
 * for more details.
28872
 *
28873
 * @static
28874
 * @memberOf _
28875
 * @category Object
28876
 * @param {Object} object The object to query.
28877
 * @returns {Array} Returns the array of property names.
28878
 * @example
28879
 *
28880
 * function Foo() {
28881
 *   this.a = 1;
28882
 *   this.b = 2;
28883
 * }
28884
 *
28885
 * Foo.prototype.c = 3;
28886
 *
28887
 * _.keys(new Foo);
28888
 * // => ['a', 'b'] (iteration order is not guaranteed)
28889
 *
28890
 * _.keys('hi');
28891
 * // => ['0', '1']
28892
 */
28893
var keys = !nativeKeys ? shimKeys : function(object) {
28894
  var Ctor = object == null ? undefined : object.constructor;
28895
  if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
28896
      (typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) {
28897
    return shimKeys(object);
28898
  }
28899
  return isObject(object) ? nativeKeys(object) : [];
28900
};
28901
28902
module.exports = keys;
28903
28904
},{"../internal/getNative":117,"../internal/isArrayLike":122,"../internal/shimKeys":137,"../lang/isObject":147,"../support":156}],153:[function(require,module,exports){
28905
var arrayEach = require('../internal/arrayEach'),
28906
    isArguments = require('../lang/isArguments'),
28907
    isArray = require('../lang/isArray'),
28908
    isFunction = require('../lang/isFunction'),
28909
    isIndex = require('../internal/isIndex'),
28910
    isLength = require('../internal/isLength'),
28911
    isObject = require('../lang/isObject'),
28912
    isString = require('../lang/isString'),
28913
    support = require('../support');
28914
28915
/** `Object#toString` result references. */
28916
var arrayTag = '[object Array]',
28917
    boolTag = '[object Boolean]',
28918
    dateTag = '[object Date]',
28919
    errorTag = '[object Error]',
28920
    funcTag = '[object Function]',
28921
    numberTag = '[object Number]',
28922
    objectTag = '[object Object]',
28923
    regexpTag = '[object RegExp]',
28924
    stringTag = '[object String]';
28925
28926
/** Used to fix the JScript `[[DontEnum]]` bug. */
28927
var shadowProps = [
28928
  'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
28929
  'toLocaleString', 'toString', 'valueOf'
28930
];
28931
28932
/** Used for native method references. */
28933
var errorProto = Error.prototype,
28934
    objectProto = Object.prototype,
28935
    stringProto = String.prototype;
28936
28937
/** Used to check objects for own properties. */
28938
var hasOwnProperty = objectProto.hasOwnProperty;
28939
28940
/**
28941
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
28942
 * of values.
28943
 */
28944
var objToString = objectProto.toString;
28945
28946
/** Used to avoid iterating over non-enumerable properties in IE < 9. */
28947
var nonEnumProps = {};
28948
nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
28949
nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true };
28950
nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true };
28951
nonEnumProps[objectTag] = { 'constructor': true };
28952
28953
arrayEach(shadowProps, function(key) {
28954
  for (var tag in nonEnumProps) {
28955
    if (hasOwnProperty.call(nonEnumProps, tag)) {
28956
      var props = nonEnumProps[tag];
28957
      props[key] = hasOwnProperty.call(props, key);
28958
    }
28959
  }
28960
});
28961
28962
/**
28963
 * Creates an array of the own and inherited enumerable property names of `object`.
28964
 *
28965
 * **Note:** Non-object values are coerced to objects.
28966
 *
28967
 * @static
28968
 * @memberOf _
28969
 * @category Object
28970
 * @param {Object} object The object to query.
28971
 * @returns {Array} Returns the array of property names.
28972
 * @example
28973
 *
28974
 * function Foo() {
28975
 *   this.a = 1;
28976
 *   this.b = 2;
28977
 * }
28978
 *
28979
 * Foo.prototype.c = 3;
28980
 *
28981
 * _.keysIn(new Foo);
28982
 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
28983
 */
28984
function keysIn(object) {
28985
  if (object == null) {
28986
    return [];
28987
  }
28988
  if (!isObject(object)) {
28989
    object = Object(object);
28990
  }
28991
  var length = object.length;
28992
28993
  length = (length && isLength(length) &&
28994
    (isArray(object) || isArguments(object) || isString(object)) && length) || 0;
28995
28996
  var Ctor = object.constructor,
28997
      index = -1,
28998
      proto = (isFunction(Ctor) && Ctor.prototype) || objectProto,
28999
      isProto = proto === object,
29000
      result = Array(length),
29001
      skipIndexes = length > 0,
29002
      skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
29003
      skipProto = support.enumPrototypes && isFunction(object);
29004
29005
  while (++index < length) {
29006
    result[index] = (index + '');
29007
  }
29008
  // lodash skips the `constructor` property when it infers it is iterating
29009
  // over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
29010
  // attribute of an existing property and the `constructor` property of a
29011
  // prototype defaults to non-enumerable.
29012
  for (var key in object) {
29013
    if (!(skipProto && key == 'prototype') &&
29014
        !(skipErrorProps && (key == 'message' || key == 'name')) &&
29015
        !(skipIndexes && isIndex(key, length)) &&
29016
        !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
29017
      result.push(key);
29018
    }
29019
  }
29020
  if (support.nonEnumShadows && object !== objectProto) {
29021
    var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)),
29022
        nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag];
29023
29024
    if (tag == objectTag) {
29025
      proto = objectProto;
29026
    }
29027
    length = shadowProps.length;
29028
    while (length--) {
29029
      key = shadowProps[length];
29030
      var nonEnum = nonEnums[key];
29031
      if (!(isProto && nonEnum) &&
29032
          (nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
29033
        result.push(key);
29034
      }
29035
    }
29036
  }
29037
  return result;
29038
}
29039
29040
module.exports = keysIn;
29041
29042
},{"../internal/arrayEach":66,"../internal/isIndex":124,"../internal/isLength":128,"../lang/isArguments":142,"../lang/isArray":143,"../lang/isFunction":145,"../lang/isObject":147,"../lang/isString":149,"../support":156}],154:[function(require,module,exports){
29043
var keys = require('./keys'),
29044
    toObject = require('../internal/toObject');
29045
29046
/**
29047
 * Creates a two dimensional array of the key-value pairs for `object`,
29048
 * e.g. `[[key1, value1], [key2, value2]]`.
29049
 *
29050
 * @static
29051
 * @memberOf _
29052
 * @category Object
29053
 * @param {Object} object The object to query.
29054
 * @returns {Array} Returns the new array of key-value pairs.
29055
 * @example
29056
 *
29057
 * _.pairs({ 'barney': 36, 'fred': 40 });
29058
 * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
29059
 */
29060
function pairs(object) {
29061
  object = toObject(object);
29062
29063
  var index = -1,
29064
      props = keys(object),
29065
      length = props.length,
29066
      result = Array(length);
29067
29068
  while (++index < length) {
29069
    var key = props[index];
29070
    result[index] = [key, object[key]];
29071
  }
29072
  return result;
29073
}
29074
29075
module.exports = pairs;
29076
29077
},{"../internal/toObject":138,"./keys":152}],155:[function(require,module,exports){
29078
var baseValues = require('../internal/baseValues'),
29079
    keys = require('./keys');
29080
29081
/**
29082
 * Creates an array of the own enumerable property values of `object`.
29083
 *
29084
 * **Note:** Non-object values are coerced to objects.
29085
 *
29086
 * @static
29087
 * @memberOf _
29088
 * @category Object
29089
 * @param {Object} object The object to query.
29090
 * @returns {Array} Returns the array of property values.
29091
 * @example
29092
 *
29093
 * function Foo() {
29094
 *   this.a = 1;
29095
 *   this.b = 2;
29096
 * }
29097
 *
29098
 * Foo.prototype.c = 3;
29099
 *
29100
 * _.values(new Foo);
29101
 * // => [1, 2] (iteration order is not guaranteed)
29102
 *
29103
 * _.values('hi');
29104
 * // => ['h', 'i']
29105
 */
29106
function values(object) {
29107
  return baseValues(object, keys(object));
29108
}
29109
29110
module.exports = values;
29111
29112
},{"../internal/baseValues":94,"./keys":152}],156:[function(require,module,exports){
29113
/** Used for native method references. */
29114
var arrayProto = Array.prototype,
29115
    errorProto = Error.prototype,
29116
    objectProto = Object.prototype;
29117
29118
/** Native method references. */
29119
var propertyIsEnumerable = objectProto.propertyIsEnumerable,
29120
    splice = arrayProto.splice;
29121
29122
/**
29123
 * An object environment feature flags.
29124
 *
29125
 * @static
29126
 * @memberOf _
29127
 * @type Object
29128
 */
29129
var support = {};
29130
29131
(function(x) {
29132
  var Ctor = function() { this.x = x; },
29133
      object = { '0': x, 'length': x },
29134
      props = [];
29135
29136
  Ctor.prototype = { 'valueOf': x, 'y': x };
29137
  for (var key in new Ctor) { props.push(key); }
29138
29139
  /**
29140
   * Detect if `name` or `message` properties of `Error.prototype` are
29141
   * enumerable by default (IE < 9, Safari < 5.1).
29142
   *
29143
   * @memberOf _.support
29144
   * @type boolean
29145
   */
29146
  support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') ||
29147
    propertyIsEnumerable.call(errorProto, 'name');
29148
29149
  /**
29150
   * Detect if `prototype` properties are enumerable by default.
29151
   *
29152
   * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
29153
   * (if the prototype or a property on the prototype has been set)
29154
   * incorrectly set the `[[Enumerable]]` value of a function's `prototype`
29155
   * property to `true`.
29156
   *
29157
   * @memberOf _.support
29158
   * @type boolean
29159
   */
29160
  support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
29161
29162
  /**
29163
   * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
29164
   *
29165
   * In IE < 9 an object's own properties, shadowing non-enumerable ones,
29166
   * are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
29167
   *
29168
   * @memberOf _.support
29169
   * @type boolean
29170
   */
29171
  support.nonEnumShadows = !/valueOf/.test(props);
29172
29173
  /**
29174
   * Detect if own properties are iterated after inherited properties (IE < 9).
29175
   *
29176
   * @memberOf _.support
29177
   * @type boolean
29178
   */
29179
  support.ownLast = props[0] != 'x';
29180
29181
  /**
29182
   * Detect if `Array#shift` and `Array#splice` augment array-like objects
29183
   * correctly.
29184
   *
29185
   * Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
29186
   * `shift()` and `splice()` functions that fail to remove the last element,
29187
   * `value[0]`, of array-like objects even though the "length" property is
29188
   * set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
29189
   * while `splice()` is buggy regardless of mode in IE < 9.
29190
   *
29191
   * @memberOf _.support
29192
   * @type boolean
29193
   */
29194
  support.spliceObjects = (splice.call(object, 0, 1), !object[0]);
29195
29196
  /**
29197
   * Detect lack of support for accessing string characters by index.
29198
   *
29199
   * IE < 8 can't access characters by index. IE 8 can only access characters
29200
   * by index on string literals, not string objects.
29201
   *
29202
   * @memberOf _.support
29203
   * @type boolean
29204
   */
29205
  support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
29206
}(1, 0));
29207
29208
module.exports = support;
29209
29210
},{}],157:[function(require,module,exports){
29211
/**
29212
 * This method returns the first argument provided to it.
29213
 *
29214
 * @static
29215
 * @memberOf _
29216
 * @category Utility
29217
 * @param {*} value Any value.
29218
 * @returns {*} Returns `value`.
29219
 * @example
29220
 *
29221
 * var object = { 'user': 'fred' };
29222
 *
29223
 * _.identity(object) === object;
29224
 * // => true
29225
 */
29226
function identity(value) {
29227
  return value;
29228
}
29229
29230
module.exports = identity;
29231
29232
},{}],158:[function(require,module,exports){
29233
/**
29234
 * A no-operation function that returns `undefined` regardless of the
29235
 * arguments it receives.
29236
 *
29237
 * @static
29238
 * @memberOf _
29239
 * @category Utility
29240
 * @example
29241
 *
29242
 * var object = { 'user': 'fred' };
29243
 *
29244
 * _.noop(object) === undefined;
29245
 * // => true
29246
 */
29247
function noop() {
29248
  // No operation performed.
29249
}
29250
29251
module.exports = noop;
29252
29253
},{}],159:[function(require,module,exports){
29254
var baseProperty = require('../internal/baseProperty'),
29255
    basePropertyDeep = require('../internal/basePropertyDeep'),
29256
    isKey = require('../internal/isKey');
29257
29258
/**
29259
 * Creates a function that returns the property value at `path` on a
29260
 * given object.
29261
 *
29262
 * @static
29263
 * @memberOf _
29264
 * @category Utility
29265
 * @param {Array|string} path The path of the property to get.
29266
 * @returns {Function} Returns the new function.
29267
 * @example
29268
 *
29269
 * var objects = [
29270
 *   { 'a': { 'b': { 'c': 2 } } },
29271
 *   { 'a': { 'b': { 'c': 1 } } }
29272
 * ];
29273
 *
29274
 * _.map(objects, _.property('a.b.c'));
29275
 * // => [2, 1]
29276
 *
29277
 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
29278
 * // => [1, 2]
29279
 */
29280
function property(path) {
29281
  return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
29282
}
29283
29284
module.exports = property;
29285
29286
},{"../internal/baseProperty":89,"../internal/basePropertyDeep":90,"../internal/isKey":126}],160:[function(require,module,exports){
29287
/**
29288
 * Module dependencies.
29289
 */
29290
29291
var Emitter = require('emitter');
29292
var reduce = require('reduce');
29293
29294
/**
29295
 * Root reference for iframes.
29296
 */
29297
29298
var root = 'undefined' == typeof window
29299
  ? (this || self)
29300
  : window;
29301
29302
/**
29303
 * Noop.
29304
 */
29305
29306
function noop(){};
29307
29308
/**
29309
 * Check if `obj` is a host object,
29310
 * we don't want to serialize these :)
29311
 *
29312
 * TODO: future proof, move to compoent land
29313
 *
29314
 * @param {Object} obj
29315
 * @return {Boolean}
29316
 * @api private
29317
 */
29318
29319
function isHost(obj) {
29320
  var str = {}.toString.call(obj);
29321
29322
  switch (str) {
29323
    case '[object File]':
29324
    case '[object Blob]':
29325
    case '[object FormData]':
29326
      return true;
29327
    default:
29328
      return false;
29329
  }
29330
}
29331
29332
/**
29333
 * Determine XHR.
29334
 */
29335
29336
request.getXHR = function () {
29337
  if (root.XMLHttpRequest
29338
      && (!root.location || 'file:' != root.location.protocol
29339
          || !root.ActiveXObject)) {
29340
    return new XMLHttpRequest;
29341
  } else {
29342
    try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
29343
    try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
29344
    try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
29345
    try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
29346
  }
29347
  return false;
29348
};
29349
29350
/**
29351
 * Removes leading and trailing whitespace, added to support IE.
29352
 *
29353
 * @param {String} s
29354
 * @return {String}
29355
 * @api private
29356
 */
29357
29358
var trim = ''.trim
29359
  ? function(s) { return s.trim(); }
29360
  : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
29361
29362
/**
29363
 * Check if `obj` is an object.
29364
 *
29365
 * @param {Object} obj
29366
 * @return {Boolean}
29367
 * @api private
29368
 */
29369
29370
function isObject(obj) {
29371
  return obj === Object(obj);
29372
}
29373
29374
/**
29375
 * Serialize the given `obj`.
29376
 *
29377
 * @param {Object} obj
29378
 * @return {String}
29379
 * @api private
29380
 */
29381
29382
function serialize(obj) {
29383
  if (!isObject(obj)) return obj;
29384
  var pairs = [];
29385
  for (var key in obj) {
29386
    if (null != obj[key]) {
29387
      pairs.push(encodeURIComponent(key)
29388
        + '=' + encodeURIComponent(obj[key]));
29389
    }
29390
  }
29391
  return pairs.join('&');
29392
}
29393
29394
/**
29395
 * Expose serialization method.
29396
 */
29397
29398
 request.serializeObject = serialize;
29399
29400
 /**
29401
  * Parse the given x-www-form-urlencoded `str`.
29402
  *
29403
  * @param {String} str
29404
  * @return {Object}
29405
  * @api private
29406
  */
29407
29408
function parseString(str) {
29409
  var obj = {};
29410
  var pairs = str.split('&');
29411
  var parts;
29412
  var pair;
29413
29414
  for (var i = 0, len = pairs.length; i < len; ++i) {
29415
    pair = pairs[i];
29416
    parts = pair.split('=');
29417
    obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
29418
  }
29419
29420
  return obj;
29421
}
29422
29423
/**
29424
 * Expose parser.
29425
 */
29426
29427
request.parseString = parseString;
29428
29429
/**
29430
 * Default MIME type map.
29431
 *
29432
 *     superagent.types.xml = 'application/xml';
29433
 *
29434
 */
29435
29436
request.types = {
29437
  html: 'text/html',
29438
  json: 'application/json',
29439
  xml: 'application/xml',
29440
  urlencoded: 'application/x-www-form-urlencoded',
29441
  'form': 'application/x-www-form-urlencoded',
29442
  'form-data': 'application/x-www-form-urlencoded'
29443
};
29444
29445
/**
29446
 * Default serialization map.
29447
 *
29448
 *     superagent.serialize['application/xml'] = function(obj){
29449
 *       return 'generated xml here';
29450
 *     };
29451
 *
29452
 */
29453
29454
 request.serialize = {
29455
   'application/x-www-form-urlencoded': serialize,
29456
   'application/json': JSON.stringify
29457
 };
29458
29459
 /**
29460
  * Default parsers.
29461
  *
29462
  *     superagent.parse['application/xml'] = function(str){
29463
  *       return { object parsed from str };
29464
  *     };
29465
  *
29466
  */
29467
29468
request.parse = {
29469
  'application/x-www-form-urlencoded': parseString,
29470
  'application/json': JSON.parse
29471
};
29472
29473
/**
29474
 * Parse the given header `str` into
29475
 * an object containing the mapped fields.
29476
 *
29477
 * @param {String} str
29478
 * @return {Object}
29479
 * @api private
29480
 */
29481
29482
function parseHeader(str) {
29483
  var lines = str.split(/\r?\n/);
29484
  var fields = {};
29485
  var index;
29486
  var line;
29487
  var field;
29488
  var val;
29489
29490
  lines.pop(); // trailing CRLF
29491
29492
  for (var i = 0, len = lines.length; i < len; ++i) {
29493
    line = lines[i];
29494
    index = line.indexOf(':');
29495
    field = line.slice(0, index).toLowerCase();
29496
    val = trim(line.slice(index + 1));
29497
    fields[field] = val;
29498
  }
29499
29500
  return fields;
29501
}
29502
29503
/**
29504
 * Return the mime type for the given `str`.
29505
 *
29506
 * @param {String} str
29507
 * @return {String}
29508
 * @api private
29509
 */
29510
29511
function type(str){
29512
  return str.split(/ *; */).shift();
29513
};
29514
29515
/**
29516
 * Return header field parameters.
29517
 *
29518
 * @param {String} str
29519
 * @return {Object}
29520
 * @api private
29521
 */
29522
29523
function params(str){
29524
  return reduce(str.split(/ *; */), function(obj, str){
29525
    var parts = str.split(/ *= */)
29526
      , key = parts.shift()
29527
      , val = parts.shift();
29528
29529
    if (key && val) obj[key] = val;
29530
    return obj;
29531
  }, {});
29532
};
29533
29534
/**
29535
 * Initialize a new `Response` with the given `xhr`.
29536
 *
29537
 *  - set flags (.ok, .error, etc)
29538
 *  - parse header
29539
 *
29540
 * Examples:
29541
 *
29542
 *  Aliasing `superagent` as `request` is nice:
29543
 *
29544
 *      request = superagent;
29545
 *
29546
 *  We can use the promise-like API, or pass callbacks:
29547
 *
29548
 *      request.get('/').end(function(res){});
29549
 *      request.get('/', function(res){});
29550
 *
29551
 *  Sending data can be chained:
29552
 *
29553
 *      request
29554
 *        .post('/user')
29555
 *        .send({ name: 'tj' })
29556
 *        .end(function(res){});
29557
 *
29558
 *  Or passed to `.send()`:
29559
 *
29560
 *      request
29561
 *        .post('/user')
29562
 *        .send({ name: 'tj' }, function(res){});
29563
 *
29564
 *  Or passed to `.post()`:
29565
 *
29566
 *      request
29567
 *        .post('/user', { name: 'tj' })
29568
 *        .end(function(res){});
29569
 *
29570
 * Or further reduced to a single call for simple cases:
29571
 *
29572
 *      request
29573
 *        .post('/user', { name: 'tj' }, function(res){});
29574
 *
29575
 * @param {XMLHTTPRequest} xhr
29576
 * @param {Object} options
29577
 * @api private
29578
 */
29579
29580
function Response(req, options) {
29581
  options = options || {};
29582
  this.req = req;
29583
  this.xhr = this.req.xhr;
29584
  // responseText is accessible only if responseType is '' or 'text' and on older browsers
29585
  this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')
29586
     ? this.xhr.responseText
29587
     : null;
29588
  this.statusText = this.req.xhr.statusText;
29589
  this.setStatusProperties(this.xhr.status);
29590
  this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
29591
  // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
29592
  // getResponseHeader still works. so we get content-type even if getting
29593
  // other headers fails.
29594
  this.header['content-type'] = this.xhr.getResponseHeader('content-type');
29595
  this.setHeaderProperties(this.header);
29596
  this.body = this.req.method != 'HEAD'
29597
    ? this.parseBody(this.text ? this.text : this.xhr.response)
29598
    : null;
29599
}
29600
29601
/**
29602
 * Get case-insensitive `field` value.
29603
 *
29604
 * @param {String} field
29605
 * @return {String}
29606
 * @api public
29607
 */
29608
29609
Response.prototype.get = function(field){
29610
  return this.header[field.toLowerCase()];
29611
};
29612
29613
/**
29614
 * Set header related properties:
29615
 *
29616
 *   - `.type` the content type without params
29617
 *
29618
 * A response of "Content-Type: text/plain; charset=utf-8"
29619
 * will provide you with a `.type` of "text/plain".
29620
 *
29621
 * @param {Object} header
29622
 * @api private
29623
 */
29624
29625
Response.prototype.setHeaderProperties = function(header){
29626
  // content-type
29627
  var ct = this.header['content-type'] || '';
29628
  this.type = type(ct);
29629
29630
  // params
29631
  var obj = params(ct);
29632
  for (var key in obj) this[key] = obj[key];
29633
};
29634
29635
/**
29636
 * Parse the given body `str`.
29637
 *
29638
 * Used for auto-parsing of bodies. Parsers
29639
 * are defined on the `superagent.parse` object.
29640
 *
29641
 * @param {String} str
29642
 * @return {Mixed}
29643
 * @api private
29644
 */
29645
29646
Response.prototype.parseBody = function(str){
29647
  var parse = request.parse[this.type];
29648
  return parse && str && (str.length || str instanceof Object)
29649
    ? parse(str)
29650
    : null;
29651
};
29652
29653
/**
29654
 * Set flags such as `.ok` based on `status`.
29655
 *
29656
 * For example a 2xx response will give you a `.ok` of __true__
29657
 * whereas 5xx will be __false__ and `.error` will be __true__. The
29658
 * `.clientError` and `.serverError` are also available to be more
29659
 * specific, and `.statusType` is the class of error ranging from 1..5
29660
 * sometimes useful for mapping respond colors etc.
29661
 *
29662
 * "sugar" properties are also defined for common cases. Currently providing:
29663
 *
29664
 *   - .noContent
29665
 *   - .badRequest
29666
 *   - .unauthorized
29667
 *   - .notAcceptable
29668
 *   - .notFound
29669
 *
29670
 * @param {Number} status
29671
 * @api private
29672
 */
29673
29674
Response.prototype.setStatusProperties = function(status){
29675
  // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
29676
  if (status === 1223) {
29677
    status = 204;
29678
  }
29679
29680
  var type = status / 100 | 0;
29681
29682
  // status / class
29683
  this.status = status;
29684
  this.statusType = type;
29685
29686
  // basics
29687
  this.info = 1 == type;
29688
  this.ok = 2 == type;
29689
  this.clientError = 4 == type;
29690
  this.serverError = 5 == type;
29691
  this.error = (4 == type || 5 == type)
29692
    ? this.toError()
29693
    : false;
29694
29695
  // sugar
29696
  this.accepted = 202 == status;
29697
  this.noContent = 204 == status;
29698
  this.badRequest = 400 == status;
29699
  this.unauthorized = 401 == status;
29700
  this.notAcceptable = 406 == status;
29701
  this.notFound = 404 == status;
29702
  this.forbidden = 403 == status;
29703
};
29704
29705
/**
29706
 * Return an `Error` representative of this response.
29707
 *
29708
 * @return {Error}
29709
 * @api public
29710
 */
29711
29712
Response.prototype.toError = function(){
29713
  var req = this.req;
29714
  var method = req.method;
29715
  var url = req.url;
29716
29717
  var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';
29718
  var err = new Error(msg);
29719
  err.status = this.status;
29720
  err.method = method;
29721
  err.url = url;
29722
29723
  return err;
29724
};
29725
29726
/**
29727
 * Expose `Response`.
29728
 */
29729
29730
request.Response = Response;
29731
29732
/**
29733
 * Initialize a new `Request` with the given `method` and `url`.
29734
 *
29735
 * @param {String} method
29736
 * @param {String} url
29737
 * @api public
29738
 */
29739
29740
function Request(method, url) {
29741
  var self = this;
29742
  Emitter.call(this);
29743
  this._query = this._query || [];
29744
  this.method = method;
29745
  this.url = url;
29746
  this.header = {};
29747
  this._header = {};
29748
  this.on('end', function(){
29749
    var err = null;
29750
    var res = null;
29751
29752
    try {
29753
      res = new Response(self);
29754
    } catch(e) {
29755
      err = new Error('Parser is unable to parse the response');
29756
      err.parse = true;
29757
      err.original = e;
29758
      return self.callback(err);
29759
    }
29760
29761
    self.emit('response', res);
29762
29763
    if (err) {
29764
      return self.callback(err, res);
29765
    }
29766
29767
    if (res.status >= 200 && res.status < 300) {
29768
      return self.callback(err, res);
29769
    }
29770
29771
    var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
29772
    new_err.original = err;
29773
    new_err.response = res;
29774
    new_err.status = res.status;
29775
29776
    self.callback(err || new_err, res);
29777
  });
29778
}
29779
29780
/**
29781
 * Mixin `Emitter`.
29782
 */
29783
29784
Emitter(Request.prototype);
29785
29786
/**
29787
 * Allow for extension
29788
 */
29789
29790
Request.prototype.use = function(fn) {
29791
  fn(this);
29792
  return this;
29793
}
29794
29795
/**
29796
 * Set timeout to `ms`.
29797
 *
29798
 * @param {Number} ms
29799
 * @return {Request} for chaining
29800
 * @api public
29801
 */
29802
29803
Request.prototype.timeout = function(ms){
29804
  this._timeout = ms;
29805
  return this;
29806
};
29807
29808
/**
29809
 * Clear previous timeout.
29810
 *
29811
 * @return {Request} for chaining
29812
 * @api public
29813
 */
29814
29815
Request.prototype.clearTimeout = function(){
29816
  this._timeout = 0;
29817
  clearTimeout(this._timer);
29818
  return this;
29819
};
29820
29821
/**
29822
 * Abort the request, and clear potential timeout.
29823
 *
29824
 * @return {Request}
29825
 * @api public
29826
 */
29827
29828
Request.prototype.abort = function(){
29829
  if (this.aborted) return;
29830
  this.aborted = true;
29831
  this.xhr.abort();
29832
  this.clearTimeout();
29833
  this.emit('abort');
29834
  return this;
29835
};
29836
29837
/**
29838
 * Set header `field` to `val`, or multiple fields with one object.
29839
 *
29840
 * Examples:
29841
 *
29842
 *      req.get('/')
29843
 *        .set('Accept', 'application/json')
29844
 *        .set('X-API-Key', 'foobar')
29845
 *        .end(callback);
29846
 *
29847
 *      req.get('/')
29848
 *        .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
29849
 *        .end(callback);
29850
 *
29851
 * @param {String|Object} field
29852
 * @param {String} val
29853
 * @return {Request} for chaining
29854
 * @api public
29855
 */
29856
29857
Request.prototype.set = function(field, val){
29858
  if (isObject(field)) {
29859
    for (var key in field) {
29860
      this.set(key, field[key]);
29861
    }
29862
    return this;
29863
  }
29864
  this._header[field.toLowerCase()] = val;
29865
  this.header[field] = val;
29866
  return this;
29867
};
29868
29869
/**
29870
 * Remove header `field`.
29871
 *
29872
 * Example:
29873
 *
29874
 *      req.get('/')
29875
 *        .unset('User-Agent')
29876
 *        .end(callback);
29877
 *
29878
 * @param {String} field
29879
 * @return {Request} for chaining
29880
 * @api public
29881
 */
29882
29883
Request.prototype.unset = function(field){
29884
  delete this._header[field.toLowerCase()];
29885
  delete this.header[field];
29886
  return this;
29887
};
29888
29889
/**
29890
 * Get case-insensitive header `field` value.
29891
 *
29892
 * @param {String} field
29893
 * @return {String}
29894
 * @api private
29895
 */
29896
29897
Request.prototype.getHeader = function(field){
29898
  return this._header[field.toLowerCase()];
29899
};
29900
29901
/**
29902
 * Set Content-Type to `type`, mapping values from `request.types`.
29903
 *
29904
 * Examples:
29905
 *
29906
 *      superagent.types.xml = 'application/xml';
29907
 *
29908
 *      request.post('/')
29909
 *        .type('xml')
29910
 *        .send(xmlstring)
29911
 *        .end(callback);
29912
 *
29913
 *      request.post('/')
29914
 *        .type('application/xml')
29915
 *        .send(xmlstring)
29916
 *        .end(callback);
29917
 *
29918
 * @param {String} type
29919
 * @return {Request} for chaining
29920
 * @api public
29921
 */
29922
29923
Request.prototype.type = function(type){
29924
  this.set('Content-Type', request.types[type] || type);
29925
  return this;
29926
};
29927
29928
/**
29929
 * Set Accept to `type`, mapping values from `request.types`.
29930
 *
29931
 * Examples:
29932
 *
29933
 *      superagent.types.json = 'application/json';
29934
 *
29935
 *      request.get('/agent')
29936
 *        .accept('json')
29937
 *        .end(callback);
29938
 *
29939
 *      request.get('/agent')
29940
 *        .accept('application/json')
29941
 *        .end(callback);
29942
 *
29943
 * @param {String} accept
29944
 * @return {Request} for chaining
29945
 * @api public
29946
 */
29947
29948
Request.prototype.accept = function(type){
29949
  this.set('Accept', request.types[type] || type);
29950
  return this;
29951
};
29952
29953
/**
29954
 * Set Authorization field value with `user` and `pass`.
29955
 *
29956
 * @param {String} user
29957
 * @param {String} pass
29958
 * @return {Request} for chaining
29959
 * @api public
29960
 */
29961
29962
Request.prototype.auth = function(user, pass){
29963
  var str = btoa(user + ':' + pass);
29964
  this.set('Authorization', 'Basic ' + str);
29965
  return this;
29966
};
29967
29968
/**
29969
* Add query-string `val`.
29970
*
29971
* Examples:
29972
*
29973
*   request.get('/shoes')
29974
*     .query('size=10')
29975
*     .query({ color: 'blue' })
29976
*
29977
* @param {Object|String} val
29978
* @return {Request} for chaining
29979
* @api public
29980
*/
29981
29982
Request.prototype.query = function(val){
29983
  if ('string' != typeof val) val = serialize(val);
29984
  if (val) this._query.push(val);
29985
  return this;
29986
};
29987
29988
/**
29989
 * Write the field `name` and `val` for "multipart/form-data"
29990
 * request bodies.
29991
 *
29992
 * ``` js
29993
 * request.post('/upload')
29994
 *   .field('foo', 'bar')
29995
 *   .end(callback);
29996
 * ```
29997
 *
29998
 * @param {String} name
29999
 * @param {String|Blob|File} val
30000
 * @return {Request} for chaining
30001
 * @api public
30002
 */
30003
30004
Request.prototype.field = function(name, val){
30005
  if (!this._formData) this._formData = new root.FormData();
30006
  this._formData.append(name, val);
30007
  return this;
30008
};
30009
30010
/**
30011
 * Queue the given `file` as an attachment to the specified `field`,
30012
 * with optional `filename`.
30013
 *
30014
 * ``` js
30015
 * request.post('/upload')
30016
 *   .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
30017
 *   .end(callback);
30018
 * ```
30019
 *
30020
 * @param {String} field
30021
 * @param {Blob|File} file
30022
 * @param {String} filename
30023
 * @return {Request} for chaining
30024
 * @api public
30025
 */
30026
30027
Request.prototype.attach = function(field, file, filename){
30028
  if (!this._formData) this._formData = new root.FormData();
30029
  this._formData.append(field, file, filename);
30030
  return this;
30031
};
30032
30033
/**
30034
 * Send `data`, defaulting the `.type()` to "json" when
30035
 * an object is given.
30036
 *
30037
 * Examples:
30038
 *
30039
 *       // querystring
30040
 *       request.get('/search')
30041
 *         .end(callback)
30042
 *
30043
 *       // multiple data "writes"
30044
 *       request.get('/search')
30045
 *         .send({ search: 'query' })
30046
 *         .send({ range: '1..5' })
30047
 *         .send({ order: 'desc' })
30048
 *         .end(callback)
30049
 *
30050
 *       // manual json
30051
 *       request.post('/user')
30052
 *         .type('json')
30053
 *         .send('{"name":"tj"})
30054
 *         .end(callback)
30055
 *
30056
 *       // auto json
30057
 *       request.post('/user')
30058
 *         .send({ name: 'tj' })
30059
 *         .end(callback)
30060
 *
30061
 *       // manual x-www-form-urlencoded
30062
 *       request.post('/user')
30063
 *         .type('form')
30064
 *         .send('name=tj')
30065
 *         .end(callback)
30066
 *
30067
 *       // auto x-www-form-urlencoded
30068
 *       request.post('/user')
30069
 *         .type('form')
30070
 *         .send({ name: 'tj' })
30071
 *         .end(callback)
30072
 *
30073
 *       // defaults to x-www-form-urlencoded
30074
  *      request.post('/user')
30075
  *        .send('name=tobi')
30076
  *        .send('species=ferret')
30077
  *        .end(callback)
30078
 *
30079
 * @param {String|Object} data
30080
 * @return {Request} for chaining
30081
 * @api public
30082
 */
30083
30084
Request.prototype.send = function(data){
30085
  var obj = isObject(data);
30086
  var type = this.getHeader('Content-Type');
30087
30088
  // merge
30089
  if (obj && isObject(this._data)) {
30090
    for (var key in data) {
30091
      this._data[key] = data[key];
30092
    }
30093
  } else if ('string' == typeof data) {
30094
    if (!type) this.type('form');
30095
    type = this.getHeader('Content-Type');
30096
    if ('application/x-www-form-urlencoded' == type) {
30097
      this._data = this._data
30098
        ? this._data + '&' + data
30099
        : data;
30100
    } else {
30101
      this._data = (this._data || '') + data;
30102
    }
30103
  } else {
30104
    this._data = data;
30105
  }
30106
30107
  if (!obj || isHost(data)) return this;
30108
  if (!type) this.type('json');
30109
  return this;
30110
};
30111
30112
/**
30113
 * Invoke the callback with `err` and `res`
30114
 * and handle arity check.
30115
 *
30116
 * @param {Error} err
30117
 * @param {Response} res
30118
 * @api private
30119
 */
30120
30121
Request.prototype.callback = function(err, res){
30122
  var fn = this._callback;
30123
  this.clearTimeout();
30124
  fn(err, res);
30125
};
30126
30127
/**
30128
 * Invoke callback with x-domain error.
30129
 *
30130
 * @api private
30131
 */
30132
30133
Request.prototype.crossDomainError = function(){
30134
  var err = new Error('Origin is not allowed by Access-Control-Allow-Origin');
30135
  err.crossDomain = true;
30136
  this.callback(err);
30137
};
30138
30139
/**
30140
 * Invoke callback with timeout error.
30141
 *
30142
 * @api private
30143
 */
30144
30145
Request.prototype.timeoutError = function(){
30146
  var timeout = this._timeout;
30147
  var err = new Error('timeout of ' + timeout + 'ms exceeded');
30148
  err.timeout = timeout;
30149
  this.callback(err);
30150
};
30151
30152
/**
30153
 * Enable transmission of cookies with x-domain requests.
30154
 *
30155
 * Note that for this to work the origin must not be
30156
 * using "Access-Control-Allow-Origin" with a wildcard,
30157
 * and also must set "Access-Control-Allow-Credentials"
30158
 * to "true".
30159
 *
30160
 * @api public
30161
 */
30162
30163
Request.prototype.withCredentials = function(){
30164
  this._withCredentials = true;
30165
  return this;
30166
};
30167
30168
/**
30169
 * Initiate request, invoking callback `fn(res)`
30170
 * with an instanceof `Response`.
30171
 *
30172
 * @param {Function} fn
30173
 * @return {Request} for chaining
30174
 * @api public
30175
 */
30176
30177
Request.prototype.end = function(fn){
30178
  var self = this;
30179
  var xhr = this.xhr = request.getXHR();
30180
  var query = this._query.join('&');
30181
  var timeout = this._timeout;
30182
  var data = this._formData || this._data;
30183
30184
  // store callback
30185
  this._callback = fn || noop;
30186
30187
  // state change
30188
  xhr.onreadystatechange = function(){
30189
    if (4 != xhr.readyState) return;
30190
30191
    // In IE9, reads to any property (e.g. status) off of an aborted XHR will
30192
    // result in the error "Could not complete the operation due to error c00c023f"
30193
    var status;
30194
    try { status = xhr.status } catch(e) { status = 0; }
30195
30196
    if (0 == status) {
30197
      if (self.timedout) return self.timeoutError();
30198
      if (self.aborted) return;
30199
      return self.crossDomainError();
30200
    }
30201
    self.emit('end');
30202
  };
30203
30204
  // progress
30205
  var handleProgress = function(e){
30206
    if (e.total > 0) {
30207
      e.percent = e.loaded / e.total * 100;
30208
    }
30209
    self.emit('progress', e);
30210
  };
30211
  if (this.hasListeners('progress')) {
30212
    xhr.onprogress = handleProgress;
30213
  }
30214
  try {
30215
    if (xhr.upload && this.hasListeners('progress')) {
30216
      xhr.upload.onprogress = handleProgress;
30217
    }
30218
  } catch(e) {
30219
    // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
30220
    // Reported here:
30221
    // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
30222
  }
30223
30224
  // timeout
30225
  if (timeout && !this._timer) {
30226
    this._timer = setTimeout(function(){
30227
      self.timedout = true;
30228
      self.abort();
30229
    }, timeout);
30230
  }
30231
30232
  // querystring
30233
  if (query) {
30234
    query = request.serializeObject(query);
30235
    this.url += ~this.url.indexOf('?')
30236
      ? '&' + query
30237
      : '?' + query;
30238
  }
30239
30240
  // initiate request
30241
  xhr.open(this.method, this.url, true);
30242
30243
  // CORS
30244
  if (this._withCredentials) xhr.withCredentials = true;
30245
30246
  // body
30247
  if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
30248
    // serialize stuff
30249
    var serialize = request.serialize[this.getHeader('Content-Type')];
30250
    if (serialize) data = serialize(data);
30251
  }
30252
30253
  // set header fields
30254
  for (var field in this.header) {
30255
    if (null == this.header[field]) continue;
30256
    xhr.setRequestHeader(field, this.header[field]);
30257
  }
30258
30259
  // send stuff
30260
  this.emit('request', this);
30261
  xhr.send(data);
30262
  return this;
30263
};
30264
30265
/**
30266
 * Expose `Request`.
30267
 */
30268
30269
request.Request = Request;
30270
30271
/**
30272
 * Issue a request:
30273
 *
30274
 * Examples:
30275
 *
30276
 *    request('GET', '/users').end(callback)
30277
 *    request('/users').end(callback)
30278
 *    request('/users', callback)
30279
 *
30280
 * @param {String} method
30281
 * @param {String|Function} url or callback
30282
 * @return {Request}
30283
 * @api public
30284
 */
30285
30286
function request(method, url) {
30287
  // callback
30288
  if ('function' == typeof url) {
30289
    return new Request('GET', method).end(url);
30290
  }
30291
30292
  // url first
30293
  if (1 == arguments.length) {
30294
    return new Request('GET', method);
30295
  }
30296
30297
  return new Request(method, url);
30298
}
30299
30300
/**
30301
 * GET `url` with optional callback `fn(res)`.
30302
 *
30303
 * @param {String} url
30304
 * @param {Mixed|Function} data or fn
30305
 * @param {Function} fn
30306
 * @return {Request}
30307
 * @api public
30308
 */
30309
30310
request.get = function(url, data, fn){
30311
  var req = request('GET', url);
30312
  if ('function' == typeof data) fn = data, data = null;
30313
  if (data) req.query(data);
30314
  if (fn) req.end(fn);
30315
  return req;
30316
};
30317
30318
/**
30319
 * HEAD `url` with optional callback `fn(res)`.
30320
 *
30321
 * @param {String} url
30322
 * @param {Mixed|Function} data or fn
30323
 * @param {Function} fn
30324
 * @return {Request}
30325
 * @api public
30326
 */
30327
30328
request.head = function(url, data, fn){
30329
  var req = request('HEAD', url);
30330
  if ('function' == typeof data) fn = data, data = null;
30331
  if (data) req.send(data);
30332
  if (fn) req.end(fn);
30333
  return req;
30334
};
30335
30336
/**
30337
 * DELETE `url` with optional callback `fn(res)`.
30338
 *
30339
 * @param {String} url
30340
 * @param {Function} fn
30341
 * @return {Request}
30342
 * @api public
30343
 */
30344
30345
request.del = function(url, fn){
30346
  var req = request('DELETE', url);
30347
  if (fn) req.end(fn);
30348
  return req;
30349
};
30350
30351
/**
30352
 * PATCH `url` with optional `data` and callback `fn(res)`.
30353
 *
30354
 * @param {String} url
30355
 * @param {Mixed} data
30356
 * @param {Function} fn
30357
 * @return {Request}
30358
 * @api public
30359
 */
30360
30361
request.patch = function(url, data, fn){
30362
  var req = request('PATCH', url);
30363
  if ('function' == typeof data) fn = data, data = null;
30364
  if (data) req.send(data);
30365
  if (fn) req.end(fn);
30366
  return req;
30367
};
30368
30369
/**
30370
 * POST `url` with optional `data` and callback `fn(res)`.
30371
 *
30372
 * @param {String} url
30373
 * @param {Mixed} data
30374
 * @param {Function} fn
30375
 * @return {Request}
30376
 * @api public
30377
 */
30378
30379
request.post = function(url, data, fn){
30380
  var req = request('POST', url);
30381
  if ('function' == typeof data) fn = data, data = null;
30382
  if (data) req.send(data);
30383
  if (fn) req.end(fn);
30384
  return req;
30385
};
30386
30387
/**
30388
 * PUT `url` with optional `data` and callback `fn(res)`.
30389
 *
30390
 * @param {String} url
30391
 * @param {Mixed|Function} data or fn
30392
 * @param {Function} fn
30393
 * @return {Request}
30394
 * @api public
30395
 */
30396
30397
request.put = function(url, data, fn){
30398
  var req = request('PUT', url);
30399
  if ('function' == typeof data) fn = data, data = null;
30400
  if (data) req.send(data);
30401
  if (fn) req.end(fn);
30402
  return req;
30403
};
30404
30405
/**
30406
 * Expose `request`.
30407
 */
30408
30409
module.exports = request;
30410
30411
},{"emitter":161,"reduce":162}],161:[function(require,module,exports){
30412
30413
/**
30414
 * Expose `Emitter`.
30415
 */
30416
30417
module.exports = Emitter;
30418
30419
/**
30420
 * Initialize a new `Emitter`.
30421
 *
30422
 * @api public
30423
 */
30424
30425
function Emitter(obj) {
30426
  if (obj) return mixin(obj);
30427
};
30428
30429
/**
30430
 * Mixin the emitter properties.
30431
 *
30432
 * @param {Object} obj
30433
 * @return {Object}
30434
 * @api private
30435
 */
30436
30437
function mixin(obj) {
30438
  for (var key in Emitter.prototype) {
30439
    obj[key] = Emitter.prototype[key];
30440
  }
30441
  return obj;
30442
}
30443
30444
/**
30445
 * Listen on the given `event` with `fn`.
30446
 *
30447
 * @param {String} event
30448
 * @param {Function} fn
30449
 * @return {Emitter}
30450
 * @api public
30451
 */
30452
30453
Emitter.prototype.on =
30454
Emitter.prototype.addEventListener = function(event, fn){
30455
  this._callbacks = this._callbacks || {};
30456
  (this._callbacks[event] = this._callbacks[event] || [])
30457
    .push(fn);
30458
  return this;
30459
};
30460
30461
/**
30462
 * Adds an `event` listener that will be invoked a single
30463
 * time then automatically removed.
30464
 *
30465
 * @param {String} event
30466
 * @param {Function} fn
30467
 * @return {Emitter}
30468
 * @api public
30469
 */
30470
30471
Emitter.prototype.once = function(event, fn){
30472
  var self = this;
30473
  this._callbacks = this._callbacks || {};
30474
30475
  function on() {
30476
    self.off(event, on);
30477
    fn.apply(this, arguments);
30478
  }
30479
30480
  on.fn = fn;
30481
  this.on(event, on);
30482
  return this;
30483
};
30484
30485
/**
30486
 * Remove the given callback for `event` or all
30487
 * registered callbacks.
30488
 *
30489
 * @param {String} event
30490
 * @param {Function} fn
30491
 * @return {Emitter}
30492
 * @api public
30493
 */
30494
30495
Emitter.prototype.off =
30496
Emitter.prototype.removeListener =
30497
Emitter.prototype.removeAllListeners =
30498
Emitter.prototype.removeEventListener = function(event, fn){
30499
  this._callbacks = this._callbacks || {};
30500
30501
  // all
30502
  if (0 == arguments.length) {
30503
    this._callbacks = {};
30504
    return this;
30505
  }
30506
30507
  // specific event
30508
  var callbacks = this._callbacks[event];
30509
  if (!callbacks) return this;
30510
30511
  // remove all handlers
30512
  if (1 == arguments.length) {
30513
    delete this._callbacks[event];
30514
    return this;
30515
  }
30516
30517
  // remove specific handler
30518
  var cb;
30519
  for (var i = 0; i < callbacks.length; i++) {
30520
    cb = callbacks[i];
30521
    if (cb === fn || cb.fn === fn) {
30522
      callbacks.splice(i, 1);
30523
      break;
30524
    }
30525
  }
30526
  return this;
30527
};
30528
30529
/**
30530
 * Emit `event` with the given args.
30531
 *
30532
 * @param {String} event
30533
 * @param {Mixed} ...
30534
 * @return {Emitter}
30535
 */
30536
30537
Emitter.prototype.emit = function(event){
30538
  this._callbacks = this._callbacks || {};
30539
  var args = [].slice.call(arguments, 1)
30540
    , callbacks = this._callbacks[event];
30541
30542
  if (callbacks) {
30543
    callbacks = callbacks.slice(0);
30544
    for (var i = 0, len = callbacks.length; i < len; ++i) {
30545
      callbacks[i].apply(this, args);
30546
    }
30547
  }
30548
30549
  return this;
30550
};
30551
30552
/**
30553
 * Return array of callbacks for `event`.
30554
 *
30555
 * @param {String} event
30556
 * @return {Array}
30557
 * @api public
30558
 */
30559
30560
Emitter.prototype.listeners = function(event){
30561
  this._callbacks = this._callbacks || {};
30562
  return this._callbacks[event] || [];
30563
};
30564
30565
/**
30566
 * Check if this emitter has `event` handlers.
30567
 *
30568
 * @param {String} event
30569
 * @return {Boolean}
30570
 * @api public
30571
 */
30572
30573
Emitter.prototype.hasListeners = function(event){
30574
  return !! this.listeners(event).length;
30575
};
30576
30577
},{}],162:[function(require,module,exports){
30578
30579
/**
30580
 * Reduce `arr` with `fn`.
30581
 *
30582
 * @param {Array} arr
30583
 * @param {Function} fn
30584
 * @param {Mixed} initial
30585
 *
30586
 * TODO: combatible error handling?
30587
 */
30588
30589
module.exports = function(arr, fn, initial){  
30590
  var idx = 0;
30591
  var len = arr.length;
30592
  var curr = arguments.length == 3
30593
    ? initial
30594
    : arr[idx++];
30595
30596
  while (idx < len) {
30597
    curr = fn.call(null, curr, arr[idx], ++idx, arr);
30598
  }
30599
  
30600
  return curr;
30601
};
30602
},{}]},{},[1])(1)
30603
});
30604
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hdXRoLmpzIiwibGliL2NsaWVudC5qcyIsImxpYi9oZWxwZXJzLmpzIiwibGliL2h0dHAuanMiLCJsaWIvcmVzb2x2ZXIuanMiLCJsaWIvc2NoZW1hLW1hcmt1cC5qcyIsImxpYi9zcGVjLWNvbnZlcnRlci5qcyIsImxpYi90eXBlcy9tb2RlbC5qcyIsImxpYi90eXBlcy9vcGVyYXRpb24uanMiLCJsaWIvdHlwZXMvb3BlcmF0aW9uR3JvdXAuanMiLCJub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1yZXNvbHZlL2VtcHR5LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2J1ZmZlci9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9idWZmZXIvbm9kZV9tb2R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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvbk9iamVjdCk7XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdLmhlbHAgPSBvcGVyYXRpb25Hcm91cFtvcGVyYXRpb25JZF0uaGVscCA9IF8uYmluZChvcGVyYXRpb25PYmplY3QuaGVscCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvbk9iamVjdCk7XG4gICAgICAgIHNlbGYuYXBpc1thcGlQcm9wZXJ0eV1bb3BlcmF0aW9uSWRdLmFzQ3VybCA9IG9wZXJhdGlvbkdyb3VwW29wZXJhdGlvbklkXS5hc0N1cmwgPSBfLmJpbmQob3BlcmF0aW9uT2JqZWN0LmFzQ3VybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRpb25PYmplY3QpO1xuXG4gICAgICAgIG9wZXJhdGlvbkdyb3VwLmFwaXNbb3BlcmF0aW9uSWRdID0gb3BlcmF0aW9uR3JvdXAub3BlcmF0aW9uc1tvcGVyYXRpb25JZF0gPSBvcGVyYXRpb25PYmplY3Q7XG5cbiAgICAgICAgLy8gbGVnYWN5IFVJIGZlYXR1cmVcbiAgICAgICAgdmFyIGFwaSA9IF8uZmluZChzZWxmLmFwaXNBcnJheSwgZnVuY3Rpb24gKGFwaSkge1xuICAgICAgICAgIHJldHVybiBhcGkudGFnID09PSB0YWc7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChhcGkpIHtcbiAgICAgICAgICBhcGkub3BlcmF0aW9uc0FycmF5LnB1c2gob3BlcmF0aW9uT2JqZWN0KTtcbiAgICAgICAgfVxuICAgICAgfS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HRvUmVzb2x2ZSA9IFtdO1xuICAvLyBpZiB0aGUgcm9vdCBpcyBzYW1lIGFzIG9ialtpXS5yb290IHdlIGNhbiByZXNvbHZlIGxvY2FsbHlcbiAgdmFyIGFsbCA9IHJlc29sdXRpb25UYWJsZTtcblxuICBmb3IoaSA9IDA7IGkgPCBhbGwubGVuZ3RoOyBpKyspIHtcbiAgICB2YXIgYSA9IGFsbFtpXTtcbiAgICBpZihyb290ID09PSBhLnJvb3QpIHtcbiAgICAgIGlmKGEucmVzb2x2ZUFzID09PSAncmVmJykge1xuICAgICAgICAvLyByZXNvbHZlIGFueSBwYXRoIHdhbGtpbmdcbiAgICAgICAgdmFyIGpvaW5lZCA9ICgoYS5yb290IHx8ICcnKSArICcvJyArIGEua2V5KS5zcGxpdCgnLycpO1xuICAgICAgICB2YXIgbm9ybWFsaXplZCA9IFtdO1xuICAgICAgICB2YXIgdXJsID0gJyc7XG4gICAgICAgIHZhciBrO1xuXG4gICAgICAgIGlmKGEua2V5LmluZGV4T2YoJy4uLycpID49IDApIHtcbiAgICAgICAgICBmb3IodmFyIGogPSAwOyBqIDwgam9pbmVkLmxlbmd0aDsgaisrKSB7XG4gICAgICAgICAgICBpZihqb2luZWRbal0gPT09ICcuLicpIHtcbiAgICAgICAgICAgICAgbm9ybWFsaXplZCA9IG5vcm1hbGl6ZWQuc2xpY2UoMCwgbm9ybWFsaXplZC5sZW5ndGgtMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgbm9ybWFsaXplZC5wdXNoKGpvaW5lZFtqXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGZvcihrID0gMDsgayA8IG5vcm1hbGl6ZWQubGVuZ3RoOyBrICsrKSB7XG4gICAgICAgICAgICBpZihrID4gMCkge1xuICAgICAgICAgICAgICB1cmwgKz0gJy8nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdXJsICs9IG5vcm1hbGl6ZWRba107XG4gICAgICAgICAgfVxuICAgICAgICAgIC8vIHdlIG5vdyBoYXZlIHRvIHJlbW90ZSByZXNvbHZlIHRoaXMgYmVjYXVzZSB0aGUgcGF0aCBoYXMgY2hhbmdlZFxuICAgICAgICAgIGEucm9vdCA9IHVybDtcbiAgICAgICAgICB0b1Jlc29sdmUucHVzaChhKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICB2YXIgcGFydHMgPSBhLmtleS5zcGxpdCgnIycpO1xuICAgICAgICAgIGlmKHBhcnRzLmxlbmd0aCA9PT0gMikge1xuICAgICAgICAgICAgaWYocGFydHNbMF0uaW5kZXhPZignaHR0cDovLycpID09PSAwIHx8IHBhcnRzWzBdLmluZGV4T2YoJ2h0dHBzOi8vJykgPT09IDApIHtcbiAgICAgICAgICAgICAgYS5yb290ID0gcGFydHNbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2NhdGlvbiA9IHBhcnRzWzFdLnNwbGl0KCcvJyk7XG4gICAgICAgICAgICB2YXIgcjtcbiAgICAgICAgICAgIHZhciBzID0gc3BlYztcbiAgICAgICAgICAgIGZvcihrID0gMDsgayA8IGxvY2F0aW9uLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIHZhciBwYXJ0ID0gbG9jYXRpb25ba107XG4gICAgICAgICAgICAgIGlmKHBhcnQgIT09ICcnKSB7XG4gICAgICAgICAgICAgICAgcyA9IHNbcGFydF07XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICByID0gcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICByID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYociA9PT0g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RyZWYsIGksIHAsIHAyLCBycztcbiAgdmFyIHJvb3RUcmltbWVkID0gZmFsc2U7XG4gIGlmIChyZWYpIHtcbiAgICBpZihyZWYuaW5kZXhPZignLi4vJykgPT09IDApIHtcbiAgICAgIC8vIHJlc2V0IHJvb3RcbiAgICAgIHAgPSByZWYuc3BsaXQoJy4uLycpO1xuICAgICAgcDIgPSByb290LnNwbGl0KCcvJyk7XG4gICAgICByZWYgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHAubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYocFtpXSA9PT0gJycpIHtcbiAgICAgICAgICBwMiA9IHAyLnNsaWNlKDAsIHAyLmxlbmd0aC0xKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICByZWYgKz0gcFtpXTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcm9vdCA9ICcnO1xuICAgICAgZm9yKGkgPSAwOyBpIDwgcDIubGVuZ3RoIC0gMTsgaSsrKSB7XG4gICAgICAgIGlmKGkgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgIHJvb3QgKz0gcDJbaV07XG4gICAgICB9XG4gICAgICByb290VHJpbW1lZCA9IHRydWU7XG4gICAgfVxuICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgaWYocmVmLmluZGV4T2YoJy8nKSA9PT0gMCkge1xuICAgICAgICBycyA9IHJlZi5zcGxpdCgnIycpO1xuICAgICAgICBwICA9IHJvb3Quc3BsaXQoJy8vJyk7XG4gICAgICAgIHAyID0gcFsxXS5zcGxpdCgnLycpO1xuICAgICAgICByb290ID0gcFswXSArICcvLycgKyBwMlswXSArIHJzWzBdO1xuICAgICAgICBsb2NhdGlvbiA9IHJzWzFdO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIHJzID0gcmVmLnNwbGl0KCcjJyk7XG4gICAgICAgIGlmKHJzWzBdICE9PSAnJykge1xuICAgICAgICAgIHAyID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgICAgIHAyID0gcDIuc2xpY2UoMCwgcDIubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgaWYoIXJvb3RUcmltbWVkKSB7XG4gICAgICAgICAgICByb290ID0gJyc7XG4gICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IHAyLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIGlmKGsgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgICAgICAgIHJvb3QgKz0gcDJba107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIHJvb3QgKz0gJy8nICsgcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIH1cbiAgICAgICAgbG9jYXRpb24gPSByc1sxXTtcbiAgICAgIH1cbiAgICB9XG4gICAgaWYgKHJlZi5pbmRleE9mKCdodHRwJykgPT09IDApIHtcbiAgICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgICByb290ID0gcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIGxvY2F0aW9uID0gcmVmLnNwbGl0KCcjJylbMV07XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgcm9vdCA9IHJlZjtcbiAgICAgICAgbG9jYXRpb24gPSAnJztcbiAgICAgIH1cbiAgICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtvYmo6IHByb3BlcnR5LCByZXNvbHZlQXM6ICdpbmxpbmUnLCByb290OiByb290LCBrZXk6IGtleSwgbG9jYXRpb246IGxvY2F0aW9ufSk7XG4gICAgfSBlbHNlIGlmIChyZWYuaW5kZXhPZignIycpID09PSAwKSB7XG4gICAgICBsb2NhdGlvbiA9IHJlZi5zcGxpdCgnIycpWzFdO1xuICAgICAgcmVzb2x1dGlvblRhYmxlLnB1c2goe29iajogcHJvcGVydHksIHJlc29sdmVBczogJ2lubGluZScsIHJvb3Q6IHJvb3QsIG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XG4gICAgICAgICAgdmFyIHNvdXJjZSA9ICdzZWxmJztcbiAgICAgICAgICBpZih0eXBlb2YgY29tcG9uZW50Wyd4LXJlc29sdmVkLWZyb20nXSAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIHNvdXJjZSA9IGNvbXBvbmVudFsneC1yZXNvbHZlZC1mcm9tJ11bMF07XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgZm9yKHZhciBwYXJ0IGluIGNvbXBvbmVudCkge1xuICAgICAgICAgICAgaWYoIW91dHB1dC5oYXNPd25Qcm9wZXJ0eShwYXJ0KSkge1xuICAgICAgICAgICAgICBvdXRwdXRbcGFydF0gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KGNvbXBvbmVudFtwYXJ0XSkpO1xuICAgICAgICAgICAgICBpZihwYXJ0ID09PSAncHJvcGVydGllcycpIHtcbiAgICAgICAgICAgICAgICBmb3IobmFtZSBpbiBvdXRwdXRbcGFydF0pIHtcbiAgICAgICAgICAgICAgICAgIG91dHB1dFtwYXJ0XVtuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgaWYocGFydCA9PT0gJ3Byb3BlcnRpZXMnKSB7XG4gICAgICAgICAgICAgICAgdmFyIHByb3BlcnRpZXMgPSBjb21wb25lbnRbcGFydF07XG4gICAgICAgICAgICAgICAgZm9yKG5hbWUgaW4gcHJvcGVydGllcykge1xuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByb3BlcnRpZXNbbmFtZV0gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KHByb3BlcnRpZXNbbmFtZV0pKTtcbiAgICAgICAgICAgICAgICAgIHZhciByZXNvbHZlZEZyb20gPSBwcm9wZXJ0aWVzW25hbWVdWyd4LXJlc29sdmVkLWZyb20nXTtcbiAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVzb2x2ZWRGcm9tID09PSAndW5kZWZpbmVkJyB8fCByZXNvbHZlZEZyb20gPT09ICdzZWxmJykge1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlZEZyb20gPSBzb3VyY2U7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBvdXRwdXQucHJvcGVydGllc1tuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ10gPSByZXNvbHZlZEZyb207XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2UgaWYocGFydCA9PT0gJ3JlcXVpcmVkJykge1xuICAgICAgICAgICAgICAgIC8vIG1lcmdlICYgZGVkdXAgdGhlIHJlcXVpcmVkIGFycmF5XG4gICAgICAgICAgICAgICAgdmFyIGEgPSBvdXRwdXQucmVxdWlyZWQuY29uY2F0KGNvbXBvbmVudFtwYXJ0XSk7XG4gICAgICAgICAgICAgICAgZm9yKHZhciBrID0gMDsgayA8IGEubGVuZ3RoOyArK2spIHtcbiAgICAgICAgICAgICAgICAgIGZvcih2YXIgaiA9IGsgKyAxOyBqIDwgYS5sZW5ndGg7ICsraikge1xuICAgICAgICAgICAgICAgICAgICBpZihhW2tdID09PSBhW2pdKSB7IGEuc3BsaWNlKGotLSwgMSk7IH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb3V0cHV0LnJlcXVpcmVkID0gYTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBlbHNlIGlmKHBhcnQgPT09ICd4LXJlc29sdmVkLWZyb20nKSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0Wyd4LXJlc29sdmVkLWZyb20nXS5wdXNoKHNvdXJjZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gVE9ETzogb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4gICAgICAgIH1cbiAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnR5cGUgPSAnb2F1dGgyJztcbiAgICAgICAgaWYoaSA+IDApIHtcbiAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uc2NvcGVzID0gc2NvcGVzO1xuICAgICAgICB9XG4gICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlcykge1xuICAgICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlcy5pbXBsaWNpdCkge1xuICAgICAgICAgICAgdmFyIGltcGxpY2l0ID0gZGVmaW5pdGlvbi5ncmFudFR5cGVzLmltcGxpY2l0O1xuICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmZsb3cgPSAnaW1wbGljaXQnO1xuICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmF1dGhvcml6YXRpb25VcmwgPSBpbXBsaWNpdC5sb2dpbkVuZHBvaW50O1xuICAgICAgICAgICAgaXNWYWxpZCA9IHRydWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIC8qIGpzaGludCBpZ25vcmU6c3RhcnQgKi9cbiAgICAgICAgICBpZihkZWZpbml0aW9uLmdyYW50VHlwZXNbJ2F1dGhvcml6YXRpb25fY29kZSddKSB7XG4gICAgICAgICAgICBpZighc2VjdXJpdHlEZWZpbml0aW9uLmZsb3cpIHtcbiAgICAgICAgICAgICAgLy8gY2Fubm90IHNldCBpZiBmbG93IGlzIGFscmVhZHkgZGVmaW5lZFxuICAgICAgICAgICAgICB2YXIgYXV0aENvZGUgPSBkZWZpbml0aW9uLmdyYW50VHlwZXNbJ2F1dGhvcml6YXRpb25fY29kZSddO1xuICAgICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uZmxvdyA9ICdhY2Nlc3NDb2RlJztcbiAgICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLmF1dGhvcml6YXRpb25VcmwgPSBhdXRoQ29kZS50b2tlblJlcXVlc3RFbmRwb2ludC51cmw7XG4gICAgICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi50b2tlblVybCA9IGF1dGhDb2RlLnRva2VuRW5kcG9pbnQudXJsO1xuICAgICAgICAgICAgICBpc1ZhbGlkID0gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgLyoganNoaW50IGlnbm9yZTplbmQgKi9cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgaWYoaXNWYWxpZCkge1xuICAgICAgICBzd2FnZ2VyLnNlY3VyaXR5RGVmaW5pdGlvbnMgPSBzd2FnZ2VyLnNlY3VyaXR5RGVmaW5pdGlvbnMgfHwge307XG4gICAgICAgIHN3YWdnZXIuc2VjdXJpdHlEZWZpbml0aW9uc1tuYW1lXSA9IHNlY3VyaXR5RGVmaW5pdGlvbjtcbiAgICAgIH1cbiAgICB9XG4gIH1cbn07XG5cblN3YWdnZXJTcGVjQ29udmVydGVyLnByb3RvdHlwZS5hcGlJbmZvID0gZnVuY3Rpb24ob2JqLCBzd2FnZ2VyKSB7XG4gIC8vIGluZm8gc2VjdGlvblxuICBpZihvYmouaW5mbykge1xuICAgIHZhciBpbmZvID0gb2JqLmluZm87XG4gICAgc3dhZ2dlci5pbmZvID0ge307XG5cbiAgICBpZihpbmZvLmNvbnRhY3QpIHtcbiAgICAgIHN3YWdnZXIuaW5mby5jb250YWN0ID0ge307XG4gICAgICBzd2FnZ2VyLmluZm8uY29udGFjdC5lbWFpbCA9IGluZm8uY29udGFjdDtcbiAgICB9XG4gICAgaWYoaW5mby5kZXNjcmlwdGlvbikge1xuICAgICAgc3dhZ2dlci5pbmZvLmRlc2NyaXB0aW9uID0gaW5mby5kZXNjcmlwdGlvbjtcbiAgICB9XG4gICAgaWYoaW5mby50aXRsZSkge1xuICAgICAgc3dhZ2dlci5pbmZvLnRpdGxlID0gaW5mby50aXRsZTtcbiAgICB9XG4gICAgaWYoaW5mby50ZXJtc09mU2VydmljZVVybCkge1xuICAgICA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C8vIGxhc3QgY2hhciB3YXMgYSBsZWFkXG4gICAgICBpZiAobGVhZFN1cnJvZ2F0ZSkge1xuICAgICAgICAvLyAyIGxlYWRzIGluIGEgcm93XG4gICAgICAgIGlmIChjb2RlUG9pbnQgPCAweERDMDApIHtcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG4gICAgICAgICAgY29udGludWVcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyB2YWxpZCBzdXJyb2dhdGUgcGFpclxuICAgICAgICAgIGNvZGVQb2ludCA9IGxlYWRTdXJyb2dhdGUgLSAweEQ4MDAgPDwgMTAgfCBjb2RlUG9pbnQgLSAweERDMDAgfCAweDEwMDAwXG4gICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IG51bGxcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gbm8gbGVhZCB5ZXRcblxuICAgICAgICBpZiAoY29kZVBvaW50ID4gMHhEQkZGKSB7XG4gICAgICAgICAgLy8gdW5leHBlY3RlZCB0cmFpbFxuICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkgYnl0ZXMucHVzaCgweEVGLCAweEJGLCAweEJEKVxuICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgIC8vIHVucGFpcmVkIGxlYWRcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIHZhbGlkIGxlYWRcbiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG4gICAgICAgICAgY29ud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XJlID0gISFzZWN1cmU7XG4gICAgICAgICAgICB0aGlzLnNjcmlwdCA9ICEhc2NyaXB0O1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBDb29raWVBY2Nlc3NJbmZvKGRvbWFpbiwgcGF0aCwgc2VjdXJlLCBzY3JpcHQpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZUFjY2Vzc0luZm8gPSBDb29raWVBY2Nlc3NJbmZvO1xuXG4gICAgZnVuY3Rpb24gQ29va2llKGNvb2tpZXN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBpZiAoY29va2llc3RyIGluc3RhbmNlb2YgQ29va2llKSB7XG4gICAgICAgICAgICByZXR1cm4gY29va2llc3RyO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgQ29va2llKSB7XG4gICAgICAgICAgICB0aGlzLm5hbWUgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLmV4cGlyYXRpb25fZGF0ZSA9IEluZmluaXR5O1xuICAgICAgICAgICAgdGhpcy5wYXRoID0gU3RyaW5nKHJlcXVlc3RfcGF0aCB8fCBcIi9cIik7XG4gICAgICAgICAgICB0aGlzLmV4cGxpY2l0X3BhdGggPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuZG9tYWluID0gcmVxdWVzdF9kb21haW4gfHwgbnVsbDtcbiAgICAgICAgICAgIHRoaXMuZXhwbGljaXRfZG9tYWluID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLnNlY3VyZSA9IGZhbHNlOyAvL2hvdyB0byBkZWZpbmUgZGVmYXVsdD9cbiAgICAgICAgICAgIHRoaXMubm9zY3JpcHQgPSBmYWxzZTsgLy9odHRwb25seVxuICAgICAgICAgICAgaWYgKGNvb2tpZXN0cikge1xuICAgICAgICAgICAgICAgIHRoaXMucGFyc2UoY29va2llc3RyLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgQ29va2llKGNvb2tpZXN0cik7XG4gICAgfVxuICAgIGV4cG9ydHMuQ29va2llID0gQ29va2llO1xuXG4gICAgQ29va2llLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkge1xuICAgICAgICB2YXIgc3RyID0gW3RoaXMubmFtZSArIFwiPVwiICsgdGhpcy52YWx1ZV07XG4gICAgICAgIGlmICh0aGlzLmV4cGlyYXRpb25fZGF0ZSAhPT0gSW5maW5pdHkpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwiZXhwaXJlcz1cIiArIChuZXcgRGF0ZSh0aGlzLmV4cGlyYXRpb25fZGF0ZSkpLnRvR01UU3RyaW5nKCkpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLmRvbWFpbikge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJkb21haW49XCIgKyB0aGlzLmRvbWFpbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMucGF0aCkge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJwYXRoPVwiICsgdGhpcy5wYXRoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5zZWN1cmUpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwic2VjdXJlXCIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm5vc2NyaXB0KSB7XG4gICAgICAgICAgICBzdHIucHVzaChcImh0dHBvbmx5XCIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzdHIuam9pbihcIjsgXCIpO1xuICAgIH07XG5cbiAgICBDb29raWUucHJvdG90eXBlLnRvVmFsdWVTdHJpbmcgPSBmdW5jdGlvbiB0b1ZhbHVlU3RyaW5nKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5uYW1lICsgXCI9XCIgKyB0aGlzLnZhbHVlO1xuICAgIH07XG5cbiAgICB2YXIgY29va2llX3N0cl9zcGxpdHRlciA9IC9bOl0oPz1cXHMqW2EtekEtWjAtOV9cXC1dK1xccypbPV0pL2c7XG4gICAgQ29va2llLnByb3RvdHlwZS5wYXJzZSA9IGZ1bmN0aW9uIHBhcnNlKHN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBpZiAodGhpcyBpbnN0YW5jZW9mIENvb2tpZSkge1xuICAgICAgICAgICAgdmFyIHBhcnRzID0gc3RyLnNwbGl0KFwiO1wiKS5maWx0ZXIoZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXZhbHVlO1xuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIHBhaXIgPSBwYXJ0c1swXS5tYXRjaCgvKFtePV0rKT0oW1xcc1xcU10qKS8pLFxuICAgICAgICAgICAgICAgIGtleSA9IHBhaXJbMV0sXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYWlyWzJdLFxuICAgICAgICAgICAgICAgIGk7XG4gICAgICAgICAgICB0aGlzLm5hbWUgPSBrZXk7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG5cbiAgICAgICAgICAgIGZvciAoaSA9IDE7IGkgPCBwYXJ0cy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgIHBhaXIgPSBwYXJ0c1tpXS5tYXRjaCgvKFtePV0rKSg/Oj0oW1xcc1xcU10qKSk/Lyk7XG4gICAgICAgICAgICAgICAga2V5ID0gcGFpclsxXS50cmltKCkudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhaXJbMl07XG4gICAgICAgICAgICAgICAgc3dpdGNoIChrZXkpIHtcbiAgICAgICAgICAgICAgICBjYXNlIFwiaHR0cG9ubHlcIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ub3NjcmlwdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgXCJleHBpcmVzXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZXhwaXJhdGlvbl9kYXRlID0gdmFsdWUgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIE51bWJlcihEYXRlLnBhcnNlKHZhbHVlKSkgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEluZmluaXR5O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwicGF0aFwiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnBhdGggPSB2YWx1ZSA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUudHJpbSgpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlwiO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmV4cGxpY2l0X3BhdGggPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwiZG9tYWluXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZG9tYWluID0gdmFsdWUgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnRyaW0oKSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJcIjtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5leHBsaWNpdF9kb21haW4gPSAhIXRoaXMuZG9tYWluO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwic2VjdXJlXCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VjdXJlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIXRoaXMuZXhwbGljaXRfcGF0aCkge1xuICAgICAgICAgICAgICAgdGhpcy5wYXRoID0gcmVxdWVzdF9wYXRoIHx8IFwiL1wiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCF0aGlzLmV4cGxpY2l0X2RvbWFpbikge1xuICAgICAgICAgICAgICAgdGhpcy5kb21haW4gPSByZXF1ZXN0X2RvbWFpbjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBDb29raWUoKS5wYXJzZShzdHIsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgIH07XG5cbiAgICBDb29raWUucHJvdG90eXBlLm1hdGNoZXMgPSBmdW5jdGlvbiBtYXRjaGVzKGFjY2Vzc19pbmZvKSB7XG4gICAgICAgIGlmICh0aGlzLm5vc2NyaXB0ICYmIGFjY2Vzc19pbmZvLnNjcmlwdCB8fFxuICAgICAgICAgICAgICAgIHRoaXMuc2VjdXJlICYmICFhY2Nlc3NfaW5mby5zZWN1cmUgfHxcbiAgICAgICAgICAgICAgICAhdGhpcy5jb2xsaWRlc1dpdGgoYWNjZXNzX2luZm8pKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfTtcblxuICAgIENvb2tpZS5wcm90b3R5cGUuY29sbGlkZXNXaXRoID0gZnVuY3Rpb24gY29sbGlkZXNXaXRoKGFjY2Vzc19pbmZvKSB7XG4gICAgICAgIGlmICgodGhpcy5wYXRoICYmICFhY2Nlc3NfaW5mby5wYXRoKSB8fCAodGhpcy5kb21haW4gJiYgIWFjY2Vzc19pbmZvLmRvbWFpbikpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wYXRoICYmIGFjY2Vzc19pbmZvLnBhdGguaW5kZXhPZih0aGlzLnBhdGgpICE9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF0aGlzLmV4cGxpY2l0X3BhdGgpIHtcbiAgICAgICAgICAgaWYgKHRoaXMucGF0aCAhPT0gYWNjZXNzX2luZm8ucGF0aCkge1xuICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGFjY2Vzc19kb21haW4gPSBhY2Nlc3NfaW5mby5kb21haW4gJiYgYWNjZXNzX2luZm8uZG9tYWluLnJlcGxhY2UoL15bXFwuXS8sJycpO1xuICAgICAgICB2YXIgY29va2llX2RvbWFpbiA9IHRoaXMuZG9tYWluICYmIHRoaXMuZG9tYWluLnJlcGxhY2UoL15bXFwuXS8sJycpO1xuICAgICAgICBpZiAoY29va2llX2RvbWFpbiA9PT0gYWNjZXNzX2RvbWFpbikge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvb2tpZV9kb21haW4pIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5leHBsaWNpdF9kb21haW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7IC8vIHdlIGFscmVhZHkgY2hlY2tlZCBpZiB0aGUgZG9tYWlucyB3ZXJlIGV4YWN0bHkgdGhlIHNhbWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB3aWxkY2FyZCA9IGFjY2Vzc19kb21haW4uaW5kZXhPZihjb29raWVfZG9tYWluKTtcbiAgICAgICAgICAgIGlmICh3aWxkY2FyZCA9PT0gLTEgfHwgd2lsZGNhcmQgIT09IGFjY2Vzc19kb21haW4ubGVuZ3RoIC0gY29va2llX2RvbWFpbi5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9O1xuXG4gICAgZnVuY3Rpb24gQ29va2llSmFyKCkge1xuICAgICAgICB2YXIgY29va2llcywgY29va2llc19saXN0LCBjb2xsaWRhYmxlX2Nvb2tpZTtcbiAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBDb29raWVKYXIpIHtcbiAgICAgICAgICAgIGNvb2tpZXMgPSBPYmplY3QuY3JlYXRlKG51bGwpOyAvL25hbWU6IFtDb29raWVdXG5cbiAgICAgICAgICAgIHRoaXMuc2V0Q29va2llID0gZnVuY3Rpb24gc2V0Q29va2llKGNvb2tpZSwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICAgICAgICAgIHZhciByZW1vdmUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llID0gbmV3IENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgICAgICAgICAgICAgIC8vRGVsZXRlIHRoZSBjb29raWUgaWYgdGhlIHNldCBpcyBwYXN0IHRoZSBjdXJyZW50IHRpbWVcbiAgICAgICAgICAgICAgICByZW1vdmUgPSBjb29raWUuZXhwaXJhdGlvbl9kYXRlIDw9IERhdGUubm93KCk7XG4gICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNbY29va2llLm5hbWVdICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjb29raWVzX2xpc3QubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbGxpZGFibGVfY29va2llID0gY29va2llc19saXN0W2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbGxpZGFibGVfY29va2llLmNvbGxpZGVzV2l0aChjb29raWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVzX2xpc3Quc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llc19saXN0Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGNvb2tpZXNbY29va2llLm5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0W2ldID0gY29va2llO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdC5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChyZW1vdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb29raWVzW2Nvb2tpZS5uYW1lXSA9IFtjb29raWVdO1xuICAgICAgICAgICAgICAgIHJldHVybiBjb29raWVzW2Nvb2tpZS5uYW1lXTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvL3JldHVybnMgYSBjb29raWVcbiAgICAgICAgICAgIHRoaXMuZ2V0Q29va2llID0gZnVuY3Rpb24gZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBjb29raWUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWVfbmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKCFjb29raWVzX2xpc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llc19saXN0Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IGNvb2tpZXNfbGlzdFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZS5leHBpcmF0aW9uX2RhdGUgPD0gRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNfbGlzdC5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llLm1hdGNoZXMoYWNjZXNzX2luZm8pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29va2llO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vcmV0dXJucyBhIGxpc3Qgb2YgY29va2llc1xuICAgICAgICAgICAgdGhpcy5nZXRDb29raWVzID0gZnVuY3Rpb24gZ2V0Q29va2llcyhhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBtYXRjaGVzID0gW10sIGNvb2tpZV9uYW1lLCBjb29raWU7XG4gICAgICAgICAgICAgICAgZm9yIChjb29raWVfbmFtZSBpbiBjb29raWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IHRoaXMuZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbyk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXMucHVzaChjb29raWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG1hdGNoZXMudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXMuam9pbihcIjpcIik7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBtYXRjaGVzLnRvVmFsdWVTdHJpbmcgPSBmdW5jdGlvbiB0b1ZhbHVlU3RyaW5nKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hlcy5tYXAoZnVuY3Rpb24gKGMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnRvVmFsdWVTdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignOycpO1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hdGNoZXM7XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IENvb2tpZUphcigpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZUphciA9IENvb2tpZUphcjtcblxuICAgIC8vcmV0dXJucyBsaXN0IG9mIGNvb2tpZXMgdGhhdCB3ZXJlIHNldCBjb3JyZWN0bHkuIENvb2tpZXMgdGhhdCBhcmUgZXhwaXJlZCBhbmQgcmVtb3ZlZCBhcmUgbm90IHJldHVybmVkLlxuICAgIENvb2tpZUphci5wcm90b3R5cGUuc2V0Q29va2llcyA9IGZ1bmN0aW9uIHNldENvb2tpZXMoY29va2llcywgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICBjb29raWVzID0gQXJyYXkuaXNBcnJheShjb29raWVzKSA/XG4gICAgICAgICAgICAgICAgY29va2llcyA6XG4gICAgICAgICAgICAgICAgY29va2llcy5zcGxpdChjb29raWVfc3RyX3NwbGl0dGVyKTtcbiAgICAgICAgdmFyIHN1Y2Nlc3NmdWwgPSBbXSxcbiAgICAgICAgICAgIGksXG4gICAgICAgICAgICBjb29raWU7XG4gICAgICAgIGNvb2tpZXMgPSBjb29raWVzLm1hcChDb29raWUpO1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llcy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgY29va2llID0gY29va2llc1tpXTtcbiAgICAgICAgICAgIGlmICh0aGlzLnNldENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpKSB7XG4gICAgICAgICAgICAgICAgc3VjY2Vzc2Z1bC5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHN1Y2Nlc3NmdWw7XG4gICAgfTtcbn0oKSk7XG4iLCIvKiFcbiAqIGpRdWVyeSBKYXZhU2NyaXB0IExpYnJhcnkgdjIuMS40XG4gKiBodHRwOi8vanF1ZXJ5LmNvbS9cbiAqXG4gKiBJbmNsdWRlcyBTaXp6bGUuanNcbiAqIGh0dHA6Ly9zaXp6bGVqcy5jb20vXG4gKlxuICogQ29weXJpZ2h0IDIwMDUsIDIwMTQgalF1ZXJ5IEZvdW5kYXRpb24sIElu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ZXBlYXQgICAgICAgICA9IHJlcGVhdDtcbm1vZHVsZS5leHBvcnRzLmlzTmVnYXRpdmVaZXJvID0gaXNOZWdhdGl2ZVplcm87XG5tb2R1bGUuZXhwb3J0cy5leHRlbmQgICAgICAgICA9IGV4dGVuZDtcbiIsIid1c2Ugc3RyaWN0JztcblxuLyplc2xpbnQtZGlzYWJsZSBuby11c2UtYmVmb3JlLWRlZmluZSovXG5cbnZhciBjb21tb24gICAgICAgICAgICAgID0gcmVxdWlyZSgnLi9jb21tb24nKTtcbnZhciBZQU1MRXhjZXB0aW9uICAgICAgID0gcmVxdWlyZSgnLi9leGNlcHRpb24nKTtcbnZhciBERUZBVUxUX0ZVTExfU0NIRU1BID0gcmVxdWlyZSgnLi9zY2hlbWEvZGVmYXVsdF9mdWxsJyk7XG52YXIgREVGQVVMVF9TQUZFX1NDSEVNQSA9IHJlcXVpcmUoJy4vc2NoZW1hL2RlZmF1bHRfc2FmZScpO1xuXG52YXIgX3RvU3RyaW5nICAgICAgID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcbnZhciBfaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG52YXIgQ0hBUl9UQUIgICAgICAgICAgICAgICAgICA9IDB4MDk7IC8qIFRhYiAqL1xudmFyIENIQVJfTElORV9GRUVEICAgICAgICAgICAgPSAweDBBOyAvKiBMRiAqL1xudmFyIENIQVJfQ0FSUklBR0VfUkVUVVJOICAgICAgPSAweDBEOyAvKiBDUiAqL1xudmFyIENIQVJfU1BBQ0UgICAgICAgICAgICAgICAgPSAweDIwOyAvKiBTcGFjZSAqL1xudmFyIENIQVJfRVhDTEFNQVRJT04gICAgICAgICAgPSAweDIxOyAvKiAhICovXG52YXIgQ0hBUl9ET1VCTEVfUVVPVEUgICAgICAgICA9IDB4MjI7IC8qIFwiICovXG52YXIgQ0hBUl9TSEFSUCAgICAgICAgICAgICAgICA9IDB4MjM7IC8qICMgKi9c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iF8ISF8IVthLXpcXC1dKyEpJC9pO1xudmFyIFBBVFRFUk5fVEFHX1VSSSAgICAgICAgICAgICAgID0gL14oPzohfFteLFxcW1xcXVxce1xcfV0pKD86JVswLTlhLWZdezJ9fFswLTlhLXpcXC0jO1xcL1xcPzpAJj1cXCtcXCQsX1xcLiF+XFwqJ1xcKFxcKVxcW1xcXV0pKiQvaTtcblxuXG5mdW5jdGlvbiBpc19FT0woYykge1xuICByZXR1cm4gKGMgPT09IDB4MEEvKiBMRiAqLykgfHwgKGMgPT09IDB4MEQvKiBDUiAqLyk7XG59XG5cbmZ1bmN0aW9uIGlzX1dISVRFX1NQQUNFKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fCAoYyA9PT0gMHgyMC8qIFNwYWNlICovKTtcbn1cblxuZnVuY3Rpb24gaXNfV1NfT1JfRU9MKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fFxuICAgICAgICAgKGMgPT09IDB4MjAvKiBTcGFjZSAqLykgfHxcbiAgICAgICAgIChjID09PSAweDBBLyogTEYgKi8pIHx8XG4gICAgICAgICAoYyA9PT0gMHgwRC8qIENSICovKTtcbn1cblxuZnVuY3Rpb24gaXNfRkxPV19JTkRJQ0FUT1IoYykge1xuICByZXR1cm4gMHgyQy8qICwgKi8gPT09IGMgfHxcbiAgICAgICAgIDB4NUIvKiBbICovID09PSBjIHx8XG4gICAgICAgICAweDVELyogXSAqLyA9PT0gYyB8fFxuICAgICAgICAgMHg3Qi8qIHsgKi8gPT09IGMgfHxcbiAgICAgICAgIDB4N0QvKiB9ICovID09PSBjO1xufVxuXG5mdW5jdGlvbiBmcm9tSGV4Q29kZShjKSB7XG4gIHZhciBsYztcblxuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIC8qZXNsaW50LWRpc2FibGUgbm8t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AgMHgyNi8qICYgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyQS8qICogKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyMS8qICEgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHg3Qy8qIHwgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgzRS8qID4gKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyNy8qICcgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyMi8qIFwiICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4MjUvKiAlICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NDAvKiBAICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NjAvKiBgICovICAgICAgICAgICA9PT0gY2gpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBpZiAoMHgzRi8qID8gKi8gPT09IGNoIHx8IDB4MkQvKiAtICovID09PSBjaCkge1xuICAgIGZvbGxvd2luZyA9IHN0YXRlLmlucHV0LmNoYXJDb2RlQXQoc3RhdGUucG9zaXRpb24gKyAxKTtcblxuICAgIGlmIChpc19XU19PUl9FT0woZm9sbG93aW5nKSB8fFxuICAgICAgICB3aXRoaW5GbG93Q29sbGVjdGlvbiAmJiBpc19GTE9XX0lORElDQVRPUihmb2xsb3dpbmcpKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgc3RhdGUua2luZCA9ICdzY2FsYXInO1xuICBzdGF0ZS5yZXN1bHQgPSAnJztcbiAgY2FwdHVyZVN0YXJ0ID0gY2FwdHVyZUVuZCA9IHN0YXRlLnBvc2l0aW9uO1xuICBoYXNQZW5kaW5nQ29udGVudCA9IGZhbHNlO1xuXG4gIHdoaWxlICgwICE9PSBjaCkge1xuICAgIGlmICgweDNBLyogOiAqLyA9PT0gY2gpIHtcbiAgICAgIGZvbGxvd2luZyA9IHN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SB7XG4gICAgICAvLyBiYXNlIDJcbiAgICAgIGluZGV4Kys7XG5cbiAgICAgIGZvciAoOyBpbmRleCA8IG1heDsgaW5kZXgrKykge1xuICAgICAgICBjaCA9IGRhdGFbaW5kZXhdO1xuICAgICAgICBpZiAoY2ggPT09ICdfJykgeyBjb250aW51ZTsgfVxuICAgICAgICBpZiAoY2ggIT09ICcwJyAmJiBjaCAhPT0gJzEnKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGhhc0RpZ2l0cyA9IHRydWU7XG4gICAgICB9XG4gICAgICByZXR1cm4gaGFzRGlnaXRzO1xuICAgIH1cblxuXG4gICAgaWYgKGNoID09PSAneCcpIHtcbiAgICAgIC8vIGJhc2UgMTZcbiAgICAgIGluZGV4Kys7XG5cbiAgICAgIGZvciAoOyBpbmRleCA8IG1heDsgaW5kZXgrKykge1xuICAgICAgICBjaCA9IGRhdGFbaW5kZXhdO1xuICAgICAgICBpZiAoY2ggPT09ICdfJykgeyBjb250aW51ZTsgfVxuICAgICAgICBpZiAoIWlzSGV4Q29kZShkYXRhLmNoYXJDb2RlQXQoaW5kZXgpKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBoYXNEaWdpdHMgPSB0cnVlO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGhhc0RpZ2l0cztcbiAgICB9XG5cbiAgICAvLyBiYXNlIDhcbiAgICBmb3IgKDsgaW5kZXggPCBtYXg7IGluZGV4KyspIHtcbiAgICAgIGNoID0gZGF0YVtpbmRleF07XG4gICAgICBpZiAoY2ggPT09ICdfJykgeyBjb250aW51ZTsgfVxuICAgICAgaWYgKCFpc09jdENvZGUoZGF0YS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuICAgICAgaGFzRGlnaXRzID0gdHJ1ZTtcbiAgICB9XG4gICAgcmV0dXJuIG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1xuICByZXR1cm4gbnVsbCAhPT0gZGF0YSA/IGRhdGEgOiB7fTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBuZXcgVHlwZSgndGFnOnlhbWwub3JnLDIwMDI6c2V0Jywge1xuICBraW5kOiAnbWFwcGluZycsXG4gIHJlc29sdmU6IHJlc29sdmVZYW1sU2V0LFxuICBjb25zdHJ1Y3Q6IGNvbnN0cnVjdFlhbWxTZXRcbn0pO1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgVHlwZSA9IHJlcXVpcmUoJy4uL3R5cGUnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBuZXcgVHlwZSgndGFnOnlhbWwub3JnLDIwMDI6c3RyJywge1xuICBraW5kOiAnc2NhbGFyJyxcbiAgY29uc3RydWN0OiBmdW5jdGlvbiAoZGF0YSkgeyByZXR1cm4gbnVsbCAhPT0gZGF0YSA/IGRhdGEgOiAnJzsgfVxufSk7XG4iLCIndXNlIHN0cmljdCc7XG5cbnZhciBUeXBlID0gcmVxdWlyZSgnLi4vdHlwZScpO1xuXG52YXIgWUFNTF9USU1FU1RBTVBfUkVHRVhQID0gbmV3IFJlZ0V4cChcbiAgJ14oWzAtOV1bMC05XVswLTldWzAtOV0pJyAgICAgICAgICArIC8vIFsxXSB5ZWFyXG4gICctKFswLTldWzAtOV0/KScgICAgICAgICAgICAgICAgICAgKyAvLyBbMl0gbW9udGhcbiAgJy0oWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICArIC8vIFszXSBkYXlcbiAgJyg/Oig/OltUdF18WyBcXFxcdF0rKScgICAgICAgICAgICAgICsgLy8gLi4uXG4gICcoWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICAgKyAvLyBbNF0gaG91clxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzVdIG1pbnV0ZVxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzZdIHNlY29uZFxuICAnK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b2tlbi5TdHJpbmdMaXRlcmFsXSA9ICdTdHJpbmcnO1xuICAgIFRva2VuTmFtZVtUb2tlbi5SZWd1bGFyRXhwcmVzc2lvbl0gPSAnUmVndWxhckV4cHJlc3Npb24nO1xuICAgIFRva2VuTmFtZVtUb2tlbi5UZW1wbGF0ZV0gPSAnVGVtcGxhdGUnO1xuXG4gICAgLy8gQSBmdW5jdGlvbiBmb2xsb3dpbmcgb25lIG9mIHRob3NlIHRva2VucyBpcyBhbiBleHByZXNzaW9uLlxuICAgIEZuRXhwclRva2VucyA9IFsnKCcsICd7JywgJ1snLCAnaW4nLCAndHlwZW9mJywgJ2luc3RhbmNlb2YnLCAnbmV3JyxcbiAgICAgICAgICAgICAgICAgICAgJ3JldHVybicsICdjYXNlJywgJ2RlbGV0ZScsICd0aHJvdycsICd2b2lkJyxcbiAgICAgICAgICAgICAgICAgICAgLy8gYXNzaWdubWVudCBvcGVyYXRvcnNcbiAgICAgICAgICAgICAgICAgICAgJz0nLCAnKz0nLCAnLT0nLCAnKj0nLCAnLz0nLCAnJT0nLCAnPDw9JywgJz4+PScsICc+Pj49JyxcbiAgICAgICAgICAgICAgICAgICAgJyY9JywgJ3w9JywgJ149JywgJywnLFxuICAgICAgICAgICAgICAgICAgICAvLyBiaW5hcnkvdW5hcnkgb3BlcmF0b3JzXG4gICAgICAgICAgICAgICAgICAgICcrJywgJy0nLCAnKicsICcvJywgJyUnLCAnKysnLCAnLS0nLCAnPDwnLCAnPj4nLCAnPj4+JywgJyYnLFxuICAgICAgICAgICAgICAgICAgICAnfCcsICdeJywgJyEnLCAnficsICcmJicsICd8fCcsICc/JywgJzonLCAnPT09JywgJz09JywgJz49JyxcbiAgICAgICAgICAgICAgICAgICAgJzw9JywgJzwnLCAnPicsICchPScsICchPT0nXTtcblxuICAgIFN5bnRheCA9IHtcbiAgICAgICAgQXNzaWdubWVudEV4cHJlc3Npb246ICdBc3NpZ25tZW50RXhwcmVzc2lvbicsXG4gICAgICAgIEFzc2ln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aWZpZXJzXG5cbiAgICBmdW5jdGlvbiBpc0lkZW50aWZpZXJTdGFydChjaCkge1xuICAgICAgICByZXR1cm4gKGNoID09PSAweDI0KSB8fCAoY2ggPT09IDB4NUYpIHx8ICAvLyAkIChkb2xsYXIpIGFuZCBfICh1bmRlcnNjb3JlKVxuICAgICAgICAgICAgKGNoID49IDB4NDEgJiYgY2ggPD0gMHg1QSkgfHwgICAgICAgICAvLyBBLi5aXG4gICAgICAgICAgICAoY2ggPj0gMHg2MSAmJiBjaCA8PSAweDdBKSB8fCAgICAgICAgIC8vIGEuLnpcbiAgICAgICAgICAgIChjaCA9PT0gMHg1QykgfHwgICAgICAgICAgICAgICAgICAgICAgLy8gXFwgKGJhY2tzbGFzaClcbiAgICAgICAgICAgICgoY2ggPj0gMHg4MCkgJiYgUmVnZXguTm9uQXNjaWlJZGVudGlmaWVyU3RhcnQudGVzdChTdHJpbmcuZnJvbUNoYXJDb2RlKGNoKSkpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGlzSWRlbnRpZmllclBhcnQoY2gpIHtcbiAgICAgICAgcmV0dXJuIChjaCA9PT0gMHgyNCkgfHwgKGNoID09PSAweDVGKSB8fCAgLy8gJCAoZG9sbGFyKSBhbmQgXyAodW5kZXJzY29yZSlcbiAgICAgICAgICAgIChjaCA+PSAweDQxICYmIGNoIDw9IDB4NUEpIHx8ICAgICAgICAgLy8gQS4uWlxuICAgICAgICAgICAgKGNoID49IDB4NjEgJiYgY2ggPD0gMHg3QSkgfHwgICAgICAgICAvLyBhLi56XG4gICAgICAgICAgICAoY2ggPj0gMHgzMCAmJiBjaCA8PSAweDM5KSB8fCAgICAgICAgIC8vIDAuLjlcbiAgICAgICAgICAgIChjaCA9PT0gMHg1QykgfHwgICAgICAgICAgICAgICAgICAgICAgLy8gXFwgKGJhY2tzbGFzaClcbiAgICAgICAgICAgICgoY2ggPj0gMHg4MCkgJiYgUmVnZXguTm9uQXNjaWlJZGVudGlmaWVyUGFydC50ZXN0K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d1bWVudHMnO1xuICAgIH1cblxuICAgIC8vIDcuNi4xLjEgS2V5d29yZHNcblxuICAgIGZ1bmN0aW9uIGlzS2V5d29yZChpZCkge1xuXG4gICAgICAgIC8vICdjb25zdCcgaXMgc3BlY2lhbGl6ZWQgYXMgS2V5d29yZCBpbiBWOC5cbiAgICAgICAgLy8gJ3lpZWxkJyBhbmQgJ2xldCcgYXJlIGZvciBjb21wYXRpYmlsaXR5IHdpdGggU3BpZGVyTW9ua2V5IGFuZCBFUy5uZXh0LlxuICAgICAgICAvLyBTb21lIG90aGVycyBhcmUgZnJvbSBmdXR1cmUgcmVzZXJ2ZWQgd29yZHMuXG5cbiAgICAgICAgc3dpdGNoIChpZC5sZW5ndGgpIHtcbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ2lmJykgfHwgKGlkID09PSAnaW4nKSB8fCAoaWQgPT09ICdkbycpO1xuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAndmFyJykgfHwgKGlkID09PSAnZm9yJykgfHwgKGlkID09PSAnbmV3JykgfHxcbiAgICAgICAgICAgICAgICAoaWQgPT09ICd0cnknKSB8fCAoaWQgPT09ICdsZXQnKTtcbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ3RoaXMnKSB8fCAoaWQgPT09ICdlbHNlJykgfHwgKGlkID09PSAnY2FzZScpIHx8XG4gICAgICAgICAgICAgICAgKGlkID09PSAndm9pZCcpIHx8IChpZCA9PT0gJ3dpdGgnKSB8fCAoaWQgPT09ICdlbnVtJyk7XG4gICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIHJldHVybiAoaWQgPT09ICd3aGlsZScpIHx8IChpZCA9PT0gJ2JyZWFrJykgfHwgKGlkID09PSAnY2F0Y2gnKSB8fFxuICAgICAgICAgICAgICAgIChpZCA9PT0gJ3Rocm93JykgfHwgKGlkID09PSAnY29uc3QnKSB8fCAoaWQgPT09ICd5aWVsZCcpIHx8XG4gICAgICAgICAgICAgICAgKGlkID09PSAnY2xhc3MnKSB8fCAoaWQgPT09ICdzdXBlcicpO1xuICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAncmV0dXJuJykgfHwgKGlkID09PSAndHlwZW9mJykgfHwgKGlkID09PSAnZGVsZXRlJykgfHxcbiAgICAgICAgICAgICAgICAoaWQgPT09ICdzd2l0Y2gnKSB8fCAoaWQgPT09ICdleHBvcnQnKSB8fCAoaWQgPT09ICdpbXBvcnQnKTtcbiAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgcmV0dXJuIChpZCA9PT0gJ2RlZmF1bHQnKSB8fCAoaWQgPT09ICdmaW5hbGx5JykgfHwgKGlkID09PSAnZXh0ZW5kcycpO1xuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAnZnVuY3Rpb24nKSB8fCAoaWQgPT09ICdjb250aW51ZScpIHx8IChpZCA9PT0gJ2RlYnVnZ2VyJyk7XG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICByZXR1cm4gKGlkID09PSAnaW5zdGFuY2VvZicpO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gNy40IENvbW1lbnRzXG5cbiAgICBmdW5jdGlvbiBhZGRDb21tZW50KHR5cGUsIHZhbHVlLCBzdGFydCwgZW5kLCBsb2MpIHtcbiAgICAgICAgdmFyIGNvbW1lbnQ7XG5cbiAgICAgICAgYXNzZXJ0KHR5cGVvZiBzdGFydCA9PT0gJ251bWJlcicsICdDb21tZW50IG11c3QgaGF2ZSB2YWxpZCBwb3NpdGlvbicpO1xuXG4gICAgICAgIHN0YXRlLmxhc3RDb21tZW50U3RhcnQgPSBzdGFydDtcblxuICAgICAgICBjb21tZW50ID0ge1xuICAgICAgICAgICAgdHlwZTogdHlwZSxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZVxuICAgICAgICB9O1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIGNvbW1lbnQucmFuZ2UgPSBbc3RhcnQsIGVuZF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgY29tbWVudC5sb2MgPSBsb2M7XG4gICAgICAgIH1cbiAgICAgICAgZXh0cmEuY29tbWVudHMucHVzaChjb21tZW50KTtcbiAgICAgICAgaWYgKGV4dHJhLmF0dGFjaENvbW1lbnQpIHtcbiAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICAgICAgZXh0cmEudHJhaWxpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2tpcFNpbmdsZUxpbmVDb21tZW50KG9mZnNldCkge1xuICAgICAgICB2YXIgc3RhcnQsIGxvYywgY2gsIGNvbW1lbnQ7XG5cbiAgICAgICAgc3RhcnQgPSBpbmRleCAtIG9mZnNldDtcbiAgICAgICAgbG9jID0ge1xuICAgICAgICAgICAgc3RhcnQ6IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnQgLSBvZmZzZXRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoKSkge1xuICAgICAgICAgICAgICAgIGhhc0xpbmVUZXJtaW5hdG9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgY29tbWVudCA9IHNvdXJjZS5zbGljZShzdGFydCArIG9mZnNldCwgaW5kZXggLSAxKTtcbiAgICAgICAgICAgICAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0IC0gMVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBhZGRDb21tZW50KCdMaW5lJywgY29tbWVudCwgc3RhcnQsIGluZGV4IC0gMSwgbG9jKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAxMyAmJiBzb3VyY2UuY2hhckNvZGVBdChpbmRleCkgPT09IDEwKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICBsaW5lU3RhcnQgPSBpbmRleDtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgIGNvbW1lbnQgPSBzb3VyY2Uuc2xpY2Uoc3RhcnQgKyBvZmZzZXQsIGluZGV4KTtcbiAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgYWRkQ29tbWVudCgnTGluZScsIGNvbW1lbnQsIHN0YXJ0LCBpbmRleCwgbG9jKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNraXBNdWx0aUxpbmVDb21tZW50KCkge1xuICAgICAgICB2YXIgc3RhcnQsIGxvYywgY2gsIGNvbW1lbnQ7XG5cbiAgICAgICAgaWYgKGV4dHJhLmNvbW1lbnRzKSB7XG4gICAgICAgICAgICBzdGFydCA9IGluZGV4IC0gMjtcbiAgICAgICAgICAgIGxvYyA9IHtcbiAgICAgICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0IC0gMlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuICAgICAgICAgICAgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2gpKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAweDBEICYmIHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkgPT09IDB4MEEpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIGxpbmVTdGFydCA9IGluZGV4O1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgyQSkge1xuICAgICAgICAgICAgICAgIC8vIEJsb2NrIGNvbW1lbnQgZW5kcyB3aXRoICcqLycuXG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkgPT09IDB4MkYpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV4dHJhLmNvbW1lbnRzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gc291cmNlLnNsaWNlKHN0YXJ0ICsgMiwgaW5kZXggLSAyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAgICAgYWRkQ29tbWVudCgnQmxvY2snLCBjb21tZW50LCBzdGFydCwgaW5kZXgsIGxvYyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gUmFuIG9mZiB0aGUgZW5kIG9mIHRoZSBmaWxlIC0gdGhlIHdob2xlIHRoaW5nIGlzIGEgY29tbWVudFxuICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29tbWVudCA9IHNvdXJjZS5zbGljZShzdGFydCArIDIsIGluZGV4KTtcbiAgICAgICAgICAgIGFkZENvbW1lbnQoJ0Jsb2NrJywgY29tbWVudCwgc3RhcnQsIGluZGV4LCBsb2MpO1xuICAgICAgICB9XG4gICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2tpcENvbW1lbnQoKSB7XG4gICAgICAgIHZhciBjaCwgc3RhcnQ7XG4gICAgICAgIGhhc0xpbmVUZXJtaW5hdG9yID0gZmFsc2U7XG5cbiAgICAgICAgc3RhcnQgPSAoaW5kZXggPT09IDApO1xuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpO1xuXG4gICAgICAgICAgICBpZiAoaXNXaGl0ZVNwYWNlKGNoKSkge1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2gpKSB7XG4gICAgICAgICAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAweDBEICYmIHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSA9PT0gMHgwQSkge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2xpbmVOdW1iZXI7XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgc3RhcnQgPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgyRikgeyAvLyBVKzAwMkYgaXMgJy8nXG4gICAgICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCArIDEpO1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gMHgyRikge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoMik7XG4gICAgICAgICAgICAgICAgICAgIHN0YXJ0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAweDJBKSB7ICAvLyBVKzAwMkEgaXMgJyonXG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHNraXBNdWx0aUxpbmVDb21tZW50KCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChzdGFydCAmJiBjaCA9PT0gMHgyRCkgeyAvLyBVKzAwMkQgaXMgJy0nXG4gICAgICAgICAgICAgICAgLy8gVSswMDNFIGlzICc+J1xuICAgICAgICAgICAgICAgIGlmICgoc291cmNlLmNoYXJDb2RlQXQoaW5kZXggKyAxKSA9PT0gMHgyRCkgJiYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMikgPT09IDB4M0UpKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vICctLT4nIGlzIGEgc2luZ2xlLWxpbmUgY29tbWVudFxuICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAzO1xuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoMyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gMHgzQykgeyAvLyBVKzAwM0MgaXMgJzwnXG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5zbGljZShpbmRleCArIDEsIGluZGV4ICsgNCkgPT09ICchLS0nKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7IC8vIGA8YFxuICAgICAgICAgICAgICAgICAgICArK2luZGV4OyAvLyBgIWBcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDsgLy8gYC1gXG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7IC8vIGAtYFxuICAgICAgICAgICAgICAgICAgICBza2lwU2luZ2xlTGluZUNvbW1lbnQoNCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5IZXhFc2NhcGUocHJlZml4KSB7XG4gICAgICAgIHZhciBpLCBsZW4sIGNoLCBjb2RlID0gMDtcblxuICAgICAgICBsZW4gPSAocHJlZml4ID09PSAndScpID8gNCA6IDI7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47ICsraSkge1xuICAgICAgICAgICAgaWYgKGluZGV4IDwgbGVuZ3RoICYmIGlzSGV4RGlnaXQoc291cmNlW2luZGV4XSkpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgICAgICBjb2RlID0gY29kZSAqIDE2ICsgJzAxMjM0NTY3ODlhYmNkZWYnLmluZGV4T2YoY2gudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZShjb2RlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpIHtcbiAgICAgICAgdmFyIGNoLCBjb2RlLCBjdTEsIGN1MjtcblxuICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIGNvZGUgPSAwO1xuXG4gICAgICAgIC8vIEF0IGxlYXN0LCBvbmUgaGV4IGRpZ2l0IGlzIHJlcXVpcmVkLlxuICAgICAgICBpZiAoY2ggPT09ICd9Jykge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICBpZiAoIWlzSGV4RGlnaXQoY2gpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb2RlID0gY29kZSAqIDE2ICsgJzAxMjM0NTY3ODlhYmNkZWYnLmluZGV4T2YoY2gudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoY29kZSA+IDB4MTBGRkZGIHx8IGNoICE9PSAnfScpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBVVEYtMTYgRW5jb2RpbmdcbiAgICAgICAgaWYgKGNvZGUgPD0gMHhGRkZGKSB7XG4gICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZShjb2RlKTtcbiAgICAgICAgfVxuICAgICAgICBjdTEgPSAoKGNvZGUgLSAweDEwMDAwKSA+PiAxMCkgKyAweEQ4MDA7XG4gICAgICAgIGN1MiA9ICgoY29kZSAtIDB4MTAwMDApICYgMTAyMykgKyAweERDMDA7XG4gICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlKGN1MSwgY3UyKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBnZXRFc2NhcGVkSWRlbnRpZmllcigpIHtcbiAgICAgICAgdmFyIGNoLCBpZDtcblxuICAgICAgICBjaCA9IHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KyspO1xuICAgICAgICBpZCA9IFN0cmluZy5mcm9tQ2hhckNvZGUoY2gpO1xuXG4gICAgICAgIC8vICdcXHUnIChVKzAwNUMsIFUrMDA3NSkgZGVub3RlcyBhbiBlc2NhcGVkIGNoYXJhY3Rlci5cbiAgICAgICAgaWYgKGNoID09PSAweDVDKSB7XG4gICAgICAgICAgICBpZiAoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpICE9PSAweDc1KSB7XG4gICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgIGlmICghY2ggfHwgY2ggPT09ICdcXFxcJyB8fCAhaXNJZGVudGlmaWVyU3RhcnQoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWQgPSBjaDtcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoIWlzSWRlbnRpZmllclBhcnQoY2gpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgaWQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjaCk7XG5cbiAgICAgICAgICAgIC8vICdcXHUnIChVKzAwNUMsIFUrMDA3NSkgZGVub3RlcyBhbiBlc2NhcGVkIGNoYXJhY3Rlci5cbiAgICAgICAgICAgIGlmIChjaCA9PT0gMHg1Qykge1xuICAgICAgICAgICAgICAgIGlkID0gaWQuc3Vic3RyKDAsIGlkLmxlbmd0aCAtIDEpO1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkgIT09IDB4NzUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgICAgICBpZiAoIWNoIHx8IGNoID09PSAnXFxcXCcgfHwgIWlzSWRlbnRpZmllclBhcnQoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaWQ7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZ2V0SWRlbnRpZmllcigpIHtcbiAgICAgICAgdmFyIHN0YXJ0LCBjaDtcblxuICAgICAgICBzdGFydCA9IGluZGV4Kys7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoY2ggPT09IDB4NUMpIHtcbiAgICAgICAgICAgICAgICAvLyBCbGFja3NsYXNoIChVKzAwNUMpIG1hcmtzIFVuaWNvZGUgZXNjYXBlIHNlcXVlbmNlLlxuICAgICAgICAgICAgICAgIGluZGV4ID0gc3RhcnQ7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldEVzY2FwZWRJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaXNJZGVudGlmaWVyUGFydChjaCkpIHtcbiAgICAgICAgICAgICAgICArK2luZGV4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9IFRva2VuLklkZW50aWZpZXI7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogdHlwZSxcbiAgICAgICAgICAgIHZhbHVlOiBpZCxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cblxuICAgIC8vIDcuNyBQdW5jdHVhdG9yc1xuXG4gICAgZnVuY3Rpb24gc2NhblB1bmN0dWF0b3IoKSB7XG4gICAgICAgIHZhciB0b2tlbiwgc3RyO1xuXG4gICAgICAgIHRva2VuID0ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uUHVuY3R1YXRvcixcbiAgICAgICAgICAgIHZhbHVlOiAnJyxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBpbmRleCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcblxuICAgICAgICAvLyBDaGVjayBmb3IgbW9zdCBjb21tb24gc2luZ2xlLWNoYXJhY3RlciBwdW5jdHVhdG9ycy5cbiAgICAgICAgc3RyID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgc3dpdGNoIChzdHIpIHtcblxuICAgICAgICBjYXNlICcoJzpcbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgICAgIGV4dHJhLm9wZW5QYXJlblRva2VuID0gZXh0cmEudG9rZW5zLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICd7JzpcbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgICAgIGV4dHJhLm9wZW5DdXJseVRva2VuID0gZXh0cmEudG9rZW5zLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucHVzaCgneycpO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJy4nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAnLicgJiYgc291cmNlW2luZGV4ICsgMV0gPT09ICcuJykge1xuICAgICAgICAgICAgICAgIC8vIFNwcmVhZCBvcGVyYXRvcjogLi4uXG4gICAgICAgICAgICAgICAgaW5kZXggKz0gMjtcbiAgICAgICAgICAgICAgICBzdHIgPSAnLi4uJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ30nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAnKSc6XG4gICAgICAgIGNhc2UgJzsnOlxuICAgICAgICBjYXNlICcsJzpcbiAgICAgICAgY2FzZSAnWyc6XG4gICAgICAgIGNhc2UgJ10nOlxuICAgICAgICBjYXNlICc6JzpcbiAgICAgICAgY2FzZSAnPyc6XG4gICAgICAgIGNhc2UgJ34nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAvLyA0LWNoYXJhY3RlciBwdW5jdHVhdG9yLlxuICAgICAgICAgICAgc3RyID0gc291cmNlLnN1YnN0cihpbmRleCwgNCk7XG4gICAgICAgICAgICBpZiAoc3RyID09PSAnPj4+PScpIHtcbiAgICAgICAgICAgICAgICBpbmRleCArPSA0O1xuICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgIC8vIDMtY2hhcmFjdGVyIHB1bmN0dWF0b3JzLlxuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMyk7XG4gICAgICAgICAgICAgICAgaWYgKHN0ciA9PT0gJz09PScgfHwgc3RyID09PSAnIT09JyB8fCBzdHIgPT09ICc+Pj4nIHx8XG4gICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw8PScgfHwgc3RyID09PSAnPj49Jykge1xuICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAzO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gMi1jaGFyYWN0ZXIgcHVuY3R1YXRvcnMuXG4gICAgICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdHIgPT09ICcmJicgfHwgc3RyID09PSAnfHwnIHx8IHN0ciA9PT0gJz09JyB8fCBzdHIgPT09ICchPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJys9JyB8fCBzdHIgPT09ICctPScgfHwgc3RyID09PSAnKj0nIHx8IHN0ciA9PT0gJy89JyB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyID09PSAnKysnIHx8IHN0ciA9PT0gJy0tJyB8fCBzdHIgPT09ICc8PCcgfHwgc3RyID09PSAnPj4nIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgPT09ICcmPScgfHwgc3RyID09PSAnfD0nIHx8IHN0ciA9PT0gJ149JyB8fCBzdHIgPT09ICclPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw9JyB8fCBzdHIgPT09ICc+PScgfHwgc3RyID09PSAnPT4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAyO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxLWNoYXJhY3RlciBwdW5jdHVhdG9ycy5cbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzw+PSErLSolJnxeLycuaW5kZXhPZihzdHIpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4ID09PSB0b2tlbi5zdGFydCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRva2VuLmVuZCA9IGluZGV4O1xuICAgICAgICB0b2tlbi52YWx1ZSA9IHN0cjtcbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIC8vIDcuOC4zIE51bWVyaWMgTGl0ZXJhbHNcblxuICAgIGZ1bmN0aW9uIHNjYW5IZXhMaXRlcmFsKHN0YXJ0KSB7XG4gICAgICAgIHZhciBudW1iZXIgPSAnJztcblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGlmICghaXNIZXhEaWdpdChzb3VyY2VbaW5kZXhdKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChudW1iZXIubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VJbnQoJzB4JyArIG51bWJlciwgMTYpLFxuICAgICAgICAgICAgbGluZU51bWJlcjogbGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5CaW5hcnlMaXRlcmFsKHN0YXJ0KSB7XG4gICAgICAgIHZhciBjaCwgbnVtYmVyO1xuXG4gICAgICAgIG51bWJlciA9ICcnO1xuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKGNoICE9PSAnMCcgJiYgY2ggIT09ICcxJykge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChudW1iZXIubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAvLyBvbmx5IDBiIG9yIDBCXG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KTtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICAgICAgICBpZiAoaXNJZGVudGlmaWVyU3RhcnQoY2gpIHx8IGlzRGVjaW1hbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VJbnQobnVtYmVyLCAyKSxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuT2N0YWxMaXRlcmFsKHByZWZpeCwgc3RhcnQpIHtcbiAgICAgICAgdmFyIG51bWJlciwgb2N0YWw7XG5cbiAgICAgICAgaWYgKGlzT2N0YWxEaWdpdChwcmVmaXgpKSB7XG4gICAgICAgICAgICBvY3RhbCA9IHRydWU7XG4gICAgICAgICAgICBudW1iZXIgPSAnMCcgKyBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvY3RhbCA9IGZhbHNlO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIG51bWJlciA9ICcnO1xuICAgICAgICB9XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAoIWlzT2N0YWxEaWdpdChzb3VyY2VbaW5kZXhdKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgfVx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pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWlzT2N0YWxEaWdpdChjaCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5OdW1lcmljTGl0ZXJhbCgpIHtcbiAgICAgICAgdmFyIG51bWJlciwgc3RhcnQsIGNoO1xuXG4gICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgYXNzZXJ0KGlzRGVjaW1hbERpZ2l0KGNoLmNoYXJDb2RlQXQoMCkpIHx8IChjaCA9PT0gJy4nKSxcbiAgICAgICAgICAgICdOdW1lcmljIGxpdGVyYWwgbXVzdCBzdGFydCB3aXRoIGEgZGVjaW1hbCBkaWdpdCBvciBhIGRlY2ltYWwgcG9pbnQnKTtcblxuICAgICAgICBzdGFydCA9IGluZGV4O1xuICAgICAgICBudW1iZXIgPSAnJztcbiAgICAgICAgaWYgKGNoICE9PSAnLicpIHtcbiAgICAgICAgICAgIG51bWJlciA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcblxuICAgICAgICAgICAgLy8gSGV4IG51bWJlciBzdGFydHMgd2l0aCAnMHgnLlxuICAgICAgICAgICAgLy8gT2N0YWwgbnVtYmVyIHN0YXJ0cyB3aXRoICcwJy5cbiAgICAgICAgICAgIC8vIE9jdGFsIG51bWJlciBpbiBFUzYgc3RhcnRzIHdpdGggJzBvJy5cbiAgICAgICAgICAgIC8vIEJpbmFyeSBudW1iZXIgaW4gRVM2IHN0YXJ0cyB3aXRoICcwYicuXG4gICAgICAgICAgICBpZiAobnVtYmVyID09PSAnMCcpIHtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd4JyB8fCBjaCA9PT0gJ1gnKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuSGV4TGl0ZXJhbChzdGFydCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ2InIHx8IGNoID09PSAnQicpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5CaW5hcnlMaXRlcmFsKHN0YXJ0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAnbycgfHwgY2ggPT09ICdPJykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Nhbk9jdGFsTGl0ZXJhbChjaCwgc3RhcnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChpc09jdGFsRGlnaXQoY2gpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0ltcGxpY2l0T2N0YWxMaXRlcmFsKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuT2N0YWxMaXRlcmFsKGNoLCBzdGFydCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHdoaWxlIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjaCA9PT0gJy4nKSB7XG4gICAgICAgICAgICBudW1iZXIgKz0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgd2hpbGUgKGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgICAgICBudW1iZXIgKz0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNoID09PSAnZScgfHwgY2ggPT09ICdFJykge1xuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcblxuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKGNoID09PSAnKycgfHwgY2ggPT09ICctJykge1xuICAgICAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaXNEZWNpbWFsRGlnaXQoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpKSkge1xuICAgICAgICAgICAgICAgIHdoaWxlIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uTnVtZXJpY0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogcGFyc2VGbG9hdChudW1iZXIpLFxuICAgICAgICAgICAgbGluZU51bWJlcjogbGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuICAgIH1cblxuICAgIC8vIDcuOC40IFN0cmluZyBMaXRlcmFsc1xuXG4gICAgZnVuY3Rpb24gc2NhblN0cmluZ0xpdGVyYWwoKSB7XG4gICAgICAgIHZhciBzdHIgPSAnJywgcXVvdGUsIHN0YXJ0LCBjaCwgdW5lc2NhcGVkLCBvY3RUb0RlYywgb2N0YWwgPSBmYWxzZTtcblxuICAgICAgICBxdW90ZSA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIGFzc2VydCgocXVvdGUgPT09ICdcXCcnIHx8IHF1b3RlID09PSAnXCInKSxcbiAgICAgICAgICAgICdTdHJpbmcgbGl0ZXJhbCBtdXN0IHN0YXJ0cyB3aXRoIGEgcXVvdGUnKTtcblxuICAgICAgICBzdGFydCA9IGluZGV4O1xuICAgICAgICArK2luZGV4O1xuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG5cbiAgICAgICAgICAgIGlmIChjaCA9PT0gcXVvdGUpIHtcbiAgICAgICAgICAgICAgICBxdW90ZSA9ICcnO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xcXFwnKSB7XG4gICAgICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICAgICAgaWYgKCFjaCB8fCAhaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICd4JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmVzY2FwZWQgPSBzY2FuSGV4RXNjYXBlKGNoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXVuZXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gdW5lc2NhcGVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ24nOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXG4nO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3InOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3QnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHQnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2InOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXGInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2YnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXGYnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3YnOlxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXHgwQic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnOCc6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJzknOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcblxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzT2N0YWxEaWdpdChjaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvY3RUb0RlYyA9IG9jdGFsVG9EZWNpbWFsKGNoKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9jdGFsID0gb2N0VG9EZWMub2N0YWwgfHwgb2N0YWw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9IFN0cmluZy5mcm9tQ2hhckNvZGUob2N0VG9EZWMuY29kZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICdcXHInICYmIHNvdXJjZVtpbmRleF0gPT09ICdcXG4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGxpbmVTdGFydCA9IGluZGV4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzdHIgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocXVvdGUgIT09ICcnKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IFRva2VuLlN0cmluZ0xpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogc3RyLFxuICAgICAgICAgICAgb2N0YWw6IG9jdGFsLFxuICAgICAgICAgICAgbGluZU51bWJlcjogc3RhcnRMaW5lTnVtYmVyLFxuICAgICAgICAgICAgbGluZVN0YXJ0OiBzdGFydExpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuVGVtcGxhdGUoKSB7XG4gICAgICAgIHZhciBjb29rZWQgPSAnJywgY2gsIHN0YXJ0LCByYXdPZmZzZXQsIHRlcm1pbmF0ZWQsIGhlYWQsIHRhaWwsIHJlc3RvcmUsIHVuZXNjYXBlZDtcblxuICAgICAgICB0ZXJtaW5hdGVkID0gZmFsc2U7XG4gICAgICAgIHRhaWwgPSBmYWxzZTtcbiAgICAgICAgc3RhcnQgPSBpbmRleDtcbiAgICAgICAgaGVhZCA9IChzb3VyY2VbaW5kZXhdID09PSAnYCcpO1xuICAgICAgICByYXdPZmZzZXQgPSAyO1xuXG4gICAgICAgICsraW5kZXg7XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJ2AnKSB7XG4gICAgICAgICAgICAgICAgcmF3T2Zmc2V0ID0gMTtcbiAgICAgICAgICAgICAgICB0YWlsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICckJykge1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY3VybHlTdGFjay5wdXNoKCckeycpO1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvb2tlZCArPSBjaDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcXFxcJykge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgICAgIGlmICghaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ24nOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3InOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3QnOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHQnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICd4JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5lc2NhcGVkID0gc2NhbkhleEVzY2FwZShjaCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVuZXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29rZWQgKz0gdW5lc2NhcGVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcmVzdG9yZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdiJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxiJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdmJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxmJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICd2JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFx2JztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICcwJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMDEgXFwwMiBhbmQgc28gb25cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihNZXNzYWdlcy5UZW1wbGF0ZU9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFwwJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNPY3RhbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMSBcXDJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLlRlbXBsYXRlT2N0YWxMaXRlcmFsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICArK2xpbmVOdW1iZXI7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb29rZWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhlYWQpIHtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uVGVtcGxhdGUsXG4gICAgICAgICAgICB2YWx1ZToge1xuICAgICAgICAgICAgICAgIGNvb2tlZDogY29va2VkLFxuICAgICAgICAgICAgICAgIHJhdzogc291cmNlLnNsaWNlKHN0YXJ0ICsgMSwgaW5kZXggLSByYXdPZmZzZXQpXG4gICA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HRlcm4gdGhhdCBpcyBlcXVpdmFsZW50IHRvIGBbYS1iXWAsIGJ1dCBpdFxuICAgICAgICAgICAgLy8gd291bGQgYmUgcmVwbGFjZWQgYnkgYFt4LWJdYCB3aGljaCB0aHJvd3MgYW4gZXJyb3IuXG4gICAgICAgICAgICB0bXAgPSB0bXBcbiAgICAgICAgICAgICAgICAucmVwbGFjZSgvXFxcXHVcXHsoWzAtOWEtZkEtRl0rKVxcfS9nLCBmdW5jdGlvbiAoJDAsICQxKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwYXJzZUludCgkMSwgMTYpIDw9IDB4MTBGRkZGKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3gnO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLkludmFsaWRSZWdFeHApO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoXG4gICAgICAgICAgICAgICAgICAgIC9cXFxcdShbYS1mQS1GMC05XXs0fSl8W1xcdUQ4MDAtXFx1REJGRl1bXFx1REMwMC1cXHVERkZGXS9nLFxuICAgICAgICAgICAgICAgICAgICAneCdcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gRmlyc3QsIGRldGVjdCBpbnZhbGlkIHJlZ3VsYXIgZXhwcmVzc2lvbnMuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBSZWdFeHAodG1wKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obnVsbCwgTWVzc2FnZXMuSW52YWxpZFJlZ0V4cCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBSZXR1cm4gYSByZWd1bGFyIGV4cHJlc3Npb24gb2JqZWN0IGZvciB0aGlzIHBhdHRlcm4tZmxhZyBwYWlyLCBvclxuICAgICAgICAvLyBgbnVsbGAgaW4gY2FzZSB0aGUgY3VycmVudCBlbnZpcm9ubWVudCBkb2Vzbid0IHN1cHBvcnQgdGhlIGZsYWdzIGl0XG4gICAgICAgIC8vIHVzZXMuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IFJlZ0V4cChwYXR0ZXJuLCBmbGFncyk7XG4gICAgICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbikge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuUmVnRXhwQm9keSgpIHtcbiAgICAgICAgdmFyIGNoLCBzdHIsIGNsYXNzTWFya2VyLCB0ZXJtaW5hdGVkLCBib2R5O1xuXG4gICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgYXNzZXJ0KGNoID09PSAnLycsICdSZWd1bGFyIGV4cHJlc3Npb24gbGl0ZXJhbCBtdXN0IHN0YXJ0IHdpdGggYSBzbGFzaCcpO1xuICAgICAgICBzdHIgPSBzb3VyY2VbaW5kZXgrK107XG5cbiAgICAgICAgY2xhc3NNYXJrZXIgPSBmYWxzZTtcbiAgICAgICAgdGVybWluYXRlZCA9IGZhbHNlO1xuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgc3RyICs9IGNoO1xuICAgICAgICAgICAgaWYgKGNoID09PSAnXFxcXCcpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAvLyBFQ01BLTI2MiA3LjguNVxuICAgICAgICAgICAgICAgIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLlVudGVybWluYXRlZFJlZ0V4cCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLlVudGVybWluYXRlZFJlZ0V4cCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNsYXNzTWFya2VyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAnXScpIHtcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NNYXJrZXIgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJy8nKSB7XG4gICAgICAgICAgICAgICAgICAgIHRlcm1pbmF0ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnWycpIHtcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NNYXJrZXIgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghdGVybWluYXRlZCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obnVsbCwgTWVzc2FnZXMuVW50ZXJtaW5hdGVkUmVnRXhwKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEV4Y2x1ZGUgbGVhZGluZyBhbmQgdHJhaWxpbmcgc2xhc2guXG4gICAgICAgIGJvZHkgPSBzdHIuc3Vic3RyKDEsIHN0ci5sZW5ndGggLSAyKTtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBib2R5LFxuICAgICAgICAgICAgbGl0ZXJhbDogc3RyXG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2NhblJlZ0V4cEZsYWdzKCkge1xuICAgICAgICB2YXIgY2gsIHN0ciwgZmxhZ3MsIHJlc3RvcmU7XG5cbiAgICAgICAgc3RyID0gJyc7XG4gICAgICAgIGZsYWdzID0gJyc7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICAgICAgaWYgKCFpc0lkZW50aWZpZXJQYXJ0KGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBpZiAoY2ggPT09ICdcXFxcJyAmJiBpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd1Jykge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICByZXN0b3JlID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIGNoID0gc2NhbkhleEVzY2FwZSgndScpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzdHIgKz0gJ1xcXFx1JzsgcmVzdG9yZSA8IGluZGV4OyArK3Jlc3RvcmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gc291cmNlW3Jlc3RvcmVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSByZXN0b3JlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgKz0gJ3UnO1xuICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXFxcdSc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcXFwnO1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZmxhZ3MgKz0gY2g7XG4gICAgICAgICAgICAgICAgc3RyICs9IGNoO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBmbGFncyxcbiAgICAgICAgICAgIGxpdGVyYWw6IHN0clxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5SZWdFeHAoKSB7XG4gICAgICAgIHNjYW5uaW5nID0gdHJ1ZTtcbiAgICAgICAgdmFyIHN0YXJ0LCBib2R5LCBmbGFncywgdmFsdWU7XG5cbiAgICAgICAgbG9va2FoZWFkID0gbnVsbDtcbiAgICAgICAgc2tpcENvbW1lbnQoKTtcbiAgICAgICAgc3RhcnQgPSBpbmRleDtcblxuICAgICAgICBib2R5ID0gc2NhblJlZ0V4cEJvZHkoKTtcbiAgICAgICAgZmxhZ3MgPSBzY2FuUmVnRXhwRmxhZ3MoKTtcbiAgICAgICAgdmFsdWUgPSB0ZXN0UmVnRXhwKGJvZHkudmFsdWUsIGZsYWdzLnZhbHVlKTtcbiAgICAgICAgc2Nhbm5pbmcgPSBmYWxzZTtcbiAgICAgICAgaWYgKGV4dHJhLnRva2VuaXplKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuLlJlZ3VsYXJFeHByZXNzaW9uLFxuICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICByZWdleDoge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiBib2R5LnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogZmxhZ3MudmFsdWVcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0OiBsaW5lU3RhcnQsXG4gICAgICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgbGl0ZXJhbDogYm9keS5saXRlcmFsICsgZmxhZ3MubGl0ZXJhbCxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgIHJlZ2V4OiB7XG4gICAgICAgICAgICAgICAgcGF0dGVybjogYm9keS52YWx1ZSxcbiAgICAgICAgICAgICAgICBmbGFnczogZmxhZ3MudmFsdWVcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY29sbGVjdFJlZ2V4KCkge1xuICAgICAgICB2YXIgcG9zLCBsb2MsIHJlZ2V4LCB0b2tlbjtcblxuICAgICAgICBza2lwQ29tbWVudCgpO1xuXG4gICAgICAgIHBvcyA9IGluZGV4O1xuICAgICAgICBsb2MgPSB7XG4gICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIHJlZ2V4ID0gc2NhblJlZ0V4cCgpO1xuXG4gICAgICAgIGxvYy5lbmQgPSB7XG4gICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICB9O1xuXG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgIGlmICghZXh0cmEudG9rZW5pemUpIHtcbiAgICAgICAgICAgIC8vIFBvcCB0aGUgcHJldmlvdXMgdG9rZW4sIHdoaWNoIGlzIGxpa2VseSAnLycgb3IgJy89J1xuICAgICAgICAgICAgaWYgKGV4dHJhLnRva2Vucy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEudG9rZW5zLmxlbmd0aCAtIDFdO1xuICAgICAgICAgICAgICAgIGlmICh0b2tlbi5yYW5nZVswXSA9PT0gcG9zICYmIHRva2VuLnR5cGUgPT09ICdQdW5jdHVhdG9yJykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodG9rZW4udmFsdWUgPT09ICcvJyB8fCB0b2tlbi52YWx1ZSA9PT0gJy89Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmEudG9rZW5zLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHRyYS50b2tlbnMucHVzaCh7XG4gICAgICAgICAgICAgICAgdHlwZTogJ1JlZ3VsYXJFeHByZXNzaW9uJyxcbiAgICAgICAgICAgICAgICB2YWx1ZTogcmVnZXgubGl0ZXJhbCxcbiAgICAgICAgICAgICAgICByZWdleDogcmVnZXgucmVnZXgsXG4gICAgICAgICAgICAgICAgcmFuZ2U6IFtwb3MsIGluZGV4XSxcbiAgICAgICAgICAgICAgICBsb2M6IGxvY1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVnZXg7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gaXNJZGVudGlmaWVyTmFtZSh0b2tlbikge1xuICAgICAgICByZXR1cm4gdG9rZW4udHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllciB8fFxuICAgICAgICAgICAgdG9rZW4udHlwZSA9PT0gVG9rZW4uS2V5d29yZCB8fFxuICAgICAgICAgICAgdG9rZW4udHlwZSA9PT0gVG9rZW4uQm9vbGVhbkxpdGVyYWwgfHxcbiAgICAgICAgICAgIHRva2VuLnR5cGUgPT09IFRva2VuLk51bGxMaXRlcmFsO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGFkdmFuY2VTbGFzaCgpIHtcbiAgICAgICAgdmFyIHByZXZUb2tlbixcbiAgICAgICAgICAgIGNoZWNrVG9rZW47XG4gICAgICAgIC8vIFVzaW5nIHRoZSBmb2xsb3dpbmcgYWxnb3JpdGhtOlxuICAgICAgICAvLyBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zd2VldC5qcy93aWtpL2Rlc2lnblxuICAgICAgICBwcmV2VG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEudG9rZW5zLmxlbmd0aCAtIDFdO1xuICAgICAgICBpZiAoIXByZXZUb2tlbikge1xuICAgICAgICAgICAgLy8gTm90aGluZyBiZWZvcmUgdGhhdDogaXQgY2Fubm90IGJlIGEgZGl2aXNpb24uXG4gICAgICAgICAgICByZXR1cm4gY29sbGVjdFJlZ2V4KCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByZXZUb2tlbi50eXBlID09PSAnUHVuY3R1YXRvcicpIHtcbiAgICAgICAgICAgIGlmIChwcmV2VG9rZW4udmFsdWUgPT09ICddJykge1xuICAgICAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByZXZUb2tlbi52YWx1ZSA9PT0gJyknKSB7XG4gICAgICAgICAgICAgICAgY2hlY2tUb2tlbiA9IGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuUGFyZW5Ub2tlbiAtIDFdO1xuICAgICAgICAgICAgICAgIGlmIChjaGVja1Rva2VuICYmXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnR5cGUgPT09ICdLZXl3b3JkJyAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgKGNoZWNrVG9rZW4udmFsdWUgPT09ICdpZicgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnZhbHVlID09PSAnd2hpbGUnIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tUb2tlbi52YWx1ZSA9PT0gJ2ZvcicgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Rva2VuLnZhbHVlID09PSAnd2l0aCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJldlRva2VuLnZhbHVlID09PSAnfScpIHtcbiAgICAgICAgICAgICAgICAvLyBEaXZpZGluZyBhIGZ1bmN0aW9uIGJ5IGFueXRoaW5nIG1ha2VzIGxpdHRsZSBzZW5zZSxcbiAgICAgICAgICAgICAgICAvLyBidXQgd2UgaGF2ZSB0byBjaGVjayBmb3IgdGhhdC5cbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEudG9rZW5zW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gM10gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDNdLnR5cGUgPT09ICdLZXl3b3JkJykge1xuICAgICAgICAgICAgICAgICAgICAvLyBBbm9ueW1vdXMgZnVuY3Rpb24uXG4gICAgICAgICAgICAgICAgICAgIGNoZWNrVG9rZW4gPSBleHRyYS50b2tlbnNbZXh0cmEub3BlbkN1cmx5VG9rZW4gLSA0XTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFjaGVja1Rva2VuKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NhblB1bmN0dWF0b3IoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXh0cmEudG9rZW5zW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gNF0gJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDRdLnR5cGUgPT09ICdLZXl3b3JkJykge1xuICAgICAgICAgICAgICAgICAgICAvLyBOYW1lZCBmdW5jdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgY2hlY2tUb2tlbiA9IGV4dHJhLnRva2Vuc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDVdO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWNoZWNrVG9rZW4pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjaGVja1Rva2VuIGRldGVybWluZXMgd2hldGhlciB0aGUgZnVuY3Rpb24gaXNcbiAgICAgICAgICAgICAgICAvLyBhIGRlY2xhcmF0aW9uIG9yIGFuIGV4cHJlc3Npb24uXG4gICAgICAgICAgICAgICAgaWYgKEZuRXhwclRva2Vucy5pbmRleE9mKGNoZWNrVG9rZW4udmFsdWUpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gSXQgaXMgYW4gZXhwcmVzc2lvbi5cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIEl0IGlzIGEgZGVjbGFyYXRpb24uXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvbGxlY3RSZWdleCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGNvbGxlY3RSZWdleCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcmV2VG9rZW4udHlwZSA9PT0gJ0tleXdvcmQnICYmIHByZXZUb2tlbi52YWx1ZSAhPT0gJ3RoaXMnKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sbGVjdFJlZ2V4KCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gYWR2YW5jZSgpIHtcbiAgICAgICAgdmFyIGNoLCB0b2tlbjtcblxuICAgICAgICBpZiAoaW5kZXggPj0gbGVuZ3RoKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuLkVPRixcbiAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgICAgIHN0YXJ0OiBpbmRleCxcbiAgICAgICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KGNoKSkge1xuICAgICAgICAgICAgdG9rZW4gPSBzY2FuSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4udHlwZSA9IFRva2VuLktleXdvcmQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdG9rZW47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBWZXJ5IGNvbW1vbjogKCBhbmQgKSBhbmQgO1xuICAgICAgICBpZiAoY2ggPT09IDB4MjggfHwgY2ggPT09IDB4MjkgfHwgY2ggPT09IDB4M0IpIHtcbiAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gU3RyaW5nIGxpdGVyYWwgc3RhcnRzIHdpdGggc2luZ2xlIHF1b3RlIChVKzAwMjcpIG9yIGRvdWJsZSBxdW90ZSAoVSswMDIyKS5cbiAgICAgICAgaWYgKGNoID09PSAweDI3IHx8IGNoID09PSAweDIyKSB7XG4gICAgICAgICAgICByZXR1cm4gc2NhblN0cmluZ0xpdGVyYWwoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIERvdCAoLikgVSswMDJFIGNhbiBhbHNvIHN0YXJ0IGEgZmxvYXRpbmctcG9pbnQgbnVtYmVyLCBoZW5jZSB0aGUgbmVlZFxuICAgICAgICAvLyB0byBjaGVjayB0aGUgbmV4dCBjaGFyYWN0ZXIuXG4gICAgICAgIGlmIChjaCA9PT0gMHgyRSkge1xuICAgICAgICAgICAgaWYgKGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5OdW1lcmljTGl0ZXJhbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNEZWNpbWFsRGlnaXQoY2gpKSB7XG4gICAgICAgICAgICByZXR1cm4gc2Nhbk51bWVyaWNMaXRlcmFsKCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBTbGFzaCAoLykgVSswMDJGIGNhbiBhbHNvIHN0YXJ0IGEgcmVnZXguXG4gICAgICAgIGlmIChleHRyYS50b2tlbml6ZSAmJiBjaCA9PT0gMHgyRikge1xuICAgICAgICAgICAgcmV0dXJuIGFkdmFuY2VTbGFzaCgpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gVGVtcGxhdGUgbGl0ZXJhbHMgc3RhcnQgd2l0aCBgIChVKzAwNjApIGZvciB0ZW1wbGF0ZSBoZWFkXG4gICAgICAgIC8vIG9yIH0gKFUrMDA3RCkgZm9yIHRlbXBsYXRlIG1pZGRsZSBvciB0ZW1wbGF0ZSB0YWlsLlxuICAgICAgICBpZiAoY2ggPT09IDB4NjAgfHwgKGNoID09PSAweDdEICYmIHN0YXRlLmN1cmx5U3RhY2tbc3RhdGUuY3VybHlTdGFjay5sZW5ndGggLSAxXSA9PT0gJyR7JykpIHtcbiAgICAgICAgICAgIHJldHVybiBzY2FuVGVtcGxhdGUoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbGxlY3RUb2tlbigpIHtcbiAgICAgICAgdmFyIGxvYywgdG9rZW4sIHZhbHVlLCBlbnRyeTtcblxuICAgICAgICBsb2MgPSB7XG4gICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydFxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIHRva2VuID0gYWR2YW5jZSgpO1xuICAgICAgICBsb2MuZW5kID0ge1xuICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgfTtcblxuICAgICAgICBpZiAodG9rZW4udHlwZSAhPT0gVG9rZW4uRU9GKSB7XG4gICAgICAgICAgICB2YWx1ZSA9IHNvdXJjZS5zbGljZSh0b2tlbi5zdGFydCwgdG9rZW4uZW5kKTtcbiAgICAgICAgICAgIGVudHJ5ID0ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuTmFtZVt0b2tlbi50eXBlXSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogdmFsdWUsXG4gICAgICAgICAgICAgICAgcmFuZ2U6IFt0b2tlbi5zdGFydCwgdG9rZW4uZW5kXSxcbiAgICAgICAgICAgICAgICBsb2M6IGxvY1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmICh0b2tlbi5yZWdleCkge1xuICAgICAgICAgICAgICAgIGVudHJ5LnJlZ2V4ID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiB0b2tlbi5yZWdleC5wYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogdG9rZW4ucmVnZXguZmxhZ3NcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXh0cmEudG9rZW5zLnB1c2goZW50cnkpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGxleCgpIHtcbiAgICAgICAgdmFyIHRva2VuO1xuICAgICAgICBzY2FubmluZyA9IHRydWU7XG5cbiAgICAgICAgbGFzdEluZGV4ID0gaW5kZXg7XG4gICAgICAgIGxhc3RMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgbGFzdExpbmVTdGFydCA9IGxpbmVTdGFydDtcblxuICAgICAgICBza2lwQ29tbWVudCgpO1xuXG4gICAgICAgIHRva2VuID0gbG9va2FoZWFkO1xuXG4gICAgICAgIHN0YXJ0SW5kZXggP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b3NpdGlvbigpO1xuICAgICAgICB0aGlzLmVuZCA9IG51bGw7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gV3JhcHBpbmdTb3VyY2VMb2NhdGlvbihzdGFydFRva2VuKSB7XG4gICAgICAgIHRoaXMuc3RhcnQgPSB7XG4gICAgICAgICAgICBsaW5lOiBzdGFydFRva2VuLmxpbmVOdW1iZXIsXG4gICAgICAgICAgICBjb2x1bW46IHN0YXJ0VG9rZW4uc3RhcnQgLSBzdGFydFRva2VuLmxpbmVTdGFydFxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmVuZCA9IG51bGw7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gTm9kZSgpIHtcbiAgICAgICAgaWYgKGV4dHJhLnJhbmdlKSB7XG4gICAgICAgICAgICB0aGlzLnJhbmdlID0gW3N0YXJ0SW5kZXgsIDBdO1xuICAgICAgICB9XG4gICAgICAgIGlmIChleHRyYS5sb2MpIHtcbiAgICAgICAgICAgIHRoaXMubG9jID0gbmV3IFNvdXJjZUxvY2F0aW9uKCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikge1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIHRoaXMucmFuZ2UgPSBbc3RhcnRUb2tlbi5zdGFydCwgMF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgdGhpcy5sb2MgPSBuZXcgV3JhcHBpbmdTb3VyY2VMb2NhdGlvbihzdGFydFRva2VuKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFdyYXBwaW5nTm9kZS5wcm90b3R5cGUgPSBOb2RlLnByb3RvdHlwZSA9IHtcblxuICAgICAgICBwcm9jZXNzQ29tbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGxhc3RDaGlsZCxcbiAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMsXG4gICAgICAgICAgICAgICAgdHJhaWxpbmdDb21tZW50cyxcbiAgICAgICAgICAgICAgICBib3R0b21SaWdodCA9IGV4dHJhLmJvdHRvbVJpZ2h0U3RhY2ssXG4gICAgICAgICAgICAgICAgaSxcbiAgICAgICAgICAgICAgICBjb21tZW50LFxuICAgICAgICAgICAgICAgIGxhc3QgPSBib3R0b21SaWdodFtib3R0b21SaWdodC5sZW5ndGggLSAxXTtcblxuICAgICAgICAgICAgaWYgKHRoaXMudHlwZSA9PT0gU3ludGF4LlByb2dyYW0pIHtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5ib2R5Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGV4dHJhLnRyYWlsaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRyYWlsaW5nQ29tbWVudHMgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSBleHRyYS50cmFpbGluZ0NvbW1lbnRzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbW1lbnQgPSBleHRyYS50cmFpbGluZ0NvbW1lbnRzW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVswXSA+PSB0aGlzLnJhbmdlWzFdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzLnVuc2hpZnQoY29tbWVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChsYXN0ICYmIGxhc3QudHJhaWxpbmdDb21tZW50cyAmJiBsYXN0LnRyYWlsaW5nQ29tbWVudHNbMF0ucmFuZ2VbMF0gPj0gdGhpcy5yYW5nZVsxXSkge1xuICAgICAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzID0gbGFzdC50cmFpbGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgbGFzdC50cmFpbGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gRWF0aW5nIHRoZSBzdGFjay5cbiAgICAgICAgICAgIGlmIChsYXN0KSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKGxhc3QgJiYgbGFzdC5yYW5nZVswXSA+PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgIGxhc3RDaGlsZCA9IGxhc3Q7XG4gICAgICAgICAgICAgICAgICAgIGxhc3QgPSBib3R0b21SaWdodC5wb3AoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChsYXN0Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICBpZiAobGFzdENoaWxkLmxlYWRpbmdDb21tZW50cyAmJiBsYXN0Q2hpbGQubGVhZGluZ0NvbW1lbnRzW2xhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHMubGVuZ3RoIC0gMV0ucmFuZ2VbMV0gPD0gdGhpcy5yYW5nZVswXSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxlYWRpbmdDb21tZW50cyA9IGxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHM7XG4gICAgICAgICAgICAgICAgICAgIGxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHMgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChleHRyYS5sZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGxlYWRpbmdDb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGZvciAoaSA9IGV4dHJhLmxlYWRpbmdDb21tZW50cy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gZXh0cmEubGVhZGluZ0NvbW1lbnRzW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVsxXSA8PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMudW5zaGlmdChjb21tZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgaWYgKGxlYWRpbmdDb21tZW50cyAmJiBsZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubGVhZGluZ0NvbW1lbnRzID0gbGVhZGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRyYWlsaW5nQ29tbWVudHMgJiYgdHJhaWxpbmdDb21tZW50cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy50cmFpbGluZ0NvbW1lbnRzID0gdHJhaWxpbmdDb21tZW50cztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYm90dG9tUmlnaHQucHVzaCh0aGlzKTtcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2g6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmIChleHRyYS5yYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMucmFuZ2VbMV0gPSBsYXN0SW5kZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEubG9jKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2MuZW5kID0ge1xuICAgICAgICAgICAgICAgICAgICBsaW5lOiBsYXN0TGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uOiBsYXN0SW5kZXggLSBsYXN0TGluZVN0YXJ0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuc291cmNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9jLnNvdXJjZSA9IGV4dHJhLnNvdXJjZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChleHRyYS5hdHRhY2hDb21tZW50KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzQ29tbWVudCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5RXhwcmVzc2lvbjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5UGF0dGVybjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlQYXR0ZXJuO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycm93RnVuY3Rpb25FeHByZXNzaW9uOiBmdW5jdGlvbiAocGFyYW1zLCBkZWZhdWx0cywgYm9keSwgZXhwcmVzc2lvbikge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFycm93RnVuY3Rpb25FeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50RXhwcmVzc2lvbjogZnVuY3Rpb24gKG9wZXJhdG9yLCBsZWZ0LCByaWdodCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFzc2lnbm1lbnRFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5vcGVyYXRvciA9IG9wZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5sZWZ0ID0gbGVmdDtcbiAgICAgICAgICAgIHRoaXMucmlnaHQgPSByaWdodDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50UGF0dGVybjogZnVuY3Rpb24gKGxlZnQsIHJpZ2h0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXNzaWdubWVudFBhdHRlcm47XG4gICAgICAgICAgICB0aGlzLmxlZnQgPSBsZWZ0O1xuICAgICAgICAgICAgdGhpcy5yaWdodCA9IHJpZ2h0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJpbmFyeUV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgbGVmdCwgcmlnaHQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IChvcGVyYXRvciA9PT0gJ3x8JyB8fCBvcGVyYXRvciA9PT0gJyYmJykgPyBTeW50YXguTG9naWNhbEV4cHJlc3Npb24gOiBTeW50YXguQmluYXJ5RXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMub3BlcmF0b3IgPSBvcGVyYXRvcjtcbiAgICAgICAgICAgIHRoaXMubGVmdCA9IGxlZnQ7XG4gICAgICAgICAgICB0aGlzLnJpZ2h0ID0gcmlnaHQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQmxvY2tTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQmxvY2tTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmJvZHkgPSBib2R5O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJyZWFrU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5CcmVha1N0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDYWxsRXhwcmVzc2lvbjogZnVuY3Rpb24gKGNhbGxlZSwgYXJncykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhbGxFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5jYWxsZWUgPSBjYWxsZWU7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50cyA9IGFyZ3M7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2F0Y2hDbGF1c2U6IGZ1bmN0aW9uIChwYXJhbSwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhdGNoQ2xhdXNlO1xuICAgICAgICAgICAgdGhpcy5wYXJhbSA9IHBhcmFtO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0JvZHk6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQ2xhc3NCb2R5O1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0RlY2xhcmF0aW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0RlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IGlkO1xuICAgICAgICAgICAgdGhpcy5zdXBlckNsYXNzID0gc3VwZXJDbGFzcztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2xhc3NFeHByZXNzaW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0V4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnN1cGVyQ2xhc3MgPSBzdXBlckNsYXNzO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDb25kaXRpb25hbEV4cHJlc3Npb246IGZ1bmN0aW9uICh0ZXN0LCBjb25zZXF1ZW50LCBhbHRlcm5hdGUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db25kaXRpb25hbEV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5jb25zZXF1ZW50ID0gY29uc2VxdWVudDtcbiAgICAgICAgICAgIHRoaXMuYWx0ZXJuYXRlID0gYWx0ZXJuYXRlO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaENvbnRpbnVlU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db250aW51ZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hEZWJ1Z2dlclN0YXRlbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkRlYnVnZ2VyU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaERvV2hpbGVTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5LCB0ZXN0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRG9XaGlsZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEVtcHR5U3RhdGVtZW50OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRW1wdHlTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwcmVzc2lvblN0YXRlbWVudDogZnVuY3Rpb24gKGV4cHJlc3Npb24pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHByZXNzaW9uU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW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IHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRnVuY3Rpb25FeHByZXNzaW9uOiBmdW5jdGlvbiAoaWQsIHBhcmFtcywgZGVmYXVsdHMsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5GdW5jdGlvbkV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSWRlbnRpZmllcjogZnVuY3Rpb24gKG5hbWUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JZGVudGlmaWVyO1xuICAgICAgICAgICAgdGhpcy5uYW1lID0gbmFtZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJZlN0YXRlbWVudDogZnVuY3Rpb24gKHRlc3QsIGNvbnNlcXVlbnQsIGFsdGVybmF0ZSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LklmU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMuY29uc2VxdWVudCA9IGNvbnNlcXVlbnQ7XG4gICAgICAgICAgICB0aGlzLmFsdGVybmF0ZSA9IGFsdGVybmF0ZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMYWJlbGVkU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MYWJlbGVkU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5sYWJlbCA9IGxhYmVsO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMaXRlcmFsOiBmdW5jdGlvbiAodG9rZW4pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MaXRlcmFsO1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHRva2VuLnZhbHVlO1xuICAgICAgICAgICAgdGhpcy5yYXcgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQsIHRva2VuLmVuZCk7XG4gICAgICAgICAgICBpZiAodG9rZW4ucmVnZXgpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZ2V4ID0gdG9rZW4ucmVnZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTWVtYmVyRXhwcmVzc2lvbjogZnVuY3Rpb24gKGFjY2Vzc29yLCBvYmplY3QsIHByb3BlcnR5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguTWVtYmVyRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuY29tcHV0ZWQgPSBhY2Nlc3NvciA9PT0gJ1snO1xuICAgICAgICAgICAgdGhpcy5vYmplY3QgPSBvYmplY3Q7XG4gICAgICAgICAgICB0aGlzLnByb3BlcnR5ID0gcHJvcGVydHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTmV3RXhwcmVzc2lvbjogZnVuY3Rpb24gKGNhbGxlZSwgYXJncykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4Lk5ld0V4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmNhbGxlZSA9IGNhbGxlZTtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnRzID0gYXJncztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hPYmplY3RFeHByZXNzaW9uOiBmdW5jdGlvbiAocHJvcGVydGllcykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4Lk9iamVjdEV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLnByb3BlcnRpZXMgPSBwcm9wZXJ0aWVzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaE9iamVjdFBhdHRlcm46IGZ1bmN0aW9uIChwcm9wZXJ0aWVzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguT2JqZWN0UGF0dGVybjtcbiAgICAgICAgICAgIHRoaXMucHJvcGVydGllcyA9IHByb3BlcnRpZXM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoUG9zdGZpeEV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5VcGRhdGVFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5vcGVyYXRvciA9IG9wZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5hcmd1bWVudCA9IGFyZ3VtZW50O1xuICAgICAgICAgICAgdGhpcy5wcmVmaXggPSBmYWxzZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hQcm9ncmFtOiBmdW5jdGlvbiAoYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlByb2dyYW07XG4gICAgICAgICAgICB0aGlzLmJvZHkgPSBib2R5O1xuICAgICAgICAgICAgaWYgKHNvdXJjZVR5cGUgPT09ICdtb2R1bGUnKSB7XG4gICAgICAgICAgICAgICAgLy8gdmVyeSByZXN0cmljdGl2ZSBmb3Igbm93XG4gICAgICAgICAgICAgICAgdGhpcy5zb3VyY2VUeXBlID0gc291cmNlVHlwZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hQcm9wZXJ0eTogZnVuY3Rpb24gKGtpbmQsIGtleSwgY29tcHV0ZWQsIHZhbHVlLCBtZXRob2QsIHNob3J0aGFuZCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlByb3BlcnR5O1xuICAgICAgICAgICAgdGhpcy5rZXkgPSBrZXk7XG4gICAgICAgICAgICB0aGlzLmNvbXB1dGVkID0gY29tcHV0ZWQ7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG4gICAgICAgICAgICB0aGlzLmtpbmQgPSBraW5kO1xuICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBtZXRob2Q7XG4gICAgICAgICAgICB0aGlzLnNob3J0aGFuZCA9IHNob3J0aGFuZDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hSZXN0RWxlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguUmVzdEVsZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoUmV0dXJuU3RhdGVtZW50OiBmdW5jdGlvbiAoYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5SZXR1cm5TdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uOiBmdW5jdGlvbiAoZXhwcmVzc2lvbnMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5TZXF1ZW5jZUV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmV4cHJlc3Npb25zID0gZXhwcmVzc2lvbnM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoU3ByZWFkRWxlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguU3ByZWFkRWxlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hTd2l0Y2hDYXNlOiBmdW5jdGlvbiAodGVzdCwgY29uc2VxdWVudCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlN3aXRjaENhc2U7XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5jb25zZXF1ZW50ID0gY29uc2VxdWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hTdXBlcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlN1cGVyO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFN3aXRjaFN0YXRlbWVudDogZnVuY3Rpb24gKGRpc2NyaW1pbmFudCwgY2FzZXMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Td2l0Y2hTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmRpc2NyaW1pbmFudCA9IGRpc2NyaW1pbmFudDtcbiAgICAgICAgICAgIHRoaXMuY2FzZXMgPSBjYXNlcztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUYWdnZWRUZW1wbGF0ZUV4cHJlc3Npb246IGZ1bmN0aW9uICh0YWcsIHF1YXNpKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVGFnZ2VkVGVtcGxhdGVFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy50YWcgPSB0YWc7XG4gICAgICAgICAgICB0aGlzLnF1YXNpID0gcXVhc2k7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVGVtcGxhdGVFbGVtZW50OiBmdW5jdGlvbiAodmFsdWUsIHRhaWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UZW1wbGF0ZUVsZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLnZhbHVlID0gdmFsdWU7XG4gICAgICAgICAgICB0aGlzLnRhaWwgPSB0YWlsO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFRlbXBsYXRlTGl0ZXJhbDogZnVuY3Rpb24gKHF1YXNpcywgZXhwcmVzc2lvbnMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UZW1wbGF0ZUxpdGVyYWw7XG4gICAgICAgICAgICB0aGlzLnF1YXNpcyA9IHF1YXNpcztcbiAgICAgICAgICAgIHRoaXMuZXhwcmVzc2lvbnMgPSBleHByZXNzaW9ucztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUaGlzRXhwcmVzc2lvbjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlRoaXNFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFRocm93U3RhdGVtZW50OiBmdW5jdGlvbiAoYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UaHJvd1N0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUcnlTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChibG9jaywgaGFuZGxlciwgZmluYWxpemVyKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVHJ5U3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5ibG9jayA9IGJsb2NrO1xuICAgICAgICAgICAgdGhpcy5ndWFyZGVkSGFuZGxlcnMgPSBbXTtcbiAgICAgICAgICAgIHRoaXMuaGFuZGxlcnMgPSBoYW5kbGVyID8gWyBoYW5kbGVyIF0gOiBbXTtcbiAgICAgICAgICAgIHRoaXMuaGFuZGxlciA9IGhhbmRsZXI7XG4gICAgICAgICAgICB0aGlzLmZpbmFsaXplciA9IGZpbmFsaXplcjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hVbmFyeUV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgYXJndW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IChvcGVyYXRvciA9PT0gJysrJyB8fCBvcGVyYXRvciA9PT0gJy0tJykgPyBTeW50YXguVXBkYXRlRXhwcmVzc2lvbiA6IFN5bnRheC5VbmFyeUV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLm9wZXJhdG9yID0gb3BlcmF0b3I7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLnByZWZpeCA9IHRydWU7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9ucykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlZhcmlhYmxlRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9ucyA9IGRlY2xhcmF0aW9ucztcbiAgICAgICAgICAgIHRoaXMua2luZCA9ICd2YXInO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaExleGljYWxEZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9ucywga2luZCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlZhcmlhYmxlRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9ucyA9IGRlY2xhcmF0aW9ucztcbiAgICAgICAgICAgIHRoaXMua2luZCA9IGtpbmQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVmFyaWFibGVEZWNsYXJhdG9yOiBmdW5jdGlvbiAoaWQsIGluaXQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5WYXJpYWJsZURlY2xhcmF0b3I7XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLmluaXQgPSBpbml0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFdoaWxlU3RhdGVtZW50OiBmdW5jdGlvbiAodGVzdCwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LldoaWxlU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoV2l0aFN0YXRlbWVudDogZnVuY3Rpb24gKG9iamVjdCwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LldpdGhTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLm9iamVjdCA9IG9iamVjdDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0U3BlY2lmaWVyOiBmdW5jdGlvbiAobG9jYWwsIGV4cG9ydGVkKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0U3BlY2lmaWVyO1xuICAgICAgICAgICAgdGhpcy5leHBvcnRlZCA9IGV4cG9ydGVkIHx8IGxvY2FsO1xuICAgICAgICAgICAgdGhpcy5sb2NhbCA9IGxvY2FsO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEltcG9ydERlZmF1bHRTcGVjaWZpZXI6IGZ1bmN0aW9uIChsb2NhbCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkltcG9ydERlZmF1bHRTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWw7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSW1wb3J0TmFtZXNwYWNlU3BlY2lmaWVyOiBmdW5jdGlvbiAobG9jYWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnROYW1lc3BhY2VTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWw7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0TmFtZWREZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9uLCBzcGVjaWZpZXJzLCBzcmMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHBvcnROYW1lZERlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5kZWNsYXJhdGlvbiA9IGRlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5zcGVjaWZpZXJzID0gc3BlY2lmaWVycztcbiAgICAgICAgICAgIHRoaXMuc291cmNlID0gc3JjO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEV4cG9ydERlZmF1bHREZWNsYXJhdGlvbjogZnVuY3Rpb24gKGRlY2xhcmF0aW9uKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5kZWNsYXJhdGlvbiA9IGRlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEV4cG9ydEFsbERlY2xhcmF0aW9uOiBmdW5jdGlvbiAoc3JjKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRXhwb3J0QWxsRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLnNvdXJjZSA9IHNyYztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJbXBvcnRTcGVjaWZpZXI6IGZ1bmN0aW9uIChsb2NhbCwgaW1wb3J0ZWQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnRTcGVjaWZpZXI7XG4gICAgICAgICAgICB0aGlzLmxvY2FsID0gbG9jYWwgfHwgaW1wb3J0ZWQ7XG4gICAgICAgICAgICB0aGlzLmltcG9ydGVkID0gaW1wb3J0ZWQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSW1wb3J0RGVjbGFyYXRpb246IGZ1bmN0aW9uIChzcGVjaWZpZXJzLCBzcmMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JbXBvcnREZWNsYXJhdGlvbjtcbiAgICAgICAgICAgIHRoaXMuc3BlY2lmaWVycyA9IHNwZWNpZmllcnM7XG4gICAgICAgICAgICB0aGlzLnNvdXJjZSA9IHNyYztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgIH07XG5cblxuICAgIGZ1bmN0aW9uIHJlY29yZEVycm9yKGVycm9yKSB7XG4gICAgICAgIHZhciBlLCBleGlzdGluZztcblxuICAgICAgICBmb3IgKGUgPSAwOyBlIDwgZXh0cmEuZXJyb3JzLmxlbmd0aDsgZSsrKSB7XG4gICAgICAgICAgICBleGlzdGluZyA9IGV4dHJhLmVycm9yc1tlXTtcbiAgICAgICAgICAgIC8vIFByZXZlbnQgZHVwbGljYXRlZCBlcnJvci5cbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBpZiAoZXhpc3RpbmcuaW5kZXggPT09IGVycm9yLmluZGV4ICYmIGV4aXN0aW5nLm1lc3NhZ2UgPT09IGVycm9yLm1lc3NhZ2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHRyYS5lcnJvcnMucHVzaChlcnJvcik7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY3JlYXRlRXJyb3IobGluZSwgcG9zLCBkZXNjcmlwdGlvbikge1xuICAgICAgICB2YXIgZXJyb3IgPSBuZXcgRXJyb3IoJ0xpbmUgJyArIGxpbmUgKyAnOiAnICsgZGVzY3JpcHRpb24pO1xuICAgICAgICBlcnJvci5pbmRleCA9IHBvcztcbiAgICAgICAgZXJyb3IubGluZU51bWJlciA9IGxpbmU7XG4gICAgICAgIGVycm9yLmNvbHVtbiA9IHBvcyAtIChzY2FubmluZyA/IGxpbmVTdGFydCA6IGxhc3RMaW5lU3RhcnQpICsgMTtcbiAgICAgICAgZXJyb3IuZGVzY3JpcHRpb24gPSBkZXNjcmlwdGlvbjtcbiAgICAgICAgcmV0dXJuIGVycm9yO1xuICAgIH1cblxuICAgIC8vIFRocm93IGFuIGV4Y2VwdGlvblxuXG4gICAgZnVuY3Rpb24gdGhyb3dFcnJvcihtZXNzYWdlRm9ybWF0KSB7XG4gICAgICAgIHZhciBhcmdzLCBtc2c7XG5cbiAgICAgICAgYXJ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xuICAgICAgICAgICAgcmVjb3JkRXJyb3IoZXJyb3IpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBUaHJvdyBhbiBleGNlcHRpb24gYmVjYXVzZSBvZiB0aGUgdG9rZW4uXG5cbiAgICBmdW5jdGlvbiB1bmV4cGVjdGVkVG9rZW5FcnJvcih0b2tlbiwgbWVzc2FnZSkge1xuICAgICAgICB2YXIgdmFsdWUsIG1zZyA9IG1lc3NhZ2UgfHwgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgIGlmICh0b2tlbikge1xuICAgICAgICAgICAgaWYgKCFtZXNzYWdlKSB7XG4gICAgICAgICAgICAgICAgbXNnID0gKHRva2VuLnR5cGUgPT09IFRva2VuLkVPRikgPyBNZXNzYWdlcy5VbmV4cGVjdGVkRU9TIDpcbiAgICAgICAgICAgICAgICAgICAgKHRva2VuLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpID8gTWVzc2FnZXMuVW5leHBlY3RlZElkZW50aWZpZXIgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uTnVtZXJpY0xpdGVyYWwpID8gTWVzc2FnZXMuVW5leHBlY3RlZE51bWJlciA6XG4gICAgICAgICAgICAgICAgICAgICh0b2tlbi50eXBlID09PSBUb2tlbi5TdHJpbmdMaXRlcmFsKSA/IE1lc3NhZ2VzLlVuZXhwZWN0ZWRTdHJpbmcgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uVGVtcGxhdGUpID8gTWVzc2FnZXMuVW5leHBlY3RlZFRlbXBsYXRlIDpcbiAgICAgICAgICAgICAgICAgICAgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRva2VuLnR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzRnV0dXJlUmVzZXJ2ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbXNnID0gTWVzc2FnZXMuVW5leHBlY3RlZFJlc2VydmVkO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0cmljdCAmJiBpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBNZXNzYWdlcy5TdHJpY3RSZXNlcnZlZFdvcmQ7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gKHRva2VuLnR5cGUgPT09IFRva2VuLlRlbXBsYXRlKSA/IHRva2VuLnZhbHVlLnJhdyA6IHRva2VuLnZhbHVlO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsdWUgPSAnSUxMRUdBTCc7XG4gICAgICAgIH1cblxuICAgICAgICBtc2cgPSBtc2cucmVwbGFjZSgnJTAnLCB2YWx1ZSk7XG5cbiAgICAgICAgcmV0dXJuICh0b2tlbiAmJiB0eXBlb2YgdG9rZW4ubGluZU51bWJlciA9PT0gJ251bWJlcicpID9cbiAgICAgICAgICAgIGNyZWF0ZUVycm9yKHRva2VuLmxpbmVOdW1iZXIsIHRva2VuLnN0YXJ0LCBtc2cpIDpcbiAgICAgICAgICAgIGNyZWF0ZUVycm9yKHNjYW5uaW5nID8gbGluZU51bWJlciA6IGxhc3RMaW5lTnVtYmVyLCBzY2FubmluZyA/IGluZGV4IDogbGFzdEluZGV4LCBtc2cpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHRocm93VW5leHBlY3RlZFRva2VuKHRva2VuLCBtZXNzYWdlKSB7XG4gICAgICAgIHRocm93IHVuZXhwZWN0ZWRUb2tlbkVycm9yKHRva2VuLCB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ZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgb3AgPSBsb29rYWhlYWQudmFsdWU7XG4gICAgICAgIHJldHVybiBvcCA9PT0gJz0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJyo9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICcvPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnJT0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJys9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICctPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnPDw9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICc+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJz4+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJyY9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICdePScgfHxcbiAgICAgICAgICAgIG9wID09PSAnfD0nO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbnN1bWVTZW1pY29sb24oKSB7XG4gICAgICAgIC8vIENhdGNoIHRoZSB2ZXJ5IGNvbW1vbiBjYXNlIGZpcnN0OiBpbW1lZGlhdGVseSBhIHNlbWljb2xvbiAoVSswMDNCKS5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCIHx8IG1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBGSVhNRShpa2FyaWVuYXRvcik6IHRoaXMgaXMgc2VlbWluZ2x5IGFuIGlzc3VlIGluIHRoZSBwcmV2aW91cyBsb2NhdGlvbiBpbmZvIGNvbnZlbnRpb24uXG4gICAgICAgIGxhc3RJbmRleCA9IHN0YXJ0SW5kZXg7XG4gICAgICAgIGxhc3RM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GlzQmluZGluZ0VsZW1lbnQgJiYgb2xkSXNCaW5kaW5nRWxlbWVudDtcbiAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNBc3NpZ25tZW50VGFyZ2V0ICYmIG9sZElzQXNzaWdubWVudFRhcmdldDtcbiAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gb2xkRmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yIHx8IGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvcjtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycmF5UGF0dGVybigpIHtcbiAgICAgICAgdmFyIG5vZGUgPSBuZXcgTm9kZSgpLCBlbGVtZW50cyA9IFtdLCByZXN0LCByZXN0Tm9kZTtcbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgd2hpbGUgKCFtYXRjaCgnXScpKSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIGVsZW1lbnRzLnB1c2gobnVsbCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLi4uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdE5vZGUgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzdCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnRzLnB1c2gocmVzdE5vZGUuZmluaXNoUmVzdEVsZW1lbnQocmVzdCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50cy5wdXNoKHBhcnNlUGF0dGVybldpdGhEZWZhdWx0KCkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIW1hdGNoKCddJykpIHtcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCcsJyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJ10nKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hBcnJheVBhdHRlcm4oZWxlbWVudHMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvcGVydHlQYXR0ZXJuKCkge1xuICAgICAgICB2YXIgbm9kZSA9IG5ldyBOb2RlKCksIGtleSwgY29tcHV0ZWQgPSBtYXRjaCgnWycpLCBpbml0O1xuICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpIHtcbiAgICAgICAgICAgIGtleSA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICBpZiAobWF0Y2goJz0nKSkge1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIGluaXQgPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvcGVydHkoXG4gICAgICAgICAgICAgICAgICAgICdpbml0Jywga2V5LCBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgbmV3IFdyYXBwaW5nTm9kZShrZXkpLmZpbmlzaEFzc2lnbm1lbnRQYXR0ZXJuKGtleSwgaW5pdCksIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKCFtYXRjaCgnOicpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvcGVydHkoJ2luaXQnLCBrZXksIGZhbHNlLCBrZXksIGZhbHNlLCB0cnVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGtleSA9IHBhcnNlT2JqZWN0UHJvcGVydHlLZXkoKTtcbiAgICAgICAgfVxuICAgICAgICBleHBlY3QoJzonKTtcbiAgICAgICAgaW5pdCA9IHBhcnNlUGF0dGVybldpdGhEZWZhdWx0KCk7XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb3BlcnR5KCdpbml0Jywga2V5LCBjb21wdXRlZCwgaW5pdCwgZmFsc2UsIGZhbHNlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU9iamVjdFBhdHRlcm4oKSB7XG4gICAgICAgIHZhciBub2RlID0gbmV3IE5vZGUoKSwgcHJvcGVydGllcyA9IFtdO1xuXG4gICAgICAgIGV4cGVjdCgneycpO1xuXG4gICAgICAgIHdoaWxlICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgcHJvcGVydGllcy5wdXNoKHBhcnNlUHJvcGVydHlQYXR0ZXJuKCkpO1xuICAgICAgICAgICAgaWYgKCFtYXRjaCgnfScpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcsJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsZXgoKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hPYmplY3RQYXR0ZXJuKHByb3BlcnRpZXMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUGF0dGVybigpIHtcbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VWYXJpYWJsZUlkZW50aWZpZXIoKTtcbiAgICAgICAgfSBlbHNlIGlmIChtYXRjaCgnWycpKSB7XG4gICAgICAgICAgICByZXR1cm4gcGFyc2VBcnJheVBhdHRlcm4oKTtcbiAgICAgICAgfSBlbHNlIGlmIChtYXRjaCgneycpKSB7XG4gICAgICAg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ByZWFkID0gbmV3IE5vZGUoKTtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICByZXN0U3ByZWFkLmZpbmlzaFNwcmVhZEVsZW1lbnQoaW5oZXJpdENvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKSk7XG5cbiAgICAgICAgICAgICAgICBpZiAoIW1hdGNoKCddJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChyZXN0U3ByZWFkKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pKTtcblxuICAgICAgICAgICAgICAgIGlmICghbWF0Y2goJ10nKSkge1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsZXgoKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hBcnJheUV4cHJlc3Npb24oZWxlbWVudHMpO1xuICAgIH1cblxuICAgIC8vIDExLjEuNSBPYmplY3QgSW5pdGlhbGlzZXJcblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvcGVydHlGdW5jdGlvbihub2RlLCBwYXJhbUluZm8pIHtcbiAgICAgICAgdmFyIHByZXZpb3VzU3RyaWN0LCBib2R5O1xuXG4gICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcblxuICAgICAgICBwcmV2aW91c1N0cmljdCA9IHN0cmljdDtcbiAgICA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BvcmRlciB0byBhdm9pZCBiYWNrIHRyYWNraW5nLCBpdCByZXR1cm5zIGBudWxsYCBpZiB0aGUgcG9zaXRpb24gaXMgbm90IGEgTWV0aG9kRGVmaW5pdGlvbiBhbmQgdGhlIGNhbGxlclxuICAgIC8vIGlzIHJlc3BvbnNpYmxlIHRvIHZpc2l0IG90aGVyIG9wdGlvbnMuXG4gICAgZnVuY3Rpb24gdHJ5UGFyc2VNZXRob2REZWZpbml0aW9uKHRva2VuLCBrZXksIGNvbXB1dGVkLCBub2RlKSB7XG4gICAgICAgIHZhciB2YWx1ZSwgb3B0aW9ucywgbWV0aG9kTm9kZTtcblxuICAgICAgICBpZiAodG9rZW4udHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllcikge1xuICAgICAgICAgICAgLy8gY2hlY2sgZm9yIGBnZXRgIGFuZCBgc2V0YDtcblxuICAgICAgICAgICAgaWYgKHRva2VuLnZhbHVlID09PSAnZ2V0JyAmJiBsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSkge1xuICAgICAgICAgICAgICAgIGNvbXB1dGVkID0gbWF0Y2goJ1snKTtcbiAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgbWV0aG9kTm9kZSA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcoJyk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYXJzZVByb3BlcnR5RnVuY3Rpb24obWV0aG9kTm9kZSwge1xuICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0czogW10sXG4gICAgICAgICAgICAgICAgICAgIHN0cmljdGVkOiBudWxsLFxuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IG51bGxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnZ2V0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRva2VuLnZhbHVlID09PSAnc2V0JyAmJiBsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSkge1xuICAgICAgICAgICAgICAgIGNvbXB1dGVkID0gbWF0Y2goJ1snKTtcbiAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgbWV0aG9kTm9kZSA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcoJyk7XG5cbiAgICAgICAgICAgICAgICBvcHRpb25zID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q291bnQ6IDAsXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHRzOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkOiBudWxsLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbVNldDoge31cbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnKScpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VQYXJhbShvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGVmYXVsdENvdW50ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmRlZmF1bHRzID0gW107XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhcnNlUHJvcGVydHlGdW5jdGlvbihtZXRob2ROb2RlLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnc2V0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobWF0Y2goJygnKSkge1xuICAgICAgICAgICAgdmFsdWUgPSBwYXJzZVByb3BlcnR5TWV0aG9kRnVuY3Rpb24oKTtcbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb3BlcnR5KCdpbml0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIHRydWUsIGZhbHNlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIE5vdCBhIE1ldGhvZERlZmluaXRpb24uXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrUHJvdG8oa2V5LCBjb21wdXRlZCwgaGFzUHJvdG8pIHtcbiAgICAgICAgaWYgKGNvbXB1dGVkID09PSBmYWxzZSAmJiAoa2V5LnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGtleS5uYW1lID09PSAnX19wcm90b19fJyB8fFxuICAgICAgICAgICAga2V5LnR5cGUgPT09IFN5bnRheC5MaXRlcmFsICYmIGtleS52YWx1ZSA9PT0gJ19fcHJvdG9fXycpKSB7XG4gICAgICAgICAgICBpZiAoaGFzUHJvdG8udmFsdWUpIHtcbiAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkR1cGxpY2F0ZVByb3RvUHJvcGVydHkpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBoYXNQcm90by52YWx1ZSA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2VuLklkZW50aWZpZXIpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnPScpKSB7XG4gICAgICAgICAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gbG9va2FoZWFkO1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIHZhbHVlID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnaW5pdCcsIGtleSwgY29tcHV0ZWQsXG4gICAgICAgICAgICAgICAgICAgIG5ldyBXcmFwcGluZ05vZGUodG9rZW4pLmZpbmlzaEFzc2lnbm1lbnRQYXR0ZXJuKGtleSwgdmFsdWUpLCBmYWxzZSwgdHJ1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnaW5pdCcsIGtleSwgY29tcHV0ZWQsIGtleSwgZmFsc2UsIHRydWUpO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU9iamVjdEluaXRpYWxpc2VyKCkge1xuICAgICAgICB2YXIgcHJvcGVydGllcyA9IFtdLCBoYXNQcm90byA9IHt2YWx1ZTogZmFsc2V9LCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcblxuICAgICAgICB3aGlsZSAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIHByb3BlcnRpZXMucHVzaChwYXJzZU9iamVjdFByb3BlcnR5KGhhc1Byb3RvKSk7XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgICAgIGV4cGVjdENvbW1hU2VwYXJhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJ30nKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hPYmplY3RFeHByZXNzaW9uKHByb3BlcnRpZXMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHJlaW50ZXJwcmV0RXhwcmVzc2lvbkFzUGF0dGVybihleHByKSB7XG4gICAgICAgIHZhciBpO1xuICAgICAgICBzd2l0Y2ggKGV4cHIudHlwZSkge1xuICAgICAgICBjYXNlIFN5bnRheC5JZGVudGlmaWVyOlxuICAgICAgICBjYXNlIFN5bnRheC5NZW1iZXJFeHByZXNzaW9uOlxuICAgICAgICBjYXNlIFN5bnRheC5SZXN0RWxlbWVudDpcbiAgICAgICAgY2FzZSBTeW50YXguQXNzaWdubWVudFBhdHRlcm46XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguU3ByZWFkRWxlbWVudDpcbiAgICAgICAgICAgIGV4cHIudHlwZSA9IFN5bnRheC5SZXN0RWxlbWVudDtcbiAgICAgICAgICAgIHJlaW50ZXJwcmV0RXhwcmVzc2lvbkFzUGF0dGVybihleHByLmFyZ3VtZW50KTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5BcnJheUV4cHJlc3Npb246XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguQXJyYXlQYXR0ZXJuO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cHIuZWxlbWVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAoZXhwci5lbGVtZW50c1tpXSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5lbGVtZW50c1tpXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4Lk9iamVjdEV4cHJlc3Npb246XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguT2JqZWN0UGF0dGVybjtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHByLnByb3BlcnRpZXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5wcm9wZXJ0aWVzW2ldLnZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5Bc3NpZ25tZW50RXhwcmVzc2lvbjpcbiAgICAgICAgICAgIGV4cHIudHlwZSA9IFN5bnRheC5Bc3NpZ25tZW50UGF0dGVybjtcbiAgICAgICAgICAgIHJlaW50ZXJwcmV0RXhwcmVzc2lvbkFzUGF0dGVybihleHByLmxlZnQpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAvLyBBbGxvdyBvdGhlciBub2RlIHR5cGUgZm9yIHRvbGVyYW50IHBhcnNpbmcuXG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlVGVtcGxhdGVFbGVtZW50KG9wdGlvbikge1xuICAgICAgICB2YXIgbm9kZSwgdG9rZW47XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5UZW1wbGF0ZSB8fCAob3B0aW9uLmhlYWQgJiYgIWxvb2thaGVhZC5oZWFkKSkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIG5vZGUgPSBuZXcgTm9kZSgpO1xuICAgICAgICB0b2tlbiA9IGxleCgpO1xuXG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaFRlbXBsYXRlRWxlbWVudCh7IHJhdzogdG9rZW4udmFsdWUucmF3LCBjb29rZWQ6IHRva2VuLnZhbHVlLmNvb2tlZCB9LCB0b2tlbi50YWlsKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZVRlbXBsYXRlTGl0ZXJhbCgpIHtcbiAgICAgICAgdmFyIHF1YXNpLCBxdWFzaXMsIGV4cHJlc3Npb25zLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBxdWFzaSA9IHBhcnNlVGVtcGxhdGVFbGVtZW50KHsgaGVhZDogdHJ1ZSB9KTtcbiAgICAgICAgcXVhc2lzID0gWyBxdWFzaSBdO1xuICAgICAgICBleHByZXNzaW9ucyA9IFtdO1xuXG4gICAgICAgIHdoaWxlICghcXVhc2kudGFpbCkge1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChwYXJzZUV4cHJlc3Npb24oKSk7XG4gICAgICAgICAgICBxdWFzaSA9IHBhcnNlVGVtcGxhdGVFbGVtZW50KHsgaGVhZDogZmFsc2UgfSk7XG4gICAgICAgICAgICBxdWFzaXMucHVzaChxdWFzaSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hUZW1wbGF0ZUxpdGVyYWwocXVhc2lzLCBleHByZXNzaW9ucyk7XG4gICAgfVxuXG4gICAgLy8gMTEuMS42IFRoZSBHcm91cGluZyBPcGVyYXRvclxuXG4gICAgZnVuY3Rpb24gcGFyc2VHcm91cEV4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciBleHByLCBleHByZXNzaW9ucywgc3RhcnRUb2tlbiwgaTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBpZiAobWF0Y2goJyknKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCc9PicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcixcbiAgICAgICAgICAgICAgICBwYXJhbXM6IFtdXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgc3RhcnRUb2tlbiA9IGxvb2thaGVhZDtcbiAgICAgICAgaWYgKG1hdGNoKCcuLi4nKSkge1xuICAgICAgICAgICAgZXhwciA9IHBhcnNlUmVzdEVsZW1lbnQoKTtcbiAgICAgICAgICAgIGV4cGVjdCgnKScpO1xuICAgICAgICAgICAgaWYgKCFtYXRjaCgnPT4nKSkge1xuICAgICAgICAgICAgICAgIGV4cGVjdCgnPT4nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgdHlwZTogUGxhY2VIb2xkZXJzLkFycm93UGFyYW1ldGVyUGxhY2VIb2xkZXIsXG4gICAgICAgICAgICAgICAgcGFyYW1zOiBbZXhwcl1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gdHJ1ZTtcbiAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG5cbiAgICAgICAgaWYgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGZhbHNlO1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMgPSBbZXhwcl07XG5cbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsZXgoKTtcblxuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLi4uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc0JpbmRpbmdFbGVtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGV4cHJlc3Npb25zLnB1c2gocGFyc2VSZXN0RWxlbWVudCgpKTtcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghbWF0Y2goJz0+JykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdCgnPT4nKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHByZXNzaW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHJlc3Npb25zW2ldKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogUGxhY2VIb2xkZXJzLkFycm93UGFyYW1ldGVyUGxhY2VIb2xkZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IGV4cHJlc3Npb25zXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uKGV4cHJlc3Npb25zKTtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgaWYgKG1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICBpZiAoIWlzQmluZGluZ0VsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoZXhwci50eXBlID09PSBTeW50YXguU2VxdWVuY2VFeHByZXNzaW9uKSB7XG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cHIuZXhwcmVzc2lvbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIuZXhwcmVzc2lvbnNbaV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHByID0ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFBsYWNlSG9sZGVycy5BcnJvd1BhcmFtZXRlclBsYWNlSG9sZGVyLFxuICAgICAgICAgICAgICAgIHBhcmFtczogZXhwci50eXBlID09PSBTeW50YXguU2VxdWVuY2VFeHByZXNzaW9uID8gZXhwci5leHByZXNzaW9ucyA6IFtleHByXVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuXG4gICAgLy8gMTEuMSBQcmltYXJ5IEV4cHJlc3Npb25zXG5cbiAgICBmdW5jdGlvbiBwYXJzZVByaW1hcnlFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgdHlwZSwgdG9rZW4s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2hMaXRlcmFsKGxleCgpKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlID09PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdmdW5jdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRnVuY3Rpb25FeHByZXNzaW9uKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCd0aGlzJykpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hUaGlzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG1hdGNoS2V5d29yZCgnY2xhc3MnKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUNsYXNzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obGV4KCkpO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLkJvb2xlYW5MaXRlcmFsKSB7XG4gICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgdG9rZW4udmFsdWUgPSAodG9rZW4udmFsdWUgPT09ICd0cnVlJyk7XG4gICAgICAgICAgICBleHByID0gbm9kZS5maW5pc2hMaXRlcmFsKHRva2VuKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlID09PSBUb2tlbi5OdWxsTGl0ZXJhbCkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgdG9rZW4gPSBsZXgoKTtcbiAgICAgICAgICAgIHRva2VuLnZhbHVlID0gbnVsbDtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcvJykgfHwgbWF0Y2goJy89JykpIHtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgIGluZGV4ID0gc3RhcnRJbmRleDtcblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS50b2tlbnMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBzY2FuUmVnRXhwKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLlRlbXBsYXRlKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VUZW1wbGF0ZUxpdGVyYWwoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxleCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuICAgIC8vIDExLjIgTGVmdC1IYW5kLVNpZGUgRXhwcmVzc2lvbnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlQXJndW1lbnRzKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdO1xuXG4gICAgICAgIGV4cGVjdCgnKCcpO1xuXG4gICAgICAgIGlmICghbWF0Y2goJyknKSkge1xuICAgICAgICAgICAgd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBhcmdzLnB1c2goaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKSk7XG4gICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGV4cGVjdENvbW1hU2VwYXJhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICByZXR1cm4gYXJncztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkUHJvcGVydHkoKSB7XG4gICAgICAgIHZhciB0b2tlbiwgbm9kZSA9IG5ldyBOb2RlKCk7XG5cbiAgICAgICAgdG9rZW4gPSBsZXgoKTtcblxuICAgICAgICBpZiAoIWlzSWRlbnRpZmllck5hbWUodG9rZW4pKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hJZGVudGlmaWVyKHRva2VuLnZhbHVlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCkge1xuICAgICAgICBleHBlY3QoJy4nKTtcblxuICAgICAgICByZXR1cm4gcGFyc2VOb25Db21wdXRlZFByb3BlcnR5KCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb21wdXRlZE1lbWJlcigpIHtcbiAgICAgICAgdmFyIGV4cHI7XG5cbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgZXhwciA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VFeHByZXNzaW9uKTtcblxuICAgICA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ycpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGV4cHIgPSBpbmhlcml0Q292ZXJHcmFtbWFyKG1hdGNoS2V5d29yZCgnbmV3JykgPyBwYXJzZU5ld0V4cHJlc3Npb24gOiBwYXJzZVByaW1hcnlFeHByZXNzaW9uKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoOzspIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnLicpKSB7XG4gICAgICAgICAgICAgICAgaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgcHJvcGVydHkgPSBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoTWVtYmVyRXhwcmVzc2lvbignLicsIGV4cHIsIHByb3BlcnR5KTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJygnKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBhcmdzID0gcGFyc2VBcmd1bWVudHMoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hDYWxsRXhwcmVzc2lvbihleHByLCBhcmdzKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJ1snKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc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bmV3IE5vZGUoKTtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgZXhwciA9IGV4cHIuZmluaXNoU3VwZXIoKTtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJ1snKSAmJiAhbWF0Y2goJy4nKSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBleHByID0gaW5oZXJpdENvdmVyR3JhbW1hcihtYXRjaEtleXdvcmQoJ25ldycpID8gcGFyc2VOZXdFeHByZXNzaW9uIDogcGFyc2VQcmltYXJ5RXhwcmVzc2lvbik7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKDs7KSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJ1snKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHByb3BlcnR5ID0gcGFyc2VDb21wdXRlZE1lbWJlcigpO1xuICAgICAgICAgICAgICAgIGV4cHIgPSBuZXcgV3JhcHBpbmdOb2RlKHN0YXJ0VG9rZW4pLmZpbmlzaE1lbWJlckV4cHJlc3Npb24oJ1snLCBleHByLCBwcm9wZXJ0eSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcuJykpIHtcbiAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0eSA9IHBhcnNlTm9uQ29tcHV0ZWRNZW1iZXIoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hNZW1iZ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gdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5TdHJpY3RMSFNQb3N0Zml4KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWlzQXNzaWdubWVudFRhcmdldCkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkludmFsaWRMSFNJbkFzc2lnbm1lbnQpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICAgIHRva2VuID0gbGV4KCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoUG9zdGZpeEV4cHJlc3Npb24odG9rZW4udmFsdWUsIGV4cHIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGV4cHI7XG4gICAgfVxuXG4gICAgLy8gMTEuNCBVbmFyeSBPcGVyYXRvcnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlVW5hcnlFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgdG9rZW4sIGV4cHIsIHN0YXJ0VG9rZW47XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5QdW5jdHVhdG9yICYmIGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VQb3N0Zml4RXhwcmVzc2lvbigpO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcrKycpIHx8IG1hdGNoKCctLScpKSB7XG4gICAgICAgICAgICBzdGFydFRva2VuID0gbG9va2FoZWFkO1xuICAgICAgICAgICAgdG9rZW4gPSBsZXgoKTtcbiAgICAgICAgICAgIGV4cHIgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlVW5hcnlFeHByZXNzaW9uKTtcbiAgICAgICAgICAgIC8vIDExLjQuNCwgMTEuNC41XG4gICAgICAgICAgICBpZiAoc3RyaWN0ICYmIGV4cHIudHlwZSA9PT0gU3ludGF4LklkZW50aWZpZXIgJiYgaXNSZXN0cmljdGVkV29yZChleHByLm5hbWUpKSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5TdHJpY3RMSFNQcmVmaXgpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIWlzQXNzaWdubWVudFRhcmdldCkge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlRXJyb3IoTWVzc2FnZXMuSW52YWxpZExIU0luQXNzaWdubWVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hVbmFyeUV4cHJlc3Npb24odG9rZW4udmFsdWUsIGV4cHIpO1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcrJykgfHwgbWF0Y2goJy0nKSB8fCBtYXRjaCgnficpIHx8IG1hdGNoKCchJykpIHtcbiAgICAgICAgICAgIHN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VVbmFyeUV4cHJlc3Npb24pO1xuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoVW5hcnlFeHByZXNzaW9uKHRva2VuLnZhbHVlLCBleHByKTtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICA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HN3aXRjaCAodG9rZW4udmFsdWUpIHtcbiAgICAgICAgY2FzZSAnfHwnOlxuICAgICAgICAgICAgcHJlYyA9IDE7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICcmJic6XG4gICAgICAgICAgICBwcmVjID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ3wnOlxuICAgICAgICAgICAgcHJlYyA9IDM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdeJzpcbiAgICAgICAgICAgIHByZWMgPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnJic6XG4gICAgICAgICAgICBwcmVjID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJz09JzpcbiAgICAgICAgY2FzZSAnIT0nOlxuICAgICAgICBjYXNlICc9PT0nOlxuICAgICAgICBjYXNlICchPT0nOlxuICAgICAgICAgICAgcHJlYyA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICc8JzpcbiAgICAgICAgY2FzZSAnPic6XG4gICAgICAgIGNhc2UgJzw9JzpcbiAgICAgICAgY2FzZSAnPj0nOlxuICAgICAgICBjYXNlICdpbnN0YW5jZW9mJzpcbiAgICAgICAgICAgIHByZWMgPSA3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnaW4nOlxuICAgICAgICAgICAgcHJlYyA9IGFsbG93SW4gPyA3IDogMDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJzw8JzpcbiAgICAgICAgY2FzZSAnPj4nOlxuICAgICAgICBjYXNlICc+Pj4nOlxuICAgICAgICAgICAgcHJlYyA9IDg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICcrJzpcbiAgICAgICAgY2FzZSAnLSc6XG4gICAgICAgICAgICBwcmVjID0gOTtcbiAgICAgICAgICAgIGJ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FtLnR5cGUpIHtcbiAgICAgICAgY2FzZSBTeW50YXguSWRlbnRpZmllcjpcbiAgICAgICAgICAgIHZhbGlkYXRlUGFyYW0ob3B0aW9ucywgcGFyYW0sIHBhcmFtLm5hbWUpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4LlJlc3RFbGVtZW50OlxuICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0uYXJndW1lbnQpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4LkFzc2lnbm1lbnRQYXR0ZXJuOlxuICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0ubGVmdCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguQXJyYXlQYXR0ZXJuOlxuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBhcmFtLmVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtLmVsZW1lbnRzW2ldICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGNoZWNrUGF0dGVyblBhcmFtKG9wdGlvbnMsIHBhcmFtLmVsZW1lbnRzW2ldKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGFzc2VydChwYXJhbS50eXBlID09PSBTeW50YXguT2JqZWN0UGF0dGVybiwgJ0ludmFsaWQgdHlwZScpO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHBhcmFtLnByb3BlcnRpZXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbS5wcm9wZXJ0aWVzW2ldLnZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgfVxuICAgIGZ1bmN0aW9uIHJlaW50ZXJwcmV0QXNDb3ZlckZvcm1hbHNMaXN0KGV4cHIpIHtcbiAgICAgICAgdmFyIGksIGxlbiwgcGFyYW0sIHBhcmFtcywgZGVmYXVsdHMsIGRlZmF1bHRDb3VudCwgb3B0aW9ucywgdG9rZW47XG5cbiAgICAgICAgZGVmYXVsdHMgPSBbXTtcbiAgICAgICAgZGVmYXVsdENvdW50ID0gMDtcbiAgICAgICAgcGFyYW1zID0gW2V4cHJdO1xuXG4gICAgICAgIHN3aXRjaCAoZXhwci50eXBlKSB7XG4gICAgICAgIGNhc2UgU3ludGF4LklkZW50aWZpZXI6XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcjpcbiAgICAgICAgICAgIHBhcmFtcyA9IGV4cHIucGFyYW1zO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuXG4gICAgICAgIG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBwYXJhbVNldDoge31cbiAgICAgICAgfTtcblxuICAgICAgICBmb3IgKGkgPSAwLCBsZW4gPSBwYXJhbXMubGVuZ3RoOyBpIDwgbGVuOyBpICs9IDEpIHtcbiAgICAgICAgICAgIHBhcmFtID0gcGFyYW1zW2ldO1xuICAgICAgICAgICAgc3dpdGNoIChwYXJhbS50eXBlKSB7XG4gICAgICAgICAgICBjYXNlIFN5bnRheC5Bc3NpZ25tZW50UGF0dGVybjpcbiAgICAgICAgICAgICAgICBwYXJhbXNbaV0gPSBwYXJhbS5sZWZ0O1xuICAgICAgICAgICAgICAgIGRlZmF1bHRzLnB1c2gocGFyYW0ucmlnaHQpO1xuICAgICAgICAgICAgICAgICsrZGVmYXVsdENvdW50O1xuICAgICAgICAgICAgICAgIGNoZWNrUGF0dGVyblBhcmFtKG9wdGlvbnMsIHBhcmFtLmxlZnQpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbSk7XG4gICAgICAgICAgICAgICAgcGFyYW1zW2ldID0gcGFyYW07XG4gICAgICAgICAgICAgICAgZGVmYXVsdHMucHVzaChudWxsKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChvcHRpb25zLm1lc3NhZ2UgPT09IE1lc3NhZ2VzLlN0cmljdFBhcmFtRHVwZSkge1xuICAgICAgICAgICAgdG9rZW4gPSBzdHJpY3QgPyBvcHRpb25zLnN0cmljdGVkIDogb3B0aW9ucy5maXJzdFJlc3RyaWN0ZWQ7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbiwgb3B0aW9ucy5tZXNzYWdlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChkZWZhdWx0Q291bnQgPT09IDApIHtcbiAgICAgICAgICAgIGRlZmF1bHRzID0gW107XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgcGFyYW1zOiBwYXJhbXMsXG4gICAgICAgICAgICBkZWZhdWx0czogZGVmYXVsdHMsXG4gICAgICAgICAgICBzdHJpY3RlZDogb3B0aW9ucy5zdHJpY3RlZCxcbiAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZDogb3B0aW9ucy5maXJzdFJlc3RyaWN0ZWQsXG4gICAgICAgICAgICBtZXNzYWdlOiBvcHRpb25zLm1lc3NhZ2VcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycm93RnVuY3Rpb25FeHByZXNzaW9uKG9wdGlvbnMsIG5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ID0gbG9va2FoZWFkO1xuICAgICAgICB0b2tlbiA9IGxvb2thaGVhZDtcblxuICAgICAgICBleHByID0gcGFyc2VDb25kaXRpb25hbEV4cHJlc3Npb24oKTtcblxuICAgICAgICBpZiAoZXhwci50eXBlID09PSBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlciB8fCBtYXRjaCgnPT4nKSkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgbGlzdCA9IHJlaW50ZXJwcmV0QXNDb3ZlckZvcm1hbHNMaXN0KGV4cHIpO1xuXG4gICAgICAgICAgICBpZiAobGlzdCkge1xuICAgICAgICAgICAgICAgIGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvciA9IG51bGw7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQXJyb3dGdW5jdGlvbkV4cHJlc3Npb24obGlzdCwgbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBleHByO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG1hdGNoQXNzaWduKCkpIHtcbiAgICAgICAgICAgIGlmICghaXNBc3NpZ25tZW50VGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5JbnZhbGlkTEhTSW5Bc3NpZ25tZW50KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gMTEuMTMuMVxuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBleHByLnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGlzUmVzdHJpY3RlZFdvcmQoZXhwci5uYW1lKSkge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5TdHJpY3RMSFNBc3NpZ25tZW50KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFtYXRjaCgnPScpKSB7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwcik7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRva2VuID0gbGV4KCk7XG4gICAgICAgICAgICByaWdodCA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hBc3NpZ25tZW50RXhwcmVzc2lvbih0b2tlbi52YWx1ZSwgZXhwciwgcmlnaHQpO1xuICAgICAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gbnVsbDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuICAgIC8vIDExLjE0IENvbW1hIE9wZXJhdG9yXG5cbiAgICBmdW5jdGlvbiBwYXJzZUV4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciBleHByLCBzdGFydFRva2VuID0gbG9va2FoZWFkLCBleHByZXNzaW9ucztcblxuICAgICAgICBleHByID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcblxuICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgZXhwcmVzc2lvbnMgPSBbZXhwcl07XG5cbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICBleHByZXNzaW9ucy5wdXNoKGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hTZXF1ZW5jZUV4cHJlc3Npb24oZXhwcmVzc2lvbnMpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGV4cHI7XG4gICAgfVxuXG4gICAgLy8gMTIuMSBCbG9ja1xuXG4gICAgZnVuY3Rpb24gcGFyc2VTdGF0ZW1lbnRMaXN0SXRlbSgpIHtcbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKGxvb2thaGVhZC52YWx1ZSkge1xuICAgICAgICAgICAgY2FzZSAnZXhwb3J0JzpcbiAgICAgICAgICAgICAgICBpZiAoc291cmNlVHlwZSAhPT0gJ21vZHVsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkLCBNZXNzYWdlcy5JbGxlZ2FsRXhwb3J0RGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VFeHBvcnREZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgY2FzZSAnaW1wb3J0JzpcbiAgICAgICAgICAgICAgICBpZiAoc291cmNlVHlwZSAhPT0gJ21vZHVsZScpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkLCBNZXNzYWdlcy5JbGxlZ2FsSW1wb3J0RGVjbGFyYXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbXBvcnREZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgY2FzZSAnY29uc3QnOlxuICAgICAgICAgICAgY2FzZSAnbGV0JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VMZXhpY2FsRGVjbGFyYXRpb24oe2luRm9yOiBmYWxzZX0pO1xuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUZ1bmN0aW9uRGVjbGFyYXRpb24obmV3IE5vZGUoKSk7XG4gICAgICAgICAgICBjYXNlICdjbGFzcyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQ2xhc3NEZWNsYXJhdGlvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHBhcnNlU3RhdGVtZW50KCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VTdGF0ZW1lbnRMaXN0KCkge1xuICAgICAgICB2YXIgbGlzdCA9IFtdO1xuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgaWYgKG1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxpc3QucHVzaChwYXJzZVN0YXRlbWVudExpc3RJdGVtKCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGxpc3Q7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VCbG9jaygpIHtcbiAgICAgICAgdmFyIGJsb2NrLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcblxuICAgICAgICBibG9jayA9IHBhcnNlU3RhdGVtZW50TGlzdCgpO1xuXG4gICAgICAgIGV4cGVjdCgnfScpO1xuXG4gICAgICAgIHJldHVybiBub2RlL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ICAgICBpZiAobWF0Y2goJz0nKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBpbml0ID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcbiAgICAgICAgfSBlbHNlIGlmIChpZC50eXBlICE9PSBTeW50YXguSWRlbnRpZmllcikge1xuICAgICAgICAgICAgZXhwZWN0KCc9Jyk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hWYXJpYWJsZURlY2xhcmF0b3IoaWQsIGluaXQpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbkxpc3QoKSB7XG4gICAgICAgIHZhciBsaXN0ID0gW107XG5cbiAgICAgICAgZG8ge1xuICAgICAgICAgICAgbGlzdC5wdXNoKHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbigpKTtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgIH0gd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpO1xuXG4gICAgICAgIHJldHVybiBsaXN0O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlVmFyaWFibGVTdGF0ZW1lbnQobm9kZSkge1xuICAgICAgICB2YXIgZGVjbGFyYXRpb25zO1xuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ3ZhcicpO1xuXG4gICAgICAgIGRlY2xhcmF0aW9ucyA9IHBhcnNlVmFyaWFibGVEZWNsYXJhdGlvbkxpc3QoKTtcblxuICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG5cbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMpO1xuICAgIH1cblxuICAgIGZ1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H0gZWxzZSB7XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCd2YXInKSkge1xuICAgICAgICAgICAgICAgIGluaXQgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgIGxleCgpO1xuXG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaFZhcmlhYmxlRGVjbGFyYXRpb24ocGFyc2VWYXJpYWJsZURlY2xhcmF0aW9uTGlzdCgpKTtcbiAgICAgICAgICAgICAgICBzdGF0ZS5hbGxvd0luID0gcHJldmlvdXNBbGxvd0luO1xuXG4gICAgICAgICAgICAgICAgaWYgKGluaXQuZGVjbGFyYXRpb25zLmxlbmd0aCA9PT0gMSAmJiBtYXRjaEtleXdvcmQoJ2luJykpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJzsnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoS2V5d29yZCgnY29uc3QnKSB8fCBtYXRjaEtleXdvcmQoJ2xldCcpKSB7XG4gICAgICAgICAgICAgICAgaW5pdCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAga2luZCA9IGxleCgpLnZhbHVlO1xuXG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGRlY2xhcmF0aW9ucyA9IHBhcnNlQmluZGluZ0xpc3Qoa2luZCwge2luRm9yOiB0cnVlfSk7XG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IHByZXZpb3VzQWxsb3dJbjtcblxuICAgICAgICAgICAgICAgIGlmIChkZWNsYXJhdGlvbnMubGVuZ3RoID09PSAxICYmIGRlY2xhcmF0aW9uc1swXS5pbml0ID09PSBudWxsICYmIG1hdGNoS2V5d29yZCgnaW4nKSkge1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gaW5pdC5maW5pc2hMZXhpY2FsRGVjbGFyYXRpb24oZGVjbGFyYXRpb25zLCBraW5kKTtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaExleGljYWxEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMsIGtpbmQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5pdFN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGluaXQgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93SW4gPSBwcmV2aW91c0FsbG93SW47XG5cbiAgICAgICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdpbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNBc3NpZ25tZW50VGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkludmFsaWRMSFNJbkZvckluKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oaW5pdCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNlcSA9IFtpbml0XTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNlcS5wdXNoKGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdCA9IG5ldyBXcmFwcGluZ05vZGUoaW5pdFN0YXJ0VG9rZW4pLmZpbmlzaFNlcXVlbmNlRXhwcmVzc2lvbihpbml0U2VxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJzsnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodHlwZW9mIGxlZnQgPT09ICd1bmRlZmluZWQnKSB7XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJzsnKSkge1xuICAgICAgICAgICAgICAgIHRlc3QgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGV4cGVjdCgnOycpO1xuXG4gICAgICAgICAgICBpZiAoIW1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgICAgICB1cGRhdGUgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdCgnKScpO1xuXG4gICAgICAgIG9sZEluSXRlcmF0aW9uID0gc3RhdGUuaW5JdGVyYXRpb247XG4gICAgICAgIHN0YXRlLmluSXRlcmF0aW9uID0gdHJ1ZTtcblxuICAgICAgICBib2R5ID0gaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZVN0YXRlbWVudCk7XG5cbiAgICAgICAgc3RhdGUuaW5JdGVyYXRpb24gPSBvbGRJbkl0ZXJhdGlvbjtcblxuICAgICAgICByZXR1cm4gKHR5cGVvZiBsZWZ0ID09PSAndW5kZWZpbmVkJykgP1xuICAgICAgICAgICAgICAgIG5vZGUuZmluaXNoRm9yU3RhdGVtZW50KGluaXQsIHRlc3QsIHVwZGF0ZSwgYm9keSkgOlxuICAgICAgICAgICAgICAgIG5vZGUuZmluaXNoRm9ySW5TdGF0ZW1lbnQobGVmdCwgcmlnaHQsIGJvZHkpO1xuICAgIH1cblxuICAgIC8vIDEyLjcgVGhlIGNvbnRpbnVlIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb250aW51ZVN0YXRlbWVudChub2RlKSB7XG4gICAgICAgIHZhciBsYWJlbCA9IG51bGwsIGtleTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdjb250aW51ZScpO1xuXG4gICAgICAgIC8vIE9wdGltaXplIHRoZSBtb3N0IGNvbW1vbiBmb3JtOiAnY29udGludWU7Jy5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCKSB7XG4gICAgICAgICAgICBsZXgoKTtcblxuICAgICAgICAgICAgaWYgKCFzdGF0ZS5pbkl0ZXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbENvbnRpbnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQ29udGludWVTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIGlmICghc3RhdGUuaW5JdGVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaENvbnRpbnVlU3RhdGVtZW50KG51bGwpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICBsYWJlbCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG5cbiAgICAgICAgICAgIGtleSA9ICckJyArIGxhYmVsLm5hbWU7XG4gICAgICAgICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChzdGF0ZS5sYWJlbFNldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuVW5rbm93bkxhYmVsLCBsYWJlbC5uYW1lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICBpZiAobGFiZWwgPT09IG51bGwgJiYgIXN0YXRlLmluSXRlcmF0aW9uKSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9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B4MjApIHtcbiAgICAgICAgICAgIGlmIChpc0lkZW50aWZpZXJTdGFydChzb3VyY2UuY2hhckNvZGVBdChsYXN0SW5kZXggKyAxKSkpIHtcbiAgICAgICAgICAgICAgICBhcmd1bWVudCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQoYXJndW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICAvLyBIQUNLXG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJ30nKSAmJiBsb29rYWhlYWQudHlwZSAhPT0gVG9rZW4uRU9GKSB7XG4gICAgICAgICAgICAgICAgYXJndW1lbnQgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQoYXJndW1lbnQpO1xuICAgIH1cblxuICAgIC8vIDEyLjEwIFRoZSB3aXRoIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VXaXRoU3RhdGVtZW50KG5vZGUpIHtcbiAgICAgICAgdmFyIG9iamVjdCwgYm9keTtcblxuICAgICAgICBpZiAoc3RyaWN0KSB7XG4gICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLlN0cmljdE1vZGVXaXRoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdEtleXdv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lKSB7XG4gICAgICAgICAgICBjYXNlICc7JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VFbXB0eVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJygnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUV4cHJlc3Npb25TdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgIHN3aXRjaCAobG9va2FoZWFkLnZhbHVlKSB7XG4gICAgICAgICAgICBjYXNlICdicmVhayc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQnJlYWtTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdjb250aW51ZSc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlQ29udGludWVTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdkZWJ1Z2dlcic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRGVidWdnZXJTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdkbyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRG9XaGlsZVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2Zvcic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRm9yU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnZnVuY3Rpb24nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUZ1bmN0aW9uRGVjbGFyYXRpb24obm9kZSk7XG4gICAgICAgICAgICBjYXNlICdpZic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSWZTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdyZXR1cm4nOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVJldHVyblN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ3N3aXRjaCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlU3dpdGNoU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAndGhyb3cnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVRocm93U3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAndHJ5JzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VUcnlTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd2YXInOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVZhcmlhYmxlU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnd2hpbGUnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVdoaWxlU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnd2l0aCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlV2l0aFN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHByID0gcGFyc2VFeHByZXNzaW9uKCk7XG5cbiAgICAgICAgLy8gMTIuMTIgTGFiZWxsZWQgU3RhdGVtZW50c1xuICAgICAgICBpZiAoKGV4cHIudHlwZSA9PT0gU3ludGF4LklkZW50aWZpZXIpICYmIG1hdGNoKCc6JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuXG4gICAgICAgICAgICBrZXkgPSAnJCcgKyBleHByLm5hbWU7XG4gICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHN0YXRlLm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gICAgICAgICB9XG4gICAgICAgICAgICB0b2tlbiA9IGxvb2thaGVhZDtcblxuICAgICAgICAgICAgc3RhdGVtZW50ID0gcGFyc2VTdGF0ZW1lbnRMaXN0SXRlbSgpO1xuICAgICAgICAgICAgYm9keS5wdXNoKHN0YXRlbWVudCk7XG4gICAgICAgICAgICBpZiAoc3RhdGVtZW50LmV4cHJlc3Npb24udHlwZSAhPT0gU3ludGF4LkxpdGVyYWwpIHtcbiAgICAgICAgICAgICAgICAvLyB0aGlzIGlzIG5vdCBkaXJlY3RpdmVcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRpcmVjdGl2ZSA9IHNvdXJjZS5zbGljZSh0b2tlbi5zdGFydCArIDEsIHRva2VuLmVuZCAtIDEpO1xuICAgICAgICAgICAgaWYgKGRpcmVjdGl2ZSA9PT0gJ3VzZSBzdHJpY3QnKSB7XG4gICAgICAgICAgICAgICAgc3RyaWN0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RSZXN0cmljdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKGZpcnN0UmVzdHJpY3RlZCwgTWVzc2FnZXMuU3RyaWN0T2N0YWxMaXRlcmFsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICghZmlyc3RSZXN0cmljdGVkICYmIHRva2VuLm9jdGFsKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZCA9IHRva2VuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG9sZExhYmVsU2V0ID0gc3RhdGUubGFiZWxTZXQ7XG4gICAgICAgIG9sZEluSXRlcmF0aW9uID0gc3RhdGUuaW5JdGVyYXRpb247XG4gICAgICAgIG9sZEluU3dpdGNoID0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9ucywgcGFyYW0sIG5hbWUpIHtcbiAgICAgICAgdmFyIGtleSA9ICckJyArIG5hbWU7XG4gICAgICAgIGlmIChzdHJpY3QpIHtcbiAgICAgICAgICAgIGlmIChpc1Jlc3RyaWN0ZWRXb3JkKG5hbWUpKSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5zdHJpY3RlZCA9IHBhcmFtO1xuICAgICAgICAgICAgICAgIG9wdGlvbnMubWVzc2FnZSA9IE1lc3NhZ2VzLlN0cmljdFBhcmFtTmFtZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob3B0aW9ucy5wYXJhbVNldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuc3RyaWN0ZWQgPSBwYXJhbTtcbiAgICAgICAgICAgICAgICBvcHRpb25zLm1lc3NhZ2UgPSBNZXNzYWdlcy5TdHJpY3RQYXJhbUR1cGU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAoIW9wdGlvbnMuZmlyc3RSZXN0cmljdGVkKSB7XG4gICAgICAgICAgICBpZiAoaXNSZXN0cmljdGVkV29yZChuYW1lKSkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuZmlyc3RSZXN0cmljdGVkID0gcGFyYW07XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5tZXNzYWdlID0gTWVzc2FnZXMuU3RyaWN0UGFyYW1OYW1lO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQobmFtZSkpIHtcbiAgICAgICAgICAgICAgICBvcHRpb25zLmZpcnN0UmVzdHJpY3RlZCA9IHBhcmFtO1xuICAgICAgICAgICAgICAgIG9wdGlvbnMubWVzc2FnZSA9IE1lc3NhZ2VzLlN0cmljdFJlc2VydmVkV29yZDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoT2JqZWN0LnByb3Rvd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gICAgKytvcHRpb25zLmRlZmF1bHRDb3VudDtcbiAgICAgICAgfVxuXG4gICAgICAgIG9wdGlvbnMucGFyYW1zLnB1c2gocGFyYW0pO1xuICAgICAgICBvcHRpb25zLmRlZmF1bHRzLnB1c2goZGVmKTtcblxuICAgICAgICByZXR1cm4gIW1hdGNoKCcpJyk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VQYXJhbXMoZmlyc3RSZXN0cmljdGVkKSB7XG4gICAgICAgIHZhciBvcHRpb25zO1xuXG4gICAgICAgIG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgZGVmYXVsdENvdW50OiAwLFxuICAgICAgICAgICAgZGVmYXVsdHM6IFtdLFxuICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkOiBmaXJzdFJlc3RyaWN0ZWRcbiAgICAgICAgfTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBpZiAoIW1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgIG9wdGlvbnMucGFyYW1TZXQgPSB7fTtcbiAgICAgICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwYXJzZVBhcmFtKG9wdGlvbnMpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdCgnKScpO1xuXG4gICAgICAgIGlmIChvcHRpb25zLmRlZmF1bHRDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgb3B0aW9ucy5kZWZhdWx0cyA9IFtdO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHBhcmFtczogb3B0aW9ucy5wYXJhbXMsXG4gICAgICAgICAgICBkZWZhdWx0czogb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pO1xuICAgICAgICB9XG4gICAgICAgIHN0cmljdCA9IHByZXZpb3VzU3RyaWN0O1xuXG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaEZ1bmN0aW9uRGVjbGFyYXRpb24oaWQsIHBhcmFtcywgZGVmYXVsdHMsIGJvZHkpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlRnVuY3Rpb25FeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgdG9rZW4sIGlkID0gbnVsbCwgc3RyaWN0ZWQsIGZpcnN0UmVzdHJpY3RlZCwgbWVzc2FnZSwgdG1wLFxuICAgICAgICAgICAgcGFyYW1zID0gW10sIGRlZmF1bHRzID0gW10sIGJvZHksIHByZXZpb3VzU3RyaWN0LCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdmdW5jdGlvbicpO1xuXG4gICAgICAgIGlmICghbWF0Y2goJygnKSkge1xuICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICBpZCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICBpZiAoc3RyaWN0KSB7XG4gICAgICAgICAgICAgICAgaWYgKGlzUmVzdHJpY3RlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5TdHJpY3RGdW5jdGlvbk5hbWUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKGlzUmVzdHJpY3RlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZCA9IHRva2VuO1xuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlID0gTWVzc2FnZXMuU3RyaWN0RnVuY3Rpb25OYW1lO1xuICAgICAgIC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Bub2RlLmZpbmlzaEZ1bmN0aW9uRXhwcmVzc2lvbihpZCwgcGFyYW1zLCBkZWZhdWx0cywgYm9keSk7XG4gICAgfVxuXG5cbiAgICBmdW5jdGlvbiBwYXJzZUNsYXNzQm9keSgpIHtcbiAgICAgICAgdmFyIGNsYXNzQm9keSwgdG9rZW4sIGlzU3RhdGljLCBoYXNDb25zdHJ1Y3RvciA9IGZhbHNlLCBib2R5LCBtZXRob2QsIGNvbXB1dGVkLCBrZXk7XG5cbiAgICAgICAgY2xhc3NCb2R5ID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcbiAgICAgICAgYm9keSA9IFtdO1xuICAgICAgICB3aGlsZSAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnOycpKSB7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG1ldGhvZCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgaXNTdGF0aWMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICAgICAga2V5ID0gcGFyc2VPYmplY3RQcm9wZXJ0eUtleSgpO1xuICAgICAgICAgICAgICAgIGlmIChrZXkubmFtZSA9PT0gJ3N0YXRpYycgJiYgbG9va2FoZWFkUHJvcGVydHlOYW1lKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgICAgIGlzU3RhdGljID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgY29tcHV0ZWQgPSBtYXRjaCgnWycpO1xuICAgICAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG1ldGhvZCA9IHRyeVBhcnNlTWV0aG9kRGVmaW5pdGlvbih0b2tlbiwga2V5LCBjb21wdXRlZCwgbWV0aG9kKTtcbiAgICAgICAgICAgICAgICBpZiAobWV0aG9kKSB7XG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZFsnc3RhdGljJ10gPSBpc1N0YXRpYztcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kID09PSAnaW5pdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ21ldGhvZCc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc1N0YXRpYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtZXRob2QuY29tcHV0ZWQgJiYgKG1ldGhvZC5rZXkubmFtZSB8fCBtZXRob2Qua2V5LnZhbHVlLnRvU3RyaW5nKCkpID09PSAnY29uc3RydWN0b3InKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kICE9PSAnbWV0aG9kJyB8fCAhbWV0aG9kLm1ldGhvZCB8fCBtZXRob2QudmFsdWUuZ2VuZXJhdG9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5Db25zdHJ1Y3RvclNwZWNpYWxNZXRob2QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGFzQ29uc3RydWN0b3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4odG9rZW4sIE1lc3NhZ2VzLkR1cGxpY2F0ZUNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNDb25zdHJ1Y3RvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ2NvbnN0cnVjdG9yJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbWV0aG9kLmNvbXB1dGVkICYmIChtZXRob2Qua2V5Lm5hbWUgfHwgbWV0aG9kLmtleS52YWx1ZS50b1N0cmluZygpKSA9PT0gJ3Byb3RvdHlwZScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RhdGljUHJvdG90eXBlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBtZXRob2QudHlwZSA9IFN5bnRheC5NZXRob2REZWZpbml0aW9uO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgbWV0aG9kLm1ldGhvZDtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG1ldGhvZC5zaG9ydGhhbmQ7XG4gICAgICAgICAgICAgICAgICAgIGJvZHkucHVzaChtZXRob2QpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxleCgpO1xuICAgICAgICByZXR1cm4gY2xhc3NCb2R5LmZpbmlzaENsYXNzQm9keShib2R5KTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUNsYXNzRGVjbGFyYXRpb24oaWRlbnRpZmllcklzT3B0aW9uYWwpIHtcbi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Nhc2UgJ2xldCc6XG4gICAgICAgICAgICAgICAgY2FzZSAnY29uc3QnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ3Zhcic6XG4gICAgICAgICAgICAgICAgY2FzZSAnY2xhc3MnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ2Z1bmN0aW9uJzpcbiAgICAgICAgICAgICAgICAgICAgZGVjbGFyYXRpb24gPSBwYXJzZVN0YXRlbWVudExpc3RJdGVtKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydE5hbWVkRGVjbGFyYXRpb24oZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIG51bGwpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCd7Jyk7XG4gICAgICAgIGlmICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlzRXhwb3J0RnJvbUlkZW50aWZpZXIgPSBpc0V4cG9ydEZyb21JZGVudGlmaWVyIHx8IG1hdGNoS2V5d29yZCgnZGVmYXVsdCcpO1xuICAgICAgICAgICAgICAgIHNwZWNpZmllcnMucHVzaChwYXJzZUV4cG9ydFNwZWNpZmllcigpKTtcbiAgICAgICAgICAgIH0gd2hpbGUgKG1hdGNoKCcsJykgJiYgbGV4KCkpO1xuICAgICAgICB9XG4gICAgICAgIGV4cGVjdCgnfScpO1xuXG4gICAgICAgIGlmIChtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdmcm9tJykpIHtcbiAgICAgICAgICAgIC8vIGNvdmVyaW5nOlxuICAgICAgICAgICAgLy8gZXhwb3J0IHtkZWZhdWx0fSBmcm9tICdmb28nO1xuICAgICAgICAgICAgLy8gZXhwb3J0IHtmb299IGZyb20gJ2Zvbyc7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIHNyYyA9IHBhcnNlTW9kdWxlU3BlY2lmaWVyKCk7XG4gICAgICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG4gICAgICAgIH0gZWxzZSBpZiAoaXNFeHBvcnRGcm9tSWRlbnRpZmllcikge1xuICAgICAgICAgICAgLy8gY292ZXJpbmc6XG4gICAgICAgICAgICAvLyBleHBvcnQge2RlZmF1bHR9OyAvLyBtaXNzaW5nIGZyb21DbGF1c2VcbiAgICAgICAgICAgIHRocm93RXJyb3IobG9va2FoZWFkLnZhbHVlID9cbiAgICAgICAgICAgICAgICAgICAgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuIDogTWVzc2FnZXMuTWlzc2luZ0Zyb21DbGF1c2UsIGxvb2thaGVhZC52YWx1ZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBjb3ZlclxuICAgICAgICAgICAgLy8gZXhwb3J0IHtmb299O1xuICAgICAgICAgICAgY29uc3VtZVNlbWljb2xvbigpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydE5hbWVkRGVjbGFyYXRpb24oZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIHNyYyk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICB2YXIgZGVjbGFyYXRpb24gPSBudWxsLFxuICAgICAgICAgICAgZXhwcmVzc2lvbiA9IG51bGw7XG5cbiAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAvLyBleHBvcnQgZGVmYXVsdCAuLi5cbiAgICAgICAgZXhwZWN0S2V5d29yZCgnZGVmYXVsdCcpO1xuXG4gICAgICAgIGlmIChtYXRjaEtleXdvcmQoJ2Z1bmN0aW9uJykpIHtcbiAgICAgICAgICAgIC8vIGNvdmVyczpcbiAgICAgICAgICAgIC8vIGV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7fVxuICAgICAgICAgICAgLy8gZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24g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YXRlLmluRnVuY3Rpb25Cb2R5KSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxJbXBvcnREZWNsYXJhdGlvbik7XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdpbXBvcnQnKTtcbiAgICAgICAgc3BlY2lmaWVycyA9IFtdO1xuXG4gICAgICAgIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uU3RyaW5nTGl0ZXJhbCkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0ICdmb28nO1xuICAgICAgICAgICAgc3JjID0gcGFyc2VNb2R1bGVTcGVjaWZpZXIoKTtcbiAgICAgICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEltcG9ydERlY2xhcmF0aW9uKHNwZWNpZmllcnMsIHNyYyk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW1hdGNoS2V5d29yZCgnZGVmYXVsdCcpICYmIGlzSWRlbnRpZmllck5hbWUobG9va2FoZWFkKSkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0IGZvb1xuICAgICAgICAgICAgLy8gaW1wb3J0IGZvbywgLi4uXG4gICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VJbXBvcnREZWZhdWx0U3BlY2lmaWVyKCkpO1xuICAgICAgICAgICAgaWYgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAobWF0Y2goJyonKSkge1xuICAgICAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAgICAgLy8gaW1wb3J0IGZvbywgKiBhcyBmb29cbiAgICAgICAgICAgIC8vIGltcG9ydCAqIGFzIGZvb1xuICAgICAgICAgICAgc3BlY2lmaWV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bi5TdHJpbmdMaXRlcmFsKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHN0YXRlbWVudCA9IHBhcnNlU3RhdGVtZW50TGlzdEl0ZW0oKTtcbiAgICAgICAgICAgIGJvZHkucHVzaChzdGF0ZW1lbnQpO1xuICAgICAgICAgICAgaWYgKHN0YXRlbWVudC5leHByZXNzaW9uLnR5cGUgIT09IFN5bnRheC5MaXRlcmFsKSB7XG4gICAgICAgICAgICAgICAgLy8gdGhpcyBpcyBub3QgZGlyZWN0aXZlXG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkaXJlY3RpdmUgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQgKyAxLCB0b2tlbi5lbmQgLSAxKTtcbiAgICAgICAgICAgIGlmIChkaXJlY3RpdmUgPT09ICd1c2Ugc3RyaWN0Jykge1xuICAgICAgICAgICAgICAgIHN0cmljdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0UmVzdHJpY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbihmaXJzdFJlc3RyaWN0ZWQsIE1lc3NhZ2VzLlN0cmljdE9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAoIWZpcnN0UmVzdHJpY3RlZCAmJiB0b2tlbi5vY3RhbCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQgPSB0b2tlbjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgc3RhdGVtZW50ID0gcGFyc2VTdGF0ZW1lbnRMaXN0SXRlbSgpO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICAgICAgICBpZiAodHlwZW9mIHN0YXRlbWVudCA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJvZHkucHVzaChzdGF0ZW1lbnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBib2R5O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJvZ3JhbSgpIHtcbiAgICAgICAgdmFyIGJvZHksIG5vZGU7XG5cbiAgICAgICAgcGVlaygpO1xuICAgICAgICBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBib2R5ID0gcGFyc2VTY3JpcHRCb2R5KCk7XG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb2dyYW0oYm9keSk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZmlsdGVyVG9rZW5Mb2NhdGlvbigpIHtcbiAgICAgICAgdmFyIGksIGVudHJ5LCB0b2tlbiwgdG9rZW5zID0gW107XG5cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4dHJhLnRva2Vucy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgZW50cnkgPSBleHRyYS50b2tlbnNbaV07XG4gICAgICAgICAgICB0b2tlbiA9IHtcbiAgICAgICAgICAgICAgICB0eXBlOiBlbnRyeS50eXBlLFxuICAgICAgICAgICAgICAgIHZhbHVlOiBlbnRyeS52YWx1ZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGlmIChlbnRyeS5yZWdleCkge1xuICAgICAgICAgICAgICAgIHRva2VuLnJlZ2V4ID0ge1xuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiBlbnRyeS5yZWdleC5wYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBmbGFnczogZW50cnkucmVnZXguZmxhZ3NcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGV4dHJhLnJhbmdlKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4ucmFuZ2UgPSBlbnRyeS5yYW5nZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChleHRyYS5sb2MpIHtcbiAgICAgICAgICAgICAgICB0b2tlbi5sb2MgPSBlbnRyeS5sb2M7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0b2tlbnMucHVzaCh0b2tlbik7XG4gICAgICAgIH1cblxuICAgICAgICBleHRyYS50b2tlbnMgPSB0b2tlbnM7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gdG9rZW5pemUoY29kZSwgb3B0aW9ucykge1xuICAgICAgICB2YXIgdG9TdHJpbmcsXG4gICAgICAgICAgICB0b2tlbnM7XG5cbiAgICAgICAgdG9TdHJpbmcgPSBTdHJpbmc7XG4gICAgICAgIGlmICh0eXBlb2YgY29kZSAhPT0gJ3N0cmluZycgJiYgIShjb2RlIGluc3RhbmNlb2YgU3RyaW5nKSkge1xuICAgICAgICAgICAgY29kZSA9IHRvU3RyaW5nKGNvZGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgc291cmNlID0gY29kZTtcbiAgICAgICAgaW5kZXggPSAwO1xuICAgICAgICBsaW5lTnVtYmVyID0gKHNvdXJjZS5sZW5ndGggPiAwKSA/IDEgOiAwO1xuICAgICAgICBsaW5lU3RhcnQgPSAwO1xuICAgICAgICBzdGFydEluZGV4ID0gaW5kZXg7XG4gICAgICAgIHN0YXJ0TGluZU51bWJlciA9IGxpbmVOdW1iZXI7XG4gICAgICAgIHN0YXJ0TGluZVN0YXJ0ID0gbGluZVN0YXJ0O1xuICAgICAgICBsZW5ndGggPSBzb3VyY2UubGVuZ3RoO1xuICAgICAgICBsb29rYWhlYWQgPSBudWxsO1xuICAgICAgICBzdGF0ZSA9IHtcbiAgICAgICAgICAgIGFsbG93SW46IHRydWUsXG4gICAgICAgICAgICBsYWJlbFNldDoge30sXG4gICAgICAgICAgICBpbkZ1bmN0aW9uQm9keTogZmFsc2UsXG4gICAgICAgICAgICBpbkl0ZXJhdGlvbjogZmFsc2UsXG4gICAgICAgICAgICBpblN3aXRjaDogZmFsc2UsXG4gICAgICAgICAgICBsYXN0Q29tbWVudFN0YXJ0OiAtMSxcbiAgICAgICAgICAgIGN1cmx5U3RhY2s6IFtdXG4gICAgICAgIH07XG5cbiAgICAgICAgZXh0cmEgPSB7fTtcblxuICAgICAgICAvLyBPcHRpb25zIG1hdGNoaW5nLlxuICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcblxuICAgICAgICAvLyBPZiBjb3Vyc2Ugd2UgY29sbGVjdCB0b2tlbnMgaGVyZS5cbiAgICAgICAgb3B0aW9ucy50b2tlbnMgPSB0cnVlO1xuICAgICAgICBleHRyYS50b2tlbnMgPSBbXTtcbiAgICAgICAgZXh0cmEudG9rZW5pemUgPSB0cnVlO1xuICAgICAgICAvLyBUaGUgZm9sbG93aW5nIHR3byBmaWVsZHMgYXJlIG5lY2Vzc2FyeSB0byBjb21wdXRlIHRoZSBSZWdleCB0b2tlbnMuXG4gICAgICAgIGV4dHJhLm9wZW5QYXJlblRva2VuID0gLTE7XG4gICAgICAgIGV4dHJhLm9wZW5DdXJseVRva2VuID0gLTE7XG5cbiAgICAgICAgZXh0cmEucmFuZ2UgPSAodHlwZW9mIG9wdGlvbnMucmFuZ2UgPT09ICdib29sZWFuJykgJiYgb3B0aW9ucy5yYW5nZTtcbiAgICAgICAgZXh0cmEubG9jID0gKHR5cGVvZiBvcHRpb25zLmxvYyA9PT0gJ2Jvb2xlYW4nKSAmJiBvcHRpb25zLmxvYztcblxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuY29tbWVudCA9PT0gJ2Jvb2xlYW4nICYmIG9wdGlvbnMuY29tbWVudCkge1xuICAgICAgICAgICAgZXh0cmEuY29tbWVudHMgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMudG9sZXJhbnQgPT09ICdib29sZWFuJyAmJiBvcHRpb25zLnRvbGVyYW50KSB7XG4gICAgICAgICAgICBleHRyYS5lcnJvcnMgPSBbXTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwZWVrKCk7XG4gICAgICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLkVPRikge1xuICAgICAgICAgICAgICAgIHJldHVybiBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgd2hpbGUgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5FT0YpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChsZXhFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmEuZXJyb3JzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWNvcmRFcnJvcihsZXhFcnJvcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBoYXZlIHRvIGJyZWFrIG9uIHRoZSBmaXJzdCBlcnJvclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gYXZvaWQgaW5maW5pdGUgbG9vcHMuXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGxleEVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmaWx0ZXJUb2tlbkxvY2F0aW9uKCk7XG4gICAgICAgICAgICB0b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmNvbW1lbnRzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgIHRva2Vucy5jb21tZW50cyA9IGV4dHJhLmNvbW1lbnRzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS5lcnJvcnMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdG9rZW5zLmVycm9ycyA9IGV4dHJhLmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGV4dHJhID0ge307XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRva2VucztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZShjb2RlLCBvcHRpb25zKSB7XG4gICAgICAgIHZhciBwcm9ncmFtLCB0b1N0cmluZztcblxuICAgICAgICB0b1N0cmluZyA9IFN0cmluZztcbiAgICAgICAgaWYgKHR5cGVvZiBjb2RlICE9PSAnc3RyaW5nJyAmJiAhKGNvZGUgaW5zdGFuY2VvZiBTdHJpbmcpKSB7XG4gICAgICAgICAgICBjb2RlID0gdG9TdHJpbmcoY29kZSk7XG4gICAgICAgIH1cblxuICAgICAgICBzb3VyY2UgPSBjb2RlO1xuICAgICAgICBpbmRleCA9IDA7XG4gICAgICAgIGxpbmVOdW1iZXIgPSAoc291cmNlLmxlbmd0aCA+IDApID8gMSA6IDA7XG4gICAgICAgIGxpbmVTdGFydCA9IDA7XG4gICAgICAgIHN0YXJ0SW5kZXggPSBpbmRleDtcbiAgICAgICAgc3RhcnRMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgc3RhcnRMaW5lU3RhcnQgPSBsaW5lU3RhcnQ7XG4gICAgICAgIGxlbmd0aCA9IHNvdXJjZS5sZW5ndGg7XG4gICAgICAgIGxvb2thaGVhZCA9IG51bGw7XG4gICAgICAgIHN0YXRlID0ge1xuICAgIC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YmIG9wdGlvbnMudG9rZW5zKSB7XG4gICAgICAgICAgICAgICAgZXh0cmEudG9rZW5zID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuY29tbWVudCA9PT0gJ2Jvb2xlYW4nICYmIG9wdGlvbnMuY29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLmNvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMudG9sZXJhbnQgPT09ICdib29sZWFuJyAmJiBvcHRpb25zLnRvbGVyYW50KSB7XG4gICAgICAgICAgICAgICAgZXh0cmEuZXJyb3JzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEuYXR0YWNoQ29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLnJhbmdlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBleHRyYS5jb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGV4dHJhLmJvdHRvbVJpZ2h0U3RhY2sgPSBbXTtcbiAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICAgICAgZXh0cmEubGVhZGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5zb3VyY2VUeXBlID09PSAnbW9kdWxlJykge1xuICAgICAgICAgICAgICAgIC8vIHZlcnkgcmVzdHJpY3RpdmUgY29uZGl0aW9uIGZvciBub3dcbiAgICAgICAgICAgICAgICBzb3VyY2VUeXBlID0gb3B0aW9ucy5zb3VyY2VUeXBlO1xuICAgICAgICAgICAgICAgIHN0cmljdCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcHJvZ3JhbSA9IHBhcnNlUHJvZ3JhbSgpO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS5jb21tZW50cyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmNvbW1lbnRzID0gZXh0cmEuY29tbWVudHM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLnRva2VucyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBmaWx0ZXJUb2tlbkxvY2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgcHJvZ3JhbS50b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmVycm9ycyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmVycm9ycyA9IGV4dHJhLmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGV4dHJhID0ge307XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcHJvZ3JhbTtcbiAgICB9XG5cbiAgICAvLyBTeW5jIHdpdGggKi5qc29uIG1hbmlmZXN0cy5cbiAgICBleHBvcnRzLnZlcnNpb24gPSAnMi4yLjAnO1xuXG4gICAgZXhwb3J0cy50b2tlbml6ZSA9IHRva2VuaXplO1xuXG4gICAgZXhwb3J0cy5wYXJzZSA9IHBhcnNlO1xuXG4gICAgLy8gRGVlcCBjb3B5LlxuICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgZXhwb3J0cy5TeW50YXggPSAoZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgbmFtZSwgdHlwZXMgPSB7fTtcblxuICAgICAgICBpZiAodHlwZW9mIE9iamVjdC5jcmVhdGUgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAg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lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gbWFudWFsIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnanNvbicpXG4gKiAgICAgICAgIC5zZW5kKCd7XCJuYW1lXCI6XCJ0alwifSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBtYW51YWwgeC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCgnbmFtZT10aicpXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGRlZmF1bHRzIHRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICAqICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gICogICAgICAgIC5zZW5kKCduYW1lPXRvYmknKVxuICAqICAgICAgICAuc2VuZCgnc3BlY2llcz1mZXJyZXQnKVxuICAqICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqIEBwYXJhbSB7U3RyaW5nfE9iamVjdH0gZGF0YVxuICogQHJldHVybiB7UmVxdWVzdH0gZm9yIGNoYWluaW5nXG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iAqIEBwYXJhbSB7U3RyaW5nfSBldmVudFxuICogQHJldHVybiB7Qm9vbGVhbn1cbiAqIEBhcGkgcHVibGljXG4gKi9cblxuRW1pdHRlci5wcm90b3R5cGUuaGFzTGlzdGVuZXJzID0gZnVuY3Rpb24oZXZlbnQpe1xuICByZXR1cm4gISEgdGhpcy5saXN0ZW5lcnMoZXZlbnQpLmxlbmd0aDtcbn07XG4iLCJcbi8qKlxuICogUmVkdWNlIGBhcnJgIHdpdGggYGZuYC5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhcnJcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGZuXG4gKiBAcGFyYW0ge01peGVkfSBpbml0aWFsXG4gKlxuICogVE9ETzogY29tYmF0aWJsZSBlcnJvciBoYW5kbGluZz9cbiAqL1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uKGFyciwgZm4sIGluaXRpYWwpeyAgXG4gIHZhciBpZHggPSAwO1xuICB2YXIgbGVuID0gYXJyLmxlbmd0aDtcbiAgdmFyIGN1cnIgPSBhcmd1bWVudHMubGVuZ3RoID09IDNcbiAgICA/IGluaXRpYWxcbiAgICA6IGFycltpZHgrK107XG5cbiAgd2hpbGUgKGlkeCA8IGxlbikge1xuICAgIGN1cnIgPSBmbi5jYWxsKG51bGwsIGN1cnIsIGFycltpZHhdLCArK2lkeCwgYXJyKTtcbiAgfVxuICBcbiAgcmV0dXJuIGN1cnI7XG59OyJdfQ==
30605
30606
'use strict';
30607
30608
window.SwaggerUi = Backbone.Router.extend({
30609
30610
  dom_id: 'swagger_ui',
30611
30612
  // Attributes
30613
  options: null,
30614
  api: null,
30615
  headerView: null,
30616
  mainView: null,
30617
30618
  // SwaggerUi accepts all the same options as SwaggerApi
30619
  initialize: function(options) {
30620
    options = options || {};
30621
    if(!options.highlightSizeThreshold) {
30622
      options.highlightSizeThreshold = 100000;
30623
    }
30624
30625
    // Allow dom_id to be overridden
30626
    if (options.dom_id) {
30627
      this.dom_id = options.dom_id;
30628
      delete options.dom_id;
30629
    }
30630
30631
    if (!options.supportedSubmitMethods){
30632
      options.supportedSubmitMethods = [
30633
        'get',
30634
        'put',
30635
        'post',
30636
        'delete',
30637
        'head',
30638
        'options',
30639
        'patch'
30640
      ];
30641
    }
30642
30643
    if (typeof options.oauth2RedirectUrl === 'string') {
30644
      window.oAuthRedirectUrl = options.redirectUrl;
30645
    }
30646
30647
    // Create an empty div which contains the dom_id
30648
    if (! $('#' + this.dom_id).length){
30649
      $('body').append('<div id="' + this.dom_id + '"></div>') ;
30650
    }
30651
30652
    this.options = options;
30653
30654
    // set marked options
30655
    marked.setOptions({gfm: true});
30656
30657
    // Set the callbacks
30658
    var that = this;
30659
    this.options.success = function() { return that.render(); };
30660
    this.options.progress = function(d) { return that.showMessage(d); };
30661
    this.options.failure = function(d) { return that.onLoadFailure(d); };
30662
30663
    // Create view to handle the header inputs
30664
    this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});
30665
30666
    // Event handler for when the baseUrl/apiKey is entered by user
30667
    this.headerView.on('update-swagger-ui', function(data) {
30668
      return that.updateSwaggerUi(data);
30669
    });
30670
  },
30671
30672
  // Set an option after initializing
30673
  setOption: function(option, value) {
30674
    this.options[option] = value;
30675
  },
30676
30677
  // Get the value of a previously set option
30678
  getOption: function(option) {
30679
    return this.options[option];
30680
  },
30681
30682
  // Event handler for when url/key is received from user
30683
  updateSwaggerUi: function(data){
30684
    this.options.url = data.url;
30685
    this.load();
30686
  },
30687
30688
  // Create an api and render
30689
  load: function(){
30690
    // Initialize the API object
30691
    if (this.mainView) {
30692
      this.mainView.clear();
30693
    }
30694
    var url = this.options.url;
30695
    if (url && url.indexOf('http') !== 0) {
30696
      url = this.buildUrl(window.location.href.toString(), url);
30697
    }
30698
    if(this.api) {
30699
      this.options.authorizations = this.api.clientAuthorizations.authz;
30700
    }
30701
    this.options.url = url;
30702
    this.headerView.update(url);
30703
30704
    this.api = new SwaggerClient(this.options);
30705
  },
30706
30707
  // collapse all sections
30708
  collapseAll: function(){
30709
    Docs.collapseEndpointListForResource('');
30710
  },
30711
30712
  // list operations for all sections
30713
  listAll: function(){
30714
    Docs.collapseOperationsForResource('');
30715
  },
30716
30717
  // expand operations for all sections
30718
  expandAll: function(){
30719
    Docs.expandOperationsForResource('');
30720
  },
30721
30722
  // This is bound to success handler for SwaggerApi
30723
  //  so it gets called when SwaggerApi completes loading
30724
  render: function(){
30725
    this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
30726
    this.mainView = new SwaggerUi.Views.MainView({
30727
      model: this.api,
30728
      el: $('#' + this.dom_id),
30729
      swaggerOptions: this.options,
30730
      router: this
30731
    }).render();
30732
    this.showMessage();
30733
    switch (this.options.docExpansion) {
30734
      case 'full':
30735
        this.expandAll(); break;
30736
      case 'list':
30737
        this.listAll(); break;
30738
      default:
30739
        break;
30740
    }
30741
    this.renderGFM();
30742
30743
    if (this.options.onComplete){
30744
      this.options.onComplete(this.api, this);
30745
    }
30746
30747
    setTimeout(Docs.shebang.bind(this), 100);
30748
  },
30749
30750
  buildUrl: function(base, url){
30751
    if (url.indexOf('/') === 0) {
30752
      var parts = base.split('/');
30753
      base = parts[0] + '//' + parts[2];
30754
      return base + url;
30755
    } else {
30756
      var endOfPath = base.length;
30757
30758
      if (base.indexOf('?') > -1){
30759
        endOfPath = Math.min(endOfPath, base.indexOf('?'));
30760
      }
30761
30762
      if (base.indexOf('#') > -1){
30763
        endOfPath = Math.min(endOfPath, base.indexOf('#'));
30764
      }
30765
30766
      base = base.substring(0, endOfPath);
30767
30768
      if (base.indexOf('/', base.length - 1 ) !== -1){
30769
        return base + url;
30770
      }
30771
30772
      return base + '/' + url;
30773
    }
30774
  },
30775
30776
  // Shows message on topbar of the ui
30777
  showMessage: function(data){
30778
    if (data === undefined) {
30779
      data = '';
30780
    }
30781
    var $msgbar = $('#message-bar');
30782
    $msgbar.removeClass('message-fail');
30783
    $msgbar.addClass('message-success');
30784
    $msgbar.html(data);
30785
    if(window.SwaggerTranslator) {
30786
      window.SwaggerTranslator.translate($msgbar);
30787
    }
30788
  },
30789
30790
  // shows message in red
30791
  onLoadFailure: function(data){
30792
    if (data === undefined) {
30793
      data = '';
30794
    }
30795
    $('#message-bar').removeClass('message-success');
30796
    $('#message-bar').addClass('message-fail');
30797
30798
    var val = $('#message-bar').text(data);
30799
30800
    if (this.options.onFailure) {
30801
      this.options.onFailure(data);
30802
    }
30803
30804
    return val;
30805
  },
30806
30807
  // Renders GFM for elements with 'markdown' class
30808
  renderGFM: function(){
30809
    $('.markdown').each(function(){
30810
      $(this).html(marked($(this).html()));
30811
    });
30812
30813
    $('.propDesc', '.model-signature .description').each(function () {
30814
      $(this).html(marked($(this).html())).addClass('markdown');
30815
    });
30816
  }
30817
30818
});
30819
30820
window.SwaggerUi.Views = {};
30821
30822
// don't break backward compatibility with previous versions and warn users to upgrade their code
30823
(function(){
30824
  window.authorizations = {
30825
    add: function() {
30826
      warn('Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add().');
30827
30828
      if (typeof window.swaggerUi === 'undefined') {
30829
        throw new TypeError('window.swaggerUi is not defined');
30830
      }
30831
30832
      if (window.swaggerUi instanceof SwaggerUi) {
30833
        window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments);
30834
      }
30835
    }
30836
  };
30837
30838
  window.ApiKeyAuthorization = function() {
30839
    warn('window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.');
30840
    SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
30841
  };
30842
30843
  window.PasswordAuthorization = function() {
30844
    warn('window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization.');
30845
    SwaggerClient.PasswordAuthorization.apply(window, arguments);
30846
  };
30847
30848
  function warn(message) {
30849
    if ('console' in window && typeof window.console.warn === 'function') {
30850
      console.warn(message);
30851
    }
30852
  }
30853
})();
30854
30855
30856
// UMD
30857
(function (root, factory) {
30858
    if (typeof define === 'function' && define.amd) {
30859
        // AMD. Register as an anonymous module.
30860
        define(['b'], function (b) {
30861
            return (root.SwaggerUi = factory(b));
30862
        });
30863
    } else if (typeof exports === 'object') {
30864
        // Node. Does not work with strict CommonJS, but
30865
        // only CommonJS-like environments that support module.exports,
30866
        // like Node.
30867
        module.exports = factory(require('b'));
30868
    } else {
30869
        // Browser globals
30870
        root.SwaggerUi = factory(root.b);
30871
    }
30872
}(this, function () {
30873
    return SwaggerUi;
30874
}));
30875
30876
'use strict';
30877
30878
SwaggerUi.Views.ApiKeyButton = Backbone.View.extend({ // TODO: append this to global SwaggerUi
30879
30880
  events:{
30881
    'click #apikey_button' : 'toggleApiKeyContainer',
30882
    'click #apply_api_key' : 'applyApiKey'
30883
  },
30884
30885
  initialize: function(opts){
30886
    this.options = opts || {};
30887
    this.router = this.options.router;
30888
  },
30889
30890
  render: function(){
30891
    var template = this.template();
30892
    $(this.el).html(template(this.model));
30893
30894
    return this;
30895
  },
30896
30897
30898
  applyApiKey: function(){
30899
    var keyAuth = new SwaggerClient.ApiKeyAuthorization(
30900
      this.model.name,
30901
      $('#input_apiKey_entry').val(),
30902
      this.model.in
30903
    );
30904
    this.router.api.clientAuthorizations.add(this.model.name, keyAuth);
30905
    this.router.load();
30906
    $('#apikey_container').show();
30907
  },
30908
30909
  toggleApiKeyContainer: function(){
30910
    if ($('#apikey_container').length) {
30911
30912
      var elem = $('#apikey_container').first();
30913
30914
      if (elem.is(':visible')){
30915
        elem.hide();
30916
      } else {
30917
30918
        // hide others
30919
        $('.auth_container').hide();
30920
        elem.show();
30921
      }
30922
    }
30923
  },
30924
30925
  template: function(){
30926
    return Handlebars.templates.apikey_button_view;
30927
  }
30928
30929
});
30930
'use strict';
30931
30932
SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
30933
30934
30935
  initialize: function (opts) {
30936
    this.options = opts || {};
30937
    this.router = this.options.router;
30938
  },
30939
30940
  render: function(){
30941
    var template = this.template();
30942
    $(this.el).html(template(this.model));
30943
30944
    return this;
30945
  },
30946
30947
  events: {
30948
    'click #basic_auth_button' : 'togglePasswordContainer',
30949
    'click #apply_basic_auth' : 'applyPassword'
30950
  },
30951
30952
  applyPassword: function(){
30953
    var username = $('.input_username').val();
30954
    var password = $('.input_password').val();
30955
    var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
30956
    this.router.api.clientAuthorizations.add(this.model.type, basicAuth);
30957
    this.router.load();
30958
    $('#basic_auth_container').hide();
30959
  },
30960
30961
  togglePasswordContainer: function(){
30962
    if ($('#basic_auth_container').length) {
30963
      var elem = $('#basic_auth_container').show();
30964
      if (elem.is(':visible')){
30965
        elem.slideUp();
30966
      } else {
30967
        // hide others
30968
        $('.auth_container').hide();
30969
        elem.show();
30970
      }
30971
    }
30972
  },
30973
30974
  template: function(){
30975
    return Handlebars.templates.basic_auth_button_view;
30976
  }
30977
30978
});
30979
'use strict';
30980
30981
SwaggerUi.Views.ContentTypeView = Backbone.View.extend({
30982
  initialize: function() {},
30983
30984
  render: function(){
30985
  	this.model.contentTypeId = 'ct' + Math.random();
30986
    $(this.el).html(Handlebars.templates.content_type(this.model));
30987
    return this;
30988
  }
30989
});
30990
'use strict';
30991
30992
SwaggerUi.Views.HeaderView = Backbone.View.extend({
30993
  events: {
30994
    'click #show-pet-store-icon'    : 'showPetStore',
30995
    'click #explore'                : 'showCustom',
30996
    'keyup #input_baseUrl'          : 'showCustomOnKeyup',
30997
    'keyup #input_apiKey'           : 'showCustomOnKeyup'
30998
  },
30999
31000
  initialize: function(){},
31001
31002
  showPetStore: function(){
31003
    this.trigger('update-swagger-ui', {
31004
      url:'http://petstore.swagger.io/v2/swagger.json'
31005
    });
31006
  },
31007
31008
  showCustomOnKeyup: function(e){
31009
    if (e.keyCode === 13) {
31010
      this.showCustom();
31011
    }
31012
  },
31013
31014
  showCustom: function(e){
31015
    if (e) {
31016
      e.preventDefault();
31017
    }
31018
31019
    this.trigger('update-swagger-ui', {
31020
      url: $('#input_baseUrl').val(),
31021
      apiKey: $('#input_apiKey').val()
31022
    });
31023
  },
31024
31025
  update: function(url, apiKey, trigger){
31026
    if (trigger === undefined) {
31027
      trigger = false;
31028
    }
31029
31030
    $('#input_baseUrl').val(url);
31031
31032
    //$('#input_apiKey').val(apiKey);
31033
    if (trigger) {
31034
      this.trigger('update-swagger-ui', {url:url});
31035
    }
31036
  }
31037
});
31038
31039
'use strict';
31040
31041
SwaggerUi.Views.MainView = Backbone.View.extend({
31042
  apisSorter : {
31043
    alpha   : function(a,b){ return a.name.localeCompare(b.name); }
31044
  },
31045
  operationsSorters : {
31046
    alpha   : function(a,b){ return a.path.localeCompare(b.path); },
31047
    method  : function(a,b){ return a.method.localeCompare(b.method); }
31048
  },
31049
  initialize: function(opts){
31050
    var sorterOption, sorterFn, key, value;
31051
    opts = opts || {};
31052
31053
    this.router = opts.router;
31054
31055
    // Sort APIs
31056
    if (opts.swaggerOptions.apisSorter) {
31057
      sorterOption = opts.swaggerOptions.apisSorter;
31058
      if (_.isFunction(sorterOption)) {
31059
        sorterFn = sorterOption;
31060
      } else {
31061
        sorterFn = this.apisSorter[sorterOption];
31062
      }
31063
      if (_.isFunction(sorterFn)) {
31064
        this.model.apisArray.sort(sorterFn);
31065
      }
31066
    }
31067
    // Sort operations of each API
31068
    if (opts.swaggerOptions.operationsSorter) {
31069
      sorterOption = opts.swaggerOptions.operationsSorter;
31070
      if (_.isFunction(sorterOption)) {
31071
        sorterFn = sorterOption;
31072
      } else {
31073
        sorterFn = this.operationsSorters[sorterOption];
31074
      }
31075
      if (_.isFunction(sorterFn)) {
31076
        for (key in this.model.apisArray) {
31077
          this.model.apisArray[key].operationsArray.sort(sorterFn);
31078
        }
31079
      }
31080
    }
31081
31082
    // set up the UI for input
31083
    this.model.auths = [];
31084
31085
    for (key in this.model.securityDefinitions) {
31086
      value = this.model.securityDefinitions[key];
31087
31088
      this.model.auths.push({
31089
        name: key,
31090
        type: value.type,
31091
        value: value
31092
      });
31093
    }
31094
31095
    if ('validatorUrl' in opts.swaggerOptions) {
31096
      // Validator URL specified explicitly
31097
      this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
31098
    } else if (this.model.url.indexOf('localhost') > 0) {
31099
      // Localhost override
31100
      this.model.validatorUrl = null;
31101
    } else {
31102
      // Default validator
31103
      if(window.location.protocol === 'https:') {
31104
        this.model.validatorUrl = 'https://online.swagger.io/validator';
31105
      }
31106
      else {
31107
        this.model.validatorUrl = 'http://online.swagger.io/validator';
31108
      }
31109
    }
31110
  },
31111
31112
  render: function(){
31113
    if (this.model.securityDefinitions) {
31114
      for (var name in this.model.securityDefinitions) {
31115
        var auth = this.model.securityDefinitions[name];
31116
        var button;
31117
31118
        if (auth.type === 'apiKey' && $('#apikey_button').length === 0) {
31119
          button = new SwaggerUi.Views.ApiKeyButton({model: auth, router:  this.router}).render().el;
31120
          $('.auth_main_container').append(button);
31121
        }
31122
31123
        if (auth.type === 'basicAuth' && $('#basic_auth_button').length === 0) {
31124
          button = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
31125
          $('.auth_main_container').append(button);
31126
        }
31127
      }
31128
    }
31129
31130
    // Render the outer container for resources
31131
    $(this.el).html(Handlebars.templates.main(this.model));
31132
31133
    // Render each resource
31134
31135
    var resources = {};
31136
    var counter = 0;
31137
    for (var i = 0; i < this.model.apisArray.length; i++) {
31138
      var resource = this.model.apisArray[i];
31139
      var id = resource.name;
31140
      while (typeof resources[id] !== 'undefined') {
31141
        id = id + '_' + counter;
31142
        counter += 1;
31143
      }
31144
      resource.id = id;
31145
      resources[id] = resource;
31146
      this.addResource(resource, this.model.auths);
31147
    }
31148
31149
    $('.propWrap').hover(function onHover(){
31150
      $('.optionsWrapper', $(this)).show();
31151
    }, function offhover(){
31152
      $('.optionsWrapper', $(this)).hide();
31153
    });
31154
    return this;
31155
  },
31156
31157
  addResource: function(resource, auths){
31158
    // Render a resource and add it to resources li
31159
    resource.id = resource.id.replace(/\s/g, '_');
31160
    var resourceView = new SwaggerUi.Views.ResourceView({
31161
      model: resource,
31162
      router: this.router,
31163
      tagName: 'li',
31164
      id: 'resource_' + resource.id,
31165
      className: 'resource',
31166
      auths: auths,
31167
      swaggerOptions: this.options.swaggerOptions
31168
    });
31169
    $('#resources', this.el).append(resourceView.render().el);
31170
  },
31171
31172
  clear: function(){
31173
    $(this.el).html('');
31174
  }
31175
});
31176
31177
'use strict';
31178
31179
SwaggerUi.Views.OperationView = Backbone.View.extend({
31180
  invocationUrl: null,
31181
31182
  events: {
31183
    'submit .sandbox'         : 'submitOperation',
31184
    'click .submit'           : 'submitOperation',
31185
    'click .response_hider'   : 'hideResponse',
31186
    'click .toggleOperation'  : 'toggleOperationContent',
31187
    'mouseenter .api-ic'      : 'mouseEnter',
31188
    'dblclick .curl'          : 'selectText',
31189
  },
31190
31191
  initialize: function(opts) {
31192
    opts = opts || {};
31193
    this.router = opts.router;
31194
    this.auths = opts.auths;
31195
    this.parentId = this.model.parentId;
31196
    this.nickname = this.model.nickname;
31197
    this.model.encodedParentId = encodeURIComponent(this.parentId);
31198
    return this;
31199
  },
31200
31201
  selectText: function(event) {
31202
      var doc = document,
31203
          text = event.target.firstChild,
31204
          range,
31205
          selection;
31206
      if (doc.body.createTextRange) {
31207
          range = document.body.createTextRange();
31208
          range.moveToElementText(text);
31209
          range.select();
31210
      } else if (window.getSelection) {
31211
          selection = window.getSelection();
31212
          range = document.createRange();
31213
          range.selectNodeContents(text);
31214
          selection.removeAllRanges();
31215
          selection.addRange(range);
31216
      }
31217
  },
31218
31219
  mouseEnter: function(e) {
31220
    var elem = $(this.el).find('.content');
31221
    var x = e.pageX;
31222
    var y = e.pageY;
31223
    var scX = $(window).scrollLeft();
31224
    var scY = $(window).scrollTop();
31225
    var scMaxX = scX + $(window).width();
31226
    var scMaxY = scY + $(window).height();
31227
    var wd = elem.width();
31228
    var hgh = elem.height();
31229
31230
    if (x + wd > scMaxX) {
31231
      x = scMaxX - wd;
31232
    }
31233
31234
    if (x < scX) {
31235
      x = scX;
31236
    }
31237
31238
    if (y + hgh > scMaxY) {
31239
      y = scMaxY - hgh;
31240
    }
31241
31242
    if (y < scY) {
31243
      y = scY;
31244
    }
31245
31246
    var pos = {};
31247
    pos.top = y;
31248
    pos.left = x;
31249
    elem.css(pos);
31250
  },
31251
31252
  // Note: copied from CoffeeScript compiled file
31253
  // TODO: redactor
31254
  render: function() {
31255
    var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
31256
    isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
31257
    if (!isMethodSubmissionSupported) {
31258
      this.model.isReadOnly = true;
31259
    }
31260
    this.model.description = this.model.description || this.model.notes;
31261
    this.model.oauth = null;
31262
    modelAuths = this.model.authorizations || this.model.security;
31263
    if (modelAuths) {
31264
      if (Array.isArray(modelAuths)) {
31265
        for (l = 0, len = modelAuths.length; l < len; l++) {
31266
          auths = modelAuths[l];
31267
          for (key in auths) {
31268
            for (a in this.auths) {
31269
              auth = this.auths[a];
31270
              if (key === auth.name) {
31271
                if (auth.type === 'oauth2') {
31272
                  this.model.oauth = {};
31273
                  this.model.oauth.scopes = [];
31274
                  ref1 = auth.value.scopes;
31275
                  for (k in ref1) {
31276
                    v = ref1[k];
31277
                    scopeIndex = auths[key].indexOf(k);
31278
                    if (scopeIndex >= 0) {
31279
                      o = {
31280
                        scope: k,
31281
                        description: v
31282
                      };
31283
                      this.model.oauth.scopes.push(o);
31284
                    }
31285
                  }
31286
                }
31287
              }
31288
            }
31289
          }
31290
        }
31291
      } else {
31292
        for (k in modelAuths) {
31293
          v = modelAuths[k];
31294
          if (k === 'oauth2') {
31295
            if (this.model.oauth === null) {
31296
              this.model.oauth = {};
31297
            }
31298
            if (this.model.oauth.scopes === void 0) {
31299
              this.model.oauth.scopes = [];
31300
            }
31301
            for (m = 0, len1 = v.length; m < len1; m++) {
31302
              o = v[m];
31303
              this.model.oauth.scopes.push(o);
31304
            }
31305
          }
31306
        }
31307
      }
31308
    }
31309
    if (typeof this.model.responses !== 'undefined') {
31310
      this.model.responseMessages = [];
31311
      ref2 = this.model.responses;
31312
      for (code in ref2) {
31313
        value = ref2[code];
31314
        schema = null;
31315
        schemaObj = this.model.responses[code].schema;
31316
        if (schemaObj && schemaObj.$ref) {
31317
          schema = schemaObj.$ref;
31318
          if (schema.indexOf('#/definitions/') === 0) {
31319
            schema = schema.substring('#/definitions/'.length);
31320
          }
31321
        }
31322
        this.model.responseMessages.push({
31323
          code: code,
31324
          message: value.description,
31325
          responseModel: schema
31326
        });
31327
      }
31328
    }
31329
    if (typeof this.model.responseMessages === 'undefined') {
31330
      this.model.responseMessages = [];
31331
    }
31332
    signatureModel = null;
31333
    if (this.model.successResponse) {
31334
      successResponse = this.model.successResponse;
31335
      for (key in successResponse) {
31336
        value = successResponse[key];
31337
        this.model.successCode = key;
31338
        if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
31339
          signatureModel = {
31340
            sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
31341
            isParam: false,
31342
            signature: value.getMockSignature()
31343
          };
31344
        }
31345
      }
31346
    } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
31347
      signatureModel = {
31348
        sampleJSON: this.model.responseSampleJSON,
31349
        isParam: false,
31350
        signature: this.model.responseClassSignature
31351
      };
31352
    }
31353
    var opts = this.options.swaggerOptions;
31354
    if (opts.showRequestHeaders) {
31355
      this.model.showRequestHeaders = true;
31356
    }
31357
    $(this.el).html(Handlebars.templates.operation(this.model));
31358
    if (signatureModel) {
31359
      responseSignatureView = new SwaggerUi.Views.SignatureView({
31360
        model: signatureModel,
31361
        router: this.router,
31362
        tagName: 'div'
31363
      });
31364
      $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
31365
    } else {
31366
      this.model.responseClassSignature = 'string';
31367
      $('.model-signature', $(this.el)).html(this.model.type);
31368
    }
31369
    contentTypeModel = {
31370
      isParam: false
31371
    };
31372
    contentTypeModel.consumes = this.model.consumes;
31373
    contentTypeModel.produces = this.model.produces;
31374
    ref3 = this.model.parameters;
31375
    for (n = 0, len2 = ref3.length; n < len2; n++) {
31376
      param = ref3[n];
31377
      type = param.type || param.dataType || '';
31378
      if (typeof type === 'undefined') {
31379
        schema = param.schema;
31380
        if (schema && schema.$ref) {
31381
          ref = schema.$ref;
31382
          if (ref.indexOf('#/definitions/') === 0) {
31383
            type = ref.substring('#/definitions/'.length);
31384
          } else {
31385
            type = ref;
31386
          }
31387
        }
31388
      }
31389
      if (type && type.toLowerCase() === 'file') {
31390
        if (!contentTypeModel.consumes) {
31391
          contentTypeModel.consumes = 'multipart/form-data';
31392
        }
31393
      }
31394
      param.type = type;
31395
    }
31396
    responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({
31397
      model: contentTypeModel,
31398
      router: this.router
31399
    });
31400
    $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
31401
    ref4 = this.model.parameters;
31402
    for (p = 0, len3 = ref4.length; p < len3; p++) {
31403
      param = ref4[p];
31404
      this.addParameter(param, contentTypeModel.consumes);
31405
    }
31406
    ref5 = this.model.responseMessages;
31407
    for (q = 0, len4 = ref5.length; q < len4; q++) {
31408
      statusCode = ref5[q];
31409
      this.addStatusCode(statusCode);
31410
    }
31411
    return this;
31412
  },
31413
31414
  addParameter: function(param, consumes) {
31415
    // Render a parameter
31416
    param.consumes = consumes;
31417
    var paramView = new SwaggerUi.Views.ParameterView({
31418
      model: param,
31419
      tagName: 'tr',
31420
      readOnly: this.model.isReadOnly
31421
    });
31422
    $('.operation-params', $(this.el)).append(paramView.render().el);
31423
  },
31424
31425
  addStatusCode: function(statusCode) {
31426
    // Render status codes
31427
    var statusCodeView = new SwaggerUi.Views.StatusCodeView({
31428
      model: statusCode,
31429
      tagName: 'tr',
31430
      router: this.router
31431
    });
31432
    $('.operation-status', $(this.el)).append(statusCodeView.render().el);
31433
  },
31434
31435
  // Note: copied from CoffeeScript compiled file
31436
  // TODO: redactor
31437
  submitOperation: function(e) {
31438
    var error_free, form, isFileUpload, map, opts;
31439
    if (e !== null) {
31440
      e.preventDefault();
31441
    }
31442
    form = $('.sandbox', $(this.el));
31443
    error_free = true;
31444
    form.find('input.required').each(function() {
31445
      $(this).removeClass('error');
31446
      if (jQuery.trim($(this).val()) === '') {
31447
        $(this).addClass('error');
31448
        $(this).wiggle({
31449
          callback: (function(_this) {
31450
            return function() {
31451
              $(_this).focus();
31452
            };
31453
          })(this)
31454
        });
31455
        error_free = false;
31456
      }
31457
    });
31458
    form.find('textarea.required').each(function() {
31459
      $(this).removeClass('error');
31460
      if (jQuery.trim($(this).val()) === '') {
31461
        $(this).addClass('error');
31462
        $(this).wiggle({
31463
          callback: (function(_this) {
31464
            return function() {
31465
              return $(_this).focus();
31466
            };
31467
          })(this)
31468
        });
31469
        error_free = false;
31470
      }
31471
    });
31472
    form.find('select.required').each(function() {
31473
      $(this).removeClass('error');
31474
      if (this.selectedIndex === -1) {
31475
        $(this).addClass('error');
31476
        $(this).wiggle({
31477
          callback: (function(_this) {
31478
            return function() {
31479
              $(_this).focus();
31480
            };
31481
          })(this)
31482
        });
31483
        error_free = false;
31484
      }
31485
    });
31486
    if (error_free) {
31487
      map = this.getInputMap(form);
31488
      isFileUpload = this.isFileUpload(form);
31489
      opts = {
31490
        parent: this
31491
      };
31492
      if (this.options.swaggerOptions) {
31493
        for(var key in this.options.swaggerOptions) {
31494
          opts[key] = this.options.swaggerOptions[key];
31495
        }
31496
      }
31497
      opts.responseContentType = $('div select[name=responseContentType]', $(this.el)).val();
31498
      opts.requestContentType = $('div select[name=parameterContentType]', $(this.el)).val();
31499
      $('.response_throbber', $(this.el)).show();
31500
      if (isFileUpload) {
31501
        $('.request_url', $(this.el)).html('<pre></pre>');
31502
        $('.request_url pre', $(this.el)).text(this.invocationUrl);
31503
31504
        opts.useJQuery = true;
31505
        map.parameterContentType = 'multipart/form-data';
31506
31507
        return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
31508
      } else {
31509
        this.map = map;
31510
        return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
31511
      }
31512
    }
31513
  },
31514
31515
  getInputMap: function (form) {
31516
    var map, ref1, l, len, o, ref2, m, len1, val, ref3, n, len2;
31517
    map = {};
31518
    ref1 = form.find('input');
31519
    for (l = 0, len = ref1.length; l < len; l++) {
31520
      o = ref1[l];
31521
      if ((o.value !== null) && jQuery.trim(o.value).length > 0) {
31522
        map[o.name] = o.value;
31523
      }
31524
      if (o.type === 'file') {
31525
        map[o.name] = o.files[0];
31526
      }
31527
    }
31528
    ref2 = form.find('textarea');
31529
    for (m = 0, len1 = ref2.length; m < len1; m++) {
31530
      o = ref2[m];
31531
      val = this.getTextAreaValue(o);
31532
      if ((val !== null) && jQuery.trim(val).length > 0) {
31533
        map[o.name] = val;
31534
      }
31535
    }
31536
    ref3 = form.find('select');
31537
    for (n = 0, len2 = ref3.length; n < len2; n++) {
31538
      o = ref3[n];
31539
      val = this.getSelectedValue(o);
31540
      if ((val !== null) && jQuery.trim(val).length > 0) {
31541
        map[o.name] = val;
31542
      }
31543
    }
31544
    return map;
31545
  },
31546
31547
  isFileUpload: function (form) {
31548
    var ref1, l, len, o;
31549
    var isFileUpload = false;
31550
    ref1 = form.find('input');
31551
    for (l = 0, len = ref1.length; l < len; l++) {
31552
      o = ref1[l];
31553
      if (o.type === 'file') {
31554
        isFileUpload = true;
31555
      }
31556
    }
31557
    return isFileUpload;
31558
  },
31559
31560
  success: function(response, parent) {
31561
    parent.showCompleteStatus(response);
31562
  },
31563
31564
  // wraps a jquery response as a shred response
31565
  wrap: function(data) {
31566
   var h, headerArray, headers, i, l, len, o;
31567
    headers = {};
31568
    headerArray = data.getAllResponseHeaders().split('\r');
31569
    for (l = 0, len = headerArray.length; l < len; l++) {
31570
      i = headerArray[l];
31571
      h = i.match(/^([^:]*?):(.*)$/);
31572
      if (!h) {
31573
        h = [];
31574
      }
31575
      h.shift();
31576
      if (h[0] !== void 0 && h[1] !== void 0) {
31577
        headers[h[0].trim()] = h[1].trim();
31578
      }
31579
    }
31580
    o = {};
31581
    o.content = {};
31582
    o.content.data = data.responseText;
31583
    o.headers = headers;
31584
    o.request = {};
31585
    o.request.url = this.invocationUrl;
31586
    o.status = data.status;
31587
    return o;
31588
  },
31589
31590
  getSelectedValue: function(select) {
31591
    if (!select.multiple) {
31592
      return select.value;
31593
    } else {
31594
      var options = [];
31595
      for (var l = 0, len = select.options.length; l < len; l++) {
31596
        var opt = select.options[l];
31597
        if (opt.selected) {
31598
          options.push(opt.value);
31599
        }
31600
      }
31601
      if (options.length > 0) {
31602
        return options;
31603
      } else {
31604
        return null;
31605
      }
31606
    }
31607
  },
31608
31609
  // handler for hide response link
31610
  hideResponse: function(e) {
31611
    if (e) { e.preventDefault(); }
31612
    $('.response', $(this.el)).slideUp();
31613
    $('.response_hider', $(this.el)).fadeOut();
31614
  },
31615
31616
  // Show response from server
31617
  showResponse: function(response) {
31618
    var prettyJson = JSON.stringify(response, null, '\t').replace(/\n/g, '<br>');
31619
    $('.response_body', $(this.el)).html(_.escape(prettyJson));
31620
  },
31621
31622
  // Show error from server
31623
  showErrorStatus: function(data, parent) {
31624
    parent.showStatus(data);
31625
  },
31626
31627
  // show the status codes
31628
  showCompleteStatus: function(data, parent){
31629
    parent.showStatus(data);
31630
  },
31631
31632
  // Adapted from http://stackoverflow.com/a/2893259/454004
31633
  // Note: directly ported from CoffeeScript
31634
  // TODO: Cleanup CoffeeScript artifacts
31635
  formatXml: function(xml) {
31636
    var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
31637
    reg = /(>)(<)(\/*)/g;
31638
    wsexp = /[ ]*(.*)[ ]+\n/g;
31639
    contexp = /(<.+>)(.+\n)/g;
31640
    xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
31641
    pad = 0;
31642
    formatted = '';
31643
    lines = xml.split('\n');
31644
    indent = 0;
31645
    lastType = 'other';
31646
    transitions = {
31647
      'single->single': 0,
31648
      'single->closing': -1,
31649
      'single->opening': 0,
31650
      'single->other': 0,
31651
      'closing->single': 0,
31652
      'closing->closing': -1,
31653
      'closing->opening': 0,
31654
      'closing->other': 0,
31655
      'opening->single': 1,
31656
      'opening->closing': 0,
31657
      'opening->opening': 1,
31658
      'opening->other': 1,
31659
      'other->single': 0,
31660
      'other->closing': -1,
31661
      'other->opening': 0,
31662
      'other->other': 0
31663
    };
31664
    fn = function(ln) {
31665
      var fromTo, j, key, padding, type, types, value;
31666
      types = {
31667
        single: Boolean(ln.match(/<.+\/>/)),
31668
        closing: Boolean(ln.match(/<\/.+>/)),
31669
        opening: Boolean(ln.match(/<[^!?].*>/))
31670
      };
31671
      type = ((function() {
31672
        var results;
31673
        results = [];
31674
        for (key in types) {
31675
          value = types[key];
31676
          if (value) {
31677
            results.push(key);
31678
          }
31679
        }
31680
        return results;
31681
      })())[0];
31682
      type = type === void 0 ? 'other' : type;
31683
      fromTo = lastType + '->' + type;
31684
      lastType = type;
31685
      padding = '';
31686
      indent += transitions[fromTo];
31687
      padding = ((function() {
31688
        var m, ref1, results;
31689
        results = [];
31690
        for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
31691
          results.push('  ');
31692
        }
31693
        return results;
31694
      })()).join('');
31695
      if (fromTo === 'opening->closing') {
31696
        formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
31697
      } else {
31698
        formatted += padding + ln + '\n';
31699
      }
31700
    };
31701
    for (l = 0, len = lines.length; l < len; l++) {
31702
      ln = lines[l];
31703
      fn(ln);
31704
    }
31705
    return formatted;
31706
  },
31707
31708
  // puts the response data in UI
31709
  showStatus: function(response) {
31710
    var url, content;
31711
    if (response.content === undefined) {
31712
      content = response.data;
31713
      url = response.url;
31714
    } else {
31715
      content = response.content.data;
31716
      url = response.request.url;
31717
    }
31718
    var headers = response.headers;
31719
    content = jQuery.trim(content);
31720
31721
    // if server is nice, and sends content-type back, we can use it
31722
    var contentType = null;
31723
    if (headers) {
31724
      contentType = headers['Content-Type'] || headers['content-type'];
31725
      if (contentType) {
31726
        contentType = contentType.split(';')[0].trim();
31727
      }
31728
    }
31729
    $('.response_body', $(this.el)).removeClass('json');
31730
    $('.response_body', $(this.el)).removeClass('xml');
31731
31732
    var supportsAudioPlayback = function(contentType){
31733
      var audioElement = document.createElement('audio');
31734
      return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, ''));
31735
    };
31736
31737
    var pre;
31738
    var code;
31739
    if (!content) {
31740
      code = $('<code />').text('no content');
31741
      pre = $('<pre class="json" />').append(code);
31742
31743
    // JSON
31744
    } else if (contentType === 'application/json' || /\+json$/.test(contentType)) {
31745
      var json = null;
31746
      try {
31747
        json = JSON.stringify(JSON.parse(content), null, '  ');
31748
      } catch (_error) {
31749
        json = 'can\'t parse JSON.  Raw result:\n\n' + content;
31750
      }
31751
      code = $('<code />').text(json);
31752
      pre = $('<pre class="json" />').append(code);
31753
31754
    // XML
31755
    } else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) {
31756
      code = $('<code />').text(this.formatXml(content));
31757
      pre = $('<pre class="xml" />').append(code);
31758
31759
    // HTML
31760
    } else if (contentType === 'text/html') {
31761
      code = $('<code />').html(_.escape(content));
31762
      pre = $('<pre class="xml" />').append(code);
31763
31764
    // Plain Text
31765
    } else if (/text\/plain/.test(contentType)) {
31766
      code = $('<code />').text(content);
31767
      pre = $('<pre class="plain" />').append(code);
31768
31769
31770
    // Image
31771
    } else if (/^image\//.test(contentType)) {
31772
      pre = $('<img>').attr('src', url);
31773
31774
    // Audio
31775
    } else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
31776
      pre = $('<audio controls>').append($('<source>').attr('src', url).attr('type', contentType));
31777
31778
    // Download
31779
    } else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
31780
               headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
31781
               headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
31782
               headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
31783
31784
      if ('Blob' in window) {
31785
        var type = contentType || 'text/html';
31786
        var blob = new Blob([content], {type: type});
31787
        var a = document.createElement('a');
31788
        var href = window.URL.createObjectURL(blob);
31789
        var fileName = response.url.substr(response.url.lastIndexOf('/') + 1);
31790
        var download = [type, fileName, href].join(':');
31791
31792
        a.setAttribute('href', href);
31793
        a.setAttribute('download', download);
31794
        a.innerText = 'Download ' + fileName;
31795
31796
        pre = $('<div/>').append(a);
31797
      } else {
31798
        pre = $('<pre class="json" />').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
31799
      }
31800
31801
    // Location header based redirect download
31802
    } else if(headers.location || headers.Location) {
31803
      window.location = response.url;
31804
31805
    // Anything else (CORS)
31806
    } else {
31807
      code = $('<code />').text(content);
31808
      pre = $('<pre class="json" />').append(code);
31809
    }
31810
    var response_body = pre;
31811
    $('.request_url', $(this.el)).html('<pre></pre>');
31812
    $('.request_url pre', $(this.el)).text(url);
31813
    $('.response_code', $(this.el)).html('<pre>' + response.status + '</pre>');
31814
    $('.response_body', $(this.el)).html(response_body);
31815
    $('.response_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(response.headers, null, '  ')).replace(/\n/g, '<br>') + '</pre>');
31816
    $('.response', $(this.el)).slideDown();
31817
    $('.response_hider', $(this.el)).show();
31818
    $('.response_throbber', $(this.el)).hide();
31819
31820
31821
    //adds curl output
31822
    var curlCommand = this.model.asCurl(this.map);
31823
    curlCommand = curlCommand.replace('!', '&#33;');
31824
    $( '.curl', $(this.el)).html('<pre>' + curlCommand + '</pre>');
31825
31826
    // only highlight the response if response is less than threshold, default state is highlight response
31827
    var opts = this.options.swaggerOptions;
31828
31829
    if (opts.showRequestHeaders) {
31830
      var form = $('.sandbox', $(this.el)),
31831
        map = this.getInputMap(form),
31832
        requestHeaders = this.model.getHeaderParams(map);
31833
      delete requestHeaders['Content-Type'];
31834
      $('.request_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(requestHeaders, null, '  ')).replace(/\n/g, '<br>') + '</pre>');
31835
    }
31836
31837
    var response_body_el = $('.response_body', $(this.el))[0];
31838
    // only highlight the response if response is less than threshold, default state is highlight response
31839
    if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold) {
31840
      return response_body_el;
31841
    } else {
31842
      return hljs.highlightBlock(response_body_el);
31843
    }
31844
  },
31845
31846
  toggleOperationContent: function (event) {
31847
    var elem = $('#' + Docs.escapeResourceName(this.parentId + '_' + this.nickname + '_content'));
31848
    if (elem.is(':visible')){
31849
      event.preventDefault();
31850
      $.bbq.pushState('#/', 2);
31851
      Docs.collapseOperation(elem);
31852
    } else {
31853
      Docs.expandOperation(elem);
31854
    }
31855
  },
31856
31857
  getTextAreaValue: function(textArea) {
31858
    var param, parsed, result, i;
31859
    if (textArea.value === null || jQuery.trim(textArea.value).length === 0) {
31860
      return null;
31861
    }
31862
    param = this.getParamByName(textArea.name);
31863
    if (param && param.type && param.type.toLowerCase() === 'array') {
31864
      parsed = textArea.value.split('\n');
31865
      result = [];
31866
      for (i = 0; i < parsed.length; i++) {
31867
        if (parsed[i] !== null && jQuery.trim(parsed[i]).length > 0) {
31868
          result.push(parsed[i]);
31869
        }
31870
      }
31871
      return result.length > 0 ? result : null;
31872
    } else {
31873
      return textArea.value;
31874
    }
31875
  },
31876
31877
  getParamByName: function(name) {
31878
    var i;
31879
    if (this.model.parameters) {
31880
      for(i = 0; i < this.model.parameters.length; i++) {
31881
        if (this.model.parameters[i].name === name) {
31882
          return this.model.parameters[i];
31883
        }
31884
      }
31885
    }
31886
    return null;
31887
  }
31888
31889
});
31890
31891
'use strict';
31892
31893
SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
31894
  initialize: function  () {},
31895
31896
  render: function(){
31897
    this.model.parameterContentTypeId = 'pct' + Math.random();
31898
    $(this.el).html(Handlebars.templates.parameter_content_type(this.model));
31899
    return this;
31900
  }
31901
31902
});
31903
'use strict';
31904
31905
SwaggerUi.Views.ParameterView = Backbone.View.extend({
31906
  initialize: function(){
31907
    Handlebars.registerHelper('isArray', function(param, opts) {
31908
      if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
31909
        return opts.fn(this);
31910
      } else {
31911
        return opts.inverse(this);
31912
      }
31913
    });
31914
  },
31915
31916
  render: function() {
31917
    var type = this.model.type || this.model.dataType;
31918
31919
    if (typeof type === 'undefined') {
31920
      var schema = this.model.schema;
31921
      if (schema && schema.$ref) {
31922
        var ref = schema.$ref;
31923
        if (ref.indexOf('#/definitions/') === 0) {
31924
          type = ref.substring('#/definitions/'.length);
31925
        } else {
31926
          type = ref;
31927
        }
31928
      }
31929
    }
31930
31931
    this.model.type = type;
31932
    this.model.paramType = this.model.in || this.model.paramType;
31933
    this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body';
31934
    this.model.isFile = type && type.toLowerCase() === 'file';
31935
31936
    // Allow for default === false
31937
    if(typeof this.model.default === 'undefined') {
31938
      this.model.default = this.model.defaultValue;
31939
    }
31940
31941
    this.model.hasDefault = (typeof this.model.default !== 'undefined');
31942
    this.model.valueId = 'm' + this.model.name + Math.random();
31943
31944
    if (this.model.allowableValues) {
31945
      this.model.isList = true;
31946
    }
31947
31948
    var template = this.template();
31949
    $(this.el).html(template(this.model));
31950
31951
    var signatureModel = {
31952
      sampleJSON: this.model.sampleJSON,
31953
      isParam: true,
31954
      signature: this.model.signature
31955
    };
31956
31957
    if (this.model.sampleJSON) {
31958
      var signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'});
31959
      $('.model-signature', $(this.el)).append(signatureView.render().el);
31960
    }
31961
    else {
31962
      $('.model-signature', $(this.el)).html(this.model.signature);
31963
    }
31964
31965
    var isParam = false;
31966
31967
    if (this.model.isBody) {
31968
      isParam = true;
31969
    }
31970
31971
    var contentTypeModel = {
31972
      isParam: isParam
31973
    };
31974
31975
    contentTypeModel.consumes = this.model.consumes;
31976
31977
    if (isParam) {
31978
      var parameterContentTypeView = new SwaggerUi.Views.ParameterContentTypeView({model: contentTypeModel});
31979
      $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
31980
    }
31981
31982
    else {
31983
      var responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({model: contentTypeModel});
31984
      $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
31985
    }
31986
31987
    return this;
31988
  },
31989
31990
  // Return an appropriate template based on if the parameter is a list, readonly, required
31991
  template: function(){
31992
    if (this.model.isList) {
31993
      return Handlebars.templates.param_list;
31994
    } else {
31995
      if (this.options.readOnly) {
31996
        if (this.model.required) {
31997
          return Handlebars.templates.param_readonly_required;
31998
        } else {
31999
          return Handlebars.templates.param_readonly;
32000
        }
32001
      } else {
32002
        if (this.model.required) {
32003
          return Handlebars.templates.param_required;
32004
        } else {
32005
          return Handlebars.templates.param;
32006
        }
32007
      }
32008
    }
32009
  }
32010
});
32011
32012
'use strict';
32013
32014
SwaggerUi.Views.ResourceView = Backbone.View.extend({
32015
  initialize: function(opts) {
32016
    opts = opts || {};
32017
    this.router = opts.router;
32018
    this.auths = opts.auths;
32019
    if ('' === this.model.description) {
32020
      this.model.description = null;
32021
    }
32022
    if (this.model.description) {
32023
      this.model.summary = this.model.description;
32024
    }
32025
  },
32026
32027
  render: function(){
32028
    var methods = {};
32029
32030
32031
    $(this.el).html(Handlebars.templates.resource(this.model));
32032
32033
    // Render each operation
32034
    for (var i = 0; i < this.model.operationsArray.length; i++) {
32035
      var operation = this.model.operationsArray[i];
32036
      var counter = 0;
32037
      var id = operation.nickname;
32038
32039
      while (typeof methods[id] !== 'undefined') {
32040
        id = id + '_' + counter;
32041
        counter += 1;
32042
      }
32043
32044
      methods[id] = operation;
32045
32046
      operation.nickname = id;
32047
      operation.parentId = this.model.id;
32048
      this.addOperation(operation);
32049
    }
32050
32051
    $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
32052
    $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
32053
    $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
32054
32055
    return this;
32056
  },
32057
32058
  addOperation: function(operation) {
32059
32060
    operation.number = this.number;
32061
32062
    // Render an operation and add it to operations li
32063
    var operationView = new SwaggerUi.Views.OperationView({
32064
      model: operation,
32065
      router: this.router,
32066
      tagName: 'li',
32067
      className: 'endpoint',
32068
      swaggerOptions: this.options.swaggerOptions,
32069
      auths: this.auths
32070
    });
32071
32072
    $('.endpoints', $(this.el)).append(operationView.render().el);
32073
32074
    this.number++;
32075
32076
  },
32077
  // Generic Event handler (`Docs` is global)
32078
32079
32080
  callDocs: function(fnName, e) {
32081
    e.preventDefault();
32082
    Docs[fnName](e.currentTarget.getAttribute('data-id'));
32083
  }
32084
});
32085
'use strict';
32086
32087
SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({
32088
  initialize: function(){},
32089
32090
  render: function(){
32091
    this.model.responseContentTypeId = 'rct' + Math.random();
32092
    $(this.el).html(Handlebars.templates.response_content_type(this.model));
32093
    return this;
32094
  }
32095
});
32096
'use strict';
32097
32098
SwaggerUi.Views.SignatureView = Backbone.View.extend({
32099
  events: {
32100
    'click a.description-link'       : 'switchToDescription',
32101
    'click a.snippet-link'           : 'switchToSnippet',
32102
    'mousedown .snippet'          : 'snippetToTextArea'
32103
  },
32104
32105
  initialize: function () {
32106
32107
  },
32108
32109
  render: function(){
32110
32111
    $(this.el).html(Handlebars.templates.signature(this.model));
32112
32113
    this.switchToSnippet();
32114
32115
    this.isParam = this.model.isParam;
32116
32117
    if (this.isParam) {
32118
      $('.notice', $(this.el)).text('Click to set as parameter value');
32119
    }
32120
32121
    return this;
32122
  },
32123
32124
  // handler for show signature
32125
  switchToDescription: function(e){
32126
    if (e) { e.preventDefault(); }
32127
32128
    $('.snippet', $(this.el)).hide();
32129
    $('.description', $(this.el)).show();
32130
    $('.description-link', $(this.el)).addClass('selected');
32131
    $('.snippet-link', $(this.el)).removeClass('selected');
32132
  },
32133
32134
  // handler for show sample
32135
  switchToSnippet: function(e){
32136
    if (e) { e.preventDefault(); }
32137
32138
    $('.description', $(this.el)).hide();
32139
    $('.snippet', $(this.el)).show();
32140
    $('.snippet-link', $(this.el)).addClass('selected');
32141
    $('.description-link', $(this.el)).removeClass('selected');
32142
  },
32143
32144
  // handler for snippet to text area
32145
  snippetToTextArea: function(e) {
32146
    if (this.isParam) {
32147
      if (e) { e.preventDefault(); }
32148
32149
      var textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
32150
32151
      // Fix for bug in IE 10/11 which causes placeholder text to be copied to "value"
32152
      if ($.trim(textArea.val()) === '' || textArea.prop('placeholder') === textArea.val()) {
32153
        textArea.val(this.model.sampleJSON);
32154
      }
32155
    }
32156
  }
32157
});
32158
'use strict';
32159
32160
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
32161
  initialize: function (opts) {
32162
    this.options = opts || {};
32163
    this.router = this.options.router;
32164
  },
32165
32166
  render: function(){
32167
    $(this.el).html(Handlebars.templates.status_code(this.model));
32168
32169
    if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
32170
      var responseModel = {
32171
        sampleJSON: JSON.stringify(this.router.api.models[this.model.responseModel].createJSONSample(), null, 2),
32172
        isParam: false,
32173
        signature: this.router.api.models[this.model.responseModel].getMockSignature(),
32174
      };
32175
32176
      var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
32177
      $('.model-signature', this.$el).append(responseModelView.render().el);
32178
    } else {
32179
      $('.model-signature', this.$el).html('');
32180
    }
32181
    return this;
32182
  }
32183
});}).call(this);

Return to bug 14458