aboutsummaryrefslogtreecommitdiff
path: root/src/utils/apng-canvas.js
blob: 5149dcc012738162c8d9563582f35b0426ba1bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
/* eslint-disable */

const self = module.exports;
/**
 * apng-canvas v2.1.2
 *
 * @copyright 2011-2019 David Mzareulyan
 * @link https://github.com/davidmz/apng-canvas
 * @license MIT
 */
!(function i(o, a, s) {
    function u(n, t) {
        if (!a[n]) {
            if (!o[n]) {
                var e = "function" == typeof require && require;
                if (!t && e) return e(n, !0);
                if (c) return c(n, !0);
                throw new Error("Cannot find module '" + n + "'");
            }
            var r = (a[n] = { exports: {} });
            o[n][0].call(
                r.exports,
                function (t) {
                    var e = o[n][1][t];
                    return u(e || t);
                },
                r,
                r.exports,
                i,
                o,
                a,
                s
            );
        }
        return a[n].exports;
    }
    for (
        var c = "function" == typeof require && require, t = 0;
        t < s.length;
        t++
    )
        u(s[t]);
    return u;
})(
    {
        1: [
            function (Y, n, r) {
                (function (G, q) {
                    var t, e;
                    (t = this),
                        (e = function () {
                            "use strict";
                            function u(t) {
                                return "function" == typeof t;
                            }
                            var n = Array.isArray
                                ? Array.isArray
                                : function (t) {
                                    return (
                                        "[object Array]" ===
                                        Object.prototype.toString.call(t)
                                    );
                                },
                                r = 0,
                                e = void 0,
                                i = void 0,
                                a = function (t, e) {
                                    (l[r] = t),
                                        (l[r + 1] = e),
                                        2 === (r += 2) && (i ? i(d) : g());
                                };
                            var t =
                                "undefined" != typeof window
                                    ? window
                                    : void 0,
                                o = t || {},
                                s =
                                    o.MutationObserver ||
                                    o.WebKitMutationObserver,
                                c =
                                    "undefined" == typeof self &&
                                    void 0 !== G &&
                                    "[object process]" === {}.toString.call(G),
                                f =
                                    "undefined" != typeof Uint8ClampedArray &&
                                    "undefined" != typeof importScripts &&
                                    "undefined" != typeof MessageChannel;
                            function h() {
                                var t = setTimeout;
                                return function () {
                                    return t(d, 1);
                                };
                            }
                            var l = new Array(1e3);
                            function d() {
                                for (var t = 0; t < r; t += 2) {
                                    (0, l[t])(l[t + 1]),
                                        (l[t] = void 0),
                                        (l[t + 1] = void 0);
                                }
                                r = 0;
                            }
                            var p,
                                v,
                                A,
                                m,
                                g = void 0;
                            function w(t, e) {
                                var n = this,
                                    r = new this.constructor(b);
                                void 0 === r[_] && j(r);
                                var i = n._state;
                                if (i) {
                                    var o = arguments[i - 1];
                                    a(function () {
                                        return L(i, r, o, n._result);
                                    });
                                } else U(n, r, t, e);
                                return r;
                            }
                            function y(t) {
                                if (
                                    t &&
                                    "object" == typeof t &&
                                    t.constructor === this
                                )
                                    return t;
                                var e = new this(b);
                                return T(e, t), e;
                            }
                            g = c
                                ? function () {
                                    return G.nextTick(d);
                                }
                                : s
                                    ? ((v = 0),
                                        (A = new s(d)),
                                        (m = document.createTextNode("")),
                                        A.observe(m, { characterData: !0 }),
                                        function () {
                                            m.data = v = ++v % 2;
                                        })
                                    : f
                                        ? (((p = new MessageChannel()).port1.onmessage =
                                            d),
                                            function () {
                                                return p.port2.postMessage(0);
                                            })
                                        : void 0 === t && "function" == typeof Y
                                            ? (function () {
                                                try {
                                                    var t =
                                                        Function("return this")().require(
                                                            "vertx"
                                                        );
                                                    return void 0 !==
                                                        (e =
                                                            t.runOnLoop || t.runOnContext)
                                                        ? function () {
                                                            e(d);
                                                        }
                                                        : h();
                                                } catch (t) {
                                                    return h();
                                                }
                                            })()
                                            : h();
                            var _ = Math.random().toString(36).substring(2);
                            function b() { }
                            var E = void 0,
                                P = 1,
                                x = 2;
                            function N(t, r, i) {
                                a(function (e) {
                                    var n = !1,
                                        t = (function (t, e, n, r) {
                                            try {
                                                t.call(e, n, r);
                                            } catch (t) {
                                                return t;
                                            }
                                        })(
                                            i,
                                            r,
                                            function (t) {
                                                n ||
                                                    ((n = !0),
                                                        r !== t
                                                            ? T(e, t)
                                                            : O(e, t));
                                            },
                                            function (t) {
                                                n || ((n = !0), R(e, t));
                                            },
                                            e._label
                                        );
                                    !n && t && ((n = !0), R(e, t));
                                }, t);
                            }
                            function C(t, e, n) {
                                e.constructor === t.constructor &&
                                    n === w &&
                                    e.constructor.resolve === y
                                    ? (function (e, t) {
                                        t._state === P
                                            ? O(e, t._result)
                                            : t._state === x
                                                ? R(e, t._result)
                                                : U(
                                                    t,
                                                    void 0,
                                                    function (t) {
                                                        return T(e, t);
                                                    },
                                                    function (t) {
                                                        return R(e, t);
                                                    }
                                                );
                                    })(t, e)
                                    : void 0 === n
                                        ? O(t, e)
                                        : u(n)
                                            ? N(t, e, n)
                                            : O(t, e);
                            }
                            function T(e, t) {
                                if (e === t)
                                    R(
                                        e,
                                        new TypeError(
                                            "You cannot resolve a promise with itself"
                                        )
                                    );
                                else if (
                                    (function (t) {
                                        var e = typeof t;
                                        return (
                                            null !== t &&
                                            ("object" == e || "function" == e)
                                        );
                                    })(t)
                                ) {
                                    var n = void 0;
                                    try {
                                        n = t.then;
                                    } catch (t) {
                                        return void R(e, t);
                                    }
                                    C(e, t, n);
                                } else O(e, t);
                            }
                            function B(t) {
                                t._onerror && t._onerror(t._result), I(t);
                            }
                            function O(t, e) {
                                t._state === E &&
                                    ((t._result = e),
                                        (t._state = P),
                                        0 !== t._subscribers.length && a(I, t));
                            }
                            function R(t, e) {
                                t._state === E &&
                                    ((t._state = x), (t._result = e), a(B, t));
                            }
                            function U(t, e, n, r) {
                                var i = t._subscribers,
                                    o = i.length;
                                (t._onerror = null),
                                    (i[o] = e),
                                    (i[o + P] = n),
                                    (i[o + x] = r),
                                    0 === o && t._state && a(I, t);
                            }
                            function I(t) {
                                var e = t._subscribers,
                                    n = t._state;
                                if (0 !== e.length) {
                                    for (
                                        var r = void 0,
                                        i = void 0,
                                        o = t._result,
                                        a = 0;
                                        a < e.length;
                                        a += 3
                                    )
                                        (r = e[a]),
                                            (i = e[a + n]),
                                            r ? L(n, r, i, o) : i(o);
                                    t._subscribers.length = 0;
                                }
                            }
                            function L(t, e, n, r) {
                                var i = u(n),
                                    o = void 0,
                                    a = void 0,
                                    s = !0;
                                if (i) {
                                    try {
                                        o = n(r);
                                    } catch (t) {
                                        (s = !1), (a = t);
                                    }
                                    if (e === o)
                                        return void R(
                                            e,
                                            new TypeError(
                                                "A promises callback cannot return that same promise."
                                            )
                                        );
                                } else o = r;
                                e._state !== E ||
                                    (i && s
                                        ? T(e, o)
                                        : !1 === s
                                            ? R(e, a)
                                            : t === P
                                                ? O(e, o)
                                                : t === x && R(e, o));
                            }
                            var D = 0;
                            function j(t) {
                                (t[_] = D++),
                                    (t._state = void 0),
                                    (t._result = void 0),
                                    (t._subscribers = []);
                            }
                            var k =
                                ((F.prototype._enumerate = function (t) {
                                    for (
                                        var e = 0;
                                        this._state === E && e < t.length;
                                        e++
                                    )
                                        this._eachEntry(t[e], e);
                                }),
                                    (F.prototype._eachEntry = function (e, t) {
                                        var n = this._instanceConstructor,
                                            r = n.resolve;
                                        if (r === y) {
                                            var i = void 0,
                                                o = void 0,
                                                a = !1;
                                            try {
                                                i = e.then;
                                            } catch (t) {
                                                (a = !0), (o = t);
                                            }
                                            if (i === w && e._state !== E)
                                                this._settledAt(
                                                    e._state,
                                                    t,
                                                    e._result
                                                );
                                            else if ("function" != typeof i)
                                                this._remaining--,
                                                    (this._result[t] = e);
                                            else if (n === S) {
                                                var s = new n(b);
                                                a ? R(s, o) : C(s, e, i),
                                                    this._willSettleAt(s, t);
                                            } else
                                                this._willSettleAt(
                                                    new n(function (t) {
                                                        return t(e);
                                                    }),
                                                    t
                                                );
                                        } else this._willSettleAt(r(e), t);
                                    }),
                                    (F.prototype._settledAt = function (t, e, n) {
                                        var r = this.promise;
                                        r._state === E &&
                                            (this._remaining--,
                                                t === x
                                                    ? R(r, n)
                                                    : (this._result[e] = n)),
                                            0 === this._remaining &&
                                            O(r, this._result);
                                    }),
                                    (F.prototype._willSettleAt = function (t, e) {
                                        var n = this;
                                        U(
                                            t,
                                            void 0,
                                            function (t) {
                                                return n._settledAt(P, e, t);
                                            },
                                            function (t) {
                                                return n._settledAt(x, e, t);
                                            }
                                        );
                                    }),
                                    F);
                            function F(t, e) {
                                (this._instanceConstructor = t),
                                    (this.promise = new t(b)),
                                    this.promise[_] || j(this.promise),
                                    n(e)
                                        ? ((this.length = e.length),
                                            (this._remaining = e.length),
                                            (this._result = new Array(
                                                this.length
                                            )),
                                            0 === this.length
                                                ? O(this.promise, this._result)
                                                : ((this.length =
                                                    this.length || 0),
                                                    this._enumerate(e),
                                                    0 === this._remaining &&
                                                    O(
                                                        this.promise,
                                                        this._result
                                                    )))
                                        : R(
                                            this.promise,
                                            new Error(
                                                "Array Methods must be provided an Array"
                                            )
                                        );
                            }
                            var S =
                                ((M.prototype.catch = function (t) {
                                    return this.then(null, t);
                                }),
                                    (M.prototype.finally = function (e) {
                                        var n = this.constructor;
                                        return u(e)
                                            ? this.then(
                                                function (t) {
                                                    return n
                                                        .resolve(e())
                                                        .then(function () {
                                                            return t;
                                                        });
                                                },
                                                function (t) {
                                                    return n
                                                        .resolve(e())
                                                        .then(function () {
                                                            throw t;
                                                        });
                                                }
                                            )
                                            : this.then(e, e);
                                    }),
                                    M);
                            function M(t) {
                                (this[_] = D++),
                                    (this._result = this._state = void 0),
                                    (this._subscribers = []),
                                    b !== t &&
                                    ("function" != typeof t &&
                                        (function () {
                                            throw new TypeError(
                                                "You must pass a resolver function as the first argument to the promise constructor"
                                            );
                                        })(),
                                        this instanceof M
                                            ? (function (e, t) {
                                                try {
                                                    t(
                                                        function (t) {
                                                            T(e, t);
                                                        },
                                                        function (t) {
                                                            R(e, t);
                                                        }
                                                    );
                                                } catch (t) {
                                                    R(e, t);
                                                }
                                            })(this, t)
                                            : (function () {
                                                throw new TypeError(
                                                    "Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."
                                                );
                                            })());
                            }
                            return (
                                (S.prototype.then = w),
                                (S.all = function (t) {
                                    return new k(this, t).promise;
                                }),
                                (S.race = function (i) {
                                    var o = this;
                                    return n(i)
                                        ? new o(function (t, e) {
                                            for (
                                                var n = i.length, r = 0;
                                                r < n;
                                                r++
                                            )
                                                o.resolve(i[r]).then(t, e);
                                        })
                                        : new o(function (t, e) {
                                            return e(
                                                new TypeError(
                                                    "You must pass an array to race."
                                                )
                                            );
                                        });
                                }),
                                (S.resolve = y),
                                (S.reject = function (t) {
                                    var e = new this(b);
                                    return R(e, t), e;
                                }),
                                (S._setScheduler = function (t) {
                                    i = t;
                                }),
                                (S._setAsap = function (t) {
                                    a = t;
                                }),
                                (S._asap = a),
                                (S.polyfill = function () {
                                    var t = void 0;
                                    if (void 0 !== q) t = q;
                                    else if ("undefined" != typeof self)
                                        t = self;
                                    else
                                        try {
                                            t = Function("return this")();
                                        } catch (t) {
                                            throw new Error(
                                                "polyfill failed because global object is unavailable in this environment"
                                            );
                                        }
                                    var e = t.Promise;
                                    if (e) {
                                        var n = null;
                                        try {
                                            n = Object.prototype.toString.call(
                                                e.resolve()
                                            );
                                        } catch (t) { }
                                        if ("[object Promise]" === n && !e.cast)
                                            return;
                                    }
                                    t.Promise = S;
                                }),
                                (S.Promise = S)
                            );
                        }),
                        "object" == typeof r && void 0 !== n
                            ? (n.exports = e())
                            : "function" == typeof define && define.amd
                                ? define(e)
                                : (t.ES6Promise = e());
                }).call(
                    this,
                    Y("VCmEsw"),
                    "undefined" != typeof self
                        ? self
                        : "undefined" != typeof window
                            ? window
                            : {}
                );
            },
            { VCmEsw: 2 },
        ],
        2: [
            function (t, e, n) {
                var r = (e.exports = {});
                function i() { }
                (r.nextTick = (function () {
                    var t = "undefined" != typeof window && window.setImmediate,
                        e =
                            "undefined" != typeof window &&
                            window.postMessage &&
                            window.addEventListener;
                    if (t)
                        return function (t) {
                            return window.setImmediate(t);
                        };
                    if (e) {
                        var n = [];
                        return (
                            window.addEventListener(
                                "message",
                                function (t) {
                                    var e = t.source;
                                    (e !== window && null !== e) ||
                                        "process-tick" !== t.data ||
                                        (t.stopPropagation(),
                                            0 < n.length && n.shift()());
                                },
                                !0
                            ),
                            function (t) {
                                n.push(t),
                                    window.postMessage("process-tick", "*");
                            }
                        );
                    }
                    return function (t) {
                        setTimeout(t, 0);
                    };
                })()),
                    (r.title = "browser"),
                    (r.browser = !0),
                    (r.env = {}),
                    (r.argv = []),
                    (r.on = i),
                    (r.addListener = i),
                    (r.once = i),
                    (r.off = i),
                    (r.removeListener = i),
                    (r.removeAllListeners = i),
                    (r.emit = i),
                    (r.binding = function (t) {
                        throw new Error("process.binding is not supported");
                    }),
                    (r.cwd = function () {
                        return "/";
                    }),
                    (r.chdir = function (t) {
                        throw new Error("process.chdir is not supported");
                    });
            },
            {},
        ],
        3: [
            function (t, e, n) {
                "use strict";
                e.exports = function () {
                    (this.width = 0),
                        (this.height = 0),
                        (this.numPlays = 0),
                        (this.playTime = 0),
                        (this.frames = []),
                        (this.play = function () {
                            s ||
                                u ||
                                (this.rewind(),
                                    (s = !0),
                                    requestAnimationFrame(e));
                        }),
                        (this.rewind = function () {
                            (o = i = 0), (a = null), (u = s = !1);
                        }),
                        (this.addContext = function (t) {
                            if (0 < c.length) {
                                var e = c[0].getImageData(
                                    0,
                                    0,
                                    this.width,
                                    this.height
                                );
                                t.putImageData(e, 0, 0);
                            }
                            c.push(t), (t._apng_animation = this);
                        }),
                        (this.removeContext = function (t) {
                            var e = c.indexOf(t);
                            -1 !== e &&
                                (c.splice(e, 1),
                                    0 === c.length && this.rewind(),
                                    "_apng_animation" in t &&
                                    delete t._apng_animation);
                        }),
                        (this.isPlayed = function () {
                            return s;
                        }),
                        (this.isFinished = function () {
                            return u;
                        });
                    var r = this,
                        i = 0,
                        o = 0,
                        a = null,
                        s = !1,
                        u = !1,
                        c = [],
                        e = function (t) {
                            for (; s && i <= t;) n(t);
                            s && requestAnimationFrame(e);
                        },
                        n = function (t) {
                            var e = o++ % r.frames.length,
                                n = r.frames[e];
                            if (
                                0 == r.numPlays ||
                                o / r.frames.length <= r.numPlays
                            ) {
                                for (
                                    0 == e &&
                                    (c.forEach(function (t) {
                                        t.clearRect(
                                            0,
                                            0,
                                            r.width,
                                            r.height
                                        );
                                    }),
                                        (a = null),
                                        2 == n.disposeOp && (n.disposeOp = 1)),
                                    a && 1 == a.disposeOp
                                        ? c.forEach(function (t) {
                                            t.clearRect(
                                                a.left,
                                                a.top,
                                                a.width,
                                                a.height
                                            );
                                        })
                                        : a &&
                                        2 == a.disposeOp &&
                                        c.forEach(function (t) {
                                            t.putImageData(
                                                a.iData,
                                                a.left,
                                                a.top
                                            );
                                        }),
                                    (a = n).iData = null,
                                    2 == a.disposeOp &&
                                    (a.iData = c[0].getImageData(
                                        n.left,
                                        n.top,
                                        n.width,
                                        n.height
                                    )),
                                    0 == n.blendOp &&
                                    c.forEach(function (t) {
                                        t.clearRect(
                                            n.left,
                                            n.top,
                                            n.width,
                                            n.height
                                        );
                                    }),
                                    c.forEach(function (t) {
                                        t.drawImage(n.img, n.left, n.top);
                                    }),
                                    0 == i && (i = t);
                                    t > i + r.playTime;

                                )
                                    i += r.playTime;
                                i += n.delay;
                            } else u = !(s = !1);
                        };
                };
            },
            {},
        ],
        4: [
            function (t, e, n) {
                "use strict";
                for (var a = new Uint32Array(256), r = 0; r < 256; r++) {
                    for (var i = r, o = 0; o < 8; o++)
                        i = 1 & i ? 3988292384 ^ (i >>> 1) : i >>> 1;
                    a[r] = i;
                }
                e.exports = function (t, e, n) {
                    for (
                        var r = -1,
                        i = (e = e || 0),
                        o = e + (n = n || t.length - e);
                        i < o;
                        i++
                    )
                        r = (r >>> 8) ^ a[255 & (r ^ t[i])];
                    return -1 ^ r;
                };
            },
            {},
        ],
        5: [
            function (a, t, e) {
                (function (t) {
                    "use strict";
                    var e = a("./support-test"),
                        n = a("./parser"),
                        r = a("./loader"),
                        i = (t.APNG = {});
                    (i.checkNativeFeatures = e.checkNativeFeatures),
                        (i.ifNeeded = e.ifNeeded),
                        (i.parseBuffer = function (t) {
                            return n(t);
                        });
                    var o = {};
                    (i.parseURL = function (t) {
                        return t in o || (o[t] = r(t).then(n)), o[t];
                    }),
                        (i.animateContext = function (t, e) {
                            return i.parseURL(t).then(function (t) {
                                return t.addContext(e), t.play(), t;
                            });
                        }),
                        (i.animateImage = function (s) {
                            return (
                                s.setAttribute("data-is-apng", "progress"),
                                i.parseURL(s.src).then(
                                    function (t) {
                                        s.setAttribute("data-is-apng", "yes");
                                        var e =
                                            document.createElement("canvas");
                                        (e.width = t.width),
                                            (e.height = t.height),
                                            Array.prototype.slice
                                                .call(s.attributes)
                                                .forEach(function (t) {
                                                    -1 ==
                                                        [
                                                            "alt",
                                                            "src",
                                                            "usemap",
                                                            "ismap",
                                                            "data-is-apng",
                                                            "width",
                                                            "height",
                                                        ].indexOf(t.nodeName) &&
                                                        e.setAttributeNode(
                                                            t.cloneNode(!1)
                                                        );
                                                }),
                                            e.setAttribute(
                                                "data-apng-src",
                                                s.src
                                            ),
                                            "" != s.alt &&
                                            e.appendChild(
                                                document.createTextNode(
                                                    s.alt
                                                )
                                            );
                                        var n = "",
                                            r = "",
                                            i = 0,
                                            o = "";
                                        "" != s.style.width &&
                                            "auto" != s.style.width
                                            ? (n = s.style.width)
                                            : s.hasAttribute("width") &&
                                            (n =
                                                s.getAttribute("width") +
                                                "px"),
                                            "" != s.style.height &&
                                                "auto" != s.style.height
                                                ? (r = s.style.height)
                                                : s.hasAttribute("height") &&
                                                (r =
                                                    s.getAttribute("height") +
                                                    "px"),
                                            "" != n &&
                                            "" == r &&
                                            ((i = parseFloat(n)),
                                                (o = n.match(/\D+$/)[0]),
                                                (r =
                                                    Math.round(
                                                        (e.height * i) / e.width
                                                    ) + o)),
                                            "" != r &&
                                            "" == n &&
                                            ((i = parseFloat(r)),
                                                (o = r.match(/\D+$/)[0]),
                                                (n =
                                                    Math.round(
                                                        (e.width * i) / e.height
                                                    ) + o)),
                                            (e.style.width = n),
                                            (e.style.height = r);
                                        var a = s.parentNode;
                                        a.insertBefore(e, s),
                                            a.removeChild(s),
                                            t.addContext(e.getContext("2d")),
                                            t.play();
                                    },
                                    function () {
                                        s.setAttribute("data-is-apng", "no");
                                    }
                                )
                            );
                        }),
                        (i.releaseCanvas = function (t) {
                            var e = t.getContext("2d");
                            "_apng_animation" in e &&
                                e._apng_animation.removeContext(e);
                        });
                }).call(
                    this,
                    "undefined" != typeof self
                        ? self
                        : "undefined" != typeof window
                            ? window
                            : {}
                );
            },
            { "./loader": 6, "./parser": 7, "./support-test": 8 },
        ],
        6: [
            function (t, e, n) {
                "use strict";
                var i = i || t("es6-promise").Promise;
                e.exports = function (r) {
                    return new i(function (t, e) {
                        var n = new XMLHttpRequest();
                        n.open("GET", r),
                            (n.responseType = "arraybuffer"),
                            (n.onload = function () {
                                200 == this.status ? t(this.response) : e(this);
                            }),
                            n.send();
                    });
                };
            },
            { "es6-promise": 1 },
        ],
        7: [
            function (t, e, n) {
                "use strict";
                var r = r || t("es6-promise").Promise,
                    m = t("./animation"),
                    o = t("./crc32"),
                    g = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
                e.exports = function (t) {
                    var A = new Uint8Array(t);
                    return new r(function (t, e) {
                        for (var n = 0; n < g.length; n++)
                            if (g[n] != A[n])
                                return void e(
                                    "Not a PNG file (invalid file signature)"
                                );
                        var r = !1;
                        if (
                            (w(A, function (t) {
                                return "acTL" != t || !(r = !0);
                            }),
                                r)
                        ) {
                            var a = [],
                                s = [],
                                u = null,
                                c = null,
                                f = new m();
                            if (
                                (w(A, function (t, e, n, r) {
                                    switch (t) {
                                        case "IHDR":
                                            (u = e.subarray(n + 8, n + 8 + r)),
                                                (f.width = y(e, n + 8)),
                                                (f.height = y(e, n + 12));
                                            break;
                                        case "acTL":
                                            f.numPlays = y(e, n + 8 + 4);
                                            break;
                                        case "fcTL":
                                            c && f.frames.push(c),
                                                ((c = {}).width = y(
                                                    e,
                                                    n + 8 + 4
                                                )),
                                                (c.height = y(e, n + 8 + 8)),
                                                (c.left = y(e, n + 8 + 12)),
                                                (c.top = y(e, n + 8 + 16));
                                            var i = _(e, n + 8 + 20),
                                                o = _(e, n + 8 + 22);
                                            0 == o && (o = 100),
                                                (c.delay = (1e3 * i) / o),
                                                c.delay <= 10 &&
                                                (c.delay = 100),
                                                (f.playTime += c.delay),
                                                (c.disposeOp = b(
                                                    e,
                                                    n + 8 + 24
                                                )),
                                                (c.blendOp = b(e, n + 8 + 25)),
                                                (c.dataParts = []);
                                            break;
                                        case "fdAT":
                                            c &&
                                                c.dataParts.push(
                                                    e.subarray(
                                                        n + 8 + 4,
                                                        n + 8 + r
                                                    )
                                                );
                                            break;
                                        case "IDAT":
                                            c &&
                                                c.dataParts.push(
                                                    e.subarray(n + 8, n + 8 + r)
                                                );
                                            break;
                                        case "IEND":
                                            s.push(E(e, n, 12 + r));
                                            break;
                                        default:
                                            a.push(E(e, n, 12 + r));
                                    }
                                }),
                                    c && f.frames.push(c),
                                    0 != f.frames.length)
                            )
                                for (
                                    var i = 0,
                                    o = new Blob(a),
                                    h = new Blob(s),
                                    l = 0;
                                    l < f.frames.length;
                                    l++
                                ) {
                                    c = f.frames[l];
                                    var d = [];
                                    d.push(g),
                                        u.set(P(c.width), 0),
                                        u.set(P(c.height), 4),
                                        d.push(x("IHDR", u)),
                                        d.push(o);
                                    for (var p = 0; p < c.dataParts.length; p++)
                                        d.push(x("IDAT", c.dataParts[p]));
                                    d.push(h);
                                    var v = URL.createObjectURL(
                                        new Blob(d, { type: "image/png" })
                                    );
                                    delete c.dataParts,
                                        (d = null),
                                        (c.img = document.createElement("img")),
                                        (c.img.onload = function () {
                                            URL.revokeObjectURL(this.src),
                                                ++i == f.frames.length && t(f);
                                        }),
                                        (c.img.onerror = function () {
                                            e("Image creation error");
                                        }),
                                        (c.img.src = v);
                                }
                            else e("Not an animated PNG");
                        } else e("Not an animated PNG");
                    });
                };
                var w = function (t, e) {
                    var n = 8;
                    do {
                        var r = y(t, n),
                            i = a(t, n + 4, 4),
                            o = e(i, t, n, r);
                        n += 12 + r;
                    } while (!1 !== o && "IEND" != i && n < t.length);
                },
                    y = function (t, e) {
                        var n = 0;
                        n += (t[0 + e] << 24) >>> 0;
                        for (var r = 1; r < 4; r++)
                            n += t[r + e] << (8 * (3 - r));
                        return n;
                    },
                    _ = function (t, e) {
                        for (var n = 0, r = 0; r < 2; r++)
                            n += t[r + e] << (8 * (1 - r));
                        return n;
                    },
                    b = function (t, e) {
                        return t[e];
                    },
                    E = function (t, e, n) {
                        var r = new Uint8Array(n);
                        return r.set(t.subarray(e, e + n)), r;
                    },
                    a = function (t, e, n) {
                        var r = Array.prototype.slice.call(
                            t.subarray(e, e + n)
                        );
                        return String.fromCharCode.apply(String, r);
                    },
                    P = function (t) {
                        return [
                            (t >>> 24) & 255,
                            (t >>> 16) & 255,
                            (t >>> 8) & 255,
                            255 & t,
                        ];
                    },
                    x = function (t, e) {
                        var n = t.length + e.length,
                            r = new Uint8Array(new ArrayBuffer(n + 8));
                        r.set(P(e.length), 0),
                            r.set(
                                (function (t) {
                                    for (var e = [], n = 0; n < t.length; n++)
                                        e.push(t.charCodeAt(n));
                                    return e;
                                })(t),
                                4
                            ),
                            r.set(e, 8);
                        var i = o(r, 4, n);
                        return r.set(P(i), n + 4), r;
                    };
            },
            { "./animation": 3, "./crc32": 4, "es6-promise": 1 },
        ],
        8: [
            function (o, a, t) {
                (function (t) {
                    "use strict";
                    var e,
                        n,
                        r = r || o("es6-promise").Promise,
                        i =
                            ((e = function (e) {
                                var n = document.createElement("canvas"),
                                    r = {
                                        TypedArrays: "ArrayBuffer" in t,
                                        BlobURLs: "URL" in t,
                                        requestAnimationFrame:
                                            "requestAnimationFrame" in t,
                                        pageProtocol:
                                            "http:" == location.protocol ||
                                            "https:" == location.protocol,
                                        canvas:
                                            "getContext" in
                                            document.createElement("canvas"),
                                        APNG: !1,
                                    };
                                if (r.canvas) {
                                    var i = new Image();
                                    (i.onload = function () {
                                        var t = n.getContext("2d");
                                        t.drawImage(i, 0, 0),
                                            (r.APNG =
                                                0 ===
                                                t.getImageData(0, 0, 1, 1)
                                                    .data[3]),
                                            e(r);
                                    }),
                                        (i.src =
                                            "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg==");
                                } else e(r);
                            }),
                                (n = null),
                                function (t) {
                                    return (n = n || new r(e)), t && n.then(t), n;
                                });
                    a.exports = {
                        checkNativeFeatures: i,
                        ifNeeded: function (r) {
                            return (
                                void 0 === r && (r = !1),
                                i().then(function (t) {
                                    if (t.APNG && !r) reject();
                                    else {
                                        var e = !0;
                                        for (var n in t)
                                            t.hasOwnProperty(n) &&
                                                "APNG" != n &&
                                                (e = e && t[n]);
                                    }
                                })
                            );
                        },
                    };
                }).call(
                    this,
                    "undefined" != typeof self
                        ? self
                        : "undefined" != typeof window
                            ? window
                            : {}
                );
            },
            { "es6-promise": 1 },
        ],
    },
    {},
    [5]
);