-
Notifications
You must be signed in to change notification settings - Fork 0
/
c2runtime.js
772 lines (772 loc) · 394 KB
/
c2runtime.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
// Generated by Construct 3, the game and app creator :: https://www.construct.net
/*
localForage -- Offline Storage, Improved
Version 1.5.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/
'use strict';var cr=window.cr={};cr.plugins_={};cr.behaviors={};"function"!==typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===typeof"test".__proto__?function(b){return b.__proto__}:function(b){return b.constructor.prototype});
(function(){function b(f,r){this.x=f;this.y=r;cr.seal(this)}function l(f,r,J,M){this.set(f,r,J,M);cr.seal(this)}function w(){this.bly=this.blx=this.bry=this.brx=this.try_=this.trx=this.tly=this.tlx=0;cr.seal(this)}function D(f,r,J,M){f<r?J<M?(H=f<J?f:J,F=r>M?r:M):(H=f<M?f:M,F=r>J?r:J):J<M?(H=r<J?r:J,F=f>M?f:M):(H=r<M?r:M,F=f>J?f:J)}function O(){this.items=this.s=null;this.item_count=0;A&&(this.s=new Set);this.values_cache=[];this.cache_valid=!0;cr.seal(this)}function L(f){T[W++]=f}function k(){this.sum=
this.t=this.y=this.c=0;cr.seal(this)}function a(f,r){f||(f=[0,0,1,0,1,1,0,1]);this.pts_cache=[];this.bboxBottom=this.bboxRight=this.bboxTop=this.bboxLeft=0;this.convexpolys=null;this.enabled="undefined"===typeof r?!0:r;this.set_pts(f);cr.seal(this)}function d(f,r){this.cellwidth=f;this.cellheight=r;this.cells={}}function n(f,r){this.cellwidth=f;this.cellheight=r;this.cells={}}function C(f,r,J){d.prototype.totalCellCount++;if(c.length){var M=c.pop();M.grid=f;M.x=r;M.y=J;return M}return new cr.GridCell(f,
r,J)}function u(f,r,J){this.grid=f;this.x=r;this.y=J;this.objects=new cr.ObjectSet}function E(f,r,J){n.prototype.totalCellCount++;if(h.length){var M=h.pop();M.grid=f;M.x=r;M.y=J;return M}return new cr.RenderCell(f,r,J)}function N(f,r,J){this.grid=f;this.x=r;this.y=J;this.objects=[];this.is_sorted=!0;this.pending_removal=new cr.ObjectSet;this.any_pending_removal=!1}function z(f,r){return f.zindex-r.zindex}cr.logexport=function(f){window.console&&window.console.log&&window.console.log(f)};cr.logerror=
function(f){window.console&&window.console.error&&window.console.error(f)};cr.seal=function(f){return f};cr.freeze=function(f){return f};cr.is_undefined=function(f){return"undefined"===typeof f};cr.is_number=function(f){return"number"===typeof f};cr.is_string=function(f){return"string"===typeof f};cr.isPOT=function(f){return 0<f&&0===(f-1&f)};cr.nextHighestPowerOfTwo=function(f){--f;for(var r=1;32>r;r<<=1)f|=f>>r;return f+1};cr.abs=function(f){return 0>f?-f:f};cr.max=function(f,r){return f>r?f:r};
cr.min=function(f,r){return f<r?f:r};cr.PI=Math.PI;cr.round=function(f){return f+.5|0};cr.floor=function(f){return 0<=f?f|0:(f|0)-1};cr.ceil=function(f){var r=f|0;return r===f?r:r+1};b.prototype.offset=function(f,r){this.x+=f;this.y+=r;return this};b.prototype.mul=function(f,r){this.x*=f;this.y*=r;return this};cr.vector2=b;cr.segments_intersect=function(f,r,J,M,V,X,aa,Y){if(f<J){var ca=f;var R=J}else ca=J,R=f;if(V<aa){var e=V;var m=aa}else e=aa,m=V;if(R<e||ca>m)return!1;r<M?(ca=r,R=M):(ca=M,R=r);
X<Y?(e=X,m=Y):(e=Y,m=X);if(R<e||ca>m)return!1;R=V-f+aa-J;ca=X-r+Y-M;f=J-f;r=M-r;V=aa-V;X=Y-X;Y=cr.abs(r*V-X*f);return cr.abs(V*ca-X*R)>Y?!1:cr.abs(f*ca-r*R)<=Y};l.prototype.set=function(f,r,J,M){this.left=f;this.top=r;this.right=J;this.bottom=M};l.prototype.copy=function(f){this.left=f.left;this.top=f.top;this.right=f.right;this.bottom=f.bottom};l.prototype.width=function(){return this.right-this.left};l.prototype.height=function(){return this.bottom-this.top};l.prototype.offset=function(f,r){this.left+=
f;this.top+=r;this.right+=f;this.bottom+=r;return this};l.prototype.normalize=function(){if(this.left>this.right){var f=this.left;this.left=this.right;this.right=f}this.top>this.bottom&&(f=this.top,this.top=this.bottom,this.bottom=f)};l.prototype.intersects_rect=function(f){return!(f.right<this.left||f.bottom<this.top||f.left>this.right||f.top>this.bottom)};l.prototype.intersects_rect_off=function(f,r,J){return!(f.right+r<this.left||f.bottom+J<this.top||f.left+r>this.right||f.top+J>this.bottom)};
l.prototype.contains_pt=function(f,r){return f>=this.left&&f<=this.right&&r>=this.top&&r<=this.bottom};l.prototype.equals=function(f){return this.left===f.left&&this.top===f.top&&this.right===f.right&&this.bottom===f.bottom};cr.rect=l;w.prototype.set_from_rect=function(f){this.tlx=f.left;this.tly=f.top;this.trx=f.right;this.try_=f.top;this.brx=f.right;this.bry=f.bottom;this.blx=f.left;this.bly=f.bottom};w.prototype.set_from_rotated_rect=function(f,r){if(0===r)this.set_from_rect(f);else{var J=Math.sin(r),
M=Math.cos(r);r=f.left*J;var V=f.top*J,X=f.right*J;J*=f.bottom;var aa=f.left*M,Y=f.top*M,ca=f.right*M;f=f.bottom*M;this.tlx=aa-V;this.tly=Y+r;this.trx=ca-V;this.try_=Y+X;this.brx=ca-J;this.bry=f+X;this.blx=aa-J;this.bly=f+r}};w.prototype.offset=function(f,r){this.tlx+=f;this.tly+=r;this.trx+=f;this.try_+=r;this.brx+=f;this.bry+=r;this.blx+=f;this.bly+=r;return this};var H=0,F=0;w.prototype.bounding_box=function(f){D(this.tlx,this.trx,this.brx,this.blx);f.left=H;f.right=F;D(this.tly,this.try_,this.bry,
this.bly);f.top=H;f.bottom=F};w.prototype.contains_pt=function(f,r){var J=this.tlx,M=this.tly,V=this.trx-J,X=this.try_-M,aa=this.brx-J,Y=this.bry-M;f-=J;r-=M;var ca=V*V+X*X,R=V*aa+X*Y;X=V*f+X*r;var e=aa*aa+Y*Y,m=aa*f+Y*r,x=1/(ca*e-R*R);V=(e*X-R*m)*x;ca=(ca*m-R*X)*x;if(0<=V&&0<ca&&1>V+ca)return!0;V=this.blx-J;X=this.bly-M;ca=V*V+X*X;R=V*aa+X*Y;X=V*f+X*r;x=1/(ca*e-R*R);V=(e*X-R*m)*x;ca=(ca*m-R*X)*x;return 0<=V&&0<ca&&1>V+ca};w.prototype.at=function(f,r){if(r)switch(f){case 0:return this.tlx;case 1:return this.trx;
case 2:return this.brx;case 3:return this.blx;case 4:return this.tlx;default:return this.tlx}else switch(f){case 0:return this.tly;case 1:return this.try_;case 2:return this.bry;case 3:return this.bly;case 4:return this.tly;default:return this.tly}};w.prototype.midX=function(){return(this.tlx+this.trx+this.brx+this.blx)/4};w.prototype.midY=function(){return(this.tly+this.try_+this.bry+this.bly)/4};w.prototype.intersects_segment=function(f,r,J,M){if(this.contains_pt(f,r)||this.contains_pt(J,M))return!0;
var V;for(V=0;4>V;V++){var X=this.at(V,!0);var aa=this.at(V,!1);var Y=this.at(V+1,!0);var ca=this.at(V+1,!1);if(cr.segments_intersect(f,r,J,M,X,aa,Y,ca))return!0}return!1};w.prototype.intersects_quad=function(f){var r=f.midX(),J=f.midY();if(this.contains_pt(r,J))return!0;r=this.midX();J=this.midY();if(f.contains_pt(r,J))return!0;var M,V;for(M=0;4>M;M++)for(V=0;4>V;V++){r=this.at(M,!0);J=this.at(M,!1);var X=this.at(M+1,!0);var aa=this.at(M+1,!1);var Y=f.at(V,!0);var ca=f.at(V,!1);var R=f.at(V+1,!0);
var e=f.at(V+1,!1);if(cr.segments_intersect(r,J,X,aa,Y,ca,R,e))return!0}return!1};cr.quad=w;cr.RGB=function(f,r,J){return Math.max(Math.min(f,255),0)|Math.max(Math.min(r,255),0)<<8|Math.max(Math.min(J,255),0)<<16};cr.RGBAEx=function(f,r,J,M){f=cr.clamp(Math.floor(1024*f),-8192,8191);r=cr.clamp(Math.floor(1024*r),-8192,8191);J=cr.clamp(Math.floor(1024*J),-8192,8191);M=cr.clamp(Math.floor(1024*M),0,1024);0>f&&(f+=16384);0>r&&(r+=16384);0>J&&(J+=16384);return-(274877906944*f+16777216*r+1024*J+M)};cr.RGBEx=
function(f,r,J){return cr.RGBAEx(f,r,J,1)};cr.GetRValue=function(f){if(0<=f)return(f&255)/255;f=Math.floor(-f/274877906944);8191<f&&(f-=16384);return f/1024};cr.GetGValue=function(f){if(0<=f)return((f&65280)>>8)/255;f=Math.floor(-f%274877906944/16777216);8191<f&&(f-=16384);return f/1024};cr.GetBValue=function(f){if(0<=f)return((f&16711680)>>16)/255;f=Math.floor(-f%16777216/1024);8191<f&&(f-=16384);return f/1024};cr.GetAValue=function(f){return 0===f&&0>1/f?0:0<=f?1:Math.floor(-f%1024)/1024};cr.shallowCopy=
function(f,r,J){for(var M in r)r.hasOwnProperty(M)&&(f[M]=r[M]);return f};cr.arrayRemove=function(f,r){var J;r=cr.floor(r);if(!(0>r||r>=f.length)){for(J=f.length-1;r<J;r++)f[r]=f[r+1];cr.truncateArray(f,J)}};cr.truncateArray=function(f,r){f.length=r};cr.clearArray=function(f){cr.truncateArray(f,0)};cr.shallowAssignArray=function(f,r){cr.clearArray(f);var J;var M=0;for(J=r.length;M<J;++M)f[M]=r[M]};cr.appendArray=function(f,r){f.push.apply(f,r)};cr.fastIndexOf=function(f,r){var J;var M=0;for(J=f.length;M<
J;++M)if(f[M]===r)return M;return-1};cr.arrayFindRemove=function(f,r){r=cr.fastIndexOf(f,r);-1!==r&&cr.arrayRemove(f,r)};cr.clamp=function(f,r,J){return f<r?r:f>J?J:f};cr.to_radians=function(f){return f/(180/cr.PI)};cr.to_degrees=function(f){return 180/cr.PI*f};cr.clamp_angle_degrees=function(f){f%=360;0>f&&(f+=360);return f};cr.clamp_angle=function(f){f%=2*cr.PI;0>f&&(f+=2*cr.PI);return f};cr.to_clamped_degrees=function(f){return cr.clamp_angle_degrees(cr.to_degrees(f))};cr.to_clamped_radians=function(f){return cr.clamp_angle(cr.to_radians(f))};
cr.angleTo=function(f,r,J,M){return Math.atan2(M-r,J-f)};cr.angleDiff=function(f,r){if(f===r)return 0;f=Math.sin(f)*Math.sin(r)+Math.cos(f)*Math.cos(r);return 1<=f?0:-1>=f?cr.PI:Math.acos(f)};cr.angleRotate=function(f,r,J){var M=Math.sin(f),V=Math.cos(f),X=Math.sin(r),aa=Math.cos(r);return Math.acos(M*X+V*aa)>J?0<V*X-M*aa?cr.clamp_angle(f+J):cr.clamp_angle(f-J):cr.clamp_angle(r)};cr.angleClockwise=function(f,r){return 0>=Math.cos(f)*Math.sin(r)-Math.sin(f)*Math.cos(r)};cr.rotatePtAround=function(f,
r,J,M,V,X){if(0===J)return X?f:r;var aa=Math.sin(J);J=Math.cos(J);f-=M;r-=V;var Y=f*aa;f=f*J-r*aa;return X?f+M:r*J+Y+V};cr.distanceTo=function(f,r,J,M){f=J-f;r=M-r;return Math.sqrt(f*f+r*r)};cr.xor=function(f,r){return!f!==!r};cr.lerp=function(f,r,J){return f+(r-f)*J};cr.unlerp=function(f,r,J){return f===r?0:(J-f)/(r-f)};cr.anglelerp=function(f,r,J){var M=cr.angleDiff(f,r);return cr.angleClockwise(r,f)?f+M*J:f-M*J};cr.qarp=function(f,r,J,M){return cr.lerp(cr.lerp(f,r,M),cr.lerp(r,J,M),M)};cr.cubic=
function(f,r,J,M,V){return cr.lerp(cr.qarp(f,r,J,V),cr.qarp(r,J,M,V),V)};cr.cosp=function(f,r,J){return(f+r+(f-r)*Math.cos(J*Math.PI))/2};cr.hasAnyOwnProperty=function(f){for(var r in f)if(f.hasOwnProperty(r))return!0;return!1};cr.wipe=function(f){for(var r in f)f.hasOwnProperty(r)&&delete f[r]};var g=+new Date;cr.performance_now=function(){if("undefined"!==typeof window.performance){var f=window.performance;if("undefined"!==typeof f.now)return f.now();if("undefined"!==typeof f.webkitNow)return f.webkitNow();
if("undefined"!==typeof f.mozNow)return f.mozNow();if("undefined"!==typeof f.msNow)return f.msNow()}return Date.now()-g};var p=!1;"undefined"!==typeof window&&(p=/chrome/i.test(navigator.userAgent)||/chromium/i.test(navigator.userAgent),!p&&/safari/i.test(navigator.userAgent),/(iphone|ipod|ipad)/i.test(navigator.userAgent));var A="undefined"!==typeof Set&&"undefined"!==typeof Set.prototype.forEach;O.prototype.contains=function(f){return this.isEmpty()?!1:A?this.s.has(f):this.items&&this.items.hasOwnProperty(f)};
O.prototype.add=function(f){if(A)this.s.has(f)||(this.s.add(f),this.cache_valid=!1);else{var r=f.toString(),J=this.items;J?J.hasOwnProperty(r)||(J[r]=f,this.item_count++,this.cache_valid=!1):(this.items={},this.items[r]=f,this.item_count=1,this.cache_valid=!1)}};O.prototype.remove=function(f){if(!this.isEmpty())if(A)this.s.has(f)&&(this.s["delete"](f),this.cache_valid=!1);else if(this.items){f=f.toString();var r=this.items;r.hasOwnProperty(f)&&(delete r[f],this.item_count--,this.cache_valid=!1)}};
O.prototype.clear=function(){this.isEmpty()||(A?this.s.clear():(this.items=null,this.item_count=0),cr.clearArray(this.values_cache),this.cache_valid=!0)};O.prototype.isEmpty=function(){return 0===this.count()};O.prototype.count=function(){return A?this.s.size:this.item_count};var T=null,W=0;O.prototype.update_cache=function(){if(!this.cache_valid){if(A)cr.clearArray(this.values_cache),T=this.values_cache,W=0,this.s.forEach(L),T=null,W=0;else{var f=this.values_cache;cr.clearArray(f);var r,J=0,M=this.items;
if(M)for(r in M)M.hasOwnProperty(r)&&(f[J++]=M[r])}this.cache_valid=!0}};O.prototype.valuesRef=function(){this.update_cache();return this.values_cache};cr.ObjectSet=O;var I=new cr.ObjectSet;cr.removeArrayDuplicates=function(f){var r;var J=0;for(r=f.length;J<r;++J)I.add(f[J]);cr.shallowAssignArray(f,I.valuesRef());I.clear()};cr.arrayRemoveAllFromObjectSet=function(f,r){A?cr.arrayRemoveAll_set(f,r.s):cr.arrayRemoveAll_arr(f,r.valuesRef())};cr.arrayRemoveAll_set=function(f,r){var J,M;var V=J=0;for(M=
f.length;J<M;++J){var X=f[J];r.has(X)||(f[V++]=X)}cr.truncateArray(f,V)};cr.arrayRemoveAll_arr=function(f,r){var J,M;var V=J=0;for(M=f.length;J<M;++J){var X=f[J];-1===cr.fastIndexOf(r,X)&&(f[V++]=X)}cr.truncateArray(f,V)};k.prototype.add=function(f){this.y=f-this.c;this.t=this.sum+this.y;this.c=this.t-this.sum-this.y;this.sum=this.t};k.prototype.reset=function(){this.sum=this.t=this.y=this.c=0};cr.KahanAdder=k;cr.regexp_escape=function(f){return f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};a.prototype.set_pts=
function(f){this.pts_array=f;this.pts_count=f.length/2;this.pts_cache.length=f.length;this.cache_height=this.cache_width=-1;this.cache_angle=0};a.prototype.is_empty=function(){return!this.pts_array.length};a.prototype.update_bbox=function(){for(var f=this.pts_cache,r=f[0],J=r,M=f[1],V=M,X,aa,Y=1,ca=this.pts_count;Y<ca;++Y)aa=2*Y,X=f[aa],aa=f[aa+1],X<r&&(r=X),X>J&&(J=X),aa<M&&(M=aa),aa>V&&(V=aa);this.bboxLeft=r;this.bboxRight=J;this.bboxTop=M;this.bboxBottom=V};a.prototype.set_from_rect=function(f,
r,J){this.pts_cache.length=8;this.pts_count=4;var M=this.pts_cache;M[0]=f.left-r;M[1]=f.top-J;M[2]=f.right-r;M[3]=f.top-J;M[4]=f.right-r;M[5]=f.bottom-J;M[6]=f.left-r;M[7]=f.bottom-J;this.cache_width=f.right-f.left;this.cache_height=f.bottom-f.top;this.update_bbox()};a.prototype.set_from_quad=function(f,r,J,M,V){this.pts_cache.length=8;this.pts_count=4;var X=this.pts_cache;X[0]=f.tlx-r;X[1]=f.tly-J;X[2]=f.trx-r;X[3]=f.try_-J;X[4]=f.brx-r;X[5]=f.bry-J;X[6]=f.blx-r;X[7]=f.bly-J;this.cache_width=M;this.cache_height=
V;this.update_bbox()};a.prototype.set_from_poly=function(f){this.pts_count=f.pts_count;cr.shallowAssignArray(this.pts_cache,f.pts_cache);this.bboxLeft=f.bboxLeft;this.bboxTop-f.bboxTop;this.bboxRight=f.bboxRight;this.bboxBottom=f.bboxBottom};a.prototype.cache_poly=function(f,r,J){if(this.cache_width!==f||this.cache_height!==r||this.cache_angle!==J){this.cache_width=f;this.cache_height=r;this.cache_angle=J;var M,V=0,X=1,aa=this.pts_array,Y=this.pts_cache;0!==J&&(V=Math.sin(J),X=Math.cos(J));J=0;for(M=
this.pts_count;J<M;J++){var ca=2*J;var R=ca+1;var e=aa[ca]*f;var m=aa[R]*r;Y[ca]=e*X-m*V;Y[R]=m*X+e*V}this.update_bbox()}};a.prototype.contains_pt=function(f,r){var J=this.pts_cache;if(f===J[0]&&r===J[1])return!0;var M,V=this.pts_count,X=this.bboxLeft-110,aa=this.bboxTop-101,Y=this.bboxRight+131,ca=this.bboxBottom+120,R=0,e=0;for(M=0;M<V;M++){var m=2*M;var x=(M+1)%V*2;var t=J[m];m=J[m+1];var v=J[x];x=J[x+1];cr.segments_intersect(X,aa,f,r,t,m,v,x)&&R++;cr.segments_intersect(Y,ca,f,r,t,m,v,x)&&e++}return 1===
R%2||1===e%2};a.prototype.intersects_poly=function(f,r,J){var M=f.pts_cache,V=this.pts_cache;if(this.contains_pt(M[0]+r,M[1]+J)||f.contains_pt(V[0]-r,V[1]-J))return!0;var X,aa;var Y=0;for(X=this.pts_count;Y<X;Y++){var ca=2*Y;var R=(Y+1)%X*2;var e=V[ca];ca=V[ca+1];var m=V[R];var x=V[R+1];R=0;for(aa=f.pts_count;R<aa;R++){var t=2*R;var v=(R+1)%aa*2;var q=M[t]+r;t=M[t+1]+J;var y=M[v]+r;v=M[v+1]+J;if(cr.segments_intersect(e,ca,m,x,q,t,y,v))return!0}}return!1};a.prototype.intersects_segment=function(f,
r,J,M,V,X){var aa=this.pts_cache;if(this.contains_pt(J-f,M-r))return!0;var Y;var ca=0;for(Y=this.pts_count;ca<Y;ca++){var R=2*ca;var e=(ca+1)%Y*2;var m=aa[R]+f;R=aa[R+1]+r;var x=aa[e]+f;e=aa[e+1]+r;if(cr.segments_intersect(J,M,V,X,m,R,x,e))return!0}return!1};a.prototype.mirror=function(f){var r;var J=0;for(r=this.pts_count;J<r;++J){var M=2*J;this.pts_cache[M]=2*f-this.pts_cache[M]}};a.prototype.flip=function(f){var r;var J=0;for(r=this.pts_count;J<r;++J){var M=2*J+1;this.pts_cache[M]=2*f-this.pts_cache[M]}};
a.prototype.diag=function(){var f;var r=0;for(f=this.pts_count;r<f;++r){var J=2*r;var M=J+1;var V=this.pts_cache[J];this.pts_cache[J]=this.pts_cache[M];this.pts_cache[M]=V}};a.prototype.is_enabled=function(){return this.enabled};cr.CollisionPoly=a;d.prototype.totalCellCount=0;d.prototype.getCell=function(f,r,J){var M=this.cells[f];return M?(M=M[r])?M:J?(M=C(this,f,r),this.cells[f][r]=M):null:J?(M=C(this,f,r),this.cells[f]={},this.cells[f][r]=M):null};d.prototype.XToCell=function(f){return cr.floor(f/
this.cellwidth)};d.prototype.YToCell=function(f){return cr.floor(f/this.cellheight)};d.prototype.update=function(f,r,J){var M,V,X;if(r){var aa=r.left;for(M=r.right;aa<=M;++aa){var Y=r.top;for(V=r.bottom;Y<=V;++Y)if(!J||!J.contains_pt(aa,Y))if(X=this.getCell(aa,Y,!1))X.remove(f),X.isEmpty()&&(d.prototype.totalCellCount--,X.objects.clear(),1E3>c.length&&c.push(X),this.cells[aa][Y]=null)}}if(J)for(aa=J.left,M=J.right;aa<=M;++aa)for(Y=J.top,V=J.bottom;Y<=V;++Y)r&&r.contains_pt(aa,Y)||this.getCell(aa,
Y,!0).insert(f)};d.prototype.queryRange=function(f,r){var J,M;var V=this.XToCell(f.left);var X=this.YToCell(f.top);var aa=this.XToCell(f.right);for(J=this.YToCell(f.bottom);V<=aa;++V)for(f=X;f<=J;++f)(M=this.getCell(V,f,!1))&&M.dump(r)};cr.SparseGrid=d;n.prototype.totalCellCount=0;n.prototype.getCell=function(f,r,J){var M=this.cells[f];return M?(M=M[r])?M:J?(M=E(this,f,r),this.cells[f][r]=M):null:J?(M=E(this,f,r),this.cells[f]={},this.cells[f][r]=M):null};n.prototype.XToCell=function(f){return cr.floor(f/
this.cellwidth)};n.prototype.YToCell=function(f){return cr.floor(f/this.cellheight)};n.prototype.update=function(f,r,J){var M,V,X;if(r){var aa=r.left;for(M=r.right;aa<=M;++aa){var Y=r.top;for(V=r.bottom;Y<=V;++Y)if(!J||!J.contains_pt(aa,Y))if(X=this.getCell(aa,Y,!1))X.remove(f),X.isEmpty()&&(n.prototype.totalCellCount--,X.reset(),1E3>h.length&&h.push(X),this.cells[aa][Y]=null)}}if(J)for(aa=J.left,M=J.right;aa<=M;++aa)for(Y=J.top,V=J.bottom;Y<=V;++Y)r&&r.contains_pt(aa,Y)||this.getCell(aa,Y,!0).insert(f)};
n.prototype.queryRange=function(f,r,J,M,V){var X,aa;f=this.XToCell(f);r=this.YToCell(r);J=this.XToCell(J);for(X=this.YToCell(M);f<=J;++f)for(M=r;M<=X;++M)(aa=this.getCell(f,M,!1))&&aa.dump(V)};n.prototype.markRangeChanged=function(f){var r,J;var M=f.left;var V=f.top;var X=f.right;for(r=f.bottom;M<=X;++M)for(f=V;f<=r;++f)if(J=this.getCell(M,f,!1))J.is_sorted=!1};cr.RenderGrid=n;var c=[];u.prototype.isEmpty=function(){return this.objects.isEmpty()};u.prototype.insert=function(f){this.objects.add(f)};
u.prototype.remove=function(f){this.objects.remove(f)};u.prototype.dump=function(f){cr.appendArray(f,this.objects.valuesRef())};cr.GridCell=u;var h=[];N.prototype.isEmpty=function(){if(!this.objects.length)return!0;if(this.objects.length>this.pending_removal.count())return!1;this.flush_pending();return!0};N.prototype.insert=function(f){this.pending_removal.contains(f)?(this.pending_removal.remove(f),this.pending_removal.isEmpty()&&(this.any_pending_removal=!1)):this.objects.length?(this.objects[this.objects.length-
1].get_zindex()>f.get_zindex()&&(this.is_sorted=!1),this.objects.push(f)):(this.objects.push(f),this.is_sorted=!0)};N.prototype.remove=function(f){this.pending_removal.add(f);this.any_pending_removal=!0;30<=this.pending_removal.count()&&this.flush_pending()};N.prototype.flush_pending=function(){this.any_pending_removal&&(this.pending_removal.count()===this.objects.length?this.reset():(cr.arrayRemoveAllFromObjectSet(this.objects,this.pending_removal),this.pending_removal.clear(),this.any_pending_removal=
!1))};N.prototype.ensure_sorted=function(){this.is_sorted||(this.objects.sort(z),this.is_sorted=!0)};N.prototype.reset=function(){cr.clearArray(this.objects);this.is_sorted=!0;this.pending_removal.clear();this.any_pending_removal=!1};N.prototype.dump=function(f){this.flush_pending();this.ensure_sorted();this.objects.length&&f.push(this.objects)};cr.RenderCell=N;var G="lighter xor copy destination-over source-in destination-in source-out destination-out source-atop destination-atop".split(" ");cr.effectToCompositeOp=
function(f){return 0>=f||11<=f?"source-over":G[f-1]};cr.setGLBlend=function(f,r,J){if(J)switch(f.srcBlend=J.ONE,f.destBlend=J.ONE_MINUS_SRC_ALPHA,r){case 1:f.srcBlend=J.ONE;f.destBlend=J.ONE;break;case 3:f.srcBlend=J.ONE;f.destBlend=J.ZERO;break;case 4:f.srcBlend=J.ONE_MINUS_DST_ALPHA;f.destBlend=J.ONE;break;case 5:f.srcBlend=J.DST_ALPHA;f.destBlend=J.ZERO;break;case 6:f.srcBlend=J.ZERO;f.destBlend=J.SRC_ALPHA;break;case 7:f.srcBlend=J.ONE_MINUS_DST_ALPHA;f.destBlend=J.ZERO;break;case 8:f.srcBlend=
J.ZERO;f.destBlend=J.ONE_MINUS_SRC_ALPHA;break;case 9:f.srcBlend=J.DST_ALPHA;f.destBlend=J.ONE_MINUS_SRC_ALPHA;break;case 10:f.srcBlend=J.ONE_MINUS_DST_ALPHA,f.destBlend=J.SRC_ALPHA}};cr.round6dp=function(f){return Math.round(1E6*f)/1E6};cr.equals_nocase=function(f,r){return"string"!==typeof f||"string"!==typeof r||f.length!==r.length?!1:f===r?!0:f.toLowerCase()===r.toLowerCase()};cr.cssToCamelCase=function(f){var r="",J,M=!1;var V=0;for(J=f.length;V<J;++V){var X=f.charAt(V);"-"===X?M=!0:M?(r+=X.toUpperCase(),
M=!1):r+=X}return r};cr.isCanvasInputEvent=function(f){f=f.target;return!f||f===document||f===window||document&&document.body&&f===document.body||cr.equals_nocase(f.tagName,"canvas")?!0:!1}})();var MatrixArray="undefined"!==typeof Float32Array?Float32Array:Array,glMatrixArrayType=MatrixArray,vec3={},mat3={},mat4={},quat4={};vec3.create=function(b){var l=new MatrixArray(3);b&&(l[0]=b[0],l[1]=b[1],l[2]=b[2]);return l};vec3.set=function(b,l){l[0]=b[0];l[1]=b[1];l[2]=b[2];return l};
vec3.add=function(b,l,w){if(!w||b===w)return b[0]+=l[0],b[1]+=l[1],b[2]+=l[2],b;w[0]=b[0]+l[0];w[1]=b[1]+l[1];w[2]=b[2]+l[2];return w};vec3.subtract=function(b,l,w){if(!w||b===w)return b[0]-=l[0],b[1]-=l[1],b[2]-=l[2],b;w[0]=b[0]-l[0];w[1]=b[1]-l[1];w[2]=b[2]-l[2];return w};vec3.negate=function(b,l){l||(l=b);l[0]=-b[0];l[1]=-b[1];l[2]=-b[2];return l};vec3.scale=function(b,l,w){if(!w||b===w)return b[0]*=l,b[1]*=l,b[2]*=l,b;w[0]=b[0]*l;w[1]=b[1]*l;w[2]=b[2]*l;return w};
vec3.normalize=function(b,l){l||(l=b);var w=b[0],D=b[1];b=b[2];var O=Math.sqrt(w*w+D*D+b*b);if(O){if(1===O)return l[0]=w,l[1]=D,l[2]=b,l}else return l[0]=0,l[1]=0,l[2]=0,l;O=1/O;l[0]=w*O;l[1]=D*O;l[2]=b*O;return l};vec3.cross=function(b,l,w){w||(w=b);var D=b[0],O=b[1];b=b[2];var L=l[0],k=l[1];l=l[2];w[0]=O*l-b*k;w[1]=b*L-D*l;w[2]=D*k-O*L;return w};vec3.length=function(b){var l=b[0],w=b[1];b=b[2];return Math.sqrt(l*l+w*w+b*b)};vec3.dot=function(b,l){return b[0]*l[0]+b[1]*l[1]+b[2]*l[2]};
vec3.direction=function(b,l,w){w||(w=b);var D=b[0]-l[0],O=b[1]-l[1];b=b[2]-l[2];l=Math.sqrt(D*D+O*O+b*b);if(!l)return w[0]=0,w[1]=0,w[2]=0,w;l=1/l;w[0]=D*l;w[1]=O*l;w[2]=b*l;return w};vec3.lerp=function(b,l,w,D){D||(D=b);D[0]=b[0]+w*(l[0]-b[0]);D[1]=b[1]+w*(l[1]-b[1]);D[2]=b[2]+w*(l[2]-b[2]);return D};vec3.str=function(b){return"["+b[0]+", "+b[1]+", "+b[2]+"]"};
mat3.create=function(b){var l=new MatrixArray(9);b&&(l[0]=b[0],l[1]=b[1],l[2]=b[2],l[3]=b[3],l[4]=b[4],l[5]=b[5],l[6]=b[6],l[7]=b[7],l[8]=b[8]);return l};mat3.set=function(b,l){l[0]=b[0];l[1]=b[1];l[2]=b[2];l[3]=b[3];l[4]=b[4];l[5]=b[5];l[6]=b[6];l[7]=b[7];l[8]=b[8];return l};mat3.identity=function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};
mat3.transpose=function(b,l){if(!l||b===l){l=b[1];var w=b[2],D=b[5];b[1]=b[3];b[2]=b[6];b[3]=l;b[5]=b[7];b[6]=w;b[7]=D;return b}l[0]=b[0];l[1]=b[3];l[2]=b[6];l[3]=b[1];l[4]=b[4];l[5]=b[7];l[6]=b[2];l[7]=b[5];l[8]=b[8];return l};mat3.toMat4=function(b,l){l||(l=mat4.create());l[15]=1;l[14]=0;l[13]=0;l[12]=0;l[11]=0;l[10]=b[8];l[9]=b[7];l[8]=b[6];l[7]=0;l[6]=b[5];l[5]=b[4];l[4]=b[3];l[3]=0;l[2]=b[2];l[1]=b[1];l[0]=b[0];return l};
mat3.str=function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+", "+b[6]+", "+b[7]+", "+b[8]+"]"};mat4.create=function(b){var l=new MatrixArray(16);b&&(l[0]=b[0],l[1]=b[1],l[2]=b[2],l[3]=b[3],l[4]=b[4],l[5]=b[5],l[6]=b[6],l[7]=b[7],l[8]=b[8],l[9]=b[9],l[10]=b[10],l[11]=b[11],l[12]=b[12],l[13]=b[13],l[14]=b[14],l[15]=b[15]);return l};
mat4.set=function(b,l){l[0]=b[0];l[1]=b[1];l[2]=b[2];l[3]=b[3];l[4]=b[4];l[5]=b[5];l[6]=b[6];l[7]=b[7];l[8]=b[8];l[9]=b[9];l[10]=b[10];l[11]=b[11];l[12]=b[12];l[13]=b[13];l[14]=b[14];l[15]=b[15];return l};mat4.identity=function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};
mat4.transpose=function(b,l){if(!l||b===l){l=b[1];var w=b[2],D=b[3],O=b[6],L=b[7],k=b[11];b[1]=b[4];b[2]=b[8];b[3]=b[12];b[4]=l;b[6]=b[9];b[7]=b[13];b[8]=w;b[9]=O;b[11]=b[14];b[12]=D;b[13]=L;b[14]=k;return b}l[0]=b[0];l[1]=b[4];l[2]=b[8];l[3]=b[12];l[4]=b[1];l[5]=b[5];l[6]=b[9];l[7]=b[13];l[8]=b[2];l[9]=b[6];l[10]=b[10];l[11]=b[14];l[12]=b[3];l[13]=b[7];l[14]=b[11];l[15]=b[15];return l};
mat4.determinant=function(b){var l=b[0],w=b[1],D=b[2],O=b[3],L=b[4],k=b[5],a=b[6],d=b[7],n=b[8],C=b[9],u=b[10],E=b[11],N=b[12],z=b[13],H=b[14];b=b[15];return N*C*a*O-n*z*a*O-N*k*u*O+L*z*u*O+n*k*H*O-L*C*H*O-N*C*D*d+n*z*D*d+N*w*u*d-l*z*u*d-n*w*H*d+l*C*H*d+N*k*D*E-L*z*D*E-N*w*a*E+l*z*a*E+L*w*H*E-l*k*H*E-n*k*D*b+L*C*D*b+n*w*a*b-l*C*a*b-L*w*u*b+l*k*u*b};
mat4.inverse=function(b,l){l||(l=b);var w=b[0],D=b[1],O=b[2],L=b[3],k=b[4],a=b[5],d=b[6],n=b[7],C=b[8],u=b[9],E=b[10],N=b[11],z=b[12],H=b[13],F=b[14];b=b[15];var g=w*a-D*k,p=w*d-O*k,A=w*n-L*k,T=D*d-O*a,W=D*n-L*a,I=O*n-L*d,c=C*H-u*z,h=C*F-E*z,G=C*b-N*z,f=u*F-E*H,r=u*b-N*H,J=E*b-N*F,M=1/(g*J-p*r+A*f+T*G-W*h+I*c);l[0]=(a*J-d*r+n*f)*M;l[1]=(-D*J+O*r-L*f)*M;l[2]=(H*I-F*W+b*T)*M;l[3]=(-u*I+E*W-N*T)*M;l[4]=(-k*J+d*G-n*h)*M;l[5]=(w*J-O*G+L*h)*M;l[6]=(-z*I+F*A-b*p)*M;l[7]=(C*I-E*A+N*p)*M;l[8]=(k*r-a*G+n*c)*
M;l[9]=(-w*r+D*G-L*c)*M;l[10]=(z*W-H*A+b*g)*M;l[11]=(-C*W+u*A-N*g)*M;l[12]=(-k*f+a*h-d*c)*M;l[13]=(w*f-D*h+O*c)*M;l[14]=(-z*T+H*p-F*g)*M;l[15]=(C*T-u*p+E*g)*M;return l};mat4.toRotationMat=function(b,l){l||(l=mat4.create());l[0]=b[0];l[1]=b[1];l[2]=b[2];l[3]=b[3];l[4]=b[4];l[5]=b[5];l[6]=b[6];l[7]=b[7];l[8]=b[8];l[9]=b[9];l[10]=b[10];l[11]=b[11];l[12]=0;l[13]=0;l[14]=0;l[15]=1;return l};
mat4.toMat3=function(b,l){l||(l=mat3.create());l[0]=b[0];l[1]=b[1];l[2]=b[2];l[3]=b[4];l[4]=b[5];l[5]=b[6];l[6]=b[8];l[7]=b[9];l[8]=b[10];return l};mat4.toInverseMat3=function(b,l){var w=b[0],D=b[1],O=b[2],L=b[4],k=b[5],a=b[6],d=b[8],n=b[9];b=b[10];var C=b*k-a*n,u=-b*L+a*d,E=n*L-k*d,N=w*C+D*u+O*E;if(!N)return null;N=1/N;l||(l=mat3.create());l[0]=C*N;l[1]=(-b*D+O*n)*N;l[2]=(a*D-O*k)*N;l[3]=u*N;l[4]=(b*w-O*d)*N;l[5]=(-a*w+O*L)*N;l[6]=E*N;l[7]=(-n*w+D*d)*N;l[8]=(k*w-D*L)*N;return l};
mat4.multiply=function(b,l,w){w||(w=b);var D=b[0],O=b[1],L=b[2],k=b[3],a=b[4],d=b[5],n=b[6],C=b[7],u=b[8],E=b[9],N=b[10],z=b[11],H=b[12],F=b[13],g=b[14];b=b[15];var p=l[0],A=l[1],T=l[2],W=l[3],I=l[4],c=l[5],h=l[6],G=l[7],f=l[8],r=l[9],J=l[10],M=l[11],V=l[12],X=l[13],aa=l[14];l=l[15];w[0]=p*D+A*a+T*u+W*H;w[1]=p*O+A*d+T*E+W*F;w[2]=p*L+A*n+T*N+W*g;w[3]=p*k+A*C+T*z+W*b;w[4]=I*D+c*a+h*u+G*H;w[5]=I*O+c*d+h*E+G*F;w[6]=I*L+c*n+h*N+G*g;w[7]=I*k+c*C+h*z+G*b;w[8]=f*D+r*a+J*u+M*H;w[9]=f*O+r*d+J*E+M*F;w[10]=f*
L+r*n+J*N+M*g;w[11]=f*k+r*C+J*z+M*b;w[12]=V*D+X*a+aa*u+l*H;w[13]=V*O+X*d+aa*E+l*F;w[14]=V*L+X*n+aa*N+l*g;w[15]=V*k+X*C+aa*z+l*b;return w};mat4.multiplyVec3=function(b,l,w){w||(w=l);var D=l[0],O=l[1];l=l[2];w[0]=b[0]*D+b[4]*O+b[8]*l+b[12];w[1]=b[1]*D+b[5]*O+b[9]*l+b[13];w[2]=b[2]*D+b[6]*O+b[10]*l+b[14];return w};
mat4.multiplyVec4=function(b,l,w){w||(w=l);var D=l[0],O=l[1],L=l[2];l=l[3];w[0]=b[0]*D+b[4]*O+b[8]*L+b[12]*l;w[1]=b[1]*D+b[5]*O+b[9]*L+b[13]*l;w[2]=b[2]*D+b[6]*O+b[10]*L+b[14]*l;w[3]=b[3]*D+b[7]*O+b[11]*L+b[15]*l;return w};
mat4.translate=function(b,l,w){var D=l[0],O=l[1];l=l[2];if(!w||b===w)return b[12]=b[0]*D+b[4]*O+b[8]*l+b[12],b[13]=b[1]*D+b[5]*O+b[9]*l+b[13],b[14]=b[2]*D+b[6]*O+b[10]*l+b[14],b[15]=b[3]*D+b[7]*O+b[11]*l+b[15],b;var L=b[0];var k=b[1];var a=b[2];var d=b[3];var n=b[4];var C=b[5];var u=b[6];var E=b[7];var N=b[8];var z=b[9];var H=b[10];var F=b[11];w[0]=L;w[1]=k;w[2]=a;w[3]=d;w[4]=n;w[5]=C;w[6]=u;w[7]=E;w[8]=N;w[9]=z;w[10]=H;w[11]=F;w[12]=L*D+n*O+N*l+b[12];w[13]=k*D+C*O+z*l+b[13];w[14]=a*D+u*O+H*l+b[14];
w[15]=d*D+E*O+F*l+b[15];return w};mat4.scale=function(b,l,w){var D=l[0],O=l[1];l=l[2];if(!w||b===w)return b[0]*=D,b[1]*=D,b[2]*=D,b[3]*=D,b[4]*=O,b[5]*=O,b[6]*=O,b[7]*=O,b[8]*=l,b[9]*=l,b[10]*=l,b[11]*=l,b;w[0]=b[0]*D;w[1]=b[1]*D;w[2]=b[2]*D;w[3]=b[3]*D;w[4]=b[4]*O;w[5]=b[5]*O;w[6]=b[6]*O;w[7]=b[7]*O;w[8]=b[8]*l;w[9]=b[9]*l;w[10]=b[10]*l;w[11]=b[11]*l;w[12]=b[12];w[13]=b[13];w[14]=b[14];w[15]=b[15];return w};
mat4.rotate=function(b,l,w,D){var O=w[0],L=w[1];w=w[2];var k=Math.sqrt(O*O+L*L+w*w);if(!k)return null;1!==k&&(k=1/k,O*=k,L*=k,w*=k);var a=Math.sin(l);var d=Math.cos(l);var n=1-d;l=b[0];k=b[1];var C=b[2];var u=b[3];var E=b[4];var N=b[5];var z=b[6];var H=b[7];var F=b[8];var g=b[9];var p=b[10];var A=b[11];var T=O*O*n+d;var W=L*O*n+w*a;var I=w*O*n-L*a;var c=O*L*n-w*a;var h=L*L*n+d;var G=w*L*n+O*a;var f=O*w*n+L*a;O=L*w*n-O*a;L=w*w*n+d;D?b!==D&&(D[12]=b[12],D[13]=b[13],D[14]=b[14],D[15]=b[15]):D=b;D[0]=
l*T+E*W+F*I;D[1]=k*T+N*W+g*I;D[2]=C*T+z*W+p*I;D[3]=u*T+H*W+A*I;D[4]=l*c+E*h+F*G;D[5]=k*c+N*h+g*G;D[6]=C*c+z*h+p*G;D[7]=u*c+H*h+A*G;D[8]=l*f+E*O+F*L;D[9]=k*f+N*O+g*L;D[10]=C*f+z*O+p*L;D[11]=u*f+H*O+A*L;return D};
mat4.rotateX=function(b,l,w){var D=Math.sin(l);l=Math.cos(l);var O=b[4],L=b[5],k=b[6],a=b[7],d=b[8],n=b[9],C=b[10],u=b[11];w?b!==w&&(w[0]=b[0],w[1]=b[1],w[2]=b[2],w[3]=b[3],w[12]=b[12],w[13]=b[13],w[14]=b[14],w[15]=b[15]):w=b;w[4]=O*l+d*D;w[5]=L*l+n*D;w[6]=k*l+C*D;w[7]=a*l+u*D;w[8]=O*-D+d*l;w[9]=L*-D+n*l;w[10]=k*-D+C*l;w[11]=a*-D+u*l;return w};
mat4.rotateY=function(b,l,w){var D=Math.sin(l);l=Math.cos(l);var O=b[0],L=b[1],k=b[2],a=b[3],d=b[8],n=b[9],C=b[10],u=b[11];w?b!==w&&(w[4]=b[4],w[5]=b[5],w[6]=b[6],w[7]=b[7],w[12]=b[12],w[13]=b[13],w[14]=b[14],w[15]=b[15]):w=b;w[0]=O*l+d*-D;w[1]=L*l+n*-D;w[2]=k*l+C*-D;w[3]=a*l+u*-D;w[8]=O*D+d*l;w[9]=L*D+n*l;w[10]=k*D+C*l;w[11]=a*D+u*l;return w};
mat4.rotateZ=function(b,l,w){var D=Math.sin(l);l=Math.cos(l);var O=b[0],L=b[1],k=b[2],a=b[3],d=b[4],n=b[5],C=b[6],u=b[7];w?b!==w&&(w[8]=b[8],w[9]=b[9],w[10]=b[10],w[11]=b[11],w[12]=b[12],w[13]=b[13],w[14]=b[14],w[15]=b[15]):w=b;w[0]=O*l+d*D;w[1]=L*l+n*D;w[2]=k*l+C*D;w[3]=a*l+u*D;w[4]=O*-D+d*l;w[5]=L*-D+n*l;w[6]=k*-D+C*l;w[7]=a*-D+u*l;return w};
mat4.frustum=function(b,l,w,D,O,L,k){k||(k=mat4.create());var a=l-b,d=D-w,n=L-O;k[0]=2*O/a;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*O/d;k[6]=0;k[7]=0;k[8]=(l+b)/a;k[9]=(D+w)/d;k[10]=-(L+O)/n;k[11]=-1;k[12]=0;k[13]=0;k[14]=-(L*O*2)/n;k[15]=0;return k};mat4.perspective=function(b,l,w,D,O){b=w*Math.tan(b*Math.PI/360);l*=b;return mat4.frustum(-l,l,-b,b,w,D,O)};
mat4.ortho=function(b,l,w,D,O,L,k){k||(k=mat4.create());var a=l-b,d=D-w,n=L-O;k[0]=2/a;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2/d;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=-2/n;k[11]=0;k[12]=-(b+l)/a;k[13]=-(D+w)/d;k[14]=-(L+O)/n;k[15]=1;return k};
mat4.lookAt=function(b,l,w,D){D||(D=mat4.create());var O=b[0],L=b[1];b=b[2];var k=w[0];var a=w[1];var d=w[2];w=l[1];var n=l[2];if(O===l[0]&&L===w&&b===n)return mat4.identity(D);w=O-l[0];n=L-l[1];var C=b-l[2];var u=1/Math.sqrt(w*w+n*n+C*C);w*=u;n*=u;C*=u;l=a*C-d*n;d=d*w-k*C;k=k*n-a*w;(u=Math.sqrt(l*l+d*d+k*k))?(u=1/u,l*=u,d*=u,k*=u):k=d=l=0;a=n*k-C*d;var E=C*l-w*k;var N=w*d-n*l;(u=Math.sqrt(a*a+E*E+N*N))?(u=1/u,a*=u,E*=u,N*=u):N=E=a=0;D[0]=l;D[1]=a;D[2]=w;D[3]=0;D[4]=d;D[5]=E;D[6]=n;D[7]=0;D[8]=k;
D[9]=N;D[10]=C;D[11]=0;D[12]=-(l*O+d*L+k*b);D[13]=-(a*O+E*L+N*b);D[14]=-(w*O+n*L+C*b);D[15]=1;return D};mat4.fromRotationTranslation=function(b,l,w){w||(w=mat4.create());var D=b[0],O=b[1],L=b[2],k=b[3],a=D+D,d=O+O,n=L+L;b=D*a;var C=D*d;D*=n;var u=O*d;O*=n;L*=n;a*=k;d*=k;k*=n;w[0]=1-(u+L);w[1]=C+k;w[2]=D-d;w[3]=0;w[4]=C-k;w[5]=1-(b+L);w[6]=O+a;w[7]=0;w[8]=D+d;w[9]=O-a;w[10]=1-(b+u);w[11]=0;w[12]=l[0];w[13]=l[1];w[14]=l[2];w[15]=1;return w};
mat4.str=function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+", "+b[4]+", "+b[5]+", "+b[6]+", "+b[7]+", "+b[8]+", "+b[9]+", "+b[10]+", "+b[11]+", "+b[12]+", "+b[13]+", "+b[14]+", "+b[15]+"]"};quat4.create=function(b){var l=new MatrixArray(4);b&&(l[0]=b[0],l[1]=b[1],l[2]=b[2],l[3]=b[3]);return l};quat4.set=function(b,l){l[0]=b[0];l[1]=b[1];l[2]=b[2];l[3]=b[3];return l};
quat4.calculateW=function(b,l){var w=b[0],D=b[1],O=b[2];if(!l||b===l)return b[3]=-Math.sqrt(Math.abs(1-w*w-D*D-O*O)),b;l[0]=w;l[1]=D;l[2]=O;l[3]=-Math.sqrt(Math.abs(1-w*w-D*D-O*O));return l};quat4.inverse=function(b,l){if(!l||b===l)return b[0]*=-1,b[1]*=-1,b[2]*=-1,b;l[0]=-b[0];l[1]=-b[1];l[2]=-b[2];l[3]=b[3];return l};quat4.length=function(b){var l=b[0],w=b[1],D=b[2];b=b[3];return Math.sqrt(l*l+w*w+D*D+b*b)};
quat4.normalize=function(b,l){l||(l=b);var w=b[0],D=b[1],O=b[2];b=b[3];var L=Math.sqrt(w*w+D*D+O*O+b*b);if(0===L)return l[0]=0,l[1]=0,l[2]=0,l[3]=0,l;L=1/L;l[0]=w*L;l[1]=D*L;l[2]=O*L;l[3]=b*L;return l};quat4.multiply=function(b,l,w){w||(w=b);var D=b[0],O=b[1],L=b[2];b=b[3];var k=l[0],a=l[1],d=l[2];l=l[3];w[0]=D*l+b*k+O*d-L*a;w[1]=O*l+b*a+L*k-D*d;w[2]=L*l+b*d+D*a-O*k;w[3]=b*l-D*k-O*a-L*d;return w};
quat4.multiplyVec3=function(b,l,w){w||(w=l);var D=l[0],O=l[1],L=l[2];l=b[0];var k=b[1],a=b[2];b=b[3];var d=b*D+k*L-a*O,n=b*O+a*D-l*L,C=b*L+l*O-k*D;D=-l*D-k*O-a*L;w[0]=d*b+D*-l+n*-a-C*-k;w[1]=n*b+D*-k+C*-l-d*-a;w[2]=C*b+D*-a+d*-k-n*-l;return w};quat4.toMat3=function(b,l){l||(l=mat3.create());var w=b[0],D=b[1],O=b[2];b=b[3];var L=w+w,k=D+D,a=O+O,d=w*L,n=w*k;w*=a;var C=D*k;D*=a;O*=a;L*=b;k*=b;b*=a;l[0]=1-(C+O);l[1]=n+b;l[2]=w-k;l[3]=n-b;l[4]=1-(d+O);l[5]=D+L;l[6]=w+k;l[7]=D-L;l[8]=1-(d+C);return l};
quat4.toMat4=function(b,l){l||(l=mat4.create());var w=b[0],D=b[1],O=b[2];b=b[3];var L=w+w,k=D+D,a=O+O,d=w*L,n=w*k;w*=a;var C=D*k;D*=a;O*=a;L*=b;k*=b;b*=a;l[0]=1-(C+O);l[1]=n+b;l[2]=w-k;l[3]=0;l[4]=n-b;l[5]=1-(d+O);l[6]=D+L;l[7]=0;l[8]=w+k;l[9]=D-L;l[10]=1-(d+C);l[11]=0;l[12]=0;l[13]=0;l[14]=0;l[15]=1;return l};
quat4.slerp=function(b,l,w,D){D||(D=b);var O=b[0]*l[0]+b[1]*l[1]+b[2]*l[2]+b[3]*l[3];if(1<=Math.abs(O))return D!==b&&(D[0]=b[0],D[1]=b[1],D[2]=b[2],D[3]=b[3]),D;var L=Math.acos(O);var k=Math.sqrt(1-O*O);if(.001>Math.abs(k))return D[0]=.5*b[0]+.5*l[0],D[1]=.5*b[1]+.5*l[1],D[2]=.5*b[2]+.5*l[2],D[3]=.5*b[3]+.5*l[3],D;O=Math.sin((1-w)*L)/k;w=Math.sin(w*L)/k;D[0]=b[0]*O+l[0]*w;D[1]=b[1]*O+l[1]*w;D[2]=b[2]*O+l[2]*w;D[3]=b[3]*O+l[3]*w;return D};
quat4.str=function(b){return"["+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+"]"};
(function(){function b(a,d,n){this.isIE=/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent);this.height=this.width=0;this.enableFrontToBack=!!n;this.isBatchInEarlyZPass=this.isEarlyZPass=!1;this.currentZ=0;this.zNear=1;this.zFar=1E3;this.zIncrement=(this.zFar-this.zNear)/32768;this.zA=this.zFar/(this.zFar-this.zNear);this.zB=this.zFar*this.zNear/(this.zNear-this.zFar);this.kzA=65536*this.zA;this.kzB=65536*this.zB;this.cam=vec3.create([0,0,100]);this.look=vec3.create([0,0,0]);this.up=
vec3.create([0,1,0]);this.worldScale=vec3.create([1,1,1]);this.enable_mipmaps=!0;this.matP=mat4.create();this.matMV=mat4.create();this.lastMV=mat4.create();this.currentMV=mat4.create();this.gl=a;this.version=0===this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2")?2:1;this.timerExt=null;this.isTiming=!1;this.timerExt=2===this.version?this.gl.getExtension("EXT_disjoint_timer_query_webgl2")||this.gl.getExtension("EXT_disjoint_timer_query"):this.gl.getExtension("EXT_disjoint_timer_query");this.frameNumber=
0;this.timerResults=[];this.initState()}function l(a,d,n){this.gl=a;this.shaderProgram=d;this.name=n;this.locAPos=a.getAttribLocation(d,"aPos");this.locATex=a.getAttribLocation(d,"aTex");this.locMatP=a.getUniformLocation(d,"matP");this.locMatMV=a.getUniformLocation(d,"matMV");this.locOpacity=a.getUniformLocation(d,"opacity");this.locColorFill=a.getUniformLocation(d,"colorFill");this.locSamplerFront=a.getUniformLocation(d,"samplerFront");this.locSamplerBack=a.getUniformLocation(d,"samplerBack");this.locSrcStart=
a.getUniformLocation(d,"srcStart");this.locSrcEnd=a.getUniformLocation(d,"srcEnd");this.locSrcOriginStart=a.getUniformLocation(d,"srcOriginStart");this.locSrcOriginEnd=a.getUniformLocation(d,"srcOriginEnd");this.locLayoutStart=a.getUniformLocation(d,"layoutStart");this.locLayoutEnd=a.getUniformLocation(d,"layoutEnd");this.locDestStart=a.getUniformLocation(d,"destStart");this.locDestEnd=a.getUniformLocation(d,"destEnd");this.locSeconds=a.getUniformLocation(d,"seconds");this.locPixelSize=a.getUniformLocation(d,
"pixelSize");this.locLayerScale=a.getUniformLocation(d,"layerScale");this.locLayerAngle=a.getUniformLocation(d,"layerAngle");this.hasAnyOptionalUniforms=!!(this.locPixelSize||this.locSeconds||this.locSamplerBack||this.locSrcStart||this.locSrcEnd||this.locSrcOriginStart||this.locSrcOriginEnd||this.locLayoutStart||this.locLayoutEnd||this.locDestStart||this.locDestEnd||this.locLayerScale||this.locLayerAngle);this.lpPixelHeight=this.lpPixelWidth=-999;this.lpOpacity=1;this.lpDestStartY=this.lpDestStartX=
this.lpLayoutEndY=this.lpLayoutEndX=this.lpLayoutStartY=this.lpLayoutStartX=this.lpSrcOriginEndY=this.lpSrcOriginEndX=this.lpSrcOriginStartY=this.lpSrcOriginStartX=this.lpSrcEndY=this.lpSrcEndX=this.lpSrcStartY=this.lpSrcStartX=0;this.lpLayerScale=this.lpDestEndY=this.lpDestEndX=1;this.lpSeconds=this.lpLayerAngle=0;this.lastCustomParams=[];this.lpMatMV=mat4.create();this.locOpacity&&a.uniform1f(this.locOpacity,1);this.locColorFill&&a.uniform4f(this.locColorFill,1,1,1,1);this.locSamplerFront&&a.uniform1i(this.locSamplerFront,
0);this.locSamplerBack&&a.uniform1i(this.locSamplerBack,1);this.locSrcStart&&a.uniform2f(this.locSrcStart,0,0);this.locSrcEnd&&a.uniform2f(this.locSrcEnd,1,1);this.locSrcOriginStart&&a.uniform2f(this.locSrcOriginStart,0,0);this.locSrcOriginEnd&&a.uniform2f(this.locSrcOriginEnd,0,0);this.locLayoutStart&&a.uniform2f(this.locLayoutStart,0,0);this.locLayoutEnd&&a.uniform2f(this.locLayoutEnd,0,0);this.locDestStart&&a.uniform2f(this.locDestStart,0,0);this.locDestEnd&&a.uniform2f(this.locDestEnd,1,1);this.locLayerScale&&
a.uniform1f(this.locLayerScale,1);this.locLayerAngle&&a.uniform1f(this.locLayerAngle,0);this.locSeconds&&a.uniform1f(this.locSeconds,0);this.hasCurrentMatMV=!1}function w(a,d){return a[0]===d[0]&&a[1]===d[1]&&a[2]===d[2]&&a[3]===d[3]&&a[4]===d[4]&&a[5]===d[5]&&a[6]===d[6]&&a[7]===d[7]&&a[8]===d[8]&&a[9]===d[9]&&a[10]===d[10]&&a[11]===d[11]&&a[12]===d[12]&&a[13]===d[13]&&a[14]===d[14]&&a[15]===d[15]}function D(a,d){this.type=a;this.glwrap=d;this.gl=d.gl;this.indexCount=this.startIndex=this.opacityParam=
0;this.mat4param=this.texParam=null;this.layoutRect=quat4.create();this.srcOriginRect=quat4.create();this.shaderParams=[];cr.seal(this)}var O=mat4.create();b.prototype.initState=function(){var a=this.gl,d;this.lastOpacity=1;this.lastTexture1=this.lastTexture0=null;this.currentOpacity=1;a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.BLEND);a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA);a.disable(a.CULL_FACE);a.disable(a.STENCIL_TEST);a.disable(a.DITHER);this.enableFrontToBack?(a.enable(a.DEPTH_TEST),
a.depthFunc(a.LEQUAL)):a.disable(a.DEPTH_TEST);this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);this.lastSrcBlend=a.ONE;this.lastDestBlend=a.ONE_MINUS_SRC_ALPHA;this.vertexData=new Float32Array(8E3*(this.enableFrontToBack?3:2));this.texcoordData=new Float32Array(16E3);this.pointData=new Float32Array(32E3);this.pointBuffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.pointBuffer);a.bufferData(a.ARRAY_BUFFER,this.pointData.byteLength,a.DYNAMIC_DRAW);this.vertexBuffers=Array(4);this.texcoordBuffers=
Array(4);for(d=0;4>d;d++)this.vertexBuffers[d]=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffers[d]),a.bufferData(a.ARRAY_BUFFER,this.vertexData.byteLength,a.DYNAMIC_DRAW),this.texcoordBuffers[d]=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,this.texcoordBuffers[d]),a.bufferData(a.ARRAY_BUFFER,this.texcoordData.byteLength,a.DYNAMIC_DRAW);this.curBuffer=0;this.indexBuffer=a.createBuffer();a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);for(var n=new Uint16Array(12E3),C=d=0;12E3>
d;)n[d++]=C,n[d++]=C+1,n[d++]=C+2,n[d++]=C,n[d++]=C+2,n[d++]=C+3,C+=4;a.bufferData(a.ELEMENT_ARRAY_BUFFER,n,a.STATIC_DRAW);this.pointPtr=this.texPtr=this.vertexPtr=0;this.shaderPrograms=[];d=this.enableFrontToBack?"attribute highp vec3 aPos;\nattribute mediump vec2 aTex;\nvarying mediump vec2 vTex;\nuniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, aPos.z, 1.0);\n\tvTex = aTex;\n}":"attribute highp vec2 aPos;\nattribute mediump vec2 aTex;\nvarying mediump vec2 vTex;\nuniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);\n\tvTex = aTex;\n}";
n=this.createShaderProgram({src:"varying mediump vec2 vTex;\nuniform lowp float opacity;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex);\n\tgl_FragColor *= opacity;\n}"},d,"<default>");this.shaderPrograms.push(n);n=this.createShaderProgram({src:"uniform mediump sampler2D samplerFront;\nvarying lowp float opacity;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, gl_PointCoord);\n\tgl_FragColor *= opacity;\n}"},"attribute vec4 aPos;\nvarying float opacity;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);\n\tgl_PointSize = aPos.z;\n\topacity = aPos.w;\n}",
"<point>");this.shaderPrograms.push(n);n=this.createShaderProgram({src:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tif (texture2D(samplerFront, vTex).a < 1.0)\n\t\tdiscard;\n}"},d,"<earlyz>");this.shaderPrograms.push(n);n=this.createShaderProgram({src:"uniform lowp vec4 colorFill;\nvoid main(void) {\n\tgl_FragColor = colorFill;\n}"},d,"<fill>");this.shaderPrograms.push(n);for(var u in cr.shaders)cr.shaders.hasOwnProperty(u)&&this.shaderPrograms.push(this.createShaderProgram(cr.shaders[u],
d,u));a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,null);this.batch=[];this.batchPtr=0;this.hasPointBatchTop=this.hasQuadBatchTop=!1;this.currentProgram=this.lastProgram=-1;this.currentShader=null;this.fbo=a.createFramebuffer();this.depthBuffer=this.renderToTex=null;this.attachedDepthBuffer=!1;this.enableFrontToBack&&(this.depthBuffer=a.createRenderbuffer());this.tmpVec3=vec3.create([0,0,0]);a=a.getParameter(a.ALIASED_POINT_SIZE_RANGE);this.minPointSize=a[0];this.maxPointSize=a[1];2048<
this.maxPointSize&&(this.maxPointSize=2048);this.switchProgram(0);cr.seal(this)};l.prototype.updateMatMV=function(a){w(this.lpMatMV,a)||(mat4.set(a,this.lpMatMV),this.gl.uniformMatrix4fv(this.locMatMV,!1,a))};b.prototype.createShaderProgram=function(a,d,n){var C=this.gl,u=C.createShader(C.FRAGMENT_SHADER);C.shaderSource(u,a.src);C.compileShader(u);if(!C.getShaderParameter(u,C.COMPILE_STATUS))throw a=C.getShaderInfoLog(u),C.deleteShader(u),Error("error compiling fragment shader: "+a);var E=C.createShader(C.VERTEX_SHADER);
C.shaderSource(E,d);C.compileShader(E);if(!C.getShaderParameter(E,C.COMPILE_STATUS))throw a=C.getShaderInfoLog(E),C.deleteShader(u),C.deleteShader(E),Error("error compiling vertex shader: "+a);d=C.createProgram();C.attachShader(d,u);C.attachShader(d,E);C.linkProgram(d);if(!C.getProgramParameter(d,C.LINK_STATUS))throw a=C.getProgramInfoLog(d),C.deleteShader(u),C.deleteShader(E),C.deleteProgram(d),Error("error linking shader program: "+a);C.useProgram(d);C.deleteShader(u);C.deleteShader(E);u=new l(C,
d,n);u.extendBoxHorizontal=a.extendBoxHorizontal||0;u.extendBoxVertical=a.extendBoxVertical||0;u.crossSampling=!!a.crossSampling;u.preservesOpaqueness=!!a.preservesOpaqueness;u.animated=!!a.animated;u.parameters=a.parameters||[];a=0;for(E=u.parameters.length;a<E;a++)u.parameters[a][1]=C.getUniformLocation(d,u.parameters[a][0]),u.lastCustomParams.push(0);cr.seal(u);return u};b.prototype.getShaderIndex=function(a){var d;var n=0;for(d=this.shaderPrograms.length;n<d;n++)if(this.shaderPrograms[n].name===
a)return n;return-1};b.prototype.project=function(a,d,n){var C=this.matMV,u=this.matP,E=[0,0,0,0,0,0,0,0];E[0]=C[0]*a+C[4]*d+C[12];E[1]=C[1]*a+C[5]*d+C[13];E[2]=C[2]*a+C[6]*d+C[14];E[3]=C[3]*a+C[7]*d+C[15];E[4]=u[0]*E[0]+u[4]*E[1]+u[8]*E[2]+u[12]*E[3];E[5]=u[1]*E[0]+u[5]*E[1]+u[9]*E[2]+u[13]*E[3];E[6]=u[2]*E[0]+u[6]*E[1]+u[10]*E[2]+u[14]*E[3];E[7]=-E[2];0!==E[7]&&(E[7]=1/E[7],E[4]*=E[7],E[5]*=E[7],E[6]*=E[7],n[0]=(.5*E[4]+.5)*this.width,n[1]=(.5*E[5]+.5)*this.height)};b.prototype.setSize=function(a,
d,n){if(this.width!==a||this.height!==d||n){this.endBatch();n=this.gl;this.width=a;this.height=d;n.viewport(0,0,a,d);mat4.lookAt(this.cam,this.look,this.up,this.matMV);this.enableFrontToBack?(mat4.ortho(-a/2,a/2,d/2,-d/2,this.zNear,this.zFar,this.matP),this.worldScale[0]=1,this.worldScale[1]=1):(mat4.perspective(45,a/d,this.zNear,this.zFar,this.matP),a=[0,0],d=[0,0],this.project(0,0,a),this.project(1,1,d),this.worldScale[0]=1/(d[0]-a[0]),this.worldScale[1]=-1/(d[1]-a[1]));a=0;for(d=this.shaderPrograms.length;a<
d;a++){var C=this.shaderPrograms[a];C.hasCurrentMatMV=!1;C.locMatP&&(n.useProgram(C.shaderProgram),n.uniformMatrix4fv(C.locMatP,!1,this.matP))}n.useProgram(this.shaderPrograms[this.lastProgram].shaderProgram);n.bindTexture(n.TEXTURE_2D,null);n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,null);n.activeTexture(n.TEXTURE0);this.lastTexture1=this.lastTexture0=null;this.depthBuffer&&(n.bindFramebuffer(n.FRAMEBUFFER,this.fbo),n.bindRenderbuffer(n.RENDERBUFFER,this.depthBuffer),n.renderbufferStorage(n.RENDERBUFFER,
n.DEPTH_COMPONENT16,this.width,this.height),this.attachedDepthBuffer||(n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,this.depthBuffer),this.attachedDepthBuffer=!0),n.bindRenderbuffer(n.RENDERBUFFER,null),n.bindFramebuffer(n.FRAMEBUFFER,null),this.renderToTex=null)}};b.prototype.resetModelView=function(){mat4.lookAt(this.cam,this.look,this.up,this.matMV);mat4.scale(this.matMV,this.worldScale)};b.prototype.translate=function(a,d){if(0!==a||0!==d)this.tmpVec3[0]=a,this.tmpVec3[1]=
d,this.tmpVec3[2]=0,mat4.translate(this.matMV,this.tmpVec3)};b.prototype.scale=function(a,d){if(1!==a||1!==d)this.tmpVec3[0]=a,this.tmpVec3[1]=d,this.tmpVec3[2]=1,mat4.scale(this.matMV,this.tmpVec3)};b.prototype.rotateZ=function(a){0!==a&&mat4.rotateZ(this.matMV,a)};b.prototype.updateModelView=function(){if(!w(this.lastMV,this.matMV)){var a=this.pushBatch();a.type=5;a.mat4param?mat4.set(this.matMV,a.mat4param):a.mat4param=mat4.create(this.matMV);mat4.set(this.matMV,this.lastMV);this.hasPointBatchTop=
this.hasQuadBatchTop=!1}};b.prototype.setEarlyZIndex=function(a){this.enableFrontToBack&&(32760<a&&(a=32760),this.currentZ=this.cam[2]-this.zNear-a*this.zIncrement)};D.prototype.doSetEarlyZPass=function(){var a=this.gl,d=this.glwrap;0!==this.startIndex?(a.depthMask(!0),a.colorMask(!1,!1,!1,!1),a.disable(a.BLEND),a.bindFramebuffer(a.FRAMEBUFFER,d.fbo),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,null,0),a.clear(a.DEPTH_BUFFER_BIT),a.bindFramebuffer(a.FRAMEBUFFER,null),d.isBatchInEarlyZPass=
!0):(a.depthMask(!1),a.colorMask(!0,!0,!0,!0),a.enable(a.BLEND),d.isBatchInEarlyZPass=!1)};D.prototype.doSetTexture=function(){this.gl.bindTexture(this.gl.TEXTURE_2D,this.texParam)};D.prototype.doSetTexture1=function(){var a=this.gl;a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,this.texParam);a.activeTexture(a.TEXTURE0)};D.prototype.doSetOpacity=function(){var a=this.opacityParam,d=this.glwrap;d.currentOpacity=a;d=d.currentShader;d.locOpacity&&d.lpOpacity!==a&&(d.lpOpacity=a,this.gl.uniform1f(d.locOpacity,
a))};D.prototype.doQuad=function(){this.gl.drawElements(this.gl.TRIANGLES,this.indexCount,this.gl.UNSIGNED_SHORT,this.startIndex)};D.prototype.doSetBlend=function(){this.gl.blendFunc(this.startIndex,this.indexCount)};D.prototype.doUpdateModelView=function(){var a,d=this.glwrap.shaderPrograms,n=this.glwrap.currentProgram;var C=0;for(a=d.length;C<a;C++){var u=d[C];C===n&&u.locMatMV?(u.updateMatMV(this.mat4param),u.hasCurrentMatMV=!0):u.hasCurrentMatMV=!1}mat4.set(this.mat4param,this.glwrap.currentMV)};
D.prototype.doRenderToTexture=function(){var a=this.gl,d=this.glwrap;this.texParam?(d.lastTexture1===this.texParam&&(a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),d.lastTexture1=null,a.activeTexture(a.TEXTURE0)),a.bindFramebuffer(a.FRAMEBUFFER,d.fbo),d.isBatchInEarlyZPass||a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.texParam,0)):(d.enableFrontToBack||a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,null,0),a.bindFramebuffer(a.FRAMEBUFFER,
null))};D.prototype.doClear=function(){var a=this.gl,d=this.startIndex;0===d?(a.clearColor(this.mat4param[0],this.mat4param[1],this.mat4param[2],this.mat4param[3]),a.clear(a.COLOR_BUFFER_BIT)):1===d?(a.enable(a.SCISSOR_TEST),a.scissor(this.mat4param[0],this.mat4param[1],this.mat4param[2],this.mat4param[3]),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.disable(a.SCISSOR_TEST)):a.clear(a.DEPTH_BUFFER_BIT)};D.prototype.doSetDepthTestEnabled=function(){var a=this.gl;0!==this.startIndex?a.enable(a.DEPTH_TEST):
a.disable(a.DEPTH_TEST)};D.prototype.doPoints=function(){var a=this.gl,d=this.glwrap;d.enableFrontToBack&&a.disable(a.DEPTH_TEST);var n=d.shaderPrograms[1];a.useProgram(n.shaderProgram);!n.hasCurrentMatMV&&n.locMatMV&&(n.updateMatMV(d.currentMV),n.hasCurrentMatMV=!0);a.enableVertexAttribArray(n.locAPos);a.bindBuffer(a.ARRAY_BUFFER,d.pointBuffer);a.vertexAttribPointer(n.locAPos,4,a.FLOAT,!1,0,0);a.drawArrays(a.POINTS,this.startIndex/4,this.indexCount);n=d.currentShader;a.useProgram(n.shaderProgram);
0<=n.locAPos&&(a.enableVertexAttribArray(n.locAPos),a.bindBuffer(a.ARRAY_BUFFER,d.vertexBuffers[d.curBuffer]),a.vertexAttribPointer(n.locAPos,d.enableFrontToBack?3:2,a.FLOAT,!1,0,0));0<=n.locATex&&(a.enableVertexAttribArray(n.locATex),a.bindBuffer(a.ARRAY_BUFFER,d.texcoordBuffers[d.curBuffer]),a.vertexAttribPointer(n.locATex,2,a.FLOAT,!1,0,0));d.enableFrontToBack&&a.enable(a.DEPTH_TEST)};D.prototype.doSetProgram=function(){var a=this.gl,d=this.glwrap,n=d.shaderPrograms[this.startIndex];d.currentProgram=
this.startIndex;d.currentShader=n;a.useProgram(n.shaderProgram);!n.hasCurrentMatMV&&n.locMatMV&&(n.updateMatMV(d.currentMV),n.hasCurrentMatMV=!0);n.locOpacity&&n.lpOpacity!==d.currentOpacity&&(n.lpOpacity=d.currentOpacity,a.uniform1f(n.locOpacity,d.currentOpacity));0<=n.locAPos&&(a.enableVertexAttribArray(n.locAPos),a.bindBuffer(a.ARRAY_BUFFER,d.vertexBuffers[d.curBuffer]),a.vertexAttribPointer(n.locAPos,d.enableFrontToBack?3:2,a.FLOAT,!1,0,0));0<=n.locATex&&(a.enableVertexAttribArray(n.locATex),
a.bindBuffer(a.ARRAY_BUFFER,d.texcoordBuffers[d.curBuffer]),a.vertexAttribPointer(n.locATex,2,a.FLOAT,!1,0,0))};D.prototype.doSetColor=function(){var a=this.mat4param;this.gl.uniform4f(this.glwrap.currentShader.locColorFill,a[0],a[1],a[2],a[3])};D.prototype.doSetProgramParameters=function(){var a=this.glwrap.currentShader,d=this.gl;var n=this.mat4param;var C=this.layoutRect;var u=this.srcOriginRect;a.locSamplerBack&&this.glwrap.lastTexture1!==this.texParam&&(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,
this.texParam),this.glwrap.lastTexture1=this.texParam,d.activeTexture(d.TEXTURE0));var E=n[0],N=n[1];!a.locPixelSize||E===a.lpPixelWidth&&N===a.lpPixelHeight||(a.lpPixelWidth=E,a.lpPixelHeight=N,d.uniform2f(a.locPixelSize,E,N));E=n[2];N=n[3];!a.locDestStart||E===a.lpDestStartX&&N===a.lpDestStartY||(a.lpDestStartX=E,a.lpDestStartY=N,d.uniform2f(a.locDestStart,E,N));E=n[4];N=n[5];!a.locDestEnd||E===a.lpDestEndX&&N===a.lpDestEndY||(a.lpDestEndX=E,a.lpDestEndY=N,d.uniform2f(a.locDestEnd,E,N));E=n[6];
a.locLayerScale&&E!==a.lpLayerScale&&(a.lpLayerScale=E,d.uniform1f(a.locLayerScale,E));E=n[7];a.locLayerAngle&&E!==a.lpLayerAngle&&(a.lpLayerAngle=E,d.uniform1f(a.locLayerAngle,E));E=n[12];N=n[13];!a.locSrcStart||E===a.lpSrcStartX&&N===a.lpSrcStartY||(a.lpSrcStartX=E,a.lpSrcStartY=N,d.uniform2f(a.locSrcStart,E,N));E=n[14];N=n[15];!a.locSrcEnd||E===a.lpSrcEndX&&N===a.lpSrcEndY||(a.lpSrcEndX=E,a.lpSrcEndY=N,d.uniform2f(a.locSrcEnd,E,N));E=u[0];N=u[1];!a.locSrcOriginStart||E===a.lpSrcOriginStartX&&N===
a.lpSrcOriginStartY||(a.lpSrcOriginStartX=E,a.lpSrcOriginStartY=N,d.uniform2f(a.locSrcOriginStart,E,N));E=u[2];N=u[3];!a.locSrcOriginEnd||E===a.lpSrcOriginEndX&&N===a.lpSrcOriginEndY||(a.lpSrcOriginEndX=E,a.lpSrcOriginEndY=N,d.uniform2f(a.locSrcOriginEnd,E,N));E=C[0];N=C[1];!a.locLayoutStart||E===a.lpLayoutStartX&&N===a.lpLayoutStartY||(a.lpLayoutStartX=E,a.lpLayoutStartY=N,d.uniform2f(a.locLayoutStart,E,N));E=C[2];N=C[3];!a.locLayoutEnd||E===a.lpLayoutEndX&&N===a.lpLayoutEndY||(a.lpLayoutEndX=E,
a.lpLayoutEndY=N,d.uniform2f(a.locLayoutEnd,E,N));E=this.startIndex;a.locSeconds&&E!==a.lpSeconds&&(a.lpSeconds=E,d.uniform1f(a.locSeconds,E));if(a.parameters.length)for(n=0,C=a.parameters.length;n<C;n++)E=this.shaderParams[n],Array.isArray(E)?d.uniform3fv(a.parameters[n][1],E):E!==a.lastCustomParams[n]&&(a.lastCustomParams[n]=E,d.uniform1f(a.parameters[n][1],E))};b.prototype.pushBatch=function(){this.batchPtr===this.batch.length&&this.batch.push(new D(0,this));return this.batch[this.batchPtr++]};
b.prototype.endBatch=function(){if(0!==this.batchPtr&&!this.gl.isContextLost()){this.maybeStartTiming();var a=this.gl;0<this.pointPtr&&(a.bindBuffer(a.ARRAY_BUFFER,this.pointBuffer),a.bufferSubData(a.ARRAY_BUFFER,0,this.pointData.subarray(0,this.pointPtr)),d&&0<=d.locAPos&&"<point>"===d.name&&a.vertexAttribPointer(d.locAPos,4,a.FLOAT,!1,0,0));if(0<this.vertexPtr){var d=this.currentShader;a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffers[this.curBuffer]);a.bufferSubData(a.ARRAY_BUFFER,0,this.vertexData.subarray(0,
this.vertexPtr));d&&0<=d.locAPos&&"<point>"!==d.name&&a.vertexAttribPointer(d.locAPos,this.enableFrontToBack?3:2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this.texcoordBuffers[this.curBuffer]);a.bufferSubData(a.ARRAY_BUFFER,0,this.texcoordData.subarray(0,this.texPtr));d&&0<=d.locATex&&"<point>"!==d.name&&a.vertexAttribPointer(d.locATex,2,a.FLOAT,!1,0,0)}a=0;for(d=this.batchPtr;a<d;a++){var n=this.batch[a];switch(n.type){case 1:n.doQuad();break;case 2:n.doSetTexture();break;case 3:n.doSetOpacity();
break;case 4:n.doSetBlend();break;case 5:n.doUpdateModelView();break;case 6:n.doRenderToTexture();break;case 7:n.doClear();break;case 8:n.doPoints();break;case 9:n.doSetProgram();break;case 10:n.doSetProgramParameters();break;case 11:n.doSetTexture1();break;case 12:n.doSetColor();break;case 13:n.doSetDepthTestEnabled();break;case 14:n.doSetEarlyZPass()}}this.pointPtr=this.texPtr=this.vertexPtr=this.batchPtr=0;this.isBatchInEarlyZPass=this.hasPointBatchTop=this.hasQuadBatchTop=!1;this.curBuffer++;
4<=this.curBuffer&&(this.curBuffer=0)}};b.prototype.maybeStartTiming=function(){if(!this.isTiming&&this.timerExt){this.isTiming=!0;var a={frameNumber:this.frameNumber,query:null,result:0};2===this.version?(a.query=this.gl.createQuery(),this.gl.beginQuery(this.timerExt.TIME_ELAPSED_EXT,a.query)):(a.query=this.timerExt.createQueryEXT(),this.timerExt.beginQueryEXT(this.timerExt.TIME_ELAPSED_EXT,a.query));this.timerResults.push(a);1E3<this.timerResults.length&&(a=this.timerResults.shift(),a.query&&(2===
this.version?this.gl.deleteQuery(a.query):this.timerExt.deleteQueryEXT(a.query)))}};b.prototype.maybeFinishTiming=function(){this.isTiming&&this.timerResults.length&&(2===this.version?this.gl.endQuery(this.timerExt.TIME_ELAPSED_EXT):this.timerExt.endQueryEXT(this.timerExt.TIME_ELAPSED_EXT),this.isTiming=!1)};b.prototype.checkForTimerResults=function(a){var d;var n=0;for(d=this.timerResults.length;n<d;++n){var C=this.timerResults[n];if(C.frameNumber>=a)break;if(C.query){var u=2===this.version?this.gl.getQueryParameter(C.query,
this.gl.QUERY_RESULT_AVAILABLE):this.timerExt.getQueryObjectEXT(C.query,this.timerExt.QUERY_RESULT_AVAILABLE_EXT);var E=this.gl.getParameter(this.timerExt.GPU_DISJOINT_EXT);u&&!E&&(C.result=2===this.version?this.gl.getQueryParameter(C.query,this.gl.QUERY_RESULT):this.timerExt.getQueryObjectEXT(C.query,this.timerExt.QUERY_RESULT_EXT),C.result/=1E9);if(u||E)2===this.version?this.gl.deleteQuery(C.query):this.timerExt.deleteQueryEXT(C.query),C.query=null}}};b.prototype.getFrameRangeTimerResults=function(a,
d){if(d<=a)return-1;var n,C=0,u=0;var E=0;for(n=this.timerResults.length;E<n;++E){var N=this.timerResults[E];if(N.frameNumber>=d)break;if(N.frameNumber>=a){if(N.query)return-1;C+=N.result;u++}}return u<d-a?-1:C};b.prototype.deleteTimerResultsToFrame=function(a){var d;var n=0;for(d=this.timerResults.length;n<d;++n){var C=this.timerResults[n];if(C.frameNumber>=a){0<n&&this.timerResults.splice(0,n);break}}};b.prototype.setOpacity=function(a){if(a!==this.lastOpacity&&!this.isEarlyZPass){var d=this.pushBatch();
d.type=3;this.lastOpacity=d.opacityParam=a;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.setTexture=function(a){if(a!==this.lastTexture0){var d=this.pushBatch();d.type=2;this.lastTexture0=d.texParam=a;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.setBlend=function(a,d){if((a!==this.lastSrcBlend||d!==this.lastDestBlend)&&!this.isEarlyZPass){var n=this.pushBatch();n.type=4;n.startIndex=a;n.indexCount=d;this.lastSrcBlend=a;this.lastDestBlend=d;this.hasPointBatchTop=this.hasQuadBatchTop=
!1}};b.prototype.isPremultipliedAlphaBlend=function(){return this.lastSrcBlend===this.gl.ONE&&this.lastDestBlend===this.gl.ONE_MINUS_SRC_ALPHA};b.prototype.setAlphaBlend=function(){this.setBlend(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA)};b.prototype.setNoPremultiplyAlphaBlend=function(){this.setBlend(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)};b.prototype.quad=function(a,d,n,C,u,E,N,z){15992<=this.vertexPtr&&this.endBatch();var H=this.vertexPtr,F=this.texPtr,g=this.vertexData,p=this.texcoordData,
A=this.currentZ;if(this.hasQuadBatchTop)this.batch[this.batchPtr-1].indexCount+=6;else{var T=this.pushBatch();T.type=1;T.startIndex=this.enableFrontToBack?H:H/2*3;T.indexCount=6;this.hasQuadBatchTop=!0;this.hasPointBatchTop=!1}this.enableFrontToBack?(g[H++]=a,g[H++]=d,g[H++]=A,g[H++]=n,g[H++]=C,g[H++]=A,g[H++]=u,g[H++]=E,g[H++]=A,g[H++]=N,g[H++]=z,g[H++]=A):(g[H++]=a,g[H++]=d,g[H++]=n,g[H++]=C,g[H++]=u,g[H++]=E,g[H++]=N,g[H++]=z);p[F++]=0;p[F++]=0;p[F++]=1;p[F++]=0;p[F++]=1;p[F++]=1;p[F++]=0;p[F++]=
1;this.vertexPtr=H;this.texPtr=F};b.prototype.quadTex=function(a,d,n,C,u,E,N,z,H){15992<=this.vertexPtr&&this.endBatch();var F=this.vertexPtr,g=this.texPtr,p=this.vertexData,A=this.texcoordData,T=this.currentZ;if(this.hasQuadBatchTop)this.batch[this.batchPtr-1].indexCount+=6;else{var W=this.pushBatch();W.type=1;W.startIndex=this.enableFrontToBack?F:F/2*3;W.indexCount=6;this.hasQuadBatchTop=!0;this.hasPointBatchTop=!1}W=H.left;var I=H.top,c=H.right;H=H.bottom;this.enableFrontToBack?(p[F++]=a,p[F++]=
d,p[F++]=T,p[F++]=n,p[F++]=C,p[F++]=T,p[F++]=u,p[F++]=E,p[F++]=T,p[F++]=N,p[F++]=z,p[F++]=T):(p[F++]=a,p[F++]=d,p[F++]=n,p[F++]=C,p[F++]=u,p[F++]=E,p[F++]=N,p[F++]=z);A[g++]=W;A[g++]=I;A[g++]=c;A[g++]=I;A[g++]=c;A[g++]=H;A[g++]=W;A[g++]=H;this.vertexPtr=F;this.texPtr=g};b.prototype.quadTexUV=function(a,d,n,C,u,E,N,z,H,F,g,p,A,T,W,I){15992<=this.vertexPtr&&this.endBatch();var c=this.vertexPtr,h=this.texPtr,G=this.vertexData,f=this.texcoordData,r=this.currentZ;if(this.hasQuadBatchTop)this.batch[this.batchPtr-
1].indexCount+=6;else{var J=this.pushBatch();J.type=1;J.startIndex=this.enableFrontToBack?c:c/2*3;J.indexCount=6;this.hasQuadBatchTop=!0;this.hasPointBatchTop=!1}this.enableFrontToBack?(G[c++]=a,G[c++]=d,G[c++]=r,G[c++]=n,G[c++]=C,G[c++]=r,G[c++]=u,G[c++]=E,G[c++]=r,G[c++]=N,G[c++]=z,G[c++]=r):(G[c++]=a,G[c++]=d,G[c++]=n,G[c++]=C,G[c++]=u,G[c++]=E,G[c++]=N,G[c++]=z);f[h++]=H;f[h++]=F;f[h++]=g;f[h++]=p;f[h++]=A;f[h++]=T;f[h++]=W;f[h++]=I;this.vertexPtr=c;this.texPtr=h};b.prototype.convexPoly=function(a){var d=
a.length/2-2,n=d-1,C=a[0],u=a[1],E;for(E=0;E<d;E+=2){var N=2*E;var z=a[N+2];var H=a[N+3];var F=a[N+4];var g=a[N+5];if(E===n)this.quad(C,u,z,H,F,g,F,g);else{var p=a[N+6];N=a[N+7];this.quad(C,u,z,H,F,g,p,N)}}};b.prototype.point=function(a,d,n,C){7996<=this.pointPtr&&this.endBatch();var u=this.pointPtr,E=this.pointData;if(this.hasPointBatchTop)this.batch[this.batchPtr-1].indexCount++;else{var N=this.pushBatch();N.type=8;N.startIndex=u;N.indexCount=1;this.hasPointBatchTop=!0;this.hasQuadBatchTop=!1}E[u++]=
a;E[u++]=d;E[u++]=n;E[u++]=C;this.pointPtr=u};b.prototype.switchProgram=function(a){if(this.lastProgram!==a){if(!this.shaderPrograms[a]){if(0===this.lastProgram)return;a=0}var d=this.pushBatch();d.type=9;this.lastProgram=d.startIndex=a;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.programUsesDest=function(a){a=this.shaderPrograms[a];return!(!a.locDestStart&&!a.locDestEnd)};b.prototype.programUsesCrossSampling=function(a){a=this.shaderPrograms[a];return!!(a.locDestStart||a.locDestEnd||
a.crossSampling)};b.prototype.programPreservesOpaqueness=function(a){return this.shaderPrograms[a].preservesOpaqueness};b.prototype.programExtendsBox=function(a){a=this.shaderPrograms[a];return 0!==a.extendBoxHorizontal||0!==a.extendBoxVertical};b.prototype.getProgramBoxExtendHorizontal=function(a){return this.shaderPrograms[a].extendBoxHorizontal};b.prototype.getProgramBoxExtendVertical=function(a){return this.shaderPrograms[a].extendBoxVertical};b.prototype.getProgramParameterType=function(a,d){return this.shaderPrograms[a].parameters[d][2]};
b.prototype.programIsAnimated=function(a){return this.shaderPrograms[a].animated};b.prototype.setProgramParameters=function(a,d,n,C,u,E,N,z,H,F,g,p,A,T,W,I,c,h,G,f,r,J,M){var V=this.shaderPrograms[this.lastProgram];if(V.hasAnyOptionalUniforms||M.length){var X=this.pushBatch();X.type=10;X.mat4param?mat4.set(this.matMV,X.mat4param):X.mat4param=mat4.create();var aa=X.mat4param;aa[0]=d;aa[1]=n;aa[2]=I;aa[3]=c;aa[4]=h;aa[5]=G;aa[6]=f;aa[7]=r;aa[12]=C;aa[13]=u;aa[14]=E;aa[15]=N;d=X.srcOriginRect;d[0]=z;
d[1]=H;d[2]=F;d[3]=g;z=X.layoutRect;z[0]=p;z[1]=W;z[2]=T;z[3]=A;X.startIndex=J;X.texParam=V.locSamplerBack?a:null;if(M.length)for(A=X.shaderParams,A.length=M.length,a=0,p=M.length;a<p;a++)A[a]=M[a];this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.clear=function(a,d,n,C){var u=this.pushBatch();u.type=7;u.startIndex=0;u.mat4param||(u.mat4param=mat4.create());u.mat4param[0]=a;u.mat4param[1]=d;u.mat4param[2]=n;u.mat4param[3]=C;this.hasPointBatchTop=this.hasQuadBatchTop=!1};b.prototype.clearRect=
function(a,d,n,C){if(!(0>n||0>C)){var u=this.pushBatch();u.type=7;u.startIndex=1;u.mat4param||(u.mat4param=mat4.create());u.mat4param[0]=a;u.mat4param[1]=d;u.mat4param[2]=n;u.mat4param[3]=C;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.clearDepth=function(){var a=this.pushBatch();a.type=7;a.startIndex=2;this.hasPointBatchTop=this.hasQuadBatchTop=!1};b.prototype.setEarlyZPass=function(a){if(this.enableFrontToBack&&(a=!!a,this.isEarlyZPass!==a)){var d=this.pushBatch();d.type=14;d.startIndex=
a?1:0;this.hasPointBatchTop=this.hasQuadBatchTop=!1;this.isEarlyZPass=a;this.renderToTex=null;this.isEarlyZPass?this.switchProgram(2):this.switchProgram(0)}};b.prototype.setDepthTestEnabled=function(a){if(this.enableFrontToBack){var d=this.pushBatch();d.type=13;d.startIndex=a?1:0;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};b.prototype.fullscreenQuad=function(){mat4.set(this.lastMV,O);this.resetModelView();this.updateModelView();var a=this.width/2,d=this.height/2;this.quad(-a,d,a,d,a,-d,-a,-d);
mat4.set(O,this.matMV);this.updateModelView()};b.prototype.setColorFillMode=function(a,d,n,C){this.switchProgram(3);var u=this.pushBatch();u.type=12;u.mat4param||(u.mat4param=mat4.create());u.mat4param[0]=a;u.mat4param[1]=d;u.mat4param[2]=n;u.mat4param[3]=C;this.hasPointBatchTop=this.hasQuadBatchTop=!1};b.prototype.setTextureFillMode=function(){this.switchProgram(0)};b.prototype.restoreEarlyZMode=function(){this.switchProgram(2)};b.prototype.getFrameNumber=function(){return this.frameNumber};b.prototype.present=
function(){this.endBatch();this.maybeFinishTiming();this.gl.flush();this.checkForTimerResults(this.frameNumber);this.frameNumber++};b.prototype.supportsGpuProfiling=function(){return!!this.timerExt};var L=[],k={};b.prototype.contextLost=function(){cr.clearArray(L);k={}};b.prototype.loadTexture=function(a,d,n,C,u,E){d=!!d;n=!!n;var N=a.src+","+d+","+n+(d?","+u:"");if("undefined"!==typeof a.src&&k.hasOwnProperty(N)){var z=k[N];z.c2refcount++;return z}this.endBatch();var H=this.gl,F=cr.isPOT(a.width)&&
cr.isPOT(a.height);z=H.createTexture();H.bindTexture(H.TEXTURE_2D,z);H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);var g=H.RGBA,p=H.RGBA,A=H.UNSIGNED_BYTE;if(C&&!this.isIE)switch(C){case 1:p=g=H.RGB;break;case 2:A=H.UNSIGNED_SHORT_4_4_4_4;break;case 3:A=H.UNSIGNED_SHORT_5_5_5_1;break;case 4:p=g=H.RGB,A=H.UNSIGNED_SHORT_5_6_5}if(1===this.version&&!F&&d){C=document.createElement("canvas");C.width=cr.nextHighestPowerOfTwo(a.width);C.height=cr.nextHighestPowerOfTwo(a.height);var T=C.getContext("2d");
T.imageSmoothingEnabled=n;T.drawImage(a,0,0,a.width,a.height,0,0,C.width,C.height);H.texImage2D(H.TEXTURE_2D,0,g,p,A,C)}else H.texImage2D(H.TEXTURE_2D,0,g,p,A,a);d?"repeat-x"===u?(H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_S,H.REPEAT),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE)):("repeat-y"===u?H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE):H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_S,H.REPEAT),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_T,H.REPEAT)):(H.texParameteri(H.TEXTURE_2D,
H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE));n?(H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MAG_FILTER,H.LINEAR),(F||2<=this.version)&&this.enable_mipmaps&&!E?(H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.LINEAR_MIPMAP_LINEAR),H.generateMipmap(H.TEXTURE_2D)):H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.LINEAR)):(H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MAG_FILTER,H.NEAREST),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.NEAREST));H.bindTexture(H.TEXTURE_2D,
null);this.lastTexture0=null;z.c2width=a.width;z.c2height=a.height;z.c2refcount=1;z.c2texkey=N;L.push(z);return k[N]=z};b.prototype.createEmptyTexture=function(a,d,n,C,u){this.endBatch();var E=this.gl;this.isIE&&(C=!1);var N=E.createTexture();E.bindTexture(E.TEXTURE_2D,N);E.texImage2D(E.TEXTURE_2D,0,E.RGBA,a,d,0,E.RGBA,C?E.UNSIGNED_SHORT_4_4_4_4:E.UNSIGNED_BYTE,null);u?(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.REPEAT),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.REPEAT)):(E.texParameteri(E.TEXTURE_2D,
E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE));E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,n?E.LINEAR:E.NEAREST);E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,n?E.LINEAR:E.NEAREST);E.bindTexture(E.TEXTURE_2D,null);this.lastTexture0=null;N.c2width=a;N.c2height=d;L.push(N);return N};b.prototype.videoToTexture=function(a,d,n){this.endBatch();var C=this.gl;this.isIE&&(n=!1);C.bindTexture(C.TEXTURE_2D,d);C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
!0);try{C.texImage2D(C.TEXTURE_2D,0,C.RGBA,C.RGBA,n?C.UNSIGNED_SHORT_4_4_4_4:C.UNSIGNED_BYTE,a)}catch(u){console&&console.error&&console.error("Error updating WebGL texture: ",u)}C.bindTexture(C.TEXTURE_2D,null);this.lastTexture0=null};b.prototype.deleteTexture=function(a){a&&("undefined"!==typeof a.c2refcount&&1<a.c2refcount?a.c2refcount--:(this.endBatch(),a===this.lastTexture0&&(this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.lastTexture0=null),a===this.lastTexture1&&(this.gl.activeTexture(this.gl.TEXTURE1),
this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.activeTexture(this.gl.TEXTURE0),this.lastTexture1=null),cr.arrayFindRemove(L,a),"undefined"!==typeof a.c2texkey&&delete k[a.c2texkey],this.gl.deleteTexture(a)))};b.prototype.estimateVRAM=function(){var a=this.width*this.height*8,d;var n=0;for(d=L.length;n<d;n++){var C=L[n];a+=C.c2width*C.c2height*4}return a};b.prototype.textureCount=function(){return L.length};b.prototype.setRenderingToTexture=function(a){if(a!==this.renderToTex){var d=this.pushBatch();
d.type=6;this.renderToTex=d.texParam=a;this.hasPointBatchTop=this.hasQuadBatchTop=!1}};cr.GLWrap=b})();
(function(){function b(e){var m=e.canvas,x=e.projectDataUrl;m||(m=document.createElement("canvas"),document.body.appendChild(m));if(m&&m.getContext){window.c3runtime=this;window.c3canvas=m;var t=this;this.exportType=e.exportType;this.isPreview="preview"===this.exportType;this.isRemotePreview=!!e.isRemotePreview;this.isCrosswalk=/crosswalk/i.test(navigator.userAgent)||/xwalk/i.test(navigator.userAgent)||!("undefined"===typeof window.c2isCrosswalk||!window.c2isCrosswalk);this.isPhoneGap=this.isCordova=
"cordova"===this.exportType;this.isMicrosoftEdge=/edge\//i.test(navigator.userAgent);this.isIE=(/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent)||/iemobile/i.test(navigator.userAgent))&&!this.isMicrosoftEdge;this.isTizen=/tizen/i.test(navigator.userAgent);this.isAndroid=/android/i.test(navigator.userAgent)&&!this.isTizen&&!this.isIE&&!this.isMicrosoftEdge;this.isiPhone=(/iphone/i.test(navigator.userAgent)||/ipod/i.test(navigator.userAgent))&&!this.isIE&&!this.isMicrosoftEdge;
this.isiPad=/ipad/i.test(navigator.userAgent);this.isiOS=this.isiPhone||this.isiPad;this.isChrome=(/chrome/i.test(navigator.userAgent)||/chromium/i.test(navigator.userAgent))&&!this.isIE&&!this.isMicrosoftEdge;this.isAmazonWebApp=/amazonwebappplatform/i.test(navigator.userAgent);this.isFirefox=/firefox/i.test(navigator.userAgent);this.isSafari=/safari/i.test(navigator.userAgent)&&!this.isChrome&&!this.isIE&&!this.isMicrosoftEdge;this.isWindows=/windows/i.test(navigator.userAgent);this.isNodeWebkit=
this.isNWjs="nwjs"===this.exportType||/nodewebkit/i.test(navigator.userAgent)||/nwjs/i.test(navigator.userAgent);this.isArcade="scirra-arcade"===this.exportType;this.isWindows8App=!("undefined"===typeof window.c2isWindows8||!window.c2isWindows8);this.isWindowsPhone8=!("undefined"===typeof window.c2isWindowsPhone8||!window.c2isWindowsPhone8);this.isWindowsPhone81=!("undefined"===typeof window.c2isWindowsPhone81||!window.c2isWindowsPhone81);this.isWindows10="windows-uwp"===this.exportType;this.isWinJS=
this.isWindows8App||this.isWindowsPhone81||this.isWindows10;this.isBlackberry10=!("undefined"===typeof window.c2isBlackberry10||!window.c2isBlackberry10);this.isAndroidStockBrowser=this.isAndroid&&!this.isChrome&&!this.isCrosswalk&&!this.isFirefox&&!this.isAmazonWebApp;this.devicePixelRatio=1;this.isMobile=this.isCordova||this.isCrosswalk||this.isAndroid||this.isiOS||this.isWindowsPhone8||this.isWindowsPhone81||this.isBlackberry10||this.isTizen;this.isMobile||(this.isMobile=/(blackberry|bb10|playbook|palm|symbian|nokia|windows\s+ce|phone|mobile|tablet|kindle|silk)/i.test(navigator.userAgent));
this.isWKWebView=!(!this.isiOS||!this.isCordova);this.isPreview&&!this.isNWjs&&("?nw"===window.location.search||/nodewebkit/i.test(navigator.userAgent)||/nwjs/i.test(navigator.userAgent))&&(this.isNWjs=!0);this.isDebug=this.isPreview&&-1<window.location.search.indexOf("debug");this.useFbInstant="undefined"!==typeof FBInstant&&!this.isPreview&&!this.isCordova;this.hasInitialized=!1;this.canvas=m;this.glwrap=this.gl=null;this.glUnmaskedRenderer="(unavailable)";this.enableFrontToBack=!1;this.earlyz_index=
0;this.ctx=null;this.firstInFullscreen=!1;this.oldHeight=this.oldWidth=0;this.canvas.oncontextmenu=function(v){v.preventDefault&&v.preventDefault();return!1};this.canvas.onselectstart=function(v){v.preventDefault&&v.preventDefault();return!1};this.canvas.ontouchstart=function(v){v.preventDefault&&v.preventDefault();return!1};this.isNWjs&&(window.ondragover=function(v){v.preventDefault();return!1},window.ondrop=function(v){v.preventDefault();return!1},window.nwgui&&window.nwgui.App.clearCache&&window.nwgui.App.clearCache());
if(this.isCordova&&this.isiOS){function v(){var q=document.activeElement;if(!q)return!1;var y=q.tagName.toLowerCase(),B="email number password search tel text url".split(" ");if("textarea"===y)return!0;if("input"===y)return-1<B.indexOf(q.type.toLowerCase()||"text");a:{do{if(q.parentNode&&q.hasAttribute("contenteditable")){q=!0;break a}q=q.parentNode}while(q);q=!1}return q}window.addEventListener("focusout",function(){v()||(document.scrollingElement.scrollTop=0)})}this.projectDataUrl=x||"";this.width=
m.width;this.height=m.height;this.draw_width=this.width;this.draw_height=this.height;this.cssWidth=this.width;this.cssHeight=this.height;this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.forceCanvasAlpha=!1;this.redraw=!0;this.isSuspended=!1;Date.now||(Date.now=function(){return+new Date});this.plugins=[];this.types={};this.types_lowercase={};this.types_by_index=[];this.behaviors=[];this.layouts={};this.layouts_by_index=[];this.eventsheets={};this.eventsheets_by_index=
[];this.wait_for_textures=[];this.triggers_to_postinit=[];this.all_global_vars=[];this.all_local_vars=[];this.shadowcasterBehavior=this.jumpthruBehavior=this.solidBehavior=null;this.deathRow={};this.isInClearDeathRow=this.hasPendingInstances=!1;this.isInOnDestroy=0;this.isEndingLayout=this.isRunningEvents=!1;this.createRow=[];this.isLoadingState=!1;this.loadFromSlot=this.saveToSlot="";this.loadFromJson=null;this.lastSaveJson="";this.suspendDrawing=this.signalledContinuousPreview=!1;this.fireOnCreateAfterLoad=
[];this.dt1=this.dt=0;this.minimumFramerate=30;this.cpuutilisation=this.logictime=0;this.timescale=1;this.kahanTime=new cr.KahanAdder;this.wallTime=new cr.KahanAdder;this.gpuTimeEndFrame=this.gpuTimeStartFrame=this.objectcount=this.framecount=this.execcount=this.tickcount_nosave=this.tickcount=this.last_fps_time=this.fps=this.last_tick_time=0;this.gpuCurUtilisation=-1;this.gpuLastUtilisation=0;this.changelayout=null;this.destroycallbacks=[];this.event_stack=[];this.event_stack_index=-1;this.localvar_stack=
[[]];this.trigger_depth=this.localvar_stack_index=0;this.pushEventStack(null);this.loop_stack=[];this.loop_stack_index=-1;this.next_puid=this.next_uid=0;this.layout_first_tick=!0;this.family_count=0;this.suspend_events=[];this.timeout_id=this.raf_id=-1;this.isloading=!0;this.stackLocalCount=this.loadingprogress=0;this.audioInstance=null;this.isInUserInputEvent=this.had_a_click=!1;this.objects_to_pretick=new cr.ObjectSet;this.objects_to_tick=new cr.ObjectSet;this.objects_to_tick2=new cr.ObjectSet;
this.registered_collisions=[];this.temp_poly=new cr.CollisionPoly([]);this.temp_poly2=new cr.CollisionPoly([]);this.allGroups=[];this.groups_by_name={};this.cndsBySid={};this.actsBySid={};this.varsBySid={};this.blocksBySid={};this.layout_ctx=this.layout_canvas=this.layout_tex=this.layer_tex=this.layer_ctx=this.layer_canvas=this.running_layout=null;this.uses_background_blending=this.is_WebGL_context_lost=!1;this.fx_tex=[null,null];this.fullscreen_scaling=0;this.files_subfolder="";this.objectsByUid=
{};this.webFontNames=this.loaderlogos=null;this.enhancedAccelerationPrecision=!0;this.snapshotCanvas=null;this.snapshotData="";this.objectRefTable=[];"html5"===this.exportType&&"file"===location.protocol.substr(0,4)&&alert("Exported games won't work until you upload them. (When running on the file: protocol, browsers block many features from working for security reasons.)");this.useFbInstant?(FBInstant.initializeAsync().then(function(){t.requestProjectData()}).catch(function(v){console.warn("[Instant Games] Unable to load: ",
v);t.requestProjectData()}),window.setTimeout(function(){t.hasInitialized||(console.warn("[Instant Games] Initialization timed out after 4 seconds. Continuing with Instant Games disabled."),t.useFbInstant=!1,t.requestProjectData())},4E3)):this.requestProjectData()}}function l(){var e=window.cordova&&window.cordova.plugins&&window.cordova.plugins.permissions;"object"!==typeof e&&Promise.reject("Permission API is not loaded");return Promise.resolve(e)}function w(e){return l().then(function(m){return new Promise(function(x,
t){m.requestPermission(m[e],function(v){x(v.hasPermission)},t)})})}function D(e){return l().then(function(m){return new Promise(function(x,t){m.checkPermission(m[e],function(v){x(v.hasPermission)},t)})})}function O(){try{return!!window.indexedDB}catch(e){return!1}}function L(e){e.target.result.createObjectStore("saves",{keyPath:"slot"})}function k(e,m,x,t){try{var v=indexedDB.open("_C2SaveStates");v.onupgradeneeded=L;v.onerror=t;v.onsuccess=function(q){q=q.target.result;q.onerror=t;q.transaction(["saves"],
"readwrite").objectStore("saves").put({slot:e,data:m}).onsuccess=x}}catch(q){t(q)}}function a(e,m,x){try{var t=indexedDB.open("_C2SaveStates");t.onupgradeneeded=L;t.onerror=x;t.onsuccess=function(v){v=v.target.result;v.onerror=x;var q=v.transaction(["saves"]).objectStore("saves").get(e);q.onsuccess=function(y){q.result?m(q.result.data):m(null)}}}catch(v){x(v)}}function d(){cr.logexport("Reloading for continuous preview");-1<window.location.search.indexOf("continuous")?window.location.reload(!0):window.location+=
"?continuous"}function n(e){var m,x={};for(m in e)!e.hasOwnProperty(m)||e[m]instanceof cr.ObjectSet||e[m]&&"undefined"!==typeof e[m].c2userdata||"spriteCreatedDestroyCallback"!==m&&(x[m]=e[m]);return x}var C=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,u=new Audio,E={"audio/webm; codecs=opus":!!u.canPlayType("audio/webm; codecs=opus"),"audio/ogg; codecs=opus":!!u.canPlayType("audio/ogg; codecs=opus"),
"audio/webm; codecs=vorbis":!!u.canPlayType("audio/webm; codecs=vorbis"),"audio/ogg; codecs=vorbis":!!u.canPlayType("audio/ogg; codecs=vorbis"),"audio/mp4":!!u.canPlayType("audio/mp4"),"audio/mpeg":!!u.canPlayType("audio/mpeg")};u=null;b.prototype.requestProjectData=function(){if(!this.hasInitialized){this.hasInitialized=!0;var e=this;if(this.isWKWebView)this.fetchLocalFileViaCordovaAsText("data.js",function(v){e.loadProject(JSON.parse(v))},function(v){alert("Error fetching data.js")});else{var m=
this.isWindowsPhone8?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest;var x=this.projectDataUrl||"data.js";if(this.isWindows8App||this.isWindowsPhone8||this.isWindowsPhone81||this.isWindows10)x="data.json";m.open("GET",x,!0);var t=!1;if("response"in m&&"responseType"in m)try{m.responseType="json",t="json"===m.responseType}catch(v){t=!1}if(!t&&"responseType"in m)try{m.responseType="text"}catch(v){}if("overrideMimeType"in m)try{m.overrideMimeType("application/json; charset=utf-8")}catch(v){}this.isWindowsPhone8?
m.onreadystatechange=function(){4===m.readyState&&e.loadProject(JSON.parse(m.responseText))}:(m.onload=function(){t?e.loadProject(m.response):e.loadProject(JSON.parse(m.responseText))},m.onerror=function(v){cr.logerror("Error requesting "+x+":");cr.logerror(v)});m.send()}}};b.prototype.initRendererAndLoader=function(){var e=this,m,x;this.isRetina=this.useHighDpi&&!this.isAndroidStockBrowser;0===this.fullscreen_mode&&this.isiOS&&(this.isRetina=!1);var t=window.devicePixelRatio||window.webkitDevicePixelRatio||
window.mozDevicePixelRatio||window.msDevicePixelRatio||1;this.devicePixelRatio=this.isRetina?t:1;"object"===typeof window.StatusBar&&window.StatusBar.hide();"object"===typeof window.AndroidFullScreen&&window.AndroidFullScreen.immersiveMode();this.ClearDeathRow();0<this.fullscreen_mode&&this.setSize(window.innerWidth,window.innerHeight,!0);try{if(this.enableWebGL){var v={alpha:!0,depth:!1,antialias:!1,failIfMajorPerformanceCaveat:!0};this.isAndroid||(this.gl=this.canvas.getContext("webgl2",v));this.gl||
(this.gl=this.canvas.getContext("webgl",v)||this.canvas.getContext("experimental-webgl",v))}}catch(P){}if(this.gl){this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2");if(t=this.gl.getExtension("WEBGL_debug_renderer_info"))v=this.gl.getParameter(t.UNMASKED_VENDOR_WEBGL),this.glUnmaskedRenderer=this.gl.getParameter(t.UNMASKED_RENDERER_WEBGL)+" ["+v+"]";this.enableFrontToBack&&(this.glUnmaskedRenderer+=" [front-to-back enabled]");this.overlay_canvas=document.createElement("canvas");this.canvas.parentNode.appendChild(this.overlay_canvas);
this.overlay_canvas.oncontextmenu=function(P){return!1};this.overlay_canvas.onselectstart=function(P){return!1};this.overlay_canvas.width=Math.round(this.cssWidth*this.devicePixelRatio);this.overlay_canvas.height=Math.round(this.cssHeight*this.devicePixelRatio);this.overlay_canvas.style.width=this.cssWidth+"px";this.overlay_canvas.style.height=this.cssHeight+"px";this.overlay_canvas.style.position="absolute";this.overlay_ctx=this.overlay_canvas.getContext("2d");this.glwrap=new cr.GLWrap(this.gl,this.isMobile,
this.enableFrontToBack);this.glwrap.setSize(this.canvas.width,this.canvas.height);this.glwrap.enable_mipmaps=0!==this.downscalingQuality;this.ctx=null;this.canvas.addEventListener("webglcontextlost",function(P){P.preventDefault();e.onContextLost();cr.logexport("[Construct 2] WebGL context lost");window.cr_setSuspended(!0)},!1);this.canvas.addEventListener("webglcontextrestored",function(P){e.glwrap.initState();e.glwrap.setSize(e.glwrap.width,e.glwrap.height,!0);e.layer_tex=null;e.layout_tex=null;
e.fx_tex[0]=null;e.fx_tex[1]=null;e.onContextRestored();e.redraw=!0;cr.logexport("[Construct 2] WebGL context restored");window.cr_setSuspended(!1)},!1);this.glwrap.supportsGpuProfiling()||(this.gpuLastUtilisation=NaN);t=0;for(v=this.types_by_index.length;t<v;t++){var q=this.types_by_index[t];var y=0;for(m=q.effect_types.length;y<m;y++){var B=q.effect_types[y];B.shaderindex=this.glwrap.getShaderIndex(B.id);B.preservesOpaqueness=this.glwrap.programPreservesOpaqueness(B.shaderindex);this.uses_background_blending=
this.uses_background_blending||this.glwrap.programUsesDest(B.shaderindex)}}t=0;for(v=this.layouts_by_index.length;t<v;t++){var K=this.layouts_by_index[t];y=0;for(m=K.effect_types.length;y<m;y++)B=K.effect_types[y],B.shaderindex=this.glwrap.getShaderIndex(B.id),B.preservesOpaqueness=this.glwrap.programPreservesOpaqueness(B.shaderindex);K.updateActiveEffects();y=0;for(m=K.layers.length;y<m;y++){var S=K.layers[y];q=0;for(x=S.effect_types.length;q<x;q++)B=S.effect_types[q],B.shaderindex=this.glwrap.getShaderIndex(B.id),
B.preservesOpaqueness=this.glwrap.programPreservesOpaqueness(B.shaderindex),this.uses_background_blending=this.uses_background_blending||this.glwrap.programUsesDest(B.shaderindex);S.updateActiveEffects()}}}else v={alpha:!0},this.ctx=this.canvas.getContext("2d",v),this.ctx.imageSmoothingEnabled=this.linearSampling,this.overlay_ctx=this.overlay_canvas=null,this.gpuLastUtilisation=NaN,this.fullscreenScalingQuality=this.wantFullscreenScalingQuality=!0;this.tickFunc=function(P){e.tick(!1,P)};window==window.top||
this.isWinJS||this.isWindowsPhone8||(document.addEventListener("mousedown",function(){window.focus()},!0),document.addEventListener("touchstart",function(){window.focus()},!0));this.isPreview&&(-1<window.location.search.indexOf("continuous")&&(cr.logexport("Reloading for continuous preview"),this.loadFromSlot="__c2_continuouspreview",this.suspendDrawing=!0),this.pauseOnBlur&&!this.isMobile&&(window.addEventListener("focus",function(){e.setSuspended(!1)}),window.addEventListener("blur",function(){var P=
window.parent;P&&P.document.hasFocus()||e.setSuspended(!0)})));window.addEventListener("blur",function(){e.onWindowBlur()});t=function(P){"mousedown"===P.type&&1===P.button&&P.preventDefault();if(cr.isCanvasInputEvent(P)&&document.activeElement&&document.activeElement!==document.getElementsByTagName("body")[0]&&document.activeElement.blur)try{document.activeElement.blur()}catch(Q){}};"undefined"!==typeof PointerEvent?document.addEventListener("pointerdown",t):window.navigator.msPointerEnabled?document.addEventListener("MSPointerDown",
t):document.addEventListener("touchstart",t);document.addEventListener("mousedown",t);0===this.fullscreen_mode&&this.isRetina&&1<this.devicePixelRatio?this.setSize(this.original_width,this.original_height,!0):this.setSize(window.innerWidth,window.innerHeight,!0);this.tryLockOrientation();this.getready();this.go();this.extra={};cr.seal(this)};b.prototype.setSize=function(e,m,x){var t=0,v=0;if(this.lastWindowWidth!==e||this.lastWindowHeight!==m||x){if(this.isiPhone&&this.isCordova&&window.screen){var q=
document.documentElement.style;var y=document.body.style;var B=window.innerWidth<window.innerHeight;var K=B?window.screen.height:window.screen.width;B=B?window.screen.width:window.screen.height;K&&B&&(y.height=q.height=K+"px",y.width=q.width=B+"px")}this.lastWindowWidth=e;this.lastWindowHeight=m;q=this.fullscreen_mode;if((y=(document.mozFullScreen||document.webkitIsFullScreen||!!document.msFullscreenElement||document.fullScreen)&&!this.isCordova)||0!==this.fullscreen_mode||x)y&&(q=this.fullscreen_scaling),
x=this.devicePixelRatio,4<=q?(5===q&&1!==x&&(e+=1,m+=1),y=this.original_width/this.original_height,e/m>y?(y*=m,5===q?(t=y*x/this.original_width,1<t?t=Math.floor(t):1>t&&(t=1/Math.ceil(1/t)),y=this.original_width*t/x,K=this.original_height*t/x,t=(e-y)/2,v=(m-K)/2,e=y,m=K):(t=(e-y)/2,e=y)):(K=e/y,5===q?(t=K*x/this.original_height,1<t?t=Math.floor(t):1>t&&(t=1/Math.ceil(1/t)),y=this.original_width*t/x,K=this.original_height*t/x,t=(e-y)/2,v=(m-K)/2,e=y):v=(m-K)/2,m=K)):y&&0===q&&(t=Math.floor((e-this.original_width)/
2),v=Math.floor((m-this.original_height)/2),e=this.original_width,m=this.original_height),2>q&&(this.aspect_scale=x),this.cssWidth=Math.round(e),this.cssHeight=Math.round(m),this.width=Math.round(e*x),this.height=Math.round(m*x),this.redraw=!0,this.wantFullscreenScalingQuality?(this.draw_width=this.width,this.draw_height=this.height,this.fullscreenScalingQuality=!0):this.width<this.original_width&&this.height<this.original_height||1===q?(this.draw_width=this.width,this.draw_height=this.height,this.fullscreenScalingQuality=
!0):(this.draw_width=this.original_width,this.draw_height=this.original_height,this.fullscreenScalingQuality=!1,2===q?(y=this.original_width/this.original_height,q=this.lastWindowWidth/this.lastWindowHeight,q<y?this.draw_width=this.draw_height*q:q>y&&(this.draw_height=this.draw_width/q)):3===q&&(y=this.original_width/this.original_height,q=this.lastWindowWidth/this.lastWindowHeight,q>y?this.draw_width=this.draw_height*q:q<y&&(this.draw_height=this.draw_width/q))),this.canvas&&(this.canvas.width=Math.round(e*
x),this.canvas.height=Math.round(m*x),this.isRetina&&(this.canvas.style.width=Math.round(e)+"px",this.canvas.style.height=Math.round(m)+"px"),this.canvas.style.marginLeft=Math.floor(t)+"px",this.canvas.style.marginTop=Math.floor(v)+"px"),this.overlay_canvas&&(this.overlay_canvas.width=Math.round(e*x),this.overlay_canvas.height=Math.round(m*x),this.overlay_canvas.style.width=this.cssWidth+"px",this.overlay_canvas.style.height=this.cssHeight+"px",this.overlay_canvas.style.left=Math.floor(t)+"px",this.overlay_canvas.style.top=
Math.floor(v)+"px"),this.glwrap&&this.glwrap.setSize(Math.round(e*x),Math.round(m*x)),this.ctx&&(this.ctx.imageSmoothingEnabled=this.linearSampling),this.tryLockOrientation(),this.isiPhone&&!this.isCordova&&window.scrollTo(0,0)}};b.prototype.tryLockOrientation=function(){if(this.autoLockOrientation&&0!==this.orientations){var e="portrait";2===this.orientations&&(e="landscape");try{screen.orientation&&screen.orientation.lock?screen.orientation.lock(e).catch(function(){}):screen.lockOrientation?screen.lockOrientation(e):
screen.webkitLockOrientation?screen.webkitLockOrientation(e):screen.mozLockOrientation?screen.mozLockOrientation(e):screen.msLockOrientation&&screen.msLockOrientation(e)}catch(m){console&&console.warn&&console.warn("Failed to lock orientation: ",m)}}};b.prototype.onContextLost=function(){this.glwrap.contextLost();this.is_WebGL_context_lost=!0;var e;var m=0;for(e=this.types_by_index.length;m<e;m++){var x=this.types_by_index[m];if(x.onLostWebGLContext)x.onLostWebGLContext()}};b.prototype.onContextRestored=
function(){this.is_WebGL_context_lost=!1;var e;var m=0;for(e=this.types_by_index.length;m<e;m++){var x=this.types_by_index[m];if(x.onRestoreWebGLContext)x.onRestoreWebGLContext()}};var N=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame;b.prototype.setSuspended=function(e){var m;if(e&&!this.isSuspended)for(cr.logexport("[Construct 2] Suspending"),this.isSuspended=!0,-1!==this.raf_id&&N(this.raf_id),
-1!==this.timeout_id&&clearTimeout(this.timeout_id),e=0,m=this.suspend_events.length;e<m;e++)this.suspend_events[e](!0);else if(!e&&this.isSuspended){cr.logexport("[Construct 2] Resuming");this.isSuspended=!1;this.last_tick_time=cr.performance_now();this.last_fps_time=cr.performance_now();e=this.logictime=this.framecount=0;for(m=this.suspend_events.length;e<m;e++)this.suspend_events[e](!1);this.tick(!1)}};b.prototype.addSuspendCallback=function(e){this.suspend_events.push(e)};b.prototype.GetObjectReference=
function(e){return this.objectRefTable[e]};b.prototype.loadProject=function(e){e&&e.project||cr.logerror("Project model unavailable");e=e.project;this.name=e[0];this.first_layout=e[1];this.fullscreen_mode=e[12];this.fullscreen_mode_set=e[12];this.original_width=e[10];this.original_height=e[11];this.parallax_x_origin=this.original_width/2;this.parallax_y_origin=this.original_height/2;this.uses_loader_layout=e[18];this.loaderstyle=e[19];this.iconsFolder=e[28];this.webFontNames=e[29].map(function(ba){return ba[0]});
if(0===this.loaderstyle){var m=new Image;m.crossOrigin="anonymous";var x=this.loaderlogos={logo:m};m.addEventListener("error",function(){x.logo=null});var t=e[39];t=this.isPreview?this.getProjectFileUrl(t):this.iconsFolder+t;this.setImageSrc(m,t)}else if(4===this.loaderstyle){m=new Image;m.src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSIxNzAwLjc5MDA0cHgiIGhlaWdodD0iMTcwMC43OTAwNHB4IiB2aWV3Qm94PSIyODcgMzE3IDExMjUgMTEyNSINCgkgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTcwMC43OTAwNCAxNzAwLjc5MDA0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnIGlkPSJsb2dvIj4NCgk8Zz4NCgkJPGc+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTM1NC45Nzc1NCwxMTk1LjYyMzA1DQoJCQkJYzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NjI5LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOGwtNC45MzI2Miw4LjU0MTk5DQoJCQkJYy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNjU2LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMzMiwwLDUuOTYxOTEtMC40NDMzNiw4LjcyNjU2LTEuMjY4NTVjNi4yOTQ5Mi0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTczOCw2LjUwMDk4bDQuOTMxNjQsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM4NDgsNS43MzQzOGMtOS4wMDM5MSw1LjYwMTU2LTE5LjYzMTg0LDguODM3ODktMzEuMDE2Niw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzI5Ni4xNTgyLDEyMjEuOTU3MDMsMzIyLjQ5MjE5LDExOTUuNjIzMDUsMzU0Ljk3NzU0LDExOTUuNjIzMDUNCgkJCQlMMzU0Ljk3NzU0LDExOTUuNjIzMDV6IE03MDMuMjE0ODQsMTI1OS4xNzU3OGMtMTQuNTU5NTctOS44MTczOC0yMC4yMDMxMy0yMC4wMzIyMy0yMC4yMDMxMy0zMy4wODAwOA0KCQkJCWMwLTE4LjQ4OTI2LDE1LjcxNDg0LTI5Ljc2MzY3LDM4LjI2NjYtMjkuNzYzNjdjOS42NTcyMywwLDE4LjcyMTY4LDIuNTQyOTcsMjYuNTU5NTcsNi45OTQxNA0KCQkJCWMyLjA0OTgsMS4xNjQwNiwyLjc2MTcyLDMuNzgzMiwxLjU4MzAxLDUuODI0MjJsLTMuNDE3OTcsNS45MTk5MmMtMy4yNDcwNyw1LjYyNDAyLTkuOTA4Miw4LjMzMTA1LTE2LjE1MzMyLDYuNTQ4ODMNCgkJCQljLTIuNzIzNjMtMC43NzYzNy01LjU5ODYzLTEuMTkyMzgtOC41NzEyOS0xLjE5MjM4Yy0xMC40OTAyMywwLTExLjU5ODYzLDkuNTc2MTctNC44NTc0MiwxNC4xMjMwNWwyMy42ODY1MiwxNS45NzY1Ng0KCQkJCWM5Ljk5MDIzLDYuNzM4MjgsMTUuODk1NTEsMTcuMDY2NDEsMTUuODk1NTEsMjguNzE4NzVjMCwxOC43ODYxMy0xNS4wMDY4NCwzMy4zMDc2Mi0zOC4yNjc1OCwzMy4zMDc2Mg0KCQkJCWMtOS41MjI0NiwwLTE4LjU4Nzg5LTEuOTU3MDMtMjYuODE1NDMtNS40OTAyM2MtNy43ODEyNS0zLjMzOTg0LTEwLjkzMzU5LTEyLjc4MjIzLTYuNjk3MjctMjAuMTE4MTZsMy40ODczLTYuMDQxOTkNCgkJCQljMS4yMTM4Ny0yLjA5OTYxLDMuOTMxNjQtMi43NTk3Nyw1Ljk3NDYxLTEuNDU2MDVjNi44NTkzOCw0LjM4MjgxLDE2LjQ5MDIzLDcuNTk0NzMsMjQuNzU4NzksNy41OTQ3Mw0KCQkJCWMxMC41NDU5LDAsMTEuMzI4MTMtOS45NTg5OCwzLjc2NzU4LTE1LjA1NzYyTDcwMy4yMTQ4NCwxMjU5LjE3NTc4TDcwMy4yMTQ4NCwxMjU5LjE3NTc4eiBNOTg0LjYzMDg2LDEyMDIuMDAwOTgNCgkJCQljMC0yLjM0NzY2LDEuOTAzMzItNC4yNTE5NSw0LjI1MTk1LTQuMjUxOTVoOS45MjE4OGM3LjgyNzE1LDAsMTQuMTcyODUsNi4zNDU3LDE0LjE3Mjg1LDE0LjE3MzgzdjU3LjQwMTM3DQoJCQkJYzAsOC42MTAzNSw2Ljk4MDQ3LDE1LjU5MDgyLDE1LjU5MDgyLDE1LjU5MDgyczE1LjU5MDgyLTYuOTgwNDcsMTUuNTkwODItMTUuNTkwODJ2LTU3LjQwMTM3DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoOS45MjA5YzIuMzQ4NjMsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2NjcuMzIzMjQNCgkJCQljMCwyNC4yNjU2My0xOS42NzA5LDQzLjkzNzUtNDMuOTM2NTIsNDMuOTM3NXMtNDMuOTM3NS0xOS42NzE4OC00My45Mzc1LTQzLjkzNzVWMTIwMi4wMDA5OEw5ODQuNjMwODYsMTIwMi4wMDA5OHoNCgkJCQkgTTQ2Ni44NjkxNCwxMTk1LjYyMzA1YzMyLjQ4NDM4LDAsNTguODE4MzYsMjYuMzMzOTgsNTguODE4MzYsNTguODE5MzRjMCwzMi40ODQzOC0yNi4zMzM5OCw1OC44MTkzNC01OC44MTgzNiw1OC44MTkzNA0KCQkJCWMtMzIuNDg2MzMsMC01OC44MTkzNC0yNi4zMzQ5Ni01OC44MTkzNC01OC44MTkzNEM0MDguMDQ5OCwxMjIxLjk1NzAzLDQzNC4zODI4MSwxMTk1LjYyMzA1LDQ2Ni44NjkxNCwxMTk1LjYyMzA1DQoJCQkJTDQ2Ni44NjkxNCwxMTk1LjYyMzA1eiBNNDY2Ljg2OTE0LDEyMjUuMDMzMmMtMTYuMjQzMTYsMC0yOS40MTAxNiwxMy4xNjY5OS0yOS40MTAxNiwyOS40MDkxOA0KCQkJCXMxMy4xNjY5OSwyOS40MDgyLDI5LjQxMDE2LDI5LjQwODJjMTYuMjQxMjEsMCwyOS40MDgyLTEzLjE2NjAyLDI5LjQwODItMjkuNDA4MlM0ODMuMTEwMzUsMTIyNS4wMzMyLDQ2Ni44NjkxNCwxMjI1LjAzMzINCgkJCQlMNDY2Ljg2OTE0LDEyMjUuMDMzMnogTTU1Ni43MzI0MiwxMzExLjEzNDc3Yy0yLjM0NzY2LDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtOTQuOTYxOTENCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzM4My0xNC4xNzM4M2gzLjk1ODk4YzQuNjI1LDAsOC45NTg5OCwyLjI1Njg0LDExLjYxMTMzLDYuMDQ1OWw0MS4xMjIwNyw1OC43NDcwN3YtNTAuNjE5MTQNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2g5LjkyMTg4YzIuMzQ3NjYsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2OTQuOTYwOTQNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3MzgzLDE0LjE3Mjg1aC0zLjk1ODk4Yy00LjYyNSwwLTguOTU4OTgtMi4yNTU4Ni0xMS42MTEzMy02LjA0NDkybC00MS4xMjIwNy01OC43NDYwOXY1MC42MTgxNg0KCQkJCWMwLDcuODI5MS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVINTU2LjczMjQyTDU1Ni43MzI0MiwxMzExLjEzNDc3eiBNMTIxNS4wMjA1MSwxMjExLjkyMjg1DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoNTAuMzE1NDNjMi4zNDg2MywwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyDQoJCQkJYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVoLTYuMDI0NDF2NzUuMTE4MTZjMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMTg4DQoJCQkJYy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtODUuMDQxMDJoLTE1Ljk0NDM0Yy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMzMyLTQuMjUxOTUtNC4yNTE5NVYxMjExLjkyMjg1DQoJCQkJTDEyMTUuMDIwNTEsMTIxMS45MjI4NXogTTc3Ni40NDkyMiwxMjExLjkyMjg1YzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTczODMtMTQuMTczODNoNTAuMzE0NDUNCgkJCQljMi4zNDk2MSwwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcxODgsMTQuMTcyODVoLTYuMDI1Mzl2NzUuMTE4MTYNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMDljLTIuMzQ5NjEsMC00LjI1MTk1LTEuOTAyMzQtNC4yNTE5NS00LjI1di04NS4wNDEwMmgtMTUuOTQ1MzENCgkJCQljLTIuMzQ3NjYsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMTEuOTIyODVMNzc2LjQ0OTIyLDEyMTEuOTIyODV6IE05MjkuNjA0NDksMTI3Mi4wMjI0NmwyNi45NTgwMSwzMi4xMjc5Mw0KCQkJCWMyLjMxNDQ1LDIuNzU3ODEsMC4zNDM3NSw2Ljk4NDM4LTMuMjU2ODQsNi45ODQzOGgtMTkuNzA1MDhjLTQuMTg5NDUsMC04LjE2NTA0LTEuODUxNTYtMTAuODU3NDItNS4wNjA1NWwtMjIuNjgxNjQtMjcuMDMxMjUNCgkJCQl2MjcuODQxOGMwLDIuMzQ3NjYtMS45MDMzMiw0LjI1LTQuMjUxOTUsNC4yNWgtOS45MjA5Yy03LjgyNzE1LDAtMTQuMTcyODUtNi4zNDM3NS0xNC4xNzI4NS0xNC4xNzI4NXYtODUuMDM5MDYNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2gyOS43NjM2N2MyMi43MDAyLDAsNDEuMTAyNTQsMTcuMTMzNzksNDEuMTAyNTQsMzguMjY4NTUNCgkJCQlDOTU2Ljc1NDg4LDEyNTIuNTkwODIsOTQ1LjQzNjUyLDEyNjYuNzAyMTUsOTI5LjYwNDQ5LDEyNzIuMDIyNDZMOTI5LjYwNDQ5LDEyNzIuMDIyNDZ6IE05MDAuMDYxNTIsMTIyMS44NDM3NXYzMi41OTg2M2g4LjUwMzkxDQoJCQkJYzEwLjk1ODk4LDAsMTkuODQyNzctNy4yOTc4NSwxOS44NDI3Ny0xNi4yOTg4M2MwLTkuMDAxOTUtOC44ODM3OS0xNi4yOTk4LTE5Ljg0Mjc3LTE2LjI5OThIOTAwLjA2MTUyTDkwMC4wNjE1MiwxMjIxLjg0Mzc1eg0KCQkJCSBNMTE1OC4zNTkzOCwxMTk1LjYyMzA1YzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NzI3LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOA0KCQkJCWwtNC45MzI2Miw4LjU0MTk5Yy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNTU5LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMyMjMsMCw1Ljk2MDk0LTAuNDQzMzYsOC43MjU1OS0xLjI2ODU1YzYuMjk1OS0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTgzNiw2LjUwMDk4bDQuOTMwNjYsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM3NSw1LjczNDM4Yy05LjAwNDg4LDUuNjAxNTYtMTkuNjMyODEsOC44Mzc4OS0zMS4wMTc1OCw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzEwOTkuNTQwMDQsMTIyMS45NTcwMywxMTI1Ljg3NDAyLDExOTUuNjIzMDUsMTE1OC4zNTkzOCwxMTk1LjYyMzA1eiIvPg0KCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMwMEZGREEiIGQ9Ik0xMzE4LjE5NzI3LDEyMDYuMDMyMjMNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2MyMC42NTYyNSwwLDQxLjMxMjUsMCw2MS45Njg3NSwwYzMuNDI5NjksMCw1LjQ1MDIsMy44ODA4NiwzLjQ4MzQsNi42OTA0Mw0KCQkJCWwtMTkuMjk2ODgsMjcuNTY3MzhjMTUuNTQyOTcsOC4zNzU5OCwyNi4xMDY0NSwyNC44MDA3OCwyNi4xMDY0NSw0My42OTUzMWMwLDI3LjM5NzQ2LTIyLjIwODk4LDQ5LjYwNjQ1LTQ5LjYwNjQ1LDQ5LjYwNjQ1DQoJCQkJYy0xNi42ODg0OCwwLTMxLjQ1MTE3LTguMjQwMjMtNDAuNDQzMzYtMjAuODc1OThjLTEuNDUwMi0yLjAzOTA2LTAuODMxMDUtNC44OTk0MSwxLjMzNTk0LTYuMTUyMzRsMTAuOTc3NTQtNi4zMzc4OQ0KCQkJCWM0Ljg4MTg0LTIuODE4MzYsMTAuOTc5NDktMi40NzU1OSwxNS41MTQ2NSwwLjg3MzA1YzMuNTI4MzIsMi42MDU0Nyw3Ljg5MTYsNC4xNDY0OCwxMi42MTUyMyw0LjE0NjQ4DQoJCQkJYzExLjc0MjE5LDAsMjEuMjU5NzctOS41MTg1NSwyMS4yNTk3Ny0yMS4yNTk3N3MtOS41MTc1OC0yMS4yNTk3Ny0yMS4yNTk3Ny0yMS4yNTk3N2gtMTUuMjE3NzcNCgkJCQljLTMuNDI5NjksMC01LjQ1MDItMy44ODA4Ni0zLjQ4NDM4LTYuNjkwNDNsMTguMTM1NzQtMjUuOTA4MmgtMzIuMDA5NzdjLTIuMzQ4NjMsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMDYuMDMyMjN6DQoJCQkJIi8+DQoJCTwvZz4NCgkJPGc+DQoJCQk8Zz4NCgkJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0RBRThGNyIgZD0iTTg1MC4zOTU1MSw4NTcuNTkxOA0KCQkJCQljLTUwLjM1NjQ1LDAtOTQuMzI1Mi0yNy4zNTY0NS0xMTcuODUyNTQtNjguMDIwNTFsLTgwLjAzMDI3LDQ2LjIwNDFjLTQuNjU1MjcsMi42ODk0NS02LjEzMTg0LDguNzE4NzUtMy4yNDkwMiwxMy4yNTU4Ng0KCQkJCQljNDIuMjM3Myw2Ni40ODYzMywxMTYuNTMzMiwxMTAuNjA3NDIsMjAxLjEzMTg0LDExMC42MDc0MmM4OC4xMjU5OCwwLDE2NS4wNzEyOS00Ny44NzUsMjA2LjI0MzE2LTExOS4wMzYxM2wtODAuNDg3My00Ni40Njk3Mw0KCQkJCQljLTQuMzEzNDgtMi40OTAyMy05LjgwMTc2LTEuMjA1MDgtMTIuNTcwMzEsMi45MzU1NUM5MzkuMTc1NzgsODMzLjU2MjUsODk3LjU5MTgsODU3LjU5MTgsODUwLjM5NTUxLDg1Ny41OTE4DQoJCQkJCUw4NTAuMzk1NTEsODU3LjU5MTh6IE0xMTM2LjcyMTY4LDU1Ni4yMTc3N2M0LjYxNDI2LTIuNjYzMDksNi4xMTAzNS04LjYxOTE0LDMuMzEyNS0xMy4xNTEzNw0KCQkJCQljLTU5LjkxNTA0LTk3LjAzMDI3LTE2Ny4yMjQ2MS0xNjEuNjk0MzQtMjg5LjYzODY3LTE2MS42OTQzNGMtMTI1Ljg5MzU1LDAtMjM1LjgxMzQ4LDY4LjM5MjU4LTI5NC42MzM3OSwxNzAuMDQ5OA0KCQkJCQlsODAuMzc2OTUsNDYuNDA2MjVjNC4zOTc0NiwyLjUzOTA2LDEwLjAwMTk1LDEuMTQ5NDEsMTIuNzEwOTQtMy4xNDU1MQ0KCQkJCQljNDIuMTY0MDYtNjYuODUxNTYsMTE2LjY2ODk1LTExMS4yNjM2NywyMDEuNTQ1OS0xMTEuMjYzNjdjODguMTI1OTgsMCwxNjUuMDcxMjksNDcuODc1OTgsMjA2LjI0MzE2LDExOS4wMzYxMw0KCQkJCQlMMTEzNi43MjE2OCw1NTYuMjE3Nzd6Ii8+DQoJCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNBNUJBQzgiIGQ9Ik04NTAuMzk1NTEsOTU5LjYzODY3DQoJCQkJCWMtODQuNTk4NjMsMC0xNTguODk0NTMtNDQuMTIxMDktMjAxLjEzMTg0LTExMC42MDc0MmMtMi44NzY5NS00LjUzMDI3LTEuMzk5NDEtMTAuNTcwMzEsMy4yNDkwMi0xMy4yNTU4Nmw4MC4wMzAyNy00Ni4yMDQxDQoJCQkJCWMtMTEuNTgxMDUtMjAuMDE2Ni0xOC4yMDk5Ni00My4yNTQ4OC0xOC4yMDk5Ni02OC4wNDE5OWMwLTc0Ljc4NTE2LDYwLjU1NzYyLTEzNi4wNjI1LDEzNi4wNjI1LTEzNi4wNjI1DQoJCQkJCWM0Ny4xOTYyOSwwLDg4Ljc4MDI3LDI0LjAyOTMsMTEzLjE4NTU1LDYwLjUyMjQ2YzIuNzY0NjUsNC4xMzM3OSw4LjI2MzY3LDUuNDIxODgsMTIuNTcwMzEsMi45MzU1NWw4MC40ODczLTQ2LjQ2OTczDQoJCQkJCWMtNDEuMTcxODgtNzEuMTYwMTYtMTE4LjExNzE5LTExOS4wMzYxMy0yMDYuMjQzMTYtMTE5LjAzNjEzYy04NC44NzY5NSwwLTE1OS4zODE4NCw0NC40MTIxMS0yMDEuNTQ1OSwxMTEuMjYzNjcNCgkJCQkJYy0yLjcwNjA1LDQuMjkxMDItOC4zMTgzNiw1LjY4MTY0LTEyLjcxMDk0LDMuMTQ1NTFsLTgwLjM3Njk1LTQ2LjQwNjI1DQoJCQkJCWMtMjguOTUyMTUsNTAuMDQwMDQtNDUuNTIzNDQsMTA4LjEzOTY1LTQ1LjUyMzQ0LDE3MC4xMDc0MmMwLDE4Ni45NjM4NywxNTEuMzk0NTMsMzQwLjE1NzIzLDM0MC4xNTcyMywzNDAuMTU3MjMNCgkJCQkJYzEyMi40MTQwNiwwLDIyOS43MjM2My02NC42NjQwNiwyODkuNjM4NjctMTYxLjY5NTMxYzIuNzk0OTItNC41MjYzNywxLjI5NDkyLTEwLjQ5MDIzLTMuMzEyNS0xMy4xNTEzN2wtODAuMDgzMDEtNDYuMjM3Mw0KCQkJCQlDMTAxNS40NjY4LDkxMS43NjM2Nyw5MzguNTIxNDgsOTU5LjYzODY3LDg1MC4zOTU1MSw5NTkuNjM4Njd6Ii8+DQoJCQk8L2c+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzAwRkZEQSIgZD0iTTExMzcuMTg1NTUsNzU4LjExMzI4di03My4xNjc5N2wtNjMuMzY1MjMsMzYuNTgzOTgNCgkJCQlMMTEzNy4xODU1NSw3NTguMTEzMjhMMTEzNy4xODU1NSw3NTguMTEzMjh6IE0xMDI2LjU3NjE3LDcwNS4xNjQwNmwxMjAuMDU4NTktNjkuMzE2NDENCgkJCQljMTIuNTY4MzYtNy4yNTU4NiwyOC4zNDQ3MywxLjg1MjU0LDI4LjM0NTcsMTYuMzY2MjF2MTM4LjYzMDg2Yy0wLjAwMDk4LDE0LjUxMjctMTUuNzc3MzQsMjMuNjIyMDctMjguMzQ1NywxNi4zNjYyMQ0KCQkJCWwtMTIwLjA1ODU5LTY5LjMxNjQxQzEwMTQuMDI4MzIsNzMwLjY0OTQxLDEwMTQuMDI4MzIsNzEyLjQwOTE4LDEwMjYuNTc2MTcsNzA1LjE2NDA2eiIvPg0KCQk8L2c+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=";
t=new Image;t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAESIzRFVmd4iZqrvM3e5GKvWZAAAFX0lEQVR42u2asW7bVhSGP0qWpUi2oM3tUFhbgAJJtBUdWvsNrLlD1AcoILZBlgaNXKBAR/sN5Ewd6fYF5HbJKAdB0FFKu5d1ZEeSJfPvcC8pyrWTDi5MgPwXCRQp6H4895z/HAoyZcqUKVOmTJkyJU8D7dt3d6QMQIK1LqPzRykHIL1KOwA9SzuAeS2dAC4A+MSXDtIMgJL0NtUA2IvepRTAutRINYCi5KYaQE7mN294Ch5ff4HzRPoprBfOU70B2Ojp/Gt7bKOnqXsJQKGj4FHSAWAAfBi5onWdA9Ay5SEvbYPTlaQpQFfHLek0umY/DCQpaC4ByPcl6RdomyvB13ESARzAim9MwQEUFdjs+NqsLAA+Mx//BnT1StIp5AfGR9QBepKk8RKAHUnSRYOq/cqVG91uN7oFdqwrmkHeZkVfZwBlnUPe8rmoQVd/GQCf22teAOXIV8UARJ+XpKatuY3EAShILjlf+obVnrQLvlwT+lOATb2F+9Jzch1pH7rS3AVyvuYud81pHek5zneXAIzrfCFNydvD65onLwdUpCYV6WdgVTqFrg7N3QpMKjgBT1MgN9Ab6Eq7JjS0D9yT6jh+mB/iAGY1oC1t09cQYEvj5AFoKYAde2vaurBLZk0mbvd0xIr1y/c1ha5NkjvmNedrn6I9obwE4FebHffpmO3UMcUjUQBWpTH07C8rS9ts6gzY0kC7QF8uZQW1KCF27bmeSZJ0NGRNQR3A8eMAtq01eM0DEyB9HSUNwN2+9AInvHE5aZeKJkBHDzUER2qwqQm2JDbo6m8Ax+4EtjRiK6xzVxihjs6oKDDf7iYHQKSgQcFmaXOPipoD/aCsERQUQEujsI67IYBCmNGrGtMyIX4lgC2NWZWaUJRqCQTwEkrRL9vTCXmphqNpQRMoaQIds2YYaDcEUAwXuK4JHZ1cC6CqqQ2ximYJHIiMgXKUEtsaQV9Nijpz/Dms6Qy6ipV5C2BR5zWla7L8lQDWNANPQ1tREwZg9tiUwrA+7+gU9rRLRUM8NdjU69DmLQOoLAM4vhZARTPMHmmHcZIsK0w8Nnd0Ci0N2dQBLbmmI4gBOLwCwAzvfQCqmoJ3o8On/xFAVSPaarKpI/bk/gcA742AkgIcP0y1iQNwKQeUNcZTjbLe0FcdvHj9tgDKcVv7rhywbhuMZsG6iQQCWK4CrOrc8c9hVWNHc2AvXF8MQMl2eLbWv7sKwED7d0KzkDwAqzEfcAyOgoLegqNZwZqi0b8AFOOd3ft8AHQ0rIYnJQ9AbskJQl+f6gTw9IFGl5sYCyAft3WhVbzOCcIDne3E4yhZAKJewBr4jp7qEOjoKw2BdWv14wAY6I/o2Jrd3lf3AkOgoume9c5JBNC2Ga1lDm/JzAQ21dOBCXeTBe+5CwAde03ud67pBl9E3SAUFQwskSQCWDPzgILMNq1KqttS1wScgRl8FfzzBYCPzISMhzrA8c0e8JYAzOtmHlA3vdONPoC4YQB2IuTZG1mSubtF2fKwJU22KfZ0EXWD5CX9AE+kl9C+eiLUMBMhy2aSXADxmaCJhLFteWdhmTD6cxEBtBftZKwzWAC4iM0MoaV4KUkcgNhU2Cx8ZJPjOKxz4YR3AaCwaCfBM51VLwZgZqfCdWsHkjMNuQIAHy/9WyK0fpEByJkFfh+rAuE1k1oUI0GzGwMwNc8FnkVbwk0ygOUnQx1bsR5EDzKcb6WJyxIANjzpx/B9X1OXJQBLT4ZWTDJMr/LJGYnfjkrJGYnfjqoJmobcito6TDeAvr5M9fqLSZqG3IIKXrpzoKTE/DXitgAEjZQDeJnqFNjVczJlypQpU6Yb0D8QEXpo1mjM/QAAAABJRU5ErkJggg==";
var v=new Image;v.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAgCAMAAADKd1bWAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/UExURQAAAH9/f3FxjXV1iXh4h3mFhXV/iXd/iG5/iHB/h3J/hnB8iHB8gnF8h3N9h3N9hnJ7g3N7h3R/h3R7h3B7h3R/hnF/hnR7hnF7hnB9hHF9h3F9hHJ+h3J+hnF8hHJ8h3J8hHN9h3N9hnJ8hXB8hXN8hXF8h3F8hXF+hnF8hnJ+hnJ8hnF9hXF9hXJ9h3J9hnJ8hXJ8hXJ8hnJ8hXF8hnF8hXN9hnF9hnF8hXF8hXJ8h3J8hXJ+hnJ8hnF9hXJ9hXJ9hXJ9hnJ8hnF8hnJ8hXF8hXF9hXJ9hnJ9hXF8hnF8hXJ9hXJ8hXJ9hXJ9hnJ9hnJ9hXF9hXF8hnF8hnJ9hjuUkXwAAABUdFJOUwAECQ0RFRoeHiImKysvMzc8QEREREhISEhNUVFVWV5iYmZqb29zc3N3d3t7gISIjJGVmZmZmZ2doqaqqq6us7e7v8TEyMjM0NDV2d3d4ebq7vL3+6sn6VQAAAOESURBVHja7ZhdVyJHEIafYYAF5ENjdhWCCKgxkhaVbHbRbBA0DhmUj5l+//9vycUMyu6Jd1zMOfBeddf0zOl+prqqumGrrbbaKqG6MIW4VTAmyROtmEjtnfV+d6Fq3KpKSQZwoqW80oYCCI0xxtxZBaXNBLCIGvmpxhsNgLq0s9EAUlIVKPbnsoMqUDHtiIwpArjGpMFpe9JTG6BlKkcTfQaK/YXm/Sjs5/oLzT5nvgPgdl9k7ypwZFqRsWMqSQTwCxzbKCT+ATuyLsCzbgAONQN3FD0eOODpUVIf6qEkKdgHigtJ0ku4CmAsSQoPaMhmAMpr9bY1AfhJKlOxGhTIdqVzmKoKlKQpQE9f4JtmNVKtUKfgSTc5oGz1Z47CSLMUzkSzGk59plUAi+MUexPN0m6gJsDlWuPNegBkfU1gpCHRDMM0PfUAo1AVwFeNXdkSwLGm4GkAwFB/AaQmalKTLQOU7CqAQ4BcqBa30ffH6iQtDd4Gsgdkpd1oPwSqU5UPjG1HXcjKuvT0DQDXagdPBiArRfmzqzv6McD/C4J3GvBRNgMFKZ+8QuhlH6oKHeLfeo0bKEtew6z1oa57eNQoKhxDfVoC+FmKbPd64lHmXQCn8nHmasKZ/klcIXRSBmhE2x3oqw/3anCmFiPt0FMbnl9xqb4E0Hiz+fyrk3cBNPQM1xrCw3JUooIgwJFmLP31K7R0x4OynKiDrwJMNIjPDqa0BHCkYGk7wdP5uwBaeoaSbCZrbTahAHaleGq+focPmmXtA3yQl5UPjNR9GxwD2IuzJQAD9d4F0NUj4KvZXAaK5AFILXQKUe4rA2Nd6Qx40pm6wKUmqR8BuKGO307BenYAnGAVQDpmeg38puFAjaQC4EpBGcj48qKfZlUAzrTQHpAPdZsCMsPuKwB6CnYBjvwieasrgJvv6oC/U8BFlC3ysmGYTiyAlCfdmt5ciyJARVHFkpcWTrSPNb02Xxcaua8A3Ik0MMaTrYGRxubS1yqAUC9XZiT1ARgpzqWJBED6W3Q5UATAmceL9HQXh/K5JOmL++YBZAaSpOlBVEJJsr/6KwD8RiAp8h1oSrVE3Qhd/GDJt02nvOw0TFSxfHo9vDiHxjRz0WFob+Wd107+3LRytFauxFpkGqazLP5zClIbfVvYiLfCxsrTx01efqaribPB65dk9zfZAWYa77PVVlutRf8BP07pQAr3tiMAAAAASUVORK5CYII=";
var q=new Image;q.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAQCAYAAADeWHeIAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAEJ0lEQVRoQ+2Yb4jURRjH15TCDOkvBGXQi6KgwnoRFCH2ogQjEUwkCxMDJeO8nd+eunc7vx31fjO7poccCtdJaGTlP9R6oXkIiWAKoRGBiZVCKcaRpxhG6ouuzzM7217n9UcIOrj5wrDzzPPMM7PP852ZZzcXERER8f9jUat9rFCqTK63xXrlA0E1LJGkticptU8IokchtTrR2dwgRlwPCOgnibYnk9Ttl6a07WVs30JjbgkmwwpKu18T4x4Mogd7/lCldlkQI64HQgCCujSIOaXUWIhwtJBWymFoWCES4D/GYAIICGYGCTZLn6t1nkrdD9j95m8Jgt9i3robuWfmtm2jxSafZi9yi6yRvkDpbDFtjuhJzir8/Zxod5F1Kv39/aO8fWo3MH6E9kWYMweb0/i5yufOYrFym4zTnybjzL3C+pv85xAEqH0Pe0L2ic0eZTpuR+4Qv8Esl5Ttm+iLQYwQ1ALXIIAx5kYCdyivXXuh1D6J4PcpU31Sxum3k7Bv6I+BFKdaUveUzCEx29H90mTMeC9r+y3v9DP4bsP3wcSsvrPJVO9l7td5bV/idplP/5zSKx719tiyZq/UI/ONuZn+Fuata221d2F3CXm2EEc+JcFDE8AdVW3ZPc3G3IrNPsa6SPgb7OVwMMPOHVNpZUYQIwRCgIE1AO2sBC2coG5aRzAVctyA/JMkHpu1JL2kVMdY+t8z/n5SdrNCos/VTr87Ljb1AhPSbMT/O0IAWSu4lQR2IW8fYJenfYe/l/Hlb4g68PmPT0C+5J6XPRWL7g7srywy1ftkDnu5KPsNZhGC2g1gu+vBT4x9KKjkZO+gJUH0QP6K4E5P0mwKSTpAUKdJYknqC+i2krRXhAzeVts+EnOE8Tq59mO/fDAB6O/wCR9oV3YfqbJdQAL3BjOPf0OARFce53udlz5+d6EvIC+hvesNIhqoEeDPNUAdJGI1wXsviDn5ZUCgLxVa7SNNnZ03kcw+9FuEBF5O3RmIsUluArHH95dKV2b7yQNwDQG07UReH8Q/wL6mojsp17/I8ol8+S8IkAWRt97NYu4x6cuVz5zD2HwmN4M3iGjg7wgg/wmQ3Atyevy1mtrdtJ6grp0uCjx5t0UmiR/ICW0UcNlcAt/L3NfCjbErKVdmDibAEl19WPywln8u8LGSpK2V65o5p/DRhf5Z9OuZ1z8kAVgHsr3KvOlCGuxavM77sOfR/yi1i58Q0YAPNm9tEK9Bc1s20Z9q7T4lkMsKhVXjgqp2ulJbDaKQ6Tns3g6ih9gw72PW2UsB2Cy1weBfDYK8yZ7w6/gnwFalBpFxCtH7hVhCPFWyr+N/51B/BAmpSHK37FOSL/VKTSt7oPaAUEGMGGmAGJ8npvp0ECNGCnxRm7rNEOBQvY6IGEHwP1d5Duo1SUTEMEEu9zubhK3bj4D7PQAAAABJRU5ErkJggg==";
var y=new Image;y.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAdxHdu4hmVZnuRMwzqiLYE4y2AAAFw0lEQVR42u2Yy+9LQRTHp6Xq0VIkXkFvwkYslAWJiGJj2a6sJJe/oF3YWGElEQmxkYi4ErFWNpatWFmIx9Lm1sJCLKgqraqv82h726l6hOuRzDf53TtnOr+ZOZ+ZOffca5ycnJycnJycnJycnJycnJz+pi7g2G9osxjvzX8qB8ABcAAcgH8XwDa85dspNOiaRDuAR4U0PnHtDuyy7IJRJS6gvVmL6TywVkp4ZxIhulUxFvlaXQTrgEHbnMDH5XRjlXCdb+uAnc2ojWgFFTYBZ8e9tzcaswAk6v/3K4sPfPNRFj87IXj+KXQUS9m2jXoH1lMuLq2DtEcAtNMBT9PjanFq7ySAhbABVEAaeDaAwkk2D7GRqctAMQJIq2sBauLnB/VxCfqKpWrbRhSC1W5SMQ9RTgBUwKpF1ccmAIQ2gCxE+20Au9nSESvDgeIDkJSBMpA9vgyXdsj0H0GORL3n2fbwPOKoSQS4Q2cBOGzSJbQYAHDbZEI+rEuBcyZRlF71fIP/x0wBuIBOw6xH3xu2GQFAP2cegmvSwHkeqBZjECzB46UXD3bg8UKJCT6QYzgDY9uiU7hC11doERq6MAZ2CPJ7ipEulOrteDcB4KOZBpBG7zrV1JGzATzmIdnrl/go3bRiBJBHlZc+6ItjuQQ+yFLz8Gka2LZFRVTFGdoQJQ0LPodHnXkS8AjlRWkBLwKQswAs0PDzGpcsAAMNuG+5WgdqxwjgEcp8qcBjN5oZdPhEvOfhU/hsbJuVloWV6WWgp2IBLxXQNEwLDfKqoMXrEQBjATiFA3qePlgAZJRl+EStdaAQjfgALOC1zfeX8ALV+7S69JdALWjxHGqztmxyMnTD6OOBWvAdGDkn60c6vrI5H4CPnOJsWQDe8G0hIU0MB8ojFx+AFAeqeitLy5FkL3w0yNNcSOx3oDxjjxaH9XxldZluY5NBfwrAQvQbRjQXAO8UqVq5dh6A7HCgWzgdFwBdgOX4lMZbTndkWWkDN07Bk+zItllLdHm1+FkLwBSADNDf8B0AnGOp5gFYgJEexwcgGQx4iyeD9ybFkWsbDZbv0+2Y8XvGtqMpWsUimpMAzA1AUrj5ALjm2wCoONKB+ACYsEeDlU04MMs4imeJQqljslSuD4xl/zgAsx6ku/8DgDwaO9AwFU56qhzOPiXpKCzCpSSdb8v+CQDmXshb99cARAPFCOA1chWaFXlP55yn2FqEgiFvOSzYtmiJzisKB7MxQPS8iO63YsD3AHDv8QPgjR92eKuf9vts1wdZjvZhN4XajD35FNDiR7ln0LYBaILY+OZT4DsA+BkTP4AUrgXkxSJcDFps+72X7EGlx6mBbU/lAbdQjvKA7hSAlSuHxdw0gORsHrAUnXkAUuj+AQAZdHGRp9bShX2ECz1JRSk4zNhRJqj5SZQJfpgCUNS2eRsAP/usTDAxPxFKA834AZgAOM1z6qGgxxpdmUDQNjP25LtAsojxu0AehSkAF6RLXWR/EkAdVYEevQtswVtpMwuAB1JGh2jbxQcgBKrig/qSxTD6o2Nm7fttSY6uUnErV+jb4CJyaArAI5luJkCDOy5HAPISSB5A3wYbhJERahvtPALAAw2EI9Vzsh2TTuk23qEceN9d4vVVv227hNroe0CRi/o9IKTZTQFIAc/M8jwGEiouG2/042u8u25uAuPvAavRH7XhzqcBpICdRpssRa+aNLFoh2JeyBzU08fih/ht20WZXghW34s+/ZQnAKhzojsSH4CC/sjARPKamLXacOfTAIwfNSkCbROLluG9Tm2gdl3PY178tu2SBIpFQ6fHH//2GAvAogCkjtGDEAFQYPsu6DdBqw11bgFIF8dNHsQGIEFRSDOe0RS9YYJk23JMrw+/Cr9bFX0VXmNsACbhA088qXhBrMYAlq8Gjhh//FX4YNSGO7cASO9n9B99AuHk5OTk5OTk5OTk5OTk5OTk5OT0VX0B7+fX+9cwWYYAAAAASUVORK5CYII=";
var B=new Image;B.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAgCAMAAADKd1bWAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAECUExURQAAAH9/f3FxjXV1iXiHh3h4h3mFhXV/iWt/iXd/iG5/iHB/h3J/hnB8iHB8gnF8h3N9h3N9hnJ7iHJ7g3N7h3R/h3B/h3R7h3B7h3F/hnF7hnB9hHF9h3F9hHJ+h3J+hnF8hHJ8h3J8hHN9h3N9hnJ8hXB8hXF+hXN8hXF8hXF+hnF8hnJ+hnJ8hnF9hXF9hXJ9h3J9hnJ8hXJ8hXJ8hnF8hnN9hnF9hnF8hXF8hXJ+hXJ8h3J8hXJ+hnJ8hnF9hXJ9hXJ9hnJ9hXJ9hnJ8hnF8hnF8hXF9hXJ9hnF8hnF8hXJ9hXJ8hXJ9hXJ9hnJ9hnJ9hXF9hXF9hXF8hnF8hnJ9hjF612UAAABVdFJOUwAECQ0RERUaGh4eIiYrKy8zNzw8QERERERISE1RUVVZXmJiZmpvb3Nzc3d3e3uAhIiMkZWZmZ2doqaqqqqurrO3u7u/xMTIzNDV2d3d4ebq7u7y9/t0tguqAAADuklEQVR42u2XUVviRhhGT8hCukQElJZVbKQI1i7uKMIuWmph1aoghCzJ+///Si8CKuju3ix9epFzlfeZbzLJYSYzQEJCQkJCQkLC/4A7FX5ATUX9REAiYA3U1QEYKA84GvlygKIuATqqruT9uJfT9RVe5AHSp2OpXwGQn/k4lX9iAemzidTfhUCSVEVB/kbnbxQA8CAX2P9HGv5hPdYAYHSwdytdFQDs07HCXp6GJOlhDQIcDQE7kgE8tTvygFPNbGAYOasZgI2pLk03CkuQHevGtAN9ABSO7k1rqhakxxqYbqgDmsZXx+RROL00e0sCzjRpmZH61qJmLuB+1jUDzRzIjNQ33SjcLpoLjUxjPRPUAU/RPdDRbkUdYBhpDxzdsprnfX4DftHI4koGyE60C1Ib2NDM4kgfgZICazG9pUPguYCK7tOQulJ1aQkYTTeBCzXhTx0AJQ3X+A04kQe9WVsuDGcpOxxCTq3oHDwds5oBiroD4EqFvB4sAE99kFIAE2Vp6QNA7/NPTwJYETBQBWBb/RUBpwA1ddmYD3Sr3PoEFNUjNeuVdISjSxgox7Fy14FFR/mXGTjUWbwStjKH6gJga7Z4Rx7ksq3ZYkp/VcAXpQFSW4UVAQagqnNqujPGGHOvX9cnwPJ9KvIs/wZPB1DXAXdD6ioz9HmZnx5x6TLQm+cC2B1JYW/nWwLm5au7wDMBRguqa9wGL5T7FNp8ipyOHNhQ761OeKu2ow4vM3D8JOBYJ/FFqNSSAMjVL0KdfUNA9F0Bj3df6znA06Hfh7JqD/cAQ/9QBbiZVLX3WgZPPQD2jOvNHyun8dIS2NoCyAbKLQuwnwkYKgeQNrWvCfB09R8IsCNfNbCCUez7VP4EONIotF/LkAmDDGAN5dpBtAHQVmtJwDh+oWttwe0zAXyRA9iBXFrxePs6X9SsCsiEKgJkC7CzvpPgtSIHOFc8WinezVxpwMvcD0twrNs82b/UhrrGP5M50SS9JKCh0TapejS14W/9jrVovNB5msKt5JLxo4bNfjBzFzX9sLQkgPeaeuBNpjZ5PWSs9Qho6iaeY74FYM1UjpdlnZfZVxM4kSS1LeAwlKQ7lyUBmEiSJkWgHEmNRWN2LEk3I7mwOVqp8dVcFsD78LHkWvPl88PJmjJAyszPolVjAeyY7Cu53EwDZA9Mw50viKoxxXjyxt/GhkkD2Zoxu/FPtmmMu2gk5RmzTc2kAd4ZU3lWU26moWRKAHmzt7j7u7hjzdSSv9YJCQkJCQkJCd/jX896A8Nsft1WAAAAAElFTkSuQmCC";
var K=new Image;K.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAQCAYAAADeWHeIAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAEu0lEQVRoQ+1XWYgcRRhuNQrB+8BI1ETFA1E0gteDGjVBUVGMGoPHg4LGI26mq9vZ3UlXTa07XdWzJvsgJLALAUVMxE2ICuKVqAQkeKBZFYw+SIRIUJAIAR9E4/p9NdW74+qs58Mu1AdN1X921f///Vd1FBAQEBAQEBAQMIFE2b1VPTDXk/8a/4cfIc3GpG7v8uT0hliVn5yqYrkno6RedD2q9RGcx5m9TigbcyTdpfVRSd2s4JygnVD5kqnkqV59oicjrfVhIrP3J9KqVNlLPDtKtD1bSNuDdz3W22uPJy/NiquFMgupD1kt1sUZ5MPHLCGLeyHro5w8+Msw34/krakZM4d0rMyVeMfDcVYsTrLGFdQj3HvE4GzOE5VfTz+pNLeNjY0dNNmPMwAqujiNCW3Fw/S1+6vKgbPok+9i3KB3D+w/ha/N4F3m1aYvmBQs+FuOj+snT8JmDiAgd1CWKLM1lkZwdHTdLoP855U1M8fb7WWippJzpIyA3msIYM7AQ/aRS4BuXgqbXSwkBtHN9eBxDDS+pC+5FlE3DyXS7PZJGoLO2tIH5HemWeMq6H8vVHE7kwD5AdD9sc4vTlTRBN3jl8A17OvtLY4lD+t9CfQi+HketJnsx5uUxbgPsajg/bdwX0LbMys6X4D5zljlN8NPNwp4O/Z+AXxtg16jSzdP8S6mN7DYLS6RdfMINrQezwaXQGm+Wj48fCg29nWarj4c/BcoF5l5kF8B5CNLR0YOmUruXxF1y+a5CMwuT0ZI/OWuGyD4iczv82yuZYjrcAWAJHo2+T9UtD4GvJcxz5igWPafV3YS+Blv3ZiPcSQ6F4D5roZCJY809VryPx4BrQKw2z0ZYf4i9nYrfDwLf5ZyFz/JD6Ixf0YdAUQiiwcQ2ByBen2F1nOxqVFs6Fps9GnKsaHn0M5vwgbfZyuG3qtMQpm4v5IT8L8QwX3Hk+OA3tuQXeNJtugagwoeC6DPsycSh+4QS/sEEwLdN/kltuT/rAAw/upZv0OnAmhfO5K7BV1iCdcOP8+Ua+XDo2PGFYBr/cp+xg2RxgYG8ezAfWApaWxmGTb3MQJpvHwHAvIhW/3fkRO8a8D/HnYUR0t7I48XjGuFzKtOCeDXBfu7y4B69njiYLOuWh04kjzopbAfbsntN39WAKkydfhxnaTVrcx+V0jKfJHWzPnku7UhkZy3+ynRsQCUHYJ/6dm4y6w5wY0q3zCjCoDAZnAmm243R/tGYH/q6WkeTdp9MdL8wvPayXlZkuY9zomp5LwIwvcmzplQvOMt+C7A2+kufy74dhT2T8FmI55XcPzMoi4f2hFlAbR823ch64fdJ+w8Xr4V9Hqs/VSMEx1AFhfB927o563WbX+kn1Q1b4DNKLpJA+/8gOe+02/3I80enumdCmClbs6D/ufQW+ceZd5gkfk1buNF1JtMf+A2ew4DwzkScPDkGyxpXsI4ZxumvhN4dJLTZ3mDJ3BGnu4KzN/ECXYF2jPYnuVu3nw86YqShcE5+UxK+cdA8A5CnhBiNkfPdmAnIo8FzbtH6ccVApPrv1yi3Q/+Ni6kLu8elVX5Aq8SsXOUNuXaWWhOCDB+fA87q2cFBAQEBAQEBPwHRNFvA2Vc/JW8EVoAAAAASUVORK5CYII=";
this.loaderlogos={logo:m,powered:[t,v,q],website:[y,B,K]}}this.next_uid=e[21];this.objectRefTable=cr.getObjectRefTable();this.system=new cr.system_object(this);m=0;for(t=e[2].length;m<t;m++){K=e[2][m];v=this.GetObjectReference(K[0]);cr.add_common_aces(K,v.prototype);var S=new v(this);S.singleglobal=K[1];S.is_world=K[2];S.is_rotatable=K[5];S.must_predraw=K[9];if(S.onCreate)S.onCreate();cr.seal(S);this.plugins.push(S)}this.objectRefTable=cr.getObjectRefTable();m=0;for(t=e[3].length;m<t;m++){K=e[3][m];
y=this.GetObjectReference(K[1]);S=null;v=0;for(q=this.plugins.length;v<q;v++)if(this.plugins[v]instanceof y){S=this.plugins[v];break}var P=new S.Type(S);P.name=K[0];P.is_family=K[2];P.instvar_sids=K[3].slice(0);P.vars_count=K[3].length;P.behs_count=K[4];P.fx_count=K[5];P.sid=K[11];P.is_family?(P.members=[],P.family_index=this.family_count++,P.families=null):(P.members=null,P.family_index=-1,P.families=[]);P.family_var_map=null;P.family_beh_map=null;P.family_fx_map=null;P.is_contained=!1;P.container=
null;K[6]?(P.texture_file=K[6][0],P.texture_filesize=K[6][1],P.texture_pixelformat=K[6][2],P.texture_data=K[6]):(P.texture_file=null,P.texture_filesize=0,P.texture_pixelformat=0,P.texture_data=null);P.animations=K[7]?K[7]:null;P.index=m;P.instances=[];P.deadCache=[];P.solstack=[new cr.selection(P)];P.cur_sol=0;P.default_instance=null;P.default_layerindex=0;P.stale_iids=!0;P.updateIIDs=cr.type_updateIIDs;P.getFirstPicked=cr.type_getFirstPicked;P.getPairedInstance=cr.type_getPairedInstance;P.getCurrentSol=
cr.type_getCurrentSol;P.pushCleanSol=cr.type_pushCleanSol;P.pushCopySol=cr.type_pushCopySol;P.popSol=cr.type_popSol;P.getBehaviorByName=cr.type_getBehaviorByName;P.getBehaviorIndexByName=cr.type_getBehaviorIndexByName;P.getEffectIndexByName=cr.type_getEffectIndexByName;P.applySolToContainer=cr.type_applySolToContainer;P.getInstanceByIID=cr.type_getInstanceByIID;P.collision_grid=new cr.SparseGrid(this.original_width,this.original_height);P.any_cell_changed=!0;P.any_instance_parallaxed=!1;P.extra={};
P.toString=cr.type_toString;P.behaviors=[];v=0;for(q=K[8].length;v<q;v++){var Q=K[8][v];var U=this.GetObjectReference(Q[1]),Z=null;y=0;for(B=this.behaviors.length;y<B;y++)if(this.behaviors[y]instanceof U){Z=this.behaviors[y];break}if(!Z){Z=new U(this);Z.my_types=[];Z.my_instances=new cr.ObjectSet;if(Z.onCreate)Z.onCreate();cr.seal(Z);this.behaviors.push(Z);cr.behaviors.solid&&Z instanceof cr.behaviors.solid&&(this.solidBehavior=Z);cr.behaviors.jumpthru&&Z instanceof cr.behaviors.jumpthru&&(this.jumpthruBehavior=
Z);cr.behaviors.shadowcaster&&Z instanceof cr.behaviors.shadowcaster&&(this.shadowcasterBehavior=Z)}-1===Z.my_types.indexOf(P)&&Z.my_types.push(P);y=new Z.Type(Z,P);y.name=Q[0];y.sid=Q[2];y.onCreate();cr.seal(y);P.behaviors.push(y)}P.global=K[9];P.isOnLoaderLayout=K[10];P.effect_types=[];v=0;for(q=K[12].length;v<q;v++)P.effect_types.push({id:K[12][v][0],name:K[12][v][1],shaderindex:-1,preservesOpaqueness:!1,active:!0,index:v});v=K[13];P.tile_poly_data=v?v[0]:null;if(!this.uses_loader_layout||P.is_family||
P.isOnLoaderLayout||!S.is_world)P.onCreate(),cr.seal(P);P.name&&(this.types[P.name]=P,this.types_lowercase[P.name.toLowerCase()]=P);this.types_by_index.push(P);S.singleglobal&&(v=new S.Instance(P),v.uid=this.next_uid++,v.puid=this.next_puid++,v.iid=0,v.get_iid=cr.inst_get_iid,v.toString=cr.inst_toString,v.properties=K[16],v.onCreate(),cr.seal(v),P.instances.push(v),this.objectsByUid[v.uid.toString()]=v)}m=0;for(t=e[4].length;m<t;m++)for(y=e[4][m],B=this.types_by_index[y[0]],v=1,q=y.length;v<q;v++)K=
this.types_by_index[y[v]],K.families.push(B),B.members.push(K);m=0;for(t=e[27].length;m<t;m++){y=e[27][m];B=[];v=0;for(q=y.length;v<q;v++)B.push(this.types_by_index[y[v]]);v=0;for(q=B.length;v<q;v++)B[v].is_contained=!0,B[v].container=B}if(0<this.family_count)for(m=0,t=this.types_by_index.length;m<t;m++)if(K=this.types_by_index[m],!K.is_family&&K.families.length){K.family_var_map=Array(this.family_count);K.family_beh_map=Array(this.family_count);K.family_fx_map=Array(this.family_count);P=[];v=Z=U=
Q=0;for(q=K.families.length;v<q;v++)for(S=K.families[v],K.family_var_map[S.family_index]=Q,Q+=S.vars_count,K.family_beh_map[S.family_index]=U,U+=S.behs_count,K.family_fx_map[S.family_index]=Z,Z+=S.fx_count,y=0,B=S.effect_types.length;y<B;y++)P.push(cr.shallowCopy({},S.effect_types[y]));K.effect_types=P.concat(K.effect_types);v=0;for(q=K.effect_types.length;v<q;v++)K.effect_types[v].index=v}m=0;for(t=e[5].length;m<t;m++)K=e[5][m],v=new cr.layout(this,K),cr.seal(v),this.layouts[v.name]=v,this.layouts_by_index.push(v);
m=0;for(t=e[6].length;m<t;m++)K=e[6][m],v=new cr.eventsheet(this,K),cr.seal(v),this.eventsheets[v.name]=v,this.eventsheets_by_index.push(v);m=0;for(t=this.eventsheets_by_index.length;m<t;m++)this.eventsheets_by_index[m].postInit();m=0;for(t=this.eventsheets_by_index.length;m<t;m++)this.eventsheets_by_index[m].updateDeepIncludes();m=0;for(t=this.triggers_to_postinit.length;m<t;m++)this.triggers_to_postinit[m].postInit();cr.clearArray(this.triggers_to_postinit);this.audio_files_info=e[7];this.audio_files_map=
{};m=0;for(t=this.audio_files_info.length;m<t;++m)v=this.audio_files_info[m],this.audio_files_map[v[0]]=v[1];this.files_subfolder=e[8];this.pixel_rounding=e[9];this.aspect_scale=1;this.enableWebGL=e[13];this.linearSampling=e[14];this.clearBackground=e[15];this.versionstr=e[16];this.useHighDpi=e[17];this.orientations=e[20];this.autoLockOrientation=0<this.orientations;this.pauseOnBlur=e[22];this.fullscreenScalingQuality=this.wantFullscreenScalingQuality=e[23];this.downscalingQuality=e[24];this.preloadSounds=
e[25];this.enableFrontToBack=e[26]&&!this.isIE;this.enhancedAccelerationPrecision=e[30];this.start_time=Date.now();cr.clearArray(this.objectRefTable);this.preloadSounds||E["audio/webm; codecs=opus"]||!window.OpusDecoder||window.OpusDecoder.Initialise();this.initRendererAndLoader()};var z=!1;b.prototype.waitForImageLoad=function(e,m){window.cr_remotePreviewImageFiles&&m&&"blob:"!==m.substr(0,5)&&(m=window.cr_remotePreviewImageFiles[m]);e.onerror=function(x){z=e.c2error=!0;console&&console.error&&console.error("Error loading image '"+
e.src+"': ",x)};e.src||("undefined"!==typeof XAPKReader?XAPKReader.get(m,function(x){e.src=x},function(x){z=e.c2error=!0;console&&console.error&&console.error("Error extracting image '"+m+"' from expansion file: ",x)}):(e.crossOrigin="anonymous",this.setImageSrc(e,m)));this.wait_for_textures.push(e)};b.prototype.findWaitingTexture=function(e){var m;var x=0;for(m=this.wait_for_textures.length;x<m;x++)if(this.wait_for_textures[x].cr_src===e)return this.wait_for_textures[x];return null};var H=0,F=!1;
b.prototype.getready=function(){if(this.audioInstance&&this.preloadSounds){var e=[],m;var x=0;for(m=this.audio_files_info.length;x<m;++x){var t=this.audio_files_info[x];var v=t[0];var q=t[2];(t=this.getPreferredAudioFile(v))&&!q&&e.push({filename:v+t[1],size:t[2],type:t[0]})}H=this.audioInstance.setPreloadList(e)}};b.prototype.areAllTexturesAndSoundsLoaded=function(){var e=H,m=0,x=!0,t;var v=0;for(t=this.wait_for_textures.length;v<t;v++){var q=this.wait_for_textures[v];var y=q.cr_filesize;if(!y||
0>=y)y=5E4;e+=y;q.src&&q.complete&&!q.c2error?m+=y:x=!1}x&&this.preloadSounds&&this.audioInstance&&(F||(this.audioInstance.startPreloads(),F=!0),v=this.audioInstance.getPreloadedSize(),m+=v,v<H&&(x=!1));this.progress=0==e?1:m/e;return x};var g=!1;b.prototype.go=function(){if(this.ctx||this.glwrap){var e=this.ctx||this.overlay_ctx;if(0<this.fullscreen_mode){var m=window.innerWidth,x=window.innerHeight;this.lastWindowWidth===m&&this.lastWindowHeight===x||this.setSize(m,x)}this.progress=0;this.last_progress=
-1;var t=this;if(this.areAllTexturesAndSoundsLoaded()&&(4!==this.loaderstyle||g))this.useFbInstant?FBInstant.startGameAsync().then(function(){t.go_loading_finished()}):this.go_loading_finished();else{this.useFbInstant&&FBInstant.setLoadingProgress(100*this.progress);x=Date.now()-this.start_time;if(e){var v=this.width,q=this.height;m=this.devicePixelRatio;if(3>this.loaderstyle&&500<=x&&this.last_progress!=this.progress){e.clearRect(0,0,v,q);x=v/2;q/=2;v=0===this.loaderstyle&&this.loaderlogos.logo&&
this.loaderlogos.logo.complete;var y=40*m,B=0,K=80*m;if(v){var S=this.loaderlogos.logo;K=S.width*m;var P=S.height*m;y=K/2;B=P/2;e.drawImage(S,cr.floor(x-y),cr.floor(q-B),K,P)}1>=this.loaderstyle?(q+=B+(v?12*m:0),x=cr.floor(x-y)+.5,q=cr.floor(q)+.5,e.fillStyle=z?"red":"DodgerBlue",e.fillRect(x,q,Math.floor(K*this.progress),6*m),e.strokeStyle="black",e.strokeRect(x,q,K,6*m),e.strokeStyle="white",e.strokeRect(x-1*m,q-1*m,K+2*m,8*m)):2===this.loaderstyle&&(e.font="12pt Arial",e.fillStyle=z?"#f00":"#999",
e.textBaseLine="middle",m=Math.round(100*this.progress)+"%",v=e.measureText?e.measureText(m):null,e.fillText(m,x-(v?v.width:0)/2,q));this.last_progress=this.progress}else if(4===this.loaderstyle){this.draw_c3_splash_loader(e);C?C(function(){t.go()}):setTimeout(function(){t.go()},16);return}}setTimeout(function(){t.go()},100)}}};var p=-1,A=!0,T=!1,W=0,I=0,c=null,h=null,G=0;b.prototype.draw_c3_splash_loader=function(e){if(!g){var m=this.isPreview||this.useFbInstant,x=m?0:200,t=m?0:3E3,v=Math.ceil(this.width),
q=Math.ceil(this.height),y=this.loaderlogos.logo,B=this.loaderlogos.powered,K=this.loaderlogos.website;if(y.complete){for(var S=0;3>S;++S)if(!B[S].complete||!K[S].complete)return;0===G&&(p=Date.now());S=Date.now();var P=!1,Q=e;A||T?(e.clearRect(0,0,v,q),c&&c.width===v&&c.height===q||(c=document.createElement("canvas"),c.width=v,c.height=q,h=c.getContext("2d")),Q=h,P=!0,A&&1===G&&(p=Date.now())):e.globalAlpha=1;Q.fillStyle="#3B4045";Q.fillRect(0,0,v,q);try{if(256<this.cssHeight){var U=1.5*cr.clamp(.22*
q,105,.6*v);var Z=U/8;Q.drawImage(128>=U?B[2]:256>=U?B[1]:B[0],.5*v-U/2,.2*q-Z/2,U,Z);Z=U=Math.min(.395*q,.95*v);Q.drawImage(y,.5*v-U/2,.485*q-Z/2,U,Z);U=1.5*cr.clamp(.22*q,105,.6*v);Z=U/8;Q.drawImage(128>=U?K[2]:256>=U?K[1]:K[0],.5*v-U/2,.868*q-Z/2,U,Z);Q.fillStyle="#4D565D";U=v;Z=Math.max(.005*q,2);Q.fillRect(0,.8*q-Z/2,U,Z);Q.fillStyle=z?"red":"#29F3D0";U=v*this.progress;Q.fillRect(.5*v-U/2,.8*q-Z/2,U,Z)}else Z=U=.55*q,Q.drawImage(y,.5*v-U/2,.45*q-Z/2,U,Z),Q.fillStyle="#4D565D",U=v,Z=Math.max(.005*
q,2),Q.fillRect(0,.85*q-Z/2,U,Z),Q.fillStyle=z?"red":"#29F3D0",U=v*this.progress,Q.fillRect(.5*v-U/2,.85*q-Z/2,U,Z);P&&(A?e.globalAlpha=0===G?0:Math.min((S-p)/300,1):T&&(e.globalAlpha=Math.max(1-(S-I)/300,0)),e.drawImage(c,0,0,v,q))}catch(ba){}A&&300<=S-p&&2<=G&&(A=!1,W=S);!A&&S-W>=t&&!T&&1<=this.progress&&(T=!0,I=S);if(T&&S-I>=300+x||m&&1<=this.progress&&500>Date.now()-p)g=!0,T=A=!1,this.loaderlogos=h=c=null;++G}}};b.prototype.go_loading_finished=function(){if(this.webFontNames.length&&document.fonts&&
document.fonts.load){var e=this;Promise.all(this.webFontNames.map(function(m){return document.fonts.load("1em '"+m+"'")})).then(function(){e.start_first_layout()})}else this.start_first_layout()};b.prototype.start_first_layout=function(){this.overlay_canvas&&(this.canvas.parentNode.removeChild(this.overlay_canvas),this.overlay_canvas=this.overlay_ctx=null);this.start_time=Date.now();this.last_fps_time=cr.performance_now();var e;if(this.uses_loader_layout){var m=0;for(e=this.types_by_index.length;m<
e;m++){var x=this.types_by_index[m];x.is_family||x.isOnLoaderLayout||!x.plugin.is_world||(x.onCreate(),cr.seal(x))}}else this.isloading=!1;m=0;for(e=this.layouts_by_index.length;m<e;m++)this.layouts_by_index[m].createGlobalNonWorlds();2<=this.fullscreen_mode&&(m=this.original_width/this.original_height,e=this.width/this.height,this.aspect_scale=2!==this.fullscreen_mode&&e>m||2===this.fullscreen_mode&&e<m?this.height/this.original_height:this.width/this.original_width);m=0;for(e=this.types_by_index.length;m<
e;m++)if(x=this.types_by_index[m],x.onBeforeAppBegin)x.onBeforeAppBegin();this.first_layout?this.layouts[this.first_layout].startRunning():this.layouts_by_index[0].startRunning();this.uses_loader_layout||(this.loadingprogress=1,this.trigger(cr.system_object.prototype.cnds.OnLoadFinished,null),window.C3_RegisterSW&&window.C3_RegisterSW());navigator.splashscreen&&navigator.splashscreen.hide&&navigator.splashscreen.hide();m=0;for(e=this.types_by_index.length;m<e;m++)if(x=this.types_by_index[m],x.onAppBegin)x.onAppBegin();
m=function(){document.hidden||document.webkitHidden||document.mozHidden||document.msHidden?window.cr_setSuspended(!0):window.cr_setSuspended(!1)};document.addEventListener("visibilitychange",m,!1);document.addEventListener("mozvisibilitychange",m,!1);document.addEventListener("webkitvisibilitychange",m,!1);document.addEventListener("msvisibilitychange",m,!1);this.isCordova&&(document.addEventListener("pause",function(){window.cr_setSuspended(!0)}),document.addEventListener("resume",function(){window.cr_setSuspended(!1)}));
document.hidden||document.webkitHidden||document.mozHidden||document.msHidden?window.cr_setSuspended(!0):this.tick(!1)};b.prototype.tick=function(e,m,x){if(this.running_layout){var t=cr.performance_now();if(x||!this.isSuspended||e){e||(C?this.raf_id=C(this.tickFunc):this.timeout_id=setTimeout(this.tickFunc,this.isMobile?1:16));m=m||t;var v=this.fullscreen_mode;(x=(document.mozFullScreen||document.webkitIsFullScreen||document.fullScreen||!!document.msFullscreenElement)&&!this.isCordova)&&0<this.fullscreen_scaling&&
(v=this.fullscreen_scaling);if(0<v){v=window.innerWidth;var q=window.innerHeight;this.lastWindowWidth===v&&this.lastWindowHeight===q||this.setSize(v,q)}x?this.firstInFullscreen||(this.firstInFullscreen=!0):this.firstInFullscreen?(this.firstInFullscreen=!1,0===this.fullscreen_mode&&this.setSize(Math.round(this.oldWidth/this.devicePixelRatio),Math.round(this.oldHeight/this.devicePixelRatio),!0)):(this.oldWidth=this.width,this.oldHeight=this.height);this.isloading&&(x=this.areAllTexturesAndSoundsLoaded(),
this.loadingprogress=this.progress,x&&(this.isloading=!1,this.progress=1,this.trigger(cr.system_object.prototype.cnds.OnLoadFinished,null),window.C3_RegisterSW&&window.C3_RegisterSW()));this.logic(m);!this.redraw||this.is_WebGL_context_lost||this.suspendDrawing||e||(this.redraw=!1,this.glwrap?this.drawGL():this.draw(),this.snapshotCanvas&&(this.canvas&&this.canvas.toDataURL&&(this.snapshotData=this.canvas.toDataURL(this.snapshotCanvas[0],this.snapshotCanvas[1]),window.cr_onSnapshot&&window.cr_onSnapshot(this.snapshotData),
this.trigger(cr.system_object.prototype.cnds.OnCanvasSnapshot,null)),this.snapshotCanvas=null));this.hit_breakpoint||(this.tickcount++,this.tickcount_nosave++,this.execcount++,this.framecount++);this.logictime+=cr.performance_now()-t}}};b.prototype.logic=function(e){var m;1E3<=e-this.last_fps_time&&(this.last_fps_time+=1E3,1E3<=e-this.last_fps_time&&(this.last_fps_time=e),this.fps=this.framecount,this.framecount=0,this.cpuutilisation=Math.min(this.logictime,1E3),this.logictime=0,this.glwrap&&0===
this.gpuTimeEndFrame&&(this.gpuTimeEndFrame=this.glwrap.getFrameNumber(),this.gpuCurUtilisation=-1));this.glwrap&&-1===this.gpuCurUtilisation&&this.glwrap.supportsGpuProfiling()&&(this.gpuCurUtilisation=this.glwrap.getFrameRangeTimerResults(this.gpuTimeStartFrame,this.gpuTimeEndFrame),-1!==this.gpuCurUtilisation&&(this.glwrap.deleteTimerResultsToFrame(this.gpuTimeEndFrame),this.gpuLastUtilisation=Math.min(this.gpuCurUtilisation,1),this.gpuTimeStartFrame=this.gpuTimeEndFrame,this.gpuTimeEndFrame=0));
if(0!==this.last_tick_time){var x=e-this.last_tick_time;0>x&&(x=0);this.dt1=x/1E3;.5<this.dt1?this.dt1=0:this.dt1>1/this.minimumFramerate&&(this.dt1=1/this.minimumFramerate)}this.last_tick_time=e;this.dt=this.dt1*this.timescale;this.kahanTime.add(this.dt);this.wallTime.add(this.dt1);e=(document.mozFullScreen||document.webkitIsFullScreen||document.fullScreen||!!document.msFullscreenElement)&&!this.isCordova;if(2<=this.fullscreen_mode||e&&0<this.fullscreen_scaling){x=this.original_width/this.original_height;
var t=this.width/this.height;var v=this.fullscreen_mode;e&&0<this.fullscreen_scaling&&(v=this.fullscreen_scaling);this.aspect_scale=2!==v&&t>x||2===v&&t<x?this.height/this.original_height:this.width/this.original_width;this.running_layout&&(this.running_layout.scrollToX(this.running_layout.scrollX),this.running_layout.scrollToY(this.running_layout.scrollY))}else this.aspect_scale=this.isRetina?this.devicePixelRatio:1;this.ClearDeathRow();this.isInOnDestroy++;this.system.runWaits();this.isInOnDestroy--;
this.ClearDeathRow();this.isInOnDestroy++;t=this.objects_to_pretick.valuesRef();e=0;for(x=t.length;e<x;e++)t[e].pretick();e=0;for(x=this.types_by_index.length;e<x;e++){var q=this.types_by_index[e];if(!q.is_family&&(q.behaviors.length||q.families.length))for(t=0,v=q.instances.length;t<v;t++){var y=q.instances[t];var B=0;for(m=y.behavior_insts.length;B<m;B++)y.behavior_insts[B].tick()}}e=0;for(x=this.types_by_index.length;e<x;e++)if(q=this.types_by_index[e],!q.is_family&&(q.behaviors.length||q.families.length))for(t=
0,v=q.instances.length;t<v;t++)for(y=q.instances[t],B=0,m=y.behavior_insts.length;B<m;B++){var K=y.behavior_insts[B];K.posttick&&K.posttick()}t=this.objects_to_tick.valuesRef();e=0;for(x=t.length;e<x;e++)t[e].tick();this.isInOnDestroy--;this.handleSaveLoad();for(e=0;this.changelayout&&10>e++;)this.doChangeLayout(this.changelayout);e=0;for(x=this.eventsheets_by_index.length;e<x;e++)this.eventsheets_by_index[e].hasRun=!1;this.running_layout.event_sheet&&this.running_layout.event_sheet.run();cr.clearArray(this.registered_collisions);
this.layout_first_tick=!1;this.isInOnDestroy++;e=0;for(x=this.types_by_index.length;e<x;e++)if(q=this.types_by_index[e],!q.is_family&&(q.behaviors.length||q.families.length))for(t=0,v=q.instances.length;t<v;t++)for(y=q.instances[t],B=0,m=y.behavior_insts.length;B<m;B++)K=y.behavior_insts[B],K.tick2&&K.tick2();t=this.objects_to_tick2.valuesRef();e=0;for(x=t.length;e<x;e++)t[e].tick2();this.isInOnDestroy--};b.prototype.onWindowBlur=function(){var e,m,x;var t=0;for(e=this.types_by_index.length;t<e;t++){var v=
this.types_by_index[t];if(!v.is_family){var q=0;for(m=v.instances.length;q<m;q++){var y=v.instances[q];if(y.onWindowBlur)y.onWindowBlur();if(y.behavior_insts){var B=0;for(x=y.behavior_insts.length;B<x;B++){var K=y.behavior_insts[B];if(K.onWindowBlur)K.onWindowBlur()}}}}}};b.prototype.doChangeLayout=function(e){var m=this.running_layout;this.running_layout.stopRunning();var x;if(this.glwrap){var t=0;for(x=this.types_by_index.length;t<x;t++){var v=this.types_by_index[t];v.is_family||!v.unloadTextures||
v.global&&0!==v.instances.length||-1!==e.initial_types.indexOf(v)||v.unloadTextures()}}m==e&&cr.clearArray(this.system.waits);cr.clearArray(this.registered_collisions);this.runLayoutChangeMethods(!0);e.startRunning();this.runLayoutChangeMethods(!1);this.layout_first_tick=this.redraw=!0;this.ClearDeathRow()};b.prototype.runLayoutChangeMethods=function(e){var m,x,t;var v=0;for(m=this.behaviors.length;v<m;v++){var q=this.behaviors[v];if(e){if(q.onBeforeLayoutChange)q.onBeforeLayoutChange()}else if(q.onLayoutChange)q.onLayoutChange()}v=
0;for(m=this.types_by_index.length;v<m;v++)if(q=this.types_by_index[v],q.global||q.plugin.singleglobal){var y=0;for(x=q.instances.length;y<x;y++){var B=q.instances[y];if(e){if(B.onBeforeLayoutChange)B.onBeforeLayoutChange()}else if(B.onLayoutChange)B.onLayoutChange();if(B.behavior_insts){var K=0;for(t=B.behavior_insts.length;K<t;K++){var S=B.behavior_insts[K];if(e){if(S.onBeforeLayoutChange)S.onBeforeLayoutChange()}else if(S.onLayoutChange)S.onLayoutChange()}}}}};b.prototype.pretickMe=function(e){this.objects_to_pretick.add(e)};
b.prototype.unpretickMe=function(e){this.objects_to_pretick.remove(e)};b.prototype.tickMe=function(e){this.objects_to_tick.add(e)};b.prototype.untickMe=function(e){this.objects_to_tick.remove(e)};b.prototype.tick2Me=function(e){this.objects_to_tick2.add(e)};b.prototype.untick2Me=function(e){this.objects_to_tick2.remove(e)};b.prototype.getDt=function(e){return e&&-1!==e.my_timescale?this.dt1*e.my_timescale:this.dt};b.prototype.draw=function(){this.running_layout.draw(this.ctx)};b.prototype.drawGL=
function(){this.enableFrontToBack&&(this.earlyz_index=1,this.running_layout.drawGL_earlyZPass(this.glwrap));this.running_layout.drawGL(this.glwrap);this.glwrap.present()};b.prototype.addDestroyCallback=function(e){e&&this.destroycallbacks.push(e)};b.prototype.removeDestroyCallback=function(e){cr.arrayFindRemove(this.destroycallbacks,e)};b.prototype.getObjectByUID=function(e){e=e.toString();return this.objectsByUid.hasOwnProperty(e)?this.objectsByUid[e]:null};var f=[];b.prototype.DestroyInstance=function(e){var m;
var x=e.type.name;if(this.deathRow.hasOwnProperty(x)){var t=this.deathRow[x];if(t.contains(e))return}else t=f.length?f.pop():new cr.ObjectSet,this.deathRow[x]=t;e.isDestroyed=!0;t.add(e);this.hasPendingInstances=!0;if(e.is_contained)for(x=0,m=e.siblings.length;x<m;x++)this.DestroyInstance(e.siblings[x]);this.isInClearDeathRow&&t.values_cache.push(e);this.isEndingLayout||(this.isInOnDestroy++,this.trigger(Object.getPrototypeOf(e.type.plugin).cnds.OnDestroyed,e),this.isInOnDestroy--)};b.prototype.ClearDeathRow=
function(){if(this.hasPendingInstances){var e,m;this.isInClearDeathRow=!0;var x=0;for(e=this.createRow.length;x<e;++x){var t=this.createRow[x];var v=t.type;v.instances.push(t);var q=0;for(m=v.families.length;q<m;++q)v.families[q].instances.push(t),v.families[q].stale_iids=!0}cr.clearArray(this.createRow);this.IterateDeathRow();cr.wipe(this.deathRow);this.hasPendingInstances=this.isInClearDeathRow=!1}};b.prototype.IterateDeathRow=function(){for(var e in this.deathRow)this.deathRow.hasOwnProperty(e)&&
this.ClearDeathRowForType(this.deathRow[e])};b.prototype.ClearDeathRowForType=function(e){var m=e.valuesRef(),x=m[0].type,t,v;cr.arrayRemoveAllFromObjectSet(x.instances,e);x.stale_iids=!0;0===x.instances.length&&(x.any_instance_parallaxed=!1);var q=0;for(t=x.families.length;q<t;++q){var y=x.families[q];cr.arrayRemoveAllFromObjectSet(y.instances,e);y.stale_iids=!0}q=0;for(t=this.system.waits.length;q<t;++q){var B=this.system.waits[q];B.sols.hasOwnProperty(x.index)&&cr.arrayRemoveAllFromObjectSet(B.sols[x.index].insts,
e);if(!x.is_family){var K=0;for(v=x.families.length;K<v;++K)y=x.families[K],B.sols.hasOwnProperty(y.index)&&cr.arrayRemoveAllFromObjectSet(B.sols[y.index].insts,e)}}if(B=m[0].layer){if(B.useRenderCells)for(K=B.instances,q=0,t=K.length;q<t;++q)v=K[q],e.contains(v)&&(v.update_bbox(),B.render_grid.update(v,v.rendercells,null),v.rendercells.set(0,0,-1,-1));cr.arrayRemoveAllFromObjectSet(B.instances,e);B.setZIndicesStaleFrom(0)}for(q=0;q<m.length;++q)this.ClearDeathRowForSingleInstance(m[q],x);e.clear();
f.push(e);this.redraw=!0};b.prototype.ClearDeathRowForSingleInstance=function(e,m){var x;var t=0;for(x=this.destroycallbacks.length;t<x;++t)this.destroycallbacks[t](e);e.collcells&&m.collision_grid.update(e,e.collcells,null);(t=e.layer)&&t.removeFromInstanceList(e,!0);if(e.behavior_insts)for(t=0,x=e.behavior_insts.length;t<x;++t){var v=e.behavior_insts[t];if(v.onDestroy)v.onDestroy();v.behavior.my_instances.remove(e)}this.objects_to_pretick.remove(e);this.objects_to_tick.remove(e);this.objects_to_tick2.remove(e);
if(e.onDestroy)e.onDestroy();this.objectsByUid.hasOwnProperty(e.uid.toString())&&delete this.objectsByUid[e.uid.toString()];this.objectcount--;100>m.deadCache.length&&m.deadCache.push(e)};b.prototype.createInstance=function(e,m,x,t){if(e.is_family){var v=cr.floor(Math.random()*e.members.length);return this.createInstance(e.members[v],m,x,t)}return e.default_instance?this.createInstanceFromInit(e.default_instance,m,!1,x,t,!1):null};var r=[];b.prototype.createInstanceFromInit=function(e,m,x,t,v,q){var y,
B;if(!e)return null;var K=this.types_by_index[e[1]],S=K.plugin.is_world;if(this.isloading&&S&&!K.isOnLoaderLayout||S&&!this.glwrap&&11===e[0][11])return null;var P=m;S||(m=null);if(K.deadCache.length){var Q=K.deadCache.pop();Q.recycled=!0;K.plugin.Instance.call(Q,K)}else Q=new K.plugin.Instance(K),Q.recycled=!1;!x||q||this.objectsByUid.hasOwnProperty(e[2].toString())?Q.uid=this.next_uid++:Q.uid=e[2];this.objectsByUid[Q.uid.toString()]=Q;Q.puid=this.next_puid++;Q.iid=K.instances.length;var U=0;for(y=
this.createRow.length;U<y;++U)this.createRow[U].type===K&&Q.iid++;Q.get_iid=cr.inst_get_iid;Q.toString=cr.inst_toString;Q.isDestroyed=!1;var Z=e[3];if(Q.recycled)cr.wipe(Q.extra);else{Q.extra={};if(this.isPreview)for(Q.instance_var_names=[],Q.instance_var_names.length=Z.length,U=0,y=Z.length;U<y;U++)Q.instance_var_names[U]=Z[U][1];Q.instance_vars=[];Q.instance_vars.length=Z.length}U=0;for(y=Z.length;U<y;U++)Q.instance_vars[U]=Z[U][0];if(S){var ba=e[0];Q.x=cr.is_undefined(t)?ba[0]:t;Q.y=cr.is_undefined(v)?
ba[1]:v;Q.z=ba[2];Q.width=ba[3];Q.height=ba[4];Q.depth=ba[5];Q.angle=ba[6];Q.opacity=ba[7];Q.hotspotX=ba[8];Q.hotspotY=ba[9];Q.blend_mode=ba[10];U=ba[11];!this.glwrap&&K.effect_types.length&&(Q.blend_mode=U);Q.compositeOp=cr.effectToCompositeOp(Q.blend_mode);this.gl&&cr.setGLBlend(Q,Q.blend_mode,this.gl);if(Q.recycled){U=0;for(y=ba[12].length;U<y;U++)for(Z=0,B=ba[12][U].length;Z<B;Z++)Q.effect_params[U][Z]=ba[12][U][Z],Array.isArray(Q.effect_params[U][Z])&&(Q.effect_params[U][Z]=Q.effect_params[U][Z].slice(0));
Q.bbox.set(0,0,0,0);Q.collcells.set(0,0,-1,-1);Q.rendercells.set(0,0,-1,-1);Q.bquad.set_from_rect(Q.bbox);cr.clearArray(Q.bbox_changed_callbacks)}else{Q.effect_params=ba[12].slice(0);U=0;for(y=Q.effect_params.length;U<y;U++)for(Q.effect_params[U]=ba[12][U].slice(0),Z=0,B=Q.effect_params[U].length;Z<B;++Z)Array.isArray(Q.effect_params[U][Z])&&(Q.effect_params[U][Z]=Q.effect_params[U][Z].slice(0));Q.active_effect_types=[];Q.active_effect_flags=[];Q.active_effect_flags.length=K.effect_types.length;Q.bbox=
new cr.rect(0,0,0,0);Q.collcells=new cr.rect(0,0,-1,-1);Q.rendercells=new cr.rect(0,0,-1,-1);Q.bquad=new cr.quad;Q.bbox_changed_callbacks=[];Q.set_bbox_changed=cr.set_bbox_changed;Q.add_bbox_changed_callback=cr.add_bbox_changed_callback;Q.contains_pt=cr.inst_contains_pt;Q.update_bbox=cr.update_bbox;Q.update_render_cell=cr.update_render_cell;Q.update_collision_cell=cr.update_collision_cell;Q.get_zindex=cr.inst_get_zindex}Q.tilemap_exists=!1;Q.tilemap_width=0;Q.tilemap_height=0;Q.tilemap_data=null;
14===ba.length&&(Q.tilemap_exists=!0,Q.tilemap_width=ba[13][0],Q.tilemap_height=ba[13][1],Q.tilemap_data=ba[13][2]);U=0;for(y=K.effect_types.length;U<y;U++)Q.active_effect_flags[U]=!0;Q.shaders_preserve_opaqueness=!0;Q.updateActiveEffects=cr.inst_updateActiveEffects;Q.updateActiveEffects();Q.uses_shaders=!!Q.active_effect_types.length;Q.bbox_changed=!0;Q.cell_changed=!0;K.any_cell_changed=!0;Q.visible=!0;Q.my_timescale=-1;Q.layer=m;Q.zindex=m.instances.length;Q.earlyz_index=0;"undefined"===typeof Q.collision_poly&&
(Q.collision_poly=null);this.redraw=Q.collisionsEnabled=!0}cr.clearArray(r);U=0;for(y=K.families.length;U<y;U++)r.push.apply(r,K.families[U].behaviors);r.push.apply(r,K.behaviors);if(Q.recycled)for(U=0,y=r.length;U<y;U++){var da=r[U];var ea=Q.behavior_insts[U];ea.recycled=!0;da.behavior.Instance.call(ea,da,Q);ba=e[4][U];Z=0;for(B=ba.length;Z<B;Z++)ea.properties[Z]=ba[Z];ea.onCreate();da.behavior.my_instances.add(Q)}else for(Q.behavior_insts=[],U=0,y=r.length;U<y;U++)da=r[U],ea=new da.behavior.Instance(da,
Q),ea.recycled=!1,ea.properties=e[4][U].slice(0),ea.onCreate(),cr.seal(ea),Q.behavior_insts.push(ea),da.behavior.my_instances.add(Q);ba=e[5];if(Q.recycled)for(U=0,y=ba.length;U<y;U++)Q.properties[U]=ba[U];else Q.properties=ba.slice(0);this.createRow.push(Q);this.hasPendingInstances=!0;m&&(m.appendToInstanceList(Q,!0),1!==m.parallaxX||1!==m.parallaxY)&&(K.any_instance_parallaxed=!0);this.objectcount++;if(K.is_contained){if(Q.is_contained=!0,Q.recycled?cr.clearArray(Q.siblings):Q.siblings=[],!x&&!q){U=
0;for(y=K.container.length;U<y;U++)if(K.container[U]!==K){if(!K.container[U].default_instance)return null;Q.siblings.push(this.createInstanceFromInit(K.container[U].default_instance,P,!1,S?Q.x:t,S?Q.y:v,!0))}U=0;for(y=Q.siblings.length;U<y;U++)for(Q.siblings[U].siblings.push(Q),Z=0;Z<y;Z++)U!==Z&&Q.siblings[U].siblings.push(Q.siblings[Z])}}else Q.is_contained=!1,Q.siblings=null;Q.onCreate();Q.recycled||cr.seal(Q);U=0;for(y=Q.behavior_insts.length;U<y;U++)Q.behavior_insts[U].postCreate&&Q.behavior_insts[U].postCreate();
return Q};b.prototype.getLayerByName=function(e){var m;var x=0;for(m=this.running_layout.layers.length;x<m;x++){var t=this.running_layout.layers[x];if(cr.equals_nocase(t.name,e))return t}return null};b.prototype.getLayerByNumber=function(e){e=cr.floor(e);0>e&&(e=0);e>=this.running_layout.layers.length&&(e=this.running_layout.layers.length-1);return this.running_layout.layers[e]};b.prototype.getLayer=function(e){return cr.is_number(e)?this.getLayerByNumber(e):this.getLayerByName(e.toString())};b.prototype.clearSol=
function(e){var m;var x=0;for(m=e.length;x<m;x++)e[x].getCurrentSol().select_all=!0};b.prototype.pushCleanSol=function(e){var m;var x=0;for(m=e.length;x<m;x++)e[x].pushCleanSol()};b.prototype.pushCopySol=function(e){var m;var x=0;for(m=e.length;x<m;x++)e[x].pushCopySol()};b.prototype.popSol=function(e){var m;var x=0;for(m=e.length;x<m;x++)e[x].popSol()};b.prototype.updateAllCells=function(e){if(e.any_cell_changed){var m,x=e.instances;var t=0;for(m=x.length;t<m;++t)x[t].update_collision_cell();x=this.createRow;
t=0;for(m=x.length;t<m;++t)x[t].type===e&&x[t].update_collision_cell();e.any_cell_changed=!1}};b.prototype.getCollisionCandidates=function(e,m,x,t){var v,q=e?1!==e.parallaxX||1!==e.parallaxY:!1;if(m.is_family)for(e=0,v=m.members.length;e<v;++e){var y=m.members[e];q||y.any_instance_parallaxed?cr.appendArray(t,y.instances):(this.updateAllCells(y),y.collision_grid.queryRange(x,t))}else q||m.any_instance_parallaxed?cr.appendArray(t,m.instances):(this.updateAllCells(m),m.collision_grid.queryRange(x,t))};
b.prototype.getTypesCollisionCandidates=function(e,m,x,t){var v;var q=0;for(v=m.length;q<v;++q)this.getCollisionCandidates(e,m[q],x,t)};b.prototype.getSolidCollisionCandidates=function(e,m,x){var t=this.getSolidBehavior();if(!t)return null;this.getTypesCollisionCandidates(e,t.my_types,m,x)};b.prototype.getJumpthruCollisionCandidates=function(e,m,x){var t=this.getJumpthruBehavior();if(!t)return null;this.getTypesCollisionCandidates(e,t.my_types,m,x)};b.prototype.testAndSelectCanvasPointOverlap=function(e,
m,x,t){var v=e.getCurrentSol(),q,y=this.getCurrentEventStack().current_event.orblock;if(v.select_all){t||(v.select_all=!1,cr.clearArray(v.instances));var B=0;for(q=e.instances.length;B<q;B++){var K=e.instances[B];K.update_bbox();var S=K.layer.canvasToLayer(m,x,!0);var P=K.layer.canvasToLayer(m,x,!1);if(K.contains_pt(S,P)){if(t)return!1;v.instances.push(K)}else y&&v.else_instances.push(K)}}else{var Q=0;var U=y?v.else_instances:v.instances;B=0;for(q=U.length;B<q;B++)if(K=U[B],K.update_bbox(),S=K.layer.canvasToLayer(m,
x,!0),P=K.layer.canvasToLayer(m,x,!1),K.contains_pt(S,P)){if(t)return!1;y?v.instances.push(K):(v.instances[Q]=v.instances[B],Q++)}t||(U.length=Q)}e.applySolToContainer();return t?!0:v.hasObjects()};b.prototype.testOverlap=function(e,m){if(!(e&&m&&e!==m&&e.collisionsEnabled&&m.collisionsEnabled))return!1;e.update_bbox();m.update_bbox();var x=e.layer,t=m.layer,v;if(x===t||x.parallaxX===t.parallaxX&&t.parallaxY===t.parallaxY&&x.scale===t.scale&&x.angle===t.angle&&x.zoomRate===t.zoomRate){if(!e.bbox.intersects_rect(m.bbox)||
!e.bquad.intersects_quad(m.bquad)||e.tilemap_exists&&m.tilemap_exists)return!1;if(e.tilemap_exists)return this.testTilemapOverlap(e,m);if(m.tilemap_exists)return this.testTilemapOverlap(m,e);var q=e.collision_poly&&!e.collision_poly.is_empty();var y=m.collision_poly&&!m.collision_poly.is_empty();if(!q&&!y)return!0;q?(e.collision_poly.cache_poly(e.width,e.height,e.angle),q=e.collision_poly):(this.temp_poly.set_from_quad(e.bquad,e.x,e.y,e.width,e.height),q=this.temp_poly);if(y){m.collision_poly.cache_poly(m.width,
m.height,m.angle);var B=m.collision_poly}else this.temp_poly.set_from_quad(m.bquad,m.x,m.y,m.width,m.height),B=this.temp_poly;return q.intersects_poly(B,m.x-e.x,m.y-e.y)}q=e.collision_poly&&!e.collision_poly.is_empty();y=m.collision_poly&&!m.collision_poly.is_empty();q?(e.collision_poly.cache_poly(e.width,e.height,e.angle),this.temp_poly.set_from_poly(e.collision_poly)):this.temp_poly.set_from_quad(e.bquad,e.x,e.y,e.width,e.height);q=this.temp_poly;y?(m.collision_poly.cache_poly(m.width,m.height,
m.angle),this.temp_poly2.set_from_poly(m.collision_poly)):this.temp_poly2.set_from_quad(m.bquad,m.x,m.y,m.width,m.height);B=this.temp_poly2;y=0;for(v=q.pts_count;y<v;y++){var K=2*y;var S=K+1;var P=q.pts_cache[K];var Q=q.pts_cache[S];q.pts_cache[K]=x.layerToCanvas(P+e.x,Q+e.y,!0);q.pts_cache[S]=x.layerToCanvas(P+e.x,Q+e.y,!1)}q.update_bbox();y=0;for(v=B.pts_count;y<v;y++)K=2*y,S=K+1,P=B.pts_cache[K],Q=B.pts_cache[S],B.pts_cache[K]=t.layerToCanvas(P+m.x,Q+m.y,!0),B.pts_cache[S]=t.layerToCanvas(P+m.x,
Q+m.y,!1);B.update_bbox();return q.intersects_poly(B,0,0)};var J=new cr.quad,M=new cr.rect(0,0,0,0),V=[];b.prototype.testTilemapOverlap=function(e,m){var x,t=m.bbox,v=e.x,q=e.y;e.getCollisionRectCandidates(t,V);var y=m.collision_poly&&!m.collision_poly.is_empty();e=0;for(x=V.length;e<x;++e){var B=V[e];var K=B.rc;if(t.intersects_rect_off(K,v,q)&&(J.set_from_rect(K),J.offset(v,q),J.intersects_quad(m.bquad)))if(y)if(m.collision_poly.cache_poly(m.width,m.height,m.angle),B.poly){if(B.poly.intersects_poly(m.collision_poly,
m.x-(v+K.left),m.y-(q+K.top)))return cr.clearArray(V),!0}else{if(this.temp_poly.set_from_quad(J,0,0,K.right-K.left,K.bottom-K.top),this.temp_poly.intersects_poly(m.collision_poly,m.x,m.y))return cr.clearArray(V),!0}else if(B.poly){if(this.temp_poly.set_from_quad(m.bquad,0,0,m.width,m.height),B.poly.intersects_poly(this.temp_poly,-(v+K.left),-(q+K.top)))return cr.clearArray(V),!0}else return cr.clearArray(V),!0}cr.clearArray(V);return!1};b.prototype.testRectOverlap=function(e,m){if(!m||!m.collisionsEnabled)return!1;
m.update_bbox();if(!m.bbox.intersects_rect(e))return!1;if(m.tilemap_exists){m.getCollisionRectCandidates(e,V);var x,t=m.x,v=m.y;m=0;for(x=V.length;m<x;++m){var q=V[m];var y=q.rc;if(e.intersects_rect_off(y,t,v))if(q.poly){if(this.temp_poly.set_from_rect(e,0,0),q.poly.intersects_poly(this.temp_poly,-(t+y.left),-(v+y.top)))return cr.clearArray(V),!0}else return cr.clearArray(V),!0}cr.clearArray(V);return!1}J.set_from_rect(e);if(!m.bquad.intersects_quad(J))return!1;if(!m.collision_poly||m.collision_poly.is_empty())return!0;
m.collision_poly.cache_poly(m.width,m.height,m.angle);J.offset(-e.left,-e.top);this.temp_poly.set_from_quad(J,0,0,1,1);return m.collision_poly.intersects_poly(this.temp_poly,e.left-m.x,e.top-m.y)};b.prototype.testSegmentOverlap=function(e,m,x,t,v){if(!v||!v.collisionsEnabled)return!1;v.update_bbox();M.set(cr.min(e,x),cr.min(m,t),cr.max(e,x),cr.max(m,t));if(!v.bbox.intersects_rect(M))return!1;if(v.tilemap_exists){v.getCollisionRectCandidates(M,V);var q,y=v.x,B=v.y;v=0;for(q=V.length;v<q;++v){var K=
V[v];var S=K.rc;if(M.intersects_rect_off(S,y,B)&&(J.set_from_rect(S),J.offset(y,B),J.intersects_segment(e,m,x,t)))if(K.poly){if(K.poly.intersects_segment(y+S.left,B+S.top,e,m,x,t))return cr.clearArray(V),!0}else return cr.clearArray(V),!0}cr.clearArray(V);return!1}if(!v.bquad.intersects_segment(e,m,x,t))return!1;if(!v.collision_poly||v.collision_poly.is_empty())return!0;v.collision_poly.cache_poly(v.width,v.height,v.angle);return v.collision_poly.intersects_segment(v.x,v.y,e,m,x,t)};b.prototype.typeHasBehavior=
function(e,m){if(!m)return!1;var x,t;var v=0;for(x=e.behaviors.length;v<x;v++)if(e.behaviors[v].behavior instanceof m)return!0;if(!e.is_family)for(v=0,x=e.families.length;v<x;v++){var q=e.families[v];var y=0;for(t=q.behaviors.length;y<t;y++)if(q.behaviors[y].behavior instanceof m)return!0}return!1};b.prototype.typeHasNoSaveBehavior=function(e){return this.typeHasBehavior(e,cr.behaviors.NoSave)};b.prototype.typeHasPersistBehavior=function(e){return this.typeHasBehavior(e,cr.behaviors.Persist)};b.prototype.getSolidBehavior=
function(){return this.solidBehavior};b.prototype.getJumpthruBehavior=function(){return this.jumpthruBehavior};var X=[];b.prototype.testOverlapSolid=function(e){var m;e.update_bbox();this.getSolidCollisionCandidates(e.layer,e.bbox,X);var x=0;for(m=X.length;x<m;++x){var t=X[x];if(t.extra.solidEnabled&&this.testOverlap(e,t))return cr.clearArray(X),t}cr.clearArray(X);return null};b.prototype.testRectOverlapSolid=function(e){var m;this.getSolidCollisionCandidates(null,e,X);var x=0;for(m=X.length;x<m;++x){var t=
X[x];if(t.extra.solidEnabled&&this.testRectOverlap(e,t))return cr.clearArray(X),t}cr.clearArray(X);return null};var aa=[];b.prototype.testOverlapJumpThru=function(e,m){var x=null;m&&(x=aa,cr.clearArray(x));e.update_bbox();this.getJumpthruCollisionCandidates(e.layer,e.bbox,X);var t;var v=0;for(t=X.length;v<t;++v){var q=X[v];if(q.extra.jumpthruEnabled&&this.testOverlap(e,q))if(m)x.push(q);else return cr.clearArray(X),q}cr.clearArray(X);return x};b.prototype.pushOutSolid=function(e,m,x,t,v,q){t=t||50;
var y=e.x,B=e.y,K,S=null,P=null;for(K=0;K<t;K++)if(e.x=y+m*K,e.y=B+x*K,e.set_bbox_changed(),!this.testOverlap(e,S)&&((S=this.testOverlapSolid(e))&&(P=S),!S&&(v&&(S=q?this.testOverlap(e,q)?q:null:this.testOverlapJumpThru(e))&&(P=S),!S)))return P&&this.pushInFractional(e,m,x,P,16),!0;e.x=y;e.y=B;e.set_bbox_changed();return!1};b.prototype.pushOutSolidAxis=function(e,m,x,t){t=t||50;var v=e.x,q=e.y,y=null,B=null,K,S;for(K=0;K<t;++K)for(S=0;2>S;++S){var P=2*S-1;e.x=v+m*K*P;e.y=q+x*K*P;e.set_bbox_changed();
if(!this.testOverlap(e,y))if(y=this.testOverlapSolid(e))B=y;else return B&&this.pushInFractional(e,m*P,x*P,B,16),!0}e.x=v;e.y=q;e.set_bbox_changed();return!1};b.prototype.pushOut=function(e,m,x,t,v){t=t||50;var q=e.x,y=e.y,B;for(B=0;B<t;B++)if(e.x=q+m*B,e.y=y+x*B,e.set_bbox_changed(),!this.testOverlap(e,v))return!0;e.x=q;e.y=y;e.set_bbox_changed();return!1};b.prototype.pushInFractional=function(e,m,x,t,v){var q=2,y=!1;var B=!1;for(var K=e.x,S=e.y;q<=v;)B=1/q,q*=2,e.x+=m*B*(y?1:-1),e.y+=x*B*(y?1:-1),
e.set_bbox_changed(),this.testOverlap(e,t)?B=y=!0:(B=y=!1,K=e.x,S=e.y);B&&(e.x=K,e.y=S,e.set_bbox_changed())};b.prototype.pushOutSolidNearest=function(e,m){m=cr.is_undefined(m)?100:m;var x=0,t=e.x,v=e.y,q=0,y=0,B=0,K=this.testOverlapSolid(e);if(!K)return!0;for(;x<=m;){switch(q){case 0:y=0;B=-1;x++;break;case 1:y=1;B=-1;break;case 2:y=1;B=0;break;case 3:B=y=1;break;case 4:y=0;B=1;break;case 5:y=-1;B=1;break;case 6:y=-1;B=0;break;case 7:B=y=-1}q=(q+1)%8;e.x=cr.floor(t+y*x);e.y=cr.floor(v+B*x);e.set_bbox_changed();
if(!this.testOverlap(e,K)&&(K=this.testOverlapSolid(e),!K))return!0}e.x=t;e.y=v;e.set_bbox_changed();return!1};b.prototype.registerCollision=function(e,m){e.collisionsEnabled&&m.collisionsEnabled&&this.registered_collisions.push([e,m])};b.prototype.addRegisteredCollisionCandidates=function(e,m,x){var t;var v=0;for(t=this.registered_collisions.length;v<t;++v){var q=this.registered_collisions[v];if(q[0]===e)q=q[1];else if(q[1]===e)q=q[0];else continue;if(m.is_family){if(-1===m.members.indexOf(m))continue}else if(q.type!==
m)continue;-1===x.indexOf(q)&&x.push(q)}};b.prototype.checkRegisteredCollision=function(e,m){var x;var t=0;for(x=this.registered_collisions.length;t<x;t++){var v=this.registered_collisions[t];if(v[0]===e&&v[1]===m||v[0]===m&&v[1]===e)return!0}return!1};b.prototype.calculateSolidBounceAngle=function(e,m,x,t){var v=e.x,q=e.y,y=cr.max(10,cr.distanceTo(m,x,v,q)),B=cr.angleTo(m,x,v,q),K=t||this.testOverlapSolid(e);if(!K)return cr.clamp_angle(B+cr.PI);var S=K,P,Q=cr.to_radians(5);for(P=1;36>P;P++){var U=
B-P*Q;e.x=m+Math.cos(U)*y;e.y=x+Math.sin(U)*y;e.set_bbox_changed();if(!this.testOverlap(e,S)&&(S=t?null:this.testOverlapSolid(e),!S)){var Z=U;break}}36===P&&(Z=cr.clamp_angle(B+cr.PI));S=K;for(P=1;36>P;P++)if(U=B+P*Q,e.x=m+Math.cos(U)*y,e.y=x+Math.sin(U)*y,e.set_bbox_changed(),!this.testOverlap(e,S)&&(S=t?null:this.testOverlapSolid(e),!S)){var ba=U;break}36===P&&(ba=cr.clamp_angle(B+cr.PI));e.x=v;e.y=q;e.set_bbox_changed();if(ba===Z)return ba;e=cr.angleDiff(ba,Z)/2;e=cr.angleClockwise(ba,Z)?cr.clamp_angle(Z+
e+cr.PI):cr.clamp_angle(ba+e);Z=Math.cos(B);B=Math.sin(B);ba=Math.cos(e);e=Math.sin(e);m=Z*ba+B*e;return cr.angleTo(0,0,Z-2*m*ba,B-2*m*e)};var Y=-1;b.prototype.trigger=function(e,m,x){if(!this.running_layout)return!1;var t=this.running_layout.event_sheet;if(!t)return!1;var v=!1,q;Y++;var y=t.deep_includes;var B=0;for(q=y.length;B<q;++B){var K=this.triggerOnSheet(e,m,y[B],x);v=v||K}K=this.triggerOnSheet(e,m,t,x);Y--;return v||K};b.prototype.triggerOnSheet=function(e,m,x,t){var v=!1,q;if(m){var y=this.triggerOnSheetForTypeName(e,
m,m.type.name,x,t);v=v||y;var B=m.type.families;var K=0;for(q=B.length;K<q;++K)y=this.triggerOnSheetForTypeName(e,m,B[K].name,x,t),v=v||y}else y=this.triggerOnSheetForTypeName(e,m,"system",x,t),v=v||y;return v};b.prototype.triggerOnSheetForTypeName=function(e,m,x,t,v){var q,y=!1;var B="undefined"!==typeof v;var K=(B?t.fasttriggers:t.triggers)[x];if(!K)return y;var S=null;t=0;for(q=K.length;t<q;++t)if(K[t].method==e){S=K[t].evs;break}if(!S)return y;e=B?S[v]:S;if(!e)return null;t=0;for(q=e.length;t<
q;t++)v=e[t][0],B=e[t][1],v=this.executeSingleTrigger(m,x,v,B),y=y||v;return y};b.prototype.executeSingleTrigger=function(e,m,x,t){var v,q=!1;this.trigger_depth++;var y=this.getCurrentEventStack().current_event;y&&this.pushCleanSol(y.solModifiersIncludingParents);var B=1<this.trigger_depth;this.pushCleanSol(x.solModifiersIncludingParents);B&&this.pushLocalVarStack();var K=this.pushEventStack(x);K.current_event=x;if(e){var S=this.types[m].getCurrentSol();S.select_all=!1;cr.clearArray(S.instances);
S.instances[0]=e;this.types[m].applySolToContainer()}e=!0;if(x.parent){m=K.temp_parents_arr;for(S=x.parent;S;)m.push(S),S=S.parent;m.reverse();S=0;for(v=m.length;S<v;S++)if(!m[S].run_pretrigger()){e=!1;break}}e&&(this.execcount++,x.orblock?x.run_orblocktrigger(t):x.run(),q=q||K.last_event_true);this.popEventStack();B&&this.popLocalVarStack();this.popSol(x.solModifiersIncludingParents);y&&this.popSol(y.solModifiersIncludingParents);this.hasPendingInstances&&0===this.isInOnDestroy&&0===Y&&!this.isRunningEvents&&
this.ClearDeathRow();this.trigger_depth--;return q};b.prototype.getCurrentCondition=function(){var e=this.getCurrentEventStack();return e.current_event.conditions[e.cndindex]};b.prototype.getCurrentConditionObjectType=function(){return this.getCurrentCondition().type};b.prototype.isCurrentConditionFirst=function(){return 0===this.getCurrentEventStack().cndindex};b.prototype.getCurrentAction=function(){var e=this.getCurrentEventStack();return e.current_event.actions[e.actindex]};b.prototype.pushLocalVarStack=
function(){this.localvar_stack_index++;this.localvar_stack_index>=this.localvar_stack.length&&this.localvar_stack.push([])};b.prototype.popLocalVarStack=function(){this.localvar_stack_index--};b.prototype.getCurrentLocalVarStack=function(){return this.localvar_stack[this.localvar_stack_index]};b.prototype.pushEventStack=function(e){this.event_stack_index++;this.event_stack_index>=this.event_stack.length&&this.event_stack.push(new cr.eventStackFrame);var m=this.getCurrentEventStack();m.reset(e);return m};
b.prototype.popEventStack=function(){this.event_stack_index--};b.prototype.getCurrentEventStack=function(){return this.event_stack[this.event_stack_index]};b.prototype.pushLoopStack=function(e){this.loop_stack_index++;this.loop_stack_index>=this.loop_stack.length&&this.loop_stack.push(cr.seal({name:e,index:0,stopped:!1}));var m=this.getCurrentLoop();m.name=e;m.index=0;m.stopped=!1;return m};b.prototype.popLoopStack=function(){this.loop_stack_index--};b.prototype.getCurrentLoop=function(){return this.loop_stack[this.loop_stack_index]};
b.prototype.getEventVariableByName=function(e,m){for(var x,t,v,q,y;m;){x=0;for(t=m.subevents.length;x<t;x++)if(y=m.subevents[x],y instanceof cr.eventvariable&&cr.equals_nocase(e,y.name))return y;m=m.parent}x=0;for(t=this.eventsheets_by_index.length;x<t;x++)for(q=this.eventsheets_by_index[x],m=0,v=q.events.length;m<v;m++)if(y=q.events[m],y instanceof cr.eventvariable&&cr.equals_nocase(e,y.name))return y;return null};b.prototype.getLayoutBySid=function(e){var m;var x=0;for(m=this.layouts_by_index.length;x<
m;x++)if(this.layouts_by_index[x].sid===e)return this.layouts_by_index[x];return null};b.prototype.getObjectTypeBySid=function(e){var m;var x=0;for(m=this.types_by_index.length;x<m;x++)if(this.types_by_index[x].sid===e)return this.types_by_index[x];return null};b.prototype.getGroupBySid=function(e){var m;var x=0;for(m=this.allGroups.length;x<m;x++)if(this.allGroups[x].sid===e)return this.allGroups[x];return null};b.prototype.requirePermissions=function(e){return this.getPermissions(e).then(function(m){if(!1===
m)return Promise.reject("Permission not granted")})};b.prototype.getPermissions=function(e){return this.isCordova&&this.isAndroid?e.reduce(function(m,x){return m.then(function(t){return!1===t?!1:D(x).then(function(v){return v?!0:w(x)})})},Promise.resolve(!0)):Promise.resolve(!0)};b.prototype.doCanvasSnapshot=function(e,m){this.snapshotCanvas=[e,m];this.redraw=!0};b.prototype.signalContinuousPreview=function(){this.signalledContinuousPreview=!0};b.prototype.handleSaveLoad=function(){var e=this,m=this.saveToSlot,
x=this.lastSaveJson,t=this.loadFromSlot,v=!1;this.signalledContinuousPreview&&(v=!0,m="__c2_continuouspreview",this.signalledContinuousPreview=!1);if(m.length){this.ClearDeathRow();x=this.saveToJSONString();if(O())k(m,x,function(){cr.logexport("Saved state to IndexedDB storage ("+x.length+" bytes)");e.lastSaveJson=x;e.trigger(cr.system_object.prototype.cnds.OnSaveComplete,null);x=e.lastSaveJson="";v&&d()},function(q){try{localStorage.setItem("__c2save_"+m,x),cr.logexport("Saved state to WebStorage ("+
x.length+" bytes)"),e.lastSaveJson=x,e.trigger(cr.system_object.prototype.cnds.OnSaveComplete,null),x=e.lastSaveJson="",v&&d()}catch(y){cr.logexport("Failed to save game state: "+q+"; "+y),e.trigger(cr.system_object.prototype.cnds.OnSaveFailed,null)}});else try{localStorage.setItem("__c2save_"+m,x),cr.logexport("Saved state to WebStorage ("+x.length+" bytes)"),e.lastSaveJson=x,this.trigger(cr.system_object.prototype.cnds.OnSaveComplete,null),x=e.lastSaveJson="",v&&d()}catch(q){cr.logexport("Error saving to WebStorage: "+
q),e.trigger(cr.system_object.prototype.cnds.OnSaveFailed,null)}this.loadFromSlot=this.saveToSlot="";this.loadFromJson=null}if(t.length){if(O())a(t,function(q){q?(e.loadFromJson=q,cr.logexport("Loaded state from IndexedDB storage ("+e.loadFromJson.length+" bytes)")):(e.loadFromJson=localStorage.getItem("__c2save_"+t)||"",cr.logexport("Loaded state from WebStorage ("+e.loadFromJson.length+" bytes)"));e.suspendDrawing=!1;e.loadFromJson||(e.loadFromJson=null,e.trigger(cr.system_object.prototype.cnds.OnLoadFailed,
null))},function(q){e.loadFromJson=localStorage.getItem("__c2save_"+t)||"";cr.logexport("Loaded state from WebStorage ("+e.loadFromJson.length+" bytes)");e.suspendDrawing=!1;e.loadFromJson||(e.loadFromJson=null,e.trigger(cr.system_object.prototype.cnds.OnLoadFailed,null))});else{try{this.loadFromJson=localStorage.getItem("__c2save_"+t)||"",cr.logexport("Loaded state from WebStorage ("+this.loadFromJson.length+" bytes)")}catch(q){this.loadFromJson=null}this.suspendDrawing=!1;e.loadFromJson||(e.loadFromJson=
null,e.trigger(cr.system_object.prototype.cnds.OnLoadFailed,null))}this.saveToSlot=this.loadFromSlot=""}null!==this.loadFromJson&&(this.ClearDeathRow(),this.loadFromJSONString(this.loadFromJson)?(this.lastSaveJson=this.loadFromJson,this.trigger(cr.system_object.prototype.cnds.OnLoadComplete,null),this.lastSaveJson=""):e.trigger(cr.system_object.prototype.cnds.OnLoadFailed,null),this.loadFromJson=null)};b.prototype.saveToJSONString=function(){var e,m,x,t={c2save:!0,version:1,rt:{time:this.kahanTime.sum,
walltime:this.wallTime.sum,timescale:this.timescale,tickcount:this.tickcount,execcount:this.execcount,next_uid:this.next_uid,running_layout:this.running_layout.sid,start_time_offset:Date.now()-this.start_time},types:{},layouts:{},events:{groups:{},cnds:{},acts:{},vars:{}}};var v=0;for(e=this.types_by_index.length;v<e;v++){var q=this.types_by_index[v];if(!q.is_family&&!this.typeHasNoSaveBehavior(q)){var y={instances:[]};cr.hasAnyOwnProperty(q.extra)&&(y.ex=n(q.extra));var B=0;for(m=q.instances.length;B<
m;B++)y.instances.push(this.saveInstanceToJSON(q.instances[B]));t.types[q.sid.toString()]=y}}v=0;for(e=this.layouts_by_index.length;v<e;v++)B=this.layouts_by_index[v],t.layouts[B.sid.toString()]=B.saveToJSON();m=t.events.groups;v=0;for(e=this.allGroups.length;v<e;v++)B=this.allGroups[v],m[B.sid.toString()]=this.groups_by_name[B.group_name].group_active;e=t.events.cnds;for(x in this.cndsBySid)this.cndsBySid.hasOwnProperty(x)&&(v=this.cndsBySid[x],cr.hasAnyOwnProperty(v.extra)&&(e[x]={ex:n(v.extra)}));
e=t.events.acts;for(x in this.actsBySid)this.actsBySid.hasOwnProperty(x)&&(v=this.actsBySid[x],cr.hasAnyOwnProperty(v.extra)&&(e[x]={ex:n(v.extra)}));e=t.events.vars;for(x in this.varsBySid)this.varsBySid.hasOwnProperty(x)&&(v=this.varsBySid[x],v.is_constant||v.parent&&!v.is_static||(e[x]=v.data));t.system=this.system.saveToJSON();return JSON.stringify(t)};b.prototype.refreshUidMap=function(){var e,m;this.objectsByUid={};var x=0;for(e=this.types_by_index.length;x<e;x++){var t=this.types_by_index[x];
if(!t.is_family){var v=0;for(m=t.instances.length;v<m;v++){var q=t.instances[v];this.objectsByUid[q.uid.toString()]=q}}}};b.prototype.loadFromJSONString=function(e){try{var m=JSON.parse(e)}catch(P){return!1}if(!m.c2save||1<m.version)return!1;this.isLoadingState=!0;e=m.rt;this.kahanTime.reset();this.kahanTime.sum=e.time;this.wallTime.reset();this.wallTime.sum=e.walltime||0;this.timescale=e.timescale;this.tickcount=e.tickcount;this.execcount=e.execcount;this.start_time=Date.now()-e.start_time_offset;
var x=e.running_layout;if(x!==this.running_layout.sid)if(x=this.getLayoutBySid(x))this.doChangeLayout(x);else return;var t,v,q;var y=m.types;for(v in y)if(y.hasOwnProperty(v)&&(q=this.getObjectTypeBySid(parseInt(v,10)))&&!q.is_family&&!this.typeHasNoSaveBehavior(q)){y[v].ex?q.extra=y[v].ex:cr.wipe(q.extra);var B=q.instances;var K=y[v].instances;x=0;for(t=cr.min(B.length,K.length);x<t;x++)this.loadInstanceFromJSON(B[x],K[x]);x=K.length;for(t=B.length;x<t;x++)this.DestroyInstance(B[x]);x=B.length;for(t=
K.length;x<t;x++){B=null;if(q.plugin.is_world&&(B=this.running_layout.getLayerBySid(K[x].w.l),!B))continue;B=this.createInstanceFromInit(q.default_instance,B,!1,0,0,!0);this.loadInstanceFromJSON(B,K[x])}q.stale_iids=!0}this.ClearDeathRow();this.refreshUidMap();t=m.layouts;for(v in t)t.hasOwnProperty(v)&&(x=this.getLayoutBySid(parseInt(v,10)))&&x.loadFromJSON(t[v]);t=m.events.groups;for(v in t)t.hasOwnProperty(v)&&(x=this.getGroupBySid(parseInt(v,10)))&&this.groups_by_name[x.group_name]&&this.groups_by_name[x.group_name].setGroupActive(t[v]);
x=m.events.cnds;for(v in this.cndsBySid)this.cndsBySid.hasOwnProperty(v)&&(x.hasOwnProperty(v)?this.cndsBySid[v].extra=x[v].ex:this.cndsBySid[v].extra={});x=m.events.acts;for(v in this.actsBySid)this.actsBySid.hasOwnProperty(v)&&(x.hasOwnProperty(v)?this.actsBySid[v].extra=x[v].ex:this.actsBySid[v].extra={});x=m.events.vars;for(v in x)x.hasOwnProperty(v)&&this.varsBySid.hasOwnProperty(v)&&(this.varsBySid[v].data=x[v]);this.next_uid=e.next_uid;this.isLoadingState=!1;x=0;for(t=this.fireOnCreateAfterLoad.length;x<
t;++x)B=this.fireOnCreateAfterLoad[x],this.trigger(Object.getPrototypeOf(B.type.plugin).cnds.OnCreated,B);cr.clearArray(this.fireOnCreateAfterLoad);this.system.loadFromJSON(m.system);x=0;for(t=this.types_by_index.length;x<t;x++)if(q=this.types_by_index[x],!q.is_family&&!this.typeHasNoSaveBehavior(q))for(m=0,v=q.instances.length;m<v;m++){B=q.instances[m];if(q.is_contained)for(y=B.get_iid(),cr.clearArray(B.siblings),e=0,K=q.container.length;e<K;e++){var S=q.container[e];q!==S&&B.siblings.push(S.instances[y])}B.afterLoad&&
B.afterLoad();if(B.behavior_insts)for(e=0,K=B.behavior_insts.length;e<K;e++)y=B.behavior_insts[e],y.afterLoad&&y.afterLoad()}return this.redraw=!0};b.prototype.saveInstanceToJSON=function(e,m){var x;var t=e.type;var v=t.plugin;var q={};m?q.c2=!0:q.uid=e.uid;cr.hasAnyOwnProperty(e.extra)&&(q.ex=n(e.extra));if(e.instance_vars&&e.instance_vars.length)for(q.ivs={},m=0,x=e.instance_vars.length;m<x;m++)q.ivs[e.type.instvar_sids[m].toString()]=e.instance_vars[m];if(v.is_world){v={x:e.x,y:e.y,w:e.width,h:e.height,
l:e.layer.sid,zi:e.get_zindex()};0!==e.angle&&(v.a=e.angle);1!==e.opacity&&(v.o=e.opacity);.5!==e.hotspotX&&(v.hX=e.hotspotX);.5!==e.hotspotY&&(v.hY=e.hotspotY);0!==e.blend_mode&&(v.bm=e.blend_mode);e.visible||(v.v=e.visible);e.collisionsEnabled||(v.ce=e.collisionsEnabled);-1!==e.my_timescale&&(v.mts=e.my_timescale);if(t.effect_types.length)for(v.fx=[],m=0,x=t.effect_types.length;m<x;m++){var y=t.effect_types[m];v.fx.push({name:y.name,active:e.active_effect_flags[y.index],params:e.effect_params[y.index]})}q.w=
v}if(e.behavior_insts&&e.behavior_insts.length)for(q.behs={},m=0,x=e.behavior_insts.length;m<x;m++)t=e.behavior_insts[m],t.saveToJSON&&(q.behs[t.type.sid.toString()]=t.saveToJSON());e.saveToJSON&&(q.data=e.saveToJSON());return q};b.prototype.getInstanceVarIndexBySid=function(e,m){var x;var t=0;for(x=e.instvar_sids.length;t<x;t++)if(e.instvar_sids[t]===m)return t;return-1};b.prototype.getBehaviorIndexBySid=function(e,m){var x;var t=0;for(x=e.behavior_insts.length;t<x;t++)if(e.behavior_insts[t].type.sid===
m)return t;return-1};b.prototype.loadInstanceFromJSON=function(e,m,x){var t,v;var q=e.type;var y=q.plugin;if(x){if(!m.c2)return}else e.uid=m.uid;m.ex?e.extra=m.ex:cr.wipe(e.extra);if(v=m.ivs)for(t in v)if(v.hasOwnProperty(t)){var B=this.getInstanceVarIndexBySid(q,parseInt(t,10));if(!(0>B||B>=e.instance_vars.length)){var K=v[t];null===K&&(K=NaN);e.instance_vars[B]=K}}if(y.is_world){B=m.w;e.layer.sid!==B.l&&(v=e.layer,e.layer=this.running_layout.getLayerBySid(B.l),e.layer?(v.removeFromInstanceList(e,
!0),e.layer.appendToInstanceList(e,!0),e.set_bbox_changed(),e.layer.setZIndicesStaleFrom(0)):(e.layer=v,x||this.DestroyInstance(e)));e.x=B.x;e.y=B.y;e.width=B.w;e.height=B.h;e.zindex=B.zi;e.angle=B.hasOwnProperty("a")?B.a:0;e.opacity=B.hasOwnProperty("o")?B.o:1;e.hotspotX=B.hasOwnProperty("hX")?B.hX:.5;e.hotspotY=B.hasOwnProperty("hY")?B.hY:.5;e.visible=B.hasOwnProperty("v")?B.v:!0;e.collisionsEnabled=B.hasOwnProperty("ce")?B.ce:!0;e.my_timescale=B.hasOwnProperty("mts")?B.mts:-1;e.blend_mode=B.hasOwnProperty("bm")?
B.bm:0;e.compositeOp=cr.effectToCompositeOp(e.blend_mode);this.gl&&cr.setGLBlend(e,e.blend_mode,this.gl);e.set_bbox_changed();if(B.hasOwnProperty("fx"))for(x=0,v=B.fx.length;x<v;x++)K=q.getEffectIndexByName(B.fx[x].name),0>K||(e.active_effect_flags[K]=B.fx[x].active,e.effect_params[K]=B.fx[x].params);e.updateActiveEffects()}if(q=m.behs)for(t in q)q.hasOwnProperty(t)&&(x=this.getBehaviorIndexBySid(e,parseInt(t,10)),0>x||e.behavior_insts[x].loadFromJSON(q[t]));m.data&&e.loadFromJSON(m.data)};b.prototype.getProjectFileUrl=
function(e){return this.isPreview?window.cr_previewProjectFiles.hasOwnProperty(e.toLowerCase())?window.cr_previewProjectFiles[e.toLowerCase()]:e:this.files_subfolder+e};b.prototype.getProjectFileBlob=function(e){return this.isPreview?window.cr_previewProjectFileBlobs&&window.cr_previewProjectFiles.hasOwnProperty(e.toLowerCase())?window.cr_previewProjectFileBlobs[e.toLowerCase()]:null:null};b.prototype.getLocalFileUrl=function(e){return this.isPreview?window.cr_previewProjectFiles.hasOwnProperty(e.toLowerCase())?
window.cr_previewProjectFiles[e.toLowerCase()]:e:e};b.prototype.fetchLocalFileViaCordova=function(e,m,x){window.resolveLocalFileSystemURL(window.cordova.file.applicationDirectory+"www/"+e,function(t){t.file(m,x)},x)};b.prototype.fetchLocalFileViaCordovaAsText=function(e,m,x){this.fetchLocalFileViaCordova(e,function(t){var v=new FileReader;v.onload=function(q){m(q.target.result)};v.onerror=x;v.readAsText(t)},x)};var ca=[],R=0;b.prototype.maybeStartNextArrayBufferRead=function(){if(ca.length&&!(8<=
R)){R++;var e=ca.shift();this.doFetchLocalFileViaCordovaAsArrayBuffer(e.filename,e.successCallback,e.errorCallback)}};b.prototype.fetchLocalFileViaCordovaAsArrayBuffer=function(e,m,x){var t=this;ca.push({filename:e,successCallback:function(v){R--;t.maybeStartNextArrayBufferRead();m(v)},errorCallback:function(v){R--;t.maybeStartNextArrayBufferRead();x(v)}});this.maybeStartNextArrayBufferRead()};b.prototype.doFetchLocalFileViaCordovaAsArrayBuffer=function(e,m,x){this.fetchLocalFileViaCordova(e,function(t){var v=
new FileReader;v.onload=function(q){m(q.target.result)};v.readAsArrayBuffer(t)},x)};b.prototype.fetchLocalFileViaCordovaAsURL=function(e,m,x){var t="",v=e.toLowerCase(),q=v.substr(v.length-4);v=v.substr(v.length-5);".mp4"===q?t="video/mp4":".webm"===v?t="video/webm":".m4a"===q?t="audio/mp4":".mp3"===q&&(t="audio/mpeg");this.fetchLocalFileViaCordovaAsArrayBuffer(e,function(y){y=new Blob([y],{type:t});y=URL.createObjectURL(y);m(y)},x)};b.prototype.isAbsoluteUrl=function(e){return/^(?:[a-z]+:)?\/\//.test(e)||
"data:"===e.substr(0,5)||"blob:"===e.substr(0,5)};b.prototype.setImageSrc=function(e,m){this.isWKWebView&&!this.isAbsoluteUrl(m)?this.fetchLocalFileViaCordovaAsURL(m,function(x){e.src=x},function(x){alert("Failed to load image: "+x)}):this.isPreview&&!this.isAbsoluteUrl(m)?e.src=this.getLocalFileUrl(m):(this.isAbsoluteUrl(m)||(m=m.toLowerCase()),e.src=m)};b.prototype.getPreferredAudioFile=function(e){e=e.toLowerCase();if(!this.audio_files_map.hasOwnProperty(e))return null;e=this.audio_files_map[e];
var m=null,x;var t=0;for(x=e.length;t<x;++t){var v=e[t];var q=v[0];m||"audio/webm; codecs=opus"!==q||(m=v);if(E[q])return v}return m};b.prototype.getProjectAudioFileUrl=function(e){var m=e.toLowerCase();return(e=this.getPreferredAudioFile(e))?{url:this.getProjectFileUrl(m+e[1]),type:e[0]}:null};b.prototype.getStatusInfo=function(){return{fps:this.fps,cpu:this.cpuutilisation/1E3,gpu:this.gpuLastUtilisation,layout:this.running_layout?this.running_layout.name:"",renderer:this.glUnmaskedRenderer}};b.prototype.accelerate=
function(e,m,x,t,v){return this.enhancedAccelerationPrecision?cr.clamp(e*v+.5*t*v*v,m*v,x*v):e*v};cr.runtime=b;cr.createRuntime=function(e){return new b(e)};window.cr_createRuntime=cr.createRuntime})();window.cr_getSnapshot=function(b,l){var w=window.c3runtime;w&&w.doCanvasSnapshot(b,l)};window.cr_sizeCanvas=function(b,l){if(0!==b&&0!==l){var w=window.c3runtime;w&&w.setSize(b,l)}};window.cr_setSuspended=function(b){var l=window.c3runtime;l&&l.setSuspended(b)};
(function(){function b(a,d){return a.zindex-d.zindex}function l(a,d){this.layout=a;this.runtime=a.runtime;this.instances=[];this.scale=1;this.angle=0;this.disableAngle=!1;this.tmprect=new cr.rect(0,0,0,0);this.tmpquad=new cr.quad;this.viewBottom=this.viewTop=this.viewRight=this.viewLeft=0;this.zindices_stale=!1;this.zindices_stale_from=-1;this.clear_earlyz_index=0;this.name=d[0];this.index=d[1];this.sid=d[2];this.visible=d[3];this.background_color=d[4];this.transparent=d[5];this.parallaxX=d[6];this.parallaxY=
d[7];this.opacity=d[8];this.forceOwnTexture=d[9];this.useRenderCells=d[10];this.zoomRate=d[11];this.blend_mode=d[12];this.effect_fallback=d[13];this.compositeOp="source-over";this.destBlend=this.srcBlend=0;this.render_grid=null;this.last_render_list=w();this.render_list_stale=!0;this.last_render_cells=new cr.rect(0,0,-1,-1);this.cur_render_cells=new cr.rect(0,0,-1,-1);this.useRenderCells&&(this.render_grid=new cr.RenderGrid(this.runtime.original_width,this.runtime.original_height));this.render_offscreen=
!1;a=d[14];var n;this.startup_initial_instances=[];this.initial_instances=[];this.created_globals=[];var C=0;for(n=a.length;C<n;C++){var u=a[C],E=this.runtime.types_by_index[u[1]];E.default_instance||(E.default_instance=u,E.default_layerindex=this.index);this.initial_instances.push(u);-1===this.layout.initial_types.indexOf(E)&&this.layout.initial_types.push(E)}cr.shallowAssignArray(this.startup_initial_instances,this.initial_instances);this.effect_types=[];this.active_effect_types=[];this.shaders_preserve_opaqueness=
!0;this.effect_params=[];C=0;for(n=d[15].length;C<n;C++)this.effect_types.push({id:d[15][C][0],name:d[15][C][1],shaderindex:-1,preservesOpaqueness:!1,active:!0,index:C}),this.effect_params.push(d[15][C][2].slice(0));this.updateActiveEffects();this.rcTexBounce=new cr.rect(0,0,1,1);this.rcTexDest=new cr.rect(0,0,1,1);this.rcTexOrigin=new cr.rect(0,0,1,1)}function w(){return O.length?O.pop():[]}function D(a){cr.clearArray(a);O.push(a)}l.prototype.updateActiveEffects=function(){cr.clearArray(this.active_effect_types);
this.shaders_preserve_opaqueness=!0;var a;var d=0;for(a=this.effect_types.length;d<a;d++){var n=this.effect_types[d];n.active&&(this.active_effect_types.push(n),n.preservesOpaqueness||(this.shaders_preserve_opaqueness=!1))}};l.prototype.getEffectByName=function(a){var d;var n=0;for(d=this.effect_types.length;n<d;n++){var C=this.effect_types[n];if(C.name===a)return C}return null};l.prototype.createInitialInstances=function(a){var d,n;var C=d=0;for(n=this.initial_instances.length;d<n;d++){var u=this.initial_instances[d];
var E=this.runtime.types_by_index[u[1]];var N=this.runtime.typeHasPersistBehavior(E);E=!0;if(!N||this.layout.first_visit){u=this.runtime.createInstanceFromInit(u,this,!0);if(!u)continue;a.push(u);u.type.global&&(E=!1,this.created_globals.push(u.uid))}E&&(this.initial_instances[C]=this.initial_instances[d],C++)}this.initial_instances.length=C;this.runtime.ClearDeathRow();!this.runtime.glwrap&&this.effect_types.length&&(this.blend_mode=this.effect_fallback);this.compositeOp=cr.effectToCompositeOp(this.blend_mode);
this.runtime.gl&&cr.setGLBlend(this,this.blend_mode,this.runtime.gl);this.render_list_stale=!0};l.prototype.recreateInitialObjects=function(a,d){var n,C=this.runtime.types_by_index,u=a.is_family,E=a.members;var N=0;for(n=this.initial_instances.length;N<n;++N){var z=this.initial_instances[N];var H=z[0];var F=H[0];H=H[1];if(d.contains_pt(F,H)){F=C[z[1]];if(F!==a)if(u){if(0>E.indexOf(F))continue}else continue;z=this.runtime.createInstanceFromInit(z,this,!1);this.runtime.isInOnDestroy++;this.runtime.trigger(Object.getPrototypeOf(F.plugin).cnds.OnCreated,
z);if(z.is_contained)for(F=0,H=z.siblings.length;F<H;F++){var g=z.siblings[N];this.runtime.trigger(Object.getPrototypeOf(g.type.plugin).cnds.OnCreated,g)}this.runtime.isInOnDestroy--}}};l.prototype.removeFromInstanceList=function(a,d){var n=cr.fastIndexOf(this.instances,a);0>n||(d&&this.useRenderCells&&a.rendercells&&a.rendercells.right>=a.rendercells.left&&(a.update_bbox(),this.render_grid.update(a,a.rendercells,null),a.rendercells.set(0,0,-1,-1)),n===this.instances.length-1?this.instances.pop():
(cr.arrayRemove(this.instances,n),this.setZIndicesStaleFrom(n)),this.render_list_stale=!0)};l.prototype.appendToInstanceList=function(a,d){a.zindex=this.instances.length;this.instances.push(a);d&&this.useRenderCells&&a.rendercells&&a.set_bbox_changed();this.render_list_stale=!0};l.prototype.prependToInstanceList=function(a,d){this.instances.unshift(a);this.setZIndicesStaleFrom(0);d&&this.useRenderCells&&a.rendercells&&a.set_bbox_changed()};l.prototype.moveInstanceAdjacent=function(a,d,n){var C=a.get_zindex();
d=d.get_zindex();cr.arrayRemove(this.instances,C);C<d&&d--;n&&d++;d===this.instances.length?this.instances.push(a):this.instances.splice(d,0,a);this.setZIndicesStaleFrom(C<d?C:d)};l.prototype.setZIndicesStaleFrom=function(a){-1===this.zindices_stale_from?this.zindices_stale_from=a:a<this.zindices_stale_from&&(this.zindices_stale_from=a);this.render_list_stale=this.zindices_stale=!0};l.prototype.updateZIndices=function(){if(this.zindices_stale){-1===this.zindices_stale_from&&(this.zindices_stale_from=
0);var a;if(this.useRenderCells){var d=this.zindices_stale_from;for(a=this.instances.length;d<a;++d){var n=this.instances[d];n.zindex=d;this.render_grid.markRangeChanged(n.rendercells)}}else for(d=this.zindices_stale_from,a=this.instances.length;d<a;++d)this.instances[d].zindex=d;this.zindices_stale=!1;this.zindices_stale_from=-1}};l.prototype.getScale=function(a){return this.getNormalScale()*(this.runtime.fullscreenScalingQuality||a?this.runtime.aspect_scale:1)};l.prototype.getNormalScale=function(){return(this.scale*
this.layout.scale-1)*this.zoomRate+1};l.prototype.getAngle=function(){return this.disableAngle?0:cr.clamp_angle(this.layout.angle+this.angle)};var O=[],L=[],k=[];l.prototype.getRenderCellInstancesToDraw=function(){this.updateZIndices();this.render_grid.queryRange(this.viewLeft,this.viewTop,this.viewRight,this.viewBottom,k);if(!k.length)return w();if(1===k.length){var a=w();cr.shallowAssignArray(a,k[0]);cr.clearArray(k);return a}for(var d=!0;1<k.length;){var n;a=k;var C=d;var u=0;for(n=a.length;u<
n-1;u+=2){var E=a[u];var N=a[u+1];d=w();var z=E,H=N,F=d,g=0,p=0,A=0,T=z.length,W=H.length;for(F.length=T+W;g<T&&p<W;++A){var I=z[g];var c=H[p];I.zindex<c.zindex?(F[A]=I,++g):(F[A]=c,++p)}for(;g<T;++g,++A)F[A]=z[g];for(;p<W;++p,++A)F[A]=H[p];C||(D(E),D(N));L.push(d)}1===n%2&&(C?(E=w(),cr.shallowAssignArray(E,a[n-1]),L.push(E)):L.push(a[n-1]));cr.shallowAssignArray(a,L);cr.clearArray(L);d=!1}a=k[0];cr.clearArray(k);return a};l.prototype.draw=function(a){this.render_offscreen=this.forceOwnTexture||1!==
this.opacity||0!==this.blend_mode;var d=this.runtime.canvas,n=a,C=!1;this.render_offscreen&&(this.runtime.layer_canvas||(this.runtime.layer_canvas=document.createElement("canvas"),d=this.runtime.layer_canvas,d.width=this.runtime.draw_width,d.height=this.runtime.draw_height,this.runtime.layer_ctx=d.getContext("2d"),C=!0),d=this.runtime.layer_canvas,n=this.runtime.layer_ctx,d.width!==this.runtime.draw_width&&(d.width=this.runtime.draw_width,C=!0),d.height!==this.runtime.draw_height&&(d.height=this.runtime.draw_height,
C=!0),C&&(n.imageSmoothingEnabled=this.runtime.linearSampling),this.transparent&&n.clearRect(0,0,this.runtime.draw_width,this.runtime.draw_height));n.globalAlpha=1;n.globalCompositeOperation="source-over";this.transparent||(n.fillStyle="rgb("+this.background_color[0]+","+this.background_color[1]+","+this.background_color[2]+")",n.fillRect(0,0,this.runtime.draw_width,this.runtime.draw_height));n.save();this.disableAngle=!0;C=this.canvasToLayer(0,0,!0,!0);var u=this.canvasToLayer(0,0,!1,!0);this.disableAngle=
!1;this.runtime.pixel_rounding&&(C=Math.round(C),u=Math.round(u));this.rotateViewport(C,u,n);var E=this.getScale();n.scale(E,E);n.translate(-C,-u);this.useRenderCells?(this.cur_render_cells.left=this.render_grid.XToCell(this.viewLeft),this.cur_render_cells.top=this.render_grid.YToCell(this.viewTop),this.cur_render_cells.right=this.render_grid.XToCell(this.viewRight),this.cur_render_cells.bottom=this.render_grid.YToCell(this.viewBottom),this.render_list_stale||!this.cur_render_cells.equals(this.last_render_cells)?
(D(this.last_render_list),C=this.getRenderCellInstancesToDraw(),this.render_list_stale=!1,this.last_render_cells.copy(this.cur_render_cells)):C=this.last_render_list):C=this.instances;var N=null;u=0;for(E=C.length;u<E;++u){var z=C[u];z!==N&&(this.drawInstance(z,n),N=z)}this.useRenderCells&&(this.last_render_list=C);n.restore();this.render_offscreen&&(a.globalCompositeOperation=this.compositeOp,a.globalAlpha=this.opacity,a.drawImage(d,0,0))};l.prototype.drawInstance=function(a,d){if(a.visible&&0!==
a.width&&0!==a.height){a.update_bbox();var n=a.bbox;n.right<this.viewLeft||n.bottom<this.viewTop||n.left>this.viewRight||n.top>this.viewBottom||(d.globalCompositeOperation=a.compositeOp,a.draw(d))}};l.prototype.updateViewport=function(a){this.disableAngle=!0;var d=this.canvasToLayer(0,0,!0,!0),n=this.canvasToLayer(0,0,!1,!0);this.disableAngle=!1;this.runtime.pixel_rounding&&(d=Math.round(d),n=Math.round(n));this.rotateViewport(d,n,a)};l.prototype.rotateViewport=function(a,d,n){var C=this.getScale();
this.viewLeft=a;this.viewTop=d;this.viewRight=a+1/C*this.runtime.draw_width;this.viewBottom=d+1/C*this.runtime.draw_height;a=this.getAngle();0!==a&&(n&&(n.translate(this.runtime.draw_width/2,this.runtime.draw_height/2),n.rotate(-a),n.translate(this.runtime.draw_width/-2,this.runtime.draw_height/-2)),this.tmprect.set(this.viewLeft,this.viewTop,this.viewRight,this.viewBottom),this.tmprect.offset((this.viewLeft+this.viewRight)/-2,(this.viewTop+this.viewBottom)/-2),this.tmpquad.set_from_rotated_rect(this.tmprect,
a),this.tmpquad.bounding_box(this.tmprect),this.tmprect.offset((this.viewLeft+this.viewRight)/2,(this.viewTop+this.viewBottom)/2),this.viewLeft=this.tmprect.left,this.viewTop=this.tmprect.top,this.viewRight=this.tmprect.right,this.viewBottom=this.tmprect.bottom)};l.prototype.drawGL_earlyZPass=function(a){if(this.render_offscreen=this.forceOwnTexture){this.runtime.layer_tex||(this.runtime.layer_tex=a.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling));
if(this.runtime.layer_tex.c2width!==this.runtime.draw_width||this.runtime.layer_tex.c2height!==this.runtime.draw_height)a.deleteTexture(this.runtime.layer_tex),this.runtime.layer_tex=a.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling);a.setRenderingToTexture(this.runtime.layer_tex)}this.disableAngle=!0;var d=this.canvasToLayer(0,0,!0,!0),n=this.canvasToLayer(0,0,!1,!0);this.disableAngle=!1;this.runtime.pixel_rounding&&(d=Math.round(d),n=Math.round(n));
this.rotateViewport(d,n,null);d=this.getScale();a.resetModelView();a.scale(d,d);a.rotateZ(-this.getAngle());a.translate((this.viewLeft+this.viewRight)/-2,(this.viewTop+this.viewBottom)/-2);a.updateModelView();this.useRenderCells?(this.cur_render_cells.left=this.render_grid.XToCell(this.viewLeft),this.cur_render_cells.top=this.render_grid.YToCell(this.viewTop),this.cur_render_cells.right=this.render_grid.XToCell(this.viewRight),this.cur_render_cells.bottom=this.render_grid.YToCell(this.viewBottom),
this.render_list_stale||!this.cur_render_cells.equals(this.last_render_cells)?(D(this.last_render_list),d=this.getRenderCellInstancesToDraw(),this.render_list_stale=!1,this.last_render_cells.copy(this.cur_render_cells)):d=this.last_render_list):d=this.instances;var C=null;for(n=d.length-1;0<=n;--n){var u=d[n];u!==C&&(this.drawInstanceGL_earlyZPass(d[n],a),C=u)}this.useRenderCells&&(this.last_render_list=d);this.transparent||(this.clear_earlyz_index=this.runtime.earlyz_index++,a.setEarlyZIndex(this.clear_earlyz_index),
a.setColorFillMode(1,1,1,1),a.fullscreenQuad(),a.restoreEarlyZMode())};l.prototype.drawGL=function(a){if(this.render_offscreen=this.forceOwnTexture||1!==this.opacity||0<this.active_effect_types.length||0!==this.blend_mode){this.runtime.layer_tex||(this.runtime.layer_tex=a.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling));if(this.runtime.layer_tex.c2width!==this.runtime.draw_width||this.runtime.layer_tex.c2height!==this.runtime.draw_height)a.deleteTexture(this.runtime.layer_tex),
this.runtime.layer_tex=a.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling);a.setRenderingToTexture(this.runtime.layer_tex);this.transparent&&a.clear(0,0,0,0)}this.transparent||(this.runtime.enableFrontToBack?(a.setEarlyZIndex(this.clear_earlyz_index),a.setColorFillMode(this.background_color[0]/255,this.background_color[1]/255,this.background_color[2]/255,1),a.fullscreenQuad(),a.setTextureFillMode()):a.clear(this.background_color[0]/255,this.background_color[1]/
255,this.background_color[2]/255,1));this.disableAngle=!0;var d=this.canvasToLayer(0,0,!0,!0);var n=this.canvasToLayer(0,0,!1,!0);this.disableAngle=!1;this.runtime.pixel_rounding&&(d=Math.round(d),n=Math.round(n));this.rotateViewport(d,n,null);d=this.getScale();a.resetModelView();a.scale(d,d);a.rotateZ(-this.getAngle());a.translate((this.viewLeft+this.viewRight)/-2,(this.viewTop+this.viewBottom)/-2);a.updateModelView();this.useRenderCells?(this.cur_render_cells.left=this.render_grid.XToCell(this.viewLeft),
this.cur_render_cells.top=this.render_grid.YToCell(this.viewTop),this.cur_render_cells.right=this.render_grid.XToCell(this.viewRight),this.cur_render_cells.bottom=this.render_grid.YToCell(this.viewBottom),this.render_list_stale||!this.cur_render_cells.equals(this.last_render_cells)?(D(this.last_render_list),n=this.getRenderCellInstancesToDraw(),this.render_list_stale=!1,this.last_render_cells.copy(this.cur_render_cells)):n=this.last_render_list):n=this.instances;var C,u=null;if(2.220446049250313e-16<
this.getNormalScale()){var E=0;for(C=n.length;E<C;++E){var N=n[E];N!==u&&(this.drawInstanceGL(n[E],a),u=N)}}this.useRenderCells&&(this.last_render_list=n);this.render_offscreen&&(n=this.active_effect_types.length?this.active_effect_types[0].shaderindex:0,E=this.active_effect_types.length?this.active_effect_types[0].index:0,0===this.active_effect_types.length||1===this.active_effect_types.length&&!a.programUsesCrossSampling(n)&&1===this.opacity?(1===this.active_effect_types.length?(a.switchProgram(n),
a.setProgramParameters(this.layout.getRenderTarget(),1/this.runtime.draw_width,1/this.runtime.draw_height,0,0,1,1,0,0,1,1,this.viewLeft,this.viewTop,this.viewRight,this.viewBottom,0,0,1,1,d,this.getAngle(),this.runtime.kahanTime.sum,this.effect_params[E]),a.programIsAnimated(n)&&(this.runtime.redraw=!0)):a.switchProgram(0),a.setRenderingToTexture(this.layout.getRenderTarget()),a.setOpacity(this.opacity),a.setTexture(this.runtime.layer_tex),a.setBlend(this.srcBlend,this.destBlend),a.resetModelView(),
a.updateModelView(),d=this.runtime.draw_width/2,n=this.runtime.draw_height/2,a.quad(-d,n,d,n,d,-n,-d,-n),a.setTexture(null)):this.layout.renderEffectChain(a,this,null,this.layout.getRenderTarget()))};l.prototype.drawInstanceGL=function(a,d){if(a.visible&&0!==a.width&&0!==a.height){a.update_bbox();var n=a.bbox;n.right<this.viewLeft||n.bottom<this.viewTop||n.left>this.viewRight||n.top>this.viewBottom||(d.setEarlyZIndex(a.earlyz_index),a.uses_shaders?this.drawInstanceWithShadersGL(a,d):(d.switchProgram(0),
d.setBlend(a.srcBlend,a.destBlend),a.drawGL(d)))}};l.prototype.drawInstanceGL_earlyZPass=function(a,d){if(a.visible&&0!==a.width&&0!==a.height){a.update_bbox();var n=a.bbox;n.right<this.viewLeft||n.bottom<this.viewTop||n.left>this.viewRight||n.top>this.viewBottom||(a.earlyz_index=this.runtime.earlyz_index++,0===a.blend_mode&&1===a.opacity&&a.shaders_preserve_opaqueness&&a.drawGL_earlyZPass&&(d.setEarlyZIndex(a.earlyz_index),a.drawGL_earlyZPass(d)))}};l.prototype.drawInstanceWithShadersGL=function(a,
d){var n=a.active_effect_types[0].shaderindex,C=a.active_effect_types[0].index,u=this.getScale(),E=this.runtime.draw_width,N=this.runtime.draw_height;if(1!==a.active_effect_types.length||d.programUsesCrossSampling(n)||d.programExtendsBox(n)||(a.angle||a.layer.getAngle())&&d.programUsesDest(n)||1!==a.opacity||a.type.plugin.must_predraw)this.layout.renderEffectChain(d,this,a,this.render_offscreen?this.runtime.layer_tex:this.layout.getRenderTarget()),d.resetModelView(),d.scale(u,u),d.rotateZ(-this.getAngle()),
d.translate((this.viewLeft+this.viewRight)/-2,(this.viewTop+this.viewBottom)/-2),d.updateModelView();else{d.switchProgram(n);d.setBlend(a.srcBlend,a.destBlend);d.programIsAnimated(n)&&(this.runtime.redraw=!0);var z=0,H=0,F=0,g=0;d.programUsesDest(n)&&(g=a.bbox,z=this.layerToCanvas(g.left,g.top,!0,!0),H=this.layerToCanvas(g.left,g.top,!1,!0),F=this.layerToCanvas(g.right,g.bottom,!0,!0),g=this.layerToCanvas(g.right,g.bottom,!1,!0),z/=E,H=1-H/N,F/=E,g=1-g/N);N=E=0;var p=n=1,A=1/a.width,T=1/a.height;
a.curFrame&&a.curFrame.sheetTex&&(E=a.curFrame.sheetTex.left,N=a.curFrame.sheetTex.top,n=a.curFrame.sheetTex.right,p=a.curFrame.sheetTex.bottom,a.curFrame.texture_img&&(A=1/a.curFrame.texture_img.width,T=1/a.curFrame.texture_img.height));d.setProgramParameters(this.render_offscreen?this.runtime.layer_tex:this.layout.getRenderTarget(),A,T,E,N,n,p,E,N,n,p,a.bbox.left,a.bbox.top,a.bbox.right,a.bbox.bottom,z,H,F,g,u,this.getAngle(),this.runtime.kahanTime.sum,a.effect_params[C]);a.drawGL(d)}};l.prototype.canvasToLayer=
function(a,d,n,C){var u=this.runtime.devicePixelRatio;this.runtime.isRetina&&(a*=u,d*=u);u=this.runtime.parallax_x_origin;var E=this.runtime.parallax_y_origin;u=(this.layout.scrollX-u)*this.parallaxX+u;E=(this.layout.scrollY-E)*this.parallaxY+E;var N=u,z=E,H=1/this.getScale(!C);C?(N-=this.runtime.draw_width*H/2,z-=this.runtime.draw_height*H/2):(N-=this.runtime.width*H/2,z-=this.runtime.height*H/2);N+=a*H;z+=d*H;d=this.getAngle();0!==d&&(N-=u,z-=E,a=Math.cos(d),d=Math.sin(d),C=N*a-z*d,z=z*a+N*d,N=
C+u,z+=E);return n?N:z};l.prototype.layerToCanvas=function(a,d,n,C){var u=this.runtime.parallax_x_origin,E=this.runtime.parallax_y_origin,N=(this.layout.scrollX-u)*this.parallaxX+u,z=(this.layout.scrollY-E)*this.parallaxY+E;E=N;u=z;var H=this.getAngle();if(0!==H){a-=N;d-=z;var F=Math.cos(-H);H=Math.sin(-H);var g=a*F-d*H;d=d*F+a*H;a=g+N;d+=z}N=1/this.getScale(!C);C?(E-=this.runtime.draw_width*N/2,u-=this.runtime.draw_height*N/2):(E-=this.runtime.width*N/2,u-=this.runtime.height*N/2);E=(a-E)/N;u=(d-
u)/N;a=this.runtime.devicePixelRatio;this.runtime.isRetina&&!C&&(E/=a,u/=a);return n?E:u};l.prototype.rotatePt=function(a,d,n){if(0===this.getAngle())return n?a:d;var C=this.layerToCanvas(a,d,!0);d=this.layerToCanvas(a,d,!1);this.disableAngle=!0;a=this.canvasToLayer(C,d,!0);C=this.canvasToLayer(C,d,!0);this.disableAngle=!1;return n?a:C};l.prototype.saveToJSON=function(){var a,d={s:this.scale,a:this.angle,vl:this.viewLeft,vt:this.viewTop,vr:this.viewRight,vb:this.viewBottom,v:this.visible,bc:this.background_color,
t:this.transparent,px:this.parallaxX,py:this.parallaxY,o:this.opacity,zr:this.zoomRate,fx:[],cg:this.created_globals,instances:[]};var n=0;for(a=this.effect_types.length;n<a;n++){var C=this.effect_types[n];d.fx.push({name:C.name,active:C.active,params:this.effect_params[C.index]})}return d};l.prototype.loadFromJSON=function(a){var d;this.scale=a.s;this.angle=a.a;this.viewLeft=a.vl;this.viewTop=a.vt;this.viewRight=a.vr;this.viewBottom=a.vb;this.visible=a.v;this.background_color=a.bc;this.transparent=
a.t;this.parallaxX=a.px;this.parallaxY=a.py;this.opacity=a.o;this.zoomRate=a.zr;this.created_globals=a.cg||[];cr.shallowAssignArray(this.initial_instances,this.startup_initial_instances);var n=new cr.ObjectSet;var C=0;for(d=this.created_globals.length;C<d;++C)n.add(this.created_globals[C]);var u=C=0;for(d=this.initial_instances.length;C<d;++C)n.contains(this.initial_instances[C][2])||(this.initial_instances[u]=this.initial_instances[C],++u);cr.truncateArray(this.initial_instances,u);u=a.fx;C=0;for(d=
u.length;C<d;C++)if(a=this.getEffectByName(u[C].name))a.active=u[C].active,this.effect_params[a.index]=u[C].params;this.updateActiveEffects();this.instances.sort(b);this.zindices_stale=!0};cr.layer=l})();
(function(){function b(k,a){this.runtime=k;this.event_sheet=null;this.scrollX=this.runtime.original_width/2;this.scrollY=this.runtime.original_height/2;this.scale=1;this.angle=0;this.first_visit=!0;this.name=a[0];this.originalWidth=a[1];this.originalHeight=a[2];this.width=a[1];this.height=a[2];this.unbounded_scrolling=a[3];this.sheetname=a[4];this.sid=a[5];var d=a[6],n;this.layers=[];this.initial_types=[];k=0;for(n=d.length;k<n;k++){var C=new cr.layer(this,d[k]);C.number=k;cr.seal(C);this.layers.push(C)}d=
a[7];this.initial_nonworld=[];k=0;for(n=d.length;k<n;k++){C=d[k];var u=this.runtime.types_by_index[C[1]];u.default_instance||(u.default_instance=C);this.initial_nonworld.push(C);-1===this.initial_types.indexOf(u)&&this.initial_types.push(u)}this.effect_types=[];this.active_effect_types=[];this.shaders_preserve_opaqueness=!0;this.effect_params=[];k=0;for(n=a[8].length;k<n;k++)this.effect_types.push({id:a[8][k][0],name:a[8][k][1],shaderindex:-1,preservesOpaqueness:!1,active:!0,index:k}),this.effect_params.push(a[8][k][2].slice(0));
this.updateActiveEffects();this.rcTexBounce=new cr.rect(0,0,1,1);this.rcTexDest=new cr.rect(0,0,1,1);this.rcTexOrigin=new cr.rect(0,0,1,1);this.viewRect=new cr.rect(0,0,0,0);this.persist_data={}}function l(k,a){return k.zindex-a.zindex}function w(k){return k.some(function(a){return a.plugin.is_world})}b.prototype.saveObjectToPersist=function(k){var a=k.type.sid.toString();this.persist_data.hasOwnProperty(a)||(this.persist_data[a]=[]);this.persist_data[a].push(this.runtime.saveInstanceToJSON(k))};
b.prototype.hasOpaqueBottomLayer=function(){var k=this.layers[0];return!k.transparent&&1===k.opacity&&!k.forceOwnTexture&&k.visible};b.prototype.updateActiveEffects=function(){cr.clearArray(this.active_effect_types);this.shaders_preserve_opaqueness=!0;var k;var a=0;for(k=this.effect_types.length;a<k;a++){var d=this.effect_types[a];d.active&&(this.active_effect_types.push(d),d.preservesOpaqueness||(this.shaders_preserve_opaqueness=!1))}};b.prototype.getEffectByName=function(k){var a;var d=0;for(a=
this.effect_types.length;d<a;d++){var n=this.effect_types[d];if(n.name===k)return n}return null};var D=[],O=!0;b.prototype.startRunning=function(){this.sheetname&&(this.event_sheet=this.runtime.eventsheets[this.sheetname],this.event_sheet.updateDeepIncludes());this.runtime.running_layout=this;this.width=this.originalWidth;this.height=this.originalHeight;this.scrollX=this.runtime.original_width/2;this.scrollY=this.runtime.original_height/2;var k,a;var d=0;for(k=this.runtime.types_by_index.length;d<
k;d++){var n=this.runtime.types_by_index[d];if(!n.is_family){var C=n.instances;n=0;for(a=C.length;n<a;n++){var u=C[n];if(u.layer){var E=u.layer.number;E>=this.layers.length&&(E=this.layers.length-1);u.layer=this.layers[E];-1===u.layer.instances.indexOf(u)&&u.layer.instances.push(u);u.layer.zindices_stale=!0}}}}if(!O)for(d=0,k=this.layers.length;d<k;++d)this.layers[d].instances.sort(l);cr.clearArray(D);this.boundScrolling();d=0;for(k=this.layers.length;d<k;d++)u=this.layers[d],u.createInitialInstances(D),
u.updateViewport(null);C=!1;if(!this.first_visit){for(N in this.persist_data)if(this.persist_data.hasOwnProperty(N)&&(n=this.runtime.getObjectTypeBySid(parseInt(N,10)))&&!n.is_family&&this.runtime.typeHasPersistBehavior(n)){a=this.persist_data[N];d=0;for(k=a.length;d<k;d++){u=null;if(n.plugin.is_world&&(u=this.getLayerBySid(a[d].w.l),!u))continue;u=this.runtime.createInstanceFromInit(n.default_instance,u,!1,0,0,!0);this.runtime.loadInstanceFromJSON(u,a[d]);C=!0;D.push(u)}cr.clearArray(a)}d=0;for(k=
this.layers.length;d<k;d++)this.layers[d].instances.sort(l),this.layers[d].zindices_stale=!0}C&&(this.runtime.ClearDeathRow(),this.runtime.refreshUidMap());this.createAndLinkContainerInstances(D);d=0;for(k=this.initial_nonworld.length;d<k;d++){var N=this.initial_nonworld[d];n=this.runtime.types_by_index[N[1]];n.is_contained||this.runtime.createInstanceFromInit(this.initial_nonworld[d],null,!0)}this.runtime.changelayout=null;this.runtime.ClearDeathRow();if(this.runtime.ctx)for(d=0,k=this.runtime.types_by_index.length;d<
k;d++)N=this.runtime.types_by_index[d],!N.is_family&&N.instances.length&&N.preloadCanvas2D&&N.preloadCanvas2D(this.runtime.ctx);if(this.runtime.isLoadingState)cr.shallowAssignArray(this.runtime.fireOnCreateAfterLoad,D);else for(d=0,k=D.length;d<k;d++)u=D[d],this.runtime.trigger(Object.getPrototypeOf(u.type.plugin).cnds.OnCreated,u);cr.clearArray(D);this.runtime.isLoadingState||this.runtime.trigger(cr.system_object.prototype.cnds.OnLayoutStart,null);this.first_visit=!1};b.prototype.createAndLinkContainerInstances=
function(k){var a,d;for(a=0;a<k.length;a++){var n=k[a];if(n.type.is_contained){var C=n.get_iid();var u=0;for(d=n.type.container.length;u<d;u++){var E=n.type.container[u];if(n.type!==E)if(E.instances.length>C)n.siblings.push(E.instances[C]);else if(E.default_instance){var N=this.runtime.createInstanceFromInit(E.default_instance,n.layer,!0,n.x,n.y,!0);this.runtime.ClearDeathRow();E.updateIIDs();n.siblings.push(N);k.push(N)}}}}};b.prototype.createGlobalNonWorlds=function(){var k,a,d=[];var n=k=0;for(a=
this.initial_nonworld.length;k<a;k++){var C=this.initial_nonworld[k];var u=this.runtime.types_by_index[C[1]];u.global?u.is_contained&&w(u.container)||d.push(this.runtime.createInstanceFromInit(C,null,!0)):(this.initial_nonworld[n]=C,n++)}cr.truncateArray(this.initial_nonworld,n);this.runtime.ClearDeathRow();this.createAndLinkContainerInstances(d)};b.prototype.stopRunning=function(){this.runtime.isLoadingState||this.runtime.trigger(cr.system_object.prototype.cnds.OnLayoutEnd,null);this.runtime.isEndingLayout=
!0;cr.clearArray(this.runtime.system.waits);var k,a;if(!this.first_visit){var d=0;for(k=this.layers.length;d<k;d++){this.layers[d].updateZIndices();var n=this.layers[d].instances;var C=0;for(a=n.length;C<a;C++){var u=n[C];u.type.global||this.runtime.typeHasPersistBehavior(u.type)&&this.saveObjectToPersist(u)}}}d=0;for(k=this.layers.length;d<k;d++){n=this.layers[d].instances;C=0;for(a=n.length;C<a;C++)u=n[C],u.type.global||this.runtime.DestroyInstance(u);this.runtime.ClearDeathRow();cr.clearArray(n);
this.layers[d].zindices_stale=!0}d=0;for(k=this.runtime.types_by_index.length;d<k;d++)if(n=this.runtime.types_by_index[d],!(n.global||n.plugin.is_world||n.plugin.singleglobal||n.is_family)){C=0;for(a=n.instances.length;C<a;C++)this.runtime.DestroyInstance(n.instances[C]);this.runtime.ClearDeathRow()}O=!1;this.runtime.isEndingLayout=!1};var L=new cr.rect(0,0,0,0);b.prototype.recreateInitialObjects=function(k,a,d,n,C){L.set(a,d,n,C);a=0;for(d=this.layers.length;a<d;a++)this.layers[a].recreateInitialObjects(k,
L)};b.prototype.draw=function(k){var a=k,d=!1,n=!this.runtime.fullscreenScalingQuality;if(n){if(!this.runtime.layout_canvas){this.runtime.layout_canvas=document.createElement("canvas");var C=this.runtime.layout_canvas;C.width=this.runtime.draw_width;C.height=this.runtime.draw_height;this.runtime.layout_ctx=C.getContext("2d");d=!0}C=this.runtime.layout_canvas;a=this.runtime.layout_ctx;C.width!==this.runtime.draw_width&&(C.width=this.runtime.draw_width,d=!0);C.height!==this.runtime.draw_height&&(C.height=
this.runtime.draw_height,d=!0);d&&(a.imageSmoothingEnabled=this.runtime.linearSampling)}a.globalAlpha=1;a.globalCompositeOperation="source-over";this.runtime.clearBackground&&!this.hasOpaqueBottomLayer()&&a.clearRect(0,0,this.runtime.draw_width,this.runtime.draw_height);var u;d=0;for(u=this.layers.length;d<u;d++){var E=this.layers[d];E.visible&&0<E.opacity&&11!==E.blend_mode&&(E.instances.length||!E.transparent)?E.draw(a):E.updateViewport(null)}n&&k.drawImage(C,0,0,this.runtime.width,this.runtime.height)};
b.prototype.drawGL_earlyZPass=function(k){k.setEarlyZPass(!0);this.runtime.layout_tex||(this.runtime.layout_tex=k.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling));if(this.runtime.layout_tex.c2width!==this.runtime.draw_width||this.runtime.layout_tex.c2height!==this.runtime.draw_height)k.deleteTexture(this.runtime.layout_tex),this.runtime.layout_tex=k.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling);k.setRenderingToTexture(this.runtime.layout_tex);
this.runtime.fullscreenScalingQuality||k.setSize(this.runtime.draw_width,this.runtime.draw_height);var a;for(a=this.layers.length-1;0<=a;--a){var d=this.layers[a];d.visible&&1===d.opacity&&d.shaders_preserve_opaqueness&&0===d.blend_mode&&(d.instances.length||!d.transparent)?d.drawGL_earlyZPass(k):d.updateViewport(null)}k.setEarlyZPass(!1)};b.prototype.drawGL=function(k){var a=0<this.active_effect_types.length||this.runtime.uses_background_blending||!this.runtime.fullscreenScalingQuality||this.runtime.enableFrontToBack;
if(a){this.runtime.layout_tex||(this.runtime.layout_tex=k.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling));if(this.runtime.layout_tex.c2width!==this.runtime.draw_width||this.runtime.layout_tex.c2height!==this.runtime.draw_height)k.deleteTexture(this.runtime.layout_tex),this.runtime.layout_tex=k.createEmptyTexture(this.runtime.draw_width,this.runtime.draw_height,this.runtime.linearSampling);k.setRenderingToTexture(this.runtime.layout_tex);this.runtime.fullscreenScalingQuality||
k.setSize(this.runtime.draw_width,this.runtime.draw_height)}else this.runtime.layout_tex&&(k.setRenderingToTexture(null),k.deleteTexture(this.runtime.layout_tex),this.runtime.layout_tex=null);this.runtime.clearBackground&&!this.hasOpaqueBottomLayer()&&k.clear(0,0,0,0);var d;var n=0;for(d=this.layers.length;n<d;n++){var C=this.layers[n];C.visible&&0<C.opacity&&(C.instances.length||!C.transparent)?C.drawGL(k):C.updateViewport(null)}a&&(0===this.active_effect_types.length||1===this.active_effect_types.length&&
this.runtime.fullscreenScalingQuality?(1===this.active_effect_types.length?(a=this.active_effect_types[0].index,n=this.calculateViewRect(),k.switchProgram(this.active_effect_types[0].shaderindex),k.setProgramParameters(null,1/this.runtime.draw_width,1/this.runtime.draw_height,0,0,1,1,0,0,1,1,n.left,n.top,n.right,n.bottom,0,0,1,1,this.scale,this.angle,this.runtime.kahanTime.sum,this.effect_params[a]),k.programIsAnimated(this.active_effect_types[0].shaderindex)&&(this.runtime.redraw=!0)):k.switchProgram(0),
this.runtime.fullscreenScalingQuality||k.setSize(this.runtime.width,this.runtime.height),k.setRenderingToTexture(null),k.setDepthTestEnabled(!1),k.setOpacity(1),k.setTexture(this.runtime.layout_tex),k.setAlphaBlend(),k.resetModelView(),k.updateModelView(),a=this.runtime.width/2,n=this.runtime.height/2,k.quad(-a,n,a,n,a,-n,-a,-n),k.setTexture(null),k.setDepthTestEnabled(!0)):this.renderEffectChain(k,null,null,null))};b.prototype.getRenderTarget=function(){return 0<this.active_effect_types.length||
this.runtime.uses_background_blending||!this.runtime.fullscreenScalingQuality||this.runtime.enableFrontToBack?this.runtime.layout_tex:null};b.prototype.getMinLayerScale=function(){var k=this.layers[0].getScale(),a;var d=1;for(a=this.layers.length;d<a;d++){var n=this.layers[d];(0!==n.parallaxX||0!==n.parallaxY)&&n.getScale()<k&&(k=n.getScale())}return k};b.prototype.scrollToX=function(k){if(!this.unbounded_scrolling){var a=this.runtime.draw_width*(1/this.getMinLayerScale())/2;k>this.width-a&&(k=this.width-
a);k<a&&(k=a)}this.scrollX!==k&&(this.scrollX=k,this.runtime.redraw=!0)};b.prototype.scrollToY=function(k){if(!this.unbounded_scrolling){var a=this.runtime.draw_height*(1/this.getMinLayerScale())/2;k>this.height-a&&(k=this.height-a);k<a&&(k=a)}this.scrollY!==k&&(this.scrollY=k,this.runtime.redraw=!0)};b.prototype.boundScrolling=function(){this.scrollToX(this.scrollX);this.scrollToY(this.scrollY)};b.prototype.calculateViewRect=function(){var k=this.scrollX,a=this.scrollY,d=1/(this.scale*this.runtime.aspect_scale);
k-=this.runtime.width*d/2;a-=this.runtime.height*d/2;this.viewRect.set(k,a,k+this.runtime.draw_width*d,a+this.runtime.draw_height*d);return this.viewRect};b.prototype.renderEffectChain=function(k,a,d,n){var C=d?d.active_effect_types:a?a.active_effect_types:this.active_effect_types;if(d){var u=d.layer.getScale();var E=d.layer.getAngle();var N=d.layer.viewLeft;var z=d.layer.viewTop;var H=d.layer.viewRight;var F=d.layer.viewBottom}else a?(u=a.getScale(),E=a.getAngle(),N=a.viewLeft,z=a.viewTop,H=a.viewRight,
F=a.viewBottom):(u=this.scale,E=this.angle,F=this.calculateViewRect(),N=F.left,z=F.top,H=F.right,F=F.bottom);var g=this.runtime.fx_tex,p,A,T=0,W=1,I=this.runtime.draw_width,c=this.runtime.draw_height,h=I/2,G=c/2,f=a?a.rcTexBounce:this.rcTexBounce,r=a?a.rcTexDest:this.rcTexDest,J=a?a.rcTexOrigin:this.rcTexOrigin,M=0,V=0,X=0,aa=0,Y=I,ca=I,R=c,e=c,m=A=0,x=d?d.layer.getAngle():0;if(d){var t=0;for(p=C.length;t<p;t++)A+=k.getProgramBoxExtendHorizontal(C[t].shaderindex),m+=k.getProgramBoxExtendVertical(C[t].shaderindex);
aa=d.bbox;M=a.layerToCanvas(aa.left,aa.top,!0,!0);X=a.layerToCanvas(aa.left,aa.top,!1,!0);Y=a.layerToCanvas(aa.right,aa.bottom,!0,!0);R=a.layerToCanvas(aa.right,aa.bottom,!1,!0);if(0!==x){t=a.layerToCanvas(aa.right,aa.top,!0,!0);p=a.layerToCanvas(aa.right,aa.top,!1,!0);V=a.layerToCanvas(aa.left,aa.bottom,!0,!0);aa=a.layerToCanvas(aa.left,aa.bottom,!1,!0);var v=Math.min(M,Y,t,V);Y=Math.max(M,Y,t,V);M=v;v=Math.min(X,R,p,aa);R=Math.max(X,R,p,aa);X=v}J.left=M/I;J.top=1-X/c;J.right=Y/I;J.bottom=1-R/c;
M-=A;X-=m;Y+=A;R+=m;r.left=M/I;r.top=1-X/c;r.right=Y/I;r.bottom=1-R/c;V=M=cr.floor(M);aa=X=cr.floor(X);ca=Y=cr.ceil(Y);e=R=cr.ceil(R);V-=A;aa-=m;ca+=A;e+=m;0>M&&(M=0);0>X&&(X=0);Y>I&&(Y=I);R>c&&(R=c);0>V&&(V=0);0>aa&&(aa=0);ca>I&&(ca=I);e>c&&(e=c);f.left=M/I;f.top=1-X/c;f.right=Y/I;f.bottom=1-R/c}else f.left=r.left=J.left=0,f.top=r.top=J.top=0,f.right=r.right=J.right=1,f.bottom=r.bottom=1;m=d&&(k.programUsesDest(C[0].shaderindex)||0!==A||0!==m||1!==d.opacity||d.type.plugin.must_predraw)||a&&!d&&1!==
a.opacity;k.setAlphaBlend();if(m){g[T]||(g[T]=k.createEmptyTexture(I,c,this.runtime.linearSampling));if(g[T].c2width!==I||g[T].c2height!==c)k.deleteTexture(g[T]),g[T]=k.createEmptyTexture(I,c,this.runtime.linearSampling);k.switchProgram(0);k.setRenderingToTexture(g[T]);var q=e-aa;k.clearRect(V,c-aa-q,ca-V,q);d?d.drawGL(k):(k.setTexture(this.runtime.layer_tex),k.setOpacity(a.opacity),k.resetModelView(),k.translate(-h,-G),k.updateModelView(),k.quadTex(M,R,Y,R,Y,X,M,X,f));r.left=r.top=0;r.right=r.bottom=
1;d&&(v=f.top,f.top=f.bottom,f.bottom=v);T=1;W=0}k.setOpacity(1);A=C.length-1;x=k.programUsesCrossSampling(C[A].shaderindex)||!a&&!d&&!this.runtime.fullscreenScalingQuality;t=0;for(p=C.length;t<p;t++){g[T]||(g[T]=k.createEmptyTexture(I,c,this.runtime.linearSampling));if(g[T].c2width!==I||g[T].c2height!==c)k.deleteTexture(g[T]),g[T]=k.createEmptyTexture(I,c,this.runtime.linearSampling);k.switchProgram(C[t].shaderindex);v=C[t].index;k.programIsAnimated(C[t].shaderindex)&&(this.runtime.redraw=!0);if(0!=
t||m){k.setProgramParameters(n,1/I,1/c,0,0,1,1,J.left,J.top,J.right,J.bottom,N,z,H,F,r.left,r.top,r.right,r.bottom,u,E,this.runtime.kahanTime.sum,d?d.effect_params[v]:a?a.effect_params[v]:this.effect_params[v]);k.setTexture(null);if(t!==A||x){k.setRenderingToTexture(g[T]);q=e-aa;var y=c-aa-q;k.clearRect(V,y,ca-V,q)}else d?k.setBlend(d.srcBlend,d.destBlend):a&&k.setBlend(a.srcBlend,a.destBlend),k.setRenderingToTexture(n);k.setTexture(g[W]);k.resetModelView();k.translate(-h,-G);k.updateModelView();
k.quadTex(M,R,Y,R,Y,X,M,X,f);t!==A||x||k.setTexture(null)}else{k.setRenderingToTexture(g[T]);q=e-aa;y=c-aa-q;k.clearRect(V,y,ca-V,q);if(d){y=W=0;var B=q=1,K=1/d.width,S=1/d.height;d.curFrame&&d.curFrame.sheetTex&&(W=d.curFrame.sheetTex.left,y=d.curFrame.sheetTex.top,q=d.curFrame.sheetTex.right,B=d.curFrame.sheetTex.bottom,d.curFrame.texture_img&&(K=1/d.curFrame.texture_img.width,S=1/d.curFrame.texture_img.height));k.setProgramParameters(n,K,S,W,y,q,B,W,y,q,B,d.bbox.left,d.bbox.top,d.bbox.right,d.bbox.bottom,
r.left,r.top,r.right,r.bottom,u,E,this.runtime.kahanTime.sum,d.effect_params[v]);d.drawGL(k)}else k.setProgramParameters(n,1/I,1/c,0,0,1,1,0,0,1,1,N,z,H,F,0,0,1,1,u,E,this.runtime.kahanTime.sum,a?a.effect_params[v]:this.effect_params[v]),k.setTexture(a?this.runtime.layer_tex:this.runtime.layout_tex),k.resetModelView(),k.translate(-h,-G),k.updateModelView(),k.quadTex(M,R,Y,R,Y,X,M,X,f);r.left=r.top=0;r.right=r.bottom=1;d&&!x&&(v=R,R=X,X=v)}T=0===T?1:0;W=0===T?1:0}x&&(k.switchProgram(0),d?k.setBlend(d.srcBlend,
d.destBlend):a?k.setBlend(a.srcBlend,a.destBlend):this.runtime.fullscreenScalingQuality||(k.setSize(this.runtime.width,this.runtime.height),h=this.runtime.width/2,G=this.runtime.height/2,X=M=0,Y=this.runtime.width,R=this.runtime.height),k.setRenderingToTexture(n),k.setTexture(g[W]),k.resetModelView(),k.translate(-h,-G),k.updateModelView(),d&&1===C.length&&!m?k.quadTex(M,X,Y,X,Y,R,M,R,f):k.quadTex(M,R,Y,R,Y,X,M,X,f),k.setTexture(null))};b.prototype.getLayerBySid=function(k){var a;var d=0;for(a=this.layers.length;d<
a;d++)if(this.layers[d].sid===k)return this.layers[d];return null};b.prototype.saveToJSON=function(){var k,a={sx:this.scrollX,sy:this.scrollY,s:this.scale,a:this.angle,w:this.width,h:this.height,fv:this.first_visit,persist:this.persist_data,fx:[],layers:{}};var d=0;for(k=this.effect_types.length;d<k;d++){var n=this.effect_types[d];a.fx.push({name:n.name,active:n.active,params:this.effect_params[n.index]})}d=0;for(k=this.layers.length;d<k;d++)n=this.layers[d],a.layers[n.sid.toString()]=n.saveToJSON();
return a};b.prototype.loadFromJSON=function(k){var a,d,n;this.scrollX=k.sx;this.scrollY=k.sy;this.scale=k.s;this.angle=k.a;this.width=k.w;this.height=k.h;this.persist_data=k.persist;"undefined"!==typeof k.fv&&(this.first_visit=k.fv);var C=k.fx;var u=0;for(a=C.length;u<a;u++)if(d=this.getEffectByName(C[u].name))d.active=C[u].active,this.effect_params[d.index]=C[u].params;this.updateActiveEffects();u=k.layers;for(n in u)u.hasOwnProperty(n)&&(k=this.getLayerBySid(parseInt(n,10)))&&k.loadFromJSON(u[n])};
cr.layout=b})();
(function(){function b(g,p){var A,T=g.length;switch(T){case 0:return!0;case 1:return g[0]===p[0];case 2:return g[0]===p[0]&&g[1]===p[1];default:for(A=0;A<T;A++)if(g[A]!==p[A])return!1;return!0}}function l(g,p){return g.index-p.index}function w(g){var p;if(2===g.length){if(g[0].index>g[1].index){var A=g[0];g[0]=g[1];g[1]=A}}else 2<g.length&&g.sort(l);g.length>=z.length&&(z.length=g.length+1);z[g.length]||(z[g.length]=[]);var T=z[g.length];A=0;for(p=T.length;A<p;A++){var W=T[A];if(b(g,W))return W}T.push(g);
return g}function D(g,p){this.runtime=g;this.triggers={};this.fasttriggers={};this.hasRun=!1;this.includes=new cr.ObjectSet;this.deep_includes=[];this.already_included_sheets=[];this.name=p[0];g=p[1];this.events=[];var A;p=0;for(A=g.length;p<A;p++)this.init_event(g[p],null,this.events)}function O(g){this.type=g;this.instances=[];this.else_instances=[];this.select_all=!0}function L(g,p,A){this.sheet=g;this.parent=p;this.runtime=g.runtime;this.solModifiers=[];this.solModifiersIncludingParents=[];this.has_else_block=
this.toplevelgroup=this.toplevelevent=this.initially_activated=this.group=this.solWriterAfterCnds=!1;this.conditions=[];this.actions=[];this.subevents=[];this.group_name="";this.group_active=this.initially_activated=this.group=!1;this.contained_includes=null;3===A[0]&&(this.group_name=A[1][1].toLowerCase(),this.group=!0,this.initially_activated=!!A[1][0],this.contained_includes=[],this.group_active=this.initially_activated,this.runtime.allGroups.push(this),this.runtime.groups_by_name[this.group_name]=
this);this.orblock=A[2];this.sid=A[4];this.group||(this.runtime.blocksBySid[this.sid.toString()]=this);var T=A[6];g=0;for(p=T.length;g<p;g++){var W=new cr.condition(this,T[g]);W.index=g;cr.seal(W);this.conditions.push(W);this.addSolModifier(W.type)}T=A[7];g=0;for(p=T.length;g<p;g++)W=new cr.action(this,T[g]),W.index=g,cr.seal(W),this.actions.push(W);if(9===A.length)for(A=A[8],g=0,p=A.length;g<p;g++)this.sheet.init_event(A[g],this,this.subevents);this.is_else_block=!1;this.conditions.length&&(this.is_else_block=
null==this.conditions[0].type&&this.conditions[0].func==cr.system_object.prototype.cnds.Else)}function k(g,p){var A;if(g&&(-1===p.indexOf(g)&&p.push(g),g.is_contained)){var T=0;for(A=g.container.length;T<A;T++){var W=g.container[T];g!==W&&-1===p.indexOf(W)&&p.push(W)}}}function a(g,p){this.block=g;this.sheet=g.sheet;this.runtime=g.runtime;this.parameters=[];this.results=[];this.extra={};this.index=-1;this.anyParamVariesPerInstance=!1;this.func=this.runtime.GetObjectReference(p[1]);this.trigger=0<
p[3];this.fasttrigger=2===p[3];this.looping=p[4];this.inverted=p[5];this.isstatic=p[6];this.sid=p[7];this.runtime.cndsBySid[this.sid.toString()]=this;-1===p[0]?(this.type=null,this.run=this.run_system,this.behaviortype=null,this.beh_index=-1):(this.type=this.runtime.types_by_index[p[0]],this.run=this.isstatic?this.run_static:this.run_object,p[2]?(this.behaviortype=this.type.getBehaviorByName(p[2]),this.beh_index=this.type.getBehaviorIndexByName(p[2])):(this.behaviortype=null,this.beh_index=-1),this.block.parent&&
this.block.parent.setSolWriterAfterCnds());this.fasttrigger&&(this.run=this.run_true);if(10===p.length){var A=p[9];g=0;for(p=A.length;g<p;g++){var T=new cr.parameter(this,A[g]);cr.seal(T);this.parameters.push(T)}this.results.length=A.length}}function d(g,p){this.block=g;this.sheet=g.sheet;this.runtime=g.runtime;this.parameters=[];this.results=[];this.extra={};this.index=-1;this.anyParamVariesPerInstance=!1;this.func=this.runtime.GetObjectReference(p[1]);-1===p[0]?(this.type=null,this.run=this.run_system,
this.behaviortype=null,this.beh_index=-1):(this.type=this.runtime.types_by_index[p[0]],this.run=this.run_object,p[2]?(this.behaviortype=this.type.getBehaviorByName(p[2]),this.beh_index=this.type.getBehaviorIndexByName(p[2])):(this.behaviortype=null,this.beh_index=-1));this.sid=p[3];this.runtime.actsBySid[this.sid.toString()]=this;if(7===p.length){var A=p[6];g=0;for(p=A.length;g<p;g++){var T=new cr.parameter(this,A[g]);cr.seal(T);this.parameters.push(T)}this.results.length=A.length}}function n(){F++;
H.length===F&&H.push(new cr.expvalue);return H[F]}function C(g,p){this.owner=g;this.block=g.block;this.sheet=g.sheet;this.runtime=g.runtime;this.type=p[0];this.expression=null;this.solindex=0;this.get=null;this.combosel=0;this.layout=null;this.key=0;this.object=null;this.index=0;this.variadicret=this.subparams=this.fileinfo=this.eventvar=this.varname=null;this.variesPerInstance=!1;var A;switch(this.type){case 0:case 7:this.expression=new cr.expNode(this,p[1]);this.solindex=0;this.get=this.get_exp;
break;case 1:case 14:this.expression=new cr.expNode(this,p[1]);this.solindex=0;this.get=this.get_exp_str;14===this.type&&(this.block.setAllSolModifiers(),this.owner instanceof cr.action&&this.block.setSolWriterAfterCnds());break;case 5:this.expression=new cr.expNode(this,p[1]);this.solindex=0;this.get=this.get_layer;break;case 3:case 8:this.combosel=p[1];this.get=this.get_combosel;break;case 16:this.combosel=p[1]?1:0;this.get=this.get_boolean;break;case 6:this.layout=this.runtime.layouts[p[1]];this.get=
this.get_layout;break;case 9:this.key=p[1];this.get=this.get_key;break;case 4:this.object=this.runtime.types_by_index[p[1]];this.get=this.get_object;this.block.addSolModifier(this.object);this.owner instanceof cr.action?this.block.setSolWriterAfterCnds():this.block.parent&&this.block.parent.setSolWriterAfterCnds();break;case 10:this.index=p[1];g.type&&g.type.is_family?(this.get=this.get_familyvar,this.variesPerInstance=!0):this.get=this.get_instvar;break;case 11:this.varname=p[1];this.eventvar=null;
this.get=this.get_eventvar;break;case 2:case 12:this.fileinfo=p[1];this.get=this.get_audiofile;break;case 13:for(this.get=this.get_variadic,this.subparams=[],this.variadicret=[],g=1,A=p.length;g<A;g++){var T=new cr.parameter(this.owner,p[g]);cr.seal(T);this.subparams.push(T);this.variadicret.push(0)}}}function u(g,p,A){this.sheet=g;this.parent=p;this.runtime=g.runtime;this.solModifiers=[];this.name=A[1];this.vartype=A[2];this.initial=A[3];this.is_static=!!A[4];this.is_constant=!!A[5];this.sid=A[6];
this.runtime.varsBySid[this.sid.toString()]=this;this.data=this.initial;this.parent?(this.localIndex=this.is_static||this.is_constant?-1:this.runtime.stackLocalCount++,this.runtime.all_local_vars.push(this)):(this.localIndex=-1,this.runtime.all_global_vars.push(this))}function E(g,p,A){this.sheet=g;this.parent=p;this.runtime=g.runtime;this.solModifiers=[];this.include_sheet=null;this.include_sheet_name=A[1];this.active=!0}function N(){this.temp_parents_arr=[];this.reset(null);cr.seal(this)}var z=
[];D.prototype.toString=function(){return this.name};D.prototype.init_event=function(g,p,A){switch(g[0]){case 0:case 3:g=new cr.eventblock(this,p,g);cr.seal(g);if(g.orblock)for(A.push(g),A=0,p=g.conditions.length;A<p;A++)g.conditions[A].trigger&&this.init_trigger(g,A);else g.is_trigger()?this.init_trigger(g,0):A.push(g);break;case 1:g=new cr.eventvariable(this,p,g);cr.seal(g);A.push(g);break;case 2:g=new cr.eventinclude(this,p,g),cr.seal(g),A.push(g)}};D.prototype.postInit=function(){var g;var p=
0;for(g=this.events.length;p<g;p++)this.events[p].postInit(p<g-1&&this.events[p+1].is_else_block)};D.prototype.updateDeepIncludes=function(){cr.clearArray(this.deep_includes);cr.clearArray(this.already_included_sheets);this.addDeepIncludes(this);cr.clearArray(this.already_included_sheets)};D.prototype.addDeepIncludes=function(g){var p,A=g.deep_includes,T=g.already_included_sheets,W=this.includes.valuesRef();var I=0;for(p=W.length;I<p;++I){var c=W[I];var h=c.include_sheet;!c.isActive()||g===h||-1<
T.indexOf(h)||(T.push(h),h.addDeepIncludes(g),A.push(h))}};D.prototype.run=function(g){this.runtime.resuming_breakpoint||(this.hasRun=!0,g||(this.runtime.isRunningEvents=!0));var p;var A=0;for(p=this.events.length;A<p;A++){var T=this.events[A];T.run();this.runtime.clearSol(T.solModifiers);this.runtime.hasPendingInstances&&this.runtime.ClearDeathRow()}g||(this.runtime.isRunningEvents=!1)};D.prototype.init_trigger=function(g,p){g.orblock||this.runtime.triggers_to_postinit.push(g);var A,T,W=g.conditions[p];
var I=W.type?W.type.name:"system";var c=(A=W.fasttrigger)?this.fasttriggers:this.triggers;c[I]||(c[I]=[]);I=c[I];c=W.func;if(A){if(W.parameters.length&&(W=W.parameters[0],1===W.type&&2===W.expression.type)){W=W.expression.value.toLowerCase();A=0;for(T=I.length;A<T;A++)if(I[A].method==c){A=I[A].evs;A[W]?A[W].push([g,p]):A[W]=[[g,p]];return}A={};A[W]=[[g,p]];I.push({method:c,evs:A})}}else{A=0;for(T=I.length;A<T;A++)if(I[A].method==c){I[A].evs.push([g,p]);return}W=cr.plugins_.Sprite&&c===cr.plugins_.Sprite.prototype.cnds.OnFrameChanged?
!0:!1;W?I.unshift({method:c,evs:[[g,p]]}):I.push({method:c,evs:[[g,p]]})}};cr.eventsheet=D;O.prototype.hasObjects=function(){return this.select_all?this.type.instances.length:this.instances.length};O.prototype.getObjects=function(){return this.select_all?this.type.instances:this.instances};O.prototype.pick_one=function(g){g&&(g.runtime.getCurrentEventStack().current_event.orblock?(this.select_all&&(cr.clearArray(this.instances),cr.shallowAssignArray(this.else_instances,g.type.instances),this.select_all=
!1),g=this.else_instances.indexOf(g),-1!==g&&(this.instances.push(this.else_instances[g]),this.else_instances.splice(g,1))):(this.select_all=!1,cr.clearArray(this.instances),this.instances[0]=g))};cr.selection=O;L.prototype.postInit=function(g){var p,A=this.parent;if(this.group)for(this.toplevelgroup=!0;A;){if(!A.group){this.toplevelgroup=!1;break}A=A.parent}this.toplevelevent=!this.is_trigger()&&(!this.parent||this.parent.group&&this.parent.toplevelgroup);this.has_else_block=!!g;A=this.runtime.types_by_index;
if(this.solModifiers===A)this.solModifiersIncludingParents=A;else{this.solModifiersIncludingParents=this.solModifiers.slice(0);for(A=this.parent;A;){g=0;for(p=A.solModifiers.length;g<p;g++)this.addParentSolModifier(A.solModifiers[g]);A=A.parent}this.solModifiers=w(this.solModifiers);this.solModifiersIncludingParents=w(this.solModifiersIncludingParents)}g=0;for(p=this.conditions.length;g<p;g++)this.conditions[g].postInit();g=0;for(p=this.actions.length;g<p;g++)this.actions[g].postInit();g=0;for(p=
this.subevents.length;g<p;g++)this.subevents[g].postInit(g<p-1&&this.subevents[g+1].is_else_block)};L.prototype.setGroupActive=function(g){if(this.group_active!==!!g){this.group_active=!!g;var p;g=0;for(p=this.contained_includes.length;g<p;++g)this.contained_includes[g].updateActive();0<p&&this.runtime.running_layout.event_sheet&&this.runtime.running_layout.event_sheet.updateDeepIncludes()}};L.prototype.addSolModifier=function(g){k(g,this.solModifiers)};L.prototype.addParentSolModifier=function(g){k(g,
this.solModifiersIncludingParents)};L.prototype.setAllSolModifiers=function(){this.solModifiers=this.runtime.types_by_index};L.prototype.setSolWriterAfterCnds=function(){this.solWriterAfterCnds=!0;this.parent&&this.parent.setSolWriterAfterCnds()};L.prototype.is_trigger=function(){return this.conditions.length?this.conditions[0].trigger:!1};L.prototype.run=function(){var g,p=!1,A=this.runtime,T=this.runtime.getCurrentEventStack();T.current_event=this;var W=this.conditions;this.is_else_block||(T.else_branch_ran=
!1);if(this.orblock){0===W.length&&(p=!0);T.cndindex=0;for(g=W.length;T.cndindex<g;T.cndindex++){var I=W[T.cndindex];I.trigger||(I=I.run())&&(p=!0)}(T.last_event_true=p)&&this.run_actions_and_subevents()}else{T.cndindex=0;for(g=W.length;T.cndindex<g;T.cndindex++)if(I=W[T.cndindex].run(),!I){T.last_event_true=!1;this.toplevelevent&&A.hasPendingInstances&&A.ClearDeathRow();return}T.last_event_true=!0;this.run_actions_and_subevents()}this.end_run(T)};L.prototype.end_run=function(g){g.last_event_true&&
this.has_else_block&&(g.else_branch_ran=!0);this.toplevelevent&&this.runtime.hasPendingInstances&&this.runtime.ClearDeathRow()};L.prototype.run_orblocktrigger=function(g){this.runtime.getCurrentEventStack().current_event=this;this.conditions[g].run()&&(this.run_actions_and_subevents(),this.runtime.getCurrentEventStack().last_event_true=!0)};L.prototype.run_actions_and_subevents=function(){var g=this.runtime.getCurrentEventStack(),p;g.actindex=0;for(p=this.actions.length;g.actindex<p;g.actindex++)if(this.actions[g.actindex].run())return;
this.run_subevents()};L.prototype.resume_actions_and_subevents=function(){var g=this.runtime.getCurrentEventStack(),p;for(p=this.actions.length;g.actindex<p;g.actindex++)if(this.actions[g.actindex].run())return;this.run_subevents()};L.prototype.run_subevents=function(){if(this.subevents.length){var g,p,A=this.subevents.length-1;this.runtime.pushEventStack(this);if(this.solWriterAfterCnds){var T=0;for(g=this.subevents.length;T<g;T++){var W=this.subevents[T];(p=!this.toplevelgroup||!this.group&&T<A)&&
this.runtime.pushCopySol(W.solModifiers);W.run();p?this.runtime.popSol(W.solModifiers):this.runtime.clearSol(W.solModifiers)}}else for(T=0,g=this.subevents.length;T<g;T++)this.subevents[T].run();this.runtime.popEventStack()}};L.prototype.run_pretrigger=function(){var g=this.runtime.getCurrentEventStack();g.current_event=this;var p=!1,A;g.cndindex=0;for(A=this.conditions.length;g.cndindex<A;g.cndindex++)if(this.conditions[g.cndindex].run())p=!0;else if(!this.orblock)return!1;return this.orblock?p:
!0};L.prototype.retrigger=function(){this.runtime.execcount++;var g=this.runtime.getCurrentEventStack().cndindex,p=this.runtime.pushEventStack(this);if(!this.orblock)for(p.cndindex=g+1,g=this.conditions.length;p.cndindex<g;p.cndindex++)if(!this.conditions[p.cndindex].run())return this.runtime.popEventStack(),!1;this.run_actions_and_subevents();this.runtime.popEventStack();return!0};L.prototype.isFirstConditionOfType=function(g){var p=g.index;if(0===p)return!0;for(--p;0<=p;--p)if(this.conditions[p].type===
g.type)return!1;return!0};cr.eventblock=L;a.prototype.postInit=function(){var g;var p=0;for(g=this.parameters.length;p<g;p++){var A=this.parameters[p];A.postInit();A.variesPerInstance&&(this.anyParamVariesPerInstance=!0)}};a.prototype.run_true=function(){return!0};a.prototype.run_system=function(){var g;var p=0;for(g=this.parameters.length;p<g;p++)this.results[p]=this.parameters[p].get();return cr.xor(this.func.apply(this.runtime.system,this.results),this.inverted)};a.prototype.run_static=function(){var g;
var p=0;for(g=this.parameters.length;p<g;p++)this.results[p]=this.parameters[p].get();p=this.func.apply(this.behaviortype?this.behaviortype:this.type,this.results);this.type.applySolToContainer();return p};a.prototype.run_object=function(){var g,p,A,T=this.type,W=T.getCurrentSol(),I=this.block.orblock&&!this.trigger,c=T.is_contained,h=T.is_family,G=T.family_index,f=this.beh_index,r=-1<f,J=this.anyParamVariesPerInstance,M=this.parameters,V=this.results,X=this.inverted,aa=this.func;if(J){var Y=0;for(p=
M.length;Y<p;++Y){var ca=M[Y];ca.variesPerInstance||(V[Y]=ca.get(0))}}else for(Y=0,p=M.length;Y<p;++Y)V[Y]=M[Y].get(0);if(W.select_all){cr.clearArray(W.instances);cr.clearArray(W.else_instances);var R=T.instances;var e=0;for(g=R.length;e<g;++e){var m=R[e];if(J)for(Y=0,p=M.length;Y<p;++Y)ca=M[Y],ca.variesPerInstance&&(V[Y]=ca.get(e));r?(Y=0,h&&(Y=m.type.family_beh_map[G]),Y=aa.apply(m.behavior_insts[f+Y],V)):Y=aa.apply(m,V);(A=cr.xor(Y,X))?W.instances.push(m):I&&W.else_instances.push(m)}T.finish&&
T.finish(!0);W.select_all=!1;T.applySolToContainer();return W.hasObjects()}var x=0;R=(A=I&&!this.block.isFirstConditionOfType(this))?W.else_instances:W.instances;var t=!1;e=0;for(g=R.length;e<g;++e){m=R[e];if(J)for(Y=0,p=M.length;Y<p;++Y)ca=M[Y],ca.variesPerInstance&&(V[Y]=ca.get(e));r?(Y=0,h&&(Y=m.type.family_beh_map[G]),Y=aa.apply(m.behavior_insts[f+Y],V)):Y=aa.apply(m,V);if(cr.xor(Y,X))if(t=!0,A){if(W.instances.push(m),c)for(Y=0,p=m.siblings.length;Y<p;Y++)ca=m.siblings[Y],ca.type.getCurrentSol().instances.push(ca)}else{R[x]=
m;if(c)for(Y=0,p=m.siblings.length;Y<p;Y++)ca=m.siblings[Y],ca.type.getCurrentSol().instances[x]=ca;x++}else if(A){R[x]=m;if(c)for(Y=0,p=m.siblings.length;Y<p;Y++)ca=m.siblings[Y],ca.type.getCurrentSol().else_instances[x]=ca;x++}else if(I&&(W.else_instances.push(m),c))for(Y=0,p=m.siblings.length;Y<p;Y++)ca=m.siblings[Y],ca.type.getCurrentSol().else_instances.push(ca)}cr.truncateArray(R,x);if(c)for(h=T.container,e=0,g=h.length;e<g;e++)m=h[e].getCurrentSol(),A?cr.truncateArray(m.else_instances,x):cr.truncateArray(m.instances,
x);x=t;if(A&&!t)for(e=0,g=W.instances.length;e<g;e++){m=W.instances[e];if(J)for(Y=0,p=M.length;Y<p;Y++)ca=M[Y],ca.variesPerInstance&&(V[Y]=ca.get(e));Y=r?aa.apply(m.behavior_insts[f],V):aa.apply(m,V);if(cr.xor(Y,X)){t=!0;break}}T.finish&&T.finish(x||I);return I?t:W.hasObjects()};cr.condition=a;d.prototype.postInit=function(){var g;var p=0;for(g=this.parameters.length;p<g;p++){var A=this.parameters[p];A.postInit();A.variesPerInstance&&(this.anyParamVariesPerInstance=!0)}};d.prototype.run_system=function(){var g=
this.runtime,p,A=this.parameters,T=this.results;var W=0;for(p=A.length;W<p;++W)T[W]=A[W].get();return this.func.apply(g.system,T)};d.prototype.run_object=function(){var g=this.type,p=this.beh_index,A=g.family_index,T=this.anyParamVariesPerInstance,W=this.parameters,I=this.results,c=this.func,h=g.getCurrentSol().getObjects();g=g.is_family;var G=-1<p,f,r;if(T){var J=0;for(r=W.length;J<r;++J){var M=W[J];M.variesPerInstance||(I[J]=M.get(0))}}else for(J=0,r=W.length;J<r;++J)I[J]=W[J].get(0);var V=0;for(f=
h.length;V<f;++V){var X=h[V];if(T)for(J=0,r=W.length;J<r;++J)M=W[J],M.variesPerInstance&&(I[J]=M.get(V));G?(J=0,g&&(J=X.type.family_beh_map[A]),c.apply(X.behavior_insts[p+J],I)):c.apply(X,I)}return!1};cr.action=d;var H=[],F=-1;C.prototype.postInit=function(){var g;if(11===this.type)this.eventvar=this.runtime.getEventVariableByName(this.varname,this.block.parent);else if(13===this.type){var p=0;for(g=this.subparams.length;p<g;p++)this.subparams[p].postInit()}this.expression&&this.expression.postInit()};
C.prototype.maybeVaryForType=function(g){this.variesPerInstance||!g||g.plugin.singleglobal||(this.variesPerInstance=!0)};C.prototype.setVaries=function(){this.variesPerInstance=!0};C.prototype.get_exp=function(g){this.solindex=g||0;g=n();this.expression.get(g);F--;return g.data};C.prototype.get_exp_str=function(g){this.solindex=g||0;g=n();this.expression.get(g);F--;return cr.is_string(g.data)?g.data:""};C.prototype.get_object=function(){return this.object};C.prototype.get_combosel=function(){return this.combosel};
C.prototype.get_boolean=function(){return!!this.combosel};C.prototype.get_layer=function(g){this.solindex=g||0;g=n();this.expression.get(g);F--;return g.is_number()?this.runtime.getLayerByNumber(g.data):this.runtime.getLayerByName(g.data)};C.prototype.get_layout=function(){return this.layout};C.prototype.get_key=function(){return this.key};C.prototype.get_instvar=function(){return this.index};C.prototype.get_familyvar=function(g){var p=g||0;g=this.owner.type;var A=g.getCurrentSol(),T=A.getObjects();
if(T.length)p=T[p%T.length].type;else if(A.else_instances.length)p=A.else_instances[p%A.else_instances.length].type;else if(g.instances.length)p=g.instances[p%g.instances.length].type;else return 0;return this.index+p.family_var_map[g.family_index]};C.prototype.get_eventvar=function(){return this.eventvar};C.prototype.get_audiofile=function(){return this.fileinfo};C.prototype.get_variadic=function(){var g;var p=0;for(g=this.subparams.length;p<g;p++)this.variadicret[p]=this.subparams[p].get();return this.variadicret};
cr.parameter=C;u.prototype.postInit=function(){this.solModifiers=w(this.solModifiers)};u.prototype.setValue=function(g){var p=this.runtime.getCurrentLocalVarStack();this.parent&&!this.is_static&&p?(this.localIndex>=p.length&&(p.length=this.localIndex+1),p[this.localIndex]=g):this.data=g};u.prototype.getValue=function(){var g=this.runtime.getCurrentLocalVarStack();return!this.parent||this.is_static||!g||this.is_constant?this.data:this.localIndex>=g.length||"undefined"===typeof g[this.localIndex]?this.initial:
g[this.localIndex]};u.prototype.run=function(){!this.parent||this.is_static||this.is_constant||this.setValue(this.initial)};cr.eventvariable=u;E.prototype.toString=function(){return"include:"+this.include_sheet.toString()};E.prototype.postInit=function(){this.include_sheet=this.runtime.eventsheets[this.include_sheet_name];this.sheet.includes.add(this);this.solModifiers=w(this.solModifiers);for(var g=this.parent;g;)g.group&&g.contained_includes.push(this),g=g.parent;this.updateActive()};E.prototype.run=
function(){this.parent&&this.runtime.pushCleanSol(this.runtime.types_by_index);this.include_sheet.hasRun||this.include_sheet.run(!0);this.parent&&this.runtime.popSol(this.runtime.types_by_index)};E.prototype.updateActive=function(){for(var g=this.parent;g;){if(g.group&&!g.group_active){this.active=!1;return}g=g.parent}this.active=!0};E.prototype.isActive=function(){return this.active};cr.eventinclude=E;N.prototype.reset=function(g){this.current_event=g;this.actindex=this.cndindex=0;cr.clearArray(this.temp_parents_arr);
this.any_true_state=this.else_branch_ran=this.last_event_true=!1};N.prototype.isModifierAfterCnds=function(){return this.current_event.solWriterAfterCnds?!0:this.cndindex<this.current_event.conditions.length-1?!!this.current_event.solModifiers.length:!1};cr.eventStackFrame=N})();
(function(){function b(k,a){this.owner=k;this.runtime=k.runtime;this.type=a[0];this.get=[this.eval_int,this.eval_float,this.eval_string,this.eval_unaryminus,this.eval_add,this.eval_subtract,this.eval_multiply,this.eval_divide,this.eval_mod,this.eval_power,this.eval_and,this.eval_or,this.eval_equal,this.eval_notequal,this.eval_less,this.eval_lessequal,this.eval_greater,this.eval_greaterequal,this.eval_conditional,this.eval_system_exp,this.eval_object_exp,this.eval_instvar_exp,this.eval_behavior_exp,
this.eval_eventvar_exp][this.type];var d=null;this.object_type=this.parameters=this.results=this.func=this.third=this.second=this.first=this.value=null;this.beh_index=-1;this.instance_expr=null;this.varindex=-1;this.eventvar=this.varname=this.behavior_type=null;this.return_string=!1;switch(this.type){case 0:case 1:case 2:this.value=a[1];break;case 3:this.first=new cr.expNode(k,a[1]);break;case 18:this.first=new cr.expNode(k,a[1]);this.second=new cr.expNode(k,a[2]);this.third=new cr.expNode(k,a[3]);
break;case 19:this.func=this.runtime.GetObjectReference(a[1]);this.func!==cr.system_object.prototype.exps.random&&this.func!==cr.system_object.prototype.exps.choose||this.owner.setVaries();this.results=[];this.parameters=[];3===a.length?(d=a[2],this.results.length=d.length+1):this.results.length=1;break;case 20:this.object_type=this.runtime.types_by_index[a[1]];this.beh_index=-1;this.func=this.runtime.GetObjectReference(a[2]);this.return_string=a[3];cr.plugins_.Function&&this.func===cr.plugins_.Function.prototype.exps.Call&&
this.owner.setVaries();this.instance_expr=a[4]?new cr.expNode(k,a[4]):null;this.results=[];this.parameters=[];6===a.length?(d=a[5],this.results.length=d.length+1):this.results.length=1;break;case 21:this.object_type=this.runtime.types_by_index[a[1]];this.return_string=a[2];this.instance_expr=a[3]?new cr.expNode(k,a[3]):null;this.varindex=a[4];break;case 22:this.object_type=this.runtime.types_by_index[a[1]];this.behavior_type=this.object_type.getBehaviorByName(a[2]);this.beh_index=this.object_type.getBehaviorIndexByName(a[2]);
this.func=this.runtime.GetObjectReference(a[3]);this.return_string=a[4];this.instance_expr=a[5]?new cr.expNode(k,a[5]):null;this.results=[];this.parameters=[];7===a.length?(d=a[6],this.results.length=d.length+1):this.results.length=1;break;case 23:this.varname=a[1],this.eventvar=null}this.owner.maybeVaryForType(this.object_type);4<=this.type&&17>=this.type&&(this.first=new cr.expNode(k,a[1]),this.second=new cr.expNode(k,a[2]));if(d){var n;a=0;for(n=d.length;a<n;a++)this.parameters.push(new cr.expNode(k,
d[a]))}cr.seal(this)}function l(){++L;O.length===L&&O.push(new cr.expvalue);return O[L]}function w(k,a,d){var n;var C=0;for(n=k.length;C<n;++C)k[C].get(d),a[C+1]=d.data}function D(k,a){this.type=k||cr.exptype.Integer;this.data=a||0;this.object_class=null;this.type==cr.exptype.Integer&&(this.data=Math.floor(this.data));cr.seal(this)}b.prototype.postInit=function(){23===this.type&&(this.eventvar=this.owner.runtime.getEventVariableByName(this.varname,this.owner.block.parent));this.first&&this.first.postInit();
this.second&&this.second.postInit();this.third&&this.third.postInit();this.instance_expr&&this.instance_expr.postInit();if(this.parameters){var k;var a=0;for(k=this.parameters.length;a<k;a++)this.parameters[a].postInit()}};var O=[],L=-1;b.prototype.eval_system_exp=function(k){var a=this.parameters,d=this.results;d[0]=k;k=l();w(a,d,k);--L;this.func.apply(this.runtime.system,d)};b.prototype.eval_object_exp=function(k){var a=this.object_type,d=this.results,n=this.parameters,C=this.instance_expr,u=this.func,
E=this.owner.solindex,N=a.getCurrentSol(),z=N.getObjects();if(!z.length)if(N.else_instances.length)z=N.else_instances;else{this.return_string?k.set_string(""):k.set_int(0);return}d[0]=k;k.object_class=a;k=l();w(n,d,k);C&&(C.get(k),k.is_number()&&(E=k.data,z=a.instances));--L;a=z.length;if(E>=a||E<=-a)E%=a;0>E&&(E+=a);u.apply(z[E],d)};b.prototype.eval_behavior_exp=function(k){var a=this.object_type,d=this.results,n=this.parameters,C=this.instance_expr,u=this.beh_index,E=this.func,N=this.owner.solindex,
z=a.getCurrentSol(),H=z.getObjects();if(!H.length)if(z.else_instances.length)H=z.else_instances;else{this.return_string?k.set_string(""):k.set_int(0);return}d[0]=k;k.object_class=a;k=l();w(n,d,k);C&&(C.get(k),k.is_number()&&(N=k.data,H=a.instances));--L;n=H.length;if(N>=n||N<=-n)N%=n;0>N&&(N+=n);N=H[N];H=0;a.is_family&&(H=N.type.family_beh_map[a.family_index]);E.apply(N.behavior_insts[u+H],d)};b.prototype.eval_instvar_exp=function(k){var a=this.instance_expr,d=this.object_type,n=this.varindex,C=this.owner.solindex,
u=d.getCurrentSol(),E=u.getObjects();if(!E.length)if(u.else_instances.length)E=u.else_instances;else{this.return_string?k.set_string(""):k.set_int(0);return}if(a){u=l();a.get(u);if(u.is_number()){C=u.data;E=d.instances;0!==E.length&&(C%=E.length,0>C&&(C+=E.length));C=d.getInstanceByIID(C);d=C.instance_vars[n];cr.is_string(d)?k.set_string(d):k.set_float(d);--L;return}--L}a=E.length;if(C>=a||C<=-a)C%=a;0>C&&(C+=a);C=E[C];E=0;d.is_family&&(E=C.type.family_var_map[d.family_index]);d=C.instance_vars[n+
E];cr.is_string(d)?k.set_string(d):k.set_float(d)};b.prototype.eval_int=function(k){k.type=cr.exptype.Integer;k.data=this.value};b.prototype.eval_float=function(k){k.type=cr.exptype.Float;k.data=this.value};b.prototype.eval_string=function(k){k.type=cr.exptype.String;k.data=this.value};b.prototype.eval_unaryminus=function(k){this.first.get(k);k.is_number()&&(k.data=-k.data)};b.prototype.eval_add=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data+=a.data,
a.is_float()&&k.make_float());--L};b.prototype.eval_subtract=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data-=a.data,a.is_float()&&k.make_float());--L};b.prototype.eval_multiply=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data*=a.data,a.is_float()&&k.make_float());--L};b.prototype.eval_divide=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data/=a.data,k.make_float());
--L};b.prototype.eval_mod=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data%=a.data,a.is_float()&&k.make_float());--L};b.prototype.eval_power=function(k){this.first.get(k);var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data=Math.pow(k.data,a.data),a.is_float()&&k.make_float());--L};b.prototype.eval_and=function(k){this.first.get(k);var a=l();this.second.get(a);a.is_string()||k.is_string()?this.eval_and_stringconcat(k,a):this.eval_and_logical(k,
a);--L};b.prototype.eval_and_stringconcat=function(k,a){k.is_string()&&a.is_string()?this.eval_and_stringconcat_str_str(k,a):this.eval_and_stringconcat_num(k,a)};b.prototype.eval_and_stringconcat_str_str=function(k,a){k.data+=a.data};b.prototype.eval_and_stringconcat_num=function(k,a){k.is_string()?k.data+=(Math.round(1E10*a.data)/1E10).toString():k.set_string(k.data.toString()+a.data)};b.prototype.eval_and_logical=function(k,a){k.set_int(k.data&&a.data?1:0)};b.prototype.eval_or=function(k){this.first.get(k);
var a=l();this.second.get(a);k.is_number()&&a.is_number()&&(k.data||a.data?k.set_int(1):k.set_int(0));--L};b.prototype.eval_conditional=function(k){this.first.get(k);k.data?this.second.get(k):this.third.get(k)};b.prototype.eval_equal=function(k){this.first.get(k);var a=l();this.second.get(a);k.set_int(k.data===a.data?1:0);--L};b.prototype.eval_notequal=function(k){this.first.get(k);var a=l();this.second.get(a);k.set_int(k.data!==a.data?1:0);--L};b.prototype.eval_less=function(k){this.first.get(k);
var a=l();this.second.get(a);k.set_int(k.data<a.data?1:0);--L};b.prototype.eval_lessequal=function(k){this.first.get(k);var a=l();this.second.get(a);k.set_int(k.data<=a.data?1:0);--L};b.prototype.eval_greater=function(k){this.first.get(k);var a=l();this.second.get(a);k.set_int(k.data>a.data?1:0);--L};b.prototype.eval_greaterequal=function(k){this.first.get(k);var a=l();this.second.get(a);k.set_int(k.data>=a.data?1:0);--L};b.prototype.eval_eventvar_exp=function(k){var a=this.eventvar.getValue();"number"===
typeof a?k.set_float(a):"boolean"===typeof a?k.set_int(a?1:0):k.set_string(a)};cr.expNode=b;D.prototype.is_int=function(){return this.type===cr.exptype.Integer};D.prototype.is_float=function(){return this.type===cr.exptype.Float};D.prototype.is_number=function(){return this.type===cr.exptype.Integer||this.type===cr.exptype.Float};D.prototype.is_string=function(){return this.type===cr.exptype.String};D.prototype.make_int=function(){this.is_int()||(this.is_float()?this.data=Math.floor(this.data):this.is_string()&&
(this.data=parseInt(this.data,10)),this.type=cr.exptype.Integer)};D.prototype.make_float=function(){this.is_float()||(this.is_string()&&(this.data=parseFloat(this.data)),this.type=cr.exptype.Float)};D.prototype.make_string=function(){this.is_string()||(this.data=this.data.toString(),this.type=cr.exptype.String)};D.prototype.set_int=function(k){this.type=cr.exptype.Integer;this.data=Math.floor(k)};D.prototype.set_float=function(k){this.type=cr.exptype.Float;this.data=k};D.prototype.set_string=function(k){this.type=
cr.exptype.String;this.data=k};D.prototype.set_any=function(k){cr.is_number(k)?(this.type=cr.exptype.Float,this.data=k):cr.is_string(k)?(this.type=cr.exptype.String,this.data=k.toString()):(this.type=cr.exptype.Integer,this.data=0)};cr.expvalue=D;cr.exptype={Integer:0,Float:1,String:2}})();cr.system_object=function(b){this.runtime=b;this.waits=[]};
cr.system_object.prototype.saveToJSON=function(){var b={},l,w,D;b.waits=[];var O=b.waits;var L=0;for(l=this.waits.length;L<l;L++){var k=this.waits[L];var a={t:k.time,st:k.signaltag,s:k.signalled,ev:k.ev.sid,sm:[],sols:{}};k.ev.actions[k.actindex]&&(a.act=k.ev.actions[k.actindex].sid);var d=0;for(w=k.solModifiers.length;d<w;d++)a.sm.push(k.solModifiers[d].sid);for(D in k.sols)if(k.sols.hasOwnProperty(D)){var n=this.runtime.types_by_index[parseInt(D,10)];var C={sa:k.sols[D].sa,insts:[]};d=0;for(w=k.sols[D].insts.length;d<
w;d++)C.insts.push(k.sols[D].insts[d].uid);a.sols[n.sid.toString()]=C}O.push(a)}return b};
cr.system_object.prototype.loadFromJSON=function(b){b=b.waits;var l,w,D,O,L;cr.clearArray(this.waits);var k=0;for(l=b.length;k<l;k++){var a=b[k];if(O=this.runtime.blocksBySid[a.ev.toString()]){var d=-1;var n=0;for(w=O.actions.length;n<w;n++)if(O.actions[n].sid===a.act){d=n;break}if(-1!==d){var C={sols:{},solModifiers:[],deleteme:!1};C.time=a.t;C.signaltag=a.st||"";C.signalled=!!a.s;C.ev=O;C.actindex=d;n=0;for(w=a.sm.length;n<w;n++)(O=this.runtime.getObjectTypeBySid(a.sm[n]))&&C.solModifiers.push(O);
for(D in a.sols)if(a.sols.hasOwnProperty(D)&&(O=this.runtime.getObjectTypeBySid(parseInt(D,10)))){d=a.sols[D];var u={sa:d.sa,insts:[]};n=0;for(w=d.insts.length;n<w;n++)(L=this.runtime.getObjectByUID(d.insts[n]))&&u.insts.push(L);C.sols[O.index.toString()]=u}this.waits.push(C)}}}};
(function(){function b(){}function l(c,h){c=c.extra.c2_feo_val;h=h.extra.c2_feo_val;if(cr.is_number(c)&&cr.is_number(h))return c-h;c=""+c;h=""+h;return c<h?-1:c>h?1:0}function w(c,h){N&&c===z&&h===H||(N=new RegExp(c,h),z=c,H=h);N.lastIndex=0;return N}function D(){}function O(){var c=g.length?g.pop():{sols:{},solModifiers:[]};c.deleteme=!1;return c}function L(){var c=p.length?p.pop():{insts:[]};c.sa=!1;return c}function k(c,h){var G=c[0]-h[0];return 0!==G?G:c[1]-h[1]}function a(c,h){return c[1]-h[1]}
function d(){}function n(c,h,G){if(c!==T||h!==W||G!==I){var f=w(h,G);A=c.match(f);T=c;W=h;I=G}}var C=cr.system_object.prototype;b.prototype.EveryTick=function(){return!0};b.prototype.OnLayoutStart=function(){return!0};b.prototype.OnLayoutEnd=function(){return!0};b.prototype.Compare=function(c,h,G){return cr.do_cmp(c,h,G)};b.prototype.CompareTime=function(c,h){var G=this.runtime.kahanTime.sum;return 0===c?(c=this.runtime.getCurrentCondition(),!c.extra.CompareTime_executed&&G>=h?c.extra.CompareTime_executed=
!0:!1):cr.do_cmp(G,c,h)};b.prototype.LayerVisible=function(c){return c?c.visible:!1};b.prototype.LayerEmpty=function(c){return c?!c.instances.length:!1};b.prototype.LayerCmpOpacity=function(c,h,G){return c?cr.do_cmp(100*c.opacity,h,G):!1};b.prototype.Repeat=function(c){var h=this.runtime.getCurrentEventStack(),G=h.current_event,f=h.isModifierAfterCnds();h=this.runtime.pushLoopStack();if(f)for(f=0;f<c&&!h.stopped;f++)this.runtime.pushCopySol(G.solModifiers),h.index=f,G.retrigger(),this.runtime.popSol(G.solModifiers);
else for(f=0;f<c&&!h.stopped;f++)h.index=f,G.retrigger();this.runtime.popLoopStack();return!1};b.prototype.While=function(c){var h=this.runtime.getCurrentEventStack();c=h.current_event;var G=h.isModifierAfterCnds();h=this.runtime.pushLoopStack();if(G)for(G=0;!h.stopped;G++)this.runtime.pushCopySol(c.solModifiers),h.index=G,c.retrigger()||(h.stopped=!0),this.runtime.popSol(c.solModifiers);else for(G=0;!h.stopped;G++)h.index=G,c.retrigger()||(h.stopped=!0);this.runtime.popLoopStack();return!1};b.prototype.For=
function(c,h,G){var f=this.runtime.getCurrentEventStack(),r=f.current_event;f=f.isModifierAfterCnds();c=this.runtime.pushLoopStack(c);if(G<h)if(f)for(;h>=G&&!c.stopped;--h)this.runtime.pushCopySol(r.solModifiers),c.index=h,r.retrigger(),this.runtime.popSol(r.solModifiers);else for(;h>=G&&!c.stopped;--h)c.index=h,r.retrigger();else if(f)for(;h<=G&&!c.stopped;++h)this.runtime.pushCopySol(r.solModifiers),c.index=h,r.retrigger(),this.runtime.popSol(r.solModifiers);else for(;h<=G&&!c.stopped;++h)c.index=
h,r.retrigger();this.runtime.popLoopStack();return!1};var u=[],E=-1;b.prototype.ForEach=function(c){var h=c.getCurrentSol();E++;u.length===E&&u.push([]);var G=u[E];cr.shallowAssignArray(G,h.getObjects());var f=this.runtime.getCurrentEventStack(),r=f.current_event,J=f.isModifierAfterCnds();f=this.runtime.pushLoopStack();var M,V,X=c.is_contained;if(J)for(J=0,M=G.length;J<M&&!f.stopped;J++){this.runtime.pushCopySol(r.solModifiers);var aa=G[J];h=c.getCurrentSol();h.select_all=!1;cr.clearArray(h.instances);
h.instances[0]=aa;if(X){var Y=0;for(V=aa.siblings.length;Y<V;Y++){var ca=aa.siblings[Y];var R=ca.type.getCurrentSol();R.select_all=!1;cr.clearArray(R.instances);R.instances[0]=ca}}f.index=J;r.retrigger();this.runtime.popSol(r.solModifiers)}else for(h.select_all=!1,cr.clearArray(h.instances),J=0,M=G.length;J<M&&!f.stopped;J++){aa=G[J];h.instances[0]=aa;if(X)for(Y=0,V=aa.siblings.length;Y<V;Y++)ca=aa.siblings[Y],R=ca.type.getCurrentSol(),R.select_all=!1,cr.clearArray(R.instances),R.instances[0]=ca;
f.index=J;r.retrigger()}cr.clearArray(G);this.runtime.popLoopStack();E--;return!1};b.prototype.ForEachOrdered=function(c,h,G){h=c.getCurrentSol();E++;u.length===E&&u.push([]);var f=u[E];cr.shallowAssignArray(f,h.getObjects());var r=this.runtime.getCurrentEventStack(),J=r.current_event,M=this.runtime.getCurrentCondition(),V=r.isModifierAfterCnds();r=this.runtime.pushLoopStack();var X;var aa=0;for(X=f.length;aa<X;aa++)f[aa].extra.c2_feo_val=M.parameters[1].get(aa);f.sort(l);1===G&&f.reverse();G=c.is_contained;
if(V)for(aa=0,X=f.length;aa<X&&!r.stopped;aa++){this.runtime.pushCopySol(J.solModifiers);var Y=f[aa];h=c.getCurrentSol();h.select_all=!1;cr.clearArray(h.instances);h.instances[0]=Y;if(G)for(M=0,V=Y.siblings.length;M<V;M++){var ca=Y.siblings[M];var R=ca.type.getCurrentSol();R.select_all=!1;cr.clearArray(R.instances);R.instances[0]=ca}r.index=aa;J.retrigger();this.runtime.popSol(J.solModifiers)}else for(h.select_all=!1,cr.clearArray(h.instances),aa=0,X=f.length;aa<X&&!r.stopped;aa++){Y=f[aa];h.instances[0]=
Y;if(G)for(M=0,V=Y.siblings.length;M<V;M++)ca=Y.siblings[M],R=ca.type.getCurrentSol(),R.select_all=!1,cr.clearArray(R.instances),R.instances[0]=ca;r.index=aa;J.retrigger()}cr.clearArray(f);this.runtime.popLoopStack();E--;return!1};b.prototype.PickByComparison=function(c,h,G,f){var r,J;if(c){E++;u.length===E&&u.push([]);var M=u[E],V=c.getCurrentSol();cr.shallowAssignArray(M,V.getObjects());V.select_all&&cr.clearArray(V.else_instances);var X=this.runtime.getCurrentCondition();var aa=r=0;for(J=M.length;r<
J;r++){var Y=M[r];M[aa]=Y;h=X.parameters[1].get(r);f=X.parameters[3].get(r);cr.do_cmp(h,G,f)?aa++:V.else_instances.push(Y)}cr.truncateArray(M,aa);V.select_all=!1;cr.shallowAssignArray(V.instances,M);cr.clearArray(M);E--;c.applySolToContainer();return!!V.instances.length}};b.prototype.PickByEvaluate=function(c,h){var G,f;if(c){E++;u.length===E&&u.push([]);var r=u[E],J=c.getCurrentSol();cr.shallowAssignArray(r,J.getObjects());J.select_all&&cr.clearArray(J.else_instances);var M=this.runtime.getCurrentCondition();
var V=G=0;for(f=r.length;G<f;G++){var X=r[G];r[V]=X;(h=M.parameters[1].get(G))?V++:J.else_instances.push(X)}cr.truncateArray(r,V);J.select_all=!1;cr.shallowAssignArray(J.instances,r);cr.clearArray(r);E--;c.applySolToContainer();return!!J.instances.length}};b.prototype.TriggerOnce=function(){var c=this.runtime.getCurrentCondition().extra;"undefined"===typeof c.TriggerOnce_lastTick&&(c.TriggerOnce_lastTick=-1);var h=c.TriggerOnce_lastTick,G=this.runtime.tickcount;c.TriggerOnce_lastTick=G;return this.runtime.layout_first_tick||
h!==G-1};b.prototype.Every=function(c){var h=this.runtime.getCurrentCondition(),G=h.extra.Every_lastTime||0,f=this.runtime.kahanTime.sum;"undefined"===typeof h.extra.Every_seconds&&(h.extra.Every_seconds=c);var r=h.extra.Every_seconds;if(f>=G+r)return h.extra.Every_lastTime=G+r,f>=h.extra.Every_lastTime+.04&&(h.extra.Every_lastTime=f),h.extra.Every_seconds=c,!0;f<G-.1&&(h.extra.Every_lastTime=f);return!1};b.prototype.PickNth=function(c,h){if(!c)return!1;var G=c.getCurrentSol(),f=G.getObjects();h=
cr.floor(h);if(0>h||h>=f.length)return!1;G.pick_one(f[h]);c.applySolToContainer();return!0};b.prototype.PickRandom=function(c){if(!c)return!1;var h=c.getCurrentSol(),G=h.getObjects(),f=cr.floor(Math.random()*G.length);if(f>=G.length)return!1;h.pick_one(G[f]);c.applySolToContainer();return!0};b.prototype.CompareVar=function(c,h,G){return cr.do_cmp(c.getValue(),h,G)};b.prototype.CompareBoolVar=function(c){return c.getValue()};b.prototype.IsGroupActive=function(c){return(c=this.runtime.groups_by_name[c.toLowerCase()])&&
c.group_active};b.prototype.IsPreview=function(){return this.runtime.isPreview};b.prototype.PickAll=function(c){if(!c||!c.instances.length)return!1;c.getCurrentSol().select_all=!0;c.applySolToContainer();return!0};b.prototype.IsMobile=function(){return this.runtime.isMobile};b.prototype.CompareBetween=function(c,h,G){return c>=h&&c<=G};b.prototype.Else=function(){var c=this.runtime.getCurrentEventStack();return c.else_branch_ran?!1:!c.last_event_true};b.prototype.OnLoadFinished=function(){return!0};
b.prototype.OnCanvasSnapshot=function(){return!0};b.prototype.EffectsSupported=function(){return!!this.runtime.glwrap};b.prototype.OnSaveComplete=function(){return!0};b.prototype.OnSaveFailed=function(){return!0};b.prototype.OnLoadComplete=function(){return!0};b.prototype.OnLoadFailed=function(){return!0};b.prototype.ObjectUIDExists=function(c){return!!this.runtime.getObjectByUID(c)};b.prototype.IsOnPlatform=function(c){var h=this.runtime;switch(c){case 0:return!h.isNodeWebkit&&!h.isCordova&&!h.isWinJS&&
!h.isWindowsPhone8&&!h.isBlackberry10&&!h.isAmazonWebApp;case 1:return h.isiOS;case 2:return h.isAndroid;case 3:return h.isWindows8App;case 4:return h.isWindowsPhone8;case 5:return h.isBlackberry10;case 6:return h.isTizen;case 7:return!1;case 8:return h.isCordova;case 9:return h.isArcade;case 10:return h.isNodeWebkit;case 11:return h.isCrosswalk;case 12:return h.isAmazonWebApp;case 13:return h.isWindows10;default:return!1}};var N=null,z="",H="";b.prototype.RegexTest=function(c,h,G){return w(h,G).test(c)};
var F=[];b.prototype.PickOverlappingPoint=function(c,h,G){if(!c)return!1;var f=c.getCurrentSol(),r=f.getObjects(),J=this.runtime.getCurrentEventStack().current_event.orblock,M=this.runtime.getCurrentCondition(),V;f.select_all?(cr.shallowAssignArray(F,r),cr.clearArray(f.else_instances),f.select_all=!1,cr.clearArray(f.instances)):J?(cr.shallowAssignArray(F,f.else_instances),cr.clearArray(f.else_instances)):(cr.shallowAssignArray(F,r),cr.clearArray(f.instances));r=0;for(J=F.length;r<J;++r){var X=F[r];
X.update_bbox();(V=cr.xor(X.contains_pt(h,G),M.inverted))?f.instances.push(X):f.else_instances.push(X)}c.applySolToContainer();return cr.xor(!!f.instances.length,M.inverted)};b.prototype.PickLastCreated=function(c){if(!c)return!1;var h=this.runtime.createRow,G,f=null,r=c.is_family;for(G=h.length-1;0<=G;--G){var J=h[G];if(r){if(0<=J.type.families.indexOf(c)){f=J;break}}else if(J.type===c){f=J;break}}!f&&c.instances.length&&(f=c.instances[c.instances.length-1]);if(!f)return!1;c.getCurrentSol().pick_one(f);
c.applySolToContainer();return!0};b.prototype.IsNaN=function(c){return!!isNaN(c)};b.prototype.AngleWithin=function(c,h,G){return cr.angleDiff(cr.to_radians(c),cr.to_radians(G))<=cr.to_radians(h)};b.prototype.IsClockwiseFrom=function(c,h){return cr.angleClockwise(cr.to_radians(c),cr.to_radians(h))};b.prototype.IsBetweenAngles=function(c,h,G){c=cr.to_clamped_radians(c);h=cr.to_clamped_radians(h);G=cr.to_clamped_radians(G);return cr.angleClockwise(G,h)?cr.angleClockwise(c,h)&&!cr.angleClockwise(c,G):
!(!cr.angleClockwise(c,h)&&cr.angleClockwise(c,G))};b.prototype.IsValueType=function(c,h){return"number"===typeof c?0===h:1===h};C.cnds=new b;D.prototype.GoToLayout=function(c){this.runtime.isloading||this.runtime.changelayout||(this.runtime.changelayout=c)};D.prototype.NextPrevLayout=function(c){if(!this.runtime.isloading&&!this.runtime.changelayout){var h=this.runtime.layouts_by_index.indexOf(this.runtime.running_layout);if(!c||0!==h)if(c||h!==this.runtime.layouts_by_index.length-1)this.runtime.changelayout=
this.runtime.layouts_by_index[h+(c?-1:1)]}};D.prototype.CreateObject=function(c,h,G,f){if(h&&c&&(h=this.runtime.createInstance(c,h,G,f))){this.runtime.isInOnDestroy++;this.runtime.trigger(Object.getPrototypeOf(c.plugin).cnds.OnCreated,h);if(h.is_contained)for(G=0,f=h.siblings.length;G<f;G++){var r=h.siblings[G];this.runtime.trigger(Object.getPrototypeOf(r.type.plugin).cnds.OnCreated,r)}this.runtime.isInOnDestroy--;c=c.getCurrentSol();c.select_all=!1;cr.clearArray(c.instances);c.instances[0]=h;if(h.is_contained)for(G=
0,f=h.siblings.length;G<f;G++)r=h.siblings[G],c=r.type.getCurrentSol(),c.select_all=!1,cr.clearArray(c.instances),c.instances[0]=r}};D.prototype.CreateObjectByName=function(c,h,G,f){h&&c&&(c=this.runtime.types_lowercase[c.toLowerCase()])&&D.prototype.CreateObject.call(this,c,h,G,f)};D.prototype.SetLayerVisible=function(c,h){c&&c.visible!==h&&(c.visible=h,this.runtime.redraw=!0)};D.prototype.SetLayerOpacity=function(c,h){c&&(h=cr.clamp(h/100,0,1),c.opacity!==h&&(c.opacity=h,this.runtime.redraw=!0))};
D.prototype.SetLayerScaleRate=function(c,h){c&&c.zoomRate!==h&&(c.zoomRate=h,this.runtime.redraw=!0)};D.prototype.SetLayerForceOwnTexture=function(c,h){c&&(h=!!h,c.forceOwnTexture!==h&&(c.forceOwnTexture=h,this.runtime.redraw=!0))};D.prototype.SetLayoutScale=function(c){this.runtime.running_layout&&this.runtime.running_layout.scale!==c&&(this.runtime.running_layout.scale=c,this.runtime.running_layout.boundScrolling(),this.runtime.redraw=!0)};D.prototype.ScrollX=function(c){this.runtime.running_layout.scrollToX(c)};
D.prototype.ScrollY=function(c){this.runtime.running_layout.scrollToY(c)};D.prototype.Scroll=function(c,h){this.runtime.running_layout.scrollToX(c);this.runtime.running_layout.scrollToY(h)};D.prototype.ScrollToObject=function(c){if(c=c.getFirstPicked())this.runtime.running_layout.scrollToX(c.x),this.runtime.running_layout.scrollToY(c.y)};D.prototype.SetVar=function(c,h){0===c.vartype?cr.is_number(h)?c.setValue(h):c.setValue(parseFloat(h)):1===c.vartype&&c.setValue(h.toString())};D.prototype.AddVar=
function(c,h){0===c.vartype?cr.is_number(h)?c.setValue(c.getValue()+h):c.setValue(c.getValue()+parseFloat(h)):1===c.vartype&&c.setValue(c.getValue()+h.toString())};D.prototype.SubVar=function(c,h){0===c.vartype&&(cr.is_number(h)?c.setValue(c.getValue()-h):c.setValue(c.getValue()-parseFloat(h)))};D.prototype.SetBoolVar=function(c,h){c.setValue(0!==h)};D.prototype.ToggleBoolVar=function(c){c.setValue(!c.getValue())};D.prototype.SetGroupActive=function(c,h){if(c=this.runtime.groups_by_name[c.toLowerCase()])switch(h){case 0:c.setGroupActive(!1);
break;case 1:c.setGroupActive(!0);break;case 2:c.setGroupActive(!c.group_active)}};D.prototype.SetTimescale=function(c){0>c&&(c=0);this.runtime.timescale=c};D.prototype.SetObjectTimescale=function(c,h){0>h&&(h=0);if(c){c=c.getCurrentSol().getObjects();var G;var f=0;for(G=c.length;f<G;f++)c[f].my_timescale=h}};D.prototype.RestoreObjectTimescale=function(c){if(!c)return!1;c=c.getCurrentSol().getObjects();var h;var G=0;for(h=c.length;G<h;G++)c[G].my_timescale=-1};var g=[],p=[];D.prototype.Wait=function(c){if(!(0>
c)){var h,G=this.runtime.getCurrentEventStack(),f=O();f.time=this.runtime.kahanTime.sum+c;f.signaltag="";f.signalled=!1;f.ev=G.current_event;f.actindex=G.actindex+1;c=0;for(h=this.runtime.types_by_index.length;c<h;c++){var r=this.runtime.types_by_index[c];var J=r.getCurrentSol();J.select_all&&-1===G.current_event.solModifiers.indexOf(r)||(f.solModifiers.push(r),r=L(),r.sa=J.select_all,cr.shallowAssignArray(r.insts,J.instances),f.sols[c.toString()]=r)}this.waits.push(f);return!0}};D.prototype.WaitForSignal=
function(c){var h,G=this.runtime.getCurrentEventStack(),f=O();f.time=-1;f.signaltag=c.toLowerCase();f.signalled=!1;f.ev=G.current_event;f.actindex=G.actindex+1;c=0;for(h=this.runtime.types_by_index.length;c<h;c++){var r=this.runtime.types_by_index[c];var J=r.getCurrentSol();J.select_all&&-1===G.current_event.solModifiers.indexOf(r)||(f.solModifiers.push(r),r=L(),r.sa=J.select_all,cr.shallowAssignArray(r.insts,J.instances),f.sols[c.toString()]=r)}this.waits.push(f);return!0};D.prototype.Signal=function(c){c=
c.toLowerCase();var h;var G=0;for(h=this.waits.length;G<h;++G){var f=this.waits[G];-1===f.time&&f.signaltag===c&&(f.signalled=!0)}};D.prototype.SetLayerScale=function(c,h){c&&c.scale!==h&&(c.scale=h,this.runtime.redraw=!0)};D.prototype.ResetGlobals=function(){var c;var h=0;for(c=this.runtime.all_global_vars.length;h<c;h++){var G=this.runtime.all_global_vars[h];G.data=G.initial}};D.prototype.SetLayoutAngle=function(c){c=cr.to_radians(c);c=cr.clamp_angle(c);this.runtime.running_layout&&this.runtime.running_layout.angle!==
c&&(this.runtime.running_layout.angle=c,this.runtime.redraw=!0)};D.prototype.SetLayerAngle=function(c,h){c&&(h=cr.to_radians(h),h=cr.clamp_angle(h),c.angle!==h&&(c.angle=h,this.runtime.redraw=!0))};D.prototype.SetLayerParallax=function(c,h,G){if(c&&(c.parallaxX!==h/100||c.parallaxY!==G/100)){c.parallaxX=h/100;c.parallaxY=G/100;if(1!==c.parallaxX||1!==c.parallaxY)for(G=c.instances,c=0,h=G.length;c<h;++c)G[c].type.any_instance_parallaxed=!0;this.runtime.redraw=!0}};D.prototype.SetLayerBackground=function(c,
h){if(c){var G=cr.clamp(Math.floor(255*cr.GetRValue(h)),0,255),f=cr.clamp(Math.floor(255*cr.GetGValue(h)),0,255);h=cr.clamp(Math.floor(255*cr.GetBValue(h)),0,255);if(c.background_color[0]!==G||c.background_color[1]!==f||c.background_color[2]!==h)c.background_color[0]=G,c.background_color[1]=f,c.background_color[2]=h,this.runtime.redraw=!0}};D.prototype.SetLayerTransparent=function(c,h){c&&!!h!==!!c.transparent&&(c.transparent=!!h,this.runtime.redraw=!0)};D.prototype.SetLayerBlendMode=function(c,h){c&&
c.blend_mode!==h&&(c.blend_mode=h,c.compositeOp=cr.effectToCompositeOp(c.blend_mode),this.runtime.gl&&cr.setGLBlend(c,c.blend_mode,this.runtime.gl),this.runtime.redraw=!0)};D.prototype.StopLoop=function(){0>this.runtime.loop_stack_index||(this.runtime.getCurrentLoop().stopped=!0)};D.prototype.GoToLayoutByName=function(c){if(!this.runtime.isloading&&!this.runtime.changelayout)for(var h in this.runtime.layouts)if(this.runtime.layouts.hasOwnProperty(h)&&cr.equals_nocase(h,c)){this.runtime.changelayout=
this.runtime.layouts[h];break}};D.prototype.RestartLayout=function(c){if(!this.runtime.isloading&&!this.runtime.changelayout&&this.runtime.running_layout){this.runtime.changelayout=this.runtime.running_layout;var h;c=0;for(h=this.runtime.allGroups.length;c<h;c++){var G=this.runtime.allGroups[c];G.setGroupActive(G.initially_activated)}}};D.prototype.SnapshotCanvas=function(c,h){this.runtime.doCanvasSnapshot(0===c?"image/png":"image/jpeg",h/100)};D.prototype.SetCanvasSize=function(c,h){if(!(0>=c||0>=
h)){var G=this.runtime.fullscreen_mode;(document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement||document.fullScreen)&&0<this.runtime.fullscreen_scaling&&(G=this.runtime.fullscreen_scaling);0===G?this.runtime.setSize(c,h,!0):(this.runtime.original_width=c,this.runtime.original_height=h,this.runtime.setSize(this.runtime.lastWindowWidth,this.runtime.lastWindowHeight,!0))}};D.prototype.SetLayoutEffectEnabled=function(c,h){this.runtime.running_layout&&this.runtime.glwrap&&(h=
this.runtime.running_layout.getEffectByName(h))&&(c=1===c,h.active!=c&&(h.active=c,this.runtime.running_layout.updateActiveEffects(),this.runtime.redraw=!0))};D.prototype.SetLayerEffectEnabled=function(c,h,G){c&&this.runtime.glwrap&&(G=c.getEffectByName(G))&&(h=1===h,G.active!=h&&(G.active=h,c.updateActiveEffects(),this.runtime.redraw=!0))};D.prototype.SetLayoutEffectParam=function(c,h,G){if(this.runtime.running_layout&&this.runtime.glwrap&&(c=this.runtime.running_layout.getEffectByName(c))){var f=
this.runtime.running_layout.effect_params[c.index];h=Math.floor(h);if(!(0>h||h>=f.length)){var r=this.runtime.glwrap.getProgramParameterType(c.shaderindex,h);1===r?G/=100:2===r&&(G=[cr.GetRValue(G),cr.GetGValue(G),cr.GetBValue(G)]);f[h]!==G&&(f[h]=G,c.active&&(this.runtime.redraw=!0))}}};D.prototype.SetLayerEffectParam=function(c,h,G,f){if(c&&this.runtime.glwrap&&(h=c.getEffectByName(h))&&(c=c.effect_params[h.index],G=Math.floor(G),!(0>G||G>=c.length))){var r=this.runtime.glwrap.getProgramParameterType(h.shaderindex,
G);1===r?f/=100:2===r&&(f=[cr.GetRValue(f),cr.GetGValue(f),cr.GetBValue(f)]);c[G]!==f&&(c[G]=f,h.active&&(this.runtime.redraw=!0))}};D.prototype.SaveState=function(c){this.runtime.saveToSlot=c};D.prototype.LoadState=function(c){this.runtime.loadFromSlot=c};D.prototype.LoadStateJSON=function(c){this.runtime.loadFromJson=c};D.prototype.SetHalfFramerateMode=function(c){this.runtime.halfFramerateMode=0!==c};D.prototype.SetFullscreenQuality=function(c){if(document.mozFullScreen||document.webkitIsFullScreen||
document.msFullscreenElement||document.fullScreen||0!==this.runtime.fullscreen_mode)this.runtime.wantFullscreenScalingQuality=0!==c,this.runtime.setSize(this.runtime.lastWindowWidth,this.runtime.lastWindowHeight,!0)};D.prototype.ResetPersisted=function(){var c;var h=0;for(c=this.runtime.layouts_by_index.length;h<c;++h)this.runtime.layouts_by_index[h].persist_data={},this.runtime.layouts_by_index[h].first_visit=!0};D.prototype.RecreateInitialObjects=function(c,h,G,f,r){c&&this.runtime.running_layout.recreateInitialObjects(c,
h,G,f,r)};D.prototype.SetPixelRounding=function(c){this.runtime.pixel_rounding=0!==c;this.runtime.redraw=!0};D.prototype.SetMinimumFramerate=function(c){1>c&&(c=1);120<c&&(c=120);this.runtime.minimumFramerate=c};D.prototype.SortZOrderByInstVar=function(c,h){if(c){var G;var f=c.getCurrentSol().getObjects();var r=[],J=[],M=this.runtime.running_layout,V=c.is_family,X=c.family_index,aa=!1;c=0;for(G=f.length;c<G;++c){var Y=f[c];if(Y.layer){var ca=V?Y.instance_vars[h+Y.type.family_var_map[X]]:Y.instance_vars[h];
r.push([Y.layer.index,Y.get_zindex()]);J.push([Y,ca])}}if(r.length){r.sort(k);J.sort(a);c=0;for(G=r.length;c<G;++c)Y=J[c][0],h=M.layers[r[c][0]],f=r[c][1],h.instances[f]!==Y&&(h.instances[f]=Y,Y.layer=h,h.setZIndicesStaleFrom(f),aa=!0);aa&&(this.runtime.redraw=!0)}}};C.acts=new D;d.prototype.int=function(c,h){cr.is_string(h)?(c.set_int(parseInt(h,10)),isNaN(c.data)&&(c.data=0)):c.set_int(h)};d.prototype.float=function(c,h){cr.is_string(h)?(c.set_float(parseFloat(h)),isNaN(c.data)&&(c.data=0)):c.set_float(h)};
d.prototype.str=function(c,h){cr.is_string(h)?c.set_string(h):c.set_string(h.toString())};d.prototype.len=function(c,h){c.set_int(h.length||0)};d.prototype.random=function(c,h,G){void 0===G?c.set_float(Math.random()*h):c.set_float(Math.random()*(G-h)+h)};d.prototype.sqrt=function(c,h){c.set_float(Math.sqrt(h))};d.prototype.abs=function(c,h){c.set_float(Math.abs(h))};d.prototype.round=function(c,h){c.set_int(Math.round(h))};d.prototype.floor=function(c,h){c.set_int(Math.floor(h))};d.prototype.ceil=
function(c,h){c.set_int(Math.ceil(h))};d.prototype.sign=function(c,h){c.set_float(Math.sign(h))};d.prototype.sin=function(c,h){c.set_float(Math.sin(cr.to_radians(h)))};d.prototype.cos=function(c,h){c.set_float(Math.cos(cr.to_radians(h)))};d.prototype.tan=function(c,h){c.set_float(Math.tan(cr.to_radians(h)))};d.prototype.asin=function(c,h){c.set_float(cr.to_degrees(Math.asin(h)))};d.prototype.acos=function(c,h){c.set_float(cr.to_degrees(Math.acos(h)))};d.prototype.atan=function(c,h){c.set_float(cr.to_degrees(Math.atan(h)))};
d.prototype.exp=function(c,h){c.set_float(Math.exp(h))};d.prototype.ln=function(c,h){c.set_float(Math.log(h))};d.prototype.log10=function(c,h){c.set_float(Math.log(h)/Math.LN10)};d.prototype.max=function(c){var h=arguments[1];"number"!==typeof h&&(h=0);var G;var f=2;for(G=arguments.length;f<G;f++){var r=arguments[f];"number"===typeof r&&h<r&&(h=r)}c.set_float(h)};d.prototype.min=function(c){var h=arguments[1];"number"!==typeof h&&(h=0);var G;var f=2;for(G=arguments.length;f<G;f++){var r=arguments[f];
"number"===typeof r&&h>r&&(h=r)}c.set_float(h)};d.prototype.dt=function(c){c.set_float(this.runtime.dt)};d.prototype.timescale=function(c){c.set_float(this.runtime.timescale)};d.prototype.wallclocktime=function(c){c.set_float((Date.now()-this.runtime.start_time)/1E3)};d.prototype.unixtime=function(c){c.set_float(Date.now())};d.prototype.time=function(c){c.set_float(this.runtime.kahanTime.sum)};d.prototype.tickcount=function(c){c.set_int(this.runtime.tickcount)};d.prototype.objectcount=function(c){c.set_int(this.runtime.objectcount)};
d.prototype.fps=function(c){c.set_int(this.runtime.fps)};d.prototype.loopindex=function(c,h){var G;if(this.runtime.loop_stack.length)if(h){for(G=this.runtime.loop_stack_index;0<=G;--G){var f=this.runtime.loop_stack[G];if(f.name===h){c.set_int(f.index);return}}c.set_int(0)}else f=this.runtime.getCurrentLoop(),c.set_int(f?f.index:-1);else c.set_int(0)};d.prototype.distance=function(c,h,G,f,r){c.set_float(cr.distanceTo(h,G,f,r))};d.prototype.angle=function(c,h,G,f,r){c.set_float(cr.to_degrees(cr.angleTo(h,
G,f,r)))};d.prototype.scrollx=function(c){c.set_float(this.runtime.running_layout.scrollX)};d.prototype.scrolly=function(c){c.set_float(this.runtime.running_layout.scrollY)};d.prototype.newline=function(c){c.set_string("\n")};d.prototype.lerp=function(c,h,G,f){c.set_float(cr.lerp(h,G,f))};d.prototype.qarp=function(c,h,G,f,r){c.set_float(cr.qarp(h,G,f,r))};d.prototype.cubic=function(c,h,G,f,r,J){c.set_float(cr.cubic(h,G,f,r,J))};d.prototype.cosp=function(c,h,G,f){c.set_float(cr.cosp(h,G,f))};d.prototype.windowwidth=
function(c){c.set_int(this.runtime.width)};d.prototype.windowheight=function(c){c.set_int(this.runtime.height)};d.prototype.uppercase=function(c,h){c.set_string(cr.is_string(h)?h.toUpperCase():"")};d.prototype.lowercase=function(c,h){c.set_string(cr.is_string(h)?h.toLowerCase():"")};d.prototype.clamp=function(c,h,G,f){h<G?c.set_float(G):h>f?c.set_float(f):c.set_float(h)};d.prototype.layerscale=function(c,h){(h=this.runtime.getLayer(h))?c.set_float(h.scale):c.set_float(0)};d.prototype.layeropacity=
function(c,h){(h=this.runtime.getLayer(h))?c.set_float(100*h.opacity):c.set_float(0)};d.prototype.layerscalerate=function(c,h){(h=this.runtime.getLayer(h))?c.set_float(h.zoomRate):c.set_float(0)};d.prototype.layerparallaxx=function(c,h){(h=this.runtime.getLayer(h))?c.set_float(100*h.parallaxX):c.set_float(0)};d.prototype.layerparallaxy=function(c,h){(h=this.runtime.getLayer(h))?c.set_float(100*h.parallaxY):c.set_float(0)};d.prototype.layerindex=function(c,h){(h=this.runtime.getLayer(h))?c.set_int(h.index):
c.set_int(-1)};d.prototype.layoutscale=function(c){this.runtime.running_layout?c.set_float(this.runtime.running_layout.scale):c.set_float(0)};d.prototype.layoutangle=function(c){c.set_float(cr.to_degrees(this.runtime.running_layout.angle))};d.prototype.layerangle=function(c,h){(h=this.runtime.getLayer(h))?c.set_float(cr.to_degrees(h.angle)):c.set_float(0)};d.prototype.layoutwidth=function(c){c.set_int(this.runtime.running_layout.width)};d.prototype.layoutheight=function(c){c.set_int(this.runtime.running_layout.height)};
d.prototype.find=function(c,h,G){cr.is_string(h)&&cr.is_string(G)?c.set_int(h.search(new RegExp(cr.regexp_escape(G),"i"))):c.set_int(-1)};d.prototype.findcase=function(c,h,G){cr.is_string(h)&&cr.is_string(G)?c.set_int(h.search(new RegExp(cr.regexp_escape(G),""))):c.set_int(-1)};d.prototype.left=function(c,h,G){c.set_string(cr.is_string(h)?h.substr(0,G):"")};d.prototype.right=function(c,h,G){c.set_string(cr.is_string(h)?h.substr(h.length-G):"")};d.prototype.mid=function(c,h,G,f){c.set_string(cr.is_string(h)?
h.substr(G,f):"")};d.prototype.tokenat=function(c,h,G,f){cr.is_string(h)&&cr.is_string(f)?(h=h.split(f),G=cr.floor(G),0>G||G>=h.length?c.set_string(""):c.set_string(h[G])):c.set_string("")};d.prototype.tokencount=function(c,h,G){cr.is_string(h)&&h.length?c.set_int(h.split(G).length):c.set_int(0)};d.prototype.replace=function(c,h,G,f){cr.is_string(h)&&cr.is_string(G)&&cr.is_string(f)?c.set_string(h.replace(new RegExp(cr.regexp_escape(G),"gi"),f)):c.set_string(cr.is_string(h)?h:"")};d.prototype.trim=
function(c,h){c.set_string(cr.is_string(h)?h.trim():"")};d.prototype.pi=function(c){c.set_float(cr.PI)};d.prototype.layoutname=function(c){this.runtime.running_layout?c.set_string(this.runtime.running_layout.name):c.set_string("")};d.prototype.renderer=function(c){c.set_string(this.runtime.gl?"webgl":"canvas2d")};d.prototype.rendererdetail=function(c){c.set_string(this.runtime.glUnmaskedRenderer)};d.prototype.anglediff=function(c,h,G){c.set_float(cr.to_degrees(cr.angleDiff(cr.to_radians(h),cr.to_radians(G))))};
d.prototype.choose=function(c){var h=cr.floor(Math.random()*(arguments.length-1));c.set_any(arguments[h+1])};d.prototype.rgb=function(c,h,G,f){c.set_int(cr.RGB(h,G,f))};d.prototype.rgbex=function(c,h,G,f){c.set_float(cr.RGBEx(h/100,G/100,f/100))};d.prototype.projectversion=function(c){c.set_string(this.runtime.versionstr)};d.prototype.projectname=function(c){c.set_string(this.runtime.name)};d.prototype.anglelerp=function(c,h,G,f){h=cr.to_radians(h);G=cr.to_radians(G);var r=cr.angleDiff(h,G);cr.angleClockwise(G,
h)?c.set_float(cr.to_clamped_degrees(h+r*f)):c.set_float(cr.to_clamped_degrees(h-r*f))};d.prototype.anglerotate=function(c,h,G,f){h=cr.to_radians(h);G=cr.to_radians(G);f=cr.to_radians(f);c.set_float(cr.to_clamped_degrees(cr.angleRotate(h,G,f)))};d.prototype.zeropad=function(c,h,G){var f=0>h?"-":"";0>h&&(h=-h);G-=h.toString().length;for(var r=0;r<G;r++)f+="0";c.set_string(f+h.toString())};d.prototype.cpuutilisation=function(c){c.set_float(this.runtime.cpuutilisation/1E3)};d.prototype.gpuutilisation=
function(c){c.set_float(this.runtime.gpuLastUtilisation)};d.prototype.viewportleft=function(c,h){h=this.runtime.getLayer(h);c.set_float(h?h.viewLeft:0)};d.prototype.viewporttop=function(c,h){h=this.runtime.getLayer(h);c.set_float(h?h.viewTop:0)};d.prototype.viewportright=function(c,h){h=this.runtime.getLayer(h);c.set_float(h?h.viewRight:0)};d.prototype.viewportbottom=function(c,h){h=this.runtime.getLayer(h);c.set_float(h?h.viewBottom:0)};d.prototype.loadingprogress=function(c){c.set_float(this.runtime.loadingprogress)};
d.prototype.unlerp=function(c,h,G,f){c.set_float(cr.unlerp(h,G,f))};d.prototype.canvassnapshot=function(c){c.set_string(this.runtime.snapshotData)};d.prototype.urlencode=function(c,h){c.set_string(encodeURIComponent(h))};d.prototype.urldecode=function(c,h){c.set_string(decodeURIComponent(h))};d.prototype.canvastolayerx=function(c,h,G,f){h=this.runtime.getLayer(h);c.set_float(h?h.canvasToLayer(G,f,!0):0)};d.prototype.canvastolayery=function(c,h,G,f){h=this.runtime.getLayer(h);c.set_float(h?h.canvasToLayer(G,
f,!1):0)};d.prototype.layertocanvasx=function(c,h,G,f){h=this.runtime.getLayer(h);c.set_float(h?h.layerToCanvas(G,f,!0):0)};d.prototype.layertocanvasy=function(c,h,G,f){h=this.runtime.getLayer(h);c.set_float(h?h.layerToCanvas(G,f,!1):0)};d.prototype.savestatejson=function(c){c.set_string(this.runtime.lastSaveJson)};d.prototype.imagememoryusage=function(c){this.runtime.glwrap?c.set_float(Math.round(100*this.runtime.glwrap.estimateVRAM()/1048576)/100):c.set_float(0)};d.prototype.regexsearch=function(c,
h,G,f){G=w(G,f);c.set_int(h?h.search(G):-1)};d.prototype.regexreplace=function(c,h,G,f,r){G=w(G,f);c.set_string(h?h.replace(G,r):"")};var A=[],T="",W="",I="";d.prototype.regexmatchcount=function(c,h,G,f){w(G,f);n(h.toString(),G,f);c.set_int(A?A.length:0)};d.prototype.regexmatchat=function(c,h,G,f,r){r=Math.floor(r);w(G,f);n(h.toString(),G,f);!A||0>r||r>=A.length?c.set_string(""):c.set_string(A[r])};d.prototype.infinity=function(c){c.set_float(Infinity)};d.prototype.setbit=function(c,h,G,f){G|=0;c.set_int((h|
0)&~(1<<G)|(0!==f?1:0)<<G)};d.prototype.togglebit=function(c,h,G){c.set_int((h|0)^1<<(G|0))};d.prototype.getbit=function(c,h,G){c.set_int((h|0)&1<<(G|0)?1:0)};d.prototype.originalwindowwidth=function(c){c.set_int(this.runtime.original_width)};d.prototype.originalwindowheight=function(c){c.set_int(this.runtime.original_height)};d.prototype.originalviewportwidth=function(c){c.set_int(this.runtime.original_width)};d.prototype.originalviewportheight=function(c){c.set_int(this.runtime.original_height)};
C.exps=new d;C.runWaits=function(){var c,h=this.runtime.getCurrentEventStack();var G=0;for(c=this.waits.length;G<c;G++){var f=this.waits[G];if(-1===f.time){if(!f.signalled)continue}else if(f.time>this.runtime.kahanTime.sum)continue;h.current_event=f.ev;h.actindex=f.actindex;h.cndindex=0;for(M in f.sols)if(f.sols.hasOwnProperty(M)){var r=this.runtime.types_by_index[parseInt(M,10)].getCurrentSol();var J=f.sols[M];r.select_all=J.sa;cr.shallowAssignArray(r.instances,J.insts);r=J;cr.clearArray(r.insts);
p.push(r)}f.ev.resume_actions_and_subevents();this.runtime.clearSol(f.solModifiers);f.deleteme=!0}var M=G=0;for(c=this.waits.length;G<c;G++)f=this.waits[G],this.waits[M]=f,f.deleteme?(cr.wipe(f.sols),cr.clearArray(f.solModifiers),g.push(f)):M++;cr.truncateArray(this.waits,M)}})();
(function(){cr.add_common_aces=function(l,w){var D=l[1],O=l[3],L=l[4],k=l[5],a=l[6],d=l[7],n=l[8],C=l[10],u=l[11];l=l[12];w.cnds||(w.cnds={});w.acts||(w.acts={});w.exps||(w.exps={});var E=w.cnds,N=w.acts;w=w.exps;O&&(E.CompareX=function(z,H){return cr.do_cmp(this.x,z,H)},E.CompareY=function(z,H){return cr.do_cmp(this.y,z,H)},E.IsOnScreen=function(){var z=this.layer;this.update_bbox();var H=this.bbox;return!(H.right<z.viewLeft||H.bottom<z.viewTop||H.left>z.viewRight||H.top>z.viewBottom)},E.IsOutsideLayout=
function(){this.update_bbox();var z=this.bbox,H=this.runtime.running_layout;return 0>z.right||0>z.bottom||z.left>H.width||z.top>H.height},E.PickDistance=function(z,H,F){var g=this.getCurrentSol(),p=g.getObjects();if(!p.length)return!1;var A=p[0],T=A,W=cr.distanceTo(A.x,A.y,H,F),I;var c=1;for(I=p.length;c<I;c++){A=p[c];var h=cr.distanceTo(A.x,A.y,H,F);if(0===z&&h<W||1===z&&h>W)W=h,T=A}g.pick_one(T);return!0},N.SetX=function(z){this.x!==z&&(this.x=z,this.set_bbox_changed())},N.SetY=function(z){this.y!==
z&&(this.y=z,this.set_bbox_changed())},N.SetPos=function(z,H){if(this.x!==z||this.y!==H)this.x=z,this.y=H,this.set_bbox_changed()},N.SetPosToObject=function(z,H){var F=z.getPairedInstance(this);F&&(F.getImagePoint?(z=F.getImagePoint(H,!0),H=F.getImagePoint(H,!1)):(z=F.x,H=F.y),this.x!==z||this.y!==H)&&(this.x=z,this.y=H,this.set_bbox_changed())},N.MoveForward=function(z){0!==z&&(this.x+=Math.cos(this.angle)*z,this.y+=Math.sin(this.angle)*z,this.set_bbox_changed())},N.MoveAtAngle=function(z,H){0!==
H&&(this.x+=Math.cos(cr.to_radians(z))*H,this.y+=Math.sin(cr.to_radians(z))*H,this.set_bbox_changed())},w.X=function(z){z.set_float(this.x)},w.Y=function(z){z.set_float(this.y)},w.dt=function(z){z.set_float(this.runtime.getDt(this))});L&&(E.CompareWidth=function(z,H){return cr.do_cmp(this.width,z,H)},E.CompareHeight=function(z,H){return cr.do_cmp(this.height,z,H)},N.SetWidth=function(z){this.width!==z&&(this.width=z,this.set_bbox_changed())},N.SetHeight=function(z){this.height!==z&&(this.height=z,
this.set_bbox_changed())},N.SetSize=function(z,H){if(this.width!==z||this.height!==H)this.width=z,this.height=H,this.set_bbox_changed()},w.Width=function(z){z.set_float(this.width)},w.Height=function(z){z.set_float(this.height)},w.BBoxLeft=function(z){this.update_bbox();z.set_float(this.bbox.left)},w.BBoxTop=function(z){this.update_bbox();z.set_float(this.bbox.top)},w.BBoxRight=function(z){this.update_bbox();z.set_float(this.bbox.right)},w.BBoxBottom=function(z){this.update_bbox();z.set_float(this.bbox.bottom)});
k&&(E.AngleWithin=function(z,H){return cr.angleDiff(this.angle,cr.to_radians(H))<=cr.to_radians(z)},E.IsClockwiseFrom=function(z){return cr.angleClockwise(this.angle,cr.to_radians(z))},E.IsBetweenAngles=function(z,H){z=cr.to_clamped_radians(z);H=cr.to_clamped_radians(H);var F=cr.clamp_angle(this.angle);return cr.angleClockwise(H,z)?cr.angleClockwise(F,z)&&!cr.angleClockwise(F,H):!(!cr.angleClockwise(F,z)&&cr.angleClockwise(F,H))},N.SetAngle=function(z){z=cr.to_radians(cr.clamp_angle_degrees(z));isNaN(z)||
this.angle===z||(this.angle=z,this.set_bbox_changed())},N.RotateClockwise=function(z){0===z||isNaN(z)||(this.angle+=cr.to_radians(z),this.angle=cr.clamp_angle(this.angle),this.set_bbox_changed())},N.RotateCounterclockwise=function(z){0===z||isNaN(z)||(this.angle-=cr.to_radians(z),this.angle=cr.clamp_angle(this.angle),this.set_bbox_changed())},N.RotateTowardAngle=function(z,H){z=cr.angleRotate(this.angle,cr.to_radians(H),cr.to_radians(z));isNaN(z)||this.angle===z||(this.angle=z,this.set_bbox_changed())},
N.RotateTowardPosition=function(z,H,F){z=cr.angleRotate(this.angle,Math.atan2(F-this.y,H-this.x),cr.to_radians(z));isNaN(z)||this.angle===z||(this.angle=z,this.set_bbox_changed())},N.SetTowardPosition=function(z,H){z=Math.atan2(H-this.y,z-this.x);isNaN(z)||this.angle===z||(this.angle=z,this.set_bbox_changed())},w.Angle=function(z){z.set_float(cr.to_clamped_degrees(this.angle))});D||(E.CompareInstanceVar=function(z,H,F){return cr.do_cmp(this.instance_vars[z],H,F)},E.IsBoolInstanceVarSet=function(z){return this.instance_vars[z]},
E.PickInstVarHiLow=function(z,H){var F=this.getCurrentSol(),g=F.getObjects();if(!g.length)return!1;var p=g[0],A=p,T=p.instance_vars[H],W;var I=1;for(W=g.length;I<W;I++){p=g[I];var c=p.instance_vars[H];if(0===z&&c<T||1===z&&c>T)T=c,A=p}F.pick_one(A);return!0},E.PickByUID=function(z){var H;if(this.runtime.getCurrentCondition().inverted){var F=this.getCurrentSol();if(F.select_all){F.select_all=!1;cr.clearArray(F.instances);cr.clearArray(F.else_instances);var g=this.instances;var p=0;for(H=g.length;p<
H;p++){var A=g[p];A.uid===z?F.else_instances.push(A):F.instances.push(A)}}else{g=p=0;for(H=F.instances.length;p<H;p++)A=F.instances[p],F.instances[g]=A,A.uid===z?F.else_instances.push(A):g++;cr.truncateArray(F.instances,g)}this.applySolToContainer();return!!F.instances.length}A=this.runtime.getObjectByUID(z);if(!A)return!1;F=this.getCurrentSol();if(!F.select_all&&-1===F.instances.indexOf(A))return!1;if(this.is_family)for(z=A.type.families,p=0,H=z.length;p<H;p++){if(z[p]===this)return F.pick_one(A),
this.applySolToContainer(),!0}else if(A.type===this)return F.pick_one(A),this.applySolToContainer(),!0;return!1},E.OnCreated=function(){return!0},E.OnDestroyed=function(){return!0},N.SetInstanceVar=function(z,H){var F=this.instance_vars;cr.is_number(F[z])?cr.is_number(H)?F[z]=H:F[z]=parseFloat(H):cr.is_string(F[z])&&(cr.is_string(H)?F[z]=H:F[z]=H.toString())},N.AddInstanceVar=function(z,H){var F=this.instance_vars;cr.is_number(F[z])?cr.is_number(H)?F[z]+=H:F[z]+=parseFloat(H):cr.is_string(F[z])&&
(cr.is_string(H)?F[z]+=H:F[z]+=H.toString())},N.SubInstanceVar=function(z,H){var F=this.instance_vars;cr.is_number(F[z])&&(cr.is_number(H)?F[z]-=H:F[z]-=parseFloat(H))},N.SetBoolInstanceVar=function(z,H){this.instance_vars[z]=H?1:0},N.ToggleBoolInstanceVar=function(z){this.instance_vars[z]=1-this.instance_vars[z]},N.Destroy=function(){this.runtime.DestroyInstance(this)},N.LoadFromJsonString||(N.LoadFromJsonString=function(z){try{var H=JSON.parse(z)}catch(g){return}this.runtime.loadInstanceFromJSON(this,
H,!0);this.afterLoad&&this.afterLoad();if(this.behavior_insts)for(z=0,H=this.behavior_insts.length;z<H;++z){var F=this.behavior_insts[z];F.afterLoad&&F.afterLoad()}}),w.Count=function(z){var H=z.object_class.instances.length,F;var g=0;for(F=this.runtime.createRow.length;g<F;g++){var p=this.runtime.createRow[g];z.object_class.is_family?0<=p.type.families.indexOf(z.object_class)&&H++:p.type===z.object_class&&H++}z.set_int(H)},w.PickedCount=function(z){z.set_int(z.object_class.getCurrentSol().getObjects().length)},
w.UID=function(z){z.set_int(this.uid)},w.IID=function(z){z.set_int(this.get_iid())},w.AsJSON||(w.AsJSON=function(z){z.set_string(JSON.stringify(this.runtime.saveInstanceToJSON(this,!0)))}));a&&(E.IsVisible=function(){return this.visible},N.SetVisible=function(z){z=2===z?!this.visible:0!==z;z!==this.visible&&(this.visible=z,this.runtime.redraw=!0)},E.CompareOpacity=function(z,H){return cr.do_cmp(cr.round6dp(100*this.opacity),z,H)},N.SetOpacity=function(z){z/=100;0>z?z=0:1<z&&(z=1);z!==this.opacity&&
(this.opacity=z,this.runtime.redraw=!0)},w.Opacity=function(z){z.set_float(cr.round6dp(100*this.opacity))});d&&(E.IsOnLayer=function(z){return z?this.layer===z:!1},E.PickTopBottom=function(z){var H=this.getCurrentSol(),F=H.getObjects();if(!F.length)return!1;var g=F[0],p=g,A;var T=1;for(A=F.length;T<A;T++)if(g=F[T],0===z){if(g.layer.index>p.layer.index||g.layer.index===p.layer.index&&g.get_zindex()>p.get_zindex())p=g}else if(g.layer.index<p.layer.index||g.layer.index===p.layer.index&&g.get_zindex()<
p.get_zindex())p=g;H.pick_one(p);return!0},N.MoveToTop=function(){var z=this.layer,H=z.instances;H.length&&H[H.length-1]===this||(z.removeFromInstanceList(this,!1),z.appendToInstanceList(this,!1),this.runtime.redraw=!0)},N.MoveToBottom=function(){var z=this.layer,H=z.instances;H.length&&H[0]===this||(z.removeFromInstanceList(this,!1),z.prependToInstanceList(this,!1),this.runtime.redraw=!0)},N.MoveToLayer=function(z){z&&z!=this.layer&&(this.layer.removeFromInstanceList(this,!0),this.layer=z,z.appendToInstanceList(this,
!0),this.runtime.redraw=!0)},N.ZMoveToObject=function(z,H){z=0===z;H&&(H=H.getFirstPicked(this))&&H.uid!==this.uid&&(this.layer.index!==H.layer.index&&(this.layer.removeFromInstanceList(this,!0),this.layer=H.layer,H.layer.appendToInstanceList(this,!0)),this.layer.moveInstanceAdjacent(this,H,z),this.runtime.redraw=!0)},w.LayerNumber=function(z){z.set_int(this.layer.number)},w.LayerName=function(z){z.set_string(this.layer.name)},w.ZIndex=function(z){z.set_int(this.get_zindex())});n&&(N.SetEffectEnabled=
function(z,H){this.runtime.glwrap&&(H=this.type.getEffectIndexByName(H),0>H||(z=1===z,this.active_effect_flags[H]!==z&&(this.active_effect_flags[H]=z,this.updateActiveEffects(),this.runtime.redraw=!0)))},N.SetEffectParam=function(z,H,F){if(this.runtime.glwrap){var g=this.type.getEffectIndexByName(z);if(!(0>g||(z=this.type.effect_types[g],g=this.effect_params[g],H=Math.floor(H),0>H||H>=g.length))){var p=this.runtime.glwrap.getProgramParameterType(z.shaderindex,H);1===p&&(F/=100);if(2===p){p=cr.GetRValue(F);
var A=cr.GetGValue(F);F=cr.GetBValue(F);H=g[H];if(H[0]===p&&H[1]===A&&H[2]===F)return;H[0]=p;H[1]=A;H[2]=F}else{if(g[H]===F)return;g[H]=F}z.active&&(this.runtime.redraw=!0)}}});C&&(N.SetVisible=function(z){this.visible=0!==z},N.SetCSSStyle=function(z,H){this.elem.style[cr.cssToCamelCase(z)]=H});u&&(N.SetFocus=function(){(this.inputElem||this.elem).focus()},N.SetBlur=function(){(this.inputElem||this.elem).blur()});l&&(N.SetEnabled=function(z){(this.inputElem||this.elem).disabled=0===z})};cr.set_bbox_changed=
function(){this.cell_changed=this.bbox_changed=!0;this.type.any_cell_changed=!0;this.runtime.redraw=!0;var l,w=this.bbox_changed_callbacks;var D=0;for(l=w.length;D<l;++D)w[D](this);this.layer.useRenderCells&&this.update_bbox()};cr.add_bbox_changed_callback=function(l){l&&this.bbox_changed_callbacks.push(l)};cr.update_bbox=function(){if(this.bbox_changed){var l=this.bbox,w=this.bquad;l.set(this.x,this.y,this.x+this.width,this.y+this.height);l.offset(-this.hotspotX*this.width,-this.hotspotY*this.height);
this.angle?(l.offset(-this.x,-this.y),w.set_from_rotated_rect(l,this.angle),w.offset(this.x,this.y),w.bounding_box(l)):w.set_from_rect(l);l.normalize();this.bbox_changed=!1;this.update_render_cell()}};var b=new cr.rect(0,0,0,0);cr.update_render_cell=function(){if(this.layer.useRenderCells){var l=this.layer.render_grid,w=this.bbox;b.set(l.XToCell(w.left),l.YToCell(w.top),l.XToCell(w.right),l.YToCell(w.bottom));this.rendercells.equals(b)||(this.rendercells.right<this.rendercells.left?l.update(this,
null,b):l.update(this,this.rendercells,b),this.rendercells.copy(b),this.layer.render_list_stale=!0)}};cr.update_collision_cell=function(){if(this.cell_changed&&this.collisionsEnabled){this.update_bbox();var l=this.type.collision_grid,w=this.bbox;b.set(l.XToCell(w.left),l.YToCell(w.top),l.XToCell(w.right),l.YToCell(w.bottom));this.collcells.equals(b)||(this.collcells.right<this.collcells.left?l.update(this,null,b):l.update(this,this.collcells,b),this.collcells.copy(b),this.cell_changed=!1)}};cr.inst_contains_pt=
function(l,w){return this.bbox.contains_pt(l,w)&&this.bquad.contains_pt(l,w)?this.tilemap_exists?this.testPointOverlapTile(l,w):this.collision_poly&&!this.collision_poly.is_empty()?(this.collision_poly.cache_poly(this.width,this.height,this.angle),this.collision_poly.contains_pt(l-this.x,w-this.y)):!0:!1};cr.inst_get_iid=function(){this.type.updateIIDs();return this.iid};cr.inst_get_zindex=function(){this.layer.updateZIndices();return this.zindex};cr.inst_updateActiveEffects=function(){cr.clearArray(this.active_effect_types);
var l,w=!0;var D=0;for(l=this.active_effect_flags.length;D<l;D++)if(this.active_effect_flags[D]){var O=this.type.effect_types[D];this.active_effect_types.push(O);O.preservesOpaqueness||(w=!1)}this.uses_shaders=!!this.active_effect_types.length;this.shaders_preserve_opaqueness=w};cr.inst_toString=function(){return"Inst"+this.puid};cr.type_getFirstPicked=function(l){if(l&&l.is_contained&&l.type!=this){var w;var D=0;for(w=l.siblings.length;D<w;D++){var O=l.siblings[D];if(O.type==this)return O}}l=this.getCurrentSol().getObjects();
return l.length?l[0]:null};cr.type_getPairedInstance=function(l){var w=this.getCurrentSol().getObjects();return w.length?w[l.get_iid()%w.length]:null};cr.type_updateIIDs=function(){if(this.stale_iids&&!this.is_family){var l;var w=0;for(l=this.instances.length;w<l;w++)this.instances[w].iid=w;var D=w,O=this.runtime.createRow;w=0;for(l=O.length;w<l;++w)O[w].type===this&&(O[w].iid=D++);this.stale_iids=!1}};cr.type_getInstanceByIID=function(l){if(l<this.instances.length)return this.instances[l];l-=this.instances.length;
var w=this.runtime.createRow,D;var O=0;for(D=w.length;O<D;++O)if(w[O].type===this){if(0===l)return w[O];--l}return null};cr.type_getCurrentSol=function(){return this.solstack[this.cur_sol]};cr.type_pushCleanSol=function(){this.cur_sol++;this.cur_sol===this.solstack.length?this.solstack.push(new cr.selection(this)):(this.solstack[this.cur_sol].select_all=!0,cr.clearArray(this.solstack[this.cur_sol].else_instances))};cr.type_pushCopySol=function(){this.cur_sol++;this.cur_sol===this.solstack.length&&
this.solstack.push(new cr.selection(this));var l=this.solstack[this.cur_sol],w=this.solstack[this.cur_sol-1];w.select_all?l.select_all=!0:(l.select_all=!1,cr.shallowAssignArray(l.instances,w.instances));cr.clearArray(l.else_instances)};cr.type_popSol=function(){this.cur_sol--};cr.type_getBehaviorByName=function(l){var w,D,O=0;if(!this.is_family){var L=0;for(w=this.families.length;L<w;L++){var k=this.families[L];var a=0;for(D=k.behaviors.length;a<D;a++){if(l===k.behaviors[a].name)return this.extra.lastBehIndex=
O,k.behaviors[a];O++}}}L=0;for(w=this.behaviors.length;L<w;L++){if(l===this.behaviors[L].name)return this.extra.lastBehIndex=O,this.behaviors[L];O++}return null};cr.type_getBehaviorIndexByName=function(l){return this.getBehaviorByName(l)?this.extra.lastBehIndex:-1};cr.type_getEffectIndexByName=function(l){var w;var D=0;for(w=this.effect_types.length;D<w;D++)if(this.effect_types[D].name===l)return D;return-1};cr.type_applySolToContainer=function(){if(this.is_contained&&!this.is_family){var l,w,D;this.updateIIDs();
var O=this.getCurrentSol();var L=O.select_all,k=(l=this.runtime.getCurrentEventStack())&&l.current_event&&l.current_event.orblock;l=0;for(w=this.container.length;l<w;l++){var a=this.container[l];if(a!==this){a.updateIIDs();var d=a.getCurrentSol();d.select_all=L;if(!L){cr.clearArray(d.instances);var n=0;for(D=O.instances.length;n<D;++n)d.instances[n]=a.getInstanceByIID(O.instances[n].iid);if(k)for(cr.clearArray(d.else_instances),n=0,D=O.else_instances.length;n<D;++n)d.else_instances[n]=a.getInstanceByIID(O.else_instances[n].iid)}}}}};
cr.type_toString=function(){return"Type"+this.sid};cr.do_cmp=function(l,w,D){if("undefined"===typeof l||"undefined"===typeof D)return!1;switch(w){case 0:return l===D;case 1:return l!==D;case 2:return l<D;case 3:return l<=D;case 4:return l>D;case 5:return l>=D;default:return!1}}})();cr.shaders={};cr.plugins_.shadowlight=function(b){this.runtime=b};
(function(){function b(R,e,m,x,t,v){t=cr.angleTo(m,x,t,v)-Math.PI/2;R=cr.angleTo(m,x,R,e);return cr.angleDiff(R,t)>=Math.PI/2}function l(R){R%=H.length;0>R&&(R+=H.length);return R}function w(){var R,e;var m=0;for(R=H.length;m<R;++m){var x=H[m];(e=H[l(m-1)])&&!x&&(g=m);!e&&x&&(A=m)}}function D(){}function O(){}var L=cr.plugins_.shadowlight.prototype;L.Type=function(R){this.plugin=R;this.runtime=R.runtime};var k=L.Type.prototype,a=document.currentScript.src;a=a.substr(0,a.lastIndexOf("/")+1);var d=
!1,n=null,C=null;k.onCreate=function(){if(!this.is_family&&!d){d=!0;n=new Image;n.cr_filesize=15E3;var R=this.runtime.getLocalFileUrl("penumbra.png");this.runtime.waitForImageLoad(n,R)}};k.onLostWebGLContext=function(){if(!this.is_family){this.penumbra_texture=this.webGL_texture=null;var R;var e=0;for(R=this.instances.length;e<R;++e){var m=this.instances[e];m.webGL_texture=null;m.penumbra_texture=null}}};k.onRestoreWebGLContext=function(){if(!this.is_family){var R;var e=0;for(R=this.instances.length;e<
R;++e)this.instances[e].createTextures()}};L.Instance=function(R){this.type=R;this.runtime=R.runtime};k=L.Instance.prototype;k.onCreate=function(){if(!C){var R=n.width,e=n.height,m=document.createElement("canvas");m.width=R;m.height=e;m=m.getContext("2d");m.clearRect(0,0,R,e);m.drawImage(n,0,0,R,e);C=m.getImageData(0,0,R,e).data}this.lightX=this.x;this.lightY=this.y;this.lightZ=this.properties[0];this.max_extrude=1E3;this.lightRadius=0===this.lightZ?this.properties[1]:0;R=this.properties[2];this.lightR=
Math.floor(255*R[0]);this.lightG=Math.floor(255*R[1]);this.lightB=Math.floor(255*R[2]);this.castFrom=this.properties[3];this.tag=this.properties[4];this.lastKnownX=this.x;this.lastKnownY=this.y;this.penumbra_texture=this.webGL_texture=null;this.runtime.glwrap?this.createTextures():this.lightRadius=0;this.runtime.tick2Me(this)};k.castsFrom=function(R){return 1===this.castFrom?cr.equals_nocase(this.tag,R):2===this.castFrom?!cr.equals_nocase(this.tag,R):!0};k.tick2=function(){if(this.lastKnownX!==this.x||
this.lastKnownY!==this.y)this.lightX=this.x,this.lightY=this.y;var R=this.layer,e=(R.viewLeft+R.viewRight)/2,m=(R.viewTop+R.viewBottom)/2,x=R.viewRight-R.viewLeft+this.max_extrude,t=R.viewBottom-R.viewTop+this.max_extrude;if(e!==this.x||m!==this.y||x!==this.width||t!==this.height)this.x=e,this.y=m,this.width=x,this.height=t,this.set_bbox_changed();this.lastKnownX=this.x;this.lastKnownY=this.y;this.max_extrude=15*cr.distanceTo(R.viewLeft,R.viewTop,R.viewRight,R.viewBottom)};k.onDestroy=function(){this.runtime.glwrap&&
(this.webGL_texture&&(this.runtime.glwrap.deleteTexture(this.webGL_texture),this.webGL_texture=null),this.penumbra_texture&&(this.runtime.glwrap.deleteTexture(this.penumbra_texture),this.penumbra_texture=null))};k.saveToJSON=function(){return{}};k.loadFromJSON=function(R){};var u=[],E=[];k.getShadowCasterCandidates=function(){this.runtime.shadowcasterBehavior&&(this.runtime.getTypesCollisionCandidates(this.layer,this.runtime.shadowcasterBehavior.myTypes,this.bbox,u),cr.removeArrayDuplicates(u))};
var N=[],z=0,H=[],F=[],g=-1,p=-1,A=-1,T=-1,W=0,I=0,c=[],h=0,G=0,f=0,r=0,J=0,M=0,V=0,X=0,aa=new cr.CollisionPoly([]);k.draw=function(R){this.getShadowCasterCandidates();R.save();R.fillStyle="rgba("+this.lightR+","+this.lightG+","+this.lightB+","+this.opacity+")";var e,m;var x=0;for(e=u.length;x<e;++x){var t=u[x];if(t.extra.shadowcasterEnabled&&this.castsFrom(t.extra.shadowcasterTag)){t.update_bbox();var v=t.extra.shadowcasterHeight;if(t.tilemap_exists){t.getCollisionRectCandidates(this.bbox,E);var q=
t.x;var y=t.y;t=0;for(m=E.length;t<m;++t){var B=E[t];var K=B.rc;if(B.poly){B=B.poly;var S=K.left;K=K.top}else aa.set_from_rect(K,0,0),B=aa,K=S=0;this.calcShadow(B,q+S,y+K,v,!1);R.beginPath();R.moveTo(c[0],c[1]);B=2;for(S=c.length;B<S;B+=2)R.lineTo(c[B],c[B+1]);R.closePath();R.fill();cr.clearArray(H);cr.clearArray(c)}cr.clearArray(E)}else{t.collision_poly&&!t.collision_poly.is_empty()?(t.collision_poly.cache_poly(t.width,t.height,t.angle),B=t.collision_poly):(aa.set_from_quad(t.bquad,t.x,t.y,t.width,
t.height),B=aa);this.calcShadow(B,t.x,t.y,v,cr.xor(0>t.width,0>t.height));R.beginPath();R.moveTo(c[0],c[1]);t=2;for(m=c.length;t<m;t+=2)R.lineTo(c[t],c[t+1]);R.closePath();R.fill();cr.clearArray(H);cr.clearArray(c)}}}R.restore();cr.clearArray(u)};k.getPolyPoints=function(R,e,m,x){z=R.pts_count;cr.clearArray(N);var t=R.pts_cache;I=W=0;var v;for(v=0;v<z;++v){var q=2*v;R=t[q]+e;q=t[q+1]+m;x?(N.unshift(q),N.unshift(R)):(N.push(R),N.push(q));W+=R;I+=q}W/=z;I/=z};k.calcShadow=function(R,e,m,x,t){this.getPolyPoints(R,
e,m,t);cr.clearArray(H);cr.clearArray(F);cr.clearArray(c);T=p=A=g=-1;m=this.lightX;t=this.lightY;if(0<this.lightRadius)this.calcBackFaces(-this.lightRadius),w(),cr.shallowAssignArray(F,H),p=g,T=A,cr.clearArray(H),A=g=-1,this.calcBackFaces(this.lightRadius),w(),-1!==g&&-1!==A&&-1!==p&&-1!==T&&this.calcUmbraWithRadius(x);else for(this.calcBackFaces(0),w(),R=0;R<z;++R){var v=2*R;e=N[v];v=N[v+1];this.calcShadowSegment(R,m,t,e,v,x)}};k.calcShadowSegment=function(R,e,m,x,t,v){var q=H[R];var y=H[l(R-1)];
var B=R===g;R=R===A;q||y?(q=cr.angleTo(e,m,x,t),y=cr.distanceTo(e,m,x,t),v=this.calculateExtrusion(e,m,x,t,v),e+=Math.cos(q)*(y+v),m+=Math.sin(q)*(y+v)):(e=x,m=t);R&&(c.push(x),c.push(t));c.push(e);c.push(m);B&&(c.push(x),c.push(t))};k.calcBackFaces=function(R){var e=this.lightX,m=this.lightY,x=e,t=m,v;for(v=0;v<z;++v){var q=2*v;var y=v+1;y=y===z?0:2*y;var B=N[q];q=N[q+1];var K=N[y];y=N[y+1];0!==R&&(t=cr.angleTo(e,m,W,I)-Math.PI/2,x=e+Math.cos(t)*R,t=m+Math.sin(t)*R);H.push(b(x,t,B,q,K,y))}};var Y=
0,ca=0;k.calcUmbraWithRadius=function(R){for(var e=p,m,x;e%=z,m=2*e,R=N[m],x=N[m+1],c.push(R),c.push(x),e!==A;++e);var t=this.lightRadius,v=cr.angleTo(this.lightX,this.lightY,W,I);e=this.lightX+Math.cos(v-Math.PI/2)*t;var q=this.lightY+Math.sin(v-Math.PI/2)*t;v=cr.angleTo(e,q,R,x);var y=cr.distanceTo(e,q,R,x);e+=Math.cos(v)*(y+this.max_extrude);q+=Math.sin(v)*(y+this.max_extrude);m=2*p;var B=N[m];m=N[m+1];v=cr.angleTo(this.lightX,this.lightY,W,I);var K=this.lightX+Math.cos(v+Math.PI/2)*t,S=this.lightY+
Math.sin(v+Math.PI/2)*t;v=cr.angleTo(K,S,B,m);y=cr.distanceTo(K,S,B,m);t=K+Math.cos(v)*(y+this.max_extrude);v=S+Math.sin(v)*(y+this.max_extrude);J=R;M=x;h=B;G=m;y=e-R;K=q-x;var P=t-B;var Q=v-m;var U=-P*K+y*Q;0===U?R=!1:(S=(-K*(R-B)+y*(x-m))/U,U=-P*K+y*Q,0===U?R=!1:(B=(P*(x-m)-Q*(R-B))/U,0<=S&&1>=S&&0<=B&&1>=B?(Y=R+B*y,ca=x+B*K,R=!0):R=!1));R?(c.push(Y),c.push(ca),V=Y,X=ca,f=Y,r=ca):(c.push(e),c.push(q),c.push(t),c.push(v),V=e,X=q,f=t,r=v)};k.calculateExtrusion=function(R,e,m,x,t){if(t>=this.lightZ)return this.max_extrude;
if(0>=t)return 0;R=cr.distanceTo(R,e,m,x);t*=Math.tan(Math.atan(R/(this.lightZ-t)));t>=this.max_extrude&&(t=this.max_extrude);0>t&&(t=0);return t};k.drawGL=function(R){R.setOpacity(this.opacity);this.getShadowCasterCandidates();var e,m;var x=0;for(e=u.length;x<e;++x){var t=u[x];if(t.extra.shadowcasterEnabled&&this.castsFrom(t.extra.shadowcasterTag)){t.update_bbox();var v=t.extra.shadowcasterHeight;if(t.tilemap_exists){t.getCollisionRectCandidates(this.bbox,E);var q=t.x;var y=t.y;t=0;for(m=E.length;t<
m;++t){var B=E[t];var K=B.rc;if(B.poly){B=B.poly;var S=K.left;K=K.top}else aa.set_from_rect(K,0,0),B=aa,K=S=0;this.calcShadow(B,q+S,y+K,v,!1);6>c.length||(R.setTexture(this.webGL_texture),R.convexPoly(c),-1<g&&-1<p&&(R.setTexture(this.penumbra_texture),this.drawPenumbraGL(R,!0)),-1<A&&-1<T&&(R.setTexture(this.penumbra_texture),this.drawPenumbraGL(R,!1)),cr.clearArray(H),cr.clearArray(c))}cr.clearArray(E)}else t.collision_poly&&!t.collision_poly.is_empty()?(t.collision_poly.cache_poly(t.width,t.height,
t.angle),B=t.collision_poly):(aa.set_from_quad(t.bquad,t.x,t.y,t.width,t.height),B=aa),this.calcShadow(B,t.x,t.y,v,cr.xor(0>t.width,0>t.height)),6>c.length||(R.setTexture(this.webGL_texture),R.convexPoly(c),-1<g&&-1<p&&(R.setTexture(this.penumbra_texture),this.drawPenumbraGL(R,!0)),-1<A&&-1<T&&(R.setTexture(this.penumbra_texture),this.drawPenumbraGL(R,!1)),cr.clearArray(H),cr.clearArray(c))}}cr.clearArray(u)};k.drawPenumbraGL=function(R,e){var m=this.lightX,x=this.lightY;if(e){var t=h;var v=G;var q=
f;var y=r}else t=J,v=M,q=V,y=X;var B=this.lightRadius,K=cr.angleTo(m,x,W,I),S=Math.PI/2;e&&(S=-S);m+=Math.cos(K+S)*B;x+=Math.sin(K+S)*B;if(e){if(e=g!==p){var P=N[2*g];var Q=N[2*g+1]}}else if(e=A!==T)P=N[2*T],Q=N[2*T+1];K=e?cr.angleTo(P,Q,t,v):cr.angleTo(m,x,t,v);B=t+Math.cos(K)*this.max_extrude;S=v+Math.sin(K)*this.max_extrude;var U,Z=U=0,ba=1;if(e){U=cr.angleTo(m,x,P,Q);var da=P+Math.cos(U)*this.max_extrude;var ea=Q+Math.sin(U)*this.max_extrude;m=cr.angleTo(t,v,q,y);U=cr.angleDiff(K,U)/cr.angleDiff(m,
U);K=cr.distanceTo(P,Q,t,v);K/=K+this.max_extrude;m=cr.angleTo(0,1,U,0);x=cr.distanceTo(0,1,U,0);Z+=Math.cos(m)*K*x;ba+=Math.sin(m)*K*x}R.quadTexUV(t,v,q,y,B,S,B,S,Z,ba,1,0,U,0,U,0);e&&R.quadTexUV(P,Q,B,S,da,ea,da,ea,0,1,U,0,0,0,0,0)};k.createTextures=function(){this.runtime.glwrap&&(this.webGL_texture&&(this.runtime.glwrap.deleteTexture(this.webGL_texture),this.webGL_texture=null),this.penumbra_texture&&(this.runtime.glwrap.deleteTexture(this.penumbra_texture),this.penumbra_texture=null),this.createFillTexture(),
this.createPenumbraTexture())};k.createFillTexture=function(){var R=document.createElement("canvas");R.width=16;R.height=16;var e=R.getContext("2d");e.fillStyle="rgb("+this.lightR+","+this.lightG+","+this.lightB+")";e.fillRect(0,0,16,16);this.webGL_texture=this.runtime.glwrap.createEmptyTexture(16,16,!1,!1,!0);this.runtime.glwrap.videoToTexture(R,this.webGL_texture)};k.createPenumbraTexture=function(){var R=n.width,e=n.height,m=this.lightR,x=this.lightG,t=this.lightB,v=C,q=document.createElement("canvas");
q.width=R;q.height=e;var y=q.getContext("2d"),B=y.createImageData(R,e),K=B.data,S;var P=0;for(S=K.length;P<S;P+=4)K[P]=m,K[P+1]=x,K[P+2]=t,K[P+3]=v[P+3];y.putImageData(B,0,0);this.penumbra_texture=this.runtime.glwrap.createEmptyTexture(R,e,this.runtime.linearSampling,!1,!1);this.runtime.glwrap.videoToTexture(q,this.penumbra_texture)};L.cnds=new function(){};D.prototype.SetLightHeight=function(R){this.lightZ!==R&&(this.lightZ=R,this.runtime.redraw=!0)};D.prototype.SetLightColor=function(R){var e=cr.clamp(Math.floor(255*
cr.GetRValue(R)),0,255),m=cr.clamp(Math.floor(255*cr.GetGValue(R)),0,255);R=cr.clamp(Math.floor(255*cr.GetBValue(R)),0,255);if(this.lightR!==e||this.lightG!==m||this.lightB!==R)this.lightR=e,this.lightG=m,this.lightB=R,this.createTextures(),this.runtime.redraw=!0};D.prototype.SetTag=function(R){this.tag!==R&&(this.tag=R,this.runtime.redraw=!0)};L.acts=new D;O.prototype.LightX=function(R){R.set_float(this.lightX)};O.prototype.LightY=function(R){R.set_float(this.lightY)};O.prototype.Tag=function(R){R.set_string(this.tag)};
L.exps=new O})();cr.plugins_.Mouse=function(b){this.runtime=b};
(function(){function b(){}function l(){}function w(){}var D=cr.plugins_.Mouse.prototype;D.Type=function(k){this.plugin=k;this.runtime=k.runtime};D.Type.prototype.onCreate=function(){};D.Instance=function(k){this.type=k;this.runtime=k.runtime;this.buttonMap=Array(4);this.triggerDir=this.triggerType=this.triggerButton=this.mouseYcanvas=this.mouseXcanvas=0;this.handled=!1};var O=D.Instance.prototype;O.onCreate=function(){var k=this;document.addEventListener("mousemove",function(d){k.onMouseMove(d)});
document.addEventListener("mousedown",function(d){k.onMouseDown(d)});document.addEventListener("mouseup",function(d){k.onMouseUp(d)});document.addEventListener("dblclick",function(d){k.onDoubleClick(d)});var a=function(d){k.onWheel(d)};document.addEventListener("mousewheel",a,!1);document.addEventListener("DOMMouseScroll",a,!1)};O.onMouseMove=function(k){this.mouseXcanvas=k.pageX-this.runtime.canvas.offsetLeft;this.mouseYcanvas=k.pageY-this.runtime.canvas.offsetTop};O.mouseInGame=function(){return 0<
this.runtime.fullscreen_mode?!0:0<=this.mouseXcanvas&&0<=this.mouseYcanvas&&this.mouseXcanvas<this.runtime.width&&this.mouseYcanvas<this.runtime.height};O.onMouseDown=function(k){this.mouseInGame()&&(this.buttonMap[k.which]=!0,this.runtime.isInUserInputEvent=!0,this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnAnyClick,this),this.triggerButton=k.which-1,this.triggerType=0,this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnClick,this),this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnObjectClicked,
this),this.runtime.isInUserInputEvent=!1)};O.onMouseUp=function(k){this.buttonMap[k.which]&&(this.runtime.had_a_click&&!this.runtime.isMobile&&k.preventDefault(),this.runtime.had_a_click=!0,this.buttonMap[k.which]=!1,this.runtime.isInUserInputEvent=!0,this.triggerButton=k.which-1,this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnRelease,this),this.runtime.isInUserInputEvent=!1)};O.onDoubleClick=function(k){this.mouseInGame()&&(k.preventDefault(),this.runtime.isInUserInputEvent=!0,this.triggerButton=
k.which-1,this.triggerType=1,this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnClick,this),this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnObjectClicked,this),this.runtime.isInUserInputEvent=!1)};O.onWheel=function(k){this.triggerDir=0>(k.wheelDelta?k.wheelDelta:k.detail?-k.detail:0)?0:1;this.handled=!1;this.runtime.isInUserInputEvent=!0;this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnWheel,this);this.runtime.isInUserInputEvent=!1;this.handled&&cr.isCanvasInputEvent(k)&&k.preventDefault()};
O.onWindowBlur=function(){var k;var a=0;for(k=this.buttonMap.length;a<k;++a)this.buttonMap[a]&&(this.buttonMap[a]=!1,this.triggerButton=a-1,this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnRelease,this))};O.isMouseOverCanvas=function(){return 0<=this.mouseXcanvas&&0<=this.mouseYcanvas&&this.mouseXcanvas<this.runtime.width&&this.mouseYcanvas<this.runtime.height};b.prototype.OnClick=function(k,a){return k===this.triggerButton&&a===this.triggerType};b.prototype.OnAnyClick=function(){return!0};
b.prototype.IsButtonDown=function(k){return this.buttonMap[k+1]};b.prototype.OnRelease=function(k){return k===this.triggerButton};b.prototype.IsOverObject=function(k){if(this.isMouseOverCanvas()){var a=this.runtime.getCurrentCondition();return cr.xor(this.runtime.testAndSelectCanvasPointOverlap(k,this.mouseXcanvas,this.mouseYcanvas,a.inverted),a.inverted)}};b.prototype.OnObjectClicked=function(k,a,d){if(k!==this.triggerButton||a!==this.triggerType)return!1;if(this.isMouseOverCanvas())return this.runtime.testAndSelectCanvasPointOverlap(d,
this.mouseXcanvas,this.mouseYcanvas,!1)};b.prototype.OnWheel=function(k){this.handled=!0;return k===this.triggerDir};D.cnds=new b;var L=null;l.prototype.SetCursor=function(k){k="auto pointer text crosshair move help wait none".split(" ")[k];L!==k&&(L=k,document.body.style.cursor=k)};l.prototype.SetCursorSprite=function(k){!this.runtime.isMobile&&k&&(k=k.getFirstPicked())&&k.curFrame&&(k=k.curFrame,L!==k&&(L=k,k="url("+k.getDataUri()+") "+Math.round(k.hotspotX*k.width)+" "+Math.round(k.hotspotY*k.height)+
", auto",document.body.style.cursor="",document.body.style.cursor=k))};D.acts=new l;w.prototype.X=function(k,a){if(cr.is_undefined(a)){a=this.runtime.getLayerByNumber(0);var d=a.scale;var n=a.zoomRate;var C=a.parallaxX;var u=a.angle;a.scale=1;a.zoomRate=1;a.parallaxX=1;a.angle=0;k.set_float(a.canvasToLayer(this.mouseXcanvas,this.mouseYcanvas,!0));a.scale=d;a.zoomRate=n;a.parallaxX=C;a.angle=u}else(a=cr.is_number(a)?this.runtime.getLayerByNumber(a):this.runtime.getLayerByName(a))?k.set_float(a.canvasToLayer(this.mouseXcanvas,
this.mouseYcanvas,!0)):k.set_float(0)};w.prototype.Y=function(k,a){if(cr.is_undefined(a)){a=this.runtime.getLayerByNumber(0);var d=a.scale;var n=a.zoomRate;var C=a.parallaxY;var u=a.angle;a.scale=1;a.zoomRate=1;a.parallaxY=1;a.angle=0;k.set_float(a.canvasToLayer(this.mouseXcanvas,this.mouseYcanvas,!1));a.scale=d;a.zoomRate=n;a.parallaxY=C;a.angle=u}else(a=cr.is_number(a)?this.runtime.getLayerByNumber(a):this.runtime.getLayerByName(a))?k.set_float(a.canvasToLayer(this.mouseXcanvas,this.mouseYcanvas,
!1)):k.set_float(0)};w.prototype.AbsoluteX=function(k){k.set_float(this.mouseXcanvas)};w.prototype.AbsoluteY=function(k){k.set_float(this.mouseYcanvas)};D.exps=new w})();cr.plugins_.Touch=function(b){this.runtime=b};
(function(){function b(g){n=g.x;C=g.y;u=g.z}function l(g,p,A,T){var W=E.length?E.pop():new w;W.init(g,p,A,T);return W}function w(){this.startindex=this.id=this.lasty=this.lastx=this.y=this.x=this.starty=this.startx=this.lasttime=this.time=this.starttime=0;this.tooFarForHold=this.triggeredHold=!1}function D(g){return g.sourceCapabilities&&g.sourceCapabilities.firesTouchEvents||g.originalEvent&&g.originalEvent.sourceCapabilities&&g.originalEvent.sourceCapabilities.firesTouchEvents}function O(){}function L(){}
function k(){}var a=cr.plugins_.Touch.prototype;a.Type=function(g){this.plugin=g;this.runtime=g.runtime};a.Type.prototype.onCreate=function(){};a.Instance=function(g){this.type=g;this.runtime=g.runtime;this.touches=[];this.mouseDown=!1};var d=a.Instance.prototype;d.findTouch=function(g){var p;var A=0;for(p=this.touches.length;A<p;A++)if(this.touches[A].id===g)return A;return-1};var n=0,C=0,u=0,E=[];w.prototype.init=function(g,p,A,T){var W=cr.performance_now();this.starttime=this.lasttime=this.time=
W;this.startx=g;this.starty=p;this.x=g;this.y=p;this.lastx=g;this.lasty=p;this.pressure=this.height=this.width=0;this.id=A;this.startindex=T;this.tooFarForHold=this.triggeredHold=!1};w.prototype.update=function(g,p,A,T,W,I){this.lasttime=this.time;this.time=g;this.lastx=this.x;this.lasty=this.y;this.x=p;this.y=A;this.width=T;this.height=W;this.pressure=I;!this.tooFarForHold&&15<=cr.distanceTo(this.startx,this.starty,this.x,this.y)&&(this.tooFarForHold=!0)};w.prototype.maybeTriggerHold=function(g,
p){!this.triggeredHold&&500<=cr.performance_now()-this.starttime&&!this.tooFarForHold&&15>cr.distanceTo(this.startx,this.starty,this.x,this.y)&&(this.triggeredHold=!0,g.trigger_index=this.startindex,g.trigger_id=this.id,g.getTouchIndex=p,g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnHoldGesture,g),g.curTouchX=this.x,g.curTouchY=this.y,g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnHoldGestureObject,g),g.getTouchIndex=0)};var N=-1E3,z=-1E3,H=-1E4;w.prototype.maybeTriggerTap=function(g,
p){if(!this.triggeredHold){var A=cr.performance_now();333>=A-this.starttime&&!this.tooFarForHold&&15>cr.distanceTo(this.startx,this.starty,this.x,this.y)&&(g.trigger_index=this.startindex,g.trigger_id=this.id,g.getTouchIndex=p,666>=A-H&&25>cr.distanceTo(N,z,this.x,this.y)?(g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnDoubleTapGesture,g),g.curTouchX=this.x,g.curTouchY=this.y,g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnDoubleTapGestureObject,g),z=N=-1E3,H=-1E4):(g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTapGesture,
g),g.curTouchX=this.x,g.curTouchY=this.y,g.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTapGestureObject,g),N=this.x,z=this.y,H=A),g.getTouchIndex=0)}};d.onCreate=function(){this.isWindows8=!("undefined"===typeof window.c2isWindows8||!window.c2isWindows8);this.getTouchIndex=this.trigger_permission=this.trigger_id=this.trigger_index=this.curTouchY=this.curTouchX=this.acc_z=this.acc_y=this.acc_x=this.acc_g_z=this.acc_g_y=this.acc_g_x=this.orient_gamma=this.orient_beta=this.orient_alpha=0;this.useMouseInput=
this.properties[0];var g=0<this.runtime.fullscreen_mode?document:this.runtime.canvas,p=document,A=this;"undefined"!==typeof PointerEvent?(g.addEventListener("pointerdown",function(h){A.onPointerStart(h)},!1),g.addEventListener("pointermove",function(h){A.onPointerMove(h)},!1),p.addEventListener("pointerup",function(h){A.onPointerEnd(h,!1)},!1),p.addEventListener("pointercancel",function(h){A.onPointerEnd(h,!0)},!1),this.runtime.canvas&&(this.runtime.canvas.addEventListener("MSGestureHold",function(h){h.preventDefault()},
!1),document.addEventListener("MSGestureHold",function(h){h.preventDefault()},!1),this.runtime.canvas.addEventListener("gesturehold",function(h){h.preventDefault()},!1),document.addEventListener("gesturehold",function(h){h.preventDefault()},!1))):window.navigator.msPointerEnabled?(g.addEventListener("MSPointerDown",function(h){A.onPointerStart(h)},!1),g.addEventListener("MSPointerMove",function(h){A.onPointerMove(h)},!1),p.addEventListener("MSPointerUp",function(h){A.onPointerEnd(h,!1)},!1),p.addEventListener("MSPointerCancel",
function(h){A.onPointerEnd(h,!0)},!1),this.runtime.canvas&&(this.runtime.canvas.addEventListener("MSGestureHold",function(h){h.preventDefault()},!1),document.addEventListener("MSGestureHold",function(h){h.preventDefault()},!1))):(g.addEventListener("touchstart",function(h){A.onTouchStart(h)},!1),g.addEventListener("touchmove",function(h){A.onTouchMove(h)},!1),p.addEventListener("touchend",function(h){A.onTouchEnd(h,!1)},!1),p.addEventListener("touchcancel",function(h){A.onTouchEnd(h,!0)},!1));if(this.isWindows8){var T=
function(h){h=h.reading;A.acc_x=h.accelerationX;A.acc_y=h.accelerationY;A.acc_z=h.accelerationZ},W=function(h){h=h.reading;A.orient_alpha=h.yawDegrees;A.orient_beta=h.pitchDegrees;A.orient_gamma=h.rollDegrees},I=Windows.Devices.Sensors.Accelerometer.getDefault();I&&(I.reportInterval=Math.max(I.minimumReportInterval,16),I.addEventListener("readingchanged",T));var c=Windows.Devices.Sensors.Inclinometer.getDefault();c&&(c.reportInterval=Math.max(c.minimumReportInterval,16),c.addEventListener("readingchanged",
W));document.addEventListener("visibilitychange",function(h){document.hidden||document.msHidden?(I&&I.removeEventListener("readingchanged",T),c&&c.removeEventListener("readingchanged",W)):(I&&I.addEventListener("readingchanged",T),c&&c.addEventListener("readingchanged",W))},!1)}else window.addEventListener("deviceorientation",function(h){A.orient_alpha=h.alpha||0;A.orient_beta=h.beta||0;A.orient_gamma=h.gamma||0},!1),window.addEventListener("devicemotion",function(h){h.accelerationIncludingGravity&&
(A.acc_g_x=h.accelerationIncludingGravity.x||0,A.acc_g_y=h.accelerationIncludingGravity.y||0,A.acc_g_z=h.accelerationIncludingGravity.z||0);h.acceleration&&(A.acc_x=h.acceleration.x||0,A.acc_y=h.acceleration.y||0,A.acc_z=h.acceleration.z||0)},!1);this.useMouseInput&&(document.addEventListener("mousemove",function(h){A.onMouseMove(h)}),document.addEventListener("mousedown",function(h){A.onMouseDown(h)}),document.addEventListener("mouseup",function(h){A.onMouseUp(h)}));!this.runtime.isiOS&&this.runtime.isCordova&&
navigator.accelerometer&&navigator.accelerometer.watchAcceleration&&navigator.accelerometer.watchAcceleration(b,null,{frequency:40});this.runtime.tick2Me(this)};d.onPointerMove=function(g){if(g.pointerType!==g.MSPOINTER_TYPE_MOUSE&&"mouse"!==g.pointerType){g.preventDefault&&g.preventDefault();var p=this.findTouch(g.pointerId),A=cr.performance_now();0<=p&&(p=this.touches[p],2>A-p.time||p.update(A,g.pageX-this.runtime.canvas.offsetLeft,g.pageY-this.runtime.canvas.offsetTop,g.width||0,g.height||0,g.pressure||
0))}};d.onPointerStart=function(g){if(g.pointerType!==g.MSPOINTER_TYPE_MOUSE&&"mouse"!==g.pointerType&&-1===this.findTouch(g.pointerId)){g.preventDefault&&cr.isCanvasInputEvent(g)&&g.preventDefault();var p=g.pageX-this.runtime.canvas.offsetLeft,A=g.pageY-this.runtime.canvas.offsetTop;cr.performance_now();this.trigger_index=this.touches.length;this.trigger_id=g.pointerId;this.touches.push(l(p,A,g.pointerId,this.trigger_index));this.runtime.isInUserInputEvent=!0;this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchStart,
this);this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchStart,this);this.curTouchX=p;this.curTouchY=A;this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchObject,this);this.runtime.isInUserInputEvent=!1}};d.onPointerEnd=function(g,p){g.pointerType!==g.MSPOINTER_TYPE_MOUSE&&"mouse"!==g.pointerType&&(g.preventDefault&&cr.isCanvasInputEvent(g)&&g.preventDefault(),g=this.findTouch(g.pointerId),this.trigger_index=0<=g?this.touches[g].startindex:-1,this.trigger_id=0<=g?this.touches[g].id:
-1,this.runtime.isInUserInputEvent=!0,this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchEnd,this),this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchEnd,this),0<=g&&(p||this.touches[g].maybeTriggerTap(this,g),100>E.length&&E.push(this.touches[g]),this.touches.splice(g,1)),this.runtime.isInUserInputEvent=!1)};d.onTouchMove=function(g){g.preventDefault&&g.preventDefault();var p=cr.performance_now(),A;var T=0;for(A=g.changedTouches.length;T<A;T++){var W=g.changedTouches[T];var I=
this.findTouch(W.identifier);if(0<=I){var c=this.runtime.canvas.offsetLeft,h=this.runtime.canvas.offsetTop;I=this.touches[I];2>p-I.time||I.update(p,W.pageX-c,W.pageY-h,2*(W.radiusX||W.webkitRadiusX||W.mozRadiusX||W.msRadiusX||0),2*(W.radiusY||W.webkitRadiusY||W.mozRadiusY||W.msRadiusY||0),W.force||W.webkitForce||W.mozForce||W.msForce||0)}}};d.onTouchStart=function(g){g.preventDefault&&cr.isCanvasInputEvent(g)&&g.preventDefault();var p=this.runtime.canvas.offsetLeft,A=this.runtime.canvas.offsetTop;
cr.performance_now();this.runtime.isInUserInputEvent=!0;var T;var W=0;for(T=g.changedTouches.length;W<T;W++){var I=g.changedTouches[W];var c=this.findTouch(I.identifier);if(-1===c){c=I.pageX-p;var h=I.pageY-A;this.trigger_index=this.touches.length;this.trigger_id=I.identifier;this.touches.push(l(c,h,I.identifier,this.trigger_index));this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchStart,this);this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchStart,this);this.curTouchX=c;
this.curTouchY=h;this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchObject,this)}}this.runtime.isInUserInputEvent=!1};d.onTouchEnd=function(g,p){g.preventDefault&&cr.isCanvasInputEvent(g)&&g.preventDefault();this.runtime.isInUserInputEvent=!0;var A;var T=0;for(A=g.changedTouches.length;T<A;T++){var W=g.changedTouches[T];W=this.findTouch(W.identifier);0<=W&&(this.trigger_index=this.touches[W].startindex,this.trigger_id=this.touches[W].id,this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchEnd,
this),this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchEnd,this),p||this.touches[W].maybeTriggerTap(this,W),100>E.length&&E.push(this.touches[W]),this.touches.splice(W,1))}this.runtime.isInUserInputEvent=!1};d.getAlpha=function(){return this.runtime.isCordova&&0===this.orient_alpha&&0!==u?90*u:this.orient_alpha};d.getBeta=function(){return this.runtime.isCordova&&0===this.orient_beta&&0!==C?90*C:this.orient_beta};d.getGamma=function(){return this.runtime.isCordova&&0===this.orient_gamma&&
0!==n?90*n:this.orient_gamma};d.onMouseDown=function(g){D(g)||(this.onTouchStart({changedTouches:[{pageX:g.pageX,pageY:g.pageY,identifier:0}]}),this.mouseDown=!0)};d.onMouseMove=function(g){if(this.mouseDown&&!D(g))this.onTouchMove({changedTouches:[{pageX:g.pageX,pageY:g.pageY,identifier:0}]})};d.onMouseUp=function(g){g.preventDefault&&this.runtime.had_a_click&&!this.runtime.isMobile&&g.preventDefault();this.runtime.had_a_click=!0;D(g)||(this.onTouchEnd({changedTouches:[{pageX:g.pageX,pageY:g.pageY,
identifier:0}]}),this.mouseDown=!1)};d.isClientPosOverCanvas=function(g,p){return 0<=g&&0<=p&&g<this.runtime.width&&p<this.runtime.height};d.tick2=function(){var g,p=cr.performance_now();var A=0;for(g=this.touches.length;A<g;++A){var T=this.touches[A];T.time<=p-50&&(T.lasttime=p);T.maybeTriggerHold(this,A)}};O.prototype.OnTouchStart=function(){return!0};O.prototype.OnTouchEnd=function(){return!0};O.prototype.IsInTouch=function(){return this.touches.length};O.prototype.OnTouchObject=function(g){return g&&
this.isClientPosOverCanvas(this.curTouchX,this.curTouchY)?this.runtime.testAndSelectCanvasPointOverlap(g,this.curTouchX,this.curTouchY,!1):!1};var F=[];O.prototype.IsTouchingObject=function(g){if(!g)return!1;var p=g.getCurrentSol(),A=p.getObjects(),T,W;var I=0;for(T=A.length;I<T;I++){var c=A[I];c.update_bbox();var h=0;for(W=this.touches.length;h<W;h++){var G=this.touches[h];if(this.isClientPosOverCanvas(G.x,G.y)){var f=c.layer.canvasToLayer(G.x,G.y,!0);G=c.layer.canvasToLayer(G.x,G.y,!1);if(c.contains_pt(f,
G)){F.push(c);break}}}}return F.length?(p.select_all=!1,cr.shallowAssignArray(p.instances,F),g.applySolToContainer(),cr.clearArray(F),!0):!1};O.prototype.CompareTouchSpeed=function(g,p,A){g=Math.floor(g);if(0>g||g>=this.touches.length)return!1;var T=this.touches[g];g=cr.distanceTo(T.x,T.y,T.lastx,T.lasty);T=(T.time-T.lasttime)/1E3;var W=0;0<T&&(W=g/T);return cr.do_cmp(W,p,A)};O.prototype.OrientationSupported=function(){return"undefined"!==typeof window.DeviceOrientationEvent};O.prototype.MotionSupported=
function(){return"undefined"!==typeof window.DeviceMotionEvent};O.prototype.CompareOrientation=function(g,p,A){g=0===g?this.getAlpha():1===g?this.getBeta():this.getGamma();return cr.do_cmp(g,p,A)};O.prototype.CompareAcceleration=function(g,p,A){var T=0;0===g?T=this.acc_g_x:1===g?T=this.acc_g_y:2===g?T=this.acc_g_z:3===g?T=this.acc_x:4===g?T=this.acc_y:5===g&&(T=this.acc_z);return cr.do_cmp(T,p,A)};O.prototype.OnNthTouchStart=function(g){g=Math.floor(g);return g===this.trigger_index};O.prototype.OnNthTouchEnd=
function(g){g=Math.floor(g);return g===this.trigger_index};O.prototype.HasNthTouch=function(g){g=Math.floor(g);return this.touches.length>=g+1};O.prototype.OnHoldGesture=function(){return!0};O.prototype.OnTapGesture=function(){return!0};O.prototype.OnDoubleTapGesture=function(){return!0};O.prototype.OnHoldGestureObject=function(g){return g&&this.isClientPosOverCanvas(this.curTouchX,this.curTouchY)?this.runtime.testAndSelectCanvasPointOverlap(g,this.curTouchX,this.curTouchY,!1):!1};O.prototype.OnTapGestureObject=
function(g){return g&&this.isClientPosOverCanvas(this.curTouchX,this.curTouchY)?this.runtime.testAndSelectCanvasPointOverlap(g,this.curTouchX,this.curTouchY,!1):!1};O.prototype.OnDoubleTapGestureObject=function(g){return g&&this.isClientPosOverCanvas(this.curTouchX,this.curTouchY)?this.runtime.testAndSelectCanvasPointOverlap(g,this.curTouchX,this.curTouchY,!1):!1};O.prototype.OnPermissionGranted=function(g){return this.trigger_permission===g};O.prototype.OnPermissionDenied=function(g){return this.trigger_permission===
g};a.cnds=new O;L.prototype.RequestPermission=function(g){var p=this,A=Promise.resolve(!0);0===g?window.DeviceOrientationEvent&&window.DeviceOrientationEvent.requestPermission&&(A=window.DeviceOrientationEvent.requestPermission().then(function(T){return"granted"===T})):window.DeviceMotionEvent&&window.DeviceMotionEvent.requestPermission&&(A=window.DeviceMotionEvent.requestPermission().then(function(T){return"granted"===T}));A.then(function(T){p.trigger_permission=g;T?p.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnPermissionGranted,
p):p.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnPermissionDenied,p)})};a.acts=new L;k.prototype.TouchCount=function(g){g.set_int(this.touches.length)};k.prototype.X=function(g,p){var A=this.getTouchIndex;if(0>A||A>=this.touches.length)g.set_float(0);else if(cr.is_undefined(p)){p=this.runtime.getLayerByNumber(0);var T=p.scale;var W=p.zoomRate;var I=p.parallaxX;var c=p.angle;p.scale=1;p.zoomRate=1;p.parallaxX=1;p.angle=0;g.set_float(p.canvasToLayer(this.touches[A].x,this.touches[A].y,!0));p.scale=
T;p.zoomRate=W;p.parallaxX=I;p.angle=c}else(p=cr.is_number(p)?this.runtime.getLayerByNumber(p):this.runtime.getLayerByName(p))?g.set_float(p.canvasToLayer(this.touches[A].x,this.touches[A].y,!0)):g.set_float(0)};k.prototype.XAt=function(g,p,A){p=Math.floor(p);if(0>p||p>=this.touches.length)g.set_float(0);else if(cr.is_undefined(A)){A=this.runtime.getLayerByNumber(0);var T=A.scale;var W=A.zoomRate;var I=A.parallaxX;var c=A.angle;A.scale=1;A.zoomRate=1;A.parallaxX=1;A.angle=0;g.set_float(A.canvasToLayer(this.touches[p].x,
this.touches[p].y,!0));A.scale=T;A.zoomRate=W;A.parallaxX=I;A.angle=c}else(A=cr.is_number(A)?this.runtime.getLayerByNumber(A):this.runtime.getLayerByName(A))?g.set_float(A.canvasToLayer(this.touches[p].x,this.touches[p].y,!0)):g.set_float(0)};k.prototype.XForID=function(g,p,A){p=this.findTouch(p);if(0>p)g.set_float(0);else if(p=this.touches[p],cr.is_undefined(A)){A=this.runtime.getLayerByNumber(0);var T=A.scale;var W=A.zoomRate;var I=A.parallaxX;var c=A.angle;A.scale=1;A.zoomRate=1;A.parallaxX=1;
A.angle=0;g.set_float(A.canvasToLayer(p.x,p.y,!0));A.scale=T;A.zoomRate=W;A.parallaxX=I;A.angle=c}else(A=cr.is_number(A)?this.runtime.getLayerByNumber(A):this.runtime.getLayerByName(A))?g.set_float(A.canvasToLayer(p.x,p.y,!0)):g.set_float(0)};k.prototype.Y=function(g,p){var A=this.getTouchIndex;if(0>A||A>=this.touches.length)g.set_float(0);else if(cr.is_undefined(p)){p=this.runtime.getLayerByNumber(0);var T=p.scale;var W=p.zoomRate;var I=p.parallaxY;var c=p.angle;p.scale=1;p.zoomRate=1;p.parallaxY=
1;p.angle=0;g.set_float(p.canvasToLayer(this.touches[A].x,this.touches[A].y,!1));p.scale=T;p.zoomRate=W;p.parallaxY=I;p.angle=c}else(p=cr.is_number(p)?this.runtime.getLayerByNumber(p):this.runtime.getLayerByName(p))?g.set_float(p.canvasToLayer(this.touches[A].x,this.touches[A].y,!1)):g.set_float(0)};k.prototype.YAt=function(g,p,A){p=Math.floor(p);if(0>p||p>=this.touches.length)g.set_float(0);else if(cr.is_undefined(A)){A=this.runtime.getLayerByNumber(0);var T=A.scale;var W=A.zoomRate;var I=A.parallaxY;
var c=A.angle;A.scale=1;A.zoomRate=1;A.parallaxY=1;A.angle=0;g.set_float(A.canvasToLayer(this.touches[p].x,this.touches[p].y,!1));A.scale=T;A.zoomRate=W;A.parallaxY=I;A.angle=c}else(A=cr.is_number(A)?this.runtime.getLayerByNumber(A):this.runtime.getLayerByName(A))?g.set_float(A.canvasToLayer(this.touches[p].x,this.touches[p].y,!1)):g.set_float(0)};k.prototype.YForID=function(g,p,A){p=this.findTouch(p);if(0>p)g.set_float(0);else if(p=this.touches[p],cr.is_undefined(A)){A=this.runtime.getLayerByNumber(0);
var T=A.scale;var W=A.zoomRate;var I=A.parallaxY;var c=A.angle;A.scale=1;A.zoomRate=1;A.parallaxY=1;A.angle=0;g.set_float(A.canvasToLayer(p.x,p.y,!1));A.scale=T;A.zoomRate=W;A.parallaxY=I;A.angle=c}else(A=cr.is_number(A)?this.runtime.getLayerByNumber(A):this.runtime.getLayerByName(A))?g.set_float(A.canvasToLayer(p.x,p.y,!1)):g.set_float(0)};k.prototype.AbsoluteX=function(g){this.touches.length?g.set_float(this.touches[0].x):g.set_float(0)};k.prototype.AbsoluteXAt=function(g,p){p=Math.floor(p);0>p||
p>=this.touches.length?g.set_float(0):g.set_float(this.touches[p].x)};k.prototype.AbsoluteXForID=function(g,p){p=this.findTouch(p);0>p?g.set_float(0):g.set_float(this.touches[p].x)};k.prototype.AbsoluteY=function(g){this.touches.length?g.set_float(this.touches[0].y):g.set_float(0)};k.prototype.AbsoluteYAt=function(g,p){p=Math.floor(p);0>p||p>=this.touches.length?g.set_float(0):g.set_float(this.touches[p].y)};k.prototype.AbsoluteYForID=function(g,p){p=this.findTouch(p);0>p?g.set_float(0):g.set_float(this.touches[p].y)};
k.prototype.SpeedAt=function(g,p){p=Math.floor(p);if(0>p||p>=this.touches.length)g.set_float(0);else{var A=this.touches[p];p=cr.distanceTo(A.x,A.y,A.lastx,A.lasty);A=(A.time-A.lasttime)/1E3;0>=A?g.set_float(0):g.set_float(p/A)}};k.prototype.SpeedForID=function(g,p){p=this.findTouch(p);if(0>p)g.set_float(0);else{var A=this.touches[p];p=cr.distanceTo(A.x,A.y,A.lastx,A.lasty);A=(A.time-A.lasttime)/1E3;0>=A?g.set_float(0):g.set_float(p/A)}};k.prototype.AngleAt=function(g,p){p=Math.floor(p);0>p||p>=this.touches.length?
g.set_float(0):(p=this.touches[p],g.set_float(cr.to_degrees(cr.angleTo(p.lastx,p.lasty,p.x,p.y))))};k.prototype.AngleForID=function(g,p){p=this.findTouch(p);0>p?g.set_float(0):(p=this.touches[p],g.set_float(cr.to_degrees(cr.angleTo(p.lastx,p.lasty,p.x,p.y))))};k.prototype.Alpha=function(g){g.set_float(this.getAlpha())};k.prototype.Beta=function(g){g.set_float(this.getBeta())};k.prototype.Gamma=function(g){g.set_float(this.getGamma())};k.prototype.AccelerationXWithG=function(g){g.set_float(this.acc_g_x)};
k.prototype.AccelerationYWithG=function(g){g.set_float(this.acc_g_y)};k.prototype.AccelerationZWithG=function(g){g.set_float(this.acc_g_z)};k.prototype.AccelerationX=function(g){g.set_float(this.acc_x)};k.prototype.AccelerationY=function(g){g.set_float(this.acc_y)};k.prototype.AccelerationZ=function(g){g.set_float(this.acc_z)};k.prototype.TouchIndex=function(g){g.set_int(this.trigger_index)};k.prototype.TouchID=function(g){g.set_float(this.trigger_id)};k.prototype.WidthForID=function(g,p){p=this.findTouch(p);
0>p?g.set_float(0):g.set_float(this.touches[p].width)};k.prototype.HeightForID=function(g,p){p=this.findTouch(p);0>p?g.set_float(0):g.set_float(this.touches[p].height)};k.prototype.PressureForID=function(g,p){p=this.findTouch(p);0>p?g.set_float(0):g.set_float(this.touches[p].pressure)};a.exps=new k})();cr.plugins_.Text=function(b){this.runtime=b};
(function(){function b(){return C.length?C.pop():{}}function l(u){var E;var N=0;for(E=u.length;N<E;N++)C.push(u[N]);cr.clearArray(u)}function w(u){return u.length&&" "===u.charAt(u.length-1)?u.substring(0,u.length-1):u}function D(){}function O(){}function L(){}var k=cr.plugins_.Text.prototype;k.onCreate=function(){k.acts.SetWidth=function(u){this.width!==u&&(this.width=u,this.text_changed=!0,this.set_bbox_changed())}};k.Type=function(u){this.plugin=u;this.runtime=u.runtime};var a=k.Type.prototype;
a.onCreate=function(){};a.onLostWebGLContext=function(){if(!this.is_family){var u;var E=0;for(u=this.instances.length;E<u;E++){var N=this.instances[E];N.mycanvas=null;N.myctx=null;N.mytex=null}}};k.Instance=function(u){this.type=u;this.runtime=u.runtime;this.recycled?cr.clearArray(this.lines):this.lines=[];this.text_changed=!0};a=k.Instance.prototype;var d={};a.onCreate=function(){this.text=this.properties[0];this.facename=this.properties[2];this.ptSize=this.properties[3];this.line_height_offset=
this.properties[4];this.isBold=this.properties[5];this.isItalic=this.properties[6];var u=this.properties[7];this.color="rgb("+Math.floor(255*u[0])+","+Math.floor(255*u[1])+","+Math.floor(255*u[2])+")";this.halign=this.properties[8];this.valign=this.properties[9];this.wrapbyword=0===this.properties[10];this.visible=this.properties[11];this.lastwrapwidth=this.lastwidth=this.width;this.lastheight=this.height;this.fontstyle=this.font="";this.textHeight=this.textWidth=this.pxHeight=0;this.updateFont();
this.mytex=this.myctx=this.mycanvas=null;this.need_text_redraw=!1;this.last_render_tick=this.runtime.tickcount;this.recycled?this.rcTex.set(0,0,1,1):this.rcTex=new cr.rect(0,0,1,1);this.runtime.glwrap&&this.runtime.tickMe(this)};a.saveToJSON=function(){return{t:this.text,f:this.font,c:this.color,ha:this.halign,va:this.valign,wr:this.wrapbyword,lho:this.line_height_offset,fn:this.facename,fs:this.fontstyle,ps:this.ptSize,pxh:this.pxHeight,tw:this.textWidth,th:this.textHeight,lrt:this.last_render_tick}};
a.loadFromJSON=function(u){this.text=u.t;this.font=u.f;this.color=u.c;this.halign=u.ha;this.valign=u.va;this.wrapbyword=u.wr;this.line_height_offset=u.lho;this.facename=u.fn;this.fontstyle=u.fs;this.ptSize=u.ps;this.pxHeight=u.pxh;this.textWidth=u.tw;this.textHeight=u.th;this.last_render_tick=u.lrt;this.isBold=0!==this.fontstyle.indexOf("bold");this.isItalic=0!==this.fontstyle.indexOf("italic");this.text_changed=!0;this.lastwrapwidth=this.lastwidth=this.width;this.lastheight=this.height};a.tick=function(){if(this.runtime.glwrap&&
this.mytex&&300<=this.runtime.tickcount-this.last_render_tick){var u=this.layer;this.update_bbox();var E=this.bbox;if(E.right<u.viewLeft||E.bottom<u.viewTop||E.left>u.viewRight||E.top>u.viewBottom)this.runtime.glwrap.deleteTexture(this.mytex),this.mycanvas=this.myctx=this.mytex=null}};a.onDestroy=function(){this.mycanvas=this.myctx=null;this.runtime.glwrap&&this.mytex&&this.runtime.glwrap.deleteTexture(this.mytex);this.mytex=null};a.updateFont=function(){this.pxHeight=Math.ceil(this.ptSize/72*96)+
4;var u=[];this.isBold&&u.push("bold");this.isItalic&&u.push("italic");this.fontstyle=u.join(" ");this.font=this.fontstyle+" "+this.ptSize.toString()+"pt '"+this.facename+"'";this.text_changed=!0;this.runtime.redraw=!0};a.draw=function(u,E){u.font=this.font;u.textBaseline="top";u.fillStyle=this.color;u.globalAlpha=E?1:this.opacity;if(E){var N=this.layer.getScale();u.save();u.scale(N,N)}if(this.text_changed||this.width!==this.lastwrapwidth)this.type.plugin.WordWrap(this.text,this.lines,u,this.width,
this.wrapbyword),this.text_changed=!1,this.lastwrapwidth=this.width;this.update_bbox();N=E?0:this.bquad.tlx;var z=E?0:this.bquad.tly;this.runtime.pixel_rounding&&(N=N+.5|0,z=z+.5|0);0===this.angle||E||(u.save(),u.translate(N,z),u.rotate(this.angle),z=N=0);var H=z+this.height,F=this.pxHeight;F+=this.line_height_offset;var g;1===this.valign?z+=Math.max(this.height/2-this.lines.length*F/2,0):2===this.valign&&(z+=Math.max(this.height-this.lines.length*F-2,0));for(g=0;g<this.lines.length;g++){var p=N;
1===this.halign?p=N+(this.width-this.lines[g].width)/2:2===this.halign&&(p=N+(this.width-this.lines[g].width));u.fillText(this.lines[g].text,p,z);z+=F;if(z>=H-F)break}(0!==this.angle||E)&&u.restore();this.last_render_tick=this.runtime.tickcount};a.drawGL=function(u){if(!(1>this.width||1>this.height)){var E=this.text_changed||this.need_text_redraw;this.need_text_redraw=!1;var N=this.layer.getScale(),z=this.layer.getAngle(),H=this.rcTex,F=N*this.width,g=N*this.height,p=Math.ceil(F),A=Math.ceil(g),T=
this.runtime.draw_width/2,W=this.runtime.draw_height/2;this.myctx||(this.mycanvas=document.createElement("canvas"),this.mycanvas.width=p,this.mycanvas.height=A,this.lastwidth=p,this.lastheight=A,E=!0,this.myctx=this.mycanvas.getContext("2d"));if(p!==this.lastwidth||A!==this.lastheight)this.mycanvas.width=p,this.mycanvas.height=A,this.mytex&&(u.deleteTexture(this.mytex),this.mytex=null),E=!0;E&&(this.myctx.clearRect(0,0,p,A),this.draw(this.myctx,!0),this.mytex||(this.mytex=u.createEmptyTexture(p,A,
this.runtime.linearSampling,this.runtime.isMobile)),u.videoToTexture(this.mycanvas,this.mytex,this.runtime.isMobile));this.lastwidth=p;this.lastheight=A;u.setTexture(this.mytex);u.setOpacity(this.opacity);u.resetModelView();u.translate(-T,-W);u.updateModelView();var I=this.bquad;E=this.layer.layerToCanvas(I.tlx,I.tly,!0,!0);T=this.layer.layerToCanvas(I.tlx,I.tly,!1,!0);W=this.layer.layerToCanvas(I.trx,I.try_,!0,!0);var c=this.layer.layerToCanvas(I.trx,I.try_,!1,!0),h=this.layer.layerToCanvas(I.brx,
I.bry,!0,!0),G=this.layer.layerToCanvas(I.brx,I.bry,!1,!0),f=this.layer.layerToCanvas(I.blx,I.bly,!0,!0);I=this.layer.layerToCanvas(I.blx,I.bly,!1,!0);if(this.runtime.pixel_rounding||0===this.angle&&0===z){var r=(E+.5|0)-E,J=(T+.5|0)-T;E+=r;T+=J;W+=r;c+=J;h+=r;G+=J;f+=r;I+=J}0===this.angle&&0===z?(W=E+p,c=T,h=W,G=T+A,f=E,I=G,H.right=1,H.bottom=1):(H.right=F/p,H.bottom=g/A);u.quadTex(E,T,W,c,h,G,f,I,H);u.resetModelView();u.scale(N,N);u.rotateZ(-this.layer.getAngle());u.translate((this.layer.viewLeft+
this.layer.viewRight)/-2,(this.layer.viewTop+this.layer.viewBottom)/-2);u.updateModelView();this.last_render_tick=this.runtime.tickcount}};var n=[];k.TokeniseWords=function(u){cr.clearArray(n);for(var E="",N,z=0;z<u.length;)if(N=u.charAt(z),"\n"===N)E.length&&(n.push(E),E=""),n.push("\n"),++z;else if(" "===N||"\t"===N||"-"===N){do E+=u.charAt(z),z++;while(z<u.length&&(" "===u.charAt(z)||"\t"===u.charAt(z)));n.push(E);E=""}else z<u.length&&(E+=N,z++);E.length&&n.push(E)};var C=[];k.WordWrap=function(u,
E,N,z,H){if(u&&u.length)if(2>=z)l(E);else{if(100>=u.length&&-1===u.indexOf("\n")){var F=N.measureText(u).width;if(F<=z){l(E);E.push(b());E[0].text=u;E[0].width=F;return}}this.WrapText(u,E,N,z,H)}else l(E)};k.WrapText=function(u,E,N,z,H){H&&(this.TokeniseWords(u),u=n);var F="",g,p=0;for(g=0;g<u.length;g++)if("\n"===u[g]){p>=E.length&&E.push(b());F=w(F);var A=E[p];A.text=F;A.width=N.measureText(F).width;p++;F=""}else{var T=F;F+=u[g];A=N.measureText(w(F)).width;A>=z&&(p>=E.length&&E.push(b()),T=w(T),
A=E[p],A.text=T,A.width=N.measureText(T).width,p++,F=u[g],H||" "!==F||(F=""))}F.length&&(p>=E.length&&E.push(b()),F=w(F),A=E[p],A.text=F,A.width=N.measureText(F).width,p++);for(g=p;g<E.length;g++)C.push(E[g]);E.length=p};D.prototype.CompareText=function(u,E){return E?this.text==u:cr.equals_nocase(this.text,u)};k.cnds=new D;O.prototype.SetText=function(u){cr.is_number(u)&&1E9>u&&(u=Math.round(1E10*u)/1E10);u=u.toString();this.text!==u&&(this.text=u,this.text_changed=!0,this.runtime.redraw=!0)};O.prototype.AppendText=
function(u){cr.is_number(u)&&(u=Math.round(1E10*u)/1E10);if(u=u.toString())this.text+=u,this.text_changed=!0,this.runtime.redraw=!0};O.prototype.SetFontFace=function(u,E){var N=!1,z=!1;switch(E){case 1:N=!0;break;case 2:z=!0;break;case 3:z=N=!0}if(u!==this.facename||this.isBold!==N||this.isItalic!==z)this.facename=u,this.isBold=N,this.isItalic=z,this.updateFont()};O.prototype.SetFontSize=function(u){this.ptSize!==u&&(this.ptSize=u,this.updateFont())};O.prototype.SetFontColor=function(u){var E=cr.clamp(Math.floor(255*
cr.GetRValue(u)),0,255),N=cr.clamp(Math.floor(255*cr.GetGValue(u)),0,255);u=cr.clamp(Math.floor(255*cr.GetBValue(u)),0,255);E="rgb("+E+","+N+","+u+")";E!==this.color&&(this.color=E,this.need_text_redraw=!0,this.runtime.redraw=!0)};O.prototype.SetWebFont=function(u,E){var N=this,z=function(){N.runtime.redraw=!0;N.text_changed=!0};if(d.hasOwnProperty(E)){if(u="'"+u+"'",this.facename!==u)for(this.facename=u,this.updateFont(),u=1;10>u;u++)setTimeout(z,100*u),setTimeout(z,1E3*u)}else{var H=document.createElement("link");
H.href=E;H.rel="stylesheet";H.type="text/css";H.onload=z;document.getElementsByTagName("head")[0].appendChild(H);d[E]=!0;this.facename="'"+u+"'";this.updateFont();for(u=1;10>u;u++)setTimeout(z,100*u),setTimeout(z,1E3*u)}};O.prototype.SetEffect=function(u){this.blend_mode=u;this.compositeOp=cr.effectToCompositeOp(u);cr.setGLBlend(this,u,this.runtime.gl);this.runtime.redraw=!0};k.acts=new O;L.prototype.Text=function(u){u.set_string(this.text)};L.prototype.FaceName=function(u){u.set_string(this.facename)};
L.prototype.FaceSize=function(u){u.set_int(this.ptSize)};L.prototype.TextWidth=function(u){var E=0,N;var z=0;for(N=this.lines.length;z<N;z++){var H=this.lines[z].width;E<H&&(E=H)}u.set_int(E)};L.prototype.TextHeight=function(u){u.set_int(this.lines.length*(this.pxHeight+this.line_height_offset)-this.line_height_offset)};k.exps=new L})();cr.plugins_.Sprite=function(b){this.runtime=b};
(function(){function b(){if(0===this.datauri.length){var I=document.createElement("canvas");I.width=this.width;I.height=this.height;var c=I.getContext("2d");this.spritesheeted?c.drawImage(this.texture_img,this.offx,this.offy,this.width,this.height,0,0,this.width,this.height):c.drawImage(this.texture_img,0,0,this.width,this.height);this.datauri=I.toDataURL("image/png")}return this.datauri}function l(){}function w(I){I[0]=0;I[1]=0;I[2]=0;z.push(I)}function D(I,c){return I<c?""+I+","+c:""+c+","+I}function O(I,
c,h,G){c=c.uid;h=h.uid;var f=D(c,h);if(I.hasOwnProperty(f))I[f][2]=G;else{var r=z.length?z.pop():[0,0,0];r[0]=c;r[1]=h;r[2]=G;I[f]=r}}function L(I,c,h){c=D(c.uid,h.uid);I.hasOwnProperty(c)&&(w(I[c]),delete I[c])}function k(I,c,h){c=D(c.uid,h.uid);if(I.hasOwnProperty(c))return H=I[c][2],!0;H=-2;return!1}function a(I,c,h){if(!I)return!1;var G=0!==c||0!==h,f=!1,r=this.runtime.getCurrentCondition(),J=r.type;r=r.inverted;var M=I.getCurrentSol();var V=this.runtime.getCurrentEventStack().current_event.orblock;
M.select_all?(this.update_bbox(),W.copy(this.bbox),W.offset(c,h),this.runtime.getCollisionCandidates(this.layer,I,W,T),M=T):M=V?this.runtime.isCurrentConditionFirst()&&!M.else_instances.length&&M.instances.length?M.instances:M.else_instances:M.instances;g=I;A=J!==I&&!r;if(G){var X=this.x;var aa=this.y;this.x+=c;this.y+=h;this.set_bbox_changed()}c=0;for(h=M.length;c<h;c++)if(V=M[c],this.runtime.testOverlap(this,V)){f=!0;if(r)break;J!==I&&p.add(V)}G&&(this.x=X,this.y=aa,this.set_bbox_changed());cr.clearArray(T);
return f}function d(){}function n(){}var C=cr.plugins_.Sprite.prototype;C.Type=function(I){this.plugin=I;this.runtime=I.runtime};var u=C.Type.prototype;u.onCreate=function(){if(!this.is_family){var I,c;this.all_frames=[];this.has_loaded_textures=!1;var h=0;for(I=this.animations.length;h<I;h++){var G=this.animations[h];var f={};f.name=G[0];f.speed=G[1];f.loop=G[2];f.repeatcount=G[3];f.repeatto=G[4];f.pingpong=G[5];f.sid=G[6];f.frames=[];var r=0;for(c=G[7].length;r<c;r++){var J=G[7][r];var M={};M.texture_file=
J[0];M.texture_filesize=J[1];M.offx=J[2];M.offy=J[3];M.width=J[4];M.height=J[5];M.duration=J[6];M.hotspotX=J[7];M.hotspotY=J[8];M.image_points=J[9];M.poly_pts=J[10];M.pixelformat=J[11];M.spritesheeted=0!==M.width;M.datauri="";M.getDataUri=b;var V={left:0,top:0,right:1,bottom:1};M.sheetTex=V;M.webGL_texture=null;(V=this.runtime.findWaitingTexture(J[0]))?M.texture_img=V:(M.texture_img=new Image,M.texture_img.cr_src=J[0],M.texture_img.cr_filesize=J[1],M.texture_img.c2webGL_texture=null,this.runtime.waitForImageLoad(M.texture_img,
J[0]));cr.seal(M);f.frames.push(M);this.all_frames.push(M)}cr.seal(f);this.animations[h]=f}}};u.updateAllCurrentTexture=function(){var I;var c=0;for(I=this.instances.length;c<I;c++){var h=this.instances[c];h.curWebGLTexture=h.curFrame.webGL_texture}};u.onLostWebGLContext=function(){if(!this.is_family){var I;var c=0;for(I=this.all_frames.length;c<I;++c){var h=this.all_frames[c];h.texture_img.c2webGL_texture=null;h.webGL_texture=null}this.has_loaded_textures=!1;this.updateAllCurrentTexture()}};u.onRestoreWebGLContext=
function(){if(!this.is_family&&this.instances.length){var I;var c=0;for(I=this.all_frames.length;c<I;++c){var h=this.all_frames[c];h.webGL_texture=this.runtime.glwrap.loadTexture(h.texture_img,!1,this.runtime.linearSampling,h.pixelformat)}this.updateAllCurrentTexture()}};u.loadTextures=function(){if(!this.is_family&&!this.has_loaded_textures&&this.runtime.glwrap){var I;var c=0;for(I=this.all_frames.length;c<I;++c){var h=this.all_frames[c];h.webGL_texture=this.runtime.glwrap.loadTexture(h.texture_img,
!1,this.runtime.linearSampling,h.pixelformat)}this.has_loaded_textures=!0}};u.unloadTextures=function(){if(!this.is_family&&!this.instances.length&&this.has_loaded_textures){var I;var c=0;for(I=this.all_frames.length;c<I;++c){var h=this.all_frames[c];this.runtime.glwrap.deleteTexture(h.webGL_texture);h.webGL_texture=null}this.has_loaded_textures=!1}};var E=[];u.preloadCanvas2D=function(I){var c;cr.clearArray(E);var h=0;for(c=this.all_frames.length;h<c;++h){var G=this.all_frames[h].texture_img;-1===
E.indexOf(G)&&(I.drawImage(G,0,0),E.push(G))}};C.Instance=function(I){this.type=I;this.runtime=I.runtime;I=this.type.animations[0].frames[0].poly_pts;this.recycled?this.collision_poly.set_pts(I):this.collision_poly=new cr.CollisionPoly(I)};var N=C.Instance.prototype;N.onCreate=function(){this.visible=this.properties[0];this.inAnimTrigger=this.isTicking=!1;this.collisionsEnabled=this.properties[3];this.cur_animation=this.getAnimationByName(this.properties[1])||this.type.animations[0];this.cur_frame=
this.properties[2];0>this.cur_frame&&(this.cur_frame=0);this.cur_frame>=this.cur_animation.frames.length&&(this.cur_frame=this.cur_animation.frames.length-1);var I=this.cur_animation.frames[this.cur_frame];this.collision_poly.set_pts(I.poly_pts);this.hotspotX=I.hotspotX;this.hotspotY=I.hotspotY;this.animForwards=0<=this.cur_animation.speed;this.cur_anim_speed=Math.abs(this.cur_animation.speed);this.cur_anim_repeatto=this.cur_animation.repeatto;1===this.type.animations.length&&1===this.type.animations[0].frames.length||
0===this.cur_anim_speed||(this.runtime.tickMe(this),this.isTicking=!0);this.recycled?this.animTimer.reset():this.animTimer=new cr.KahanAdder;this.frameStart=this.getNowTime();this.animPlaying=!0;this.animRepeats=0;this.changeAnimName=this.animTriggerName="";this.changeAnimFrom=0;this.changeAnimFrame=-1;this.type.loadTextures();var c,h;I=0;for(c=this.type.animations.length;I<c;I++){var G=this.type.animations[I];var f=0;for(h=G.frames.length;f<h;f++){var r=G.frames[f];0===r.width&&(r.width=r.texture_img.width,
r.height=r.texture_img.height);if(r.spritesheeted){var J=r.texture_img;var M=r.sheetTex;M.left=r.offx/J.width;M.top=r.offy/J.height;M.right=(r.offx+r.width)/J.width;M.bottom=(r.offy+r.height)/J.height;0===r.offx&&0===r.offy&&r.width===J.width&&r.height===J.height&&(r.spritesheeted=!1)}}}this.curFrame=this.cur_animation.frames[this.cur_frame];this.curWebGLTexture=this.curFrame.webGL_texture};N.saveToJSON=function(){var I={a:this.cur_animation.sid,f:this.cur_frame,cas:this.cur_anim_speed,fs:this.frameStart,
ar:this.animRepeats,at:this.animTimer.sum,rt:this.cur_anim_repeatto};this.animPlaying||(I.ap=this.animPlaying);this.animForwards||(I.af=this.animForwards);return I};N.loadFromJSON=function(I){var c=this.getAnimationBySid(I.a);c&&(this.cur_animation=c);this.cur_frame=I.f;0>this.cur_frame&&(this.cur_frame=0);this.cur_frame>=this.cur_animation.frames.length&&(this.cur_frame=this.cur_animation.frames.length-1);this.cur_anim_speed=I.cas;this.frameStart=I.fs;this.animRepeats=I.ar;this.animTimer.reset();
this.animTimer.sum=I.at;this.animPlaying=I.hasOwnProperty("ap")?I.ap:!0;this.animForwards=I.hasOwnProperty("af")?I.af:!0;I.hasOwnProperty("rt")?this.cur_anim_repeatto=I.rt:this.cur_anim_repeatto=this.cur_animation.repeatto;this.curFrame=this.cur_animation.frames[this.cur_frame];this.curWebGLTexture=this.curFrame.webGL_texture;this.collision_poly.set_pts(this.curFrame.poly_pts);this.hotspotX=this.curFrame.hotspotX;this.hotspotY=this.curFrame.hotspotY};N.animationFinish=function(I){this.cur_frame=I?
0:this.cur_animation.frames.length-1;this.animPlaying=!1;this.animTriggerName=this.cur_animation.name;this.inAnimTrigger=!0;this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnAnyAnimFinished,this);this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnAnimFinished,this);this.inAnimTrigger=!1;this.animRepeats=0};N.getNowTime=function(){return this.animTimer.sum};N.tick=function(){this.animTimer.add(this.runtime.getDt(this));this.changeAnimName.length&&this.doChangeAnim();0<=this.changeAnimFrame&&
this.doChangeAnimFrame();var I=this.getNowTime(),c=this.cur_animation,h=c.frames[this.cur_frame],G=h.duration/this.cur_anim_speed;this.animPlaying&&I>=this.frameStart+G&&(this.animForwards?this.cur_frame++:this.cur_frame--,this.frameStart+=G,this.cur_frame>=c.frames.length&&(c.pingpong?(this.animForwards=!1,this.cur_frame=c.frames.length-2):c.loop?this.cur_frame=this.cur_anim_repeatto:(this.animRepeats++,this.animRepeats>=c.repeatcount?this.animationFinish(!1):this.cur_frame=this.cur_anim_repeatto)),
0>this.cur_frame&&(c.pingpong?(this.cur_frame=1,this.animForwards=!0,c.loop||(this.animRepeats++,this.animRepeats>=c.repeatcount&&this.animationFinish(!0))):c.loop?this.cur_frame=this.cur_anim_repeatto:(this.animRepeats++,this.animRepeats>=c.repeatcount?this.animationFinish(!0):this.cur_frame=this.cur_anim_repeatto)),0>this.cur_frame?this.cur_frame=0:this.cur_frame>=c.frames.length&&(this.cur_frame=c.frames.length-1),I>this.frameStart+c.frames[this.cur_frame].duration/this.cur_anim_speed&&(this.frameStart=
I),I=c.frames[this.cur_frame],this.OnFrameChanged(h,I),this.runtime.redraw=!0)};N.getAnimationByName=function(I){var c;var h=0;for(c=this.type.animations.length;h<c;h++){var G=this.type.animations[h];if(cr.equals_nocase(G.name,I))return G}return null};N.getAnimationBySid=function(I){var c;var h=0;for(c=this.type.animations.length;h<c;h++){var G=this.type.animations[h];if(G.sid===I)return G}return null};N.doChangeAnim=function(){var I=this.cur_animation.frames[this.cur_frame],c=this.getAnimationByName(this.changeAnimName);
this.changeAnimName="";!c||cr.equals_nocase(c.name,this.cur_animation.name)&&this.animPlaying||(this.cur_animation=c,this.animForwards=0<=c.speed,this.cur_anim_speed=Math.abs(c.speed),this.cur_anim_repeatto=c.repeatto,0>this.cur_frame&&(this.cur_frame=0),this.cur_frame>=this.cur_animation.frames.length&&(this.cur_frame=this.cur_animation.frames.length-1),1===this.changeAnimFrom&&(this.cur_frame=0),this.animPlaying=!0,this.frameStart=this.getNowTime(),this.OnFrameChanged(I,this.cur_animation.frames[this.cur_frame]),
this.runtime.redraw=!0)};N.doChangeAnimFrame=function(){var I=this.cur_animation.frames[this.cur_frame],c=this.cur_frame;this.cur_frame=cr.floor(this.changeAnimFrame);0>this.cur_frame&&(this.cur_frame=0);this.cur_frame>=this.cur_animation.frames.length&&(this.cur_frame=this.cur_animation.frames.length-1);c!==this.cur_frame&&(this.OnFrameChanged(I,this.cur_animation.frames[this.cur_frame]),this.frameStart=this.getNowTime(),this.runtime.redraw=!0);this.changeAnimFrame=-1};N.OnFrameChanged=function(I,
c){var h=I.width,G=I.height,f=c.width,r=c.height;h!=f&&(this.width*=f/h);G!=r&&(this.height*=r/G);this.hotspotX=c.hotspotX;this.hotspotY=c.hotspotY;this.collision_poly.set_pts(c.poly_pts);this.set_bbox_changed();this.curFrame=c;this.curWebGLTexture=c.webGL_texture;h=0;for(G=this.behavior_insts.length;h<G;h++)if(f=this.behavior_insts[h],f.onSpriteFrameChanged)f.onSpriteFrameChanged(I,c);this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnFrameChanged,this)};N.draw=function(I){I.globalAlpha=this.opacity;
var c=this.curFrame,h=c.spritesheeted,G=c.texture_img,f=this.x,r=this.y,J=this.width,M=this.height;if(0===this.angle&&0<=J&&0<=M)f-=this.hotspotX*J,r-=this.hotspotY*M,this.runtime.pixel_rounding&&(f=Math.round(f),r=Math.round(r)),h?I.drawImage(G,c.offx,c.offy,c.width,c.height,f,r,J,M):I.drawImage(G,f,r,J,M);else{this.runtime.pixel_rounding&&(f=Math.round(f),r=Math.round(r));I.save();var V=0<J?1:-1,X=0<M?1:-1;I.translate(f,r);1===V&&1===X||I.scale(V,X);I.rotate(this.angle*V*X);f=-(this.hotspotX*cr.abs(J));
r=-(this.hotspotY*cr.abs(M));h?I.drawImage(G,c.offx,c.offy,c.width,c.height,f,r,cr.abs(J),cr.abs(M)):I.drawImage(G,f,r,cr.abs(J),cr.abs(M));I.restore()}};N.drawGL_earlyZPass=function(I){this.drawGL(I)};N.drawGL=function(I){I.setTexture(this.curWebGLTexture);I.setOpacity(this.opacity);var c=this.curFrame,h=this.bquad;if(this.runtime.pixel_rounding){var G=Math.round(this.x)-this.x,f=Math.round(this.y)-this.y;c.spritesheeted?I.quadTex(h.tlx+G,h.tly+f,h.trx+G,h.try_+f,h.brx+G,h.bry+f,h.blx+G,h.bly+f,
c.sheetTex):I.quad(h.tlx+G,h.tly+f,h.trx+G,h.try_+f,h.brx+G,h.bry+f,h.blx+G,h.bly+f)}else c.spritesheeted?I.quadTex(h.tlx,h.tly,h.trx,h.try_,h.brx,h.bry,h.blx,h.bly,c.sheetTex):I.quad(h.tlx,h.tly,h.trx,h.try_,h.brx,h.bry,h.blx,h.bly)};N.getImagePointIndexByName=function(I){var c=this.curFrame,h;var G=0;for(h=c.image_points.length;G<h;G++)if(cr.equals_nocase(I,c.image_points[G][0]))return G;return-1};N.getImagePoint=function(I,c){var h=this.curFrame,G=h.image_points;var f=cr.is_string(I)?this.getImagePointIndexByName(I):
I-1;f=cr.floor(f);if(0>f||f>=G.length)return c?this.x:this.y;I=(G[f][1]-h.hotspotX)*this.width;G=G[f][2];G=(G-h.hotspotY)*this.height;h=Math.cos(this.angle);f=Math.sin(this.angle);var r=I*h-G*f;G=G*h+I*f;I=r+this.x;G+=this.y;return c?I:G};var z=[],H=-2,F=[];l.prototype.OnCollision=function(I){if(!I)return!1;var c=this.runtime,h=c.getCurrentCondition(),G=h.type,f=null;h.extra.collmemory?f=h.extra.collmemory:(f={},h.extra.collmemory=f);h.extra.spriteCreatedDestroyCallback||(h.extra.spriteCreatedDestroyCallback=
!0,c.addDestroyCallback(function(t){var v=h.extra.collmemory;t=t.uid;var q;for(q in v)if(v.hasOwnProperty(q)){var y=v[q];if(y[0]===t||y[1]===t)w(v[q]),delete v[q]}}));var r=G.getCurrentSol(),J=I.getCurrentSol();r=r.getObjects();var M,V,X=this.runtime.tickcount,aa=X-1,Y=c.getCurrentEventStack().current_event;for(M=0;M<r.length;M++){var ca=r[M];if(J.select_all){ca.update_bbox();this.runtime.getCollisionCandidates(ca.layer,I,ca.bbox,F);var R=F;this.runtime.addRegisteredCollisionCandidates(ca,I,R)}else R=
J.getObjects();for(V=0;V<R.length;V++){var e=R[V];if(c.testOverlap(ca,e)||c.checkRegisteredCollision(ca,e)){var m=k(f,ca,e);m=!m||H<aa;O(f,ca,e,X);if(m){c.pushCopySol(Y.solModifiers);m=G.getCurrentSol();var x=I.getCurrentSol();m.select_all=!1;x.select_all=!1;G===I?(m.instances.length=2,m.instances[0]=ca,m.instances[1]=e,G.applySolToContainer()):(m.instances.length=1,x.instances.length=1,m.instances[0]=ca,x.instances[0]=e,G.applySolToContainer(),I.applySolToContainer());Y.retrigger();c.popSol(Y.solModifiers)}}else L(f,
ca,e)}cr.clearArray(F)}return!1};var g=null,p=new cr.ObjectSet,A=!1,T=[],W=new cr.rect(0,0,0,0);u.finish=function(I){if(A){if(I){var c=this.runtime.getCurrentEventStack().current_event.orblock;I=g.getCurrentSol();var h=p.valuesRef(),G;if(I.select_all){I.select_all=!1;cr.clearArray(I.instances);var f=0;for(G=h.length;f<G;++f)I.instances[f]=h[f];if(c)for(cr.clearArray(I.else_instances),f=0,G=g.instances.length;f<G;++f)h=g.instances[f],p.contains(h)||I.else_instances.push(h)}else if(c)for(c=I.instances.length,
f=0,G=h.length;f<G;++f)I.instances[c+f]=h[f],cr.arrayFindRemove(I.else_instances,h[f]);else cr.shallowAssignArray(I.instances,h);g.applySolToContainer()}p.clear();A=!1}};l.prototype.IsOverlapping=function(I){return a.call(this,I,0,0)};l.prototype.IsOverlappingOffset=function(I,c,h){return a.call(this,I,c,h)};l.prototype.IsAnimPlaying=function(I){return this.changeAnimName.length?cr.equals_nocase(this.changeAnimName,I):cr.equals_nocase(this.cur_animation.name,I)};l.prototype.CompareFrame=function(I,
c){return cr.do_cmp(this.cur_frame,I,c)};l.prototype.CompareAnimSpeed=function(I,c){return cr.do_cmp(this.animForwards?this.cur_anim_speed:-this.cur_anim_speed,I,c)};l.prototype.OnAnimFinished=function(I){return cr.equals_nocase(this.animTriggerName,I)};l.prototype.OnAnyAnimFinished=function(){return!0};l.prototype.OnFrameChanged=function(){return!0};l.prototype.IsMirrored=function(){return 0>this.width};l.prototype.IsFlipped=function(){return 0>this.height};l.prototype.OnURLLoaded=function(){return!0};
l.prototype.IsCollisionEnabled=function(){return this.collisionsEnabled};C.cnds=new l;d.prototype.Spawn=function(I,c,h){if(I&&c&&(c=this.runtime.createInstance(I,c,this.getImagePoint(h,!0),this.getImagePoint(h,!1)))){"undefined"!==typeof c.angle&&(c.angle=this.angle,c.set_bbox_changed());this.runtime.isInOnDestroy++;var G;this.runtime.trigger(Object.getPrototypeOf(I.plugin).cnds.OnCreated,c);if(c.is_contained){var f=0;for(G=c.siblings.length;f<G;f++){var r=c.siblings[f];this.runtime.trigger(Object.getPrototypeOf(r.type.plugin).cnds.OnCreated,
r)}}this.runtime.isInOnDestroy--;f=this.runtime.getCurrentAction();h=!1;if(cr.is_undefined(f.extra.Spawn_LastExec)||f.extra.Spawn_LastExec<this.runtime.execcount)h=!0,f.extra.Spawn_LastExec=this.runtime.execcount;if(I!=this.type&&(I=I.getCurrentSol(),I.select_all=!1,h?(cr.clearArray(I.instances),I.instances[0]=c):I.instances.push(c),c.is_contained))for(f=0,G=c.siblings.length;f<G;f++)r=c.siblings[f],I=r.type.getCurrentSol(),I.select_all=!1,h?(cr.clearArray(I.instances),I.instances[0]=r):I.instances.push(r)}};
d.prototype.SetEffect=function(I){this.blend_mode=I;this.compositeOp=cr.effectToCompositeOp(I);cr.setGLBlend(this,I,this.runtime.gl);this.runtime.redraw=!0};d.prototype.StopAnim=function(){this.animPlaying=!1};d.prototype.StartAnim=function(I){this.animPlaying=!0;this.frameStart=this.getNowTime();1===I&&0!==this.cur_frame&&(this.changeAnimFrame=0,this.inAnimTrigger||this.doChangeAnimFrame());this.isTicking||(this.runtime.tickMe(this),this.isTicking=!0)};d.prototype.SetAnim=function(I,c){this.changeAnimName=
I;this.changeAnimFrom=c;this.isTicking||(this.runtime.tickMe(this),this.isTicking=!0);this.inAnimTrigger||this.doChangeAnim()};d.prototype.SetAnimFrame=function(I){this.changeAnimFrame=I;this.isTicking||(this.runtime.tickMe(this),this.isTicking=!0);this.inAnimTrigger||this.doChangeAnimFrame()};d.prototype.SetAnimSpeed=function(I){this.cur_anim_speed=cr.abs(I);this.animForwards=0<=I;this.isTicking||(this.runtime.tickMe(this),this.isTicking=!0)};d.prototype.SetAnimRepeatToFrame=function(I){I=Math.floor(I);
0>I&&(I=0);I>=this.cur_animation.frames.length&&(I=this.cur_animation.frames.length-1);this.cur_anim_repeatto=I};d.prototype.SetMirrored=function(I){I=cr.abs(this.width)*(0===I?-1:1);this.width!==I&&(this.width=I,this.set_bbox_changed())};d.prototype.SetFlipped=function(I){I=cr.abs(this.height)*(0===I?-1:1);this.height!==I&&(this.height=I,this.set_bbox_changed())};d.prototype.SetScale=function(I){var c=this.curFrame,h=c.width*I*(0>this.width?-1:1);I=c.height*I*(0>this.height?-1:1);if(this.width!==
h||this.height!==I)this.width=h,this.height=I,this.set_bbox_changed()};d.prototype.LoadURL=function(I,c,h){var G=new Image,f=this,r=this.curFrame;G.onload=function(){r.texture_img.src===G.src?f.runtime.glwrap&&f.curFrame===r&&(f.curWebGLTexture=r.webGL_texture):(r.texture_img=G,r.offx=0,r.offy=0,r.width=G.width,r.height=G.height,r.spritesheeted=!1,r.datauri="",r.pixelformat=0,f.runtime.glwrap&&(r.webGL_texture&&f.runtime.glwrap.deleteTexture(r.webGL_texture),r.webGL_texture=f.runtime.glwrap.loadTexture(G,
!1,f.runtime.linearSampling),f.curFrame===r&&(f.curWebGLTexture=r.webGL_texture),f.type.updateAllCurrentTexture()));0===c&&(f.width=G.width,f.height=G.height,f.set_bbox_changed());f.runtime.redraw=!0;f.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnURLLoaded,f)};"data:"!==I.substr(0,5)&&0===h&&(G.crossOrigin="anonymous");this.runtime.setImageSrc(G,I)};d.prototype.SetCollisions=function(I){this.collisionsEnabled!==(0!==I)&&((this.collisionsEnabled=0!==I)?this.set_bbox_changed():(this.collcells.right>=
this.collcells.left&&this.type.collision_grid.update(this,this.collcells,null),this.collcells.set(0,0,-1,-1)))};C.acts=new d;n.prototype.AnimationFrame=function(I){I.set_int(this.cur_frame)};n.prototype.AnimationFrameCount=function(I){I.set_int(this.cur_animation.frames.length)};n.prototype.AnimationName=function(I){I.set_string(this.cur_animation.name)};n.prototype.AnimationSpeed=function(I){I.set_float(this.animForwards?this.cur_anim_speed:-this.cur_anim_speed)};n.prototype.ImagePointX=function(I,
c){I.set_float(this.getImagePoint(c,!0))};n.prototype.ImagePointY=function(I,c){I.set_float(this.getImagePoint(c,!1))};n.prototype.ImagePointCount=function(I){I.set_int(this.curFrame.image_points.length)};n.prototype.ImageWidth=function(I){I.set_float(this.curFrame.width)};n.prototype.ImageHeight=function(I){I.set_float(this.curFrame.height)};C.exps=new n})();cr.plugins_.TiledBg=function(b){this.runtime=b};
(function(){function b(){}function l(){}function w(){}var D=cr.plugins_.TiledBg.prototype;D.Type=function(L){this.plugin=L;this.runtime=L.runtime};var O=D.Type.prototype;O.onCreate=function(){this.is_family||(this.texture_img=this.runtime.findWaitingTexture(this.texture_file),this.texture_img||(this.texture_img=new Image,this.texture_img.cr_src=this.texture_file,this.texture_img.cr_filesize=this.texture_filesize,this.texture_img.c2webGL_texture=null,this.runtime.waitForImageLoad(this.texture_img,
this.texture_file)),this.webGL_texture=this.pattern=null)};O.onLostWebGLContext=function(){this.is_family||(this.webGL_texture=null)};O.onRestoreWebGLContext=function(){if(!this.is_family&&this.instances.length){this.webGL_texture||(this.webGL_texture=this.runtime.glwrap.loadTexture(this.texture_img,!0,this.runtime.linearSampling,this.texture_pixelformat));var L;var k=0;for(L=this.instances.length;k<L;k++)this.instances[k].webGL_texture=this.webGL_texture}};O.loadTextures=function(){this.is_family||
this.webGL_texture||!this.runtime.glwrap||(this.webGL_texture=this.runtime.glwrap.loadTexture(this.texture_img,!0,this.runtime.linearSampling,this.texture_pixelformat))};O.unloadTextures=function(){this.is_family||this.instances.length||!this.webGL_texture||(this.runtime.glwrap.deleteTexture(this.webGL_texture),this.webGL_texture=null)};O.preloadCanvas2D=function(L){L.drawImage(this.texture_img,0,0)};D.Instance=function(L){this.type=L;this.runtime=L.runtime};O=D.Instance.prototype;O.onCreate=function(){this.visible=
this.properties[0];this.rcTex=new cr.rect(0,0,0,0);this.has_own_texture=!1;this.texture_img=this.type.texture_img;this.runtime.glwrap?(this.type.loadTextures(),this.webGL_texture=this.type.webGL_texture):(this.type.pattern||(this.type.pattern=this.runtime.ctx.createPattern(this.type.texture_img,"repeat")),this.pattern=this.type.pattern)};O.afterLoad=function(){this.has_own_texture=!1;this.texture_img=this.type.texture_img};O.onDestroy=function(){this.runtime.glwrap&&this.has_own_texture&&this.webGL_texture&&
(this.runtime.glwrap.deleteTexture(this.webGL_texture),this.webGL_texture=null)};O.draw=function(L){L.globalAlpha=this.opacity;L.save();L.fillStyle=this.pattern;var k=this.x,a=this.y;this.runtime.pixel_rounding&&(k=Math.round(k),a=Math.round(a));var d=-(this.hotspotX*this.width),n=-(this.hotspotY*this.height),C=d%this.texture_img.width,u=n%this.texture_img.height;0>C&&(C+=this.texture_img.width);0>u&&(u+=this.texture_img.height);L.translate(k,a);L.rotate(this.angle);L.translate(C,u);L.fillRect(d-
C,n-u,this.width,this.height);L.restore()};O.drawGL_earlyZPass=function(L){this.drawGL(L)};O.drawGL=function(L){L.setTexture(this.webGL_texture);L.setOpacity(this.opacity);var k=this.rcTex;k.right=this.width/this.texture_img.width;k.bottom=this.height/this.texture_img.height;var a=this.bquad;if(this.runtime.pixel_rounding){var d=Math.round(this.x)-this.x,n=Math.round(this.y)-this.y;L.quadTex(a.tlx+d,a.tly+n,a.trx+d,a.try_+n,a.brx+d,a.bry+n,a.blx+d,a.bly+n,k)}else L.quadTex(a.tlx,a.tly,a.trx,a.try_,
a.brx,a.bry,a.blx,a.bly,k)};b.prototype.OnURLLoaded=function(){return!0};D.cnds=new b;l.prototype.SetEffect=function(L){this.blend_mode=L;this.compositeOp=cr.effectToCompositeOp(L);cr.setGLBlend(this,L,this.runtime.gl);this.runtime.redraw=!0};l.prototype.LoadURL=function(L,k){var a=new Image,d=this;a.onload=function(){d.texture_img=a;d.runtime.glwrap?(d.has_own_texture&&d.webGL_texture&&d.runtime.glwrap.deleteTexture(d.webGL_texture),d.webGL_texture=d.runtime.glwrap.loadTexture(a,!0,d.runtime.linearSampling)):
d.pattern=d.runtime.ctx.createPattern(a,"repeat");d.has_own_texture=!0;d.runtime.redraw=!0;d.runtime.trigger(cr.plugins_.TiledBg.prototype.cnds.OnURLLoaded,d)};"data:"!==L.substr(0,5)&&0===k&&(a.crossOrigin="anonymous");this.runtime.setImageSrc(a,L)};D.acts=new l;w.prototype.ImageWidth=function(L){L.set_float(this.texture_img.width)};w.prototype.ImageHeight=function(L){L.set_float(this.texture_img.height)};D.exps=new w})();var localForageInitFailed=!1;
try{!function(b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).localforage=b()}(function(){return function O(l,w,D){function L(d,n){if(!w[d]){if(!l[d]){var C="function"==typeof require&&require;if(!n&&C)return C(d,!0);if(k)return k(d,!0);n=Error("Cannot find module '"+d+"'");throw n.code="MODULE_NOT_FOUND",n;}n=w[d]={exports:{}};
l[d][0].call(n.exports,function(u){var E=l[d][1][u];return L(E?E:u)},n,n.exports,O,l,w,D)}return w[d].exports}for(var k="function"==typeof require&&require,a=0;a<D.length;a++)L(D[a]);return L}({1:[function(l,w,D){function O(q,y){q=q||[];y=y||{};try{return new Blob(q,y)}catch(S){if("TypeError"!==S.name)throw S;for(var B=new ("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),K=0;K<q.length;K+=
1)B.append(q[K]);return B.getBlob(y.type)}}function L(q,y){y&&q.then(function(B){y(null,B)},function(B){y(B)})}function k(q,y,B){"function"==typeof y&&q.then(y);"function"==typeof B&&q["catch"](B)}function a(q){return(new h(function(y){var B=q.transaction(G,"readwrite"),K=O([""]);B.objectStore(G).put(K,"key");B.onabort=function(S){S.preventDefault();S.stopPropagation();y(!1)};B.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),P=navigator.userAgent.match(/Edge\//);y(P||!S||43<=
parseInt(S[1],10))}}))["catch"](function(){return!1})}function d(q){return"boolean"==typeof I?h.resolve(I):a(q).then(function(y){return I=y})}function n(q){q=c[q.name];var y={};y.promise=new h(function(B){y.resolve=B});q.deferredOperations.push(y);q.dbReady?q.dbReady=q.dbReady.then(function(){return y.promise}):q.dbReady=y.promise}function C(q,y){return new h(function(B,K){if(q.db){if(!y)return B(q.db);n(q);q.db.close()}var S=[q.name];y&&S.push(q.version);var P=W.open.apply(W,S);y&&(P.onupgradeneeded=
function(Q){var U=P.result;try{U.createObjectStore(q.storeName),1>=Q.oldVersion&&U.createObjectStore(G)}catch(Z){if("ConstraintError"!==Z.name)throw Z;console.warn('The database "'+q.name+'" has been upgraded from version '+Q.oldVersion+" to version "+Q.newVersion+', but the storage "'+q.storeName+'" already exists.')}});P.onerror=function(Q){Q.preventDefault();K(P.error)};P.onsuccess=function(){B(P.result);var Q=c[q.name].deferredOperations.pop();Q&&Q.resolve()}})}function u(q){return new h(function(y,
B){var K=new FileReader;K.onerror=B;K.onloadend=function(S){S=btoa(S.target.result||"");y({__local_forage_encoded_blob:!0,data:S,type:q.type})};K.readAsBinaryString(q)})}function E(q){for(var y=atob(q.data),B=y.length,K=new ArrayBuffer(B),S=new Uint8Array(K),P=0;B>P;P++)S[P]=y.charCodeAt(P);return O([K],{type:q.type})}function N(q){var y=this,B=y._initReady().then(function(){var K=c[y._dbInfo.name];return K&&K.dbReady?K.dbReady:void 0});return k(B,q,q),B}function z(q){var y=.75*q.length;var B=q.length,
K=0;"="===q[q.length-1]&&(y--,"="===q[q.length-2]&&y--);var S=new ArrayBuffer(y),P=new Uint8Array(S);for(y=0;B>y;y+=4){var Q=J.indexOf(q[y]);var U=J.indexOf(q[y+1]);var Z=J.indexOf(q[y+2]);var ba=J.indexOf(q[y+3]);P[K++]=Q<<2|U>>4;P[K++]=(15&U)<<4|Z>>2;P[K++]=(3&Z)<<6|63&ba}return S}function H(q){var y=new Uint8Array(q),B="";for(q=0;q<y.length;q+=3)B+=J[y[q]>>2],B+=J[(3&y[q])<<4|y[q+1]>>4],B+=J[(15&y[q+1])<<2|y[q+2]>>6],B+=J[63&y[q+2]];return 2===y.length%3?B=B.substring(0,B.length-1)+"=":1===y.length%
3&&(B=B.substring(0,B.length-2)+"=="),B}function F(q,y,B,K){var S=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var P=new h(function(Q,U){S.ready().then(function(){void 0===y&&(y=null);var Z=y,ba=S._dbInfo;ba.serializer.serialize(y,function(da,ea){ea?U(ea):ba.db.transaction(function(fa){fa.executeSql("INSERT OR REPLACE INTO "+ba.storeName+" (key, value) VALUES (?, ?)",[q,da],function(){Q(Z)},function(ha,ia){U(ia)})},function(fa){if(fa.code===fa.QUOTA_ERR){if(0<
K)return void Q(F.apply(S,[q,Z,B,K-1]));U(fa)}})})})["catch"](U)});return L(P,B),P}function g(q,y){q[y]=function(){var B=arguments;return q.ready().then(function(){return q[y].apply(q,B)})}}function p(){for(var q=1;q<arguments.length;q++){var y=arguments[q];if(y)for(var B in y)y.hasOwnProperty(B)&&(v(y[B])?arguments[0][B]=y[B].slice():arguments[0][B]=y[B])}return arguments[0]}function A(q){for(var y in R)if(R.hasOwnProperty(y)&&R[y]===q)return!0;return!1}var T="function"==typeof Symbol&&"symbol"==
typeof Symbol.iterator?function(q){return typeof q}:function(q){return q&&"function"==typeof Symbol&&q.constructor===Symbol?"symbol":typeof q},W=function(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}();"undefined"==typeof Promise&&l("lie/polyfill");var I,c,h=Promise,G="local-forage-detect-blob-support",
f=Object.prototype.toString,r={_driver:"asyncStorage",_initStorage:function(q){function y(){return h.resolve()}var B=this,K={db:null};if(q)for(var S in q)K[S]=q[S];c||(c={});var P=c[K.name];P||(P={forages:[],db:null,dbReady:null,deferredOperations:[]},c[K.name]=P);P.forages.push(B);B._initReady||(B._initReady=B.ready,B.ready=N);q=[];for(S=0;S<P.forages.length;S++){var Q=P.forages[S];Q!==B&&q.push(Q._initReady()["catch"](y))}var U=P.forages.slice(0);return h.all(q).then(function(){return K.db=P.db,
C(K,!1)}).then(function(Z){K.db=Z;var ba=B._defaultConfig.version;if(K.db){var da=!K.db.objectStoreNames.contains(K.storeName),ea=K.version>K.db.version;(K.version<K.db.version&&(K.version!==ba&&console.warn('The database "'+K.name+"\" can't be downgraded from version "+K.db.version+" to version "+K.version+"."),K.version=K.db.version),ea||da)?(da&&(ba=K.db.version+1,ba>K.version&&(K.version=ba)),ba=!0):ba=!1}else ba=!0;return ba?C(K,!0):Z}).then(function(Z){K.db=P.db=Z;B._dbInfo=K;for(Z=0;Z<U.length;Z++){var ba=
U[Z];ba!==B&&(ba._dbInfo.db=K.db,ba._dbInfo.version=K.version)}})},iterate:function(q,y){var B=this,K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo,U=Q.db.transaction(Q.storeName,"readonly").objectStore(Q.storeName).openCursor(),Z=1;U.onsuccess=function(){var ba=U.result;if(ba){var da=ba.value;da&&da.__local_forage_encoded_blob&&(da=E(da));da=q(da,ba.key,Z++);void 0!==da?S(da):ba["continue"]()}else S()};U.onerror=function(){P(U.error)}})["catch"](P)});return L(K,y),K},getItem:function(q,
y){var B=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo,U=Q.db.transaction(Q.storeName,"readonly").objectStore(Q.storeName).get(q);U.onsuccess=function(){var Z=U.result;void 0===Z&&(Z=null);Z&&Z.__local_forage_encoded_blob&&(Z=E(Z));S(Z)};U.onerror=function(){P(U.error)}})["catch"](P)});return L(K,y),K},setItem:function(q,y,B){var K=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),
q=String(q));var S=new h(function(P,Q){var U;K.ready().then(function(){return U=K._dbInfo,"[object Blob]"===f.call(y)?d(U.db).then(function(Z){return Z?y:u(y)}):y}).then(function(Z){var ba=U.db.transaction(U.storeName,"readwrite"),da=ba.objectStore(U.storeName).put(Z,q);null===Z&&(Z=void 0);ba.oncomplete=function(){void 0===Z&&(Z=null);P(Z)};ba.onabort=ba.onerror=function(){Q(da.error?da.error:da.transaction.error)}})["catch"](Q)});return L(S,B),S},removeItem:function(q,y){var B=this;"string"!=typeof q&&
(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo,U=Q.db.transaction(Q.storeName,"readwrite"),Z=U.objectStore(Q.storeName)["delete"](q);U.oncomplete=function(){S()};U.onerror=function(){P(Z.error)};U.onabort=function(){P(Z.error?Z.error:Z.transaction.error)}})["catch"](P)});return L(K,y),K},clear:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo,Q=P.db.transaction(P.storeName,
"readwrite"),U=Q.objectStore(P.storeName).clear();Q.oncomplete=function(){K()};Q.onabort=Q.onerror=function(){S(U.error?U.error:U.transaction.error)}})["catch"](S)});return L(B,q),B},length:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo,Q=P.db.transaction(P.storeName,"readonly").objectStore(P.storeName).count();Q.onsuccess=function(){K(Q.result)};Q.onerror=function(){S(Q.error)}})["catch"](S)});return L(B,q),B},key:function(q,y){var B=this,K=new h(function(S,
P){return 0>q?void S(null):void B.ready().then(function(){var Q=B._dbInfo,U=!1,Z=Q.db.transaction(Q.storeName,"readonly").objectStore(Q.storeName).openCursor();Z.onsuccess=function(){var ba=Z.result;return ba?void(0===q?S(ba.key):U?S(ba.key):(U=!0,ba.advance(q))):void S(null)};Z.onerror=function(){P(Z.error)}})["catch"](P)});return L(K,y),K},keys:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo,Q=P.db.transaction(P.storeName,"readonly").objectStore(P.storeName).openCursor(),
U=[];Q.onsuccess=function(){var Z=Q.result;return Z?(U.push(Z.key),void Z["continue"]()):void K(U)};Q.onerror=function(){S(Q.error)}})["catch"](S)});return L(B,q),B}},J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M=/^~~local_forage_type~([^~]+)~/,V=Object.prototype.toString,X={serialize:function(q,y){var B="";if(q&&(B=V.call(q)),q&&("[object ArrayBuffer]"===B||q.buffer&&"[object ArrayBuffer]"===V.call(q.buffer))){var K,S="__lfsc__:";q instanceof ArrayBuffer?(K=q,S+="arbf"):
(K=q.buffer,"[object Int8Array]"===B?S+="si08":"[object Uint8Array]"===B?S+="ui08":"[object Uint8ClampedArray]"===B?S+="uic8":"[object Int16Array]"===B?S+="si16":"[object Uint16Array]"===B?S+="ur16":"[object Int32Array]"===B?S+="si32":"[object Uint32Array]"===B?S+="ui32":"[object Float32Array]"===B?S+="fl32":"[object Float64Array]"===B?S+="fl64":y(Error("Failed to get type for BinaryArray")));y(S+H(K))}else if("[object Blob]"===B)B=new FileReader,B.onload=function(){var P="~~local_forage_type~"+q.type+
"~"+H(this.result);y("__lfsc__:blob"+P)},B.readAsArrayBuffer(q);else try{y(JSON.stringify(q))}catch(P){console.error("Couldn't convert value into a JSON string: ",q),y(null,P)}},deserialize:function(q){if("__lfsc__:"!==q.substring(0,9))return JSON.parse(q);var y=q.substring(13);q=q.substring(9,13);if("blob"===q&&M.test(y)){var B=y.match(M);var K=B[1];y=y.substring(B[0].length)}y=z(y);switch(q){case "arbf":return y;case "blob":return O([y],{type:K});case "si08":return new Int8Array(y);case "ui08":return new Uint8Array(y);
case "uic8":return new Uint8ClampedArray(y);case "si16":return new Int16Array(y);case "ur16":return new Uint16Array(y);case "si32":return new Int32Array(y);case "ui32":return new Uint32Array(y);case "fl32":return new Float32Array(y);case "fl64":return new Float64Array(y);default:throw Error("Unkown type: "+q);}},stringToBuffer:z,bufferToString:H},aa={_driver:"webSQLStorage",_initStorage:function(q){var y=this,B={db:null};if(q)for(var K in q)B[K]="string"!=typeof q[K]?q[K].toString():q[K];q=new h(function(S,
P){try{B.db=openDatabase(B.name,String(B.version),B.description,B.size)}catch(Q){return P(Q)}B.db.transaction(function(Q){Q.executeSql("CREATE TABLE IF NOT EXISTS "+B.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){y._dbInfo=B;S()},function(U,Z){P(Z)})})});return B.serializer=X,q},iterate:function(q,y){var B=this,K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo;Q.db.transaction(function(U){U.executeSql("SELECT * FROM "+Q.storeName,[],function(Z,ba){Z=ba.rows;
ba=Z.length;for(var da=0;ba>da;da++){var ea=Z.item(da),fa=ea.value;if(fa&&(fa=Q.serializer.deserialize(fa)),fa=q(fa,ea.key,da+1),void 0!==fa)return void S(fa)}S()},function(Z,ba){P(ba)})})})["catch"](P)});return L(K,y),K},getItem:function(q,y){var B=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo;Q.db.transaction(function(U){U.executeSql("SELECT * FROM "+Q.storeName+" WHERE key = ? LIMIT 1",
[q],function(Z,ba){(Z=ba.rows.length?ba.rows.item(0).value:null)&&(Z=Q.serializer.deserialize(Z));S(Z)},function(Z,ba){P(ba)})})})["catch"](P)});return L(K,y),K},setItem:function(q,y,B){return F.apply(this,[q,y,B,1])},removeItem:function(q,y){var B=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo;Q.db.transaction(function(U){U.executeSql("DELETE FROM "+Q.storeName+" WHERE key = ?",[q],
function(){S()},function(Z,ba){P(ba)})})})["catch"](P)});return L(K,y),K},clear:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo;P.db.transaction(function(Q){Q.executeSql("DELETE FROM "+P.storeName,[],function(){K()},function(U,Z){S(Z)})})})["catch"](S)});return L(B,q),B},length:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo;P.db.transaction(function(Q){Q.executeSql("SELECT COUNT(key) as c FROM "+P.storeName,[],function(U,
Z){U=Z.rows.item(0).c;K(U)},function(U,Z){S(Z)})})})["catch"](S)});return L(B,q),B},key:function(q,y){var B=this,K=new h(function(S,P){B.ready().then(function(){var Q=B._dbInfo;Q.db.transaction(function(U){U.executeSql("SELECT key FROM "+Q.storeName+" WHERE id = ? LIMIT 1",[q+1],function(Z,ba){Z=ba.rows.length?ba.rows.item(0).key:null;S(Z)},function(Z,ba){P(ba)})})})["catch"](P)});return L(K,y),K},keys:function(q){var y=this,B=new h(function(K,S){y.ready().then(function(){var P=y._dbInfo;P.db.transaction(function(Q){Q.executeSql("SELECT key FROM "+
P.storeName,[],function(U,Z){U=[];for(var ba=0;ba<Z.rows.length;ba++)U.push(Z.rows.item(ba).key);K(U)},function(U,Z){S(Z)})})})["catch"](S)});return L(B,q),B}},Y={_driver:"localStorageWrapper",_initStorage:function(q){var y={};if(q)for(var B in q)y[B]=q[B];return y.keyPrefix=y.name+"/",y.storeName!==this._defaultConfig.storeName&&(y.keyPrefix+=y.storeName+"/"),this._dbInfo=y,y.serializer=X,h.resolve()},iterate:function(q,y){var B=this,K=B.ready().then(function(){for(var S=B._dbInfo,P=S.keyPrefix,
Q=P.length,U=localStorage.length,Z=1,ba=0;U>ba;ba++){var da=localStorage.key(ba);if(0===da.indexOf(P)){var ea=localStorage.getItem(da);if(ea&&(ea=S.serializer.deserialize(ea)),ea=q(ea,da.substring(Q),Z++),void 0!==ea)return ea}}});return L(K,y),K},getItem:function(q,y){var B=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=B.ready().then(function(){var S=B._dbInfo,P=localStorage.getItem(S.keyPrefix+q);return P&&(P=S.serializer.deserialize(P)),
P});return L(K,y),K},setItem:function(q,y,B){var K=this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var S=K.ready().then(function(){void 0===y&&(y=null);var P=y;return new h(function(Q,U){var Z=K._dbInfo;Z.serializer.serialize(y,function(ba,da){if(da)U(da);else try{localStorage.setItem(Z.keyPrefix+q,ba),Q(P)}catch(ea){"QuotaExceededError"!==ea.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==ea.name||U(ea),U(ea)}})})});return L(S,B),S},removeItem:function(q,y){var B=
this;"string"!=typeof q&&(console.warn(q+" used as a key, but it is not a string."),q=String(q));var K=B.ready().then(function(){localStorage.removeItem(B._dbInfo.keyPrefix+q)});return L(K,y),K},clear:function(q){var y=this,B=y.ready().then(function(){for(var K=y._dbInfo.keyPrefix,S=localStorage.length-1;0<=S;S--){var P=localStorage.key(S);0===P.indexOf(K)&&localStorage.removeItem(P)}});return L(B,q),B},length:function(q){var y=this.keys().then(function(B){return B.length});return L(y,q),y},key:function(q,
y){var B=this,K=B.ready().then(function(){var S=B._dbInfo;try{var P=localStorage.key(q)}catch(Q){P=null}return P&&(P=P.substring(S.keyPrefix.length)),P});return L(K,y),K},keys:function(q){var y=this,B=y.ready().then(function(){for(var K=y._dbInfo,S=localStorage.length,P=[],Q=0;S>Q;Q++)0===localStorage.key(Q).indexOf(K.keyPrefix)&&P.push(localStorage.key(Q).substring(K.keyPrefix.length));return P});return L(B,q),B}},ca={},R={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},
e="clear getItem iterate key keys length removeItem setItem".split(" "),m={description:"",driver:[R.INDEXEDDB,R.WEBSQL,R.LOCALSTORAGE].slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},x={};x[R.INDEXEDDB]=function(){try{if(!W)return!1;var q="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),y="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");
return(!q||y)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(B){return!1}}();x[R.WEBSQL]="function"==typeof openDatabase;l=R.LOCALSTORAGE;try{var t="undefined"!=typeof localStorage&&"setItem"in localStorage&&localStorage.setItem}catch(q){t=!1}x[l]=t;var v=Array.isArray||function(q){return"[object Array]"===Object.prototype.toString.call(q)};t=new (function(){function q(y){if(!(this instanceof q))throw new TypeError("Cannot call a class as a function");this.INDEXEDDB=R.INDEXEDDB;
this.LOCALSTORAGE=R.LOCALSTORAGE;this.WEBSQL=R.WEBSQL;this._defaultConfig=p({},m);this._config=p({},this._defaultConfig,y);this._initDriver=this._driverSet=null;this._ready=!1;this._dbInfo=null;this._wrapLibraryMethodsWithReady();this.setDriver(this._config.driver)["catch"](function(){})}return q.prototype.config=function(y){if("object"===("undefined"==typeof y?"undefined":T(y))){if(this._ready)return Error("Can't call config() after localforage has been used.");for(var B in y){if("storeName"===B&&
(y[B]=y[B].replace(/\W/g,"_")),"version"===B&&"number"!=typeof y[B])return Error("Database version must be a number.");this._config[B]=y[B]}return"driver"in y&&y.driver?this.setDriver(this._config.driver):!0}return"string"==typeof y?this._config[y]:this._config},q.prototype.defineDriver=function(y,B,K){var S=new h(function(P,Q){try{var U=y._driver,Z=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),ba=Error("Custom driver name already in use: "+y._driver);
if(!y._driver)return void Q(Z);if(A(y._driver))return void Q(ba);var da=e.concat("_initStorage");for(ba=0;ba<da.length;ba++){var ea=da[ba];if(!ea||!y[ea]||"function"!=typeof y[ea])return void Q(Z)}var fa=h.resolve(!0);"_support"in y&&(fa=y._support&&"function"==typeof y._support?y._support():h.resolve(!!y._support));fa.then(function(ha){x[U]=ha;ca[U]=y;P()},Q)}catch(ha){Q(ha)}});return k(S,B,K),S},q.prototype.driver=function(){return this._driver||null},q.prototype.getDriver=function(y,B,K){var S=
this,P=h.resolve().then(function(){if(!A(y)){if(ca[y])return ca[y];throw Error("Driver not found.");}switch(y){case S.INDEXEDDB:return r;case S.LOCALSTORAGE:return Y;case S.WEBSQL:return aa}});return k(P,B,K),P},q.prototype.getSerializer=function(y){var B=h.resolve(X);return k(B,y),B},q.prototype.ready=function(y){var B=this,K=B._driverSet.then(function(){return null===B._ready&&(B._ready=B._initDriver()),B._ready});return k(K,y,y),K},q.prototype.setDriver=function(y,B,K){function S(){U._config.driver=
U.driver()}function P(ba){return U._extend(ba),S(),U._ready=U._initStorage(U._config),U._ready}function Q(ba){return function(){function da(){for(;ea<ba.length;){var fa=ba[ea];return ea++,U._dbInfo=null,U._ready=null,U.getDriver(fa).then(P)["catch"](da)}S();return U._driverSet=h.reject(Error("No available storage method found.")),U._driverSet}var ea=0;return da()}}var U=this;v(y)||(y=[y]);var Z=this._getSupportedDrivers(y);return this._driverSet=(null!==this._driverSet?this._driverSet["catch"](function(){return h.resolve()}):
h.resolve()).then(function(){var ba=Z[0];return U._dbInfo=null,U._ready=null,U.getDriver(ba).then(function(da){U._driver=da._driver;S();U._wrapLibraryMethodsWithReady();U._initDriver=Q(Z)})})["catch"](function(){S();return U._driverSet=h.reject(Error("No available storage method found.")),U._driverSet}),k(this._driverSet,B,K),this._driverSet},q.prototype.supports=function(y){return!!x[y]},q.prototype._extend=function(y){p(this,y)},q.prototype._getSupportedDrivers=function(y){for(var B=[],K=0,S=y.length;S>
K;K++){var P=y[K];this.supports(P)&&B.push(P)}return B},q.prototype._wrapLibraryMethodsWithReady=function(){for(var y=0;y<e.length;y++)g(this,e[y])},q.prototype.createInstance=function(y){return new q(y)},q}());w.exports=t},{undefined:void 0}]},{},[1])(1)})}catch(b){localForageInitFailed=!0}cr.plugins_.LocalStorage=function(b){this.runtime=b};
(function(){function b(z){return z?"string"===typeof z?z:"string"===typeof z.message?z.message:"string"===typeof z.name?z.name:"string"===typeof z.data?z.data:"unknown error":"unknown error"}function l(z,H){n=H;z.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,z)}function w(z){if(!C)return z;if(C?z.substr(0,C.length)===C:1)return z.substr(C.length)}function D(){}function O(){}function L(){}var k="",a="",d=[],n="",C="",u="undefined"!==typeof window.is_scirra_arcade;u&&(C="sa"+window.scirra_arcade_id+
"_");var E=cr.plugins_.LocalStorage.prototype;E.Type=function(z){this.plugin=z;this.runtime=z.runtime};E.Type.prototype.onCreate=function(){};E.Instance=function(z){this.type=z;this.runtime=z.runtime};var N=E.Instance.prototype;N.onCreate=function(){this.pendingGets=this.pendingSets=0};N.onDestroy=function(){};N.saveToJSON=function(){return{}};N.loadFromJSON=function(z){};D.prototype.OnItemSet=function(z){return k===z};D.prototype.OnAnyItemSet=function(){return!0};D.prototype.OnItemGet=function(z){return k===
z};D.prototype.OnAnyItemGet=function(){return!0};D.prototype.OnItemRemoved=function(z){return k===z};D.prototype.OnAnyItemRemoved=function(){return!0};D.prototype.OnCleared=function(){return!0};D.prototype.OnAllKeyNamesLoaded=function(){return!0};D.prototype.OnError=function(){return!0};D.prototype.OnItemExists=function(z){return k===z};D.prototype.OnItemMissing=function(z){return k===z};D.prototype.CompareKey=function(z,H){return cr.do_cmp(k,z,H)};D.prototype.CompareValue=function(z,H){return cr.do_cmp(a,
z,H)};D.prototype.IsProcessingSets=function(){return 0<this.pendingSets};D.prototype.IsProcessingGets=function(){return 0<this.pendingGets};D.prototype.OnAllSetsComplete=function(){return!0};D.prototype.OnAllGetsComplete=function(){return!0};E.cnds=new D;O.prototype.SetItem=function(z,H){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");else{var F=C+z;this.pendingSets++;var g=this;localforage.setItem(F,H,function(p,A){g.pendingSets--;p?(n=b(p),g.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,
g)):(k=z,a=A,g.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemSet,g),g.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemSet,g),a=k="");0===g.pendingSets&&g.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllSetsComplete,g)})}};O.prototype.GetItem=function(z){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");else{var H=C+z;this.pendingGets++;var F=this;localforage.getItem(H,function(g,p){F.pendingGets--;if(g)n=
b(g),F.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,F);else{k=z;a=p;if("undefined"===typeof a||null===a)a="";F.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemGet,F);F.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemGet,F);a=k=""}0===F.pendingGets&&F.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllGetsComplete,F)})}};O.prototype.CheckItemExists=function(z){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");
else{var H=this;localforage.getItem(C+z,function(F,g){F?(n=b(F),H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,H)):(k=z,null===g?(a="",H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemMissing,H)):(a=g,H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemExists,H)),a=k="")})}};O.prototype.RemoveItem=function(z){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");else{var H=this;localforage.removeItem(C+z,
function(F){F?(n=b(F),H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,H)):(k=z,a="",H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemRemoved,H),H.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemRemoved,H),k="")})}};O.prototype.ClearStorage=function(){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");else if(!u){var z=this;localforage.clear(function(H){H?(n=b(H),z.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,
z)):(a=k="",cr.clearArray(d),z.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnCleared,z))})}};O.prototype.GetAllKeyNames=function(){if(localForageInitFailed)l(this,"storage failed to initialise - may be disabled in browser settings");else{var z=this;localforage.keys(function(H,F){var g;if(H)n=b(H),z.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError,z);else{cr.clearArray(d);H=0;for(g=F.length;H<g;++H){var p=F[H];(C?p.substr(0,C.length)===C:1)&&d.push(w(p))}z.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllKeyNamesLoaded,
z)}})}};E.acts=new O;L.prototype.ItemValue=function(z){z.set_any(a)};L.prototype.Key=function(z){z.set_string(k)};L.prototype.KeyCount=function(z){z.set_int(d.length)};L.prototype.KeyAt=function(z,H){H=Math.floor(H);0>H||H>=d.length?z.set_string(""):z.set_string(d[H])};L.prototype.ErrorMessage=function(z){z.set_string(n)};E.exps=new L})();
cr.plugins_.XML=function(b){this.runtime=b;this.runtime.isIE&&(b={},window.XPathResult=b,b.NUMBER_TYPE=1,b.STRING_TYPE=2,b.UNORDERED_NODE_SNAPSHOT_TYPE=6,b.ORDERED_NODE_SNAPSHOT_TYPE=7)};
(function(){function b(){}function l(){}function w(){}var D=cr.plugins_.XML.prototype;D.Type=function(L){this.plugin=L;this.runtime=L.runtime};D.Type.prototype.onCreate=function(){};D.Instance=function(L){this.type=L;this.runtime=L.runtime};var O=D.Instance.prototype;O.onCreate=function(){this.xmlDoc=null;this.nodeStack=[]};O.xpath_eval_one=function(L,k){if(this.xmlDoc){var a=this.nodeStack.length?this.nodeStack[this.nodeStack.length-1]:this.xmlDoc.documentElement;try{return this.runtime.isIE?a.selectSingleNode(L):
this.xmlDoc.evaluate(L,a,null,k,null)}catch(d){return null}}};O.xpath_eval_many=function(L,k){if(this.xmlDoc){var a=this.nodeStack.length?this.nodeStack[this.nodeStack.length-1]:this.xmlDoc.documentElement;try{return this.runtime.isIE?a.selectNodes(L):this.xmlDoc.evaluate(L,a,null,k,null)}catch(d){return null}}};O.doForEachIteration=function(L,k){this.nodeStack.push(k);this.runtime.pushCopySol(L.solModifiers);L.retrigger();this.runtime.popSol(L.solModifiers);this.nodeStack.pop()};b.prototype.ForEach=
function(L){var k=this.runtime.getCurrentEventStack().current_event;L=this.xpath_eval_many(L,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);var a;if(L){var d=this.runtime.pushLoopStack();if(this.runtime.isIE){var n=0;for(a=L.length;n<a;n++)d.index=n,this.doForEachIteration(k,L[n])}else for(n=0,a=L.snapshotLength;n<a;n++)d.index=n,this.doForEachIteration(k,L.snapshotItem(n));this.runtime.popLoopStack()}return!1};D.cnds=new b;l.prototype.Load=function(L){var k=!("undefined"===typeof window.c2isWindows8||!window.c2isWindows8);
try{if(k){var a=new Windows.Data.Xml.Dom.XmlDocument;a.loadXml(L)}else if(this.runtime.isIE){var d=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument"];for(var n=0;3>n;n++)try{a=new ActiveXObject(d[n]);break}catch(C){a=null}a&&(a.async="false",a.loadXML(L))}else d=new DOMParser,a=d.parseFromString(L,"text/xml")}catch(C){a=null}a&&(this.xmlDoc=a,this.runtime.isIE&&!k&&this.xmlDoc.setProperty("SelectionLanguage","XPath"))};D.acts=new l;w.prototype.NumberValue=function(L,k){(k=this.xpath_eval_one(k,
XPathResult.NUMBER_TYPE))?this.runtime.isIE?L.set_int(parseInt(k.nodeValue,10)):L.set_int(k.numberValue||0):L.set_int(0)};w.prototype.StringValue=function(L,k){if(/firefox/i.test(navigator.userAgent))if(k=this.xpath_eval_one(k,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE)){var a,d="";var n=0;for(a=k.snapshotLength;n<a;n++)d+=k.snapshotItem(n).textContent;L.set_string(d)}else L.set_string("");else(k=this.xpath_eval_one(k,XPathResult.STRING_TYPE))?this.runtime.isIE?L.set_string(k.nodeValue||k.nodeTypedValue||
""):L.set_string(k.stringValue||""):L.set_string("")};w.prototype.NodeCount=function(L,k){(k=this.xpath_eval_many(k,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE))?this.runtime.isIE?L.set_int(k.length||0):L.set_int(k.snapshotLength||0):L.set_int(0)};D.exps=new w})();cr.plugins_.Browser=function(b){this.runtime=b};
(function(){function b(){d&&n&&window.OfflineClientInfo&&window.OfflineClientInfo.SetMessageCallback(function(F){C.onSWMessage(F)})}function l(){if(!E&&navigator.getBattery){var F=navigator.getBattery();E=!0;F&&F.then(function(g){u=g})}}function w(){}function D(){}function O(F){console&&console.warn&&console.warn("Fullscreen request failed: ",F);z.setSize(window.innerWidth,window.innerHeight)}function L(){}var k=cr.plugins_.Browser.prototype;k.Type=function(F){this.plugin=F;this.runtime=F.runtime};
var a=k.Type.prototype;a.onCreate=function(){};var d=!1,n=!1;document.addEventListener("DOMContentLoaded",function(){if(window.C3_RegisterSW&&navigator.serviceWorker){var F=document.createElement("script");F.onload=function(){d=!0;b()};F.src="offlineclient.js";document.head.appendChild(F)}});var C=null;a.onAppBegin=function(){n=!0;b()};k.Instance=function(F){this.type=F;this.runtime=F.runtime};a=k.Instance.prototype;a.onCreate=function(){var F=this;window.addEventListener("resize",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnResize,
F)});C=this;"undefined"!==typeof navigator.onLine&&(window.addEventListener("online",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOnline,F)}),window.addEventListener("offline",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOffline,F)}));document.addEventListener("backbutton",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton,F)});document.addEventListener("menubutton",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnMenuButton,
F)});document.addEventListener("searchbutton",function(){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnSearchButton,F)});document.addEventListener("tizenhwkey",function(g){switch(g.keyName){case "back":var p=F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton,F);!p&&window.tizen&&window.tizen.application.getCurrentApplication().exit();break;case "menu":(p=F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnMenuButton,F))||g.preventDefault()}});this.runtime.isWindows10&&"undefined"!==
typeof Windows?Windows.UI.Core.SystemNavigationManager.getForCurrentView().addEventListener("backrequested",function(g){F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton,F)&&(g.handled=!0)}):this.runtime.isWinJS&&WinJS.Application&&(WinJS.Application.onbackclick=function(g){return!!F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton,F)});this.runtime.addSuspendCallback(function(g){g?F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnPageHidden,F):F.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnPageVisible,
F)});this.is_arcade="undefined"!==typeof window.is_scirra_arcade};a.onSWMessage=function(F){F=F.data.type;"downloading-update"===F?this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateFound,this):"update-ready"===F||"update-pending"===F?this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateReady,this):"offline-ready"===F&&this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOfflineReady,this)};var u=null,E=!1;w.prototype.CookiesEnabled=function(){return navigator?navigator.cookieEnabled:
!1};w.prototype.IsOnline=function(){return navigator?navigator.onLine:!1};w.prototype.HasJava=function(){return navigator?navigator.javaEnabled():!1};w.prototype.OnOnline=function(){return!0};w.prototype.OnOffline=function(){return!0};w.prototype.IsDownloadingUpdate=function(){return!1};w.prototype.PageVisible=function(){return!this.runtime.isSuspended};w.prototype.OnPageVisible=function(){return!0};w.prototype.OnPageHidden=function(){return!0};w.prototype.OnResize=function(){return!0};w.prototype.IsFullscreen=
function(){return!!(document.mozFullScreen||document.webkitIsFullScreen||document.fullScreen)};w.prototype.OnBackButton=function(){return!0};w.prototype.OnMenuButton=function(){return!0};w.prototype.OnSearchButton=function(){return!0};w.prototype.IsMetered=function(){var F=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return F?!!F.metered:!1};w.prototype.IsCharging=function(){var F=navigator.battery||navigator.mozBattery||navigator.webkitBattery;if(F)return!!F.charging;
l();return u?!!u.charging:!0};w.prototype.IsPortraitLandscape=function(F){return(window.innerWidth<=window.innerHeight?0:1)===F};w.prototype.SupportsFullscreen=function(){if(this.runtime.isNWjs)return!0;var F=this.runtime.canvas;return!!(F.requestFullscreen||F.mozRequestFullScreen||F.msRequestFullscreen||F.webkitRequestFullScreen)};w.prototype.OnUpdateFound=function(){return!0};w.prototype.OnUpdateReady=function(){return!0};w.prototype.OnOfflineReady=function(){return!0};k.cnds=new w;D.prototype.Alert=
function(F){alert(F.toString())};D.prototype.Close=function(){window.tizen?window.tizen.application.getCurrentApplication().exit():navigator.app&&navigator.app.exitApp?navigator.app.exitApp():navigator.device&&navigator.device.exitApp?navigator.device.exitApp():this.is_arcade||window.close()};D.prototype.Focus=function(){this.runtime.isNWjs?nw.Window.get().focus():this.is_arcade||window.focus()};D.prototype.Blur=function(){this.runtime.isNWjs?nw.Window.get().blur():this.is_arcade||window.blur()};
D.prototype.GoBack=function(){navigator.app&&navigator.app.backHistory?navigator.app.backHistory():!this.is_arcade&&window.back&&window.back()};D.prototype.GoForward=function(){!this.is_arcade&&window.forward&&window.forward()};D.prototype.GoHome=function(){!this.is_arcade&&window.home&&window.home()};D.prototype.GoToURL=function(F,g){this.runtime.isWinJS?Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri(F)):navigator.app&&navigator.app.loadUrl?navigator.app.loadUrl(F,{openExternal:!0}):
this.runtime.isCordova?window.open(F,"_system"):this.runtime.isPreview?window.open(F,"_blank"):this.is_arcade||(2!==g||this.is_arcade?1!==g||this.is_arcade?window.location=F:window.parent.location=F:window.top.location=F)};D.prototype.GoToURLWindow=function(F,g){this.runtime.isWinJS?Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri(F)):navigator.app&&navigator.app.loadUrl?navigator.app.loadUrl(F,{openExternal:!0}):this.runtime.isCordova?window.open(F,"_system"):this.is_arcade||window.open(F,
g)};D.prototype.Reload=function(){this.is_arcade||window.location.reload()};var N=!0,z=null;D.prototype.RequestFullScreen=function(F,g){2<=F&&(F+=1);6===F&&(F=2);document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement||document.fullScreen||document.fullScreenElement||(this.runtime.fullscreen_scaling=2<=F?F:0,F={navigationUI:"auto"},1===g?F.navigationUI="hide":2===g&&(F.navigationUI="show"),g=document.documentElement,N&&(N=!1,z=this.runtime,g.addEventListener("mozfullscreenerror",
O),g.addEventListener("webkitfullscreenerror",O),g.addEventListener("MSFullscreenError",O),g.addEventListener("fullscreenerror",O)),g.requestFullscreen?g.requestFullscreen(F):g.mozRequestFullScreen?g.mozRequestFullScreen(F):g.msRequestFullscreen?g.msRequestFullscreen(F):g.webkitRequestFullScreen&&("undefined"!==typeof Element&&"undefined"!==typeof Element.ALLOW_KEYBOARD_INPUT?g.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):g.webkitRequestFullScreen()))};D.prototype.CancelFullScreen=function(){document.exitFullscreen?
document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()};D.prototype.Vibrate=function(F){try{var g=F.split(","),p;var A=0;for(p=g.length;A<p;A++)g[A]=parseInt(g[A],10);navigator.vibrate?navigator.vibrate(g):navigator.mozVibrate?navigator.mozVibrate(g):navigator.webkitVibrate?navigator.webkitVibrate(g):navigator.msVibrate&&navigator.msVibrate(g)}catch(T){}};
D.prototype.InvokeDownload=function(F,g){if(g){var p=document.createElement("a");if("undefined"===typeof p.download)window.open(F);else{var A=document.getElementsByTagName("body")[0];p.textContent=g;p.href=F;p.download=g;A.appendChild(p);F=new MouseEvent("click");p.dispatchEvent(F);A.removeChild(p)}}};D.prototype.InvokeDownloadString=function(F,g,p){if(p){var A="data:"+g+","+encodeURIComponent(F);F=document.createElement("a");"undefined"===typeof F.download?window.open(A):(g=document.getElementsByTagName("body")[0],
F.textContent=p,F.href=A,F.download=p,g.appendChild(F),p=new MouseEvent("click"),F.dispatchEvent(p),g.removeChild(F))}};D.prototype.ConsoleLog=function(F,g){"undefined"!==typeof console&&(0===F&&console.log&&console.log(g.toString()),1===F&&console.warn&&console.warn(g.toString()),2===F&&console.error&&console.error(g.toString()))};D.prototype.ConsoleGroup=function(F){console&&console.group&&console.group(F)};D.prototype.ConsoleGroupEnd=function(){console&&console.groupEnd&&console.groupEnd()};D.prototype.ExecJs=
function(F){try{eval&&eval(F)}catch(g){console&&console.error&&console.error("Error executing Javascript: ",g)}};var H="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");D.prototype.LockOrientation=function(F){F=Math.floor(F);0>F||F>=H.length||(this.runtime.autoLockOrientation=!1,F=H[F],screen.orientation&&screen.orientation.lock?screen.orientation.lock(F):screen.lockOrientation?screen.lockOrientation(F):screen.webkitLockOrientation?screen.webkitLockOrientation(F):
screen.mozLockOrientation?screen.mozLockOrientation(F):screen.msLockOrientation&&screen.msLockOrientation(F))};D.prototype.UnlockOrientation=function(){this.runtime.autoLockOrientation=!1;screen.orientation&&screen.orientation.unlock?screen.orientation.unlock():screen.unlockOrientation?screen.unlockOrientation():screen.webkitUnlockOrientation?screen.webkitUnlockOrientation():screen.mozUnlockOrientation?screen.mozUnlockOrientation():screen.msUnlockOrientation&&screen.msUnlockOrientation()};k.acts=
new D;L.prototype.URL=function(F){F.set_string(window.location.toString())};L.prototype.Protocol=function(F){F.set_string(window.location.protocol)};L.prototype.Domain=function(F){F.set_string(window.location.hostname)};L.prototype.PathName=function(F){F.set_string(window.location.pathname)};L.prototype.Hash=function(F){F.set_string(window.location.hash)};L.prototype.Referrer=function(F){F.set_string(document.referrer)};L.prototype.Title=function(F){F.set_string(document.title)};L.prototype.Name=
function(F){F.set_string(navigator.appName)};L.prototype.Version=function(F){F.set_string(navigator.appVersion)};L.prototype.Language=function(F){navigator&&navigator.language?F.set_string(navigator.language):F.set_string("")};L.prototype.Platform=function(F){F.set_string(navigator.platform)};L.prototype.Product=function(F){navigator&&navigator.product?F.set_string(navigator.product):F.set_string("")};L.prototype.Vendor=function(F){navigator&&navigator.vendor?F.set_string(navigator.vendor):F.set_string("")};
L.prototype.UserAgent=function(F){F.set_string(navigator.userAgent)};L.prototype.QueryString=function(F){F.set_string(window.location.search)};L.prototype.QueryParam=function(F,g){(g=RegExp("[?&]"+g+"=([^&]*)").exec(window.location.search))?F.set_string(decodeURIComponent(g[1].replace(/\+/g," "))):F.set_string("")};L.prototype.Bandwidth=function(F){var g=navigator.connection||navigator.mozConnection||navigator.webkitConnection;g?"undefined"!==typeof g.bandwidth?F.set_float(g.bandwidth):"undefined"!==
typeof g.downlinkMax?F.set_float(g.downlinkMax):F.set_float(Number.POSITIVE_INFINITY):F.set_float(Number.POSITIVE_INFINITY)};L.prototype.ConnectionType=function(F){var g=navigator.connection||navigator.mozConnection||navigator.webkitConnection;g?F.set_string(g.type||"unknown"):F.set_string("unknown")};L.prototype.BatteryLevel=function(F){var g=navigator.battery||navigator.mozBattery||navigator.webkitBattery;g?F.set_float(g.level):(l(),u?F.set_float(u.level):F.set_float(1))};L.prototype.BatteryTimeLeft=
function(F){var g=navigator.battery||navigator.mozBattery||navigator.webkitBattery;g?F.set_float(g.dischargingTime):(l(),u?F.set_float(u.dischargingTime):F.set_float(Number.POSITIVE_INFINITY))};L.prototype.ExecJS=function(F,g){if(eval){var p=0;try{p=eval(g)}catch(A){console&&console.error&&console.error("Error executing Javascript: ",A)}"number"===typeof p?F.set_any(p):"string"===typeof p?F.set_any(p):"boolean"===typeof p?F.set_any(p?1:0):F.set_any(0)}else F.set_any(0)};L.prototype.ScreenWidth=function(F){F.set_int(screen.width)};
L.prototype.ScreenHeight=function(F){F.set_int(screen.height)};L.prototype.DevicePixelRatio=function(F){F.set_float(this.runtime.devicePixelRatio)};L.prototype.WindowInnerWidth=function(F){F.set_int(window.innerWidth)};L.prototype.WindowInnerHeight=function(F){F.set_int(window.innerHeight)};L.prototype.WindowOuterWidth=function(F){F.set_int(window.outerWidth)};L.prototype.WindowOuterHeight=function(F){F.set_int(window.outerHeight)};k.exps=new L})();
cr.behaviors.shadowcaster=function(b){this.runtime=b;this.myTypes=[]};
(function(){function b(){}function l(){}function w(){}var D=cr.behaviors.shadowcaster.prototype;D.Type=function(L,k){this.behavior=L;this.objtype=k;this.runtime=L.runtime;-1===this.behavior.myTypes.indexOf(k)&&this.behavior.myTypes.push(k)};D.Type.prototype.onCreate=function(){};D.Instance=function(L,k){this.type=L;this.behavior=L.behavior;this.inst=k;this.runtime=L.runtime};var O=D.Instance.prototype;O.onCreate=function(){this.inst.extra.shadowcasterHeight=this.properties[0];this.inst.extra.shadowcasterTag=
this.properties[1];this.inst.extra.shadowcasterEnabled=this.properties[2]};O.tick=function(){};b.prototype.IsEnabled=function(){return this.inst.extra.shadowcasterEnabled};b.prototype.CompareHeight=function(L,k){return cr.do_cmp(this.inst.extra.shadowcasterHeight,L,k)};D.cnds=new b;l.prototype.SetEnabled=function(L){this.inst.extra.shadowcasterEnabled=!!L};l.prototype.SetHeight=function(L){this.inst.extra.shadowcasterHeight!==L&&(this.inst.extra.shadowcasterHeight=L,this.runtime.redraw=!0)};l.prototype.SetTag=
function(L){this.inst.extra.shadowcasterTag!==L&&(this.inst.extra.shadowcasterTag=L,this.runtime.redraw=!0)};D.acts=new l;w.prototype.Height=function(L){L.set_float(this.inst.extra.shadowcasterHeight)};w.prototype.Tag=function(L){L.set_string(this.inst.extra.shadowcasterTag)};D.exps=new w})();
cr.getObjectRefTable=function(){return[cr.plugins_.shadowlight,cr.plugins_.Mouse,cr.plugins_.Touch,cr.plugins_.Text,cr.plugins_.Sprite,cr.plugins_.TiledBg,cr.behaviors.shadowcaster,cr.plugins_.LocalStorage,cr.plugins_.XML,cr.plugins_.Browser,cr.plugins_.Touch.prototype.cnds.IsInTouch,cr.plugins_.shadowlight.prototype.acts.SetPos,cr.plugins_.Touch.prototype.exps.X,cr.plugins_.Touch.prototype.exps.Y,cr.system_object.prototype.cnds.Else,cr.system_object.prototype.cnds.Compare,cr.plugins_.Mouse.prototype.exps.X,
cr.plugins_.Mouse.prototype.exps.Y,cr.system_object.prototype.cnds.EveryTick,cr.plugins_.Text.prototype.acts.SetText,cr.system_object.prototype.exps.fps,cr.system_object.prototype.exps.newline,cr.system_object.prototype.exps.round,cr.system_object.prototype.exps.cpuutilisation,cr.system_object.prototype.exps.renderer,cr.plugins_.Sprite.prototype.acts.SetPos,cr.plugins_.shadowlight.prototype.exps.LightX,cr.plugins_.shadowlight.prototype.exps.LightY]};
self.C3_JsPropNameTable=[{ShadowLight:0},{Mouse:0},{Touch:0},{Text:0},{Sprite4:0},{Text2:0},{ShadowCaster:0},{TiledBackground:0},{LocalStorage:0},{XML:0},{Browser:0}];