-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathWinAppRunnerSystem.htm
558 lines (483 loc) · 237 KB
/
WinAppRunnerSystem.htm
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>WinApp Runner</title>
<style>
html,body{margin:0;padding:0;background-color:black;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;touch-action:none}
canvas{position:fixed;left:0;top:0;right:0;bottom:0;width:80%;height:100%;margin:0 auto}
.gui_pleasewait{position:fixed;width:64px;height:64px;left:0;right:0;top:-30px;bottom:0;margin:auto auto;border:0}
.gui_percentage{position:fixed;width:200px;height:64px;left:0;right:0;top:130px;bottom:0;margin:auto auto;border:0;font-family:Arial;font-weight:bold;font-size:20px;background-color:black;color:white;text-align:center}
.gui_upload{position:fixed;right:10px;top:10px;z-index:999;width:64px;height:64px;cursor:pointer;display:block;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QwUACMi+x873QAABmlJREFUeNrlm01oXNcVx3/nvjfz5HFlvOiY0CROIj8IjWk+RJjaJW3tWHa16KbQbIpLjB3NDMnGhZZCN4Vu7FAopqUw+ii4dVbORyF44TR2ECl2lKFIZNGuJqmJ20JR0tgJkj1P8+7pYiwltkbzpXc1o/hsZ9575/zvOeeeT1FVXJJVEEABg1JDQCyWJTxSAMQsYUjhqUFQLIIIqIIRp+zhu3ipAtaCxGA+/Xgg98onN7t5T/nH27fazPYFwccVDpKUBlitn1gUw4n/EJw/X6kmyeipMAye3E/Vv4VEUpqRCABW4Sawb6LCRtB0PmQgIRDWB4AqViL2jF+lF/SXI2F6MEXkme7fYbq1cUWZNQdNr4QHOHS6Er3njZgb8QZqgCrITcj9qUI/0eXCg3hdOMuOAFBg/iLB9yvJOrikqDw2hBpBOoChIxOYkxHTr8ID5CY/YE4OGtSBBuTGK2wmKhd2QRua0FIDLLrphK8f2PvEuk4TUGDP+PtsVnrPjJiuAbAKYi2bmYqlksVamlm5aaz2EGndqWx2yk1+gNxkTb/YEABB+c6ke7t/txAOTx8J9zkHoUnMsgqAmlK/ShzT1GiYFXg5E3D2UuFrO11/b05GjLZzDVoi9ox/6JSZ0dEw+OX9nPcM+wBiZdabr+zN/ZnI5Xf/WniIlHq3JVG3nXSsOBce4FcPcGJZeABPGLbZ8A+uv/vt8X8ioo1NwCqIRM6Ff/u58DDwk1W2KBwu58MXXH//hgpWG5hAbGGvY8f31tFwOONz2QjBGn9ZWow5tG+qMu2Sj5l8uGIGKxoQxW6RnxoNs19J8XIT4QFSWzzOXvxReJ9TZqS22gTm3m7K2DqztEnvGzs5Awy15A2yg4O8PlEg40wDLvrBbQDEFo47zPKsOXlShO918MgTjxP+zhU/xyuVqt4KjQzUq7fOrp4j4TOC/LSLR4++MxY+74qv2jIAVsEsfbTV0b37WDrQ093WLj3DKVeRYmrxf1vtct8hd+baggunF+C9Jsh6bDk1kOLsuWPJO8XcmWsLRsC4yPfKY5Pe7jadXst01ZDN+rxaHhsaSJpPBYznouUiJ094nTm9VjdDzoqZTJrNpRhM0q3Bd/PhMyrys6SZNcLhSwk7RfFqGPlCULBems6Hu0WYctXHSxlOTT+XnFMUDD7WS4zBtNQWIuIDDX8j+CHw8zatsxQRNUyOMlHwSVL8+hb8a0uShmTS0G+NX7kCXGnoGPPhN9st11uV/z41cfVvrhOjxQWD88JHv5PJBNXobhU+s9Vi0nh37enXDBhV/64FQLEYQe9aACT2MbbL6ZtSsWhcxOid0rlj4X2lYrErZ+55YKTLqOXR+MLEDp+rM4Vdv+6V8JfHwt/s8Lk6rG/+vutYQLU+jdVpRugbfQoEVXm6PX2r/b1m/bYqv0sxs22Gx9+t27J0HB1OjYZZVeaNEbCZ7V2nw9IPtox2zMbD9zBv5NacoNoNuAnU3+0bjrV5sv8CXnfJThAoIHUAPFOfwzvudvrjOtBWt9WofuzUcYZhAFThC5OiT+6nisu2QBT9I06n28rpPaOzLgHYcaBWXRZ9BQDftTGn0494wlh72ZAsAJccmuOK81oBQARmCvc7G3rMTVReAl7qtcOczodYPm+ImNu8uQZ82Sl9xwS6f4f3pfzsELk/djQZMjyTD6/3SJ5tnfz5raPhqvniVfdfLTCUikVTLJWaFoxjKzXPrKC5rbfnKi3H8ctjkx7mxVUtoFUA+AJfr12wTDW/EqKYXwwIzyM9TidVaiL2t60xerFh/2vNQclrVdKHTle+FMWSdwr34rGlccyx1kODKSKXHdqNovLYEGYN4ZsC4Bl4jF2L3aaa/UClYtFYMU3zFdM8yRCesBc27bTksH3TttoqaXm6IsuDx5uLLuXDOvOt5Gt/X0CZlYMtr8d+UPthe6HtQlfnO0PW9u0IbfkHpG02jDpZpup8ZQaw3GDv+L/7Svjpwr1sYYvblZk7gZiTkZ6bRKcqnxgAUB+uNNo7k3jjaDi4PcVn68nk1704uTJnU43Inf5wQwSfKewETffB4uQdQNTfWGPmop94ee1cGAZfPVCrGvVRSa4YK662xxVFgAU+2rZ//Pqn3bxjajTMPnwP88sFTCd55Easzxv5fNtUVBBVIhOxWA3SAJmgGtkoIEjBkoW0d+v/G7A+/39Uv1aWb/CsRwAAAABJRU5ErkJggg==");opacity:0.3;border-radius:32px;border:1px solid white}
.gui_download{position:fixed;right:10px;top:84px;z-index:999;width:64px;height:64px;cursor:pointer;display:block;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5QwUAB8qhjfKEAAABp1JREFUeNrlm11oXNcRx39z7tWuLcWKC1UIJP3AvhDyklBjNlb6EbmWQiiG1jSF9MNp48TapU956UNSSt6aOoVSCoVdybRuAn5JyUMwjd3IrUlJoiytFRNcQn3tEjvOQ+W0thxptXf3nunDSvLaWmnvru5dSdE8Lezh3Jn/mfM/c+bMiKqSpFgFARQwKFUExGKp4NAFQEgFQxeOGgTFIoiAKhhJVD3cJCZVwFqQEMzUx5syf/zfbDvzFPdv7bHdW6cFl6RwkLg8wGptxYIQnv+I9PHjfjlORX/teemduym7c0jE5RmxAGAVZoGBEZ9OyKlhj00xgbAyAFSxErCrcInVkD//yEtt6SJwTPtzmHb3uKKcNkNmtYwHePiIH5xxBk0p7KAHqILMQuZFn7Ukb2W/iNMGWbYEgAKTJ0nv9eMluLikeHAbagRpAYaWtsCEDJq1ajxAZvQCEzJk0AQ8IFPwWU9SzG6HCJ7Q1AMsuu6Mry3YeUJd4RZQYFfhPOtVzphB0zYAVkGsZT1LLp+3WMtyu9w0dnsItEYq610yoxeQWZbkxYYkqCgPxOz67wx730E0G+28lcIDI/7LsX4/6zWkRLfxcTdkyOdj9f9SwGR3Wv4eZexMwGTcnjAhg+Z+O2YdaQKAJajtnZhlc4o+RXdGGyv/SIIP/iYhos5Nl6ibAAgV+kcuJnPvFv0CyJ6I0cnxJHT4auHfvHNLfODWs36SIZ6qfIDoyYgc8EFielBBNbXgBW79JWdgNLmApxzyYZcjY1HGVkI+TEqPXYWLjA97iz0gCElUNrn6ZZDno4x1XP0J8HZiykh1wfSFOGDiDdJsEBk/6aZvCoRCC0+v4Vte3PK075d1LjQyUMvebjSpzgNgFUzlSs9GA6Br5r89dv7dIfPS1emNBkDmpavTRsBYNq4oYBzZuABUQnDjfBo89j2vt2fLpNOQdEK5zXUiElQot/01e/tnGv03fb0v3HvUn4olHHCquCLV2ADoTdOf0r7jDV9snOjzuA7PufQ91yhJ09Oj3wBeiwUADCYgvjPwa7/3Tyg8k5TLhpZnMqPnX4trPteCmSmnU3EqecYMvmCVl+M3X195zx18Ic4ZZ6YNJm41c/m8/de7PBUqZ2NbeeXs+xPyRBJ5CtOdLgdxT/p40Z/6aJZvAldWOpdVppDSvseL8RBfvXT3WEyqFXZqQb79on++avmB1RUZj1F9rL9w+Vwi4bABo5pIkQgAD476J4zwbPssHS/pLQ6ELEZItkbotAwe0jZIMbS8OmHiJb1FAIcuxrZZfZPP5cyxJ727o5Di5Cc8pfDPFlz/7MfT7I9Cesee9O7O53JtkbnjgJE2Q+H7wrGRO1wujWe3/7LZ2L1H/SlL6VsWpiIYP6VS2hcl2nvroPerO1wu7dDXf9v2KaBaq8ZqOYgw+hUAVfl6lPH9hcvnDPa7y5Fiq6RnhIdqe1kGWtX/8CNenyoYI2C7t06vgKiiX0ELF/6E6M+WNAj9aTukJ2jLfnzPnUwamcsIqXXplLwrQz8HfaVRpHfaDP2iU3qk03UpMcfU6vA68eFcPm//c12esHWRosL7F9EDSUR6jaRmq9wAAGDnbjqWFN171J+aldK+OVL8pKQ8+mjhwrVOff/BPdXyjW03T2odTowMFC6fK1fYX6rw/YER/2xHP14X/C38EoHx7Oc6WvT40O/8VzudBTo17GHrVt7cxOb66X8bSd1Sge7ecq5S/OE2Mn9oqTJkx/iwd22V7OltZfBfDniL6osXnX/VtCGfy5lmjBxaqTpmAc3e1V1XaVqOXzw46mAOLUp/LQLAFbi3OmY5vPxLcRDy7Cbhx4i6q2q7SlXE/qY5Roca5v6WLJS8Wib18BE/+DTs+7ezd+GweYnocwnZ0kUwkqV7vRtfPLgNs4TxywLgGLif7TPtXjXXguRzOWPFLHtfMctfMoQv2bF1+3q2w75um3WVNF1dkfnC4/Ulbw57NeWb2Re9X0A5LUOmUxeWlbj9DjsWOdHVes+QtWu2hLa4j5Tt84JWmqlab5kBLCX6C5fXlPGnsnexmc3JtszcCsSEDK76lmjV5WMDAOZzeKu3JU4c8LZs7eL6Sm7yK26cXKizKQdkjlzsiOHj2c9DXbUnqwlAPRC1GauMn3TTcZfdHfO89Gf3VMtGXVSIrZdYkuoeVxQBprnSu7twra2HzcOPeH333MlkLYGZTMpKOtE+b+RGt6moIKoEJmC+NqE7XQ5skCbdBRULKWdufAfa5/8PUjW5zzgtmJQAAAAASUVORK5CYII=");opacity:0.3;border-radius:32px;border:1px solid white}
.gui_filedownload_container{position:fixed;width:300px;height:350px;overflow-y:hidden;left:0;right:0;top:0;bottom:0;margin:auto auto;background-color:gray;border:1px solid gray;display:none;z-index:99}
.gui_filedownload_title{width:100%;background-color:#b9180b;font-family:Arial;font-size:16px;color:white;text-shadow:0 0 3px #000000,0 0 7px #000000;text-align:left;line-height:2.8;border-bottom:1px solid gray}
.gui_filedownload_title_value{padding-left:10px}
.gui_filedownload_title_close{float:right;padding-right:10px;cursor:pointer}
.gui_filedownload_location{width:100%;background-color:#D3D3D3;font-family:Arial;font-size:16px;line-height:2.8;border-bottom:1px solid silver}
.gui_filedownload_location_value{width:280px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;padding-left:10px;padding-right:10px}
.gui_filedownload_select{width:100%;height:259px;overflow-y:scroll;background-color:white;border:none;font-family:Arial;font-size:16px}
.gui_filedownload_fileitem{width:100%;font-family:Arial;font-size:16px;line-height:2}
.gui_filedownload_fileitem:hover{background-color:#3a76b1;color:white;cursor:pointer}
.gui_filedownload_fileitem_name{padding-left:7px}
.gui_fileupload_container{position:fixed;width:300px;height:308px;overflow-y:hidden;left:0;right:0;top:0;bottom:0;margin:auto auto;background-color:#D3D3D3;border:1px solid gray;display:none;z-index:99}
.gui_fileupload_title{width:100%;background-color:#b9180b;font-family:Arial;font-size:16px;color:white;text-shadow:0 0 3px #000000,0 0 7px #000000;text-align:left;line-height:2.8;border-bottom:1px solid gray}
.gui_fileupload_title_value{padding-left:10px}
.gui_fileupload_title_close{float:right;padding-right:10px;cursor:pointer}
.gui_fileupload_location{width:100%;background-color:#D3D3D3;font-family:Arial;font-size:16px;line-height:2.8;border-bottom:1px solid silver}
.gui_fileupload_location_value{width:280px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;padding-left:10px;padding-right:10px}
.gui_fileupload_select{width:100%;height:159px;overflow-y:scroll;background-color:white;border:none;font-family:Arial;font-size:16px;border-bottom:1px solid silver}
.gui_fileupload_submit{width:180px;background-color:silver;font-family:Arial;font-size:16px;text-align:center;line-height:2.3;border:1px solid gray;margin:10px auto;cursor:pointer}
.gui_fileupload_submit:hover{background-color:#A9A9A9}
.gui_fileupload_uploader{display:none}
.gui_fileupload_fileitem{width:100%;font-family:Arial;font-size:16px;line-height:2}
.gui_fileupload_fileitem:hover{background-color:#3a76b1;color:white;cursor:pointer}
.gui_fileupload_fileitem_name{padding-left:7px}
.lds-spinner{color:white;display:inline-block;position:relative;width:64px;height:64px}
.lds-spinner div{transform-origin:32px 32px;animation:lds-spinner 1.2s linear infinite}
.lds-spinner div:after{content:" ";display:block;position:fixed;top:3px;left:29px;width:5px;height:14px;border-radius:20%;background:white}
.lds-spinner div:nth-child(1){transform:rotate(0deg);animation-delay:-1.1s}
.lds-spinner div:nth-child(2){transform:rotate(30deg);animation-delay:-1s}
.lds-spinner div:nth-child(3){transform:rotate(60deg);animation-delay:-0.9s}
.lds-spinner div:nth-child(4){transform:rotate(90deg);animation-delay:-0.8s}
.lds-spinner div:nth-child(5){transform:rotate(120deg);animation-delay:-0.7s}
.lds-spinner div:nth-child(6){transform:rotate(150deg);animation-delay:-0.6s}
.lds-spinner div:nth-child(7){transform:rotate(180deg);animation-delay:-0.5s}
.lds-spinner div:nth-child(8){transform:rotate(210deg);animation-delay:-0.4s}
.lds-spinner div:nth-child(9){transform:rotate(240deg);animation-delay:-0.3s}
.lds-spinner div:nth-child(10){transform:rotate(270deg);animation-delay:-0.2s}
.lds-spinner div:nth-child(11){transform:rotate(300deg);animation-delay:-0.1s}
.lds-spinner div:nth-child(12){transform:rotate(330deg);animation-delay:0s}
@keyframes lds-spinner{0%{opacity:1}100%{opacity:0}}
</style>
</head>
<body>
<div class="gui_pleasewait"><div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>
<div class="gui_percentage"><script>document.write(parent.STRING_BOOTING);</script></div>
<div class="gui_download"></div>
<div class="gui_upload"></div>
<div class="gui_filedownload_container">
<div class="gui_filedownload_title">
<span class="gui_filedownload_title_value" id="gui_filedownload_title_value"><script>document.write(parent.STRING_DOWNLOADFILE);</script></span>
<div class="gui_filedownload_title_close" onclick="download_HideFileList()">X</div>
</div>
<div class="gui_filedownload_location"><div class="gui_filedownload_location_value"> </div></div>
<div class="gui_filedownload_select"></div>
</div>
<div class="gui_fileupload_container">
<div class="gui_fileupload_title">
<span class="gui_fileupload_title_value" id="gui_fileupload_title_value"><script>document.write(parent.STRING_SELECTFOLDER);</script></span>
<div class="gui_fileupload_title_close" onclick="upload_HideFolderList()">X</div>
</div>
<div class="gui_fileupload_location"><div class="gui_fileupload_location_value"> </div></div>
<div class="gui_fileupload_select"></div>
<div class="gui_fileupload_submit" onclick="upload_writeFile()"><script>document.write(parent.STRING_UPLOADFILE);</script></div>
</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<input type="file" class="gui_fileupload_uploader" id="gui_fileupload_uploader" onchange="upload_getFile(event.target.files);" />
<script>
// browserfs.min.js
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BrowserFS=e():t.BrowserFS=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){(function(t,r,i,o){"use strict";function s(t,e){switch(typeof t){case"number":return t;case"string":var n=parseInt(t,8);return isNaN(n)?e:n;default:return e}}function a(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);throw new ke(_e.EINVAL,"Invalid time.")}function c(t){if(t.indexOf("\0")>=0)throw new ke(_e.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new ke(_e.EINVAL,"Path must not be empty.");return me.resolve(t)}function u(t,e,n,r){switch(typeof t){case"object":return{encoding:"undefined"!=typeof t.encoding?t.encoding:e,flag:"undefined"!=typeof t.flag?t.flag:n,mode:s(t.mode,r)};case"string":return{encoding:t,flag:n,mode:r};default:return{encoding:e,flag:n,mode:r}}}function f(){}function h(t,e,n){n.existsSync(t)||(h(me.dirname(t),e,n),n.mkdirSync(t,e))}function p(t){var e=l(t),n=e.byteOffset,r=e.byteLength;return 0===n&&r===e.buffer.byteLength?e.buffer:e.buffer.slice(n,n+r)}function l(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function d(t){return t instanceof r?t:t instanceof Uint8Array?y(t):new r(t)}function y(t){return t instanceof r?t:0===t.byteOffset&&t.byteLength===t.buffer.byteLength?g(t.buffer):new r(t)}function g(t){try{return new r(t)}catch(e){return new r(new Uint8Array(t))}}function v(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=t.length),e<0||n<0||n>t.length||e>n)throw new TypeError("Invalid slice bounds on buffer of length "+t.length+": ["+e+", "+n+"]");if(0===t.length)return new r(0);var i=l(t),o=t[0],s=(o+1)%255;return t[0]=s,i[0]===s?(i[0]=o,y(i.slice(e,n))):(t[0]=o,y(i.subarray(e,n)))}function w(t){return t}function m(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function _(t,e,n){return e=qe(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=qe(r.length-e,0),s=Array(o);++i<o;)s[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(s),m(t,this,a)}}function E(t){return function(){return t}}function S(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function b(t){var e=S(t)?Ge.call(t):"";return e==Ye||e==Xe||e==Ke}function k(t){return!!nn&&nn in t}function I(t){if(null!=t){try{return on.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function F(t){if(!S(t)||k(t))return!1;var e=b(t)?pn:an;return e.test(I(t))}function N(t,e){return null==t?void 0:t[e]}function O(t,e){var n=N(t,e);return F(n)?n:void 0}function T(t){var e=0,n=0;return function(){var r=vn(),i=gn-(r-n);if(n=r,i>0){if(++e>=yn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function L(t,e){return wn(_(t,e,w),t+"")}function R(t){return null!=t&&"object"==typeof t}function x(t){return"symbol"==typeof t||R(t)&&En.call(t)==mn}function A(t){if("number"==typeof t)return t;if(x(t))return Sn;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(bn,"");var n=In.test(t);return n||Fn.test(t)?Nn(t.slice(2),n?2:8):kn.test(t)?Sn:+t}function D(t){if(!t)return 0===t?t:0;if(t=A(t),t===On||t===-On){var e=t<0?-1:1;return e*Tn}return t===t?t:0}function P(t){var e=D(t),n=e%1;return e===e?n?e-n:e:0}function C(t,e){if("function"!=typeof t)throw new TypeError(Ln);return e=void 0===e?e:P(e),L(t,e)}function M(t){return C(function(e,n){var r=Rn(function(n,r){var i=this;return t(e,function(t,e){t.apply(i,n.concat([e]))},r)});return n.length?r.apply(this,n):r})}function U(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=xn}function B(t){return null!=t&&U(t.length)&&!b(t)}function j(){}function z(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}function V(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function W(t){return R(t)&&Mn.call(t)==Pn}function H(){return!1}function Z(t,e){return e=null==e?Kn:e,!!e&&("number"==typeof t||Jn.test(t))&&t>-1&&t%1==0&&t<e}function q(t){return R(t)&&U(t.length)&&!!Er[br.call(t)]}function Y(t){return function(e){return t(e)}}function X(t,e){var n=Vn(t),r=!n&&zn(t),i=!n&&!r&&Xn(t),o=!n&&!r&&!i&&Lr(t),s=n||r||i||o,a=s?V(t.length,String):[],c=a.length;for(var u in t)!e&&!xr.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Z(u,c))||a.push(u);return a}function K(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||Ar;return t===n}function J(t,e){return function(n){return t(e(n))}}function G(t){if(!K(t))return Dr(t);var e=[];for(var n in Object(t))Cr.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Q(t){return B(t)?X(t):G(t)}function $(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}function tt(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}function et(t){var e=Q(t),n=-1,r=e.length;return function(){var i=e[++n];return n<r?{value:t[i],key:i}:null}}function nt(t){if(B(t))return $(t);var e=Dn(t);return e?tt(e):et(t)}function rt(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function it(t){return function(e,n,r){function i(t){if(c-=1,t)a=!0,r(t);else{if(a&&c<=0)return r(null);o()}}function o(){for(;c<t&&!a;){var e=s();if(null===e)return a=!0,void(c<=0&&r(null));c+=1,n(e.value,e.key,rt(i))}}if(r=z(r||j),t<=0||!e)return r(null);var s=nt(e),a=!1,c=0;o()}}function ot(t,e,n,r){it(e)(t,n,r)}function st(t,e){return function(n,r,i){return t(n,e,r,i)}}function at(t,e){var n;if("function"!=typeof e)throw new TypeError(Mr);return t=P(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}function ct(t){return at(2,t)}function ut(t,e,n){function r(t){t?n(t):++o===s&&n(null)}n=ct(n||j);var i=0,o=0,s=t.length;for(0===s&&n(null);i<s;i++)e(t[i],i,rt(r))}function ft(t){return function(e,n,r){return t(Br,e,n,r)}}function ht(t,e,n,r){r=z(r||j),e=e||[];var i=[],o=0;t(e,function(t,e,r){var s=o++;n(t,function(t,e){i[s]=e,r(t)})},function(t){r(t,i)})}function pt(t){return function(e,n,r,i){return t(it(n),e,r,i)}}function lt(t,e){for(var n=-1,r=t?t.length:0;++n<r&&e(t[n],n,t)!==!1;);return t}function dt(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(n(o[c],c,o)===!1)break}return e}}function yt(t){setTimeout(t,0)}function gt(t){return C(function(e,n){t(function(){e.apply(null,n)})})}function vt(){this.head=this.tail=null,this.length=0}function wt(t,e){t.length=1,t.head=t.tail=e}function mt(t,e,n,r){r=z(r||j),vi(t,function(t,r,i){n(e,t,function(t,n){e=n,i(t)})},function(t){r(t,e)})}function _t(t){return C(function(e,n){e.apply(null,n.concat([C(function(e,n){"object"==typeof console&&(e?console.error&&console.error(e):console[t]&<(n,function(e){console[t](e)}))})]))})}function Et(t){return function(e,n,r){return t(e,r)}}function St(t,e,n){Br(t,Et(e),n)}function bt(){null===_i&&(_i={},_i[Dropbox.ApiError.NETWORK_ERROR]=_e.EIO,_i[Dropbox.ApiError.INVALID_PARAM]=_e.EINVAL,_i[Dropbox.ApiError.INVALID_TOKEN]=_e.EPERM,_i[Dropbox.ApiError.OAUTH_ERROR]=_e.EPERM,_i[Dropbox.ApiError.NOT_FOUND]=_e.ENOENT,_i[Dropbox.ApiError.INVALID_METHOD]=_e.EINVAL,_i[Dropbox.ApiError.NOT_ACCEPTABLE]=_e.EINVAL,_i[Dropbox.ApiError.CONFLICT]=_e.EINVAL,_i[Dropbox.ApiError.RATE_LIMITED]=_e.EBUSY,_i[Dropbox.ApiError.SERVER_ERROR]=_e.EBUSY,_i[Dropbox.ApiError.OVER_QUOTA]=_e.ENOSPC)}function kt(t){return t&&t.stat.isFile}function It(t){return t&&t.stat.isFolder}function Ft(t){return null===t||void 0===t||"object"==typeof t&&"number"==typeof t.byteLength}function Nt(t,e){void 0===e&&(e="");for(var n=t.errno,r=t.node,i=[];r&&(i.unshift(r.name),r!==r.parent);)r=r.parent;return new ke(n,Se[n],i.length>0?"/"+i.join("/"):e)}function Ot(t,e){if(null!==e&&"object"==typeof e){var n=e,r=n.path;r&&(r="/"+me.relative(t,r),n.message=n.message.replace(n.path,r),n.path=r)}return e}function Tt(t,e){return"function"==typeof e?function(n){arguments.length>0&&(arguments[0]=Ot(t,n)),e.apply(null,arguments)}:e}function Lt(t,e,n){return"Sync"!==t.slice(t.length-4)?function(){return arguments.length>0&&(e&&(arguments[0]=me.join(this._folder,arguments[0])),n&&(arguments[1]=me.join(this._folder,arguments[1])),arguments[arguments.length-1]=Tt(this._folder,arguments[arguments.length-1])),this._wrapped[t].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=me.join(this._folder,arguments[0])),n&&(arguments[1]=me.join(this._folder,arguments[1])),this._wrapped[t].apply(this._wrapped,arguments)}catch(r){throw Ot(this._folder,r)}}}function Rt(t){return t.isDirectory}function xt(t,e,n,r){if("undefined"!=typeof navigator.webkitPersistentStorage)switch(t){case Ee.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(e,n,r);break;case Ee.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(e,n,r);break;default:r(new TypeError("Invalid storage type: "+t))}else Ee.webkitStorageInfo.requestQuota(t,e,n,r)}function At(t){return Array.prototype.slice.call(t||[],0)}function Dt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})}function Pt(t,e){return!t||(e(t),!1)}function Ct(t,e,n){return!t||(e.abort(function(){n(t)}),!1)}function Mt(t,e){switch(void 0===e&&(e=t.toString()),t.name){case"NotFoundError":return new ke(_e.ENOENT,e);case"QuotaExceededError":return new ke(_e.ENOSPC,e);default:return new ke(_e.EIO,e)}}function Ut(t,e,n){return void 0===e&&(e=_e.EIO),void 0===n&&(n=null),function(r){r.preventDefault(),t(new ke(e,n))}}function Bt(t,e,n){return e?function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=e[0],i=this._getFs(r);e[0]=i.path;try{return i.fs[t].apply(i.fs,e)}catch(o){throw this.standardizeError(o,i.path,r),o}}:function(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];var i=n[0],o=this._getFs(i);if(n[0]=o.path,"function"==typeof n[n.length-1]){var s=n[n.length-1];n[n.length-1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];t.length>0&&t[0]instanceof ke&&e.standardizeError(t[0],o.path,i),s.apply(null,t)}}return o.fs[t].apply(o.fs,n)}}function jt(t){return 146|t}function zt(t){return Ie.getFileFlag(t)}function Vt(t){return{type:ro.API_ERROR,errorData:Jt(t.writeToBuffer())}}function Wt(t){return ke.fromBuffer(Gt(t.errorData))}function Ht(t){return{type:ro.ERROR,name:t.name,message:t.message,stack:t.stack}}function Zt(t){var e=Ee[t.name];"function"!=typeof e&&(e=Error);var n=new e(t.message);return n.stack=t.stack,n}function qt(t){return{type:ro.STATS,statsData:Jt(t.toBuffer())}}function Yt(t){return Ne.fromBuffer(Gt(t.statsData))}function Xt(t){return{type:ro.FILEFLAG,flagStr:t.getFlagString()}}function Kt(t){return Ie.getFileFlag(t.flagStr)}function Jt(t){return p(t)}function Gt(t){return g(t)}function Qt(t){return{type:ro.BUFFER,data:Jt(t)}}function $t(t){return Gt(t.data)}function te(t){return t&&"object"==typeof t&&t.hasOwnProperty("browserfsMessage")&&t.browserfsMessage}function ee(t){return t&&"object"==typeof t&&t.hasOwnProperty("browserfsMessage")&&t.browserfsMessage}function ne(t,e,n){var i=new XMLHttpRequest;i.open("GET",t,!0);var o=!0;switch(e){case"buffer":i.responseType="arraybuffer";break;case"json":try{i.responseType="json",o="json"===i.responseType}catch(s){o=!1}break;default:return n(new ke(_e.EINVAL,"Invalid download type: "+e))}i.onreadystatechange=function(t){if(4===i.readyState){if(200!==i.status)return n(new ke(i.status,"XHR error."));switch(e){case"buffer":return n(null,new r(i.response?i.response:0));case"json":return o?n(null,i.response):n(null,JSON.parse(i.responseText))}}},i.send()}function re(t,e){var n=new XMLHttpRequest;n.open("GET",t,!1);var i=null,o=null;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.onreadystatechange=function(t){if(4===n.readyState){if(200!==n.status)return void(o=new ke(n.status,"XHR error."));switch(e){case"buffer":var s=n.responseText;i=new r(s.length);for(var a=0;a<s.length;a++)i[a]=s.charCodeAt(a);return;case"json":return void(i=JSON.parse(n.responseText))}}},n.send(),o)throw o;return i}function ie(t,e){var n=new XMLHttpRequest;switch(n.open("GET",t,!1),e){case"buffer":n.responseType="arraybuffer";break;case"json":break;default:throw new ke(_e.EINVAL,"Invalid download type: "+e)}var i,o;if(n.onreadystatechange=function(t){if(4===n.readyState)if(200===n.status)switch(e){case"buffer":i=new r(n.response);break;case"json":i=JSON.parse(n.response)}else o=new ke(n.status,"XHR error.")},n.send(),o)throw o;return i}function oe(t,e,n){var r=new XMLHttpRequest;r.open("HEAD",e,t),r.onreadystatechange=function(t){if(4===r.readyState){if(200!==r.status)return n(new ke(r.status,"XHR HEAD error."));try{return n(null,parseInt(r.getResponseHeader("Content-Length")||"-1",10))}catch(t){return n(new ke(_e.EIO,"XHR HEAD error: Could not read content-length."))}}},r.send()}function se(t){var e;return oe(!1,t,function(t,n){if(t)throw t;e=n}),e}function ae(t,e){oe(!0,t,e)}function ce(t){return t&&t.isFile()}function ue(t){return t&&t.isDir()}function fe(t,e,n){try{n(null,t.toString(e))}catch(r){n(r)}}function he(t,e){var n=31&e,r=(e>>5&15)-1,i=(e>>9)+1980,o=31&t,s=t>>5&63,a=t>>11;return new Date(i,r,n,a,s,o)}function pe(t,e,n,r){return 0===r?"":e?t.toString("utf8",n,n+r):mo.byte2str(t.slice(n,n+r))}function le(t){t.Buffer=r,t.process=o;var e=t.require?t.require:null;t.require=function(t){var n=ye(t);return n?n:e.apply(null,Array.prototype.slice.call(arguments,0))}}function de(t,e){xo[t]=e}function ye(t){switch(t){case"fs":return Re;case"path":return me;case"buffer":return we;case"process":return o;case"bfs_utils":return Pe;default:return xo[t]}}function ge(t){return Re.initialize(t)}Object.defineProperty(e,"__esModule",{value:!0});var ve,we=n(4),me=n(12);ve="undefined"!=typeof window?window:"undefined"!=typeof self?self:t;var _e,Ee=ve;!function(t){t[t.EPERM=1]="EPERM",t[t.ENOENT=2]="ENOENT",t[t.EIO=5]="EIO",t[t.EBADF=9]="EBADF",t[t.EACCES=13]="EACCES",t[t.EBUSY=16]="EBUSY",t[t.EEXIST=17]="EEXIST",t[t.ENOTDIR=20]="ENOTDIR",t[t.EISDIR=21]="EISDIR",t[t.EINVAL=22]="EINVAL",t[t.EFBIG=27]="EFBIG",t[t.ENOSPC=28]="ENOSPC",t[t.EROFS=30]="EROFS",t[t.ENOTEMPTY=39]="ENOTEMPTY",t[t.ENOTSUP=95]="ENOTSUP"}(_e||(_e={}));var Se={};Se[_e.EPERM]="Operation not permitted.",Se[_e.ENOENT]="No such file or directory.",Se[_e.EIO]="Input/output error.",Se[_e.EBADF]="Bad file descriptor.",Se[_e.EACCES]="Permission denied.",Se[_e.EBUSY]="Resource busy or locked.",Se[_e.EEXIST]="File exists.",Se[_e.ENOTDIR]="File is not a directory.",Se[_e.EISDIR]="File is a directory.",Se[_e.EINVAL]="Invalid argument.",Se[_e.EFBIG]="File is too big.",Se[_e.ENOSPC]="No space left on disk.",Se[_e.EROFS]="Cannot modify a read-only file system.",Se[_e.ENOTEMPTY]="Directory is not empty.",Se[_e.ENOTSUP]="Operation is not supported.";var be,ke=function(t){function e(e,n,r){void 0===n&&(n=Se[e]),void 0===r&&(r=null),t.call(this,n),this.syscall="",this.errno=e,this.code=_e[e],this.path=r,this.stack=(new t).stack,this.message="Error: "+this.code+": "+n+(this.path?", '"+this.path+"'":"")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fromJSON=function(t){var n=new e(0);return n.errno=t.errno,n.code=t.code,n.path=t.path,n.stack=t.stack,n.message=t.message,n},e.fromBuffer=function(t,n){return void 0===n&&(n=0),e.fromJSON(JSON.parse(t.toString("utf8",n+4,n+4+t.readUInt32LE(n))))},e.FileError=function(t,n){return new e(t,Se[t],n)},e.ENOENT=function(t){return this.FileError(_e.ENOENT,t)},e.EEXIST=function(t){return this.FileError(_e.EEXIST,t)},e.EISDIR=function(t){return this.FileError(_e.EISDIR,t)},e.ENOTDIR=function(t){return this.FileError(_e.ENOTDIR,t)},e.EPERM=function(t){return this.FileError(_e.EPERM,t)},e.ENOTEMPTY=function(t){return this.FileError(_e.ENOTEMPTY,t)},e.prototype.toString=function(){return this.message},e.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},e.prototype.writeToBuffer=function(t,e){void 0===t&&(t=new r(this.bufferSize())),void 0===e&&(e=0);var n=t.write(JSON.stringify(this.toJSON()),e+4);return t.writeUInt32LE(n,e),t},e.prototype.bufferSize=function(){return 4+r.byteLength(JSON.stringify(this.toJSON()))},e}(Error);!function(t){t[t.NOP=0]="NOP",t[t.THROW_EXCEPTION=1]="THROW_EXCEPTION",t[t.TRUNCATE_FILE=2]="TRUNCATE_FILE",t[t.CREATE_FILE=3]="CREATE_FILE"}(be||(be={}));var Ie=function Bo(t){if(this.flagStr=t,Bo.validFlagStrs.indexOf(t)<0)throw new ke(_e.EINVAL,"Invalid flag: "+t)};Ie.getFileFlag=function(t){return Ie.flagCache.hasOwnProperty(t)?Ie.flagCache[t]:Ie.flagCache[t]=new Ie(t)},Ie.prototype.getFlagString=function(){return this.flagStr},Ie.prototype.isReadable=function(){return this.flagStr.indexOf("r")!==-1||this.flagStr.indexOf("+")!==-1},Ie.prototype.isWriteable=function(){return this.flagStr.indexOf("w")!==-1||this.flagStr.indexOf("a")!==-1||this.flagStr.indexOf("+")!==-1},Ie.prototype.isTruncating=function(){return this.flagStr.indexOf("w")!==-1},Ie.prototype.isAppendable=function(){return this.flagStr.indexOf("a")!==-1},Ie.prototype.isSynchronous=function(){return this.flagStr.indexOf("s")!==-1},Ie.prototype.isExclusive=function(){return this.flagStr.indexOf("x")!==-1},Ie.prototype.pathExistsAction=function(){return this.isExclusive()?be.THROW_EXCEPTION:this.isTruncating()?be.TRUNCATE_FILE:be.NOP},Ie.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?be.CREATE_FILE:be.THROW_EXCEPTION},Ie.flagCache={},Ie.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"];var Fe;!function(t){t[t.FILE=32768]="FILE",t[t.DIRECTORY=16384]="DIRECTORY",t[t.SYMLINK=40960]="SYMLINK"}(Fe||(Fe={}));var Ne=function(t,e,n,r,i,o){if(void 0===r&&(r=new Date),void 0===i&&(i=new Date),void 0===o&&(o=new Date),this.size=e,this.atime=r,this.mtime=i,this.ctime=o,this.dev=0,this.ino=0,this.rdev=0,this.nlink=1,this.blksize=4096,this.uid=0,this.gid=0,this.birthtime=new Date(0),this.fileData=null,n)this.mode=n;else switch(t){case Fe.FILE:this.mode=420;break;case Fe.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode<4096&&(this.mode|=t)};Ne.fromBuffer=function(t){var e=t.readUInt32LE(0),n=t.readUInt32LE(4),r=t.readDoubleLE(8),i=t.readDoubleLE(16),o=t.readDoubleLE(24);return new Ne(61440&n,e,4095&n,new Date(r),new Date(i),new Date(o))},Ne.prototype.toBuffer=function(){var t=new r(32);return t.writeUInt32LE(this.size,0),t.writeUInt32LE(this.mode,4),t.writeDoubleLE(this.atime.getTime(),8),t.writeDoubleLE(this.mtime.getTime(),16),t.writeDoubleLE(this.ctime.getTime(),24),t},Ne.prototype.clone=function(){return new Ne(61440&this.mode,this.size,4095&this.mode,this.atime,this.mtime,this.ctime)},Ne.prototype.isFile=function(){return(61440&this.mode)===Fe.FILE},Ne.prototype.isDirectory=function(){return(61440&this.mode)===Fe.DIRECTORY},Ne.prototype.isSymbolicLink=function(){return(61440&this.mode)===Fe.SYMLINK},Ne.prototype.chmod=function(t){this.mode=61440&this.mode|t},Ne.prototype.isSocket=function(){return!1},Ne.prototype.isBlockDevice=function(){return!1},Ne.prototype.isCharacterDevice=function(){return!1},Ne.prototype.isFIFO=function(){return!1};var Oe=function(t,e){return t},Te=function(){this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this.root=null,this.fdMap={},this.nextFd=100};Te.prototype.initialize=function(t){if(!t.constructor.isAvailable())throw new ke(_e.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=t},Te.prototype._toUnixTimestamp=function(t){if("number"==typeof t)return t;if(t instanceof Date)return t.getTime()/1e3;throw new Error("Cannot parse time: "+t)},Te.prototype.getRootFS=function(){return this.root?this.root:null},Te.prototype.rename=function(t,e,n){void 0===n&&(n=f);var r=Oe(n,1);try{this.root.rename(c(t),c(e),r)}catch(i){r(i)}},Te.prototype.renameSync=function(t,e){this.root.renameSync(c(t),c(e))},Te.prototype.exists=function(t,e){void 0===e&&(e=f);var n=Oe(e,1);try{return this.root.exists(c(t),n)}catch(r){return n(!1)}},Te.prototype.existsSync=function(t){try{return this.root.existsSync(c(t))}catch(e){return!1}},Te.prototype.stat=function(t,e){void 0===e&&(e=f);var n=Oe(e,2);try{return this.root.stat(c(t),!1,n)}catch(r){return n(r,null)}},Te.prototype.statSync=function(t){return this.root.statSync(c(t),!1)},Te.prototype.lstat=function(t,e){void 0===e&&(e=f);var n=Oe(e,2);try{return this.root.stat(c(t),!0,n)}catch(r){return n(r,null)}},Te.prototype.lstatSync=function(t){return this.root.statSync(c(t),!0)},Te.prototype.truncate=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=f);var r=0;"function"==typeof e?n=e:"number"==typeof e&&(r=e);var i=Oe(n,1);try{if(r<0)throw new ke(_e.EINVAL);return this.root.truncate(c(t),r,i)}catch(o){return i(o)}},Te.prototype.truncateSync=function(t,e){if(void 0===e&&(e=0),e<0)throw new ke(_e.EINVAL);return this.root.truncateSync(c(t),e)},Te.prototype.unlink=function(t,e){void 0===e&&(e=f);var n=Oe(e,1);try{return this.root.unlink(c(t),n)}catch(r){return n(r)}},Te.prototype.unlinkSync=function(t){return this.root.unlinkSync(c(t))},Te.prototype.open=function(t,e,n,r){var i=this;void 0===r&&(r=f);var o=s(n,420);r="function"==typeof n?n:r;var a=Oe(r,2);try{this.root.open(c(t),Ie.getFileFlag(e),o,function(t,e){e?a(t,i.getFdForFile(e)):a(t)})}catch(u){a(u,null)}},Te.prototype.openSync=function(t,e,n){return void 0===n&&(n=420),this.getFdForFile(this.root.openSync(c(t),Ie.getFileFlag(e),s(n,420)))},Te.prototype.readFile=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n=f);var r=u(e,null,"r",null);n="function"==typeof e?e:n;var i=Oe(n,2);try{var o=Ie.getFileFlag(r.flag);return o.isReadable()?this.root.readFile(c(t),r.encoding,o,i):i(new ke(_e.EINVAL,"Flag passed to readFile must allow for reading."))}catch(s){return i(s,null)}},Te.prototype.readFileSync=function(t,e){void 0===e&&(e={});var n=u(e,null,"r",null),r=Ie.getFileFlag(n.flag);if(!r.isReadable())throw new ke(_e.EINVAL,"Flag passed to readFile must allow for reading.");return this.root.readFileSync(c(t),n.encoding,r)},Te.prototype.writeFile=function(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=f);var i=u(n,"utf8","w",420);r="function"==typeof n?n:r;var o=Oe(r,1);try{var s=Ie.getFileFlag(i.flag);return s.isWriteable()?this.root.writeFile(c(t),e,i.encoding,s,i.mode,o):o(new ke(_e.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(a){return o(a)}},Te.prototype.writeFileSync=function(t,e,n){var r=u(n,"utf8","w",420),i=Ie.getFileFlag(r.flag);if(!i.isWriteable())throw new ke(_e.EINVAL,"Flag passed to writeFile must allow for writing.");return this.root.writeFileSync(c(t),e,r.encoding,i,r.mode)},Te.prototype.appendFile=function(t,e,n,r){void 0===r&&(r=f);var i=u(n,"utf8","a",420);r="function"==typeof n?n:r;var o=Oe(r,1);try{var s=Ie.getFileFlag(i.flag);if(!s.isAppendable())return o(new ke(_e.EINVAL,"Flag passed to appendFile must allow for appending."));this.root.appendFile(c(t),e,i.encoding,s,i.mode,o)}catch(a){o(a)}},Te.prototype.appendFileSync=function(t,e,n){var r=u(n,"utf8","a",420),i=Ie.getFileFlag(r.flag);if(!i.isAppendable())throw new ke(_e.EINVAL,"Flag passed to appendFile must allow for appending.");return this.root.appendFileSync(c(t),e,r.encoding,i,r.mode)},Te.prototype.fstat=function(t,e){void 0===e&&(e=f);var n=Oe(e,2);try{var r=this.fd2file(t);r.stat(n)}catch(i){n(i)}},Te.prototype.fstatSync=function(t){return this.fd2file(t).statSync()},Te.prototype.close=function(t,e){var n=this;void 0===e&&(e=f);var r=Oe(e,1);try{this.fd2file(t).close(function(e){e||n.closeFd(t),r(e)})}catch(i){r(i)}},Te.prototype.closeSync=function(t){this.fd2file(t).closeSync(),this.closeFd(t)},Te.prototype.ftruncate=function(t,e,n){void 0===n&&(n=f);var r="number"==typeof e?e:0;n="function"==typeof e?e:n;var i=Oe(n,1);try{var o=this.fd2file(t);if(r<0)throw new ke(_e.EINVAL);o.truncate(r,i)}catch(s){i(s)}},Te.prototype.ftruncateSync=function(t,e){void 0===e&&(e=0);var n=this.fd2file(t);if(e<0)throw new ke(_e.EINVAL);n.truncateSync(e)},Te.prototype.fsync=function(t,e){void 0===e&&(e=f);var n=Oe(e,1);try{this.fd2file(t).sync(n)}catch(r){n(r)}},Te.prototype.fsyncSync=function(t){this.fd2file(t).syncSync()},Te.prototype.fdatasync=function(t,e){void 0===e&&(e=f);var n=Oe(e,1);try{this.fd2file(t).datasync(n)}catch(r){n(r)}},Te.prototype.fdatasyncSync=function(t){this.fd2file(t).datasyncSync()},Te.prototype.write=function(t,e,n,i,o,s){void 0===s&&(s=f);var a,c,u,h=null;if("string"==typeof e){var p="utf8";switch(typeof n){case"function":s=n;break;case"number":h=n,p="string"==typeof i?i:"utf8",s="function"==typeof o?o:s;break;default:return(s="function"==typeof i?i:"function"==typeof o?o:s)(new ke(_e.EINVAL,"Invalid arguments."))}a=new r(e,p),c=0,u=a.length}else a=e,c=n,u=i,h="number"==typeof o?o:null,s="function"==typeof o?o:s;var l=Oe(s,3);try{var d=this.fd2file(t);void 0!==h&&null!==h||(h=d.getPos()),d.write(a,c,u,h,l)}catch(y){l(y)}},Te.prototype.writeSync=function(t,e,n,i,o){var s,a,c,u=0;if("string"==typeof e){c="number"==typeof n?n:null;var f="string"==typeof i?i:"utf8";u=0,s=new r(e,f),a=s.length}else s=e,u=n,a=i,c="number"==typeof o?o:null;var h=this.fd2file(t);return void 0!==c&&null!==c||(c=h.getPos()),h.writeSync(s,u,a,c)},Te.prototype.read=function(t,e,n,i,o,s){void 0===s&&(s=f);var a,c,u,h,p;if("number"==typeof e){u=e,a=n;var l=i;s="function"==typeof o?o:s,c=0,h=new r(u),p=Oe(function(t,e,n){return t?s(t):void s(t,n.toString(l),e)},3)}else h=e,c=n,u=i,a=o,p=Oe(s,3);try{var d=this.fd2file(t);void 0!==a&&null!==a||(a=d.getPos()),d.read(h,c,u,a,p)}catch(y){p(y)}},Te.prototype.readSync=function(t,e,n,i,o){var s,a,c,u,f,h=!1;"number"==typeof e?(c=e,u=n,f=i,a=0,s=new r(c),h=!0):(s=e,a=n,c=i,u=o);var p=this.fd2file(t);void 0!==u&&null!==u||(u=p.getPos());var l=p.readSync(s,a,c,u);return h?[s.toString(f),l]:l},Te.prototype.fchown=function(t,e,n,r){void 0===r&&(r=f);var i=Oe(r,1);try{this.fd2file(t).chown(e,n,i)}catch(o){i(o)}},Te.prototype.fchownSync=function(t,e,n){this.fd2file(t).chownSync(e,n)},Te.prototype.fchmod=function(t,e,n){var r=Oe(n,1);try{var i="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmod(i,r)}catch(o){r(o)}},Te.prototype.fchmodSync=function(t,e){var n="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmodSync(n)},Te.prototype.futimes=function(t,e,n,r){void 0===r&&(r=f);var i=Oe(r,1);try{var o=this.fd2file(t);"number"==typeof e&&(e=new Date(1e3*e)),"number"==typeof n&&(n=new Date(1e3*n)),o.utimes(e,n,i)}catch(s){i(s)}},Te.prototype.futimesSync=function(t,e,n){this.fd2file(t).utimesSync(a(e),a(n))},Te.prototype.rmdir=function(t,e){void 0===e&&(e=f);var n=Oe(e,1);try{t=c(t),this.root.rmdir(t,n)}catch(r){n(r)}},Te.prototype.rmdirSync=function(t){return t=c(t),this.root.rmdirSync(t)},Te.prototype.mkdir=function(t,e,n){void 0===n&&(n=f),"function"==typeof e&&(n=e,e=511);var r=Oe(n,1);try{t=c(t),this.root.mkdir(t,e,r)}catch(i){r(i)}},Te.prototype.mkdirSync=function(t,e){this.root.mkdirSync(c(t),s(e,511))},Te.prototype.readdir=function(t,e){void 0===e&&(e=f);var n=Oe(e,2);try{t=c(t),this.root.readdir(t,n)}catch(r){n(r)}},Te.prototype.readdirSync=function(t){return t=c(t),this.root.readdirSync(t)},Te.prototype.link=function(t,e,n){void 0===n&&(n=f);var r=Oe(n,1);try{t=c(t),e=c(e),this.root.link(t,e,r)}catch(i){r(i)}},Te.prototype.linkSync=function(t,e){return t=c(t),e=c(e),this.root.linkSync(t,e)},Te.prototype.symlink=function(t,e,n,r){void 0===r&&(r=f);var i="string"==typeof n?n:"file";r="function"==typeof n?n:r;var o=Oe(r,1);try{if("file"!==i&&"dir"!==i)return o(new ke(_e.EINVAL,"Invalid type: "+i));t=c(t),e=c(e),this.root.symlink(t,e,i,o)}catch(s){o(s)}},Te.prototype.symlinkSync=function(t,e,n){if(n){if("file"!==n&&"dir"!==n)throw new ke(_e.EINVAL,"Invalid type: "+n)}else n="file";return t=c(t),e=c(e),this.root.symlinkSync(t,e,n)},Te.prototype.readlink=function(t,e){void 0===e&&(e=f);var n=Oe(e,2);try{t=c(t),this.root.readlink(t,n)}catch(r){n(r)}},Te.prototype.readlinkSync=function(t){return t=c(t),this.root.readlinkSync(t)},Te.prototype.chown=function(t,e,n,r){void 0===r&&(r=f);var i=Oe(r,1);try{t=c(t),this.root.chown(t,!1,e,n,i)}catch(o){i(o)}},Te.prototype.chownSync=function(t,e,n){t=c(t),this.root.chownSync(t,!1,e,n)},Te.prototype.lchown=function(t,e,n,r){void 0===r&&(r=f);var i=Oe(r,1);try{t=c(t),this.root.chown(t,!0,e,n,i)}catch(o){i(o)}},Te.prototype.lchownSync=function(t,e,n){t=c(t),this.root.chownSync(t,!0,e,n)},Te.prototype.chmod=function(t,e,n){void 0===n&&(n=f);var r=Oe(n,1);try{var i=s(e,-1);if(i<0)throw new ke(_e.EINVAL,"Invalid mode.");this.root.chmod(c(t),!1,i,r)}catch(o){r(o)}},Te.prototype.chmodSync=function(t,e){var n=s(e,-1);if(n<0)throw new ke(_e.EINVAL,"Invalid mode.");t=c(t),this.root.chmodSync(t,!1,n)},Te.prototype.lchmod=function(t,e,n){void 0===n&&(n=f);var r=Oe(n,1);try{var i=s(e,-1);if(i<0)throw new ke(_e.EINVAL,"Invalid mode.");this.root.chmod(c(t),!0,i,r)}catch(o){r(o)}},Te.prototype.lchmodSync=function(t,e){var n=s(e,-1);if(n<1)throw new ke(_e.EINVAL,"Invalid mode.");this.root.chmodSync(c(t),!0,n)},Te.prototype.utimes=function(t,e,n,r){void 0===r&&(r=f);var i=Oe(r,1);try{this.root.utimes(c(t),a(e),a(n),i)}catch(o){i(o)}},Te.prototype.utimesSync=function(t,e,n){this.root.utimesSync(c(t),a(e),a(n))},Te.prototype.realpath=function(t,e,n){void 0===n&&(n=f);var r="object"==typeof e?e:{};n="function"==typeof e?e:f;var i=Oe(n,2);try{t=c(t),this.root.realpath(t,r,i)}catch(o){i(o)}},Te.prototype.realpathSync=function(t,e){return void 0===e&&(e={}),t=c(t),this.root.realpathSync(t,e)},Te.prototype.watchFile=function(t,e,n){throw void 0===n&&(n=f),new ke(_e.ENOTSUP)},Te.prototype.unwatchFile=function(t,e){throw void 0===e&&(e=f),new ke(_e.ENOTSUP)},Te.prototype.watch=function(t,e,n){throw void 0===n&&(n=f),new ke(_e.ENOTSUP)},Te.prototype.access=function(t,e,n){throw void 0===n&&(n=f),new ke(_e.ENOTSUP)},Te.prototype.accessSync=function(t,e){throw new ke(_e.ENOTSUP)},Te.prototype.createReadStream=function(t,e){throw new ke(_e.ENOTSUP)},Te.prototype.createWriteStream=function(t,e){throw new ke(_e.ENOTSUP)},Te.prototype.wrapCallbacks=function(t){Oe=t},Te.prototype.getFdForFile=function(t){var e=this.nextFd++;return this.fdMap[e]=t,e},Te.prototype.fd2file=function(t){var e=this.fdMap[t];if(e)return e;throw new ke(_e.EBADF,"Invalid file descriptor.")},Te.prototype.closeFd=function(t){delete this.fdMap[t]},Te.Stats=Ne;var Le=new Te,Re={},xe=Te.prototype;Object.keys(xe).forEach(function(t){"function"==typeof Le[t]?Re[t]=function(){return Le[t].apply(Le,arguments)}:Re[t]=Le[t]}),Re.changeFSModule=function(t){Le=t},Re.getFSModule=function(){return Le},Re.FS=Te;var Ae="undefined"!=typeof navigator&&!(!/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())&&navigator.userAgent.indexOf("Trident")===-1),De="undefined"==typeof window,Pe=Object.freeze({isIE:Ae,isWebWorker:De,mkdirpSync:h,buffer2ArrayBuffer:p,buffer2Uint8array:l,arrayish2Buffer:d,uint8Array2Buffer:y,arrayBuffer2Buffer:g,copyingSlice:v}),Ce=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};Ce.prototype.open=function(t){var e=this.fs.realPath(t.node),n=this.FS;try{n.isFile(t.node.mode)&&(t.nfd=this.nodefs.openSync(e,this.fs.flagsToPermissionString(t.flags)))}catch(r){if(!r.code)throw r;throw new n.ErrnoError(this.ERRNO_CODES[r.code])}},Ce.prototype.close=function(t){var e=this.FS;try{e.isFile(t.node.mode)&&t.nfd&&this.nodefs.closeSync(t.nfd)}catch(n){if(!n.code)throw n;throw new e.ErrnoError(this.ERRNO_CODES[n.code])}},Ce.prototype.read=function(t,e,n,r,i){try{return this.nodefs.readSync(t.nfd,y(e),n,r,i);}catch(o){throw new this.FS.ErrnoError(this.ERRNO_CODES[o.code])}},Ce.prototype.write=function(t,e,n,r,i){try{return this.nodefs.writeSync(t.nfd,y(e),n,r,i)}catch(o){throw new this.FS.ErrnoError(this.ERRNO_CODES[o.code])}},Ce.prototype.llseek=function(t,e,n){var r=e;if(1===n)r+=t.position;else if(2===n&&this.FS.isFile(t.node.mode))try{var i=this.nodefs.fstatSync(t.nfd);r+=i.size}catch(o){throw new this.FS.ErrnoError(this.ERRNO_CODES[o.code])}if(r<0)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return t.position=r,r};var Me=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};Me.prototype.getattr=function(t){var e,n=this.fs.realPath(t);try{e=this.nodefs.lstatSync(n)}catch(r){if(!r.code)throw r;throw new this.FS.ErrnoError(this.ERRNO_CODES[r.code])}return{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},Me.prototype.setattr=function(t,e){var n=this.fs.realPath(t);try{if(void 0!==e.mode&&(this.nodefs.chmodSync(n,e.mode),t.mode=e.mode),void 0!==e.timestamp){var r=new Date(e.timestamp);this.nodefs.utimesSync(n,r,r)}}catch(i){if(!i.code)throw i;if("ENOTSUP"!==i.code)throw new this.FS.ErrnoError(this.ERRNO_CODES[i.code])}if(void 0!==e.size)try{this.nodefs.truncateSync(n,e.size)}catch(i){if(!i.code)throw i;throw new this.FS.ErrnoError(this.ERRNO_CODES[i.code])}},Me.prototype.lookup=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e),r=this.fs.getMode(n);return this.fs.createNode(t,e,r)},Me.prototype.mknod=function(t,e,n,r){var i=this.fs.createNode(t,e,n,r),o=this.fs.realPath(i);try{this.FS.isDir(i.mode)?this.nodefs.mkdirSync(o,i.mode):this.nodefs.writeFileSync(o,"",{mode:i.mode})}catch(s){if(!s.code)throw s;throw new this.FS.ErrnoError(this.ERRNO_CODES[s.code])}return i},Me.prototype.rename=function(t,e,n){var r=this.fs.realPath(t),i=this.PATH.join2(this.fs.realPath(e),n);try{this.nodefs.renameSync(r,i)}catch(o){if(!o.code)throw o;throw new this.FS.ErrnoError(this.ERRNO_CODES[o.code])}},Me.prototype.unlink=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.unlinkSync(n)}catch(r){if(!r.code)throw r;throw new this.FS.ErrnoError(this.ERRNO_CODES[r.code])}},Me.prototype.rmdir=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.rmdirSync(n)}catch(r){if(!r.code)throw r;throw new this.FS.ErrnoError(this.ERRNO_CODES[r.code])}},Me.prototype.readdir=function(t){var e=this.fs.realPath(t);try{return this.nodefs.readdirSync(e)}catch(n){if(!n.code)throw n;throw new this.FS.ErrnoError(this.ERRNO_CODES[n.code])}},Me.prototype.symlink=function(t,e,n){var r=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.symlinkSync(n,r)}catch(i){if(!i.code)throw i;throw new this.FS.ErrnoError(this.ERRNO_CODES[i.code])}},Me.prototype.readlink=function(t){var e=this.fs.realPath(t);try{return this.nodefs.readlinkSync(e)}catch(n){if(!n.code)throw n;throw new this.FS.ErrnoError(this.ERRNO_CODES[n.code])}};var Ue=function(t,e,n,r){void 0===t&&(t=self.FS),void 0===e&&(e=self.PATH),void 0===n&&(n=self.ERRNO_CODES),void 0===r&&(r=Re),this.flagsToPermissionStringMap={0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},this.nodefs=r,this.FS=t,this.PATH=e,this.ERRNO_CODES=n,this.node_ops=new Me(this),this.stream_ops=new Ce(this)};Ue.prototype.mount=function(t){return this.createNode(null,"/",this.getMode(t.opts.root),0)},Ue.prototype.createNode=function(t,e,n,r){var i=this.FS;if(!i.isDir(n)&&!i.isFile(n)&&!i.isLink(n))throw new i.ErrnoError(this.ERRNO_CODES.EINVAL);var o=i.createNode(t,e,n);return o.node_ops=this.node_ops,o.stream_ops=this.stream_ops,o},Ue.prototype.getMode=function(t){var e;try{e=this.nodefs.lstatSync(t)}catch(n){if(!n.code)throw n;throw new this.FS.ErrnoError(this.ERRNO_CODES[n.code])}return e.mode},Ue.prototype.realPath=function(t){for(var e=[];t.parent!==t;)e.push(t.name),t=t.parent;return e.push(t.mount.opts.root),e.reverse(),this.PATH.join.apply(null,e)},Ue.prototype.flagsToPermissionString=function(t){var e="string"==typeof t?parseInt(t,10):t;return e&=8191,e in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[e]:t},Ue.prototype.getNodeFS=function(){return this.nodefs},Ue.prototype.getFS=function(){return this.FS},Ue.prototype.getPATH=function(){return this.PATH},Ue.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES};var Be=function(){};Be.prototype.supportsLinks=function(){return!1},Be.prototype.diskSpace=function(t,e){e(0,0)},Be.prototype.openFile=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.createFile=function(t,e,n,r){throw new ke(_e.ENOTSUP)},Be.prototype.open=function(t,e,n,r){var i=this,o=function(o,s){if(o)switch(e.pathNotExistsAction()){case be.CREATE_FILE:return i.stat(me.dirname(t),!1,function(o,s){o?r(o):s.isDirectory()?i.createFile(t,e,n,r):r(ke.ENOTDIR(me.dirname(t)))});case be.THROW_EXCEPTION:return r(ke.ENOENT(t));default:return r(new ke(_e.EINVAL,"Invalid FileFlag object."))}else{if(s.isDirectory())return r(ke.EISDIR(t));switch(e.pathExistsAction()){case be.THROW_EXCEPTION:return r(ke.EEXIST(t));case be.TRUNCATE_FILE:return i.openFile(t,e,function(t,e){t?r(t):e.truncate(0,function(){e.sync(function(){r(null,e)})})});case be.NOP:return i.openFile(t,e,r);default:return r(new ke(_e.EINVAL,"Invalid FileFlag object."))}}};this.stat(t,!1,o)},Be.prototype.rename=function(t,e,n){n(new ke(_e.ENOTSUP))},Be.prototype.renameSync=function(t,e){throw new ke(_e.ENOTSUP)},Be.prototype.stat=function(t,e,n){n(new ke(_e.ENOTSUP))},Be.prototype.statSync=function(t,e){throw new ke(_e.ENOTSUP)},Be.prototype.openFileSync=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.createFileSync=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.openSync=function(t,e,n){var r;try{r=this.statSync(t,!1)}catch(i){switch(e.pathNotExistsAction()){case be.CREATE_FILE:var o=this.statSync(me.dirname(t),!1);if(!o.isDirectory())throw ke.ENOTDIR(me.dirname(t));return this.createFileSync(t,e,n);case be.THROW_EXCEPTION:throw ke.ENOENT(t);default:throw new ke(_e.EINVAL,"Invalid FileFlag object.")}}if(r.isDirectory())throw ke.EISDIR(t);switch(e.pathExistsAction()){case be.THROW_EXCEPTION:throw ke.EEXIST(t);case be.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,e,r.mode);case be.NOP:return this.openFileSync(t,e,n);default:throw new ke(_e.EINVAL,"Invalid FileFlag object.")}},Be.prototype.unlink=function(t,e){e(new ke(_e.ENOTSUP))},Be.prototype.unlinkSync=function(t){throw new ke(_e.ENOTSUP)},Be.prototype.rmdir=function(t,e){e(new ke(_e.ENOTSUP))},Be.prototype.rmdirSync=function(t){throw new ke(_e.ENOTSUP)},Be.prototype.mkdir=function(t,e,n){n(new ke(_e.ENOTSUP))},Be.prototype.mkdirSync=function(t,e){throw new ke(_e.ENOTSUP)},Be.prototype.readdir=function(t,e){e(new ke(_e.ENOTSUP))},Be.prototype.readdirSync=function(t){throw new ke(_e.ENOTSUP)},Be.prototype.exists=function(t,e){this.stat(t,null,function(t){e(!t)})},Be.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch(e){return!1}},Be.prototype.realpath=function(t,e,n){if(this.supportsLinks())for(var r=t.split(me.sep),i=0;i<r.length;i++){var o=r.slice(0,i+1);r[i]=me.join.apply(null,o)}else this.exists(t,function(e){e?n(null,t):n(ke.ENOENT(t))})},Be.prototype.realpathSync=function(t,e){if(this.supportsLinks()){for(var n=t.split(me.sep),r=0;r<n.length;r++){var i=n.slice(0,r+1);n[r]=me.join.apply(me,i)}return n.join(me.sep)}if(this.existsSync(t))return t;throw ke.ENOENT(t)},Be.prototype.truncate=function(t,e,n){this.open(t,Ie.getFileFlag("r+"),420,function(t,r){return t?n(t):void r.truncate(e,function(t){r.close(function(e){n(t||e)})})})},Be.prototype.truncateSync=function(t,e){var n=this.openSync(t,Ie.getFileFlag("r+"),420);try{n.truncateSync(e)}catch(r){throw r}finally{n.closeSync()}},Be.prototype.readFile=function(t,e,n,i){var o=i;this.open(t,n,420,function(t,n){return t?i(t):(i=function(t,e){n.close(function(n){return t||(t=n),o(t,e)})},void n.stat(function(t,o){if(t)return i(t);var s=new r(o.size);n.read(s,0,o.size,0,function(t){if(t)return i(t);if(null===e)return i(t,s);try{i(null,s.toString(e))}catch(n){i(n)}})}))})},Be.prototype.readFileSync=function(t,e,n){var i=this.openSync(t,n,420);try{var o=i.statSync(),s=new r(o.size);return i.readSync(s,0,o.size,0),i.closeSync(),null===e?s:s.toString(e)}finally{i.closeSync()}},Be.prototype.writeFile=function(t,e,n,i,o,s){var a=s;this.open(t,i,420,function(t,i){if(t)return s(t);s=function(t){i.close(function(e){a(t?t:e)})};try{"string"==typeof e&&(e=new r(e,n))}catch(o){return s(o)}i.write(e,0,e.length,0,s)})},Be.prototype.writeFileSync=function(t,e,n,i,o){var s=this.openSync(t,i,o);try{"string"==typeof e&&(e=new r(e,n)),s.writeSync(e,0,e.length,0)}finally{s.closeSync()}},Be.prototype.appendFile=function(t,e,n,i,o,s){var a=s;this.open(t,i,o,function(t,i){return t?s(t):(s=function(t){i.close(function(e){a(t?t:e)})},"string"==typeof e&&(e=new r(e,n)),void i.write(e,0,e.length,null,s))})},Be.prototype.appendFileSync=function(t,e,n,i,o){var s=this.openSync(t,i,o);try{"string"==typeof e&&(e=new r(e,n)),s.writeSync(e,0,e.length,null)}finally{s.closeSync()}},Be.prototype.chmod=function(t,e,n,r){r(new ke(_e.ENOTSUP))},Be.prototype.chmodSync=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.chown=function(t,e,n,r,i){i(new ke(_e.ENOTSUP))},Be.prototype.chownSync=function(t,e,n,r){throw new ke(_e.ENOTSUP)},Be.prototype.utimes=function(t,e,n,r){r(new ke(_e.ENOTSUP))},Be.prototype.utimesSync=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.link=function(t,e,n){n(new ke(_e.ENOTSUP))},Be.prototype.linkSync=function(t,e){throw new ke(_e.ENOTSUP)},Be.prototype.symlink=function(t,e,n,r){r(new ke(_e.ENOTSUP))},Be.prototype.symlinkSync=function(t,e,n){throw new ke(_e.ENOTSUP)},Be.prototype.readlink=function(t,e){e(new ke(_e.ENOTSUP))},Be.prototype.readlinkSync=function(t){throw new ke(_e.ENOTSUP)};var je=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.supportsSynch=function(){return!0},e.prototype.rename=function(t,e,n){try{this.renameSync(t,e),n()}catch(r){n(r)}},e.prototype.stat=function(t,e,n){try{n(null,this.statSync(t,e))}catch(r){n(r)}},e.prototype.open=function(t,e,n,r){try{r(null,this.openSync(t,e,n))}catch(i){r(i)}},e.prototype.unlink=function(t,e){try{this.unlinkSync(t),e()}catch(n){e(n)}},e.prototype.rmdir=function(t,e){try{this.rmdirSync(t),e()}catch(n){e(n)}},e.prototype.mkdir=function(t,e,n){try{this.mkdirSync(t,e),n()}catch(r){n(r)}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(n){e(n)}},e.prototype.chmod=function(t,e,n,r){try{this.chmodSync(t,e,n),r()}catch(i){r(i)}},e.prototype.chown=function(t,e,n,r,i){try{this.chownSync(t,e,n,r),i()}catch(o){i(o)}},e.prototype.utimes=function(t,e,n,r){try{this.utimesSync(t,e,n),r()}catch(i){r(i)}},e.prototype.link=function(t,e,n){try{this.linkSync(t,e),n()}catch(r){n(r)}},e.prototype.symlink=function(t,e,n,r){try{this.symlinkSync(t,e,n),r()}catch(i){r(i)}},e.prototype.readlink=function(t,e){try{e(null,this.readlinkSync(t))}catch(n){e(n)}},e}(Be),ze=function(){};ze.prototype.sync=function(t){t(new ke(_e.ENOTSUP))},ze.prototype.syncSync=function(){throw new ke(_e.ENOTSUP)},ze.prototype.datasync=function(t){this.sync(t)},ze.prototype.datasyncSync=function(){return this.syncSync()},ze.prototype.chown=function(t,e,n){n(new ke(_e.ENOTSUP))},ze.prototype.chownSync=function(t,e){throw new ke(_e.ENOTSUP)},ze.prototype.chmod=function(t,e){e(new ke(_e.ENOTSUP))},ze.prototype.chmodSync=function(t){throw new ke(_e.ENOTSUP)},ze.prototype.utimes=function(t,e,n){n(new ke(_e.ENOTSUP))},ze.prototype.utimesSync=function(t,e){throw new ke(_e.ENOTSUP)};var Ve=function(t){function e(e,n,i,o,s){if(t.call(this),this._pos=0,this._dirty=!1,this._fs=e,this._path=n,this._flag=i,this._stat=o,s?this._buffer=s:this._buffer=new r(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStats=function(){return this._stat},e.prototype.getFlag=function(){return this._flag},e.prototype.getPath=function(){return this._path},e.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},e.prototype.advancePos=function(t){return this._pos+=t},e.prototype.setPos=function(t){return this._pos=t},e.prototype.sync=function(t){try{this.syncSync(),t()}catch(e){t(e)}},e.prototype.syncSync=function(){throw new ke(_e.ENOTSUP)},e.prototype.close=function(t){try{this.closeSync(),t()}catch(e){t(e)}},e.prototype.closeSync=function(){throw new ke(_e.ENOTSUP)},e.prototype.stat=function(t){try{t(null,this._stat.clone())}catch(e){t(e)}},e.prototype.statSync=function(){return this._stat.clone()},e.prototype.truncate=function(t,e){try{this.truncateSync(t),this._flag.isSynchronous()&&!Re.getRootFS().supportsSynch()&&this.sync(e),e()}catch(n){return e(n)}},e.prototype.truncateSync=function(t){if(this._dirty=!0,!this._flag.isWriteable())throw new ke(_e.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,t>this._buffer.length){var e=new r(t-this._buffer.length);return e.fill(0),this.writeSync(e,0,e.length,this._buffer.length),void(this._flag.isSynchronous()&&Re.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=t;var n=new r(t);this._buffer.copy(n,0,0,t),this._buffer=n,this._flag.isSynchronous()&&Re.getRootFS().supportsSynch()&&this.syncSync()},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(o){i(o)}},e.prototype.writeSync=function(t,e,n,i){if(this._dirty=!0,void 0!==i&&null!==i||(i=this.getPos()),!this._flag.isWriteable())throw new ke(_e.EPERM,"File not opened with a writeable mode.");var o=i+n;if(o>this._stat.size&&(this._stat.size=o,o>this._buffer.length)){var s=new r(o);this._buffer.copy(s),this._buffer=s}var a=t.copy(this._buffer,i,e,e+n);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),a):(this.setPos(i+a),a)},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(o){i(o)}},e.prototype.readSync=function(t,e,n,r){if(!this._flag.isReadable())throw new ke(_e.EPERM,"File not opened with a readable mode.");void 0!==r&&null!==r||(r=this.getPos());var i=r+n;i>this._stat.size&&(n=this._stat.size-r);var o=this._buffer.copy(t,e,r,r+n);return this._stat.atime=new Date,this._pos=r+n,o},e.prototype.chmod=function(t,e){try{this.chmodSync(t),e()}catch(n){e(n)}},e.prototype.chmodSync=function(t){if(!this._fs.supportsProps())throw new ke(_e.ENOTSUP);this._dirty=!0,this._stat.chmod(t),this.syncSync()},e.prototype.isDirty=function(){return this._dirty},e.prototype.resetDirty=function(){this._dirty=!1},e}(ze),We=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.close=function(t){t()},e.prototype.closeSync=function(){},e}(Ve),He=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(Ve),Ze=function(t){function e(e,n){if(t.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=e,this._async=n,!e.supportsSynch())throw new Error("The first argument to AsyncMirror needs to be a synchronous file system.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getName=function(){return"AsyncMirror"},e.prototype._syncSync=function(t){this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,Ie.getFileFlag("w"),t.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),t.getStats().mode]})},e.prototype.initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};if(this._isInitialized)t();else if(1===n.push(t)){var i=function(t,n,r){"/"!==t&&e._sync.mkdirSync(t,n),e._async.readdir(t,function(e,n){function i(e){e?r(e):o<n.length?(s(me.join(t,n[o]),i),o++):r()}var o=0;e?r(e):i()})},o=function(t,n,r){e._async.readFile(t,null,Ie.getFileFlag("r"),function(i,o){if(i)r(i);else try{e._sync.writeFileSync(t,o,null,Ie.getFileFlag("w"),n)}catch(s){i=s}finally{r(i)}})},s=function(t,n){e._async.stat(t,!1,function(e,r){e?n(e):r.isDirectory()?i(t,r.mode,n):o(t,r.mode,n)})};i("/",0,r)}},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._sync.supportsProps()&&this._async.supportsProps()},e.prototype.renameSync=function(t,e){this.checkInitialized(),this._sync.renameSync(t,e),this.enqueueOp({apiMethod:"rename",arguments:[t,e]})},e.prototype.statSync=function(t,e){return this.checkInitialized(),this._sync.statSync(t,e)},e.prototype.openSync=function(t,e,n){this.checkInitialized();var r=this._sync.openSync(t,e,n);return r.closeSync(),new He(this,t,e,this._sync.statSync(t,!1),this._sync.readFileSync(t,null,Ie.getFileFlag("r")))},e.prototype.unlinkSync=function(t){this.checkInitialized(),this._sync.unlinkSync(t),this.enqueueOp({apiMethod:"unlink",arguments:[t]})},e.prototype.rmdirSync=function(t){this.checkInitialized(),this._sync.rmdirSync(t),this.enqueueOp({apiMethod:"rmdir",arguments:[t]})},e.prototype.mkdirSync=function(t,e){this.checkInitialized(),this._sync.mkdirSync(t,e),this.enqueueOp({apiMethod:"mkdir",arguments:[t,e]})},e.prototype.readdirSync=function(t){return this.checkInitialized(),this._sync.readdirSync(t)},e.prototype.existsSync=function(t){return this.checkInitialized(),this._sync.existsSync(t)},e.prototype.chmodSync=function(t,e,n){this.checkInitialized(),this._sync.chmodSync(t,e,n),this.enqueueOp({apiMethod:"chmod",arguments:[t,e,n]})},e.prototype.chownSync=function(t,e,n,r){this.checkInitialized(),this._sync.chownSync(t,e,n,r),this.enqueueOp({apiMethod:"chown",arguments:[t,e,n,r]})},e.prototype.utimesSync=function(t,e,n){this.checkInitialized(),this._sync.utimesSync(t,e,n),this.enqueueOp({apiMethod:"utimes",arguments:[t,e,n]})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new ke(_e.EPERM,"AsyncMirrorFS is not initialized. Please initialize AsyncMirrorFS using its initialize() method before using it.")},e.prototype.enqueueOp=function(t){var e=this;if(this._queue.push(t),!this._queueRunning){this._queueRunning=!0;var n=function(t){if(t&&console.error("WARNING: File system has desynchronized. Received following error: "+t+"\n$"),e._queue.length>0){var r=e._queue.shift(),i=r.arguments;i.push(n),e._async[r.apiMethod].apply(e._async,i)}else e._queueRunning=!1};n()}},e}(je),qe=Math.max,Ye="[object Function]",Xe="[object GeneratorFunction]",Ke="[object Proxy]",Je=Object.prototype,Ge=Je.toString,Qe="object"==typeof t&&t&&t.Object===Object&&t,$e="object"==typeof self&&self&&self.Object===Object&&self,tn=Qe||$e||Function("return this")(),en=tn["__core-js_shared__"],nn=function(){var t=/[^.]+$/.exec(en&&en.keys&&en.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),rn=Function.prototype,on=rn.toString,sn=/[\\^$.*+?()[\]{}|]/g,an=/^\[object .+?Constructor\]$/,cn=Function.prototype,un=Object.prototype,fn=cn.toString,hn=un.hasOwnProperty,pn=RegExp("^"+fn.call(hn).replace(sn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ln=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),dn=ln?function(t,e){return ln(t,"toString",{configurable:!0,enumerable:!1,value:E(e),writable:!0})}:w,yn=500,gn=16,vn=Date.now,wn=T(dn),mn="[object Symbol]",_n=Object.prototype,En=_n.toString,Sn=NaN,bn=/^\s+|\s+$/g,kn=/^[-+]0x[0-9a-f]+$/i,In=/^0b[01]+$/i,Fn=/^0o[0-7]+$/i,Nn=parseInt,On=1/0,Tn=1.7976931348623157e308,Ln="Expected a function",Rn=function(t){return C(function(e){var n=e.pop();t.call(this,e,n)})},xn=9007199254740991,An="function"==typeof Symbol&&Symbol.iterator,Dn=function(t){return An&&t[An]&&t[An]()},Pn="[object Arguments]",Cn=Object.prototype,Mn=Cn.toString,Un=Object.prototype,Bn=Un.hasOwnProperty,jn=Un.propertyIsEnumerable,zn=W(function(){return arguments}())?W:function(t){return R(t)&&Bn.call(t,"callee")&&!jn.call(t,"callee")},Vn=Array.isArray,Wn="object"==typeof e&&e&&!e.nodeType&&e,Hn=Wn&&"object"==typeof i&&i&&!i.nodeType&&i,Zn=Hn&&Hn.exports===Wn,qn=Zn?tn.Buffer:void 0,Yn=qn?qn.isBuffer:void 0,Xn=Yn||H,Kn=9007199254740991,Jn=/^(?:0|[1-9]\d*)$/,Gn="[object Arguments]",Qn="[object Array]",$n="[object Boolean]",tr="[object Date]",er="[object Error]",nr="[object Function]",rr="[object Map]",ir="[object Number]",or="[object Object]",sr="[object RegExp]",ar="[object Set]",cr="[object String]",ur="[object WeakMap]",fr="[object ArrayBuffer]",hr="[object DataView]",pr="[object Float32Array]",lr="[object Float64Array]",dr="[object Int8Array]",yr="[object Int16Array]",gr="[object Int32Array]",vr="[object Uint8Array]",wr="[object Uint8ClampedArray]",mr="[object Uint16Array]",_r="[object Uint32Array]",Er={};Er[pr]=Er[lr]=Er[dr]=Er[yr]=Er[gr]=Er[vr]=Er[wr]=Er[mr]=Er[_r]=!0,Er[Gn]=Er[Qn]=Er[fr]=Er[$n]=Er[hr]=Er[tr]=Er[er]=Er[nr]=Er[rr]=Er[ir]=Er[or]=Er[sr]=Er[ar]=Er[cr]=Er[ur]=!1;var Sr=Object.prototype,br=Sr.toString,kr="object"==typeof e&&e&&!e.nodeType&&e,Ir=kr&&"object"==typeof i&&i&&!i.nodeType&&i,Fr=Ir&&Ir.exports===kr,Nr=Fr&&Qe.process,Or=function(){try{return Nr&&Nr.binding("util")}catch(t){}}(),Tr=Or&&Or.isTypedArray,Lr=Tr?Y(Tr):q,Rr=Object.prototype,xr=Rr.hasOwnProperty,Ar=Object.prototype,Dr=J(Object.keys,Object),Pr=Object.prototype,Cr=Pr.hasOwnProperty,Mr="Expected a function",Ur=st(ot,1/0),Br=function(t,e,n){var r=B(t)?ut:Ur;r(t,e,n)},jr=ft(ht);M(jr);var zr=pt(ht),Vr=st(zr,1);M(Vr),C(function(t,e){return C(function(n){return t.apply(null,e.concat(n))})});var Wr,Hr=(dt(),tn.Symbol),Zr=Hr?Hr.prototype:void 0,qr=(Zr?Zr.toString:void 0,"\\ud800-\\udfff"),Yr="\\u0300-\\u036f\\ufe20-\\ufe23",Xr="\\u20d0-\\u20f0",Kr="\\ufe0e\\ufe0f",Jr="\\u200d",Gr=(RegExp("["+Jr+qr+Yr+Xr+Kr+"]"),"\\ud800-\\udfff"),Qr="\\u0300-\\u036f\\ufe20-\\ufe23",$r="\\u20d0-\\u20f0",ti="\\ufe0e\\ufe0f",ei="["+Gr+"]",ni="["+Qr+$r+"]",ri="\\ud83c[\\udffb-\\udfff]",ii="(?:"+ni+"|"+ri+")",oi="[^"+Gr+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",ai="[\\ud800-\\udbff][\\udc00-\\udfff]",ci="\\u200d",ui=ii+"?",fi="["+ti+"]?",hi="(?:"+ci+"(?:"+[oi,si,ai].join("|")+")"+fi+ui+")*",pi=fi+ui+hi,li="(?:"+[oi+ni+"?",ni,si,ai,ei].join("|")+")",di=(RegExp(ri+"(?="+ri+")|"+li+pi,"g"),"function"==typeof setImmediate&&setImmediate),yi="object"==typeof o&&"function"==typeof o.nextTick;Wr=di?setImmediate:yi?o.nextTick:yt;var gi=gt(Wr);vt.prototype.removeLink=function(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t},vt.prototype.empty=vt,vt.prototype.insertAfter=function(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1},vt.prototype.insertBefore=function(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1},vt.prototype.unshift=function(t){this.head?this.insertBefore(this.head,t):wt(this,t)},vt.prototype.push=function(t){this.tail?this.insertAfter(this.tail,t):wt(this,t)},vt.prototype.shift=function(){return this.head&&this.removeLink(this.head)},vt.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)};var vi=st(ot,1),wi=C(function(t){return C(function(e){var n=this,r=e[e.length-1];"function"==typeof r?e.pop():r=j,mt(t,e,function(t,e,r){e.apply(n,t.concat([C(function(t,e){r(t,e)})]))},function(t,e){r.apply(n,[t].concat(e))})})});C(function(t){return wi.apply(null,t.reverse())}),C(function(t){var e=[null].concat(t);return Rn(function(t,n){return n.apply(this,e)})}),_t("dir"),_t("log");var mi;mi=yi?o.nextTick:di?setImmediate:yt,gt(mi);var _i=(Array.prototype.slice,Math.ceil,Math.max,null),Ei=function(t){this._cache={},this._client=t};Ei.prototype.readdir=function(t,e){var n=this,r=this.getCachedDirInfo(t);this._wrap(function(e){null!==r&&r.contents?n._client.readdir(t,{contentHash:r.stat.contentHash},e):n._client.readdir(t,e)},function(i,o,s,a){i?i.status===Dropbox.ApiError.NO_CONTENT&&null!==r?e(null,r.contents.slice(0)):e(i):(n.updateCachedDirInfo(t,s,o.slice(0)),a.forEach(function(e){n.updateCachedInfo(me.join(t,e.name),e)}),e(null,o))})},Ei.prototype.remove=function(t,e){var n=this;this._wrap(function(e){n._client.remove(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r)})},Ei.prototype.move=function(t,e,n){var r=this;this._wrap(function(n){r._client.move(t,e,n)},function(i,o){i||(r.deleteCachedInfo(t),r.updateCachedInfo(e,o)),n(i)})},Ei.prototype.stat=function(t,e){var n=this;this._wrap(function(e){n._client.stat(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r,i)})},Ei.prototype.readFile=function(t,e){var n=this,r=this.getCachedFileInfo(t);null!==r&&null!==r.contents?this.stat(t,function(i,o){i?e(i):o.contentHash===r.stat.contentHash?e(i,r.contents.slice(0),r.stat):n.readFile(t,e)}):this._wrap(function(e){n._client.readFile(t,{arrayBuffer:!0},e)},function(r,i,o){r||n.updateCachedInfo(t,o,i.slice(0)),e(r,i,o)})},Ei.prototype.writeFile=function(t,e,n){var r=this;this._wrap(function(n){r._client.writeFile(t,e,n)},function(i,o){i||r.updateCachedInfo(t,o,e.slice(0)),n(i,o)})},Ei.prototype.mkdir=function(t,e){var n=this;this._wrap(function(e){n._client.mkdir(t,e)},function(r,i){r||n.updateCachedInfo(t,i,[]),e(r)})},Ei.prototype._wrap=function(t,e){var n=0,r=function(i){var o=2;if(i&&3>++n)switch(i.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){t(r)},1e3*o);break;default:e.apply(null,arguments)}else e.apply(null,arguments)};t(r)},Ei.prototype.getCachedInfo=function(t){return this._cache[t.toLowerCase()]},Ei.prototype.putCachedInfo=function(t,e){this._cache[t.toLowerCase()]=e},Ei.prototype.deleteCachedInfo=function(t){delete this._cache[t.toLowerCase()]},Ei.prototype.getCachedDirInfo=function(t){var e=this.getCachedInfo(t);return It(e)?e:null},Ei.prototype.getCachedFileInfo=function(t){var e=this.getCachedInfo(t);return kt(e)?e:null},Ei.prototype.updateCachedDirInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.contentHash||void 0!==r&&r.stat.contentHash===e.contentHash||this.putCachedInfo(t,{stat:e,contents:n})},Ei.prototype.updateCachedFileInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.versionTag||void 0!==r&&r.stat.versionTag===e.versionTag||this.putCachedInfo(t,{stat:e,contents:n})},Ei.prototype.updateCachedInfo=function(t,e,n){void 0===n&&(n=null),e.isFile&&Ft(n)?this.updateCachedFileInfo(t,e,n):e.isFolder&&Array.isArray(n)&&this.updateCachedDirInfo(t,e,n)};var Si=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;if(this.isDirty()){var n=this.getBuffer(),r=p(n);this._fs._writeFileStrict(this.getPath(),r,function(n){n||e.resetDirty(),t(n)})}else t()},e.prototype.close=function(t){this.sync(t)},e}(Ve),bi=function(t){function e(e){t.call(this),this._client=new Ei(e),bt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof Dropbox},e.prototype.getName=function(){return"Dropbox"},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.empty=function(t){var e=this;this._client.readdir("/",function(n,r){if(n)t(e.convert(n,"/"));else{var i=function(t,n){var r=me.join("/",t);e._client.remove(r,function(t){n(t?e.convert(t,r):null)})},o=function(e){e?t(e):t()};St(r,i,o)}})},e.prototype.rename=function(t,e,n){var r=this;this._client.move(t,e,function(i){i?r._client.stat(e,function(o,s){if(o||s.isFolder){var a=i.response.error.indexOf(t)>-1?t:e;n(r.convert(i,a))}else r._client.remove(e,function(i){i?n(r.convert(i,e)):r.rename(t,e,n)})}):n()})},e.prototype.stat=function(t,e,n){var r=this;this._client.stat(t,function(e,i){if(e)n(r.convert(e,t));else{if(!i||!i.isRemoved){var o=new Ne(r._statType(i),i.size);return n(null,o)}n(ke.FileError(_e.ENOENT,t))}})},e.prototype.open=function(t,e,n,i){var o=this;this._client.readFile(t,function(n,s,a){if(!n){var c;c=null===s?new r(0):g(s);var u=o._makeFile(t,e,a,c);return i(null,u)}if(e.isReadable())i(o.convert(n,t));else switch(n.status){case Dropbox.ApiError.NOT_FOUND:var f=new ArrayBuffer(0);return o._writeFileStrict(t,f,function(n,r){if(n)i(n);else{var s=o._makeFile(t,e,r,g(f));i(null,s)}});default:return i(o.convert(n,t))}})},e.prototype._writeFileStrict=function(t,e,n){var r=this,i=me.dirname(t);this.stat(i,!1,function(o,s){o?n(ke.FileError(_e.ENOENT,i)):r._client.writeFile(t,e,function(e,i){e?n(r.convert(e,t)):n(null,i)})})},e.prototype._statType=function(t){return t.isFile?Fe.FILE:Fe.DIRECTORY},e.prototype._makeFile=function(t,e,n,r){var i=this._statType(n),o=new Ne(i,n.size);return new Si(this,t,e,o,r)},e.prototype._remove=function(t,e,n){var r=this;this._client.stat(t,function(i,o){i?e(r.convert(i,t)):o.isFile&&!n?e(ke.FileError(_e.ENOTDIR,t)):!o.isFile&&n?e(ke.FileError(_e.EISDIR,t)):r._client.remove(t,function(n){e(n?r.convert(n,t):null)})})},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){this._remove(t,e,!1)},e.prototype.mkdir=function(t,e,n){var r=this,i=me.dirname(t);this._client.stat(i,function(e,o){e?n(r.convert(e,i)):r._client.mkdir(t,function(e){n(e?ke.FileError(_e.EEXIST,t):null)})})},e.prototype.readdir=function(t,e){var n=this;this._client.readdir(t,function(t,r){return t?e(n.convert(t)):e(null,r)})},e.prototype.convert=function(t,e){void 0===e&&(e=null);var n=_i[t.status];return void 0===n&&(n=_e.EIO),e?ke.FileError(n,e):new ke(n)},e}(Be),ki=function(t){function e(e,n,r,i){t.call(this),this._fs=e,this._FS=n,this._path=r,this._stream=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPos=function(){},e.prototype.close=function(t){var e=null;try{this.closeSync()}catch(n){e=n}finally{t(e)}},e.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(t){throw Nt(t,this._path)}},e.prototype.stat=function(t){try{t(null,this.statSync())}catch(e){t(e)}},e.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(t){throw Nt(t,this._path)}},e.prototype.truncate=function(t,e){var n=null;try{this.truncateSync(t)}catch(r){n=r}finally{e(n)}},e.prototype.truncateSync=function(t){try{this._FS.ftruncate(this._stream.fd,t)}catch(e){throw Nt(e,this._path)}},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(o){i(o)}},e.prototype.writeSync=function(t,e,n,r){try{var i=l(t);return null===r&&(r=void 0),this._FS.write(this._stream,i,e,n,r)}catch(o){throw Nt(o,this._path)}},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(o){i(o)}},e.prototype.readSync=function(t,e,n,r){try{var i=l(t);return null===r&&(r=void 0),this._FS.read(this._stream,i,e,n,r)}catch(o){throw Nt(o,this._path);}},e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.chown=function(t,e,n){var r=null;try{this.chownSync(t,e)}catch(i){r=i}finally{n(r)}},e.prototype.chownSync=function(t,e){try{this._FS.fchown(this._stream.fd,t,e)}catch(n){throw Nt(n,this._path)}},e.prototype.chmod=function(t,e){var n=null;try{this.chmodSync(t)}catch(r){n=r}finally{e(n)}},e.prototype.chmodSync=function(t){try{this._FS.fchmod(this._stream.fd,t)}catch(e){throw Nt(e,this._path)}},e.prototype.utimes=function(t,e,n){var r=null;try{this.utimesSync(t,e)}catch(i){r=i}finally{n(r)}},e.prototype.utimesSync=function(t,e){this._fs.utimesSync(this._path,t,e)},e}(ze),Ii=function(t){function e(e){t.call(this),this._FS=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getName=function(){return this._FS.DB_NAME()},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!0},e.prototype.supportsProps=function(){return!0},e.prototype.supportsSynch=function(){return!0},e.prototype.renameSync=function(t,e){try{this._FS.rename(t,e)}catch(n){throw n.errno===_e.ENOENT?Nt(n,this.existsSync(t)?e:t):Nt(n)}},e.prototype.statSync=function(t,e){try{var n=e?this._FS.lstat(t):this._FS.stat(t),r=this.modeToFileType(n.mode);return new Ne(r,n.size,n.mode,n.atime,n.mtime,n.ctime)}catch(i){throw Nt(i,t)}},e.prototype.openSync=function(t,e,n){try{var r=this._FS.open(t,e.getFlagString(),n);if(this._FS.isDir(r.node.mode))throw this._FS.close(r),ke.EISDIR(t);return new ki(this,this._FS,t,r)}catch(i){throw Nt(i,t)}},e.prototype.unlinkSync=function(t){try{this._FS.unlink(t)}catch(e){throw Nt(e,t)}},e.prototype.rmdirSync=function(t){try{this._FS.rmdir(t)}catch(e){throw Nt(e,t)}},e.prototype.mkdirSync=function(t,e){try{this._FS.mkdir(t,e)}catch(n){throw Nt(n,t)}},e.prototype.readdirSync=function(t){try{return this._FS.readdir(t).filter(function(t){return"."!==t&&".."!==t})}catch(e){throw Nt(e,t)}},e.prototype.truncateSync=function(t,e){try{this._FS.truncate(t,e)}catch(n){throw Nt(n,t)}},e.prototype.readFileSync=function(t,e,n){try{var r=this._FS.readFile(t,{flags:n.getFlagString()}),i=y(r);return e?i.toString(e):i}catch(o){throw Nt(o,t)}},e.prototype.writeFileSync=function(t,e,n,i,o){try{n&&(e=new r(e,n));var s=l(e);this._FS.writeFile(t,s,{flags:i.getFlagString(),encoding:"binary"}),this._FS.chmod(t,o)}catch(a){throw Nt(a,t)}},e.prototype.chmodSync=function(t,e,n){try{e?this._FS.lchmod(t,n):this._FS.chmod(t,n)}catch(r){throw Nt(r,t)}},e.prototype.chownSync=function(t,e,n,r){try{e?this._FS.lchown(t,n,r):this._FS.chown(t,n,r)}catch(i){throw Nt(i,t)}},e.prototype.symlinkSync=function(t,e,n){try{this._FS.symlink(t,e)}catch(r){throw Nt(r)}},e.prototype.readlinkSync=function(t){try{return this._FS.readlink(t)}catch(e){throw Nt(e,t)}},e.prototype.utimesSync=function(t,e,n){try{this._FS.utime(t,e.getTime(),n.getTime())}catch(r){throw Nt(r,t)}},e.prototype.modeToFileType=function(t){if(this._FS.isDir(t))return Fe.DIRECTORY;if(this._FS.isFile(t))return Fe.FILE;if(this._FS.isLink(t))return Fe.SYMLINK;throw ke.EPERM("Invalid mode: "+t)},e}(je),Fi=function(t){function e(e,n){t.call(this),this._folder=e,this._wrapped=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.initialize=function(t){var e=this;this._wrapped.exists(this._folder,function(n){n?t():e._wrapped.isReadOnly()?t(ke.ENOENT(e._folder)):e._wrapped.mkdir(e._folder,511,t)})},e.prototype.getName=function(){return this._wrapped.getName()},e.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},e.prototype.supportsProps=function(){return this._wrapped.supportsProps()},e.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e}(Be);["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(function(t){Fi.prototype[t]=Lt(t,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(t){Fi.prototype[t]=Lt(t,!0,!0)});var Ni=Ee.webkitRequestFileSystem||Ee.requestFileSystem||null,Oi=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;if(this.isDirty()){var n={create:!1},r=this._fs,i=function(n){n.createWriter(function(n){var i=e.getBuffer(),o=new Blob([p(i)]),s=o.size;n.onwriteend=function(){n.onwriteend=null,n.truncate(s),e.resetDirty(),t()},n.onerror=function(n){t(r.convert(n,e.getPath(),!1))},n.write(o)})},o=function(n){t(r.convert(n,e.getPath(),!1))};r.fs.root.getFile(this.getPath(),n,i,o)}else t()},e.prototype.close=function(t){this.sync(t)},e}(Ve),Ti=function(t){function e(e,n){void 0===e&&(e=5),void 0===n&&(n=Ee.PERSISTENT),t.call(this),this.size=1048576*e,this.type=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!!Ni},e.prototype.getName=function(){return"HTML5 FileSystem"},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.convert=function(t,e,n){switch(t.name){case"PathExistsError":return ke.EEXIST(e);case"QuotaExceededError":return ke.FileError(_e.ENOSPC,e);case"NotFoundError":return ke.ENOENT(e);case"SecurityError":return ke.FileError(_e.EACCES,e);case"InvalidModificationError":return ke.FileError(_e.EPERM,e);case"TypeMismatchError":return ke.FileError(n?_e.ENOTDIR:_e.EISDIR,e);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return ke.FileError(_e.EINVAL,e)}},e.prototype.allocate=function(t){var e=this;void 0===t&&(t=function(){});var n=function(n){e.fs=n,t()},r=function(n){t(e.convert(n,"/",!0))};this.type===Ee.PERSISTENT?xt(this.type,this.size,function(t){Ni(e.type,t,n,r)},r):Ni(this.type,this.size,n,r)},e.prototype.empty=function(t){var e=this;this._readdir("/",function(n,r){if(n)console.error("Failed to empty FS"),t(n);else{var i=function(e){n?(console.error("Failed to empty FS"),t(n)):t()},o=function(t,n){var r=function(){n()},i=function(r){n(e.convert(r,t.fullPath,!t.isDirectory))};Rt(t)?t.removeRecursively(r,i):t.remove(r,i)};St(r,o,i)}})},e.prototype.rename=function(t,e,n){var r=this,i=2,o=0,s=this.fs.root,a=t,c=function(t){--i<=0&&n(r.convert(t,a,!1))},u=function(i){return 2===++o?n(new ke(_e.EINVAL,"Something was identified as both a file and a directory. This should never happen.")):t===e?n():(a=me.dirname(e),void s.getDirectory(a,{},function(o){a=me.basename(e),i.moveTo(o,a,function(t){n()},function(o){i.isDirectory?(a=e,r.unlink(e,function(i){i?c(o):r.rename(t,e,n)})):c(o)})},c))};s.getFile(t,{},u,c),s.getDirectory(t,{},u,c)},e.prototype.stat=function(t,e,n){var r=this,i={create:!1},o=function(t){var e=function(t){var e=new Ne(Fe.FILE,t.size);n(null,e)};t.file(e,a)},s=function(t){var e=4096,r=new Ne(Fe.DIRECTORY,e);n(null,r)},a=function(e){n(r.convert(e,t,!1))},c=function(){r.fs.root.getDirectory(t,i,s,a)};this.fs.root.getFile(t,i,o,c)},e.prototype.open=function(t,e,n,r){var i=this,o=function(n){r("InvalidModificationError"===n.name&&e.isExclusive()?ke.EEXIST(t):i.convert(n,t,!1))};this.fs.root.getFile(t,{create:e.pathNotExistsAction()===be.CREATE_FILE,exclusive:e.isExclusive()},function(n){n.file(function(n){var s=new FileReader;s.onloadend=function(o){var a=i._makeFile(t,e,n,s.result);r(null,a)},s.onerror=function(t){o(s.error)},s.readAsArrayBuffer(n)},o)},o)},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(ke.ENOTEMPTY(t)):n._remove(t,e,!1)})},e.prototype.mkdir=function(t,e,n){var r=this,i={create:!0,exclusive:!0},o=function(t){n()},s=function(e){n(r.convert(e,t,!0))};this.fs.root.getDirectory(t,i,o,s)},e.prototype.readdir=function(t,e){this._readdir(t,function(t,n){if(t)return e(t);for(var r=[],i=0;i<n.length;i++)r.push(n[i].name);e(null,r)})},e.prototype._makeFile=function(t,e,n,r){void 0===r&&(r=new ArrayBuffer(0));var i=new Ne(Fe.FILE,n.size),o=g(r);return new Oi(this,t,e,i,o)},e.prototype._readdir=function(t,e){var n=this,r=function(r){e(n.convert(r,t,!0))};this.fs.root.getDirectory(t,{create:!1},function(t){var n=t.createReader(),i=[],o=function(){n.readEntries(function(t){t.length?(i=i.concat(At(t)),o()):e(null,i)},r)};o()},r)},e.prototype._remove=function(t,e,n){var r=this,i=function(i){var o=function(){e()},s=function(i){e(r.convert(i,t,!n))};i.remove(o,s)},o=function(i){e(r.convert(i,t,!n))},s={create:!1};n?this.fs.root.getFile(t,s,i,o):this.fs.root.getDirectory(t,s,i,o)},e}(Be),Li=function(t,e,n,r,i,o){this.id=t,this.size=e,this.mode=n,this.atime=r,this.mtime=i,this.ctime=o};Li.fromBuffer=function(t){if(void 0===t)throw new Error("NO");return new Li(t.toString("ascii",30),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22))},Li.prototype.toStats=function(){return new Ne((61440&this.mode)===Fe.DIRECTORY?Fe.DIRECTORY:Fe.FILE,this.size,this.mode,new Date(this.atime),new Date(this.mtime),new Date(this.ctime))},Li.prototype.getSize=function(){return 30+this.id.length},Li.prototype.toBuffer=function(t){return void 0===t&&(t=new r(this.getSize())),t.writeUInt32LE(this.size,0),t.writeUInt16LE(this.mode,4),t.writeDoubleLE(this.atime,6),t.writeDoubleLE(this.mtime,14),t.writeDoubleLE(this.ctime,22),t.write(this.id,30,this.id.length,"ascii"),t},Li.prototype.update=function(t){var e=!1;this.size!==t.size&&(this.size=t.size,e=!0),this.mode!==t.mode&&(this.mode=t.mode,e=!0);var n=t.atime.getTime();this.atime!==n&&(this.atime=n,e=!0);var r=t.mtime.getTime();this.mtime!==r&&(this.mtime=r,e=!0);var i=t.ctime.getTime();return this.ctime!==i&&(this.ctime=i,e=!0),e},Li.prototype.isFile=function(){return(61440&this.mode)===Fe.FILE},Li.prototype.isDirectory=function(){return(61440&this.mode)===Fe.DIRECTORY};var Ri="/",xi=function(t){this.store=t,this.originalData={},this.modifiedKeys=[]};xi.prototype.get=function(t){var e=this.store.get(t);return this.stashOldValue(t,e),e},xi.prototype.put=function(t,e,n){return this.markModified(t),this.store.put(t,e,n)},xi.prototype.del=function(t){this.markModified(t),this.store.del(t)},xi.prototype.commit=function(){},xi.prototype.abort=function(){var t,e,n,r=this;for(t=0;t<this.modifiedKeys.length;t++)e=r.modifiedKeys[t],n=r.originalData[e],null===n?r.store.del(e):r.store.put(e,n,!0)},xi.prototype.stashOldValue=function(t,e){this.originalData.hasOwnProperty(t)||(this.originalData[t]=e)},xi.prototype.markModified=function(t){this.modifiedKeys.indexOf(t)===-1&&(this.modifiedKeys.push(t),this.originalData.hasOwnProperty(t)||(this.originalData[t]=this.store.get(t)))};var Ai=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(Ve),Di=function(t){function e(e){t.call(this),this.store=e.store,this.makeRootDirectory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getName=function(){return this.store.name()},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.empty=function(){this.store.clear(),this.makeRootDirectory()},e.prototype.renameSync=function(t,e){var n=this.store.beginTransaction("readwrite"),i=me.dirname(t),o=me.basename(t),s=me.dirname(e),a=me.basename(e),c=this.findINode(n,i),u=this.getDirListing(n,i,c);if(!u[o])throw ke.ENOENT(t);var f=u[o];if(delete u[o],0===(s+"/").indexOf(t+"/"))throw new ke(_e.EBUSY,i);var h,p;if(s===i?(h=c,p=u):(h=this.findINode(n,s),p=this.getDirListing(n,s,h)),p[a]){var l=this.getINode(n,e,p[a]);if(!l.isFile())throw ke.EPERM(e);try{n.del(l.id),n.del(p[a])}catch(d){throw n.abort(),d}}p[a]=f;try{n.put(c.id,new r(JSON.stringify(u)),!0),n.put(h.id,new r(JSON.stringify(p)),!0)}catch(d){throw n.abort(),d}n.commit()},e.prototype.statSync=function(t,e){return this.findINode(this.store.beginTransaction("readonly"),t).toStats()},e.prototype.createFileSync=function(t,e,n){var i=this.store.beginTransaction("readwrite"),o=new r(0),s=this.commitNewFile(i,t,Fe.FILE,n,o);return new Ai(this,t,e,s.toStats(),o)},e.prototype.openFileSync=function(t,e){var n=this.store.beginTransaction("readonly"),r=this.findINode(n,t),i=n.get(r.id);if(void 0===i)throw ke.ENOENT(t);return new Ai(this,t,e,r.toStats(),i)},e.prototype.unlinkSync=function(t){this.removeEntry(t,!1)},e.prototype.rmdirSync=function(t){if(this.readdirSync(t).length>0)throw ke.ENOTEMPTY(t);this.removeEntry(t,!0)},e.prototype.mkdirSync=function(t,e){var n=this.store.beginTransaction("readwrite"),i=new r("{}");this.commitNewFile(n,t,Fe.DIRECTORY,e,i)},e.prototype.readdirSync=function(t){var e=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(e,t,this.findINode(e,t)))},e.prototype._syncSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=this._findINode(r,me.dirname(t),me.basename(t)),o=this.getINode(r,t,i),s=o.update(n);try{r.put(o.id,e,!0),s&&r.put(i,o.toBuffer(),!0)}catch(a){throw r.abort(),a}r.commit()},e.prototype.makeRootDirectory=function(){var t=this.store.beginTransaction("readwrite");if(void 0===t.get(Ri)){var e=(new Date).getTime(),n=new Li(Dt(),4096,511|Fe.DIRECTORY,e,e,e);t.put(n.id,new r("{}"),!1),t.put(Ri,n.toBuffer(),!1),t.commit()}},e.prototype._findINode=function(t,e,n){var r=this,i=function(i){var o=r.getDirListing(t,e,i);if(o[n])return o[n];throw ke.ENOENT(me.resolve(e,n))};return"/"===e?""===n?Ri:i(this.getINode(t,e,Ri)):i(this.getINode(t,e+me.sep+n,this._findINode(t,me.dirname(e),me.basename(e))))},e.prototype.findINode=function(t,e){return this.getINode(t,e,this._findINode(t,me.dirname(e),me.basename(e)))},e.prototype.getINode=function(t,e,n){var r=t.get(n);if(void 0===r)throw ke.ENOENT(e);return Li.fromBuffer(r)},e.prototype.getDirListing=function(t,e,n){if(!n.isDirectory())throw ke.ENOTDIR(e);var r=t.get(n.id);if(void 0===r)throw ke.ENOENT(e);return JSON.parse(r.toString())},e.prototype.addNewNode=function(t,e){for(var n,r=0;r<5;)try{return n=Dt(),t.put(n,e,!1),n}catch(i){}throw new ke(_e.EIO,"Unable to commit data to key-value store.")},e.prototype.commitNewFile=function(t,e,n,i,o){var s=me.dirname(e),a=me.basename(e),c=this.findINode(t,s),u=this.getDirListing(t,s,c),f=(new Date).getTime();if("/"===e)throw ke.EEXIST(e);if(u[a])throw ke.EEXIST(e);var h;try{var p=this.addNewNode(t,o);h=new Li(p,o.length,i|n,f,f,f);var l=this.addNewNode(t,h.toBuffer());u[a]=l,t.put(c.id,new r(JSON.stringify(u)),!0)}catch(d){throw t.abort(),d}return t.commit(),h},e.prototype.removeEntry=function(t,e){var n=this.store.beginTransaction("readwrite"),i=me.dirname(t),o=this.findINode(n,i),s=this.getDirListing(n,i,o),a=me.basename(t);if(!s[a])throw ke.ENOENT(t);var c=s[a];delete s[a];var u=this.getINode(n,t,c);if(!e&&u.isDirectory())throw ke.EISDIR(t);if(e&&!u.isDirectory())throw ke.ENOTDIR(t);try{n.del(u.id),n.del(c),n.put(o.id,new r(JSON.stringify(s)),!0)}catch(f){throw n.abort(),f}n.commit()},e}(je),Pi=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(n){n||e.resetDirty(),t(n)}):t()},e.prototype.close=function(t){this.sync(t)},e}(Ve),Ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.init=function(t,e){this.store=t,this.makeRootDirectory(e)},e.prototype.getName=function(){return this.store.name()},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.empty=function(t){var e=this;this.store.clear(function(n){Pt(n,t)&&e.makeRootDirectory(t)})},e.prototype.rename=function(t,e,n){var i=this,o=this.store.beginTransaction("readwrite"),s=me.dirname(t),a=me.basename(t),c=me.dirname(e),u=me.basename(e),f={},h={},p=!1;if(0===(c+"/").indexOf(t+"/"))return n(new ke(_e.EBUSY,s));var l=function(){if(!p&&h.hasOwnProperty(s)&&h.hasOwnProperty(c)){var l=h[s],d=f[s],y=h[c],g=f[c];if(l[a]){var v=l[a];delete l[a];var w=function(){y[u]=v,o.put(d.id,new r(JSON.stringify(l)),!0,function(t){Ct(t,o,n)&&(s===c?o.commit(n):o.put(g.id,new r(JSON.stringify(y)),!0,function(t){Ct(t,o,n)&&o.commit(n)}))})};y[u]?i.getINode(o,e,y[u],function(t,r){Ct(t,o,n)&&(r.isFile()?o.del(r.id,function(t){Ct(t,o,n)&&o.del(y[u],function(t){Ct(t,o,n)&&w()})}):o.abort(function(t){n(ke.EPERM(e))}))}):w()}else n(ke.ENOENT(t))}},d=function(t){i.findINodeAndDirListing(o,t,function(e,r,i){e?p||(p=!0,o.abort(function(){n(e)})):(f[t]=r,h[t]=i,l())})};d(s),s!==c&&d(c)},e.prototype.stat=function(t,e,n){var r=this.store.beginTransaction("readonly");this.findINode(r,t,function(t,e){Pt(t,n)&&n(null,e.toStats())})},e.prototype.createFile=function(t,e,n,i){var o=this,s=this.store.beginTransaction("readwrite"),a=new r(0);this.commitNewFile(s,t,Fe.FILE,n,a,function(n,r){Pt(n,i)&&i(null,new Pi(o,t,e,r.toStats(),a))})},e.prototype.openFile=function(t,e,n){var r=this,i=this.store.beginTransaction("readonly");this.findINode(i,t,function(o,s){Pt(o,n)&&i.get(s.id,function(i,o){Pt(i,n)&&(void 0===o?n(ke.ENOENT(t)):n(null,new Pi(r,t,e,s.toStats(),o)))})})},e.prototype.unlink=function(t,e){this.removeEntry(t,!1,e)},e.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(ke.ENOTEMPTY(t)):n.removeEntry(t,!0,e)})},e.prototype.mkdir=function(t,e,n){var i=this.store.beginTransaction("readwrite"),o=new r("{}");this.commitNewFile(i,t,Fe.DIRECTORY,e,o,n)},e.prototype.readdir=function(t,e){var n=this,r=this.store.beginTransaction("readonly");this.findINode(r,t,function(i,o){Pt(i,e)&&n.getDirListing(r,t,o,function(t,n){Pt(t,e)&&e(null,Object.keys(n))})})},e.prototype._sync=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite");this._findINode(o,me.dirname(t),me.basename(t),function(s,a){Ct(s,o,r)&&i.getINode(o,t,a,function(t,i){if(Ct(t,o,r)){var s=i.update(n);o.put(i.id,e,!0,function(t){Ct(t,o,r)&&(s?o.put(a,i.toBuffer(),!0,function(t){Ct(t,o,r)&&o.commit(r)}):o.commit(r))})}})})},e.prototype.makeRootDirectory=function(t){var e=this.store.beginTransaction("readwrite");e.get(Ri,function(n,i){if(n||void 0===i){var o=(new Date).getTime(),s=new Li(Dt(),4096,511|Fe.DIRECTORY,o,o,o);e.put(s.id,new r("{}"),!1,function(n){Ct(n,e,t)&&e.put(Ri,s.toBuffer(),!1,function(n){n?e.abort(function(){t(n)}):e.commit(t)})})}else e.commit(t)})},e.prototype._findINode=function(t,e,n,r){var i=this,o=function(t,i,o){t?r(t):o[n]?r(null,o[n]):r(ke.ENOENT(me.resolve(e,n)))};"/"===e?""===n?r(null,Ri):this.getINode(t,e,Ri,function(n,s){Pt(n,r)&&i.getDirListing(t,e,s,function(t,e){o(t,s,e)})}):this.findINodeAndDirListing(t,e,o)},e.prototype.findINode=function(t,e,n){var r=this;this._findINode(t,me.dirname(e),me.basename(e),function(i,o){Pt(i,n)&&r.getINode(t,e,o,n)})},e.prototype.getINode=function(t,e,n,r){t.get(n,function(t,n){Pt(t,r)&&(void 0===n?r(ke.ENOENT(e)):r(null,Li.fromBuffer(n)))})},e.prototype.getDirListing=function(t,e,n,r){n.isDirectory()?t.get(n.id,function(t,n){if(Pt(t,r))try{r(null,JSON.parse(n.toString()))}catch(t){r(ke.ENOENT(e))}}):r(ke.ENOTDIR(e))},e.prototype.findINodeAndDirListing=function(t,e,n){var r=this;this.findINode(t,e,function(i,o){Pt(i,n)&&r.getDirListing(t,e,o,function(t,e){Pt(t,n)&&n(null,o,e)})})},e.prototype.addNewNode=function(t,e,n){var r,i=0,o=function(){5===++i?n(new ke(_e.EIO,"Unable to commit data to key-value store.")):(r=Dt(),t.put(r,e,!1,function(t,e){t||!e?o():n(null,r)}))};o()},e.prototype.commitNewFile=function(t,e,n,i,o,s){var a=this,c=me.dirname(e),u=me.basename(e),f=(new Date).getTime();return"/"===e?s(ke.EEXIST(e)):void this.findINodeAndDirListing(t,c,function(c,h,p){Ct(c,t,s)&&(p[u]?t.abort(function(){s(ke.EEXIST(e))}):a.addNewNode(t,o,function(e,c){if(Ct(e,t,s)){var l=new Li(c,o.length,i|n,f,f,f);a.addNewNode(t,l.toBuffer(),function(e,n){Ct(e,t,s)&&(p[u]=n,t.put(h.id,new r(JSON.stringify(p)),!0,function(e){Ct(e,t,s)&&t.commit(function(e){Ct(e,t,s)&&s(null,l)})}))})}}))})},e.prototype.removeEntry=function(t,e,n){var i=this,o=this.store.beginTransaction("readwrite"),s=me.dirname(t),a=me.basename(t);this.findINodeAndDirListing(o,s,function(s,c,u){if(Ct(s,o,n))if(u[a]){var f=u[a];delete u[a],i.getINode(o,t,f,function(i,s){Ct(i,o,n)&&(!e&&s.isDirectory()?o.abort(function(){n(ke.EISDIR(t))}):e&&!s.isDirectory()?o.abort(function(){n(ke.ENOTDIR(t))}):o.del(s.id,function(t){Ct(t,o,n)&&o.del(f,function(t){Ct(t,o,n)&&o.put(c.id,new r(JSON.stringify(u)),!0,function(t){Ct(t,o,n)&&o.commit(n)})})}))})}else o.abort(function(){n(ke.ENOENT(t))})})},e}(Be),Mi=function(){this.store={}};Mi.prototype.name=function(){return"In-memory"},Mi.prototype.clear=function(){this.store={}},Mi.prototype.beginTransaction=function(t){return new xi(this)},Mi.prototype.get=function(t){return this.store[t]},Mi.prototype.put=function(t,e,n){return!(!n&&this.store.hasOwnProperty(t))&&(this.store[t]=e,!0)},Mi.prototype.del=function(t){delete this.store[t]};var Ui=function(t){function e(){t.call(this,{store:new Mi})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Di),Bi=Ee.indexedDB||Ee.mozIndexedDB||Ee.webkitIndexedDB||Ee.msIndexedDB,ji=function(t,e){this.tx=t,this.store=e};ji.prototype.get=function(t,e){try{var n=this.store.get(t);n.onerror=Ut(e),n.onsuccess=function(t){var n=t.target.result;void 0===n?e(null,n):e(null,g(n))}}catch(r){e(Mt(r))}};var zi=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.put=function(t,e,n,r){try{var i,o=p(e);i=n?this.store.put(o,t):this.store.add(o,t),i.onerror=Ut(r),i.onsuccess=function(t){r(null,!0)}}catch(s){r(Mt(s))}},e.prototype.del=function(t,e){try{var n=this.store["delete"](t);n.onerror=Ut(e),n.onsuccess=function(t){e()}}catch(r){e(Mt(r))}},e.prototype.commit=function(t){setTimeout(t,0)},e.prototype.abort=function(t){var e;try{this.tx.abort()}catch(n){e=Mt(n)}finally{t(e)}},e}(ji),Vi=function(t,e){var n=this;void 0===e&&(e="browserfs"),this.storeName=e;var r=Bi.open(this.storeName,1);r.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(n.storeName)&&e.deleteObjectStore(n.storeName),e.createObjectStore(n.storeName)},r.onsuccess=function(e){n.db=e.target.result,t(null,n)},r.onerror=Ut(t,_e.EACCES)};Vi.prototype.name=function(){return"IndexedDB - "+this.storeName},Vi.prototype.clear=function(t){try{var e=this.db.transaction(this.storeName,"readwrite"),n=e.objectStore(this.storeName),r=n.clear();r.onsuccess=function(e){setTimeout(t,0)},r.onerror=Ut(t)}catch(i){t(Mt(i))}},Vi.prototype.beginTransaction=function(t){void 0===t&&(t="readonly");var e=this.db.transaction(this.storeName,t),n=e.objectStore(this.storeName);if("readwrite"===t)return new zi(e,n);if("readonly"===t)return new ji(e,n);throw new ke(_e.EINVAL,"Invalid transaction type.")};var Wi,Hi=function(t){function e(e,n){var r=this;t.call(this);var i=new Vi(function(t){t?e(t):r.init(i,function(t){e(t,r)})},n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){try{return"undefined"!=typeof Bi&&null!==Bi.open("__browserfs_test__")}catch(t){return!1}},e}(Ci),Zi=!1;try{Ee.localStorage.setItem("__test__",String.fromCharCode(55296)),Zi=Ee.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch(qi){Zi=!1}Wi=Zi?"binary_string":"binary_string_ie",r.isEncoding(Wi)||(Wi="base64");var Yi=function(){};Yi.prototype.name=function(){return"LocalStorage"},Yi.prototype.clear=function(){Ee.localStorage.clear()},Yi.prototype.beginTransaction=function(t){return new xi(this)},Yi.prototype.get=function(t){try{var e=Ee.localStorage.getItem(t);if(null!==e)return new r(e,Wi)}catch(n){}},Yi.prototype.put=function(t,e,n){try{return!(!n&&null!==Ee.localStorage.getItem(t))&&(Ee.localStorage.setItem(t,e.toString(Wi)),!0)}catch(r){throw new ke(_e.ENOSPC,"LocalStorage is full.")}},Yi.prototype.del=function(t){try{Ee.localStorage.removeItem(t)}catch(e){throw new ke(_e.EIO,"Unable to delete key "+t+": "+e)}};for(var Xi=function(t){function e(){t.call(this,{store:new Yi})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof Ee.localStorage},e}(Di),Ki=function(t){function e(){t.call(this),this.mountList=[],this.mntMap={},this.rootFs=new Ui}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.mount=function(t,e){if("/"!==t[0]&&(t="/"+t),t=me.resolve(t),this.mntMap[t])throw new ke(_e.EINVAL,"Mount point "+t+" is already taken.");h(t,511,this.rootFs),this.mntMap[t]=e,this.mountList.push(t),this.mountList=this.mountList.sort(function(t,e){return e.length-t.length})},e.prototype.umount=function(t){var e=this;if("/"!==t[0]&&(t="/"+t),t=me.resolve(t),!this.mntMap[t])throw new ke(_e.EINVAL,"Mount point "+t+" is already unmounted.");for(delete this.mntMap[t],this.mountList.splice(this.mountList.indexOf(t),1);"/"!==t&&0===e.rootFs.readdirSync(t).length;)e.rootFs.rmdirSync(t),t=me.dirname(t)},e.prototype._getFs=function(t){for(var e=this,n=this.mountList,r=n.length,i=0;i<r;i++){var o=n[i];if(o.length<=t.length&&0===t.indexOf(o))return t=t.substr(o.length>1?o.length:0),""===t&&(t="/"),{fs:e.mntMap[o],path:t}}return{fs:this.rootFs,path:t}},e.prototype.getName=function(){return"MountableFileSystem"},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.standardizeError=function(t,e,n){var r=t.message.indexOf(e);return r!==-1&&(t.message=t.message.substr(0,r)+n+t.message.substr(r+e.length),t.path=n),t},e.prototype.rename=function(t,e,n){var r=this,i=this._getFs(t),o=this._getFs(e);return i.fs===o.fs?i.fs.rename(i.path,o.path,function(s){s&&r.standardizeError(r.standardizeError(s,i.path,t),o.path,e),n(s)}):Re.readFile(t,function(r,i){return r?n(r):void Re.writeFile(e,i,function(e){return e?n(e):void Re.unlink(t,n)})})},e.prototype.renameSync=function(t,e){var n=this._getFs(t),r=this._getFs(e);if(n.fs===r.fs)try{return n.fs.renameSync(n.path,r.path)}catch(i){throw this.standardizeError(this.standardizeError(i,n.path,t),r.path,e),i}var o=Re.readFileSync(t);return Re.writeFileSync(e,o),Re.unlinkSync(t)},e.prototype.readdirSync=function(t){var e=this._getFs(t),n=null;if(e.fs!==this.rootFs)try{n=this.rootFs.readdirSync(t)}catch(r){}try{var i=e.fs.readdirSync(e.path);return null===n?i:i.concat(n.filter(function(t){return i.indexOf(t)===-1}))}catch(r){if(null===n)throw this.standardizeError(r,e.path,t);return n}},e.prototype.readdir=function(t,e){var n=this,r=this._getFs(t);r.fs.readdir(r.path,function(i,o){if(r.fs!==n.rootFs)try{var s=n.rootFs.readdirSync(t);o=o?o.concat(s.filter(function(t){return o.indexOf(t)===-1})):s}catch(a){if(i)return e(n.standardizeError(i,r.path,t))}else if(i)return e(n.standardizeError(i,r.path,t));e(null,o)})},e.prototype.rmdirSync=function(t){var e=this._getFs(t);if(this._containsMountPt(t))throw ke.ENOTEMPTY(t);try{e.fs.rmdirSync(e.path)}catch(n){throw this.standardizeError(n,e.path,t)}},e.prototype.rmdir=function(t,e){var n=this,r=this._getFs(t);this._containsMountPt(t)?e(ke.ENOTEMPTY(t)):r.fs.rmdir(r.path,function(i){e(i?n.standardizeError(i,r.path,t):null)})},e.prototype._containsMountPt=function(t){for(var e=this.mountList,n=e.length,r=0;r<n;r++){var i=e[r];if(i.length>=t.length&&i.slice(0,t.length)===t)return!0}return!1},e}(Be),Ji=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],Gi=0;Gi<Ji.length;Gi++)for(var Qi=Ji[Gi],$i=0;$i<Qi.length;$i++){var to=Qi[$i];Ki.prototype[to]=Bt(to,!1,Gi+1),Ki.prototype[to+"Sync"]=Bt(to+"Sync",!0,Gi+1)}var eo=function(){this._locked=!1,this._waiters=[]};eo.prototype.lock=function(t){return this._locked?void this._waiters.push(t):(this._locked=!0,void t())},eo.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var t=this._waiters.shift();return t?void setImmediate(t):void(this._locked=!1)},eo.prototype.tryLock=function(){return!this._locked&&(this._locked=!0,!0)},eo.prototype.isLocked=function(){return this._locked};var no=function(t){this._fs=t,this._mu=new eo};no.prototype.getName=function(){return"LockedFS<"+this._fs.getName()+">"},no.prototype.getFSUnlocked=function(){return this._fs},no.prototype.initialize=function(t){this._fs.initialize(t)},no.prototype.diskSpace=function(t,e){this._fs.diskSpace(t,e)},no.prototype.isReadOnly=function(){return this._fs.isReadOnly()},no.prototype.supportsLinks=function(){return this._fs.supportsLinks()},no.prototype.supportsProps=function(){return this._fs.supportsProps()},no.prototype.supportsSynch=function(){return this._fs.supportsSynch()},no.prototype.rename=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.rename(t,e,function(t){r._mu.unlock(),n(t)})})},no.prototype.renameSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,e)},no.prototype.stat=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.stat(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},no.prototype.statSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,e)},no.prototype.open=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.open(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},no.prototype.openSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,e,n)},no.prototype.unlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.unlink(t,function(t){n._mu.unlock(),e(t)})})},no.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},no.prototype.rmdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.rmdir(t,function(t){n._mu.unlock(),e(t)})})},no.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},no.prototype.mkdir=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.mkdir(t,e,function(t){r._mu.unlock(),n(t)})})},no.prototype.mkdirSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,e)},no.prototype.readdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.readdir(t,function(t,r){n._mu.unlock(),e(t,r)})})},no.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},no.prototype.exists=function(t,e){var n=this;this._mu.lock(function(){n._fs.exists(t,function(t){n._mu.unlock(),e(t)})})},no.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},no.prototype.realpath=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.realpath(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},no.prototype.realpathSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,e)},no.prototype.truncate=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.truncate(t,e,function(t){r._mu.unlock(),n(t)})})},no.prototype.truncateSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,e)},no.prototype.readFile=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.readFile(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},no.prototype.readFileSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,e,n)},no.prototype.writeFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.writeFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},no.prototype.writeFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,n,r,i)},no.prototype.appendFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.appendFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},no.prototype.appendFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,n,r,i)},no.prototype.chmod=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.chmod(t,e,n,function(t){i._mu.unlock(),r(t)})})},no.prototype.chmodSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,e,n)},no.prototype.chown=function(t,e,n,r,i){var o=this;this._mu.lock(function(){o._fs.chown(t,e,n,r,function(t){o._mu.unlock(),i(t)})})},no.prototype.chownSync=function(t,e,n,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(t,e,n,r)},no.prototype.utimes=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.utimes(t,e,n,function(t){i._mu.unlock(),r(t)})})},no.prototype.utimesSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,e,n)},no.prototype.link=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.link(t,e,function(t){r._mu.unlock(),n(t)})})},no.prototype.linkSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,e)},no.prototype.symlink=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.symlink(t,e,n,function(t){i._mu.unlock(),r(t)})})},no.prototype.symlinkSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,n)},no.prototype.readlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.readlink(t,function(t,r){n._mu.unlock(),e(t,r)})})},no.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var ro,io="/.deletedFiles.log",oo=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;return this.isDirty()?void this._fs._syncAsync(this,function(n){e.resetDirty(),t(n)}):void t(null)},e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.close=function(t){this.sync(t)},e.prototype.closeSync=function(){this.syncSync()},e}(Ve),so=function(t){function e(e,n){if(t.call(this),this._isInitialized=!1,this._initializeCallbacks=[],this._deletedFiles={},this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this._deleteLogError=null,this._writable=e,this._readable=n,this._writable.isReadOnly())throw new ke(_e.EINVAL,"Writable file system must be writable.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},e.prototype._syncAsync=function(t,e){var n=this;this.createParentDirectoriesAsync(t.getPath(),function(r){return r?e(r):void n._writable.writeFile(t.getPath(),t.getBuffer(),null,zt("w"),t.getStats().mode,e)})},e.prototype._syncSync=function(t){this.createParentDirectories(t.getPath()),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,zt("w"),t.getStats().mode)},e.prototype.getName=function(){return"OverlayFS"},e.prototype.initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};return this._isInitialized?t():(n.push(t),void(1===n.length&&this._writable.readFile(io,"utf8",zt("r"),function(t,n){if(t){if(t.errno!==_e.ENOENT)return r(t)}else e._deleteLog=n;e._reparseDeletionLog(),r(null)})))},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},e.prototype.getDeletionLog=function(){return this._deleteLog},e.prototype.restoreDeletionLog=function(t){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("")},e.prototype.rename=function(t,e,n){var r=this;if(this.checkInitAsync(n)&&!this.checkPathAsync(t,n)&&!this.checkPathAsync(e,n))return t===io||e===io?n(ke.EPERM("Cannot rename deletion log.")):t===e?n():void this.stat(t,!1,function(i,o){return i?n(i):r.stat(e,!1,function(i,s){function a(r){var i=r.shift();if(!i)return n();var o=me.resolve(t,i),s=me.resolve(e,i);c.rename(o,s,function(t){return t?n(t):void a(r)})}var c=r,u=511;if(o.isDirectory()){if(i)return i.errno!==_e.ENOENT?n(i):r._writable.exists(t,function(i){return i?r._writable.rename(t,e,n):void r._writable.mkdir(e,u,function(e){return e?n(e):void r._readable.readdir(t,function(t,e){return t?n():void a(e)})})});if(u=s.mode,!s.isDirectory())return n(ke.ENOTDIR(e));r.readdir(e,function(i,o){return o&&o.length?n(ke.ENOTEMPTY(e)):void r._readable.readdir(t,function(t,e){return t?n():void a(e)})})}return s&&s.isDirectory()?n(ke.EISDIR(e)):void r.readFile(t,null,zt("r"),function(i,s){return i?n(i):r.writeFile(e,s,null,zt("w"),o.mode,function(e){return e?n(e):r.unlink(t,n)})})})})},e.prototype.renameSync=function(t,e){var n=this;if(this.checkInitialized(),this.checkPath(t),this.checkPath(e),t===io||e===io)throw ke.EPERM("Cannot rename deletion log.");var r=this.statSync(t,!1);if(r.isDirectory()){if(t===e)return;var i=511;if(this.existsSync(e)){var o=this.statSync(e,!1);if(i=o.mode,!o.isDirectory())throw ke.ENOTDIR(e);if(this.readdirSync(e).length>0)throw ke.ENOTEMPTY(e)}this._writable.existsSync(t)?this._writable.renameSync(t,e):this._writable.existsSync(e)||this._writable.mkdirSync(e,i),this._readable.existsSync(t)&&this._readable.readdirSync(t).forEach(function(r){n.renameSync(me.resolve(t,r),me.resolve(e,r))})}else{if(this.existsSync(e)&&this.statSync(e,!1).isDirectory())throw ke.EISDIR(e);this.writeFileSync(e,this.readFileSync(t,null,zt("r")),null,zt("w"),r.mode)}t!==e&&this.existsSync(t)&&this.unlinkSync(t)},e.prototype.stat=function(t,e,n){var r=this;this.checkInitAsync(n)&&this._writable.stat(t,e,function(i,o){i&&i.errno===_e.ENOENT?(r._deletedFiles[t]&&n(ke.ENOENT(t)),r._readable.stat(t,e,function(t,e){e&&(e=e.clone(),e.mode=jt(e.mode)),n(t,e)})):n(i,o)})},e.prototype.statSync=function(t,e){this.checkInitialized();try{return this._writable.statSync(t,e)}catch(n){if(this._deletedFiles[t])throw ke.ENOENT(t);var r=this._readable.statSync(t,e).clone();return r.mode=jt(r.mode),r}},e.prototype.open=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&!this.checkPathAsync(t,r)&&this.stat(t,!1,function(o,s){if(s)switch(e.pathExistsAction()){case be.TRUNCATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):void i._writable.open(t,e,n,r)});case be.NOP:return i._writable.exists(t,function(o){o?i._writable.open(t,e,n,r):(s=s.clone(),s.mode=n,i._readable.readFile(t,null,zt("r"),function(n,o){if(n)return r(n);s.size===-1&&(s.size=o.length);var a=new oo(i,t,e,s,o);r(null,a)}))});default:return r(ke.EEXIST(t))}else switch(e.pathNotExistsAction()){case be.CREATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):i._writable.open(t,e,n,r)});default:return r(ke.ENOENT(t))}})},e.prototype.openSync=function(t,e,n){if(this.checkInitialized(),this.checkPath(t),t===io)throw ke.EPERM("Cannot open deletion log.");if(this.existsSync(t))switch(e.pathExistsAction()){case be.TRUNCATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);case be.NOP:if(this._writable.existsSync(t))return this._writable.openSync(t,e,n);var r=this._readable.readFileSync(t,null,zt("r")),i=this._readable.statSync(t,!1).clone();return i.mode=n,new oo(this,t,e,i,r);default:throw ke.EEXIST(t)}else switch(e.pathNotExistsAction()){case be.CREATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);default:throw ke.ENOENT(t)}},e.prototype.unlink=function(t,e){var n=this;this.checkInitAsync(e)&&!this.checkPathAsync(t,e)&&this.exists(t,function(r){return r?void n._writable.exists(t,function(r){return r?n._writable.unlink(t,function(r){return r?e(r):void n.exists(t,function(r){r&&n.deletePath(t),e(null)})}):(n.deletePath(t),void e(null))}):e(ke.ENOENT(t))})},e.prototype.unlinkSync=function(t){if(this.checkInitialized(),this.checkPath(t),!this.existsSync(t))throw ke.ENOENT(t);this._writable.existsSync(t)&&this._writable.unlinkSync(t),this.existsSync(t)&&this.deletePath(t)},e.prototype.rmdir=function(t,e){var n=this;if(this.checkInitAsync(e)){var r=function(){n.readdir(t,function(r,i){return r?e(r):i.length?e(ke.ENOTEMPTY(t)):(n.deletePath(t),void e(null))})};this.exists(t,function(i){return i?void n._writable.exists(t,function(i){i?n._writable.rmdir(t,function(i){return i?e(i):void n._readable.exists(t,function(t){t?r():e()})}):r()}):e(ke.ENOENT(t))})}},e.prototype.rmdirSync=function(t){if(this.checkInitialized(),!this.existsSync(t))throw ke.ENOENT(t);if(this._writable.existsSync(t)&&this._writable.rmdirSync(t),this.existsSync(t)){if(this.readdirSync(t).length>0)throw ke.ENOTEMPTY(t);this.deletePath(t)}},e.prototype.mkdir=function(t,e,n){var r=this;this.checkInitAsync(n)&&this.exists(t,function(i){return i?n(ke.EEXIST(t)):void r.createParentDirectoriesAsync(t,function(i){return i?n(i):void r._writable.mkdir(t,e,n)})})},e.prototype.mkdirSync=function(t,e){if(this.checkInitialized(),this.existsSync(t))throw ke.EEXIST(t);this.createParentDirectories(t),this._writable.mkdirSync(t,e)},e.prototype.readdir=function(t,e){var n=this;this.checkInitAsync(e)&&this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?void n._writable.readdir(t,function(r,i){return r&&"ENOENT"!==r.code?e(r):(!r&&i||(i=[]),void n._readable.readdir(t,function(r,o){!r&&o||(o=[]);var s={},a=i.concat(o.filter(function(e){return!n._deletedFiles[t+"/"+e]})).filter(function(t){var e=!s[t];return s[t]=!0,e});e(null,a)}))}):e(ke.ENOTDIR(t))})},e.prototype.readdirSync=function(t){var e=this;this.checkInitialized();var n=this.statSync(t,!1);if(!n.isDirectory())throw ke.ENOTDIR(t);var r=[];try{r=r.concat(this._writable.readdirSync(t))}catch(i){}try{r=r.concat(this._readable.readdirSync(t).filter(function(n){return!e._deletedFiles[t+"/"+n]}))}catch(i){}var o={};return r.filter(function(t){var e=!o[t];return o[t]=!0,e})},e.prototype.exists=function(t,e){var n=this;this.checkInitialized(),this._writable.exists(t,function(r){return r?e(!0):void n._readable.exists(t,function(r){e(r&&n._deletedFiles[t]!==!0)})})},e.prototype.existsSync=function(t){return this.checkInitialized(),this._writable.existsSync(t)||this._readable.existsSync(t)&&this._deletedFiles[t]!==!0},e.prototype.chmod=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){return o?r(o):void i._writable.chmod(t,e,n,r)})},e.prototype.chmodSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.chmodSync(t,e,n)})},e.prototype.chown=function(t,e,n,r,i){var o=this;this.checkInitAsync(i)&&this.operateOnWritableAsync(t,function(s){return s?i(s):void o._writable.chown(t,e,n,r,i)})},e.prototype.chownSync=function(t,e,n,r){var i=this;this.checkInitialized(),this.operateOnWritable(t,function(){i._writable.chownSync(t,e,n,r)})},e.prototype.utimes=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){return o?r(o):void i._writable.utimes(t,e,n,r)})},e.prototype.utimesSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.utimesSync(t,e,n)})},e.prototype.deletePath=function(t){this._deletedFiles[t]=!0,this.updateLog("d"+t+"\n")},e.prototype.updateLog=function(t){var e=this;this._deleteLog+=t,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(io,this._deleteLog,"utf8",Ie.getFileFlag("w"),420,function(t){e._deleteLogUpdatePending=!1,t?e._deleteLogError=t:e._deleteLogUpdateNeeded&&(e._deleteLogUpdateNeeded=!1,e.updateLog(""))}))},e.prototype._reparseDeletionLog=function(){var t=this;this._deletedFiles={},this._deleteLog.split("\n").forEach(function(e){t._deletedFiles[e.slice(1)]="d"===e.slice(0,1)})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new ke(_e.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(null!==this._deleteLogError){var t=this._deleteLogError;throw this._deleteLogError=null,t}},e.prototype.checkInitAsync=function(t){if(!this._isInitialized)return t(new ke(_e.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")),!1;if(null!==this._deleteLogError){var e=this._deleteLogError;return this._deleteLogError=null,t(e),!1}return!0},e.prototype.checkPath=function(t){if(t===io)throw ke.EPERM(t)},e.prototype.checkPathAsync=function(t,e){return t===io&&(e(ke.EPERM(t)),!0)},e.prototype.createParentDirectoriesAsync=function(t,e){function n(t,e){t?(o.push(i),i=me.dirname(i),s._writable.stat(i,!1,n)):r()}function r(){if(!o.length)return e();var t=o.pop();s._readable.stat(t,!1,function(n,i){return i?void s._writable.mkdir(t,i.mode,function(t){return t?e(t):void r()}):e()})}var i=me.dirname(t),o=[],s=this;this._writable.stat(i,!1,n)},e.prototype.createParentDirectories=function(t){for(var e=this,n=me.dirname(t),r=[];!this._writable.existsSync(n);)r.push(n),n=me.dirname(n);r=r.reverse(),r.forEach(function(t){e._writable.mkdirSync(t,e.statSync(t,!1).mode)})},e.prototype.operateOnWritable=function(t,e){if(!this.existsSync(t))throw ke.ENOENT(t);this._writable.existsSync(t)||this.copyToWritable(t),e()},e.prototype.operateOnWritableAsync=function(t,e){var n=this;this.exists(t,function(r){return r?void n._writable.exists(t,function(r){return r?void e():n.copyToWritableAsync(t,e)}):e(ke.ENOENT(t))})},e.prototype.copyToWritable=function(t){var e=this.statSync(t,!1);e.isDirectory()?this._writable.mkdirSync(t,e.mode):this.writeFileSync(t,this._readable.readFileSync(t,null,zt("r")),null,zt("w"),this.statSync(t,!1).mode)},e.prototype.copyToWritableAsync=function(t,e){var n=this;this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?n._writable.mkdir(t,i.mode,e):void n._readable.readFile(t,null,zt("r"),function(r,o){return r?e(r):void n.writeFile(t,o,null,zt("w"),i.mode,e)})})},e}(Be),ao=function(t){function e(e,n){t.call(this,new so(e,n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return so.isAvailable()},e.prototype.initialize=function(e){t.prototype.initialize.call(this,e)},e.prototype.getOverlayedFileSystems=function(){return t.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},e.prototype.unwrap=function(){return t.prototype.getFSUnlocked.call(this)},e}(no);!function(t){t[t.CB=0]="CB",t[t.FD=1]="FD",t[t.API_ERROR=2]="API_ERROR",t[t.STATS=3]="STATS",t[t.PROBE=4]="PROBE",t[t.FILEFLAG=5]="FILEFLAG",t[t.BUFFER=6]="BUFFER",t[t.ERROR=7]="ERROR"}(ro||(ro={}));var co=function(){this._callbacks={},this._nextId=0};co.prototype.toRemoteArg=function(t){var e=this._nextId++;return this._callbacks[e]=t,{type:ro.CB,id:e}},co.prototype.toLocalArg=function(t){var e=this._callbacks[t];return delete this._callbacks[t],e};var uo=function(){this._fileDescriptors={},this._nextId=0};uo.prototype.toRemoteArg=function(t,e,n,i){var o,s,a=this._nextId++;this._fileDescriptors[a]=t,t.stat(function(c,u){c?i(c):(s=Jt(u.toBuffer()),n.isReadable()?t.read(new r(u.size),0,u.size,0,function(t,r,c){t?i(t):(o=Jt(c),i(null,{type:ro.FD,id:a,data:o,stat:s,path:e,flag:n.getFlagString()}))}):i(null,{type:ro.FD,id:a,data:new ArrayBuffer(0),stat:s,path:e,flag:n.getFlagString()}))})},uo.prototype.applyFdAPIRequest=function(t,e){var n=this,r=t.args[0];this._applyFdChanges(r,function(i,o){i?e(i):o[t.method](function(i){"close"===t.method&&delete n._fileDescriptors[r.id],e(i)})})},uo.prototype._applyFdChanges=function(t,e){var n=this._fileDescriptors[t.id],r=Gt(t.data),i=Ne.fromBuffer(Gt(t.stat)),o=Ie.getFileFlag(t.flag);o.isWriteable()?n.write(r,0,r.length,o.isAppendable()?n.getPos():0,function(t){function s(){n.stat(function(t,r){t?e(t):r.mode!==i.mode?n.chmod(i.mode,function(t){e(t,n)}):e(t,n)})}t?e(t):o.isAppendable()?s():n.truncate(r.length,function(){s()})}):e(null,n)};var fo=function(t){function e(e,n,r,i,o,s){t.call(this,e,n,r,i,s),this._remoteFdId=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getRemoteFdId=function(){return this._remoteFdId},e.prototype.toRemoteArg=function(){return{type:ro.FD,id:this._remoteFdId,data:Jt(this.getBuffer()),stat:Jt(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},e.prototype.sync=function(t){this._syncClose("sync",t)},e.prototype.close=function(t){this._syncClose("close",t)},e.prototype._syncClose=function(t,e){var n=this;this.isDirty()?this._fs.syncClose(t,this,function(t){t||n.resetDirty(),e(t)}):e()},e}(Ve),ho=function(t){function e(e){var n=this;t.call(this),this._callbackConverter=new co,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._worker=e,this._worker.addEventListener("message",function(t){var e=t.data;if(ee(e)){var r,i=e.args,o=new Array(i.length);for(r=0;r<o.length;r++)o[r]=n._argRemote2Local(i[r]);n._callbackConverter.toLocalArg(e.cbId).apply(null,o)}})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof importScripts||"undefined"!=typeof Worker},e.attachRemoteListener=function(t){function e(t,e,n){switch(typeof t){case"object":t instanceof Ne?n(null,qt(t)):t instanceof ke?n(null,Vt(t)):t instanceof ze?n(null,i.toRemoteArg(t,e[0],e[1],n)):t instanceof Ie?n(null,Xt(t)):t instanceof r?n(null,Qt(t)):t instanceof Error?n(null,Ht(t)):n(null,t);break;default:n(null,t)}}function n(n,r){if(!n)return n;switch(typeof n){case"object":if("number"!=typeof n.type)return n;var i=n;switch(i.type){case ro.CB:var o=n.id;return function(){function n(e){u>0&&(u=-1,s={browserfsMessage:!0,cbId:o,args:[Vt(e)]},t.postMessage(s))}var i,s,a=arguments,c=new Array(arguments.length),u=arguments.length;for(i=0;i<arguments.length;i++)!function(i,a){e(a,r,function(e,r){c[i]=r,e?n(e):0===--u&&(s={browserfsMessage:!0,cbId:o,args:c},t.postMessage(s))})}(i,a[i]);0===arguments.length&&(s={browserfsMessage:!0,cbId:o,args:c},t.postMessage(s))};case ro.API_ERROR:return Wt(i);case ro.STATS:return Yt(i);case ro.FILEFLAG:return Kt(i);case ro.BUFFER:return $t(i);case ro.ERROR:return Zt(i);default:return n}default:return n}}var i=new uo;t.addEventListener("message",function(e){var r=e.data;if(te(r)){var o=r.args,s=new Array(o.length);switch(r.method){case"close":case"sync":!function(){var e=o[1];i.applyFdAPIRequest(r,function(n){var r={browserfsMessage:!0,cbId:e.id,args:n?[Vt(n)]:[]};t.postMessage(r)})}();break;case"probe":!function(){var e=Re.getRootFS(),n=o[1],r={type:ro.PROBE,isReadOnly:e.isReadOnly(),supportsLinks:e.supportsLinks(),supportsProps:e.supportsProps()},i={browserfsMessage:!0,cbId:n.id,args:[r]};t.postMessage(i)}();break;default:for(var a=0;a<o.length;a++)s[a]=n(o[a],s);var c=Re.getRootFS();c[r.method].apply(c,s)}}})},e.prototype.getName=function(){return"WorkerFS"},e.prototype._argLocal2Remote=function(t){if(!t)return t;switch(typeof t){case"object":return t instanceof Ne?qt(t):t instanceof ke?Vt(t):t instanceof fo?t.toRemoteArg():t instanceof Ie?Xt(t):t instanceof r?Qt(t):t instanceof Error?Ht(t):"Unknown argument";case"function":return this._callbackConverter.toRemoteArg(t);default:return t}},e.prototype.initialize=function(t){var e=this;if(this._isInitialized)t();else{var n={browserfsMessage:!0,method:"probe",args:[this._argLocal2Remote(new r(0)),this._callbackConverter.toRemoteArg(function(n){e._isInitialized=!0,e._isReadOnly=n.isReadOnly,e._supportLinks=n.supportsLinks,e._supportProps=n.supportsProps,t()})]};this._worker.postMessage(n)}},e.prototype.isReadOnly=function(){return this._isReadOnly},e.prototype.supportsSynch=function(){return!1},e.prototype.supportsLinks=function(){return this._supportLinks},e.prototype.supportsProps=function(){return this._supportProps},e.prototype.rename=function(t,e,n){this._rpc("rename",arguments)},e.prototype.stat=function(t,e,n){this._rpc("stat",arguments)},e.prototype.open=function(t,e,n,r){this._rpc("open",arguments)},e.prototype.unlink=function(t,e){this._rpc("unlink",arguments)},e.prototype.rmdir=function(t,e){this._rpc("rmdir",arguments)},e.prototype.mkdir=function(t,e,n){this._rpc("mkdir",arguments)},e.prototype.readdir=function(t,e){this._rpc("readdir",arguments)},e.prototype.exists=function(t,e){this._rpc("exists",arguments)},e.prototype.realpath=function(t,e,n){this._rpc("realpath",arguments)},e.prototype.truncate=function(t,e,n){this._rpc("truncate",arguments)},e.prototype.readFile=function(t,e,n,r){this._rpc("readFile",arguments)},e.prototype.writeFile=function(t,e,n,r,i,o){this._rpc("writeFile",arguments)},e.prototype.appendFile=function(t,e,n,r,i,o){this._rpc("appendFile",arguments)},e.prototype.chmod=function(t,e,n,r){this._rpc("chmod",arguments)},e.prototype.chown=function(t,e,n,r,i){this._rpc("chown",arguments)},e.prototype.utimes=function(t,e,n,r){this._rpc("utimes",arguments)},e.prototype.link=function(t,e,n){this._rpc("link",arguments)},e.prototype.symlink=function(t,e,n,r){this._rpc("symlink",arguments)},e.prototype.readlink=function(t,e){this._rpc("readlink",arguments)},e.prototype.syncClose=function(t,e,n){this._worker.postMessage({browserfsMessage:!0,method:t,args:[e.toRemoteArg(),this._callbackConverter.toRemoteArg(n)]})},e.prototype._argRemote2Local=function(t){if(!t)return t;switch(typeof t){case"object":if("number"!=typeof t.type)return t;var e=t;switch(e.type){case ro.API_ERROR:return Wt(e);case ro.FD:var n=e;return new fo(this,n.path,Ie.getFileFlag(n.flag),Ne.fromBuffer(Gt(n.stat)),n.id,Gt(n.data));case ro.STATS:return Yt(e);case ro.FILEFLAG:return Kt(e);case ro.BUFFER:return $t(e);case ro.ERROR:return Zt(e);default:return t}default:return t}},e.prototype._rpc=function(t,e){var n,r=this,i={browserfsMessage:!0,method:t,args:null},o=new Array(e.length);for(n=0;n<e.length;n++)o[n]=r._argLocal2Remote(e[n]);i.args=o,this._worker.postMessage(i)},e}(Be),po=ne,lo=Ae&&"undefined"!=typeof Blob?ie:re,yo=function(){this._index={},this.addPath("/",new vo)};yo.fromListing=function(t){var e=new yo,n=new vo;e._index["/"]=n;for(var r=[["",t,n]];r.length>0;){var i=void 0,o=r.pop(),s=o[0],a=o[1],c=o[2],u=void 0;for(u in a)if(a.hasOwnProperty(u)){var f=a[u],h=s+"/"+u;f?(e._index[h]=i=new vo,r.push([h,f,i])):i=new go(new Ne(Fe.FILE,(-1),365)),c&&(c._ls[u]=i)}}return e},yo.prototype.fileIterator=function(t){var e=this;for(var n in this._index)if(e._index.hasOwnProperty(n))for(var r=e._index[n],i=r.getListing(),o=0;o<i.length;o++){var s=r.getItem(i[o]);ce(s)&&t(s.getData())}},yo.prototype.addPath=function(t,e){if(!e)throw new Error("Inode must be specified");if("/"!==t[0])throw new Error("Path must be absolute, got: "+t);if(this._index.hasOwnProperty(t))return this._index[t]===e;var n=this._split_path(t),r=n[0],i=n[1],o=this._index[r];return!(void 0===o&&"/"!==t&&(o=new vo,!this.addPath(r,o)))&&(!("/"!==t&&!o.addItem(i,e))&&(ue(e)&&(this._index[t]=e),!0))},yo.prototype.addPathFast=function(t,e){var n=t.lastIndexOf("/"),r=0===n?"/":t.substring(0,n),i=t.substring(n+1),o=this._index[r];return void 0===o&&(o=new vo,this.addPathFast(r,o)),!!o.addItem(i,e)&&(e.isDir()&&(this._index[t]=e),!0)},yo.prototype.removePath=function(t){var e=this,n=this._split_path(t),r=n[0],i=n[1],o=this._index[r];if(void 0===o)return null;var s=o.remItem(i);if(null===s)return null;if(ue(s)){for(var a=s.getListing(),c=0;c<a.length;c++)e.removePath(t+"/"+a[c]);"/"!==t&&delete this._index[t]}return s},yo.prototype.ls=function(t){var e=this._index[t];return void 0===e?null:e.getListing()},yo.prototype.getInode=function(t){var e=this._split_path(t),n=e[0],r=e[1],i=this._index[n];return void 0===i?null:n===t?i:i.getItem(r)},yo.prototype._split_path=function(t){var e=me.dirname(t),n=t.substr(e.length+("/"===e?0:1));return[e,n]};var go=function(t){this.data=t};go.prototype.isFile=function(){return!0},go.prototype.isDir=function(){return!1},go.prototype.getData=function(){return this.data},go.prototype.setData=function(t){this.data=t};var vo=function(t){void 0===t&&(t=null),this.data=t,this._ls={}};vo.prototype.isFile=function(){return!1},vo.prototype.isDir=function(){return!0},vo.prototype.getData=function(){return this.data},vo.prototype.getStats=function(){return new Ne(Fe.DIRECTORY,4096,365)},vo.prototype.getListing=function(){return Object.keys(this._ls)},vo.prototype.getItem=function(t){var e=this._ls[t];return e?e:null},vo.prototype.addItem=function(t,e){return!(t in this._ls)&&(this._ls[t]=e,!0)},vo.prototype.remItem=function(t){var e=this._ls[t];return void 0===e?null:(delete this._ls[t],e)};var wo=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),e||(e="index.json"),n.length>0&&"/"!==n.charAt(n.length-1)&&(n+="/"),this.prefixUrl=n;var r=null;if("string"==typeof e){if(r=this._requestFileSync(e,"json"),!r)throw new Error("Unable to find listing at URL: ${listingUrlOrObj}")}else r=e;this._index=yo.fromListing(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return"undefined"!=typeof XMLHttpRequest&&null!==XMLHttpRequest},e.prototype.empty=function(){this._index.fileIterator(function(t){t.fileData=null})},e.prototype._requestFileSizeAsync=function(t,e){ae(this.getXhrPath(t),e)},e.prototype._requestFileSizeSync=function(t){return se(this.getXhrPath(t))},e.prototype.getName=function(){return"XmlHttpRequest"},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.preloadFile=function(t,e){var n=this._index.getInode(t);if(!ce(n))throw ke.EISDIR(t);if(null===n)throw ke.ENOENT(t);var r=n.getData();r.size=e.length,r.fileData=e},e.prototype.stat=function(t,e,n){var r=this._index.getInode(t);if(null===r)return n(ke.ENOENT(t));var i;ce(r)?(i=r.getData(),i.size<0?this._requestFileSizeAsync(t,function(t,e){return t?n(t):(i.size=e,void n(null,i.clone()))}):n(null,i.clone())):ue(r)?(i=r.getStats(),n(null,i)):n(ke.FileError(_e.EINVAL,t))},e.prototype.statSync=function(t,e){var n=this._index.getInode(t);if(null===n)throw ke.ENOENT(t);var r;if(ce(n))r=n.getData(),r.size<0&&(r.size=this._requestFileSizeSync(t));else{if(!ue(n))throw ke.FileError(_e.EINVAL,t);r=n.getStats()}return r},e.prototype.open=function(t,e,n,r){if(e.isWriteable())return r(new ke(_e.EPERM,t));var i=this,o=this._index.getInode(t);if(null===o)return r(ke.ENOENT(t));if(!ce(o))return r(ke.EISDIR(t));var s=o.getData();switch(e.pathExistsAction()){case be.THROW_EXCEPTION:case be.TRUNCATE_FILE:return r(ke.EEXIST(t));case be.NOP:if(s.fileData)return r(null,new We(i,t,e,s.clone(),s.fileData));this._requestFileAsync(t,"buffer",function(n,o){return n?r(n):(s.size=o.length,s.fileData=o,r(null,new We(i,t,e,s.clone(),o)))});break;default:return r(new ke(_e.EINVAL,"Invalid FileMode object."))}},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new ke(_e.EPERM,t);var r=this._index.getInode(t);if(null===r)throw ke.ENOENT(t);if(!ce(r))throw ke.EISDIR(t);var i=r.getData();switch(e.pathExistsAction()){case be.THROW_EXCEPTION:case be.TRUNCATE_FILE:throw ke.EEXIST(t);case be.NOP:if(i.fileData)return new We(this,t,e,i.clone(),i.fileData);var o=this._requestFileSync(t,"buffer");return i.size=o.length,i.fileData=o,new We(this,t,e,i.clone(),o);default:throw new ke(_e.EINVAL,"Invalid FileMode object.")}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(n){e(n)}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(null===e)throw ke.ENOENT(t);if(ue(e))return e.getListing();throw ke.ENOTDIR(t)},e.prototype.readFile=function(t,e,n,r){var i=r;this.open(t,n,420,function(t,n){if(t)return r(t);r=function(t,e){n.close(function(n){return t||(t=n),i(t,e)})};var o=n,s=o.getBuffer();null===e?r(t,v(s)):fe(s,e,r)})},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r,o=i.getBuffer();return null===e?v(o):o.toString(e)}finally{r.closeSync()}},e.prototype.getXhrPath=function(t){return"/"===t.charAt(0)&&(t=t.slice(1)),this.prefixUrl+t},e.prototype._requestFileAsync=function(t,e,n){po(this.getXhrPath(t),e,n)},e.prototype._requestFileSync=function(t,e){return lo(this.getXhrPath(t),e)},e}(Be),mo=function(){};mo.str2byte=function(t,e){for(var n=t.length>e.length?e.length:t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>127){var o=mo.extendedChars.indexOf(t.charAt(r));o>-1&&(i=o+128)}e[i]=r}return n},mo.byte2str=function(t){for(var e=new Array(t.length),n=0;n<t.length;n++){var r=t[n];r>127?e[n]=mo.extendedChars[r-128]:e[n]=String.fromCharCode(r)}return e.join("")},mo.byteLength=function(t){return t.length},mo.extendedChars=["Ç","ü","é","â","ä","à ","Ã¥","ç","ê","ë","è","ï","î","ì","Ä","Ã…","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ãœ","ø","£","Ø","×","Æ’","á","Ã","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Ã","Â","À","©","¦","¦","+","+","¢","Â¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ã","Ê","Ë","È","i","Ã","ÃŽ","Ã","+","+","_","_","¦","ÃŒ","_","Ó","ß","Ô","Ã’","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ã","¯","´","Â","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];var _o,Eo=n(20).inflateRaw;!function(t){t[t.MSDOS=0]="MSDOS",t[t.AMIGA=1]="AMIGA",t[t.OPENVMS=2]="OPENVMS",t[t.UNIX=3]="UNIX",t[t.VM_CMS=4]="VM_CMS",t[t.ATARI_ST=5]="ATARI_ST",t[t.OS2_HPFS=6]="OS2_HPFS",t[t.MAC=7]="MAC",t[t.Z_SYSTEM=8]="Z_SYSTEM",t[t.CP_M=9]="CP_M",t[t.NTFS=10]="NTFS",t[t.MVS=11]="MVS",t[t.VSE=12]="VSE",t[t.ACORN_RISC=13]="ACORN_RISC",t[t.VFAT=14]="VFAT",t[t.ALT_MVS=15]="ALT_MVS",t[t.BEOS=16]="BEOS",t[t.TANDEM=17]="TANDEM",t[t.OS_400=18]="OS_400",t[t.OSX=19]="OSX"}(_o||(_o={}));var So;!function(t){t[t.STORED=0]="STORED",t[t.SHRUNK=1]="SHRUNK",t[t.REDUCED_1=2]="REDUCED_1",t[t.REDUCED_2=3]="REDUCED_2",t[t.REDUCED_3=4]="REDUCED_3",t[t.REDUCED_4=5]="REDUCED_4",t[t.IMPLODE=6]="IMPLODE",t[t.DEFLATE=8]="DEFLATE",t[t.DEFLATE64=9]="DEFLATE64",t[t.TERSE_OLD=10]="TERSE_OLD",t[t.BZIP2=12]="BZIP2",t[t.LZMA=14]="LZMA",t[t.TERSE_NEW=18]="TERSE_NEW",t[t.LZ77=19]="LZ77",t[t.WAVPACK=97]="WAVPACK",t[t.PPMD=98]="PPMD"}(So||(So={}));var bo=function(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new ke(_e.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};bo.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},bo.prototype.flags=function(){return this.data.readUInt16LE(6)},bo.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},bo.prototype.lastModFileTime=function(){return he(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},bo.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},bo.prototype.crc32=function(){return this.data.readUInt32LE(14)},bo.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},bo.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},bo.prototype.fileName=function(){return pe(this.data,this.useUTF8(),30,this.fileNameLength())},bo.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},bo.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},bo.prototype.useUTF8=function(){return 2048===(2048&this.flags())};var ko=function(t,e,n){this.header=t,this.record=e,this.data=n};ko.prototype.decompress=function(){var t=this.header.compressionMethod();switch(t){case So.DEFLATE:var e=Eo(this.data.slice(0,this.record.compressedSize()),{chunkSize:this.record.uncompressedSize()});return d(e);case So.STORED:return v(this.data,0,this.record.uncompressedSize());default:var n=So[t];throw n=n?n:"Unknown: "+t,new ke(_e.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+n)}},ko.prototype.getHeader=function(){return this.header},ko.prototype.getRecord=function(){return this.record},ko.prototype.getRawData=function(){return this.data};var Io=function(t){this.data=t};Io.prototype.crc32=function(){return this.data.readUInt32LE(0)},Io.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},Io.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)};var Fo=function(t){if(this.data=t,134630224!==this.data.readUInt32LE(0))throw new ke(_e.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))};Fo.prototype.length=function(){return this.data.readUInt32LE(4)},Fo.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())};var No=function(t){if(this.data=t,84233040!==this.data.readUInt32LE(0))throw new ke(_e.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))};No.prototype.size=function(){return this.data.readUInt16LE(4)},No.prototype.signatureData=function(){return this.data.slice(6,6+this.size())};var Oo=function(t,e){if(this.zipData=t,this.data=e,33639248!==this.data.readUInt32LE(0))throw new ke(_e.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};Oo.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},Oo.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},Oo.prototype.flag=function(){return this.data.readUInt16LE(8)},Oo.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},Oo.prototype.lastModFileTime=function(){return he(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},Oo.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},Oo.prototype.crc32=function(){return this.data.readUInt32LE(16)},Oo.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},Oo.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},Oo.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},Oo.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},Oo.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},Oo.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},Oo.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},Oo.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},Oo.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},Oo.prototype.produceFilename=function(){var t=pe(this.data,this.useUTF8(),46,this.fileNameLength());return t.replace(/\\/g,"/")},Oo.prototype.fileName=function(){return this._filename},Oo.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},Oo.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},Oo.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return pe(this.data,this.useUTF8(),t,this.fileCommentLength())},Oo.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},Oo.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},Oo.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},Oo.prototype.isFile=function(){return!this.isDirectory()},Oo.prototype.useUTF8=function(){return 2048===(2048&this.flag())},Oo.prototype.isEncrypted=function(){return 1===(1&this.flag())},Oo.prototype.getFileData=function(){var t=this.headerRelativeOffset(),e=new bo(this.zipData.slice(t));return new ko(e,this,this.zipData.slice(t+e.totalSize()))},Oo.prototype.getData=function(){return this.getFileData().decompress()},Oo.prototype.getRawData=function(){return this.getFileData().getRawData()},Oo.prototype.getStats=function(){return new Ne(Fe.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())};var To=function(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new ke(_e.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};To.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},To.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},To.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},To.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},To.prototype.cdSize=function(){return this.data.readUInt32LE(12)},To.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},To.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},To.prototype.cdZipComment=function(){return pe(this.data,!0,22,this.cdZipCommentLength())},To.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var Lo=function(t,e,n,r){this.index=t,this.directoryEntries=e,this.eocd=n,this.data=r},Ro=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),this.name=n,this._index=new yo,this._directoryEntries=[],this._eocd=null,e instanceof Lo?(this._index=e.index,this._directoryEntries=e.directoryEntries,this._eocd=e.eocd,this.data=e.data):(this.data=e,this.populateIndex())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.computeIndex=function(t,n){var r=new yo,i=e.getEOCD(t);if(i.diskNumber()!==i.cdDiskNumber())throw new ke(_e.EINVAL,"ZipFS does not support spanned zip files.");var o=i.cdOffset();if(4294967295===o)throw new ke(_e.EINVAL,"ZipFS does not support Zip64.");var s=o+i.cdSize();e.computeIndexResponsive(t,r,o,s,n,[],i)},e.getEOCD=function(t){for(var e=22,n=Math.min(e+65535,t.length-1),r=e;r<n;r++)if(101010256===t.readUInt32LE(t.length-r))return new To(t.slice(t.length-r));throw new ke(_e.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},e.addToIndex=function(t,e){var n=t.fileName();if("/"===n.charAt(0))throw new Error("WHY IS THIS ABSOLUTE");"/"===n.charAt(n.length-1)&&(n=n.substr(0,n.length-1)),t.isDirectory()?e.addPathFast("/"+n,new vo(t)):e.addPathFast("/"+n,new go(t))},e.computeIndexResponsive=function(t,n,r,i,o,s,a){if(r<i){for(var c=0;c++<200&&r<i;){var u=new Oo(t,t.slice(r));e.addToIndex(u,n),r+=u.totalSize(),s.push(u)}setImmediate(function(){e.computeIndexResponsive(t,n,r,i,o,s,a)})}else o(new Lo(n,s,a,t))},e.prototype.getName=function(){return"ZipFS"+(""!==this.name?" "+this.name:"")},e.prototype.getCentralDirectoryEntry=function(t){var e=this._index.getInode(t);if(null===e)throw ke.ENOENT(t);if(ce(e))return e.getData();if(ue(e))return e.getData();throw ke.EPERM("Invalid inode: "+e)},e.prototype.getCentralDirectoryEntryAt=function(t){var e=this._directoryEntries[t];if(!e)throw new RangeError("Invalid directory index: "+t+".");return e},e.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},e.prototype.getEndOfCentralDirectory=function(){return this._eocd},e.prototype.diskSpace=function(t,e){e(this.data.length,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.statSync=function(t,e){var n=this._index.getInode(t);if(null===n)throw ke.ENOENT(t);var r;if(ce(n))r=n.getData().getStats();else{if(!ue(n))throw new ke(_e.EINVAL,"Invalid inode.");r=n.getStats()}return r},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new ke(_e.EPERM,t);var r=this._index.getInode(t);if(!r)throw ke.ENOENT(t);if(!ce(r))throw ke.EISDIR(t);var i=r.getData(),o=i.getStats();switch(e.pathExistsAction()){case be.THROW_EXCEPTION:case be.TRUNCATE_FILE:throw ke.EEXIST(t);case be.NOP:return new We(this,t,e,o,i.getData());default:throw new ke(_e.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(e){if(ue(e))return e.getListing();throw ke.ENOTDIR(t)}throw ke.ENOENT(t)},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r,o=i.getBuffer();return null===e?v(o):o.toString(e)}finally{r.closeSync()}},e.prototype.populateIndex=function(){var t=this,n=this._eocd=e.getEOCD(this.data);if(n.diskNumber()!==n.cdDiskNumber())throw new ke(_e.EINVAL,"ZipFS does not support spanned zip files.");var r=n.cdOffset();if(4294967295===r)throw new ke(_e.EINVAL,"ZipFS does not support Zip64.");for(var i=r+n.cdSize();r<i;){var o=new Oo(t.data,t.data.slice(r));r+=o.totalSize(),e.addToIndex(o,t._index),t._directoryEntries.push(o)}},e}(je),xo={AsyncMirror:Ze,Dropbox:bi,Emscripten:Ii,FolderAdapter:Fi,HTML5FS:Ti,InMemory:Ui,IndexedDB:Hi,LocalStorage:Xi,MountableFileSystem:Ki,OverlayFS:ao,WorkerFS:ho,XmlHttpRequest:wo,ZipFS:Ro};if(o.initializeTTYs&&o.initializeTTYs(),"b"!=="ab".substr(-1)&&(String.prototype.substr=function(t){return function(e,n){return e<0&&(e=this.length+e),t.call(this,e,n)}}(String.prototype.substr)),"undefined"==typeof setImmediate){var Ao=Ee,Do=[],Po="zero-timeout-message",Co=function(){if("undefined"!=typeof Ao.importScripts||!Ao.postMessage)return!1;var t=!0,e=Ao.onmessage;return Ao.onmessage=function(){t=!1},Ao.postMessage("","*"),Ao.onmessage=e,t};if(Co()){Ao.setImmediate=function(t){Do.push(t),Ao.postMessage(Po,"*")};var Mo=function(t){if(t.source===self&&t.data===Po&&(t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,Do.length>0)){var e=Do.shift();return e()}};Ao.addEventListener?Ao.addEventListener("message",Mo,!0):Ao.attachEvent("onmessage",Mo)}else if(Ao.MessageChannel){var Uo=new Ao.MessageChannel;Uo.port1.onmessage=function(t){if(Do.length>0)return Do.shift()()},Ao.setImmediate=function(t){Do.push(t),Uo.port2.postMessage("")}}else Ao.setImmediate=function(t){return setTimeout(t,0)}}"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.length);var n=this;return t<0&&(t=this.length+t,t<0&&(t=0)),e<0&&(e=this.length+e,e<0&&(e=0)),e<t&&(e=t),new Uint8Array(n.buffer,n.byteOffset+t,e-t)})),e.install=le,e.registerFileSystem=de,e.BFSRequire=ye,e.initialize=ge,e.EmscriptenFS=Ue,e.FileSystem=xo}).call(e,function(){return this}(),n(7),n(37)(t),n(2))},function(t,e,n){(function(e){function r(t){return this instanceof r?(c.call(this,t),u.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(t)}function i(){this.allowHalfOpen||this._writableState.ended||e.nextTick(this.end.bind(this))}function o(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}t.exports=r;var s=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e},a=n(5);a.inherits=n(3);var c=n(14),u=n(11);a.inherits(r,c),o(s(u.prototype),function(t){r.prototype[t]||(r.prototype[t]=u.prototype[t])})}).call(e,n(2))},function(t,e,n){"use strict";function r(t){s[t]||("function"==typeof o[t]?s[t]=function(){return o[t].apply(o,arguments)}:s[t]=o[t])}var i=n(17),o=new i,s={};for(var a in o)r(a);s.initializeTTYs=function(){null===o.stdin&&(o.initializeTTYs(),s.stdin=o.stdin,s.stdout=o.stdout,s.stderr=o.stderr)},o.nextTick(function(){s.initializeTTYs()}),t.exports=s},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){(function(t){"use strict";function r(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}function i(e){if(K<e)throw new RangeError("Invalid typed array length");var n=new Uint8Array(e);return n.__proto__=t.prototype,n}function t(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return o(t,e,n)}function o(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?h(t,e,n):"string"==typeof t?u(t,e):p(t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e,n){return s(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}function c(t){return s(t),i(t<0?0:0|l(t))}function u(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(e,n),o=i(r),s=o.write(e,n);return s!==r&&(o=o.slice(0,s)),o}function f(t){for(var e=t.length<0?0:0|l(t.length),n=i(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),i.__proto__=t.prototype,i}function p(e){if(t.isBuffer(e)){var n=0|l(e.length),r=i(n);return 0===r.length?r:(e.copy(r,0,0,n),r)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||q(e.length)?i(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function l(t){if(t>=K)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K.toString(16)+" bytes");return 0|t}function d(e){return+e!=e&&(e=0),t.alloc(+e)}function y(e,n){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(n){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(i)return z(e).length;n=(""+n).toLowerCase(),i=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return N(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return F(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function v(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function w(e,n,r,i,o){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof n&&(n=t.from(n,i)),t.isBuffer(n))return 0===n.length?-1:m(e,n,r,i,o);if("number"==typeof n)return n=255&n,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,n,r):Uint8Array.prototype.lastIndexOf.call(e,n,r):m(e,[n],r,i,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=e.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}var u;if(i){var f=-1;for(u=n;u<a;u++)if(o(t,u)===o(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===c)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(n+c>a&&(n=a-c),u=n;u>=0;u--){for(var h=!0,p=0;p<c;p++)if(o(t,u+p)!==o(e,p)){h=!1;break}if(h)return u}return-1}function _(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function E(t,e,n,r){return Z(z(e,t.length-n),t,n,r)}function S(t,e,n,r){return Z(V(e),t,n,r)}function b(t,e,n,r){return S(t,e,n,r)}function k(t,e,n,r){return Z(H(e),t,n,r)}function I(t,e,n,r){return Z(W(e,t.length-n),t,n,r)}function F(t,e,n){return 0===e&&n===t.length?Y.fromByteArray(t):Y.fromByteArray(t.slice(e,n))}function N(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=n){var c,u,f,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[i+1],128===(192&c)&&(h=(31&o)<<6|63&c,h>127&&(s=h));break;case 3:c=t[i+1],u=t[i+2],128===(192&c)&&128===(192&u)&&(h=(15&o)<<12|(63&c)<<6|63&u,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128===(192&c)&&128===(192&u)&&128===(192&f)&&(h=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return O(r)}function O(t){var e=t.length;if(e<=J)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=J));return n}function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function L(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function R(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=j(t[o]);return i}function x(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function A(t,e,n){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,n,r,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>o||n<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function P(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function C(t,e,n,r,i){return e=+e,n>>>=0,i||P(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,n,r,23,4),n+4}function M(t,e,n,r,i){return e=+e,n>>>=0,i||P(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,n,r,52,8),n+8}function U(t){if(t=B(t).replace(G,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function B(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function W(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function H(t){return Y.toByteArray(U(t))}function Z(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function q(t){return t!==t}var Y=n(16),X=n(19);e.Buffer=t,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50;var K=2147483647;e.kMaxLength=K,t.TYPED_ARRAY_SUPPORT=r(),t.TYPED_ARRAY_SUPPORT||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use v4.x if you require old browser support."),t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(t,e,n){return o(t,e,n)},t.alloc=function(t,e,n){return a(t,e,n)},t.allocUnsafe=function(t){return c(t)},t.allocUnsafeSlow=function(t){return c(t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var r=e.length,i=n.length,o=0,s=Math.min(r,i);o<s;++o)if(e[o]!==n[o]){r=e[o],i=n[o];break}return r<i?-1:i<r?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,n){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var r;if(void 0===n)for(n=0,r=0;r<e.length;++r)n+=e[r].length;var i=t.allocUnsafe(n),o=0;for(r=0;r<e.length;++r){var s=e[r];if(!t.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i},t.byteLength=y,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},t.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?N(this,0,t):g.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e,n,r,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=r-n,c=Math.min(s,a),u=this.slice(i,o),f=e.slice(n,r),h=0;h<c;++h)if(u[h]!==f[h]){s=u[h],a=f[h];break}return s<a?-1:a<s?1:0},t.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},t.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},t.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},t.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return S(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return k(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;t.prototype.slice=function(e,n){var r=this.length;e=~~e,n=void 0===n?r:~~n,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<e&&(n=e);var i=this.subarray(e,n);return i.__proto__=t.prototype,i},t.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||A(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},t.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||A(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},t.prototype.readUInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||A(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},t.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||A(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){t>>>=0,e||A(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){t>>>=0,e||A(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return t>>>=0,e||A(t,4,this.length),X.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return t>>>=0,e||A(t,4,this.length),X.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return t>>>=0,e||A(t,8,this.length),X.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return t>>>=0,e||A(t,8,this.length),X.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;D(this,t,e,n,i,0)}var o=1,s=0;for(this[e]=255&t;++s<n&&(o*=256);)this[e+s]=t/o&255;return e+n},t.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;D(this,t,e,n,i,0)}var o=n-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+n},t.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,255,0),this[e]=255&t,e+1},t.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},t.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},t.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},t.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},t.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},t.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},t.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},t.prototype.fill=function(e,n,r,i){if("string"==typeof e){if("string"==typeof n?(i=n,n=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e=255&e);if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=n;s<r;++s)this[s]=e;else{var a=t.isBuffer(e)?e:z(new t(e,i).toString()),c=a.length;for(s=0;s<r-n;++s)this[s+n]=a[s%c]}return this};var G=/[^+\/0-9A-Za-z-_]/g}).call(e,n(7))},function(t,e,n){(function(t){function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===g(t)}function r(t){return"boolean"==typeof t}function i(t){return null===t}function o(t){return null==t}function s(t){return"number"==typeof t}function a(t){return"string"==typeof t}function c(t){return"symbol"==typeof t}function u(t){return void 0===t}function f(t){return"[object RegExp]"===g(t)}function h(t){return"object"==typeof t&&null!==t}function p(t){return"[object Date]"===g(t)}function l(t){return"[object Error]"===g(t)||t instanceof Error}function d(t){return"function"==typeof t}function y(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function g(t){return Object.prototype.toString.call(t)}e.isArray=n,e.isBoolean=r,e.isNull=i,e.isNullOrUndefined=o,e.isNumber=s,e.isString=a,e.isSymbol=c,e.isUndefined=u,e.isRegExp=f,e.isObject=h,e.isDate=p,e.isError=l,e.isFunction=d,e.isPrimitive=y,e.isBuffer=t.isBuffer}).call(e,n(7))},function(t,e,n){function r(){i.call(this)}t.exports=r;var i=n(9).EventEmitter,o=n(3);o(r,i),r.Readable=n(34),r.Writable=n(36),r.Duplex=n(32),r.Transform=n(35),r.PassThrough=n(33),r.Stream=r,r.prototype.pipe=function(t,e){function n(e){t.writable&&!1===t.write(e)&&u.pause&&u.pause()}function r(){u.readable&&u.resume&&u.resume()}function o(){f||(f=!0,t.end())}function s(){f||(f=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){u.removeListener("data",n),t.removeListener("drain",r),u.removeListener("end",o),u.removeListener("close",s),u.removeListener("error",a),t.removeListener("error",a),u.removeListener("end",c),u.removeListener("close",c),t.removeListener("close",c)}var u=this;u.on("data",n),t.on("drain",r),t._isStdio||e&&e.end===!1||(u.on("end",o),u.on("close",s));var f=!1;return u.on("error",a),t.on("error",a),u.on("end",c),u.on("close",c),t.on("close",c),t.emit("pipe",u),t}},function(t,e,n){t.exports=n(4).Buffer},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+r),i);for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,s;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(s=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],s.set(o,i),i+=o.length;return s}},i={arraySet:function(t,e,n,r,i){for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(n)},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,a,c,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var f=new Error('Uncaught, unspecified "error" event. ('+e+")");throw f.context=e,f}if(n=this._events[t],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),u=n.slice(),i=u.length,c=0;c<i;c++)u[c].apply(this,a);return!0},n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],s=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){function r(t,e){this.afterTransform=function(t,n){return i(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,c.isNullOrUndefined(n)||t.push(n),i&&i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}function o(t){if(!(this instanceof o))return new o(t);a.call(this,t),this._transformState=new r(t,this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){c.isFunction(this._flush)?this._flush(function(t){s(e,t)}):s(e)})}function s(t,e){if(e)return t.emit("error",e);var n=t._writableState,r=t._transformState;if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return t.push(null)}t.exports=o;var a=n(1),c=n(5);c.inherits=n(3),c.inherits(o,a),o.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},o.prototype._transform=function(t,e,n){throw new Error("not implemented")},o.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(t){var e=this._transformState;c.isNull(e.writechunk)||!e.writecb||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))}},function(t,e,n){(function(e){function r(t,e,n){this.chunk=t,this.encoding=e,this.callback=n}function i(t,e){var r=n(1);t=t||{};var i=t.highWaterMark,o=t.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.objectMode=!!t.objectMode,e instanceof r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=t.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){l(e,t)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function o(t){var e=n(1);return this instanceof o||this instanceof e?(this._writableState=new i(t,this),this.writable=!0,void b.call(this)):new o(t)}function s(t,n,r){var i=new Error("write after end");t.emit("error",i),e.nextTick(function(){r(i)})}function a(t,n,r,i){var o=!0;if(!(S.isBuffer(r)||S.isString(r)||S.isNullOrUndefined(r)||n.objectMode)){var s=new TypeError("Invalid non-string/buffer chunk");t.emit("error",s),e.nextTick(function(){i(s)}),o=!1}return o}function c(t,e,n){return!t.objectMode&&t.decodeStrings!==!1&&S.isString(e)&&(e=new E(e,n)),e}function u(t,e,n,i,o){n=c(e,n,i),S.isBuffer(n)&&(i="buffer");var s=e.objectMode?1:n.length;e.length+=s;var a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked?e.buffer.push(new r(n,i,o)):f(t,e,!1,s,n,i,o),a}function f(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function h(t,n,r,i,o){r?e.nextTick(function(){n.pendingcb--,o(i)}):(n.pendingcb--,o(i)),t._writableState.errorEmitted=!0,t.emit("error",i)}function p(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function l(t,n){var r=t._writableState,i=r.sync,o=r.writecb;if(p(r),n)h(t,r,i,n,o);else{var s=v(t,r);s||r.corked||r.bufferProcessing||!r.buffer.length||g(t,r),i?e.nextTick(function(){d(t,r,s,o)}):d(t,r,s,o)}}function d(t,e,n,r){n||y(t,e),e.pendingcb--,r(),m(t,e)}function y(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function g(t,e){if(e.bufferProcessing=!0,t._writev&&e.buffer.length>1){for(var n=[],r=0;r<e.buffer.length;r++)n.push(e.buffer[r].callback);e.pendingcb++,f(t,e,!0,e.length,e.buffer,"",function(t){for(var r=0;r<n.length;r++)e.pendingcb--,n[r](t)}),e.buffer=[]}else{for(var r=0;r<e.buffer.length;r++){var i=e.buffer[r],o=i.chunk,s=i.encoding,a=i.callback,c=e.objectMode?1:o.length;if(f(t,e,!1,c,o,s,a),e.writing){r++;break}}r<e.buffer.length?e.buffer=e.buffer.slice(r):e.buffer.length=0}e.bufferProcessing=!1}function v(t,e){return e.ending&&0===e.length&&!e.finished&&!e.writing}function w(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function m(t,e){var n=v(t,e);return n&&(0===e.pendingcb?(w(t,e),e.finished=!0,t.emit("finish")):w(t,e)),n}function _(t,n,r){n.ending=!0,m(t,n),r&&(n.finished?e.nextTick(r):t.once("finish",r)),n.ended=!0}t.exports=o;var E=n(4).Buffer;o.WritableState=i;var S=n(5);S.inherits=n(3);var b=n(6);S.inherits(o,b),o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(t,e,n){var r=this._writableState,i=!1;return S.isFunction(e)&&(n=e,e=null),S.isBuffer(t)?e="buffer":e||(e=r.defaultEncoding),S.isFunction(n)||(n=function(){}),r.ended?s(this,r,n):a(this,r,t,n)&&(r.pendingcb++,i=u(this,r,t,e,n)),i},o.prototype.cork=function(){var t=this._writableState;t.corked++},o.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.buffer.length||g(this,t))},o.prototype._write=function(t,e,n){n(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(t,e,n){var r=this._writableState;S.isFunction(t)?(n=t,t=null,e=null):S.isFunction(e)&&(n=e,e=null),S.isNullOrUndefined(t)||this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||_(this,r,n)}}).call(e,n(2))},function(t,e,n){(function(e){"use strict";function n(t){var e=r.exec(t);return e.shift(),e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(){function t(){}return t.normalize=function(e){""===e&&(e=".");var n=e.charAt(0)===t.sep;e=t._removeDuplicateSeps(e);for(var r=e.split(t.sep),i=[],o=0;o<r.length;o++){var s=r[o];"."!==s&&(".."===s&&(n||!n&&i.length>0&&".."!==i[0])?i.pop():i.push(s))}if(!n&&i.length<2)switch(i.length){case 1:""===i[0]&&i.unshift(".");break;default:i.push(".")}return e=i.join(t.sep),n&&e.charAt(0)!==t.sep&&(e=t.sep+e),e},t.join=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];for(var r=[],i=0;i<e.length;i++){var o=e[i];if("string"!=typeof o)throw new TypeError("Invalid argument type to path.join: "+typeof o);""!==o&&r.push(o)}return t.normalize(r.join(t.sep))},t.resolve=function(){for(var n=[],r=0;r<arguments.length;r++)n[r-0]=arguments[r];for(var i=[],o=0;o<n.length;o++){var s=n[o];if("string"!=typeof s)throw new TypeError("Invalid argument type to path.join: "+typeof s);""!==s&&(s.charAt(0)===t.sep&&(i=[]),i.push(s))}var a=t.normalize(i.join(t.sep));if(a.length>1&&a.charAt(a.length-1)===t.sep)return a.substr(0,a.length-1);if(a.charAt(0)!==t.sep){"."!==a.charAt(0)||1!==a.length&&a.charAt(1)!==t.sep||(a=1===a.length?"":a.substr(2));var c=e.cwd();a=""!==a?this.normalize(c+("/"!==c?t.sep:"")+a):c}return a},t.relative=function(e,n){var r;e=t.resolve(e),n=t.resolve(n);var i=e.split(t.sep),o=n.split(t.sep);o.shift(),i.shift();var s=0,a=[];for(r=0;r<i.length;r++){var c=i[r];if(c!==o[r]){s=i.length-r;break}}a=o.slice(r),1===i.length&&""===i[0]&&(s=0),s>i.length&&(s=i.length);var u="";for(r=0;r<s;r++)u+="../";return u+=a.join(t.sep),u.length>1&&u.charAt(u.length-1)===t.sep&&(u=u.substr(0,u.length-1)),u},t.dirname=function(e){e=t._removeDuplicateSeps(e);var n=e.charAt(0)===t.sep,r=e.split(t.sep);return""===r.pop()&&r.length>0&&r.pop(),r.length>1||1===r.length&&!n?r.join(t.sep):n?t.sep:"."},t.basename=function(e,n){if(void 0===n&&(n=""),""===e)return e;e=t.normalize(e);var r=e.split(t.sep),i=r[r.length-1];if(""===i&&r.length>1)return r[r.length-2];if(n.length>0){var o=i.substr(i.length-n.length);if(o===n)return i.substr(0,i.length-n.length)}return i},t.extname=function(e){e=t.normalize(e);var n=e.split(t.sep);if(e=n.pop(),""===e&&n.length>0&&(e=n.pop()),".."===e)return"";var r=e.lastIndexOf(".");return r===-1||0===r?"":e.substr(r)},t.isAbsolute=function(e){return e.length>0&&e.charAt(0)===t.sep},t._makeLong=function(t){return t},t.parse=function(t){var e=n(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}},t.format=function(e){if(null===e||"object"!=typeof e)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);var n=e.root||"";if("string"!=typeof n)throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);var r=e.dir?e.dir+t.sep:"",i=e.base||"";return r+i},t._removeDuplicateSeps=function(t){return t=t.replace(this._replaceRegex,this.sep)},t.sep="/",t._replaceRegex=new RegExp("//+","g"),t.delimiter=":",t.posix=t,t.win32=t,t}();t.exports=i}).call(e,n(2))},function(t,e,n){function r(t){return this instanceof r?void i.call(this,t):new r(t)}t.exports=r;var i=n(10),o=n(5);o.inherits=n(3),o.inherits(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){(function(e){function r(t,e){var r=n(1);t=t||{};var i=t.highWaterMark,o=t.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,e instanceof r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(O||(O=n(15).StringDecoder),this.decoder=new O(t.encoding),this.encoding=t.encoding)}function i(t){n(1);return this instanceof i?(this._readableState=new r(t,this),this.readable=!0,void F.call(this)):new i(t)}function o(t,e,n,r,i){var o=u(e,n);if(o)t.emit("error",o);else if(N.isNullOrUndefined(n))e.reading=!1,e.ended||f(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!i){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else!e.decoder||i||r||(n=e.decoder.write(n)),i||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&h(t)),l(t,e);else i||(e.reading=!1);return s(e)}function s(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}function a(t){if(t>=L)t=L;else{t--;for(var e=1;e<32;e<<=1)t|=t>>e;t++}return t}function c(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||N.isNull(t)?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:t<=0?0:(t>e.highWaterMark&&(e.highWaterMark=a(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function u(t,e){var n=null;return N.isBuffer(e)||N.isString(e)||N.isNullOrUndefined(e)||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(t,e){if(e.decoder&&!e.ended){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,h(t)}function h(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(T("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(function(){p(t)}):p(t))}function p(t){T("emit readable"),t.emit("readable"),w(t)}function l(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(function(){d(t,n)}))}function d(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(T("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function y(t){return function(){var e=t._readableState;T("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&I.listenerCount(t,"data")&&(e.flowing=!0,w(t))}}function g(t,n){n.resumeScheduled||(n.resumeScheduled=!0,e.nextTick(function(){v(t,n)}))}function v(t,e){e.resumeScheduled=!1,t.emit("resume"),w(t),e.flowing&&!e.reading&&t.read(0)}function w(t){var e=t._readableState;if(T("flow",e.flowing),e.flowing)do var n=t.read();while(null!==n&&e.flowing)}function m(t,e){var n,r=e.buffer,i=e.length,o=!!e.decoder,s=!!e.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(s)n=r.shift();else if(!t||t>=i)n=o?r.join(""):k.concat(r,i),r.length=0;else if(t<r[0].length){var a=r[0];n=a.slice(0,t),r[0]=a.slice(t)}else if(t===r[0].length)n=r.shift();else{n=o?"":new k(t);for(var c=0,u=0,f=r.length;u<f&&c<t;u++){var a=r[0],h=Math.min(t-c,a.length);o?n+=a.slice(0,h):a.copy(n,c,0,h),h<a.length?r[0]=a.slice(h):r.shift(),c+=h}}return n}function _(t){var n=t._readableState;if(n.length>0)throw new Error("endReadable called on non-empty stream");n.endEmitted||(n.ended=!0,e.nextTick(function(){n.endEmitted||0!==n.length||(n.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function E(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}function S(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}t.exports=i;var b=n(31),k=n(4).Buffer;i.ReadableState=r;var I=n(9).EventEmitter;I.listenerCount||(I.listenerCount=function(t,e){return t.listeners(e).length});var F=n(6),N=n(5);N.inherits=n(3);var O,T=n(38);T=T&&T.debuglog?T.debuglog("stream"):function(){},N.inherits(i,F),i.prototype.push=function(t,e){var n=this._readableState;return N.isString(t)&&!n.objectMode&&(e=e||n.defaultEncoding,e!==n.encoding&&(t=new k(t,e),e="")),o(this,n,t,e,!1)},i.prototype.unshift=function(t){var e=this._readableState;return o(this,e,t,"",!0)},i.prototype.setEncoding=function(t){return O||(O=n(15).StringDecoder),this._readableState.decoder=new O(t),this._readableState.encoding=t,this};var L=8388608;i.prototype.read=function(t){T("read",t);var e=this._readableState,n=t;if((!N.isNumber(t)||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return T("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?_(this):h(this),null;if(t=c(t,e),0===t&&e.ended)return 0===e.length&&_(this),null;var r=e.needReadable;T("need readable",r),(0===e.length||e.length-t<e.highWaterMark)&&(r=!0,T("length less than watermark",r)),(e.ended||e.reading)&&(r=!1,T("reading or ended",r)),r&&(T("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),r&&!e.reading&&(t=c(n,e));var i;return i=t>0?m(t,e):null,N.isNull(i)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),n!==t&&e.ended&&0===e.length&&_(this),N.isNull(i)||this.emit("data",i),i},i.prototype._read=function(t){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(t,n){function r(t){T("onunpipe"),t===h&&o()}function i(){T("onend"),t.end()}function o(){T("cleanup"),t.removeListener("close",c),t.removeListener("finish",u),t.removeListener("drain",g),t.removeListener("error",a),t.removeListener("unpipe",r),h.removeListener("end",i),h.removeListener("end",o),h.removeListener("data",s),!p.awaitDrain||t._writableState&&!t._writableState.needDrain||g()}function s(e){T("ondata");var n=t.write(e);!1===n&&(T("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,h.pause())}function a(e){T("onerror",e),f(),t.removeListener("error",a),0===I.listenerCount(t,"error")&&t.emit("error",e)}function c(){t.removeListener("finish",u),f()}function u(){T("onfinish"),t.removeListener("close",c),f()}function f(){T("unpipe"),h.unpipe(t)}var h=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=t;break;case 1:p.pipes=[p.pipes,t];break;default:p.pipes.push(t)}p.pipesCount+=1,T("pipe count=%d opts=%j",p.pipesCount,n);var l=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,d=l?i:o;p.endEmitted?e.nextTick(d):h.once("end",d),t.on("unpipe",r);var g=y(h);return t.on("drain",g),h.on("data",s),t._events&&t._events.error?b(t._events.error)?t._events.error.unshift(a):t._events.error=[a,t._events.error]:t.on("error",a),t.once("close",c),t.once("finish",u),t.emit("pipe",h),p.flowing||(T("pipe resume"),h.resume()),t},i.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var i=S(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},i.prototype.on=function(t,n){var r=F.prototype.on.call(this,t,n);if("data"===t&&!1!==this._readableState.flowing&&this.resume(),"readable"===t&&this.readable){var i=this._readableState;if(!i.readableListening)if(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading)i.length&&h(this,i);else{var o=this;e.nextTick(function(){T("readable nexttick read 0"),o.read(0)})}}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var t=this._readableState;return t.flowing||(T("resume"),t.flowing=!0,t.reading||(T("resume read 0"),this.read(0)),g(this,t)),this},i.prototype.pause=function(){return T("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(T("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;t.on("end",function(){if(T("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){if(T("wrapped data"),e.decoder&&(i=e.decoder.write(i)),i&&(e.objectMode||i.length)){var o=r.push(i);o||(n=!0,t.pause())}});for(var i in t)N.isFunction(t[i])&&N.isUndefined(this[i])&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return E(o,function(e){t.on(e,r.emit.bind(r,e))}),r._read=function(e){T("wrapped _read",e),n&&(n=!1,t.resume())},r},i._fromList=m}).call(e,n(2))},function(t,e,n){function r(t){if(t&&!c(t))throw new Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function o(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function s(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var a=n(4).Buffer,c=a.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},u=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),r(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";t=t.slice(n,t.length),e=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=e.charCodeAt(e.length-1);if(!(r>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,r=e.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},function(t,e){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function r(t){return 3*t.length/4-n(t)}function i(t){var e,r,i,o,s,a,c=t.length;s=n(t),a=new f(3*c/4-s),i=s>0?c-4:c;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)o=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[h++]=o>>16&255,a[h++]=o>>8&255,a[h++]=255&o;return 2===s?(o=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[h++]=255&o):1===s&&(o=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[h++]=o>>8&255,a[h++]=255&o),a}function o(t){return c[t>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}function s(t,e,n){for(var r,i=[],s=e;s<n;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],i.push(o(r));return i.join("")}function a(t){for(var e,n=t.length,r=n%3,i="",o=[],a=16383,u=0,f=n-r;u<f;u+=a)o.push(s(t,u,u+a>f?f:u+a));return 1===r?(e=t[n-1],i+=c[e>>2],i+=c[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=c[e>>10],i+=c[e>>4&63],i+=c[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=r,e.toByteArray=i,e.fromByteArray=a;for(var c=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,l=h.length;p<l;++p)c[p]=h[p],u[h.charCodeAt(p)]=p;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,e,n){(function(e){"use strict";var r=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},i=n(9),o=null,s=function(){function t(t,e){this.fun=t,this.array=e}return t.prototype.run=function(){this.fun.apply(null,this.array)},t}(),a=function(){function t(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return t.prototype.push=function(t){var e=this;1!==this._queue.push(t)||this._draining||setTimeout(function(){return e._drainQueue()},0)},t.prototype._cleanUpNextTick=function(){this._draining=!1,this._currentQueue&&this._currentQueue.length?this._queue=this._currentQueue.concat(this._queue):this._queueIndex=-1,this._queue.length&&this._drainQueue()},t.prototype._drainQueue=function(){var t=this;if(!this._draining){var e=setTimeout(function(){return t._cleanUpNextTick()});this._draining=!0;for(var n=this._queue.length;n;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex<n;)this._currentQueue&&this._currentQueue[this._queueIndex].run();this._queueIndex=-1,n=this._queue.length}this._currentQueue=null,this._draining=!1,clearTimeout(e)}},t}(),c=function(t){function i(){t.apply(this,arguments),this.startTime=Date.now(),this._cwd="/",this.platform="browser",this.argv=[],this.execArgv=[],this.stdout=null,this.stderr=null,this.stdin=null,this.domain=null,this._queue=new a,this.execPath=e,this.env={},this.exitCode=0,this._gid=1,this._uid=1,this.version="v5.0",this.versions={http_parser:"0.0",node:"5.0",v8:"0.0",uv:"0.0",zlib:"0.0",ares:"0.0",icu:"0.0",modules:"0",openssl:"0.0"},this.config={target_defaults:{cflags:[],default_configuration:"Release",defines:[],include_dirs:[],libraries:[]},variables:{clang:0,host_arch:"x32",node_install_npm:!1,node_install_waf:!1,node_prefix:"",node_shared_cares:!1,node_shared_http_parser:!1,node_shared_libuv:!1,node_shared_zlib:!1,node_shared_v8:!1,node_use_dtrace:!1,node_use_etw:!1,node_use_openssl:!1,node_shared_openssl:!1,strict_aliasing:!1,target_arch:"x32",v8_use_snapshot:!1,v8_no_strict_aliasing:0,visibility:""}},this.pid=1e3*Math.random()|0,this.title="node",this.arch="x32",this._mask=18,this.connected=void 0}return r(i,t),i.prototype.chdir=function(t){null===o&&(o=n(12)),this._cwd=o.resolve(t)},i.prototype.cwd=function(){return this._cwd},i.prototype.uptime=function(){return(Date.now()-this.startTime)/1e3|0},i.prototype.nextTick=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this._queue.push(new s(t,e))},i.prototype.abort=function(){this.emit("abort")},i.prototype.exit=function(t){this.exitCode=t,this.emit("exit",[t])},i.prototype.getgid=function(){return this._gid},i.prototype.setgid=function(t){"number"==typeof t?this._gid=t:this._gid=1},i.prototype.getuid=function(){return this._uid},i.prototype.setuid=function(t){"number"==typeof t?this._uid=t:this._uid=1},i.prototype.kill=function(t,e){this.emit("kill",[t,e])},i.prototype.memoryUsage=function(){return{rss:0,heapTotal:0,heapUsed:0}},i.prototype.umask=function(t){void 0===t&&(t=this._mask);var e=this._mask;return this._mask=t,this.emit("umask",[t]),e},i.prototype.hrtime=function(){var t;t="undefined"!=typeof performance?performance.now():Date.now?Date.now():(new Date).getTime();var e=t/1e3|0;return t-=1e3*e,t=1e6*t|0,[e,t]},i.prototype.initializeTTYs=function(){if(null===this.stdout){var t=n(18);this.stdout=new t,this.stderr=new t,this.stdin=new t}},i.prototype.disconnect=function(){},i}(i.EventEmitter);t.exports=c}).call(e,"/")},function(t,e,n){(function(e){"use strict";var r=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},i=n(6),o=function(t){function n(){t.call(this),this.isRaw=!1,this.columns=80,this.rows=120,this.isTTY=!0,this._bufferedWrites=[],this._waitingForWrites=!1}return r(n,t),n.prototype.setRawMode=function(t){this.isRaw!==t&&(this.isRaw=t,this.emit("modeChange"))},n.prototype.changeColumns=function(t){t!==this.columns&&(this.columns=t,this.emit("resize"))},n.prototype.changeRows=function(t){t!==this.rows&&(this.rows=t,this.emit("resize"))},n.isatty=function(t){return t&&t instanceof n},n.prototype._write=function(t,n,r){var i;try{var o;o="string"==typeof t?new e(t,n):t,this._bufferedWrites.push(o),this._waitingForWrites&&this._read(1024)}catch(s){i=s}finally{r(i)}},n.prototype._read=function(t){if(0===this._bufferedWrites.length)this._waitingForWrites=!0;else for(;this._bufferedWrites.length>0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},n}(i.Duplex);t.exports=o}).call(e,n(7))},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,f=-7,h=n?i-1:0,p=n?-1:1,l=t[e+h];for(h+=p,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=p,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:(l?-1:1)*(1/0);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,h=f>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),e+=s+h>=1?p/c:p*Math.pow(2,1-h),e*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+l]=255&s,l+=d,s/=256,u-=8);t[n+l-d]|=128*y}},function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var n=s.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(f[n]);this.header=new p,s.inflateGetHeader(this.strm,this.header)}function i(t,e){var n=new r(e);if(n.push(t,!0),n.err)throw n.msg;return n.result}function o(t,e){return e=e||{},e.raw=!0,i(t,e)}var s=n(27),a=n(8),c=n(21),u=n(23),f=n(29),h=n(30),p=n(25),l=Object.prototype.toString;r.prototype.push=function(t,e){var n,r,i,o,f,h,p=this.strm,d=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;r=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?p.input=c.binstring2buf(t):"[object ArrayBuffer]"===l.call(t)?p.input=new Uint8Array(t):p.input=t,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new a.Buf8(d),p.next_out=0,p.avail_out=d),n=s.inflate(p,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&y&&(h="string"==typeof y?c.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,n=s.inflateSetDictionary(this.strm,h)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&n!==u.Z_STREAM_END&&(0!==p.avail_in||r!==u.Z_FINISH&&r!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(i=c.utf8border(p.output,p.next_out),o=p.next_out-i,f=c.buf2string(p.output,i),p.next_out=o,p.avail_out=d-o,o&&a.arraySet(p.output,p.output,i,o,0),this.onData(f)):this.onData(a.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((p.avail_in>0||0===p.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(r=u.Z_FINISH),r===u.Z_FINISH?(n=s.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):r!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),p.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=i,e.inflateRaw=o,e.ungzip=i},function(t,e,n){"use strict";function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var n="",r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n}var i=n(8),o=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(a){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(a){s=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;c[254]=c[254]=1,e.string2buf=function(t){var e,n,r,o,s,a=t.length,c=0;for(o=0;o<a;o++)n=t.charCodeAt(o),55296===(64512&n)&&o+1<a&&(r=t.charCodeAt(o+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),c+=n<128?1:n<2048?2:n<65536?3:4;for(e=new i.Buf8(c),s=0,o=0;s<c;o++)n=t.charCodeAt(o),55296===(64512&n)&&o+1<a&&(r=t.charCodeAt(o+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),n=0,r=e.length;n<r;n++)e[n]=t.charCodeAt(n);return e},e.buf2string=function(t,e){var n,i,o,s,a=e||t.length,u=new Array(2*a);for(i=0,n=0;n<a;)if(o=t[n++],o<128)u[i++]=o;else if(s=c[o],s>4)u[i++]=65533,n+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&n<a;)o=o<<6|63&t[n++],s--;s>1?u[i++]=65533:o<65536?u[i++]=o:(o-=65536,u[i++]=55296|o>>10&1023,u[i++]=56320|1023&o)}return r(u,i)},e.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+c[t[n]]>e?n:e}},function(t,e){"use strict";function n(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0}t.exports=n},function(t,e){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e){"use strict";function n(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function r(t,e,n,r){var o=i,s=r+n;t^=-1;for(var a=r;a<s;a++)t=t>>>8^o[255&(t^e[a])];return t^-1}var i=n();t.exports=r},function(t,e){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=n},function(t,e){"use strict";var n=30,r=12;t.exports=function(t,e){var i,o,s,a,c,u,f,h,p,l,d,y,g,v,w,m,_,E,S,b,k,I,F,N,O;i=t.state,o=t.next_in,N=t.input,s=o+(t.avail_in-5),a=t.next_out,O=t.output,c=a-(e-t.avail_out),u=a+(t.avail_out-257),f=i.dmax,h=i.wsize,p=i.whave,l=i.wnext,d=i.window,y=i.hold,g=i.bits,v=i.lencode,w=i.distcode,m=(1<<i.lenbits)-1,_=(1<<i.distbits)-1;t:do{g<15&&(y+=N[o++]<<g,g+=8,y+=N[o++]<<g,g+=8),E=v[y&m];e:for(;;){if(S=E>>>24,y>>>=S,g-=S,S=E>>>16&255,0===S)O[a++]=65535&E;else{if(!(16&S)){if(0===(64&S)){E=v[(65535&E)+(y&(1<<S)-1)];continue e}if(32&S){i.mode=r;break t}t.msg="invalid literal/length code",i.mode=n;break t}b=65535&E,S&=15,S&&(g<S&&(y+=N[o++]<<g,g+=8),b+=y&(1<<S)-1,y>>>=S,g-=S),g<15&&(y+=N[o++]<<g,g+=8,y+=N[o++]<<g,g+=8),E=w[y&_];n:for(;;){if(S=E>>>24,y>>>=S,g-=S,S=E>>>16&255,!(16&S)){if(0===(64&S)){E=w[(65535&E)+(y&(1<<S)-1)];continue n}t.msg="invalid distance code",i.mode=n;break t}if(k=65535&E,S&=15,g<S&&(y+=N[o++]<<g,g+=8,g<S&&(y+=N[o++]<<g,g+=8)),k+=y&(1<<S)-1,k>f){t.msg="invalid distance too far back",i.mode=n;break t}if(y>>>=S,g-=S,S=a-c,k>S){if(S=k-S,S>p&&i.sane){t.msg="invalid distance too far back",i.mode=n;break t}if(I=0,F=d,0===l){if(I+=h-S,S<b){b-=S;do O[a++]=d[I++];while(--S);I=a-k,F=O}}else if(l<S){if(I+=h+l-S,S-=l,S<b){b-=S;do O[a++]=d[I++];while(--S);if(I=0,l<b){S=l,b-=S;do O[a++]=d[I++];while(--S);I=a-k,F=O}}}else if(I+=l-S,S<b){b-=S;do O[a++]=d[I++];while(--S);I=a-k,F=O}for(;b>2;)O[a++]=F[I++],O[a++]=F[I++],O[a++]=F[I++],b-=3;b&&(O[a++]=F[I++],b>1&&(O[a++]=F[I++]))}else{I=a-k;do O[a++]=O[I++],O[a++]=O[I++],O[a++]=O[I++],b-=3;while(b>2);b&&(O[a++]=O[I++],b>1&&(O[a++]=O[I++]))}break}}break}}while(o<s&&a<u);b=g>>3,o-=b,g-=b<<3,y&=(1<<g)-1,t.next_in=o,t.next_out=a,t.avail_in=o<s?5+(s-o):5-(o-s),t.avail_out=a<u?257+(u-a):257-(a-u),i.hold=y,i.bits=g}},function(t,e,n){"use strict";function r(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new w.Buf16(320),this.work=new w.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=M,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new w.Buf32(yt),e.distcode=e.distdyn=new w.Buf32(gt),e.sane=1,e.back=-1,T):x}function s(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,o(t)):x}function a(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,s(t))):x}function c(t,e){var n,r;return t?(r=new i,t.state=r,r.window=null,n=a(t,e),n!==T&&(t.state=null),n):x}function u(t){return c(t,wt)}function f(t){if(mt){var e;for(g=new w.Buf32(512),v=new w.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(S(k,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;S(I,t.lens,0,32,v,0,t.work,{bits:5}),mt=!1}t.lencode=g,t.lenbits=9,t.distcode=v,t.distbits=5}function h(t,e,n,r){var i,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new w.Buf8(o.wsize)),r>=o.wsize?(w.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),w.arraySet(o.window,e,n-r,i,o.wnext),r-=i,r?(w.arraySet(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function p(t,e){var n,i,o,s,a,c,u,p,l,d,y,g,v,yt,gt,vt,wt,mt,_t,Et,St,bt,kt,It,Ft=0,Nt=new w.Buf8(4),Ot=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return x;n=t.state,n.mode===X&&(n.mode=K),a=t.next_out,o=t.output,u=t.avail_out,s=t.next_in,i=t.input,c=t.avail_in,p=n.hold,l=n.bits,d=c,y=u,bt=T;t:for(;;)switch(n.mode){case M:if(0===n.wrap){n.mode=K;break}for(;l<16;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(2&n.wrap&&35615===p){n.check=0,Nt[0]=255&p,Nt[1]=p>>>8&255,n.check=_(n.check,Nt,2,0),p=0,l=0,n.mode=U;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&p)<<8)+(p>>8))%31){t.msg="incorrect header check",n.mode=pt;break}if((15&p)!==C){t.msg="unknown compression method",n.mode=pt;break}if(p>>>=4,l-=4,St=(15&p)+8,0===n.wbits)n.wbits=St;else if(St>n.wbits){t.msg="invalid window size",n.mode=pt;break}n.dmax=1<<St,t.adler=n.check=1,n.mode=512&p?q:X,p=0,l=0;break;case U:for(;l<16;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(n.flags=p,(255&n.flags)!==C){t.msg="unknown compression method",n.mode=pt;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=pt;break}n.head&&(n.head.text=p>>8&1),512&n.flags&&(Nt[0]=255&p,Nt[1]=p>>>8&255,n.check=_(n.check,Nt,2,0)),p=0,l=0,n.mode=B;case B:for(;l<32;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.head&&(n.head.time=p),512&n.flags&&(Nt[0]=255&p,Nt[1]=p>>>8&255,Nt[2]=p>>>16&255,Nt[3]=p>>>24&255,n.check=_(n.check,Nt,4,0)),p=0,l=0,n.mode=j;case j:for(;l<16;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.head&&(n.head.xflags=255&p,n.head.os=p>>8),512&n.flags&&(Nt[0]=255&p,Nt[1]=p>>>8&255,n.check=_(n.check,Nt,2,0)),p=0,l=0,n.mode=z;case z:if(1024&n.flags){for(;l<16;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.length=p,n.head&&(n.head.extra_len=p),512&n.flags&&(Nt[0]=255&p,Nt[1]=p>>>8&255,n.check=_(n.check,Nt,2,0)),p=0,l=0}else n.head&&(n.head.extra=null);n.mode=V;case V:if(1024&n.flags&&(g=n.length,g>c&&(g=c),g&&(n.head&&(St=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),w.arraySet(n.head.extra,i,s,g,St)),512&n.flags&&(n.check=_(n.check,i,g,s)),c-=g,s+=g,n.length-=g),n.length))break t;n.length=0,n.mode=W;case W:if(2048&n.flags){if(0===c)break t;g=0;do St=i[s+g++],n.head&&St&&n.length<65536&&(n.head.name+=String.fromCharCode(St));while(St&&g<c);if(512&n.flags&&(n.check=_(n.check,i,g,s)),c-=g,s+=g,St)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=H;case H:if(4096&n.flags){if(0===c)break t;g=0;do St=i[s+g++],n.head&&St&&n.length<65536&&(n.head.comment+=String.fromCharCode(St));while(St&&g<c);if(512&n.flags&&(n.check=_(n.check,i,g,s)),c-=g,s+=g,St)break t}else n.head&&(n.head.comment=null);n.mode=Z;case Z:if(512&n.flags){for(;l<16;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(p!==(65535&n.check)){t.msg="header crc mismatch",n.mode=pt;break}p=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=X;break;case q:for(;l<32;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}t.adler=n.check=r(p),p=0,l=0,n.mode=Y;case Y:if(0===n.havedict)return t.next_out=a,t.avail_out=u,t.next_in=s,t.avail_in=c,n.hold=p,n.bits=l,R;t.adler=n.check=1,n.mode=X;case X:if(e===N||e===O)break t;case K:if(n.last){p>>>=7&l,l-=7&l,n.mode=ut;break}for(;l<3;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}switch(n.last=1&p,p>>>=1,l-=1,3&p){case 0:n.mode=J;break;case 1:if(f(n),n.mode=nt,e===O){p>>>=2,l-=2;break t}break;case 2:n.mode=$;break;case 3:t.msg="invalid block type",n.mode=pt}p>>>=2,l-=2;break;case J:for(p>>>=7&l,l-=7&l;l<32;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if((65535&p)!==(p>>>16^65535)){t.msg="invalid stored block lengths",n.mode=pt;break}if(n.length=65535&p,p=0,l=0,n.mode=G,e===O)break t;case G:n.mode=Q;case Q:if(g=n.length){if(g>c&&(g=c),g>u&&(g=u),0===g)break t;w.arraySet(o,i,s,g,a),c-=g,s+=g,u-=g,a+=g,n.length-=g;break}n.mode=X;break;case $:for(;l<14;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(n.nlen=(31&p)+257,p>>>=5,l-=5,n.ndist=(31&p)+1,p>>>=5,l-=5,n.ncode=(15&p)+4,p>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=pt;break}n.have=0,n.mode=tt;case tt:for(;n.have<n.ncode;){for(;l<3;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.lens[Ot[n.have++]]=7&p,p>>>=3,l-=3}for(;n.have<19;)n.lens[Ot[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},bt=S(b,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,bt){t.msg="invalid code lengths set",n.mode=pt;break}n.have=0,n.mode=et;case et:for(;n.have<n.nlen+n.ndist;){for(;Ft=n.lencode[p&(1<<n.lenbits)-1],gt=Ft>>>24,vt=Ft>>>16&255,wt=65535&Ft,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(wt<16)p>>>=gt,l-=gt,n.lens[n.have++]=wt;else{if(16===wt){for(It=gt+2;l<It;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(p>>>=gt,l-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=pt;break}St=n.lens[n.have-1],g=3+(3&p),p>>>=2,l-=2}else if(17===wt){for(It=gt+3;l<It;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}p>>>=gt,l-=gt,St=0,g=3+(7&p),p>>>=3,l-=3}else{for(It=gt+7;l<It;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}p>>>=gt,l-=gt,St=0,g=11+(127&p),p>>>=7,l-=7}if(n.have+g>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=pt;break}for(;g--;)n.lens[n.have++]=St}}if(n.mode===pt)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=pt;break}if(n.lenbits=9,kt={bits:n.lenbits},bt=S(k,n.lens,0,n.nlen,n.lencode,0,n.work,kt),n.lenbits=kt.bits,bt){t.msg="invalid literal/lengths set",n.mode=pt;break}if(n.distbits=6,n.distcode=n.distdyn,kt={bits:n.distbits},bt=S(I,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,kt),n.distbits=kt.bits,bt){t.msg="invalid distances set",n.mode=pt;break}if(n.mode=nt,e===O)break t;case nt:n.mode=rt;case rt:if(c>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=s,t.avail_in=c,n.hold=p,n.bits=l,E(t,y),a=t.next_out,o=t.output,u=t.avail_out,s=t.next_in,i=t.input,c=t.avail_in,p=n.hold,l=n.bits,n.mode===X&&(n.back=-1);break}for(n.back=0;Ft=n.lencode[p&(1<<n.lenbits)-1],gt=Ft>>>24,vt=Ft>>>16&255,wt=65535&Ft,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(vt&&0===(240&vt)){for(mt=gt,_t=vt,Et=wt;Ft=n.lencode[Et+((p&(1<<mt+_t)-1)>>mt)],gt=Ft>>>24,vt=Ft>>>16&255,wt=65535&Ft,!(mt+gt<=l);){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}p>>>=mt,l-=mt,n.back+=mt}if(p>>>=gt,l-=gt,n.back+=gt,n.length=wt,0===vt){n.mode=ct;break}if(32&vt){n.back=-1,n.mode=X;break}if(64&vt){t.msg="invalid literal/length code",n.mode=pt;break}n.extra=15&vt,n.mode=it;case it:if(n.extra){for(It=n.extra;l<It;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.length+=p&(1<<n.extra)-1,p>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ot;case ot:for(;Ft=n.distcode[p&(1<<n.distbits)-1],gt=Ft>>>24,vt=Ft>>>16&255,wt=65535&Ft,!(gt<=l);){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(0===(240&vt)){for(mt=gt,_t=vt,Et=wt;Ft=n.distcode[Et+((p&(1<<mt+_t)-1)>>mt)],gt=Ft>>>24,vt=Ft>>>16&255,wt=65535&Ft,!(mt+gt<=l);){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}p>>>=mt,l-=mt,n.back+=mt}if(p>>>=gt,l-=gt,n.back+=gt,64&vt){t.msg="invalid distance code",n.mode=pt;break}n.offset=wt,n.extra=15&vt,n.mode=st;case st:if(n.extra){for(It=n.extra;l<It;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}n.offset+=p&(1<<n.extra)-1,p>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=pt;break}n.mode=at;case at:if(0===u)break t;if(g=y-u,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=pt;break}g>n.wnext?(g-=n.wnext,v=n.wsize-g):v=n.wnext-g,g>n.length&&(g=n.length),yt=n.window}else yt=o,v=a-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do o[a++]=yt[v++];while(--g);0===n.length&&(n.mode=rt);break;case ct:if(0===u)break t;o[a++]=n.length,u--,n.mode=rt;break;case ut:if(n.wrap){for(;l<32;){if(0===c)break t;c--,p|=i[s++]<<l,l+=8}if(y-=u,t.total_out+=y,n.total+=y,y&&(t.adler=n.check=n.flags?_(n.check,o,y,a-y):m(n.check,o,y,a-y)),y=u,(n.flags?p:r(p))!==n.check){t.msg="incorrect data check",n.mode=pt;break}p=0,l=0}n.mode=ft;case ft:if(n.wrap&&n.flags){for(;l<32;){if(0===c)break t;c--,p+=i[s++]<<l,l+=8}if(p!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=pt;break}p=0,l=0}n.mode=ht;case ht:bt=L;break t;case pt:bt=A;break t;case lt:return D;case dt:default:return x}return t.next_out=a,t.avail_out=u,t.next_in=s,t.avail_in=c,n.hold=p,n.bits=l,(n.wsize||y!==t.avail_out&&n.mode<pt&&(n.mode<ut||e!==F))&&h(t,t.output,t.next_out,y-t.avail_out)?(n.mode=lt,D):(d-=t.avail_in,y-=t.avail_out,t.total_in+=d,t.total_out+=y,n.total+=y,n.wrap&&y&&(t.adler=n.check=n.flags?_(n.check,o,y,t.next_out-y):m(n.check,o,y,t.next_out-y)),t.data_type=n.bits+(n.last?64:0)+(n.mode===X?128:0)+(n.mode===nt||n.mode===G?256:0),(0===d&&0===y||e===F)&&bt===T&&(bt=P),bt)}function l(t){if(!t||!t.state)return x;var e=t.state;return e.window&&(e.window=null),t.state=null,T}function d(t,e){var n;return t&&t.state?(n=t.state,0===(2&n.wrap)?x:(n.head=e,e.done=!1,T)):x}function y(t,e){var n,r,i,o=e.length;return t&&t.state?(n=t.state,0!==n.wrap&&n.mode!==Y?x:n.mode===Y&&(r=1,r=m(r,e,o,0),r!==n.check)?A:(i=h(t,e,o,o))?(n.mode=lt,D):(n.havedict=1,T)):x}var g,v,w=n(8),m=n(22),_=n(24),E=n(26),S=n(28),b=0,k=1,I=2,F=4,N=5,O=6,T=0,L=1,R=2,x=-2,A=-3,D=-4,P=-5,C=8,M=1,U=2,B=3,j=4,z=5,V=6,W=7,H=8,Z=9,q=10,Y=11,X=12,K=13,J=14,G=15,Q=16,$=17,tt=18,et=19,nt=20,rt=21,it=22,ot=23,st=24,at=25,ct=26,ut=27,ft=28,ht=29,pt=30,lt=31,dt=32,yt=852,gt=592,vt=15,wt=vt,mt=!0;e.inflateReset=s,e.inflateReset2=a,e.inflateResetKeep=o,e.inflateInit=u,e.inflateInit2=c,e.inflate=p,e.inflateEnd=l,e.inflateGetHeader=d,e.inflateSetDictionary=y,e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,n){"use strict";var r=n(8),i=15,o=852,s=592,a=0,c=1,u=2,f=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,n,d,y,g,v,w){var m,_,E,S,b,k,I,F,N,O=w.bits,T=0,L=0,R=0,x=0,A=0,D=0,P=0,C=0,M=0,U=0,B=null,j=0,z=new r.Buf16(i+1),V=new r.Buf16(i+1),W=null,H=0;for(T=0;T<=i;T++)z[T]=0;for(L=0;L<d;L++)z[e[n+L]]++;for(A=O,x=i;x>=1&&0===z[x];x--);if(A>x&&(A=x),0===x)return y[g++]=20971520,y[g++]=20971520,w.bits=1,0;for(R=1;R<x&&0===z[R];R++);for(A<R&&(A=R),C=1,T=1;T<=i;T++)if(C<<=1,C-=z[T],C<0)return-1;if(C>0&&(t===a||1!==x))return-1;for(V[1]=0,T=1;T<i;T++)V[T+1]=V[T]+z[T];for(L=0;L<d;L++)0!==e[n+L]&&(v[V[e[n+L]]++]=L);if(t===a?(B=W=v,k=19):t===c?(B=f,j-=257,W=h,H-=257,k=256):(B=p,W=l,k=-1),U=0,L=0,T=R,b=g,D=A,P=0,E=-1,M=1<<A,S=M-1,t===c&&M>o||t===u&&M>s)return 1;for(var Z=0;;){Z++,I=T-P,v[L]<k?(F=0,N=v[L]):v[L]>k?(F=W[H+v[L]],N=B[j+v[L]]):(F=96,N=0),m=1<<T-P,_=1<<D,R=_;do _-=m,y[b+(U>>P)+_]=I<<24|F<<16|N|0;while(0!==_);for(m=1<<T-1;U&m;)m>>=1;if(0!==m?(U&=m-1,U+=m):U=0,L++,0===--z[T]){if(T===x)break;T=e[n+v[L]]}if(T>A&&(U&S)!==E){for(0===P&&(P=A),b+=R,D=T-P,C=1<<D;D+P<x&&(C-=z[D+P],!(C<=0));)D++,C<<=1;if(M+=1<<D,t===c&&M>o||t===u&&M>s)return 1;E=U&S,y[E]=A<<24|D<<16|b-g|0}}return 0!==U&&(y[b+U]=T-P<<24|64<<16|0),w.bits=A,0}},function(t,e){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=n},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e,n){t.exports=n(1)},function(t,e,n){t.exports=n(13)},function(t,e,n){(function(r){e=t.exports=n(14),e.Stream=n(6),e.Readable=e,e.Writable=n(11),e.Duplex=n(1),e.Transform=n(10),e.PassThrough=n(13),r.browser||"disable"!==r.env.READABLE_STREAM||(t.exports=n(6))}).call(e,n(2))},function(t,e,n){t.exports=n(10)},function(t,e,n){t.exports=n(11)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){}])});
var HOME_DIRECTORY = "/root/home/username/files/";
var rootZipFile = "WinAppRunnerSystem.zip";
var system_data = null;
var download_PathRoot = "/root";
var download_PathCurrent = "/root";
var upload_PathRoot = "/root";
var upload_PathCurrent = "/root";
var FILEDATA = null;
var FILENAME = null;
var flag_r = {isReadable:function(){return true;},isWriteable:function(){return false;},isTruncating:function(){return false;},isAppendable:function(){return false;},isSynchronous:function(){return false;},isExclusive:function(){return false;},pathExistsAction:function(){return 0;},pathNotExistsAction:function(){return 1;}};
function buildFileSystem(writableStorage)
{
var Buffer = BrowserFS.BFSRequire("buffer").Buffer;
var zipfs = new BrowserFS.FileSystem.ZipFS(new Buffer(new Uint8Array(parent.systemFileData)));
var homeAdapter = null;
if(parent.zipFileData!=null)
{
var additionalZipfs = new BrowserFS.FileSystem.ZipFS(new Buffer(new Uint8Array(parent.zipFileData)));
homeAdapter = new BrowserFS.FileSystem.FolderAdapter("/", additionalZipfs);
buildBrowserFileSystem(writableStorage, zipfs, homeAdapter);
}
else
{
var dirPrefixParentDir = parentDir(HOME_DIRECTORY);
dirPrefixParentDir = dirPrefixParentDir.substring(0, dirPrefixParentDir.length - 1);
homeAdapter = new BrowserFS.FileSystem.FolderAdapter(dirPrefixParentDir, zipfs);
buildBrowserFileSystem(writableStorage, zipfs, homeAdapter)
}
}
function buildBrowserFileSystem(writableStorage, zipfs, homeAdapter)
{
FS.createFolder(FS.root, "root", true, true);
var rootOverlay = new BrowserFS.FileSystem.OverlayFS(new BrowserFS.FileSystem.InMemory(), zipfs);
rootOverlay.initialize(function callback(e3)
{
homeAdapter.initialize(function callback(e)
{
var homeOverlay = new BrowserFS.FileSystem.OverlayFS(writableStorage, homeAdapter);
homeOverlay.initialize(function callback(e2)
{
postBuildFileSystem(rootOverlay, homeOverlay);
});
});
});
}
function postBuildFileSystem(rootFS, homeFS)
{
var dirPrefixWithoutEndSlash = HOME_DIRECTORY.substring(0, HOME_DIRECTORY.length - 1);
system_data = new BrowserFS.FileSystem.MountableFileSystem();
system_data.mount("/", rootFS);
system_data.mount(dirPrefixWithoutEndSlash, homeFS);
var BFS = new BrowserFS.EmscriptenFS();
BrowserFS.initialize(system_data);
FS.mount(BFS, {root: "/root"}, "/root");
}
function parentDir(childDir)
{
if(endsWith(childDir,"/"))
{
childDir = childDir.substring(0,childDir.length - 1);
}
return childDir.substring(0, childDir.lastIndexOf('/') + 1);
}
function endsWith(str, suffix)
{
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
var Module = {
logReadFiles : false,
preRun: [(function(){buildFileSystem(new BrowserFS.FileSystem.InMemory(),false)})],
arguments: ["-root","/root","-m","64","-w","/home/username/files/","/usr/bin/wine",parent.exeFilename],
postRun: [],
print: function(text){console.log(text);if(text.indexOf("Main exe initialization")>-1 && text.indexOf("failed")){parent.handleError();}},
printErr: function(text) {},
canvas: (function() {var canvas=document.getElementById("canvas");canvas.width=800;canvas.height=600;return canvas;})(),
setStatus: function(text) {},
totalDependencies: 0,
monitorRunDependencies: function(left) {}
};
function download_getFileList()
{
// GETTING THE SELECT LIST
var selectList = document.getElementsByClassName("gui_filedownload_select")[0];
// CLEARING THE SELECT LIST
selectList.innerHTML = "";
// GETTING THE CURRENT DOWNLOAD PATH
var pathToShow = download_PathCurrent;
// REMOVING THE ROOT FOLDER PATH REFERENCE
pathToShow = pathToShow.substr(5,pathToShow.length);
// CHECKING IF THERE ISN'T A PATH LEFT
if (pathToShow == "")
{
// SETTING THE ROOT PATH
pathToShow = "/";
}
// UPDATING THE CURRENT LOCATION IN THE FILE LIST DIALOG
document.getElementsByClassName("gui_filedownload_location_value")[0].innerHTML = pathToShow;
// SHOWING THE FILE LIST DIALOG AND HIDING THE FOLDER LIST DIALOG
document.getElementsByClassName("gui_fileupload_container")[0].style.display = "none";
document.getElementsByClassName("gui_filedownload_container")[0].style.display = "block";
try
{
// READING EVERY ITEM WITHIN THE PATH
system_data.readdir(download_PathCurrent, function(myItem, content)
{
// CHECKING IF THE ITEM IS A FOLDER
if (!myItem)
{
// SETTING THE VARIABLES THAT WILL BE STORING THE FOLDER NAMES AND FILE NAMES
var rawListFolders = [];
var rawListFiles = [];
// LOOPING THE CONTENT OF THE FOLDER
for(var i = 0; i < content.length; i++)
{
// CHECKING THE OBJECT TYPE
system_data.readdir(download_PathCurrent + "/" + content[i], function(myItem2, content2)
{
// CHECKING IF THE ITEM IS A FOLDER
if (!myItem2)
{
// ADDING ITEM TO THE FOLDER LIST
rawListFolders.push(content[i]);
}
else
{
// ADDING ITEM TO THE FILE LIST
rawListFiles.push(content[i]);
}
});
}
// CHECKING IF THE CURRENT PATH IS THE ROOT PATH
if (download_PathCurrent!=download_PathRoot)
{
// ADDING THE 'GO BACK TO THE PARENT FOLDER' ITEM
rawListFolders.push("..");
}
// SORTING THE FOLDERS
rawListFolders.sort(function(a,b){if(a.toLowerCase()<b.toLowerCase())return -1;if(a.toLowerCase()>b.toLowerCase())return 1;return 0;});
// SORTING THE FILES
rawListFiles.sort(function(a,b){if(a.toLowerCase()<b.toLowerCase())return -1;if(a.toLowerCase()>b.toLowerCase())return 1;return 0;});
// ADDING THE FOLDERS TO THE SELECT LIST
for(var i = 0; i < rawListFolders.length; i++)
{
var opt = "<div class='gui_filedownload_fileitem' onclick='download_checkContent(\"" + rawListFolders[i] + "\",true)'><span class='gui_filedownload_fileitem_name'><DIR> " + rawListFolders[i].toUpperCase() + "</span></div>";
selectList.innerHTML = selectList.innerHTML + opt;
}
// ADDING THE FILES TO THE SELECT LIST
for(var i = 0; i < rawListFiles.length; i++)
{
var opt = "<div class='gui_filedownload_fileitem' onclick='download_checkContent(\"" + rawListFiles[i] + "\",false)'><span class='gui_filedownload_fileitem_name'>" + rawListFiles[i].toUpperCase() + "</span></div>";
selectList.innerHTML = selectList.innerHTML + opt;
}
}
});
}
catch(err)
{
}
}
function download_HideFileList()
{
// SETTING THE DEFAULT PATH TO THE FILE DOWNLOAD DIALOG
download_PathCurrent = download_PathRoot;
// HIDING THE FILE DOWNLOAD DIALOG
document.getElementsByClassName("gui_filedownload_container")[0].style.display = "none";
}
function download_checkContent(selectedItemValue,isFolder)
{
try
{
// CHECKING IF IT IS A FOLDER
if (isFolder==true)
{
// CHECKING IF IT IS A 'GO BACK TO THE PARENT FOLDER' ITEM
if (selectedItemValue=="..")
{
// UPDATING THE CURRENT PATH WITH THE PARENT FOLDER
download_PathCurrent = download_PathCurrent.substr(0,download_PathCurrent.lastIndexOf("/"));
}
else
{
// UPDATING THE CURRENT PATH WITH THE SELECTED FOLDER
if (download_PathCurrent=="/")
{
download_PathCurrent = download_PathCurrent + selectedItemValue;
}
else
{
download_PathCurrent = download_PathCurrent + "/" + selectedItemValue;
}
}
// CALLING THE FUNCTION THAT GETS THE FILE LIST BUT WITH THE UPDATED PATH
download_getFileList();
}
else
{
// DOWNLOADING THE SELECTED FILE
download_Save(download_PathCurrent + "/" + selectedItemValue,selectedItemValue);
// HIDING THE FILE DOWNLOAD DIALOG
download_HideFileList();
}
}
catch(err)
{
}
}
function download_Save(filePath,filename)
{
try
{
// READING THE FILE THAT WILL BE DOWNLOADED
var rawReading = FS.readFile(filePath);
var fileAsArray = new Uint8Array(rawReading);
// DOWNLOADING THE FILE
download_Blob(fileAsArray, filename, "application/octet-stream");
}
catch(err)
{
}
}
function download_Blob(data, fileName, mimeType)
{
var blob, url;
blob = new Blob([data], {type: mimeType});
url = window.URL.createObjectURL(blob);
download_URL(url, fileName);
setTimeout(function()
{
return window.URL.revokeObjectURL(url);
}, 1000);
}
function download_URL(data, fileName)
{
var a;
a = document.createElement("a");
a.href = data;
a.download = fileName;
document.body.appendChild(a);
a.style = "display: none";
a.click();
a.remove();
}
function upload_getFile(files)
{
try
{
var filereader = new FileReader();
filereader.file_name = files[0].name;
filereader.onload = function()
{
// SETTING THE FILE CONTENT FOR THE EMULATOR
FILEDATA = this.result;
FILENAME = files[0].name;
// CLEARING THE SELECTED FILE VALUE
document.getElementById("gui_fileupload_uploader").value = null;
// GETTING THE SYSTEM FOLDER LIST IN ORDER TO DISPLAY THE FILE UPLOAD DIALOG
upload_getFolderList();
};
// READING THE SELECTED FILE
filereader.readAsArrayBuffer(files[0]);
}
catch(err)
{
}
}
function upload_getFolderList()
{
// GETTING THE SELECT LIST
var selectList = document.getElementsByClassName("gui_fileupload_select")[0];
// CLEARING THE FOLDER LIST
selectList.innerHTML = "";
// GETTING THE CURRENT UPLOAD PATH
var pathToShow = upload_PathCurrent;
// REMOVING THE ROOT FOLDER PATH REFERENCE
pathToShow = pathToShow.substr(5,pathToShow.length);
// CHECKING IF THERE ISN'T A PATH LEFT
if (pathToShow == "")
{
// SETTING THE ROOT PATH
pathToShow = "/";
}
// UPDATING THE CURRENT LOCATION IN THE FILE LIST DIALOG
document.getElementsByClassName("gui_fileupload_location_value")[0].innerHTML = pathToShow;
// SHOWING THE FOLDER LIST DIALOG AND HIDING THE FILE LIST DIALOG
document.getElementsByClassName("gui_fileupload_container")[0].style.display = "block";
document.getElementsByClassName("gui_filedownload_container")[0].style.display = "none";
try
{
// READING EVERY ITEM WITHIN THE PATH
system_data.readdir(upload_PathCurrent, function(myItem, content)
{
// CHECKING IF THE ITEM IS A FOLDER
if (!myItem)
{
// SETTING THE VARIABLES THAT WILL BE STORING THE FOLDER NAMES
var rawListFolders = [];
// LOOPING THE CONTENT OF THE FOLDER
for(var i = 0; i < content.length; i++)
{
// CHECKING THE OBJECT TYPE
system_data.readdir(upload_PathCurrent + "/" + content[i], function(myItem2, content2)
{
// CHECKING IF THE ITEM IS A FOLDER
if (!myItem2)
{
// ADDING ITEM TO THE FOLDER LIST
rawListFolders.push(content[i]);
}
});
}
// CHECKING IF THE CURRENT PATH IS THE ROOT PATH
if (upload_PathCurrent!=upload_PathRoot)
{
// ADDING THE 'GO BACK TO THE PARENT FOLDER' ITEM
rawListFolders.push("..");
}
// SORTING THE FOLDERS
rawListFolders.sort(function(a,b){if(a.toLowerCase()<b.toLowerCase())return -1;if(a.toLowerCase()>b.toLowerCase())return 1;return 0;});
// ADDING THE FOLDERS TO THE SELECT LIST
for(var i = 0; i < rawListFolders.length; i++)
{
var opt = "<div class='gui_fileupload_fileitem' onclick='upload_checkContent(\"" + rawListFolders[i] + "\",true)'><span class='gui_fileupload_fileitem_name'><DIR> " + rawListFolders[i].toUpperCase() + "</span></div>";
selectList.innerHTML = selectList.innerHTML + opt;
}
}
});
}
catch(err)
{
}
}
function upload_checkContent(selectedItemValue,isFolder)
{
try
{
// CHECKING IF IT IS A FOLDER
if (isFolder==true)
{
// CHECKING IF IT IS A 'GO BACK TO THE PARENT FOLDER' ITEM
if (selectedItemValue=="..")
{
// UPDATING THE CURRENT PATH WITH THE PARENT FOLDER
upload_PathCurrent = upload_PathCurrent.substr(0,upload_PathCurrent.lastIndexOf("/"));
}
else
{
// UPDATING THE CURRENT PATH WITH THE SELECTED FOLDER
upload_PathCurrent = upload_PathCurrent + "/" + selectedItemValue;
}
// CALLING THE FUNCTION THAT GETS THE FOLDER LIST BUT WITH THE UPDATED PATH
upload_getFolderList();
}
}
catch(err)
{
}
}
function upload_writeFile()
{
try
{
// WRITING THE UPLOADED FILE INTO THE FILE SYSTEM
var dataView = new Uint8Array(FILEDATA);
FS.createDataFile(upload_PathCurrent,FILENAME,dataView,true,true);
}
catch(err)
{
}
// HIDING THE FILE UPLOAD DIALOG
upload_HideFolderList();
}
function upload_ResetPath()
{
// SETTING THE DEFAULT PATH TO THE FILE UPLOAD DIALOG
upload_PathCurrent = upload_PathRoot;
// GETTING THE SYSTEM FILE LIST IN ORDER TO DISPLAY THE FILE UPLOAD DIALOG
upload_getFolderList();
}
function upload_HideFolderList()
{
// SETTING THE DEFAULT PATH TO THE FILE UPLOAD DIALOG
upload_PathCurrent = upload_PathRoot;
// HIDING THE FILE UPLOAD DIALOG
document.getElementsByClassName("gui_fileupload_container")[0].style.display = "none";
}
document.getElementsByClassName("gui_download")[0].addEventListener("click",function(event)
{
// SETTING THE DEFAULT PATH TO THE FILE DOWNLOAD DIALOG
download_PathCurrent = download_PathRoot;
// GETTING THE SYSTEM FILE LIST IN ORDER TO DISPLAY THE FILE DOWNLOAD DIALOG
download_getFileList();
});
document.getElementsByClassName("gui_upload")[0].addEventListener("click",function(event)
{
// CLICK THE FILE SELECTOR
document.getElementById("gui_fileupload_uploader").click();
});
var script = document.createElement("script");
script.src = "WinAppRunnerSystem.js";
document.body.appendChild(script);
</script>
</body>
</html>