Position Independent Source Code

Check-in Differences
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From:

[5d405be33e] Getting this ready for later benchmarking (user: yumaikas tags: trunk, date: 2017-01-01 10:23:54)

To:

[ee6ad01f10] Added some needed words to dicts (user: yumaikas tags: trunk, date: 2017-12-10 22:40:15)

Added CONTRIBUTING.md.











>
>
>
>
>
1
2
3
4
5
This repository is a mirror of [pisc.junglecoder.com](https://pisc.junglecoder.com), so if you'd like to get the best view of the project, that's where you should be able to find it.
I recommend opening an issue, or emailing me based on my profile before opening a PR. 

Right now I'm focusing on more tests, some basic performance improvements, and building up to a high quality IRC/Slack/Discord chat-bot frame work, hopefully one that can trade punches with Hubot. Contributions that focus in theses areas are more than welcome. 

Deleted Fibionacci.pisc.

1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49

/*
Even Fibonacci numbers under 4 million
*/

"std_lib.pisc" import

: triplicate ( a -- a a a ) dup dup ;
: max_fib ( --  const ) 4000000 ;

/* TODO: This isn't working?
: nth_fib ( a -- b ) 
	:n

	$n 0 = [ 0 ] when
	$n 1 = [ 1 ] when
	$n 1 > [ 
		$n [ 1 - nth_fib ] [ 2 - nth_fib ] bi +
	] when
;
*/

: loop_fib ( n -- fib sum )
	:n 
	0 triplicate :sum :fib :a 
	1 :b
	$n [ 
		$a $b + :fib
		$b :a
		$fib :b
		$fib even? [ $fib $sum + :sum ] when
	] times
	$fib
	$sum
;

: nth_fib ( n -- b ) 
	:n
	0 1 $n nth_fib_do
;

/* This is the tail-recursive version of fibionacci */
: nth_fib_do ( a b n -- q ) 
	:n :b :a
	$n 0 > 
		[ $b  $a $b +  $n 1 - nth_fib_do ] 
		[ $a ]
	if
;
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































Deleted FizzBuzz.pisc.

1
2
3
4
5
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
/* 
 Implementing fizzbuzz in PISC
*/


/* Old version, very verbose
: divisible? ( a b -- bool ) mod zero? ;
: out-f ( a -- f ) print f ;
get-locals
0 :num

100 [
	t :unprinted
	$num inc :num 
	$num 15 divisible? [ "FizzBuzz" out-f :unprinted ] when
	$num 5 divisible? $unprinted and [ "Buzz" out-f :unprinted ] when
	$num 3 divisible? $unprinted and [ "Fizz" out-f :unprinted ] when 
	$unprinted [ $num print ] when 
 ] times
drop-locals
*/

"std_lib.pisc" import

: inc ( a -- a` ) 1 + ;

get-locals
0 !num /* Store 0 into num variable */
100 [
	$num inc dup :num
			[ 3 divisor? [ "Buzz" ] [ "" ] if ] 
			[ 5 divisor? [ "Fizz" ] [ "" ] if ] bi 
		concat dup len 0 = [ drop $num ] when print
] times
drop-locals
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Changes to ImageSchema.sql.

1

2

3
4
5
6
7
8
9
..
24
25
26
27
28
29
30
31
32
33
-- This is the schemda for a PISC image




Create Table vocabulary (
	vocab_id INTEGER PRIMARY KEY,
	vocab_name text NOT NULL,
	-- TODO: figure out dependency tracking
);

................................................................................
	word_documentation TEXT NULL,
	FOREIGN KEY(word_id) REFERENCES vocabulary(word_id)
);

Create Table kv_store (
);

-------------------------------------------------
Search: /\*([^*]+)\*/ : ([\w-]+) (\( [^)]+\)) [^;]+;
Replace: :DOC \2 \3 \1 ;
|
>

>







 







<
<
<
1
2
3
4
5
6
7
8
9
10
11
..
26
27
28
29
30
31
32



-- TODO: I don't think I'm going to use this, at least for the known future
-- TODO: BoltDB seems like a better fit for now.

-- This was the schemda for a PISC image 

Create Table vocabulary (
	vocab_id INTEGER PRIMARY KEY,
	vocab_name text NOT NULL,
	-- TODO: figure out dependency tracking
);

................................................................................
	word_documentation TEXT NULL,
	FOREIGN KEY(word_id) REFERENCES vocabulary(word_id)
);

Create Table kv_store (
);




Changes to README.md.

1
2
3
4
5
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
39
40
41
42
43
44

45
46
# PISC
Position Independent Source Code. A small, stack-based, concatenative language.

## About 

This is currently a small side project to see how far a small stack-based scripting language can go in spare time. Inspired by Factor (80%), Forth (5%) and Python (5%) and Tcl (5%) (not 100% inspired yet.)
Plans are currently for an interperated language that uses a "arrays and hashtables" approach to data stucturing.

## TODO:

If you can understand what is going on, please submit a pull request to add something that I'm missing. I'm not trying to compete with [factor](http://factorcode.org) or [forth](http://www.forth.com/forth/) for performance/features, but I trying out their style of programming to see how it goes. Ports of this interpretor to the language of your choice are welcome as well. 

With that in mind, things that I will be adding (or accepting PRs for) as [time](http://www.catb.org/jargon/html/C/copious-free-time.html) allows:


  - More tests for different combinators (if, loop, while)
  - A standard library build from a minimal core (this is a lot of the things below)
  - Stack shuffling combinators (see the ones in factor):

  -- drop ( x -- )
  -- 2drop ( x y -- )

  -- 3drop ( x y z -- )
  -- nip ( x y -- y )
  -- 2nip ( x y z -- z )
  -- dup  ( x -- x x )
  -- 2dup ( x y -- x y x y )
  -- 3dup ( x y z -- x y z )
  -- 2over ( x y z -- x y z x y )
  -- pick ( x y z -- x y z x )
  -- swap ( x y -- y x )
  - Add a way for modules to be added without a lot of major modifications in the core loop of the interp.
  - Math words. A lot is needed here, and in double/int versions ( >, <, =, -, +, div, mod ) 
  - String manipulation words (concat, >upper, >lower, int>string, double>string, etc)
  - Array and map manipulating words (ways to define them, literals, member access, so on.)
  - A basic compliation step for reducing cache misses in the core loop (transforming words into constant lookup codes, so that word lookup isn't proportional to the number of words in the core loop)
  - STDIN/STDOUT words.
  - Regex facilties. 
  - File i/o words
  - A plan for multiprocessing. (I want to pull from TCL on this one if I can)
  - Combinators for quotations, like bi and tri. 
  - A plan for a module system.
  - Syscalls
  - shellout words. 
  - struct words (when this thing allows for partial compilation or some such thing.)
  - Bindings to awesome libraries (SDL, Tk, ImageMagick)



.pisc is the file extension for these files. 





|
|

|

|

|
>

<
|
<
>
|
<
>
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

>

<
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16

17
18

19
20























21
22
23

# PISC
Position Independent Source Code. A small, stack-based, concatenative language.

## About 

PISC's source and documentation are hosted at [https://pisc.junglecoder.com/ ](https://pisc.junglecoder.com).
A quick starter can be found at [PISC in Y Minutes](https://pisc.junglecoder.com/home/apps/fossil/PISC.fossil/wiki?name=PISC+in+Y+Minutes)

## Building 

PISC requires go 1.9+ to build. Installation instructions [here](https://golang.org/doc/install)

Once go is installed, you'll (currently) need to run `git clone https://github.com/yumaikas/PISC-mirror "$GOPATH/src/pisc"`
Running `cd $GOPATH/src/pisc && go get -u && go build -o pisc` will fetch depenencies and get you a PISC executable. You can launch a REPL with `pisc -i` and play with it there.


## Playground


PISC has a playground at https://pisc.junglecoder.com/playground/


## Flags
























Running `pisc help` will dump out current information about avaiable flags


Deleted SumsOf3And5.pisc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
Sums below 1000 of 3 and 5
*/

"std_lib.pisc" import

: inc ( a -- b ) 1 + ;

get-locals
0 :n
 /* Maybe we can keep this on the stack? */
0 1000 [ /* Sum and loop count */
	dup inc :n
	[ 5 divisor? ] [ 3 divisor? ] bi or [ $n + ] when
] times
print
drop-locals
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted bathroom_stall.pisc.

1
2
3
4
5
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
/* 
Solving this code golf problem http://codegolf.stackexchange.com/questions/89241/be-respectful-in-the-restroom
*/


: respect ( stalls -- respectfulPostion ) 

	<vector> :distances
	<vector> :full
	<vector> :empty
	0 :i 
	>string 
	[ 
		dup "1" str-eq [ [ $i vec-append ] $:full ] when 
		"0" str-eq [ [ $i vec-append ] $:empty ] when
		[ 1 + ] $:i
	] each-char 
	0 :i
	$empty [ :eElem 
		0 dup :dist :i 
		$full [ :fElem
		  [ $fElem $eElem - abs + ] $:dist
		  [ 1 + ] $:i
		] vec-each
	    $dist $i 0.0 + / $eElem 2vector [ swap vec-append ] $:distances
	] vec-each
	0 :maxDist
	0 :maxPos

	$distances dup print [ /* Pop the elements into vars */
		dup []0 :dist []1 :pos
		$maxDist $dist < [ $pos :maxPos $dist :maxDist ] when 
	] vec-each
	$maxPos
	;
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Added bindata.go.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
// Code generated by go-bindata.
// sources:
// stdlib/bools.pisc
// stdlib/debug.pisc
// stdlib/dicts.pisc
// stdlib/io.pisc
// stdlib/locals.pisc
// stdlib/loops.pisc
// stdlib/math.pisc
// stdlib/random.pisc
// stdlib/shell.pisc
// stdlib/std_lib.pisc
// stdlib/strings.pisc
// stdlib/symbols.pisc
// stdlib/vectors.pisc
// stdlib/with.pisc
// DO NOT EDIT!

package pisc

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"time"
)

func bindataRead(data []byte, name string) ([]byte, error) {
	gz, err := gzip.NewReader(bytes.NewBuffer(data))
	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	var buf bytes.Buffer
	_, err = io.Copy(&buf, gz)
	clErr := gz.Close()

	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}
	if clErr != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}

type asset struct {
	bytes []byte
	info  os.FileInfo
}

type bindataFileInfo struct {
	name    string
	size    int64
	mode    os.FileMode
	modTime time.Time
}

func (fi bindataFileInfo) Name() string {
	return fi.name
}
func (fi bindataFileInfo) Size() int64 {
	return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
	return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
	return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
	return false
}
func (fi bindataFileInfo) Sys() interface{} {
	return nil
}

var _stdlibBoolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd7\xe2\x4a\xca\xcf\xcf\x29\xd6\x2b\xc8\x2c\x4e\xe6\xd2\xd2\xe7\xe2\x52\x56\xf0\x54\x48\x2f\x4d\x2d\x2e\x56\x28\xc9\xc8\x2c\x56\xc8\x2c\x56\x48\xcd\x2d\x28\xa9\x54\xc8\xcb\x2f\xb7\xe7\xe2\x02\x04\x00\x00\xff\xff\xcb\x3e\x17\xc6\x30\x00\x00\x00")

func stdlibBoolsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibBoolsPisc,
		"stdlib/bools.pisc",
	)
}

func stdlibBoolsPisc() (*asset, error) {
	bytes, err := stdlibBoolsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/bools.pisc", size: 48, mode: os.FileMode(436), modTime: time.Unix(1511943077, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibDebugPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\xb1\x0a\xc2\x30\x10\xc6\xf1\xbd\x4f\xf1\xd1\x49\x87\xbc\x40\x8b\x2e\xba\x3b\x38\x8a\x43\xb8\x9e\x26\x10\x72\xe1\x2e\x1a\x7d\x7b\x91\x2a\x74\xe8\xf6\xc1\x9f\xef\xd7\x0d\xc7\xd3\x01\x16\xa4\xb9\xa2\x7c\x8b\x2f\xd7\x44\x27\xc3\x06\xce\x61\x8b\x73\x90\x66\x68\x21\x52\xc0\xdc\x31\x77\xaf\x0c\x7a\xa8\x72\xae\xe9\x8d\x24\x7e\xe2\x09\x63\xb7\xe0\x92\x90\x4f\xab\xd0\xaf\x7c\x89\x98\xff\x0a\x8c\xa4\x30\xc6\x6e\x58\xbb\x5f\x00\x79\xb2\x62\x6f\x55\x63\xbe\xa3\xc7\x0e\x3d\xac\xf9\x02\xab\xea\x48\x32\xf9\xba\x9c\x39\x16\x14\x8d\xb9\xe2\x0a\xf6\x14\x66\x0f\x23\x3e\x01\x00\x00\xff\xff\xd4\x33\x23\xc6\xf1\x00\x00\x00")

func stdlibDebugPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibDebugPisc,
		"stdlib/debug.pisc",
	)
}

func stdlibDebugPisc() (*asset, error) {
	bytes, err := stdlibDebugPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/debug.pisc", size: 241, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibDictsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x94\xcd\x6e\xdb\x3a\x10\x85\xf7\x7a\x8a\x03\x43\x17\xb8\x16\x4a\x69\x2f\x1b\xf1\xa6\xed\xba\x68\x97\x86\x17\x8c\x34\xb2\x88\xc8\xa4\x4a\x8e\x1c\xf8\xed\x0b\x52\x3f\x96\x65\xa5\x69\x36\x49\x86\x67\x66\xbe\x39\x1c\x31\x4b\xf0\x55\x15\xac\x8c\x96\x56\x91\x83\xd4\x25\xb8\x26\x65\xd1\xb1\x6a\x14\xfb\x58\x92\x45\x51\x8e\x52\x15\x2c\x54\x25\xe8\xd2\xf2\x4d\x38\x96\xc5\x1b\xfe\x47\x9a\x42\x88\x70\x76\xc0\x16\x21\xda\x2b\x0e\x38\x62\xef\xe3\x2f\x38\xe1\xbd\x26\x8d\xdd\xac\x88\x36\x2c\xfc\xdf\x0f\x15\xb0\x45\xd9\xb5\xe0\x5b\x4b\xa6\xc2\x66\xe2\xba\x6d\xe0\xd8\x0a\x4d\xbf\xd7\x8b\x92\x76\x9d\xa5\x50\xaf\xd7\x3f\x55\x5d\x41\x7f\x22\xf1\x95\xce\xc4\xc2\x58\x51\x52\x25\xbb\xc6\xc3\x85\x93\x37\xba\x61\x0c\x09\x81\xab\x6c\x3a\xc2\x16\xf9\x18\xcb\xbd\x20\xf7\xd2\x08\xc3\x4f\x1c\x12\xe3\x90\xe9\x1b\xd5\xd2\x89\x37\x0a\xa6\x2c\x8f\xce\xc4\x38\xf9\xf0\x50\xed\x04\x55\x45\xbb\x28\xca\x12\x7c\x27\x2e\x6a\x54\xd6\x5c\x30\x1b\x2e\xc9\x22\xe4\x3f\x7e\x7e\x83\x78\x99\x13\xf6\x64\xe3\xb4\xbe\xea\x6e\xd2\xad\x09\x07\x6f\x8e\xc1\xf3\xbc\xc4\x09\xa5\x6a\xef\xc9\x71\x89\x1e\xe2\x17\xb1\xdf\x88\x90\x5a\x19\x0b\x89\xb3\xba\x92\xee\x89\xb4\xf1\x44\xc1\x91\x2f\x78\xed\x18\x0d\xc9\x2b\x05\xfd\x8c\xd8\xe8\x10\xe9\x8d\x9f\xf0\xf7\x7b\x31\x62\x79\x9e\x01\x6d\x7e\x65\x6d\xe7\xea\x69\x8a\x55\xf5\x20\x74\x61\xda\x69\xdc\x78\x31\xee\x36\x5c\x6c\x63\x8a\x61\xec\xa5\x3b\x4b\xfd\x83\x35\xbd\x2f\x2b\x05\xdc\xbb\x6c\xef\x5d\xf7\x22\xbe\xf3\x59\x2d\x2f\xb4\xda\xd9\xcd\x3a\xef\xff\x31\x67\xb0\x61\xc8\x8a\x3f\x30\x22\xec\xde\xc6\x9f\xd6\xd2\xe1\x95\xfc\x15\x51\x6b\xa9\x90\x4c\x65\x8a\xce\x11\xe2\xab\xb4\x1e\xd4\xff\x52\xda\x31\xc9\x72\x03\xb2\xd6\x58\x64\x49\x18\xf6\xde\x39\x4c\x37\x21\x27\xd9\x44\x1d\xff\xf5\xde\x46\x8a\xcf\x31\x3e\xe4\x38\x3e\x18\x3f\xac\xe5\x67\x6c\x7e\x53\xc3\xaa\x4a\x0d\xd2\x6c\x6f\x60\x03\xb6\x1d\x85\x9d\x25\x59\xd4\xe8\xb4\x2a\x4c\x49\x28\x6a\x69\x65\xc1\xe4\x7b\x83\x6b\xe5\xfc\xeb\xa2\xf4\x79\xf6\x61\xfd\x37\x0c\x78\x78\xda\x88\xe7\xb7\xa6\x07\x3c\xf6\x0f\xc0\xf4\x5f\xff\x95\x07\x50\x5e\xf0\x9e\x02\x8e\xf0\x18\x83\x6c\xb6\xba\x87\xb5\x55\x3c\x8c\x7b\x3e\x3d\x23\x53\x46\xba\xd0\xa7\xe9\xfc\x05\x28\x64\xd3\x60\x17\xfd\x09\x00\x00\xff\xff\x7e\x91\x17\xc6\xe5\x05\x00\x00")

func stdlibDictsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibDictsPisc,
		"stdlib/dicts.pisc",
	)
}

func stdlibDictsPisc() (*asset, error) {
	bytes, err := stdlibDictsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/dicts.pisc", size: 1509, mode: os.FileMode(436), modTime: time.Unix(1512944015, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibIoPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\x41\x6f\xf3\x36\x0c\x3d\xd7\xbf\xe2\x01\x19\x90\xe6\x43\x9c\xef\x3a\xb4\xc0\x86\x21\x6d\x80\x5e\x96\x61\xeb\xb0\x4b\x81\x55\xb6\xe9\x58\x83\x22\x79\x12\xd5\xc0\xff\x7e\x20\x6d\x27\x59\xbb\x0e\xdf\x4d\x96\xc8\xf7\x1e\xc9\x47\x7f\xfd\x82\xe7\x8e\xf0\xb4\x87\xb3\x55\x34\xd1\x52\x42\x68\xf1\xcb\xd3\x6f\x5b\x7c\xf9\x5a\x14\xfa\x6e\x13\x9a\x50\xc3\x26\xbf\x64\xb4\x21\xc2\x20\xf5\x54\xdb\xd6\xd6\x38\x85\xd8\x48\xe4\xdd\xc3\x7e\x2b\x30\xb7\x28\x4b\xac\x50\x2c\xf0\x2b\x99\x86\x62\x2a\x8a\x6d\x8e\x91\x3c\xbb\x61\x3d\xe2\x76\x26\x21\x92\x69\xac\x3f\xc0\xf8\x06\xa7\x68\x59\xce\xa1\xfa\x8b\x6a\x4e\xe0\xce\x30\x4c\x24\x54\x21\xfb\x06\x1c\x90\x7d\x43\xd1\x0d\x12\x74\x08\xa8\x4c\xa2\x06\x55\x6e\x6d\x98\x73\x36\x78\x34\x75\xa7\xa8\x14\x95\x80\x3b\x42\x1b\x9c\x0b\x27\xc9\x6a\xb3\xaf\xd9\x06\x9f\xe0\x82\x69\xa8\x81\xf5\x1c\x60\x39\xa1\xb1\xfa\x60\xe2\x00\xf2\x2c\xf5\xdf\x15\xc5\x62\xa1\x50\x65\x35\x30\x8d\x15\xe9\x69\x55\x48\x4d\x09\x66\xfc\x6c\x63\x38\x2a\xcf\x44\x6b\x12\x8c\x17\xe4\x35\x12\xb1\x96\x74\x79\x4d\x78\xdc\xef\xa4\x16\x8e\x99\x60\x5b\x7d\x22\xdf\x48\xb7\x55\xab\x75\x04\xab\x8d\xa9\x3b\x6a\x2e\x1a\x62\xf6\x93\x06\x3d\x5d\x34\xfc\xfe\xbc\x2b\xbf\x1f\x2f\xdf\x29\xb9\x24\x3b\x3b\x27\x27\x8e\x57\xb9\x7a\xff\x2e\x6b\x0d\x8e\xf6\x78\x14\xd9\xcb\x97\xb8\xd4\xd1\x2c\x5f\xfc\x12\xa1\x3d\xab\x55\x64\x29\x44\x31\x1f\xf7\xbb\x1f\x15\x94\x73\xf4\xe9\x7f\x2b\x93\x91\x54\x44\x7e\xae\x6f\x8d\xd6\xb8\x44\x08\xdc\x51\x3c\xd9\x44\x45\x71\x5f\x8c\x26\x0a\x3d\xf9\x52\x92\xca\xa9\xaf\xb7\xe8\x0d\x77\x42\x38\x5a\x0a\x2b\xec\x04\x73\x6e\x6c\x67\xde\x08\x06\xaf\xb5\x0b\x89\x5e\x75\x8c\xc3\x68\xa2\xda\x78\x54\x84\xda\x38\x47\x6a\x24\x0d\x51\x55\x57\x96\x9a\x04\xfa\xc6\x11\x3e\x8a\x10\x77\xfe\x4b\xc4\x74\xb1\xc2\x1f\x7a\x48\x6a\xd5\x64\x8f\xbd\xa3\x28\xb4\x7e\x16\xb6\xc6\xe8\xc3\x41\x75\x04\xef\x86\x31\x57\xbb\x9f\x10\xa2\x0c\xc5\xfa\x43\xc2\x7d\x71\x33\xd2\xea\x7b\x39\x5e\xe3\x56\x87\xa6\xeb\xa4\x54\xfa\x29\x0e\xea\x08\x86\x59\xfb\x38\xab\x99\x75\x8f\x00\xd3\xd8\xbf\x39\x7d\x0d\xd3\xf7\xe4\x75\x23\x5f\xfc\x1c\x24\x33\x9c\x71\xa5\x15\xd2\x80\x1f\xce\xda\xe4\xe6\x67\x73\xa4\xc9\x5c\xdb\xe0\x99\x3c\x27\xac\x80\x9f\x90\xd9\x3a\xcb\xc3\x79\xef\xf4\xaf\x31\xef\x7c\x3a\x1a\xe7\x34\x3f\x8d\x7b\x38\xb5\x61\x83\x87\x00\x1f\x18\x59\x8c\xe1\xe1\x4c\x3c\xd0\x14\x77\x16\xd2\x47\xfb\xf6\x67\x9f\x39\x5d\xd7\x77\x75\x6b\xd3\xfb\xf1\xea\x1f\x2a\xcb\x2f\x43\x44\xf4\xd1\x7a\x5d\xcd\x37\xe3\xf2\x0c\x8c\x93\xe5\xae\x0c\x99\xfb\xcc\xf3\xa4\xff\xce\x81\x05\x7d\xb3\xc1\xaa\xb8\xb9\x93\xcf\xe2\xe6\x83\x2d\x9a\xdc\xe3\x3b\x0d\x15\x08\x6c\xd4\x60\x62\xe5\x05\x9e\xf7\x0f\xfb\x62\x81\x09\x7c\x6c\xb0\x70\xe0\x4c\x68\xfd\x27\x7c\xf8\x0f\xc2\x69\x19\x3e\x21\xfc\x27\x00\x00\xff\xff\xb2\x42\xc8\x50\xc8\x05\x00\x00")

func stdlibIoPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibIoPisc,
		"stdlib/io.pisc",
	)
}

func stdlibIoPisc() (*asset, error) {
	bytes, err := stdlibIoPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/io.pisc", size: 1480, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibLocalsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x92\x4f\x8b\xdb\x30\x10\xc5\xef\xfe\x14\x0f\xb2\x87\x75\x16\x27\x77\x07\x0a\x25\x0d\x65\xa1\xb4\x61\x73\x0c\xa1\x0c\xf2\x38\x11\x49\x24\x57\x1a\x67\xfb\xf1\x8b\xfe\x38\xeb\xac\x7b\xd0\x41\xcc\x9b\xdf\xbc\xf9\xb3\x9c\xe3\x87\x55\x74\xf1\xd0\x06\xdb\xd7\xdd\x1a\xf3\x65\x51\xd4\xdf\x7e\xad\xe1\x59\xaa\x4b\x88\xe1\x19\x37\xba\xc0\xd0\x95\x51\x55\x28\xb1\x63\x49\x3f\xb1\x31\x82\x55\x4e\x39\x8e\x52\x06\x79\x10\x94\xf8\xce\x02\x39\x71\xf8\xf5\x0c\xf2\xde\x2a\x4d\xc2\x0d\xde\xb5\x9c\x40\x48\x59\x29\x3a\xc5\x79\x3c\xa7\xca\xdb\xde\x07\xb5\x17\x52\x67\xb4\x2e\x94\x68\xad\x43\x16\x59\x23\x36\x56\xc9\xff\x24\x1b\x68\x8d\xb3\xdd\x67\x9c\xed\x40\x99\x63\xdb\x3b\xa6\x6d\xa7\x94\x3b\x86\x49\x9d\xee\x4d\xfe\xe9\xad\x60\x8f\x33\x6e\xa8\xb0\x58\xe0\x10\xb8\x29\x6f\xb1\x40\x09\xbc\xf5\x06\x14\x65\x24\xda\x9a\xe8\x36\x10\x72\xc3\xda\xc4\x4a\xaa\x77\x8e\x8d\x3c\xf4\xb5\xdb\x6c\xea\x98\xf8\xa5\xd1\x4a\x62\xfd\xe5\x1c\x6b\xdb\x69\x6e\xd0\x3a\x7b\x45\x4b\x4a\xac\x0b\x0b\xab\xa1\x4e\x64\x8e\x3c\x38\xba\x91\xfb\x99\xc7\x1f\x6d\xf8\x77\xea\xb0\xc7\x7e\xb4\xa0\x03\xce\xcc\x1d\x0e\x68\x74\x17\xdf\xc7\xba\x57\x28\x8a\x19\xbe\x8a\xf0\xb5\x13\x6d\x8e\x61\xcd\x99\x9f\x17\x55\xd4\xdb\xb7\x0d\x9e\xea\xff\xd4\x2b\x07\x69\xf2\x1b\x8f\x0b\x5b\xc7\xad\xfe\xcb\x3e\x78\x9d\xe1\xd5\x28\xc7\xd7\xd0\x2f\x99\x06\x0d\xe7\x5f\x81\x48\xad\xaa\xd1\xf1\x94\x31\x9c\x7c\x55\x37\x72\x58\x65\xd5\xcb\xcb\x83\x4a\x9b\x4f\xaa\x62\x16\x4f\x2e\x14\xf0\x2c\xd9\x75\x4a\x7d\x9a\x1c\xe7\xc7\x54\x06\x7c\x3d\xb9\xf9\xd1\x78\x8a\x2c\xfa\x1d\x54\x71\x39\x8f\xb8\xa6\xef\x46\xc8\x38\xfb\xa0\xaa\x82\x91\xd5\xbf\x00\x00\x00\xff\xff\xaa\x09\x9f\x67\x71\x03\x00\x00")

func stdlibLocalsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibLocalsPisc,
		"stdlib/locals.pisc",
	)
}

func stdlibLocalsPisc() (*asset, error) {
	bytes, err := stdlibLocalsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/locals.pisc", size: 881, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibLoopsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xcb\x31\x0a\x02\x31\x10\x46\xe1\x7e\x4e\xf1\x97\xeb\xc2\x66\x7b\x53\xaa\x9d\xe0\x15\x46\xe2\x80\x81\x98\x44\x67\xa2\x1e\x5f\x42\xac\xb7\x7d\x7c\x6f\x9d\xe9\x5c\x4a\x55\x57\xa3\x06\x9a\x57\xa2\xfd\xf1\x72\x80\xc5\x87\x28\x26\x64\x3c\x5b\x31\x2c\x0b\x9c\xc3\x0e\xa7\xaf\x84\x66\x02\xee\x95\x91\xff\xce\x8f\xe9\x73\x8f\x49\x30\xa1\xbe\xe4\xb6\xf9\x0d\xc8\xdd\x31\x92\x5c\xdf\xa2\x60\x63\xf8\x5f\x00\x00\x00\xff\xff\x8a\xf6\x37\x23\x8e\x00\x00\x00")

func stdlibLoopsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibLoopsPisc,
		"stdlib/loops.pisc",
	)
}

func stdlibLoopsPisc() (*asset, error) {
	bytes, err := stdlibLoopsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/loops.pisc", size: 142, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibMathPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x95\x4f\x6f\xe3\x36\x10\xc5\xef\xfa\x14\xef\xb8\x71\x23\x24\xca\xd1\x71\x1c\x74\xbd\xdd\xb6\xc0\xa2\x3e\x24\xb7\x20\x80\x29\x69\x24\x33\x95\x48\xed\x90\x8a\xed\x7e\xfa\x82\xb4\x6c\x51\xf2\x1f\xec\xcd\x30\x7f\xef\x0d\xf9\x38\x43\x4d\xbf\x2d\x17\x98\xe7\xba\x4d\x2b\xc2\x17\x6c\x11\xc7\xc8\x71\x83\x85\x26\xce\x08\x02\xaa\xad\x53\x62\x58\x0d\x81\x0e\x7b\x8c\xbc\x4a\x64\xda\x1c\x24\x3b\xdc\xe0\x77\xce\x90\x69\x23\x15\xe1\x11\x3d\xb2\x0e\x99\xbf\x76\x0d\x71\xaa\x2b\x99\x41\x9c\xc1\x8d\x54\x63\xc7\x13\xe0\x9a\xdf\x10\xb6\xe2\xc4\xcd\x0a\x55\x92\xb2\x03\xe6\x9a\xa1\xe7\x7b\x3c\x4b\xd9\x86\xf4\xa2\x4d\x09\xac\x75\x40\x90\xac\x06\x04\xc9\x4a\xaa\x12\xba\xe8\xf3\x6b\x98\x32\x69\xa4\x56\x87\x70\x8f\xe2\x61\xa0\x8b\x61\x3a\x57\xb2\x1c\xe5\x48\x5c\x84\xe0\x1f\xcc\x9a\x51\xb4\x2a\xb3\xae\x68\x40\x65\xc3\x72\x75\x53\x51\x4d\xca\x0a\xde\x81\x2e\x88\xb6\xcd\xc0\x7a\xdb\x68\x45\xca\x4a\x31\xa6\x1e\x42\xec\x75\xa3\x61\xd7\x84\x46\x6f\x88\x5d\x16\xab\xed\x2a\x84\xeb\x24\xa4\x57\xae\x48\x82\x78\x75\x8b\x5a\xf3\x21\x2f\x42\xa1\x19\xa6\x16\x55\xd5\xe5\x66\x70\xf4\x28\x2a\xad\x39\xf4\xf8\xee\xff\xf8\xa5\xd4\x4b\x51\xd7\x22\xd4\xfe\xe9\xff\x38\x1e\xfd\x75\xf9\x6d\x79\x84\x3f\xee\x43\xf2\xe3\x1e\x5f\xc9\x18\xaa\x4e\x83\xfa\x18\x1c\xe9\xbb\x64\x63\xf1\xaf\x54\xf9\x45\x41\xa5\xcb\x50\xf1\x8f\xb0\x2d\x8b\x0a\x3f\x74\x29\x58\xda\x75\x8d\x47\xf4\x64\x32\xd8\xc6\x0f\x5d\x22\x15\x86\x90\xdc\x87\x76\xc9\xe0\xaa\x56\x5b\x24\xf8\xcd\x97\x59\xdd\x22\x6d\xed\x3e\x5c\x91\x65\x2d\x0b\x4b\xd8\x48\xbb\xee\xe2\xfd\x14\x55\x4b\x26\xb4\x7a\x38\x5b\xee\x21\x44\xd2\x10\xf9\x2a\x95\x6f\xa2\xae\x3d\xdc\x45\x6c\x8f\xf0\x68\xca\x5f\x5c\xeb\x9e\xc4\x71\x65\xd2\xcd\x79\xc1\xcf\xe1\x6c\xbe\xfc\x6c\x05\x77\xd3\x79\x02\x8f\x9e\x86\xd7\xee\x59\x38\xc7\x5d\xda\x85\xbd\xa8\xe1\x56\x0d\x06\xeb\x6f\x65\xa9\x24\xde\xc7\xea\xa3\xb8\x85\x30\xc1\x7b\xda\x09\x77\x83\x4b\x5d\x72\x4e\x1c\xff\x47\xac\x4f\x5a\x46\x17\x7e\x9a\x0c\x65\x5a\xe5\xfb\xae\x3a\x7a\x24\xa7\x1e\x5a\xd1\x2f\x5a\xdc\x4d\x22\xd7\xed\x53\xb8\x2e\x70\xeb\x76\xa3\x21\xb8\x44\x2d\xec\xfa\x28\x36\xd1\xe4\x2e\x9a\xa2\xf6\xd7\x28\x90\xba\x6a\xbe\x71\x88\x71\x83\x87\xbc\x6d\x30\xc7\x1b\x94\x6c\xf0\x8e\x37\xe4\xac\xdd\x0f\x59\xb8\x0f\x07\x6a\xb1\xed\x55\x95\xe0\xd2\x8b\xd0\xcb\x3a\xfc\xa0\xf7\xb2\xe8\x6e\x82\x17\x5d\x93\x6b\x3b\x99\xed\x77\xe3\xf7\x40\x9f\xa4\x9e\xf1\x05\xca\xb9\x3d\xbb\xea\xa8\x75\x0e\x97\xda\xb3\x2f\x97\xcb\x4f\x69\x34\xef\x99\xfa\x40\x85\x4c\x34\xc5\x53\xbf\x23\xb7\x1a\xf7\x6b\x77\x13\xcc\x20\x0d\x44\xc5\x24\xf2\x1d\x72\x2a\xa4\xa2\x7c\x5f\x7c\x3e\xd2\xcd\xa0\xdc\x97\x20\x9a\x62\x36\x5a\xf1\x87\x9b\xe1\x0d\x4f\x78\x47\x2e\x1b\x68\xf6\xdc\x7c\x64\xf0\xd4\x39\x44\x53\x88\xd4\xf8\xc5\x38\x86\xc0\x0d\x9c\xc1\xbd\xb7\x88\x13\x4c\xf0\x8e\xcd\x9a\x5c\xcb\xfd\x1f\x00\x00\xff\xff\x5a\xd8\x7d\x5b\xc0\x07\x00\x00")

func stdlibMathPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibMathPisc,
		"stdlib/math.pisc",
	)
}

func stdlibMathPisc() (*asset, error) {
	bytes, err := stdlibMathPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/math.pisc", size: 1984, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibRandomPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x14\xca\xc1\x09\x80\x30\x0c\x40\xd1\x55\xfe\x51\x0f\x59\x40\xa7\x09\x49\xc0\x42\x9b\x16\xad\xba\xbe\x78\x7f\x1b\x76\xf4\x62\xc1\xc2\x13\x86\x08\x51\xa3\xb1\xe2\xf7\xa0\x46\x72\x6a\xba\x94\x9c\x5c\xaf\x0e\x5a\xf7\xdf\x89\x4e\xf6\x2f\x00\x00\xff\xff\x3c\x4d\xec\x7d\x3b\x00\x00\x00")

func stdlibRandomPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibRandomPisc,
		"stdlib/random.pisc",
	)
}

func stdlibRandomPisc() (*asset, error) {
	bytes, err := stdlibRandomPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/random.pisc", size: 59, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibShellPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x54\xcb\x6e\xdb\x3a\x10\x5d\x8b\x5f\x71\xc0\x78\xe1\x2c\x68\x38\x5b\x45\xd7\xc0\x7d\x24\xb7\xd9\xa4\x05\xd2\x9d\x23\x14\x8c\x38\x8e\x88\xd0\x24\x2b\x52\x36\xfa\xf7\xc5\x50\x7e\xb6\x5d\xd8\x20\xcf\xbc\xcf\x19\x4a\xd4\x70\x09\x73\x28\x85\x5b\x38\x9b\xb2\xda\x58\x47\x09\x6b\xc4\xc1\xfa\x8c\x16\x3b\xea\x14\xe9\xae\xc7\xbd\x10\x35\xac\x57\xc6\x0e\x98\x83\xff\xbf\x8f\x21\x73\xe4\x62\x81\x5b\x88\x2a\xee\x0d\xea\x38\xd0\x4e\x54\x6b\x74\x06\x2d\x8c\x8d\xe8\xb4\x73\xa2\x9a\x31\x8e\xce\x88\x92\x25\xf5\xe4\x9c\xda\x06\x33\x3a\xc2\xfc\x94\xe7\x56\x54\xcd\x8e\xba\x1c\x86\x15\xea\xa8\x73\xdf\xdb\x94\x39\xd9\xec\x78\x01\xd7\xe0\x8e\x74\x8c\xe4\xcd\xd9\x0b\x2d\xea\x38\xa6\xde\x5c\xbb\xb3\x6b\x0c\xf1\x4d\x77\x1f\x48\x7b\x1d\x7f\x09\x08\xd1\x08\x51\x35\xc6\x76\x79\x05\x33\x46\xd4\xa9\x07\x67\xb8\x60\xa2\x45\xd3\x28\x97\x18\x15\x55\x75\x45\x91\xa8\xaa\x8a\xa3\xd4\x6a\x1b\x0c\x41\x1a\x89\x94\x07\xd5\x05\x9f\xb5\xf5\x97\x24\xae\x61\x86\x10\xd1\xc2\x6e\x38\xea\x82\x55\x51\x1d\x0a\x98\x52\xb8\xcc\x00\xb9\x58\xc8\x89\xc1\xa6\x51\x63\x3c\x1b\x8e\x58\x57\xe6\xe4\xfe\x4f\x10\xcf\xc8\xe0\x3b\x65\xc5\x5d\xe8\xac\x78\xd6\x83\xbf\x2e\x3c\xca\x57\x7f\x6c\x71\x2c\x7d\x35\x8d\xda\x77\xae\x98\xbe\xfc\xfd\xf5\x93\x04\xf9\x9d\x7a\xa7\x83\x89\x21\xb6\x5d\x81\xe4\x8b\xbe\x6b\xa8\xd9\x9f\xa7\x6e\x27\x3f\x9b\x78\x53\x4a\xea\x17\x96\x1b\xcb\xc5\x9d\x9c\x4c\xdb\x60\xbc\xde\xd2\xb4\x0b\x7a\xff\xa1\xac\xb7\x19\x73\x84\x98\x6d\xf0\xe9\xb8\x52\xa2\xba\xc1\xbf\x03\xe9\x6c\xfd\x3b\x72\x4f\x48\x59\x67\xc2\x9b\x4e\xb6\x4b\xd8\x84\x01\xda\x97\xf0\x94\x7f\x38\xe2\x4a\x2d\xea\x7f\x1e\xfe\x7f\x7a\x3e\x9c\x1f\x9e\xff\x13\x95\x7c\xcd\x12\xf5\xd3\xe3\x0b\xf8\xec\x25\xea\xcf\x8f\x2f\xa2\x92\x12\xf5\x52\x54\x19\xb5\x27\x32\x49\xa5\xe8\x6c\xbe\xdc\x3f\x67\xfd\x31\xe7\x40\x89\xb2\xda\x84\x41\x1d\xc1\xda\x5a\xcc\xf8\xc7\x00\x1c\x79\xac\xfe\xc2\x1a\x52\x16\xad\x27\x94\xed\x65\x55\xf3\xa4\x7b\x3b\xe5\x54\x93\x14\xb3\x8b\xb2\x1c\xb2\xc4\x8c\x7b\x64\x26\x27\xac\x38\xa3\xc5\xbe\x27\xcf\xb1\xe4\xd3\x38\xd0\xb1\x4f\x16\xe5\x7c\x3f\x54\x5c\x9e\xeb\xd5\x77\xbf\xf9\x30\x7a\xda\xf6\x32\x44\xe1\x6a\x92\xe4\x44\x1b\x93\x36\x41\xcc\x1e\x3f\xfa\x1b\x8c\x89\x90\x7b\x9b\x90\x03\x12\xe5\x49\x8b\xa2\xa9\x4e\xe5\xb2\xb7\xb9\x4f\x5d\x88\x24\x6a\x76\x56\x93\xf1\xf0\x55\xb9\x7a\xec\xf2\x1b\xfb\x4a\x4e\xa3\x5c\xe8\xb4\xc3\xfd\xcf\x00\x00\x00\xff\xff\x46\xbd\x3e\x73\x83\x04\x00\x00")

func stdlibShellPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibShellPisc,
		"stdlib/shell.pisc",
	)
}

func stdlibShellPisc() (*asset, error) {
	bytes, err := stdlibShellPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/shell.pisc", size: 1155, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibStd_libPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\xc1\x6e\xe3\x36\x10\xbd\xfb\x2b\x1e\xb6\x87\x46\x41\x6c\x77\xb3\x37\x1b\xa8\x51\x6c\x2e\x0b\xb4\x48\x8b\x04\xe8\xc1\x35\x1a\x5a\x1e\x45\x84\x69\x52\x25\x47\x56\xfc\xf7\xc5\x0c\x25\x59\x8b\xe4\xb0\x87\xdd\xc8\xe4\xbc\xf7\xe6\x0d\x67\x66\x79\x8b\xdf\x50\x51\x87\x32\x44\x42\x17\xe2\x21\xa1\x0a\x11\x7f\x7e\x7b\xfa\x0a\x7a\xa3\xb2\x65\x1b\xfc\x02\xb7\xcb\xd9\x6c\x85\x26\x5a\xcf\xce\xe3\x06\x06\xf3\x39\x50\xe0\xd7\xc4\xd1\xfa\x57\xb9\x39\xff\xdb\xb4\x9c\xf0\xe9\x1f\xff\x69\xf2\x73\x3d\xe2\x06\xd4\x47\xa0\xf5\x6c\x36\x5b\xde\xe2\xb9\x26\x54\xc1\xb9\xd0\xc9\x75\x69\x9c\x4b\x30\x91\xc0\x35\xa1\x6c\x63\x24\xcf\x48\x6c\xca\xe3\x3c\xd5\x6d\x55\xb9\x9e\xe4\x64\xd9\x9e\x29\x69\x92\xb3\xd5\xc3\xe3\x57\x38\x92\x24\x1d\x79\xb3\x77\x24\xa2\x8e\xfc\x2b\xd7\x28\x80\xdf\xc9\xc3\x26\xa5\x7c\x0d\x38\x50\x65\x3d\x1d\xd4\x39\xb8\x36\x2c\x27\x14\xd3\x00\x28\x6b\x2a\x8f\x22\xc3\x61\x80\xf0\xa5\x21\xa4\x4b\x62\x3a\x41\x13\x57\x45\x7b\x6a\x42\x14\x8f\x95\x75\xd4\x18\xae\x45\x75\xb1\x40\x81\x97\x7c\xf5\x32\x3a\x60\x73\xa4\x04\xa3\x91\x90\xd0\x3b\x18\x7f\x80\x61\xa6\x53\xc3\x49\xa4\x72\xe5\xb3\x71\x0d\x33\x9c\xb3\x8b\xe4\x8c\x98\xbd\x82\x17\x9a\xc3\x4f\x78\x7e\x7c\x78\x5c\xe1\x8f\x70\xce\xa8\xc4\x86\x4f\xe4\x85\x4e\x70\x7d\x7a\x5c\x53\xa2\xde\x8b\x8d\x88\x94\x1a\x2a\x95\xef\x14\x0e\xad\xa3\xa4\xcf\xf0\x24\x25\x46\x2e\xb1\xd4\xe2\x76\x99\x3d\x1e\xda\x66\x78\x44\x03\x83\x02\x0f\x6d\xe3\x6c\x69\x98\x72\x3d\x39\x34\x08\xd5\x20\x5f\x1e\xb1\x9e\xad\xde\x83\x7e\x41\x63\xcb\xe3\x5c\xce\xd7\x7d\xf1\xee\x7f\x84\x99\xbb\x00\x72\x94\x4d\xbd\x93\x19\x29\xf6\x99\x64\xaf\xff\x0a\xdc\x63\x8b\xcf\x57\xc5\x1d\xd8\x9e\x28\x8d\xca\xa9\x33\x13\xd8\x5e\xb5\x9f\x3a\xd3\xfc\xa8\xec\x47\xf8\x41\x2e\x86\xec\x10\xfa\x35\x76\xff\xe0\x9f\x9c\x32\x78\xfb\x1d\xc1\x15\xde\xdf\xdf\x8f\xe8\x7d\xc6\x8b\x23\x3d\xbb\x7a\x59\xe1\xcb\x24\xaa\xcc\x71\x5f\x3e\x8a\x0b\x67\x8a\xb8\xc1\x1b\x2e\x12\x24\x7f\xde\x26\x92\x93\x27\x39\xf4\x69\xfd\xd7\x06\xce\x15\x2d\xf0\xdc\x37\xae\x9c\x19\xd9\x0b\xb9\x6f\x71\x36\xae\xa5\xdc\xc4\x3a\xcd\x52\x22\x3d\xc3\x5e\xea\x14\xfc\xa4\x68\xa6\x62\x8a\x3a\xda\x3a\x55\x35\x4d\xd8\xb4\x58\x47\x22\x51\x5e\x2c\x0c\xde\xf4\x6e\x85\x6d\xff\x6b\xae\x23\xb5\xc7\x0e\xfd\x87\xe4\xae\x8e\xb6\xca\x88\x9d\xa6\x2d\x3e\xf7\x76\xcc\xfe\xb3\xfe\x7f\x9f\x31\x32\x90\xdb\xac\x91\x83\x15\xb7\xd6\xb6\xff\x56\xe9\xd4\xe8\x53\x8f\x3d\x6f\x2b\xdc\x60\x03\x8e\x2d\xfd\x25\xa5\xa8\x8c\x4b\xf9\x6b\x3e\x97\xf9\x69\x1d\xa3\x90\xa8\x8d\x6e\x95\xbb\x4c\x28\xe1\x2a\x7b\x87\xc0\x35\xc5\xce\x26\xca\x37\x23\x7e\x81\x87\x7e\xf7\x98\x84\x97\x8d\xde\xbe\x68\xee\x13\xc9\x1c\xde\x4b\xa1\xc0\x66\xc8\x77\x79\x8b\xbf\x6b\xf2\x93\x84\x65\x6b\x77\x72\x74\x09\x2d\x0e\xc1\xff\xcc\xf0\x24\xec\xce\x49\xdb\xda\x4a\x2d\xe5\x90\x91\x7e\x24\xde\x62\x77\x25\x97\xae\xec\xfb\xc9\xe7\x5e\x7a\xd7\x49\x92\xa6\xd7\xe5\x71\x9d\xdb\x42\x67\x3d\xef\x7a\x8d\x28\x1d\x99\x38\xcf\xef\x7e\x33\x10\xe5\xfd\x2d\x9b\xee\xb2\x81\x0f\x8c\xdd\x95\xbd\xab\x65\xab\xad\x67\xff\x07\x00\x00\xff\xff\x8d\xf7\x0d\x9f\x96\x06\x00\x00")

func stdlibStd_libPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibStd_libPisc,
		"stdlib/std_lib.pisc",
	)
}

func stdlibStd_libPisc() (*asset, error) {
	bytes, err := stdlibStd_libPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/std_lib.pisc", size: 1686, mode: os.FileMode(436), modTime: time.Unix(1511844549, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibStringsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\x3d\x6f\xdb\x30\x10\x9d\xa3\x5f\xf1\x1a\x64\x88\x92\x32\xe9\xec\x00\x36\x82\xb4\x43\x26\x0f\xee\x66\x18\x10\x4d\x9d\x23\xa6\x12\x29\x93\x27\xbb\xfe\xf7\xc5\x51\x1f\x56\x3b\x75\xd3\x1d\xdf\xbd\xf7\xee\x43\xcf\x0f\xc8\x36\x1c\xac\xfb\x88\x4f\xad\x8d\x26\x1b\x22\x54\xda\x95\xb5\x7c\x9c\x7d\x28\x23\xb4\x2b\x11\x3b\x53\x65\x0f\xcf\x59\xb6\xf8\xbe\x7e\x43\xe4\xa0\x8c\x77\x46\x33\xee\xa1\xb1\x87\x52\x30\xc8\xf1\x96\x72\xe4\x34\x13\xb8\x22\xb0\x6f\xc1\x67\x2f\x78\x51\x81\x77\x29\x1d\x59\x9b\x5f\x78\xe9\xb9\x96\xfd\x63\x22\x52\x4a\xa0\x3d\xd1\x89\x02\x43\xbb\xcb\x80\x3e\xe9\xba\x23\x58\xc7\x1e\x7a\xe0\x1b\x19\x22\x87\xa5\x75\x62\x45\x8a\x95\x12\xd4\x17\xe4\x78\x65\xa6\xa6\x65\xb0\x87\x19\xf9\xc6\x52\xa1\x71\x02\xa4\x0f\x0a\x33\x22\xf5\xe9\xad\xc3\x3d\x4e\x64\x10\xa9\xbd\x3a\xfa\xd9\x05\x07\x2d\x79\xf6\xe1\x1f\x1f\xfb\x0b\x8a\xa1\x8d\x22\x4d\xab\x8b\x92\x96\x7a\xeb\xb0\x27\x3e\x13\x39\xe8\xba\x4e\xdd\x53\x4d\x0d\x39\x8e\xf0\x07\x14\x27\x32\xc5\x5c\x3e\xb6\xb5\x1d\x3b\x19\xf4\xc5\x4a\x8e\x4d\x7a\x98\x24\x07\x03\x83\x9d\x5e\xaf\x88\xd4\x16\xd0\x11\x1a\x25\xd9\xda\x36\xc4\x7f\xf7\x26\xd3\xb8\xac\xae\x73\x5a\x21\xc7\x7b\x04\x57\x36\x8e\xbc\x03\x64\x5e\x74\x5c\x5d\x97\x2c\x15\xaf\xe1\x3f\x96\x4b\xc7\x4e\xd7\x73\x9e\x65\xe8\x1c\xa9\x40\xba\xa4\x70\x75\xe0\xf7\x9f\xb2\xed\x40\x72\x31\x1a\x73\xcc\x21\xf8\x66\xea\xf7\x2b\x22\xf5\xaa\xc5\xf6\x7d\xbd\x2b\x50\x7a\x13\x71\xf0\x01\x8d\x0f\x72\x16\x07\x3f\x6a\x91\x36\x95\x32\x95\x1e\x55\x8e\x9d\x67\x91\x7a\x7a\x42\x8e\x1f\xbf\xc9\x74\x4c\x28\x24\x5b\x24\x02\xc1\x43\xf0\xda\x30\x85\x7b\xb1\x90\xcb\xda\x8a\xc8\x41\x56\x93\x2d\x86\x73\xef\xa6\x13\x4b\xec\x4a\xc1\x75\xcd\xda\x98\x2e\x44\xe4\x58\x58\xe7\x28\x64\x37\xdf\xb0\xb0\xd9\xcd\x16\x77\x29\x9e\x26\xb8\xc5\xe3\xa3\xc5\x0e\xe7\x8a\x1c\x76\x33\x93\xd9\xcd\x9d\xcd\x46\x15\x99\xb4\x8c\x44\x6e\x38\x6e\x24\xce\xc1\x97\x96\xfc\x01\xb7\xfd\xbf\x79\x3b\x31\x4e\xce\x5c\xbf\x21\xf9\x4c\xe3\x52\x69\x53\x92\xcc\x27\xb0\xf3\x8c\x17\xfc\x09\x00\x00\xff\xff\x74\xb0\x4a\xc5\xf1\x03\x00\x00")

func stdlibStringsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibStringsPisc,
		"stdlib/strings.pisc",
	)
}

func stdlibStringsPisc() (*asset, error) {
	bytes, err := stdlibStringsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/strings.pisc", size: 1009, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibSymbolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xce\xb1\x0e\x82\x30\x10\xc6\xf1\xbd\x4f\xf1\x1f\x81\x04\xd9\xc5\x48\x0c\xee\x0e\x3e\xc1\xa1\x97\x48\x82\x45\x68\x1b\xe3\xdb\x9b\x4a\x43\x18\x1c\xdb\xfb\x7e\xf7\x5d\x55\x98\xeb\xe7\xd9\x8d\x83\xdb\xbd\x7a\x77\x33\x45\x65\xf6\xe7\x4b\xcb\xc1\xfd\x7e\x8f\x64\x94\x25\x39\xed\xac\xe2\x15\x21\xd8\x7e\x0a\xca\x32\xa6\x5e\xd2\xf1\x55\x5a\x9d\xc8\x10\x3a\x22\x69\xc8\x39\xcd\x8a\x7f\xa8\x53\xfc\x7b\x4c\xc4\x61\x47\x8f\x4e\x41\x06\xa8\xcd\xc6\xaf\x7c\xa3\x05\xb1\x77\xba\x94\x4f\x1b\x9a\x58\xfb\xdf\xac\x87\xc4\x92\xda\x7c\x03\x00\x00\xff\xff\x27\x8e\xbf\xf1\xde\x00\x00\x00")

func stdlibSymbolsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibSymbolsPisc,
		"stdlib/symbols.pisc",
	)
}

func stdlibSymbolsPisc() (*asset, error) {
	bytes, err := stdlibSymbolsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/symbols.pisc", size: 222, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibVectorsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x55\x4d\x8b\xe3\x46\x10\x3d\xab\x7f\xc5\x83\x35\x64\xec\x89\x67\xd6\x9a\xdd\x1c\xe4\x10\x08\x31\x84\x9c\x02\x1b\xd8\x8b\x30\x6c\x8f\x55\x8e\x9b\x48\xdd\x4a\x77\x4b\xf6\xfc\xfb\x50\xa5\x4f\xaf\x9d\x4d\x4e\x33\x5d\xf5\xaa\x5e\xd7\xab\xd7\xf2\xf3\x0a\x9f\xe9\x10\x9d\x0f\xd0\xb6\x40\x3c\x91\xf1\x68\xa2\x29\x4d\x34\x14\xb0\x7a\x56\x2a\xdb\xfd\xfe\x0b\x5a\x3a\xac\x03\xc5\xb5\x8e\x78\xe0\x03\x5a\x5d\xc2\x14\x17\xac\xd7\xa0\x92\x2a\x2c\xf1\x07\x45\xce\x44\xe7\xa1\xa3\xe4\xa2\x63\x58\x43\xd8\x4e\x4d\xc6\x06\xd7\xc5\xbf\x52\x94\x7f\xc9\x46\xa9\xb6\x05\x5d\x86\xb2\x1f\xbb\xae\x3f\xe1\x81\x0b\x7a\x8a\x25\x7e\xb3\x26\x42\xc3\xd2\x79\x88\xcd\x68\x48\x1f\x4e\x3d\xd1\xdf\x8d\x8b\x5c\xf8\xf4\x84\x25\x3e\x35\x16\x5f\x38\xf2\x05\x47\xe7\x21\xb0\x81\xd7\x58\x9e\x7f\x6a\xa6\x32\xa4\xfd\xe1\x01\x1a\xaf\x3d\x3b\x96\xd3\x8d\x52\xe4\x08\x67\x5d\x0b\x67\xed\xa9\x26\x5b\x60\x8f\x68\x2a\x0a\x5d\x87\x4d\x18\x06\x9e\x86\x7d\x3f\x28\xb1\x65\x0a\x5b\xdc\x00\x36\x73\xc0\x8b\xbf\x05\xa4\x73\xc0\x87\x78\xba\x01\xbc\xcc\x01\x1f\xef\x00\x3e\xcc\x01\x3f\xdc\x01\x7c\x9c\x00\xef\xb0\x73\xf6\xbb\x08\x5d\x14\xa8\x9c\x27\x9c\xc8\x13\x1a\x5b\x52\x08\x2c\x99\x27\x98\x00\x8d\x55\x4b\xfe\x6d\x85\x3f\x9d\x2b\xe0\x49\x07\x67\x7b\xf7\xb0\xcc\x29\x33\x6c\xd0\xa6\xe3\x42\xda\x17\x2c\xf1\x73\x5d\x97\xec\x34\x2d\x61\x1d\x8d\xb3\xec\x9b\xf9\x62\xce\x26\x10\x6a\x6d\x3c\x6f\xa8\xdd\x88\x51\xdb\xf4\x7b\x86\x79\x0a\x4d\x29\x9b\x6b\x5f\x64\x92\x3b\x4c\xf9\xb0\x3b\xfd\x8a\x7d\x47\xaa\x92\x4c\x52\x59\x9b\x22\x6b\x37\x2a\x79\x8f\xcc\x4c\x5b\x7d\x97\xb9\x26\xaa\x64\xd1\xa6\x28\xc9\x62\xd1\x6e\xe4\x6f\x65\x2c\x72\x95\x24\x7c\x5e\x98\x41\x1e\x09\xa4\x53\x40\x25\x89\xf4\x96\x53\xcd\x86\x50\x49\x92\x63\x83\x47\xec\xb1\xc8\x8c\x4a\xe6\xfe\x60\x75\x42\x5d\xea\x99\x49\x4c\xa4\x2a\x60\x89\x5d\x53\xd5\x62\xc8\x83\xb3\x91\x6c\x0c\x70\xc7\xb9\x41\x9d\x8d\x4e\xce\x21\xea\xc3\x5f\x32\xfd\xbd\x4e\x4f\xe2\xfb\x9c\x47\x1f\xde\xc5\x76\xf6\xa8\x3d\xb5\xe4\x03\x4d\x45\x7d\xa0\x33\xfa\xa7\xee\xc0\xeb\x99\xde\xd8\xff\xa8\x53\x49\xd1\xd4\xc8\xf8\xc0\xca\x65\xfc\x2c\x58\x63\x25\x4a\xac\x45\x09\x51\x66\xc1\x99\x14\xcf\xa2\x4f\xde\x89\x49\x87\x99\xbc\xd9\x65\x8c\x31\x74\x88\xbe\x8d\xd1\xb7\x01\xdc\x7f\x9e\x98\x74\x4c\x5e\xa6\xaa\xeb\xf4\x7a\xdd\x2d\xe6\xf1\x71\x5a\x88\x92\x22\x25\xcf\x96\x2b\x8e\xa6\x8c\xe4\xbf\xfa\x8a\x74\x41\x2a\x3e\xf7\x73\x8e\xa6\xc9\x2c\x9d\xa5\xb7\x58\x8b\x07\x55\x49\x02\x96\xa1\x77\xe1\xa2\x03\x4c\xdf\x8b\xce\x1d\x43\x21\xf6\xc8\x51\x78\x57\x63\x0f\x73\x04\xdf\x6a\x58\x98\x4a\xfa\xda\xe9\x6e\x95\xae\xbf\xba\x58\xc5\xed\xba\x6b\x29\x8c\xfe\xa6\x43\xa7\x3b\x3a\x41\x78\x19\x39\x14\x6e\x64\x16\xf8\x18\x97\x2b\x5e\xcb\xca\x37\x53\x09\x44\x30\x8c\x8a\x61\x94\xec\x79\x85\xd1\x53\x8c\x3d\x7a\x67\x67\x56\xec\x67\x5c\x62\xc7\x13\xb2\x6b\x3b\xc0\xb5\xa5\xb7\xfc\x83\x93\xfd\x67\x0f\xf9\xd8\x0e\x69\x91\xec\xce\x05\x5e\xf9\x51\x7c\x83\x5f\xf2\xdf\xa4\xff\x97\x0e\x3d\xbb\x64\x7b\xf2\x7f\x02\x00\x00\xff\xff\xd5\x00\x21\x41\x46\x07\x00\x00")

func stdlibVectorsPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibVectorsPisc,
		"stdlib/vectors.pisc",
	)
}

func stdlibVectorsPisc() (*asset, error) {
	bytes, err := stdlibVectorsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/vectors.pisc", size: 1862, mode: os.FileMode(436), modTime: time.Unix(1512805598, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _stdlibWithPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x4e\xc3\x30\x10\x84\xcf\xf1\x53\x8c\x4a\x0f\x25\xc2\xcd\x3d\x45\x08\x09\x71\xe0\x82\x10\x57\x84\xd0\xc6\x31\xb1\x8b\x1b\x87\x78\x5b\xbf\x3e\x5a\x97\x22\xfe\x8e\xab\xf1\x7c\x33\xe3\xa6\x46\xf6\xec\xa8\x0b\x16\xb1\xdb\x5a\xc3\x09\x75\xa3\x54\xfb\xf0\x78\x8b\x6b\xac\x90\xe3\xdc\xdf\xd3\xce\x42\x6b\xac\xd7\x38\xc7\xe2\x45\x0c\x0b\x0c\x96\x75\x88\x86\x02\x52\xa6\x09\xbd\x37\xac\x07\xcb\x30\x14\x02\x36\x4a\xb5\x05\x8c\x95\x60\xf1\xbe\x8f\xfc\x45\x68\xcb\xd5\xc6\x6e\xab\xaa\x4b\xf1\x5d\xa1\xcd\x07\x9a\x55\xb5\x2c\xca\x29\x41\x0e\xed\x28\xe9\x03\xcd\x78\xc2\x3f\xa2\x74\x10\xb1\xd8\xf1\x8c\xec\xec\xa8\xaa\xa6\xc6\xdd\x2b\xd8\xf9\x74\xcc\x75\x94\x50\x5c\x48\x96\x2f\x40\xd3\x64\xc7\x1e\x9e\xc1\x11\x84\xc4\x64\xde\x64\xf3\xaf\xf4\xe5\xa9\xb7\x4e\xc7\x14\x55\x9d\xe1\x46\xc6\x95\x67\xfb\xe4\xc7\xe1\x13\xbb\xb3\x4c\xdf\xfa\xcb\x0f\xfc\xa1\x95\x86\x3f\x70\x1b\xf5\x11\x00\x00\xff\xff\x81\x99\x2d\xf3\x7d\x01\x00\x00")

func stdlibWithPiscBytes() ([]byte, error) {
	return bindataRead(
		_stdlibWithPisc,
		"stdlib/with.pisc",
	)
}

func stdlibWithPisc() (*asset, error) {
	bytes, err := stdlibWithPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "stdlib/with.pisc", size: 381, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
		}
		return a.bytes, nil
	}
	return nil, fmt.Errorf("Asset %s not found", name)
}

// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
	a, err := Asset(name)
	if err != nil {
		panic("asset: Asset(" + name + "): " + err.Error())
	}

	return a
}

// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
		}
		return a.info, nil
	}
	return nil, fmt.Errorf("AssetInfo %s not found", name)
}

// AssetNames returns the names of the assets.
func AssetNames() []string {
	names := make([]string, 0, len(_bindata))
	for name := range _bindata {
		names = append(names, name)
	}
	return names
}

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
	"stdlib/bools.pisc": stdlibBoolsPisc,
	"stdlib/debug.pisc": stdlibDebugPisc,
	"stdlib/dicts.pisc": stdlibDictsPisc,
	"stdlib/io.pisc": stdlibIoPisc,
	"stdlib/locals.pisc": stdlibLocalsPisc,
	"stdlib/loops.pisc": stdlibLoopsPisc,
	"stdlib/math.pisc": stdlibMathPisc,
	"stdlib/random.pisc": stdlibRandomPisc,
	"stdlib/shell.pisc": stdlibShellPisc,
	"stdlib/std_lib.pisc": stdlibStd_libPisc,
	"stdlib/strings.pisc": stdlibStringsPisc,
	"stdlib/symbols.pisc": stdlibSymbolsPisc,
	"stdlib/vectors.pisc": stdlibVectorsPisc,
	"stdlib/with.pisc": stdlibWithPisc,
}

// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
//     data/
//       foo.txt
//       img/
//         a.png
//         b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
	node := _bintree
	if len(name) != 0 {
		cannonicalName := strings.Replace(name, "\\", "/", -1)
		pathList := strings.Split(cannonicalName, "/")
		for _, p := range pathList {
			node = node.Children[p]
			if node == nil {
				return nil, fmt.Errorf("Asset %s not found", name)
			}
		}
	}
	if node.Func != nil {
		return nil, fmt.Errorf("Asset %s not found", name)
	}
	rv := make([]string, 0, len(node.Children))
	for childName := range node.Children {
		rv = append(rv, childName)
	}
	return rv, nil
}

type bintree struct {
	Func     func() (*asset, error)
	Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
	"stdlib": &bintree{nil, map[string]*bintree{
		"bools.pisc": &bintree{stdlibBoolsPisc, map[string]*bintree{}},
		"debug.pisc": &bintree{stdlibDebugPisc, map[string]*bintree{}},
		"dicts.pisc": &bintree{stdlibDictsPisc, map[string]*bintree{}},
		"io.pisc": &bintree{stdlibIoPisc, map[string]*bintree{}},
		"locals.pisc": &bintree{stdlibLocalsPisc, map[string]*bintree{}},
		"loops.pisc": &bintree{stdlibLoopsPisc, map[string]*bintree{}},
		"math.pisc": &bintree{stdlibMathPisc, map[string]*bintree{}},
		"random.pisc": &bintree{stdlibRandomPisc, map[string]*bintree{}},
		"shell.pisc": &bintree{stdlibShellPisc, map[string]*bintree{}},
		"std_lib.pisc": &bintree{stdlibStd_libPisc, map[string]*bintree{}},
		"strings.pisc": &bintree{stdlibStringsPisc, map[string]*bintree{}},
		"symbols.pisc": &bintree{stdlibSymbolsPisc, map[string]*bintree{}},
		"vectors.pisc": &bintree{stdlibVectorsPisc, map[string]*bintree{}},
		"with.pisc": &bintree{stdlibWithPisc, map[string]*bintree{}},
	}},
}}

// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
	data, err := Asset(name)
	if err != nil {
		return err
	}
	info, err := AssetInfo(name)
	if err != nil {
		return err
	}
	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
	if err != nil {
		return err
	}
	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
	if err != nil {
		return err
	}
	return nil
}

// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
	children, err := AssetDir(name)
	// File
	if err != nil {
		return RestoreAsset(dir, name)
	}
	// Dir
	for _, child := range children {
		err = RestoreAssets(dir, filepath.Join(name, child))
		if err != nil {
			return err
		}
	}
	return nil
}

func _filePath(dir, name string) string {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

Changes to boolean.go.

1
2
3
4







5
6
7
8
9




10
11
12
13
14




15
16
17
18
19









package main

func (m *machine) loadBooleanWords() error {
	m.predefinedWords["and"] = NilWord(func(m *machine) {







		a := m.popValue().(Boolean)
		b := m.popValue().(Boolean)
		m.pushValue(Boolean(a && b))
	})
	m.predefinedWords["or"] = NilWord(func(m *machine) {




		a := m.popValue().(Boolean)
		b := m.popValue().(Boolean)
		m.pushValue(Boolean(a || b))
	})
	m.predefinedWords["not"] = NilWord(func(m *machine) {




		a := m.popValue().(Boolean)
		m.pushValue(Boolean(!a))
	})
	return nil
}









|

|
|
>
>
>
>
>
>
>
|
|
|
<
<
>
>
>
>
|
|
|
<
<
>
>
>
>
|
|
<


>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
package pisc

var ModBoolCore = Module{
	Author:    "Andrew Owen",
	Name:      "BoolCore",
	License:   "MIT",
	DocString: "The 3 basic boolean operation, and/or and not",
	Load:      loadBoolCore,
}

func _and(m *Machine) error {
	a := m.PopValue().(Boolean)
	b := m.PopValue().(Boolean)
	m.PushValue(Boolean(a && b))


	return nil
}

func _or(m *Machine) error {
	a := m.PopValue().(Boolean)
	b := m.PopValue().(Boolean)
	m.PushValue(Boolean(a || b))


	return nil
}

func _not(m *Machine) error {
	a := m.PopValue().(Boolean)
	m.PushValue(Boolean(!a))

	return nil
}

func loadBoolCore(m *Machine) error {
	m.AppendToHelpTopic("Bools", "PISC boolean expressions are generally not short-circuited without using quotations")
	m.AddGoWordWithStack("and", "( a b -- a&b )", "Boolean And", _and)
	m.AddGoWordWithStack("or", "( a b -- a||b )", "Boolean OR", _or)
	m.AddGoWordWithStack("not", "( a  -- not-a )", "Boolean NOT", _not)

	return m.ImportPISCAsset("stdlib/bools.pisc")
}

Deleted bools.pisc.

1
2
3
4
5
6
7
/*
bools.pisc
*/

:DOC and ( x y -- ? )  Boolean and  ;
:DOC or ( x y -- ? )  Boolean or  ;
:DOC not ( x -- !x )  Boolean not  ;
<
<
<
<
<
<
<














Added build.































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/bash

set -uo pipefail
export PISCDIR="$(pwd)"

function older_than() {
  local target="$1"
  shift
  if [ ! -e "$target" ]
  then
    echo "updating $target" >&2
    return 0  # success
  fi
  local f
  for f in "$@"
  do
    if [ "$f" -nt "$target" ]
    then
      echo "updating $target" >&2
      return 0  # success
    fi
  done
  return 1  # failure
}

cd "$PISCDIR"

function generate {
	echo "Generating..." >&2
	older_than bindata.go stdlib/*.pisc && {
        # TODO: Put in a go get command for go-bindata
		echo "Generating bindata" >&2 
		go-bindata -pkg pisc stdlib/...
	}
}

function webbuild {
	older_than ./cmd/playground/playground.js *.go stdlib/*.pisc && {
		cd "./cmd/playground"
        # TODO: Put in a go get command for gopherjs
		gopherjs build -m
		cd ../..
	} 
}

function upload {
	generate
	webbuild
	cd ./cmd/playground
	# Note: This command won't work w/o a password for the scp
	scp *.css *.js *.html yumaikas@junglecoder.com:/var/www/pisc-static/playground
	cd ../..
}

function interpinstall {
	generate 
	cd "./cmd/pisc"
    go get
	echo "Installing new PISC interpreter"
	go install 
	cd "../.."
}

function testpisc {
	interpinstall
	pisc -f tests/all.pisc
}

case "$1" in 
"generate")
	generate
	;;
"install")
	interpinstall
	;;
"web")
	webbuild
	;;
"upload")
	upload
	;;
"test")
	testpisc
	;;
esac

cat <<EONOTE
TODO: Definitely consider switching fmt.Println to pass through priv_puts in as *many* places as make sense.
TODO: Consider using crit-bit trees for dictionaries
TODO: Now that something close to a save-game has been implemented for final-frontier, start implementing the initial states and such
TODO: Implement an interactive tutorial in the 'in Y minutes' style. 
TODO: consider packing the scripts under scripts/ for general use, possibly with a switch for unpacking them
EONOTE

exit 0

Added cmd/FinalFrontier/bindata.go.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
// Code generated by go-bindata.
// sources:
// scripts/backstory.txt
// scripts/gamesave.pisc
// scripts/intro.pisc
// scripts/lib.pisc
// scripts/main.pisc
// scripts/map.pisc
// scripts/markets.pisc
// scripts/saving.pisc
// scripts/ships.pisc
// scripts/term_posix.pisc
// scripts/term_win.pisc
// DO NOT EDIT!

package main

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"time"
)

func bindataRead(data []byte, name string) ([]byte, error) {
	gz, err := gzip.NewReader(bytes.NewBuffer(data))
	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	var buf bytes.Buffer
	_, err = io.Copy(&buf, gz)
	clErr := gz.Close()

	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}
	if clErr != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}

type asset struct {
	bytes []byte
	info  os.FileInfo
}

type bindataFileInfo struct {
	name    string
	size    int64
	mode    os.FileMode
	modTime time.Time
}

func (fi bindataFileInfo) Name() string {
	return fi.name
}
func (fi bindataFileInfo) Size() int64 {
	return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
	return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
	return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
	return false
}
func (fi bindataFileInfo) Sys() interface{} {
	return nil
}

var _scriptsBackstoryTxt = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x92\x51\x6e\xdc\x30\x0c\x44\xaf\x32\x07\xd8\x2c\xd0\x8f\x1e\x21\x1f\xfd\x28\x10\xa0\xb9\x00\x2d\x8f\x2d\x62\x65\x49\x15\xe9\x75\x7c\xfb\x42\xca\x6e\x1b\xf4\xd3\x30\xc5\x79\x9c\x99\xd7\x8f\x9a\x4a\x63\x33\x48\x23\x78\x67\x46\x2e\x07\x36\xa9\x55\xf3\x8a\xb2\x3b\x3c\x12\x77\x69\x5a\x76\x43\x92\x4c\x43\x59\x60\x49\xab\x55\x09\xbc\xe2\x67\x31\x47\x65\xa9\x89\x30\x72\x83\x17\x4c\x44\x28\xd9\x99\xbd\x7f\x99\xcb\x89\x92\xc7\xa6\xda\x57\x78\x5f\xe1\x91\xda\x30\x69\xf3\x78\x81\x18\xa6\xe2\x11\xb6\x4f\x63\x2d\x24\xcf\xff\x44\x06\x9c\x37\x4a\x88\x6c\x9d\xa3\x26\x09\xb4\x2b\xde\xb4\x89\xd3\x2e\x58\x1a\x75\x8d\xce\x66\x97\xcf\xa7\xdb\xbe\xae\x69\xdc\x95\xf4\x46\xdc\x95\x58\x4a\xc3\x22\xee\x34\xbf\xe0\xf7\xae\xe1\x46\x73\x4c\x7b\xb8\x5d\xf1\x36\xb0\xa4\x9d\x58\x12\xe9\x86\xad\x98\xa7\x13\xb5\x15\x67\xf0\x07\x6c\x2c\x5b\x57\x7d\x8f\x6c\xc4\x6e\x9c\x1f\xb7\x0a\xec\x34\xe7\xf6\x72\xa8\x11\xdc\xaa\xb6\xce\x5c\xf6\x3c\xe3\x57\x49\x17\x4c\xbb\x23\x95\x55\xcd\x35\x18\x36\xb9\xd1\x20\x58\x25\xc9\xc7\xf9\x72\xe8\x4c\x94\x4c\x64\x4a\x7b\xd1\xad\x16\x33\x9d\x12\xaf\x78\xed\x79\xe8\x32\x06\x83\x6b\x40\xdb\x13\x71\x88\xe1\x39\x73\x19\xa6\x52\x5a\x3a\xbf\xd8\xa5\xd9\x5c\x26\x4d\xea\x4a\x83\xd5\x46\x99\x9f\x11\x2d\xd2\x86\x43\x43\xd5\x63\x2b\xfb\x1a\x7b\xcc\x8f\x34\xdf\xa3\x1a\x16\x09\xbe\xb7\x7e\x5e\x24\xac\x04\xa5\x9f\x48\x5c\x1c\x13\xa3\xe6\xf9\x8a\x1f\x3d\xd8\x72\xc3\xcc\x20\x33\x6d\x78\x2b\x5f\x08\xe6\xa6\x77\x3e\xdc\xe9\x2c\x89\x60\xee\x52\x63\x72\x2b\xbd\x6c\x1f\x95\x4d\x37\x66\x97\xd4\xcd\x1c\x4b\xfb\x6d\x25\xa7\x13\x87\x7a\x1c\xf2\xb2\xf6\x22\x76\xe2\x99\xe2\xf1\xb3\x39\xc5\x88\x23\x96\x3e\x95\x69\xf6\x24\xfd\x2b\xbf\xb4\x71\x41\x7f\xe9\x51\xfc\xbf\xbf\x41\xb6\x27\x9b\x84\xc0\xea\x9c\x7b\x01\x05\x1b\x25\x8f\x7a\x7b\x93\x3b\xd3\x48\x1a\x49\xcc\xf1\xed\x3b\x4e\x4a\x33\x44\xb9\x13\x16\xcb\x91\x71\x94\x3c\x8f\x36\x7a\xd4\xbc\xda\xf5\x4f\x00\x00\x00\xff\xff\x94\x12\x47\x4d\x4c\x03\x00\x00")

func scriptsBackstoryTxtBytes() ([]byte, error) {
	return bindataRead(
		_scriptsBackstoryTxt,
		"scripts/backstory.txt",
	)
}

func scriptsBackstoryTxt() (*asset, error) {
	bytes, err := scriptsBackstoryTxtBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/backstory.txt", size: 844, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsGamesavePisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")

func scriptsGamesavePiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsGamesavePisc,
		"scripts/gamesave.pisc",
	)
}

func scriptsGamesavePisc() (*asset, error) {
	bytes, err := scriptsGamesavePiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/gamesave.pisc", size: 0, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsIntroPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x53\x4f\x6b\xeb\x46\x10\x3f\x5b\xa0\xef\xf0\xc3\x04\x92\x80\xec\xfa\xd2\x8b\x7b\x08\xa5\x10\x28\xf4\x96\x40\x09\xc6\x87\xb1\x34\xd2\x0e\x5e\xcf\xaa\xbb\x23\x29\xfa\xf6\x65\xa5\x98\x17\x1e\x3c\x74\xd2\xce\xec\xfc\xfe\xcd\x96\xc5\x11\xa2\x16\x03\x9e\xd0\xd1\x8d\xb1\xdb\x41\xf9\xd3\xf0\x5c\x16\xc7\x7c\x50\x16\x7f\xfd\xf3\x56\x16\x65\xb1\x7d\xeb\xa9\xe6\x0a\xe6\x18\xaf\xa2\xe4\xf1\x1a\x83\x9a\x70\xcc\xd5\x77\xc7\x48\x46\x31\xc1\xd1\xc8\xb8\x70\x7d\x0d\xca\x0d\xe6\x30\x54\xe0\x91\x15\x93\x63\xcd\xbf\x98\x38\x32\x2e\x83\x81\x30\x31\xa3\x76\xe2\x9b\x7d\x59\xfc\x6d\x8f\x09\x84\x28\xe9\x3a\xc3\x4b\xcb\x15\x52\x46\x6c\x29\x8a\x76\x15\x26\x47\x86\x49\xcc\xa1\x97\x48\xc6\xa9\x42\xba\x0d\x5d\xe7\x39\xa6\x0a\xa4\x0d\x7a\x4f\xca\x46\x71\x46\x1f\xbc\xd4\x5c\x16\xa2\x20\xd4\x41\x93\x91\x1a\x92\xc5\xa5\xbf\x82\x06\x83\x05\xdc\x58\x4d\x82\x82\x92\x71\x94\xd0\xa4\x0a\x4a\xa3\x74\xb4\x9c\x36\xd2\xb6\x52\x0f\xde\xe6\x75\x7c\x16\x3e\x98\x65\xbd\x63\x90\x06\xa1\x5d\x09\xee\xf1\x11\x86\xc7\x91\xd1\x47\xee\x29\x72\x83\x36\x44\x98\x93\x84\x86\xe6\xa5\x1a\x11\x99\x1a\xd1\x0e\x26\x37\xc6\x44\x09\x0d\x37\x52\x93\x71\x93\x89\xd4\x8e\xa2\xa5\xb2\xc8\x30\xc9\x49\x8f\xd0\x73\x5c\x58\x54\xd9\xb2\x98\x81\x22\xaf\x97\x2d\xc0\x22\x89\xe6\x69\xa2\x48\x72\x1b\x3c\x59\xb8\x9b\xb0\xb6\xd3\x28\xda\xa5\xb2\x58\xc2\xa0\x5b\x18\xf4\x0b\xe9\xe1\xf7\xc3\xe1\xb0\xc7\xbf\xe2\xfd\x12\x06\x7f\xf6\x3e\xe4\xd1\xf7\xfc\x5e\xf0\xf4\xf1\x9b\x3e\x97\xc5\x16\x7d\x14\x35\xaf\x39\xde\x03\x8e\x57\x9c\xf0\x70\x85\xa4\xdd\xac\x2f\x8b\x83\x67\x9c\xd0\xb1\x5d\x79\xce\xd5\x33\x26\x27\x9e\x73\xf7\xda\xa6\x2f\x38\xa1\x2c\x36\xdb\x77\x17\x86\xce\x55\xe8\x39\x3a\xea\xd3\x0f\x2c\x64\x51\xd9\x2c\xd2\x60\x8e\xe3\x22\x70\x8f\x3f\x5b\xe3\x08\xf2\x7e\x59\xb6\x19\x53\xd0\x47\xc3\x85\xd1\x85\x2c\x9a\x74\x9e\x1c\x47\xfe\x46\x70\x33\x91\xd8\x8e\x75\x09\x67\xb3\x39\x65\xff\xb2\x41\xbb\x1b\xeb\x80\x33\xca\xe2\xbc\xec\xdf\x9d\xda\x9c\xa9\x9d\xd0\x4b\x7d\xdd\x2d\x7e\x9f\x71\x6f\xf8\x23\x0b\x38\x7e\x2b\xfd\xfc\x2e\xb2\xa4\xe5\x49\x6c\xb6\x4b\xf0\xf1\xce\xcb\x02\x94\xb9\x01\xad\x11\x5e\xb8\xcd\xc6\x66\x93\x6b\xd2\x9c\xd9\xc8\x1e\xe6\x62\x36\x63\xdd\x9c\x0a\x2e\x4c\x3c\x72\xdc\xe3\x97\x62\x4e\xf8\x6f\x10\xdb\x2d\x1c\xce\x5f\xf4\xd6\xef\xff\x00\x00\x00\xff\xff\x8f\x37\x15\x2f\xbb\x03\x00\x00")

func scriptsIntroPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsIntroPisc,
		"scripts/intro.pisc",
	)
}

func scriptsIntroPisc() (*asset, error) {
	bytes, err := scriptsIntroPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/intro.pisc", size: 955, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsLibPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x91\xcd\x6a\xdc\x30\x14\x85\xd7\x16\xe8\x1d\x0e\xc3\x2c\x52\xc2\x2d\xe9\xd6\x75\x33\x9b\x6e\xb2\x69\x0a\x59\xa4\xe0\x0c\x65\x22\xdd\xda\xaa\x23\xc9\x95\x64\x9c\xbc\x7d\x91\x35\x3f\x86\x40\x76\x96\xce\xa7\xef\xea\xc8\x89\x83\x25\xeb\x35\x63\xf3\x78\xf7\xe3\xfb\xfd\xe3\xc3\x06\xfc\x0f\x2d\xa4\x00\x80\x4d\x54\xc1\x8c\x29\x3e\x3d\x65\xf0\xf7\x6c\xdc\xe7\xd1\x44\xb5\x41\x77\xb0\x4c\x25\x94\x62\x8f\xb9\x67\x27\x85\x14\x2b\xdd\xcf\xfb\x87\xbb\x5f\x1f\xc9\x46\x1f\xcd\xeb\xc7\xba\x1a\xf3\xc1\x24\x62\x97\x38\xe0\x0a\x44\xf8\x04\x29\xaa\x16\x1d\xa7\x81\xdf\x60\x62\xc9\x76\xd8\xa3\x45\x3e\x67\x5e\x58\x8a\xaf\xe5\x6c\x33\x8d\xa4\xfd\xec\xc8\xb2\x9b\x6e\x71\x05\x37\x59\xf2\x63\x8a\x59\xe4\x9f\xff\x16\x59\xed\x26\x2b\x45\x75\x83\xda\x92\xd1\xaf\x52\x54\x09\xb5\xea\xbd\x8f\xc6\x75\xcb\x30\x29\xaa\xea\x38\xb0\x1e\xf2\x62\x3b\xac\x26\xb7\xf8\x73\xe1\x51\xee\x8e\x0b\x75\x08\xc1\xcf\x3b\xb4\x79\xe7\x6c\xd1\x26\x2c\xeb\xad\x36\x21\x43\xd3\x98\x3d\x44\xcb\x0d\x70\xea\xbf\x02\x72\x8d\x8c\x5c\x5f\xbf\x47\xca\xce\xd6\x4d\x16\xd6\xeb\x4b\x8d\x73\x74\x83\x06\x6d\x01\xbe\x80\x8e\xc0\x4a\x71\xfe\xda\xe7\x22\xac\x72\xc7\x46\x1b\x95\x6e\xcb\x63\x6f\x57\xed\x9a\x86\xb4\x77\xbc\x2b\xc1\xc9\xd4\x34\xa4\x7a\x1f\xd9\x1d\x47\xb7\x58\x3c\x25\x19\x83\x57\x34\xf0\xdb\xfa\xc8\x37\xb4\x78\x3e\xa8\x81\xe6\xde\x24\x3e\xbd\xda\x82\xf7\xa6\xeb\x5f\x4c\xd7\xa7\xe5\x3f\xfe\x0f\x00\x00\xff\xff\x55\xdb\xba\xd7\xa0\x02\x00\x00")

func scriptsLibPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsLibPisc,
		"scripts/lib.pisc",
	)
}

func scriptsLibPisc() (*asset, error) {
	bytes, err := scriptsLibPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/lib.pisc", size: 672, mode: os.FileMode(436), modTime: time.Unix(1506682674, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsMainPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x93\x4f\x6f\xea\x38\x14\xc5\xd7\x89\x94\xef\x70\x94\x61\xf1\xde\x13\xa1\xf3\x6f\x95\x57\x75\x34\xa2\x74\xa6\x12\x05\x69\xda\xae\x28\x0b\xc7\xb9\x24\x16\x8e\x9d\xb1\x0d\x14\x55\xfd\xee\x23\x3b\xa1\xd0\x99\x8a\xe9\x06\x9c\xeb\xdf\x3d\xbe\xf7\xfa\xf8\x07\x3c\xd4\xc2\x42\x58\xac\x84\x62\x12\x2b\xa3\x95\x13\x64\x86\x60\xa8\x58\x43\x10\xca\xb6\xc2\x50\xc9\x51\xec\x61\x5b\xc6\x69\x08\x67\x58\x49\x3b\xa1\x4a\x3b\x04\x53\x25\x18\xa4\x70\x4e\x12\x0a\xe1\xa0\x57\x90\x4c\x51\x56\x30\x4b\x25\xb8\x6e\x0a\xe6\x92\xf8\xe2\x5b\x12\xdf\x5e\x4f\x7e\xbf\xcf\x71\xc7\xf6\x05\xf9\xe3\x4a\x58\xdd\x10\x76\x6c\x0f\xa7\x21\x94\xa3\xca\x30\x47\x90\x5a\x55\x70\xa2\x21\x7f\xd0\x96\xa4\xdf\xd2\x70\x35\x81\x6f\xa4\xdb\x18\xf2\x67\x84\x52\x56\xcc\x90\xb1\x49\xfc\xed\x22\x89\x93\x38\xb5\xdc\x88\xd6\xd9\xa7\x27\x29\x8a\x51\x2b\x2c\x4f\x43\x0f\x59\x17\x3f\x05\x1a\x66\xd6\xe4\xec\x79\x48\x28\x67\xf4\x79\xc4\xb2\xad\x50\xd5\x47\x4c\x12\xe7\xd0\x2d\x29\xa1\xaa\xac\x21\xb5\xc1\x97\x6e\x9e\x59\x06\x45\xcf\x0e\x5f\x93\x38\xca\x7d\x24\x89\xa3\x5f\x71\xb9\x69\xb3\x52\xef\x54\x40\xaf\x90\x37\x49\x1c\x0d\x1a\x64\x57\xb5\xa8\x6a\x29\xaa\xda\x21\xbf\x9b\xcc\x1e\x93\x18\xd1\x02\x05\xe3\xeb\xac\x90\x8c\xaf\xb1\x44\x3e\xfe\x73\x7e\x3b\x9e\xf8\x9d\x6e\x85\xd6\x08\x15\x2a\xf0\xec\xa0\xc1\xa8\xd4\x8a\x7e\xc3\x32\x04\x92\x38\x8a\xc6\xd3\x7b\xff\x37\x9b\x4d\xfd\xdf\xe0\xc5\xff\x46\x7c\xcf\x14\xd2\x9b\xe0\x82\x9b\xde\x05\x29\x7a\x26\x32\x54\x22\x2c\x52\x20\xc5\x8f\xf0\xc5\x20\x9d\xd1\x0e\x7f\xb0\x86\x52\xf4\x47\x1f\xf0\x40\xfd\xd4\x53\x53\xcd\xca\x33\xd8\xcf\x3d\x36\x6f\x9d\xd0\xca\x7e\x0c\xfd\xd2\x43\x7f\x91\xdb\x18\xe5\xfd\x62\x88\x49\x48\xb1\xfa\xaf\xea\xae\x16\x8e\x90\x3e\xb6\x17\xd7\x7a\x17\x58\x5e\x6b\x6d\x69\x88\x89\x72\x64\x42\x40\xab\x95\x30\x0d\x52\x74\x39\xaf\xc7\xa1\x45\x7e\xf0\xa3\xd6\x68\x9e\xad\x69\x9f\xc4\xd1\x12\xbb\x5a\x48\x7f\x4f\x2f\x61\x04\x58\x20\x38\x03\xcb\xc3\xa7\xd4\xac\xcc\xc2\xed\x2e\xfb\x88\xee\x7a\x79\xfb\xa6\x67\xe1\x8e\xc4\x6b\xb8\x15\x5e\x6b\x4b\x2a\x13\xe5\x33\xb6\xc4\x33\xe6\x90\xc4\xdf\x3b\xe3\x1c\x05\x8f\xae\xc1\x57\x04\xbf\x60\x3c\xbd\xc7\xe0\x05\xe9\xc3\xfc\x7a\x9e\xe3\xb6\x69\x25\x35\xa4\x5c\x67\x3f\x9f\x69\x7d\x57\xe8\x5b\x92\x0a\x0b\xa4\x48\x31\xc2\x12\xdf\xbd\xb8\x65\x5b\xfa\xb7\xf8\xa7\xb4\x7d\xe2\xff\x68\x1f\xfa\xfe\xf2\x59\xd1\x43\xc6\x79\xd9\xe3\xf8\x4e\x4b\x3e\x36\xf2\xf7\xe6\xb0\xdf\x0f\xb0\x61\x42\xf5\x45\x24\x31\x00\x5c\x96\x82\xbb\xab\xf7\x2f\x32\xe7\x1b\x63\x32\xeb\x98\xa3\x77\x50\xff\x2c\x7d\x64\x01\x87\x25\x16\x18\x04\xf1\xc1\x31\x01\x9c\x49\x79\xaa\x80\x37\x9b\xf8\xbc\x8a\x5c\x30\x8f\x5f\x9f\xbc\xd6\x43\x7b\x7e\x22\xdd\xe6\x5b\xe5\xfd\xdd\xfb\xc2\x93\xf8\x9f\x00\x00\x00\xff\xff\x1f\xb5\xba\x12\x96\x05\x00\x00")

func scriptsMainPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsMainPisc,
		"scripts/main.pisc",
	)
}

func scriptsMainPisc() (*asset, error) {
	bytes, err := scriptsMainPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/main.pisc", size: 1430, mode: os.FileMode(436), modTime: time.Unix(1506683028, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsMapPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x5f\x8b\x13\x31\x14\xc5\x9f\x33\x90\xef\x70\xa8\x03\xae\x8b\xb1\xfa\x9a\x95\xfa\x50\x16\x14\xd6\x0a\xca\xe2\x43\xe9\x43\x9a\x5c\x9b\xb0\xf9\x33\x24\xa9\xb3\x20\x7e\x77\x49\xa6\xe2\x22\xfb\x30\x19\x72\xcf\xb9\xe7\xde\xfc\xd6\xd7\x7c\xe0\xc3\x57\x8a\x86\x32\x14\x4e\xca\xab\xea\x34\x82\x9a\xf0\x23\xa7\x00\x4b\x99\x9a\xe3\x7a\xdd\x4e\x89\x52\x55\x16\x4d\xbd\xc2\x49\x05\x82\x10\x88\xf4\x58\xf1\x0a\x7c\x60\x7c\xb8\x69\xae\xee\xb3\x69\x16\x73\xca\xde\xe0\x0a\x93\x57\x91\xea\x33\x0d\xb2\x97\xe4\xa2\xb7\x46\x36\x5e\xbc\x62\x63\xa8\xe8\xec\xa6\xea\x52\xc4\x94\x5d\xac\x3e\xfe\xe7\xf0\x49\xab\x26\x17\x98\xf3\xd4\xbf\x3d\xc4\x26\xb6\xc8\x03\x7e\x92\xee\x7b\x4a\x9f\x74\xe9\x82\x4e\x21\xa8\x68\x9e\x6a\xda\x26\xa7\xa9\xb4\xd4\x6e\xf3\x14\xf1\x0e\x02\xef\xcf\x93\x30\x69\x8e\x22\x50\x3c\x6f\x20\xc3\x32\x39\x40\x6c\xac\x3b\x59\xef\x4e\xb6\x42\x7e\xbe\xdd\xdd\xf3\x01\x6c\x8f\xa3\xd2\x0f\xe2\xe8\x95\x7e\xc0\x01\x72\xfb\xf1\xcb\xa7\xed\xed\x42\x82\xed\x31\x06\xbc\x31\x29\xd2\x07\x1c\xf8\xc0\x5e\xe0\x3b\xbd\xcc\x84\x4c\xe2\x78\x76\xde\xb8\x78\x42\xb5\x84\x36\x09\xa4\xb4\x45\x75\x81\x30\xbb\x6a\xa1\x90\xa9\x54\xd4\x84\xd1\xf5\x28\x3e\x30\xb6\xbd\xfb\xd6\x7f\x7d\xc8\x3f\x32\x8c\xbd\x85\x6c\x2e\x36\xfe\x6a\xe7\x13\x4e\x9d\xc8\x6e\x77\xd7\xcb\x99\xcc\x22\x5f\xb8\x48\xdf\xaf\x6c\x74\x68\xef\xc1\x0a\x58\x61\xf4\xb8\xe4\xff\x6d\x5b\xa0\xb5\xfd\xfa\x75\xb6\xae\x12\x56\xf7\xd3\xba\x61\x6a\x1b\x16\xf2\xa4\xeb\x6b\x50\xac\x94\x5b\x41\xdb\x94\x0a\xad\xb0\x04\xfc\xe6\x03\x3b\x60\xb6\xce\xd3\xc2\xf2\x82\xbe\xd3\xd1\x36\x15\x8a\xc2\x99\xc7\x3e\x45\x55\x3e\xdc\xe0\x4f\x00\x00\x00\xff\xff\xb8\x77\xfd\xe3\x9a\x02\x00\x00")

func scriptsMapPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsMapPisc,
		"scripts/map.pisc",
	)
}

func scriptsMapPisc() (*asset, error) {
	bytes, err := scriptsMapPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/map.pisc", size: 666, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsMarketsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x92\x31\x6f\xdb\x4e\x0c\xc5\xf7\x03\xee\x3b\x10\xf0\x92\x04\x7f\xc3\x7b\xfe\x43\x01\x2b\x71\x9a\xc1\x68\x50\x17\xcd\x4c\x9f\x18\x1d\x91\xd3\x51\xe0\xf1\xec\xfa\xdb\x17\x27\xbb\x70\x81\x74\xc8\xc2\x41\xd4\xfb\xbd\x27\x3e\x2d\xc0\x3b\xef\x56\x77\x6d\xbe\x46\x34\xe0\x02\x16\x09\x28\x48\x96\xf1\x04\x83\x70\x1e\xc0\x04\xf6\x04\x89\xdf\x09\x38\x83\x45\x2e\x30\xe0\x48\x5f\x9a\x6a\xb1\x80\x35\x16\x0e\xf0\x24\xd2\x97\x99\x83\x46\xea\xdd\x46\xa4\xf7\x6e\x53\x29\x79\xf7\x4d\x69\xb5\x0b\x8a\xd3\x45\xf1\x80\x86\xd0\xe1\x54\x6a\xa2\x59\xf3\xa2\x32\x28\x8e\xc5\xbb\x9f\xdc\x93\x14\xef\x9e\x70\x6c\xab\x2d\x4e\x65\xd5\x45\x54\x2b\x17\xed\x57\xc2\xc3\xe9\xea\xf6\x5d\xf6\xd2\x76\xdb\x9a\xd9\x58\x72\xf1\x6e\x5d\x39\xf5\xcb\x4e\xc9\xc8\xbb\xc7\x7c\x60\x95\x65\x89\x4c\xa9\xe7\x3c\x5c\x28\x1b\xc5\x81\x13\x5d\x39\x3b\x49\xa8\xf0\x82\x99\x52\xf1\xae\x93\x71\xaa\x46\x0a\x5d\xe4\xa9\x78\xf7\x20\xa1\x8e\x94\x9b\xd1\x2e\xd4\x34\x59\xd5\x73\xf0\xbb\x55\x9b\xf7\x50\xa2\x1c\x97\x23\xea\x3b\x19\xdc\xc0\x72\x09\xb7\xf0\xff\x9f\xd3\xbe\x8a\xa6\x1e\x50\x43\x24\x3b\x4d\x67\x5d\x27\x49\xf2\xe9\xde\xbb\xc7\x5f\x93\xa8\x15\xd8\xcf\x47\x1c\x5a\x9c\xff\xe0\xc8\x16\x01\x41\x31\xf7\x32\x42\x88\x98\x03\x81\xbc\x01\xcd\x2f\xb7\x4a\x24\x13\x88\x45\x52\x68\xc8\xb6\x6b\x52\x40\x03\x84\x24\x47\x98\x94\x03\x35\xa3\xad\x64\x2c\xc6\x01\x7e\x50\x88\x59\x82\x62\x68\xb6\xcf\xe3\x3f\x6c\xe9\x92\xa5\x6f\xf5\x84\x4b\x3d\x8d\x7d\x40\x65\xa9\x05\xfe\x8a\xaf\x93\x28\x1a\x17\x83\xe7\xdc\xd7\x62\x9f\x23\xc7\xb9\xbc\xf9\xe1\xfc\xe7\x75\x4a\x67\xc8\x06\xf7\xca\x9f\x84\x7c\xe8\x6e\x4d\x55\x9b\xb4\x7d\xe6\x96\x4c\x3f\x60\xe8\x40\x7a\xb2\xc8\x79\xb8\x52\x26\x39\x92\xae\x38\xbf\xa5\x4a\xed\xbc\x37\x91\xe2\xed\xb9\xd2\xdf\x01\x00\x00\xff\xff\x8c\x0c\x77\x50\x16\x03\x00\x00")

func scriptsMarketsPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsMarketsPisc,
		"scripts/markets.pisc",
	)
}

func scriptsMarketsPisc() (*asset, error) {
	bytes, err := scriptsMarketsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/markets.pisc", size: 790, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsSavingPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x41\x6f\xdb\x38\x13\x3d\x4b\x80\xfe\xc3\x2b\xab\x83\xdd\xef\x53\xb2\x7b\x95\x83\x2c\x92\xa6\x28\x7a\x0a\xb0\xeb\xec\xc5\xf6\x81\x96\xc7\x31\x61\x45\x54\x48\xca\xae\x11\xe4\xbf\x2f\x86\xa4\x6d\xb9\x4d\x5c\x14\x08\x2c\x92\xc3\x37\x9c\x79\xf3\x86\xcc\xe5\x27\x64\x69\x96\x2e\xbb\xa6\xc2\x40\xe1\x5b\xe3\xe8\x91\xcc\x10\xe3\x5d\x4b\x83\x21\xac\x33\xaa\x79\xc4\x4b\x96\x26\x86\x5c\x67\x1a\x88\xb8\x45\x64\xe9\xeb\x11\xb9\xc0\x9d\xee\xe6\x35\x9d\x03\x86\x1d\xa7\x38\x89\x1b\x63\xe4\xee\x1c\xec\x5f\xaa\x9c\xfe\xf1\x38\x55\x39\xdc\xa9\xca\x9d\x3d\x4f\x55\x4e\xe9\x46\x9a\xdd\x29\x78\x8e\x5b\xad\x6b\x92\xcd\x39\x70\xdc\x72\x8a\xb4\xf8\xc7\xef\x3c\x07\x0c\x3b\xf6\xb8\x4f\x97\xfc\x5b\xc2\x92\x51\xb2\x2e\x9e\x64\xdb\x32\x60\x80\xa2\xc0\x7e\x32\xcc\xd2\xe4\x8a\x33\xba\xce\xd2\x24\x99\x60\x6b\x94\xa3\xc2\xa7\x38\xc3\xd5\x55\x71\xcc\xa3\x6f\xdf\x50\x15\xcc\x81\x9f\xbe\x49\x35\x11\x19\x4b\x75\xe2\xd6\x17\x21\x3a\xf6\xe3\xbe\x35\xe6\xe3\xad\x21\x91\xbe\x75\xae\x75\x1d\x6c\x91\x9d\x2c\x4d\x4a\x57\x38\xe9\xbd\x64\x69\x32\x41\xb9\x41\x96\x26\x40\x1e\x97\x91\x6f\xe0\x76\x2d\xe9\x25\x38\xa1\x62\x25\x6d\xb1\xa6\xdd\x5f\xc1\xed\x7b\xbb\x1e\xc9\x61\x16\xb7\xbc\x40\x30\xd9\x10\xbd\x4d\x02\x95\x6c\x1a\xed\x30\x27\x58\xb9\xa1\xc5\x85\xc0\x2b\xc8\x18\x6d\x3c\x0e\x50\xcb\x2c\x4d\x66\xc8\xd2\x51\xe4\x5f\x6e\x38\x3b\xe9\x08\x03\xb4\xd2\xad\x10\x26\x45\x11\x07\x43\x94\x61\x50\xb2\x35\x4b\x93\x3c\x4c\xe3\x89\x25\x7f\xb3\x34\x59\xa2\xb4\x5d\x55\x91\xb5\x3e\xdd\xdc\xbb\xd2\x2d\x35\xc5\x52\xd5\x54\x78\x9e\x0c\xca\xfb\x87\x31\x87\x2f\x4a\x5c\x60\xe0\x73\xc2\x46\xd6\x1d\x61\x4d\x3b\x3e\xd3\xaf\x0c\x43\xb2\x6d\x67\x57\x18\x09\xe4\xf7\x0f\x63\x5c\x04\xa6\x6b\xd5\xf8\xba\x04\x59\x30\xa5\x49\xe2\xed\x57\x57\x45\xf4\x9d\xfc\xc1\x13\x27\xe7\x3e\xd1\xf2\x91\x5c\xa1\x3b\xd7\x76\xce\x07\x46\xcf\x58\x74\x2d\xf2\x18\x2c\xb4\x39\x04\x8e\x19\x4a\x7a\xe6\xda\xe5\xce\x13\xdb\xeb\x13\xd0\x73\x83\x09\x8e\xce\x10\x69\x38\xd1\xe4\x76\x45\x3d\x78\xec\xcf\x5f\x40\x83\x5c\xf7\xc8\x23\x87\xc9\x04\x62\xda\x04\x9e\x24\x53\x33\xc4\xc2\xe8\x16\x23\xfc\xcc\x48\x5f\x13\x9f\x83\x00\xbc\x31\x72\xab\x97\xbe\x5a\x25\x23\x7d\x68\x7d\x49\x78\x41\x04\x87\x55\xad\x2d\x45\x65\x7c\xc4\xdf\xd4\xd6\xb2\x62\x7d\x6d\x95\x5b\x61\x2a\xa0\x1a\xb8\x15\xc5\xde\xfe\x3f\x9c\xc6\x9a\xa8\x85\x72\x58\x1a\xfd\x84\xb9\x21\xb9\xe6\x2e\xe9\x5a\x56\xd6\x73\xa7\xb9\x71\xe4\x92\x95\x65\x9d\x09\x92\x32\x18\x42\x4c\xa7\x82\x7f\xf8\x63\x9d\x29\xcc\xfe\xa4\xa9\x08\xeb\xe2\x74\x7d\xc4\xee\xb6\x46\xb6\x85\xf7\x69\x7f\xf6\xc7\x80\xad\x6c\x3d\xaa\xd2\x4d\x25\x5d\x5c\x3c\xce\xa3\xde\x7b\xf5\x1a\xa0\x72\xdf\x83\xe2\x3c\xbd\xdc\xb4\xad\x54\xc6\x7a\x85\x94\x6c\x2c\xae\x99\x98\xa8\xda\x8f\xf8\xd6\x54\x86\xa4\x25\x4f\x83\x93\xf3\x42\x35\x0b\x6a\x58\x58\xb9\x77\xd5\xb5\x28\xae\x9d\x9c\xe3\x4f\xfc\x0f\x5e\x83\xfe\x0d\x49\x7e\xb8\xe4\xca\x85\xb2\xad\x74\xd5\x2a\xb4\x4a\xaf\x98\x87\x6b\xa6\xec\x49\x56\x4c\x9d\x40\x1e\xc2\x61\x97\x91\x1a\x92\x0e\x51\x50\x33\x94\xe3\x9b\x5b\x7f\x94\x98\x36\x02\x07\xf0\xf8\xe6\x16\x22\xf4\xca\x71\x95\xc3\x0d\x79\x4e\x50\xae\x11\xc7\xc5\x75\xbe\x46\xb9\x61\x21\xe5\x1b\xec\x23\x44\xe9\x03\xf3\x3d\x7b\xf4\x0c\xef\x97\xc3\x3a\x9c\x14\x18\xc8\x37\x51\x78\x1e\x80\x13\xfb\xba\xaf\x88\x7e\x35\x8f\x7b\x04\x2e\x0e\x47\xf8\xee\xf5\xf7\x00\xc9\x6a\xc5\x77\xe3\x5b\x34\x17\x07\x9a\x47\x59\x9a\x1c\x0b\xcc\x5d\x15\xea\xcb\x23\x2e\x2f\x57\x97\x6a\x7a\x7a\xaf\xba\x67\x2a\xf8\x5b\x35\x38\x57\xec\x73\x0a\xfa\x95\x10\xb8\xb6\x2f\x7d\x76\xf2\x90\xcd\x04\x25\xbd\xc1\xb6\xaf\x06\xf1\xdf\xa1\x94\x95\xac\xeb\x40\xeb\x86\x2a\xcf\x2a\xfb\xc4\x6b\x0f\x77\x9e\x5f\xf4\x5b\x88\xdf\xd2\xc0\x30\x8f\x7c\x03\x5d\xc7\xa8\x7d\x2b\x06\x72\x4f\xd3\x19\x1d\xe1\x71\x25\x78\x88\xdd\x3c\x7c\x4f\x21\xef\x3b\x44\xaf\xa7\xc3\x03\x1e\xbb\x3a\x4c\x8a\x02\x18\xe2\xb7\x02\xf3\x6f\x79\x70\xe2\x87\xc1\xc5\x24\x28\x86\x15\xd9\x62\x02\xe1\x04\x66\xfc\x5d\xf2\x57\x2d\xf7\xd2\x78\xd3\x73\xb8\x4e\xef\xbe\xdc\x3e\x7c\xcd\xd2\xcb\x4f\x59\x2a\x74\xe7\x2e\xdc\x77\x27\xa0\x9e\x5a\x6d\x1c\xca\x05\xef\x39\x2e\xe7\x8b\xde\xbb\xec\x4d\xe3\xfb\xbb\xfb\x12\x37\x8b\x05\x1c\x59\x67\x3f\x7c\x10\x68\x8d\x6a\x5c\xdd\x1c\x8c\x9f\x75\x63\xd5\x82\x0c\xec\x56\xb9\x6a\xc5\x87\x73\xfb\x58\xbe\xa7\x3b\x4b\xa8\x8c\x72\x73\xe5\xe0\x0c\x91\xed\xc1\xf9\x3f\xb1\x8f\xf8\xfa\x70\xfb\xe5\x2e\x4b\xff\x0b\x00\x00\xff\xff\x80\xeb\xb1\x62\xf6\x0a\x00\x00")

func scriptsSavingPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsSavingPisc,
		"scripts/saving.pisc",
	)
}

func scriptsSavingPisc() (*asset, error) {
	bytes, err := scriptsSavingPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/saving.pisc", size: 2806, mode: os.FileMode(436), modTime: time.Unix(1506683130, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsShipsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x4d\x6f\xdc\x36\x10\x3d\x5b\x80\xfe\xc3\x03\x12\xa0\xb6\xb1\x6b\xc7\x75\x4f\xea\x22\x45\xea\x24\x68\x80\xe4\xd2\x04\xc8\xa1\xe8\x61\x24\x8e\x24\x76\x25\x52\xe5\x50\xbb\x56\x8b\xfe\xf7\x62\x48\x6d\xec\x24\x6d\x81\xc2\x30\x56\x22\xe7\xe3\x71\xe6\xcd\xa3\x9e\xe0\x63\x4f\x11\x56\x10\x7b\xc6\xe8\x0d\x0f\x68\x7d\x80\xf4\x76\x12\x74\xde\xba\x0e\xd1\xa3\xe6\x1f\xca\xa2\x2c\x9e\xe0\x2d\x39\x46\x5c\x26\x16\x34\xe4\x50\x33\x6e\xe0\xdb\xe4\xfc\x1d\x46\xfa\xcd\x87\xbc\x9b\xad\x9f\x61\x8b\x1f\x49\x6c\x53\xe1\x8e\x1c\x1a\x0a\x61\x41\xad\x0b\xfa\xdc\x79\xb5\xb9\xc1\x16\x2f\x29\xd2\x63\x13\x43\x91\x34\xec\x81\x82\xf5\xb3\x60\x6f\x9d\x91\x8d\xa2\x0c\x64\x2c\x45\xeb\x9d\x22\xe4\xc1\xb0\xb9\xc2\x0b\x34\xbe\xd9\x4f\x36\xa2\x27\xc1\x4d\xf6\x96\xc1\x47\xd4\x0b\x0c\xb7\x34\x0f\x51\x33\x7d\x8b\x2d\x7e\x62\x3a\x2c\xff\x82\x66\x03\x1f\xd0\x33\x1d\x2c\x07\x74\xde\x1b\x81\xba\xdd\x62\x8b\xd7\x81\x3a\x3b\x70\x85\x37\x82\x7a\xb6\x43\xc4\xd1\xc6\x1e\xd2\xfb\x66\x0f\xaa\xc5\x87\x5a\x14\x54\xf4\xa0\x61\xf0\x47\xc4\x40\x4e\x26\x1f\xa2\x1e\xa3\xcd\xde\x39\xa6\x56\xa6\xc2\x6e\x20\xc7\xcf\x71\x0e\xb1\x7f\xe4\x82\x62\xbb\x85\x2e\xe2\x02\x65\x71\x56\xa5\xa5\x4a\x77\xcb\xe2\xec\x4f\x3c\x4d\x76\xbf\xa0\xc5\xaf\x88\x76\x64\xc1\x5f\xa8\xd6\x1a\x9e\xed\x8c\x6d\xe2\xf3\xb2\x38\x3b\x7b\x9a\x96\xb0\xdb\x6d\x4f\x7b\x67\x4f\x53\xa4\xdd\x6e\xab\xbf\x65\xf1\xfd\x9a\x5f\x1b\xac\xf9\x1d\x8d\x9c\xf2\x8a\x02\xd0\xd5\x15\x40\x5e\xab\x74\xff\xf3\x14\x79\x63\xb7\xdb\xa6\x87\xb4\x94\x82\xec\x76\xdb\x6c\x9c\x52\x5c\x5f\x96\xc5\x2b\x6a\xfa\x1c\xd2\x9e\xca\xe6\xe7\x54\x91\xd5\xf5\xc1\x40\x3b\x47\x30\xc1\x3b\xc6\xe0\xc9\xa8\x5d\xe3\x5d\x0c\x7e\x18\xd8\x68\x23\x95\x62\x77\xb9\xcf\x65\xf1\x26\x53\xee\xd4\x77\x2b\x30\x2c\x31\xf8\x85\xcd\x06\x8b\x9f\xd1\x29\x22\x2b\xf0\x07\x0e\x57\x28\x8b\x77\x5e\xe2\x4a\x6a\xe3\xdd\x37\x11\x31\x2c\xda\xad\xd5\x0d\xf4\xc0\x21\x7f\xe4\x03\x87\x0d\xca\x62\x0a\xdc\x72\x08\xeb\x0c\x0c\x4c\x07\x4e\xc1\x7b\x1e\xa6\x81\x45\x94\x2f\x0d\x4d\x71\x0e\x69\xfd\x4a\xcf\xfd\x3e\xe5\xd0\xd9\xe8\xd5\xfc\xe6\xfe\x56\x7d\x6f\xef\x6f\x9e\xc1\x3a\x18\x3b\xb2\x53\xfa\xca\x06\xe4\x0c\x5a\x9b\x8e\x97\xc8\x64\x6c\xdb\x72\x60\x17\x21\xdc\xa9\x59\xa2\xca\xdb\x54\x6d\x8d\xd7\x78\x3d\x92\xc3\x6d\xe2\x8c\x80\x04\x47\x1e\x86\x0d\xde\x8f\xa4\x3f\xef\xd8\xd8\x31\x45\x7d\x4b\xa1\xe3\x04\x26\x07\x5a\x07\xf6\xfc\x12\xd6\x19\xdb\x50\x64\x8c\xe4\x0c\x45\x1f\x96\x53\xb2\x8b\x0a\x29\x9d\x6d\x79\x2b\xf3\xa4\xd4\xbd\x5e\xcb\x7d\xa9\xb5\x78\xe5\x3a\xeb\x58\x2e\x37\x65\xf1\x7a\xe6\x01\x1f\xc8\xed\x2f\xcb\x22\xf3\x6d\xf2\xa6\x2c\xee\x02\x1f\xf1\xfb\x4c\x21\x72\xc0\xf9\x0d\x1a\x7d\x1f\x79\xac\x39\x60\xe2\x00\xe1\x46\x4f\x7e\x51\x16\xb9\xcd\x93\x37\x6a\xb6\xbe\x7c\x66\x50\x16\x1f\x7a\x0e\x0c\xd2\xff\x41\x34\x81\x88\xad\x07\x86\xf3\x6e\x2b\x51\xc1\x07\xf3\xa9\x4e\x55\x42\xee\x5d\x87\x40\xae\x63\x08\x3b\xf1\x41\x70\x0e\xbe\x8f\x41\x5b\x3b\xd6\x14\x11\xfc\xec\x0c\x2e\xca\xe2\x4e\x89\x45\xb5\x96\x2a\x81\x40\x4b\x01\x35\x47\x05\xde\xf4\xe4\x1a\x56\x8e\x4e\x24\xa2\xad\x27\x07\xeb\x64\xca\xe0\xd4\x5d\x5b\x0c\x69\xc8\x39\x3d\x68\x9a\x77\x49\xbc\x88\x1e\xc2\xda\x23\x7d\x48\x46\x2b\xc0\x8b\xb2\xf8\xe0\x8f\x98\xa8\xd9\x53\xc7\x5f\xfa\xf4\x34\x0f\x99\x9b\xd7\x31\x90\x1d\x38\x08\x28\x81\xbd\x78\xd4\x44\xc9\x84\x3a\x50\x58\x14\xd5\xc0\x07\x1e\x44\x71\x52\x18\x7d\xa8\xca\x62\xf0\xc7\x2c\x6c\x35\xa3\x0e\x4c\x4d\x9f\x07\x87\xdc\x02\x8a\xb1\xd9\x97\xc5\xc8\xc6\xce\x63\x85\x8f\x76\x18\x12\xe9\x52\x29\x41\x18\xad\xb3\xe3\x3c\x6a\xb8\x1b\xc8\xdc\x34\x2c\xd2\xce\x83\xfa\x51\xb3\xbf\x2a\x8b\x3e\xeb\xe6\x7f\x39\xde\x7e\xed\x28\x69\x24\x5e\x6a\x87\xe5\x11\x7f\xb3\xe6\x26\x52\xa6\xd6\xbd\x48\xc6\x15\xde\xf7\xde\x47\x81\xc4\xb9\x6d\xcb\xe2\x25\xb7\xec\x1a\xae\x90\x1e\x8c\x80\x3a\xb2\x4e\xe2\x1a\x3b\x13\x47\x36\xe0\x2c\x22\x3e\x6a\xef\x42\xc7\x82\x79\x52\x64\xdc\xd1\xb6\x66\x1a\xcb\xe2\x8d\x77\x95\x5a\x84\x28\x5b\x15\x96\xec\xa9\xa3\x72\xed\x3f\xd1\x2e\x4d\xdb\x0b\x73\xd0\xf6\x9b\xd5\xa4\xc2\xcf\x64\x0d\x07\xdd\xca\x4f\x27\x5f\xe3\x41\xe9\x7a\xe2\xb8\xe4\x0b\xd0\xba\x4e\x36\x30\x3c\xb1\x33\xda\x20\xef\x70\xec\x6d\xd3\x67\x71\xf7\xed\x89\x0c\x2a\x5c\x8b\xce\x9f\x32\x41\xbb\xaf\x7a\x76\x52\xb4\x45\x5f\xf1\xd9\x10\xae\xba\xb4\xc9\xdb\x91\xf6\x9c\x44\x2d\xe9\x9f\x92\x46\x87\x33\x27\x5a\x59\x65\x63\xbe\xb1\x21\x03\x1d\xd8\xe8\xcb\xe2\xe7\x20\xe9\x5e\x7f\xb8\x97\x56\x8e\x2e\x14\xf2\x9d\xf4\x18\x00\x81\xd3\xb8\xeb\x78\xa4\xc4\xf0\xd3\xe4\xd3\x34\x24\x5e\x1f\x95\x06\x29\x83\x3f\x6a\xb1\xfc\xd1\x7d\x1d\x22\xc9\x44\x24\xb7\xdf\x28\xb2\x14\xa5\xd5\x25\xeb\x10\xf5\x9b\x43\xb7\xd2\x87\x87\x42\x52\xe5\xfb\x04\x35\x27\x71\x7c\x1f\x11\xe7\xf0\x0f\xa1\xb3\xea\xd4\xb4\x64\x70\xf9\xf5\x14\xb7\xa6\xe5\x21\x2c\xfd\xaf\xb0\x81\x8f\xdb\x55\xc1\xd6\xc8\x8f\x34\xec\x14\xff\x24\x71\x56\xc0\x36\xf6\x1c\xa0\x32\x98\x6e\x01\xa3\x37\xc2\x3e\x69\xfa\x17\x54\xb0\x6d\xbe\x39\x74\x84\x65\xa2\x26\xb5\x3e\x7f\x81\xc4\x9e\x47\xf5\x73\x3e\xa6\x71\xf9\xfa\xef\xef\x00\x00\x00\xff\xff\x2f\xdf\x8e\xdf\xa5\x09\x00\x00")

func scriptsShipsPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsShipsPisc,
		"scripts/ships.pisc",
	)
}

func scriptsShipsPisc() (*asset, error) {
	bytes, err := scriptsShipsPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/ships.pisc", size: 2469, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsTerm_posixPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x94\x41\x8f\xda\x30\x10\x85\xef\xf9\x15\x4f\xde\x3d\x90\x43\xa4\x0d\x78\xa1\x0d\x42\x7b\x40\xad\xaa\x0a\x71\xd9\x23\xcb\x21\x98\x81\x8d\x08\x31\x72\x4c\x51\x54\xf5\xbf\x57\xb6\xe9\x3a\xae\x61\x25\x24\x3c\xf3\x3e\x8f\x67\xde\x48\x29\x20\x64\x2d\x55\x26\xe4\x96\x30\x80\xfd\xcb\xb2\x6b\x92\x5a\x81\x14\x85\x4d\x3e\xfe\xc6\xb7\xd7\x39\xd8\x8a\xe1\xd1\x26\xd8\x91\xe1\x0f\xa6\x49\xf2\x80\x79\x4d\xa5\x42\x2b\x14\x51\x83\xb2\xd9\xe2\x28\x7f\x11\xc4\x59\xb5\x52\x41\x4b\x68\x79\xca\x6a\xda\xe9\xa4\xc0\x7c\xf1\x8a\x81\x79\x21\xf5\x15\x87\x3f\xd9\xf5\x34\xfd\x61\x6a\x9e\x54\xd5\x68\x4c\x93\x02\xcb\x85\x83\x97\x0b\xa4\x60\x6f\xea\xad\x61\x2e\x1f\x08\xcb\x85\xf9\xd9\x4e\xbe\x4b\x45\x99\x6d\xbe\x4d\x0a\x6c\xea\x52\x1c\x1c\x48\xad\xc8\x5c\x98\x82\x8d\x9e\x58\x7f\x6c\x53\x51\xd1\xd6\x83\x26\x30\x58\x1e\x61\x7b\x3b\xe2\x07\xe8\x42\x83\x0e\x23\xb4\xa3\xba\x96\x17\xcf\x5e\x63\x03\x8f\x22\x78\x53\x9f\xa9\xdf\xe8\x99\x2c\xc8\x23\xf0\x58\xee\xa9\xd1\xa5\x67\xff\x25\x0c\xfe\x1c\xe1\xa2\x2b\x7b\xed\xda\xc8\x80\xe3\x08\xbc\xbc\x57\xba\xd7\x81\x0b\x0d\x3a\xf9\x0f\x4d\x1e\xb0\x29\xc5\xa1\x67\xb2\x89\xee\x39\xcd\x63\xa7\x2d\x7f\xcb\x6e\x1e\xdb\x6d\xd9\x7b\x9e\xf3\xd8\x73\xcb\xdf\x37\x9e\xdf\x30\xde\x75\x7f\xcb\x7d\x1e\xbb\x6f\xe9\xcf\x56\xc0\xe3\x15\x38\xb7\x6e\xee\x81\xc7\x7b\xb0\xf4\xbd\x65\xf0\x68\x19\x05\xaa\x36\xa3\x46\x93\x7a\xc1\x00\x07\x73\xe3\x05\x29\xf2\x11\x66\xb6\x5c\xd5\x66\xa5\x52\xf2\x12\xa8\xc3\x09\x66\x58\x61\x4f\xfa\x40\x1d\xbe\xe6\x98\x61\x8d\x15\x76\x58\xa3\xda\x7d\x54\x3d\x9f\x82\x4b\xe3\x67\x5f\x72\x2b\x2f\x4d\x28\x8e\xbd\xa8\xaa\xfd\xbb\x0e\xd5\x89\x57\xcd\x67\x20\x14\xbf\x58\xd1\xa9\x5d\x38\xc5\x30\xf7\x17\xc3\x07\xf3\xfc\xc9\x4b\x5d\xa8\x61\x75\x2d\xb5\x76\xa7\xc6\x9c\x36\x15\xa4\xc2\x34\xf9\x1b\x00\x00\xff\xff\x61\x7b\xb6\x42\xf0\x04\x00\x00")

func scriptsTerm_posixPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsTerm_posixPisc,
		"scripts/term_posix.pisc",
	)
}

func scriptsTerm_posixPisc() (*asset, error) {
	bytes, err := scriptsTerm_posixPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/term_posix.pisc", size: 1264, mode: os.FileMode(436), modTime: time.Unix(1506682689, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _scriptsTerm_winPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x93\x41\x8b\xdb\x30\x10\x85\xef\xfe\x15\x0f\xed\x1e\xe2\x83\x61\xed\x68\x9b\xe2\xa5\xec\x21\xb4\x94\x12\x72\xd9\xe3\x6e\x0f\x8e\x32\x4d\x4c\x1c\x2b\xc8\x4a\x43\x28\xfd\xef\x65\xa4\xb4\xb2\xaa\x64\x21\x10\xcd\xbc\x4f\x33\xa3\x37\xb8\x86\xd2\x9d\x36\x85\xd2\x6b\xc2\x04\xee\xaf\x28\x2e\x49\x1a\x14\x72\xd4\x2e\x79\xff\x0b\x9f\x5f\xe6\x10\xaf\x02\xf7\x2e\x21\xf6\x02\xbf\xf1\x94\x65\x77\x98\x77\xd4\x18\x0c\xca\x10\xf5\x68\xfa\x35\xf6\xfa\x27\x41\x1d\xcd\xa0\x0d\xac\x86\xd5\x87\xa2\xa3\x1f\x36\xab\x31\x5f\xbc\x60\xc2\x1d\xf2\x50\xb1\xfa\x26\x2e\xa7\xaf\x5c\xf2\x60\xda\xde\xe2\x29\xab\xb1\x5c\x78\x76\xb9\x40\x0e\xf1\x66\xde\x7a\xe1\xf3\x91\xb0\x5c\xf0\xcf\x0d\xf2\x45\x1b\x2a\xdc\xec\x43\x56\x63\xd5\x35\x6a\xe7\x41\x1a\x54\xe1\xc3\x1c\x62\xfa\x20\xc6\xaf\xe6\x8a\x86\xd6\x01\xe4\x80\xb1\x32\xc1\x36\xee\x85\xff\x40\x1f\x32\x5a\x25\xe8\x99\xba\x4e\x9f\x02\x7b\x89\x19\x9e\x26\xf0\xaa\x3b\xd2\x78\xd0\x23\x39\x50\x26\xe0\xbe\xd9\x50\x6f\x9b\xc0\xfe\x4d\x30\xfe\x98\xe0\xea\xdc\x8c\xc6\x75\x11\x83\x1f\x12\xf0\xb4\x6d\xed\x68\x02\x1f\x32\x3a\xfb\x0f\xcd\xee\xb0\x6a\xd4\x6e\x64\x32\x47\xb7\x9c\x96\xa9\xd3\x8e\xbf\x66\xb7\x4c\xed\x76\xec\x2d\xcf\x65\xea\xb9\xe3\x6f\x1b\x2f\xaf\x18\xef\xa7\xbf\xe6\xbe\x4c\xdd\x77\xf4\x7b\x2b\x90\xe9\x0a\xbc\x5b\x57\xf7\x20\xd3\x3d\x38\xfa\xd6\x32\x64\xb2\x8c\x1a\xed\x50\x50\x6f\xc9\x3c\x63\x82\x1d\xdf\x78\x46\x8e\x72\x8a\x4f\xae\x5c\x3b\x14\x8d\x31\xfa\x14\xa9\x55\x25\x9d\xec\xf5\xe3\x21\x12\x67\x55\xb8\xba\xd6\xa7\x3e\x12\x3f\x3e\x04\xd1\xb4\x9b\xad\x8d\xaf\xce\x82\xca\x5f\x7b\x2c\x3e\x8e\x7a\x9e\xe3\x69\xab\x32\x5c\x8c\x1b\x96\xe5\xa8\xe3\x39\xd6\xf0\x7a\x29\xf5\xdd\x9f\x7a\x3e\xad\x5a\x68\xc3\x7d\xfe\x04\x00\x00\xff\xff\x86\xb3\x64\xa9\xd8\x04\x00\x00")

func scriptsTerm_winPiscBytes() ([]byte, error) {
	return bindataRead(
		_scriptsTerm_winPisc,
		"scripts/term_win.pisc",
	)
}

func scriptsTerm_winPisc() (*asset, error) {
	bytes, err := scriptsTerm_winPiscBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "scripts/term_win.pisc", size: 1240, mode: os.FileMode(436), modTime: time.Unix(1506682723, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
		}
		return a.bytes, nil
	}
	return nil, fmt.Errorf("Asset %s not found", name)
}

// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
	a, err := Asset(name)
	if err != nil {
		panic("asset: Asset(" + name + "): " + err.Error())
	}

	return a
}

// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
		}
		return a.info, nil
	}
	return nil, fmt.Errorf("AssetInfo %s not found", name)
}

// AssetNames returns the names of the assets.
func AssetNames() []string {
	names := make([]string, 0, len(_bindata))
	for name := range _bindata {
		names = append(names, name)
	}
	return names
}

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
	"scripts/backstory.txt": scriptsBackstoryTxt,
	"scripts/gamesave.pisc": scriptsGamesavePisc,
	"scripts/intro.pisc": scriptsIntroPisc,
	"scripts/lib.pisc": scriptsLibPisc,
	"scripts/main.pisc": scriptsMainPisc,
	"scripts/map.pisc": scriptsMapPisc,
	"scripts/markets.pisc": scriptsMarketsPisc,
	"scripts/saving.pisc": scriptsSavingPisc,
	"scripts/ships.pisc": scriptsShipsPisc,
	"scripts/term_posix.pisc": scriptsTerm_posixPisc,
	"scripts/term_win.pisc": scriptsTerm_winPisc,
}

// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
//     data/
//       foo.txt
//       img/
//         a.png
//         b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
	node := _bintree
	if len(name) != 0 {
		cannonicalName := strings.Replace(name, "\\", "/", -1)
		pathList := strings.Split(cannonicalName, "/")
		for _, p := range pathList {
			node = node.Children[p]
			if node == nil {
				return nil, fmt.Errorf("Asset %s not found", name)
			}
		}
	}
	if node.Func != nil {
		return nil, fmt.Errorf("Asset %s not found", name)
	}
	rv := make([]string, 0, len(node.Children))
	for childName := range node.Children {
		rv = append(rv, childName)
	}
	return rv, nil
}

type bintree struct {
	Func     func() (*asset, error)
	Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
	"scripts": &bintree{nil, map[string]*bintree{
		"backstory.txt": &bintree{scriptsBackstoryTxt, map[string]*bintree{}},
		"gamesave.pisc": &bintree{scriptsGamesavePisc, map[string]*bintree{}},
		"intro.pisc": &bintree{scriptsIntroPisc, map[string]*bintree{}},
		"lib.pisc": &bintree{scriptsLibPisc, map[string]*bintree{}},
		"main.pisc": &bintree{scriptsMainPisc, map[string]*bintree{}},
		"map.pisc": &bintree{scriptsMapPisc, map[string]*bintree{}},
		"markets.pisc": &bintree{scriptsMarketsPisc, map[string]*bintree{}},
		"saving.pisc": &bintree{scriptsSavingPisc, map[string]*bintree{}},
		"ships.pisc": &bintree{scriptsShipsPisc, map[string]*bintree{}},
		"term_posix.pisc": &bintree{scriptsTerm_posixPisc, map[string]*bintree{}},
		"term_win.pisc": &bintree{scriptsTerm_winPisc, map[string]*bintree{}},
	}},
}}

// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
	data, err := Asset(name)
	if err != nil {
		return err
	}
	info, err := AssetInfo(name)
	if err != nil {
		return err
	}
	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
	if err != nil {
		return err
	}
	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
	if err != nil {
		return err
	}
	return nil
}

// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
	children, err := AssetDir(name)
	// File
	if err != nil {
		return RestoreAsset(dir, name)
	}
	// Dir
	for _, child := range children {
		err = RestoreAssets(dir, filepath.Join(name, child))
		if err != nil {
			return err
		}
	}
	return nil
}

func _filePath(dir, name string) string {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

Added cmd/FinalFrontier/build.sh.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
#! /bin/bash
function older_than() {
  local target="$1"
  shift
  if [ ! -e "$target" ]
  then
    echo "updating $target" >&2
    return 0  # success
  fi
  local f
  for f in "$@"
  do
    if [ "$f" -nt "$target" ]
    then
      echo "updating $target" >&2
      return 0  # success
    fi
  done
  return 1  # failure
}

# For now, force re-packing of bindata
rm bindata.go

older_than bindata.go strings/*.pisc && {
  echo "Packing scripts"
  go-bindata -pkg main -o bindata.go scripts/...
}

case "$1" in
  build)
  older_than game.exe *.go && {
    go build -o game.exe
  }
  ;;
  run)
  older_than game.exe main.go finalFrontier.go && {
    rm game.exe
    go build -o game.exe
  }
  ./game.exe
  ;;
esac
  




Added cmd/FinalFrontier/finalFrontier.go.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
package main

import (
	"os"
	"pisc"
)

func loadGameScript(m *pisc.Machine) error {
	assetKey := m.PopValue().String()
	data, err := Asset(string(assetKey))
	if err != nil {
		return err
	}
	err = m.ExecuteString(string(data), pisc.CodePosition{Source: "file:" + string(assetKey)})
	if err != nil {
		return err
	}
	return nil
}

func getTermMode(m *pisc.Machine) error {
	m.PushValue(pisc.String(mode))
	return nil
}

func exit(m *pisc.Machine) error {
	de_init_term()
	os.Exit(0)
	return nil
}

var ModFinalFrontier = pisc.Module{
	Author:    "Andrew Owen",
	Name:      "ConsoleIO",
	License:   "MIT",
	DocString: "Provides basic OS-interaction words",
	Load:      loadFinalFrontier,
}

func loadFinalFrontier(m *pisc.Machine) error {
	init_term()
	m.AddGoWord("term-mode", "( -- mode )", getTermMode)
	m.AddGoWord("getkey", "( -- keyval )", getch)
	m.AddGoWord("game-script", "( filename -- ? ) ", loadGameScript)
	m.AddGoWord("quit-game", "( -- )", exit)
    os_overload(m)
	return nil
}

Added cmd/FinalFrontier/init_posix.go.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
// +build !windows

package main

import (
	"fmt"
	"github.com/pkg/term"
	"pisc"
)

var mode = "POSIX"

var pty *term.Term
var buf = make([]byte, 1)

func init_term() error {
	var err error
	pty, err = term.Open("/dev/tty", term.RawMode)
	if err != nil {
		return err
	}
	return nil
}

func de_init_term() error {
	return pty.Restore()
}

func os_overload(m *pisc.Machine) error {
    return nil
}

func getch(m *pisc.Machine) error {
	num, err := pty.Read(buf)

	if err != nil {
		return err
	}
	if num != 1 {
		return fmt.Errorf("Didn't read at least 1 byte from the pty!")
	}

	m.PushValue(pisc.Integer(int(buf[0])))
	return nil
}

Added cmd/FinalFrontier/init_windows.go.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
// +build windows

package main

import (
	"pisc"
    "github.com/mattn/go-colorable"
    "io"
    "fmt"
)

//#include <conio.h>
import "C"

var mode = "WINDOWS"
var writer io.Writer 

func init_term() error {
    writer = colorable.NewColorableStdout()
	return nil
	// stub, so that compilation doesn't fail
}

func de_init_term() error {
	return nil
}

func printWithAnsiColor(m *pisc.Machine) error {
    str := m.PopValue().(pisc.String)
    _, err := fmt.Fprint(writer, str)
    return err
}

func os_overload(m *pisc.Machine) error {
    // Overwritting priv_puts to handle ANSI color codes on windows
    m.AddGoWord("priv_puts", "( str -- )", printWithAnsiColor)
    return nil
}


func getch(m *pisc.Machine) error {
	char := C.getch()
	m.PushValue(pisc.Integer(char))
    return nil
}

Added cmd/FinalFrontier/main.go.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"fmt"
	"pisc"
)

func main() {
	m := &pisc.Machine{
		Values:               make([]pisc.StackEntry, 0),
		DefinedWords:         make(map[string]*pisc.CodeQuotation),
		DefinedStackComments: make(map[string]string),
		PredefinedWords:      make(map[string]pisc.GoWord),
		PrefixWords:          make(map[string]*pisc.CodeQuotation),
		HelpDocs:             make(map[string]string),
	}

	m.LoadModules(append(
		pisc.StandardModules,
		pisc.ModDebugCore,
		pisc.ModIOCore,
		ModFinalFrontier)...)
	err := m.ExecuteString(`"scripts/main.pisc" game-script`, pisc.CodePosition{Source: "main.go"})
	if err != nil {
		fmt.Println(err.Error())
	}
}

Added cmd/FinalFrontier/scripts/backstory.txt.



>
1
Explorers are even now mapping out the various lanes of slipspace. Most people seem to be content to stay on the planet of their birth, as both subspace and slipspace are treacherous places. Pirates, freighters, and smugglers alike vie for fattest, quickest buck. Planetary fleets mostly protect their homes. There used to be a system-wise empire around Sol, but logistics makes a galaxy-wide one near-impossible. Even if galactic rule was possible, the early slipspace instabilities spread people far and wide throughout space. This factured the society left behind. It took decades for a slipspace drive to be stable enough for more experimental use. It was only with the aging and death of those who witnessed the slipspace fracturing that the slipspace came to be accepted as a means of travel. The last 15 years have shown wondrous things.

Added cmd/FinalFrontier/scripts/gamesave.pisc.

Added cmd/FinalFrontier/scripts/intro.pisc.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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

: intro ( game -- next )
:game
CLS

"Space, the Final Frontier

The stars have beckoned you, even when you were but a wee child.
It's a risky life, spacefaring, what with pirates, smugglers, and planetary police
in a constant struggle, not to mention asteriods, navigation difficulty, and the utter
void of space. You've prepared for this day. Your reading time was dedicated to charts
and ship operation, your spare time to training in simulators, and your savings
have amounted to $5000. Will you explore the stars? (Y/n)
" println

0 :k [ $k is-yn? not ] [ getkey :k ] while

$k is-n? [ 
	"Though, perhaps the stars are for another time. After all, they won't be going anywhere" println
	wait-enter
		[ opening-menu ] 
] when
$k is-y? [ [ pick-ship ] ] when
;

: pick-ship ( game -- next ) 
	CLS
	" You're going to need a ship before you can travel through space, however. " println
	wait-enter
	[ quit-game ]
;




Added cmd/FinalFrontier/scripts/lib.pisc.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
term-mode "WINDOWS" eq [ 
    "scripts\\term_win.pisc" game-script
] when

term-mode "POSIX" eq [ 
    "scripts\\term_posix.pisc" game-script
] when

: wait-enter ( -- ) 
	[ getkey is-enter? ] [ ] while
;

: <up-down-menu> ( num-opts -- obj ) 
	:num
	0 :m-idx
	t :choosing
	[ 
		getkey :k
		$k is-enter? [ f :choosing ] when 
		$k is-arrow? [
			getkey :dir
			$dir is-up? [ --m-idx ] when
			$dir is-down? [ ++m-idx ] when
			$m-idx $num mod :m-idx
			$m-idx 0 < [ $num 1 - :m-idx ] when
		] when
	] :check
	<dict> 
	[ $choosing ] <<-done?
	[ $m-idx ] <<-chosen-idx
	[ check ] <<-proc-key
	[ $m-idx = [ back-white ] when ] <<-highlight
;

Added cmd/FinalFrontier/scripts/main.pisc.

















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This is final frontier, a game inspiredc by space, tradewinds, and a little bit of lane-based combat
/*
IDEAS: Maybe find some way to integrate long time travel into the culture of spacefarers
*/

"scripts\\lib.pisc" game-script
"scripts\\markets.pisc" game-script
"scripts\\intro.pisc" game-script
"scripts\\saving.pisc" game-script

: opening-menu ( game -- next )
	:game
	4 <up-down-menu> :m
	$m ->highlight :MENU
 	[ back-black ] :CHOICE
 	CHOICE print

 	[ $m .done? ]
 	[
		CLS
		NNL
		${
			cyan "Final Frontier" NNL
			red 
			"  " 0 MENU "New Game" CHOICE NNL
			"  " 1 MENU "Load Game" CHOICE NNL
			"  " 2 MENU "Options" CHOICE NNL
			"  " 3 MENU "Return to real life" CHOICE NNL
			white "Up/Down to choose, Enter to confirm " NL
		} print

		$m .proc-key
	] while
	{ 
		 [ intro ] 
		 [ load-game ]
		 [ options ]
		 [ exit-game ]
	} $m .chosen-idx vec-at 
;

: load-game ( game --  ) :game CLS ${ "TODO: Implement game-loads" NL } println [ " " drop ] ;
: save-game ( game -- ) :game CLS ${ "TODO: Implement game-saves" NL } println [ " " drop ] ;
: options ( -- ) :game CLS ${ "TODO: Implement game options" NL } println [ " " drop ] ;
: exit-game ( game -- ) save-game quit-game ;

: main ( -- )
    <dict> opening-menu :curr-state
    <dict> :game
    [ t ] [ $game $curr-state call :curr-state ] while
    getkey
    back-black println CLS 
    quit-game
;

main

Added cmd/FinalFrontier/scripts/map.pisc.



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
/*

Render a galatic map from here

*/

: star-map ( game -- next ) 
	
;


: show-world ( planet game -- next ) 
	:game :planet

	$planet ->description println

	$planet ->locations dup dup [ ->name ] vec-map :locs [ ->command ] vec-map :choices
	$locs len 1 - <up-down-menu> :m

	$m ->highlight :MENU
 	[ back-black ] :CHOICE


	[ $m .done? ]
	# We're re-building the menu each time with a rest to $i
	[ 
		CLS
		CHOICE println
		0 :i
		${
			$planet ->name NNL
			red
			$locs [ :l
				$i MENU "  " $l CHOICE NNL
			] vec-each
			white "Up/down to select, enter to choose" NL
		}
	] while

	$choices $m .chosen-idx vec-at
; 

Added cmd/FinalFrontier/scripts/markets.pisc.



















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 

/*

What is the economy going to be like in this game?

## Basic Goods

Water
Food
Fuel
Ore/Scrap

## Data Capsules

Programs
Videos
Games
Maps/Charts

## Heavy Goods

Robots
Munitions
Build-Crete
Enviro-shielding

## Fragile Goods

Solar Panels
Computer Chips
Documents
Sculptures

*/

: show-market ( -- ) ;

/*
World archetypes

Colony:
Exports basic goods, with a random chance of exporting one other type of good at a low price

Monastic Technocracy:
Imports basic goods, exports data capsules of various types

Corporatist Industocracy:
Imports basic goods, exports heavy goods 

Creatist Fabritocracy:
Imports basic goods, exports Fragile Goods

Beurocratic Metrocracy:
Imports everything, exports power/influence (heh)

*/

Added cmd/FinalFrontier/scripts/saving.pisc.



























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* 

func (i Integer) Type() string {
	return "Integer"
}

func (d Double) Type() string {
	return "Double"
}

func (a Array) Type() string {
	return "Vector"
}

func (dict Dict) Type() string {
	return "Dictionary"
}

func (b Boolean) Type() string {
	return "Boolean"
}

func (s String) Type() string {
	return "String"
}

*/

: serial-mapping ( -- mapping )
	<dict>
		[ write-dict ] <<-Dictionary
		[ write-vec ] <<-Vector
		[ write-int ] <<-Integer
		[ write-double ] <<-Double
		[ write-string ] <<-String
		[ write-bool ] <<-Boolean
	:t-table

	[ :v 
	  $t-table $v typeof dict-has-key?
		[ $t-table $v typeof dict-get ]
		[ ${ "Type " $v typeof " cannot be saved." } error ]
	  if
	] 
;

: save-state ( path state -- state ) :state :path
	$state typeof :type
	f :success
	[ $path open-file-writer :OUT
		": . ( dict value key -- dict ) dict-push ;" $OUT .write-line
		<dict> 
			$OUT <<-OUT
			0 <<-tab
	] :get-output
	[ eq dup $success or :success ] :eqn
	$type "Dictionary" eqn [ get-output $state write-dict ] when
	$type "Vector" eqn [ get-output $state write-vec ] when
	$success not
		[ ${ "Cannot write value of type: " $type } error ]
	when	
	$OUT .close
;

# Replace " with \" in the string, to keep it from breaking up
: quote-safe ( str -- str ) "\\" "\\\\" str-replace "\"" "\\\"" str-replace ;
: wrap-quotes ( str -- str ) "\"" swap str-concat "\"" str-concat ;

: write-dict ( ctx dict -- ) 
	:pairs dup :ctx ->OUT :OUT
	# Increase the tab-indent
	$ctx dup ->tab 1 + <-tab 

	serial-mapping :dispatch
	[ $OUT .write-string ] :output
	[ "\t" $ctx ->tab str-repeat output ] :TAB

	"\n" output
	TAB "<dict>" output

	$pairs [ :k $pairs ->$k :v
		$v dispatch :write
		"\n" output TAB "\t" output
		$ctx $v write 
		" " output
		$k quote-safe wrap-quotes output
		" ." output 
	] dict-each-key
	$ctx dup ->tab 1 - <-tab 
;
	
: write-vec ( ctx vec -- )
	:elems dup :ctx ->OUT :OUT
	$ctx dup ->tab 1 + <-tab 
	[ "\t" $ctx ->tab str-repeat output ] :TAB
	serial-mapping :dispatch
	# Increase the tab-indent
	[ $OUT .write-string ] :output

	"{" output 
	$elems [ :e
		" " output
		$ctx $e $e dispatch call 
	] vec-each
	" }" output
	$ctx dup ->tab 1 - <-tab 
;
 

: write-int ( ctx int -- ) >string swap ->OUT .write-string ;
: write-string ( ctx str -- ) quote-safe wrap-quotes swap ->OUT .write-string ; 
: write-double ( ctx double -- ) >string swap ->OUT .write-string ;
: write-bool ( ctx bool --  ) [ :ctx ] dip [ "t" ] [ "f" ] if $ctx ->OUT .write-string ;


# DEBUG
/*
"out.txt" import :d

"out.txt" $d save-state

"TODO: Add tests!!" println
"TODO: Consider switching dicts to use critbit trees" println
*/
# GUBED

Added cmd/FinalFrontier/scripts/ships.pisc.















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# What is the model for ships going to be?

# Lane types can be 1 of the 4 major types

# 0 - Basic: Can carry basic cargo
# 1 - Data: Can carry data of various kinds, is radiation shielded. A cockpit has 1 data slot by default
# 2 - Heavy: Can carry basic cargo, or heavier goods 
# 3 - Fragile: Is built with shock absorbsion to allow transport of fragile goods

: <lane> ( size type -- lane ) 
	:type :size
	{ $size [ f ] times } :cargo
	<dict>
		$cargo <<-cargo
		$type <<-type
;

: <ship> ( name lanes -- ship ) 
	:lanes :name
	<dict>
		$lanes <<-lanes
		$name <<-name
;

/*
Each ship is built out of lanes
Each ship has a drone loadout controlled by the Cockpit
If the cockpit is destroyed, you game is over. 
Most ships don't try to destroy a cockpit however, 
preferring to leave you helpless or capture you.

Ships can have 1x3 to 3x10 in dimentions, and filled with different segments

Lanes can come in 3 sizes as well, Small, Medim and Large

Segment types (* indicate mandatory segment): 

Life-support/Cockpit*, 
Engines*,
Fuel Tank*
cargo pod
Crew quarter (1 crew member per section)
drone pod (1 drone per section)

There are also possible non-standard segments:

Long range sensors ( extra combat round )
Contraband pod ( far better chance of passing an inspection )
Ship scanner (allows you to see into ship segments)
Tow package (allows you to haul ships/trailers around)

Segments have varying levels of armor:
low: Can be breached by any attck
medium: Will withstand a minimum of 1 successful attack.
heavy: Will withstand a minimum of 3 successful attacks.

Drones come in 3 basic types:

Attack: Shoots stuff
Defence: Defends against attack drones, each shot charges up a mega-beam
Ion: shorts-out drones and/or sections

Advanced drones: Raider

Raider drones do a variety of things, depending on which type of segment they manage to hit

If they hit Life-support/cockpit, they take over the ship, 
which allows it to be slaved to yours for transport to shipyards

If they hit a engine pod, the opposing ship will be slowed down

If they hit a Fuel tank, all the fuel in that tank is transfered to your ship next turn

If they hit a cargo bay, the cargo in that bay is transfared to your ship next turn

If they hit a crew-quarter, the crew member in that quarter is either 
captured or killed, depending on if you have space to carry them or not.










Added cmd/FinalFrontier/scripts/term_posix.pisc.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ;

# Clear screen and move cursor to top-left
: CLS ( -- ) ${ ESC "[2J" ESC "[;H" } print ;
: NL ( -- NL ) "\r\n" ;
: NNL ( -- NL ) NL NL ;

# Fore-colors
: black ( -- esc-black ) "30" color-code ;
: red ( -- esc-red ) "31" color-code ;
: green ( -- esc-green ) "32" color-code ;
: yellow ( -- esc-yellow ) "33" color-code ;
: blue ( -- esc-blue ) "34" color-code ;
: magenta ( -- esc-magenta ) "35" color-code ;
: cyan ( -- esc-cyan ) "36" color-code ;
: white ( -- esc-white ) "37" color-code ;

# back-colors
: back-black ( -- esc-black ) "40" color-code ;
: back-red ( -- esc-red ) "41" color-code ;
: back-green ( -- esc-green ) "42" color-code ;
: back-yellow ( -- esc-yellow ) "43" color-code ;
: back-blue ( -- esc-blue ) "44" color-code ;
: back-magenta ( -- esc-magenta ) "45" color-code ;
: back-cyan ( -- esc-cyan ) "46" color-code ;
: back-white ( -- esc-white ) "47" color-code ;

: is-enter? ( k -- ? ) 13 = ;
: is-arrow? ( k -- ? ) 27 = [ getkey 91 = ] [ f ] if ;

: is-up? ( k -- ? ) 65 = ;
: is-down? ( k -- ? ) 66 = ;
: is-right? ( k -- ? ) 67 = ;
: is-left? ( k -- ? ) 68 = ;

: is-y? ( k -- ? ) 121 = ;
: is-n? ( k -- ? ) 110 = ;
: is-yn? ( k -- ? )  [ is-y? ] [ is-n? ] bi or ;

Added cmd/FinalFrontier/scripts/term_win.pisc.















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ;

# Clear screen and move cursor to top-left
: CLS ( -- ) ${ ESC "[2J" ESC "[H" } print ;
: NL ( -- NL ) "\r\n" ;
: NNL ( -- NL ) NL NL ;

# Fore-colors
: black ( -- esc-black ) "30" color-code ;
: red ( -- esc-red ) "31" color-code ;
: green ( -- esc-green ) "32" color-code ;
: yellow ( -- esc-yellow ) "33" color-code ;
: blue ( -- esc-blue ) "34" color-code ;
: magenta ( -- esc-magenta ) "35" color-code ;
: cyan ( -- esc-cyan ) "36" color-code ;
: white ( -- esc-white ) "37" color-code ;

# back-colors
: back-black ( -- esc-black ) "40" color-code ;
: back-red ( -- esc-red ) "41" color-code ;
: back-green ( -- esc-green ) "42" color-code ;
: back-yellow ( -- esc-yellow ) "43" color-code ;
: back-blue ( -- esc-blue ) "44" color-code ;
: back-magenta ( -- esc-magenta ) "45" color-code ;
: back-cyan ( -- esc-cyan ) "46" color-code ;
: back-white ( -- esc-white ) "47" color-code ;

: is-enter? ( k -- ? ) 13 = ;
: is-arrow? ( k -- ? ) 224 = ;

: is-up? ( k -- ? ) 72 = ;
: is-down? ( k -- ? ) 80 = ;
: is-right? ( k -- ? ) 77 = ;
: is-left? ( k -- ? ) 75 = ;

: is-y? ( k -- ? ) 121 = ;
: is-n? ( k -- ? ) 110 = ;
: is-yn? ( k -- ? )  [ is-y? ] [ is-n? ] bi or ;

Added cmd/build/build.go.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package main

import "pisc"

var ModBuildCore = pisc.Module{
	Author:    "Andrew Owen",
	Name:      "BuildKit",
	License:   "MIT",
	DocString: `commands for running pisc Buildscripts`,
	Load:      loadBuildWords,
}

func loadBuildWords(m *pisc.Machine) error {
	return nil
}

Added cmd/build/main.go.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package main

import (
	"pisc"
	"pisc/libs/shell"
)

func main() {
	m := &pisc.Machine{
		Values:               make([]pisc.StackEntry, 0),
		DefinedWords:         make(map[string]*pisc.CodeQuotation),
		DefinedStackComments: make(map[string]string),
		PredefinedWords:      make(map[string]pisc.GoWord),
		PrefixWords:          make(map[string]*pisc.CodeQuotation),
		HelpDocs:             make(map[string]string),
	}
	m.LoadModules(append(pisc.StandardModules, shell.ModShellUtils)...)
}

Added cmd/pisc-web-ide/main.go.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
package main

import (
	"fmt"
	"github.com/pressly/chi"
	"github.com/pressly/chi/middleware"
	"log"
	"net/http"
)

// To try out: https://github.com/pressly/chi

func main() {
	// Simple static webserver:
	r := chi.NewRouter()
	r.Use(middleware.Logger)
	r.Use(middleware.Recoverer)

	r.FileServer("/", http.Dir("./webroot"))
	r.Get("/test", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w, "Testing now!")
	})

	r.Get("/test/:id/arrp/:foo", func(w http.ResponseWriter, r *http.Request) {
		// FIXME: Not safe!!
		fmt.Fprintln(w, chi.URLParam(r, "id"))
		fmt.Fprintln(w, chi.URLParam(r, "foo"))
	})
	r.Get("/test/a", func(w http.ResponseWriter, r *http.Request) {
		// FIXME: Not safe!!
		fmt.Fprintln(w, "foo")
	})

	log.Fatal(http.ListenAndServe(":8080", r))
}

Added cmd/pisc-web-ide/webroot/index.html.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
<html>
  <body>

  	<p>Hello PISC web-ide!</p>
  	
  	<script src="/static/js/reqwest-2.0.5/reqwest.js" type="text/javascript" charset="utf-8" async defer></script>
  	<script src="/static/js/vue-js/vue.js" type="text/javascript" charset="utf-8"></script>
  	<script></script>
  </body>
</html>

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
.PHONY: boosh test

boosh:
	@node -e "var json = require('./build');json.JSHINT_OPTS=JSON.parse(require('fs').readFileSync('./.jshintrc'));require('fs').writeFileSync('./build.json', JSON.stringify(json, null, 2))"
	@node_modules/smoosh/bin/smoosh make build.json

test:
	npm test

bump: boosh
	npm version patch
	node make/bump

publish:
	npm publish
	git push origin master --tags

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md.







































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# It's AJAX

All over again. Includes support for xmlHttpRequest, JSONP, CORS, and CommonJS Promises A.

It is also isomorphic allowing you to `require('reqwest')` in `Node.js` through the peer dependency [xhr2](https://github.com/pwnall/node-xhr2), albeit the original intent of this library is for the browser. For a more thorough solution for Node.js, see [mikeal/request](https://github.com/request/request).

## API

``` js
reqwest('path/to/html', function (resp) {
  qwery('#content').html(resp)
})

reqwest({
    url: 'path/to/html'
  , method: 'post'
  , data: { foo: 'bar', baz: 100 }
  , success: function (resp) {
      qwery('#content').html(resp)
    }
})

reqwest({
    url: 'path/to/html'
  , method: 'get'
  , data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ]
  , success: function (resp) {
      qwery('#content').html(resp)
    }
})

reqwest({
    url: 'path/to/json'
  , type: 'json'
  , method: 'post'
  , error: function (err) { }
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

reqwest({
    url: 'path/to/json'
  , type: 'json'
  , method: 'post'
  , contentType: 'application/json'
  , headers: {
      'X-My-Custom-Header': 'SomethingImportant'
    }
  , error: function (err) { }
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported
reqwest({
    url: 'path/to/json'
  , type: 'json'
  , method: 'post'
  , contentType: 'application/json'
  , crossOrigin: true
  , withCredentials: true
  , error: function (err) { }
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

reqwest({
    url: 'path/to/data.jsonp?callback=?'
  , type: 'jsonp'
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
  , jsonpCallbackName: 'bar'
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
  , complete: function (resp) {
      qwery('#hide-this').hide()
    }
})
```

## Promises

``` js
reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
})
  .then(function (resp) {
    qwery('#content').html(resp.content)
  }, function (err, msg) {
    qwery('#errors').html(msg)
  })
  .always(function (resp) {
    qwery('#hide-this').hide()
  })
```

``` js
reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
})
  .then(function (resp) {
    qwery('#content').html(resp.content)
  })
  .fail(function (err, msg) {
    qwery('#errors').html(msg)
  })
  .always(function (resp) {
    qwery('#hide-this').hide()
  })
```

``` js
var r = reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
  , success: function () {
      setTimeout(function () {
        r
          .then(function (resp) {
            qwery('#content').html(resp.content)
          }, function (err) { })
          .always(function (resp) {
             qwery('#hide-this').hide()
          })
      }, 15)
    }
})
```

## Options

  * `url` a fully qualified uri
  * `method` http method (default: `GET`)
  * `headers` http headers (default: `{}`)
  * `data` entity body for `PATCH`, `POST` and `PUT` requests. Must be a query `String` or `JSON` object
  * `type` a string enum. `html`, `xml`, `json`, or `jsonp`. Default is inferred by resource extension. Eg: `.json` will set `type` to `json`. `.xml` to `xml` etc.
  * `contentType` sets the `Content-Type` of the request. Eg: `application/json`
  * `crossOrigin` for cross-origin requests for browsers that support this feature.
  * `success` A function called when the request successfully completes
  * `error` A function called when the request fails.
  * `complete` A function called whether the request is a success or failure. Always called when complete.
  * `jsonpCallback` Specify the callback function name for a `JSONP` request. This value will be used instead of the random (but recommended) name automatically generated by reqwest.

## Security

If you are *still* requiring support for IE6/IE7, consider including [JSON3](https://bestiejs.github.io/json3/) in your project. Or simply do the following

``` html
<script>
(function () {
  if (!window.JSON) {
    document.write('<scr' + 'ipt src="http://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"><\/scr' + 'ipt>')
  }
}());
</script>
```


## Contributing

``` sh
$ git clone git://github.com/ded/reqwest.git reqwest
$ cd !$
$ npm install
```

Please keep your local edits to `src/reqwest.js`.
The base `./reqwest.js` and `./reqwest.min.js` will be built upon releases.

## Running Tests

``` sh
make test
```

## Browser support

  * IE6+
  * Chrome 1+
  * Safari 3+
  * Firefox 1+
  * Opera

## Ender Support
Reqwest can be used as an [Ender](http://enderjs.com) module. Add it to your existing build as such:

    $ ender add reqwest

Use it as such:

``` js
$.ajax({ ... })
```

Serialize things:

``` js
$(form).serialize() // returns query string -> x=y&...
$(form).serialize({type:'array'}) // returns array name/value pairs -> [ { name: x, value: y}, ... ]
$(form).serialize({type:'map'}) // returns an object representation -> { x: y, ... }
$(form).serializeArray()
$.toQueryString({
    foo: 'bar'
  , baz: 'thunk'
}) // returns query string -> foo=bar&baz=thunk
```

Or, get a bit fancy:

``` js
$('#myform input[name=myradios]').serialize({type:'map'})['myradios'] // get the selected value
$('input[type=text],#specialthing').serialize() // turn any arbitrary set of form elements into a query string
```

## ajaxSetup
Use the `request.ajaxSetup` to predefine a data filter on all requests. See the example below that demonstrates JSON hijacking prevention:

``` js
$.ajaxSetup({
  dataFilter: function (response, type) {
    if (type == 'json') return response.substring('])}while(1);</x>'.length)
    else return response
  }
})
```

## RequireJs and Jam
Reqwest can also be used with RequireJs and can be installed via jam

```
jam install reqwest
```

```js
define(function(require){
  var reqwest = require('reqwest')
});
```

## spm
Reqwest can also be installed via spm [![](http://spmjs.io/badge/reqwest)](http://spmjs.io/package/reqwest)

```
spm install reqwest
```

## jQuery and Zepto Compatibility
There are some differences between the *Reqwest way* and the
*jQuery/Zepto way*.

### method ###
jQuery/Zepto use `type` to specify the request method while Reqwest uses
`method` and reserves `type` for the response data type.

### dataType ###
When using jQuery/Zepto you use the `dataType` option to specify the type
of data to expect from the server, Reqwest uses `type`. jQuery also can
also take a space-separated list of data types to specify the request,
response and response-conversion types but Reqwest uses the `type`
parameter to infer the response type and leaves conversion up to you.

### JSONP ###
Reqwest also takes optional `jsonpCallback` and `jsonpCallbackName`
options to specify the callback query-string key and the callback function
name respectively while jQuery uses `jsonp` and `jsonpCallback` for
these same options.


But fear not! If you must work the jQuery/Zepto way then Reqwest has
a wrapper that will remap these options for you:

```js
reqwest.compat({
    url: 'path/to/data.jsonp?foo=bar'
  , dataType: 'jsonp'
  , jsonp: 'foo'
  , jsonpCallback: 'bar'
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

// or from Ender:

$.ajax.compat({
  ...
})
```

If you want to install jQuery/Zepto compatibility mode as the default
then simply place this snippet at the top of your code:

```js
$.ajax.compat && $.ender({ ajax: $.ajax.compat });
```


**Happy Ajaxing!**

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json.





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
  "YO": "This file is built by the Makefile, your edits may not be saved on build",
  "JAVASCRIPT": {
    "DIST_DIR": "./",
    "reqwest": [
      "src/copyright.js",
      "src/reqwest.js"
    ]
  },
  "JSHINT_OPTS": {
    "predef": [
      "define",
      "ActiveXObject",
      "XDomainRequest"
    ],
    "bitwise": true,
    "camelcase": false,
    "curly": false,
    "eqeqeq": false,
    "forin": false,
    "immed": false,
    "latedef": false,
    "newcap": true,
    "noarg": true,
    "noempty": true,
    "nonew": true,
    "plusplus": false,
    "quotmark": true,
    "regexp": false,
    "undef": true,
    "unused": true,
    "strict": false,
    "trailing": true,
    "maxlen": 120,
    "asi": true,
    "boss": true,
    "debug": true,
    "eqnull": true,
    "esnext": true,
    "evil": true,
    "expr": true,
    "funcscope": false,
    "globalstrict": false,
    "iterator": false,
    "lastsemic": true,
    "laxbreak": true,
    "laxcomma": true,
    "loopfunc": true,
    "multistr": false,
    "onecase": false,
    "proto": false,
    "regexdash": false,
    "scripturl": true,
    "smarttabs": false,
    "shadow": false,
    "sub": true,
    "supernew": false,
    "validthis": true,
    "browser": true,
    "couch": false,
    "devel": false,
    "dojo": false,
    "mootools": false,
    "node": true,
    "nonstandard": true,
    "prototypejs": false,
    "rhino": false,
    "worker": true,
    "wsh": false,
    "nomen": false,
    "onevar": false,
    "passfail": false
  }
}

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
var fs = require('fs')
  , version = require('../package.json').version;

['./reqwest.js', './reqwest.min.js'].forEach(function (file) {
  var data = fs.readFileSync(file, 'utf8')
  data = data.replace(/^\/\*\!/, '/*! version: ' + version)
  fs.writeFileSync(file, data)
})

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js.



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var exec = require('child_process').exec
  , fs = require('fs')
  , Connect = require('connect')
  , dispatch = require('dispatch')
  , mime = require('mime')
  , DelayedStream = require('delayed-stream')

  , getMime = function(ext) {
      return mime.lookup(ext == 'jsonp' ? 'js' : ext)
    }

var routes = {
  '/': function (req, res) {
    res.write(fs.readFileSync('./tests/tests.html', 'utf8'))
    res.end()
  },
  '/tests/timeout$': function (req, res) {
      var delayed = DelayedStream.create(req)
      setTimeout(function() {
        res.writeHead(200, {
            'Expires': 0
          , 'Cache-Control': 'max-age=0, no-cache, no-store'
        })
        req.query.callback && res.write(req.query.callback + '(')
        res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers }))
        req.query.callback && res.write(');')
        delayed.pipe(res)
      }, 2000)
  },
  '/tests/204': function(req, res) {
    res.writeHead(204);
    res.end();
  },
  '(([\\w\\-\\/\\.]+)\\.(css|js|json|jsonp|html|xml)$)': function (req, res, next, uri, file, ext) {
    res.writeHead(200, {
        'Expires': 0
      , 'Cache-Control': 'max-age=0, no-cache, no-store'
      , 'Content-Type': getMime(ext)
    })
    if (req.query.echo !== undefined) {
      ext == 'jsonp' && res.write((req.query.callback || req.query.testCallback || 'echoCallback') + '(')
      res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers }))
      ext == 'jsonp' && res.write(');')
    } else {
      res.write(fs.readFileSync('./' + file + '.' + ext))
    }
    res.end()
  }
}

Connect.createServer(Connect.query(), dispatch(routes)).listen(1234)

var otherOriginRoutes = {
    '/get-value': function (req, res) {
      res.writeHead(200, {
        'Access-Control-Allow-Origin': req.headers.origin,
        'Content-Type': 'text/plain'
      })
      res.end('hello')
    },
    '/set-cookie': function (req, res) {
      res.writeHead(200, {
        'Access-Control-Allow-Origin': req.headers.origin,
        'Access-Control-Allow-Credentials': 'true',
        'Content-Type': 'text/plain',
        'Set-Cookie': 'cookie=hello'
      })
      res.end('Set a cookie!')
    },
    '/get-cookie-value': function (req, res) {
      var cookies = {}
        , value

      req.headers.cookie && req.headers.cookie.split(';').forEach(function( cookie ) {
        var parts = cookie.split('=')
        cookies[ parts[ 0 ].trim() ] = ( parts[ 1 ] || '' ).trim()
      })
      value = cookies.cookie

      res.writeHead(200, {
          'Access-Control-Allow-Origin': req.headers.origin,
          'Access-Control-Allow-Credentials': 'true',
          'Content-Type': 'text/plain'
      })
      res.end(value)
    }
}

Connect.createServer(Connect.query(), dispatch(otherOriginRoutes)).listen(5678)

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
{
  "name": "reqwest",
  "description": "A wrapper for asynchronous http requests",
  "keywords": [
    "ender",
    "ajax",
    "xhr",
    "connection",
    "web 2.0",
    "async",
    "sync"
  ],
  "version": "2.0.5",
  "homepage": "https://github.com/ded/reqwest",
  "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)",
  "repository": {
    "type": "git",
    "url": "https://github.com/ded/reqwest.git"
  },
  "main": "./reqwest.js",
  "ender": "./src/ender.js",
  "browser": {
    "xhr2": false
  },
  "devDependencies": {
    "connect": "1.8.x",
    "mime": "1.x.x",
    "sink-test": ">=0.1.2",
    "dispatch": "0.x.x",
    "valentine": ">=1.4.7",
    "smoosh": "0.4.0",
    "delayed-stream": "0.0.5",
    "bump": "0.2.3"
  },
  "scripts": {
    "boosh": "smoosh make ./build.json",
    "test": "node ./test.js"
  },
  "license": "MIT",
  "spm": {
    "main": "reqwest.js",
    "ignore": [
      "vendor",
      "test",
      "make"
    ]
  }
}

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
var page = require('webpage').create()
page.open('http://localhost:1234', function() {

  function f() {
    setTimeout(function () {
      var clsName = page.evaluate(function() {
        var el = document.getElementById('tests')
        return el.className
      })
      if (!clsName.match(/sink-done/)) f()
      else {
        var count = 0
        var fail = page.evaluate(function () {
          var t = ''
          var els = document.querySelectorAll('ol#tests .fail .fail')
          for (var i = 0; i < els.length; i++) {
            t += els[i].textContent + '\n'
          }
          return {text: t, count: els.length}
        })
        var pass = !!clsName.match(/sink-pass/)
        if (pass) console.log('All tests have passed!')
        else {
          console.log(fail.count + ' test(s) failed')
          console.log(fail.text.trim())
        }

        phantom.exit(pass ? 0 : 1)
      }
    }, 10)
  }
  f()
})

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
/*!
  * Reqwest! A general purpose XHR connection manager
  * license MIT (c) Dustin Diaz 2015
  * https://github.com/ded/reqwest
  */

!function (name, context, definition) {
  if (typeof module != 'undefined' && module.exports) module.exports = definition()
  else if (typeof define == 'function' && define.amd) define(definition)
  else context[name] = definition()
}('reqwest', this, function () {

  var context = this

  if ('window' in context) {
    var doc = document
      , byTag = 'getElementsByTagName'
      , head = doc[byTag]('head')[0]
  } else {
    var XHR2
    try {
      XHR2 = require('xhr2')
    } catch (ex) {
      throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')
    }
  }


  var httpsRe = /^http/
    , protocolRe = /(^\w+):\/\//
    , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
    , readyState = 'readyState'
    , contentType = 'Content-Type'
    , requestedWith = 'X-Requested-With'
    , uniqid = 0
    , callbackPrefix = 'reqwest_' + (+new Date())
    , lastValue // data stored by the most recent JSONP callback
    , xmlHttpRequest = 'XMLHttpRequest'
    , xDomainRequest = 'XDomainRequest'
    , noop = function () {}

    , isArray = typeof Array.isArray == 'function'
        ? Array.isArray
        : function (a) {
            return a instanceof Array
          }

    , defaultHeaders = {
          'contentType': 'application/x-www-form-urlencoded'
        , 'requestedWith': xmlHttpRequest
        , 'accept': {
              '*':  'text/javascript, text/html, application/xml, text/xml, */*'
            , 'xml':  'application/xml, text/xml'
            , 'html': 'text/html'
            , 'text': 'text/plain'
            , 'json': 'application/json, text/javascript'
            , 'js':   'application/javascript, text/javascript'
          }
      }

    , xhr = function(o) {
        // is it x-domain
        if (o['crossOrigin'] === true) {
          var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null
          if (xhr && 'withCredentials' in xhr) {
            return xhr
          } else if (context[xDomainRequest]) {
            return new XDomainRequest()
          } else {
            throw new Error('Browser does not support cross-origin requests')
          }
        } else if (context[xmlHttpRequest]) {
          return new XMLHttpRequest()
        } else if (XHR2) {
          return new XHR2()
        } else {
          return new ActiveXObject('Microsoft.XMLHTTP')
        }
      }
    , globalSetupOptions = {
        dataFilter: function (data) {
          return data
        }
      }

  function succeed(r) {
    var protocol = protocolRe.exec(r.url)
    protocol = (protocol && protocol[1]) || context.location.protocol
    return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response
  }

  function handleReadyState(r, success, error) {
    return function () {
      // use _aborted to mitigate against IE err c00c023f
      // (can't read props on aborted request objects)
      if (r._aborted) return error(r.request)
      if (r._timedOut) return error(r.request, 'Request is aborted: timeout')
      if (r.request && r.request[readyState] == 4) {
        r.request.onreadystatechange = noop
        if (succeed(r)) success(r.request)
        else
          error(r.request)
      }
    }
  }

  function setHeaders(http, o) {
    var headers = o['headers'] || {}
      , h

    headers['Accept'] = headers['Accept']
      || defaultHeaders['accept'][o['type']]
      || defaultHeaders['accept']['*']

    var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);
    // breaks cross-origin requests with legacy browsers
    if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']
    if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']
    for (h in headers)
      headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])
  }

  function setCredentials(http, o) {
    if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {
      http.withCredentials = !!o['withCredentials']
    }
  }

  function generalCallback(data) {
    lastValue = data
  }

  function urlappend (url, s) {
    return url + (/\?/.test(url) ? '&' : '?') + s
  }

  function handleJsonp(o, fn, err, url) {
    var reqId = uniqid++
      , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key
      , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)
      , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)')
      , match = url.match(cbreg)
      , script = doc.createElement('script')
      , loaded = 0
      , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1

    if (match) {
      if (match[3] === '?') {
        url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name
      } else {
        cbval = match[3] // provided callback func name
      }
    } else {
      url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em
    }

    context[cbval] = generalCallback

    script.type = 'text/javascript'
    script.src = url
    script.async = true
    if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {
      // need this for IE due to out-of-order onreadystatechange(), binding script
      // execution to an event listener gives us control over when the script
      // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
      script.htmlFor = script.id = '_reqwest_' + reqId
    }

    script.onload = script.onreadystatechange = function () {
      if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {
        return false
      }
      script.onload = script.onreadystatechange = null
      script.onclick && script.onclick()
      // Call the user callback with the last value stored and clean up values and scripts.
      fn(lastValue)
      lastValue = undefined
      head.removeChild(script)
      loaded = 1
    }

    // Add the script to the DOM head
    head.appendChild(script)

    // Enable JSONP timeout
    return {
      abort: function () {
        script.onload = script.onreadystatechange = null
        err({}, 'Request is aborted: timeout', {})
        lastValue = undefined
        head.removeChild(script)
        loaded = 1
      }
    }
  }

  function getRequest(fn, err) {
    var o = this.o
      , method = (o['method'] || 'GET').toUpperCase()
      , url = typeof o === 'string' ? o : o['url']
      // convert non-string objects to query-string form unless o['processData'] is false
      , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')
        ? reqwest.toQueryString(o['data'])
        : (o['data'] || null)
      , http
      , sendWait = false

    // if we're working on a GET request and we have data then we should append
    // query string to end of URL and not post data
    if ((o['type'] == 'jsonp' || method == 'GET') && data) {
      url = urlappend(url, data)
      data = null
    }

    if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)

    // get the xhr from the factory if passed
    // if the factory returns null, fall-back to ours
    http = (o.xhr && o.xhr(o)) || xhr(o)

    http.open(method, url, o['async'] === false ? false : true)
    setHeaders(http, o)
    setCredentials(http, o)
    if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {
        http.onload = fn
        http.onerror = err
        // NOTE: see
        // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e
        http.onprogress = function() {}
        sendWait = true
    } else {
      http.onreadystatechange = handleReadyState(this, fn, err)
    }
    o['before'] && o['before'](http)
    if (sendWait) {
      setTimeout(function () {
        http.send(data)
      }, 200)
    } else {
      http.send(data)
    }
    return http
  }

  function Reqwest(o, fn) {
    this.o = o
    this.fn = fn

    init.apply(this, arguments)
  }

  function setType(header) {
    // json, javascript, text/plain, text/html, xml
    if (header === null) return undefined; //In case of no content-type.
    if (header.match('json')) return 'json'
    if (header.match('javascript')) return 'js'
    if (header.match('text')) return 'html'
    if (header.match('xml')) return 'xml'
  }

  function init(o, fn) {

    this.url = typeof o == 'string' ? o : o['url']
    this.timeout = null

    // whether request has been fulfilled for purpose
    // of tracking the Promises
    this._fulfilled = false
    // success handlers
    this._successHandler = function(){}
    this._fulfillmentHandlers = []
    // error handlers
    this._errorHandlers = []
    // complete (both success and fail) handlers
    this._completeHandlers = []
    this._erred = false
    this._responseArgs = {}

    var self = this

    fn = fn || function () {}

    if (o['timeout']) {
      this.timeout = setTimeout(function () {
        timedOut()
      }, o['timeout'])
    }

    if (o['success']) {
      this._successHandler = function () {
        o['success'].apply(o, arguments)
      }
    }

    if (o['error']) {
      this._errorHandlers.push(function () {
        o['error'].apply(o, arguments)
      })
    }

    if (o['complete']) {
      this._completeHandlers.push(function () {
        o['complete'].apply(o, arguments)
      })
    }

    function complete (resp) {
      o['timeout'] && clearTimeout(self.timeout)
      self.timeout = null
      while (self._completeHandlers.length > 0) {
        self._completeHandlers.shift()(resp)
      }
    }

    function success (resp) {
      var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE
      resp = (type !== 'jsonp') ? self.request : resp
      // use global data filter on response text
      var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)
        , r = filteredResponse
      try {
        resp.responseText = r
      } catch (e) {
        // can't assign this in IE<=8, just ignore
      }
      if (r) {
        switch (type) {
        case 'json':
          try {
            resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')
          } catch (err) {
            return error(resp, 'Could not parse JSON in response', err)
          }
          break
        case 'js':
          resp = eval(r)
          break
        case 'html':
          resp = r
          break
        case 'xml':
          resp = resp.responseXML
              && resp.responseXML.parseError // IE trololo
              && resp.responseXML.parseError.errorCode
              && resp.responseXML.parseError.reason
            ? null
            : resp.responseXML
          break
        }
      }

      self._responseArgs.resp = resp
      self._fulfilled = true
      fn(resp)
      self._successHandler(resp)
      while (self._fulfillmentHandlers.length > 0) {
        resp = self._fulfillmentHandlers.shift()(resp)
      }

      complete(resp)
    }

    function timedOut() {
      self._timedOut = true
      self.request.abort()
    }

    function error(resp, msg, t) {
      resp = self.request
      self._responseArgs.resp = resp
      self._responseArgs.msg = msg
      self._responseArgs.t = t
      self._erred = true
      while (self._errorHandlers.length > 0) {
        self._errorHandlers.shift()(resp, msg, t)
      }
      complete(resp)
    }

    this.request = getRequest.call(this, success, error)
  }

  Reqwest.prototype = {
    abort: function () {
      this._aborted = true
      this.request.abort()
    }

  , retry: function () {
      init.call(this, this.o, this.fn)
    }

    /**
     * Small deviation from the Promises A CommonJs specification
     * http://wiki.commonjs.org/wiki/Promises/A
     */

    /**
     * `then` will execute upon successful requests
     */
  , then: function (success, fail) {
      success = success || function () {}
      fail = fail || function () {}
      if (this._fulfilled) {
        this._responseArgs.resp = success(this._responseArgs.resp)
      } else if (this._erred) {
        fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
      } else {
        this._fulfillmentHandlers.push(success)
        this._errorHandlers.push(fail)
      }
      return this
    }

    /**
     * `always` will execute whether the request succeeds or fails
     */
  , always: function (fn) {
      if (this._fulfilled || this._erred) {
        fn(this._responseArgs.resp)
      } else {
        this._completeHandlers.push(fn)
      }
      return this
    }

    /**
     * `fail` will execute when the request fails
     */
  , fail: function (fn) {
      if (this._erred) {
        fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
      } else {
        this._errorHandlers.push(fn)
      }
      return this
    }
  , 'catch': function (fn) {
      return this.fail(fn)
    }
  }

  function reqwest(o, fn) {
    return new Reqwest(o, fn)
  }

  // normalize newline variants according to spec -> CRLF
  function normalize(s) {
    return s ? s.replace(/\r?\n/g, '\r\n') : ''
  }

  function serial(el, cb) {
    var n = el.name
      , t = el.tagName.toLowerCase()
      , optCb = function (o) {
          // IE gives value="" even where there is no value attribute
          // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273
          if (o && !o['disabled'])
            cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))
        }
      , ch, ra, val, i

    // don't serialize elements that are disabled or without a name
    if (el.disabled || !n) return

    switch (t) {
    case 'input':
      if (!/reset|button|image|file/i.test(el.type)) {
        ch = /checkbox/i.test(el.type)
        ra = /radio/i.test(el.type)
        val = el.value
        // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here
        ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))
      }
      break
    case 'textarea':
      cb(n, normalize(el.value))
      break
    case 'select':
      if (el.type.toLowerCase() === 'select-one') {
        optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)
      } else {
        for (i = 0; el.length && i < el.length; i++) {
          el.options[i].selected && optCb(el.options[i])
        }
      }
      break
    }
  }

  // collect up all form elements found from the passed argument elements all
  // the way down to child elements; pass a '<form>' or form fields.
  // called with 'this'=callback to use for serial() on each element
  function eachFormElement() {
    var cb = this
      , e, i
      , serializeSubtags = function (e, tags) {
          var i, j, fa
          for (i = 0; i < tags.length; i++) {
            fa = e[byTag](tags[i])
            for (j = 0; j < fa.length; j++) serial(fa[j], cb)
          }
        }

    for (i = 0; i < arguments.length; i++) {
      e = arguments[i]
      if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)
      serializeSubtags(e, [ 'input', 'select', 'textarea' ])
    }
  }

  // standard query string style serialization
  function serializeQueryString() {
    return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))
  }

  // { 'name': 'value', ... } style serialization
  function serializeHash() {
    var hash = {}
    eachFormElement.apply(function (name, value) {
      if (name in hash) {
        hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])
        hash[name].push(value)
      } else hash[name] = value
    }, arguments)
    return hash
  }

  // [ { name: 'name', value: 'value' }, ... ] style serialization
  reqwest.serializeArray = function () {
    var arr = []
    eachFormElement.apply(function (name, value) {
      arr.push({name: name, value: value})
    }, arguments)
    return arr
  }

  reqwest.serialize = function () {
    if (arguments.length === 0) return ''
    var opt, fn
      , args = Array.prototype.slice.call(arguments, 0)

    opt = args.pop()
    opt && opt.nodeType && args.push(opt) && (opt = null)
    opt && (opt = opt.type)

    if (opt == 'map') fn = serializeHash
    else if (opt == 'array') fn = reqwest.serializeArray
    else fn = serializeQueryString

    return fn.apply(null, args)
  }

  reqwest.toQueryString = function (o, trad) {
    var prefix, i
      , traditional = trad || false
      , s = []
      , enc = encodeURIComponent
      , add = function (key, value) {
          // If value is a function, invoke it and return its value
          value = ('function' === typeof value) ? value() : (value == null ? '' : value)
          s[s.length] = enc(key) + '=' + enc(value)
        }
    // If an array was passed in, assume that it is an array of form elements.
    if (isArray(o)) {
      for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])
    } else {
      // If traditional, encode the "old" way (the way 1.3.2 or older
      // did it), otherwise encode params recursively.
      for (prefix in o) {
        if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)
      }
    }

    // spaces should be + according to spec
    return s.join('&').replace(/%20/g, '+')
  }

  function buildParams(prefix, obj, traditional, add) {
    var name, i, v
      , rbracket = /\[\]$/

    if (isArray(obj)) {
      // Serialize array item.
      for (i = 0; obj && i < obj.length; i++) {
        v = obj[i]
        if (traditional || rbracket.test(prefix)) {
          // Treat each array item as a scalar.
          add(prefix, v)
        } else {
          buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)
        }
      }
    } else if (obj && obj.toString() === '[object Object]') {
      // Serialize object item.
      for (name in obj) {
        buildParams(prefix + '[' + name + ']', obj[name], traditional, add)
      }

    } else {
      // Serialize scalar item.
      add(prefix, obj)
    }
  }

  reqwest.getcallbackPrefix = function () {
    return callbackPrefix
  }

  // jQuery and Zepto compatibility, differences can be remapped here so you can call
  // .ajax.compat(options, callback)
  reqwest.compat = function (o, fn) {
    if (o) {
      o['type'] && (o['method'] = o['type']) && delete o['type']
      o['dataType'] && (o['type'] = o['dataType'])
      o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']
      o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])
    }
    return new Reqwest(o, fn)
  }

  reqwest.ajaxSetup = function (options) {
    options = options || {}
    for (var k in options) {
      globalSetupOptions[k] = options[k]
    }
  }

  return reqwest
});

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js.

cannot compute difference between binary files

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js.











>
>
>
>
>
1
2
3
4
5
/*!
  * Reqwest! A general purpose XHR connection manager
  * license MIT (c) Dustin Diaz 2015
  * https://github.com/ded/reqwest
  */

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
!function ($) {
  var r = require('reqwest')
    , integrate = function (method) {
        return function () {
          var args = Array.prototype.slice.call(arguments, 0)
            , i = (this && this.length) || 0
          while (i--) args.unshift(this[i])
          return r[method].apply(null, args)
        }
      }
    , s = integrate('serialize')
    , sa = integrate('serializeArray')

  $.ender({
      ajax: r
    , serialize: r.serialize
    , serializeArray: r.serializeArray
    , toQueryString: r.toQueryString
    , ajaxSetup: r.ajaxSetup
  })

  $.ender({
      serialize: s
    , serializeArray: sa
  }, true)
}(ender);

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
!function (name, context, definition) {
  if (typeof module != 'undefined' && module.exports) module.exports = definition()
  else if (typeof define == 'function' && define.amd) define(definition)
  else context[name] = definition()
}('reqwest', this, function () {

  var context = this

  if ('window' in context) {
    var doc = document
      , byTag = 'getElementsByTagName'
      , head = doc[byTag]('head')[0]
  } else {
    var XHR2
    try {
      XHR2 = require('xhr2')
    } catch (ex) {
      throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')
    }
  }


  var httpsRe = /^http/
    , protocolRe = /(^\w+):\/\//
    , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
    , readyState = 'readyState'
    , contentType = 'Content-Type'
    , requestedWith = 'X-Requested-With'
    , uniqid = 0
    , callbackPrefix = 'reqwest_' + (+new Date())
    , lastValue // data stored by the most recent JSONP callback
    , xmlHttpRequest = 'XMLHttpRequest'
    , xDomainRequest = 'XDomainRequest'
    , noop = function () {}

    , isArray = typeof Array.isArray == 'function'
        ? Array.isArray
        : function (a) {
            return a instanceof Array
          }

    , defaultHeaders = {
          'contentType': 'application/x-www-form-urlencoded'
        , 'requestedWith': xmlHttpRequest
        , 'accept': {
              '*':  'text/javascript, text/html, application/xml, text/xml, */*'
            , 'xml':  'application/xml, text/xml'
            , 'html': 'text/html'
            , 'text': 'text/plain'
            , 'json': 'application/json, text/javascript'
            , 'js':   'application/javascript, text/javascript'
          }
      }

    , xhr = function(o) {
        // is it x-domain
        if (o['crossOrigin'] === true) {
          var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null
          if (xhr && 'withCredentials' in xhr) {
            return xhr
          } else if (context[xDomainRequest]) {
            return new XDomainRequest()
          } else {
            throw new Error('Browser does not support cross-origin requests')
          }
        } else if (context[xmlHttpRequest]) {
          return new XMLHttpRequest()
        } else if (XHR2) {
          return new XHR2()
        } else {
          return new ActiveXObject('Microsoft.XMLHTTP')
        }
      }
    , globalSetupOptions = {
        dataFilter: function (data) {
          return data
        }
      }

  function succeed(r) {
    var protocol = protocolRe.exec(r.url)
    protocol = (protocol && protocol[1]) || context.location.protocol
    return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response
  }

  function handleReadyState(r, success, error) {
    return function () {
      // use _aborted to mitigate against IE err c00c023f
      // (can't read props on aborted request objects)
      if (r._aborted) return error(r.request)
      if (r._timedOut) return error(r.request, 'Request is aborted: timeout')
      if (r.request && r.request[readyState] == 4) {
        r.request.onreadystatechange = noop
        if (succeed(r)) success(r.request)
        else
          error(r.request)
      }
    }
  }

  function setHeaders(http, o) {
    var headers = o['headers'] || {}
      , h

    headers['Accept'] = headers['Accept']
      || defaultHeaders['accept'][o['type']]
      || defaultHeaders['accept']['*']

    var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);
    // breaks cross-origin requests with legacy browsers
    if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']
    if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']
    for (h in headers)
      headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])
  }

  function setCredentials(http, o) {
    if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {
      http.withCredentials = !!o['withCredentials']
    }
  }

  function generalCallback(data) {
    lastValue = data
  }

  function urlappend (url, s) {
    return url + (/\?/.test(url) ? '&' : '?') + s
  }

  function handleJsonp(o, fn, err, url) {
    var reqId = uniqid++
      , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key
      , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)
      , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)')
      , match = url.match(cbreg)
      , script = doc.createElement('script')
      , loaded = 0
      , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1

    if (match) {
      if (match[3] === '?') {
        url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name
      } else {
        cbval = match[3] // provided callback func name
      }
    } else {
      url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em
    }

    context[cbval] = generalCallback

    script.type = 'text/javascript'
    script.src = url
    script.async = true
    if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {
      // need this for IE due to out-of-order onreadystatechange(), binding script
      // execution to an event listener gives us control over when the script
      // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
      script.htmlFor = script.id = '_reqwest_' + reqId
    }

    script.onload = script.onreadystatechange = function () {
      if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {
        return false
      }
      script.onload = script.onreadystatechange = null
      script.onclick && script.onclick()
      // Call the user callback with the last value stored and clean up values and scripts.
      fn(lastValue)
      lastValue = undefined
      head.removeChild(script)
      loaded = 1
    }

    // Add the script to the DOM head
    head.appendChild(script)

    // Enable JSONP timeout
    return {
      abort: function () {
        script.onload = script.onreadystatechange = null
        err({}, 'Request is aborted: timeout', {})
        lastValue = undefined
        head.removeChild(script)
        loaded = 1
      }
    }
  }

  function getRequest(fn, err) {
    var o = this.o
      , method = (o['method'] || 'GET').toUpperCase()
      , url = typeof o === 'string' ? o : o['url']
      // convert non-string objects to query-string form unless o['processData'] is false
      , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')
        ? reqwest.toQueryString(o['data'])
        : (o['data'] || null)
      , http
      , sendWait = false

    // if we're working on a GET request and we have data then we should append
    // query string to end of URL and not post data
    if ((o['type'] == 'jsonp' || method == 'GET') && data) {
      url = urlappend(url, data)
      data = null
    }

    if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)

    // get the xhr from the factory if passed
    // if the factory returns null, fall-back to ours
    http = (o.xhr && o.xhr(o)) || xhr(o)

    http.open(method, url, o['async'] === false ? false : true)
    setHeaders(http, o)
    setCredentials(http, o)
    if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {
        http.onload = fn
        http.onerror = err
        // NOTE: see
        // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e
        http.onprogress = function() {}
        sendWait = true
    } else {
      http.onreadystatechange = handleReadyState(this, fn, err)
    }
    o['before'] && o['before'](http)
    if (sendWait) {
      setTimeout(function () {
        http.send(data)
      }, 200)
    } else {
      http.send(data)
    }
    return http
  }

  function Reqwest(o, fn) {
    this.o = o
    this.fn = fn

    init.apply(this, arguments)
  }

  function setType(header) {
    // json, javascript, text/plain, text/html, xml
    if (header === null) return undefined; //In case of no content-type.
    if (header.match('json')) return 'json'
    if (header.match('javascript')) return 'js'
    if (header.match('text')) return 'html'
    if (header.match('xml')) return 'xml'
  }

  function init(o, fn) {

    this.url = typeof o == 'string' ? o : o['url']
    this.timeout = null

    // whether request has been fulfilled for purpose
    // of tracking the Promises
    this._fulfilled = false
    // success handlers
    this._successHandler = function(){}
    this._fulfillmentHandlers = []
    // error handlers
    this._errorHandlers = []
    // complete (both success and fail) handlers
    this._completeHandlers = []
    this._erred = false
    this._responseArgs = {}

    var self = this

    fn = fn || function () {}

    if (o['timeout']) {
      this.timeout = setTimeout(function () {
        timedOut()
      }, o['timeout'])
    }

    if (o['success']) {
      this._successHandler = function () {
        o['success'].apply(o, arguments)
      }
    }

    if (o['error']) {
      this._errorHandlers.push(function () {
        o['error'].apply(o, arguments)
      })
    }

    if (o['complete']) {
      this._completeHandlers.push(function () {
        o['complete'].apply(o, arguments)
      })
    }

    function complete (resp) {
      o['timeout'] && clearTimeout(self.timeout)
      self.timeout = null
      while (self._completeHandlers.length > 0) {
        self._completeHandlers.shift()(resp)
      }
    }

    function success (resp) {
      var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE
      resp = (type !== 'jsonp') ? self.request : resp
      // use global data filter on response text
      var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)
        , r = filteredResponse
      try {
        resp.responseText = r
      } catch (e) {
        // can't assign this in IE<=8, just ignore
      }
      if (r) {
        switch (type) {
        case 'json':
          try {
            resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')
          } catch (err) {
            return error(resp, 'Could not parse JSON in response', err)
          }
          break
        case 'js':
          resp = eval(r)
          break
        case 'html':
          resp = r
          break
        case 'xml':
          resp = resp.responseXML
              && resp.responseXML.parseError // IE trololo
              && resp.responseXML.parseError.errorCode
              && resp.responseXML.parseError.reason
            ? null
            : resp.responseXML
          break
        }
      }

      self._responseArgs.resp = resp
      self._fulfilled = true
      fn(resp)
      self._successHandler(resp)
      while (self._fulfillmentHandlers.length > 0) {
        resp = self._fulfillmentHandlers.shift()(resp)
      }

      complete(resp)
    }

    function timedOut() {
      self._timedOut = true
      self.request.abort()
    }

    function error(resp, msg, t) {
      resp = self.request
      self._responseArgs.resp = resp
      self._responseArgs.msg = msg
      self._responseArgs.t = t
      self._erred = true
      while (self._errorHandlers.length > 0) {
        self._errorHandlers.shift()(resp, msg, t)
      }
      complete(resp)
    }

    this.request = getRequest.call(this, success, error)
  }

  Reqwest.prototype = {
    abort: function () {
      this._aborted = true
      this.request.abort()
    }

  , retry: function () {
      init.call(this, this.o, this.fn)
    }

    /**
     * Small deviation from the Promises A CommonJs specification
     * http://wiki.commonjs.org/wiki/Promises/A
     */

    /**
     * `then` will execute upon successful requests
     */
  , then: function (success, fail) {
      success = success || function () {}
      fail = fail || function () {}
      if (this._fulfilled) {
        this._responseArgs.resp = success(this._responseArgs.resp)
      } else if (this._erred) {
        fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
      } else {
        this._fulfillmentHandlers.push(success)
        this._errorHandlers.push(fail)
      }
      return this
    }

    /**
     * `always` will execute whether the request succeeds or fails
     */
  , always: function (fn) {
      if (this._fulfilled || this._erred) {
        fn(this._responseArgs.resp)
      } else {
        this._completeHandlers.push(fn)
      }
      return this
    }

    /**
     * `fail` will execute when the request fails
     */
  , fail: function (fn) {
      if (this._erred) {
        fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)
      } else {
        this._errorHandlers.push(fn)
      }
      return this
    }
  , 'catch': function (fn) {
      return this.fail(fn)
    }
  }

  function reqwest(o, fn) {
    return new Reqwest(o, fn)
  }

  // normalize newline variants according to spec -> CRLF
  function normalize(s) {
    return s ? s.replace(/\r?\n/g, '\r\n') : ''
  }

  function serial(el, cb) {
    var n = el.name
      , t = el.tagName.toLowerCase()
      , optCb = function (o) {
          // IE gives value="" even where there is no value attribute
          // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273
          if (o && !o['disabled'])
            cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))
        }
      , ch, ra, val, i

    // don't serialize elements that are disabled or without a name
    if (el.disabled || !n) return

    switch (t) {
    case 'input':
      if (!/reset|button|image|file/i.test(el.type)) {
        ch = /checkbox/i.test(el.type)
        ra = /radio/i.test(el.type)
        val = el.value
        // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here
        ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))
      }
      break
    case 'textarea':
      cb(n, normalize(el.value))
      break
    case 'select':
      if (el.type.toLowerCase() === 'select-one') {
        optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)
      } else {
        for (i = 0; el.length && i < el.length; i++) {
          el.options[i].selected && optCb(el.options[i])
        }
      }
      break
    }
  }

  // collect up all form elements found from the passed argument elements all
  // the way down to child elements; pass a '<form>' or form fields.
  // called with 'this'=callback to use for serial() on each element
  function eachFormElement() {
    var cb = this
      , e, i
      , serializeSubtags = function (e, tags) {
          var i, j, fa
          for (i = 0; i < tags.length; i++) {
            fa = e[byTag](tags[i])
            for (j = 0; j < fa.length; j++) serial(fa[j], cb)
          }
        }

    for (i = 0; i < arguments.length; i++) {
      e = arguments[i]
      if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)
      serializeSubtags(e, [ 'input', 'select', 'textarea' ])
    }
  }

  // standard query string style serialization
  function serializeQueryString() {
    return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))
  }

  // { 'name': 'value', ... } style serialization
  function serializeHash() {
    var hash = {}
    eachFormElement.apply(function (name, value) {
      if (name in hash) {
        hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])
        hash[name].push(value)
      } else hash[name] = value
    }, arguments)
    return hash
  }

  // [ { name: 'name', value: 'value' }, ... ] style serialization
  reqwest.serializeArray = function () {
    var arr = []
    eachFormElement.apply(function (name, value) {
      arr.push({name: name, value: value})
    }, arguments)
    return arr
  }

  reqwest.serialize = function () {
    if (arguments.length === 0) return ''
    var opt, fn
      , args = Array.prototype.slice.call(arguments, 0)

    opt = args.pop()
    opt && opt.nodeType && args.push(opt) && (opt = null)
    opt && (opt = opt.type)

    if (opt == 'map') fn = serializeHash
    else if (opt == 'array') fn = reqwest.serializeArray
    else fn = serializeQueryString

    return fn.apply(null, args)
  }

  reqwest.toQueryString = function (o, trad) {
    var prefix, i
      , traditional = trad || false
      , s = []
      , enc = encodeURIComponent
      , add = function (key, value) {
          // If value is a function, invoke it and return its value
          value = ('function' === typeof value) ? value() : (value == null ? '' : value)
          s[s.length] = enc(key) + '=' + enc(value)
        }
    // If an array was passed in, assume that it is an array of form elements.
    if (isArray(o)) {
      for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])
    } else {
      // If traditional, encode the "old" way (the way 1.3.2 or older
      // did it), otherwise encode params recursively.
      for (prefix in o) {
        if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)
      }
    }

    // spaces should be + according to spec
    return s.join('&').replace(/%20/g, '+')
  }

  function buildParams(prefix, obj, traditional, add) {
    var name, i, v
      , rbracket = /\[\]$/

    if (isArray(obj)) {
      // Serialize array item.
      for (i = 0; obj && i < obj.length; i++) {
        v = obj[i]
        if (traditional || rbracket.test(prefix)) {
          // Treat each array item as a scalar.
          add(prefix, v)
        } else {
          buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)
        }
      }
    } else if (obj && obj.toString() === '[object Object]') {
      // Serialize object item.
      for (name in obj) {
        buildParams(prefix + '[' + name + ']', obj[name], traditional, add)
      }

    } else {
      // Serialize scalar item.
      add(prefix, obj)
    }
  }

  reqwest.getcallbackPrefix = function () {
    return callbackPrefix
  }

  // jQuery and Zepto compatibility, differences can be remapped here so you can call
  // .ajax.compat(options, callback)
  reqwest.compat = function (o, fn) {
    if (o) {
      o['type'] && (o['method'] = o['type']) && delete o['type']
      o['dataType'] && (o['type'] = o['dataType'])
      o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']
      o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])
    }
    return new Reqwest(o, fn)
  }

  reqwest.ajaxSetup = function (options) {
    options = options || {}
    for (var k in options) {
      globalSetupOptions[k] = options[k]
    }
  }

  return reqwest
});

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var spawn = require('child_process').spawn
  , server  = spawn('node', ['make/tests.js'])
  , phantom = spawn('./vendor/phantomjs', ['./phantom.js'])


phantom.stdout.on('data', function (data) {
  console.log('stdout: ' + data);
})

phantom.on('exit', function (code, signal) {
  var outcome = code == 0 ? 'passed' : 'failed'
  console.log('Reqwest tests have %s', outcome, code)
  server.kill('SIGHUP')
  process.exit(code)
})

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js.











































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*!
  * Ender: open module JavaScript framework (client-lib)
  * copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat)
  * http://ender.no.de
  * License MIT
  */
(function (context) {

  // a global object for node.js module compatiblity
  // ============================================

  context['global'] = context

  // Implements simple module system
  // losely based on CommonJS Modules spec v1.1.1
  // ============================================

  var modules = {}
    , old = context['$']
    , oldRequire = context['require']
    , oldProvide = context['provide']

  function require (identifier) {
    // modules can be required from ender's build system, or found on the window
    var module = modules['$' + identifier] || window[identifier]
    if (!module) throw new Error("Ender Error: Requested module '" + identifier + "' has not been defined.")
    return module
  }

  function provide (name, what) {
    return (modules['$' + name] = what)
  }

  context['provide'] = provide
  context['require'] = require

  function aug(o, o2) {
    for (var k in o2) k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k])
    return o
  }

  /**
   * main Ender return object
   * @constructor
   * @param {Array|Node|string} s a CSS selector or DOM node(s)
   * @param {Array.|Node} r a root node(s)
   */
  function Ender(s, r) {
    var elements
      , i

    this.selector = s
    // string || node || nodelist || window
    if (typeof s == 'undefined') {
      elements = []
      this.selector = ''
    } else if (typeof s == 'string' || s.nodeName || (s.length && 'item' in s) || s == window) {
      elements = ender._select(s, r)
    } else {
      elements = isFinite(s.length) ? s : [s]
    }
    this.length = elements.length
    for (i = this.length; i--;) this[i] = elements[i]
  }

  /**
   * @param {function(el, i, inst)} fn
   * @param {Object} opt_scope
   * @returns {Ender}
   */
  Ender.prototype['forEach'] = function (fn, opt_scope) {
    var i, l
    // opt out of native forEach so we can intentionally call our own scope
    // defaulting to the current item and be able to return self
    for (i = 0, l = this.length; i < l; ++i) i in this && fn.call(opt_scope || this[i], this[i], i, this)
    // return self for chaining
    return this
  }

  Ender.prototype.$ = ender // handy reference to self


  function ender(s, r) {
    return new Ender(s, r)
  }

  ender['_VERSION'] = '0.4.3-dev'

  ender.fn = Ender.prototype // for easy compat to jQuery plugins

  ender.ender = function (o, chain) {
    aug(chain ? Ender.prototype : ender, o)
  }

  ender._select = function (s, r) {
    if (typeof s == 'string') return (r || document).querySelectorAll(s)
    if (s.nodeName) return [s]
    return s
  }


  // use callback to receive Ender's require & provide
  ender.noConflict = function (callback) {
    context['$'] = old
    if (callback) {
      context['provide'] = oldProvide
      context['require'] = oldRequire
      callback(require, provide, this)
    }
    return this
  }

  if (typeof module !== 'undefined' && module.exports) module.exports = ender
  // use subscript notation as extern for Closure compilation
  context['ender'] = context['$'] = context['ender'] || ender

}(this));

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml.



>
1
><><>Not a valid xml document<><><

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html.



>
1
<p>boosh</p>

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js.



>
1
window.boosh = 'boosh';

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json.



>
1
{ "boosh": "boosh" }

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml.



>
1
<root><boosh>boosh</boosh></root>

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp.



>
1
reqwest_0({ "boosh": "boosh" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp.



>
1
bar({ "boosh": "boosh" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp.



>
1
reqwest_2({ "boosh": "boosh" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp.



>
1
reqwest_0({ "a": "a" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp.



>
1
reqwest_0({ "b": "b" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp.



>
1
reqwest_0({ "c": "c" });

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json.



>
1
])}while(1);</x>{ "boosh": "boosh" }

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json.











>
>
>
>
>
1
2
3
4
5
this is not valid JSON!, there: are ~!_+ punctuation

marks

all, over, the:place ^ 2

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html.



















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE HTML>
<html lang="en-us">
  <head>
    <title>Reqwest tests</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="/node_modules/sink-test/src/sink.css" type="text/css">
    <script src="/node_modules/valentine/valentine.js"></script>
    <script src="/node_modules/sink-test/src/sink.js"></script>
    <script src="/tests/ender.js"></script>
    <script src="/src/reqwest.js"></script>
    <script src="/src/ender.js"></script>
    <style type="text/css">
      #fixtures {
        position: absolute;
        top: -9999em;
      }
    </style>
  </head>
  <body>
    <h1>Reqwest Tests</h1>
    <div id="fixtures">
      <form action="/foo" method="post">
        <input type="submit" value="Continue">
        <input type="text" name="foo" value="bar">
        <input type="hidden" name="bar" value="baz">
        <input type="checkbox" name="wha" checked value="1">
        <input type="checkbox" name="wha" value="2">
        <input type="checkbox" name="wha" checked value="3">
        <input type="radio" name="who" value="one">
        <input type="radio" name="who" checked value="tawoo">
        <input type="radio" name="who" value="three">
        <input type="text" name="$escapable name$" value="escapeme" />
        <select name="choices">
          <option>one</option>
          <option selected>two</option>
          <option>tres</option>
        </select>
        <textarea name="opinions">world peace is not real</textarea>
      </form>
      <form action="/baa" method="get">
        <textarea name="T3" rows="2" cols="15">?
A B
Z</textarea>
        <input type="hidden" name="H1" value="x" />       <!-- 0 -->
        <input type="hidden" name="H2" />                 <!-- 1 -->
        <input type="password" name="PWD1" value="xyz" /> <!-- 2 -->
        <input type="password" name="PWD2" />             <!-- 3 -->
        <input type="text" name="T1" />                   <!-- 4 -->
        <input type="text" name="T2" value="YES" readonly="readonly" /> <!-- 5 -->
        <input type="checkbox" name="C1" value="1" />     <!-- 6 -->
        <input type="checkbox" name="C2" />               <!-- 7 -->
        <input type="radio" name="R1" value="1" />        <!-- 8 -->
        <input type="radio" name="R1" value="" />         <!-- 9 -->
        <input type="text" name="My Name" value="me" />   <!-- 10 -->
        <input type="reset" name="rst" value="NO" />      <!-- 11 -->
        <input type="file" name="file" />                 <!-- 12 -->
        <input type="submit" name="sub" value="NO" />     <!-- 13 -->
        <select name="S1"></select>                       <!-- 0 -->
        <select name="S2">                                <!-- 1 -->
          <option value="abc">ABC</option>
          <option value="def">DEF</option>
          <option value="ghi">GHI</option>
          <option value="jkl">JKL</option>
          <option value="mno">MNO</option>
          <option value="pqr">PQR</option>
          <option value="disco stu">DISCO STU!</option>
          <option value="vwx">VWX</option>
          <option value="yz">YZ</option>
          <option value="">no no no!</option>
        </select>
        <select name="S3">                                <!-- 2 -->
          <option>ABC</option>
          <option>DEF</option>
          <option>GHI</option>
          <option>JKL</option>
          <option>MNO</option>
          <option>PQR</option>
          <option>DISCO STU!</option>
          <option>VWX</option>
          <option>YZ</option>
        </select>
        <select name="S4" multiple="multiple" size="3">   <!-- 3 -->
          <option value="1">One</option>
          <option value="2">Two</option>
          <option value="3">Three</option>
          <option value="4">Four</option>
          <option value="5">Five</option>
          <option value="6">Six</option>
          <option>Seven</option>
          <option>Eight</option>
          <option>Disco Stu!</option>
        </select>
        <input type="text" name="D1" value="NO" disabled="disabled" />  <!-- 14 -->
        <input type="checkbox" name="D2" value="NO" checked="checked" disabled="disabled" />  <!-- 15 -->
        <input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" />  <!-- 16 -->
        <select name="D4" disabled="disabled"><option selected="selected" value="NO">NO</option></select> <!-- 4 -->
        <select name="D5"><option selected="selected" value="NO" disabled="disabled">NO</option></select> <!-- 5 -->
        <select name="D4" disabled="disabled "multiple="multiple" size="3"><option selected="selected" value="NO">NO</option></select> <!-- 6 -->
        <select name="D5" multiple="multiple" size="3"><option selected="selected" value="NO" disabled="disabled">NO</option></select> <!-- 7 -->
      </form>
    </div>
    <ol id="tests"></ol>
    <script src="/tests/tests.js"></script>
  </body>
</html>

Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
/*jshint maxlen:80*/
/*global reqwest:true, sink:true, start:true, ender:true, v:true, boosh:true*/

(function (ajax) {
  var BIND_ARGS = 'bind'
    , PASS_ARGS = 'pass'
    , FakeXHR = (function () {
        function FakeXHR () {
          this.args = {}
          FakeXHR.last = this
        }
        FakeXHR.setup = function () {
          FakeXHR.oldxhr = window['XMLHttpRequest']
          FakeXHR.oldaxo = window['ActiveXObject']
          window['XMLHttpRequest'] = FakeXHR
          window['ActiveXObject'] = FakeXHR
          FakeXHR.last = null
        }
        FakeXHR.restore = function () {
          window['XMLHttpRequest'] = FakeXHR.oldxhr
          window['ActiveXObject'] = FakeXHR.oldaxo
        }
        FakeXHR.prototype.methodCallCount = function (name) {
          return this.args[name] ? this.args[name].length : 0
        }
        FakeXHR.prototype.methodCallArgs = function (name, i, j) {
          var a = this.args[name]
              && this.args[name].length > i ? this.args[name][i] : null
          if (arguments.length > 2) return a && a.length > j ? a[j] : null
          return a
        }
        v.each(['open', 'send', 'setRequestHeader' ], function (f) {
          FakeXHR.prototype[f] = function () {
            if (!this.args[f]) this.args[f] = []
            this.args[f].push(arguments)
          }
        })
        return FakeXHR
      }())

  sink('Setup', function (test, ok, before, after) {
    before(function () {
      ajax.ajaxSetup({
        dataFilter: function (resp, type) {
          // example filter to prevent json hijacking
          return resp.substring('])}while(1);</x>'.length)
        }
      })
    })
    after(function () {
      ajax.ajaxSetup({
        // reset to original data filter
        dataFilter: function (resp, type) {
          return resp
        }
      })
    })
    test('dataFilter', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures_with_prefix.json'
        , type: 'json'
        , success: function (resp) {
            ok(resp, 'received response')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaluated response as JSON'
            )
            complete()
          }
      })
    })
  })

  sink('Mime Types', function (test, ok) {
    test('JSON', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
        , success: function (resp) {
            ok(resp, 'received response')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaluated response as JSON'
            )
            complete()
          }
      })
    })

    test('JSONP', function (complete) {
      // stub callback prefix
      reqwest.getcallbackPrefix = function (id) {
        return 'reqwest_' + id
      }
      ajax({
          url: '/tests/fixtures/fixtures_jsonp.jsonp?callback=?'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response for unique generated callback')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaled response for unique generated cb as JSONP'
            )
            complete()
          }
      })
    })

    test('JS', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.js'
        , type: 'js'
        , success: function () {
            ok(
                typeof boosh !== 'undefined' && boosh == 'boosh'
              , 'evaluated response as JavaScript'
            )
            complete()
          }
      })
    })

    test('HTML', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.html'
        , type: 'html'
        , success: function (resp) {
            ok(resp == '<p>boosh</p>', 'evaluated response as HTML')
            complete()
          }
      })
    })

    test('XML', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.xml'
        , type: 'xml'
        , success: function (resp) {
            ok(resp
                && resp.documentElement
                && resp.documentElement.nodeName == 'root'
              , 'XML Response root is <root>'
            )
            ok(resp
                && resp.documentElement
                && resp.documentElement.hasChildNodes
                && resp.documentElement.firstChild.nodeName == 'boosh'
                && resp.documentElement.firstChild.firstChild.nodeValue
                    == 'boosh'
              , 'Correct XML response'
            )
            complete()
          }
        , error: function (err) {
            ok(false, err.responseText)
            complete()
          }
      })
    })

    test('XML (404)', function (complete) {
      ajax({
          url:'/tests/fixtures/badfixtures.xml'
        , type:'xml'
        , success: function (resp) {
            if (resp == null) {
              ok(true, 'XML response is null')
              complete()
            } else {
              ok(resp
                  && resp.documentElement
                  && resp.documentElement.firstChild
                  && (/error/i).test(resp.documentElement.firstChild.nodeValue)
                , 'XML response reports parsing error'
              )
              complete()
            }
          }
        , error: function () {
            ok(true, 'No XML response (error())')
            complete()
          }
      })
    })
  })

  sink('JSONP', function (test, ok) {
    test('Named callback in query string', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures_jsonp2.jsonp?foo=bar'
        , type: 'jsonp'
        , jsonpCallback: 'foo'
        , success: function (resp) {
            ok(resp, 'received response for custom callback')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaluated response as JSONP with custom callback'
            )
            complete()
          }
      })
    })

    test('Unnamed callback in query string', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures_jsonp3.jsonp?foo=?'
        , type: 'jsonp'
        , jsonpCallback: 'foo'
        , success: function (resp) {
            ok(resp, 'received response for custom wildcard callback')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaled response as JSONP with custom wildcard cb'
            )
            complete()
          }
      })
    })

    test('No callback, no query string', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures_jsonp3.jsonp'
        , type: 'jsonp'
        , jsonpCallback: 'foo'
        , success: function (resp) {
            ok(resp, 'received response for custom wildcard callback')
            ok(
                resp && resp.boosh == 'boosh'
              , 'correctly evaled response as JSONP with custom cb not in url'
            )
            complete()
          }
      })
    })

    test('No callback in existing query string', function (complete) {
      ajax({
          url: '/tests/none.jsonp?echo&somevar=some+long+str+here'
        , type: 'jsonp'
        , jsonpCallbackName: 'yohoho'
        , success: function (resp) {
            ok(resp && resp.query, 'received response from echo callback')
            ok(
                resp && resp.query && resp.query.somevar == 'some long str here'
              , 'correctly evaluated response as JSONP with echo callback'
            )
            complete()
          }
      })
    })

    test('Append data to existing query string', function (complete) {
      ajax({
          url: '/tests/none.jsonp?echo' // should append &somevar...
        , type: 'jsonp'
        , data: { somevar: 'some long str here', anothervar: 'yo ho ho!' }
        , success: function (resp) {
            ok(resp && resp.query, 'received response from echo callback')
            ok(
                resp && resp.query && resp.query.somevar == 'some long str here'
              , 'correctly sent and received data object from JSONP echo (1)'
            )
            ok(
                resp && resp.query && resp.query.anothervar == 'yo ho ho!'
              , 'correctly sent and received data object from JSONP echo (2)'
            )
            complete()
          }
      })
    })

    test('Generate complete query string from data', function (complete) {
      ajax({
          url: '/tests/none.jsonp' // should append ?echo...etc.
        , type: 'jsonp'
        , data: [
              { name: 'somevar', value: 'some long str here' }
            , { name: 'anothervar', value: 'yo ho ho!' }
            , { name: 'echo', value: true }
          ]
        , success: function (resp) {
            ok(resp && resp.query, 'received response from echo callback')
            ok(
                resp && resp.query && resp.query.somevar == 'some long str here'
              , 'correctly sent and received data array from JSONP echo (1)'
            )
            ok(
                resp && resp.query && resp.query.anothervar == 'yo ho ho!'
              , 'correctly sent and received data array from JSONP echo (2)'
            )
            complete()
          }
      })
    })

    test('Append data to query string and insert callback name'
        , function (complete) {

      ajax({
          // should append data and match callback correctly
          url: '/tests/none.jsonp?callback=?'
        , type: 'jsonp'
        , jsonpCallbackName: 'reqwest_foo'
        , data: { foo: 'bar', boo: 'baz', echo: true }
        , success: function (resp) {
            ok(resp && resp.query, 'received response from echo callback')
            ok(
                resp && resp.query && resp.query.callback == 'reqwest_foo'
              , 'correctly matched callback in URL'
            )
            complete()
          }
      })
    })
  })

  sink('Callbacks', function (test, ok) {

    test('sync version', function (done) {
      var r = ajax({
        method: 'get'
      , url: '/tests/fixtures/fixtures.json'
      , type: 'json'
      , async: false
      })
      var request = r.request,
        responseText = request.response !== undefined ? request.response : request.responseText
      ok(eval('(' + responseText + ')').boosh == 'boosh', 'can make sync calls')
      done()
    })

    test('no callbacks', function (complete) {
      var pass = true
      try {
        ajax('/tests/fixtures/fixtures.js')
      } catch (ex) {
        pass = false
      } finally {
        ok(pass, 'successfully doesnt fail without callback')
        complete()
      }
    })

    test('complete is called', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.js'
        , complete: function () {
            ok(true, 'called complete')
            complete()
          }
      })
    })

    test('invalid JSON sets error on resp object', function (complete) {
      ajax({
          url: '/tests/fixtures/invalidJSON.json'
        , type: 'json'
        , success: function () {
            ok(false, 'success callback fired')
            complete()
          }
        , error: function (resp, msg) {
            ok(
                msg == 'Could not parse JSON in response'
              , 'error callback fired'
            )
            complete()
          }
      })
    })

    test('multiple parallel named JSONP callbacks', 8, function () {
      ajax({
          url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response from call #1')
            ok(
                resp && resp.a == 'a'
              , 'evaluated response from call #1 as JSONP'
            )
          }
      })
      ajax({
          url: '/tests/fixtures/fixtures_jsonp_multi_b.jsonp?callback=reqwest_0'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response from call #2')
            ok(
                resp && resp.b == 'b'
              , 'evaluated response from call #2 as JSONP'
            )
          }
      })
      ajax({
          url: '/tests/fixtures/fixtures_jsonp_multi_c.jsonp?callback=reqwest_0'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response from call #2')
            ok(
                resp && resp.c == 'c'
              , 'evaluated response from call #3 as JSONP'
            )
          }
      })
      ajax({
          url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response from call #2')
            ok(
                resp && resp.a == 'a'
              , 'evaluated response from call #4 as JSONP'
            )
          }
      })
    })

    test('JSONP also supports success promises', function (complete) {
      ajax({
          url: '/tests/none.jsonp?echo'
        , type: 'jsonp'
        , success: function (resp) {
            ok(resp, 'received response in constructor success callback')
          }
      })
        .then(function (resp) {
            ok(resp, 'received response in promise success callback')
            return resp;
        })
        .then(function (resp) {
            ok(resp, 'received response in second promise success callback')
            complete()
        })
    })

    test('JSONP also supports error promises', function (complete) {
      ajax({
          url: '/tests/timeout/'
        , type: 'jsonp'
        , error: function (err) {
            ok(err, 'received error response in constructor error callback')
          }
      })
        .fail(function (err) {
            ok(err, 'received error response in promise error callback')
        })
        .fail(function (err) {
            ok(err, 'received error response in second promise error callback')
            complete()
        })
        .abort()
    })

  })

  if (window.XMLHttpRequest
    && ('withCredentials' in new window.XMLHttpRequest())) {

    sink('Cross-origin Resource Sharing', function (test, ok) {
      test('make request to another origin', 1, function () {
        ajax({
            url: 'http://' + window.location.hostname + ':5678/get-value'
          , type: 'text'
          , method: 'get'
          , crossOrigin: true
          , complete: function (resp) {
              ok(resp.responseText === 'hello', 'request made successfully')
            }
        })
      })

      test('set cookie on other origin', 2, function () {
        ajax({
            url: 'http://' + window.location.hostname + ':5678/set-cookie'
          , type: 'text'
          , method: 'get'
          , crossOrigin: true
          , withCredentials: true
          , before: function (http) {
              ok(
                  http.withCredentials === true
                , 'has set withCredentials on connection object'
              )
            }
          , complete: function (resp) {
              ok(resp.status === 200, 'cookie set successfully')
            }
        })
      })

      test('get cookie from other origin', 1, function () {
        ajax({
              url: 'http://'
                  + window.location.hostname
                  + ':5678/get-cookie-value'
            , type: 'text'
            , method: 'get'
            , crossOrigin: true
            , withCredentials: true
            , complete: function (resp) {
                ok(
                    resp.responseText == 'hello'
                  , 'cookie value retrieved successfully'
                )
              }
        })
      })

    })
  }

  sink('Connection Object', function (test, ok) {

    test('use xhr factory provided in the options', function (complete) {
      var reqwest
      , xhr

      if (typeof XMLHttpRequest !== 'undefined') {
          xhr = new XMLHttpRequest()
      } else if (typeof ActiveXObject !== 'undefined') {
          xhr = new ActiveXObject('Microsoft.XMLHTTP')
      } else {
        ok(false, 'browser not supported')
      }

      reqwest = ajax({
          url: '/tests/fixtures/fixtures.html',
          xhr: function () {
            return xhr
          }
      })

      ok(reqwest.request === xhr, 'uses factory')
      complete()
    })

    test('fallbacks to own xhr factory if falsy is returned', function (complete) {
      var reqwest

      FakeXHR.setup()
      try {
        reqwest = ajax({
            url: '/tests/fixtures/fixtures.html',
            xhr: function () {
              return null
            }
        })

        ok(reqwest.request instanceof FakeXHR, 'fallbacks correctly')
        complete()
      } finally {
        FakeXHR.restore()
      }
    })

    test('setRequestHeaders', function (complete) {
      ajax({
          url: '/tests/fixtures/fixtures.html'
        , data: 'foo=bar&baz=thunk'
        , method: 'post'
        , headers: {
            'Accept': 'application/x-foo'
          }
        , success: function () {
            ok(true, 'can post headers')
            complete()
          }
      })
    })

    test('can inspect http before send', function (complete) {
      var connection = ajax({
          url: '/tests/fixtures/fixtures.js'
        , method: 'post'
        , type: 'js'
        , before: function (http) {
            ok(http.readyState == 1, 'received http connection object')
          }
        , success: function () {
            // Microsoft.XMLHTTP appears not to run this async in IE6&7, it
            // processes the request and triggers success() before ajax() even
            // returns. Perhaps a better solution would be to defer the calls
            // within handleReadyState()
            setTimeout(function () {
              ok(
                  connection.request.readyState == 4
                , 'success callback has readyState of 4'
              )
              complete()
            }, 0)
        }
      })
    })

    test('ajax() encodes array `data`', function (complete) {
      FakeXHR.setup()
      try {
       ajax({
            url: '/tests/fixtures/fixtures.html'
          , method: 'post'
          , data: [
                { name: 'foo', value: 'bar' }
              , { name: 'baz', value: 'thunk' }
            ]
        })
        ok(FakeXHR.last.methodCallCount('send') == 1, 'send called')
        ok(
            FakeXHR.last.methodCallArgs('send', 0).length == 1
          , 'send called with 1 arg'
        )
        ok(
            FakeXHR.last.methodCallArgs('send', 0, 0) == 'foo=bar&baz=thunk'
          , 'send called with encoded array'
        )
        complete()
      } finally {
        FakeXHR.restore()
      }
    })

    test('ajax() encodes hash `data`', function (complete) {
      FakeXHR.setup()
      try {
        ajax({
            url: '/tests/fixtures/fixtures.html'
          , method: 'post'
          , data: { bar: 'foo', thunk: 'baz' }
        })
        ok(FakeXHR.last.methodCallCount('send') == 1, 'send called')
        ok(
            FakeXHR.last.methodCallArgs('send', 0).length == 1
          , 'send called with 1 arg'
        )
        ok(
            FakeXHR.last.methodCallArgs('send', 0, 0) == 'bar=foo&thunk=baz'
          , 'send called with encoded array'
        )
        complete()
      } finally {
        FakeXHR.restore()
      }
    })

    test('ajax() obeys `processData`', function (complete) {
      FakeXHR.setup()
      try {
        var d = { bar: 'foo', thunk: 'baz' }
        ajax({
            url: '/tests/fixtures/fixtures.html'
          , processData: false
          , method: 'post'
          , data: d
        })
        ok(FakeXHR.last.methodCallCount('send') == 1, 'send called')
        ok(
            FakeXHR.last.methodCallArgs('send', 0).length == 1
          , 'send called with 1 arg'
        )
        ok(
            FakeXHR.last.methodCallArgs('send', 0, 0) === d
          , 'send called with exact `data` object'
        )
        complete()
      } finally {
        FakeXHR.restore()
      }
    })

    function testXhrGetUrlAdjustment(url, data, expectedUrl, complete) {
      FakeXHR.setup()
      try {
        ajax({ url: url, data: data })
        ok(FakeXHR.last.methodCallCount('open') == 1, 'open called')
        ok(
            FakeXHR.last.methodCallArgs('open', 0).length == 3
          , 'open called with 3 args'
        )
        ok(
            FakeXHR.last.methodCallArgs('open', 0, 0) == 'GET'
          , 'first arg of open() is "GET"'
        )
        ok(FakeXHR.last.methodCallArgs('open', 0, 1) == expectedUrl
          , 'second arg of open() is URL with query string')
        ok(
            FakeXHR.last.methodCallArgs('open', 0, 2) === true
          , 'third arg of open() is `true`'
        )
        ok(FakeXHR.last.methodCallCount('send') == 1, 'send called')
        ok(
            FakeXHR.last.methodCallArgs('send', 0).length == 1
          , 'send called with 1 arg'
        )
        ok(
            FakeXHR.last.methodCallArgs('send', 0, 0) === null
          , 'send called with null'
        )
        complete()
      } finally {
        FakeXHR.restore()
      }
    }

    test('ajax() appends GET URL with ?`data`', function (complete) {
      testXhrGetUrlAdjustment(
          '/tests/fixtures/fixtures.html'
        , 'bar=foo&thunk=baz'
        , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz'
        , complete
      )
    })

    test('ajax() appends GET URL with ?`data` (serialized object)'
          , function (complete) {

      testXhrGetUrlAdjustment(
          '/tests/fixtures/fixtures.html'
        , { bar: 'foo', thunk: 'baz' }
        , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz'
        , complete
      )
    })

    test('ajax() appends GET URL with &`data` (serialized array)'
          , function (complete) {

      testXhrGetUrlAdjustment(
          '/tests/fixtures/fixtures.html?x=y'
        , [ { name: 'bar', value: 'foo'}, {name: 'thunk', value: 'baz' } ]
        , '/tests/fixtures/fixtures.html?x=y&bar=foo&thunk=baz'
        , complete
      )
    })
  })

  sink('Standard vs compat mode', function (test, ok) {
    function methodMatch(resp, method) {
       return resp && resp.method === method
    }
    function headerMatch(resp, key, expected) {
      return resp && resp.headers && resp.headers[key] === expected
    }
    function queryMatch(resp, key, expected) {
      return resp && resp.query && resp.query[key] === expected
    }

    test('standard mode default', function (complete) {
      ajax({
          url: '/tests/none.json?echo'
        , success: function (resp) {
            ok(methodMatch(resp, 'GET'), 'correct request method (GET)')
            ok(
                headerMatch(
                    resp
                  , 'content-type'
                  , 'application/x-www-form-urlencoded'
                )
              , 'correct Content-Type request header'
            )
            ok(
                headerMatch(resp, 'x-requested-with', 'XMLHttpRequest')
              , 'correct X-Requested-With header'
            )
            ok(
                headerMatch(
                    resp
                  , 'accept'
                  , 'text/javascript, text/html, application/xml, text/xml, */*'
                )
              , 'correct Accept header'
            )
            complete()
          }
      })
    })

    test('standard mode custom content-type', function (complete) {
      ajax({
          url: '/tests/none.json?echo'
        , contentType: 'yapplication/foobar'
        , success: function (resp) {
            ok(methodMatch(resp, 'GET'), 'correct request method (GET)')
            ok(
                headerMatch(resp, 'content-type', 'yapplication/foobar')
              , 'correct Content-Type request header'
            )
            ok(
                headerMatch(resp, 'x-requested-with', 'XMLHttpRequest')
              , 'correct X-Requested-With header'
            )
            ok(
                headerMatch(
                    resp
                  , 'accept'
                  , 'text/javascript, text/html, application/xml, text/xml, */*'
                )
              , 'correct Accept header'
            )
            complete()
          }
      })
    })

    test('standard mode on no content-type', function (complete) {
      ajax({
        url: '/tests/204'
          , success: function (resp) {
            ok(true, 'Nothing blew up.')
          }
        })
    })

    test('compat mode "dataType=json" headers', function (complete) {
      ajax.compat({
          url: '/tests/none.json?echo'
        , dataType: 'json' // should map to 'type'
        , success: function (resp) {
            ok(methodMatch(resp, 'GET'), 'correct request method (GET)')
            ok(
                headerMatch(
                    resp
                  , 'content-type'
                  , 'application/x-www-form-urlencoded'
                )
              , 'correct Content-Type request header'
            )
            ok(
                headerMatch(resp, 'x-requested-with', 'XMLHttpRequest')
              , 'correct X-Requested-With header'
            )
            ok(
                headerMatch(resp, 'accept', 'application/json, text/javascript')
              , 'correct Accept header'
            )
            complete()
          }
      })
    })

    test('compat mode "dataType=json" with "type=post" headers'
        , function (complete) {
      ajax.compat({
          url: '/tests/none.json?echo'
        , type: 'post'
        , dataType: 'json' // should map to 'type'
        , success: function (resp) {
            ok(methodMatch(resp, 'POST'), 'correct request method (POST)')
            ok(
                headerMatch(
                    resp
                  , 'content-type'
                  , 'application/x-www-form-urlencoded'
                )
              , 'correct Content-Type request header'
            )
            ok(
                headerMatch(resp, 'x-requested-with', 'XMLHttpRequest')
              , 'correct X-Requested-With header'
            )
            ok(
                headerMatch(resp, 'accept', 'application/json, text/javascript')
              , 'correct Accept header'
            )
            complete()
          }
      })
    })

    test('compat mode "dataType=json" headers (with additional headers)'
        , function (complete) {

      ajax.compat({
          url: '/tests/none.json?echo'
        , dataType: 'json' // should map to 'type'
          // verify that these are left intact and nothing screwy
          // happens with headers
        , headers: { one: 1, two: 2 }
        , success: function (resp) {
            ok(
                headerMatch(
                    resp
                  , 'content-type'
                  , 'application/x-www-form-urlencoded'
                )
              , 'correct Content-Type request header'
            )
            ok(
                headerMatch(resp, 'x-requested-with', 'XMLHttpRequest')
              , 'correct X-Requested-With header'
            )
            ok(
                headerMatch(resp, 'accept', 'application/json, text/javascript')
              , 'correct Accept header'
            )
            ok(
                headerMatch(resp, 'one', '1') && headerMatch(resp, 'two', '2')
              , 'left additional headers intact'
            )
            complete()
          }
      })
    })

    test('compat mode "dataType=jsonp" query string', function (complete) {
      ajax.compat({
          url: '/tests/none.jsonp?echo'
        , dataType: 'jsonp'
        , jsonp: 'testCallback' // should map to jsonpCallback
        , jsonpCallback: 'foobar' // should map to jsonpCallbackName
        , success: function (resp) {
            ok(
                queryMatch(resp, 'echo', '')
              , 'correct Content-Type request header'
            )
            ok(
                queryMatch(resp, 'testCallback', 'foobar')
              , 'correct X-Requested-With header'
            )
            complete()
          }
      })
    })
  })

  /***************** SERIALIZER TESTS ***********************/

  // define some helpers for the serializer tests that are used often and
  // shared with the ender integration tests

  function createSerializeHelper(ok) {
    var forms = document.forms
      , foo = forms[0].getElementsByTagName('input')[1]
      , bar = forms[0].getElementsByTagName('input')[2]
      , choices = forms[0].getElementsByTagName('select')[0]
      , BIND_ARGS = 'bind'
      , PASS_ARGS = 'pass'

    function reset() {
      forms[1].reset()
    }

    function formElements(formIndex, tagName, elementIndex) {
      return forms[formIndex].getElementsByTagName(tagName)[elementIndex]
    }

    function isArray(a) {
      return Object.prototype.toString.call(a) == '[object Array]'
    }

    function sameValue(value, expected) {
      if (expected == null) {
        return value === null
      } else if (isArray(expected)) {
        if (value.length !== expected.length) return false
        for (var i = 0; i < expected.length; i++) {
          if (value[i] != expected[i]) return false
        }
        return true
      } else return value == expected
    }

    function testInput(input, name, value, str) {
      var sa = ajax.serialize(input, { type: 'array' })
        , sh = ajax.serialize(input, { type: 'map' })
        , av, i

      if (value != null) {
        av = isArray(value) ? value : [ value ]

        ok(
            sa.length == av.length
          ,   'serialize(' + str + ', {type:\'array\'}) returns array '
            + '[{name,value}]'
        )

        for (i = 0; i < av.length; i++) {
          ok(
              name == sa[i].name
            , 'serialize(' + str + ', {type:\'array\'})[' + i + '].name'
          )
          ok(
              av[i] == sa[i].value
            , 'serialize(' + str + ', {type:\'array\'})[' + i + '].value'
          )
        }

        ok(sameValue(sh[name], value), 'serialize(' + str + ', {type:\'map\'})')
      } else {
        // the cases where an element shouldn't show up at all, checkbox not
        // checked for example
        ok(sa.length === 0, 'serialize(' + str + ', {type:\'array\'}) is []')
        ok(
            v.keys(sh).length === 0
          , 'serialize(' + str + ', {type:\'map\'}) is {}'
        )
      }
    }

    function testFormSerialize(method, type) {
      var expected =
            'foo=bar&bar=baz&wha=1&wha=3&who=tawoo&%24escapable+name'
          + '%24=escapeme&choices=two&opinions=world+peace+is+not+real'

      ok(method, 'serialize() bound to context')
      ok(
          (method ? method(forms[0]) : null) == expected
        , 'serialized form (' + type + ')'
      )
    }

    function executeMultiArgumentMethod(method, argType, options) {
      var els = [ foo, bar, choices ]
        , ths = argType === BIND_ARGS ? ender(els) : null
        , args = argType === PASS_ARGS ? els : []

      if (!!options) args.push(options)

      return method.apply(ths, args)
    }

    function testMultiArgumentSerialize(method, type, argType) {
      ok(method, 'serialize() bound in context')
      var result = method ? executeMultiArgumentMethod(method, argType) : null
      ok(
          result == 'foo=bar&bar=baz&choices=two'
        , 'serialized all 3 arguments together'
      )
    }

    function verifyFormSerializeArray(result, type) {
      var expected = [
              { name: 'foo', value: 'bar' }
            , { name: 'bar', value: 'baz' }
            , { name: 'wha', value: 1 }
            , { name: 'wha', value: 3 }
            , { name: 'who', value: 'tawoo' }
            , { name: '$escapable name$', value: 'escapeme' }
            , { name: 'choices', value: 'two' }
            , { name: 'opinions', value: 'world peace is not real' }
          ]
        , i

    for (i = 0; i < expected.length; i++) {
        ok(v.some(result, function (v) {
          return v.name == expected[i].name && v.value == expected[i].value
        }), 'serialized ' + expected[i].name + ' (' + type + ')')
      }
    }

    function testFormSerializeArray(method, type) {
      ok(method, 'serialize(..., {type:\'array\'}) bound to context')

      var result = method ? method(forms[0], { type: 'array' }) : []
      if (!result) result = []

      verifyFormSerializeArray(result, type)
    }

    function testMultiArgumentSerializeArray(method, type, argType) {
        ok(method, 'serialize(..., {type:\'array\'}) bound to context')
        var result = method
          ? executeMultiArgumentMethod(method, argType, { type: 'array' })
          : []

        if (!result) result = []

        ok(result.length == 3, 'serialized as array of 3')
        ok(
            result.length == 3
            && result[0].name == 'foo'
            && result[0].value == 'bar'
          , 'serialized first element (' + type + ')'
        )
        ok(
            result.length == 3
            && result[1].name == 'bar'
            && result[1].value == 'baz'
          , 'serialized second element (' + type + ')'
        )
        ok(
            result.length == 3
            && result[2].name == 'choices'
            && result[2].value == 'two'
          , 'serialized third element (' + type + ')'
        )
      }

    function testFormSerializeHash(method, type) {
      var expected = {
              foo: 'bar'
            , bar: 'baz'
            , wha: [ '1', '3' ]
            , who: 'tawoo'
            , '$escapable name$': 'escapeme'
            , choices: 'two'
            , opinions: 'world peace is not real'
          }
        , result

      ok(method, 'serialize({type:\'map\'}) bound to context')

      result = method ? method(forms[0], { type: 'map' }) : {}
      if (!result) result = {}

      ok(
          v.keys(expected).length === v.keys(result).length
        , 'same number of keys (' + type + ')'
      )

      v.each(v.keys(expected), function (k) {
        ok(
            sameValue(expected[k], result[k])
          , 'same value for ' + k + ' (' + type + ')'
        )
      })
    }

    function testMultiArgumentSerializeHash(method, type, argType) {
      ok(method, 'serialize({type:\'map\'}) bound to context')
      var result = method
        ? executeMultiArgumentMethod(method, argType, { type: 'map' })
        : {}
      if (!result) result = {}
      ok(result.foo == 'bar', 'serialized first element (' + type + ')')
      ok(result.bar == 'baz', 'serialized second element (' + type + ')')
      ok(result.choices == 'two', 'serialized third element (' + type + ')')
    }

    return {
      reset: reset
      , formElements: formElements
      , testInput: testInput
      , testFormSerialize: testFormSerialize
      , testMultiArgumentSerialize: testMultiArgumentSerialize
      , testFormSerializeArray: testFormSerializeArray
      , verifyFormSerializeArray: verifyFormSerializeArray
      , testMultiArgumentSerializeArray: testMultiArgumentSerializeArray
      , testFormSerializeHash: testFormSerializeHash
      , testMultiArgumentSerializeHash: testMultiArgumentSerializeHash
    }
  }

  sink('Serializing', function (test, ok) {

    /*
     * Serialize forms according to spec.
     *  * reqwest.serialize(ele[, ele...]) returns a query string style
     *    serialization
     *  * reqwest.serialize(ele[, ele...], {type:'array'}) returns a
     *    [ { name: 'name', value: 'value'}, ... ] style serialization,
     *    compatible with jQuery.serializeArray()
     *  * reqwest.serialize(ele[, ele...], {type:\'map\'}) returns a
     *    { 'name': 'value', ... } style serialization, compatible with
     *    Prototype Form.serializeElements({hash:true})
     * Some tests based on spec notes here:
     *    http://malsup.com/jquery/form/comp/test.html
     */

    var sHelper = createSerializeHelper(ok)
    sHelper.reset()

    test('correctly serialize textarea', function (complete) {
      var textarea = sHelper.formElements(1, 'textarea', 0)
        , sa

      // the texarea has 2 different newline styles, should come out as
      // normalized CRLF as per forms spec
      ok(
          'T3=%3F%0D%0AA+B%0D%0AZ' == ajax.serialize(textarea)
        , 'serialize(textarea)'
      )
      sa = ajax.serialize(textarea, { type: 'array' })
      ok(sa.length == 1, 'serialize(textarea, {type:\'array\'}) returns array')
      sa = sa[0]
      ok('T3' == sa.name, 'serialize(textarea, {type:\'array\'}).name')
      ok(
          '?\r\nA B\r\nZ' == sa.value
        , 'serialize(textarea, {type:\'array\'}).value'
      )
      ok(
          '?\r\nA B\r\nZ' == ajax.serialize(textarea, { type: 'map' }).T3
        , 'serialize(textarea, {type:\'map\'})'
      )
      complete()
    })

    test('correctly serialize input[type=hidden]', function (complete) {
      sHelper.testInput(
          sHelper.formElements(1, 'input', 0)
        , 'H1'
        , 'x'
        , 'hidden'
      )
      sHelper.testInput(
          sHelper.formElements(1, 'input', 1)
        , 'H2'
        , ''
        , 'hidden[no value]'
      )
      complete()
    })

    test('correctly serialize input[type=password]', function (complete) {
      sHelper.testInput(
          sHelper.formElements(1, 'input', 2)
        , 'PWD1'
        , 'xyz'
        , 'password'
      )
      sHelper.testInput(
          sHelper.formElements(1, 'input', 3)
        , 'PWD2'
        , ''
        , 'password[no value]'
      )
      complete()
    })

    test('correctly serialize input[type=text]', function (complete) {
      sHelper.testInput(
          sHelper.formElements(1, 'input', 4)
        , 'T1'
        , ''
        , 'text[no value]'
      )
      sHelper.testInput(
          sHelper.formElements(1, 'input', 5)
        , 'T2'
        , 'YES'
        , 'text[readonly]'
      )
      sHelper.testInput(
          sHelper.formElements(1, 'input', 10)
        , 'My Name'
        , 'me'
        , 'text[space name]'
      )
      complete()
    })

    test('correctly serialize input[type=checkbox]', function (complete) {
      var cb1 = sHelper.formElements(1, 'input', 6)
        , cb2 = sHelper.formElements(1, 'input', 7)
      sHelper.testInput(cb1, 'C1', null, 'checkbox[not checked]')
      cb1.checked = true
      sHelper.testInput(cb1, 'C1', '1', 'checkbox[checked]')
      // special case here, checkbox with no value='' should give you 'on'
      // for cb.value
      sHelper.testInput(cb2, 'C2', null, 'checkbox[no value, not checked]')
      cb2.checked = true
      sHelper.testInput(cb2, 'C2', 'on', 'checkbox[no value, checked]')
      complete()
    })

    test('correctly serialize input[type=radio]', function (complete) {
      var r1 = sHelper.formElements(1, 'input', 8)
        , r2 = sHelper.formElements(1, 'input', 9)
      sHelper.testInput(r1, 'R1', null, 'radio[not checked]')
      r1.checked = true
      sHelper.testInput(r1, 'R1', '1', 'radio[not checked]')
      sHelper.testInput(r2, 'R1', null, 'radio[no value, not checked]')
      r2.checked = true
      sHelper.testInput(r2, 'R1', '', 'radio[no value, checked]')
      complete()
    })

    test('correctly serialize input[type=reset]', function (complete) {
      sHelper.testInput(
          sHelper.formElements(1, 'input', 11)
        , 'rst'
        , null
        , 'reset'
      )
      complete()
    })

    test('correctly serialize input[type=file]', function (complete) {
      sHelper.testInput(
          sHelper.formElements(1, 'input', 12)
        , 'file'
        , null
        , 'file'
      )
      complete()
    })

    test('correctly serialize input[type=submit]', function (complete) {
      // we're only supposed to serialize a submit button if it was clicked to
      // perform this serialization:
      // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
      // but we'll pretend to be oblivious to this part of the spec...
      sHelper.testInput(
          sHelper.formElements(1, 'input', 13)
        , 'sub'
        , 'NO'
        , 'submit'
      )
      complete()
    })

    test('correctly serialize select with no options', function (complete) {
      var select = sHelper.formElements(1, 'select', 0)
      sHelper.testInput(select, 'S1', null, 'select, no options')
      complete()
    })

    test('correctly serialize select with values', function (complete) {
      var select = sHelper.formElements(1, 'select', 1)
      sHelper.testInput(select, 'S2', 'abc', 'select option 1 (default)')
      select.selectedIndex = 1
      sHelper.testInput(select, 'S2', 'def', 'select option 2')
      select.selectedIndex = 6
      sHelper.testInput(select, 'S2', 'disco stu', 'select option 7')
      // a special case where we have <option value=''>X</option>, should
      // return '' rather than X which will happen if you just do a simple
      // `value=(option.value||option.text)`
      select.selectedIndex = 9
      sHelper.testInput(
          select
        , 'S2'
        , ''
        , 'select option 9, value="" should yield ""'
      )
      select.selectedIndex = -1
      sHelper.testInput(select, 'S2', null, 'select, unselected')
      complete()
    })

    test('correctly serialize select without explicit values'
        , function (complete) {

      var select = sHelper.formElements(1, 'select', 2)
      sHelper.testInput(select, 'S3', 'ABC', 'select option 1 (default)')
      select.selectedIndex = 1
      sHelper.testInput(select, 'S3', 'DEF', 'select option 2')
      select.selectedIndex = 6
      sHelper.testInput(select, 'S3', 'DISCO STU!', 'select option 7')
      select.selectedIndex = -1
      sHelper.testInput(select, 'S3', null, 'select, unselected')
      complete()
    })

    test('correctly serialize select multiple', function (complete) {
      var select = sHelper.formElements(1, 'select', 3)
      sHelper.testInput(select, 'S4', null, 'select, unselected (default)')
      select.options[1].selected = true
      sHelper.testInput(select, 'S4', '2', 'select option 2')
      select.options[3].selected = true
      sHelper.testInput(select, 'S4', [ '2', '4' ], 'select options 2 & 4')
      select.options[8].selected = true
      sHelper.testInput(
          select
        , 'S4'
        , [ '2', '4', 'Disco Stu!' ]
        , 'select option 2 & 4 & 9'
      )
      select.options[3].selected = false
      sHelper.testInput(
          select
        , 'S4'
        , [ '2', 'Disco Stu!' ]
        , 'select option 2 & 9'
      )
      select.options[1].selected = false
      select.options[8].selected = false
      sHelper.testInput(select, 'S4', null, 'select, all unselected')
      complete()
     })

    test('correctly serialize options', function (complete) {
      var option = sHelper.formElements(1, 'select', 1).options[6]
      sHelper.testInput(
          option
        , '-'
        , null
        , 'just option (with value), shouldn\'t serialize'
      )

      option = sHelper.formElements(1, 'select', 2).options[6]
      sHelper.testInput(
          option
        , '-'
        , null
        , 'option (without value), shouldn\'t serialize'
      )

      complete()
    })

    test('correctly serialize disabled', function (complete) {
      var input = sHelper.formElements(1, 'input', 14)
        , select

      sHelper.testInput(input, 'D1', null, 'disabled text input')
      input = sHelper.formElements(1, 'input', 15)
      sHelper.testInput(input, 'D2', null, 'disabled checkbox')
      input = sHelper.formElements(1, 'input', 16)
      sHelper.testInput(input, 'D3', null, 'disabled radio')

      select = sHelper.formElements(1, 'select', 4)
      sHelper.testInput(select, 'D4', null, 'disabled select')
      select = sHelper.formElements(1, 'select', 3)
      sHelper.testInput(select, 'D5', null, 'disabled select option')
      select = sHelper.formElements(1, 'select', 6)
      sHelper.testInput(select, 'D6', null, 'disabled multi select')
      select = sHelper.formElements(1, 'select', 7)
      sHelper.testInput(select, 'D7', null, 'disabled multi select option')
      complete()
    })

    test('serialize(form)', function (complete) {
      sHelper.testFormSerialize(ajax.serialize, 'direct')
      complete()
    })

    test('serialize(form, {type:\'array\'})', function (complete) {
      sHelper.testFormSerializeArray(ajax.serialize, 'direct')
      complete()
    })

    test('serialize(form, {type:\'map\'})', function (complete) {
      sHelper.testFormSerializeHash(ajax.serialize, 'direct')
      complete()
    })

    // mainly for Ender integration, so you can do this:
    // $('input[name=T2],input[name=who],input[name=wha]').serialize()
    test('serialize(element, element, element...)', function (complete) {
      sHelper.testMultiArgumentSerialize(ajax.serialize, 'direct', PASS_ARGS)
      complete()
    })

    // mainly for Ender integration, so you can do this:
    // $('input[name=T2],input[name=who],input[name=wha]')
    //    .serialize({type:'array'})
    test('serialize(element, element, element..., {type:\'array\'})'
        , function (complete) {
      sHelper.testMultiArgumentSerializeArray(
          ajax.serialize
        , 'direct'
        , PASS_ARGS
      )
      complete()
    })

    // mainly for Ender integration, so you can do this:
    // $('input[name=T2],input[name=who],input[name=wha]')
    //     .serialize({type:'map'})
    test('serialize(element, element, element...)', function (complete) {
      sHelper.testMultiArgumentSerializeHash(
          ajax.serialize
        , 'direct'
        , PASS_ARGS
      )
      complete()
    })

    test('toQueryString([{ name: x, value: y }, ... ]) name/value array'
        , function (complete) {

      var arr = [
          { name: 'foo', value: 'bar' }
        , { name: 'baz', value: '' }
        , { name: 'x', value: -20 }
        , { name: 'x', value: 20 }
      ]

      ok(ajax.toQueryString(arr) == 'foo=bar&baz=&x=-20&x=20', 'simple')

      arr = [
          { name: 'dotted.name.intact', value: '$@%' }
        , { name: '$ $', value: 20 }
        , { name: 'leave britney alone', value: 'waa haa haa' }
      ]

      ok(
          ajax.toQueryString(arr) ==
              'dotted.name.intact=%24%40%25&%24+%24=20'
            + '&leave+britney+alone=waa+haa+haa'
        , 'escaping required'
      )

      complete()
    })

    test('toQueryString({name: value,...} complex object', function (complete) {
      var obj = { 'foo': 'bar', 'baz': '', 'x': -20 }

      ok(ajax.toQueryString(obj) == 'foo=bar&baz=&x=-20', 'simple')

      obj = {
          'dotted.name.intact': '$@%'
        , '$ $': 20
        , 'leave britney alone': 'waa haa haa'
      }
      ok(
          ajax.toQueryString(obj) ==
              'dotted.name.intact=%24%40%25&%24+%24=20'
            + '&leave+britney+alone=waa+haa+haa'
        , 'escaping required'
      )

      complete()
    })

    test('toQueryString({name: [ value1, value2 ...],...} object with arrays', function (complete) {
      var obj = { 'foo': 'bar', 'baz': [ '', '', 'boo!' ], 'x': [ -20, 2.2, 20 ] }
      ok(ajax.toQueryString(obj, true) == "foo=bar&baz=&baz=&baz=boo!&x=-20&x=2.2&x=20", "object with arrays")
      ok(ajax.toQueryString(obj) == "foo=bar&baz%5B%5D=&baz%5B%5D=&baz%5B%5D=boo!&x%5B%5D=-20&x%5B%5D=2.2&x%5B%5D=20")
      complete()
    })

    test('toQueryString({name: { nestedName: value },...} object with objects', function(complete) {
      var obj = { 'foo': { 'bar': 'baz' }, 'x': [ { 'bar': 'baz' }, { 'boo': 'hiss' } ] }
      ok(ajax.toQueryString(obj) == "foo%5Bbar%5D=baz&x%5B0%5D%5Bbar%5D=baz&x%5B1%5D%5Bboo%5D=hiss", "object with objects")
      complete()
    })

  })

  sink('Ender Integration', function (test, ok) {
    var sHelper = createSerializeHelper(ok)
    sHelper.reset()

    test('$.ajax alias for reqwest, not bound to boosh', 1, function () {
      ok(ender.ajax === ajax, '$.ajax is reqwest')
    })

    // sHelper.test that you can do $.serialize(form)
    test('$.serialize(form)', function (complete) {
      sHelper.testFormSerialize(ender.serialize, 'ender')
      complete()
    })

    // sHelper.test that you can do $.serialize(form)
    test('$.serialize(form, {type:\'array\'})', function (complete) {
      sHelper.testFormSerializeArray(ender.serialize, 'ender')
      complete()
    })

    // sHelper.test that you can do $.serialize(form)
    test('$.serialize(form, {type:\'map\'})', function (complete) {
      sHelper.testFormSerializeHash(ender.serialize, 'ender')
      complete()
    })

    // sHelper.test that you can do $.serializeObject(form)
    test('$.serializeArray(...) alias for serialize(..., {type:\'map\'}'
        , function (complete) {
      sHelper.verifyFormSerializeArray(
          ender.serializeArray(document.forms[0])
        , 'ender'
      )
      complete()
    })

    test('$.serialize(element, element, element...)', function (complete) {
      sHelper.testMultiArgumentSerialize(ender.serialize, 'ender', PASS_ARGS)
      complete()
    })

    test('$.serialize(element, element, element..., {type:\'array\'})'
        , function (complete) {
      sHelper.testMultiArgumentSerializeArray(
          ender.serialize
        , 'ender'
        , PASS_ARGS
      )
      complete()
    })

    test('$.serialize(element, element, element..., {type:\'map\'})'
        , function (complete) {
      sHelper.testMultiArgumentSerializeHash(
          ender.serialize
        , 'ender'
        , PASS_ARGS
      )
      complete()
    })

    test('$(element, element, element...).serialize()', function (complete) {
      sHelper.testMultiArgumentSerialize(ender.fn.serialize, 'ender', BIND_ARGS)
      complete()
    })

    test('$(element, element, element...).serialize({type:\'array\'})'
        , function (complete) {
      sHelper.testMultiArgumentSerializeArray(
          ender.fn.serialize
        , 'ender'
        , BIND_ARGS
      )
      complete()
    })

    test('$(element, element, element...).serialize({type:\'map\'})'
        , function (complete) {
      sHelper.testMultiArgumentSerializeHash(
          ender.fn.serialize
        , 'ender'
        , BIND_ARGS
      )
      complete()
    })

    test('$.toQueryString alias for reqwest.toQueryString, not bound to boosh'
          , function (complete) {
      ok(
          ender.toQueryString === ajax.toQueryString
        , '$.toQueryString is reqwest.toQueryString'
      )
      complete()
    })
  })


  /**
   * Promise tests for `then` `fail` and `always`
   */
  sink('Promises', function (test, ok) {

    test('always callback is called', function (complete) {
      ajax({
        url: '/tests/fixtures/fixtures.js'
      })
        .always(function () {
          ok(true, 'called complete')
          complete()
        })
    })

    test('success and error handlers are called', 3, function () {
      ajax({
          url: '/tests/fixtures/invalidJSON.json'
        , type: 'json'
      })
        .then(
            function () {
              ok(false, 'success callback fired')
            }
          , function (resp, msg) {
              ok(
                  msg == 'Could not parse JSON in response'
                , 'error callback fired'
              )
            }
        )

      ajax({
          url: '/tests/fixtures/invalidJSON.json'
        , type: 'json'
      })
        .fail(function (resp, msg) {
          ok(msg == 'Could not parse JSON in response', 'fail callback fired')
        })

      ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
      })
        .then(
            function () {
              ok(true, 'success callback fired')
            }
          , function () {
              ok(false, 'error callback fired')
            }
        )
    })

    test('then is chainable', 2, function () {
      ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
      })
        .then(
            function (resp) {
              ok(true, 'first success callback fired')
              return 'new value';
            }
        )
        .then(
            function (resp) {
              ok(resp === 'new value', 'second success callback fired')
            }
        )
    })

    test('success does not chain with then', 2, function () {
      ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
        , success: function() {
          ok(true, 'success callback fired')
          return 'some independent value';
        }
      })
        .then(
            function (resp) {
              ok(
                resp && resp !== 'some independent value'
                , 'then callback fired'
              )
            }
        )
    })

    test('then & always handlers can be added after a response is received'
          , 2
          , function () {

      var a = ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
      })
        .always(function () {
          setTimeout(function () {
            a.then(
                  function () {
                    ok(true, 'success callback called')
                  }
                , function () {
                    ok(false, 'error callback called')
                  }
              ).always(function () {
                ok(true, 'complete callback called')
              })
          }, 1)
        })
    })

    test('then is chainable after a response is received'
          , 2
          , function () {

      var a = ajax({
          url: '/tests/fixtures/fixtures.json'
        , type: 'json'
      })
        .always(function () {
          setTimeout(function () {
            a.then(function () {
              ok(true, 'first success callback called')
              return 'new value';
            }).then(function (resp) {
              ok(resp === 'new value', 'second success callback called')
            })
          }, 1)
        })
    })

    test('failure handlers can be added after a response is received'
        , function (complete) {

      var a = ajax({
          url: '/tests/fixtures/invalidJSON.json'
        , type: 'json'
      })
        .always(function () {
          setTimeout(function () {
            a
              .fail(function () {
                ok(true, 'fail callback called')
                complete()
              })
          }, 1)
        })
    })

    test('.then success and fail are optional parameters', 1, function () {
      try {
        ajax({
            url: '/tests/fixtures/invalidJSON.json'
          , type: 'json'
        })
          .then()
      } catch (ex) {
        ok(false, '.then() parameters should be optional')
      } finally {
        ok(true, 'passed .then() optional parameters')
      }
    })

  })



  sink('Timeout', function (test, ok) {
    test('xmlHttpRequest', function (complete) {
      var ts = +new Date()
      ajax({
          url: '/tests/timeout'
        , type: 'json'
        , timeout: 250
        , error: function (err, msg) {
            ok(err, 'received error response')
            try {
              ok(err && err.status === 0, 'correctly caught timeout')
              ok(msg && msg === 'Request is aborted: timeout', 'timeout message received')
            } catch (e) {
              ok(true, 'IE is a troll')
            }
            var tt = Math.abs(+new Date() - ts)
            ok(
                tt > 200 && tt < 300
              , 'timeout close enough to 250 (' + tt + ')'
            )
            complete()
          }
      })
    })

    test('jsonpRequest', function (complete) {
      var ts = +new Date()
      ajax({
          url: '/tests/timeout'
        , type: 'jsonp'
        , timeout: 250
        , error: function (err) {
            ok(err, 'received error response')
            var tt = Math.abs(+new Date() - ts)
            ok(
                tt > 200 && tt < 300
              , 'timeout close enough to 250 (' + tt + ')'
            )
            complete()
          }
      })
    })
  })

  start()

}(reqwest))

Added cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
/*!
 * Vue.js v2.2.0
 * (c) 2014-2017 Evan You
 * Released under the MIT License.
 */
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
	typeof define === 'function' && define.amd ? define(factory) :
	(global.Vue = factory());
}(this, (function () { 'use strict';

/*  */

/**
 * Convert a value to a string that is actually rendered.
 */
function _toString (val) {
  return val == null
    ? ''
    : typeof val === 'object'
      ? JSON.stringify(val, null, 2)
      : String(val)
}

/**
 * Convert a input value to a number for persistence.
 * If the conversion fails, return original string.
 */
function toNumber (val) {
  var n = parseFloat(val);
  return isNaN(n) ? val : n
}

/**
 * Make a map and return a function for checking if a key
 * is in that map.
 */
function makeMap (
  str,
  expectsLowerCase
) {
  var map = Object.create(null);
  var list = str.split(',');
  for (var i = 0; i < list.length; i++) {
    map[list[i]] = true;
  }
  return expectsLowerCase
    ? function (val) { return map[val.toLowerCase()]; }
    : function (val) { return map[val]; }
}

/**
 * Check if a tag is a built-in tag.
 */
var isBuiltInTag = makeMap('slot,component', true);

/**
 * Remove an item from an array
 */
function remove (arr, item) {
  if (arr.length) {
    var index = arr.indexOf(item);
    if (index > -1) {
      return arr.splice(index, 1)
    }
  }
}

/**
 * Check whether the object has the property.
 */
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
  return hasOwnProperty.call(obj, key)
}

/**
 * Check if value is primitive
 */
function isPrimitive (value) {
  return typeof value === 'string' || typeof value === 'number'
}

/**
 * Create a cached version of a pure function.
 */
function cached (fn) {
  var cache = Object.create(null);
  return (function cachedFn (str) {
    var hit = cache[str];
    return hit || (cache[str] = fn(str))
  })
}

/**
 * Camelize a hyphen-delimited string.
 */
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
  return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});

/**
 * Capitalize a string.
 */
var capitalize = cached(function (str) {
  return str.charAt(0).toUpperCase() + str.slice(1)
});

/**
 * Hyphenate a camelCase string.
 */
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
  return str
    .replace(hyphenateRE, '$1-$2')
    .replace(hyphenateRE, '$1-$2')
    .toLowerCase()
});

/**
 * Simple bind, faster than native
 */
function bind (fn, ctx) {
  function boundFn (a) {
    var l = arguments.length;
    return l
      ? l > 1
        ? fn.apply(ctx, arguments)
        : fn.call(ctx, a)
      : fn.call(ctx)
  }
  // record original fn length
  boundFn._length = fn.length;
  return boundFn
}

/**
 * Convert an Array-like object to a real Array.
 */
function toArray (list, start) {
  start = start || 0;
  var i = list.length - start;
  var ret = new Array(i);
  while (i--) {
    ret[i] = list[i + start];
  }
  return ret
}

/**
 * Mix properties into target object.
 */
function extend (to, _from) {
  for (var key in _from) {
    to[key] = _from[key];
  }
  return to
}

/**
 * Quick object check - this is primarily used to tell
 * Objects from primitive values when we know the value
 * is a JSON-compliant type.
 */
function isObject (obj) {
  return obj !== null && typeof obj === 'object'
}

/**
 * Strict object type check. Only returns true
 * for plain JavaScript objects.
 */
var toString = Object.prototype.toString;
var OBJECT_STRING = '[object Object]';
function isPlainObject (obj) {
  return toString.call(obj) === OBJECT_STRING
}

/**
 * Merge an Array of Objects into a single Object.
 */
function toObject (arr) {
  var res = {};
  for (var i = 0; i < arr.length; i++) {
    if (arr[i]) {
      extend(res, arr[i]);
    }
  }
  return res
}

/**
 * Perform no operation.
 */
function noop () {}

/**
 * Always return false.
 */
var no = function () { return false; };

/**
 * Return same value
 */
var identity = function (_) { return _; };

/**
 * Generate a static keys string from compiler modules.
 */
function genStaticKeys (modules) {
  return modules.reduce(function (keys, m) {
    return keys.concat(m.staticKeys || [])
  }, []).join(',')
}

/**
 * Check if two values are loosely equal - that is,
 * if they are plain objects, do they have the same shape?
 */
function looseEqual (a, b) {
  var isObjectA = isObject(a);
  var isObjectB = isObject(b);
  if (isObjectA && isObjectB) {
    return JSON.stringify(a) === JSON.stringify(b)
  } else if (!isObjectA && !isObjectB) {
    return String(a) === String(b)
  } else {
    return false
  }
}

function looseIndexOf (arr, val) {
  for (var i = 0; i < arr.length; i++) {
    if (looseEqual(arr[i], val)) { return i }
  }
  return -1
}

/**
 * Ensure a function is called only once.
 */
function once (fn) {
  var called = false;
  return function () {
    if (!called) {
      called = true;
      fn();
    }
  }
}

/*  */

var config = {
  /**
   * Option merge strategies (used in core/util/options)
   */
  optionMergeStrategies: Object.create(null),

  /**
   * Whether to suppress warnings.
   */
  silent: false,

  /**
   * Show production mode tip message on boot?
   */
  productionTip: "development" !== 'production',

  /**
   * Whether to enable devtools
   */
  devtools: "development" !== 'production',

  /**
   * Whether to record perf
   */
  performance: "development" !== 'production',

  /**
   * Error handler for watcher errors
   */
  errorHandler: null,

  /**
   * Ignore certain custom elements
   */
  ignoredElements: [],

  /**
   * Custom user key aliases for v-on
   */
  keyCodes: Object.create(null),

  /**
   * Check if a tag is reserved so that it cannot be registered as a
   * component. This is platform-dependent and may be overwritten.
   */
  isReservedTag: no,

  /**
   * Check if a tag is an unknown element.
   * Platform-dependent.
   */
  isUnknownElement: no,

  /**
   * Get the namespace of an element
   */
  getTagNamespace: noop,

  /**
   * Parse the real tag name for the specific platform.
   */
  parsePlatformTagName: identity,

  /**
   * Check if an attribute must be bound using property, e.g. value
   * Platform-dependent.
   */
  mustUseProp: no,

  /**
   * List of asset types that a component can own.
   */
  _assetTypes: [
    'component',
    'directive',
    'filter'
  ],

  /**
   * List of lifecycle hooks.
   */
  _lifecycleHooks: [
    'beforeCreate',
    'created',
    'beforeMount',
    'mounted',
    'beforeUpdate',
    'updated',
    'beforeDestroy',
    'destroyed',
    'activated',
    'deactivated'
  ],

  /**
   * Max circular updates allowed in a scheduler flush cycle.
   */
  _maxUpdateCount: 100
};

/*  */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};

// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;

// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
  if (_isServer === undefined) {
    /* istanbul ignore if */
    if (!inBrowser && typeof global !== 'undefined') {
      // detect presence of vue-server-renderer and avoid
      // Webpack shimming the process
      _isServer = global['process'].env.VUE_ENV === 'server';
    } else {
      _isServer = false;
    }
  }
  return _isServer
};

// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;

/* istanbul ignore next */
function isNative (Ctor) {
  return /native code/.test(Ctor.toString())
}

var hasSymbol =
  typeof Symbol !== 'undefined' && isNative(Symbol) &&
  typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);

/**
 * Defer a task to execute it asynchronously.
 */
var nextTick = (function () {
  var callbacks = [];
  var pending = false;
  var timerFunc;

  function nextTickHandler () {
    pending = false;
    var copies = callbacks.slice(0);
    callbacks.length = 0;
    for (var i = 0; i < copies.length; i++) {
      copies[i]();
    }
  }

  // the nextTick behavior leverages the microtask queue, which can be accessed
  // via either native Promise.then or MutationObserver.
  // MutationObserver has wider support, however it is seriously bugged in
  // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  // completely stops working after triggering a few times... so, if native
  // Promise is available, we will use it:
  /* istanbul ignore if */
  if (typeof Promise !== 'undefined' && isNative(Promise)) {
    var p = Promise.resolve();
    var logError = function (err) { console.error(err); };
    timerFunc = function () {
      p.then(nextTickHandler).catch(logError);
      // in problematic UIWebViews, Promise.then doesn't completely break, but
      // it can get stuck in a weird state where callbacks are pushed into the
      // microtask queue but the queue isn't being flushed, until the browser
      // needs to do some other work, e.g. handle a timer. Therefore we can
      // "force" the microtask queue to be flushed by adding an empty timer.
      if (isIOS) { setTimeout(noop); }
    };
  } else if (typeof MutationObserver !== 'undefined' && (
    isNative(MutationObserver) ||
    // PhantomJS and iOS 7.x
    MutationObserver.toString() === '[object MutationObserverConstructor]'
  )) {
    // use MutationObserver where native Promise is not available,
    // e.g. PhantomJS IE11, iOS7, Android 4.4
    var counter = 1;
    var observer = new MutationObserver(nextTickHandler);
    var textNode = document.createTextNode(String(counter));
    observer.observe(textNode, {
      characterData: true
    });
    timerFunc = function () {
      counter = (counter + 1) % 2;
      textNode.data = String(counter);
    };
  } else {
    // fallback to setTimeout
    /* istanbul ignore next */
    timerFunc = function () {
      setTimeout(nextTickHandler, 0);
    };
  }

  return function queueNextTick (cb, ctx) {
    var _resolve;
    callbacks.push(function () {
      if (cb) { cb.call(ctx); }
      if (_resolve) { _resolve(ctx); }
    });
    if (!pending) {
      pending = true;
      timerFunc();
    }
    if (!cb && typeof Promise !== 'undefined') {
      return new Promise(function (resolve) {
        _resolve = resolve;
      })
    }
  }
})();

var _Set;
/* istanbul ignore if */
if (typeof Set !== 'undefined' && isNative(Set)) {
  // use native Set when available.
  _Set = Set;
} else {
  // a non-standard Set polyfill that only works with primitive keys.
  _Set = (function () {
    function Set () {
      this.set = Object.create(null);
    }
    Set.prototype.has = function has (key) {
      return this.set[key] === true
    };
    Set.prototype.add = function add (key) {
      this.set[key] = true;
    };
    Set.prototype.clear = function clear () {
      this.set = Object.create(null);
    };

    return Set;
  }());
}

var perf;

{
  perf = inBrowser && window.performance;
  if (perf && (!perf.mark || !perf.measure)) {
    perf = undefined;
  }
}

/*  */

var emptyObject = Object.freeze({});

/**
 * Check if a string starts with $ or _
 */
function isReserved (str) {
  var c = (str + '').charCodeAt(0);
  return c === 0x24 || c === 0x5F
}

/**
 * Define a property.
 */
function def (obj, key, val, enumerable) {
  Object.defineProperty(obj, key, {
    value: val,
    enumerable: !!enumerable,
    writable: true,
    configurable: true
  });
}

/**
 * Parse simple path.
 */
var bailRE = /[^\w.$]/;
function parsePath (path) {
  if (bailRE.test(path)) {
    return
  } else {
    var segments = path.split('.');
    return function (obj) {
      for (var i = 0; i < segments.length; i++) {
        if (!obj) { return }
        obj = obj[segments[i]];
      }
      return obj
    }
  }
}

var warn = noop;
var tip = noop;
var formatComponentName;

{
  var hasConsole = typeof console !== 'undefined';
  var classifyRE = /(?:^|[-_])(\w)/g;
  var classify = function (str) { return str
    .replace(classifyRE, function (c) { return c.toUpperCase(); })
    .replace(/[-_]/g, ''); };

  warn = function (msg, vm) {
    if (hasConsole && (!config.silent)) {
      console.error("[Vue warn]: " + msg + " " + (
        vm ? formatLocation(formatComponentName(vm)) : ''
      ));
    }
  };

  tip = function (msg, vm) {
    if (hasConsole && (!config.silent)) {
      console.warn("[Vue tip]: " + msg + " " + (
        vm ? formatLocation(formatComponentName(vm)) : ''
      ));
    }
  };

  formatComponentName = function (vm, includeFile) {
    if (vm.$root === vm) {
      return '<Root>'
    }
    var name = vm._isVue
      ? vm.$options.name || vm.$options._componentTag
      : vm.name;

    var file = vm._isVue && vm.$options.__file;
    if (!name && file) {
      var match = file.match(/([^/\\]+)\.vue$/);
      name = match && match[1];
    }

    return (
      (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
      (file && includeFile !== false ? (" at " + file) : '')
    )
  };

  var formatLocation = function (str) {
    if (str === "<Anonymous>") {
      str += " - use the \"name\" option for better debugging messages.";
    }
    return ("\n(found in " + str + ")")
  };
}

/*  */


var uid$1 = 0;

/**
 * A dep is an observable that can have multiple
 * directives subscribing to it.
 */
var Dep = function Dep () {
  this.id = uid$1++;
  this.subs = [];
};

Dep.prototype.addSub = function addSub (sub) {
  this.subs.push(sub);
};

Dep.prototype.removeSub = function removeSub (sub) {
  remove(this.subs, sub);
};

Dep.prototype.depend = function depend () {
  if (Dep.target) {
    Dep.target.addDep(this);
  }
};

Dep.prototype.notify = function notify () {
  // stablize the subscriber list first
  var subs = this.subs.slice();
  for (var i = 0, l = subs.length; i < l; i++) {
    subs[i].update();
  }
};

// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];

function pushTarget (_target) {
  if (Dep.target) { targetStack.push(Dep.target); }
  Dep.target = _target;
}

function popTarget () {
  Dep.target = targetStack.pop();
}

/*
 * not type checking this file because flow doesn't play well with
 * dynamically accessing methods on Array prototype
 */

var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
  'push',
  'pop',
  'shift',
  'unshift',
  'splice',
  'sort',
  'reverse'
]
.forEach(function (method) {
  // cache original method
  var original = arrayProto[method];
  def(arrayMethods, method, function mutator () {
    var arguments$1 = arguments;

    // avoid leaking arguments:
    // http://jsperf.com/closure-with-arguments
    var i = arguments.length;
    var args = new Array(i);
    while (i--) {
      args[i] = arguments$1[i];
    }
    var result = original.apply(this, args);
    var ob = this.__ob__;
    var inserted;
    switch (method) {
      case 'push':
        inserted = args;
        break
      case 'unshift':
        inserted = args;
        break
      case 'splice':
        inserted = args.slice(2);
        break
    }
    if (inserted) { ob.observeArray(inserted); }
    // notify change
    ob.dep.notify();
    return result
  });
});

/*  */

var arrayKeys = Object.getOwnPropertyNames(arrayMethods);

/**
 * By default, when a reactive property is set, the new value is
 * also converted to become reactive. However when passing down props,
 * we don't want to force conversion because the value may be a nested value
 * under a frozen data structure. Converting it would defeat the optimization.
 */
var observerState = {
  shouldConvert: true,
  isSettingProps: false
};

/**
 * Observer class that are attached to each observed
 * object. Once attached, the observer converts target
 * object's property keys into getter/setters that
 * collect dependencies and dispatches updates.
 */
var Observer = function Observer (value) {
  this.value = value;
  this.dep = new Dep();
  this.vmCount = 0;
  def(value, '__ob__', this);
  if (Array.isArray(value)) {
    var augment = hasProto
      ? protoAugment
      : copyAugment;
    augment(value, arrayMethods, arrayKeys);
    this.observeArray(value);
  } else {
    this.walk(value);
  }
};

/**
 * Walk through each property and convert them into
 * getter/setters. This method should only be called when
 * value type is Object.
 */
Observer.prototype.walk = function walk (obj) {
  var keys = Object.keys(obj);
  for (var i = 0; i < keys.length; i++) {
    defineReactive$$1(obj, keys[i], obj[keys[i]]);
  }
};

/**
 * Observe a list of Array items.
 */
Observer.prototype.observeArray = function observeArray (items) {
  for (var i = 0, l = items.length; i < l; i++) {
    observe(items[i]);
  }
};

// helpers

/**
 * Augment an target Object or Array by intercepting
 * the prototype chain using __proto__
 */
function protoAugment (target, src) {
  /* eslint-disable no-proto */
  target.__proto__ = src;
  /* eslint-enable no-proto */
}

/**
 * Augment an target Object or Array by defining
 * hidden properties.
 */
/* istanbul ignore next */
function copyAugment (target, src, keys) {
  for (var i = 0, l = keys.length; i < l; i++) {
    var key = keys[i];
    def(target, key, src[key]);
  }
}

/**
 * Attempt to create an observer instance for a value,
 * returns the new observer if successfully observed,
 * or the existing observer if the value already has one.
 */
function observe (value, asRootData) {
  if (!isObject(value)) {
    return
  }
  var ob;
  if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
    ob = value.__ob__;
  } else if (
    observerState.shouldConvert &&
    !isServerRendering() &&
    (Array.isArray(value) || isPlainObject(value)) &&
    Object.isExtensible(value) &&
    !value._isVue
  ) {
    ob = new Observer(value);
  }
  if (asRootData && ob) {
    ob.vmCount++;
  }
  return ob
}

/**
 * Define a reactive property on an Object.
 */
function defineReactive$$1 (
  obj,
  key,
  val,
  customSetter
) {
  var dep = new Dep();

  var property = Object.getOwnPropertyDescriptor(obj, key);
  if (property && property.configurable === false) {
    return
  }

  // cater for pre-defined getter/setters
  var getter = property && property.get;
  var setter = property && property.set;

  var childOb = observe(val);
  Object.defineProperty(obj, key, {
    enumerable: true,
    configurable: true,
    get: function reactiveGetter () {
      var value = getter ? getter.call(obj) : val;
      if (Dep.target) {
        dep.depend();
        if (childOb) {
          childOb.dep.depend();
        }
        if (Array.isArray(value)) {
          dependArray(value);
        }
      }
      return value
    },
    set: function reactiveSetter (newVal) {
      var value = getter ? getter.call(obj) : val;
      /* eslint-disable no-self-compare */
      if (newVal === value || (newVal !== newVal && value !== value)) {
        return
      }
      /* eslint-enable no-self-compare */
      if ("development" !== 'production' && customSetter) {
        customSetter();
      }
      if (setter) {
        setter.call(obj, newVal);
      } else {
        val = newVal;
      }
      childOb = observe(newVal);
      dep.notify();
    }
  });
}

/**
 * Set a property on an object. Adds the new property and
 * triggers change notification if the property doesn't
 * already exist.
 */
function set (obj, key, val) {
  if (Array.isArray(obj)) {
    obj.length = Math.max(obj.length, key);
    obj.splice(key, 1, val);
    return val
  }
  if (hasOwn(obj, key)) {
    obj[key] = val;
    return
  }
  var ob = obj.__ob__;
  if (obj._isVue || (ob && ob.vmCount)) {
    "development" !== 'production' && warn(
      'Avoid adding reactive properties to a Vue instance or its root $data ' +
      'at runtime - declare it upfront in the data option.'
    );
    return
  }
  if (!ob) {
    obj[key] = val;
    return
  }
  defineReactive$$1(ob.value, key, val);
  ob.dep.notify();
  return val
}

/**
 * Delete a property and trigger change if necessary.
 */
function del (obj, key) {
  if (Array.isArray(obj)) {
    obj.splice(key, 1);
    return
  }
  var ob = obj.__ob__;
  if (obj._isVue || (ob && ob.vmCount)) {
    "development" !== 'production' && warn(
      'Avoid deleting properties on a Vue instance or its root $data ' +
      '- just set it to null.'
    );
    return
  }
  if (!hasOwn(obj, key)) {
    return
  }
  delete obj[key];
  if (!ob) {
    return
  }
  ob.dep.notify();
}

/**
 * Collect dependencies on array elements when the array is touched, since
 * we cannot intercept array element access like property getters.
 */
function dependArray (value) {
  for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
    e = value[i];
    e && e.__ob__ && e.__ob__.dep.depend();
    if (Array.isArray(e)) {
      dependArray(e);
    }
  }
}

/*  */

/**
 * Option overwriting strategies are functions that handle
 * how to merge a parent option value and a child option
 * value into the final value.
 */
var strats = config.optionMergeStrategies;

/**
 * Options with restrictions
 */
{
  strats.el = strats.propsData = function (parent, child, vm, key) {
    if (!vm) {
      warn(
        "option \"" + key + "\" can only be used during instance " +
        'creation with the `new` keyword.'
      );
    }
    return defaultStrat(parent, child)
  };
}

/**
 * Helper that recursively merges two data objects together.
 */
function mergeData (to, from) {
  if (!from) { return to }
  var key, toVal, fromVal;
  var keys = Object.keys(from);
  for (var i = 0; i < keys.length; i++) {
    key = keys[i];
    toVal = to[key];
    fromVal = from[key];
    if (!hasOwn(to, key)) {
      set(to, key, fromVal);
    } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
      mergeData(toVal, fromVal);
    }
  }
  return to
}

/**
 * Data
 */
strats.data = function (
  parentVal,
  childVal,
  vm
) {
  if (!vm) {
    // in a Vue.extend merge, both should be functions
    if (!childVal) {
      return parentVal
    }
    if (typeof childVal !== 'function') {
      "development" !== 'production' && warn(
        'The "data" option should be a function ' +
        'that returns a per-instance value in component ' +
        'definitions.',
        vm
      );
      return parentVal
    }
    if (!parentVal) {
      return childVal
    }
    // when parentVal & childVal are both present,
    // we need to return a function that returns the
    // merged result of both functions... no need to
    // check if parentVal is a function here because
    // it has to be a function to pass previous merges.
    return function mergedDataFn () {
      return mergeData(
        childVal.call(this),
        parentVal.call(this)
      )
    }
  } else if (parentVal || childVal) {
    return function mergedInstanceDataFn () {
      // instance merge
      var instanceData = typeof childVal === 'function'
        ? childVal.call(vm)
        : childVal;
      var defaultData = typeof parentVal === 'function'
        ? parentVal.call(vm)
        : undefined;
      if (instanceData) {
        return mergeData(instanceData, defaultData)
      } else {
        return defaultData
      }
    }
  }
};

/**
 * Hooks and props are merged as arrays.
 */
function mergeHook (
  parentVal,
  childVal
) {
  return childVal
    ? parentVal
      ? parentVal.concat(childVal)
      : Array.isArray(childVal)
        ? childVal
        : [childVal]
    : parentVal
}

config._lifecycleHooks.forEach(function (hook) {
  strats[hook] = mergeHook;
});

/**
 * Assets
 *
 * When a vm is present (instance creation), we need to do
 * a three-way merge between constructor options, instance
 * options and parent options.
 */
function mergeAssets (parentVal, childVal) {
  var res = Object.create(parentVal || null);
  return childVal
    ? extend(res, childVal)
    : res
}

config._assetTypes.forEach(function (type) {
  strats[type + 's'] = mergeAssets;
});

/**
 * Watchers.
 *
 * Watchers hashes should not overwrite one
 * another, so we merge them as arrays.
 */
strats.watch = function (parentVal, childVal) {
  /* istanbul ignore if */
  if (!childVal) { return Object.create(parentVal || null) }
  if (!parentVal) { return childVal }
  var ret = {};
  extend(ret, parentVal);
  for (var key in childVal) {
    var parent = ret[key];
    var child = childVal[key];
    if (parent && !Array.isArray(parent)) {
      parent = [parent];
    }
    ret[key] = parent
      ? parent.concat(child)
      : [child];
  }
  return ret
};

/**
 * Other object hashes.
 */
strats.props =
strats.methods =
strats.computed = function (parentVal, childVal) {
  if (!childVal) { return Object.create(parentVal || null) }
  if (!parentVal) { return childVal }
  var ret = Object.create(null);
  extend(ret, parentVal);
  extend(ret, childVal);
  return ret
};

/**
 * Default strategy.
 */
var defaultStrat = function (parentVal, childVal) {
  return childVal === undefined
    ? parentVal
    : childVal
};

/**
 * Validate component names
 */
function checkComponents (options) {
  for (var key in options.components) {
    var lower = key.toLowerCase();
    if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
      warn(
        'Do not use built-in or reserved HTML elements as component ' +
        'id: ' + key
      );
    }
  }
}

/**
 * Ensure all props option syntax are normalized into the
 * Object-based format.
 */
function normalizeProps (options) {
  var props = options.props;
  if (!props) { return }
  var res = {};
  var i, val, name;
  if (Array.isArray(props)) {
    i = props.length;
    while (i--) {
      val = props[i];
      if (typeof val === 'string') {
        name = camelize(val);
        res[name] = { type: null };
      } else {
        warn('props must be strings when using array syntax.');
      }
    }
  } else if (isPlainObject(props)) {
    for (var key in props) {
      val = props[key];
      name = camelize(key);
      res[name] = isPlainObject(val)
        ? val
        : { type: val };
    }
  }
  options.props = res;
}

/**
 * Normalize raw function directives into object format.
 */
function normalizeDirectives (options) {
  var dirs = options.directives;
  if (dirs) {
    for (var key in dirs) {
      var def = dirs[key];
      if (typeof def === 'function') {
        dirs[key] = { bind: def, update: def };
      }
    }
  }
}

/**
 * Merge two option objects into a new one.
 * Core utility used in both instantiation and inheritance.
 */
function mergeOptions (
  parent,
  child,
  vm
) {
  {
    checkComponents(child);
  }
  normalizeProps(child);
  normalizeDirectives(child);
  var extendsFrom = child.extends;
  if (extendsFrom) {
    parent = typeof extendsFrom === 'function'
      ? mergeOptions(parent, extendsFrom.options, vm)
      : mergeOptions(parent, extendsFrom, vm);
  }
  if (child.mixins) {
    for (var i = 0, l = child.mixins.length; i < l; i++) {
      var mixin = child.mixins[i];
      if (mixin.prototype instanceof Vue$3) {
        mixin = mixin.options;
      }
      parent = mergeOptions(parent, mixin, vm);
    }
  }
  var options = {};
  var key;
  for (key in parent) {
    mergeField(key);
  }
  for (key in child) {
    if (!hasOwn(parent, key)) {
      mergeField(key);
    }
  }
  function mergeField (key) {
    var strat = strats[key] || defaultStrat;
    options[key] = strat(parent[key], child[key], vm, key);
  }
  return options
}

/**
 * Resolve an asset.
 * This function is used because child instances need access
 * to assets defined in its ancestor chain.
 */
function resolveAsset (
  options,
  type,
  id,
  warnMissing
) {
  /* istanbul ignore if */
  if (typeof id !== 'string') {
    return
  }
  var assets = options[type];
  // check local registration variations first
  if (hasOwn(assets, id)) { return assets[id] }
  var camelizedId = camelize(id);
  if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  var PascalCaseId = capitalize(camelizedId);
  if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  // fallback to prototype chain
  var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  if ("development" !== 'production' && warnMissing && !res) {
    warn(
      'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
      options
    );
  }
  return res
}

/*  */

function validateProp (
  key,
  propOptions,
  propsData,
  vm
) {
  var prop = propOptions[key];
  var absent = !hasOwn(propsData, key);
  var value = propsData[key];
  // handle boolean props
  if (isType(Boolean, prop.type)) {
    if (absent && !hasOwn(prop, 'default')) {
      value = false;
    } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
      value = true;
    }
  }
  // check default value
  if (value === undefined) {
    value = getPropDefaultValue(vm, prop, key);
    // since the default value is a fresh copy,
    // make sure to observe it.
    var prevShouldConvert = observerState.shouldConvert;
    observerState.shouldConvert = true;
    observe(value);
    observerState.shouldConvert = prevShouldConvert;
  }
  {
    assertProp(prop, key, value, vm, absent);
  }
  return value
}

/**
 * Get the default value of a prop.
 */
function getPropDefaultValue (vm, prop, key) {
  // no default, return undefined
  if (!hasOwn(prop, 'default')) {
    return undefined
  }
  var def = prop.default;
  // warn against non-factory defaults for Object & Array
  if ("development" !== 'production' && isObject(def)) {
    warn(
      'Invalid default value for prop "' + key + '": ' +
      'Props with type Object/Array must use a factory function ' +
      'to return the default value.',
      vm
    );
  }
  // the raw prop value was also undefined from previous render,
  // return previous default value to avoid unnecessary watcher trigger
  if (vm && vm.$options.propsData &&
    vm.$options.propsData[key] === undefined &&
    vm._props[key] !== undefined) {
    return vm._props[key]
  }
  // call factory function for non-Function types
  // a value is Function if its prototype is function even across different execution context
  return typeof def === 'function' && getType(prop.type) !== 'Function'
    ? def.call(vm)
    : def
}

/**
 * Assert whether a prop is valid.
 */
function assertProp (
  prop,
  name,
  value,
  vm,
  absent
) {
  if (prop.required && absent) {
    warn(
      'Missing required prop: "' + name + '"',
      vm
    );
    return
  }
  if (value == null && !prop.required) {
    return
  }
  var type = prop.type;
  var valid = !type || type === true;
  var expectedTypes = [];
  if (type) {
    if (!Array.isArray(type)) {
      type = [type];
    }
    for (var i = 0; i < type.length && !valid; i++) {
      var assertedType = assertType(value, type[i]);
      expectedTypes.push(assertedType.expectedType || '');
      valid = assertedType.valid;
    }
  }
  if (!valid) {
    warn(
      'Invalid prop: type check failed for prop "' + name + '".' +
      ' Expected ' + expectedTypes.map(capitalize).join(', ') +
      ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
      vm
    );
    return
  }
  var validator = prop.validator;
  if (validator) {
    if (!validator(value)) {
      warn(
        'Invalid prop: custom validator check failed for prop "' + name + '".',
        vm
      );
    }
  }
}

/**
 * Assert the type of a value
 */
function assertType (value, type) {
  var valid;
  var expectedType = getType(type);
  if (expectedType === 'String') {
    valid = typeof value === (expectedType = 'string');
  } else if (expectedType === 'Number') {
    valid = typeof value === (expectedType = 'number');
  } else if (expectedType === 'Boolean') {
    valid = typeof value === (expectedType = 'boolean');
  } else if (expectedType === 'Function') {
    valid = typeof value === (expectedType = 'function');
  } else if (expectedType === 'Object') {
    valid = isPlainObject(value);
  } else if (expectedType === 'Array') {
    valid = Array.isArray(value);
  } else {
    valid = value instanceof type;
  }
  return {
    valid: valid,
    expectedType: expectedType
  }
}

/**
 * Use function string name to check built-in types,
 * because a simple equality check will fail when running
 * across different vms / iframes.
 */
function getType (fn) {
  var match = fn && fn.toString().match(/^\s*function (\w+)/);
  return match && match[1]
}

function isType (type, fn) {
  if (!Array.isArray(fn)) {
    return getType(fn) === getType(type)
  }
  for (var i = 0, len = fn.length; i < len; i++) {
    if (getType(fn[i]) === getType(type)) {
      return true
    }
  }
  /* istanbul ignore next */
  return false
}

function handleError (err, vm, type) {
  if (config.errorHandler) {
    config.errorHandler.call(null, err, vm, type);
  } else {
    {
      warn(("Error in " + type + ":"), vm);
    }
    /* istanbul ignore else */
    if (inBrowser && typeof console !== 'undefined') {
      console.error(err);
    } else {
      throw err
    }
  }
}

/* not type checking this file because flow doesn't play well with Proxy */

var initProxy;

{
  var allowedGlobals = makeMap(
    'Infinity,undefined,NaN,isFinite,isNaN,' +
    'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
    'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
    'require' // for Webpack/Browserify
  );

  var warnNonPresent = function (target, key) {
    warn(
      "Property or method \"" + key + "\" is not defined on the instance but " +
      "referenced during render. Make sure to declare reactive data " +
      "properties in the data option.",
      target
    );
  };

  var hasProxy =
    typeof Proxy !== 'undefined' &&
    Proxy.toString().match(/native code/);

  if (hasProxy) {
    var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
    config.keyCodes = new Proxy(config.keyCodes, {
      set: function set (target, key, value) {
        if (isBuiltInModifier(key)) {
          warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
          return false
        } else {
          target[key] = value;
          return true
        }
      }
    });
  }

  var hasHandler = {
    has: function has (target, key) {
      var has = key in target;
      var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
      if (!has && !isAllowed) {
        warnNonPresent(target, key);
      }
      return has || !isAllowed
    }
  };

  var getHandler = {
    get: function get (target, key) {
      if (typeof key === 'string' && !(key in target)) {
        warnNonPresent(target, key);
      }
      return target[key]
    }
  };

  initProxy = function initProxy (vm) {
    if (hasProxy) {
      // determine which proxy handler to use
      var options = vm.$options;
      var handlers = options.render && options.render._withStripped
        ? getHandler
        : hasHandler;
      vm._renderProxy = new Proxy(vm, handlers);
    } else {
      vm._renderProxy = vm;
    }
  };
}

/*  */

var VNode = function VNode (
  tag,
  data,
  children,
  text,
  elm,
  context,
  componentOptions
) {
  this.tag = tag;
  this.data = data;
  this.children = children;
  this.text = text;
  this.elm = elm;
  this.ns = undefined;
  this.context = context;
  this.functionalContext = undefined;
  this.key = data && data.key;
  this.componentOptions = componentOptions;
  this.componentInstance = undefined;
  this.parent = undefined;
  this.raw = false;
  this.isStatic = false;
  this.isRootInsert = true;
  this.isComment = false;
  this.isCloned = false;
  this.isOnce = false;
};

var prototypeAccessors = { child: {} };

// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
  return this.componentInstance
};

Object.defineProperties( VNode.prototype, prototypeAccessors );

var createEmptyVNode = function () {
  var node = new VNode();
  node.text = '';
  node.isComment = true;
  return node
};

function createTextVNode (val) {
  return new VNode(undefined, undefined, undefined, String(val))
}

// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
  var cloned = new VNode(
    vnode.tag,
    vnode.data,
    vnode.children,
    vnode.text,
    vnode.elm,
    vnode.context,
    vnode.componentOptions
  );
  cloned.ns = vnode.ns;
  cloned.isStatic = vnode.isStatic;
  cloned.key = vnode.key;
  cloned.isCloned = true;
  return cloned
}

function cloneVNodes (vnodes) {
  var res = new Array(vnodes.length);
  for (var i = 0; i < vnodes.length; i++) {
    res[i] = cloneVNode(vnodes[i]);
  }
  return res
}

/*  */

var normalizeEvent = cached(function (name) {
  var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  name = once$$1 ? name.slice(1) : name;
  var capture = name.charAt(0) === '!';
  name = capture ? name.slice(1) : name;
  return {
    name: name,
    once: once$$1,
    capture: capture
  }
});

function createFnInvoker (fns) {
  function invoker () {
    var arguments$1 = arguments;

    var fns = invoker.fns;
    if (Array.isArray(fns)) {
      for (var i = 0; i < fns.length; i++) {
        fns[i].apply(null, arguments$1);
      }
    } else {
      // return handler return value for single handlers
      return fns.apply(null, arguments)
    }
  }
  invoker.fns = fns;
  return invoker
}

function updateListeners (
  on,
  oldOn,
  add,
  remove$$1,
  vm
) {
  var name, cur, old, event;
  for (name in on) {
    cur = on[name];
    old = oldOn[name];
    event = normalizeEvent(name);
    if (!cur) {
      "development" !== 'production' && warn(
        "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
        vm
      );
    } else if (!old) {
      if (!cur.fns) {
        cur = on[name] = createFnInvoker(cur);
      }
      add(event.name, cur, event.once, event.capture);
    } else if (cur !== old) {
      old.fns = cur;
      on[name] = old;
    }
  }
  for (name in oldOn) {
    if (!on[name]) {
      event = normalizeEvent(name);
      remove$$1(event.name, oldOn[name], event.capture);
    }
  }
}

/*  */

function mergeVNodeHook (def, hookKey, hook) {
  var invoker;
  var oldHook = def[hookKey];

  function wrappedHook () {
    hook.apply(this, arguments);
    // important: remove merged hook to ensure it's called only once
    // and prevent memory leak
    remove(invoker.fns, wrappedHook);
  }

  if (!oldHook) {
    // no existing hook
    invoker = createFnInvoker([wrappedHook]);
  } else {
    /* istanbul ignore if */
    if (oldHook.fns && oldHook.merged) {
      // already a merged invoker
      invoker = oldHook;
      invoker.fns.push(wrappedHook);
    } else {
      // existing plain hook
      invoker = createFnInvoker([oldHook, wrappedHook]);
    }
  }

  invoker.merged = true;
  def[hookKey] = invoker;
}

/*  */

// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:

// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren (children) {
  for (var i = 0; i < children.length; i++) {
    if (Array.isArray(children[i])) {
      return Array.prototype.concat.apply([], children)
    }
  }
  return children
}

// 2. When the children contains constrcuts that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren (children) {
  return isPrimitive(children)
    ? [createTextVNode(children)]
    : Array.isArray(children)
      ? normalizeArrayChildren(children)
      : undefined
}

function normalizeArrayChildren (children, nestedIndex) {
  var res = [];
  var i, c, last;
  for (i = 0; i < children.length; i++) {
    c = children[i];
    if (c == null || typeof c === 'boolean') { continue }
    last = res[res.length - 1];
    //  nested
    if (Array.isArray(c)) {
      res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
    } else if (isPrimitive(c)) {
      if (last && last.text) {
        last.text += String(c);
      } else if (c !== '') {
        // convert primitive to vnode
        res.push(createTextVNode(c));
      }
    } else {
      if (c.text && last && last.text) {
        res[res.length - 1] = createTextVNode(last.text + c.text);
      } else {
        // default key for nested array children (likely generated by v-for)
        if (c.tag && c.key == null && nestedIndex != null) {
          c.key = "__vlist" + nestedIndex + "_" + i + "__";
        }
        res.push(c);
      }
    }
  }
  return res
}

/*  */

function getFirstComponentChild (children) {
  return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}

/*  */

function initEvents (vm) {
  vm._events = Object.create(null);
  vm._hasHookEvent = false;
  // init parent attached events
  var listeners = vm.$options._parentListeners;
  if (listeners) {
    updateComponentListeners(vm, listeners);
  }
}

var target;

function add (event, fn, once$$1) {
  if (once$$1) {
    target.$once(event, fn);
  } else {
    target.$on(event, fn);
  }
}

function remove$1 (event, fn) {
  target.$off(event, fn);
}

function updateComponentListeners (
  vm,
  listeners,
  oldListeners
) {
  target = vm;
  updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
}

function eventsMixin (Vue) {
  var hookRE = /^hook:/;
  Vue.prototype.$on = function (event, fn) {
    var this$1 = this;

    var vm = this;
    if (Array.isArray(event)) {
      for (var i = 0, l = event.length; i < l; i++) {
        this$1.$on(event[i], fn);
      }
    } else {
      (vm._events[event] || (vm._events[event] = [])).push(fn);
      // optimize hook:event cost by using a boolean flag marked at registration
      // instead of a hash lookup
      if (hookRE.test(event)) {
        vm._hasHookEvent = true;
      }
    }
    return vm
  };

  Vue.prototype.$once = function (event, fn) {
    var vm = this;
    function on () {
      vm.$off(event, on);
      fn.apply(vm, arguments);
    }
    on.fn = fn;
    vm.$on(event, on);
    return vm
  };

  Vue.prototype.$off = function (event, fn) {
    var vm = this;
    // all
    if (!arguments.length) {
      vm._events = Object.create(null);
      return vm
    }
    // specific event
    var cbs = vm._events[event];
    if (!cbs) {
      return vm
    }
    if (arguments.length === 1) {
      vm._events[event] = null;
      return vm
    }
    // specific handler
    var cb;
    var i = cbs.length;
    while (i--) {
      cb = cbs[i];
      if (cb === fn || cb.fn === fn) {
        cbs.splice(i, 1);
        break
      }
    }
    return vm
  };

  Vue.prototype.$emit = function (event) {
    var vm = this;
    var cbs = vm._events[event];
    if (cbs) {
      cbs = cbs.length > 1 ? toArray(cbs) : cbs;
      var args = toArray(arguments, 1);
      for (var i = 0, l = cbs.length; i < l; i++) {
        cbs[i].apply(vm, args);
      }
    }
    return vm
  };
}

/*  */

/**
 * Runtime helper for resolving raw children VNodes into a slot object.
 */
function resolveSlots (
  children,
  context
) {
  var slots = {};
  if (!children) {
    return slots
  }
  var defaultSlot = [];
  var name, child;
  for (var i = 0, l = children.length; i < l; i++) {
    child = children[i];
    // named slots should only be respected if the vnode was rendered in the
    // same context.
    if ((child.context === context || child.functionalContext === context) &&
        child.data && (name = child.data.slot)) {
      var slot = (slots[name] || (slots[name] = []));
      if (child.tag === 'template') {
        slot.push.apply(slot, child.children);
      } else {
        slot.push(child);
      }
    } else {
      defaultSlot.push(child);
    }
  }
  // ignore single whitespace
  if (defaultSlot.length && !(
    defaultSlot.length === 1 &&
    (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  )) {
    slots.default = defaultSlot;
  }
  return slots
}

function resolveScopedSlots (
  fns
) {
  var res = {};
  for (var i = 0; i < fns.length; i++) {
    res[fns[i][0]] = fns[i][1];
  }
  return res
}

/*  */

var activeInstance = null;

function initLifecycle (vm) {
  var options = vm.$options;

  // locate first non-abstract parent
  var parent = options.parent;
  if (parent && !options.abstract) {
    while (parent.$options.abstract && parent.$parent) {
      parent = parent.$parent;
    }
    parent.$children.push(vm);
  }

  vm.$parent = parent;
  vm.$root = parent ? parent.$root : vm;

  vm.$children = [];
  vm.$refs = {};

  vm._watcher = null;
  vm._inactive = null;
  vm._directInactive = false;
  vm._isMounted = false;
  vm._isDestroyed = false;
  vm._isBeingDestroyed = false;
}

function lifecycleMixin (Vue) {
  Vue.prototype._update = function (vnode, hydrating) {
    var vm = this;
    if (vm._isMounted) {
      callHook(vm, 'beforeUpdate');
    }
    var prevEl = vm.$el;
    var prevVnode = vm._vnode;
    var prevActiveInstance = activeInstance;
    activeInstance = vm;
    vm._vnode = vnode;
    // Vue.prototype.__patch__ is injected in entry points
    // based on the rendering backend used.
    if (!prevVnode) {
      // initial render
      vm.$el = vm.__patch__(
        vm.$el, vnode, hydrating, false /* removeOnly */,
        vm.$options._parentElm,
        vm.$options._refElm
      );
    } else {
      // updates
      vm.$el = vm.__patch__(prevVnode, vnode);
    }
    activeInstance = prevActiveInstance;
    // update __vue__ reference
    if (prevEl) {
      prevEl.__vue__ = null;
    }
    if (vm.$el) {
      vm.$el.__vue__ = vm;
    }
    // if parent is an HOC, update its $el as well
    if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
      vm.$parent.$el = vm.$el;
    }
    // updated hook is called by the scheduler to ensure that children are
    // updated in a parent's updated hook.
  };

  Vue.prototype.$forceUpdate = function () {
    var vm = this;
    if (vm._watcher) {
      vm._watcher.update();
    }
  };

  Vue.prototype.$destroy = function () {
    var vm = this;
    if (vm._isBeingDestroyed) {
      return
    }
    callHook(vm, 'beforeDestroy');
    vm._isBeingDestroyed = true;
    // remove self from parent
    var parent = vm.$parent;
    if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
      remove(parent.$children, vm);
    }
    // teardown watchers
    if (vm._watcher) {
      vm._watcher.teardown();
    }
    var i = vm._watchers.length;
    while (i--) {
      vm._watchers[i].teardown();
    }
    // remove reference from data ob
    // frozen object may not have observer.
    if (vm._data.__ob__) {
      vm._data.__ob__.vmCount--;
    }
    // call the last hook...
    vm._isDestroyed = true;
    callHook(vm, 'destroyed');
    // turn off all instance listeners.
    vm.$off();
    // remove __vue__ reference
    if (vm.$el) {
      vm.$el.__vue__ = null;
    }
    // invoke destroy hooks on current rendered tree
    vm.__patch__(vm._vnode, null);
  };
}

function mountComponent (
  vm,
  el,
  hydrating
) {
  vm.$el = el;
  if (!vm.$options.render) {
    vm.$options.render = createEmptyVNode;
    {
      /* istanbul ignore if */
      if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
        warn(
          'You are using the runtime-only build of Vue where the template ' +
          'option is not available. Either pre-compile the templates into ' +
          'render functions, or use the compiler-included build.',
          vm
        );
      } else {
        warn(
          'Failed to mount component: template or render function not defined.',
          vm
        );
      }
    }
  }
  callHook(vm, 'beforeMount');

  var updateComponent;
  /* istanbul ignore if */
  if ("development" !== 'production' && config.performance && perf) {
    updateComponent = function () {
      var name = vm._name;
      var startTag = "start " + name;
      var endTag = "end " + name;
      perf.mark(startTag);
      var vnode = vm._render();
      perf.mark(endTag);
      perf.measure((name + " render"), startTag, endTag);
      perf.mark(startTag);
      vm._update(vnode, hydrating);
      perf.mark(endTag);
      perf.measure((name + " patch"), startTag, endTag);
    };
  } else {
    updateComponent = function () {
      vm._update(vm._render(), hydrating);
    };
  }

  vm._watcher = new Watcher(vm, updateComponent, noop);
  hydrating = false;

  // manually mounted instance, call mounted on self
  // mounted is called for render-created child components in its inserted hook
  if (vm.$vnode == null) {
    vm._isMounted = true;
    callHook(vm, 'mounted');
  }
  return vm
}

function updateChildComponent (
  vm,
  propsData,
  listeners,
  parentVnode,
  renderChildren
) {
  // determine whether component has slot children
  // we need to do this before overwriting $options._renderChildren
  var hasChildren = !!(
    renderChildren ||               // has new static slots
    vm.$options._renderChildren ||  // has old static slots
    parentVnode.data.scopedSlots || // has new scoped slots
    vm.$scopedSlots !== emptyObject // has old scoped slots
  );

  vm.$options._parentVnode = parentVnode;
  vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  if (vm._vnode) { // update child tree's parent
    vm._vnode.parent = parentVnode;
  }
  vm.$options._renderChildren = renderChildren;

  // update props
  if (propsData && vm.$options.props) {
    observerState.shouldConvert = false;
    {
      observerState.isSettingProps = true;
    }
    var props = vm._props;
    var propKeys = vm.$options._propKeys || [];
    for (var i = 0; i < propKeys.length; i++) {
      var key = propKeys[i];
      props[key] = validateProp(key, vm.$options.props, propsData, vm);
    }
    observerState.shouldConvert = true;
    {
      observerState.isSettingProps = false;
    }
    // keep a copy of raw propsData
    vm.$options.propsData = propsData;
  }
  // update listeners
  if (listeners) {
    var oldListeners = vm.$options._parentListeners;
    vm.$options._parentListeners = listeners;
    updateComponentListeners(vm, listeners, oldListeners);
  }
  // resolve slots + force update if has children
  if (hasChildren) {
    vm.$slots = resolveSlots(renderChildren, parentVnode.context);
    vm.$forceUpdate();
  }
}

function isInInactiveTree (vm) {
  while (vm && (vm = vm.$parent)) {
    if (vm._inactive) { return true }
  }
  return false
}

function activateChildComponent (vm, direct) {
  if (direct) {
    vm._directInactive = false;
    if (isInInactiveTree(vm)) {
      return
    }
  } else if (vm._directInactive) {
    return
  }
  if (vm._inactive || vm._inactive == null) {
    vm._inactive = false;
    for (var i = 0; i < vm.$children.length; i++) {
      activateChildComponent(vm.$children[i]);
    }
    callHook(vm, 'activated');
  }
}

function deactivateChildComponent (vm, direct) {
  if (direct) {
    vm._directInactive = true;
    if (isInInactiveTree(vm)) {
      return
    }
  }
  if (!vm._inactive) {
    vm._inactive = true;
    for (var i = 0; i < vm.$children.length; i++) {
      deactivateChildComponent(vm.$children[i]);
    }
    callHook(vm, 'deactivated');
  }
}

function callHook (vm, hook) {
  var handlers = vm.$options[hook];
  if (handlers) {
    for (var i = 0, j = handlers.length; i < j; i++) {
      try {
        handlers[i].call(vm);
      } catch (e) {
        handleError(e, vm, (hook + " hook"));
      }
    }
  }
  if (vm._hasHookEvent) {
    vm.$emit('hook:' + hook);
  }
}

/*  */


var queue = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;

/**
 * Reset the scheduler's state.
 */
function resetSchedulerState () {
  queue.length = 0;
  has = {};
  {
    circular = {};
  }
  waiting = flushing = false;
}

/**
 * Flush both queues and run the watchers.
 */
function flushSchedulerQueue () {
  flushing = true;
  var watcher, id, vm;

  // Sort queue before flush.
  // This ensures that:
  // 1. Components are updated from parent to child. (because parent is always
  //    created before the child)
  // 2. A component's user watchers are run before its render watcher (because
  //    user watchers are created before the render watcher)
  // 3. If a component is destroyed during a parent component's watcher run,
  //    its watchers can be skipped.
  queue.sort(function (a, b) { return a.id - b.id; });

  // do not cache length because more watchers might be pushed
  // as we run existing watchers
  for (index = 0; index < queue.length; index++) {
    watcher = queue[index];
    id = watcher.id;
    has[id] = null;
    watcher.run();
    // in dev build, check and stop circular updates.
    if ("development" !== 'production' && has[id] != null) {
      circular[id] = (circular[id] || 0) + 1;
      if (circular[id] > config._maxUpdateCount) {
        warn(
          'You may have an infinite update loop ' + (
            watcher.user
              ? ("in watcher with expression \"" + (watcher.expression) + "\"")
              : "in a component render function."
          ),
          watcher.vm
        );
        break
      }
    }
  }

  // call updated hooks
  index = queue.length;
  while (index--) {
    watcher = queue[index];
    vm = watcher.vm;
    if (vm._watcher === watcher && vm._isMounted) {
      callHook(vm, 'updated');
    }
  }

  // devtool hook
  /* istanbul ignore if */
  if (devtools && config.devtools) {
    devtools.emit('flush');
  }

  resetSchedulerState();
}

/**
 * Push a watcher into the watcher queue.
 * Jobs with duplicate IDs will be skipped unless it's
 * pushed when the queue is being flushed.
 */
function queueWatcher (watcher) {
  var id = watcher.id;
  if (has[id] == null) {
    has[id] = true;
    if (!flushing) {
      queue.push(watcher);
    } else {
      // if already flushing, splice the watcher based on its id
      // if already past its id, it will be run next immediately.
      var i = queue.length - 1;
      while (i >= 0 && queue[i].id > watcher.id) {
        i--;
      }
      queue.splice(Math.max(i, index) + 1, 0, watcher);
    }
    // queue the flush
    if (!waiting) {
      waiting = true;
      nextTick(flushSchedulerQueue);
    }
  }
}

/*  */

var uid$2 = 0;

/**
 * A watcher parses an expression, collects dependencies,
 * and fires callback when the expression value changes.
 * This is used for both the $watch() api and directives.
 */
var Watcher = function Watcher (
  vm,
  expOrFn,
  cb,
  options
) {
  this.vm = vm;
  vm._watchers.push(this);
  // options
  if (options) {
    this.deep = !!options.deep;
    this.user = !!options.user;
    this.lazy = !!options.lazy;
    this.sync = !!options.sync;
  } else {
    this.deep = this.user = this.lazy = this.sync = false;
  }
  this.cb = cb;
  this.id = ++uid$2; // uid for batching
  this.active = true;
  this.dirty = this.lazy; // for lazy watchers
  this.deps = [];
  this.newDeps = [];
  this.depIds = new _Set();
  this.newDepIds = new _Set();
  this.expression = expOrFn.toString();
  // parse expression for getter
  if (typeof expOrFn === 'function') {
    this.getter = expOrFn;
  } else {
    this.getter = parsePath(expOrFn);
    if (!this.getter) {
      this.getter = function () {};
      "development" !== 'production' && warn(
        "Failed watching path: \"" + expOrFn + "\" " +
        'Watcher only accepts simple dot-delimited paths. ' +
        'For full control, use a function instead.',
        vm
      );
    }
  }
  this.value = this.lazy
    ? undefined
    : this.get();
};

/**
 * Evaluate the getter, and re-collect dependencies.
 */
Watcher.prototype.get = function get () {
  pushTarget(this);
  var value;
  var vm = this.vm;
  if (this.user) {
    try {
      value = this.getter.call(vm, vm);
    } catch (e) {
      handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
    }
  } else {
    value = this.getter.call(vm, vm);
  }
  // "touch" every property so they are all tracked as
  // dependencies for deep watching
  if (this.deep) {
    traverse(value);
  }
  popTarget();
  this.cleanupDeps();
  return value
};

/**
 * Add a dependency to this directive.
 */
Watcher.prototype.addDep = function addDep (dep) {
  var id = dep.id;
  if (!this.newDepIds.has(id)) {
    this.newDepIds.add(id);
    this.newDeps.push(dep);
    if (!this.depIds.has(id)) {
      dep.addSub(this);
    }
  }
};

/**
 * Clean up for dependency collection.
 */
Watcher.prototype.cleanupDeps = function cleanupDeps () {
    var this$1 = this;

  var i = this.deps.length;
  while (i--) {
    var dep = this$1.deps[i];
    if (!this$1.newDepIds.has(dep.id)) {
      dep.removeSub(this$1);
    }
  }
  var tmp = this.depIds;
  this.depIds = this.newDepIds;
  this.newDepIds = tmp;
  this.newDepIds.clear();
  tmp = this.deps;
  this.deps = this.newDeps;
  this.newDeps = tmp;
  this.newDeps.length = 0;
};

/**
 * Subscriber interface.
 * Will be called when a dependency changes.
 */
Watcher.prototype.update = function update () {
  /* istanbul ignore else */
  if (this.lazy) {
    this.dirty = true;
  } else if (this.sync) {
    this.run();
  } else {
    queueWatcher(this);
  }
};

/**
 * Scheduler job interface.
 * Will be called by the scheduler.
 */
Watcher.prototype.run = function run () {
  if (this.active) {
    var value = this.get();
    if (
      value !== this.value ||
      // Deep watchers and watchers on Object/Arrays should fire even
      // when the value is the same, because the value may
      // have mutated.
      isObject(value) ||
      this.deep
    ) {
      // set new value
      var oldValue = this.value;
      this.value = value;
      if (this.user) {
        try {
          this.cb.call(this.vm, value, oldValue);
        } catch (e) {
          handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
        }
      } else {
        this.cb.call(this.vm, value, oldValue);
      }
    }
  }
};

/**
 * Evaluate the value of the watcher.
 * This only gets called for lazy watchers.
 */
Watcher.prototype.evaluate = function evaluate () {
  this.value = this.get();
  this.dirty = false;
};

/**
 * Depend on all deps collected by this watcher.
 */
Watcher.prototype.depend = function depend () {
    var this$1 = this;

  var i = this.deps.length;
  while (i--) {
    this$1.deps[i].depend();
  }
};

/**
 * Remove self from all dependencies' subscriber list.
 */
Watcher.prototype.teardown = function teardown () {
    var this$1 = this;

  if (this.active) {
    // remove self from vm's watcher list
    // this is a somewhat expensive operation so we skip it
    // if the vm is being destroyed.
    if (!this.vm._isBeingDestroyed) {
      remove(this.vm._watchers, this);
    }
    var i = this.deps.length;
    while (i--) {
      this$1.deps[i].removeSub(this$1);
    }
    this.active = false;
  }
};

/**
 * Recursively traverse an object to evoke all converted
 * getters, so that every nested property inside the object
 * is collected as a "deep" dependency.
 */
var seenObjects = new _Set();
function traverse (val) {
  seenObjects.clear();
  _traverse(val, seenObjects);
}

function _traverse (val, seen) {
  var i, keys;
  var isA = Array.isArray(val);
  if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
    return
  }
  if (val.__ob__) {
    var depId = val.__ob__.dep.id;
    if (seen.has(depId)) {
      return
    }
    seen.add(depId);
  }
  if (isA) {
    i = val.length;
    while (i--) { _traverse(val[i], seen); }
  } else {
    keys = Object.keys(val);
    i = keys.length;
    while (i--) { _traverse(val[keys[i]], seen); }
  }
}

/*  */

var sharedPropertyDefinition = {
  enumerable: true,
  configurable: true,
  get: noop,
  set: noop
};

function proxy (target, sourceKey, key) {
  sharedPropertyDefinition.get = function proxyGetter () {
    return this[sourceKey][key]
  };
  sharedPropertyDefinition.set = function proxySetter (val) {
    this[sourceKey][key] = val;
  };
  Object.defineProperty(target, key, sharedPropertyDefinition);
}

function initState (vm) {
  vm._watchers = [];
  var opts = vm.$options;
  if (opts.props) { initProps(vm, opts.props); }
  if (opts.methods) { initMethods(vm, opts.methods); }
  if (opts.data) {
    initData(vm);
  } else {
    observe(vm._data = {}, true /* asRootData */);
  }
  if (opts.computed) { initComputed(vm, opts.computed); }
  if (opts.watch) { initWatch(vm, opts.watch); }
}

var isReservedProp = { key: 1, ref: 1, slot: 1 };

function initProps (vm, propsOptions) {
  var propsData = vm.$options.propsData || {};
  var props = vm._props = {};
  // cache prop keys so that future props updates can iterate using Array
  // instead of dynamic object key enumeration.
  var keys = vm.$options._propKeys = [];
  var isRoot = !vm.$parent;
  // root instance props should be converted
  observerState.shouldConvert = isRoot;
  var loop = function ( key ) {
    keys.push(key);
    var value = validateProp(key, propsOptions, propsData, vm);
    /* istanbul ignore else */
    {
      if (isReservedProp[key]) {
        warn(
          ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
          vm
        );
      }
      defineReactive$$1(props, key, value, function () {
        if (vm.$parent && !observerState.isSettingProps) {
          warn(
            "Avoid mutating a prop directly since the value will be " +
            "overwritten whenever the parent component re-renders. " +
            "Instead, use a data or computed property based on the prop's " +
            "value. Prop being mutated: \"" + key + "\"",
            vm
          );
        }
      });
    }
    // static props are already proxied on the component's prototype
    // during Vue.extend(). We only need to proxy props defined at
    // instantiation here.
    if (!(key in vm)) {
      proxy(vm, "_props", key);
    }
  };

  for (var key in propsOptions) loop( key );
  observerState.shouldConvert = true;
}

function initData (vm) {
  var data = vm.$options.data;
  data = vm._data = typeof data === 'function'
    ? data.call(vm)
    : data || {};
  if (!isPlainObject(data)) {
    data = {};
    "development" !== 'production' && warn(
      'data functions should return an object:\n' +
      'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
      vm
    );
  }
  // proxy data on instance
  var keys = Object.keys(data);
  var props = vm.$options.props;
  var i = keys.length;
  while (i--) {
    if (props && hasOwn(props, keys[i])) {
      "development" !== 'production' && warn(
        "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
        "Use prop default value instead.",
        vm
      );
    } else if (!isReserved(keys[i])) {
      proxy(vm, "_data", keys[i]);
    }
  }
  // observe data
  observe(data, true /* asRootData */);
}

var computedWatcherOptions = { lazy: true };

function initComputed (vm, computed) {
  var watchers = vm._computedWatchers = Object.create(null);

  for (var key in computed) {
    var userDef = computed[key];
    var getter = typeof userDef === 'function' ? userDef : userDef.get;
    // create internal watcher for the computed property.
    watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);

    // component-defined computed properties are already defined on the
    // component prototype. We only need to define computed properties defined
    // at instantiation here.
    if (!(key in vm)) {
      defineComputed(vm, key, userDef);
    }
  }
}

function defineComputed (target, key, userDef) {
  if (typeof userDef === 'function') {
    sharedPropertyDefinition.get = createComputedGetter(key);
    sharedPropertyDefinition.set = noop;
  } else {
    sharedPropertyDefinition.get = userDef.get
      ? userDef.cache !== false
        ? createComputedGetter(key)
        : userDef.get
      : noop;
    sharedPropertyDefinition.set = userDef.set
      ? userDef.set
      : noop;
  }
  Object.defineProperty(target, key, sharedPropertyDefinition);
}

function createComputedGetter (key) {
  return function computedGetter () {
    var watcher = this._computedWatchers && this._computedWatchers[key];
    if (watcher) {
      if (watcher.dirty) {
        watcher.evaluate();
      }
      if (Dep.target) {
        watcher.depend();
      }
      return watcher.value
    }
  }
}

function initMethods (vm, methods) {
  var props = vm.$options.props;
  for (var key in methods) {
    vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
    {
      if (methods[key] == null) {
        warn(
          "method \"" + key + "\" has an undefined value in the component definition. " +
          "Did you reference the function correctly?",
          vm
        );
      }
      if (props && hasOwn(props, key)) {
        warn(
          ("method \"" + key + "\" has already been defined as a prop."),
          vm
        );
      }
    }
  }
}

function initWatch (vm, watch) {
  for (var key in watch) {
    var handler = watch[key];
    if (Array.isArray(handler)) {
      for (var i = 0; i < handler.length; i++) {
        createWatcher(vm, key, handler[i]);
      }
    } else {
      createWatcher(vm, key, handler);
    }
  }
}

function createWatcher (vm, key, handler) {
  var options;
  if (isPlainObject(handler)) {
    options = handler;
    handler = handler.handler;
  }
  if (typeof handler === 'string') {
    handler = vm[handler];
  }
  vm.$watch(key, handler, options);
}

function stateMixin (Vue) {
  // flow somehow has problems with directly declared definition object
  // when using Object.defineProperty, so we have to procedurally build up
  // the object here.
  var dataDef = {};
  dataDef.get = function () { return this._data };
  var propsDef = {};
  propsDef.get = function () { return this._props };
  {
    dataDef.set = function (newData) {
      warn(
        'Avoid replacing instance root $data. ' +
        'Use nested data properties instead.',
        this
      );
    };
    propsDef.set = function () {
      warn("$props is readonly.", this);
    };
  }
  Object.defineProperty(Vue.prototype, '$data', dataDef);
  Object.defineProperty(Vue.prototype, '$props', propsDef);

  Vue.prototype.$set = set;
  Vue.prototype.$delete = del;

  Vue.prototype.$watch = function (
    expOrFn,
    cb,
    options
  ) {
    var vm = this;
    options = options || {};
    options.user = true;
    var watcher = new Watcher(vm, expOrFn, cb, options);
    if (options.immediate) {
      cb.call(vm, watcher.value);
    }
    return function unwatchFn () {
      watcher.teardown();
    }
  };
}

/*  */

var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy };
var hooksToMerge = Object.keys(hooks);

function createComponent (
  Ctor,
  data,
  context,
  children,
  tag
) {
  if (!Ctor) {
    return
  }

  var baseCtor = context.$options._base;
  if (isObject(Ctor)) {
    Ctor = baseCtor.extend(Ctor);
  }

  if (typeof Ctor !== 'function') {
    {
      warn(("Invalid Component definition: " + (String(Ctor))), context);
    }
    return
  }

  // async component
  if (!Ctor.cid) {
    if (Ctor.resolved) {
      Ctor = Ctor.resolved;
    } else {
      Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
        // it's ok to queue this on every render because
        // $forceUpdate is buffered by the scheduler.
        context.$forceUpdate();
      });
      if (!Ctor) {
        // return nothing if this is indeed an async component
        // wait for the callback to trigger parent update.
        return
      }
    }
  }

  // resolve constructor options in case global mixins are applied after
  // component constructor creation
  resolveConstructorOptions(Ctor);

  data = data || {};

  // transform component v-model data into props & events
  if (data.model) {
    transformModel(Ctor.options, data);
  }

  // extract props
  var propsData = extractProps(data, Ctor);

  // functional component
  if (Ctor.options.functional) {
    return createFunctionalComponent(Ctor, propsData, data, context, children)
  }

  // extract listeners, since these needs to be treated as
  // child component listeners instead of DOM listeners
  var listeners = data.on;
  // replace with listeners with .native modifier
  data.on = data.nativeOn;

  if (Ctor.options.abstract) {
    // abstract components do not keep anything
    // other than props & listeners
    data = {};
  }

  // merge component management hooks onto the placeholder node
  mergeHooks(data);

  // return a placeholder vnode
  var name = Ctor.options.name || tag;
  var vnode = new VNode(
    ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
    data, undefined, undefined, undefined, context,
    { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  );
  return vnode
}

function createFunctionalComponent (
  Ctor,
  propsData,
  data,
  context,
  children
) {
  var props = {};
  var propOptions = Ctor.options.props;
  if (propOptions) {
    for (var key in propOptions) {
      props[key] = validateProp(key, propOptions, propsData);
    }
  }
  // ensure the createElement function in functional components
  // gets a unique context - this is necessary for correct named slot check
  var _context = Object.create(context);
  var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  var vnode = Ctor.options.render.call(null, h, {
    props: props,
    data: data,
    parent: context,
    children: children,
    slots: function () { return resolveSlots(children, context); }
  });
  if (vnode instanceof VNode) {
    vnode.functionalContext = context;
    if (data.slot) {
      (vnode.data || (vnode.data = {})).slot = data.slot;
    }
  }
  return vnode
}

function createComponentInstanceForVnode (
  vnode, // we know it's MountedComponentVNode but flow doesn't
  parent, // activeInstance in lifecycle state
  parentElm,
  refElm
) {
  var vnodeComponentOptions = vnode.componentOptions;
  var options = {
    _isComponent: true,
    parent: parent,
    propsData: vnodeComponentOptions.propsData,
    _componentTag: vnodeComponentOptions.tag,
    _parentVnode: vnode,
    _parentListeners: vnodeComponentOptions.listeners,
    _renderChildren: vnodeComponentOptions.children,
    _parentElm: parentElm || null,
    _refElm: refElm || null
  };
  // check inline-template render functions
  var inlineTemplate = vnode.data.inlineTemplate;
  if (inlineTemplate) {
    options.render = inlineTemplate.render;
    options.staticRenderFns = inlineTemplate.staticRenderFns;
  }
  return new vnodeComponentOptions.Ctor(options)
}

function init (
  vnode,
  hydrating,
  parentElm,
  refElm
) {
  if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
    var child = vnode.componentInstance = createComponentInstanceForVnode(
      vnode,
      activeInstance,
      parentElm,
      refElm
    );
    child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  } else if (vnode.data.keepAlive) {
    // kept-alive components, treat as a patch
    var mountedNode = vnode; // work around flow
    prepatch(mountedNode, mountedNode);
  }
}

function prepatch (
  oldVnode,
  vnode
) {
  var options = vnode.componentOptions;
  var child = vnode.componentInstance = oldVnode.componentInstance;
  updateChildComponent(
    child,
    options.propsData, // updated props
    options.listeners, // updated listeners
    vnode, // new parent vnode
    options.children // new children
  );
}

function insert (vnode) {
  if (!vnode.componentInstance._isMounted) {
    vnode.componentInstance._isMounted = true;
    callHook(vnode.componentInstance, 'mounted');
  }
  if (vnode.data.keepAlive) {
    activateChildComponent(vnode.componentInstance, true /* direct */);
  }
}

function destroy (vnode) {
  if (!vnode.componentInstance._isDestroyed) {
    if (!vnode.data.keepAlive) {
      vnode.componentInstance.$destroy();
    } else {
      deactivateChildComponent(vnode.componentInstance, true /* direct */);
    }
  }
}

function resolveAsyncComponent (
  factory,
  baseCtor,
  cb
) {
  if (factory.requested) {
    // pool callbacks
    factory.pendingCallbacks.push(cb);
  } else {
    factory.requested = true;
    var cbs = factory.pendingCallbacks = [cb];
    var sync = true;

    var resolve = function (res) {
      if (isObject(res)) {
        res = baseCtor.extend(res);
      }
      // cache resolved
      factory.resolved = res;
      // invoke callbacks only if this is not a synchronous resolve
      // (async resolves are shimmed as synchronous during SSR)
      if (!sync) {
        for (var i = 0, l = cbs.length; i < l; i++) {
          cbs[i](res);
        }
      }
    };

    var reject = function (reason) {
      "development" !== 'production' && warn(
        "Failed to resolve async component: " + (String(factory)) +
        (reason ? ("\nReason: " + reason) : '')
      );
    };

    var res = factory(resolve, reject);

    // handle promise
    if (res && typeof res.then === 'function' && !factory.resolved) {
      res.then(resolve, reject);
    }

    sync = false;
    // return in case resolved synchronously
    return factory.resolved
  }
}

function extractProps (data, Ctor) {
  // we are only extracting raw values here.
  // validation and default values are handled in the child
  // component itself.
  var propOptions = Ctor.options.props;
  if (!propOptions) {
    return
  }
  var res = {};
  var attrs = data.attrs;
  var props = data.props;
  var domProps = data.domProps;
  if (attrs || props || domProps) {
    for (var key in propOptions) {
      var altKey = hyphenate(key);
      checkProp(res, props, key, altKey, true) ||
      checkProp(res, attrs, key, altKey) ||
      checkProp(res, domProps, key, altKey);
    }
  }
  return res
}

function checkProp (
  res,
  hash,
  key,
  altKey,
  preserve
) {
  if (hash) {
    if (hasOwn(hash, key)) {
      res[key] = hash[key];
      if (!preserve) {
        delete hash[key];
      }
      return true
    } else if (hasOwn(hash, altKey)) {
      res[key] = hash[altKey];
      if (!preserve) {
        delete hash[altKey];
      }
      return true
    }
  }
  return false
}

function mergeHooks (data) {
  if (!data.hook) {
    data.hook = {};
  }
  for (var i = 0; i < hooksToMerge.length; i++) {
    var key = hooksToMerge[i];
    var fromParent = data.hook[key];
    var ours = hooks[key];
    data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  }
}

function mergeHook$1 (one, two) {
  return function (a, b, c, d) {
    one(a, b, c, d);
    two(a, b, c, d);
  }
}

// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel (options, data) {
  var prop = (options.model && options.model.prop) || 'value';
  var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  var on = data.on || (data.on = {});
  if (on[event]) {
    on[event] = [data.model.callback].concat(on[event]);
  } else {
    on[event] = data.model.callback;
  }
}

/*  */

var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;

// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement (
  context,
  tag,
  data,
  children,
  normalizationType,
  alwaysNormalize
) {
  if (Array.isArray(data) || isPrimitive(data)) {
    normalizationType = children;
    children = data;
    data = undefined;
  }
  if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  return _createElement(context, tag, data, children, normalizationType)
}

function _createElement (
  context,
  tag,
  data,
  children,
  normalizationType
) {
  if (data && data.__ob__) {
    "development" !== 'production' && warn(
      "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
      'Always create fresh vnode data objects in each render!',
      context
    );
    return createEmptyVNode()
  }
  if (!tag) {
    // in case of component :is set to falsy value
    return createEmptyVNode()
  }
  // support single function children as default scoped slot
  if (Array.isArray(children) &&
      typeof children[0] === 'function') {
    data = data || {};
    data.scopedSlots = { default: children[0] };
    children.length = 0;
  }
  if (normalizationType === ALWAYS_NORMALIZE) {
    children = normalizeChildren(children);
  } else if (normalizationType === SIMPLE_NORMALIZE) {
    children = simpleNormalizeChildren(children);
  }
  var vnode, ns;
  if (typeof tag === 'string') {
    var Ctor;
    ns = config.getTagNamespace(tag);
    if (config.isReservedTag(tag)) {
      // platform built-in elements
      vnode = new VNode(
        config.parsePlatformTagName(tag), data, children,
        undefined, undefined, context
      );
    } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
      // component
      vnode = createComponent(Ctor, data, context, children, tag);
    } else {
      // unknown or unlisted namespaced elements
      // check at runtime because it may get assigned a namespace when its
      // parent normalizes children
      vnode = new VNode(
        tag, data, children,
        undefined, undefined, context
      );
    }
  } else {
    // direct component options / constructor
    vnode = createComponent(tag, data, context, children);
  }
  if (vnode) {
    if (ns) { applyNS(vnode, ns); }
    return vnode
  } else {
    return createEmptyVNode()
  }
}

function applyNS (vnode, ns) {
  vnode.ns = ns;
  if (vnode.tag === 'foreignObject') {
    // use default namespace inside foreignObject
    return
  }
  if (vnode.children) {
    for (var i = 0, l = vnode.children.length; i < l; i++) {
      var child = vnode.children[i];
      if (child.tag && !child.ns) {
        applyNS(child, ns);
      }
    }
  }
}

/*  */

/**
 * Runtime helper for rendering v-for lists.
 */
function renderList (
  val,
  render
) {
  var ret, i, l, keys, key;
  if (Array.isArray(val) || typeof val === 'string') {
    ret = new Array(val.length);
    for (i = 0, l = val.length; i < l; i++) {
      ret[i] = render(val[i], i);
    }
  } else if (typeof val === 'number') {
    ret = new Array(val);
    for (i = 0; i < val; i++) {
      ret[i] = render(i + 1, i);
    }
  } else if (isObject(val)) {
    keys = Object.keys(val);
    ret = new Array(keys.length);
    for (i = 0, l = keys.length; i < l; i++) {
      key = keys[i];
      ret[i] = render(val[key], key, i);
    }
  }
  return ret
}

/*  */

/**
 * Runtime helper for rendering <slot>
 */
function renderSlot (
  name,
  fallback,
  props,
  bindObject
) {
  var scopedSlotFn = this.$scopedSlots[name];
  if (scopedSlotFn) { // scoped slot
    props = props || {};
    if (bindObject) {
      extend(props, bindObject);
    }
    return scopedSlotFn(props) || fallback
  } else {
    var slotNodes = this.$slots[name];
    // warn duplicate slot usage
    if (slotNodes && "development" !== 'production') {
      slotNodes._rendered && warn(
        "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
        "- this will likely cause render errors.",
        this
      );
      slotNodes._rendered = true;
    }
    return slotNodes || fallback
  }
}

/*  */

/**
 * Runtime helper for resolving filters
 */
function resolveFilter (id) {
  return resolveAsset(this.$options, 'filters', id, true) || identity
}

/*  */

/**
 * Runtime helper for checking keyCodes from config.
 */
function checkKeyCodes (
  eventKeyCode,
  key,
  builtInAlias
) {
  var keyCodes = config.keyCodes[key] || builtInAlias;
  if (Array.isArray(keyCodes)) {
    return keyCodes.indexOf(eventKeyCode) === -1
  } else {
    return keyCodes !== eventKeyCode
  }
}

/*  */

/**
 * Runtime helper for merging v-bind="object" into a VNode's data.
 */
function bindObjectProps (
  data,
  tag,
  value,
  asProp
) {
  if (value) {
    if (!isObject(value)) {
      "development" !== 'production' && warn(
        'v-bind without argument expects an Object or Array value',
        this
      );
    } else {
      if (Array.isArray(value)) {
        value = toObject(value);
      }
      for (var key in value) {
        if (key === 'class' || key === 'style') {
          data[key] = value[key];
        } else {
          var type = data.attrs && data.attrs.type;
          var hash = asProp || config.mustUseProp(tag, type, key)
            ? data.domProps || (data.domProps = {})
            : data.attrs || (data.attrs = {});
          hash[key] = value[key];
        }
      }
    }
  }
  return data
}

/*  */

/**
 * Runtime helper for rendering static trees.
 */
function renderStatic (
  index,
  isInFor
) {
  var tree = this._staticTrees[index];
  // if has already-rendered static tree and not inside v-for,
  // we can reuse the same tree by doing a shallow clone.
  if (tree && !isInFor) {
    return Array.isArray(tree)
      ? cloneVNodes(tree)
      : cloneVNode(tree)
  }
  // otherwise, render a fresh tree.
  tree = this._staticTrees[index] =
    this.$options.staticRenderFns[index].call(this._renderProxy);
  markStatic(tree, ("__static__" + index), false);
  return tree
}

/**
 * Runtime helper for v-once.
 * Effectively it means marking the node as static with a unique key.
 */
function markOnce (
  tree,
  index,
  key
) {
  markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  return tree
}

function markStatic (
  tree,
  key,
  isOnce
) {
  if (Array.isArray(tree)) {
    for (var i = 0; i < tree.length; i++) {
      if (tree[i] && typeof tree[i] !== 'string') {
        markStaticNode(tree[i], (key + "_" + i), isOnce);
      }
    }
  } else {
    markStaticNode(tree, key, isOnce);
  }
}

function markStaticNode (node, key, isOnce) {
  node.isStatic = true;
  node.key = key;
  node.isOnce = isOnce;
}

/*  */

function initRender (vm) {
  vm.$vnode = null; // the placeholder node in parent tree
  vm._vnode = null; // the root of the child tree
  vm._staticTrees = null;
  var parentVnode = vm.$options._parentVnode;
  var renderContext = parentVnode && parentVnode.context;
  vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  vm.$scopedSlots = emptyObject;
  // bind the createElement fn to this instance
  // so that we get proper render context inside it.
  // args order: tag, data, children, normalizationType, alwaysNormalize
  // internal version is used by render functions compiled from templates
  vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  // normalization is always applied for the public version, used in
  // user-written render functions.
  vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
}

function renderMixin (Vue) {
  Vue.prototype.$nextTick = function (fn) {
    return nextTick(fn, this)
  };

  Vue.prototype._render = function () {
    var vm = this;
    var ref = vm.$options;
    var render = ref.render;
    var staticRenderFns = ref.staticRenderFns;
    var _parentVnode = ref._parentVnode;

    if (vm._isMounted) {
      // clone slot nodes on re-renders
      for (var key in vm.$slots) {
        vm.$slots[key] = cloneVNodes(vm.$slots[key]);
      }
    }

    vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;

    if (staticRenderFns && !vm._staticTrees) {
      vm._staticTrees = [];
    }
    // set parent vnode. this allows render functions to have access
    // to the data on the placeholder node.
    vm.$vnode = _parentVnode;
    // render self
    var vnode;
    try {
      vnode = render.call(vm._renderProxy, vm.$createElement);
    } catch (e) {
      handleError(e, vm, "render function");
      // return error render result,
      // or previous vnode to prevent render error causing blank component
      /* istanbul ignore else */
      {
        vnode = vm.$options.renderError
          ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
          : vm._vnode;
      }
    }
    // return empty vnode in case the render function errored out
    if (!(vnode instanceof VNode)) {
      if ("development" !== 'production' && Array.isArray(vnode)) {
        warn(
          'Multiple root nodes returned from render function. Render function ' +
          'should return a single root node.',
          vm
        );
      }
      vnode = createEmptyVNode();
    }
    // set parent
    vnode.parent = _parentVnode;
    return vnode
  };

  // internal render helpers.
  // these are exposed on the instance prototype to reduce generated render
  // code size.
  Vue.prototype._o = markOnce;
  Vue.prototype._n = toNumber;
  Vue.prototype._s = _toString;
  Vue.prototype._l = renderList;
  Vue.prototype._t = renderSlot;
  Vue.prototype._q = looseEqual;
  Vue.prototype._i = looseIndexOf;
  Vue.prototype._m = renderStatic;
  Vue.prototype._f = resolveFilter;
  Vue.prototype._k = checkKeyCodes;
  Vue.prototype._b = bindObjectProps;
  Vue.prototype._v = createTextVNode;
  Vue.prototype._e = createEmptyVNode;
  Vue.prototype._u = resolveScopedSlots;
}

/*  */

function initInjections (vm) {
  var provide = vm.$options.provide;
  var inject = vm.$options.inject;
  if (provide) {
    vm._provided = typeof provide === 'function'
      ? provide.call(vm)
      : provide;
  }
  if (inject) {
    // inject is :any because flow is not smart enough to figure out cached
    // isArray here
    var isArray = Array.isArray(inject);
    var keys = isArray
      ? inject
      : hasSymbol
        ? Reflect.ownKeys(inject)
        : Object.keys(inject);

    for (var i = 0; i < keys.length; i++) {
      var key = keys[i];
      var provideKey = isArray ? key : inject[key];
      var source = vm;
      while (source) {
        if (source._provided && source._provided[provideKey]) {
          vm[key] = source._provided[provideKey];
          break
        }
        source = source.$parent;
      }
    }
  }
}

/*  */

var uid = 0;

function initMixin (Vue) {
  Vue.prototype._init = function (options) {
    /* istanbul ignore if */
    if ("development" !== 'production' && config.performance && perf) {
      perf.mark('init');
    }

    var vm = this;
    // a uid
    vm._uid = uid++;
    // a flag to avoid this being observed
    vm._isVue = true;
    // merge options
    if (options && options._isComponent) {
      // optimize internal component instantiation
      // since dynamic options merging is pretty slow, and none of the
      // internal component options needs special treatment.
      initInternalComponent(vm, options);
    } else {
      vm.$options = mergeOptions(
        resolveConstructorOptions(vm.constructor),
        options || {},
        vm
      );
    }
    /* istanbul ignore else */
    {
      initProxy(vm);
    }
    // expose real self
    vm._self = vm;
    initLifecycle(vm);
    initEvents(vm);
    initRender(vm);
    callHook(vm, 'beforeCreate');
    initState(vm);
    initInjections(vm);
    callHook(vm, 'created');

    /* istanbul ignore if */
    if ("development" !== 'production' && config.performance && perf) {
      vm._name = formatComponentName(vm, false);
      perf.mark('init end');
      perf.measure(((vm._name) + " init"), 'init', 'init end');
    }

    if (vm.$options.el) {
      vm.$mount(vm.$options.el);
    }
  };
}

function initInternalComponent (vm, options) {
  var opts = vm.$options = Object.create(vm.constructor.options);
  // doing this because it's faster than dynamic enumeration.
  opts.parent = options.parent;
  opts.propsData = options.propsData;
  opts._parentVnode = options._parentVnode;
  opts._parentListeners = options._parentListeners;
  opts._renderChildren = options._renderChildren;
  opts._componentTag = options._componentTag;
  opts._parentElm = options._parentElm;
  opts._refElm = options._refElm;
  if (options.render) {
    opts.render = options.render;
    opts.staticRenderFns = options.staticRenderFns;
  }
}

function resolveConstructorOptions (Ctor) {
  var options = Ctor.options;
  if (Ctor.super) {
    var superOptions = resolveConstructorOptions(Ctor.super);
    var cachedSuperOptions = Ctor.superOptions;
    if (superOptions !== cachedSuperOptions) {
      // super option changed,
      // need to resolve new options.
      Ctor.superOptions = superOptions;
      // check if there are any late-modified/attached options (#4976)
      var modifiedOptions = resolveModifiedOptions(Ctor);
      // update base extend options
      if (modifiedOptions) {
        extend(Ctor.extendOptions, modifiedOptions);
      }
      options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
      if (options.name) {
        options.components[options.name] = Ctor;
      }
    }
  }
  return options
}

function resolveModifiedOptions (Ctor) {
  var modified;
  var latest = Ctor.options;
  var sealed = Ctor.sealedOptions;
  for (var key in latest) {
    if (latest[key] !== sealed[key]) {
      if (!modified) { modified = {}; }
      modified[key] = dedupe(latest[key], sealed[key]);
    }
  }
  return modified
}

function dedupe (latest, sealed) {
  // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  // between merges
  if (Array.isArray(latest)) {
    var res = [];
    sealed = Array.isArray(sealed) ? sealed : [sealed];
    for (var i = 0; i < latest.length; i++) {
      if (sealed.indexOf(latest[i]) < 0) {
        res.push(latest[i]);
      }
    }
    return res
  } else {
    return latest
  }
}

function Vue$3 (options) {
  if ("development" !== 'production' &&
    !(this instanceof Vue$3)) {
    warn('Vue is a constructor and should be called with the `new` keyword');
  }
  this._init(options);
}

initMixin(Vue$3);
stateMixin(Vue$3);
eventsMixin(Vue$3);
lifecycleMixin(Vue$3);
renderMixin(Vue$3);

/*  */

function initUse (Vue) {
  Vue.use = function (plugin) {
    /* istanbul ignore if */
    if (plugin.installed) {
      return
    }
    // additional parameters
    var args = toArray(arguments, 1);
    args.unshift(this);
    if (typeof plugin.install === 'function') {
      plugin.install.apply(plugin, args);
    } else if (typeof plugin === 'function') {
      plugin.apply(null, args);
    }
    plugin.installed = true;
    return this
  };
}

/*  */

function initMixin$1 (Vue) {
  Vue.mixin = function (mixin) {
    this.options = mergeOptions(this.options, mixin);
  };
}

/*  */

function initExtend (Vue) {
  /**
   * Each instance constructor, including Vue, has a unique
   * cid. This enables us to create wrapped "child
   * constructors" for prototypal inheritance and cache them.
   */
  Vue.cid = 0;
  var cid = 1;

  /**
   * Class inheritance
   */
  Vue.extend = function (extendOptions) {
    extendOptions = extendOptions || {};
    var Super = this;
    var SuperId = Super.cid;
    var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
    if (cachedCtors[SuperId]) {
      return cachedCtors[SuperId]
    }

    var name = extendOptions.name || Super.options.name;
    {
      if (!/^[a-zA-Z][\w-]*$/.test(name)) {
        warn(
          'Invalid component name: "' + name + '". Component names ' +
          'can only contain alphanumeric characters and the hyphen, ' +
          'and must start with a letter.'
        );
      }
    }

    var Sub = function VueComponent (options) {
      this._init(options);
    };
    Sub.prototype = Object.create(Super.prototype);
    Sub.prototype.constructor = Sub;
    Sub.cid = cid++;
    Sub.options = mergeOptions(
      Super.options,
      extendOptions
    );
    Sub['super'] = Super;

    // For props and computed properties, we define the proxy getters on
    // the Vue instances at extension time, on the extended prototype. This
    // avoids Object.defineProperty calls for each instance created.
    if (Sub.options.props) {
      initProps$1(Sub);
    }
    if (Sub.options.computed) {
      initComputed$1(Sub);
    }

    // allow further extension/mixin/plugin usage
    Sub.extend = Super.extend;
    Sub.mixin = Super.mixin;
    Sub.use = Super.use;

    // create asset registers, so extended classes
    // can have their private assets too.
    config._assetTypes.forEach(function (type) {
      Sub[type] = Super[type];
    });
    // enable recursive self-lookup
    if (name) {
      Sub.options.components[name] = Sub;
    }

    // keep a reference to the super options at extension time.
    // later at instantiation we can check if Super's options have
    // been updated.
    Sub.superOptions = Super.options;
    Sub.extendOptions = extendOptions;
    Sub.sealedOptions = extend({}, Sub.options);

    // cache constructor
    cachedCtors[SuperId] = Sub;
    return Sub
  };
}

function initProps$1 (Comp) {
  var props = Comp.options.props;
  for (var key in props) {
    proxy(Comp.prototype, "_props", key);
  }
}

function initComputed$1 (Comp) {
  var computed = Comp.options.computed;
  for (var key in computed) {
    defineComputed(Comp.prototype, key, computed[key]);
  }
}

/*  */

function initAssetRegisters (Vue) {
  /**
   * Create asset registration methods.
   */
  config._assetTypes.forEach(function (type) {
    Vue[type] = function (
      id,
      definition
    ) {
      if (!definition) {
        return this.options[type + 's'][id]
      } else {
        /* istanbul ignore if */
        {
          if (type === 'component' && config.isReservedTag(id)) {
            warn(
              'Do not use built-in or reserved HTML elements as component ' +
              'id: ' + id
            );
          }
        }
        if (type === 'component' && isPlainObject(definition)) {
          definition.name = definition.name || id;
          definition = this.options._base.extend(definition);
        }
        if (type === 'directive' && typeof definition === 'function') {
          definition = { bind: definition, update: definition };
        }
        this.options[type + 's'][id] = definition;
        return definition
      }
    };
  });
}

/*  */

var patternTypes = [String, RegExp];

function getComponentName (opts) {
  return opts && (opts.Ctor.options.name || opts.tag)
}

function matches (pattern, name) {
  if (typeof pattern === 'string') {
    return pattern.split(',').indexOf(name) > -1
  } else if (pattern instanceof RegExp) {
    return pattern.test(name)
  }
  /* istanbul ignore next */
  return false
}

function pruneCache (cache, filter) {
  for (var key in cache) {
    var cachedNode = cache[key];
    if (cachedNode) {
      var name = getComponentName(cachedNode.componentOptions);
      if (name && !filter(name)) {
        pruneCacheEntry(cachedNode);
        cache[key] = null;
      }
    }
  }
}

function pruneCacheEntry (vnode) {
  if (vnode) {
    if (!vnode.componentInstance._inactive) {
      callHook(vnode.componentInstance, 'deactivated');
    }
    vnode.componentInstance.$destroy();
  }
}

var KeepAlive = {
  name: 'keep-alive',
  abstract: true,

  props: {
    include: patternTypes,
    exclude: patternTypes
  },

  created: function created () {
    this.cache = Object.create(null);
  },

  destroyed: function destroyed () {
    var this$1 = this;

    for (var key in this$1.cache) {
      pruneCacheEntry(this$1.cache[key]);
    }
  },

  watch: {
    include: function include (val) {
      pruneCache(this.cache, function (name) { return matches(val, name); });
    },
    exclude: function exclude (val) {
      pruneCache(this.cache, function (name) { return !matches(val, name); });
    }
  },

  render: function render () {
    var vnode = getFirstComponentChild(this.$slots.default);
    var componentOptions = vnode && vnode.componentOptions;
    if (componentOptions) {
      // check pattern
      var name = getComponentName(componentOptions);
      if (name && (
        (this.include && !matches(this.include, name)) ||
        (this.exclude && matches(this.exclude, name))
      )) {
        return vnode
      }
      var key = vnode.key == null
        // same constructor may get registered as different local components
        // so cid alone is not enough (#3269)
        ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
        : vnode.key;
      if (this.cache[key]) {
        vnode.componentInstance = this.cache[key].componentInstance;
      } else {
        this.cache[key] = vnode;
      }
      vnode.data.keepAlive = true;
    }
    return vnode
  }
};

var builtInComponents = {
  KeepAlive: KeepAlive
};

/*  */

function initGlobalAPI (Vue) {
  // config
  var configDef = {};
  configDef.get = function () { return config; };
  {
    configDef.set = function () {
      warn(
        'Do not replace the Vue.config object, set individual fields instead.'
      );
    };
  }
  Object.defineProperty(Vue, 'config', configDef);

  // exposed util methods.
  // NOTE: these are not considered part of the public API - avoid relying on
  // them unless you are aware of the risk.
  Vue.util = {
    warn: warn,
    extend: extend,
    mergeOptions: mergeOptions,
    defineReactive: defineReactive$$1
  };

  Vue.set = set;
  Vue.delete = del;
  Vue.nextTick = nextTick;

  Vue.options = Object.create(null);
  config._assetTypes.forEach(function (type) {
    Vue.options[type + 's'] = Object.create(null);
  });

  // this is used to identify the "base" constructor to extend all plain-object
  // components with in Weex's multi-instance scenarios.
  Vue.options._base = Vue;

  extend(Vue.options.components, builtInComponents);

  initUse(Vue);
  initMixin$1(Vue);
  initExtend(Vue);
  initAssetRegisters(Vue);
}

initGlobalAPI(Vue$3);

Object.defineProperty(Vue$3.prototype, '$isServer', {
  get: isServerRendering
});

Vue$3.version = '2.2.0';

/*  */

// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select');
var mustUseProp = function (tag, type, attr) {
  return (
    (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
    (attr === 'selected' && tag === 'option') ||
    (attr === 'checked' && tag === 'input') ||
    (attr === 'muted' && tag === 'video')
  )
};

var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');

var isBooleanAttr = makeMap(
  'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  'required,reversed,scoped,seamless,selected,sortable,translate,' +
  'truespeed,typemustmatch,visible'
);

var xlinkNS = 'http://www.w3.org/1999/xlink';

var isXlink = function (name) {
  return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
};

var getXlinkProp = function (name) {
  return isXlink(name) ? name.slice(6, name.length) : ''
};

var isFalsyAttrValue = function (val) {
  return val == null || val === false
};

/*  */

function genClassForVnode (vnode) {
  var data = vnode.data;
  var parentNode = vnode;
  var childNode = vnode;
  while (childNode.componentInstance) {
    childNode = childNode.componentInstance._vnode;
    if (childNode.data) {
      data = mergeClassData(childNode.data, data);
    }
  }
  while ((parentNode = parentNode.parent)) {
    if (parentNode.data) {
      data = mergeClassData(data, parentNode.data);
    }
  }
  return genClassFromData(data)
}

function mergeClassData (child, parent) {
  return {
    staticClass: concat(child.staticClass, parent.staticClass),
    class: child.class
      ? [child.class, parent.class]
      : parent.class
  }
}

function genClassFromData (data) {
  var dynamicClass = data.class;
  var staticClass = data.staticClass;
  if (staticClass || dynamicClass) {
    return concat(staticClass, stringifyClass(dynamicClass))
  }
  /* istanbul ignore next */
  return ''
}

function concat (a, b) {
  return a ? b ? (a + ' ' + b) : a : (b || '')
}

function stringifyClass (value) {
  var res = '';
  if (!value) {
    return res
  }
  if (typeof value === 'string') {
    return value
  }
  if (Array.isArray(value)) {
    var stringified;
    for (var i = 0, l = value.length; i < l; i++) {
      if (value[i]) {
        if ((stringified = stringifyClass(value[i]))) {
          res += stringified + ' ';
        }
      }
    }
    return res.slice(0, -1)
  }
  if (isObject(value)) {
    for (var key in value) {
      if (value[key]) { res += key + ' '; }
    }
    return res.slice(0, -1)
  }
  /* istanbul ignore next */
  return res
}

/*  */

var namespaceMap = {
  svg: 'http://www.w3.org/2000/svg',
  math: 'http://www.w3.org/1998/Math/MathML'
};

var isHTMLTag = makeMap(
  'html,body,base,head,link,meta,style,title,' +
  'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  'embed,object,param,source,canvas,script,noscript,del,ins,' +
  'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  'output,progress,select,textarea,' +
  'details,dialog,menu,menuitem,summary,' +
  'content,element,shadow,template'
);

// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap(
  'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  true
);

var isPreTag = function (tag) { return tag === 'pre'; };

var isReservedTag = function (tag) {
  return isHTMLTag(tag) || isSVG(tag)
};

function getTagNamespace (tag) {
  if (isSVG(tag)) {
    return 'svg'
  }
  // basic support for MathML
  // note it doesn't support other MathML elements being component roots
  if (tag === 'math') {
    return 'math'
  }
}

var unknownElementCache = Object.create(null);
function isUnknownElement (tag) {
  /* istanbul ignore if */
  if (!inBrowser) {
    return true
  }
  if (isReservedTag(tag)) {
    return false
  }
  tag = tag.toLowerCase();
  /* istanbul ignore if */
  if (unknownElementCache[tag] != null) {
    return unknownElementCache[tag]
  }
  var el = document.createElement(tag);
  if (tag.indexOf('-') > -1) {
    // http://stackoverflow.com/a/28210364/1070244
    return (unknownElementCache[tag] = (
      el.constructor === window.HTMLUnknownElement ||
      el.constructor === window.HTMLElement
    ))
  } else {
    return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  }
}

/*  */

/**
 * Query an element selector if it's not an element already.
 */
function query (el) {
  if (typeof el === 'string') {
    var selected = document.querySelector(el);
    if (!selected) {
      "development" !== 'production' && warn(
        'Cannot find element: ' + el
      );
      return document.createElement('div')
    }
    return selected
  } else {
    return el
  }
}

/*  */

function createElement$1 (tagName, vnode) {
  var elm = document.createElement(tagName);
  if (tagName !== 'select') {
    return elm
  }
  // false or null will remove the attribute but undefined will not
  if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
    elm.setAttribute('multiple', 'multiple');
  }
  return elm
}

function createElementNS (namespace, tagName) {
  return document.createElementNS(namespaceMap[namespace], tagName)
}

function createTextNode (text) {
  return document.createTextNode(text)
}

function createComment (text) {
  return document.createComment(text)
}

function insertBefore (parentNode, newNode, referenceNode) {
  parentNode.insertBefore(newNode, referenceNode);
}

function removeChild (node, child) {
  node.removeChild(child);
}

function appendChild (node, child) {
  node.appendChild(child);
}

function parentNode (node) {
  return node.parentNode
}

function nextSibling (node) {
  return node.nextSibling
}

function tagName (node) {
  return node.tagName
}

function setTextContent (node, text) {
  node.textContent = text;
}

function setAttribute (node, key, val) {
  node.setAttribute(key, val);
}


var nodeOps = Object.freeze({
	createElement: createElement$1,
	createElementNS: createElementNS,
	createTextNode: createTextNode,
	createComment: createComment,
	insertBefore: insertBefore,
	removeChild: removeChild,
	appendChild: appendChild,
	parentNode: parentNode,
	nextSibling: nextSibling,
	tagName: tagName,
	setTextContent: setTextContent,
	setAttribute: setAttribute
});

/*  */

var ref = {
  create: function create (_, vnode) {
    registerRef(vnode);
  },
  update: function update (oldVnode, vnode) {
    if (oldVnode.data.ref !== vnode.data.ref) {
      registerRef(oldVnode, true);
      registerRef(vnode);
    }
  },
  destroy: function destroy (vnode) {
    registerRef(vnode, true);
  }
};

function registerRef (vnode, isRemoval) {
  var key = vnode.data.ref;
  if (!key) { return }

  var vm = vnode.context;
  var ref = vnode.componentInstance || vnode.elm;
  var refs = vm.$refs;
  if (isRemoval) {
    if (Array.isArray(refs[key])) {
      remove(refs[key], ref);
    } else if (refs[key] === ref) {
      refs[key] = undefined;
    }
  } else {
    if (vnode.data.refInFor) {
      if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
        refs[key].push(ref);
      } else {
        refs[key] = [ref];
      }
    } else {
      refs[key] = ref;
    }
  }
}

/**
 * Virtual DOM patching algorithm based on Snabbdom by
 * Simon Friis Vindum (@paldepind)
 * Licensed under the MIT License
 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
 *
 * modified by Evan You (@yyx990803)
 *

/*
 * Not type-checking this because this file is perf-critical and the cost
 * of making flow understand it is not worth it.
 */

var emptyNode = new VNode('', {}, []);

var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy'];

function isUndef (s) {
  return s == null
}

function isDef (s) {
  return s != null
}

function sameVnode (vnode1, vnode2) {
  return (
    vnode1.key === vnode2.key &&
    vnode1.tag === vnode2.tag &&
    vnode1.isComment === vnode2.isComment &&
    !vnode1.data === !vnode2.data
  )
}

function createKeyToOldIdx (children, beginIdx, endIdx) {
  var i, key;
  var map = {};
  for (i = beginIdx; i <= endIdx; ++i) {
    key = children[i].key;
    if (isDef(key)) { map[key] = i; }
  }
  return map
}

function createPatchFunction (backend) {
  var i, j;
  var cbs = {};

  var modules = backend.modules;
  var nodeOps = backend.nodeOps;

  for (i = 0; i < hooks$1.length; ++i) {
    cbs[hooks$1[i]] = [];
    for (j = 0; j < modules.length; ++j) {
      if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
    }
  }

  function emptyNodeAt (elm) {
    return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  }

  function createRmCb (childElm, listeners) {
    function remove$$1 () {
      if (--remove$$1.listeners === 0) {
        removeNode(childElm);
      }
    }
    remove$$1.listeners = listeners;
    return remove$$1
  }

  function removeNode (el) {
    var parent = nodeOps.parentNode(el);
    // element may have already been removed due to v-html / v-text
    if (parent) {
      nodeOps.removeChild(parent, el);
    }
  }

  var inPre = 0;
  function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
    vnode.isRootInsert = !nested; // for transition enter check
    if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
      return
    }

    var data = vnode.data;
    var children = vnode.children;
    var tag = vnode.tag;
    if (isDef(tag)) {
      {
        if (data && data.pre) {
          inPre++;
        }
        if (
          !inPre &&
          !vnode.ns &&
          !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
          config.isUnknownElement(tag)
        ) {
          warn(
            'Unknown custom element: <' + tag + '> - did you ' +
            'register the component correctly? For recursive components, ' +
            'make sure to provide the "name" option.',
            vnode.context
          );
        }
      }
      vnode.elm = vnode.ns
        ? nodeOps.createElementNS(vnode.ns, tag)
        : nodeOps.createElement(tag, vnode);
      setScope(vnode);

      /* istanbul ignore if */
      {
        createChildren(vnode, children, insertedVnodeQueue);
        if (isDef(data)) {
          invokeCreateHooks(vnode, insertedVnodeQueue);
        }
        insert(parentElm, vnode.elm, refElm);
      }

      if ("development" !== 'production' && data && data.pre) {
        inPre--;
      }
    } else if (vnode.isComment) {
      vnode.elm = nodeOps.createComment(vnode.text);
      insert(parentElm, vnode.elm, refElm);
    } else {
      vnode.elm = nodeOps.createTextNode(vnode.text);
      insert(parentElm, vnode.elm, refElm);
    }
  }

  function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
    var i = vnode.data;
    if (isDef(i)) {
      var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
      if (isDef(i = i.hook) && isDef(i = i.init)) {
        i(vnode, false /* hydrating */, parentElm, refElm);
      }
      // after calling the init hook, if the vnode is a child component
      // it should've created a child instance and mounted it. the child
      // component also has set the placeholder vnode's elm.
      // in that case we can just return the element and be done.
      if (isDef(vnode.componentInstance)) {
        initComponent(vnode, insertedVnodeQueue);
        if (isReactivated) {
          reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
        }
        return true
      }
    }
  }

  function initComponent (vnode, insertedVnodeQueue) {
    if (vnode.data.pendingInsert) {
      insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
    }
    vnode.elm = vnode.componentInstance.$el;
    if (isPatchable(vnode)) {
      invokeCreateHooks(vnode, insertedVnodeQueue);
      setScope(vnode);
    } else {
      // empty component root.
      // skip all element-related modules except for ref (#3455)
      registerRef(vnode);
      // make sure to invoke the insert hook
      insertedVnodeQueue.push(vnode);
    }
  }

  function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
    var i;
    // hack for #4339: a reactivated component with inner transition
    // does not trigger because the inner node's created hooks are not called
    // again. It's not ideal to involve module-specific logic in here but
    // there doesn't seem to be a better way to do it.
    var innerNode = vnode;
    while (innerNode.componentInstance) {
      innerNode = innerNode.componentInstance._vnode;
      if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
        for (i = 0; i < cbs.activate.length; ++i) {
          cbs.activate[i](emptyNode, innerNode);
        }
        insertedVnodeQueue.push(innerNode);
        break
      }
    }
    // unlike a newly created component,
    // a reactivated keep-alive component doesn't insert itself
    insert(parentElm, vnode.elm, refElm);
  }

  function insert (parent, elm, ref) {
    if (parent) {
      if (ref) {
        nodeOps.insertBefore(parent, elm, ref);
      } else {
        nodeOps.appendChild(parent, elm);
      }
    }
  }

  function createChildren (vnode, children, insertedVnodeQueue) {
    if (Array.isArray(children)) {
      for (var i = 0; i < children.length; ++i) {
        createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
      }
    } else if (isPrimitive(vnode.text)) {
      nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
    }
  }

  function isPatchable (vnode) {
    while (vnode.componentInstance) {
      vnode = vnode.componentInstance._vnode;
    }
    return isDef(vnode.tag)
  }

  function invokeCreateHooks (vnode, insertedVnodeQueue) {
    for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
      cbs.create[i$1](emptyNode, vnode);
    }
    i = vnode.data.hook; // Reuse variable
    if (isDef(i)) {
      if (i.create) { i.create(emptyNode, vnode); }
      if (i.insert) { insertedVnodeQueue.push(vnode); }
    }
  }

  // set scope id attribute for scoped CSS.
  // this is implemented as a special case to avoid the overhead
  // of going through the normal attribute patching process.
  function setScope (vnode) {
    var i;
    var ancestor = vnode;
    while (ancestor) {
      if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
        nodeOps.setAttribute(vnode.elm, i, '');
      }
      ancestor = ancestor.parent;
    }
    // for slot content they should also get the scopeId from the host instance.
    if (isDef(i = activeInstance) &&
        i !== vnode.context &&
        isDef(i = i.$options._scopeId)) {
      nodeOps.setAttribute(vnode.elm, i, '');
    }
  }

  function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
    for (; startIdx <= endIdx; ++startIdx) {
      createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
    }
  }

  function invokeDestroyHook (vnode) {
    var i, j;
    var data = vnode.data;
    if (isDef(data)) {
      if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
      for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
    }
    if (isDef(i = vnode.children)) {
      for (j = 0; j < vnode.children.length; ++j) {
        invokeDestroyHook(vnode.children[j]);
      }
    }
  }

  function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
    for (; startIdx <= endIdx; ++startIdx) {
      var ch = vnodes[startIdx];
      if (isDef(ch)) {
        if (isDef(ch.tag)) {
          removeAndInvokeRemoveHook(ch);
          invokeDestroyHook(ch);
        } else { // Text node
          removeNode(ch.elm);
        }
      }
    }
  }

  function removeAndInvokeRemoveHook (vnode, rm) {
    if (rm || isDef(vnode.data)) {
      var listeners = cbs.remove.length + 1;
      if (!rm) {
        // directly removing
        rm = createRmCb(vnode.elm, listeners);
      } else {
        // we have a recursively passed down rm callback
        // increase the listeners count
        rm.listeners += listeners;
      }
      // recursively invoke hooks on child component root node
      if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
        removeAndInvokeRemoveHook(i, rm);
      }
      for (i = 0; i < cbs.remove.length; ++i) {
        cbs.remove[i](vnode, rm);
      }
      if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
        i(vnode, rm);
      } else {
        rm();
      }
    } else {
      removeNode(vnode.elm);
    }
  }

  function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
    var oldStartIdx = 0;
    var newStartIdx = 0;
    var oldEndIdx = oldCh.length - 1;
    var oldStartVnode = oldCh[0];
    var oldEndVnode = oldCh[oldEndIdx];
    var newEndIdx = newCh.length - 1;
    var newStartVnode = newCh[0];
    var newEndVnode = newCh[newEndIdx];
    var oldKeyToIdx, idxInOld, elmToMove, refElm;

    // removeOnly is a special flag used only by <transition-group>
    // to ensure removed elements stay in correct relative positions
    // during leaving transitions
    var canMove = !removeOnly;

    while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
      if (isUndef(oldStartVnode)) {
        oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
      } else if (isUndef(oldEndVnode)) {
        oldEndVnode = oldCh[--oldEndIdx];
      } else if (sameVnode(oldStartVnode, newStartVnode)) {
        patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
        oldStartVnode = oldCh[++oldStartIdx];
        newStartVnode = newCh[++newStartIdx];
      } else if (sameVnode(oldEndVnode, newEndVnode)) {
        patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
        oldEndVnode = oldCh[--oldEndIdx];
        newEndVnode = newCh[--newEndIdx];
      } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
        patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
        canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
        oldStartVnode = oldCh[++oldStartIdx];
        newEndVnode = newCh[--newEndIdx];
      } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
        patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
        canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
        oldEndVnode = oldCh[--oldEndIdx];
        newStartVnode = newCh[++newStartIdx];
      } else {
        if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
        idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
        if (isUndef(idxInOld)) { // New element
          createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
          newStartVnode = newCh[++newStartIdx];
        } else {
          elmToMove = oldCh[idxInOld];
          /* istanbul ignore if */
          if ("development" !== 'production' && !elmToMove) {
            warn(
              'It seems there are duplicate keys that is causing an update error. ' +
              'Make sure each v-for item has a unique key.'
            );
          }
          if (sameVnode(elmToMove, newStartVnode)) {
            patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
            oldCh[idxInOld] = undefined;
            canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
            newStartVnode = newCh[++newStartIdx];
          } else {
            // same key but different element. treat as new element
            createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
            newStartVnode = newCh[++newStartIdx];
          }
        }
      }
    }
    if (oldStartIdx > oldEndIdx) {
      refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
      addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
    } else if (newStartIdx > newEndIdx) {
      removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
    }
  }

  function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
    if (oldVnode === vnode) {
      return
    }
    // reuse element for static trees.
    // note we only do this if the vnode is cloned -
    // if the new node is not cloned it means the render functions have been
    // reset by the hot-reload-api and we need to do a proper re-render.
    if (vnode.isStatic &&
        oldVnode.isStatic &&
        vnode.key === oldVnode.key &&
        (vnode.isCloned || vnode.isOnce)) {
      vnode.elm = oldVnode.elm;
      vnode.componentInstance = oldVnode.componentInstance;
      return
    }
    var i;
    var data = vnode.data;
    var hasData = isDef(data);
    if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
      i(oldVnode, vnode);
    }
    var elm = vnode.elm = oldVnode.elm;
    var oldCh = oldVnode.children;
    var ch = vnode.children;
    if (hasData && isPatchable(vnode)) {
      for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
      if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
    }
    if (isUndef(vnode.text)) {
      if (isDef(oldCh) && isDef(ch)) {
        if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
      } else if (isDef(ch)) {
        if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
        addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
      } else if (isDef(oldCh)) {
        removeVnodes(elm, oldCh, 0, oldCh.length - 1);
      } else if (isDef(oldVnode.text)) {
        nodeOps.setTextContent(elm, '');
      }
    } else if (oldVnode.text !== vnode.text) {
      nodeOps.setTextContent(elm, vnode.text);
    }
    if (hasData) {
      if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
    }
  }

  function invokeInsertHook (vnode, queue, initial) {
    // delay insert hooks for component root nodes, invoke them after the
    // element is really inserted
    if (initial && vnode.parent) {
      vnode.parent.data.pendingInsert = queue;
    } else {
      for (var i = 0; i < queue.length; ++i) {
        queue[i].data.hook.insert(queue[i]);
      }
    }
  }

  var bailed = false;
  // list of modules that can skip create hook during hydration because they
  // are already rendered on the client or has no need for initialization
  var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');

  // Note: this is a browser-only function so we can assume elms are DOM nodes.
  function hydrate (elm, vnode, insertedVnodeQueue) {
    {
      if (!assertNodeMatch(elm, vnode)) {
        return false
      }
    }
    vnode.elm = elm;
    var tag = vnode.tag;
    var data = vnode.data;
    var children = vnode.children;
    if (isDef(data)) {
      if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
      if (isDef(i = vnode.componentInstance)) {
        // child component. it should have hydrated its own tree.
        initComponent(vnode, insertedVnodeQueue);
        return true
      }
    }
    if (isDef(tag)) {
      if (isDef(children)) {
        // empty element, allow client to pick up and populate children
        if (!elm.hasChildNodes()) {
          createChildren(vnode, children, insertedVnodeQueue);
        } else {
          var childrenMatch = true;
          var childNode = elm.firstChild;
          for (var i$1 = 0; i$1 < children.length; i$1++) {
            if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
              childrenMatch = false;
              break
            }
            childNode = childNode.nextSibling;
          }
          // if childNode is not null, it means the actual childNodes list is
          // longer than the virtual children list.
          if (!childrenMatch || childNode) {
            if ("development" !== 'production' &&
                typeof console !== 'undefined' &&
                !bailed) {
              bailed = true;
              console.warn('Parent: ', elm);
              console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
            }
            return false
          }
        }
      }
      if (isDef(data)) {
        for (var key in data) {
          if (!isRenderedModule(key)) {
            invokeCreateHooks(vnode, insertedVnodeQueue);
            break
          }
        }
      }
    } else if (elm.data !== vnode.text) {
      elm.data = vnode.text;
    }
    return true
  }

  function assertNodeMatch (node, vnode) {
    if (vnode.tag) {
      return (
        vnode.tag.indexOf('vue-component') === 0 ||
        vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
      )
    } else {
      return node.nodeType === (vnode.isComment ? 8 : 3)
    }
  }

  return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
    if (!vnode) {
      if (oldVnode) { invokeDestroyHook(oldVnode); }
      return
    }

    var isInitialPatch = false;
    var insertedVnodeQueue = [];

    if (!oldVnode) {
      // empty mount (likely as component), create new root element
      isInitialPatch = true;
      createElm(vnode, insertedVnodeQueue, parentElm, refElm);
    } else {
      var isRealElement = isDef(oldVnode.nodeType);
      if (!isRealElement && sameVnode(oldVnode, vnode)) {
        // patch existing root node
        patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
      } else {
        if (isRealElement) {
          // mounting to a real element
          // check if this is server-rendered content and if we can perform
          // a successful hydration.
          if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
            oldVnode.removeAttribute('server-rendered');
            hydrating = true;
          }
          if (hydrating) {
            if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
              invokeInsertHook(vnode, insertedVnodeQueue, true);
              return oldVnode
            } else {
              warn(
                'The client-side rendered virtual DOM tree is not matching ' +
                'server-rendered content. This is likely caused by incorrect ' +
                'HTML markup, for example nesting block-level elements inside ' +
                '<p>, or missing <tbody>. Bailing hydration and performing ' +
                'full client-side render.'
              );
            }
          }
          // either not server-rendered, or hydration failed.
          // create an empty node and replace it
          oldVnode = emptyNodeAt(oldVnode);
        }
        // replacing existing element
        var oldElm = oldVnode.elm;
        var parentElm$1 = nodeOps.parentNode(oldElm);
        createElm(
          vnode,
          insertedVnodeQueue,
          // extremely rare edge case: do not insert if old element is in a
          // leaving transition. Only happens when combining transition +
          // keep-alive + HOCs. (#4590)
          oldElm._leaveCb ? null : parentElm$1,
          nodeOps.nextSibling(oldElm)
        );

        if (vnode.parent) {
          // component root element replaced.
          // update parent placeholder node element, recursively
          var ancestor = vnode.parent;
          while (ancestor) {
            ancestor.elm = vnode.elm;
            ancestor = ancestor.parent;
          }
          if (isPatchable(vnode)) {
            for (var i = 0; i < cbs.create.length; ++i) {
              cbs.create[i](emptyNode, vnode.parent);
            }
          }
        }

        if (parentElm$1 !== null) {
          removeVnodes(parentElm$1, [oldVnode], 0, 0);
        } else if (isDef(oldVnode.tag)) {
          invokeDestroyHook(oldVnode);
        }
      }
    }

    invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
    return vnode.elm
  }
}

/*  */

var directives = {
  create: updateDirectives,
  update: updateDirectives,
  destroy: function unbindDirectives (vnode) {
    updateDirectives(vnode, emptyNode);
  }
};

function updateDirectives (oldVnode, vnode) {
  if (oldVnode.data.directives || vnode.data.directives) {
    _update(oldVnode, vnode);
  }
}

function _update (oldVnode, vnode) {
  var isCreate = oldVnode === emptyNode;
  var isDestroy = vnode === emptyNode;
  var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);

  var dirsWithInsert = [];
  var dirsWithPostpatch = [];

  var key, oldDir, dir;
  for (key in newDirs) {
    oldDir = oldDirs[key];
    dir = newDirs[key];
    if (!oldDir) {
      // new directive, bind
      callHook$1(dir, 'bind', vnode, oldVnode);
      if (dir.def && dir.def.inserted) {
        dirsWithInsert.push(dir);
      }
    } else {
      // existing directive, update
      dir.oldValue = oldDir.value;
      callHook$1(dir, 'update', vnode, oldVnode);
      if (dir.def && dir.def.componentUpdated) {
        dirsWithPostpatch.push(dir);
      }
    }
  }

  if (dirsWithInsert.length) {
    var callInsert = function () {
      for (var i = 0; i < dirsWithInsert.length; i++) {
        callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
      }
    };
    if (isCreate) {
      mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
    } else {
      callInsert();
    }
  }

  if (dirsWithPostpatch.length) {
    mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
      for (var i = 0; i < dirsWithPostpatch.length; i++) {
        callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
      }
    });
  }

  if (!isCreate) {
    for (key in oldDirs) {
      if (!newDirs[key]) {
        // no longer present, unbind
        callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
      }
    }
  }
}

var emptyModifiers = Object.create(null);

function normalizeDirectives$1 (
  dirs,
  vm
) {
  var res = Object.create(null);
  if (!dirs) {
    return res
  }
  var i, dir;
  for (i = 0; i < dirs.length; i++) {
    dir = dirs[i];
    if (!dir.modifiers) {
      dir.modifiers = emptyModifiers;
    }
    res[getRawDirName(dir)] = dir;
    dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  }
  return res
}

function getRawDirName (dir) {
  return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}

function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  var fn = dir.def && dir.def[hook];
  if (fn) {
    fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  }
}

var baseModules = [
  ref,
  directives
];

/*  */

function updateAttrs (oldVnode, vnode) {
  if (!oldVnode.data.attrs && !vnode.data.attrs) {
    return
  }
  var key, cur, old;
  var elm = vnode.elm;
  var oldAttrs = oldVnode.data.attrs || {};
  var attrs = vnode.data.attrs || {};
  // clone observed objects, as the user probably wants to mutate it
  if (attrs.__ob__) {
    attrs = vnode.data.attrs = extend({}, attrs);
  }

  for (key in attrs) {
    cur = attrs[key];
    old = oldAttrs[key];
    if (old !== cur) {
      setAttr(elm, key, cur);
    }
  }
  // #4391: in IE9, setting type can reset value for input[type=radio]
  /* istanbul ignore if */
  if (isIE9 && attrs.value !== oldAttrs.value) {
    setAttr(elm, 'value', attrs.value);
  }
  for (key in oldAttrs) {
    if (attrs[key] == null) {
      if (isXlink(key)) {
        elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
      } else if (!isEnumeratedAttr(key)) {
        elm.removeAttribute(key);
      }
    }
  }
}

function setAttr (el, key, value) {
  if (isBooleanAttr(key)) {
    // set attribute for blank value
    // e.g. <option disabled>Select one</option>
    if (isFalsyAttrValue(value)) {
      el.removeAttribute(key);
    } else {
      el.setAttribute(key, key);
    }
  } else if (isEnumeratedAttr(key)) {
    el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  } else if (isXlink(key)) {
    if (isFalsyAttrValue(value)) {
      el.removeAttributeNS(xlinkNS, getXlinkProp(key));
    } else {
      el.setAttributeNS(xlinkNS, key, value);
    }
  } else {
    if (isFalsyAttrValue(value)) {
      el.removeAttribute(key);
    } else {
      el.setAttribute(key, value);
    }
  }
}

var attrs = {
  create: updateAttrs,
  update: updateAttrs
};

/*  */

function updateClass (oldVnode, vnode) {
  var el = vnode.elm;
  var data = vnode.data;
  var oldData = oldVnode.data;
  if (!data.staticClass && !data.class &&
      (!oldData || (!oldData.staticClass && !oldData.class))) {
    return
  }

  var cls = genClassForVnode(vnode);

  // handle transition classes
  var transitionClass = el._transitionClasses;
  if (transitionClass) {
    cls = concat(cls, stringifyClass(transitionClass));
  }

  // set the class
  if (cls !== el._prevClass) {
    el.setAttribute('class', cls);
    el._prevClass = cls;
  }
}

var klass = {
  create: updateClass,
  update: updateClass
};

/*  */

var validDivisionCharRE = /[\w).+\-_$\]]/;

function parseFilters (exp) {
  var inSingle = false;
  var inDouble = false;
  var inTemplateString = false;
  var inRegex = false;
  var curly = 0;
  var square = 0;
  var paren = 0;
  var lastFilterIndex = 0;
  var c, prev, i, expression, filters;

  for (i = 0; i < exp.length; i++) {
    prev = c;
    c = exp.charCodeAt(i);
    if (inSingle) {
      if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
    } else if (inDouble) {
      if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
    } else if (inTemplateString) {
      if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
    } else if (inRegex) {
      if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
    } else if (
      c === 0x7C && // pipe
      exp.charCodeAt(i + 1) !== 0x7C &&
      exp.charCodeAt(i - 1) !== 0x7C &&
      !curly && !square && !paren
    ) {
      if (expression === undefined) {
        // first filter, end of expression
        lastFilterIndex = i + 1;
        expression = exp.slice(0, i).trim();
      } else {
        pushFilter();
      }
    } else {
      switch (c) {
        case 0x22: inDouble = true; break         // "
        case 0x27: inSingle = true; break         // '
        case 0x60: inTemplateString = true; break // `
        case 0x28: paren++; break                 // (
        case 0x29: paren--; break                 // )
        case 0x5B: square++; break                // [
        case 0x5D: square--; break                // ]
        case 0x7B: curly++; break                 // {
        case 0x7D: curly--; break                 // }
      }
      if (c === 0x2f) { // /
        var j = i - 1;
        var p = (void 0);
        // find first non-whitespace prev char
        for (; j >= 0; j--) {
          p = exp.charAt(j);
          if (p !== ' ') { break }
        }
        if (!p || !validDivisionCharRE.test(p)) {
          inRegex = true;
        }
      }
    }
  }

  if (expression === undefined) {
    expression = exp.slice(0, i).trim();
  } else if (lastFilterIndex !== 0) {
    pushFilter();
  }

  function pushFilter () {
    (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
    lastFilterIndex = i + 1;
  }

  if (filters) {
    for (i = 0; i < filters.length; i++) {
      expression = wrapFilter(expression, filters[i]);
    }
  }

  return expression
}

function wrapFilter (exp, filter) {
  var i = filter.indexOf('(');
  if (i < 0) {
    // _f: resolveFilter
    return ("_f(\"" + filter + "\")(" + exp + ")")
  } else {
    var name = filter.slice(0, i);
    var args = filter.slice(i + 1);
    return ("_f(\"" + name + "\")(" + exp + "," + args)
  }
}

/*  */

function baseWarn (msg) {
  console.error(("[Vue compiler]: " + msg));
}

function pluckModuleFunction (
  modules,
  key
) {
  return modules
    ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
    : []
}

function addProp (el, name, value) {
  (el.props || (el.props = [])).push({ name: name, value: value });
}

function addAttr (el, name, value) {
  (el.attrs || (el.attrs = [])).push({ name: name, value: value });
}

function addDirective (
  el,
  name,
  rawName,
  value,
  arg,
  modifiers
) {
  (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
}

function addHandler (
  el,
  name,
  value,
  modifiers,
  important
) {
  // check capture modifier
  if (modifiers && modifiers.capture) {
    delete modifiers.capture;
    name = '!' + name; // mark the event as captured
  }
  if (modifiers && modifiers.once) {
    delete modifiers.once;
    name = '~' + name; // mark the event as once
  }
  var events;
  if (modifiers && modifiers.native) {
    delete modifiers.native;
    events = el.nativeEvents || (el.nativeEvents = {});
  } else {
    events = el.events || (el.events = {});
  }
  var newHandler = { value: value, modifiers: modifiers };
  var handlers = events[name];
  /* istanbul ignore if */
  if (Array.isArray(handlers)) {
    important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  } else if (handlers) {
    events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  } else {
    events[name] = newHandler;
  }
}

function getBindingAttr (
  el,
  name,
  getStatic
) {
  var dynamicValue =
    getAndRemoveAttr(el, ':' + name) ||
    getAndRemoveAttr(el, 'v-bind:' + name);
  if (dynamicValue != null) {
    return parseFilters(dynamicValue)
  } else if (getStatic !== false) {
    var staticValue = getAndRemoveAttr(el, name);
    if (staticValue != null) {
      return JSON.stringify(staticValue)
    }
  }
}

function getAndRemoveAttr (el, name) {
  var val;
  if ((val = el.attrsMap[name]) != null) {
    var list = el.attrsList;
    for (var i = 0, l = list.length; i < l; i++) {
      if (list[i].name === name) {
        list.splice(i, 1);
        break
      }
    }
  }
  return val
}

/*  */

/**
 * Cross-platform code generation for component v-model
 */
function genComponentModel (
  el,
  value,
  modifiers
) {
  var ref = modifiers || {};
  var number = ref.number;
  var trim = ref.trim;

  var baseValueExpression = '$$v';
  var valueExpression = baseValueExpression;
  if (trim) {
    valueExpression =
      "(typeof " + baseValueExpression + " === 'string'" +
        "? " + baseValueExpression + ".trim()" +
        ": " + baseValueExpression + ")";
  }
  if (number) {
    valueExpression = "_n(" + valueExpression + ")";
  }
  var assignment = genAssignmentCode(value, valueExpression);

  el.model = {
    value: ("(" + value + ")"),
    callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  };
}

/**
 * Cross-platform codegen helper for generating v-model value assignment code.
 */
function genAssignmentCode (
  value,
  assignment
) {
  var modelRs = parseModel(value);
  if (modelRs.idx === null) {
    return (value + "=" + assignment)
  } else {
    return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
      "if (!Array.isArray($$exp)){" +
        value + "=" + assignment + "}" +
      "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  }
}

/**
 * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
 *
 * for loop possible cases:
 *
 * - test
 * - test[idx]
 * - test[test1[idx]]
 * - test["a"][idx]
 * - xxx.test[a[a].test1[idx]]
 * - test.xxx.a["asa"][test1[idx]]
 *
 */

var len;
var str;
var chr;
var index$1;
var expressionPos;
var expressionEndPos;

function parseModel (val) {
  str = val;
  len = str.length;
  index$1 = expressionPos = expressionEndPos = 0;

  if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
    return {
      exp: val,
      idx: null
    }
  }

  while (!eof()) {
    chr = next();
    /* istanbul ignore if */
    if (isStringStart(chr)) {
      parseString(chr);
    } else if (chr === 0x5B) {
      parseBracket(chr);
    }
  }

  return {
    exp: val.substring(0, expressionPos),
    idx: val.substring(expressionPos + 1, expressionEndPos)
  }
}

function next () {
  return str.charCodeAt(++index$1)
}

function eof () {
  return index$1 >= len
}

function isStringStart (chr) {
  return chr === 0x22 || chr === 0x27
}

function parseBracket (chr) {
  var inBracket = 1;
  expressionPos = index$1;
  while (!eof()) {
    chr = next();
    if (isStringStart(chr)) {
      parseString(chr);
      continue
    }
    if (chr === 0x5B) { inBracket++; }
    if (chr === 0x5D) { inBracket--; }
    if (inBracket === 0) {
      expressionEndPos = index$1;
      break
    }
  }
}

function parseString (chr) {
  var stringQuote = chr;
  while (!eof()) {
    chr = next();
    if (chr === stringQuote) {
      break
    }
  }
}

/*  */

var warn$1;

// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';

function model (
  el,
  dir,
  _warn
) {
  warn$1 = _warn;
  var value = dir.value;
  var modifiers = dir.modifiers;
  var tag = el.tag;
  var type = el.attrsMap.type;

  {
    var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
    if (tag === 'input' && dynamicType) {
      warn$1(
        "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
        "v-model does not support dynamic input types. Use v-if branches instead."
      );
    }
    // inputs with type="file" are read only and setting the input's
    // value will throw an error.
    if (tag === 'input' && type === 'file') {
      warn$1(
        "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
        "File inputs are read only. Use a v-on:change listener instead."
      );
    }
  }

  if (tag === 'select') {
    genSelect(el, value, modifiers);
  } else if (tag === 'input' && type === 'checkbox') {
    genCheckboxModel(el, value, modifiers);
  } else if (tag === 'input' && type === 'radio') {
    genRadioModel(el, value, modifiers);
  } else if (tag === 'input' || tag === 'textarea') {
    genDefaultModel(el, value, modifiers);
  } else if (!config.isReservedTag(tag)) {
    genComponentModel(el, value, modifiers);
    // component v-model doesn't need extra runtime
    return false
  } else {
    warn$1(
      "<" + (el.tag) + " v-model=\"" + value + "\">: " +
      "v-model is not supported on this element type. " +
      'If you are working with contenteditable, it\'s recommended to ' +
      'wrap a library dedicated for that purpose inside a custom component.'
    );
  }

  // ensure runtime directive metadata
  return true
}

function genCheckboxModel (
  el,
  value,
  modifiers
) {
  if ("development" !== 'production' &&
    el.attrsMap.checked != null) {
    warn$1(
      "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
      "inline checked attributes will be ignored when using v-model. " +
      'Declare initial values in the component\'s data option instead.'
    );
  }
  var number = modifiers && modifiers.number;
  var valueBinding = getBindingAttr(el, 'value') || 'null';
  var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  addProp(el, 'checked',
    "Array.isArray(" + value + ")" +
      "?_i(" + value + "," + valueBinding + ")>-1" + (
        trueValueBinding === 'true'
          ? (":(" + value + ")")
          : (":_q(" + value + "," + trueValueBinding + ")")
      )
  );
  addHandler(el, CHECKBOX_RADIO_TOKEN,
    "var $$a=" + value + "," +
        '$$el=$event.target,' +
        "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
    'if(Array.isArray($$a)){' +
      "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
          '$$i=_i($$a,$$v);' +
      "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
      "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
    "}else{" + value + "=$$c}",
    null, true
  );
}

function genRadioModel (
    el,
    value,
    modifiers
) {
  if ("development" !== 'production' &&
    el.attrsMap.checked != null) {
    warn$1(
      "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
      "inline checked attributes will be ignored when using v-model. " +
      'Declare initial values in the component\'s data option instead.'
    );
  }
  var number = modifiers && modifiers.number;
  var valueBinding = getBindingAttr(el, 'value') || 'null';
  valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true);
}

function genSelect (
    el,
    value,
    modifiers
) {
  {
    el.children.some(checkOptionWarning);
  }

  var number = modifiers && modifiers.number;
  var selectedVal = "Array.prototype.filter" +
    ".call($event.target.options,function(o){return o.selected})" +
    ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
    "return " + (number ? '_n(val)' : 'val') + "})";

  var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  var code = "var $$selectedVal = " + selectedVal + ";";
  code = code + " " + (genAssignmentCode(value, assignment));
  addHandler(el, 'change', code, null, true);
}

function checkOptionWarning (option) {
  if (option.type === 1 &&
    option.tag === 'option' &&
    option.attrsMap.selected != null) {
    warn$1(
      "<select v-model=\"" + (option.parent.attrsMap['v-model']) + "\">:\n" +
      'inline selected attributes on <option> will be ignored when using v-model. ' +
      'Declare initial values in the component\'s data option instead.'
    );
    return true
  }
  return false
}

function genDefaultModel (
  el,
  value,
  modifiers
) {
  var type = el.attrsMap.type;
  var ref = modifiers || {};
  var lazy = ref.lazy;
  var number = ref.number;
  var trim = ref.trim;
  var needCompositionGuard = !lazy && type !== 'range';
  var event = lazy
    ? 'change'
    : type === 'range'
      ? RANGE_TOKEN
      : 'input';

  var valueExpression = '$event.target.value';
  if (trim) {
    valueExpression = "$event.target.value.trim()";
  }
  if (number) {
    valueExpression = "_n(" + valueExpression + ")";
  }

  var code = genAssignmentCode(value, valueExpression);
  if (needCompositionGuard) {
    code = "if($event.target.composing)return;" + code;
  }

  addProp(el, 'value', ("(" + value + ")"));
  addHandler(el, event, code, null, true);
  if (trim || number || type === 'number') {
    addHandler(el, 'blur', '$forceUpdate()');
  }
}

/*  */

// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents (on) {
  var event;
  /* istanbul ignore if */
  if (on[RANGE_TOKEN]) {
    // IE input[type=range] only supports `change` event
    event = isIE ? 'change' : 'input';
    on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
    delete on[RANGE_TOKEN];
  }
  if (on[CHECKBOX_RADIO_TOKEN]) {
    // Chrome fires microtasks in between click/change, leads to #4521
    event = isChrome ? 'click' : 'change';
    on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
    delete on[CHECKBOX_RADIO_TOKEN];
  }
}

var target$1;

function add$1 (
  event,
  handler,
  once,
  capture
) {
  if (once) {
    var oldHandler = handler;
    var _target = target$1; // save current target element in closure
    handler = function (ev) {
      var res = arguments.length === 1
        ? oldHandler(ev)
        : oldHandler.apply(null, arguments);
      if (res !== null) {
        remove$2(event, handler, capture, _target);
      }
    };
  }
  target$1.addEventListener(event, handler, capture);
}

function remove$2 (
  event,
  handler,
  capture,
  _target
) {
  (_target || target$1).removeEventListener(event, handler, capture);
}

function updateDOMListeners (oldVnode, vnode) {
  if (!oldVnode.data.on && !vnode.data.on) {
    return
  }
  var on = vnode.data.on || {};
  var oldOn = oldVnode.data.on || {};
  target$1 = vnode.elm;
  normalizeEvents(on);
  updateListeners(on, oldOn, add$1, remove$2, vnode.context);
}

var events = {
  create: updateDOMListeners,
  update: updateDOMListeners
};

/*  */

function updateDOMProps (oldVnode, vnode) {
  if (!oldVnode.data.domProps && !vnode.data.domProps) {
    return
  }
  var key, cur;
  var elm = vnode.elm;
  var oldProps = oldVnode.data.domProps || {};
  var props = vnode.data.domProps || {};
  // clone observed objects, as the user probably wants to mutate it
  if (props.__ob__) {
    props = vnode.data.domProps = extend({}, props);
  }

  for (key in oldProps) {
    if (props[key] == null) {
      elm[key] = '';
    }
  }
  for (key in props) {
    cur = props[key];
    // ignore children if the node has textContent or innerHTML,
    // as these will throw away existing DOM nodes and cause removal errors
    // on subsequent patches (#3360)
    if (key === 'textContent' || key === 'innerHTML') {
      if (vnode.children) { vnode.children.length = 0; }
      if (cur === oldProps[key]) { continue }
    }

    if (key === 'value') {
      // store value as _value as well since
      // non-string values will be stringified
      elm._value = cur;
      // avoid resetting cursor position when value is the same
      var strCur = cur == null ? '' : String(cur);
      if (shouldUpdateValue(elm, vnode, strCur)) {
        elm.value = strCur;
      }
    } else {
      elm[key] = cur;
    }
  }
}

// check platforms/web/util/attrs.js acceptValue


function shouldUpdateValue (
  elm,
  vnode,
  checkVal
) {
  return (!elm.composing && (
    vnode.tag === 'option' ||
    isDirty(elm, checkVal) ||
    isInputChanged(elm, checkVal)
  ))
}

function isDirty (elm, checkVal) {
  // return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
  return document.activeElement !== elm && elm.value !== checkVal
}

function isInputChanged (elm, newVal) {
  var value = elm.value;
  var modifiers = elm._vModifiers; // injected by v-model runtime
  if ((modifiers && modifiers.number) || elm.type === 'number') {
    return toNumber(value) !== toNumber(newVal)
  }
  if (modifiers && modifiers.trim) {
    return value.trim() !== newVal.trim()
  }
  return value !== newVal
}

var domProps = {
  create: updateDOMProps,
  update: updateDOMProps
};

/*  */

var parseStyleText = cached(function (cssText) {
  var res = {};
  var listDelimiter = /;(?![^(]*\))/g;
  var propertyDelimiter = /:(.+)/;
  cssText.split(listDelimiter).forEach(function (item) {
    if (item) {
      var tmp = item.split(propertyDelimiter);
      tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
    }
  });
  return res
});

// merge static and dynamic style data on the same vnode
function normalizeStyleData (data) {
  var style = normalizeStyleBinding(data.style);
  // static style is pre-processed into an object during compilation
  // and is always a fresh object, so it's safe to merge into it
  return data.staticStyle
    ? extend(data.staticStyle, style)
    : style
}

// normalize possible array / string values into Object
function normalizeStyleBinding (bindingStyle) {
  if (Array.isArray(bindingStyle)) {
    return toObject(bindingStyle)
  }
  if (typeof bindingStyle === 'string') {
    return parseStyleText(bindingStyle)
  }
  return bindingStyle
}

/**
 * parent component style should be after child's
 * so that parent component's style could override it
 */
function getStyle (vnode, checkChild) {
  var res = {};
  var styleData;

  if (checkChild) {
    var childNode = vnode;
    while (childNode.componentInstance) {
      childNode = childNode.componentInstance._vnode;
      if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
        extend(res, styleData);
      }
    }
  }

  if ((styleData = normalizeStyleData(vnode.data))) {
    extend(res, styleData);
  }

  var parentNode = vnode;
  while ((parentNode = parentNode.parent)) {
    if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
      extend(res, styleData);
    }
  }
  return res
}

/*  */

var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
  /* istanbul ignore if */
  if (cssVarRE.test(name)) {
    el.style.setProperty(name, val);
  } else if (importantRE.test(val)) {
    el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  } else {
    el.style[normalize(name)] = val;
  }
};

var prefixes = ['Webkit', 'Moz', 'ms'];

var testEl;
var normalize = cached(function (prop) {
  testEl = testEl || document.createElement('div');
  prop = camelize(prop);
  if (prop !== 'filter' && (prop in testEl.style)) {
    return prop
  }
  var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  for (var i = 0; i < prefixes.length; i++) {
    var prefixed = prefixes[i] + upper;
    if (prefixed in testEl.style) {
      return prefixed
    }
  }
});

function updateStyle (oldVnode, vnode) {
  var data = vnode.data;
  var oldData = oldVnode.data;

  if (!data.staticStyle && !data.style &&
      !oldData.staticStyle && !oldData.style) {
    return
  }

  var cur, name;
  var el = vnode.elm;
  var oldStaticStyle = oldVnode.data.staticStyle;
  var oldStyleBinding = oldVnode.data.style || {};

  // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  var oldStyle = oldStaticStyle || oldStyleBinding;

  var style = normalizeStyleBinding(vnode.data.style) || {};

  vnode.data.style = style.__ob__ ? extend({}, style) : style;

  var newStyle = getStyle(vnode, true);

  for (name in oldStyle) {
    if (newStyle[name] == null) {
      setProp(el, name, '');
    }
  }
  for (name in newStyle) {
    cur = newStyle[name];
    if (cur !== oldStyle[name]) {
      // ie9 setting to null has no effect, must use empty string
      setProp(el, name, cur == null ? '' : cur);
    }
  }
}

var style = {
  create: updateStyle,
  update: updateStyle
};

/*  */

/**
 * Add class with compatibility for SVG since classList is not supported on
 * SVG elements in IE
 */
function addClass (el, cls) {
  /* istanbul ignore if */
  if (!cls || !(cls = cls.trim())) {
    return
  }

  /* istanbul ignore else */
  if (el.classList) {
    if (cls.indexOf(' ') > -1) {
      cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
    } else {
      el.classList.add(cls);
    }
  } else {
    var cur = " " + (el.getAttribute('class') || '') + " ";
    if (cur.indexOf(' ' + cls + ' ') < 0) {
      el.setAttribute('class', (cur + cls).trim());
    }
  }
}

/**
 * Remove class with compatibility for SVG since classList is not supported on
 * SVG elements in IE
 */
function removeClass (el, cls) {
  /* istanbul ignore if */
  if (!cls || !(cls = cls.trim())) {
    return
  }

  /* istanbul ignore else */
  if (el.classList) {
    if (cls.indexOf(' ') > -1) {
      cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
    } else {
      el.classList.remove(cls);
    }
  } else {
    var cur = " " + (el.getAttribute('class') || '') + " ";
    var tar = ' ' + cls + ' ';
    while (cur.indexOf(tar) >= 0) {
      cur = cur.replace(tar, ' ');
    }
    el.setAttribute('class', cur.trim());
  }
}

/*  */

function resolveTransition (def$$1) {
  if (!def$$1) {
    return
  }
  /* istanbul ignore else */
  if (typeof def$$1 === 'object') {
    var res = {};
    if (def$$1.css !== false) {
      extend(res, autoCssTransition(def$$1.name || 'v'));
    }
    extend(res, def$$1);
    return res
  } else if (typeof def$$1 === 'string') {
    return autoCssTransition(def$$1)
  }
}

var autoCssTransition = cached(function (name) {
  return {
    enterClass: (name + "-enter"),
    enterToClass: (name + "-enter-to"),
    enterActiveClass: (name + "-enter-active"),
    leaveClass: (name + "-leave"),
    leaveToClass: (name + "-leave-to"),
    leaveActiveClass: (name + "-leave-active")
  }
});

var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';

// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
  /* istanbul ignore if */
  if (window.ontransitionend === undefined &&
    window.onwebkittransitionend !== undefined) {
    transitionProp = 'WebkitTransition';
    transitionEndEvent = 'webkitTransitionEnd';
  }
  if (window.onanimationend === undefined &&
    window.onwebkitanimationend !== undefined) {
    animationProp = 'WebkitAnimation';
    animationEndEvent = 'webkitAnimationEnd';
  }
}

// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser && window.requestAnimationFrame
  ? window.requestAnimationFrame.bind(window)
  : setTimeout;

function nextFrame (fn) {
  raf(function () {
    raf(fn);
  });
}

function addTransitionClass (el, cls) {
  (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  addClass(el, cls);
}

function removeTransitionClass (el, cls) {
  if (el._transitionClasses) {
    remove(el._transitionClasses, cls);
  }
  removeClass(el, cls);
}

function whenTransitionEnds (
  el,
  expectedType,
  cb
) {
  var ref = getTransitionInfo(el, expectedType);
  var type = ref.type;
  var timeout = ref.timeout;
  var propCount = ref.propCount;
  if (!type) { return cb() }
  var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  var ended = 0;
  var end = function () {
    el.removeEventListener(event, onEnd);
    cb();
  };
  var onEnd = function (e) {
    if (e.target === el) {
      if (++ended >= propCount) {
        end();
      }
    }
  };
  setTimeout(function () {
    if (ended < propCount) {
      end();
    }
  }, timeout + 1);
  el.addEventListener(event, onEnd);
}

var transformRE = /\b(transform|all)(,|$)/;

function getTransitionInfo (el, expectedType) {
  var styles = window.getComputedStyle(el);
  var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
  var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
  var animationDelays = styles[animationProp + 'Delay'].split(', ');
  var animationDurations = styles[animationProp + 'Duration'].split(', ');
  var animationTimeout = getTimeout(animationDelays, animationDurations);

  var type;
  var timeout = 0;
  var propCount = 0;
  /* istanbul ignore if */
  if (expectedType === TRANSITION) {
    if (transitionTimeout > 0) {
      type = TRANSITION;
      timeout = transitionTimeout;
      propCount = transitionDurations.length;
    }
  } else if (expectedType === ANIMATION) {
    if (animationTimeout > 0) {
      type = ANIMATION;
      timeout = animationTimeout;
      propCount = animationDurations.length;
    }
  } else {
    timeout = Math.max(transitionTimeout, animationTimeout);
    type = timeout > 0
      ? transitionTimeout > animationTimeout
        ? TRANSITION
        : ANIMATION
      : null;
    propCount = type
      ? type === TRANSITION
        ? transitionDurations.length
        : animationDurations.length
      : 0;
  }
  var hasTransform =
    type === TRANSITION &&
    transformRE.test(styles[transitionProp + 'Property']);
  return {
    type: type,
    timeout: timeout,
    propCount: propCount,
    hasTransform: hasTransform
  }
}

function getTimeout (delays, durations) {
  /* istanbul ignore next */
  while (delays.length < durations.length) {
    delays = delays.concat(delays);
  }

  return Math.max.apply(null, durations.map(function (d, i) {
    return toMs(d) + toMs(delays[i])
  }))
}

function toMs (s) {
  return Number(s.slice(0, -1)) * 1000
}

/*  */

function enter (vnode, toggleDisplay) {
  var el = vnode.elm;

  // call leave callback now
  if (el._leaveCb) {
    el._leaveCb.cancelled = true;
    el._leaveCb();
  }

  var data = resolveTransition(vnode.data.transition);
  if (!data) {
    return
  }

  /* istanbul ignore if */
  if (el._enterCb || el.nodeType !== 1) {
    return
  }

  var css = data.css;
  var type = data.type;
  var enterClass = data.enterClass;
  var enterToClass = data.enterToClass;
  var enterActiveClass = data.enterActiveClass;
  var appearClass = data.appearClass;
  var appearToClass = data.appearToClass;
  var appearActiveClass = data.appearActiveClass;
  var beforeEnter = data.beforeEnter;
  var enter = data.enter;
  var afterEnter = data.afterEnter;
  var enterCancelled = data.enterCancelled;
  var beforeAppear = data.beforeAppear;
  var appear = data.appear;
  var afterAppear = data.afterAppear;
  var appearCancelled = data.appearCancelled;
  var duration = data.duration;

  // activeInstance will always be the <transition> component managing this
  // transition. One edge case to check is when the <transition> is placed
  // as the root node of a child component. In that case we need to check
  // <transition>'s parent for appear check.
  var context = activeInstance;
  var transitionNode = activeInstance.$vnode;
  while (transitionNode && transitionNode.parent) {
    transitionNode = transitionNode.parent;
    context = transitionNode.context;
  }

  var isAppear = !context._isMounted || !vnode.isRootInsert;

  if (isAppear && !appear && appear !== '') {
    return
  }

  var startClass = isAppear && appearClass
    ? appearClass
    : enterClass;
  var activeClass = isAppear && appearActiveClass
    ? appearActiveClass
    : enterActiveClass;
  var toClass = isAppear && appearToClass
    ? appearToClass
    : enterToClass;

  var beforeEnterHook = isAppear
    ? (beforeAppear || beforeEnter)
    : beforeEnter;
  var enterHook = isAppear
    ? (typeof appear === 'function' ? appear : enter)
    : enter;
  var afterEnterHook = isAppear
    ? (afterAppear || afterEnter)
    : afterEnter;
  var enterCancelledHook = isAppear
    ? (appearCancelled || enterCancelled)
    : enterCancelled;

  var explicitEnterDuration = toNumber(
    isObject(duration)
      ? duration.enter
      : duration
  );

  if ("development" !== 'production' && explicitEnterDuration != null) {
    checkDuration(explicitEnterDuration, 'enter', vnode);
  }

  var expectsCSS = css !== false && !isIE9;
  var userWantsControl = getHookAgumentsLength(enterHook);

  var cb = el._enterCb = once(function () {
    if (expectsCSS) {
      removeTransitionClass(el, toClass);
      removeTransitionClass(el, activeClass);
    }
    if (cb.cancelled) {
      if (expectsCSS) {
        removeTransitionClass(el, startClass);
      }
      enterCancelledHook && enterCancelledHook(el);
    } else {
      afterEnterHook && afterEnterHook(el);
    }
    el._enterCb = null;
  });

  if (!vnode.data.show) {
    // remove pending leave element on enter by injecting an insert hook
    mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
      var parent = el.parentNode;
      var pendingNode = parent && parent._pending && parent._pending[vnode.key];
      if (pendingNode &&
          pendingNode.tag === vnode.tag &&
          pendingNode.elm._leaveCb) {
        pendingNode.elm._leaveCb();
      }
      enterHook && enterHook(el, cb);
    });
  }

  // start enter transition
  beforeEnterHook && beforeEnterHook(el);
  if (expectsCSS) {
    addTransitionClass(el, startClass);
    addTransitionClass(el, activeClass);
    nextFrame(function () {
      addTransitionClass(el, toClass);
      removeTransitionClass(el, startClass);
      if (!cb.cancelled && !userWantsControl) {
        if (isValidDuration(explicitEnterDuration)) {
          setTimeout(cb, explicitEnterDuration);
        } else {
          whenTransitionEnds(el, type, cb);
        }
      }
    });
  }

  if (vnode.data.show) {
    toggleDisplay && toggleDisplay();
    enterHook && enterHook(el, cb);
  }

  if (!expectsCSS && !userWantsControl) {
    cb();
  }
}

function leave (vnode, rm) {
  var el = vnode.elm;

  // call enter callback now
  if (el._enterCb) {
    el._enterCb.cancelled = true;
    el._enterCb();
  }

  var data = resolveTransition(vnode.data.transition);
  if (!data) {
    return rm()
  }

  /* istanbul ignore if */
  if (el._leaveCb || el.nodeType !== 1) {
    return
  }

  var css = data.css;
  var type = data.type;
  var leaveClass = data.leaveClass;
  var leaveToClass = data.leaveToClass;
  var leaveActiveClass = data.leaveActiveClass;
  var beforeLeave = data.beforeLeave;
  var leave = data.leave;
  var afterLeave = data.afterLeave;
  var leaveCancelled = data.leaveCancelled;
  var delayLeave = data.delayLeave;
  var duration = data.duration;

  var expectsCSS = css !== false && !isIE9;
  var userWantsControl = getHookAgumentsLength(leave);

  var explicitLeaveDuration = toNumber(
    isObject(duration)
      ? duration.leave
      : duration
  );

  if ("development" !== 'production' && explicitLeaveDuration != null) {
    checkDuration(explicitLeaveDuration, 'leave', vnode);
  }

  var cb = el._leaveCb = once(function () {
    if (el.parentNode && el.parentNode._pending) {
      el.parentNode._pending[vnode.key] = null;
    }
    if (expectsCSS) {
      removeTransitionClass(el, leaveToClass);
      removeTransitionClass(el, leaveActiveClass);
    }
    if (cb.cancelled) {
      if (expectsCSS) {
        removeTransitionClass(el, leaveClass);
      }
      leaveCancelled && leaveCancelled(el);
    } else {
      rm();
      afterLeave && afterLeave(el);
    }
    el._leaveCb = null;
  });

  if (delayLeave) {
    delayLeave(performLeave);
  } else {
    performLeave();
  }

  function performLeave () {
    // the delayed leave may have already been cancelled
    if (cb.cancelled) {
      return
    }
    // record leaving element
    if (!vnode.data.show) {
      (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
    }
    beforeLeave && beforeLeave(el);
    if (expectsCSS) {
      addTransitionClass(el, leaveClass);
      addTransitionClass(el, leaveActiveClass);
      nextFrame(function () {
        addTransitionClass(el, leaveToClass);
        removeTransitionClass(el, leaveClass);
        if (!cb.cancelled && !userWantsControl) {
          if (isValidDuration(explicitLeaveDuration)) {
            setTimeout(cb, explicitLeaveDuration);
          } else {
            whenTransitionEnds(el, type, cb);
          }
        }
      });
    }
    leave && leave(el, cb);
    if (!expectsCSS && !userWantsControl) {
      cb();
    }
  }
}

// only used in dev mode
function checkDuration (val, name, vnode) {
  if (typeof val !== 'number') {
    warn(
      "<transition> explicit " + name + " duration is not a valid number - " +
      "got " + (JSON.stringify(val)) + ".",
      vnode.context
    );
  } else if (isNaN(val)) {
    warn(
      "<transition> explicit " + name + " duration is NaN - " +
      'the duration expression might be incorrect.',
      vnode.context
    );
  }
}

function isValidDuration (val) {
  return typeof val === 'number' && !isNaN(val)
}

/**
 * Normalize a transition hook's argument length. The hook may be:
 * - a merged hook (invoker) with the original in .fns
 * - a wrapped component method (check ._length)
 * - a plain function (.length)
 */
function getHookAgumentsLength (fn) {
  if (!fn) { return false }
  var invokerFns = fn.fns;
  if (invokerFns) {
    // invoker
    return getHookAgumentsLength(
      Array.isArray(invokerFns)
        ? invokerFns[0]
        : invokerFns
    )
  } else {
    return (fn._length || fn.length) > 1
  }
}

function _enter (_, vnode) {
  if (!vnode.data.show) {
    enter(vnode);
  }
}

var transition = inBrowser ? {
  create: _enter,
  activate: _enter,
  remove: function remove$$1 (vnode, rm) {
    /* istanbul ignore else */
    if (!vnode.data.show) {
      leave(vnode, rm);
    } else {
      rm();
    }
  }
} : {};

var platformModules = [
  attrs,
  klass,
  events,
  domProps,
  style,
  transition
];

/*  */

// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);

var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });

/**
 * Not type checking this file because flow doesn't like attaching
 * properties to Elements.
 */

/* istanbul ignore if */
if (isIE9) {
  // http://www.matts411.com/post/internet-explorer-9-oninput/
  document.addEventListener('selectionchange', function () {
    var el = document.activeElement;
    if (el && el.vmodel) {
      trigger(el, 'input');
    }
  });
}

var model$1 = {
  inserted: function inserted (el, binding, vnode) {
    if (vnode.tag === 'select') {
      var cb = function () {
        setSelected(el, binding, vnode.context);
      };
      cb();
      /* istanbul ignore if */
      if (isIE || isEdge) {
        setTimeout(cb, 0);
      }
    } else if (vnode.tag === 'textarea' || el.type === 'text') {
      el._vModifiers = binding.modifiers;
      if (!binding.modifiers.lazy) {
        if (!isAndroid) {
          el.addEventListener('compositionstart', onCompositionStart);
          el.addEventListener('compositionend', onCompositionEnd);
        }
        /* istanbul ignore if */
        if (isIE9) {
          el.vmodel = true;
        }
      }
    }
  },
  componentUpdated: function componentUpdated (el, binding, vnode) {
    if (vnode.tag === 'select') {
      setSelected(el, binding, vnode.context);
      // in case the options rendered by v-for have changed,
      // it's possible that the value is out-of-sync with the rendered options.
      // detect such cases and filter out values that no longer has a matching
      // option in the DOM.
      var needReset = el.multiple
        ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
        : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
      if (needReset) {
        trigger(el, 'change');
      }
    }
  }
};

function setSelected (el, binding, vm) {
  var value = binding.value;
  var isMultiple = el.multiple;
  if (isMultiple && !Array.isArray(value)) {
    "development" !== 'production' && warn(
      "<select multiple v-model=\"" + (binding.expression) + "\"> " +
      "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
      vm
    );
    return
  }
  var selected, option;
  for (var i = 0, l = el.options.length; i < l; i++) {
    option = el.options[i];
    if (isMultiple) {
      selected = looseIndexOf(value, getValue(option)) > -1;
      if (option.selected !== selected) {
        option.selected = selected;
      }
    } else {
      if (looseEqual(getValue(option), value)) {
        if (el.selectedIndex !== i) {
          el.selectedIndex = i;
        }
        return
      }
    }
  }
  if (!isMultiple) {
    el.selectedIndex = -1;
  }
}

function hasNoMatchingOption (value, options) {
  for (var i = 0, l = options.length; i < l; i++) {
    if (looseEqual(getValue(options[i]), value)) {
      return false
    }
  }
  return true
}

function getValue (option) {
  return '_value' in option
    ? option._value
    : option.value
}

function onCompositionStart (e) {
  e.target.composing = true;
}

function onCompositionEnd (e) {
  e.target.composing = false;
  trigger(e.target, 'input');
}

function trigger (el, type) {
  var e = document.createEvent('HTMLEvents');
  e.initEvent(type, true, true);
  el.dispatchEvent(e);
}

/*  */

// recursively search for possible transition defined inside the component root
function locateNode (vnode) {
  return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
    ? locateNode(vnode.componentInstance._vnode)
    : vnode
}

var show = {
  bind: function bind (el, ref, vnode) {
    var value = ref.value;

    vnode = locateNode(vnode);
    var transition = vnode.data && vnode.data.transition;
    var originalDisplay = el.__vOriginalDisplay =
      el.style.display === 'none' ? '' : el.style.display;
    if (value && transition && !isIE9) {
      vnode.data.show = true;
      enter(vnode, function () {
        el.style.display = originalDisplay;
      });
    } else {
      el.style.display = value ? originalDisplay : 'none';
    }
  },

  update: function update (el, ref, vnode) {
    var value = ref.value;
    var oldValue = ref.oldValue;

    /* istanbul ignore if */
    if (value === oldValue) { return }
    vnode = locateNode(vnode);
    var transition = vnode.data && vnode.data.transition;
    if (transition && !isIE9) {
      vnode.data.show = true;
      if (value) {
        enter(vnode, function () {
          el.style.display = el.__vOriginalDisplay;
        });
      } else {
        leave(vnode, function () {
          el.style.display = 'none';
        });
      }
    } else {
      el.style.display = value ? el.__vOriginalDisplay : 'none';
    }
  },

  unbind: function unbind (
    el,
    binding,
    vnode,
    oldVnode,
    isDestroy
  ) {
    if (!isDestroy) {
      el.style.display = el.__vOriginalDisplay;
    }
  }
};

var platformDirectives = {
  model: model$1,
  show: show
};

/*  */

// Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)

var transitionProps = {
  name: String,
  appear: Boolean,
  css: Boolean,
  mode: String,
  type: String,
  enterClass: String,
  leaveClass: String,
  enterToClass: String,
  leaveToClass: String,
  enterActiveClass: String,
  leaveActiveClass: String,
  appearClass: String,
  appearActiveClass: String,
  appearToClass: String,
  duration: [Number, String, Object]
};

// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) {
  var compOptions = vnode && vnode.componentOptions;
  if (compOptions && compOptions.Ctor.options.abstract) {
    return getRealChild(getFirstComponentChild(compOptions.children))
  } else {
    return vnode
  }
}

function extractTransitionData (comp) {
  var data = {};
  var options = comp.$options;
  // props
  for (var key in options.propsData) {
    data[key] = comp[key];
  }
  // events.
  // extract listeners and pass them directly to the transition methods
  var listeners = options._parentListeners;
  for (var key$1 in listeners) {
    data[camelize(key$1)] = listeners[key$1];
  }
  return data
}

function placeholder (h, rawChild) {
  return /\d-keep-alive$/.test(rawChild.tag)
    ? h('keep-alive')
    : null
}

function hasParentTransition (vnode) {
  while ((vnode = vnode.parent)) {
    if (vnode.data.transition) {
      return true
    }
  }
}

function isSameChild (child, oldChild) {
  return oldChild.key === child.key && oldChild.tag === child.tag
}

var Transition = {
  name: 'transition',
  props: transitionProps,
  abstract: true,

  render: function render (h) {
    var this$1 = this;

    var children = this.$slots.default;
    if (!children) {
      return
    }

    // filter out text nodes (possible whitespaces)
    children = children.filter(function (c) { return c.tag; });
    /* istanbul ignore if */
    if (!children.length) {
      return
    }

    // warn multiple elements
    if ("development" !== 'production' && children.length > 1) {
      warn(
        '<transition> can only be used on a single element. Use ' +
        '<transition-group> for lists.',
        this.$parent
      );
    }

    var mode = this.mode;

    // warn invalid mode
    if ("development" !== 'production' &&
        mode && mode !== 'in-out' && mode !== 'out-in') {
      warn(
        'invalid <transition> mode: ' + mode,
        this.$parent
      );
    }

    var rawChild = children[0];

    // if this is a component root node and the component's
    // parent container node also has transition, skip.
    if (hasParentTransition(this.$vnode)) {
      return rawChild
    }

    // apply transition data to child
    // use getRealChild() to ignore abstract components e.g. keep-alive
    var child = getRealChild(rawChild);
    /* istanbul ignore if */
    if (!child) {
      return rawChild
    }

    if (this._leaving) {
      return placeholder(h, rawChild)
    }

    // ensure a key that is unique to the vnode type and to this transition
    // component instance. This key will be used to remove pending leaving nodes
    // during entering.
    var id = "__transition-" + (this._uid) + "-";
    child.key = child.key == null
      ? id + child.tag
      : isPrimitive(child.key)
        ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
        : child.key;

    var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
    var oldRawChild = this._vnode;
    var oldChild = getRealChild(oldRawChild);

    // mark v-show
    // so that the transition module can hand over the control to the directive
    if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
      child.data.show = true;
    }

    if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
      // replace old child transition data with fresh one
      // important for dynamic transitions!
      var oldData = oldChild && (oldChild.data.transition = extend({}, data));
      // handle transition mode
      if (mode === 'out-in') {
        // return placeholder node and queue update when leave finishes
        this._leaving = true;
        mergeVNodeHook(oldData, 'afterLeave', function () {
          this$1._leaving = false;
          this$1.$forceUpdate();
        });
        return placeholder(h, rawChild)
      } else if (mode === 'in-out') {
        var delayedLeave;
        var performLeave = function () { delayedLeave(); };
        mergeVNodeHook(data, 'afterEnter', performLeave);
        mergeVNodeHook(data, 'enterCancelled', performLeave);
        mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
      }
    }

    return rawChild
  }
};

/*  */

// Provides transition support for list items.
// supports move transitions using the FLIP technique.

// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the first pass, we remove all nodes that need to be removed,
// triggering their leaving transition; in the second pass, we insert/move
// into the final disired state. This way in the second pass removed
// nodes will remain where they should be.

var props = extend({
  tag: String,
  moveClass: String
}, transitionProps);

delete props.mode;

var TransitionGroup = {
  props: props,

  render: function render (h) {
    var tag = this.tag || this.$vnode.data.tag || 'span';
    var map = Object.create(null);
    var prevChildren = this.prevChildren = this.children;
    var rawChildren = this.$slots.default || [];
    var children = this.children = [];
    var transitionData = extractTransitionData(this);

    for (var i = 0; i < rawChildren.length; i++) {
      var c = rawChildren[i];
      if (c.tag) {
        if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
          children.push(c);
          map[c.key] = c
          ;(c.data || (c.data = {})).transition = transitionData;
        } else {
          var opts = c.componentOptions;
          var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
          warn(("<transition-group> children must be keyed: <" + name + ">"));
        }
      }
    }

    if (prevChildren) {
      var kept = [];
      var removed = [];
      for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
        var c$1 = prevChildren[i$1];
        c$1.data.transition = transitionData;
        c$1.data.pos = c$1.elm.getBoundingClientRect();
        if (map[c$1.key]) {
          kept.push(c$1);
        } else {
          removed.push(c$1);
        }
      }
      this.kept = h(tag, null, kept);
      this.removed = removed;
    }

    return h(tag, null, children)
  },

  beforeUpdate: function beforeUpdate () {
    // force removing pass
    this.__patch__(
      this._vnode,
      this.kept,
      false, // hydrating
      true // removeOnly (!important, avoids unnecessary moves)
    );
    this._vnode = this.kept;
  },

  updated: function updated () {
    var children = this.prevChildren;
    var moveClass = this.moveClass || ((this.name || 'v') + '-move');
    if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
      return
    }

    // we divide the work into three loops to avoid mixing DOM reads and writes
    // in each iteration - which helps prevent layout thrashing.
    children.forEach(callPendingCbs);
    children.forEach(recordPosition);
    children.forEach(applyTranslation);

    // force reflow to put everything in position
    var body = document.body;
    var f = body.offsetHeight; // eslint-disable-line

    children.forEach(function (c) {
      if (c.data.moved) {
        var el = c.elm;
        var s = el.style;
        addTransitionClass(el, moveClass);
        s.transform = s.WebkitTransform = s.transitionDuration = '';
        el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
          if (!e || /transform$/.test(e.propertyName)) {
            el.removeEventListener(transitionEndEvent, cb);
            el._moveCb = null;
            removeTransitionClass(el, moveClass);
          }
        });
      }
    });
  },

  methods: {
    hasMove: function hasMove (el, moveClass) {
      /* istanbul ignore if */
      if (!hasTransition) {
        return false
      }
      if (this._hasMove != null) {
        return this._hasMove
      }
      // Detect whether an element with the move class applied has
      // CSS transitions. Since the element may be inside an entering
      // transition at this very moment, we make a clone of it and remove
      // all other transition classes applied to ensure only the move class
      // is applied.
      var clone = el.cloneNode();
      if (el._transitionClasses) {
        el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
      }
      addClass(clone, moveClass);
      clone.style.display = 'none';
      this.$el.appendChild(clone);
      var info = getTransitionInfo(clone);
      this.$el.removeChild(clone);
      return (this._hasMove = info.hasTransform)
    }
  }
};

function callPendingCbs (c) {
  /* istanbul ignore if */
  if (c.elm._moveCb) {
    c.elm._moveCb();
  }
  /* istanbul ignore if */
  if (c.elm._enterCb) {
    c.elm._enterCb();
  }
}

function recordPosition (c) {
  c.data.newPos = c.elm.getBoundingClientRect();
}

function applyTranslation (c) {
  var oldPos = c.data.pos;
  var newPos = c.data.newPos;
  var dx = oldPos.left - newPos.left;
  var dy = oldPos.top - newPos.top;
  if (dx || dy) {
    c.data.moved = true;
    var s = c.elm.style;
    s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
    s.transitionDuration = '0s';
  }
}

var platformComponents = {
  Transition: Transition,
  TransitionGroup: TransitionGroup
};

/*  */

// install platform specific utils
Vue$3.config.mustUseProp = mustUseProp;
Vue$3.config.isReservedTag = isReservedTag;
Vue$3.config.getTagNamespace = getTagNamespace;
Vue$3.config.isUnknownElement = isUnknownElement;

// install platform runtime directives & components
extend(Vue$3.options.directives, platformDirectives);
extend(Vue$3.options.components, platformComponents);

// install platform patch function
Vue$3.prototype.__patch__ = inBrowser ? patch : noop;

// public mount method
Vue$3.prototype.$mount = function (
  el,
  hydrating
) {
  el = el && inBrowser ? query(el) : undefined;
  return mountComponent(this, el, hydrating)
};

// devtools global hook
/* istanbul ignore next */
setTimeout(function () {
  if (config.devtools) {
    if (devtools) {
      devtools.emit('init', Vue$3);
    } else if ("development" !== 'production' && isChrome) {
      console[console.info ? 'info' : 'log'](
        'Download the Vue Devtools extension for a better development experience:\n' +
        'https://github.com/vuejs/vue-devtools'
      );
    }
  }
  if ("development" !== 'production' &&
      config.productionTip !== false &&
      inBrowser && typeof console !== 'undefined') {
    console[console.info ? 'info' : 'log'](
      "You are running Vue in development mode.\n" +
      "Make sure to turn on production mode when deploying for production.\n" +
      "See more tips at https://vuejs.org/guide/deployment.html"
    );
  }
}, 0);

/*  */

// check whether current browser encodes a char inside attribute values
function shouldDecode (content, encoded) {
  var div = document.createElement('div');
  div.innerHTML = "<div a=\"" + content + "\">";
  return div.innerHTML.indexOf(encoded) > 0
}

// #3663
// IE encodes newlines inside attribute values while other browsers don't
var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;

/*  */

var isUnaryTag = makeMap(
  'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  'link,meta,param,source,track,wbr',
  true
);

// Elements that you can, intentionally, leave open
// (and which close themselves)
var canBeLeftOpenTag = makeMap(
  'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  true
);

// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
var isNonPhrasingTag = makeMap(
  'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  'title,tr,track',
  true
);

/*  */

var decoder;

function decode (html) {
  decoder = decoder || document.createElement('div');
  decoder.innerHTML = html;
  return decoder.textContent
}

/**
 * Not type-checking this file because it's mostly vendor code.
 */

/*!
 * HTML Parser By John Resig (ejohn.org)
 * Modified by Juriy "kangax" Zaytsev
 * Original code by Erik Arvidsson, Mozilla Public License
 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
 */

// Regular Expressions for parsing tags and attributes
var singleAttrIdentifier = /([^\s"'<>/=]+)/;
var singleAttrAssign = /(?:=)/;
var singleAttrValues = [
  // attr value double quotes
  /"([^"]*)"+/.source,
  // attr value, single quotes
  /'([^']*)'+/.source,
  // attr value, no quotes
  /([^\s"'=<>`]+)/.source
];
var attribute = new RegExp(
  '^\\s*' + singleAttrIdentifier.source +
  '(?:\\s*(' + singleAttrAssign.source + ')' +
  '\\s*(?:' + singleAttrValues.join('|') + '))?'
);

// could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
// but for Vue templates we can enforce a simple charset
var ncname = '[a-zA-Z_][\\w\\-\\.]*';
var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
var startTagOpen = new RegExp('^<' + qnameCapture);
var startTagClose = /^\s*(\/?)>/;
var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
var doctype = /^<!DOCTYPE [^>]+>/i;
var comment = /^<!--/;
var conditionalComment = /^<!\[/;

var IS_REGEX_CAPTURING_BROKEN = false;
'x'.replace(/x(.)?/g, function (m, g) {
  IS_REGEX_CAPTURING_BROKEN = g === '';
});

// Special Elements (can contain anything)
var isScriptOrStyle = makeMap('script,style', true);
var reCache = {};

var decodingMap = {
  '&lt;': '<',
  '&gt;': '>',
  '&quot;': '"',
  '&amp;': '&',
  '&#10;': '\n'
};
var encodedAttr = /&(?:lt|gt|quot|amp);/g;
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;

function decodeAttr (value, shouldDecodeNewlines) {
  var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  return value.replace(re, function (match) { return decodingMap[match]; })
}

function parseHTML (html, options) {
  var stack = [];
  var expectHTML = options.expectHTML;
  var isUnaryTag$$1 = options.isUnaryTag || no;
  var index = 0;
  var last, lastTag;
  while (html) {
    last = html;
    // Make sure we're not in a script or style element
    if (!lastTag || !isScriptOrStyle(lastTag)) {
      var textEnd = html.indexOf('<');
      if (textEnd === 0) {
        // Comment:
        if (comment.test(html)) {
          var commentEnd = html.indexOf('-->');

          if (commentEnd >= 0) {
            advance(commentEnd + 3);
            continue
          }
        }

        // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
        if (conditionalComment.test(html)) {
          var conditionalEnd = html.indexOf(']>');

          if (conditionalEnd >= 0) {
            advance(conditionalEnd + 2);
            continue
          }
        }

        // Doctype:
        var doctypeMatch = html.match(doctype);
        if (doctypeMatch) {
          advance(doctypeMatch[0].length);
          continue
        }

        // End tag:
        var endTagMatch = html.match(endTag);
        if (endTagMatch) {
          var curIndex = index;
          advance(endTagMatch[0].length);
          parseEndTag(endTagMatch[1], curIndex, index);
          continue
        }

        // Start tag:
        var startTagMatch = parseStartTag();
        if (startTagMatch) {
          handleStartTag(startTagMatch);
          continue
        }
      }

      var text = (void 0), rest$1 = (void 0), next = (void 0);
      if (textEnd >= 0) {
        rest$1 = html.slice(textEnd);
        while (
          !endTag.test(rest$1) &&
          !startTagOpen.test(rest$1) &&
          !comment.test(rest$1) &&
          !conditionalComment.test(rest$1)
        ) {
          // < in plain text, be forgiving and treat it as text
          next = rest$1.indexOf('<', 1);
          if (next < 0) { break }
          textEnd += next;
          rest$1 = html.slice(textEnd);
        }
        text = html.substring(0, textEnd);
        advance(textEnd);
      }

      if (textEnd < 0) {
        text = html;
        html = '';
      }

      if (options.chars && text) {
        options.chars(text);
      }
    } else {
      var stackedTag = lastTag.toLowerCase();
      var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
      var endTagLength = 0;
      var rest = html.replace(reStackedTag, function (all, text, endTag) {
        endTagLength = endTag.length;
        if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') {
          text = text
            .replace(/<!--([\s\S]*?)-->/g, '$1')
            .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
        }
        if (options.chars) {
          options.chars(text);
        }
        return ''
      });
      index += html.length - rest.length;
      html = rest;
      parseEndTag(stackedTag, index - endTagLength, index);
    }

    if (html === last) {
      options.chars && options.chars(html);
      if ("development" !== 'production' && !stack.length && options.warn) {
        options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
      }
      break
    }
  }

  // Clean up any remaining tags
  parseEndTag();

  function advance (n) {
    index += n;
    html = html.substring(n);
  }

  function parseStartTag () {
    var start = html.match(startTagOpen);
    if (start) {
      var match = {
        tagName: start[1],
        attrs: [],
        start: index
      };
      advance(start[0].length);
      var end, attr;
      while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
        advance(attr[0].length);
        match.attrs.push(attr);
      }
      if (end) {
        match.unarySlash = end[1];
        advance(end[0].length);
        match.end = index;
        return match
      }
    }
  }

  function handleStartTag (match) {
    var tagName = match.tagName;
    var unarySlash = match.unarySlash;

    if (expectHTML) {
      if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
        parseEndTag(lastTag);
      }
      if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
        parseEndTag(tagName);
      }
    }

    var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;

    var l = match.attrs.length;
    var attrs = new Array(l);
    for (var i = 0; i < l; i++) {
      var args = match.attrs[i];
      // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
      if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
        if (args[3] === '') { delete args[3]; }
        if (args[4] === '') { delete args[4]; }
        if (args[5] === '') { delete args[5]; }
      }
      var value = args[3] || args[4] || args[5] || '';
      attrs[i] = {
        name: args[1],
        value: decodeAttr(
          value,
          options.shouldDecodeNewlines
        )
      };
    }

    if (!unary) {
      stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
      lastTag = tagName;
    }

    if (options.start) {
      options.start(tagName, attrs, unary, match.start, match.end);
    }
  }

  function parseEndTag (tagName, start, end) {
    var pos, lowerCasedTagName;
    if (start == null) { start = index; }
    if (end == null) { end = index; }

    if (tagName) {
      lowerCasedTagName = tagName.toLowerCase();
    }

    // Find the closest opened tag of the same type
    if (tagName) {
      for (pos = stack.length - 1; pos >= 0; pos--) {
        if (stack[pos].lowerCasedTag === lowerCasedTagName) {
          break
        }
      }
    } else {
      // If no tag name is provided, clean shop
      pos = 0;
    }

    if (pos >= 0) {
      // Close all the open elements, up the stack
      for (var i = stack.length - 1; i >= pos; i--) {
        if ("development" !== 'production' &&
            (i > pos || !tagName) &&
            options.warn) {
          options.warn(
            ("tag <" + (stack[i].tag) + "> has no matching end tag.")
          );
        }
        if (options.end) {
          options.end(stack[i].tag, start, end);
        }
      }

      // Remove the open elements from the stack
      stack.length = pos;
      lastTag = pos && stack[pos - 1].tag;
    } else if (lowerCasedTagName === 'br') {
      if (options.start) {
        options.start(tagName, [], true, start, end);
      }
    } else if (lowerCasedTagName === 'p') {
      if (options.start) {
        options.start(tagName, [], false, start, end);
      }
      if (options.end) {
        options.end(tagName, start, end);
      }
    }
  }
}

/*  */

var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;

var buildRegex = cached(function (delimiters) {
  var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
});

function parseText (
  text,
  delimiters
) {
  var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  if (!tagRE.test(text)) {
    return
  }
  var tokens = [];
  var lastIndex = tagRE.lastIndex = 0;
  var match, index;
  while ((match = tagRE.exec(text))) {
    index = match.index;
    // push text token
    if (index > lastIndex) {
      tokens.push(JSON.stringify(text.slice(lastIndex, index)));
    }
    // tag token
    var exp = parseFilters(match[1].trim());
    tokens.push(("_s(" + exp + ")"));
    lastIndex = index + match[0].length;
  }
  if (lastIndex < text.length) {
    tokens.push(JSON.stringify(text.slice(lastIndex)));
  }
  return tokens.join('+')
}

/*  */

var dirRE = /^v-|^@|^:/;
var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
var bindRE = /^:|^v-bind:/;
var onRE = /^@|^v-on:/;
var argRE = /:(.*)$/;
var modifierRE = /\.[^.]+/g;

var decodeHTMLCached = cached(decode);

// configurable state
var warn$2;
var platformGetTagNamespace;
var platformMustUseProp;
var platformIsPreTag;
var preTransforms;
var transforms;
var postTransforms;
var delimiters;

/**
 * Convert HTML string to AST.
 */
function parse (
  template,
  options
) {
  warn$2 = options.warn || baseWarn;
  platformGetTagNamespace = options.getTagNamespace || no;
  platformMustUseProp = options.mustUseProp || no;
  platformIsPreTag = options.isPreTag || no;
  preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  transforms = pluckModuleFunction(options.modules, 'transformNode');
  postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  delimiters = options.delimiters;

  var stack = [];
  var preserveWhitespace = options.preserveWhitespace !== false;
  var root;
  var currentParent;
  var inVPre = false;
  var inPre = false;
  var warned = false;

  function endPre (element) {
    // check pre state
    if (element.pre) {
      inVPre = false;
    }
    if (platformIsPreTag(element.tag)) {
      inPre = false;
    }
  }

  parseHTML(template, {
    warn: warn$2,
    expectHTML: options.expectHTML,
    isUnaryTag: options.isUnaryTag,
    shouldDecodeNewlines: options.shouldDecodeNewlines,
    start: function start (tag, attrs, unary) {
      // check namespace.
      // inherit parent ns if there is one
      var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);

      // handle IE svg bug
      /* istanbul ignore if */
      if (isIE && ns === 'svg') {
        attrs = guardIESVGBug(attrs);
      }

      var element = {
        type: 1,
        tag: tag,
        attrsList: attrs,
        attrsMap: makeAttrsMap(attrs),
        parent: currentParent,
        children: []
      };
      if (ns) {
        element.ns = ns;
      }

      if (isForbiddenTag(element) && !isServerRendering()) {
        element.forbidden = true;
        "development" !== 'production' && warn$2(
          'Templates should only be responsible for mapping the state to the ' +
          'UI. Avoid placing tags with side-effects in your templates, such as ' +
          "<" + tag + ">" + ', as they will not be parsed.'
        );
      }

      // apply pre-transforms
      for (var i = 0; i < preTransforms.length; i++) {
        preTransforms[i](element, options);
      }

      if (!inVPre) {
        processPre(element);
        if (element.pre) {
          inVPre = true;
        }
      }
      if (platformIsPreTag(element.tag)) {
        inPre = true;
      }
      if (inVPre) {
        processRawAttrs(element);
      } else {
        processFor(element);
        processIf(element);
        processOnce(element);
        processKey(element);

        // determine whether this is a plain element after
        // removing structural attributes
        element.plain = !element.key && !attrs.length;

        processRef(element);
        processSlot(element);
        processComponent(element);
        for (var i$1 = 0; i$1 < transforms.length; i$1++) {
          transforms[i$1](element, options);
        }
        processAttrs(element);
      }

      function checkRootConstraints (el) {
        if ("development" !== 'production' && !warned) {
          if (el.tag === 'slot' || el.tag === 'template') {
            warned = true;
            warn$2(
              "Cannot use <" + (el.tag) + "> as component root element because it may " +
              'contain multiple nodes.'
            );
          }
          if (el.attrsMap.hasOwnProperty('v-for')) {
            warned = true;
            warn$2(
              'Cannot use v-for on stateful component root element because ' +
              'it renders multiple elements.'
            );
          }
        }
      }

      // tree management
      if (!root) {
        root = element;
        checkRootConstraints(root);
      } else if (!stack.length) {
        // allow root elements with v-if, v-else-if and v-else
        if (root.if && (element.elseif || element.else)) {
          checkRootConstraints(element);
          addIfCondition(root, {
            exp: element.elseif,
            block: element
          });
        } else if ("development" !== 'production' && !warned) {
          warned = true;
          warn$2(
            "Component template should contain exactly one root element. " +
            "If you are using v-if on multiple elements, " +
            "use v-else-if to chain them instead."
          );
        }
      }
      if (currentParent && !element.forbidden) {
        if (element.elseif || element.else) {
          processIfConditions(element, currentParent);
        } else if (element.slotScope) { // scoped slot
          currentParent.plain = false;
          var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
        } else {
          currentParent.children.push(element);
          element.parent = currentParent;
        }
      }
      if (!unary) {
        currentParent = element;
        stack.push(element);
      } else {
        endPre(element);
      }
      // apply post-transforms
      for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
        postTransforms[i$2](element, options);
      }
    },

    end: function end () {
      // remove trailing whitespace
      var element = stack[stack.length - 1];
      var lastNode = element.children[element.children.length - 1];
      if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
        element.children.pop();
      }
      // pop stack
      stack.length -= 1;
      currentParent = stack[stack.length - 1];
      endPre(element);
    },

    chars: function chars (text) {
      if (!currentParent) {
        if ("development" !== 'production' && !warned && text === template) {
          warned = true;
          warn$2(
            'Component template requires a root element, rather than just text.'
          );
        }
        return
      }
      // IE textarea placeholder bug
      /* istanbul ignore if */
      if (isIE &&
          currentParent.tag === 'textarea' &&
          currentParent.attrsMap.placeholder === text) {
        return
      }
      var children = currentParent.children;
      text = inPre || text.trim()
        ? decodeHTMLCached(text)
        // only preserve whitespace if its not right after a starting tag
        : preserveWhitespace && children.length ? ' ' : '';
      if (text) {
        var expression;
        if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
          children.push({
            type: 2,
            expression: expression,
            text: text
          });
        } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
          children.push({
            type: 3,
            text: text
          });
        }
      }
    }
  });
  return root
}

function processPre (el) {
  if (getAndRemoveAttr(el, 'v-pre') != null) {
    el.pre = true;
  }
}

function processRawAttrs (el) {
  var l = el.attrsList.length;
  if (l) {
    var attrs = el.attrs = new Array(l);
    for (var i = 0; i < l; i++) {
      attrs[i] = {
        name: el.attrsList[i].name,
        value: JSON.stringify(el.attrsList[i].value)
      };
    }
  } else if (!el.pre) {
    // non root node in pre blocks with no attributes
    el.plain = true;
  }
}

function processKey (el) {
  var exp = getBindingAttr(el, 'key');
  if (exp) {
    if ("development" !== 'production' && el.tag === 'template') {
      warn$2("<template> cannot be keyed. Place the key on real elements instead.");
    }
    el.key = exp;
  }
}

function processRef (el) {
  var ref = getBindingAttr(el, 'ref');
  if (ref) {
    el.ref = ref;
    el.refInFor = checkInFor(el);
  }
}

function processFor (el) {
  var exp;
  if ((exp = getAndRemoveAttr(el, 'v-for'))) {
    var inMatch = exp.match(forAliasRE);
    if (!inMatch) {
      "development" !== 'production' && warn$2(
        ("Invalid v-for expression: " + exp)
      );
      return
    }
    el.for = inMatch[2].trim();
    var alias = inMatch[1].trim();
    var iteratorMatch = alias.match(forIteratorRE);
    if (iteratorMatch) {
      el.alias = iteratorMatch[1].trim();
      el.iterator1 = iteratorMatch[2].trim();
      if (iteratorMatch[3]) {
        el.iterator2 = iteratorMatch[3].trim();
      }
    } else {
      el.alias = alias;
    }
  }
}

function processIf (el) {
  var exp = getAndRemoveAttr(el, 'v-if');
  if (exp) {
    el.if = exp;
    addIfCondition(el, {
      exp: exp,
      block: el
    });
  } else {
    if (getAndRemoveAttr(el, 'v-else') != null) {
      el.else = true;
    }
    var elseif = getAndRemoveAttr(el, 'v-else-if');
    if (elseif) {
      el.elseif = elseif;
    }
  }
}

function processIfConditions (el, parent) {
  var prev = findPrevElement(parent.children);
  if (prev && prev.if) {
    addIfCondition(prev, {
      exp: el.elseif,
      block: el
    });
  } else {
    warn$2(
      "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
      "used on element <" + (el.tag) + "> without corresponding v-if."
    );
  }
}

function findPrevElement (children) {
  var i = children.length;
  while (i--) {
    if (children[i].type === 1) {
      return children[i]
    } else {
      if ("development" !== 'production' && children[i].text !== ' ') {
        warn$2(
          "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
          "will be ignored."
        );
      }
      children.pop();
    }
  }
}

function addIfCondition (el, condition) {
  if (!el.ifConditions) {
    el.ifConditions = [];
  }
  el.ifConditions.push(condition);
}

function processOnce (el) {
  var once$$1 = getAndRemoveAttr(el, 'v-once');
  if (once$$1 != null) {
    el.once = true;
  }
}

function processSlot (el) {
  if (el.tag === 'slot') {
    el.slotName = getBindingAttr(el, 'name');
    if ("development" !== 'production' && el.key) {
      warn$2(
        "`key` does not work on <slot> because slots are abstract outlets " +
        "and can possibly expand into multiple elements. " +
        "Use the key on a wrapping element instead."
      );
    }
  } else {
    var slotTarget = getBindingAttr(el, 'slot');
    if (slotTarget) {
      el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
    }
    if (el.tag === 'template') {
      el.slotScope = getAndRemoveAttr(el, 'scope');
    }
  }
}

function processComponent (el) {
  var binding;
  if ((binding = getBindingAttr(el, 'is'))) {
    el.component = binding;
  }
  if (getAndRemoveAttr(el, 'inline-template') != null) {
    el.inlineTemplate = true;
  }
}

function processAttrs (el) {
  var list = el.attrsList;
  var i, l, name, rawName, value, arg, modifiers, isProp;
  for (i = 0, l = list.length; i < l; i++) {
    name = rawName = list[i].name;
    value = list[i].value;
    if (dirRE.test(name)) {
      // mark element as dynamic
      el.hasBindings = true;
      // modifiers
      modifiers = parseModifiers(name);
      if (modifiers) {
        name = name.replace(modifierRE, '');
      }
      if (bindRE.test(name)) { // v-bind
        name = name.replace(bindRE, '');
        value = parseFilters(value);
        isProp = false;
        if (modifiers) {
          if (modifiers.prop) {
            isProp = true;
            name = camelize(name);
            if (name === 'innerHtml') { name = 'innerHTML'; }
          }
          if (modifiers.camel) {
            name = camelize(name);
          }
        }
        if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
          addProp(el, name, value);
        } else {
          addAttr(el, name, value);
        }
      } else if (onRE.test(name)) { // v-on
        name = name.replace(onRE, '');
        addHandler(el, name, value, modifiers);
      } else { // normal directives
        name = name.replace(dirRE, '');
        // parse arg
        var argMatch = name.match(argRE);
        if (argMatch && (arg = argMatch[1])) {
          name = name.slice(0, -(arg.length + 1));
        }
        addDirective(el, name, rawName, value, arg, modifiers);
        if ("development" !== 'production' && name === 'model') {
          checkForAliasModel(el, value);
        }
      }
    } else {
      // literal attribute
      {
        var expression = parseText(value, delimiters);
        if (expression) {
          warn$2(
            name + "=\"" + value + "\": " +
            'Interpolation inside attributes has been removed. ' +
            'Use v-bind or the colon shorthand instead. For example, ' +
            'instead of <div id="{{ val }}">, use <div :id="val">.'
          );
        }
      }
      addAttr(el, name, JSON.stringify(value));
    }
  }
}

function checkInFor (el) {
  var parent = el;
  while (parent) {
    if (parent.for !== undefined) {
      return true
    }
    parent = parent.parent;
  }
  return false
}

function parseModifiers (name) {
  var match = name.match(modifierRE);
  if (match) {
    var ret = {};
    match.forEach(function (m) { ret[m.slice(1)] = true; });
    return ret
  }
}

function makeAttrsMap (attrs) {
  var map = {};
  for (var i = 0, l = attrs.length; i < l; i++) {
    if ("development" !== 'production' && map[attrs[i].name] && !isIE) {
      warn$2('duplicate attribute: ' + attrs[i].name);
    }
    map[attrs[i].name] = attrs[i].value;
  }
  return map
}

function isForbiddenTag (el) {
  return (
    el.tag === 'style' ||
    (el.tag === 'script' && (
      !el.attrsMap.type ||
      el.attrsMap.type === 'text/javascript'
    ))
  )
}

var ieNSBug = /^xmlns:NS\d+/;
var ieNSPrefix = /^NS\d+:/;

/* istanbul ignore next */
function guardIESVGBug (attrs) {
  var res = [];
  for (var i = 0; i < attrs.length; i++) {
    var attr = attrs[i];
    if (!ieNSBug.test(attr.name)) {
      attr.name = attr.name.replace(ieNSPrefix, '');
      res.push(attr);
    }
  }
  return res
}

function checkForAliasModel (el, value) {
  var _el = el;
  while (_el) {
    if (_el.for && _el.alias === value) {
      warn$2(
        "<" + (el.tag) + " v-model=\"" + value + "\">: " +
        "You are binding v-model directly to a v-for iteration alias. " +
        "This will not be able to modify the v-for source array because " +
        "writing to the alias is like modifying a function local variable. " +
        "Consider using an array of objects and use v-model on an object property instead."
      );
    }
    _el = _el.parent;
  }
}

/*  */

var isStaticKey;
var isPlatformReservedTag;

var genStaticKeysCached = cached(genStaticKeys$1);

/**
 * Goal of the optimizer: walk the generated template AST tree
 * and detect sub-trees that are purely static, i.e. parts of
 * the DOM that never needs to change.
 *
 * Once we detect these sub-trees, we can:
 *
 * 1. Hoist them into constants, so that we no longer need to
 *    create fresh nodes for them on each re-render;
 * 2. Completely skip them in the patching process.
 */
function optimize (root, options) {
  if (!root) { return }
  isStaticKey = genStaticKeysCached(options.staticKeys || '');
  isPlatformReservedTag = options.isReservedTag || no;
  // first pass: mark all non-static nodes.
  markStatic$1(root);
  // second pass: mark static roots.
  markStaticRoots(root, false);
}

function genStaticKeys$1 (keys) {
  return makeMap(
    'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
    (keys ? ',' + keys : '')
  )
}

function markStatic$1 (node) {
  node.static = isStatic(node);
  if (node.type === 1) {
    // do not make component slot content static. this avoids
    // 1. components not able to mutate slot nodes
    // 2. static slot content fails for hot-reloading
    if (
      !isPlatformReservedTag(node.tag) &&
      node.tag !== 'slot' &&
      node.attrsMap['inline-template'] == null
    ) {
      return
    }
    for (var i = 0, l = node.children.length; i < l; i++) {
      var child = node.children[i];
      markStatic$1(child);
      if (!child.static) {
        node.static = false;
      }
    }
  }
}

function markStaticRoots (node, isInFor) {
  if (node.type === 1) {
    if (node.static || node.once) {
      node.staticInFor = isInFor;
    }
    // For a node to qualify as a static root, it should have children that
    // are not just static text. Otherwise the cost of hoisting out will
    // outweigh the benefits and it's better off to just always render it fresh.
    if (node.static && node.children.length && !(
      node.children.length === 1 &&
      node.children[0].type === 3
    )) {
      node.staticRoot = true;
      return
    } else {
      node.staticRoot = false;
    }
    if (node.children) {
      for (var i = 0, l = node.children.length; i < l; i++) {
        markStaticRoots(node.children[i], isInFor || !!node.for);
      }
    }
    if (node.ifConditions) {
      walkThroughConditionsBlocks(node.ifConditions, isInFor);
    }
  }
}

function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
  for (var i = 1, len = conditionBlocks.length; i < len; i++) {
    markStaticRoots(conditionBlocks[i].block, isInFor);
  }
}

function isStatic (node) {
  if (node.type === 2) { // expression
    return false
  }
  if (node.type === 3) { // text
    return true
  }
  return !!(node.pre || (
    !node.hasBindings && // no dynamic bindings
    !node.if && !node.for && // not v-if or v-for or v-else
    !isBuiltInTag(node.tag) && // not a built-in
    isPlatformReservedTag(node.tag) && // not a component
    !isDirectChildOfTemplateFor(node) &&
    Object.keys(node).every(isStaticKey)
  ))
}

function isDirectChildOfTemplateFor (node) {
  while (node.parent) {
    node = node.parent;
    if (node.tag !== 'template') {
      return false
    }
    if (node.for) {
      return true
    }
  }
  return false
}

/*  */

var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;

// keyCode aliases
var keyCodes = {
  esc: 27,
  tab: 9,
  enter: 13,
  space: 32,
  up: 38,
  left: 37,
  right: 39,
  down: 40,
  'delete': [8, 46]
};

// #4868: modifiers that prevent the execution of the listener
// need to explicitly return null so that we can determine whether to remove
// the listener for .once
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };

var modifierCode = {
  stop: '$event.stopPropagation();',
  prevent: '$event.preventDefault();',
  self: genGuard("$event.target !== $event.currentTarget"),
  ctrl: genGuard("!$event.ctrlKey"),
  shift: genGuard("!$event.shiftKey"),
  alt: genGuard("!$event.altKey"),
  meta: genGuard("!$event.metaKey"),
  left: genGuard("$event.button !== 0"),
  middle: genGuard("$event.button !== 1"),
  right: genGuard("$event.button !== 2")
};

function genHandlers (events, native) {
  var res = native ? 'nativeOn:{' : 'on:{';
  for (var name in events) {
    res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  }
  return res.slice(0, -1) + '}'
}

function genHandler (
  name,
  handler
) {
  if (!handler) {
    return 'function(){}'
  } else if (Array.isArray(handler)) {
    return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  } else if (!handler.modifiers) {
    return fnExpRE.test(handler.value) || simplePathRE.test(handler.value)
      ? handler.value
      : ("function($event){" + (handler.value) + "}")
  } else {
    var code = '';
    var keys = [];
    for (var key in handler.modifiers) {
      if (modifierCode[key]) {
        code += modifierCode[key];
      } else {
        keys.push(key);
      }
    }
    if (keys.length) {
      code = genKeyFilter(keys) + code;
    }
    var handlerCode = simplePathRE.test(handler.value)
      ? handler.value + '($event)'
      : handler.value;
    return ("function($event){" + code + handlerCode + "}")
  }
}

function genKeyFilter (keys) {
  return ("if(" + (keys.map(genFilterCode).join('&&')) + ")return null;")
}

function genFilterCode (key) {
  var keyVal = parseInt(key, 10);
  if (keyVal) {
    return ("$event.keyCode!==" + keyVal)
  }
  var alias = keyCodes[key];
  return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
}

/*  */

function bind$1 (el, dir) {
  el.wrapData = function (code) {
    return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  };
}

/*  */

var baseDirectives = {
  bind: bind$1,
  cloak: noop
};

/*  */

// configurable state
var warn$3;
var transforms$1;
var dataGenFns;
var platformDirectives$1;
var isPlatformReservedTag$1;
var staticRenderFns;
var onceCount;
var currentOptions;

function generate (
  ast,
  options
) {
  // save previous staticRenderFns so generate calls can be nested
  var prevStaticRenderFns = staticRenderFns;
  var currentStaticRenderFns = staticRenderFns = [];
  var prevOnceCount = onceCount;
  onceCount = 0;
  currentOptions = options;
  warn$3 = options.warn || baseWarn;
  transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  dataGenFns = pluckModuleFunction(options.modules, 'genData');
  platformDirectives$1 = options.directives || {};
  isPlatformReservedTag$1 = options.isReservedTag || no;
  var code = ast ? genElement(ast) : '_c("div")';
  staticRenderFns = prevStaticRenderFns;
  onceCount = prevOnceCount;
  return {
    render: ("with(this){return " + code + "}"),
    staticRenderFns: currentStaticRenderFns
  }
}

function genElement (el) {
  if (el.staticRoot && !el.staticProcessed) {
    return genStatic(el)
  } else if (el.once && !el.onceProcessed) {
    return genOnce(el)
  } else if (el.for && !el.forProcessed) {
    return genFor(el)
  } else if (el.if && !el.ifProcessed) {
    return genIf(el)
  } else if (el.tag === 'template' && !el.slotTarget) {
    return genChildren(el) || 'void 0'
  } else if (el.tag === 'slot') {
    return genSlot(el)
  } else {
    // component or element
    var code;
    if (el.component) {
      code = genComponent(el.component, el);
    } else {
      var data = el.plain ? undefined : genData(el);

      var children = el.inlineTemplate ? null : genChildren(el, true);
      code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
    }
    // module transforms
    for (var i = 0; i < transforms$1.length; i++) {
      code = transforms$1[i](el, code);
    }
    return code
  }
}

// hoist static sub-trees out
function genStatic (el) {
  el.staticProcessed = true;
  staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
}

// v-once
function genOnce (el) {
  el.onceProcessed = true;
  if (el.if && !el.ifProcessed) {
    return genIf(el)
  } else if (el.staticInFor) {
    var key = '';
    var parent = el.parent;
    while (parent) {
      if (parent.for) {
        key = parent.key;
        break
      }
      parent = parent.parent;
    }
    if (!key) {
      "development" !== 'production' && warn$3(
        "v-once can only be used inside v-for that is keyed. "
      );
      return genElement(el)
    }
    return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  } else {
    return genStatic(el)
  }
}

function genIf (el) {
  el.ifProcessed = true; // avoid recursion
  return genIfConditions(el.ifConditions.slice())
}

function genIfConditions (conditions) {
  if (!conditions.length) {
    return '_e()'
  }

  var condition = conditions.shift();
  if (condition.exp) {
    return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
  } else {
    return ("" + (genTernaryExp(condition.block)))
  }

  // v-if with v-once should generate code like (a)?_m(0):_m(1)
  function genTernaryExp (el) {
    return el.once ? genOnce(el) : genElement(el)
  }
}

function genFor (el) {
  var exp = el.for;
  var alias = el.alias;
  var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';

  if (
    "development" !== 'production' &&
    maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key
  ) {
    warn$3(
      "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
      "v-for should have explicit keys. " +
      "See https://vuejs.org/guide/list.html#key for more info.",
      true /* tip */
    );
  }

  el.forProcessed = true; // avoid recursion
  return "_l((" + exp + ")," +
    "function(" + alias + iterator1 + iterator2 + "){" +
      "return " + (genElement(el)) +
    '})'
}

function genData (el) {
  var data = '{';

  // directives first.
  // directives may mutate the el's other properties before they are generated.
  var dirs = genDirectives(el);
  if (dirs) { data += dirs + ','; }

  // key
  if (el.key) {
    data += "key:" + (el.key) + ",";
  }
  // ref
  if (el.ref) {
    data += "ref:" + (el.ref) + ",";
  }
  if (el.refInFor) {
    data += "refInFor:true,";
  }
  // pre
  if (el.pre) {
    data += "pre:true,";
  }
  // record original tag name for components using "is" attribute
  if (el.component) {
    data += "tag:\"" + (el.tag) + "\",";
  }
  // module data generation functions
  for (var i = 0; i < dataGenFns.length; i++) {
    data += dataGenFns[i](el);
  }
  // attributes
  if (el.attrs) {
    data += "attrs:{" + (genProps(el.attrs)) + "},";
  }
  // DOM props
  if (el.props) {
    data += "domProps:{" + (genProps(el.props)) + "},";
  }
  // event handlers
  if (el.events) {
    data += (genHandlers(el.events)) + ",";
  }
  if (el.nativeEvents) {
    data += (genHandlers(el.nativeEvents, true)) + ",";
  }
  // slot target
  if (el.slotTarget) {
    data += "slot:" + (el.slotTarget) + ",";
  }
  // scoped slots
  if (el.scopedSlots) {
    data += (genScopedSlots(el.scopedSlots)) + ",";
  }
  // component v-model
  if (el.model) {
    data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + "},";
  }
  // inline-template
  if (el.inlineTemplate) {
    var inlineTemplate = genInlineTemplate(el);
    if (inlineTemplate) {
      data += inlineTemplate + ",";
    }
  }
  data = data.replace(/,$/, '') + '}';
  // v-bind data wrap
  if (el.wrapData) {
    data = el.wrapData(data);
  }
  return data
}

function genDirectives (el) {
  var dirs = el.directives;
  if (!dirs) { return }
  var res = 'directives:[';
  var hasRuntime = false;
  var i, l, dir, needRuntime;
  for (i = 0, l = dirs.length; i < l; i++) {
    dir = dirs[i];
    needRuntime = true;
    var gen = platformDirectives$1[dir.name] || baseDirectives[dir.name];
    if (gen) {
      // compile-time directive that manipulates AST.
      // returns true if it also needs a runtime counterpart.
      needRuntime = !!gen(el, dir, warn$3);
    }
    if (needRuntime) {
      hasRuntime = true;
      res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
    }
  }
  if (hasRuntime) {
    return res.slice(0, -1) + ']'
  }
}

function genInlineTemplate (el) {
  var ast = el.children[0];
  if ("development" !== 'production' && (
    el.children.length > 1 || ast.type !== 1
  )) {
    warn$3('Inline-template components must have exactly one child element.');
  }
  if (ast.type === 1) {
    var inlineRenderFns = generate(ast, currentOptions);
    return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  }
}

function genScopedSlots (slots) {
  return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "])")