-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemulator.min.js
7210 lines (7137 loc) · 544 KB
/
emulator.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
! function() {
var e, t;
e = window, t = function() {
return i = [function(e, t, i) {
"use strict";
i.r(t);
function b(e, t) {
var i = t.x - e.x,
t = t.y - e.y;
return Math.sqrt(i * i + t * t)
}
function Z(e) {
return e * (Math.PI / 180)
}
function s(e) {
u.has(e) && clearTimeout(u.get(e)), u.set(e, setTimeout(e, 100))
}
function o(e, t, i) {
for (var n, s = t.split(/[ ,]+/g), o = 0; o < s.length; o += 1) n = s[o], e.addEventListener ? e.addEventListener(n, i, !1) : e.attachEvent && e.attachEvent(n, i)
}
function n(e, t, i) {
for (var n, s = t.split(/[ ,]+/g), o = 0; o < s.length; o += 1) n = s[o], e.removeEventListener ? e.removeEventListener(n, i) : e.detachEvent && e.detachEvent(n, i)
}
function l(e) {
return e.preventDefault(), e.type.match(/^touch/) ? e.changedTouches : e
}
function a() {
return {
x: void 0 !== window.pageXOffset ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft,
y: void 0 !== window.pageYOffset ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop
}
}
function r(e, t) {
t.top || t.right || t.bottom || t.left ? (e.style.top = t.top, e.style.right = t.right, e.style.bottom = t.bottom, e.style.left = t.left) : (e.style.left = t.x + "px", e.style.top = t.y + "px")
}
function c(e, t, i) {
var n, s = g(e);
for (n in s)
if (s.hasOwnProperty(n))
if ("string" == typeof t) s[n] = t + " " + i;
else {
for (var o = "", l = 0, a = t.length; l < a; l += 1) o += t[l] + " " + i + ", ";
s[n] = o.slice(0, -2)
} return s
}
function g(t) {
var i = {};
return i[t] = "", ["webkit", "Moz", "o"].forEach(function(e) {
i[e + t.charAt(0).toUpperCase() + t.slice(1)] = ""
}), i
}
function d(e, t) {
for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
}
function h(e, t) {
if (e.length)
for (var i = 0, n = e.length; i < n; i += 1) t(e[i]);
else t(e)
}
var p, u = new Map,
i = !!("ontouchstart" in window),
m = !!window.PointerEvent,
I = !!window.MSPointerEvent,
C = {
start: "mousedown",
move: "mousemove",
end: "mouseup"
},
y = {};
function V() {}
m ? p = {
start: "pointerdown",
move: "pointermove",
end: "pointerup, pointercancel"
} : I ? p = {
start: "MSPointerDown",
move: "MSPointerMove",
end: "MSPointerUp"
} : i ? (p = {
start: "touchstart",
move: "touchmove",
end: "touchend, touchcancel"
}, y = C) : p = C, V.prototype.on = function(e, t) {
var i, n = e.split(/[ ,]+/g);
this._handlers_ = this._handlers_ || {};
for (var s = 0; s < n.length; s += 1) i = n[s], this._handlers_[i] = this._handlers_[i] || [], this._handlers_[i].push(t);
return this
}, V.prototype.off = function(e, t) {
return this._handlers_ = this._handlers_ || {}, void 0 === e ? this._handlers_ = {} : void 0 === t ? this._handlers_[e] = null : this._handlers_[e] && 0 <= this._handlers_[e].indexOf(t) && this._handlers_[e].splice(this._handlers_[e].indexOf(t), 1), this
}, V.prototype.trigger = function(e, t) {
var i, n = this,
s = e.split(/[ ,]+/g);
n._handlers_ = n._handlers_ || {};
for (var o = 0; o < s.length; o += 1) i = s[o], n._handlers_[i] && n._handlers_[i].length && n._handlers_[i].forEach(function(e) {
e.call(n, {
type: i,
target: n
}, t)
})
}, V.prototype.config = function(e) {
this.options = this.defaults || {}, e && (this.options = function(e, t) {
var i, n = {};
for (i in e) e.hasOwnProperty(i) && t.hasOwnProperty(i) ? n[i] = t[i] : e.hasOwnProperty(i) && (n[i] = e[i]);
return n
}(this.options, e))
}, V.prototype.bindEvt = function(e, t) {
var i = this;
return i._domHandlers_ = i._domHandlers_ || {}, i._domHandlers_[t] = function() {
"function" == typeof i["on" + t] ? i["on" + t].apply(i, arguments) : console.warn('[WARNING] : Missing "on' + t + '" handler.')
}, o(e, p[t], i._domHandlers_[t]), y[t] && o(e, y[t], i._domHandlers_[t]), i
}, V.prototype.unbindEvt = function(e, t) {
return this._domHandlers_ = this._domHandlers_ || {}, n(e, p[t], this._domHandlers_[t]), y[t] && n(e, y[t], this._domHandlers_[t]), delete this._domHandlers_[t], this
};
m = V;
function B(e, t) {
return this.identifier = t.identifier, this.position = t.position, this.frontPosition = t.frontPosition, this.collection = e, this.defaults = {
size: 100,
threshold: .1,
color: "white",
fadeTime: 250,
dataOnly: !1,
restJoystick: !0,
restOpacity: .5,
mode: "dynamic",
zone: document.body,
lockX: !1,
lockY: !1,
shape: "circle"
}, this.config(t), "dynamic" === this.options.mode && (this.options.restOpacity = 0), this.id = B.id, B.id += 1, this.buildEl().stylize(), this.instance = {
el: this.ui.el,
on: this.on.bind(this),
off: this.off.bind(this),
show: this.show.bind(this),
hide: this.hide.bind(this),
add: this.addToDom.bind(this),
remove: this.removeFromDom.bind(this),
destroy: this.destroy.bind(this),
setPosition: this.setPosition.bind(this),
resetDirection: this.resetDirection.bind(this),
computeDirection: this.computeDirection.bind(this),
trigger: this.trigger.bind(this),
position: this.position,
frontPosition: this.frontPosition,
ui: this.ui,
identifier: this.identifier,
id: this.id,
options: this.options
}, this.instance
}
B.prototype = new m, (B.constructor = B).id = 0, B.prototype.buildEl = function(e) {
return this.ui = {}, this.options.dataOnly || (this.ui.el = document.createElement("div"), this.ui.back = document.createElement("div"), this.ui.front = document.createElement("div"), this.ui.el.className = "nipple collection_" + this.collection.id, this.ui.back.className = "back", this.ui.front.className = "front", this.ui.el.setAttribute("id", "nipple_" + this.collection.id + "_" + this.id), this.ui.el.appendChild(this.ui.back), this.ui.el.appendChild(this.ui.front)), this
}, B.prototype.stylize = function() {
var e, t, i;
return this.options.dataOnly || (t = this.options.fadeTime + "ms", e = function() {
var e, t = g("borderRadius");
for (e in t) t.hasOwnProperty(e) && (t[e] = "50%");
return t
}(), t = c("transition", "opacity", t), (i = {}).el = {
position: "absolute",
opacity: this.options.restOpacity,
display: "block",
zIndex: 999
}, i.back = {
position: "absolute",
display: "block",
width: this.options.size + "px",
height: this.options.size + "px",
marginLeft: -this.options.size / 2 + "px",
marginTop: -this.options.size / 2 + "px",
background: this.options.color,
opacity: ".5"
}, i.front = {
width: this.options.size / 2 + "px",
height: this.options.size / 2 + "px",
position: "absolute",
display: "block",
marginLeft: -this.options.size / 4 + "px",
marginTop: -this.options.size / 4 + "px",
background: this.options.color,
opacity: ".5",
transform: "translate(0px, 0px)"
}, d(i.el, t), "circle" === this.options.shape && d(i.back, e), d(i.front, e), this.applyStyles(i)), this
}, B.prototype.applyStyles = function(e) {
for (var t in this.ui)
if (this.ui.hasOwnProperty(t))
for (var i in e[t]) this.ui[t].style[i] = e[t][i];
return this
}, B.prototype.addToDom = function() {
return this.options.dataOnly || document.body.contains(this.ui.el) || this.options.zone.appendChild(this.ui.el), this
}, B.prototype.removeFromDom = function() {
return !this.options.dataOnly && document.body.contains(this.ui.el) && this.options.zone.removeChild(this.ui.el), this
}, B.prototype.destroy = function() {
clearTimeout(this.removeTimeout), clearTimeout(this.showTimeout), clearTimeout(this.restTimeout), this.trigger("destroyed", this.instance), this.removeFromDom(), this.off()
}, B.prototype.show = function(e) {
var t = this;
return t.options.dataOnly || (clearTimeout(t.removeTimeout), clearTimeout(t.showTimeout), clearTimeout(t.restTimeout), t.addToDom(), t.restCallback(), setTimeout(function() {
t.ui.el.style.opacity = 1
}, 0), t.showTimeout = setTimeout(function() {
t.trigger("shown", t.instance), "function" == typeof e && e.call(this)
}, t.options.fadeTime)), t
}, B.prototype.hide = function(t) {
var e, i, n = this;
return n.options.dataOnly || (n.ui.el.style.opacity = n.options.restOpacity, clearTimeout(n.removeTimeout), clearTimeout(n.showTimeout), clearTimeout(n.restTimeout), n.removeTimeout = setTimeout(function() {
var e = "dynamic" === n.options.mode ? "none" : "block";
n.ui.el.style.display = e, "function" == typeof t && t.call(n), n.trigger("hidden", n.instance)
}, n.options.fadeTime), n.options.restJoystick && (e = n.options.restJoystick, (i = {}).x = !0 === e || !1 !== e.x ? 0 : n.instance.frontPosition.x, i.y = !0 === e || !1 !== e.y ? 0 : n.instance.frontPosition.y, n.setPosition(t, i))), n
}, B.prototype.setPosition = function(e, t) {
var i = this,
t = (i.frontPosition = {
x: t.x,
y: t.y
}, i.options.fadeTime + "ms"),
n = {},
t = (n.front = c("transition", ["transform"], t), {
front: {}
});
t.front = {
transform: "translate(" + i.frontPosition.x + "px," + i.frontPosition.y + "px)"
}, i.applyStyles(n), i.applyStyles(t), i.restTimeout = setTimeout(function() {
"function" == typeof e && e.call(i), i.restCallback()
}, i.options.fadeTime)
}, B.prototype.restCallback = function() {
var e = {};
e.front = c("transition", "none", ""), this.applyStyles(e), this.trigger("rested", this.instance)
}, B.prototype.resetDirection = function() {
this.direction = {
x: !1,
y: !1,
angle: !1
}
}, B.prototype.computeDirection = function(e) {
var t, i, n, s = e.angle.radian,
o = Math.PI / 4,
l = Math.PI / 2;
if (o < s && s < 3 * o && !e.lockX ? t = "up" : -o < s && s <= o && !e.lockY ? t = "left" : 3 * -o < s && s <= -o && !e.lockX ? t = "down" : e.lockY || (t = "right"), e.lockY || (i = -l < s && s < l ? "left" : "right"), e.lockX || (n = 0 < s ? "up" : "down"), e.force > this.options.threshold) {
var a, r = {};
for (a in this.direction) this.direction.hasOwnProperty(a) && (r[a] = this.direction[a]);
var c = {};
for (a in this.direction = {
x: i,
y: n,
angle: t
}, e.direction = this.direction, r) r[a] === this.direction[a] && (c[a] = !0);
if (c.x && c.y && c.angle) return e;
c.x && c.y || this.trigger("plain", e), c.x || this.trigger("plain:" + i, e), c.y || this.trigger("plain:" + n, e), c.angle || this.trigger("dir dir:" + t, e)
} else this.resetDirection();
return e
};
var f = B;
function S(e, t) {
this.nipples = [], this.idles = [], this.actives = [], this.ids = [], this.pressureIntervals = {}, this.manager = e, this.id = S.id, S.id += 1, this.defaults = {
zone: document.body,
multitouch: !1,
maxNumberOfNipples: 10,
mode: "dynamic",
position: {
top: 0,
left: 0
},
catchDistance: 200,
size: 100,
threshold: .1,
color: "white",
fadeTime: 250,
dataOnly: !1,
restJoystick: !0,
restOpacity: .5,
lockX: !1,
lockY: !1,
shape: "circle",
dynamicPage: !1,
follow: !1
}, this.config(t), "static" !== this.options.mode && "semi" !== this.options.mode || (this.options.multitouch = !1), this.options.multitouch || (this.options.maxNumberOfNipples = 1);
e = getComputedStyle(this.options.zone.parentElement);
return e && "flex" === e.display && (this.parentIsFlex = !0), this.updateBox(), this.prepareNipples(), this.bindings(), this.begin(), this.nipples
}
S.prototype = new m, (S.constructor = S).id = 0, S.prototype.prepareNipples = function() {
var n = this.nipples;
n.on = this.on.bind(this), n.off = this.off.bind(this), n.options = this.options, n.destroy = this.destroy.bind(this), n.ids = this.ids, n.id = this.id, n.processOnMove = this.processOnMove.bind(this), n.processOnEnd = this.processOnEnd.bind(this), n.get = function(e) {
if (void 0 === e) return n[0];
for (var t = 0, i = n.length; t < i; t += 1)
if (n[t].identifier === e) return n[t];
return !1
}
}, S.prototype.bindings = function() {
this.bindEvt(this.options.zone, "start"), this.options.zone.style.touchAction = "none", this.options.zone.style.msTouchAction = "none"
}, S.prototype.begin = function() {
var e = this.options;
"static" === e.mode && ((e = this.createNipple(e.position, this.manager.getIdentifier())).add(), this.idles.push(e))
}, S.prototype.createNipple = function(e, t) {
var i = this.manager.scroll,
n = {},
s = this.options,
o = this.parentIsFlex ? i.x : i.x + this.box.left,
l = this.parentIsFlex ? i.y : i.y + this.box.top,
o = (e.x && e.y ? n = {
x: e.x - o,
y: e.y - l
} : (e.top || e.right || e.bottom || e.left) && ((o = document.createElement("DIV")).style.display = "hidden", o.style.top = e.top, o.style.right = e.right, o.style.bottom = e.bottom, o.style.left = e.left, o.style.position = "absolute", s.zone.appendChild(o), l = o.getBoundingClientRect(), s.zone.removeChild(o), n = e, e = {
x: l.left + i.x,
y: l.top + i.y
}), new f(this, {
color: s.color,
size: s.size,
threshold: s.threshold,
fadeTime: s.fadeTime,
dataOnly: s.dataOnly,
restJoystick: s.restJoystick,
restOpacity: s.restOpacity,
mode: s.mode,
identifier: t,
position: e,
zone: s.zone,
frontPosition: {
x: 0,
y: 0
},
shape: s.shape
}));
return s.dataOnly || (r(o.ui.el, n), r(o.ui.front, o.frontPosition)), this.nipples.push(o), this.trigger("added " + o.identifier + ":added", o), this.manager.trigger("added " + o.identifier + ":added", o), this.bindNipple(o), o
}, S.prototype.updateBox = function() {
this.box = this.options.zone.getBoundingClientRect()
}, S.prototype.bindNipple = function(e) {
function t(e, t) {
i = e.type + " " + t.id + ":" + e.type, n.trigger(i, t)
}
var i, n = this;
e.on("destroyed", n.onDestroyed.bind(n)), e.on("shown hidden rested dir plain", t), e.on("dir:up dir:right dir:down dir:left", t), e.on("plain:up plain:right plain:down plain:left", t)
}, S.prototype.pressureFn = function(t, i, e) {
var n = this,
s = 0;
clearInterval(n.pressureIntervals[e]), n.pressureIntervals[e] = setInterval(function() {
var e = t.force || t.pressure || t.webkitForce || 0;
e !== s && (i.trigger("pressure", e), n.trigger("pressure " + i.identifier + ":pressure", e), s = e)
}.bind(n), 100)
}, S.prototype.onstart = function(i) {
var n = this,
t = n.options,
s = i;
return i = l(i), n.updateBox(), h(i, function(e) {
(n.actives.length < t.maxNumberOfNipples || s.type.match(/^touch/) && (Object.keys(n.manager.ids).forEach(function(t) {
var e;
Object.values(s.touches).findIndex(function(e) {
return e.identifier === t
}) < 0 && ((e = [i[0]]).identifier = t, n.processOnEnd(e))
}), n.actives.length < t.maxNumberOfNipples)) && n.processOnStart(e)
}), n.manager.bindDocument(), !1
}, S.prototype.processOnStart = function(t) {
function e(e) {
e.trigger("start", e), i.trigger("start " + e.id + ":start", e), e.show(), 0 < o && i.pressureFn(t, e, e.identifier), i.processOnMove(t)
}
var i = this,
n = i.options,
s = i.manager.getIdentifier(t),
o = t.force || t.pressure || t.webkitForce || 0,
l = {
x: t.pageX,
y: t.pageY
},
a = i.getOrCreate(s, l);
a.identifier !== s && i.manager.removeIdentifier(a.identifier), a.identifier = s;
if (0 <= (s = i.idles.indexOf(a)) && i.idles.splice(s, 1), i.actives.push(a), i.ids.push(a.identifier), "semi" !== n.mode || b(l, a.position) <= n.catchDistance) return e(a), a;
a.destroy(), i.processOnStart(t)
}, S.prototype.getOrCreate = function(e, t) {
var i, n = this.options;
return /(semi|static)/.test(n.mode) ? (i = this.idles[0]) ? (this.idles.splice(0, 1), i) : "semi" === n.mode ? this.createNipple(t, e) : (console.warn("Coudln't find the needed nipple."), !1) : this.createNipple(t, e)
}, S.prototype.processOnMove = function(e) {
var t, i, n, s, o, l, a, r, c, g, d, h, p, u, m = this.options,
I = this.manager.getIdentifier(e),
C = this.nipples.get(I),
y = this.manager.scroll;
u = e, (isNaN(u.buttons) ? 0 !== u.pressure : 0 !== u.buttons) ? C ? (m.dynamicPage && (u = C.el.getBoundingClientRect(), C.position = {
x: y.x + u.left,
y: y.y + u.top
}), C.identifier = I, u = C.options.size / 2, t = {
x: e.pageX,
y: e.pageY
}, m.lockX && (t.y = C.position.y), m.lockY && (t.x = C.position.x), s = b(t, C.position), o = t, l = C.position, a = l.x - o.x, l = l.y - o.y, o = Math.atan2(l, a) * (180 / Math.PI), l = Z(o), a = s / u, r = {
distance: s,
position: t
}, "circle" === C.options.shape ? (i = Math.min(s, u), n = C.position, d = i, p = {
x: 0,
y: 0
}, h = Z(o), p.x = n.x - d * Math.cos(h), p.y = n.y - d * Math.sin(h), n = p) : (d = t, h = C.position, p = u, n = {
x: Math.min(Math.max(d.x, h.x - p), h.x + p),
y: Math.min(Math.max(d.y, h.y - p), h.y + p)
}, i = b(n, C.position)), m.follow ? u < s && (c = t.x - n.x, g = t.y - n.y, C.position.x += c, C.position.y += g, C.el.style.top = C.position.y - (this.box.top + y.y) + "px", C.el.style.left = C.position.x - (this.box.left + y.x) + "px", s = b(t, C.position)) : (t = n, s = i), c = t.x - C.position.x, g = t.y - C.position.y, C.frontPosition = {
x: c,
y: g
}, m.dataOnly || (C.ui.front.style.transform = "translate(" + c + "px," + g + "px)"), y = {
identifier: C.identifier,
position: t,
force: a,
pressure: e.force || e.pressure || e.webkitForce || 0,
distance: s,
angle: {
radian: l,
degree: o
},
vector: {
x: c / u,
y: -g / u
},
raw: r,
instance: C,
lockX: m.lockX,
lockY: m.lockY
}, (y = C.computeDirection(y)).angle = {
radian: Z(180 - o),
degree: 180 - o
}, C.trigger("move", y), this.trigger("move " + C.id + ":move", y)) : (console.error("Found zombie joystick with ID " + I), this.manager.removeIdentifier(I)) : this.processOnEnd(e)
}, S.prototype.processOnEnd = function(e) {
var t = this,
i = t.options,
e = t.manager.getIdentifier(e),
n = t.nipples.get(e),
e = t.manager.removeIdentifier(n.identifier);
n && (i.dataOnly || n.hide(function() {
"dynamic" === i.mode && (n.trigger("removed", n), t.trigger("removed " + n.id + ":removed", n), t.manager.trigger("removed " + n.id + ":removed", n), n.destroy())
}), clearInterval(t.pressureIntervals[n.identifier]), n.resetDirection(), n.trigger("end", n), t.trigger("end " + n.id + ":end", n), 0 <= t.ids.indexOf(n.identifier) && t.ids.splice(t.ids.indexOf(n.identifier), 1), 0 <= t.actives.indexOf(n) && t.actives.splice(t.actives.indexOf(n), 1), /(semi|static)/.test(i.mode) ? t.idles.push(n) : 0 <= t.nipples.indexOf(n) && t.nipples.splice(t.nipples.indexOf(n), 1), t.manager.unbindDocument(), /(semi|static)/.test(i.mode)) && (t.manager.ids[e.id] = e.identifier)
}, S.prototype.onDestroyed = function(e, t) {
0 <= this.nipples.indexOf(t) && this.nipples.splice(this.nipples.indexOf(t), 1), 0 <= this.actives.indexOf(t) && this.actives.splice(this.actives.indexOf(t), 1), 0 <= this.idles.indexOf(t) && this.idles.splice(this.idles.indexOf(t), 1), 0 <= this.ids.indexOf(t.identifier) && this.ids.splice(this.ids.indexOf(t.identifier), 1), this.manager.removeIdentifier(t.identifier), this.manager.unbindDocument()
}, S.prototype.destroy = function() {
for (var e in this.unbindEvt(this.options.zone, "start"), this.nipples.forEach(function(e) {
e.destroy()
}), this.pressureIntervals) this.pressureIntervals.hasOwnProperty(e) && clearInterval(this.pressureIntervals[e]);
this.trigger("destroyed", this.nipples), this.manager.unbindDocument(), this.off()
};
var A = S;
function v(e) {
function t() {
var t;
n.collections.forEach(function(e) {
e.forEach(function(e) {
t = e.el.getBoundingClientRect(), e.position = {
x: n.scroll.x + t.left,
y: n.scroll.y + t.top
}
})
})
}
function i() {
n.scroll = a()
}
var n = this;
n.ids = {}, n.index = 0, n.collections = [], n.scroll = a(), n.config(e), n.prepareCollections(), o(window, "resize", function() {
s(t)
});
return o(window, "scroll", function() {
s(i)
}), n.collections
}
v.prototype = new m, (v.constructor = v).prototype.prepareCollections = function() {
var e = this;
e.collections.create = e.create.bind(e), e.collections.on = e.on.bind(e), e.collections.off = e.off.bind(e), e.collections.destroy = e.destroy.bind(e), e.collections.get = function(t) {
var i;
return e.collections.every(function(e) {
return !(i = e.get(t))
}), i
}
}, v.prototype.create = function(e) {
return this.createCollection(e)
}, v.prototype.createCollection = function(e) {
e = new A(this, e);
return this.bindCollection(e), this.collections.push(e), e
}, v.prototype.bindCollection = function(e) {
function t(e, t) {
i = e.type + " " + t.id + ":" + e.type, n.trigger(i, t)
}
var i, n = this;
e.on("destroyed", n.onDestroyed.bind(n)), e.on("shown hidden rested dir plain", t), e.on("dir:up dir:right dir:down dir:left", t), e.on("plain:up plain:right plain:down plain:left", t)
}, v.prototype.bindDocument = function() {
this.binded || (this.bindEvt(document, "move").bindEvt(document, "end"), this.binded = !0)
}, v.prototype.unbindDocument = function(e) {
Object.keys(this.ids).length && !0 !== e || (this.unbindEvt(document, "move").unbindEvt(document, "end"), this.binded = !1)
}, v.prototype.getIdentifier = function(e) {
var t;
return e ? void 0 === (t = void 0 === e.identifier ? e.pointerId : e.identifier) && (t = this.latest || 0) : t = this.index, void 0 === this.ids[t] && (this.ids[t] = this.index, this.index += 1), this.latest = t, this.ids[t]
}, v.prototype.removeIdentifier = function(e) {
var t, i = {};
for (t in this.ids)
if (this.ids[t] === e) {
i.id = t, i.identifier = this.ids[t], delete this.ids[t];
break
} return i
}, v.prototype.onmove = function(e) {
return this.onAny("move", e), !1
}, v.prototype.onend = function(e) {
return this.onAny("end", e), !1
}, v.prototype.oncancel = function(e) {
return this.onAny("end", e), !1
}, v.prototype.onAny = function(e, t) {
var i, n = this,
s = "processOn" + e.charAt(0).toUpperCase() + e.slice(1);
t = l(t);
return h(t, function(e) {
i = n.getIdentifier(e), h(n.collections, function(e, t, i) {
0 <= i.ids.indexOf(t) && (i[s](e), e._found_ = !0)
}.bind(null, e, i)), e._found_ || n.removeIdentifier(i)
}), !1
}, v.prototype.destroy = function() {
this.unbindDocument(!0), this.ids = {}, this.index = 0, this.collections.forEach(function(e) {
e.destroy()
}), this.off()
}, v.prototype.onDestroyed = function(e, t) {
if (this.collections.indexOf(t) < 0) return !1;
this.collections.splice(this.collections.indexOf(t), 1)
};
var U = new v;
t.default = {
create: function(e) {
return U.create(e)
},
factory: U
}
}], n = {}, s.m = i, s.c = n, s.d = function(e, t, i) {
s.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: i
})
}, s.r = function(e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(e, "__esModule", {
value: !0
})
}, s.t = function(t, e) {
if (1 & e && (t = s(t)), 8 & e) return t;
if (4 & e && "object" == typeof t && t && t.__esModule) return t;
var i = Object.create(null);
if (s.r(i), Object.defineProperty(i, "default", {
enumerable: !0,
value: t
}), 2 & e && "string" != typeof t)
for (var n in t) s.d(i, n, function(e) {
return t[e]
}.bind(null, n));
return i
}, s.n = function(e) {
var t = e && e.__esModule ? function() {
return e.default
} : function() {
return e
};
return s.d(t, "a", t), t
}, s.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}, s.p = "", s(s.s = 0).default;
function s(e) {
var t;
return (n[e] || (t = n[e] = {
i: e,
l: !1,
exports: {}
}, i[e].call(t.exports, t, t.exports, s), t.l = !0, t)).exports
}
var i, n
}, "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("nipplejs", [], t) : "object" == typeof exports ? exports.nipplejs = t() : e.nipplejs = t(), window.EJS_SHADERS = {
"2xScaleHQ.glslp": {
shader: {
type: "text",
value: 'shaders = 1\n\nshader0 = "2xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type0 = source\nscale0 = 2.0\n'
},
resources: [{
name: "2xScaleHQ.glsl",
type: "base64",
value: "LyoKICAgMnhHTFNMSHFGaWx0ZXIgc2hhZGVyCiAgIAogICBDb3B5cmlnaHQgKEMpIDIwMDUgZ3Vlc3QocikgLSBndWVzdC5yQGdtYWlsLmNvbQoKICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vcgogICBtb2RpZnkgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZQogICBhcyBwdWJsaXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMgogICBvZiB0aGUgTGljZW5zZSwgb3IgKGF0IHlvdXIgb3B0aW9uKSBhbnkgbGF0ZXIgdmVyc2lvbi4KCiAgIFRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUgaG9wZSB0aGF0IGl0IHdpbGwgYmUgdXNlZnVsLAogICBidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZgogICBNRVJDSEFOVEFCSUxJVFkgb3IgRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UuICBTZWUgdGhlCiAgIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGZvciBtb3JlIGRldGFpbHMuCgogICBZb3Ugc2hvdWxkIGhhdmUgcmVjZWl2ZWQgYSBjb3B5IG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZQogICBhbG9uZyB3aXRoIHRoaXMgcHJvZ3JhbTsgaWYgbm90LCB3cml0ZSB0byB0aGUgRnJlZSBTb2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1heF93KTsKICAgdzQgPSBjbGFtcChsYzIgKiBkb3QoYWJzKGMxMSAtIGMwMSksIGR0KSArIG14LCBtaW5fdywgbWF4X3cpOwogICBGcmFnQ29sb3IgPSB2ZWM0KHcxICogYzEwICsgdzIgKiBjMjEgKyB3MyAqIGMxMiArIHc0ICogYzAxICsgKDEuMCAtIHcxIC0gdzIgLSB3MyAtIHc0KSAqIGMxMSwgMS4wKTsKfSAKI2VuZGlmCg==\n"
}]
},
"4xScaleHQ.glslp": {
shader: {
type: "text",
value: 'shaders = 1\n\nshader0 = "4xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type0 = source\nscale0 = 4.0\n'
},
resources: [{
name: "4xScaleHQ.glsl",
type: "base64",
value: "LyoKICAgNHhHTFNMSHFGaWx0ZXIgc2hhZGVyCiAgIAogICBDb3B5cmlnaHQgKEMpIDIwMDUgZ3Vlc3QocikgLSBndWVzdC5yQGdtYWlsLmNvbQoKICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vcgogICBtb2RpZnkgaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZQogICBhcyBwdWJsaXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMgogICBvZiB0aGUgTGljZW5zZSwgb3IgKGF0IHlvdXIgb3B0aW9uKSBhbnkgbGF0ZXIgdmVyc2lvbi4KCiAgIFRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUgaG9wZSB0aGF0IGl0IHdpbGwgYmUgdXNlZnVsLAogICBidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZgogICBNRVJDSEFOVEFCSUxJVFkgb3IgRklUTkVTUyBGT1IgQ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IqKGkyK2k0KSt3MyooczErczMpK3c0KihzMitzNCkrYykvKDIuMCoodzErdzIrdzMrdzQpKzEuMCksIDEuMCk7Cn0gCiNlbmRpZgo="
}]
},
sabr: {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = sabr-v3.0.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "sabr-v3.0.glsl",
type: "base64",
value: "LyoKCVNBQlIgdjMuMCBTaGFkZXIKCUpvc2h1YSBTdHJlZXQKCQoJUG9ydGlvbnMgb2YgdGhpcyBhbGdvcml0aG0gd2VyZSB0YWtlbiBmcm9tIEh5bGxpYW4ncyA1eEJSIHYzLjdjCglzaGFkZXIuCgkKCVRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IKCW1vZGlmeSBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlCglhcyBwdWJsaXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24gMgoJb2YgdGhlIExpY2Vuc2UsIG9yIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCgoJVGhpcyBwcm9ncmFtIGlzIGRpc3RyaWJ1dGVkIGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsCglidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdpdGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZgoJTUVSQ0hBTlRBQklMSVRZIG9yIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFLiAgU2VlIHRoZQoJR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgZm9yIG1vcmUgZGV0YWlscy4KCglZb3Ugc2hvdWxkIGhhdmUgcmVjZWl2ZWQgYSBjb3B5IG9mIH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WFjLncpOwoJcmVzMiA9IG1peChyZXMyLCBtaXgoUDExLCBQNywgcHgueiksIG1hYy56KTsKCXJlczIgPSBtaXgocmVzMiwgbWl4KFA3LCBQMTMsIHB4LnkpLCBtYWMueSk7CglyZXMyID0gbWl4KHJlczIsIG1peChQMTMsIFAxNywgcHgueCksIG1hYy54KTsKCQoJRnJhZ0NvbG9yID0gdmVjNChtaXgocmVzMSwgcmVzMiwgc3RlcChjX2RmKFAxMiwgcmVzMSksIGNfZGYoUDEyLCByZXMyKSkpLCAxLjApOwp9IAojZW5kaWYK"
}]
},
"crt-aperture.glslp": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "crt-aperture.glsl",
type: "base64",
value: "LyoKICAgIENSVCBTaGFkZXIgYnkgRWFzeU1vZGUKICAgIExpY2Vuc2U6IEdQTAoqLwoKI3ByYWdtYSBwYXJhbWV0ZXIgU0hBUlBORVNTX0lNQUdFICJTaGFycG5lc3MgSW1hZ2UiIDEuMCAxLjAgNS4wIDEuMAojcHJhZ21hIHBhcmFtZXRlciBTSEFSUE5FU1NfRURHRVMgIlNoYXJwbmVzcyBFZGdlcyIgMy4wIDEuMCA1LjAgMS4wCiNwcmFnbWEgcGFyYW1ldGVyIEdMT1dfV0lEVEggIkdsb3cgV2lkdGgiIDAuNSAwLjA1IDAuNjUgMC4wNQojcHJhZ21hIHBhcmFtZXRlciBHTE9XX0hFSUdIVCAiR2xvdyBIZWlnaHQiIDAuNSAwLjA1IDAuNjUgMC4wNQojcHJhZ21hIHBhcmFtZXRlciBHTE9XX0hBTEFUSU9OICJHbG93IEhhbGF0aW9uIiAwLjEgMC4wIDEuMCAwLjAxCiNwcmFnbWEgcGFyYW1ldGVyIEdMT1dfRElGRlVTSU9OICJHbG93IERpZmZ1c2lvbiIgMC4wNSAwLjAgMS4wIDAuMDEKI3ByYWdtYSBwYXJhbWV0ZXIgTUFTS19DT0xPUlMgIk1hc2sg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SkgLyBUZXh0dXJlU2l6ZTsKCiAgICB2ZWMzIGNvbF9nbG93ID0gZmlsdGVyX2dhdXNzaWFuKFRleHR1cmUsIGNvLCBUZXh0dXJlU2l6ZSk7CiAgICB2ZWMzIGNvbF9zb2Z0ID0gZmlsdGVyX2xhbmN6b3MoVGV4dHVyZSwgY28sIFRleHR1cmVTaXplLCBTSEFSUE5FU1NfSU1BR0UpOwogICAgdmVjMyBjb2xfc2hhcnAgPSBmaWx0ZXJfbGFuY3pvcyhUZXh0dXJlLCBjbywgVGV4dHVyZVNpemUsIFNIQVJQTkVTU19FREdFUyk7CiAgICB2ZWMzIGNvbCA9IHNxcnQoY29sX3NoYXJwICogY29sX3NvZnQpOwoKICAgIGNvbCAqPSBnZXRfc2NhbmxpbmVfd2VpZ2h0KGZyYWN0KGNvLnkgKiBUZXh0dXJlU2l6ZS55KSwgY29sX3NvZnQpOwogICAgY29sX2dsb3cgPSBzYXR1cmF0ZShjb2xfZ2xvdyAtIGNvbCk7CiAgICBjb2wgKz0gY29sX2dsb3cgKiBjb2xfZ2xvdyAqIEdMT1dfSEFMQVRJT047CiAgICBjb2wgPSBtaXgoY29sLCBjb2wgKiBnZXRfbWFza193ZWlnaHQoY28ueCkgKiBNQVNLX0NPTE9SUywgTUFTS19TVFJFTkdUSCk7CiAgICBjb2wgKz0gY29sX2dsb3cgKiBHTE9XX0RJRkZVU0lPTjsKICAgIGNvbCA9IHBvdyhjb2wgKiBCUklHSFRORVNTLCB2ZWMzKDEuMCAvIEdBTU1BX09VVFBVVCkpOwoKICAgIEZyYWdDb2xvciA9IHZlYzQoY29sLCAxLjApOwp9CgojZW5kaWYK"
}]
},
"crt-easymode.glslp": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "crt-easymode.glsl",
type: "base64",
value: "LyoKICAgIENSVCBTaGFkZXIgYnkgRWFzeU1vZGUKICAgIExpY2Vuc2U6IEdQTAoKICAgIE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4KGNvbCwgY29sMiwgc2Nhbl9icmlnaHQpOwogICAgY29sICo9IG1hc2tfd2VpZ2h0OwogICAgY29sICA9IHBvdyhjb2wsIHZlYzMoMS4wIC8gR0FNTUFfT1VUUFVUKSk7CgogICAgRnJhZ0NvbG9yID0gdmVjNChjb2wgKiBCUklHSFRfQk9PU1QsIDEuMCk7Cn0gCiNlbmRpZgo="
}]
},
"crt-geom.glslp": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "crt-geom.glsl",
type: "base64",
value: "LyoKICAgIENSVC1pbnRlcmxhY2VkCgogICAgQ29weXJpZ2h0IChDKSAyMDEwLTIwMTIgY2d3ZywgVGhlbWFpc3RlciBhbmQgRE9MTFMKCiAgICBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeSBpdAogICAgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkgdGhlIEZyZWUKICAgIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yIChhdCB5b3VyIG9wdGlvbikKICAgIGFueSBsYXRlciB2ZXJzaW9uLgoKICAgIChjZ3dnIGdhdmUgdGhlaXIgY29uc2VudCB0byBoYXZlIHRoZSBvcmlnaW5hbCB2ZXJzaW9uIG9mIHRoaXMgc2hhZGVyCiAgICBkaXN0cmlidXRlZCB1bmRlciB0aGUgR1BMIGluIHRoaXMgbWVzc2FnZToKCiAgICAgICAgaHR0cDovL2JvYXJkLmJ5dXUub3JnL3ZpZXd0b3BpYy5waHA/cD0yNjA3NSNwMjYwNzUKCiAgICAgICAgIkZlZWwgZnJlZSB0byBkaXN0cmlidXRlIG15IHNoYWRlcnMgdW5kZXIg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mVjMigtb25lLngsIDAuMCkpLAogICAgICAgICAgICAgICAgICAgICAgICBURVgyRCh4eSksCiAgICAgICAgICAgICAgICAgICAgICAgIFRFWDJEKHh5ICsgdmVjMihvbmUueCwgMC4wKSksCiAgICAgICAgICAgICAgICAgICAgICAgIFRFWDJEKHh5ICsgdmVjMigyLjAgKiBvbmUueCwgMC4wKSkpICogY29lZmZzLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAsIDEuMCk7CiAgICAgICAgdmVjNCBjb2wyID0gY2xhbXAobWF0NCgKICAgICAgICAgICAgICAgICAgICAgICAgVEVYMkQoeHkgKyB2ZWMyKC1vbmUueCwgb25lLnkpKSwKICAgICAgICAgICAgICAgICAgICAgICAgVEVYMkQoeHkgKyB2ZWMyKDAuMCwgb25lLnkpKSwKICAgICAgICAgICAgICAgICAgICAgICAgVEVYMkQoeHkgKyBvbmUpLAogICAgICAgICAgICAgICAgICAgICAgICBURVgyRCh4eSArIHZlYzIoMi4wICogb25lLngsIG9uZS55KSkpICogY29lZmZzLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAsIDEuMCk7CgojaWZuZGVmIExJTkVBUl9QUk9DRVNTSU5HCgljb2wgID0gcG93KGNvbCAsIHZlYzQoQ1JUZ2FtbWEpKTsKCWNvbDIgPSBwb3coY29sMiwgdmVjNChDUlRnYW1tYSkpOwojZW5kaWYKCi8vIENhbGN1bGF0ZSB0aGUgaW5mbHVlbmNlIG9mIHRoZSBjdXJyZW50IGFuZCBuZXh0IHNjYW5saW5lcyBvbgovLyB0aGUgY3VycmVudCBwaXhlbC4KCXZlYzQgd2VpZ2h0cyAgPSBzY2FubGluZVdlaWdodHModXZfcmF0aW8ueSwgY29sKTsKCXZlYzQgd2VpZ2h0czIgPSBzY2FubGluZVdlaWdodHMoMS4wIC0gdXZfcmF0aW8ueSwgY29sMik7CiNpZmRlZiBPVkVSU0FNUExFCgl1dl9yYXRpby55ID11dl9yYXRpby55KzEuMC8zLjAqZmlsdGVyXzsKCXd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gICBtdWxfcmVzID0gc2F0dXJhdGlvbihtdWxfcmVzKTsKCgoKLy8gQ29sb3IgdGhlIHRleGVsLgogICAgb3V0cHV0X2R1bW15IF9PVVQ7CiAgICBfT1VULl9jb2xvciA9IHZlYzQobXVsX3JlcywgMS4wKTsKICAgIEZyYWdDb2xvciA9IF9PVVQuX2NvbG9yOwogICAgcmV0dXJuOwp9IAojZW5kaWYK"
}]
},
"crt-mattias.glslp": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-mattias.glsl\nfilter_linear0 = false"
},
resources: [{
name: "crt-mattias.glsl",
type: "base64",
value: "Ly8gQ1JUIEVtdWxhdGlvbgovLyBieSBNYXR0aWFzCi8vIGh0dHBzOi8vd3d3LnNoYWRlcnRveS5jb20vdmlldy9sc0IzRFYKCiNwcmFnbWEgcGFyYW1ldGVyIENVUlZBVFVSRSAiQ3VydmF0dXJlIiAwLjUgMC4wIDEuMCAwLjA1CiNwcmFnbWEgcGFyYW1ldGVyIFNDQU5TUEVFRCAiU2NhbmxpbmUgQ3Jhd2wgU3BlZWQiIDEuMCAwLjAgMTAuMCAwLjUKCiNpZiBkZWZpbmVkKFZFUlRFWCkKCiNpZiBfX1ZFUlNJT05fXyA+PSAxMzAKI2RlZmluZSBDT01QQVRfVkFSWUlORyBvdXQKI2RlZmluZSBDT01QQVRfQVRUUklCVVRFIGluCiNkZWZpbmUgQ09NUEFUX1RFWFRVUkUgdGV4dHVyZQojZWxzZQojZGVmaW5lIENPTVBBVF9WQVJZSU5HIHZhcnlpbmcgCiNkZWZpbmUgQ09NUEFUX0FUVFJJQlVURSBhdHRyaWJ1dGUgCiNkZWZpbmUgQ09NUEFUX1RFWFRVUkUgdGV4dHVyZTJECiNlbmRpZgoKI2lmZGVmIEdMX0VTCiNkZWZpbmUgQ09NUEFUX1BSRUNJU0lPTiBtZWRpdW1wCiNlbHNlCiNkZWZpbmUgQ09NUEFUX1BSRUNJU0lPTgojZW5kaWYKCkNPTVBBVF9BVFRSSU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hZ0NvbG9yID0gdmVjNChjb2wsMS4wKTsKfSAKI2VuZGlmCg=="
}]
},
"crt-beam": {
shader: {
type: "text",
value: 'shaders = "1"\nfeedback_pass = "0"\nshader0 = "CRT-Beam.glsl"\nfilter_linear0 = "true"\nwrap_mode0 = "clamp_to_border"\nmipmap_input0 = "false"\nalias0 = ""\nfloat_framebuffer0 = "false"\nsrgb_framebuffer0 = "false"\n\n'
},
resources: [{
name: "CRT-Beam.glsl",
type: "base64",
value: "LyoKCWNydC1iZWFtCglmb3IgYmVzdCByZXN1bHRzIHVzZSBpbnRlZ2VyIHNjYWxlIDV4IG9yIG1vcmUKKi8KCiNwcmFnbWEgcGFyYW1ldGVyIGJsdXIgIkhvcml6b250YWwgQmx1ci9CZWFtIHNoYXBlIiAwLjYgMC4wIDEuMCAwLjEKI3ByYWdtYSBwYXJhbWV0ZXIgU2NhbmxpbmUgIlNjYW5saW5lIHRoaWNrbmVzcyIgMC4yIDAuMCAxLjAgMC4wNQojcHJhZ21hIHBhcmFtZXRlciB3ZWlnaHRyICJTY2FubGluZSBSZWQgYnJpZ2h0bmVzcyIgMC44IDAuMCAxLjAgMC4wNQojcHJhZ21hIHBhcmFtZXRlciB3ZWlnaHRnICJTY2FubGluZSBHcmVlbiBicmlnaHRuZXNzIiAwLjggMC4wIDEuMCAwLjA1CiNwcmFnbWEgcGFyYW1ldGVyIHdlaWdodGIgIlNjYW5saW5lIEJsdWUgYnJpZ2h0bmVzcyIgMC44IDAuMCAxLjAgMC4wNQojcHJhZ21hIHBhcmFtZXRlciBib2d1c19tc2sgIiBbIE1BU0tTIF0gIiAwLjAgMC4wIDAuMCAwLjAKI3ByYWdtYSBwYXJhbWV0ZXIgbWFzayAiTWFzayAwOkNHV0csMS0yOkxvdHRlcywzLTQgR3JheSw1LTY6Q0dXRyBzbG90LDcgVkdBIiAzLjAgLTEuMCA3LjAgMS4wCiNwcmFnbWEgcGFyYW1ldGVyIG1za19zaXplICJNYXNrIHNpemUiIDEuMCAx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shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-caligari.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "crt-caligari.glsl",
type: "base64",
value: "Ly8gUGFyYW1ldGVyIGxpbmVzIGdvIGhlcmU6Ci8vIDAuNSA9IHRoZSBzcG90IHN0YXlzIGluc2lkZSB0aGUgb3JpZ2luYWwgcGl4ZWwKLy8gMS4wID0gdGhlIHNwb3QgYmxlZWRzIHVwIHRvIHRoZSBjZW50ZXIgb2YgbmV4dCBwaXhlbAojcHJhZ21hIHBhcmFtZXRlciBTUE9UX1dJRFRIICJDUlRDYWxpZ2FyaSBTcG90IFdpZHRoIiAwLjkgMC41IDEuNSAwLjA1CiNwcmFnbWEgcGFyYW1ldGVyIFNQT1RfSEVJR0hUICJDUlRDYWxpZ2FyaSBTcG90IEhlaWdodCIgMC42NSAwLjUgMS41IDAuMDUKLy8gVXNlZCB0byBjb3VudGVyYWN0IHRoZSBkZXNhdHVyYXRpb24gZWZmZWN0IG9mIHdlaWdodGluZy4KI3ByYWdtYSBwYXJhbWV0ZXIgQ09MT1JfQk9PU1QgIkNSVENhbGlnYXJpIENvbG9yIEJvb3N0IiAxLjQ1IDEuMCAyLjAgMC4wNQovLyBDb25zdGFudHMgdXNlZCB3aXRoIGdhbW1hIGNvcnJlY3Rpb24uCiNwcmFnbWEgcGFyYW1ldGVyIElucHV0R2FtbWEgIkNSVENhbGlnYXJpIElucHV0IEdhbW1hIiAyLjQgMC4wIDUuMCAwLjEKI3ByYWdtYSBwYXJhbWV0ZXIgT3V0cHV0R2FtbWEgIkNSVENhbGlnYXJpIE91dHB1dCBHYW1tYSIgMi4yIDAuMCA1LjAgMC4xCgojaWYgZGVmaW5lZChWRVJURVgpCgojaWYgX19WRVJTSU9OX18gPj0gMTMwCiNkZWZpbmUgQ09NUEFUX1ZBUllJTkcgb3V0CiNkZWZpbmUgQ09NUEFUX0FUVFJJQlVURSBpbgojZGVmaW5lIENPTVBBVF9URVhUVVJFIHRleHR1c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Z2h0XzAwLCB2X3dlaWdodF8xMCAqIGhfd2VpZ2h0XzAwICk7CgogICBjb2xvck5CID0gVEVYMkQoICB0ZXh0dXJlX2Nvb3JkcyArIGNvb3JkczAxICsgY29vcmRzMTAgKTsKCiAgIGNvbG9yID0gY29sb3IgKyBjb2xvck5CICogdmVjNCggdl93ZWlnaHRfMTAgKiBoX3dlaWdodF8wMSwgdl93ZWlnaHRfMTAgKiBoX3dlaWdodF8wMSwgdl93ZWlnaHRfMTAgKiBoX3dlaWdodF8wMSwgdl93ZWlnaHRfMTAgKiBoX3dlaWdodF8wMSApOwoKICAgY29sb3IgKj0gdmVjNCggQ09MT1JfQk9PU1QgKTsKCiAgIEZyYWdDb2xvciA9IGNsYW1wKCBHQU1NQV9PVVQoY29sb3IpLCAwLjAsIDEuMCApOwp9IAojZW5kaWYK"
}]
},
"crt-lottes": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = crt-lottes.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "crt-lottes.glsl",
type: "base64",
value: "Ly8gUGFyYW1ldGVyIGxpbmVzIGdvIGhlcmU6CiNwcmFnbWEgcGFyYW1ldGVyIGhhcmRTY2FuICJoYXJkU2NhbiIgLTguMCAtMjAuMCAwLjAgMS4wCiNwcmFnbWEgcGFyYW1ldGVyIGhhcmRQaXggImhhcmRQaXgiIC0zLjAgLTIwLjAgMC4wIDEuMAojcHJhZ21hIHBhcmFtZXRlciB3YXJwWCAid2FycFgiIDAuMDMxIDAuMCAwLjEyNSAwLjAxCiNwcmFnbWEgcGFyYW1ldGVyIHdhcnBZICJ3YXJwWSIgMC4wNDEgMC4wIDAuMTI1IDAuMDEKI3ByYWdtYSBwYXJhbWV0ZXIgbWFza0RhcmsgIm1hc2tEYXJrIiAwLjUgMC4wIDIuMCAwLjEKI3ByYWdtYSBwYXJhbWV0ZXIgbWFza0xpZ2h0ICJtYXNrTGlnaHQiIDEuNSAwLjAgMi4wIDAuMQojcHJhZ21hIHBhcmFtZXR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gICB9IAoKICAgIC8vIEFwZXJ0dXJlLWdyaWxsZS4KICAgIGVsc2UgaWYgKHNoYWRvd01hc2sgPT0gMi4wKSAKICAgIHsKICAgICAgICBwb3MueCA9IGZyYWN0KHBvcy54KjAuMzMzMzMzMzMzKTsKCiAgICAgICAgaWYgICAgICAocG9zLnggPCAwLjMzMykgbWFzay5yID0gbWFza0xpZ2h0OwogICAgICAgIGVsc2UgaWYgKHBvcy54IDwgMC42NjYpIG1hc2suZyA9IG1hc2tMaWdodDsKICAgICAgICBlbHNlICAgICAgICAgICAgICAgICAgICBtYXNrLmIgPSBtYXNrTGlnaHQ7CiAgICB9IAoKICAgIC8vIFN0cmV0Y2hlZCBWR0Egc3R5bGUgc2hhZG93IG1hc2sgKHNhbWUgYXMgcHJpb3Igc2hhZGVycykuCiAgICBlbHNlIGlmIChzaGFkb3dNYXNrID09IDMuMCkgCiAgICB7CiAgICAgICAgcG9zLnggKz0gcG9zLnkqMy4wOwogICAgICAgIHBvcy54ICA9IGZyYWN0KHBvcy54KjAuMTY2NjY2NjY2KTsKCiAgICAgICAgaWYgICAgICAocG9zLnggPCAwLjMzMykgbWFzay5yID0gbWFza0xpZ2h0OwogICAgICAgIGVsc2UgaWYgKHBvcy54IDwgMC42NjYpIG1hc2suZyA9IG1hc2tMaWdodDsKICAgICAgICBlbHNlICAgICAgICAgICAgICAgICAgICBtYXNrLmIgPSBtYXNrTGlnaHQ7CiAgICB9CgogICAgLy8gVkdBIHN0eWxlIHNoYWRvdyBtYXNrLgogICAgZWxzZSBpZiAoc2hhZG93TWFzayA9PSA0LjApIAogICAgewogICAgICAgIHBvcy54eSAgPSBmbG9vcihwb3MueHkqdmVjMigxLjAsIDAuNSkpOwogICAgICAgIHBvcy54ICArPSBwb3MueSozLjA7CiAgICAgICAgcG9zLnggICA9IGZyYWN0KHBvcy54KjAuMTY2NjY2NjY2KTsKCiAgICAgICAgaWYgICAgICAocG9zLnggPCAwLjMzMykgbWFzay5yID0gbWFza0xpZ2h0OwogICAgICAgIGVsc2UgaWYgKHBvcy54IDwgMC42NjYpIG1hc2suZyA9IG1hc2tMaWdodDsKICAgICAgICBlbHNlICAgICAgICAgICAgICAgICAgICBtYXNrLmIgPSBtYXNrTGlnaHQ7CiAgICB9CgogICAgcmV0dXJuIG1hc2s7Cn0KCnZvaWQgbWFpbigpCnsKICAgIHZlYzIgcG9zID0gV2FycChURVgwLnh5KihUZXh0dXJlU2l6ZS54eS9JbnB1dFNpemUueHkpKSooSW5wdXRTaXplLnh5L1RleHR1cmVTaXplLnh5KTsKICAgIHZlYzMgb3V0Q29sb3IgPSBUcmkocG9zKTsKCiNpZmRlZiBET19CTE9PTQogICAgLy9BZGQgQmxvb20KICAgIG91dENvbG9yLnJnYiArPSBCbG9vbShwb3MpKmJsb29tQW1vdW50OwojZW5kaWYKCiAgICBpZiAoc2hhZG93TWFzayA+IDAuMCkKICAgICAgICBvdXRDb2xvci5yZ2IgKj0gTWFzayhnbF9GcmFnQ29vcmQueHkgKiAxLjAwMDAwMSk7CiAgICAKI2lmZGVmIEdMX0VTICAgIC8qIFRPRE8vRklYTUUgLSBoYWNreSBjbGFtcCBmaXggKi8KICAgIHZlYzIgYm9yZGVydGVzdCA9IChwb3MpOwogICAgaWYgKCBib3JkZXJ0ZXN0LnggPiAwLjAwMDEgJiYgYm9yZGVydGVzdC54IDwgMC45OTk5ICYmIGJvcmRlcnRlc3QueSA+IDAuMDAwMSAmJiBib3JkZXJ0ZXN0LnkgPCAwLjk5OTkpCiAgICAgICAgb3V0Q29sb3IucmdiID0gb3V0Q29sb3IucmdiOwogICAgZWxzZQogICAgICAgIG91dENvbG9yLnJnYiA9IHZlYzMoMC4wKTsKI2VuZGlmCiAgICBGcmFnQ29sb3IgPSB2ZWM0KFRvU3JnYihvdXRDb2xvci5yZ2IpLCAxLjApOwp9IAojZW5kaWYK"
}]
},
"crt-zfast": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = zfast_crt.glsl\nfilter_linear0 = true"
},
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GRvIHRoZSByaWdodCB0aGluZz8NCiNlbmRpZg0KDQoJRnJhZ0NvbG9yLnJnYmEgPSB2ZWM0KGNvbG91ci5yZ2IqbWl4KHNjYW5MaW5lV2VpZ2h0Km1hc2ssIHNjYW5MaW5lV2VpZ2h0QiwgZG90KGNvbG91ci5yZ2IsdmVjMyhtYXNrRmFkZSkpKSwxLjApOw0KCQ0KfSANCiNlbmRpZg0K"
}]
},
"crt-yeetron": {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = yeetron.glsl\nfilter_linear0 = false\n"
},
resources: [{
name: "yeetron.glsl",
type: "base64",
value: "Ly8gcG9ydGVkIGZyb20gUmVTaGFkZQoKI2lmIGRlZmluZWQoVkVSVEVYKQoKI2lmIF9fVkVSU0lPTl9fID49IDEzMAojZGVmaW5lIENPTVBBVF9WQVJZSU5HIG91dAojZGVmaW5lIENPTVBBVF9BVFRSSUJVVEUgaW4KI2RlZmluZSBDT01QQVRfVEVYVFVSRSB0ZXh0dXJlCiNlbHNlCiNkZWZpbmUgQ09NUEFUX1ZBUllJTkcgdmFyeWluZyAKI2RlZmluZSBDT01QQVRfQVRUUklCVVRFIGF0dHJpYnV0ZSAKI2RlZmluZSBDT01QQVRfVEVYVFVSRSB0ZXh0dXJlMkQKI2VuZGlmCgojaWZkZWYgR0xfRVMKI2RlZmluZSBDT01QQVRfUFJFQ0lTSU9OIG1lZGl1bXAKI2Vsc2UKI2RlZmluZSBDT01QQVRfUFJFQ0lTSU9OCiNlbmRpZgoKQ09NUEFUX0FUVFJJQlVURSB2ZWM0IFZlcnRleENvb3JkOwpDT01QQVRfQVRUUklCVVRFIHZlYzQgQ09MT1I7CkNPTVBBVF9BVFRSSUJVVEUgdmVjNCBUZXhDb29yZDsKQ09NUEFUX1ZBUllJTkcgdmVjNCBDT0wwOwpDT01QQVRfVkFSWUlORyB2ZWM0IFRFWDA7Cgp2ZWM0IF9vUG9zaXRpb24xOyAKdW5pZm9ybSBtYXQ0IE1WUE1hdHJpeDs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ogYzIpLnh5OwoJcjAuencgPSBmcmFjdChyMC54eXh5KS56dzsKCXIwLnh5ID0gKC1yMC56d3p3ICsgcjApLnh5OwoJcjAueHkgPSAocjAgKyBjOC53d3d3KS54eTsKCXIwLnggPSByMC55ICogYzUudyArIHIwLng7CglyMC54ID0gcjAueCAqIGM2Lng7CglyMC54ID0gZnJhY3QocjAueCk7CglyMC54eSA9IChyMC54eHh4ICsgYzYueXp6dykueHk7CglyMS55eiA9IChyMC55ID49IDAuMCA/IGM3Lnh4eXcgOiBjNy54eXh3KS55ejsKCXIxLnggPSBjNi53OwoJcjAueHl6ID0gKHIwLnggPj0gMC4wID8gcjEgOiBjNy55eHh3KS54eXo7CglyMS54eSA9IChjMSAqIHYwKS54eTsKCXIwLncgPSByMS55ICogYzgudyArIGM4Lnc7CglyMC53ID0gZnJhY3QocjAudyk7CglyMC53ID0gcjAudyAqIGM0LnggKyBjNC55OwoJcjIueSA9IHNpbihyMC53KTsKCXIxLnp3ID0gKGFicyhyMikueXl5eSArIGM0KS56dzsKCXIxLnogPSBjbGFtcChyMS56LCAwLjAsIDEuMCk7CglyMC53ID0gcjEudyA+PSAwLjAgPyByMS56IDogYzgudzsKCXIyID0gZnJhY3QocjEueHl4eSk7CglyMS54eSA9IChyMSArIC1yMi56d3p3KS54eTsKCXIyID0gcjIgKyBjOC54eHl5OwoJcjEuencgPSAocjEueHl4eSArIGM4Lnd3d3cpLnp3OwoJcjEuencgPSAodjAueHl4eSAqIC1jMS54eXh5ICsgcjEpLnp3OwoJcjEudyA9IHIxLncgKyByMS53OwoJcjEueiA9IHIxLnogKiBjOC53OwoJcjEueiA9IC1hYnMocjEpLnogKyBjMy54OwoJcjMueCA9IG1heChjMy55LCByMS56KTsKCXI0LnggPSBtaW4ocjMueCwgYzMueik7CglyMS56dyA9ICgtYWJzKHIxKS53d3d3ICsgYzMpLnp3OwoJcjEueiA9IGNsYW1wKHIxLnosIDAuMCwgMS4wKTsKCXIxLnogPSByMS53ID49IDAuMCA/IHIxLnogOiBjOC53OwoJcjQueSA9IHIwLncgKyByMS56OwoJcjAudyA9IHIwLncgKiByNC54OwoJcjEueiA9IHIxLnogKiByNC54OwoJcjMueHkgPSAocjQgKiBjNSkueHk7CglyMS53ID0gcjMueSAqIHIzLng7CglyMi56ID0gY21wKHIyLCByMi54eXh5LCBjOC55eXl5KS56OwoJcjMueHkgPSBtYXgoYzgueXl5eSwgLXIyLnp3encpLnh5OwoJcjIueHkgPSAocjIgKyByMykueHk7CglyMS54eSA9IChyMiAqIGM4Lnp6enogKyByMSkueHk7CglyMS54eSA9IChyMSArIGM4Lnd3d3cpLnh5OwoJcjIueCA9IDEuMCAvIGMxLng7CglyMi55ID0gMS4wIC8gYzEueTsKCXIxLnh5ID0gKHIxICogcjIpLnh5OwoJcjIgPSBDT01QQVRfVEVYVFVSRShTb3VyY2UsIHIxLnh5KTsKCXIzLnggPSByMC53ICogcjIueDsKCXIzLnl6ID0gKHIxLnh6d3cgKiByMikueXo7CglGcmFnQ29sb3IudyA9IHIyLnc7CglyMC54eXogPSAocjAgKiByMykueHl6OwoJcjEueiA9IGM1Lno7CglyMC53ID0gcjEueiArIC1jMi55OwoJRnJhZ0NvbG9yLnh5eiA9IChyMC53ID49IDAuMCA/IHIzIDogcjApLnh5ejsKfSAKI2VuZGlmCg=="
}]
},
bicubic: {
shader: {
type: "text",
value: "shaders = 1\n\nshader0 = bicubic.glsl\nfilter_linear0 = false"
},
resources: [{
name: "bicubic.glsl",
type: "base64",
value: "Ly8gRGVmYXVsdCB0byBNaXRjaGVsLU5ldHJhdmFsaSBjb2VmZmljaWVudHMgZm9yIGJlc3QgcHN5Y2hvdmlzdWFsIHJlc3VsdAovLyBiaWN1YmljLXNoYXJwIGlzIEIgPSAwLjEgYW5kIEMgPSAwLjUKLy8gYmljdWJpYy1zaGFycGVyIGlzIEIgPSAwLjAgYW5kIEMgPSAwLjc1CiNwcmFnbWEgcGFyYW1ldGVyIEIgIkJpY3ViaWMgQ29lZmYgQi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YWw7Cn0gCiNlbmRpZgo=\n"
}]
},
"mix-frames": {
shader: {
type: "text",
value: 'shaders = "1"\n\nshader0 = "mix_frames.glsl"\nfilter_linear0 = "false"\n'
},
resources: [{
name: "mix_frames.glsl",
type: "base64",
value: "LyoKCW1peF9mcmFtZXMgLSBwZXJmb3JtcyA1MDo1MCBibGVuZGluZyBiZXR3ZWVuIHRoZSBjdXJyZW50IGFuZCBwcmV2aW91cwoJZnJhbWVzLgoJCglBdXRob3I6IGpkZ2xlYXZlcgoJCglUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeSBpdAoJdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNoZWQgYnkgdGhlIEZyZWUKCVNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yIChhdCB5b3VyIG9wdGlvbikKCWFueSBsYXRlciB2ZXJzaW9uLgoqLwoKI2lmIGRlZmluZWQoVkVSVEVYKQoKI2lmIF9fVkVSU0lPTl9fID49IDEzMAojZGVmaW5lIENPTVBBVF9WQVJZSU5HIG91dAojZGVmaW5lIENPTVBBVF9BVFRSSUJVVEUgaW4KI2RlZmluZSBDT01QQVRfVEVYVFVSRSB0ZXh0dXJlCiNlbHNlCiNkZWZpbmUgQ09NUEFUX1ZBUllJTkcgdmFyeWluZyAKI2RlZmluZSBDT01QQVRfQVRUUklCVVRFIGF0dHJpYnV0ZSAKI2RlZmluZSBDT01QQVRfVEVYVFVSRSB0ZXh0dXJlMkQKI2VuZGlmCgojaWZkZWYgR0xfRVMKI2lmZGVmIEdMX0ZSQUdNRU5UX1BSRUNJU0lPTl9ISUdICiNkZWZpbmUgQ09NUEFUX1BSRUNJU0lPTiBoaWdocAojZWxzZQojZGVmaW5lIENPT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FWDAueHkpLnJnYjsKCQoJLy8gR2V0IGNvbG91ciBvZiBwcmV2aW91cyBwaXhlbAoJQ09NUEFUX1BSRUNJU0lPTiB2ZWMzIGNvbG91clByZXYgPSBDT01QQVRfVEVYVFVSRShQcmV2VGV4dHVyZSwgVEVYMC54eSkucmdiOwoJCgkvLyBNaXggY29sb3VycwoJY29sb3VyLnJnYiA9IG1peChjb2xvdXIucmdiLCBjb2xvdXJQcmV2LnJnYiwgMC41KTsKCQoJZ2xfRnJhZ0NvbG9yID0gdmVjNChjb2xvdXIucmdiLCAxLjApOwp9CiNlbmRpZgo="
}]
}
};
window.EJS_STORAGE = class {
constructor(e, t) {
this.dbName = e, this.storeName = t
}
addFileToDB(i, n) {
(async () => {
if ("?EJS_KEYS!" !== i) {
let e = await this.get("?EJS_KEYS!");
var t;
e = e || [], n ? e.includes(i) || e.push(i) : -1 !== (t = e.indexOf(i)) && e.splice(t, 1), this.put("?EJS_KEYS!", e)
}
})()
}
get(s) {
return new Promise((i, e) => {
if (!window.indexedDB) return i();
let n = indexedDB.open(this.dbName, 1);
n.onerror = () => i(), n.onsuccess = () => {
let t = n.result.transaction([this.storeName], "readwrite").objectStore(this.storeName).get(s);
t.onsuccess = e => {
i(t.result)
}, t.onerror = () => i()
}, n.onupgradeneeded = () => {
var e = n.result;
e.objectStoreNames.contains(this.storeName) || e.createObjectStore(this.storeName)
}
})
}
put(n, s) {
return new Promise((t, e) => {
if (!window.indexedDB) return t();
let i = indexedDB.open(this.dbName, 1);
i.onerror = () => {}, i.onsuccess = () => {
var e = i.result.transaction([this.storeName], "readwrite").objectStore(this.storeName).put(s, n);
e.onerror = () => t(), e.onsuccess = () => {
this.addFileToDB(n, !0), t()
}
}, i.onupgradeneeded = () => {
var e = i.result;
e.objectStoreNames.contains(this.storeName) || e.createObjectStore(this.storeName)
}
})
}
remove(n) {
return new Promise((t, e) => {
if (!window.indexedDB) return t();
let i = indexedDB.open(this.dbName, 1);
i.onerror = () => {}, i.onsuccess = () => {
var e = i.result.transaction([this.storeName], "readwrite").objectStore(this.storeName).delete(n);
this.addFileToDB(n, !1), e.onsuccess = () => t(), e.onerror = () => {}
}, i.onupgradeneeded = () => {
var e = i.result;
e.objectStoreNames.contains(this.storeName) || e.createObjectStore(this.storeName)
}
})
}
getSizes() {
return new Promise(async (e, t) => {
window.indexedDB || e({});
var i = await this.get("?EJS_KEYS!");
if (!i) return e({});
var n = {};
for (let e = 0; e < i.length; e++) {
var s = await this.get(i[e]);
s && s.data && "number" == typeof s.data.byteLength && (n[i[e]] = s.data.byteLength)
}
e(n)
})
}
}, window.EJS_DUMMYSTORAGE = class {
constructor() {}
addFileToDB() {
return new Promise(e => e())
}
get() {
return new Promise(e => e())
}
put() {
return new Promise(e => e())
}
remove() {
return new Promise(e => e())
}
getSizes() {
return new Promise(e => e({}))
}
};
class i {
gamepads;
timeout;
listeners;
constructor() {
this.buttonLabels = {
0: "BUTTON_1",
1: "BUTTON_2",
2: "BUTTON_3",
3: "BUTTON_4",
4: "LEFT_TOP_SHOULDER",
5: "RIGHT_TOP_SHOULDER",
6: "LEFT_BOTTOM_SHOULDER",
7: "RIGHT_BOTTOM_SHOULDER",
8: "SELECT",
9: "START",
10: "LEFT_STICK",
11: "RIGHT_STICK",
12: "DPAD_UP",
13: "DPAD_DOWN",
14: "DPAD_LEFT",
15: "DPAD_RIGHT"
}, this.gamepads = [], this.listeners = {}, this.timeout = null, this.loop()
}
terminate() {
window.clearTimeout(this.timeout)
}
getGamepads() {
return navigator.getGamepads ? navigator.getGamepads() : navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []
}
loop() {
this.updateGamepadState(), this.timeout = setTimeout(this.loop.bind(this), 10)
}
updateGamepadState() {
const n = this.getGamepads();
n.forEach((l, e) => {
if (l) {
let t = !1;
this.gamepads.forEach((s, e) => {
if (s.index === l.index) {
const o = {
axes: [],
buttons: {},
index: s.index,
id: s.id
};
t = !0, s.axes.forEach((e, t) => {
var i = l.axes[t] < .01 && -.01 < l.axes[t] ? 0 : l.axes[t];
if (i !== (e < .01 && -.01 < e ? 0 : e)) {
const e = ["LEFT_STICK_X", "LEFT_STICK_Y", "RIGHT_STICK_X", "RIGHT_STICK_Y"][t];
if (!e) return;
this.dispatchEvent("axischanged", {
axis: e,
value: i,
index: l.index,
label: this.getAxisLabel(e, i),
gamepadIndex: l.index
})
}
o.axes[t] = i
}), l.buttons.forEach((e, t) => {
let i = 1 === s.buttons[t],
n = ("object" == typeof s.buttons[t] && (i = s.buttons[t].pressed), 1 === e);
"object" == typeof e && (n = e.pressed), o.buttons[t] = {
pressed: n
}, i !== n && (n ? this.dispatchEvent("buttondown", {
index: t,
label: this.getButtonLabel(t),
gamepadIndex: l.index
}) : this.dispatchEvent("buttonup", {
index: t,
label: this.getButtonLabel(t),
gamepadIndex: l.index
}))
}), this.gamepads[e] = o
}
}), t || (this.gamepads.push(n[e]), this.dispatchEvent("connected", {
gamepadIndex: l.index
}))
}
});
for (let i = 0; i < this.gamepads.length; i++)
if (this.gamepads[i]) {
let t = !1;
for (let e = 0; e < n.length; e++)
if (n[e] && this.gamepads[i].index === n[e].index) {
t = !0;
break
} t || (this.dispatchEvent("disconnected", {
gamepadIndex: this.gamepads[i].index
}), this.gamepads.splice(i, 1), i--)
}
}
dispatchEvent(e, t) {
"function" == typeof this.listeners[e] && ((t = t || {}).type = e, this.listeners[e](t))
}
on(e, t) {
this.listeners[e.toLowerCase()] = t
}
getButtonLabel(e) {
return null == e ? null : void 0 === this.buttonLabels[e] ? "GAMEPAD_" + e : this.buttonLabels[e]
}
getAxisLabel(e, t) {
let i = .5 < t || t < -.5 ? 0 < t ? "+1" : "-1" : null;
return e && i ? e + ":" + i : null
}
}
window.GamepadHandler = i;
window.EJS_GameManager = class {
constructor(e, t) {
this.EJS = t, this.Module = e, this.FS = this.Module.FS, this.functions = {
restart: this.Module.cwrap("system_restart", "", []),
saveStateInfo: this.Module.cwrap("save_state_info", "null", []),
loadState: this.Module.cwrap("load_state", "number", ["string", "number"]),
screenshot: this.Module.cwrap("cmd_take_screenshot", "", []),
simulateInput: this.Module.cwrap("simulate_input", "null", ["number", "number", "number"]),
toggleMainLoop: this.Module.cwrap("toggleMainLoop", "null", ["number"]),
getCoreOptions: this.Module.cwrap("get_core_options", "string", []),
setVariable: this.Module.cwrap("ejs_set_variable", "null", ["string", "string"]),
setCheat: this.Module.cwrap("set_cheat", "null", ["number", "number", "string"]),
resetCheat: this.Module.cwrap("reset_cheat", "null", []),
toggleShader: this.Module.cwrap("shader_enable", "null", ["number"]),
getDiskCount: this.Module.cwrap("get_disk_count", "number", []),
getCurrentDisk: this.Module.cwrap("get_current_disk", "number", []),
setCurrentDisk: this.Module.cwrap("set_current_disk", "null", ["number"]),
getSaveFilePath: this.Module.cwrap("save_file_path", "string", []),
saveSaveFiles: this.Module.cwrap("cmd_savefiles", "", []),
supportsStates: this.Module.cwrap("supports_states", "number", []),
loadSaveFiles: this.Module.cwrap("refresh_save_files", "null", []),
toggleFastForward: this.Module.cwrap("toggle_fastforward", "null", ["number"]),
setFastForwardRatio: this.Module.cwrap("set_ff_ratio", "null", ["number"]),
toggleRewind: this.Module.cwrap("toggle_rewind", "null", ["number"]),
setRewindGranularity: this.Module.cwrap("set_rewind_granularity", "null", ["number"]),
toggleSlowMotion: this.Module.cwrap("toggle_slow_motion", "null", ["number"]),
setSlowMotionRatio: this.Module.cwrap("set_sm_ratio", "null", ["number"]),
getFrameNum: this.Module.cwrap("get_current_frame_count", "number", [""]),
setVSync: this.Module.cwrap("set_vsync", "null", ["number"])
}, this.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n'), this.writeFile("/home/web_user/retroarch/userdata/config/MAME 2003 (0.78)/MAME 2003 (0.78).opt", 'mame2003_skip_disclaimer = "enabled"\nmame2003_skip_warnings = "enabled"\n'), this.mkdir("/data"), this.mkdir("/data/saves"), this.writeFile("/home/web_user/retroarch/userdata/retroarch.cfg", this.getRetroArchCfg()), this.FS.mount(IDBFS, {}, "/data/saves"), this.FS.syncfs(!0, () => {}), this.initShaders(), this.EJS.addEventListener(window, "beforeunload", () => {
this.saveSaveFiles(), this.FS.syncfs(() => {})
})
}
loadExternalFiles() {
return new Promise(async (e, t) => {
if (this.EJS.config.externalFiles && "Object" === this.EJS.config.externalFiles.constructor.name)
for (const l in this.EJS.config.externalFiles) await new Promise(o => {
this.EJS.downloadFile(this.EJS.config.externalFiles[l], async e => {
if (-1 === e) return this.EJS.debug && console.warn("Failed to fetch file from '" + this.EJS.config.externalFiles[l] + "'. Make sure the file exists."), o();
let t = l;
if (l.trim().endsWith("/")) {
var i = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/gi,
i = this.EJS.config.externalFiles[l].split("/").pop().split("#")[0].split("?")[0].replace(i, "").trim();
if (!i) return o();
var n = await this.EJS.checkCompression(new Uint8Array(e.data), this.EJS.localization("Decompress Game Assets"));
if (!n["!!notCompressedData"]) {
for (const s in n) this.writeFile(t + s, n[s]);
return o()
}
t += i
}
try {
this.writeFile(t, e.data)
} catch (e) {
this.EJS.debug && console.warn("Failed to write file to '" + t + "'. Make sure there are no conflicting files.")
}
o()
}, null, !0, {
responseType: "arraybuffer",
method: "GET"
})
});
e()
})
}
writeFile(e, t) {
var i = e.split("/");
let n = "/";
for (let e = 0; e < i.length - 1; e++) i[e].trim() && (n += i[e] + "/", this.mkdir(n));
this.FS.writeFile(e, t)
}
mkdir(e) {
try {
this.FS.mkdir(e)