From 0d8c88ea93f38c61bf9281c4f766ae844865a378 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 10 Apr 2022 17:38:18 +0000 Subject: [PATCH] Update content of files --- data/promote.telegram.org/js/libwebp-0.2.0.js | 4082 +++++ .../js/ogvjs/ogv-decoder-audio-opus.js | 32 + .../js/ogvjs/ogv-decoder-audio-vorbis.js | 30 + .../js/ogvjs/ogv-demuxer-ogg.js | 30 + .../js/ogvjs/ogv-support.js | 272 + .../js/ogvjs/ogv-worker-audio.js | 701 + data/promote.telegram.org/js/ogvjs/ogv.js | 9663 +++++++++++ data/telegram.org/js/pako-inflate.min.js | 1 + data/telegram.org/js/rlottie-wasm.js | 1 + data/telegram.org/js/tgsticker-worker.js | 206 + data/tsf.telegram.org/js/billboard.js | 13312 ++++++++++++++++ 11 files changed, 28330 insertions(+) create mode 100644 data/promote.telegram.org/js/libwebp-0.2.0.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-opus.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-vorbis.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv-demuxer-ogg.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv-support.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv-worker-audio.js create mode 100644 data/promote.telegram.org/js/ogvjs/ogv.js create mode 100644 data/telegram.org/js/pako-inflate.min.js create mode 100644 data/telegram.org/js/rlottie-wasm.js create mode 100644 data/telegram.org/js/tgsticker-worker.js create mode 100644 data/tsf.telegram.org/js/billboard.js diff --git a/data/promote.telegram.org/js/libwebp-0.2.0.js b/data/promote.telegram.org/js/libwebp-0.2.0.js new file mode 100644 index 0000000000..118d807eb3 --- /dev/null +++ b/data/promote.telegram.org/js/libwebp-0.2.0.js @@ -0,0 +1,4082 @@ +// Copyright 2011 Google Inc. +// +// This code is licensed under the same terms as WebM: +// Software License Agreement: http://www.webmproject.org/license/software/ +// Additional IP Rights Grant: http://www.webmproject.org/license/additional/ +// ----------------------------------------------------------------------------- +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// Copyright 2011-2013 Dominik Homberger +// Libwebp Javascript / libwebpjs - the libwebp implementation in javascript (v0.2.0) +// +// Author: Dominik Homberger (dominik.homberger@gmail.com) +(function() { + + var self; + + var ca = void 0, + p = null, + s = 0, + x = 0, + la = s, + E = s, + bb = 0, + Mb = 0; + + function M(F) { + return JSON.parse(JSON.stringify(F)) + } + + function N(F, G, w, D, S) { + for (i = 0; i < S; ++i) F[G + i] = w[D + i] + } + + function Nb(F) { + var G = [], + w = F.length, + D; + for (D = 0; D < w; ++D) G.push(F[D]); + return G + } + + function ic(F, G) { + var w = []; + w.push(M(F)); + var D; + for (D = 0; D < G; ++D) w.push(M(F)); + w.push(0); + return w + } + + function rc(F, G) { + var w = [], + D; + for (D = 0; D < G; ++D) w.push(F); + w.push(0); + return w + } + + function memmove (arr1, index1, arr2, index2, length) { + var i; + for (i = 0; i < length; i++) { + arr1[index1 + i] = arr2[index2 + i]; + } + } + + function jd(F, G, w, D) { + var S; + for (S = 0; S < D; ++S) F[G + S] = w + } + + function kd(F, G, w, D) { + var S = "", + ga; + for (ga = 0; ga < D; ++ga) S += String.fromCharCode(F[G + ga]); + return w == S ? 0 : 1 + } + + function U(F, G) { + var w, D = []; + for (w = 0; w < F; ++w) D.push(G); + return D + } + + function ld(F, G) { + var w, D = []; + for (w = 0; w < F; ++w) D.push(M(G)); + return D + } + + function md(F, G) { + var w; + for (w = F.length - 1; 0 <= w; --w) G = M(U(F[w], G)); + return G + } + + function $(F) { + if (!F) throw Error("assert :P"); + } + window.WebPDecoder = function() { + function F(a) { + return a == Ob || a == Pb || a == Bb || a == Qb + } + + function G(a) { + return S(a, 1) + } + + function w(a, b) { + var c = 1 + ((a.la - 1) * b >> 8), + d = c << 8, + e = s; + a.Z >= d ? (e = 1, a.la -= c, a.Z -= d) : (e = 0, a.la = c); + for (; 128 > a.la;) a.Z <<= 1, a.la <<= 1, 8 == ++a.gc && (a.gc = 0, a.bc && (a.Z += a.qa[a.Ia++], a.bc--)); + return e + } + + function D(a, b, c, d) { + d -= c; + 2 <= d ? (a.Z = b[c + 0] << 8 | b[c + 1], a.qa = b, a.Ia = c + 2, a.bc = d - 2) : (a.Z = 0, a.qa = p, a.bc = 0); + a.la = 255; + a.gc = 0 + } + + function S(a, b) { + for (var c = 0, d = s, d = b - 1; 0 <= d; d--) c |= w(a, 128) << d; + return c + } + + function ga(a, b) { + var c = + S(a, b); + return G(a) ? -c : c + } + + function Rb(a, b, c, d) { + var e = Mb; + $(a != p); + $(b != p); + $(4294967288 > d); + a.qa = b; + a.Ia = c; + a.ya = d; + a.T = 0; + a.Q = 0; + a.g = 0; + a.L = 0; + for (e = a.fa = 0; 4 > e && e < a.ya; ++e) a.T |= a.qa[a.Ia + a.Q] << 8 * e, ++a.Q + } + + function Sb(a) { + for (; 8 <= a.g && a.Q < a.ya;) a.T >>>= 8, a.T += a.qa[a.Ia + a.Q] << 24 >>> 0, ++a.Q, a.g -= 8 + } + + function Da(a) { + 8 <= a.g && Sb(a); + a.Q == a.ya && 32 == a.g && (a.L = 1) + } + + function T(a, b) { + var c = 0; + $(0 <= b); + if (!a.L && b < gf) { + if (a.Q == a.ya && 32 <= a.g + b && (a.L = 1, 32 < a.g + b)) return c; + c = a.T >> a.g & hf[b]; + a.g += b; + 8 <= a.g && 8 <= a.g && Sb(a) + } else a.fa = 1; + return c + } + + function ma(a) { + return a.Pa == a.gb + } + + function nd(a, b) { + $(a != p); + if (0 == b) return 0; + a.gb = 2 * b - 1; + a.Y = ld(a.gb, jf); + if (a.Y == p) return 0; + a.Y[0].s = -1; + return a.Pa = 1 + } + + function ja(a) { + a != p && (a.Y = p, a.Y = p, a.gb = 0, a.Pa = 0) + } + + function jc(a, b, c, d) { + for (var e = a.Y, g = 0, k = +a.gb; 0 < d--;) { + if (g >= k) return 0; + if (0 > e[g].s) { + if (ma(a)) return 0; + var h = a, + n = h.Y, + l = +h.Pa; + e[g].s = l - g; + h.Pa += 2; + n[l + 0].s = -1; + n[l + 1].s = -1 + } else if (0 == e[g].s) return 0; + g += e[g].s + (c >> d & 1) + } + if (0 > e[g].s) e[g].s = 0; + else if (0 != e[g].s) return 0; + e[g].kc = b; + return 1 + } + + function od(a, b, c) { + var d = + s, + e = 0, + g = 0; + $(a != p); + $(b != p); + for (d = 0; d < c; ++d) 0 < b[d] && (++e, g = d); + if (!nd(a, e)) return 0; + if (1 == e) return 0 > g || g >= c ? (ja(a), 0) : jc(a, g, 0, 0); + e = 0; + g = U(c, s); + if (g == p) return (e = e && ma(a)) || ja(a), e; + var k = s, + k = s, + d = U(Tb + 1, 0), + h = s, + n = U(Tb + 1, 0), + l = 0; + $(b != p); + $(0 < c); + $(g != p); + for (k = 0; k < c; ++k) b[k] > l && (l = b[k]); + if (l > Tb) d = 0; + else { + for (k = 0; k < c; ++k) ++d[b[k]]; + h = d[0] = 0; + n[0] = -1; + for (k = 1; k <= l; ++k) h = h + d[k - 1] << 1, n[k] = h; + for (k = 0; k < c; ++k) g[k] = 0 < b[k] ? n[b[k]]++ : pd; + d = 1 + } + if (!d) return (e = e && ma(a)) || ja(a), e; + for (d = 0; d < c; ++d) + if (0 < b[d] && !jc(a, d, g[d], b[d])) return (e = + e && ma(a)) || ja(a), e; + (e = ma(a)) || ja(a); + return e + } + + function Ea(a, b, c, d, e, g, k) { + for (var h = s, h = 0; h < k; ++h) e[g + h] = a[b + h] + c[d + h] & 255 + } + + function qd(a, b, c) { + var d = a.P.l; + if (!(c = 0 > b || 0 > c || b + c > a.P.v)) + if (c = 0 == b) { + a: { + var e = a.Ga, + g = a.G, + k = a.ub; + c = a.P.l; + var h = a.P.v, + n = a.Xb, + l = [p], + m = p, + f = h * c, + q = p, + r = p, + r = "WEBP_FILTER_TYPE", + u = s, + l = s, + v = 0, + C = s; + $(0 < c && 0 < h && d >= c); + $(e != p && n != p); + if (k <= Ub) c = 0; + else if (C = e[g + 0] >> 0 & 3, r = e[g + 0] >> 2 & 3, u = e[g + 0] >> 4 & 3, l = e[g + 0] >> 6 & 3, C < kc || C > kf || r >= lf || u > rd || 0 != l) c = 0; + else { + if (C == kc) v = k >= f, l = e, m = g + Ub; + else { + l = U(f, 0); + m = 0; + if (l == + p) { + c = 0; + break a + } + var v = g + Ub, + k = k - Ub, + g = l, + q = M(Vb), + A = 0, + z = sd(); + z == p ? v = 0 : (z.l = c, z.v = h, z.N = q, td(na), q.put = ud, q.Mb = vd, q.Pb = wd, q.ka = p, q.ka = g, q.fd = 0, q.width = c, q.height = h, z.a = L, Rb(z.o, e, v, k), z.Wa = Cb, Ka(c, h, 1, z, p) && xd(z, c) && (z.Wa = Db, A = lc(z, z.V, z.Ha, z.l, z.v, mf)), z != p && sa(z), v = A) + } + if (v) { + e = nf[r]; + e != p ? (q = U(f, 0), r = 0, q == p && (v = 0, C != kc && (m = l = p)), e(l, m, c, h, 1, c, q, r), f = q, C = r) : (f = l, C = m); + for (e = 0; 0 < h--;) N(n, e, f, C, c), C += c, e += d; + u == rd && (v = l == p || 0 >= m || 0 >= c ? 0 : 1) + } + c = v + } + } + c = !c + } + return c ? p : 0 == b ? a.Xb : +b * d + } + + function of(a) { + var b = a.width, + c = a.height, + d = a.J; + if (0 >= b || 0 >= c || !(d >= Qa && d < Cc)) return ta; + if (!a.Fc && a.Jb == p) { + var e = p, + g = 0, + k = 0, + h = 0, + n = 0, + e = bb, + l = b * yd[d], + m = l * c; + d < ua || (g = parseInt((b + 1) / 2, 10), h = g * parseInt((c + 1) / 2, 10), d == Ra && (k = b, n = k * c)); + e = m + 2 * h + n; + if (e != e) return ta; + e = U(e, 205); + if (e == p) return cb; + a.Jb = e; + a.jc = p; + d < ua ? (b = a.c.RGBA, b.ma = e, b.Sa = p, b.f = l, b.size = m) : (b = a.c.Va, b.y = e, b.D = p, b.F = l, b.Wc = m, b.c = e, b.B = p + m, b.nb = g, b.Rc = h, b.S = e, b.C = p + m + h, b.rb = g, b.Uc = h, d == Ra && (b.p = e, b.q = p + m + 2 * h), b.Wb = n, b.Fa = k) + } + d = 1; + g = a.J; + k = a.width; + h = a.height; + g >= Qa && g < Cc ? g < ua ? (a = a.c.RGBA, d &= + a.f * h <= a.size, d &= a.f >= k * yd[g], d &= a.ma != p) : (a = a.c.Va, n = a.nb * parseInt((h + 1) / 2, 10), l = a.rb * parseInt((h + 1) / 2, 10), m = a.Fa * h, d &= a.F * h <= a.Wc, d &= n <= a.Rc, d &= l <= a.Uc, d &= m <= a.Wb, d &= a.F >= k, d &= a.nb >= parseInt((k + 1) / 2, 10), d &= a.rb >= parseInt((k + 1) / 2, 10), d &= a.y != p, d &= a.c != p, d &= a.S != p, g == Ra && (d &= a.Fa >= k, d &= m <= a.Wb, d &= a.p != p)) : d = 0; + return d ? L : ta + } + + function zd(a, b, c, d) { + if (d == p || 0 >= a || 0 >= b) return ta; + if (c != p) { + if (c.Ua) { + var e = c.wc, + g = c.vc, + k = c.t & -2, + h = c.k & -2; + if (0 > k || 0 > h || 0 >= e || 0 >= g || k + e > a || h + g > b) return ta; + a = e; + b = g + } + if (c.I) { + if (0 >= c.Ba || + 0 >= c.Aa) return ta; + a = c.Ba; + b = c.Aa + } + } + d.width = a; + d.height = b; + return of(d) + } + + function mb(a) { + return !(a & -256) ? a : 0 > a ? 0 : 255 + } + + function Ad(a, b, c, d) { + var e = U(16, 0), + g; + g = 0; + var k; + for (k = 0; 4 > k; ++k) { + var h = a[b + 0] + a[b + 8], + n = a[b + 0] - a[b + 8], + l = (a[b + 4] * Wb >> 16) - (a[b + 12] * Xb >> 16), + m = (a[b + 4] * Xb >> 16) + (a[b + 12] * Wb >> 16); + e[g + 0] = h + m; + e[g + 1] = n + l; + e[g + 2] = n - l; + e[g + 3] = h - m; + g += 4; + b++ + } + for (k = g = 0; 4 > k; ++k) a = e[g + 0] + 4, h = a + e[g + 8], n = a - e[g + 8], l = (e[g + 4] * Wb >> 16) - (e[g + 12] * Xb >> 16), m = (e[g + 4] * Xb >> 16) + (e[g + 12] * Wb >> 16), c[d + 0 + 0 * f] = mb(c[d + 0 + 0 * f] + (h + m >> 3)), c[d + 1 + 0 * f] = mb(c[d + + 1 + 0 * f] + (n + l >> 3)), c[d + 2 + 0 * f] = mb(c[d + 2 + 0 * f] + (n - l >> 3)), c[d + 3 + 0 * f] = mb(c[d + 3 + 0 * f] + (h - m >> 3)), g++, d += f + } + + function pf(a, b, c, d, e) { + Ad(a, b, c, d); + e && Ad(a, b + 16, c, d + 4) + } + + function qf(a, b, c, d) { + mc(a, b + 0, c, d + 0, 1); + mc(a, b + 32, c, d + 4 * f, 1) + } + + function nc(a, b, c, d) { + a = a[b + 0] + 4; + var e; + for (e = 0; 4 > e; ++e) + for (b = 0; 4 > b; ++b) c[d + b + e * f] = mb(c[d + b + e * f] + (a >> 3)) + } + + function rf(a, b, c, d) { + a[b + 0] && nc(a, b + 0, c, d + 0); + a[b + 16] && nc(a, b + 16, c, d + 4); + a[b + 32] && nc(a, b + 32, c, d + 4 * f); + a[b + 48] && nc(a, b + 48, c, d + 4 * f + 4) + } + + function Dc(a, b, c) { + var d = b - f, + e = oa, + g = 255 - a[d - 1], + k; + for (k = 0; k < + c; ++k) { + var h = e, + n = g + a[b - 1], + l; + for (l = 0; l < c; ++l) a[b + l] = h[n + a[d + l]]; + b += f + } + } + + function Yb(a, b, c) { + var d; + for (d = 0; 16 > d; ++d) + for (i = 0; 16 > i; ++i) b[c + d * f + i] = a + } + + function y(a, b, c) { + return a + 2 * b + c + 2 >> 2 + } + + function Zb(a, b, c) { + var d, e; + for (d = 0; 8 > d; ++d) + for (e = 0; 8 > e; ++e) b[c + e + d * f] = a + } + + function nb(a, b, c) { + var d = a[b - c], + e = a[b + 0], + g = 3 * (e - d) + sc[1020 + a[b - 2 * c] - a[b + c]], + k = oc[112 + (g + 4 >> 3)]; + a[b - c] = oa[255 + d + oc[112 + (g + 3 >> 3)]]; + a[b + 0] = oa[255 + e - k] + } + + function Bd(a, b, c, d) { + var e = a[b + 0], + g = a[b + c]; + return va[255 + a[b - 2 * c] - a[b - c]] > d || va[255 + g - e] > d + } + + function Cd(a, + b, c, d, e) { + var g = a[b - 3 * c], + k = a[b - 2 * c], + h = a[b - c], + n = a[b + 0], + l = a[b + c], + m = a[b + 2 * c], + f = a[b + 3 * c]; + return 2 * va[255 + h - n] + tc[255 + k - l] > d ? 0 : va[255 + a[b - 4 * c] - g] <= e && va[255 + g - k] <= e && va[255 + k - h] <= e && va[255 + f - m] <= e && va[255 + m - l] <= e && va[255 + l - n] <= e + } + + function Dd(a, b, c, d) { + var e; + for (e = 0; 16 > e; ++e) 2 * va[255 + a[b + e - c] - a[b + e + 0]] + tc[255 + a[b + e - 2 * c] - a[b + e + c]] <= d && nb(a, b + e, c) + } + + function Ed(a, b, c, d) { + var e; + for (e = 0; 16 > e; ++e) 2 * va[255 + a[b + e * c - 1] - a[b + e * c + 0]] + tc[255 + a[b + e * c - 2] - a[b + e * c + 1]] <= d && nb(a, b + e * c, 1) + } + + function sf(a, b, c, d) { + var e; + for (e = 3; 0 < e; --e) b += + 4 * c, Dd(a, b + 0, c, d) + } + + function tf(a, b, c, d) { + var e; + for (e = 3; 0 < e; --e) b += 4, Ed(a, b + 0, c, d) + } + + function Fa(a, b, c, d, e, g, k, h) { + for (; 0 < e--;) { + if (Cd(a, b + 0, c, g, k)) + if (Bd(a, b + 0, c, h)) nb(a, b + 0, c); + else { + var n = a, + l = b + 0, + m = c, + f = n[l - 2 * m], + q = n[l - m], + r = n[l + 0], + u = n[l + m], + v = n[l + 2 * m], + C = sc[1020 + 3 * (r - q) + sc[1020 + f - u]], + A = 27 * C + 63 >> 7, + z = 18 * C + 63 >> 7, + C = 9 * C + 63 >> 7; + n[l - 3 * m] = oa[255 + n[l - 3 * m] + C]; + n[l - 2 * m] = oa[255 + f + z]; + n[l - m] = oa[255 + q + A]; + n[l + 0] = oa[255 + r - A]; + n[l + m] = oa[255 + u - z]; + n[l + 2 * m] = oa[255 + v - C] + } + b += d + } + } + + function Ga(a, b, c, d, e, g, k, h) { + for (; 0 < e--;) { + if (Cd(a, b + 0, c, + g, k)) + if (Bd(a, b + 0, c, h)) nb(a, b + 0, c); + else { + var n = a, + l = b + 0, + m = c, + f = n[l - m], + q = n[l + 0], + r = n[l + m], + u = 3 * (q - f), + v = oc[112 + (u + 4 >> 3)], + u = oc[112 + (u + 3 >> 3)], + C = v + 1 >> 1; + n[l - 2 * m] = oa[255 + n[l - 2 * m] + C]; + n[l - m] = oa[255 + f + u]; + n[l + 0] = oa[255 + q - v]; + n[l + m] = oa[255 + r - C] + } + b += d + } + } + + function uf(a, b, c, d, e, g) { + Fa(a, b + 0, c, 1, 16, d, e, g) + } + + function vf(a, b, c, d, e, g) { + Fa(a, b + 0, 1, c, 16, d, e, g) + } + + function wf(a, b, c, d, e, g) { + var k; + for (k = 3; 0 < k; --k) b += 4 * c, Ga(a, b + 0, c, 1, 16, d, e, g) + } + + function xf(a, b, c, d, e, g) { + var k; + for (k = 3; 0 < k; --k) b += 4, Ga(a, b + 0, 1, c, 16, d, e, g) + } + + function yf(a, b, c, d, e, + g, k, h) { + Fa(a, b, e, 1, 8, g, k, h); + Fa(c, d, e, 1, 8, g, k, h) + } + + function zf(a, b, c, d, e, g, k, h) { + Fa(a, b, 1, e, 8, g, k, h); + Fa(c, d, 1, e, 8, g, k, h) + } + + function Af(a, b, c, d, e, g, k, h) { + Ga(a, b + 4 * e, e, 1, 8, g, k, h); + Ga(c, d + 4 * e, e, 1, 8, g, k, h) + } + + function Bf(a, b, c, d, e, g, k, h) { + Ga(a, b + 4, 1, e, 8, g, k, h); + Ga(c, d + 4, 1, e, 8, g, k, h) + } + + function Fd(a, b) { + return b == $b ? 0 == a.i ? 0 == a.d ? Cf : Df : 0 == a.d ? Ef : $b : b + } + + function Ec(a, b, c, d) { + for (i = 0; 4 > i; ++i) a[b + i] = c[d + i] + } + + function wa(a, b) { + return 0 > a ? 0 : a > b ? b : a + } + + function Gd(a) { + a.a = "VP8_STATUS_OK"; + a.xc = "OK" + } + + function td(a) { + a >>> 8 != na >>> 8 && alert("mismatch error") + } + + function Y(a, b, c) { + a.a == L && (a.a = b, a.xc = c, a.za = 0); + // alert(b + ": " + c); + return 0 + } + + function Hd(a, b) { + var c = [0], + d = x, + e = [Mb], + g = M(Id), + k = M(Jd), + h = M(Fc), + e = "VP8StatusCode", + g = M(Gc); + if (a == p) return alert("(dec == null)"), 0; + Gd(a); + if (b == p) return Y(a, "VP8_STATUS_INVALID_PARAM", "null VP8Io passed to VP8GetHeaders()"); + g.data = b.data; + g.b = b.b; + g.e = b.e; + g.b = [g.b]; + g.e = [g.e]; + g = [g]; + e = Kd(g); + if (e != L) return Y(a, e, "Incorrect/incomplete header."); + g = g[0]; + g.b = g.b[0]; + g.e = g.e[0]; + if (g.ia) return Y(a, W, "Unexpected lossless format encountered."); + a.Ga == p && ($(0 == a.ub), a.Ga = g.$, a.G = g.G, a.ub = g.pa); + d = g.data; + c = g.b + g.offset; + e = g.e - g.offset; + $(g.e >= g.offset); + if (4 > e[0]) return Y(a, Z, "Truncated header."); + h = d[c + 0] | d[c + 1] << 8 | d[c + 2] << 16; + g = a.Ac; + g.fb = !(h & 1) + 0; + g.Jc = h >> 1 & 7; + g.Nc = h >> 4 & 1; + g.Ra = h >> 5; + if (3 < g.Jc) return Y(a, "VP8_STATUS_BITSTREAM_ERROR", "Incorrect keyframe parameters."); + if (!g.Nc) return Y(a, "VP8_STATUS_UNSUPPORTED_FEATURE", "Frame not displayable."); + c += 3; + e -= 3; + k = a.P; + if (g.fb) { + if (7 > e) return Y(a, "VP8_STATUS_NOT_ENOUGH_DATA", "cannot parse picture header"); + if (!(3 <= + e && 157 == d[c + 0] && 1 == d[c + 1] && 42 == d[c + 2])) return Y(a, "VP8_STATUS_BITSTREAM_ERROR", "Bad code word"); + k.l = (d[c + 4] << 8 | d[c + 3]) & 16383; + k.gd = d[c + 4] >> 6; + k.v = (d[c + 6] << 8 | d[c + 5]) & 16383; + k.hd = d[c + 6] >> 6; + c += 7; + e -= 7; + a.Ma = k.l + 15 >> 4; + a.hb = k.v + 15 >> 4; + b.width = k.l; + b.height = k.v; + b.I = 0; + b.Ua = 0; + b.k = 0; + b.t = 0; + b.Ka = b.width; + b.K = b.height; + b.m = b.width; + b.h = b.height; + h = a.R; + for (i = 0; i < h.Ta.length; ++i) h.Ta[i] = 255; + h.z = M(Ff); + h = a.Ca; + $(h != p); + h.pb = 0; + h.ob = 0; + h.tb = 1; + for (i = 0; i < h.Kb.length; ++i) h.Kb[i] = 0; + for (i = 0; i < h.Cb.length; ++i) h.Cb[i] = 0; + a.Lb = 0 + } + if (g.Ra > + e) return Y(a, "VP8_STATUS_NOT_ENOUGH_DATA", "bad partition length"); + h = a.o; + D(h, d, c, c + g.Ra); + c += g.Ra; + e -= g.Ra; + g.fb && (k.uc = G(h), k.$c = G(h)); + var k = h, + n = a.Ca, + l = a.R; + $(k != p); + $(n != p); + n.pb = G(k); + if (n.pb) { + n.ob = G(k); + if (G(k)) { + var m; + n.tb = G(k); + for (m = 0; m < xa; ++m) n.Kb[m] = G(k) ? ga(k, 7) : 0; + for (m = 0; m < xa; ++m) n.Cb[m] = G(k) ? ga(k, 6) : 0 + } + if (n.ob) + for (m = 0; m < Ld; ++m) l.Ta[m] = G(k) ? S(k, 8) : 255 + } else n.ob = 0; + if (k.Ab) return Y(a, "VP8_STATUS_BITSTREAM_ERROR", "cannot parse segment header"); + k = h; + n = a.ga; + n.Oc = G(k); + n.Fb = S(k, 6); + n.kb = S(k, 3); + n.oc = G(k); + if (n.oc && + G(k)) { + for (l = 0; l < Hc; ++l) G(k) && (n.Lc[l] = ga(k, 6)); + for (l = 0; l < Gf; ++l) G(k) && (n.Gc[l] = ga(k, 6)) + } + a.A = 0 == n.Fb ? 0 : n.Oc ? 1 : 2; + if (0 < a.A) + if (a.Ca.pb) + for (l = 0; l < xa; ++l) m = a.Ca.Cb[l], a.Ca.tb || (m += n.Fb), a.Zb[l] = m; + else a.Zb[0] = n.Fb; + if (k.Ab) return Y(a, "VP8_STATUS_BITSTREAM_ERROR", "cannot parse filter header"); + var k = d, + f = c, + n = f, + e = f + e; + m = 0; + var q = s, + r = s; + a.Hb = 1 << S(a.o, 2); + q = a.Hb - 1; + l = k; + m = f + 3 * q; + if (e < m) e = "VP8_STATUS_NOT_ENOUGH_DATA"; + else { + for (r = 0; r < q; ++r) { + var f = l, + u = m + (k[n + 0] | k[n + 1] << 8 | k[n + 2] << 16); + u > e && (f = k); + D(a.ic[+r], l, m, u); + l = f; + m = u; + n += 3 + } + D(a.ic[+q], l, m, e); + e = m < e ? "VP8_STATUS_OK" : "VP8_STATUS_SUSPENDED" + } + if ("VP8_STATUS_OK" != e) return Y(a, "VP8_STATUS_BITSTREAM_ERROR", "cannot parse partitions"); + q = a.o; + e = S(q, 7); + k = G(q) ? ga(q, 4) : 0; + n = G(q) ? ga(q, 4) : 0; + l = G(q) ? ga(q, 4) : 0; + m = G(q) ? ga(q, 4) : 0; + q = G(q) ? ga(q, 4) : 0; + r = a.Ca; + f = s; + for (f = 0; f < xa; ++f) { + u = s; + if (r.pb) u = r.Kb[f], r.tb || (u += e); + else if (0 < f) { + a.yb[f] = a.yb[0]; + continue + } else u = e; + var v = a.yb[f]; + v.sc[0] = Ic[wa(u + k, 127)]; + v.sc[1] = Jc[wa(u + 0, 127)]; + v.sb[0] = 2 * Ic[wa(u + n, 127)]; + v.sb[1] = 101581 * Jc[wa(u + l, 127)] >> 16; + 8 > v.sb[1] && + (v.sb[1] = 8); + v.qc[0] = Ic[wa(u + m, 117)]; + v.qc[1] = Jc[wa(u + q, 127)] + } + if (g.fb) a.Zc = 259; + else return Y(a, Hf, "Not a key frame."); + G(h); + e = a.R; + for (k = 0; k < Md; ++k) + for (n = 0; n < Nd; ++n) + for (l = 0; l < Kc; ++l) + for (m = 0; m < Lc; ++m) w(h, If[k][n][l][m]) && (e.z[k][n][l][m] = S(h, 8)); + a.pc = G(h); + a.pc && (a.Pc = S(h, 8)); + if (a.P.uc) { + c -= 8; + h = Mb; + if (8 > g.Ra || 1 != d[c + 8 - 1]) return Y(a, W, "RIFF: Inconsistent extra information."); + h = d[c + 0] << 0 | d[c + 1] << 8 | d[c + 2] << 16; + a.fc = h; + a.dd = p; + a.cd = d[c + 3] + } + return a.za = 1 + } + + function Mc(a, b, c, d, e, g) { + var k = b[e][c]; + if (!w(a, k[0])) return 0; + for (;;) { + ++e; + if (w(a, k[1])) { + var h; + if (w(a, k[2])) { + if (w(a, k[3])) + if (w(a, k[6])) { + h = x; + c = w(a, k[8]); + k = w(a, k[9 + c]); + k = 2 * c + k; + c = 0; + h = Jf[k]; + var n; + for (n = 0; n < h.length - 1; ++n) c += c + w(a, h[n]); + c += 3 + (8 << k) + } else w(a, k[7]) ? (c = 7 + 2 * w(a, 165), c += w(a, 145)) : c = 5 + w(a, 159); + else c = w(a, k[4]) ? 3 + w(a, k[5]) : 2; + k = b[Nc[e]][2] + } else k = b[Nc[e]][1], c = 1; + h = Kf[e - 1]; + g[g[g.length - 1] + h] = (w(a, 128) ? -c : c) * d[(0 < h) + 0]; + if (16 == e || !w(a, k[0])) return e + } else k = b[Nc[e]][0]; + if (16 == e) return 16 + } + } + + function ob(a, b) { + return ((16777216 * a[0] + 65536 * a[1] + 256 * a[2] + 1 * a[3]) * Lf & + 4278190080) >> b + } + + function Mf(a, b) { + var c = 0; + if (a == p) return 0; + if (b == p) return Y(a, "VP8_STATUS_INVALID_PARAM", "NULL VP8Io parameter in VP8Decode()."); + if (!a.za && !Hd(a, b)) return 0; + $(a.za); + var d; + if (b.Mb && !b.Mb(b)) Y(a, Nf, "Frame setup failed"), d = a.a; + else { + b.Za && (a.A = 0); + var e = uc[a.A]; + 2 == a.A ? (a.lb = 0, a.mb = 0) : (a.lb = b.t - e >> 4, a.mb = b.k - e >> 4, 0 > a.lb && (a.lb = 0), 0 > a.mb && (a.mb = 0)); + a.Ya = b.K + 15 + e >> 4; + a.wb = b.Ka + 15 + e >> 4; + a.wb > a.Ma && (a.wb = a.Ma); + a.Ya > a.hb && (a.Ya = a.hb); + d = L + } + if (c = d == L) { + if (c) { + var g; + b: { + a.Ja = 0; + if (a.qb) { + var k = a.rc; + if (!WebPWorkerReset(k)) { + g = + Y(a, cb, "thread initialization failed."); + break b + } + k.Qd = a; + k.Rd = a.oa.N; + k.Ud = FinishRow; + a.jb = 0 < a.A ? Od : Od - 1 + } else a.jb = Of; + g = 1 + } + var h; + if (!(h = !g)) { + var n; + b: { + var l = a.jb, + m = a.Ma, + t = 4 * m, + q = 32 * m, + r = m + 1, + u = 0 < a.A ? m * (a.qb ? 2 : 1) : 0, + v = Pf, + C = q * (16 * l + parseInt(3 * uc[a.A] / 2, 10)), + A = a.Ga != p ? a.P.l * a.P.v : 0, + z = t + q + r + u + v + 384 + C + A + Pd; + if (z != z) n = 0; + else { + if (z > a.Gb) { + a.ib = 0; + a.Gb = 0; + if (a.ib == p) { + n = Y(a, "VP8_STATUS_OUT_OF_MEMORY", "no memory during frame initialization."); + break b + } + a.Gb = z + } + a.dc = 205; + a.Xc = rc(205, 16 * m); + a.Sc = rc(205, 8 * m); + a.Vc = rc(205, 8 * m); + a.M = + u ? ic(Oc, u) : p; + a.Sd = u ? 0 : p; + a.oa.ha = 0; + a.oa.M = a.M; + $(0 == (v & Pd)); + a.Ea = rc(205, 1 * v); + a.z = -12851; + a.H = 16 * m; + a.r = 8 * m; + var Ha = uc[a.A], + G = Ha * a.H, + y = Ha / 2 * a.r; + a.ca = U(C, 205); + a.da = +G; + a.aa = a.ca; + a.ba = a.da + 16 * l * a.H + y; + a.ra = a.aa; + a.sa = a.ba + 8 * l * a.r + y; + a.Xb = A ? U(A, x) : p; + a.La = ic(Qd, r); + a.dc = rc($b, t); + n = 1 + } + } + h = !n + } + if (h) c = 0; + else { + b.width = a.P.l; + b.height = a.P.v; + b.w = 0; + b.y = a.ca; + b.D = a.da; + b.c = a.aa; + b.B = a.ba; + b.S = a.ra; + b.C = a.sa; + b.F = a.H; + b.Da = a.r; + b.p = p; + b.q = p; + if (!Rd) { + var B; + for (B = -255; 255 >= B; ++B) va[255 + B] = 0 > B ? -B : B, tc[255 + B] = va[255 + B] >> 1; + for (B = -1020; 1020 >= + B; ++B) sc[1020 + B] = -128 > B ? -128 : 127 < B ? 127 : B; + for (B = -112; 112 >= B; ++B) oc[112 + B] = -16 > B ? -16 : 15 < B ? 15 : B; + for (B = -255; 510 >= B; ++B) oa[255 + B] = 0 > B ? 0 : 255 < B ? 255 : B; + Rd = 1 + } + mc = pf; + Pc = qf; + Qc = nc; + Rc = rf; + Sd = uf; + Td = vf; + Ud = yf; + Vd = zf; + Wd = wf; + Xd = xf; + Yd = Af; + Zd = Bf; + $d = Dd; + ae = Ed; + be = sf; + ce = tf; + c = 1 + } + } + if (c) a: { + for (a.d = 0; a.d < a.Ya; ++a.d) { + var Qf = a.ic[a.d & a.Hb - 1], + db = a, + F = db.La[0]; + F.X = 0; + F.ua = 0; + jd(db.cc, 0, $b, db.cc.length); + db.W = (0 < db.A && db.d >= db.mb && db.d <= db.Ya) + 0; + for (a.i = 0; a.i < a.Ma; a.i++) { + var D; + var H = a, + T = Qf, + ya = H.o, + S = H.La[0], + J = H.La[1 + H.i]; + H.Ca.ob && (H.Lb = !w(ya, + H.R.Ta[0]) ? 0 + w(ya, H.R.Ta[1]) : 2 + w(ya, H.R.Ta[2])); + J.Nb = H.pc ? w(ya, H.Pc) : 0; + var O = H.dc; + O[O.length - 1] = 0 + 4 * H.i; + var Sc = H.cc; + H.wa = !w(ya, 145); + if (H.wa) + for (var ga = H.Eb, ja = 0, Z = ca, Z = 0; 4 > Z; ++Z) { + var V = Sc[Z], + R; + for (R = 0; 4 > R; ++R) { + var ta = Rf[O[O[O.length - 1] + R]][V], + za = 0; + do za = Sf[2 * za + w(ya, ta[za])]; while (0 < za); + V = -za; + O[O[O.length - 1] + R] = V; + ga[ja] = V; + ja++ + } + Sc[Z] = V + } else { + var V = w(ya, 156) ? w(ya, 128) ? de : ee : w(ya, 163) ? fe : ge; + H.Eb[0] = V; + for (za = 0; 4 > za; ++za) O[za + O[O.length - 1]] = V; + for (za = 0; 4 > za; ++za) Sc[za] = V + } + H.Tc = !w(ya, 142) ? ge : !w(ya, 114) ? fe : + w(ya, 183) ? de : ee; + if (ya.Ab) D = 0; + else { + if (J.Nb) S.X = J.X = 0, H.wa || (S.ua = J.ua = 0), H.ja = 0, H.Oa = 0; + else { + var ia = ca, + ka = ca, + sa = ca, + wa = Tf, + Aa = H.yb[H.Lb], + aa = H.z, + ma = H.La[0], + ua = U(4, 0), + xa = U(4, 0), + ea = U(4, 0), + pb = U(4, 0), + na = 0, + Ba = 0, + pa = ca, + qa = ca, + Sa = ca, + aa = rc(0, 384); + if (H.wa) sa = 0, wa = H.R.z[3]; + else { + var ab = U(16, 0), + Ca = J.ua + ma.ua; + J.ua = ma.ua = (0 < Mc(T, H.R.z[1], Ca, Aa.sb, 0, ab)) + 0; + for (var sa = 1, wa = H.R.z[0], qb = ab, Ta = aa, La = U(16, s), X = s, X = 0; 4 > X; ++X) { + var Da = qb[0 + X] + qb[12 + X], + Ea = qb[4 + X] + qb[8 + X], + Fa = qb[4 + X] - qb[8 + X], + Ga = qb[0 + X] - qb[12 + X]; + La[0 + X] = Da + Ea; + La[8 + + X] = Da - Ea; + La[4 + X] = Ga + Fa; + La[12 + X] = Ga - Fa + } + for (X = 0; 4 > X; ++X) { + var Oa = Ta[Ta.length - 1], + lb = La[0 + 4 * X] + 3, + Da = lb + La[3 + 4 * X], + Ea = La[1 + 4 * X] + La[2 + 4 * X], + Fa = La[1 + 4 * X] - La[2 + 4 * X], + Ga = lb - La[3 + 4 * X]; + Ta[Oa + 0] = Da + Ea >> 3; + Ta[Oa + 16] = Ga + Fa >> 3; + Ta[Oa + 32] = Da - Ea >> 3; + Ta[Oa + 48] = Ga - Fa >> 3; + Ta[Ta.length - 1] += 64 + } + aa[aa.length - 1] = 0 + } + ea = Nb(vc[J.X & 15]); + pb = Nb(vc[ma.X & 15]); + for (qa = 0; 4 > qa; ++qa) { + for (var Eb = pb[qa], pa = 0; 4 > pa; ++pa) { + var Ca = Eb + ea[pa], + Ka = Mc(T, wa, Ca, Aa.sc, sa, aa); + ea[pa] = Eb = (0 < Ka) + 0; + xa[pa] = (0 != aa[aa[aa.length - 1] + 0]) + 0; + ua[pa] = (1 < Ka) + 0; + aa[aa.length - + 1] += 16 + } + pb[qa] = Eb; + Ba |= ob(xa, 24 - 4 * qa); + na |= ob(ua, 24 - 4 * qa) + } + ia = ob(ea, 24); + ka = ob(pb, 24); + ea = Nb(vc[J.X >> 4]); + pb = Nb(vc[ma.X >> 4]); + for (Sa = 0; 4 > Sa; Sa += 2) { + for (qa = 0; 2 > qa; ++qa) { + Eb = pb[Sa + qa]; + for (pa = 0; 2 > pa; ++pa) Ca = Eb + ea[Sa + pa], Ka = Mc(T, H.R.z[2], Ca, Aa.qc, 0, aa), ea[Sa + pa] = Eb = (0 < Ka) + 0, xa[2 * qa + pa] = (0 != aa[aa[aa.length - 1] + 0]) + 0, ua[2 * qa + pa] = (1 < Ka) + 0, aa[aa.length - 1] += 16; + pb[Sa + qa] = Eb + } + Ba |= ob(xa, 8 - 2 * Sa); + na |= ob(ua, 8 - 2 * Sa) + } + ia |= ob(ea, 20); + ka |= ob(pb, 20); + J.X = ia; + ma.X = ka; + H.z = aa; + H.Oa = na + 0; + H.ja = na | Ba; + J.Nb = !H.ja + 0 + } + D = !T.Ab + } + if (!D) { + c = Y(a, "VP8_STATUS_NOT_ENOUGH_DATA", + "Premature end-of-file encountered." + a.i + " " + a.d); + break a + } + var P = a, + da = P.Ea, + Ma = Tc, + Ua = P.Ea, + Va = Uc, + Wa = P.Ea, + Xa = he; + if (0 < P.i) { + for (var ba = ca, ba = -1; 16 > ba; ++ba) Ec(da, Ma + ba * f - 4, da, Ma + ba * f + 12); + for (ba = -1; 8 > ba; ++ba) Ec(Ua, Va + ba * f - 4, Ua, Va + ba * f + 4), Ec(Wa, Xa + ba * f - 4, Wa, Xa + ba * f + 4) + } else { + for (ba = 0; 16 > ba; ++ba) da[Ma + ba * f - 1] = 129; + for (ba = 0; 8 > ba; ++ba) Ua[Va + ba * f - 1] = 129, Wa[Xa + ba * f - 1] = 129; + 0 < P.d && (da[Ma - 1 - f] = Ua[Va - 1 - f] = Wa[Xa - 1 - f] = 129) + } + var Qa = P.Xc, + Ra = 16 * +P.i, + mb = P.Sc, + vb = 8 * +P.i, + wb = P.Vc, + xb = 8 * +P.i, + Za = P.z, + fa = ca; + if (0 < P.d) N(da, Ma - f, Qa, Ra, + 16), N(Ua, Va - f, mb, vb, 8), N(Wa, Xa - f, wb, xb, 8); + else if (0 == P.i) { + for (i = 0; 21 > i; ++i) da[Ma - f - 1 + i] = 127; + for (i = 0; 9 > i; ++i) Ua[Va - f - 1 + i] = 127; + for (i = 0; 9 > i; ++i) Wa[Xa - f - 1 + i] = 127 + } + if (P.wa) { + var Ya = Ma - f + 16; + 0 < P.d && (P.i >= P.Ma - 1 ? da[Ya + 0] = da[Ya + 1] = da[Ya + 2] = da[Ya + 3] = Qa[Ra + 15] : N(da, Ya + 0, Qa, Ra + 16, 4)); + for (var Fb = 0; 4 > Fb; ++Fb) da[Fb + Ya + 4 * f] = da[Fb + Ya + 4 * f] = da[Fb + Ya + 8 * f] = da[Fb + Ya + 12 * f] = da[Fb + Ya + 0]; + for (fa = 0; 16 > fa; fa++) { + var ac = da, + bc = Ma + ie[fa]; + Uf[P.Eb[fa]](ac, bc); + P.Oa & 1 << fa ? mc(Za, 16 * +fa, ac, bc, 0) : P.ja & 1 << fa && Qc(Za, 16 * +fa, ac, bc) + } + } else { + var $a = + Fd(P, P.Eb[0]); + Vf[$a](da, Ma); + if (P.ja) + for (fa = 0; 16 > fa; fa++) ac = da, bc = Ma + ie[fa], P.Oa & 1 << fa ? mc(Za, 16 * +fa, ac, bc, 0) : P.ja & 1 << fa && Qc(Za, 16 * +fa, ac, bc) + } + $a = Fd(P, P.Tc); + je[$a](Ua, Va); + je[$a](Wa, Xa); + if (P.ja & 983040) { + var zb = P.z, + Pa = 256; + P.Oa & 983040 ? Pc(zb, Pa, Ua, Va) : Rc(zb, Pa, Ua, Va) + } + if (P.ja & 15728640) { + var Ab = P.z, + Pa = 320; + P.Oa & 15728640 ? Pc(Ab, Pa, Wa, Xa) : Rc(Ab, Pa, Wa, Xa) + } + P.d < P.hb - 1 && (N(Qa, Ra, da, Ma + 15 * f, 16), N(mb, vb, Ua, Va + 7 * f, 8), N(wb, xb, Wa, Xa + 7 * f, 8)); + var Q = a; + if (0 < Q.A) { + var kb = Q.M[1 + Q.i], + Kb = Q.La[1 + Q.i].Nb, + ha = Q.Zb[Q.Lb]; + Q.ga.oc && (ha += + Q.ga.Lc[0], Q.wa && (ha += Q.ga.Gc[0])); + ha = 0 > ha ? 0 : 63 < ha ? 63 : ha; + kb.zc = ha; + 0 < Q.ga.kb && (ha = 4 < Q.ga.kb ? ha >> 2 : ha >> 1, ha > 9 - Q.ga.kb && (ha = 9 - Q.ga.kb)); + kb.yc = 1 > ha ? 1 : ha; + kb.ab = (!Kb || Q.wa) + 0 + } + for (var Ia = ca, Bb = 8 * Q.Ja * Q.r, Qb = Q.ca, Ub = Q.da + 16 * Q.i + 16 * Q.Ja * Q.H, Wb = Q.aa, Xb = Q.ba + 8 * Q.i + Bb, Yb = Q.ra, Zb = Q.sa + 8 * Q.i + Bb, Ia = 0; 16 > Ia; ++Ia) N(Qb, Ub + Ia * Q.H, Q.Ea, +Tc + Ia * f, 16); + for (Ia = 0; 8 > Ia; ++Ia) N(Wb, Xb + Ia * Q.r, Q.Ea, +Uc + Ia * f, 8), N(Yb, Zb + Ia * Q.r, Q.Ea, +he + Ia * f, 8) + } + var K = a, + I = b, + cc = 1, + eb = K.oa; + if (K.qb) { + var nb = K.rc, + cc = cc & WebPWorkerSync(nb); + $(nb.a == OK); + if (cc) { + eb.N = + I; + eb.ha = K.Ja; + eb.d = K.d; + eb.W = K.W; + if (eb.W) { + var hc = eb.M; + eb.M = K.M; + K.M = hc + } + WebPWorkerLaunch(nb); + ++K.Ja == K.jb && (K.Ja = 0) + } + } else { + eb.d = K.d; + eb.W = K.W; + b: { + var Hb = 1, + rb = K.oa, + ib = uc[K.A], + yb = ib * K.H, + dc = parseInt(ib / 2) * K.r, + Ib = 16 * rb.ha * K.H, + jb = 8 * rb.ha * K.r, + Jb = K.ca, + Lb = K.da - yb + Ib, + Ob = K.aa, + Pb = K.ba - dc + jb, + Rb = K.ra, + Sb = K.sa - dc + jb, + jc = 0 == rb.d, + Tb = (rb.d >= K.hb - 1) + 0, + ra = 16 * rb.d, + fb = 16 * (rb.d + 1); + if (rb.W) { + var pc = K, + wc = s, + kc = pc.oa.d; + $(pc.oa.W); + for (wc = pc.lb; wc < pc.wb; ++wc) { + var Na = pc, + ec = wc, + Vb = kc, + xc = Na.oa, + gb = Na.H, + fc = xc.M[1 + ec], + sb = Na.ca, + tb = Na.da + 16 * xc.ha * + gb + 16 * ec, + Gb = fc.zc, + hb = fc.yc, + Ja = 2 * Gb + hb; + if (0 != Gb) + if (1 == Na.A) 0 < ec && ae(sb, tb, gb, Ja + 4), fc.ab && ce(sb, tb, gb, Ja), 0 < Vb && $d(sb, tb, gb, Ja + 4), fc.ab && be(sb, tb, gb, Ja); + else { + var gc = Na.r, + yc = Na.aa, + zc = Na.ba + 8 * xc.ha * gc + 8 * ec, + Ac = Na.ra, + Bc = Na.sa + 8 * xc.ha * gc + 8 * ec, + ub = Na.Ac.fb ? 40 <= Gb ? 2 : 15 <= Gb ? 1 : 0 : 40 <= Gb ? 3 : 20 <= Gb ? 2 : 15 <= Gb ? 1 : 0; + 0 < ec && (Td(sb, tb, gb, Ja + 4, hb, ub), Vd(yc, zc, Ac, Bc, gc, Ja + 4, hb, ub)); + fc.ab && (Xd(sb, tb, gb, Ja, hb, ub), Zd(yc, zc, Ac, Bc, gc, Ja, hb, ub)); + 0 < Vb && (Sd(sb, tb, gb, Ja + 4, hb, ub), Ud(yc, zc, Ac, Bc, gc, Ja + 4, hb, ub)); + fc.ab && (Wd(sb, tb, gb, + Ja, hb, ub), Yd(yc, zc, Ac, Bc, gc, Ja, hb, ub)) + } + } + } + if (I.put) { + jc ? (I.y = K.ca, I.D = K.da + Ib, I.c = K.aa, I.B = K.ba + jb, I.S = K.ra, I.C = K.sa + jb) : (ra -= ib, I.y = Jb, I.D = Lb, I.c = Ob, I.B = Pb, I.S = Rb, I.C = Sb); + Tb || (fb -= ib); + fb > I.K && (fb = I.K); + if (K.Ga != p && ra < fb && (0 == ra ? (I.p = qd(K, ra, fb - ra), I.q = 0) : I.q = qd(K, ra, fb - ra), I.p == p)) { + cc = Y(K, W, "Could not decode alpha data."); + break b + } + if (ra < I.k) { + var qc = I.k - ra, + ra = I.k; + $(!(qc & 1)); + I.D += K.H * qc; + I.B += K.r * (qc >> 1); + I.C += K.r * (qc >> 1); + I.p != p && (I.q += I.width * qc) + } + ra < fb && (I.D += I.t, I.B += I.t >> 1, I.C += I.t >> 1, I.p != p && (I.q += I.t), + I.w = ra - I.k, I.m = I.Ka - I.t, I.h = fb - ra, Hb = I.put(I)) + } + rb.ha + 1 == K.jb && !Tb && (N(K.ca, K.da - yb, Jb, Lb + 16 * K.H, yb), N(K.aa, K.ba - dc, Ob, Pb + 8 * K.r, dc), N(K.ra, K.sa - dc, Rb, Sb + 8 * K.r, dc)); + cc = Hb + } + } + if (!cc) { + c = Y(a, "VP8_STATUS_USER_ABORT", "Output aborted."); + break a + } + } + var Cb; + if (!(Cb = a.qb && !WebPWorkerSync(a.rc))) { + var Db; + if (Db = 0 < a.fc) $(a), $(0 < a.fc), Db = !1; + Cb = Db + } + c = Cb ? 0 : 1 + } + var lc = c; + b.Pb && b.Pb(b); + c = lc & 1 + } + if (!c) return ke(a), 0; + a.za = 0; + return c + } + + function ke(a) { + a != p && (a.ib && (a.ib = 0), a.ib = p, a.Gb = 0, a.za = 0) + } + + function Aa(a, b) { + return a + (1 << b) - 1 >> b + } + + function hc(a, b, c, d, e) { + var g = vb[c] + wb[b] >> ea; + b = xb[b]; + d[e + 0] = ia[a + Za[c] - J]; + d[e + 1] = ia[a + g - J]; + d[e + 2] = ia[a + b - J] + } + + function le(a, b, c, d, e) { + var g = vb[c] + wb[b] >> ea; + b = xb[b]; + d[e + 0] = ia[a + Za[c] - J] & 248 | ia[a + g - J] >> 5; + d[e + 1] = ia[a + g - J] << 3 & 224 | ia[a + b - J] >> 3 + } + + function me(a, b, c, d, e) { + d[e + 0] = 255; + hc(a, b, c, d, e + 1) + } + + function ne(a, b, c, d, e) { + var g = xb[b]; + d[e + 0] = Hb[a + Za[c] - J] << 4 | Hb[a + (vb[c] + wb[b] >> ea) - J]; + d[e + 1] = 15 | Hb[a + g - J] << 4 + } + + function Vc(a, b, c, d, e) { + var g = Za[c]; + c = vb[c] + wb[b] >> ea; + d[e + 0] = ia[a + xb[b] - J]; + d[e + 1] = ia[a + c - J]; + d[e + 2] = ia[a + g - J] + } + + function oe(a, b, c, d, e) { + Vc(a, b, c, d, e); + d[e + 3] = 255 + } + + function pe(a, b, c, d, e) { + hc(a, b, c, d, e); + d[e + 3] = 255 + } + + function ib(a, b, c) { + a[b] = ((((a[b] & 4278255360) >>> 0) + ((c & 4278255360) >>> 0) & 4278255360) >>> 0 | (a[b] & 16711935) + (c & 16711935) & 16711935) >>> 0 + } + + function ka(a, b) { + return (((a ^ b) & 4278124286) >>> 1) + ((a & b) >>> 0) >>> 0 + } + + function $a(a) { + return 256 > a && 0 < a ? a : 0 >= a ? 0 : ~a >> 24 & 255 + } + + function yb(a, b) { + return $a(a + parseInt((a - b) / 2, 10)) + } + + function Wc() { + return qe + } + + function Xc(a, b) { + a &= 255; + b &= 255; + 127 < a && (a -= 256); + 127 < b && (b -= 256); + return a * b >>> 5 + } + + function re(a, + b, c, d, e, g, k) { + var h = s, + n = 8 >> a.n, + l = a.U, + f = a.u; + if (8 > n) { + a = (1 << a.n) - 1; + for (var t = (1 << n) - 1, h = b; h < c; ++h) { + b = 0; + for (var q = s, q = 0; q < l; ++q) 0 == (q & a) && (b = d[e++] >> 8 & 255), g[k++] = f[b & t], b >>= n + } + } else + for (h = b; h < c; ++h) + for (q = 0; q < l; ++q) g[k++] = f[d[e++] >> 8 & 255] + } + + function se(a, b, c, d, e) { + for (c = b + c; b < c;) { + var g = a[b++]; + d[e++] = g >> 16 & 255; + d[e++] = g >> 8 & 255; + d[e++] = g >> 0 & 255; + d[e++] = g >> 24 & 255 + } + } + + function te(a, b, c, d, e) { + for (c = b + c; b < c;) { + var g = a[b++]; + d[e++] = g >> 16 & 240 | g >> 12 & 15; + d[e++] = g >> 0 & 240 | g >> 28 & 15 + } + } + + function Ib(a, b, c, d, e) { + for (c = b + c; b < c;) { + var g = + a[b++]; + d[e++] = g >> 24 & 255; + d[e++] = g >> 16 & 255; + d[e++] = g >> 8 & 255; + d[e++] = g >> 0 & 255 + } + } + + function ue(a, b, c, d) { + if (T(a, 8) != ve) return 0; + b[0] = T(a, we) + 1; + c[0] = T(a, we) + 1; + d[0] = T(a, 1); + T(a, Wf); + return 1 + } + + function xe(a, b) { + var c = s; + if (4 > a) return a + 1; + c = a - 2 >> 1; + return (2 + (a & 1) << c) + T(b, c) + 1 + } + + function Oa(a, b) { + if (b.Q + 8 > b.ya) { + var c = a.Y, + d = 0; + for ($(c != p); 0 != c[d].s;) { + var e = c, + g = b, + k = g.T >> g.g & 1; + g.L ? g.fa = 1 : (++g.g, 8 <= g.g && Sb(g), g.Q == g.ya && 32 == g.g && (g.L = 1)); + d = d + e[d].s + k + } + return c[d].kc + } + c = a.Y; + d = 0; + for ($(c != p); 0 != c[d].s;) e = c, g = b.T >> b.g & 1, ++b.g, d = d + + e[d].s + g; + return c[d].kc + } + + function zb(a, b) { + if (a != p) + for (var c = s, d = s, c = 0; c < b; ++c) + for (var e = a[c].va, d = 0; d < Yc; ++d) ja(e[d]) + } + + function ye(a, b, c) { + b = 0 == a.eb ? 0 : a.ac[a.bd + a.Ec * (c >> a.eb) + (b >> a.eb)]; + $(b < a.hc); + return a.Db[+b] + } + + function ze(a, b, c, d) { + var e = a.Na, + g = a.O, + k = g + b, + h = c, + f = d; + d = a.Xa; + c = a.vb; + for (N(d, c, h, f, a.l * b); 0 < e--;) { + b = a.nc[e]; + var l = g, + m = k, + t = h, + q = f, + f = d, + h = c; + $(l < m); + $(m <= b.Vb); + switch (b.Qc) { + case Ae: + t = 0; + for (b = h + (m - l) * b.U; h < b;) { + var m = f, + q = h, + r = m[q] >> 8 & 255, + u = (m[q] & 16711935) >>> 0, + u = u + (r << 16 | r), + u = u & 16711935; + f[h++] = ((m[q] & 4278255360) >>> + 0 | u) >>> 0; + 32 == l && t++ + } + break; + case Be: + var v = b, + C = l, + t = m, + q = f, + r = h, + u = v.U; + if (0 == C) { + var A = s; + ib(q, r, qe); + for (A = 1; A < u; ++A) ib(q, r + A, q[r + A - 1]); + r += u; + ++C + } + for (var z = (1 << v.n) - 1, Ha = Aa(u, v.n), w = v.u, v = +(C >> v.n) * Ha; C < t;) { + var y = w, + B = v, + G = p; + ib(q, r, q[r - u + 0]); + G = Ce[y[B++] >> 8 & 15]; + for (A = 1; A < u; ++A) { + var F = E; + 0 == (A & z) && (G = Ce[y[B++] >> 8 & 15]); + F = G(q[r + A - 1], q, r + A - u); + ib(q, r + A, F) + } + r += u; + ++C; + 0 == (C & z) && (v += Ha) + } + m != b.Vb && (b = b.U, N(f, h - b, f, h + (m - l - 1) * b, b)); + break; + case De: + t = b.U; + q = (1 << b.n) - 1; + r = Aa(t, b.n); + u = b.u; + for (b = +(l >> b.n) * r; l < m;) { + A = u; + C = b; + z = M(Xf); + Ha = + s; + for (Ha = 0; Ha < t; ++Ha) 0 == (Ha & q) && (w = A[C++], v = z, v.Cc = w >> 0 & 255, v.Bc = w >> 8 & 255, v.Kc = w >> 16 & 255), w = f[h + Ha], v = w >>> 8, y = w >>> 16, B = w, y += Xc(z.Cc, v), y &= 255, B += Xc(z.Bc, v), B += Xc(z.Kc, y), B &= 255, f[h + Ha] = (w & 4278255360 | y << 16 | B) >>> 0; + h += t; + ++l; + 0 == (l & q) && (b += r) + } + break; + case Ee: + t == f && 0 < b.n ? (t = (m - l) * Aa(b.U, b.n), q = h + (m - l) * b.U - t, memmove(f, q, f, h, t), re(b, l, m, f, q, f, h)) : re(b, l, m, t, q, f, h) + } + h = d; + f = c + } + } + + function Yf(a, b) { + var c = a.V, + d = a.Ha + a.l * a.O, + e = b - a.O; + if (!(0 >= e)) { + ze(a, e, c, d); + var g = a.N, + c = a.Xa, + k = [a.vb]; + var d = a.O, + e = b, + h = k, + f = g.width; + $(d < e); + $(g.t < g.Ka); + e > g.K && (e = g.K); + if (d < g.k) { + var l = g.k - d, + d = g.k; + h[0] += f * l + } + d >= e ? d = 0 : (h[0] += g.t, g.w = d - g.k, g.m = g.Ka - g.t, g.h = e - d, d = 1); + if (d) { + k = k[0]; + d = a.Ib; + e = g.width; + if (d.J < ua) { + var m = d.c.RGBA, + h = m.ma, + t = m.Sa + a.xa * m.f; + if (g.I) c = EmitRescaledRows(a, c, k, e, g.h, h, t, m.f); + else { + for (var f = d.J, l = g.m, g = g.h, m = m.f, q = g; 0 < q--;) { + var r = c, + u = k, + v = l, + C = h, + A = t; + switch (f) { + case Qa: + for (v = u + v; u < v;) { + var z = r[u++]; + C[A++] = z >> 16 & 255; + C[A++] = z >> 8 & 255; + C[A++] = z >> 0 & 255 + } + break; + case jb: + se(r, u, v, C, A); + break; + case Ob: + se(r, u, v, C, A); + WebPApplyAlphaMultiply(C, 0, v, + 1, 0); + break; + case Zc: + for (v = u + v; u < v;) z = r[u++], C[A++] = z >> 0 & 255, C[A++] = z >> 8 & 255, C[A++] = z >> 16 & 255; + break; + case Pa: + Ib(r, u, v, C, A); + break; + case Pb: + Ib(r, u, v, C, A); + WebPApplyAlphaMultiply(C, 0, v, 1, 0); + break; + case Ab: + Ib(r, u, v, C, A); + break; + case Bb: + Ib(r, u, v, C, A); + WebPApplyAlphaMultiply(C, 1, v, 1, 0); + break; + case kb: + te(r, u, v, C, A); + break; + case Qb: + te(r, u, v, C, A); + WebPApplyAlphaMultiply4444(C, v, 1, 0); + break; + case Fe: + for (v = u + v; u < v;) z = r[u++], C[A++] = z >> 16 & 248 | z >> 13 & 7, C[A++] = z >> 5 & 224 | z >> 3 & 31; + break; + default: + $(0) + } + k += e; + t += m + } + c = g + } + a.xa += c + } else a.xa = + g.I ? EmitRescaledRowsYUVA(a, c, k, e, g.h) : EmitRowsYUVA(a, c, k, e, g.m, g.h); + $(a.xa <= d.height) + } + a.O = b; + $(a.O <= a.v) + } + } + + function lc(a, b, c, d, e, g) { + var k = 1, + h = 0, + f = 0, + l = a.o, + m = a.cb, + t = m.Db, + q = c, + r = c; + c += d * e; + e = Ba + Ge; + var u = e + m.xb, + v = 0 < m.xb ? m.Yb : p, + C = m.Dc, + A = !1; + $(t != p); + a: for (; !l.L && q < c;) { + var z = s; + A || (0 == (h & C) && (t = ye(m, h, f)), Da(l), z = Oa(t.va[Zf], l)); + if (z < Ba || A) { + if (!A) { + var w = k = A = s, + y = s; + Da(l); + A = Oa(t.va[$f], l); + k = z; + Da(l); + w = Oa(t.va[ag], l); + Da(l); + y = Oa(t.va[bg], l); + b[q] = (y << 24 >>> 0) + (A << 16) + (k << 8) + w + } + A = !1; + ++q; + ++h; + if (h >= d && (h = 0, ++f, g != p && 0 == f % + $c && g(a, f), v != p)) + for (; r < q;) k = b[r++], v.ea[ad * k >>> v.bb] = k + } else if (z < e) { + w = w = s; + k = xe(z - Ba, l); + z = Oa(t.va[cg], l); + Da(l); + w = xe(z, l); + w > He ? w -= He : (z = dg[w - 1], z = (z >> 4) * d + (8 - (z & 15)), w = 1 <= z ? z : 1); + z = s; + for (z = 0; z < k; ++z) b[q + z] = b[q + z - w]; + q += k; + for (h += k; h >= d;) h -= d, ++f, g != p && 0 == f % $c && g(a, f); + if (q < c && (t = ye(m, h, f), v != p)) + for (; r < q;) k = b[r++], v.ea[ad * k >>> v.bb] = k + } else if (z < u) { + A = z - e; + for ($(v != p); r < q;) z = b[r++], v.ea[ad * z >>> v.bb] = z; + z = b; + w = q; + y = v; + $(A <= -1 >>> y.bb); + z[w] = y.ea[A]; + A = !0; + continue a + }(k = !l.fa) || End + } + g != p && g(a, f); + l.fa || !k || l.L && q < c ? (k = + 0, a.a = !l.L ? W : Ie) : q == c && (a.Ob = Db); + return k + } + + function bd(a) { + $(a); + a.ac = p; + zb(a.Db, a.hc); + var b = a.Yb; + b != p && (b.ea = p, b.ea = p); + $(a) + } + + function sd() { + var a = M(eg); + if (a == p) return p; + a.a = L; + a.Wa = cd; + a.Ob = cd; + return a + } + + function sa(a) { + var b = s; + if (a != p) { + bd(a.cb); + a.V = p; + a.V = p; + for (b = 0; b < a.Na; ++b) { + var c = a.nc[b]; + c.u = p; + c.u = p + } + a.Na = 0; + a.Ub = 0; + a.Mc = p; + a.Mc = p; + a.Ib = p + } + } + + function Ka(a, b, c, d, e) { + var g = 1; + a = [a]; + b = [b]; + for (var k = d.o, h = d.cb, f = p, l = p, l = 0;;) { + if (c) + for (; g && T(k, 1);) { + var m = a, + t = b, + q = d, + r = 1, + u = q.o, + g = q.nc[q.Na], + v = T(u, 2); + if (q.Ub & 1 << v) g = 0; + else { + q.Ub |= + 1 << v; + g.Qc = v; + g.U = m[0]; + g.Vb = t[0]; + g.u = [p]; + g.b = 0; + ++q.Na; + $(q.Na <= Je); + switch (v) { + case Be: + case De: + g.n = T(u, 3) + 2; + r = Ka(Aa(g.U, g.n), Aa(g.Vb, g.n), 0, q, g.u); + break; + case Ee: + t = T(u, 8) + 1; + r = 16 < t ? 0 : 4 < t ? 1 : 2 < t ? 2 : 3; + m[0] = Aa(g.U, r); + g.n = r; + if (m = r = Ka(t, 1, 0, q, g.u)) + if (m = t, q = g, r = s, t = 1 << (8 >>> q.n) >>> 0, u = Array(t), u == p) m = 0; + else { + var v = q.u[0], + C = q.b; + u[0] = q.u[0][q.b + 0]; + for (r = 1; r < m; ++r) u[r] = ((((v[C + r] & 4278255360) >>> 0) + ((u[r - 1] & 4278255360) >>> 0) & 4278255360) >>> 0 | (v[C + r] & 16711935) + (u[r - 1] & 16711935) & 16711935) >>> 0; + for (; r < t; ++r) u[r] = 0; + q.u[0] = p; + q.b = p; + q.u[0] = u; + q.b = 0; + m = 1 + } + r = m; + break; + case Ae: + break; + default: + $(0) + } + g.u = g.u[0]; + g = r + } + } + if (g && T(k, 1) && (l = T(k, 4), g = 1 <= l && l <= fg, !g)) { + d.a = W; + break + } + if (g) a: { + var g = d, + A = a[0], + z = b[0], + m = l, + C = v = s, + C = g.o, + q = g.cb, + r = [p], + t = p, + u = 1; + if (c && T(C, 1)) { + var v = T(C, 3) + 2, + A = Aa(A, v), + w = Aa(z, v), + z = A * w; + if (!Ka(A, w, 0, g, r)) { + g.a = W; + zb(t, u); + g = 0; + break a + } + r = r[0]; + q.eb = v; + for (v = 0; v < z; ++v) A = r[v] >>> 8 & 65535, r[v] = A, A >= u && (u = A + 1) + } + if (C.fa) zb(t, u), g = 0; + else if ($(65536 >= u), t = ld(u, gg), t == p) g.a = cb, zb(t, u), g = 0; + else { + for (v = 0; v < u; ++v) { + z = t[v].va; + for (C = 0; C < Yc; ++C) { + A = hg[C]; + 0 == C && 0 < m && (A += 1 << m); + b: { + var y = A, + A = g, + G = z[+C], + B = 0, + w = A.o; + if (T(w, 1)) { + var F = Array(2), + D = Array(2), + L = Array(2), + B = T(w, 1) + 1, + J = T(w, 1); + F[0] = T(w, 0 == J ? 1 : 8); + D[0] = 0; + L[0] = B - 1; + 2 == B && (F[1] = T(w, 8), D[1] = 1, L[1] = B - 1); + c: { + var J = 0, + H = s; + $(G != p); + $(L != p); + $(D != p); + $(F != p); + if (nd(G, B)) { + for (H = 0; H < B; ++H) + if (D[H] != pd) { + if (0 > F[H] || F[H] >= y) { + (J = J && ma(G)) || ja(G); + B = J; + break c + } + if (!jc(G, F[H], D[H], L[H])) { + (J = J && ma(G)) || ja(G); + B = J; + break c + } + }(J = (J = 1) && ma(G)) || ja(G); + B = J + } else B = 0 + } + } else { + B = s; + D = []; + F = T(w, 4) + 4; + if (F > Ke) { + A.a = W; + A = 0; + break b + } + L = Array(y); + if (L == p) { + A.a = + cb; + A = 0; + break b + } + for (B = 0; B < F; ++B) D[ig[B]] = T(w, 3); + c: { + var B = A, + O = D, + D = y, + F = L, + J = 0, + H = B.o, + S = s, + V = s, + Y = jg, + Z = M(Le); + if (od(Z, O, Ke)) { + if (T(H, 1)) { + if (S = 2 + 2 * T(H, 3), V = 2 + T(H, S), V > D) { + B.a = W; + ja(Z); + B = J; + break c + } + } else V = D; + for (S = 0; S < D;) { + var R = s; + if (0 == V--) break; + Da(H); + R = Oa(Z, H); + if (R < Me) F[S++] = R, 0 != R && (Y = R); + else { + var O = R == kg, + R = R - Me, + ea = lg[R], + R = T(H, mg[R]) + ea; + if (S + R > D) { + B.a = W; + ja(Z); + B = J; + break c + } + for (O = O ? Y : 0; 0 < R--;) F[S++] = O + } + } + J = 1; + ja(Z); + B = J + } else B.a = W, B = 0 + } + B && (B = od(G, L, y)) + }(B = B && !w.fa) ? A = 1: (A.a = W, A = 0) + } + if (!A) { + zb(t, u); + g = 0; + break a + } + } + } + q.ac = r; + q.hc = + u; + q.Db = t; + g = 1 + } + } + if (!g) { + d.a = W; + break + } + if (0 < l) { + if (h.xb = 1 << l, m = h.Yb, q = 1 << l, $(m != p), $(0 < l), m.ea = U(q, 0), m.ea == p ? l = 0 : (m.bb = 32 - l, l = 1), !l) { + d.a = cb; + g = 0; + break + } + } else h.xb = 0; + l = d; + m = a[0]; + q = b[0]; + r = l.cb; + t = r.eb; + l.l = m; + l.v = q; + r.Ec = Aa(m, t); + r.Dc = 0 == t ? -1 : (1 << t) - 1; + if (c) { + d.Ob = Cb; + break + } + f = Array(a * b); + l = 0; + if (f == p) { + d.a = cb; + g = 0; + break + } + g = (g = lc(d, f, l, a, b, p)) && !k.fa; + break + } + g ? (e != p ? e[0] = f : ($(f == p), $(c)), c || bd(h)) : (bd(h), d.a == W && d.o.L && (d.a = Ie)); + return g + } + + function xd(a, b) { + var c = a.l * a.v, + d = c + b + b * $c; + $(a.l <= b); + a.V = Array(d); + a.Ha = 0; + if (a.V == p) return a.Xa = + p, a.a = cb, 0; + a.Xa = a.V; + a.vb = a.Ha + c + b; + return 1 + } + + function mf(a, b) { + var c = b - a.O, + d = a.V, + e = a.Ha + a.l * a.O; + if (!(0 >= c)) { + ze(a, c, d, e); + for (var e = a.N.width, c = e * c, d = a.N.ka, e = a.N.fd + e * a.O, g = a.Xa, k = a.vb, h = s, h = 0; h < c; ++h) d[e + h] = g[k + h] >>> 8 & 255; + a.O = a.xa = b + } + } + + function ng(a, b) { + var c = [s], + d = [s], + e = [s]; + if (a == p) return 0; + if (b == p) return a.a = ta, 0; + a.N = b; + a.a = L; + Rb(a.o, b.data, b.b, b.e); + if (!ue(a.o, c, d, e)) return a.a = W, sa(a), $(a.a != L), 0; + a.Ob = cd; + b.width = c[0]; + b.height = d[0]; + a.Wa = Cb; + return !Ka(c[0], d[0], 1, a, p) ? (sa(a), $(a.a != L), 0) : 1 + } + + function og(a) { + var b = + p, + c = p; + if (a == p) return 0; + b = a.N; + $(b != p); + c = b.ka; + $(c != p); + a.Ib = c.j; + a.Hc = c.Hc; + $(a.Ib != p); + if (!Ne(c.Qa, b, Pa)) return a.a = ta, sa(a), $(a.a != L), 0; + if (!xd(a, b.width) || b.I && !AllocateAndInitRescaler(a, b)) return sa(a), $(a.a != L), 0; + a.Wa = Db; + if (!lc(a, a.V, a.Ha, a.l, a.v, Yf)) return sa(a), $(a.a != L), 0; + c.ec = a.xa; + sa(a); + return 1 + } + + function wa(a, b) { + return 0 > a ? 0 : a > b ? b : a + } + + function ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, C, w, z) { + var y, G = C - 1 >> 1, + F = e[g + 0] | k[h + 0] << 16, + B = f[l + 0] | m[t + 0] << 16; + if (a) { + var D = 3 * F + B + 131074 >> 2; + w(a[b + 0], D & 255, D >> 16, q, r) + } + c && (D = + 3 * B + F + 131074 >> 2, w(c[d + 0], D & 255, D >> 16, u, v)); + for (y = 1; y <= G; ++y) { + var J = e[g + y] | k[h + y] << 16, + L = f[l + y] | m[t + y] << 16, + D = F + J + B + L + 524296, + O = D + 2 * (J + B) >> 3, + H = D + 2 * (F + L) >> 3; + a && (D = O + F >> 1, F = H + J >> 1, w(a[b + 2 * y - 1], D & 255, D >> 16, q, r + (2 * y - 1) * z), w(a[b + 2 * y - 0], F & 255, F >> 16, q, r + (2 * y - 0) * z)); + c && (D = H + B >> 1, F = O + L >> 1, w(c[d + 2 * y - 1], D & 255, D >> 16, u, v + (2 * y - 1) * z), w(c[d + 2 * y + 0], F & 255, F >> 16, u, v + (2 * y + 0) * z)); + F = J; + B = L + } + C & 1 || (a && (D = 3 * F + B + 131074 >> 2, w(a[b + C - 1], D & 255, D >> 16, q, r + (C - 1) * z)), c && (D = 3 * B + F + 131074 >> 2, w(c[d + C - 1], D & 255, D >> 16, u, v + (C - 1) * z))) + } + + function pg(a, + b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, hc, 3) + } + + function qg(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, Vc, 3) + } + + function Oe(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, pe, 4) + } + + function Pe(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, oe, 4) + } + + function Qe(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, me, 4) + } + + function Re(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, + f, l, m, t, q, r, u, v, w, ne, 2) + } + + function rg(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w) { + ab(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u, v, w, le, 2) + } + + function Ca(a, b, c, d, e, g, k, h, f, l, m, t, q, r, u) { + var v; + for (v = 0; v < q - 1; v += 2) r(a[b + 0], e[g + 0], k[h + 0], f, l), r(a[b + 1], e[g + 0], k[h + 0], f, l + u), r(c[d + 0], e[g + 0], k[h + 0], m, t), r(c[d + 1], e[g + 0], k[h + 0], m, t + u), b += 2, d += 2, g++, h++, l += 2 * u, t += 2 * u; + v == q - 1 && (r(a[b + 0], e[g + 0], k[h + 0], f, l), r(c[d + 0], e[g + 0], k[h + 0], m, t)) + } + + function Se(a, b, c, d, e, g, k, f, n, l, m, t, q) { + Ca(a, b, c, d, e, g, k, f, n, l, m, t, q, pe, 4) + } + + function Te(a, b, c, d, e, g, k, f, n, l, + m, t, q) { + Ca(a, b, c, d, e, g, k, f, n, l, m, t, q, oe, 4) + } + + function Ue(a, b, c, d, e, g, k, f, n, l, m, t, q) { + Ca(a, b, c, d, e, g, k, f, n, l, m, t, q, me, 4) + } + + function Ve(a, b, c, d, e, g, k, f, n, l, m, t, q) { + Ca(a, b, c, d, e, g, k, f, n, l, m, t, q, ne, 2) + } + + function sg(a, b, c, d, e, g) { + for (; 0 < e--;) { + for (var k = a, f = b + (c ? 1 : 0), n = a, l = b + (c ? 0 : 3), m = s, m = 0; m < d; ++m) { + var t = n[l + 4 * m]; + if (255 != t) { + var t = 32897 * t, + q = k, + r = f + 4 * m + 0; + k[f + 4 * m + 0] * t >>> 23; + q[r] = ca; + q = k; + r = f + 4 * m + 1; + k[f + 4 * m + 1] * t >>> 23; + q[r] = ca; + q = k; + r = f + 4 * m + 2; + k[f + 4 * m + 2] * t >>> 23; + q[r] = ca + } + } + b += g + } + } + + function tg(a, b) { + var c = b.j.c.Va, + d = c.y, + e = c.D + a.w * c.F, + g = c.c, + k = c.B + (a.w >> 1) * c.nb, + f = c.S, + n = c.C + (a.w >> 1) * c.rb, + l = a.m, + m = a.h, + t = parseInt((l + 1) / 2, 10), + q = parseInt((m + 1) / 2, 10), + r; + for (r = 0; r < m; ++r) N(d, e + r * c.F, a.y, a.D + r * a.F, l); + for (r = 0; r < q; ++r) N(g, k + r * c.nb, a.c, a.B + r * a.Da, t), N(f, n + r * c.rb, a.S, a.C + r * a.Da, t); + return a.h + } + + function ug(a, b) { + var c = b.j, + d = c.c.RGBA, + e = d.ma, + g = d.Sa + a.w * d.f, + k = a.y, + f = a.D, + n = a.c, + l = a.B, + m = a.S, + t = a.C, + c = vg[c.J], + q = a.m, + r = a.h - 1, + u; + for (u = 0; u < r; u += 2) c(k, f, k, f + a.F, n, l, m, t, e, g, e, g + d.f, q), f += 2 * a.F, l += a.Da, t += a.Da, g += 2 * d.f; + u == r && c(k, f, k, f, n, l, m, t, e, g, e, g, q); + return a.h + } + + function wg(a, b) { + var c = a.h, + d = b.j.c.RGBA, + e = d.ma, + g = d.Sa + a.w * d.f, + k = V[b.j.J], + f = a.y, + n = a.D, + l = a.c, + m = a.B, + t = a.S, + q = a.C, + r = b.Qb, + u = b.Rb, + v = b.lc, + w = b.mc, + A = a.w, + z = a.w + a.h, + y = a.m, + D = parseInt((y + 1) / 2, 10); + 0 == A ? k(p, p, f, n, l, m, t, q, l, m, t, q, p, p, e, g, y) : (k(b.Sb, b.Tb, f, n, r, u, v, w, l, m, t, q, e, g - d.f, e, g, y), ++c); + for (; A + 2 < z; A += 2) r = l, u = m, v = t, w = q, m += a.Da, q += a.Da, g += 2 * d.f, n += 2 * a.F, k(f, n - a.F, f, n, r, u, v, w, l, m, t, q, e, g - d.f, e, g, y); + n += a.F; + a.k + z < a.K ? (N(b.Sb, b.Tb, f, n, 1 * y), N(b.Qb, b.Rb, l, m, 1 * D), N(b.lc, b.mc, t, q, 1 * D), c--) : z & 1 || k(f, n, p, p, l, m, t, q, l, m, + t, q, e, g + d.f, p, p, y); + return c + } + + function xg(a, b) { + var c = a.p, + d = a.q, + e = b.j.c.Va, + g = a.m, + f = a.h, + h = e.p, + n = e.q + a.w * e.Fa, + c = a.p, + d = a.q, + l = s; + if (c != p) + for (l = 0; l < f; ++l) N(h, n, c, d, 1 * g), d += a.width, n += e.Fa; + else if (e.p != p) + for (l = 0; l < f; ++l) jd(h, n, 255, g), n += e.Fa; + return 0 + } + + function We(a, b, c) { + var d = a.w; + c[0] = a.h; + a.Bb && (0 == d ? --c[0] : (--d, b[0] -= a.width), a.k + a.w + a.h == a.K && (c[0] = a.K - a.k - d)); + return d + } + + function yg(a, b) { + var c = a.p, + d = [a.q]; + if (c != p) { + for (var e = a.m, g = b.j.J, f = g == Ab || g == Bb, h = b.j.c.RGBA, n = [s], l = We(a, d, n), d = d[0], m = h.ma, l = h.Sa + l * h.f, + t = l + (f ? 0 : 3), q = 255, r = s, u = s, u = 0; u < n[0]; ++u) { + for (r = 0; r < e; ++r) { + var v = c[d + r]; + m[t + 4 * r] = v; + q &= v + } + d += a.width; + t += h.f + } + 255 != q && F(g) && WebPApplyAlphaMultiply(m, l, f, e, n, h.f) + } + return 0 + } + + function zg(a, b) { + var c = a.p, + d = [a.q]; + if (c != p) { + var e = a.m, + g = b.j.J, + f = b.j.c.RGBA, + h = [s], + n = We(a, d, h), + d = d[0], + l = f.ma, + n = f.Sa + n * f.f, + m = n + 1, + t = 15, + q = s; + for (j = 0; j < h[0]; ++j) { + for (q = 0; q < e; ++q) { + var r = c[d + q] >> 4; + l[m + 2 * q] = l[m + 2 * q] & 240 | r; + t &= r + } + d += a.width; + m += f.f + } + 15 != t && F(g) && WebPApplyAlphaMultiply4444(l, n, e, h, f.f) + } + return 0 + } + + function vd(a) { + var b = a.ka, + c = b.j.J, + d = c < + ua, + e = c == jb || c == Pa || c == Ab || c == kb || c == Ra || F(c); + b.memory = p; + b.$a = p; + b.zb = p; + b.ad = p; + if (!Ne(b.Qa, a, e ? ua : Ra)) return 0; + if (a.I) { + if (!(d ? InitRGBRescaler(a, b) : InitYUVRescaler(a, b))) return alert("memory error #1"), 0 + } else { + if (d) { + if (b.$a = ug, a.Bb) { + var g = a.m + 1 >> 1, + f = a.m + 2 * g, + h, n = []; + for (h = 0; h < f; ++h) n.push(205); + n.push(0); + b.memory = n; + if (b.memory == p) return alert("memory error #2"), 0; + b.Sb = b.memory; + b.Tb = 0; + b.Qb = b.Sb; + b.Rb = b.Tb + a.m; + b.lc = b.Qb; + b.mc = b.Rb + g; + b.$a = wg; + V[Qa] = pg; + V[jb] = Oe; + V[Zc] = qg; + V[Pa] = Pe; + V[Ab] = Qe; + V[kb] = Re; + V[Fe] = rg + } + } else b.$a = + tg; + e && (F(c) && (WebPApplyAlphaMultiply = sg, V[Ob] = Oe, V[Pb] = Pe, V[Bb] = Qe, V[Qb] = Re), b.zb = c == kb || c == Qb ? zg : d ? yg : xg) + } + if (d && !Xe) { + for (a = 0; 256 > a; ++a) Za[a] = 89858 * (a - 128) + Jb >> ea, wb[a] = -22014 * (a - 128) + Jb, vb[a] = -45773 * (a - 128), xb[a] = 113618 * (a - 128) + Jb >> ea; + for (a = J; a < dd; ++a) b = 76283 * (a - 16) + Jb >> ea, ia[a - J] = wa(b, 255), Hb[a - J] = wa(b + 8 >> 4, 15); + Xe = 1 + } + return 1 + } + + function ud(a) { + var b = a.ka, + c = a.m, + d = a.h; + $(!(a.w & 1)); + if (0 >= c || 0 >= d) return 0; + c = b.$a(a, b); + b.ec += c; + b.zb && b.zb(a, b); + return 1 + } + + function wd(a) { + a = a.ka; + a.memory = ""; + a.memory = p + } + + function ed(a, + b) { + return a[b + 0] | a[b + 1] << 8 | a[b + 2] << 16 + } + + function Kb(a, b) { + return (ed(a, b) | a[b + 3] << 24) >>> 0 + } + + function Ye(a, b, c, d, e, g, f) { + var h = 0, + n = [0], + l = "VP8StatusCode", + m = M(Gc); + if (a == p || c[0] < Lb) return Z; + m.data = a; + m.b = [b[0]]; + m.e = [c[0]]; + m.na = [m.na]; + a: { + h = m.na; + $(a != p); + $(c != p); + $(h != p); + h[0] = 0; + if (c[0] >= Lb && !kd(a, b[0], "RIFF", O)) { + if (kd(a, b[0] + 8, "WEBP", O)) { + l = W; + break a + } + var t = Kb(a, b[0] + O); + if (t < O + R) { + l = W; + break a + } + h[0] = t; + b[0] += Lb; + c[0] -= Lb + } else h[0] = 0; + l = L + } + m.na = m.na[0]; + if (l != L) return l; + h = 0 < m.na; + t = [0]; + a: if (l = R + fd, $(a != p), $(c != p), $(n != p), n[0] = + 0, c[0] < R) l = Z; + else { + if (!kd(a, b[0], "VP8X", O)) { + var q = s, + r = s, + u = E; + if (Kb(a, b[0] + O) != fd) { + l = W; + break a + } + if (c[0] < l) { + l = Z; + break a + } + u = Kb(a, b[0] + 8); + q = 1 + ed(a, b[0] + 12); + r = 1 + ed(a, b[0] + 15); + if (q * r >= Ag) { + l = W; + break a + } + t != p && (t[0] = u); + d != p && (d[0] = q); + e != p && (e[0] = r); + b[0] += l; + c[0] -= l; + n[0] = 1 + } + l = L + } + if (l != L) return l; + if (!h && n[0]) return W; + g != p && (g[0] = !!(t[0] & Bg)); + if (n && f == p) return L; + if (c < O) return Z; + if (h && n[0] || !h && !n[0] && !kd(a, b[0], "ALPH", O)) { + m.$ = [m.$]; + m.G = [m.G]; + m.pa = [m.pa]; + a: { + var n = m.na, + h = m.$, + t = m.G, + l = m.pa, + q = x, + r = 0, + u = Mb, + v = O + R + fd; + $(a != p); + $(c != p); + q = a; + r = b[0]; + u = c[0]; + $(h != p); + $(l != p); + h[0] = p; + t[0] = p; + for (l[0] = 0;;) { + var w = E, + y = E; + b[0] = r; + c[0] = u; + if (u < R) { + l = Z; + break a + } + w = Kb(q, r + O); + y = R + w + 1 & -2; + v += y; + if (0 < n && v > n) { + l = W; + break a + } + if (u < y) { + l = Z; + break a + } + if (kd(q, r, "ALPH", O)) { + if (!kd(q, r, "VP8 ", O) || !kd(q, "VP8L", O)) { + l = L; + break a + } + } else h[0] = q, t[0] = r + R, l[0] = w; + r += y; + u -= y + } + l = ca + } + m.$ = m.$[0]; + m.G = m.G[0]; + m.pa = m.pa[0]; + if (l != L) return l + } + m.ta = [m.ta]; + m.ia = [m.ia]; + a: if (n = m.na, h = m.ta, t = m.ia, r = !kd(a, b[0], "VP8 ", O), l = !kd(a, b[0], "VP8L", O), q = O + R, $(a != p), $(c != p), $(h != p), $(t != p), c[0] < R) l = Z; + else { + if (r || l) { + r = Kb(a, b[0] + O); + if (n >= q && r > n - q) { + l = W; + break a + } + h[0] = r; + b[0] += R; + c[0] -= R; + t[0] = l + } else t[0] = 1 <= c && a[b + 0] == ve, h[0] = c[0]; + l = L + } + m.ta = m.ta[0]; + m.ia = m.ia[0]; + if (l != L) return l; + if (m.ta > Ze) return W; + if (m.ia) { + if (c[0] < $e) return Z; + n = b[0]; + h = c[0]; + d = d ? d[0] : p; + e = e ? e[0] : p; + t = g ? g[0] : p; + a == p || h < $e ? a = 0 : (l = [s], q = [s], r = [s], u = M(af), Rb(u, a, n, h), ue(u, l, q, r) ? (d != p && (d[0] = l[0]), e != p && (e[0] = q[0]), t != p && (t[0] = r[0]), a = 1) : a = 0) + } else { + if (c < bf) return Z; + n = b[0]; + h = c[0]; + d = d ? d[0] : p; + e = e ? e[0] : p; + !(a == p || h < bf) && 3 <= h - 3 && 157 == a[n + 3 + 0] && 1 == a[n + + 3 + 1] && 42 == a[n + 3 + 2] ? (h = a[n + 0] | a[n + 1] << 8 | a[n + 2] << 16, t = (a[n + 7] << 8 | a[n + 6]) & 16383, a = (a[n + 9] << 8 | a[n + 8]) & 16383, !(!(h & 1) + 0) || 3 < (h >> 1 & 7) || !(h >> 4 & 1) || h >> 5 >= m.ta ? a = 0 : (d && (d[0] = t), e && (e[0] = a), a = 1)) : a = 0 + } + if (!a) return W; + g != p && (g[0] |= m.$ != p); + f != p && (f[0] = m, f[0].offset = b[0] - f[0].b, $(b[0] - f[0].b < Ze), $(f[0].offset == f[0].e - c[0])); + return L + } + + function Kd(a) { + $(a != p); + return Ye(a[0].data, a[0].b, a[0].e, p, p, p, a) + } + + function cf(a, b, c, d) { + var e = "VP8StatusCode", + g = M(Vb), + f = M(Gc); + f.data = a; + f.b = b; + f.e = c; + f.b = [f.b]; + f.e = [f.e]; + f = [f]; + e = Kd(f); + if (e != + L) return e; + f = f[0]; + f.b = f.b[0]; + f.e = f.e[0]; + $(d != p); + td(na); + g.data = f.data; + g.b = b + f.offset; + g.e = f.e - f.offset; + g.put = ud; + g.Mb = vd; + g.Pb = wd; + g.ka = d; + if (f.ia) { + a = sd(); + if (a == p) return cb; + ng(a, g) ? (e = zd(g.width, g.height, d.Qa, d.j), e == L && !og(a) && (e = a.a)) : e = a.a; + a != p && sa(a) + } else { + e = M(Cg); + e != p && (Gd(e), e.za = 0, e.Hb = 1); + a = e; + if (a == p) return cb; + a.qb = 0; + a.Ga = f.$; + a.G = f.G; + a.ub = f.pa; + Hd(a, g) ? (e = zd(g.width, g.height, d.Qa, d.j), e == L && !Mf(a, g) && (e = a.a)) : e = a.a; + a != p && ke(a) + } + e != L && (self || this).Yc(d.j); + return e + } + + function lb(a, b, c, d, e) { + var g = { + value: 0 + }; + c = { + value: c + }; + var f = M(df), + h = M(gd); + f.j = h; + h.J = a; + var n = { + value: h.width + }, + l = { + value: h.height + }, + m; + m = c; + var t = M(ef); + hd(b, g, m, t) != L ? m = 0 : (n != p && (n.value = t.width), l != p && (l.value = t.height), m = 1); + if (!m) return p; + h.width = n.value; + h.height = l.value; + d != p && (d.value = h.width.value); + e != p && (e.value = h.height.value); + return cf(b, g.value, c.value, f) != L ? p : a < ua ? h.c.RGBA.ma : h.c.Va.y + } + + function hd(a, b, c, d) { + if (d == p || a == p) return ta; + $(d != p); + d.tc = 0; + d.width = [d.width]; + d.height = [d.height]; + d.$b = [d.$b]; + return Ye(a, b, c, d.width, d.height, d.$b, p) + } + + function Ne(a, + b, c) { + var d = b.width, + e = b.height, + g = 0, + f = 0, + h = d, + n = e; + b.Ua = a != p && 0 < a.Ua; + if (b.Ua && (h = a.wc, n = a.vc, g = a.t, f = a.k, c < ua || (g &= -2, f &= -2), 0 > g || 0 > f || 0 >= h || 0 >= n || g + h > d || f + n > e)) return 0; + b.t = g; + b.k = f; + b.Ka = g + h; + b.K = f + n; + b.m = h; + b.h = n; + b.I = a != p && 0 < a.I; + if (b.I) { + if (0 >= a.Ba || 0 >= a.Aa) return 0; + b.Ba = a.Ba; + b.Aa = a.Aa + } + b.Za = a && a.Za; + b.Bb = a == p || !a.ed; + b.I && (b.Za = b.Ba < 3 * d / 4 && b.Aa < 3 * e / 4, b.Bb = 0); + return 1 + } + var na = 512, + Qa = 0, + jb = 1, + Zc = 2, + Pa = 3, + Ab = 4, + kb = 5, + Fe = 6, + Ob = 7, + Pb = 8, + Bb = 9, + Qb = 10, + ua = 11, + Ra = 12, + Cc = 13; + this.WEBP_CSP_MODE = this.Cd = { + nd: 0, + od: 1, + kd: 2, + ld: 3, + jd: 4, + pd: 5, + qd: 6, + rd: 7, + sd: 8, + md: 9 + }; + var gd = { + J: "WEBP_CSP_MODE", + width: s, + height: s, + Fc: s, + c: { + RGBA: { + ma: x, + Sa: 0, + f: s, + size: Mb + }, + Va: { + y: x, + c: x, + S: x, + p: x, + D: x, + B: x, + C: x, + q: x, + F: s, + nb: s, + rb: s, + Fa: s, + Wc: Mb, + Rc: Mb, + Uc: Mb, + Wb: Mb + } + }, + Ic: U(4, E), + Jb: p, + jc: x + }, + L = 0, + cb = 1, + ta = 2, + W = 3, + Hf = 4, + Ie = 5, + Nf = 6, + Z = 7; + this.VP8StatusCode = this.td = { + xd: 0, + yd: 1, + vd: 2, + ud: 3, + Ad: 4, + zd: 5, + Bd: 6, + wd: 7 + }; + var ef = { + width: { + value: s + }, + height: { + value: s + }, + $b: { + value: s + }, + tc: s, + Yd: s, + rotate: s, + be: s, + Ic: U(3, E) + }; + this.WebPGetFeatures = this.Md = function(a, b, c) { + var d = "VP8StatusCode"; + na >>> 8 != na >>> 8 || c == p ? a = ta : (b = [b], d = hd(a, [0], b, c), a = d == Z ? W : d); + return a + }; + var ff = { + Za: s, + ed: s, + Ua: s, + t: s, + k: s, + wc: s, + vc: s, + I: s, + Ba: s, + Aa: s, + ae: s, + Td: s, + Xd: s, + Ic: U(6, E) + }; + this.WebPDecoderConfig = this.Kd = { + input: M(ef), + j: M(gd), + options: M(ff) + }; + this.WebPInitDecoderConfig = this.Nd = function(a) { + na >>> 8 != na >>> 8 || a == p ? a = 0 : (a = a.input, $(a != p), a.tc = 0, a = 1); + return a + }; + var Vb = { + width: s, + height: s, + w: s, + m: s, + h: s, + y: x, + c: x, + S: x, + D: 0, + B: 0, + C: 0, + F: s, + Da: s, + ka: 0, + put: 0, + Mb: 0, + Pb: 0, + Bb: s, + e: Mb, + data: x, + b: 0, + Za: s, + Ua: s, + t: s, + Ka: s, + k: s, + K: s, + I: s, + Ba: s, + Aa: s, + p: x, + q: 0 + }, + df = { + j: M(gd), + Sb: x, + Qb: x, + lc: x, + Tb: 0, + Rb: 0, + mc: 0, + ec: s, + Qa: M(ff), + memory: 0, + $a: "(OutputFunc)", + zb: "(OutputFunc)", + ad: "(OutputRowFunc)" + }, + Gc = { + data: x, + b: x, + e: Mb, + offset: Mb, + $: p, + G: x, + pa: Mb, + ta: Mb, + na: Mb, + ia: s + }, + Fc = { + qa: x, + Ia: p, + Pd: x, + Ab: s, + la: E, + Z: E, + gc: s + }, + af = { + T: bb, + qa: x, + Ia: x, + ya: Mb, + Q: Mb, + g: s, + L: s, + fa: s + }, + gf = 25, + hf = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215], + bf = 10, + ve = 47, + we = 14, + Wf = 3, + $e = 5, + fg = 11, + Yc = 5, + qe = 4278190080, + jg = 8, + Tb = 15, + Ba = 256, + Ge = 24, + Je = 4, + Be = 0, + De = 1, + Ae = 2, + Ee = 3, + Ub = 1, + kc = 0, + kf = 1, + rd = 1, + O = 4, + R = 8, + Lb = 12, + fd = 10, + Bg = 16, + Ag = 1 * Math.pow(2, 32), + Ze = -1 - R - 1 >>> 0, + jf = { + kc: s, + s: s + }, + Le = { + Y: "HuffmanTreeNode*", + gb: s, + Pa: s + }, + pd = -1, + Dg = { + ea: E, + bb: s + }, + ad = 506832829, + $b = 0, + ge = $b, + fe = 2, + ee = 3, + de = 1, + Ef = 4, + Df = 5, + Cf = 6, + Ld = 3, + xa = 4, + Hc = 4, + Gf = 4, + Md = 4, + Nd = 8, + Kc = 3, + Lc = 11, + f = 32, + Pf = 17 * f + 9 * f, + Tc = 1 * f + 8, + Uc = Tc + 16 * f + f, + he = Uc + 16, + Id = { + fb: x, + Jc: x, + Nc: x, + Ra: E + }, + Jd = { + l: 0, + v: 0, + gd: x, + hd: x, + uc: x, + $c: x + }, + Eg = { + pb: s, + ob: s, + tb: s, + Kb: U(xa, 0), + Cb: U(xa, 0) + }, + Fg = { + Ta: U(Ld, x), + z: md([Md, Nd, Kc, Lc], x) + }, + Gg = { + Oc: s, + Fb: s, + kb: s, + oc: s, + Lc: U(Hc, s), + Gc: U(Hc, s) + }, + Oc = { + zc: s, + yc: s, + ab: s + }, + Qd = { + X: s, + ua: s, + Nb: s + }, + id = U(2, s), + Hg = { + sc: M(id), + sb: M(id), + qc: M(id) + }, + Ig = { + ha: s, + d: s, + W: s, + M: Oc, + N: Vb + }, + Cg = { + a: "VP8StatusCode", + za: s, + xc: 0, + o: M(Fc), + Ac: M(Id), + P: M(Jd), + ga: M(Gg), + Ca: M(Eg), + rc: "WebPWorker", + qb: s, + Ja: s, + jb: s, + oa: Ig, + Ma: s, + hb: s, + lb: s, + mb: s, + wb: s, + Ya: s, + Hb: s, + ic: ld(8, Fc), + Zc: E, + yb: ld(xa, Hg), + R: M(Fg), + pc: s, + Pc: x, + dc: x, + cc: U(4, x), + Xc: x, + Sc: x, + Vc: x, + La: M(Qd), + M: M(Oc), + Ea: x, + z: 0, + ca: x, + aa: x, + ra: x, + da: s, + ba: s, + sa: s, + H: s, + r: s, + ib: 0, + Gb: Mb, + i: s, + d: s, + wa: x, + Eb: U(16, x), + Vd: 0, + Tc: x, + Lb: x, + ja: E, + Oa: E, + A: s, + W: s, + Zb: U(xa, x), + Ga: p, + G: 0, + ub: Mb, + Xb: x, + Od: 0, + cd: s, + dd: x, + Wd: 0, + fc: Mb + }, + Db = 0, + Cb = 1, + cd = 2, + Jg = { + Qc: "VP8LImageTransformType", + n: s, + U: s, + Vb: s, + u: E, + b: E + }, + gg = { + va: ld(Yc, Le) + }, + Kg = { + xb: s, + Yb: M(Dg), + Dc: s, + eb: s, + Ec: s, + ac: E, + bd: E, + hc: s, + Db: "HTreeGroup" + }, + eg = { + a: "VP8StatusCode", + Wa: "VP8LDecodeState", + Ob: "VP8LDecodeState", + N: "VP8Io", + Ib: "WebPDecBuffer", + Hc: "WebPDecBuffer", + V: E, + Ha: E, + Xa: E, + vb: E, + o: M(af), + l: s, + v: s, + O: s, + xa: s, + cb: M(Kg), + Na: s, + nc: ld(Je, Jg), + Ub: E, + Mc: x, + $d: x, + Zd: "*WebPRescaler" + }, + lf = 4, + nf = [p, function(a, b, c, d, e, g, f, h) { + var n = s, + l = h; + $(a != p); + $(f != p); + $(0 < c); + $(0 < d); + $(0 < e); + $(g >= c * e); + for (n = 0; n < d; ++n) 0 == n ? N(f, h, a, b, e) : Ea(a, b, f, l - g, f, h, e), Ea(a, b + e, f, l, f, h + e, e * (c - 1)), + l += g, b += g, h += g + }, function(a, b, c, d, e, f, k, h) { + var n = s, + l = h; + $(a != p); + $(k != p); + $(0 < c); + $(0 < d); + $(0 < e); + $(f >= c * e); + N(k, h, a, b, e); + Ea(a, b + e, k, l, k, h + e, e * (c - 1)); + for (n = 1; n < d; ++n) b += f, h += f, Ea(a, b, k, l, k, h, e * c), l += f + }, function(a, b, c, d, e, f, k, h) { + var n = h, + l = s; + $(a != p); + $(k != p); + $(0 < c); + $(0 < d); + $(0 < e); + $(f >= c * e); + N(k, h, a, b, e); + Ea(a, b + e, k, n, k, h + e, e * (c - 1)); + for (l = 1; l < d; ++l) { + var m = s, + n = n + f; + b += f; + h += f; + Ea(a, b, k, n - f, k, h, e); + for (m = e; m < c * e; ++m) { + var t = k[n + m - e] + k[n + m - f] - k[n + m - f - e]; + k[h + m] = a[b + m] + (0 > t ? 0 : 255 < t ? 255 : t) & 255 + } + } + }], + yd = [3, 4, 3, 4, 4, 2, 2, 4, 4, 4, + 2, 1, 1 + ]; + this.WebPFreeDecBuffer = this.Yc = function(a) { + a != p && (a.Fc || (a.Jb = ""), a.jc = 0, a.Jb = a.jc = p) + }; + self = this; + var va = U(511, x), + tc = U(511, x), + sc = U(2041, 0), + oc = U(225, 0), + oa = U(766, x), + Rd = 0, + Xb = 85627, + Wb = 35468, + Uf = [function(a, b) { + var c = 4, + d; + for (d = 0; 4 > d; ++d) c += a[b + d - f] + a[b - 1 + d * f]; + c >>= 3; + for (d = 0; 4 > d; ++d) jd(a, b + d * f, c, 4) + }, function(a, b) { + Dc(a, b, 4) + }, function(a, b) { + var c = b - f, + d = []; + d.push(y(a[c - 1], a[c + 0], a[c + 1])); + d.push(y(a[c + 0], a[c + 1], a[c + 2])); + d.push(y(a[c + 1], a[c + 2], a[c + 3])); + d.push(y(a[c + 2], a[c + 3], a[c + 4])); + for (c = 0; 4 > c; ++c) N(a, b + c * f, d, 0, 4) + }, + function(a, b) { + var c = a[b - 1], + d = a[b - 1 + f], + e = a[b - 1 + 2 * f], + g = a[b - 1 + 3 * f]; + a[b + 0 + 0 * f] = a[b + 1 + 0 * f] = a[b + 2 + 0 * f] = a[b + 3 + 0 * f] = y(a[b - 1 - f], c, d); + a[b + 0 + 1 * f] = a[b + 1 + 1 * f] = a[b + 2 + 1 * f] = a[b + 3 + 1 * f] = y(c, d, e); + a[b + 0 + 2 * f] = a[b + 1 + 2 * f] = a[b + 2 + 2 * f] = a[b + 3 + 2 * f] = y(d, e, g); + a[b + 0 + 3 * f] = a[b + 1 + 3 * f] = a[b + 2 + 3 * f] = a[b + 3 + 3 * f] = y(e, g, g) + }, + function(a, b) { + var c = a[b - 1 + 0 * f], + d = a[b - 1 + 1 * f], + e = a[b - 1 + 2 * f], + g = a[b - 1 - f], + k = a[b + 0 - f], + h = a[b + 1 - f], + n = a[b + 2 - f], + l = a[b + 3 - f]; + a[b + 0 + 3 * f] = y(d, e, a[b - 1 + 3 * f]); + a[b + 0 + 2 * f] = a[b + 1 + 3 * f] = y(c, d, e); + a[b + 0 + 1 * f] = a[b + 1 + 2 * f] = a[b + 2 + 3 * f] = y(g, c, d); + a[b + + 0 + 0 * f] = a[b + 1 + 1 * f] = a[b + 2 + 2 * f] = a[b + 3 + 3 * f] = y(k, g, c); + a[b + 1 + 0 * f] = a[b + 2 + 1 * f] = a[b + 3 + 2 * f] = y(h, k, g); + a[b + 2 + 0 * f] = a[b + 3 + 1 * f] = y(n, h, k); + a[b + 3 + 0 * f] = y(l, n, h) + }, + function(a, b) { + var c = a[b - 1 + 0 * f], + d = a[b - 1 + 1 * f], + e = a[b - 1 + 2 * f], + g = a[b - 1 - f], + k = a[b + 0 - f], + h = a[b + 1 - f], + n = a[b + 2 - f], + l = a[b + 3 - f]; + a[b + 0 + 0 * f] = a[b + 1 + 2 * f] = g + k + 1 >> 1; + a[b + 1 + 0 * f] = a[b + 2 + 2 * f] = k + h + 1 >> 1; + a[b + 2 + 0 * f] = a[b + 3 + 2 * f] = h + n + 1 >> 1; + a[b + 3 + 0 * f] = n + l + 1 >> 1; + a[b + 0 + 3 * f] = y(e, d, c); + a[b + 0 + 2 * f] = y(d, c, g); + a[b + 0 + 1 * f] = a[b + 1 + 3 * f] = y(c, g, k); + a[b + 1 + 1 * f] = a[b + 2 + 3 * f] = y(g, k, h); + a[b + 2 + 1 * f] = a[b + 3 + 3 * f] = y(k, h, n); + a[b + 3 + 1 * f] = y(h, n, l) + }, + function(a, b) { + var c = a[b + 1 - f], + d = a[b + 2 - f], + e = a[b + 3 - f], + g = a[b + 4 - f], + k = a[b + 5 - f], + h = a[b + 6 - f], + n = a[b + 7 - f]; + a[b + 0 + 0 * f] = y(a[b + 0 - f], c, d); + a[b + 1 + 0 * f] = a[b + 0 + 1 * f] = y(c, d, e); + a[b + 2 + 0 * f] = a[b + 1 + 1 * f] = a[b + 0 + 2 * f] = y(d, e, g); + a[b + 3 + 0 * f] = a[b + 2 + 1 * f] = a[b + 1 + 2 * f] = a[b + 0 + 3 * f] = y(e, g, k); + a[b + 3 + 1 * f] = a[b + 2 + 2 * f] = a[b + 1 + 3 * f] = y(g, k, h); + a[b + 3 + 2 * f] = a[b + 2 + 3 * f] = y(k, h, n); + a[b + 3 + 3 * f] = y(h, n, n) + }, + function(a, b) { + var c = a[b + 0 - f], + d = a[b + 1 - f], + e = a[b + 2 - f], + g = a[b + 3 - f], + k = a[b + 4 - f], + h = a[b + 5 - f], + n = a[b + 6 - f], + l = a[b + 7 - f]; + a[b + 0 + 0 * f] = c + d + 1 >> 1; + a[b + 1 + 0 * f] = a[b + + 0 + 2 * f] = d + e + 1 >> 1; + a[b + 2 + 0 * f] = a[b + 1 + 2 * f] = e + g + 1 >> 1; + a[b + 3 + 0 * f] = a[b + 2 + 2 * f] = g + k + 1 >> 1; + a[b + 0 + 1 * f] = y(c, d, e); + a[b + 1 + 1 * f] = a[b + 0 + 3 * f] = y(d, e, g); + a[b + 2 + 1 * f] = a[b + 1 + 3 * f] = y(e, g, k); + a[b + 3 + 1 * f] = a[b + 2 + 3 * f] = y(g, k, h); + a[b + 3 + 2 * f] = y(k, h, n); + a[b + 3 + 3 * f] = y(h, n, l) + }, + function(a, b) { + var c = a[b - 1 + 0 * f], + d = a[b - 1 + 1 * f], + e = a[b - 1 + 2 * f], + g = a[b - 1 + 3 * f], + k = a[b - 1 - f], + h = a[b + 0 - f], + n = a[b + 1 - f], + l = a[b + 2 - f]; + a[b + 0 + 0 * f] = a[b + 2 + 1 * f] = c + k + 1 >> 1; + a[b + 0 + 1 * f] = a[b + 2 + 2 * f] = d + c + 1 >> 1; + a[b + 0 + 2 * f] = a[b + 2 + 3 * f] = e + d + 1 >> 1; + a[b + 0 + 3 * f] = g + e + 1 >> 1; + a[b + 3 + 0 * f] = y(h, n, l); + a[b + 2 + 0 * f] = y(k, h, n); + a[b + + 1 + 0 * f] = a[b + 3 + 1 * f] = y(c, k, h); + a[b + 1 + 1 * f] = a[b + 3 + 2 * f] = y(d, c, k); + a[b + 1 + 2 * f] = a[b + 3 + 3 * f] = y(e, d, c); + a[b + 1 + 3 * f] = y(g, e, d) + }, + function(a, b) { + var c = a[b - 1 + 0 * f], + d = a[b - 1 + 1 * f], + e = a[b - 1 + 2 * f], + g = a[b - 1 + 3 * f]; + a[b + 0 + 0 * f] = c + d + 1 >> 1; + a[b + 2 + 0 * f] = a[b + 0 + 1 * f] = d + e + 1 >> 1; + a[b + 2 + 1 * f] = a[b + 0 + 2 * f] = e + g + 1 >> 1; + a[b + 1 + 0 * f] = y(c, d, e); + a[b + 3 + 0 * f] = a[b + 1 + 1 * f] = y(d, e, g); + a[b + 3 + 1 * f] = a[b + 1 + 2 * f] = y(e, g, g); + a[b + 3 + 2 * f] = a[b + 2 + 2 * f] = a[b + 0 + 3 * f] = a[b + 1 + 3 * f] = a[b + 2 + 3 * f] = a[b + 3 + 3 * f] = g + } + ], + Vf = [function(a, b) { + var c = 16, + d; + for (d = 0; 16 > d; ++d) c += a[b - 1 + d * f] + a[b + d - f]; + Yb(c >> 5, a, b) + }, function(a, + b) { + Dc(a, b, 16) + }, function(a, b) { + var c; + for (c = 0; 16 > c; ++c) N(a, b + c * f, a, b - f, 16) + }, function(a, b) { + var c; + for (c = 16; 0 < c; --c) jd(a, b + 0, a[b - 1], 16), b += f + }, function(a, b) { + var c = 8, + d; + for (d = 0; 16 > d; ++d) c += a[b - 1 + d * f]; + Yb(c >> 4, a, b) + }, function(a, b) { + var c = 8, + d; + for (d = 0; 16 > d; ++d) c += a[b + d - f]; + Yb(c >> 4, a, b) + }, function(a, b) { + Yb(128, a, b) + }], + je = [function(a, b) { + var c = 8, + d; + for (d = 0; 8 > d; ++d) c += a[b + d - f] + a[b - 1 + d * f]; + Zb(1 * (c >> 4), a, b) + }, function(a, b) { + Dc(a, b, 8) + }, function(a, b) { + var c; + for (c = 0; 8 > c; ++c) N(a, b + c * f, a, b - f, 8) + }, function(a, b) { + var c; + for (c = 0; 8 > c; ++c) jd(a, + b + 0, a[b - 1], 8), b += f + }, function(a, b) { + var c = 4, + d; + for (d = 0; 8 > d; ++d) c += a[b - 1 + d * f]; + Zb(1 * (c >> 3), a, b) + }, function(a, b) { + var c = 4, + d; + for (d = 0; 8 > d; ++d) c += a[b + d - f]; + Zb(1 * (c >> 3), a, b) + }, function(a, b) { + Zb(128, a, b) + }], + mc, Pc, Qc, Rc, Sd, Td, Ud, Vd, Wd, Xd, Yd, Zd, $d, ae, be, ce, Pd = 31, + uc = [0, 2, 8], + Od = 3, + Of = 1, + ie = [0 + 0 * f, 4 + 0 * f, 8 + 0 * f, 12 + 0 * f, 0 + 4 * f, 4 + 4 * f, 8 + 4 * f, 12 + 4 * f, 0 + 8 * f, 4 + 8 * f, 8 + 8 * f, 12 + 8 * f, 0 + 12 * f, 4 + 12 * f, 8 + 12 * f, 12 + 12 * f], + Ic = [4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 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, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 93, 95, 96, 98, 100, 101, 102, 104, 106, 108, 110, 112, 114, 116, 118, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 143, 145, 148, 151, 154, 157 + ], + Jc = [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, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, + 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 167, 170, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 234, 239, 245, 249, 254, 259, 264, 269, 274, 279, 284 + ], + Sf = [-$b, 1, -1, 2, -2, 3, 4, 6, -3, 5, -4, -5, -6, 7, -7, 8, -8, -9], + Ff = [ + [ + [ + [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128], + [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128], + [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128] + ], + [ + [253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128], + [189, 129, 242, 255, 227, 213, 255, 219, 128, 128, + 128 + ], + [106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128] + ], + [ + [1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128], + [181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128], + [78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128] + ], + [ + [1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128], + [184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128], + [77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128] + ], + [ + [1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128], + [170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128], + [37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128] + ], + [ + [1, 204, 254, 255, 245, 255, 128, 128, 128, 128, + 128 + ], + [207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128], + [102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128] + ], + [ + [1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128], + [177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128], + [80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128] + ], + [ + [1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128], + [246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128], + [255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128] + ] + ], + [ + [ + [198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62], + [131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1], + [68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128] + ], + [ + [1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128], + [184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128], + [81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128] + ], + [ + [1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128], + [99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128], + [23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128] + ], + [ + [1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128], + [109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128], + [44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128] + ], + [ + [1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128], + [94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128], + [22, + 100, 174, 245, 186, 161, 255, 199, 128, 128, 128 + ] + ], + [ + [1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128], + [124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128], + [35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128] + ], + [ + [1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128], + [121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128], + [45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128] + ], + [ + [1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128], + [203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128], + [137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128] + ] + ], + [ + [ + [253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128], + [175, 13, + 224, 243, 193, 185, 249, 198, 255, 255, 128 + ], + [73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128] + ], + [ + [1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128], + [239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128], + [155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128] + ], + [ + [1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128], + [201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128], + [69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128] + ], + [ + [1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128], + [223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128], + [141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128] + ], + [ + [1, 16, 248, 255, + 255, 128, 128, 128, 128, 128, 128 + ], + [190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128], + [149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128] + ], + [ + [1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128], + [247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128], + [240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128] + ], + [ + [1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128], + [213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128], + [55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128] + ], + [ + [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128], + [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128], + [128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128 + ] + ] + ], + [ + [ + [202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255], + [126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128], + [61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128] + ], + [ + [1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128], + [166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128], + [39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128] + ], + [ + [1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128], + [124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128], + [24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128] + ], + [ + [1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128], + [149, 150, 226, 252, 216, + 205, 255, 171, 128, 128, 128 + ], + [28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128] + ], + [ + [1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128], + [123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128], + [20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128] + ], + [ + [1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128], + [168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128], + [47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128] + ], + [ + [1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128], + [141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128], + [42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128] + ], + [ + [1, 1, 255, 128, 128, 128, 128, + 128, 128, 128, 128 + ], + [244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128], + [238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128] + ] + ] + ], + Rf = [ + [ + [231, 120, 48, 89, 115, 113, 120, 152, 112], + [152, 179, 64, 126, 170, 118, 46, 70, 95], + [175, 69, 143, 80, 85, 82, 72, 155, 103], + [56, 58, 10, 171, 218, 189, 17, 13, 152], + [114, 26, 17, 163, 44, 195, 21, 10, 173], + [121, 24, 80, 195, 26, 62, 44, 64, 85], + [144, 71, 10, 38, 171, 213, 144, 34, 26], + [170, 46, 55, 19, 136, 160, 33, 206, 71], + [63, 20, 8, 114, 114, 208, 12, 9, 226], + [81, 40, 11, 96, 182, 84, 29, 16, 36] + ], + [ + [134, 183, 89, 137, 98, 101, 106, 165, 148], + [72, 187, 100, 130, 157, 111, + 32, 75, 80 + ], + [66, 102, 167, 99, 74, 62, 40, 234, 128], + [41, 53, 9, 178, 241, 141, 26, 8, 107], + [74, 43, 26, 146, 73, 166, 49, 23, 157], + [65, 38, 105, 160, 51, 52, 31, 115, 128], + [104, 79, 12, 27, 217, 255, 87, 17, 7], + [87, 68, 71, 44, 114, 51, 15, 186, 23], + [47, 41, 14, 110, 182, 183, 21, 17, 194], + [66, 45, 25, 102, 197, 189, 23, 18, 22] + ], + [ + [88, 88, 147, 150, 42, 46, 45, 196, 205], + [43, 97, 183, 117, 85, 38, 35, 179, 61], + [39, 53, 200, 87, 26, 21, 43, 232, 171], + [56, 34, 51, 104, 114, 102, 29, 93, 77], + [39, 28, 85, 171, 58, 165, 90, 98, 64], + [34, 22, 116, 206, 23, 34, 43, 166, 73], + [107, 54, 32, 26, 51, 1, 81, 43, 31], + [68, 25, 106, 22, + 64, 171, 36, 225, 114 + ], + [34, 19, 21, 102, 132, 188, 16, 76, 124], + [62, 18, 78, 95, 85, 57, 50, 48, 51] + ], + [ + [193, 101, 35, 159, 215, 111, 89, 46, 111], + [60, 148, 31, 172, 219, 228, 21, 18, 111], + [112, 113, 77, 85, 179, 255, 38, 120, 114], + [40, 42, 1, 196, 245, 209, 10, 25, 109], + [88, 43, 29, 140, 166, 213, 37, 43, 154], + [61, 63, 30, 155, 67, 45, 68, 1, 209], + [100, 80, 8, 43, 154, 1, 51, 26, 71], + [142, 78, 78, 16, 255, 128, 34, 197, 171], + [41, 40, 5, 102, 211, 183, 4, 1, 221], + [51, 50, 17, 168, 209, 192, 23, 25, 82] + ], + [ + [138, 31, 36, 171, 27, 166, 38, 44, 229], + [67, 87, 58, 169, 82, 115, 26, 59, 179], + [63, 59, 90, 180, 59, 166, 93, 73, + 154 + ], + [40, 40, 21, 116, 143, 209, 34, 39, 175], + [47, 15, 16, 183, 34, 223, 49, 45, 183], + [46, 17, 33, 183, 6, 98, 15, 32, 183], + [57, 46, 22, 24, 128, 1, 54, 17, 37], + [65, 32, 73, 115, 28, 128, 23, 128, 205], + [40, 3, 9, 115, 51, 192, 18, 6, 223], + [87, 37, 9, 115, 59, 77, 64, 21, 47] + ], + [ + [104, 55, 44, 218, 9, 54, 53, 130, 226], + [64, 90, 70, 205, 40, 41, 23, 26, 57], + [54, 57, 112, 184, 5, 41, 38, 166, 213], + [30, 34, 26, 133, 152, 116, 10, 32, 134], + [39, 19, 53, 221, 26, 114, 32, 73, 255], + [31, 9, 65, 234, 2, 15, 1, 118, 73], + [75, 32, 12, 51, 192, 255, 160, 43, 51], + [88, 31, 35, 67, 102, 85, 55, 186, 85], + [56, 21, 23, 111, 59, 205, 45, 37, 192], + [55, 38, 70, 124, 73, 102, 1, 34, 98] + ], + [ + [125, 98, 42, 88, 104, 85, 117, 175, 82], + [95, 84, 53, 89, 128, 100, 113, 101, 45], + [75, 79, 123, 47, 51, 128, 81, 171, 1], + [57, 17, 5, 71, 102, 57, 53, 41, 49], + [38, 33, 13, 121, 57, 73, 26, 1, 85], + [41, 10, 67, 138, 77, 110, 90, 47, 114], + [115, 21, 2, 10, 102, 255, 166, 23, 6], + [101, 29, 16, 10, 85, 128, 101, 196, 26], + [57, 18, 10, 102, 102, 213, 34, 20, 43], + [117, 20, 15, 36, 163, 128, 68, 1, 26] + ], + [ + [102, 61, 71, 37, 34, 53, 31, 243, 192], + [69, 60, 71, 38, 73, 119, 28, 222, 37], + [68, 45, 128, 34, 1, 47, 11, 245, 171], + [62, 17, 19, 70, 146, 85, 55, 62, 70], + [37, 43, 37, 154, 100, 163, 85, 160, + 1 + ], + [63, 9, 92, 136, 28, 64, 32, 201, 85], + [75, 15, 9, 9, 64, 255, 184, 119, 16], + [86, 6, 28, 5, 64, 255, 25, 248, 1], + [56, 8, 17, 132, 137, 255, 55, 116, 128], + [58, 15, 20, 82, 135, 57, 26, 121, 40] + ], + [ + [164, 50, 31, 137, 154, 133, 25, 35, 218], + [51, 103, 44, 131, 131, 123, 31, 6, 158], + [86, 40, 64, 135, 148, 224, 45, 183, 128], + [22, 26, 17, 131, 240, 154, 14, 1, 209], + [45, 16, 21, 91, 64, 222, 7, 1, 197], + [56, 21, 39, 155, 60, 138, 23, 102, 213], + [83, 12, 13, 54, 192, 255, 68, 47, 28], + [85, 26, 85, 85, 128, 128, 32, 146, 171], + [18, 11, 7, 63, 144, 171, 4, 4, 246], + [35, 27, 10, 146, 174, 171, 12, 26, 128] + ], + [ + [190, 80, 35, 99, 180, 80, + 126, 54, 45 + ], + [85, 126, 47, 87, 176, 51, 41, 20, 32], + [101, 75, 128, 139, 118, 146, 116, 128, 85], + [56, 41, 15, 176, 236, 85, 37, 9, 62], + [71, 30, 17, 119, 118, 255, 17, 18, 138], + [101, 38, 60, 138, 55, 70, 43, 26, 142], + [146, 36, 19, 30, 171, 255, 97, 27, 20], + [138, 45, 61, 62, 219, 1, 81, 188, 64], + [32, 41, 20, 117, 151, 142, 20, 21, 163], + [112, 19, 12, 61, 195, 128, 48, 4, 24] + ] + ], + If = [ + [ + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [223, 241, + 252, 255, 255, 255, 255, 255, 255, 255, 255 + ], + [249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255], + [234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255], + [250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255], + [254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ] + ], + [ + [ + [217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [225, 252, 241, 253, 255, 255, 254, 255, + 255, 255, 255 + ], + [234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255] + ], + [ + [255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 253, 254, 255, 255, + 255, 255, 255, 255, 255, 255 + ], + [252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255], + [250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255 + ] + ] + ], + [ + [ + [186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255], + [234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255], + [251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255] + ], + [ + [255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255 + ] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ] + ], + [ + [ + [248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255], + [248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255], + [246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255], + [252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255], + [248, 254, 253, 255, 255, 255, + 255, 255, 255, 255, 255 + ], + [253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255], + [252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 253, + 255, 255, 255, 255, 255, 255, 255, 255 + ], + [250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ], + [ + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], + [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] + ] + ] + ]; + this.WebPGetDecoderVersion = this.Ld = function() { + return 512 + }; + var Nc = [0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 0], + Jf = [ + [173, 148, 140, 0], + [176, 155, 140, 135, 0], + [180, 157, 141, 134, 130, 0], + [254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0] + ], + Kf = [0, 1, 4, 8, 5, 2, 3, 6, + 9, 12, 13, 10, 7, 11, 14, 15 + ], + Tf = md([Kc, Lc], ""); + U(4, x); + var vc = [ + [0, 0, 0, 0], + [1, 0, 0, 0], + [0, 1, 0, 0], + [1, 1, 0, 0], + [0, 0, 1, 0], + [1, 0, 1, 0], + [0, 1, 1, 0], + [1, 1, 1, 0], + [0, 0, 0, 1], + [1, 0, 0, 1], + [0, 1, 0, 1], + [1, 1, 0, 1], + [0, 0, 1, 1], + [1, 0, 1, 1], + [0, 1, 1, 1], + [1, 1, 1, 1] + ], + Lf = 134480385, + ea = 16, + J = -227, + dd = 482, + Ce = [Wc, function(a) { + return a + }, function(a, b, c) { + return b[c + 0] + }, function(a, b, c) { + return b[c + 1] + }, function(a, b, c) { + return b[c - 1] + }, function(a, b, c) { + return ka(ka(a, b[c + 1]), b[c + 0]) + }, function(a, b, c) { + return ka(a, b[c - 1]) + }, function(a, b, c) { + return ka(a, b[c + 0]) + }, function(a, + b, c) { + return ka(b[c - 1], b[c + 0]) + }, function(a, b, c) { + return ka(b[c + 0], b[c + 1]) + }, function(a, b, c) { + return ka(ka(a, b[c - 1]), ka(b[c + 0], b[c + 1])) + }, function(a, b, c) { + return 0 >= Math.abs((a >> 24 & 255) - (b[c - 1] >> 24 & 255)) - Math.abs((b[c + 0] >> 24 & 255) - (b[c - 1] >> 24 & 255)) + (Math.abs((a >> 16 & 255) - (b[c - 1] >> 16 & 255)) - Math.abs((b[c + 0] >> 16 & 255) - (b[c - 1] >> 16 & 255))) + (Math.abs((a >> 8 & 255) - (b[c - 1] >> 8 & 255)) - Math.abs((b[c + 0] >> 8 & 255) - (b[c - 1] >> 8 & 255))) + (Math.abs((a & 255) - (b[c - 1] & 255)) - Math.abs((b[c + 0] & 255) - (b[c - 1] & 255))) ? b[c + 0] : a + }, function(a, b, c) { + return ($a((a >> + 24 & 255) + (b[c + 0] >> 24 & 255) - (b[c - 1] >> 24 & 255)) << 24 | $a((a >> 16 & 255) + (b[c + 0] >> 16 & 255) - (b[c - 1] >> 16 & 255)) << 16 | $a((a >> 8 & 255) + (b[c + 0] >> 8 & 255) - (b[c - 1] >> 8 & 255)) << 8 | $a((a & 255) + (b[c + 0] & 255) - (b[c - 1] & 255))) >>> 0 + }, function(a, b, c) { + var d = b[c - 1]; + a = ka(a, b[c + 0]); + return (yb(a >> 24 & 255, d >> 24 & 255) << 24 | yb(a >> 16 & 255, d >> 16 & 255) << 16 | yb(a >> 8 & 255, d >> 8 & 255) << 8 | yb(a >> 0 & 255, d >> 0 & 255)) >>> 0 + }, Wc, Wc], + Xf = { + Cc: x, + Bc: x, + Kc: x + }, + $c = 16, + Me = 16, + kg = 16, + mg = [2, 3, 7], + lg = [3, 3, 11], + Zf = 0, + $f = 1, + ag = 2, + bg = 3, + cg = 4, + hg = [Ba + Ge, Ba, Ba, Ba, 40], + Ke = 19, + ig = [17, 18, 0, 1, 2, 3, 4, 5, 16, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + ], + He = 120, + dg = [24, 7, 23, 25, 40, 6, 39, 41, 22, 26, 38, 42, 56, 5, 55, 57, 21, 27, 54, 58, 37, 43, 72, 4, 71, 73, 20, 28, 53, 59, 70, 74, 36, 44, 88, 69, 75, 52, 60, 3, 87, 89, 19, 29, 86, 90, 35, 45, 68, 76, 85, 91, 51, 61, 104, 2, 103, 105, 18, 30, 102, 106, 34, 46, 84, 92, 67, 77, 101, 107, 50, 62, 120, 1, 119, 121, 83, 93, 17, 31, 100, 108, 66, 78, 118, 122, 33, 47, 117, 123, 49, 63, 99, 109, 82, 94, 0, 116, 124, 65, 79, 16, 32, 98, 110, 48, 115, 125, 81, 95, 64, 114, 126, 97, 111, 80, 113, 127, 96, 112], + Jb = 1 << ea - 1, + Za = U(256, 0), + xb = U(256, 0), + vb = U(256, la), + wb = U(256, la), + ia = U(dd - J, x), + Hb = U(dd - + J, x), + Xe = 0, + V = Array(Cc), + vg = [function(a, b, c, d, e, f, k, h, n, l, m, t, q) { + Ca(a, b, c, d, e, f, k, h, n, l, m, t, q, hc, 3) + }, Se, function(a, b, c, d, e, f, k, h, n, l, m, t, q) { + Ca(a, b, c, d, e, f, k, h, n, l, m, t, q, Vc, 3) + }, Te, Ue, Ve, function(a, b, c, d, e, f, k, h, n, l, m, t, q) { + Ca(a, b, c, d, e, f, k, h, n, l, m, t, q, le, 2) + }, Se, Te, Ue, Ve]; + this.Hd = function(a, b, c, d) { + return lb(Qa, a, b, c, d) + }; + this.Id = function(a, b, c, d) { + return lb(jb, a, b, c, d) + }; + this.Jd = function(a, b, c, d) { + return lb(kb, a, b, c, d) + }; + this.Ed = function(a, b, c, d) { + return lb(Ab, a, b, c, d) + }; + this.Fd = function(a, b, c, d) { + return lb(Zc, + a, b, c, d) + }; + this.Gd = function(a, b, c, d) { + return lb(Pa, a, b, c, d) + }; + this.WebPDecode = this.Dd = function(a, b, c) { + var d = M(df), + e = "VP8StatusCode"; + if (c == p) return ta; + e = hd(a, [0], [b], c.input); + if (e != L) return e == Z ? W : e; + d.j = c.j; + d.Qa = c.Qa; + return e = cf(a, 0, [b], d) + } + }; + +})(); \ No newline at end of file diff --git a/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-opus.js b/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-opus.js new file mode 100644 index 0000000000..2a511967ae --- /dev/null +++ b/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-opus.js @@ -0,0 +1,32 @@ +var OGVDecoderAudioOpus +(function() { + var scriptSrc; + if (typeof document !== 'undefined' && document.currentScript) scriptSrc = document.currentScript.src; +OGVDecoderAudioOpus = function(OGVDecoderAudioOpus) { + OGVDecoderAudioOpus = OGVDecoderAudioOpus || {}; + if (!OGVDecoderAudioOpus.currentScriptUrl) OGVDecoderAudioOpus.currentScriptUrl = scriptSrc; + var Module = OGVDecoderAudioOpus; + +var options=Module;Module={print:(function(str){console.log(str)})};if(typeof OGVLoader!=="undefined"){Module["pthreadMainPrefixURL"]=OGVLoader.base+"/"}if(options["memoryLimit"]&&!options.wasmBinary){Module["TOTAL_MEMORY"]=options["memoryLimit"]}for(option in options){if(options.hasOwnProperty(option)){Module[option]=options[option]}}var Math_imul_orig=Math.imul;var OGVDecoderAudioOpus=Module;var Module;if(!Module)Module=(typeof OGVDecoderAudioOpus!=="undefined"?OGVDecoderAudioOpus:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else if(Module["ENVIRONMENT"]==="PTHREAD"){ENVIRONMENT_IS_WORKER=true;ENVIRONMENT_IS_PTHREAD=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function shell_read(){throw"no read() available"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return xhr.response}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function shell_print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function shell_printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}if(!Module["quit"]){Module["quit"]=(function(status,toThrow){throw toThrow})}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value;return value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i>2];var end=(ret+size+15|0)&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=Runtime.stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){var __cxa_demangle_func=Module["___cxa_demangle"]||Module["__cxa_demangle"];if(__cxa_demangle_func){try{var s=func.substr(1);var len=lengthBytesUTF8(s)+1;var buf=_malloc(len);stringToUTF8(s,buf,len);var status=_malloc(4);var ret=__cxa_demangle_func(buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}return func}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];if(!Math["trunc"])Math["trunc"]=(function(x){return x<0?Math.ceil(x):Math.floor(x)});Math.trunc=Math["trunc"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=Runtime.GLOBAL_BASE;STATICTOP=STATIC_BASE+25808;__ATINIT__.push();allocate([0,0,206,64,0,0,200,64,0,0,184,64,0,0,170,64,0,0,162,64,0,0,154,64,0,0,144,64,0,0,140,64,0,0,156,64,0,0,150,64,0,0,146,64,0,0,142,64,0,0,156,64,0,0,148,64,0,0,138,64,0,0,144,64,0,0,140,64,0,0,148,64,0,0,152,64,0,0,142,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,146,80,0,0,154,80,0,0,170,80,0,0,202,80,0,0,242,80,0,0,66,81,0,0,32,0,10,0,20,46,100,1,226,81,0,0,34,83,0,0,98,83,0,0,116,83,0,0,20,84,0,0,92,84,0,0,24,69,0,0,32,0,16,0,102,38,171,1,164,84,0,0,164,86,0,0,228,86,0,0,2,87,0,0,2,88,0,0,74,88,0,0,46,69,0,0,173,88,0,0,176,88,0,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,6,0,0,0,1,0,0,0,5,0,0,0,2,0,0,0,15,0,0,0,0,0,0,0,8,0,0,0,7,0,0,0,12,0,0,0,3,0,0,0,11,0,0,0,4,0,0,0,14,0,0,0,1,0,0,0,9,0,0,0,6,0,0,0,13,0,0,0,2,0,0,0,10,0,0,0,5,0,0,0,15,0,0,0,10,0,0,0,5,0,0,0,148,1,0,0,84,4,0,0,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39,0,0,0,41,0,0,0,43,0,0,0,45,0,0,0,47,0,0,0,49,0,0,0,51,0,0,0,53,0,0,0,55,0,0,0,57,0,0,0,59,0,0,0,61,0,0,0,63,0,0,0,65,0,0,0,67,0,0,0,69,0,0,0,71,0,0,0,73,0,0,0,75,0,0,0,77,0,0,0,79,0,0,0,81,0,0,0,83,0,0,0,85,0,0,0,87,0,0,0,89,0,0,0,91,0,0,0,93,0,0,0,95,0,0,0,97,0,0,0,99,0,0,0,101,0,0,0,103,0,0,0,105,0,0,0,107,0,0,0,109,0,0,0,111,0,0,0,113,0,0,0,115,0,0,0,117,0,0,0,119,0,0,0,121,0,0,0,123,0,0,0,125,0,0,0,127,0,0,0,129,0,0,0,131,0,0,0,133,0,0,0,135,0,0,0,137,0,0,0,139,0,0,0,141,0,0,0,143,0,0,0,145,0,0,0,147,0,0,0,149,0,0,0,151,0,0,0,153,0,0,0,155,0,0,0,157,0,0,0,159,0,0,0,161,0,0,0,163,0,0,0,165,0,0,0,167,0,0,0,169,0,0,0,171,0,0,0,173,0,0,0,175,0,0,0,177,0,0,0,179,0,0,0,181,0,0,0,183,0,0,0,185,0,0,0,187,0,0,0,189,0,0,0,191,0,0,0,193,0,0,0,195,0,0,0,197,0,0,0,199,0,0,0,201,0,0,0,203,0,0,0,205,0,0,0,207,0,0,0,209,0,0,0,211,0,0,0,213,0,0,0,215,0,0,0,217,0,0,0,219,0,0,0,221,0,0,0,223,0,0,0,225,0,0,0,227,0,0,0,229,0,0,0,231,0,0,0,233,0,0,0,235,0,0,0,237,0,0,0,239,0,0,0,241,0,0,0,243,0,0,0,245,0,0,0,247,0,0,0,249,0,0,0,251,0,0,0,253,0,0,0,255,0,0,0,1,1,0,0,3,1,0,0,5,1,0,0,7,1,0,0,9,1,0,0,11,1,0,0,13,1,0,0,15,1,0,0,17,1,0,0,19,1,0,0,21,1,0,0,23,1,0,0,25,1,0,0,27,1,0,0,29,1,0,0,31,1,0,0,33,1,0,0,35,1,0,0,37,1,0,0,39,1,0,0,41,1,0,0,43,1,0,0,45,1,0,0,47,1,0,0,49,1,0,0,51,1,0,0,53,1,0,0,55,1,0,0,57,1,0,0,59,1,0,0,61,1,0,0,63,1,0,0,65,1,0,0,67,1,0,0,69,1,0,0,71,1,0,0,73,1,0,0,75,1,0,0,77,1,0,0,79,1,0,0,81,1,0,0,83,1,0,0,85,1,0,0,87,1,0,0,89,1,0,0,91,1,0,0,93,1,0,0,95,1,0,0,13,0,0,0,25,0,0,0,41,0,0,0,61,0,0,0,85,0,0,0,113,0,0,0,145,0,0,0,181,0,0,0,221,0,0,0,9,1,0,0,57,1,0,0,109,1,0,0,165,1,0,0,225,1,0,0,33,2,0,0,101,2,0,0,173,2,0,0,249,2,0,0,73,3,0,0,157,3,0,0,245,3,0,0,81,4,0,0,177,4,0,0,21,5,0,0,125,5,0,0,233,5,0,0,89,6,0,0,205,6,0,0,69,7,0,0,193,7,0,0,65,8,0,0,197,8,0,0,77,9,0,0,217,9,0,0,105,10,0,0,253,10,0,0,149,11,0,0,49,12,0,0,209,12,0,0,117,13,0,0,29,14,0,0,201,14,0,0,121,15,0,0,45,16,0,0,229,16,0,0,161,17,0,0,97,18,0,0,37,19,0,0,237,19,0,0,185,20,0,0,137,21,0,0,93,22,0,0,53,23,0,0,17,24,0,0,241,24,0,0,213,25,0,0,189,26,0,0,169,27,0,0,153,28,0,0,141,29,0,0,133,30,0,0,129,31,0,0,129,32,0,0,133,33,0,0,141,34,0,0,153,35,0,0,169,36,0,0,189,37,0,0,213,38,0,0,241,39,0,0,17,41,0,0,53,42,0,0,93,43,0,0,137,44,0,0,185,45,0,0,237,46,0,0,37,48,0,0,97,49,0,0,161,50,0,0,229,51,0,0,45,53,0,0,121,54,0,0,201,55,0,0,29,57,0,0,117,58,0,0,209,59,0,0,49,61,0,0,149,62,0,0,253,63,0,0,105,65,0,0,217,66,0,0,77,68,0,0,197,69,0,0,65,71,0,0,193,72,0,0,69,74,0,0,205,75,0,0,89,77,0,0,233,78,0,0,125,80,0,0,21,82,0,0,177,83,0,0,81,85,0,0,245,86,0,0,157,88,0,0,73,90,0,0,249,91,0,0,173,93,0,0,101,95,0,0,33,97,0,0,225,98,0,0,165,100,0,0,109,102,0,0,57,104,0,0,9,106,0,0,221,107,0,0,181,109,0,0,145,111,0,0,113,113,0,0,85,115,0,0,61,117,0,0,41,119,0,0,25,121,0,0,13,123,0,0,5,125,0,0,1,127,0,0,1,129,0,0,5,131,0,0,13,133,0,0,25,135,0,0,41,137,0,0,61,139,0,0,85,141,0,0,113,143,0,0,145,145,0,0,181,147,0,0,221,149,0,0,9,152,0,0,57,154,0,0,109,156,0,0,165,158,0,0,225,160,0,0,33,163,0,0,101,165,0,0,173,167,0,0,249,169,0,0,73,172,0,0,157,174,0,0,245,176,0,0,81,179,0,0,177,181,0,0,21,184,0,0,125,186,0,0,233,188,0,0,89,191,0,0,205,193,0,0,69,196,0,0,193,198,0,0,65,201,0,0,197,203,0,0,77,206,0,0,217,208,0,0,105,211,0,0,253,213,0,0,149,216,0,0,49,219,0,0,209,221,0,0,117,224,0,0,29,227,0,0,201,229,0,0,121,232,0,0,45,235,0,0,229,237,0,0,161,240,0,0,63,0,0,0,129,0,0,0,231,0,0,0,121,1,0,0,63,2,0,0,65,3,0,0,135,4,0,0,25,6,0,0,255,7,0,0,65,10,0,0,231,12,0,0,249,15,0,0,127,19,0,0,129,23,0,0,7,28,0,0,25,33,0,0,191,38,0,0,1,45,0,0,231,51,0,0,121,59,0,0,191,67,0,0,193,76,0,0,135,86,0,0,25,97,0,0,127,108,0,0,193,120,0,0,231,133,0,0,249,147,0,0,255,162,0,0,1,179,0,0,7,196,0,0,25,214,0,0,63,233,0,0,129,253,0,0,231,18,1,0,121,41,1,0,63,65,1,0,65,90,1,0,135,116,1,0,25,144,1,0,255,172,1,0,65,203,1,0,231,234,1,0,249,11,2,0,127,46,2,0,129,82,2,0,7,120,2,0,25,159,2,0,191,199,2,0,1,242,2,0,231,29,3,0,121,75,3,0,191,122,3,0,193,171,3,0,135,222,3,0,25,19,4,0,127,73,4,0,193,129,4,0,231,187,4,0,249,247,4,0,255,53,5,0,1,118,5,0,7,184,5,0,25,252,5,0,63,66,6,0,129,138,6,0,231,212,6,0,121,33,7,0,63,112,7,0,65,193,7,0,135,20,8,0,25,106,8,0,255,193,8,0,65,28,9,0,231,120,9,0,249,215,9,0,127,57,10,0,129,157,10,0,7,4,11,0,25,109,11,0,191,216,11,0,1,71,12,0,231,183,12,0,121,43,13,0,191,161,13,0,193,26,14,0,135,150,14,0,25,21,15,0,127,150,15,0,193,26,16,0,231,161,16,0,249,43,17,0,255,184,17,0,1,73,18,0,7,220,18,0,25,114,19,0,63,11,20,0,129,167,20,0,231,70,21,0,121,233,21,0,63,143,22,0,65,56,23,0,135,228,23,0,25,148,24,0,255,70,25,0,65,253,25,0,231,182,26,0,249,115,27,0,127,52,28,0,129,248,28,0,7,192,29,0,25,139,30,0,191,89,31,0,1,44,32,0,231,1,33,0,121,219,33,0,191,184,34,0,193,153,35,0,135,126,36,0,25,103,37,0,127,83,38,0,193,67,39,0,231,55,40,0,249,47,41,0,255,43,42,0,1,44,43,0,7,48,44,0,25,56,45,0,63,68,46,0,129,84,47,0,231,104,48,0,121,129,49,0,63,158,50,0,65,191,51,0,135,228,52,0,25,14,54,0,255,59,55,0,65,110,56,0,231,164,57,0,249,223,58,0,127,31,60,0,129,99,61,0,7,172,62,0,25,249,63,0,191,74,65,0,1,161,66,0,231,251,67,0,121,91,69,0,191,191,70,0,193,40,72,0,135,150,73,0,25,9,75,0,127,128,76,0,193,252,77,0,231,125,79,0,249,3,81,0,255,142,82,0,1,31,84,0,7,180,85,0,25,78,87,0,63,237,88,0,129,145,90,0,231,58,92,0,121,233,93,0,63,157,95,0,65,86,97,0,135,20,99,0,25,216,100,0,255,160,102,0,65,111,104,0,231,66,106,0,249,27,108,0,127,250,109,0,65,1,0,0,169,2,0,0,9,5,0,0,193,8,0,0,65,14,0,0,9,22,0,0,169,32,0,0,193,46,0,0,1,65,0,0,41,88,0,0,9,117,0,0,129,152,0,0,129,195,0,0,9,247,0,0,41,52,1,0,1,124,1,0,193,207,1,0,169,48,2,0,9,160,2,0,65,31,3,0,193,175,3,0,9,83,4,0,169,10,5,0,65,216,5,0,129,189,6,0,41,188,7,0,9,214,8,0,1,13,10,0,1,99,11,0,9,218,12,0,41,116,14,0,129,51,16,0,65,26,18,0,169,42,20,0,9,103,22,0,193,209,24,0,65,109,27,0,9,60,30,0,169,64,33,0,193,125,36,0,1,246,39,0,41,172,43,0,9,163,47,0,129,221,51,0,129,94,56,0,9,41,61,0,41,64,66,0,1,167,71,0,193,96,77,0,169,112,83,0,9,218,89,0,65,160,96,0,193,198,103,0,9,81,111,0,169,66,119,0,65,159,127,0,129,106,136,0,41,168,145,0,9,92,155,0,1,138,165,0,1,54,176,0,9,100,187,0,41,24,199,0,129,86,211,0,65,35,224,0,169,130,237,0,9,121,251,0,193,10,10,1,65,60,25,1,9,18,41,1,169,144,57,1,193,188,74,1,1,155,92,1,41,48,111,1,9,129,130,1,129,146,150,1,129,105,171,1,9,11,193,1,41,124,215,1,1,194,238,1,193,225,6,2,169,224,31,2,9,196,57,2,65,145,84,2,193,77,112,2,9,255,140,2,169,170,170,2,65,86,201,2,129,7,233,2,41,196,9,3,9,146,43,3,1,119,78,3,1,121,114,3,9,158,151,3,41,236,189,3,129,105,229,3,65,28,14,4,169,10,56,4,9,59,99,4,193,179,143,4,65,123,189,4,9,152,236,4,169,16,29,5,193,235,78,5,1,48,130,5,41,228,182,5,9,15,237,5,129,183,36,6,129,228,93,6,9,157,152,6,41,232,212,6,1,205,18,7,193,82,82,7,169,128,147,7,9,94,214,7,65,242,26,8,193,68,97,8,9,93,169,8,169,66,243,8,65,253,62,9,129,148,140,9,41,16,220,9,9,120,45,10,1,212,128,10,1,44,214,10,9,136,45,11,41,240,134,11,129,108,226,11,65,5,64,12,169,194,159,12,9,173,1,13,193,204,101,13,65,42,204,13,9,206,52,14,169,192,159,14,193,10,13,15,1,181,124,15,41,200,238,15,9,77,99,16,129,76,218,16,129,207,83,17,9,223,207,17,41,132,78,18,1,200,207,18,193,179,83,19,169,80,218,19,9,168,99,20,65,195,239,20,193,171,126,21,9,107,16,22,169,10,165,22,65,148,60,23,129,17,215,23,41,140,116,24,9,14,21,25,1,161,184,25,1,79,95,26,9,34,9,27,41,36,182,27,129,95,102,28,65,222,25,29,169,170,208,29,9,207,138,30,193,85,72,31,65,73,9,32,9,180,205,32,169,160,149,33,193,25,97,34,1,42,48,35,41,220,2,36,9,59,217,36,129,81,179,37,147,6,0,0,69,14,0,0,15,28,0,0,17,51,0,0,91,87,0,0,13,142,0,0,119,221,0,0,57,77,1,0,99,230,1,0,149,179,2,0,31,193,3,0,33,29,5,0,171,215,6,0,221,2,9,0,7,179,11,0,201,254,14,0,51,255,18,0,229,207,23,0,47,143,29,0,49,94,36,0,251,96,44,0,173,190,53,0,151,161,64,0,89,55,77,0,3,177,91,0,53,67,108,0,63,38,127,0,65,150,148,0,75,211,172,0,125,33,200,0,39,201,230,0,233,22,9,1,211,91,47,1,133,237,89,1,79,38,137,1,81,101,189,1,155,14,247,1,77,139,54,2,183,73,124,2,121,189,200,2,163,95,28,3,213,174,119,3,95,47,219,3,97,107,71,4,235,242,188,4,29,92,60,5,71,67,198,5,9,75,91,6,115,28,252,6,37,103,169,7,111,225,99,8,113,72,44,9,59,96,3,10,237,243,233,10,215,213,224,11,153,223,232,12,67,242,2,14,117,246,47,15,127,220,112,16,129,156,198,17,139,54,50,19,189,178,180,20,103,33,79,22,41,155,2,24,19,65,208,25,197,60,185,27,143,192,190,29,145,7,226,31,219,85,36,34,141,248,134,36,247,69,11,39,185,157,178,41,227,104,126,44,21,26,112,47,159,45,137,50,161,41,203,53,43,158,55,57,93,37,208,60,135,99,150,64,73,7,140,68,179,201,178,72,101,110,12,77,175,195,154,81,177,162,95,86,123,239,92,91,45,153,148,96,23,154,8,102,217,247,186,107,131,195,173,113,181,25,227,119,191,34,93,126,29,35,0,0,113,77,0,0,145,156,0,0,253,38,1,0,101,12,2,0,233,119,3,0,153,162,5,0,53,214,8,0,45,112,13,0,225,228,19,0,33,195,28,0,237,183,40,0,117,146,56,0,89,72,77,0,41,250,103,0,37,248,137,0,61,199,180,0,81,38,234,0,177,19,44,1,221,210,124,1,133,242,222,1,201,82,85,2,185,43,227,2,21,20,140,3,77,8,84,4,193,113,63,5,65,46,83,6,205,151,148,7,149,140,9,9,57,119,184,10,73,87,168,12,5,202,224,14,93,19,106,17,49,39,77,20,209,178,147,23,189,38,72,27,165,192,117,31,169,149,40,36,217,156,109,41,245,185,82,47,109,200,230,53,161,166,57,61,97,65,92,69,173,159,96,78,181,238,89,88,25,142,92,99,105,28,126,111,229,131,213,124,255,189,0,0,1,168,1,0,143,107,3,0,241,158,6,0,63,35,12,0,193,61,21,0,143,182,35,0,241,252,57,0,255,81,91,0,1,250,139,0,15,117,209,0,113,191,50,1,63,154,184,1,193,220,109,2,15,207,95,3,113,142,158,4,255,123,61,6,1,182,83,8,143,156,252,10,241,97,88,14,63,167,140,18,193,37,197,23,143,101,52,30,241,129,20,38,255,251,167,47,1,156,58,59,15,98,34,73,113,134,192,89,63,138,130,109,193,88,227,132,1,14,4,0,145,33,9,0,17,44,19,0,65,238,37,0,65,79,71,0,145,67,128,0,17,247,221,0,1,70,115,1,1,146,90,2,17,1,184,3,145,53,188,5,65,143,167,8,65,6,206,12,17,178,155,18,145,15,154,26,1,26,118,37,1,76,7,52,145,158,87,71,17,157,172,96,65,166,145,129,35,81,22,0,197,158,50,0,23,185,107,0,153,246,216,0,107,137,160,1,13,196,254,2,31,1,80,5,33,217,29,9,51,108,48,15,213,162,164,24,167,103,8,39,41,253,125,60,123,181,231,91,29,119,29,137,175,160,45,201,173,142,123,0,137,230,25,1,57,150,94,2,61,22,216,4,181,99,119,9,225,40,198,17,33,3,52,32,117,72,130,56,125,87,87,96,191,91,175,2,129,216,39,6,247,132,94,13,233,254,173,27,127,139,235,54,129,183,229,104,23,3,156,193,193,12,255,14,57,106,133,34,25,238,145,75,129,120,43,158,51,225,9,84,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,188,21,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,230,71,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,172,93,0,0,18,72,0,0,40,22,0,0,128,7,0,0,3,0,0,0,8,24,0,0,60,24,0,0,112,24,0,0,164,24,0,0,216,24,0,0,136,1,0,0,60,72,0,0,147,94,0,0,27,96,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138,227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140,65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222,112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,86,76,0,0,248,52,0,0,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,74,0,0,248,52,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,73,0,0,248,52,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,73,0,0,248,52,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63,107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125,63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63,123,180,120,63,78,129,120,63,115,77,120,63,234,24,120,63,178,227,119,63,205,173,119,63,58,119,119,63,249,63,119,63,10,8,119,63,110,207,118,63,37,150,118,63,47,92,118,63,140,33,118,63,60,230,117,63,64,170,117,63,151,109,117,63,66,48,117,63,65,242,116,63,148,179,116,63,59,116,116,63,55,52,116,63,135,243,115,63,44,178,115,63,38,112,115,63,118,45,115,63,26,234,114,63,20,166,114,63,100,97,114,63,10,28,114,63,5,214,113,63,87,143,113,63,0,72,113,63,255,255,112,63,85,183,112,63,2,110,112,63,6,36,112,63,98,217,111,63,21,142,111,63,32,66,111,63,132,245,110,63,63,168,110,63,83,90,110,63,192,11,110,63,134,188,109,63,165,108,109,63,29,28,109,63,239,202,108,63,27,121,108,63,161,38,108,63,128,211,107,63,187,127,107,63,80,43,107,63,64,214,106,63,140,128,106,63,50,42,106,63,53,211,105,63,147,123,105,63,77,35,105,63,100,202,104,63,216,112,104,63,168,22,104,63,213,187,103,63,96,96,103,63,72,4,103,63,143,167,102,63,51,74,102,63,54,236,101,63,151,141,101,63,87,46,101,63,119,206,100,63,245,109,100,63,212,12,100,63,18,171,99,63,177,72,99,63,176,229,98,63,16,130,98,63,209,29,98,63,243,184,97,63,119,83,97,63,92,237,96,63,164,134,96,63,78,31,96,63,91,183,95,63,203,78,95,63,158,229,94,63,213,123,94,63,112,17,94,63,110,166,93,63,210,58,93,63,154,206,92,63,198,97,92,63,89,244,91,63,81,134,91,63,174,23,91,63,114,168,90,63,157,56,90,63,46,200,89,63,39,87,89,63,135,229,88,63,79,115,88,63,127,0,88,63,23,141,87,63,24,25,87,63,130,164,86,63,86,47,86,63,147,185,85,63,58,67,85,63,75,204,84,63,199,84,84,63,174,220,83,63,1,100,83,63,191,234,82,63,233,112,82,63,127,246,81,63,130,123,81,63,242,255,80,63,207,131,80,63,26,7,80,63,210,137,79,63,250,11,79,63,144,141,78,63,148,14,78,63,9,143,77,63,237,14,77,63,65,142,76,63,5,13,76,63,59,139,75,63,225,8,75,63,249,133,74,63,131,2,74,63,127,126,73,63,238,249,72,63,207,116,72,63,36,239,71,63,237,104,71,63,41,226,70,63,218,90,70,63,0,211,69,63,155,74,69,63,172,193,68,63,50,56,68,63,47,174,67,63,162,35,67,63,141,152,66,63,239,12,66,63,200,128,65,63,26,244,64,63,229,102,64,63,40,217,63,63,229,74,63,63,27,188,62,63,204,44,62,63,247,156,61,63,157,12,61,63,190,123,60,63,92,234,59,63,117,88,59,63,10,198,58,63,29,51,58,63,173,159,57,63,187,11,57,63,71,119,56,63,81,226,55,63,218,76,55,63,227,182,54,63,107,32,54,63,116,137,53,63,253,241,52,63,7,90,52,63,147,193,51,63,160,40,51,63,48,143,50,63,66,245,49,63,216,90,49,63,241,191,48,63,142,36,48,63,175,136,47,63,85,236,46,63,129,79,46,63,50,178,45,63,105,20,45,63,39,118,44,63,107,215,43,63,55,56,43,63,139,152,42,63,103,248,41,63,204,87,41,63,186,182,40,63,50,21,40,63,51,115,39,63,191,208,38,63,214,45,38,63,121,138,37,63,167,230,36,63,97,66,36,63,169,157,35,63,125,248,34,63,223,82,34,63,207,172,33,63,77,6,33,63,91,95,32,63,248,183,31,63,37,16,31,63,226,103,30,63,48,191,29,63,16,22,29,63,129,108,28,63,132,194,27,63,26,24,27,63,67,109,26,63,0,194,25,63,81,22,25,63,54,106,24,63,177,189,23,63,193,16,23,63,103,99,22,63,163,181,21,63,118,7,21,63,225,88,20,63,228,169,19,63,127,250,18,63,179,74,18,63,128,154,17,63,231,233,16,63,232,56,16,63,132,135,15,63,187,213,14,63,142,35,14,63,254,112,13,63,10,190,12,63,179,10,12,63,250,86,11,63,223,162,10,63,99,238,9,63,134,57,9,63,73,132,8,63,172,206,7,63,175,24,7,63,84,98,6,63,155,171,5,63,131,244,4,63,15,61,4,63,61,133,3,63,15,205,2,63,134,20,2,63,161,91,1,63,97,162,0,63,143,209,255,62,167,93,254,62,14,233,252,62,194,115,251,62,198,253,249,62,27,135,248,62,193,15,247,62,186,151,245,62,6,31,244,62,168,165,242,62,158,43,241,62,236,176,239,62,145,53,238,62,144,185,236,62,232,60,235,62,154,191,233,62,169,65,232,62,21,195,230,62,223,67,229,62,8,196,227,62,145,67,226,62,124,194,224,62,200,64,223,62,120,190,221,62,140,59,220,62,6,184,218,62,230,51,217,62,46,175,215,62,223,41,214,62,249,163,212,62,125,29,211,62,110,150,209,62,204,14,208,62,151,134,206,62,210,253,204,62,125,116,203,62,153,234,201,62,39,96,200,62,40,213,198,62,159,73,197,62,138,189,195,62,236,48,194,62,198,163,192,62,25,22,191,62,230,135,189,62,45,249,187,62,241,105,186,62,50,218,184,62,241,73,183,62,47,185,181,62,238,39,180,62,47,150,178,62,242,3,177,62,57,113,175,62,4,222,173,62,86,74,172,62,47,182,170,62,144,33,169,62,122,140,167,62,239,246,165,62,239,96,164,62,124,202,162,62,151,51,161,62,64,156,159,62,122,4,158,62,68,108,156,62,161,211,154,62,145,58,153,62,22,161,151,62,48,7,150,62,225,108,148,62,41,210,146,62,11,55,145,62,135,155,143,62,158,255,141,62,81,99,140,62,162,198,138,62,145,41,137,62,32,140,135,62,80,238,133,62,34,80,132,62,151,177,130,62,176,18,129,62,222,230,126,62,169,167,123,62,195,103,120,62,47,39,117,62,238,229,113,62,4,164,110,62,115,97,107,62,60,30,104,62,98,218,100,62,232,149,97,62,207,80,94,62,26,11,91,62,204,196,87,62,230,125,84,62,107,54,81,62,93,238,77,62,191,165,74,62,146,92,71,62,218,18,68,62,151,200,64,62,206,125,61,62,128,50,58,62,174,230,54,62,93,154,51,62,141,77,48,62,66,0,45,62,125,178,41,62,66,100,38,62,145,21,35,62,110,198,31,62,219,118,28,62,218,38,25,62,109,214,21,62,152,133,18,62,91,52,15,62,186,226,11,62,183,144,8,62,84,62,5,62,148,235,1,62,240,48,253,61,6,138,246,61,113,226,239,61,51,58,233,61,79,145,226,61,207,231,219,61,181,61,213,61,3,147,206,61,192,231,199,61,242,59,193,61,156,143,186,61,195,226,179,61,108,53,173,61,155,135,166,61,85,217,159,61,159,42,153,61,126,123,146,61,246,203,139,61,11,28,133,61,135,215,124,61,70,118,111,61,93,20,98,61,214,177,84,61,185,78,71,61,16,235,57,61,229,134,44,61,64,34,31,61,44,189,17,61,178,87,4,61,181,227,237,60,96,23,211,60,118,74,184,60,11,125,157,60,50,175,130,60,250,193,79,60,254,36,26,60,42,15,201,59,153,167,59,59,46,125,214,185,210,70,113,187,171,222,227,187,166,140,39,188,129,41,93,188,225,98,137,188,160,48,164,188,236,253,190,188,179,202,217,188,224,150,244,188,49,177,7,189,147,22,21,189,140,123,34,189,19,224,47,189,30,68,61,189,165,167,74,189,157,10,88,189,254,108,101,189,190,206,114,189,234,23,128,189,27,200,134,189,237,119,141,189,92,39,148,189,99,214,154,189,253,132,161,189,38,51,168,189,217,224,174,189,17,142,181,189,202,58,188,189,254,230,194,189,170,146,201,189,200,61,208,189,84,232,214,189,74,146,221,189,164,59,228,189,93,228,234,189,114,140,241,189,221,51,248,189,154,218,254,189,82,192,2,190,252,18,6,190,71,101,9,190,50,183,12,190,186,8,16,190,221,89,19,190,152,170,22,190,234,250,25,190,208,74,29,190,71,154,32,190,78,233,35,190,225,55,39,190,0,134,42,190,166,211,45,190,211,32,49,190,131,109,52,190,181,185,55,190,101,5,59,190,147,80,62,190,58,155,65,190,90,229,68,190,240,46,72,190,249,119,75,190,116,192,78,190,93,8,82,190,179,79,85,190,115,150,88,190,156,220,91,190,42,34,95,190,27,103,98,190,109,171,101,190,31,239,104,190,44,50,108,190,148,116,111,190,84,182,114,190,106,247,117,190,211,55,121,190,141,119,124,190,150,182,127,190,117,122,129,190,69,25,131,190,185,183,132,190,208,85,134,190,136,243,135,190,225,144,137,190,218,45,139,190,112,202,140,190,164,102,142,190,116,2,144,190,223,157,145,190,228,56,147,190,129,211,148,190,182,109,150,190,129,7,152,190,226,160,153,190,215,57,155,190,95,210,156,190,121,106,158,190,35,2,160,190,94,153,161,190,38,48,163,190,125,198,164,190,96,92,166,190,206,241,167,190,198,134,169,190,71,27,171,190,80,175,172,190,224,66,174,190,245,213,175,190,143,104,177,190,173,250,178,190,77,140,180,190,110,29,182,190,16,174,183,190,48,62,185,190,207,205,186,190,234,92,188,190,130,235,189,190,148,121,191,190,31,7,193,190,35,148,194,190,159,32,196,190,145,172,197,190,248,55,199,190,211,194,200,190,34,77,202,190,226,214,203,190,19,96,205,190,181,232,206,190,197,112,208,190,66,248,209,190,45,127,211,190,131,5,213,190,67,139,214,190,109,16,216,190,255,148,217,190,249,24,219,190,89,156,220,190,29,31,222,190,70,161,223,190,211,34,225,190,193,163,226,190,16,36,228,190,190,163,229,190,204,34,231,190,56,161,232,190,0,31,234,190,36,156,235,190,162,24,237,190,122,148,238,190,171,15,240,190,51,138,241,190,18,4,243,190,70,125,244,190,207,245,245,190,170,109,247,190,217,228,248,190,88,91,250,190,40,209,251,190,71,70,253,190,181,186,254,190,56,23,0,191,187,208,0,191,228,137,1,191,178,66,2,191,37,251,2,191,59,179,3,191,246,106,4,191,83,34,5,191,83,217,5,191,245,143,6,191,56,70,7,191,29,252,7,191,162,177,8,191,199,102,9,191,140,27,10,191,240,207,10,191,243,131,11,191,147,55,12,191,209,234,12,191,172,157,13,191,36,80,14,191,56,2,15,191,232,179,15,191,50,101,16,191,24,22,17,191,151,198,17,191,176,118,18,191,99,38,19,191,174,213,19,191,145,132,20,191,13,51,21,191,31,225,21,191,200,142,22,191,8,60,23,191,221,232,23,191,72,149,24,191,72,65,25,191,220,236,25,191,4,152,26,191,192,66,27,191,15,237,27,191,240,150,28,191,99,64,29,191,104,233,29,191,254,145,30,191,37,58,31,191,220,225,31,191,35,137,32,191,250,47,33,191,95,214,33,191,82,124,34,191,212,33,35,191,227,198,35,191,127,107,36,191,167,15,37,191,92,179,37,191,157,86,38,191,104,249,38,191,191,155,39,191,160,61,40,191,11,223,40,191,255,127,41,191,125,32,42,191,131,192,42,191,17,96,43,191,39,255,43,191,196,157,44,191,232,59,45,191,146,217,45,191,195,118,46,191,121,19,47,191,180,175,47,191,115,75,48,191,183,230,48,191,127,129,49,191,203,27,50,191,153,181,50,191,234,78,51,191,189,231,51,191,18,128,52,191,232,23,53,191,63,175,53,191,22,70,54,191,110,220,54,191,69,114,55,191,156,7,56,191,113,156,56,191,197,48,57,191,150,196,57,191,230,87,58,191,178,234,58,191,252,124,59,191,194,14,60,191,3,160,60,191,193,48,61,191,250,192,61,191,173,80,62,191,219,223,62,191,131,110,63,191,165,252,63,191,64,138,64,191,83,23,65,191,224,163,65,191,228,47,66,191,96,187,66,191,83,70,67,191,190,208,67,191,158,90,68,191,246,227,68,191,194,108,69,191,5,245,69,191,188,124,70,191,232,3,71,191,137,138,71,191,157,16,72,191,37,150,72,191,32,27,73,191,142,159,73,191,111,35,74,191,193,166,74,191,134,41,75,191,188,171,75,191,99,45,76,191,122,174,76,191,2,47,77,191,250,174,77,191,98,46,78,191,57,173,78,191,126,43,79,191,51,169,79,191,85,38,80,191,230,162,80,191,228,30,81,191,80,154,81,191,40,21,82,191,109,143,82,191,30,9,83,191,59,130,83,191,195,250,83,191,183,114,84,191,22,234,84,191,223,96,85,191,18,215,85,191,176,76,86,191,183,193,86,191,39,54,87,191,0,170,87,191,66,29,88,191,236,143,88,191,254,1,89,191,120,115,89,191,89,228,89,191,162,84,90,191,81,196,90,191,102,51,91,191,226,161,91,191,195,15,92,191,10,125,92,191,183,233,92,191,200,85,93,191,62,193,93,191,24,44,94,191,87,150,94,191,249,255,94,191,255,104,95,191,104,209,95,191,51,57,96,191,98,160,96,191,243,6,97,191,229,108,97,191,58,210,97,191,240,54,98,191,8,155,98,191,128,254,98,191,89,97,99,191,146,195,99,191,44,37,100,191,37,134,100,191,126,230,100,191,55,70,101,191,78,165,101,191,197,3,102,191,154,97,102,191,205,190,102,191,94,27,103,191,77,119,103,191,154,210,103,191,68,45,104,191,75,135,104,191,174,224,104,191,111,57,105,191,139,145,105,191,4,233,105,191,217,63,106,191,9,150,106,191,148,235,106,191,123,64,107,191,188,148,107,191,89,232,107,191,79,59,108,191,160,141,108,191,75,223,108,191,79,48,109,191,173,128,109,191,101,208,109,191,117,31,110,191,223,109,110,191,161,187,110,191,187,8,111,191,46,85,111,191,248,160,111,191,27,236,111,191,149,54,112,191,103,128,112,191,144,201,112,191,15,18,113,191,230,89,113,191,19,161,113,191,151,231,113,191,113,45,114,191,160,114,114,191,38,183,114,191,1,251,114,191,50,62,115,191,184,128,115,191,148,194,115,191,196,3,116,191,73,68,116,191,34,132,116,191,80,195,116,191,210,1,117,191,168,63,117,191,210,124,117,191,80,185,117,191,33,245,117,191,69,48,118,191,189,106,118,191,136,164,118,191,166,221,118,191,22,22,119,191,217,77,119,191,239,132,119,191,87,187,119,191,17,241,119,191,29,38,120,191,122,90,120,191,42,142,120,191,43,193,120,191,125,243,120,191,33,37,121,191,22,86,121,191,92,134,121,191,242,181,121,191,218,228,121,191,18,19,122,191,154,64,122,191,115,109,122,191,157,153,122,191,22,197,122,191,223,239,122,191,248,25,123,191,97,67,123,191,26,108,123,191,34,148,123,191,122,187,123,191,32,226,123,191,23,8,124,191,92,45,124,191,240,81,124,191,211,117,124,191,5,153,124,191,134,187,124,191,85,221,124,191,115,254,124,191,223,30,125,191,154,62,125,191,163,93,125,191,250,123,125,191,159,153,125,191,146,182,125,191,211,210,125,191,98,238,125,191,63,9,126,191,105,35,126,191,225,60,126,191,167,85,126,191,186,109,126,191,27,133,126,191,201,155,126,191,196,177,126,191,13,199,126,191,162,219,126,191,133,239,126,191,181,2,127,191,50,21,127,191,252,38,127,191,19,56,127,191,118,72,127,191,39,88,127,191,36,103,127,191,110,117,127,191,5,131,127,191,232,143,127,191,25,156,127,191,149,167,127,191,95,178,127,191,116,188,127,191,215,197,127,191,133,206,127,191,129,214,127,191,200,221,127,191,93,228,127,191,61,234,127,191,106,239,127,191,227,243,127,191,169,247,127,191,187,250,127,191,25,253,127,191,196,254,127,191,187,255,127,191,250,255,127,63,57,254,127,63,169,249,127,63,75,242,127,63,30,232,127,63,35,219,127,63,89,203,127,63,193,184,127,63,91,163,127,63,40,139,127,63,39,112,127,63,90,82,127,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([191,49,127,63,88,14,127,63,37,232,126,63,38,191,126,63,92,147,126,63,200,100,126,63,105,51,126,63,65,255,125,63,79,200,125,63,150,142,125,63,20,82,125,63,203,18,125,63,188,208,124,63,231,139,124,63,77,68,124,63,239,249,123,63,205,172,123,63,233,92,123,63,67,10,123,63,221,180,122,63,182,92,122,63,209,1,122,63,46,164,121,63,206,67,121,63,178,224,120,63,220,122,120,63,76,18,120,63,4,167,119,63,4,57,119,63,79,200,118,63,228,84,118,63,198,222,117,63,246,101,117,63,117,234,116,63,68,108,116,63,101,235,115,63,218,103,115,63,163,225,114,63,194,88,114,63,57,205,113,63,9,63,113,63,52,174,112,63,187,26,112,63,160,132,111,63,228,235,110,63,138,80,110,63,147,178,109,63,1,18,109,63,213,110,108,63,17,201,107,63,183,32,107,63,201,117,106,63,73,200,105,63,57,24,105,63,155,101,104,63,111,176,103,63,186,248,102,63,124,62,102,63,184,129,101,63,111,194,100,63,164,0,100,63,90,60,99,63,145,117,98,63,76,172,97,63,142,224,96,63,89,18,96,63,174,65,95,63,145,110,94,63,3,153,93,63,8,193,92,63,160,230,91,63,207,9,91,63,152,42,90,63,251,72,89,63,253,100,88,63,159,126,87,63,229,149,86,63,208,170,85,63,99,189,84,63,161,205,83,63,140,219,82,63,39,231,81,63,117,240,80,63,121,247,79,63,52,252,78,63,171,254,77,63,223,254,76,63,212,252,75,63,140,248,74,63,10,242,73,63,82,233,72,63,101,222,71,63,71,209,70,63,251,193,69,63,132,176,68,63,229,156,67,63,32,135,66,63,58,111,65,63,52,85,64,63,19,57,63,63,216,26,62,63,136,250,60,63,38,216,59,63,180,179,58,63,54,141,57,63,175,100,56,63,34,58,55,63,147,13,54,63,5,223,52,63,124,174,51,63,249,123,50,63,130,71,49,63,25,17,48,63,194,216,46,63,127,158,45,63,86,98,44,63,72,36,43,63,90,228,41,63,144,162,40,63,235,94,39,63,113,25,38,63,37,210,36,63,9,137,35,63,35,62,34,63,117,241,32,63,4,163,31,63,210,82,30,63,228,0,29,63,61,173,27,63,225,87,26,63,211,0,25,63,25,168,23,63,180,77,22,63,170,241,20,63,253,147,19,63,178,52,18,63,204,211,16,63,80,113,15,63,66,13,14,63,164,167,12,63,124,64,11,63,205,215,9,63,154,109,8,63,233,1,7,63,189,148,5,63,25,38,4,63,3,182,2,63,126,68,1,63,28,163,255,62,110,186,252,62,250,206,249,62,202,224,246,62,228,239,243,62,81,252,240,62,26,6,238,62,71,13,235,62,224,17,232,62,237,19,229,62,119,19,226,62,135,16,223,62,36,11,220,62,88,3,217,62,42,249,213,62,164,236,210,62,205,221,207,62,175,204,204,62,82,185,201,62,191,163,198,62,254,139,195,62,24,114,192,62,22,86,189,62,0,56,186,62,224,23,183,62,189,245,179,62,161,209,176,62,149,171,173,62,162,131,170,62,207,89,167,62,39,46,164,62,178,0,161,62,121,209,157,62,133,160,154,62,223,109,151,62,143,57,148,62,160,3,145,62,26,204,141,62,5,147,138,62,107,88,135,62,86,28,132,62,205,222,128,62,182,63,123,62,16,191,116,62,187,59,110,62,201,181,103,62,77,45,97,62,89,162,90,62,255,20,84,62,81,133,77,62,99,243,70,62,70,95,64,62,13,201,57,62,202,48,51,62,144,150,44,62,114,250,37,62,130,92,31,62,210,188,24,62,118,27,18,62,127,120,11,62,1,212,4,62,29,92,252,61,114,13,239,61,41,188,225,61,102,104,212,61,78,18,199,61,8,186,185,61,184,95,172,61,132,3,159,61,146,165,145,61,7,70,132,61,18,202,109,61,122,5,83,61,145,62,56,61,164,117,29,61,252,170,2,61,202,189,207,60,86,35,154,60,97,14,73,60,197,167,187,59,61,122,86,186,9,70,241,187,18,221,99,188,80,138,167,188,65,36,221,188,227,93,9,189,35,40,36,189,150,240,62,189,242,182,89,189,234,122,116,189,26,158,135,189,66,253,148,189,200,90,162,189,134,182,175,189,87,16,189,189,22,104,202,189,155,189,215,189,195,16,229,189,105,97,242,189,101,175,255,189,74,125,6,190,104,33,13,190,250,195,19,190,237,100,26,190,46,4,33,190,172,161,39,190,83,61,46,190,16,215,52,190,210,110,59,190,134,4,66,190,25,152,72,190,121,41,79,190,148,184,85,190,86,69,92,190,174,207,98,190,137,87,105,190,214,220,111,190,128,95,118,190,120,223,124,190,84,174,129,190,129,235,132,190,56,39,136,190,114,97,139,190,36,154,142,190,69,209,145,190,205,6,149,190,179,58,152,190,238,108,155,190,116,157,158,190,61,204,161,190,64,249,164,190,115,36,168,190,207,77,171,190,73,117,174,190,218,154,177,190,120,190,180,190,27,224,183,190,186,255,186,190,75,29,190,190,199,56,193,190,37,82,196,190,91,105,199,190,97,126,202,190,48,145,205,190,188,161,208,190,0,176,211,190,241,187,214,190,135,197,217,190,186,204,220,190,129,209,223,190,211,211,226,190,169,211,229,190,250,208,232,190,189,203,235,190,234,195,238,190,120,185,241,190,96,172,244,190,154,156,247,190,28,138,250,190,223,116,253,190,109,46,0,191,3,161,1,191,45,18,3,191,230,129,4,191,44,240,5,191,250,92,7,191,76,200,8,191,30,50,10,191,108,154,11,191,50,1,13,191,108,102,14,191,23,202,15,191,45,44,17,191,172,140,18,191,144,235,19,191,213,72,21,191,118,164,22,191,113,254,23,191,192,86,25,191,98,173,26,191,81,2,28,191,138,85,29,191,9,167,30,191,203,246,31,191,204,68,33,191,9,145,34,191,124,219,35,191,36,36,37,191,253,106,38,191,2,176,39,191,48,243,40,191,132,52,42,191,250,115,43,191,143,177,44,191,63,237,45,191,7,39,47,191,227,94,48,191,208,148,49,191,202,200,50,191,206,250,51,191,218,42,53,191,232,88,54,191,247,132,55,191,2,175,56,191,7,215,57,191,3,253,58,191,241,32,60,191,207,66,61,191,154,98,62,191,79,128,63,191,233,155,64,191,104,181,65,191,198,204,66,191,1,226,67,191,23,245,68,191,3,6,70,191,196,20,71,191,86,33,72,191,182,43,73,191,225,51,74,191,212,57,75,191,141,61,76,191,9,63,77,191,68,62,78,191,61,59,79,191,240,53,80,191,90,46,81,191,121,36,82,191,74,24,83,191,202,9,84,191,247,248,84,191,206,229,85,191,77,208,86,191,112,184,87,191,55,158,88,191,156,129,89,191,160,98,90,191,62,65,91,191,117,29,92,191,65,247,92,191,162,206,93,191,148,163,94,191,20,118,95,191,34,70,96,191,186,19,97,191,217,222,97,191,127,167,98,191,169,109,99,191,84,49,100,191,126,242,100,191,38,177,101,191,73,109,102,191,229,38,103,191,248,221,103,191,128,146,104,191,123,68,105,191,232,243,105,191,195,160,106,191,12,75,107,191,192,242,107,191,222,151,108,191,100,58,109,191,80,218,109,191,160,119,110,191,83,18,111,191,102,170,111,191,217,63,112,191,169,210,112,191,213,98,113,191,91,240,113,191,58,123,114,191,113,3,115,191,253,136,115,191,222,11,116,191,17,140,116,191,150,9,117,191,107,132,117,191,143,252,117,191,0,114,118,191,189,228,118,191,198,84,119,191,24,194,119,191,178,44,120,191,147,148,120,191,187,249,120,191,40,92,121,191,217,187,121,191,205,24,122,191,2,115,122,191,121,202,122,191,47,31,123,191,36,113,123,191,88,192,123,191,201,12,124,191,118,86,124,191,95,157,124,191,130,225,124,191,224,34,125,191,119,97,125,191,71,157,125,191,79,214,125,191,142,12,126,191,4,64,126,191,176,112,126,191,146,158,126,191,169,201,126,191,245,241,126,191,117,23,127,191,41,58,127,191,16,90,127,191,43,119,127,191,120,145,127,191,248,168,127,191,170,189,127,191,143,207,127,191,165,222,127,191,237,234,127,191,102,244,127,191,17,251,127,191,237,254,127,191,234,255,127,63,229,248,127,63,166,230,127,63,45,201,127,63,124,160,127,63,149,108,127,63,121,45,127,63,44,227,126,63,177,141,126,63,11,45,126,63,63,193,125,63,82,74,125,63,72,200,124,63,40,59,124,63,247,162,123,63,189,255,122,63,128,81,122,63,72,152,121,63,30,212,120,63,9,5,120,63,19,43,119,63,70,70,118,63,172,86,117,63,78,92,116,63,56,87,115,63,118,71,114,63,19,45,113,63,28,8,112,63,158,216,110,63,165,158,109,63,64,90,108,63,126,11,107,63,107,178,105,63,25,79,104,63,150,225,102,63,242,105,101,63,62,232,99,63,139,92,98,63,234,198,96,63,109,39,95,63,38,126,93,63,40,203,91,63,133,14,90,63,83,72,88,63,163,120,86,63,139,159,84,63,32,189,82,63,118,209,80,63,163,220,78,63,189,222,76,63,219,215,74,63,19,200,72,63,124,175,70,63,46,142,68,63,65,100,66,63,206,49,64,63,236,246,61,63,180,179,59,63,66,104,57,63,173,20,55,63,16,185,52,63,134,85,50,63,41,234,47,63,21,119,45,63,101,252,42,63,53,122,40,63,161,240,37,63,198,95,35,63,192,199,32,63,172,40,30,63,169,130,27,63,212,213,24,63,74,34,22,63,42,104,19,63,147,167,16,63,164,224,13,63,123,19,11,63,57,64,8,63,253,102,5,63,231,135,2,63,45,70,255,62,91,113,249,62,151,145,243,62,36,167,237,62,69,178,231,62,60,179,225,62,76,170,219,62,186,151,213,62,201,123,207,62,190,86,201,62,223,40,195,62,112,242,188,62,183,179,182,62,251,108,176,62,129,30,170,62,146,200,163,62,115,107,157,62,108,7,151,62,197,156,144,62,199,43,138,62,185,180,131,62,199,111,122,62,33,107,109,62,17,92,96,62,41,67,83,62,253,32,70,62,32,246,56,62,38,195,43,62,164,136,30,62,45,71,17,62,87,255,3,62,110,99,237,61,194,189,210,61,218,14,184,61,222,87,157,61,251,153,130,61,188,172,79,61,101,28,26,61,153,10,201,60,42,167,59,60,193,120,214,186,45,68,113,188,87,215,227,188,76,129,39,189,148,15,93,189,21,74,137,189,90,6,164,189,109,187,190,189,34,104,217,189,78,11,244,189,227,81,7,190,47,152,20,190,247,215,33,190,165,16,47,190,166,65,60,190,100,106,73,190,77,138,86,190,205,160,99,190,80,173,112,190,69,175,125,190,13,83,133,190,158,200,139,190,13,56,146,190,18,161,152,190,102,3,159,190,191,94,165,190,216,178,171,190,105,255,177,190,43,68,184,190,216,128,190,190,42,181,196,190,219,224,202,190,165,3,209,190,69,29,215,190,117,45,221,190,241,51,227,190,118,48,233,190,192,34,239,190,141,10,245,190,155,231,250,190,211,92,0,191,56,64,3,191,219,29,6,191,155,245,8,191,90,199,11,191,247,146,14,191,84,88,17,191,80,23,20,191,205,207,22,191,172,129,25,191,208,44,28,191,26,209,30,191,109,110,33,191,171,4,36,191,183,147,38,191,116,27,41,191,199,155,43,191,147,20,46,191,187,133,48,191,38,239,50,191,183,80,53,191,85,170,55,191,227,251,57,191,74,69,60,191,110,134,62,191,55,191,64,191,139,239,66,191,83,23,69,191,117,54,71,191,218,76,73,191,107,90,75,191,16,95,77,191,179,90,79,191,62,77,81,191,154,54,83,191,179,22,85,191,114,237,86,191,197,186,88,191,149,126,90,191,208,56,92,191,98,233,93,191,56,144,95,191,64,45,97,191,103,192,98,191,156,73,100,191,206,200,101,191,235,61,103,191,227,168,104,191,167,9,106,191,39,96,107,191,84,172,108,191,31,238,109,191,122,37,111,191,88,82,112,191,171,116,113,191,103,140,114,191,127,153,115,191,231,155,116,191,149,147,117,191,126,128,118,191,150,98,119,191,212,57,120,191,47,6,121,191,158,199,121,191,23,126,122,191,148,41,123,191,13,202,123,191,122,95,124,191,213,233,124,191,24,105,125,191,62,221,125,191,64,70,126,191,28,164,126,191,204,246,126,191,77,62,127,191,156,122,127,191,182,171,127,191,153,209,127,191,67,236,127,191,180,251,127,191,166,255,127,63,148,227,127,63,156,154,127,63,204,36,127,63,56,130,126,63,253,178,125,63,63,183,124,63,42,143,123,63,243,58,122,63,212,186,120,63,17,15,119,63,246,55,117,63,213,53,115,63,8,9,113,63,241,177,110,63,249,48,108,63,144,134,105,63,47,179,102,63,83,183,99,63,132,147,96,63,78,72,93,63,69,214,89,63,3,62,86,63,43,128,82,63,101,157,78,63,94,150,74,63,204,107,70,63,106,30,66,63,249,174,61,63,64,30,57,63,13,109,52,63,50,156,47,63,135,172,42,63,235,158,37,63,63,116,32,63,109,45,27,63,97,203,21,63,13,79,16,63,104,185,10,63,107,11,5,63,46,140,254,62,221,212,242,62,241,242,230,62,127,232,218,62,166,183,206,62,136,98,194,62,78,235,181,62,42,84,169,62,81,159,156,62,253,206,143,62,109,229,130,62,206,201,107,62,98,159,81,62,48,80,55,62,211,224,28,62,241,85,2,62,98,104,207,61,124,0,154,61,36,251,72,61,27,164,187,60,243,119,86,187,100,61,241,188,187,192,99,189,103,93,167,189,20,189,220,189,3,251,8,190,115,127,35,190,52,231,61,190,164,45,88,190,38,78,114,190,18,34,134,190,137,5,147,190,52,207,159,190,213,124,172,190,51,12,185,190,26,123,197,190,91,199,209,190,205,238,221,190,80,239,233,190,199,198,245,190,144,185,0,191,38,121,6,191,36,33,12,191,141,176,17,191,102,38,23,191,186,129,28,191,152,193,33,191,21,229,38,191,74,235,43,191,86,211,48,191,91,156,53,191,131,69,58,191,253,205,62,191,252,52,67,191,188,121,71,191,125,155,75,191,132,153,79,191,31,115,83,191,161,39,87,191,99,182,90,191,198,30,94,191,48,96,97,191,15,122,100,191,216,107,103,191,7,53,106,191,31,213,108,191,169,75,111,191,55,152,113,191,98,186,115,191,201,177,117,191,22,126,119,191,246,30,121,191,33,148,122,191,85,221,123,191,89,250,124,191,250,234,125,191,14,175,126,191,116,70,127,191,15,177,127,191,206,238,127,191,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10,113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190,234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141,142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202,40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17,63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124,183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203,89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127,191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48,124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191,215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48,191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179,86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191,65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207,125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126,191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122,55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90,191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53,63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2,191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63,76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160,189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48,32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21,239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79,63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63,10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18,124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62,190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,0,0,102,63,0,0,76,63,0,0,38,63,0,0,0,63,0,134,107,63,0,20,46,63,0,112,189,62,0,208,76,62,6,0,0,0,4,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,0,3,0,6,0,3,0,3,0,3,0,4,0,3,0,3,0,3,0,205,1,100,0,3,0,40,0,3,0,3,0,3,0,5,0,14,0,14,0,10,0,11,0,3,0,8,0,9,0,7,0,3,0,91,1,92,202,190,216,182,223,154,226,156,230,120,236,122,244,204,252,52,3,134,11,136,19,100,25,102,29,74,32,66,39,164,53,100,0,240,0,32,0,100,0,205,60,0,48,0,32,0,32,254,31,246,31,234,31,216,31,194,31,168,31,136,31,98,31,58,31,10,31,216,30,160,30,98,30,34,30,220,29,144,29,66,29,238,28,150,28,58,28,216,27,114,27,10,27,156,26,42,26,180,25,58,25,188,24,60,24,182,23,46,23,160,22,16,22,126,21,232,20,78,20,176,19,16,19,110,18,200,17,30,17,116,16,198,15,22,15,100,14,174,13,248,12,64,12,132,11,200,10,10,10,74,9,138,8,198,7,2,7,62,6,120,5,178,4,234,3,34,3,90,2,146,1,202,0,0,0,54,255,110,254,166,253,222,252,22,252,78,251,136,250,194,249,254,248,58,248,118,247,182,246,246,245,56,245,124,244,192,243,8,243,82,242,156,241,234,240,58,240,140,239,226,238,56,238,146,237,240,236,80,236,178,235,24,235,130,234,240,233,96,233,210,232,74,232,196,231,68,231,198,230,76,230,214,229,100,229,246,228,142,228,40,228,198,227,106,227,18,227,190,226,112,226,36,226,222,225,158,225,96,225,40,225,246,224,198,224,158,224,120,224,88,224,62,224,40,224,22,224,10,224,2,224,0,224,42,175,213,201,207,255,64,0,17,0,99,255,97,1,16,254,163,0,39,43,189,86,217,255,6,0,91,0,86,255,186,0,23,0,128,252,192,24,216,77,237,255,220,255,102,0,167,255,232,255,72,1,73,252,8,10,37,62,135,199,61,201,64,0,128,0,134,255,36,0,54,1,0,253,72,2,51,36,69,69,12,0,128,0,18,0,114,255,32,1,139,255,159,252,27,16,123,56,104,2,13,200,246,255,39,0,58,0,210,255,172,255,120,0,184,0,197,254,227,253,4,5,4,21,64,35,230,62,198,196,243,255,0,0,20,0,26,0,5,0,225,255,213,255,252,255,65,0,90,0,7,0,99,255,8,255,212,255,81,2,47,6,52,10,199,12,228,87,5,197,3,0,242,255,236,255,241,255,2,0,25,0,37,0,25,0,240,255,185,255,149,255,177,255,50,0,36,1,111,2,214,3,8,5,184,5,148,107,103,196,17,0,12,0,8,0,1,0,246,255,234,255,226,255,224,255,234,255,3,0,44,0,100,0,168,0,243,0,61,1,125,1,173,1,199,1,189,0,168,253,105,2,103,119,117,0,97,255,210,251,8,116,52,0,221,0,168,246,116,110,252,255,17,2,234,242,229,102,208,255,246,2,140,240,165,93,176,255,137,3,117,239,6,83,157,255,204,3,130,239,102,71,149,255,199,3,139,240,39,59,153,255,128,3,97,242,174,46,165,255,5,3,207,244,94,34,185,255,99,2,161,247,152,22,210,255,169,1,161,250,180,11,0,64,202,69,27,76,255,82,130,90,179,98,162,107,96,117,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,10,0,12,0,14,0,16,0,20,0,24,0,28,0,34,0,40,0,48,0,60,0,78,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,8,0,8,0,8,0,16,0,16,0,16,0,21,0,21,0,24,0,29,0,34,0,36,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,41,0,41,0,41,0,82,0,82,0,123,0,164,0,200,0,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,164,0,164,0,240,0,10,1,27,1,39,1,41,0,41,0,41,0,41,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,10,1,10,1,49,1,62,1,72,1,80,1,123,0,123,0,123,0,123,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,62,1,62,1,87,1,95,1,102,1,108,1,240,0,240,0,240,0,240,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,49,1,87,1,87,1,87,1,95,1,95,1,114,1,120,1,126,1,131,1,0,0,12,0,24,0,36,0,48,0,4,0,16,0,28,0,40,0,52,0,8,0,20,0,32,0,44,0,56,0,1,0,13,0,25,0,37,0,49,0,5,0,17,0,29,0,41,0,53,0,9,0,21,0,33,0,45,0,57,0,2,0,14,0,26,0,38,0,50,0,6,0,18,0,30,0,42,0,54,0,10,0,22,0,34,0,46,0,58,0,3,0,15,0,27,0,39,0,51,0,7,0,19,0,31,0,43,0,55,0,11,0,23,0,35,0,47,0,59,0,0,0,24,0,48,0,72,0,96,0,8,0,32,0,56,0,80,0,104,0,16,0,40,0,64,0,88,0,112,0,4,0,28,0,52,0,76,0,100,0,12,0,36,0,60,0,84,0,108,0,20,0,44,0,68,0,92,0,116,0,1,0,25,0,49,0,73,0,97,0,9,0,33,0,57,0,81,0,105,0,17,0,41,0,65,0,89,0,113,0,5,0,29,0,53,0,77,0,101,0,13,0,37,0,61,0,85,0,109,0,21,0,45,0,69,0,93,0,117,0,2,0,26,0,50,0,74,0,98,0,10,0,34,0,58,0,82,0,106,0,18,0,42,0,66,0,90,0,114,0,6,0,30,0,54,0,78,0,102,0,14,0,38,0,62,0,86,0,110,0,22,0,46,0,70,0,94,0,118,0,3,0,27,0,51,0,75,0,99,0,11,0,35,0,59,0,83,0,107,0,19,0,43,0,67,0,91,0,115,0,7,0,31,0,55,0,79,0,103,0,15,0,39,0,63,0,87,0,111,0,23,0,47,0,71,0,95,0,119,0,0,0,48,0,96,0,144,0,192,0,16,0,64,0,112,0,160,0,208,0,32,0,80,0,128,0,176,0,224,0,4,0,52,0,100,0,148,0,196,0,20,0,68,0,116,0,164,0,212,0,36,0,84,0,132,0,180,0,228,0,8,0,56,0,104,0,152,0,200,0,24,0,72,0,120,0,168,0,216,0,40,0,88,0,136,0,184,0,232,0,12,0,60,0,108,0,156,0,204,0,28,0,76,0,124,0,172,0,220,0,44,0,92,0,140,0,188,0,236,0,1,0,49,0,97,0,145,0,193,0,17,0,65,0,113,0,161,0,209,0,33,0,81,0,129,0,177,0,225,0,5,0,53,0,101,0,149,0,197,0,21,0,69,0,117,0,165,0,213,0,37,0,85,0,133,0,181,0,229,0,9,0,57,0,105,0,153,0,201,0,25,0,73,0,121,0,169,0,217,0,41,0,89,0,137,0,185,0,233,0,13,0,61,0,109,0,157,0,205,0,29,0,77,0,125,0,173,0,221,0,45,0,93,0,141,0,189,0,237,0,2,0,50,0,98,0,146,0,194,0,18,0,66,0,114,0,162,0,210,0,34,0,82,0,130,0,178,0,226,0,6,0,54,0,102,0,150,0,198,0,22,0,70,0,118,0,166,0,214,0,38,0,86,0,134,0,182,0,230,0,10,0,58,0,106,0,154,0,202,0,26,0,74,0,122,0,170,0,218,0,42,0,90,0,138,0,186,0,234,0,14,0,62,0,110,0,158,0,206,0,30,0,78,0,126,0,174,0,222,0,46,0,94,0,142,0,190,0,238,0,3,0,51,0,99,0,147,0,195,0,19,0,67,0,115,0,163,0,211,0,35,0,83,0,131,0,179,0,227,0,7,0,55,0,103,0,151,0,199,0,23,0,71,0,119,0,167,0,215,0,39,0,87,0,135,0,183,0,231,0,11,0,59,0,107,0,155,0,203,0,27,0,75,0,123,0,171,0,219,0,43,0,91,0,139,0,187,0,235,0,15,0,63,0,111,0,159,0,207,0,31,0,79,0,127,0,175,0,223,0,47,0,95,0,143,0,191,0,239,0,0,0,96,0,192,0,32,1,128,1,32,0,128,0,224,0,64,1,160,1,64,0,160,0,0,1,96,1,192,1,8,0,104,0,200,0,40,1,136,1,40,0,136,0,232,0,72,1,168,1,72,0,168,0,8,1,104,1,200,1,16,0,112,0,208,0,48,1,144,1,48,0,144,0,240,0,80,1,176,1,80,0,176,0,16,1,112,1,208,1,24,0,120,0,216,0,56,1,152,1,56,0,152,0,248,0,88,1,184,1,88,0,184,0,24,1,120,1,216,1,4,0,100,0,196,0,36,1,132,1,36,0,132,0,228,0,68,1,164,1,68,0,164,0,4,1,100,1,196,1,12,0,108,0,204,0,44,1,140,1,44,0,140,0,236,0,76,1,172,1,76,0,172,0,12,1,108,1,204,1,20,0,116,0,212,0,52,1,148,1,52,0,148,0,244,0,84,1,180,1,84,0,180,0,20,1,116,1,212,1,28,0,124,0,220,0,60,1,156,1,60,0,156,0,252,0,92,1,188,1,92,0,188,0,28,1,124,1,220,1,1,0,97,0,193,0,33,1,129,1,33,0,129,0,225,0,65,1,161,1,65,0,161,0,1,1,97,1,193,1,9,0,105,0,201,0,41,1,137,1,41,0,137,0,233,0,73,1,169,1,73,0,169,0,9,1,105,1,201,1,17,0,113,0,209,0,49,1,145,1,49,0,145,0,241,0,81,1,177,1,81,0,177,0,17,1,113,1,209,1,25,0,121,0,217,0,57,1,153,1,57,0,153,0,249,0,89,1,185,1,89,0,185,0,25,1,121,1,217,1,5,0,101,0,197,0,37,1,133,1,37,0,133,0,229,0,69,1,165,1,69,0,165,0,5,1,101,1,197,1,13,0,109,0,205,0,45,1,141,1,45,0,141,0,237,0,77,1,173,1,77,0,173,0,13,1,109,1,205,1,21,0,117,0,213,0,53,1,149,1,53,0,149,0,245,0,85,1,181,1,85,0,181,0,21,1,117,1,213,1,29,0,125,0,221,0,61,1,157,1,61,0,157,0,253,0,93,1,189,1,93,0,189,0,29,1,125,1,221,1,2,0,98,0,194,0,34,1,130,1,34,0,130,0,226,0,66,1,162,1,66,0,162,0,2,1,98,1,194,1,10,0,106,0,202,0,42,1,138,1,42,0,138,0,234,0,74,1,170,1,74,0,170,0,10,1,106,1,202,1,18,0,114,0,210,0,50,1,146,1,50,0,146,0,242,0,82,1,178,1,82,0,178,0,18,1,114,1,210,1,26,0,122,0,218,0,58,1,154,1,58,0,154,0,250,0,90,1,186,1,90,0,186,0,26,1,122,1,218,1,6,0,102,0,198,0,38,1,134,1,38,0,134,0,230,0,70,1,166,1,70,0,166,0,6,1,102,1,198,1,14,0,110,0,206,0,46,1,142,1,46,0,142,0,238,0,78,1,174,1,78,0,174,0,14,1,110,1,206,1,22,0,118,0,214,0,54,1,150,1,54,0,150,0,246,0,86,1,182,1,86,0,182,0,22,1,118,1,214,1,30,0,126,0,222,0,62,1,158,1,62,0,158,0,254,0,94,1,190,1,94,0,190,0,30,1,126,1,222,1,3,0,99,0,195,0,35,1,131,1,35,0,131,0,227,0,67,1,163,1,67,0,163,0,3,1,99,1,195,1,11,0,107,0,203,0,43,1,139,1,43,0,139,0,235,0,75,1,171,1,75,0,171,0,11,1,107,1,203,1,19,0,115,0,211,0,51,1,147,1,51,0,147,0,243,0,83,1,179,1,83,0,179,0,19,1,115,1,211,1,27,0,123,0,219,0,59,1,155,1,59,0,155,0,251,0,91,1,187,1,91,0,187,0,27,1,123,1,219,1,7,0,103,0,199,0,39,1,135,1,39,0,135,0,231,0,71,1,167,1,71,0,167,0,7,1,103,1,199,1,15,0,111,0,207,0,47,1,143,1,47,0,143,0,239,0,79,1,175,1,79,0,175,0,15,1,111,1,207,1,23,0,119,0,215,0,55,1,151,1,55,0,151,0,247,0,87,1,183,1,87,0,183,0,23,1,119,1,215,1,31,0,127,0,223,0,63,1,159,1,63,0,159,0,255],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([95,1,191,1,95,0,191,0,31,1,127,1,223,1,184,126,154,121,154,121,102,102,184,126,51,115,210,6,138,58,171,152,198,26,169,100,246,216,0,255,0,255,0,255,0,255,0,255,0,254,1,0,1,255,0,254,0,253,2,0,1,255,0,254,0,253,3,0,1,255,224,112,44,15,3,2,1,0,254,237,192,132,70,23,4,0,255,252,226,155,61,11,2,0,250,245,234,203,71,50,42,38,35,33,31,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,179,99,0,71,56,43,30,21,12,6,0,199,165,144,124,109,96,84,71,61,51,42,32,23,15,8,0,241,225,211,199,187,175,164,153,142,132,123,114,105,96,88,80,72,64,57,50,44,38,33,29,24,20,16,12,9,5,2,0,4,6,24,7,5,0,0,2,0,0,12,28,41,13,252,247,15,42,25,14,1,254,62,41,247,246,37,65,252,3,250,4,66,7,248,16,14,38,253,33,13,22,39,23,12,255,36,64,27,250,249,10,55,43,17,1,1,8,1,1,6,245,74,53,247,244,55,76,244,8,253,3,93,27,252,26,39,59,3,248,2,0,77,11,9,248,22,44,250,7,40,9,26,3,9,249,20,101,249,4,3,248,42,26,0,241,33,68,2,23,254,55,46,254,15,3,255,21,16,41,250,27,61,39,5,245,42,88,4,1,254,60,65,6,252,255,251,73,56,1,247,19,94,29,247,0,12,99,6,4,8,237,102,46,243,3,2,13,3,2,9,235,84,72,238,245,46,104,234,8,18,38,48,23,0,240,70,83,235,11,5,245,117,22,248,250,23,117,244,3,3,248,95,28,4,246,15,77,60,241,255,4,124,2,252,3,38,84,24,231,2,13,42,13,31,21,252,56,46,255,255,35,79,243,19,249,65,88,247,242,20,4,81,49,227,20,0,75,3,239,5,247,44,92,248,1,253,22,69,31,250,95,41,244,5,39,67,16,252,1,0,250,120,55,220,243,44,122,4,232,81,5,11,3,7,2,0,9,10,88,12,35,60,83,108,132,157,180,206,228,15,32,55,77,101,125,151,175,201,225,19,42,66,89,114,137,162,184,209,230,12,25,50,72,97,120,147,172,200,223,26,44,69,90,114,135,159,180,205,225,13,22,53,80,106,130,156,180,205,228,15,25,44,64,90,115,142,168,196,222,19,24,62,82,100,120,145,168,190,214,22,31,50,79,103,120,151,170,203,227,21,29,45,65,106,124,150,171,196,224,30,49,75,97,121,142,165,186,209,229,19,25,52,70,93,116,143,166,192,219,26,34,62,75,97,118,145,167,194,217,25,33,56,70,91,113,143,165,196,223,21,34,51,72,97,117,145,171,196,222,20,29,50,67,90,117,144,168,197,221,22,31,48,66,95,117,146,168,196,222,24,33,51,77,116,134,158,180,200,224,21,28,70,87,106,124,149,170,194,217,26,33,53,64,83,117,152,173,204,225,27,34,65,95,108,129,155,174,210,225,20,26,72,99,113,131,154,176,200,219,34,43,61,78,93,114,155,177,205,229,23,29,54,97,124,138,163,179,209,229,30,38,56,89,118,129,158,178,200,231,21,29,49,63,85,111,142,163,193,222,27,48,77,103,133,158,179,196,215,232,29,47,74,99,124,151,176,198,220,237,33,42,61,76,93,121,155,174,207,225,29,53,87,112,136,154,170,188,208,227,24,30,52,84,131,150,166,186,203,229,37,48,64,84,104,118,156,177,201,230,212,178,148,129,108,96,85,82,79,77,61,59,57,56,51,49,48,45,42,41,40,38,36,34,31,30,21,12,10,3,1,0,255,245,244,236,233,225,217,203,190,176,175,161,149,136,125,114,102,91,81,71,60,52,43,35,28,20,19,18,12,11,5,0,179,138,140,148,151,149,153,151,163,116,67,82,59,92,72,100,89,92,16,0,0,0,0,99,66,36,36,34,36,34,34,34,34,83,69,36,52,34,116,102,70,68,68,176,102,68,68,34,65,85,68,84,36,116,141,152,139,170,132,187,184,216,137,132,249,168,185,139,104,102,100,68,68,178,218,185,185,170,244,216,187,187,170,244,187,187,219,138,103,155,184,185,137,116,183,155,152,136,132,217,184,184,170,164,217,171,155,139,244,169,184,185,170,164,216,223,218,138,214,143,188,218,168,244,141,136,155,170,168,138,220,219,139,164,219,202,216,137,168,186,246,185,139,116,185,219,185,138,100,100,134,100,102,34,68,68,100,68,168,203,221,218,168,167,154,136,104,70,164,246,171,137,139,137,155,218,219,139,255,254,253,238,14,3,2,1,0,255,254,252,218,35,3,2,1,0,255,254,250,208,59,4,2,1,0,255,254,246,194,71,10,2,1,0,255,252,236,183,82,8,2,1,0,255,252,235,180,90,17,2,1,0,255,248,224,171,97,30,4,1,0,255,254,236,173,95,37,7,1,0,255,255,255,131,6,145,255,255,255,255,255,236,93,15,96,255,255,255,255,255,194,83,25,71,221,255,255,255,255,162,73,34,66,162,255,255,255,210,126,73,43,57,173,255,255,255,201,125,71,48,58,130,255,255,255,166,110,73,57,62,104,210,255,255,251,123,65,55,68,100,171,255,7,23,38,54,69,85,100,116,131,147,162,178,193,208,223,239,13,25,41,55,69,83,98,112,127,142,157,171,187,203,220,236,15,21,34,51,61,78,92,106,126,136,152,167,185,205,225,240,10,21,36,50,63,79,95,110,126,141,157,173,189,205,221,237,17,20,37,51,59,78,89,107,123,134,150,164,184,205,224,240,10,15,32,51,67,81,96,112,129,142,158,173,189,204,220,236,8,21,37,51,65,79,98,113,126,138,155,168,179,192,209,218,12,15,34,55,63,78,87,108,118,131,148,167,185,203,219,236,16,19,32,36,56,79,91,108,118,136,154,171,186,204,220,237,11,28,43,58,74,89,105,120,135,150,165,180,196,211,226,241,6,16,33,46,60,75,92,107,123,137,156,169,185,199,214,225,11,19,30,44,57,74,89,105,121,135,152,169,186,202,218,234,12,19,29,46,57,71,88,100,120,132,148,165,182,199,216,233,17,23,35,46,56,77,92,106,123,134,152,167,185,204,222,237,14,17,45,53,63,75,89,107,115,132,151,171,188,206,221,240,9,16,29,40,56,71,88,103,119,137,154,171,189,205,222,237,16,19,36,48,57,76,87,105,118,132,150,167,185,202,218,236,12,17,29,54,71,81,94,104,126,136,149,164,182,201,221,237,15,28,47,62,79,97,115,129,142,155,168,180,194,208,223,238,8,14,30,45,62,78,94,111,127,143,159,175,192,207,223,239,17,30,49,62,79,92,107,119,132,145,160,174,190,204,220,235,14,19,36,45,61,76,91,108,121,138,154,172,189,205,222,238,12,18,31,45,60,76,91,107,123,138,154,171,187,204,221,236,13,17,31,43,53,70,83,103,114,131,149,167,185,203,220,237,17,22,35,42,58,78,93,110,125,139,155,170,188,206,224,240,8,15,34,50,67,83,99,115,131,146,162,178,193,209,224,239,13,16,41,66,73,86,95,111,128,137,150,163,183,206,225,241,17,25,37,52,63,75,92,102,119,132,144,160,175,191,212,231,19,31,49,65,83,100,117,133,147,161,174,187,200,213,227,242,18,31,52,68,88,103,117,126,138,149,163,177,192,207,223,239,16,29,47,61,76,90,106,119,133,147,161,176,193,209,224,240,15,21,35,50,61,73,86,97,110,119,129,141,175,198,218,237,225,204,201,184,183,175,158,154,153,135,119,115,113,110,109,99,98,95,79,68,52,50,48,45,43,32,31,27,18,10,3,0,255,251,235,230,212,201,196,182,167,166,163,151,138,124,110,104,90,78,76,70,69,57,45,34,24,21,11,6,5,4,3,0,175,148,160,176,178,173,174,164,177,174,196,182,198,192,182,68,62,66,60,72,117,85,90,118,136,151,142,160,142,155,0,0,0,0,0,0,0,1,100,102,102,68,68,36,34,96,164,107,158,185,180,185,139,102,64,66,36,34,34,0,1,32,208,139,141,191,152,185,155,104,96,171,104,166,102,102,102,132,1,0,0,0,0,16,16,0,80,109,78,107,185,139,103,101,208,212,141,139,173,153,123,103,36,0,0,0,0,0,0,1,48,0,0,0,0,0,0,32,68,135,123,119,119,103,69,98,68,103,120,118,118,102,71,98,134,136,157,184,182,153,139,134,208,168,248,75,189,143,121,107,32,49,34,34,34,0,17,2,210,235,139,123,185,137,105,134,98,135,104,182,100,183,171,134,100,70,68,70,66,66,34,131,64,166,102,68,36,2,1,0,134,166,102,68,34,34,66,132,212,246,158,139,107,107,87,102,100,219,125,122,137,118,103,132,114,135,137,105,171,106,50,34,164,214,141,143,185,151,121,103,192,34,0,0,0,0,0,1,208,109,74,187,134,249,159,137,102,110,154,118,87,101,119,101,0,2,0,36,36,66,68,35,96,164,102,100,36,0,2,33,167,138,174,102,100,84,2,2,100,107,120,119,36,197,24,0,255,254,253,244,12,3,2,1,0,255,254,252,224,38,3,2,1,0,255,254,251,209,57,4,2,1,0,255,254,244,195,69,4,2,1,0,255,251,232,184,84,7,2,1,0,255,254,240,186,86,14,2,1,0,255,254,239,178,91,30,5,1,0,255,248,227,177,100,19,2,1,0,255,255,255,156,4,154,255,255,255,255,255,227,102,15,92,255,255,255,255,255,213,83,24,72,236,255,255,255,255,150,76,33,63,214,255,255,255,190,121,77,43,55,185,255,255,255,245,137,71,43,59,139,255,255,255,255,131,66,50,66,107,194,255,255,166,116,76,55,53,125,255,255,249,247,246,245,244,234,210,202,201,200,197,174,82,59,56,55,54,46,22,12,11,10,9,7,0,64,0,203,150,0,215,195,166,125,110,82,0,120,0,128,64,0,232,158,10,0,230,0,243,221,192,181,0,171,85,0,192,128,64,0,205,154,102,51,0,213,171,128,85,43,0,224,192,160,128,96,64,32,0,100,40,16,7,3,1,0,253,250,244,233,212,182,150,131,120,110,98,85,72,60,49,40,32,25,19,15,13,11,9,8,7,6,5,4,3,2,1,0,210,208,206,203,199,193,183,168,142,104,74,52,37,27,20,14,10,6,4,2,0,223,201,183,167,152,138,124,111,98,88,79,70,62,56,50,44,39,35,31,27,24,21,18,16,14,12,10,8,6,4,3,2,1,0,188,176,155,138,119,97,67,43,26,10,0,165,119,80,61,47,35,27,20,14,9,4,0,113,63,0,125,51,26,18,15,12,11,10,9,8,7,6,5,4,3,2,1,0,198,105,45,22,15,12,11,10,9,8,7,6,5,4,3,2,1,0,213,162,116,83,59,43,32,24,18,15,12,9,7,6,5,3,2,0,239,187,116,59,28,16,11,10,9,8,7,6,5,4,3,2,1,0,250,229,188,135,86,51,30,19,13,10,8,6,5,4,3,2,1,0,249,235,213,185,156,128,103,83,66,53,42,33,26,21,17,13,10,0,254,249,235,206,164,118,77,46,27,16,10,7,5,4,3,2,1,0,255,253,249,239,220,191,156,119,85,57,37,23,15,10,6,4,2,0,255,253,251,246,237,223,203,179,152,124,98,75,55,40,29,21,15,0,255,254,253,247,220,162,106,67,42,28,18,12,9,6,4,3,2,0,241,190,178,132,87,74,41,14,0,223,193,157,140,106,57,39,18,0,128,0,214,42,0,235,128,21,0,244,184,72,11,0,248,214,128,42,7,0,248,225,170,80,25,5,0,251,236,198,126,54,18,3,0,250,238,211,159,82,35,15,5,0,250,231,203,168,128,88,53,25,6,0,252,238,216,185,148,108,71,40,18,4,0,253,243,225,199,166,128,90,57,31,13,3,0,254,246,233,212,183,147,109,73,44,23,10,2,0,255,250,240,223,198,166,128,90,58,33,16,6,1,0,255,251,244,231,210,181,146,110,75,46,25,12,5,1,0,255,253,248,238,221,196,164,128,92,60,35,18,8,3,1,0,255,253,249,242,229,208,180,146,110,76,48,27,14,7,3,1,0,129,0,207,50,0,236,129,20,0,245,185,72,10,0,249,213,129,42,6,0,250,226,169,87,27,4,0,251,233,194,130,62,20,4,0,250,236,207,160,99,47,17,3,0,255,240,217,182,131,81,41,11,1,0,255,254,233,201,159,107,61,20,2,1,0,255,249,233,206,170,128,86,50,23,7,1,0,255,250,238,217,186,148,108,70,39,18,6,1,0,255,252,243,226,200,166,128,90,56,30,13,4,1,0,255,252,245,231,209,180,146,110,76,47,25,11,4,1,0,255,253,248,237,219,194,163,128,93,62,37,19,8,3,1,0,255,254,250,241,226,205,177,145,111,79,51,30,15,6,2,1,0,129,0,203,54,0,234,129,23,0,245,184,73,10,0,250,215,129,41,5,0,252,232,173,86,24,3,0,253,240,200,129,56,15,2,0,253,244,217,164,94,38,10,1,0,253,245,226,189,132,71,27,7,1,0,253,246,231,203,159,105,56,23,6,1,0,255,248,235,213,179,133,85,47,19,5,1,0,255,254,243,221,194,159,117,70,37,12,2,1,0,255,254,248,234,208,171,128,85,48,22,8,2,1,0,255,254,250,240,220,189,149,107,67,36,16,6,2,1,0,255,254,251,243,227,201,166,128,90,55,29,13,5,2,1,0,255,254,252,246,234,213,183,147,109,73,43,22,10,4,2,1,0,130,0,200,58,0,231,130,26,0,244,184,76,12,0,249,214,130,43,6,0,252,232,173,87,24,3,0,253,241,203,131,56,14,2,0,254,246,221,167,94,35,8,1,0,254,249,232,193,130,65,23,5,1,0,255,251,239,211,162,99,45,15,4,1,0,255,251,243,223,186,131,74,33,11,3,1,0,255,252,245,230,202,158,105,57,24,8,2,1,0,255,253,247,235,214,179,132,84,44,19,7,2,1,0,255,254,250,240,223,196,159,112,69,36,15,6,2,1,0,255,254,253,245,231,209,176,136,93,55,27,11,3,2,1,0,255,254,253,252,239,221,194,158,117,76,42,18,4,3,2,1,0,0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,254,49,67,77,82,93,99,198,11,18,24,31,36,45,255,46,66,78,87,94,104,208,14,21,32,42,51,66,255,94,104,109,112,115,118,248,53,69,80,88,95,102,0,1,0,0,0,1,0,0,1,255,1,255,2,254,2,254,3,253,0,1,0,1,255,2,255,2,254,3,254,3,0,2,255,255,255,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,255,2,1,0,1,1,0,0,255,255,0,0,1,255,0,1,255,0,255,1,254,2,254,254,2,253,2,3,253,252,3,252,4,4,251,5,250,251,6,249,6,5,8,247,0,0,1,0,0,0,0,0,0,0,255,1,0,0,1,255,0,1,255,255,1,255,2,1,255,2,254,254,2,254,2,2,3,253,0,1,0,0,0,0,0,0,1,0,1,0,0,1,255,1,0,0,2,1,255,2,255,255,2,255,2,2,255,3,254,254,254,3,0,1,0,0,1,0,1,255,2,255,2,255,2,3,254,3,254,254,4,4,253,5,253,252,6,252,6,5,251,8,250,251,249,9,0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3,0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,80,75,69,63,56,49,40,34,29,20,18,10,0,0,0,0,0,0,0,0,110,100,90,84,78,71,65,58,51,45,39,32,26,20,12,0,0,0,0,0,0,118,110,103,93,86,80,75,70,65,59,53,47,40,31,23,15,4,0,0,0,0,126,119,112,104,95,89,83,78,72,66,60,54,47,39,32,25,17,12,1,0,0,134,127,120,114,103,97,91,85,78,72,66,60,54,47,41,35,29,23,16,10,1,144,137,130,124,113,107,101,95,88,82,76,70,64,57,51,45,39,33,26,15,1,152,145,138,132,123,117,111,105,98,92,86,80,74,67,61,55,49,43,36,20,1,162,155,148,142,133,127,121,115,108,102,96,90,84,77,71,65,59,53,46,30,1,172,165,158,152,143,137,131,125,118,112,106,100,94,87,81,75,69,63,56,45,20,200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,40,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,40,15,23,28,31,34,36,38,39,41,42,43,44,45,46,47,47,49,50,51,52,53,54,55,55,57,58,59,60,61,62,63,63,65,66,67,68,69,70,71,71,40,20,33,41,48,53,57,61,64,66,69,71,73,75,76,78,80,82,85,87,89,91,92,94,96,98,101,103,105,107,108,110,112,114,117,119,121,123,124,126,128,40,23,39,51,60,67,73,79,83,87,91,94,97,100,102,105,107,111,115,118,121,124,126,129,131,135,139,142,145,148,150,153,155,159,163,166,169,172,174,177,179,35,28,49,65,78,89,99,107,114,120,126,132,136,141,145,149,153,159,165,171,176,180,185,189,192,199,205,211,216,220,225,229,232,239,245,251,21,33,58,79,97,112,125,137,148,157,166,174,182,189,195,201,207,217,227,235,243,251,17,35,63,86,106,123,139,152,165,177,187,197,206,214,222,230,237,250,25,31,55,75,91,105,117,128,138,146,154,161,168,174,180,185,190,200,208,215,222,229,235,240,245,255,16,36,65,89,110,128,144,159,173,185,196,207,217,226,234,242,250,11,41,74,103,128,151,172,191,209,225,241,255,9,43,79,110,138,163,186,207,227,246,12,39,71,99,123,144,164,182,198,214,228,241,253,9,44,81,113,142,168,192,214,235,255,7,49,90,127,160,191,220,247,6,51,95,134,170,203,234,7,47,87,123,155,184,212,237,6,52,97,137,174,208,240,5,57,106,151,192,231,5,59,111,158,202,243,5,55,103,147,187,224,5,60,113,161,206,248,4,65,122,175,224,4,67,127,182,234,224,224,224,224,224,224,224,224,160,160,160,160,185,185,185,178,178,168,134,61,37,224,224,224,224,224,224,224,224,240,240,240,240,207,207,207,198,198,183,144,66,40,160,160,160,160,160,160,160,160,185,185,185,185,193,193,193,183,183,172,138,64,38,240,240,240,240,240,240,240,240,207,207,207,207,204,204,204,193,193,180,143,66,40,185,185,185,185,185,185,185,185,193,193,193,193,193,193,193,183,183,172,138,65,39,207,207,207,207,207,207,207,207,204,204,204,204,201,201,201,188,188,176,141,66,40,193,193,193,193,193,193,193,193,193,193,193,193,194,194,194,184,184,173,139,65,39,204,204,204,204,204,204,204,204,201,201,201,201,198,198,198,187,187,175,140,66,40,0,8,13,16,19,21,23,24,26,27,28,29,30,31,32,32,33,34,34,35,36,36,37,37,72,127,65,129,66,128,65,128,64,128,62,128,64,128,64,128,92,78,92,79,92,78,90,79,116,41,115,40,114,40,132,26,132,26,145,17,161,12,176,10,177,11,24,179,48,138,54,135,54,132,53,134,56,133,55,132,55,132,61,114,70,96,74,88,75,88,87,74,89,66,91,67,100,59,108,50,120,40,122,37,97,43,78,50,83,78,84,81,88,75,86,74,87,71,90,73,93,74,93,74,109,40,114,36,117,34,117,34,143,17,145,18,146,19,162,12,165,10,178,7,189,6,190,8,177,9,23,178,54,115,63,102,66,98,69,99,74,89,71,91,73,91,78,89,86,80,92,66,93,64,102,59,103,60,104,60,117,52,123,44,138,35,133,31,97,38,77,45,61,90,93,60,105,42,107,41,110,45,116,38,113,38,112,38,124,26,132,27,136,19,140,20,155,14,159,16,158,18,170,13,177,10,187,8,192,6,175,9,159,10,21,178,59,110,71,86,75,85,84,83,91,66,88,73,87,72,92,75,98,72,105,58,107,54,115,52,114,55,112,56,129,51,132,40,150,33,140,29,98,35,77,42,42,121,96,66,108,43,111,40,117,44,123,32,120,36,119,33,127,33,134,34,139,21,147,23,152,20,158,25,154,26,166,21,173,16,184,13,184,10,150,13,139,15,22,178,63,114,74,82,84,83,92,82,103,62,96,72,96,67,101,73,107,72,113,55,118,52,125,52,118,52,117,55,135,49,137,39,157,32,145,29,97,33,77,40,2,1,0,2,1,0,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,0,15,8,7,4,11,12,3,2,13,10,5,6,9,14,1,0,9,6,3,4,5,8,1,2,7,6,0,3,0,7,3,0,1,10,0,2,6,18,10,12,4,0,2,0,0,0,9,4,7,4,0,3,12,7,7,255,255,79,112,117,115,72,101,97,100,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);var tempDoublePtr=STATICTOP;STATICTOP+=16;Module["_bitshift64Ashr"]=_bitshift64Ashr;Module["_i64Add"]=_i64Add;Module["_memset"]=_memset;function _abort(){Module["abort"]()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;var _llvm_pow_f64=Math_pow;Module["___muldsi3"]=___muldsi3;Module["___muldi3"]=___muldi3;function _llvm_stackrestore(p){var self=_llvm_stacksave;var ret=self.LLVM_SAVEDSTACKS[p];self.LLVM_SAVEDSTACKS.splice(p,1);Runtime.stackRestore(ret)}function _ogvjs_callback_audio(buffers,channels,sampleCount){var HEAPU32=Module.HEAPU32;var HEAPF32=Module.HEAPF32;var outputBuffers=[];if(buffers!==0){var inPtr,inArray,inBuffer,outArray;for(var channel=0;channel>2]=value;return value}Module["_sbrk"]=_sbrk;DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC);STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6){try{Module["dynCall_viiiiii"](index,a1,a2,a3,a4,a5,a6)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}Module.asmGlobalArg={"Math":Math,"Int8Array":Int8Array,"Int16Array":Int16Array,"Int32Array":Int32Array,"Uint8Array":Uint8Array,"Uint16Array":Uint16Array,"Uint32Array":Uint32Array,"Float32Array":Float32Array,"Float64Array":Float64Array,"NaN":NaN,"Infinity":Infinity};Module.asmLibraryArg={"abort":abort,"assert":assert,"enlargeMemory":enlargeMemory,"getTotalMemory":getTotalMemory,"abortOnCannotGrowMemory":abortOnCannotGrowMemory,"invoke_viiiiii":invoke_viiiiii,"_ogvjs_callback_init_audio":_ogvjs_callback_init_audio,"_llvm_pow_f64":_llvm_pow_f64,"_abort":_abort,"___setErrNo":___setErrNo,"_llvm_stacksave":_llvm_stacksave,"_ogvjs_callback_audio":_ogvjs_callback_audio,"_emscripten_memcpy_big":_emscripten_memcpy_big,"_llvm_stackrestore":_llvm_stackrestore,"DYNAMICTOP_PTR":DYNAMICTOP_PTR,"tempDoublePtr":tempDoublePtr,"ABORT":ABORT,"STACKTOP":STACKTOP,"STACK_MAX":STACK_MAX};// EMSCRIPTEN_START_ASM +var asm=(function(global,env,buffer) { +"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.DYNAMICTOP_PTR|0;var j=env.tempDoublePtr|0;var k=env.ABORT|0;var l=env.STACKTOP|0;var m=env.STACK_MAX|0;var n=0;var o=0;var p=0;var q=0;var r=global.NaN,s=global.Infinity;var t=0,u=0,v=0,w=0,x=0.0,y=0,z=0,A=0,B=0.0;var C=0;var D=global.Math.floor;var E=global.Math.abs;var F=global.Math.sqrt;var G=global.Math.pow;var H=global.Math.cos;var I=global.Math.sin;var J=global.Math.tan;var K=global.Math.acos;var L=global.Math.asin;var M=global.Math.atan;var N=global.Math.atan2;var O=global.Math.exp;var P=global.Math.log;var Q=global.Math.ceil;var R=global.Math.imul;var S=global.Math.min;var T=global.Math.max;var U=global.Math.clz32;var V=env.abort;var W=env.assert;var X=env.enlargeMemory;var Y=env.getTotalMemory;var Z=env.abortOnCannotGrowMemory;var _=env.invoke_viiiiii;var $=env._ogvjs_callback_init_audio;var aa=env._llvm_pow_f64;var ba=env._abort;var ca=env.___setErrNo;var da=env._llvm_stacksave;var ea=env._ogvjs_callback_audio;var fa=env._emscripten_memcpy_big;var ga=env._llvm_stackrestore;var ha=0.0; +// EMSCRIPTEN_START_FUNCS +function ja(a){a=a|0;var b=0;b=l;l=l+a|0;l=l+15&-16;return b|0}function ka(){return l|0}function la(a){a=a|0;l=a}function ma(a,b){a=a|0;b=b|0;l=a;m=b}function na(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function oa(a){a=a|0;C=a}function pa(){return C|0}function qa(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=(R(1664525,c[d>>2]|0)|0)+1013904223|0;l=b;return a|0}function ra(a,d,e,f,h,i,j,k,m){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0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2];z=(c[u>>2]|0)+((R(c[H>>2]|0,c[y>>2]|0)|0)<<2)|0;c[Q>>2]=z+(b[(c[(c[t>>2]|0)+32>>2]|0)+(c[I>>2]<<1)>>1]<>2]<<2);c[K>>2]=0;while(1){if((c[K>>2]|0)>=(1<>2]|0))break;z=R(c[I>>2]|0,c[x>>2]|0)|0;if(!(d[(c[v>>2]|0)+(z+(c[H>>2]|0))>>0]&1<>2])){c[J>>2]=0;while(1){if((c[J>>2]|0)>=(c[L>>2]|0))break;c[G>>2]=qa(c[G>>2]|0)|0;Z=+g[V>>2];g[(c[Q>>2]|0)+((c[J>>2]<>2])+(c[K>>2]|0)<<2)>>2]=c[G>>2]&32768|0?Z:-Z;c[J>>2]=(c[J>>2]|0)+1}c[W>>2]=1}c[K>>2]=(c[K>>2]|0)+1}if(c[W>>2]|0)ua(c[Q>>2]|0,c[L>>2]<>2],1.0);z=(c[H>>2]|0)+1|0;c[H>>2]=z}while((z|0)<(c[x>>2]|0));c[I>>2]=(c[I>>2]|0)+1}l=s;return}function ta(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0}function ua(a,b,d){a=a|0;b=b|0;d=+d;var e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;e=l;l=l+32|0;f=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;m=e+8|0;n=e+4|0;o=e;c[f>>2]=a;c[h>>2]=b;g[i>>2]=d;g[k>>2]=+va(c[f>>2]|0,c[f>>2]|0,c[h>>2]|0)+1.0000000036274937e-15;g[n>>2]=+g[k>>2];d=1.0/+F(+(+g[n>>2]));g[m>>2]=d*+g[i>>2];c[o>>2]=c[f>>2];c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[h>>2]|0))break;g[c[o>>2]>>2]=+g[m>>2]*+g[c[o>>2]>>2];c[o>>2]=(c[o>>2]|0)+4;c[j>>2]=(c[j>>2]|0)+1}l=e;return}function va(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0.0;e=l;l=l+32|0;f=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[h>>2]=b;c[i>>2]=d;g[k>>2]=0.0;c[j>>2]=0;while(1){m=+g[k>>2];if((c[j>>2]|0)>=(c[i>>2]|0))break;g[k>>2]=m+ +g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]*+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2];c[j>>2]=(c[j>>2]|0)+1}l=e;return +m}function wa(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+32|0;f=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;m=e+4|0;n=e;c[f>>2]=a;c[h>>2]=b;c[i>>2]=d;c[h>>2]=c[h>>2]>>1;c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[i>>2]|0))break;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[h>>2]|0))break;d=R(c[i>>2]<<1,c[k>>2]|0)|0;g[m>>2]=+g[(c[f>>2]|0)+(d+(c[j>>2]|0)<<2)>>2]*.7071067690849304;d=R(c[i>>2]|0,(c[k>>2]<<1)+1|0)|0;g[n>>2]=+g[(c[f>>2]|0)+(d+(c[j>>2]|0)<<2)>>2]*.7071067690849304;d=R(c[i>>2]<<1,c[k>>2]|0)|0;g[(c[f>>2]|0)+(d+(c[j>>2]|0)<<2)>>2]=+g[m>>2]+ +g[n>>2];d=R(c[i>>2]|0,(c[k>>2]<<1)+1|0)|0;g[(c[f>>2]|0)+(d+(c[j>>2]|0)<<2)>>2]=+g[m>>2]-+g[n>>2];c[k>>2]=(c[k>>2]|0)+1}c[j>>2]=(c[j>>2]|0)+1}l=e;return}function xa(e,f,h,i,j,k,m,n,o,p,q,r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return i|0}else{d=c[h>>2]&255;h=c[c[g>>2]>>2]|0;b=c[(c[g>>2]|0)+4>>2]|0;j=(c[g>>2]|0)+8|0;g=(c[j>>2]|0)+1|0;c[j>>2]=g;a[h+(b-g)>>0]=d;c[f>>2]=0;i=c[f>>2]|0;l=e;return i|0}return 0}function Ka(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=l;l=l+32|0;i=h+28|0;j=h+24|0;k=h+20|0;m=h+16|0;n=h+12|0;o=h+8|0;p=h+4|0;q=h;c[i>>2]=a;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[n>>2]=g;c[q>>2]=(c[i>>2]<<1)-1;if((c[n>>2]|0)!=0&(c[i>>2]|0)==2)c[q>>2]=(c[q>>2]|0)+-1;i=(c[j>>2]|0)+(R(c[q>>2]|0,c[k>>2]|0)|0)|0;c[p>>2]=za(i,c[q>>2]|0)|0;if(((c[j>>2]|0)-(c[m>>2]|0)-32|0)<(c[p>>2]|0))r=(c[j>>2]|0)-(c[m>>2]|0)-32|0;else r=c[p>>2]|0;c[p>>2]=r;c[p>>2]=64<(c[p>>2]|0)?64:c[p>>2]|0;if((c[p>>2]|0)<4){c[o>>2]=1;s=c[o>>2]|0;l=h;return s|0}else{c[o>>2]=b[18390+((c[p>>2]&7)<<1)>>1]>>14-(c[p>>2]>>3);c[o>>2]=(c[o>>2]|0)+1>>1<<1;s=c[o>>2]|0;l=h;return s|0}return 0}function La(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0;f=l;l=l+48|0;h=f+44|0;i=f+40|0;j=f+36|0;k=f+32|0;m=f+28|0;n=f+24|0;o=f+20|0;p=f+16|0;q=f+12|0;r=f+8|0;s=f+4|0;t=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;g[r>>2]=1.0000000036274937e-15;g[q>>2]=1.0000000036274937e-15;a:do if(c[j>>2]|0){c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[k>>2]|0))break a;g[s>>2]=+g[(c[h>>2]|0)+(c[m>>2]<<2)>>2]+ +g[(c[i>>2]|0)+(c[m>>2]<<2)>>2];g[t>>2]=+g[(c[h>>2]|0)+(c[m>>2]<<2)>>2]-+g[(c[i>>2]|0)+(c[m>>2]<<2)>>2];g[q>>2]=+g[q>>2]+ +g[s>>2]*+g[s>>2];g[r>>2]=+g[r>>2]+ +g[t>>2]*+g[t>>2];c[m>>2]=(c[m>>2]|0)+1}}else{u=+va(c[h>>2]|0,c[h>>2]|0,c[k>>2]|0);g[q>>2]=+g[q>>2]+u;u=+va(c[i>>2]|0,c[i>>2]|0,c[k>>2]|0);g[r>>2]=+g[r>>2]+u}while(0);g[o>>2]=+F(+(+g[q>>2]));g[p>>2]=+F(+(+g[r>>2]));c[n>>2]=~~+D(+(+N(+(+g[p>>2]),+(+g[o>>2]))*10430.3818359375+.5));l=f;return c[n>>2]|0}function Ma(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=cb(c[(c[g>>2]|0)+28>>2]|0,c[j>>2]|0)|0;if((c[h>>2]|0)>>>0>0){e=(c[(c[g>>2]|0)+28>>2]|0)-(R(c[k>>2]|0,(c[j>>2]|0)-(c[h>>2]|0)|0)|0)|0;d=(c[g>>2]|0)+32|0;c[d>>2]=(c[d>>2]|0)+e;e=R(c[k>>2]|0,(c[i>>2]|0)-(c[h>>2]|0)|0)|0;c[(c[g>>2]|0)+28>>2]=e;m=c[g>>2]|0;_a(m);l=f;return}else{e=R(c[k>>2]|0,(c[j>>2]|0)-(c[i>>2]|0)|0)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>2]<<2)>>2]=+g[s>>2]*+g[y>>2]+ +g[t>>2]*+g[x>>2];c[r>>2]=(c[r>>2]|0)+1}l=i;return}function Ta(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;m=e;c[f>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[i>>2]|0))break;g[m>>2]=+g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]*.7071067690849304;g[k>>2]=+g[(c[h>>2]|0)+(c[j>>2]<<2)>>2]*.7071067690849304;g[(c[f>>2]|0)+(c[j>>2]<<2)>>2]=+g[m>>2]+ +g[k>>2];g[(c[h>>2]|0)+(c[j>>2]<<2)>>2]=+g[k>>2]-+g[m>>2];c[j>>2]=(c[j>>2]|0)+1}l=e;return}function Ua(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[(c[f>>2]|0)+28>>2];c[k>>2]=c[(c[f>>2]|0)+32>>2];c[j>>2]=(c[i>>2]|0)>>>(c[h>>2]|0);c[i>>2]=(c[i>>2]|0)-(c[j>>2]|0);if(c[g>>2]|0)c[(c[f>>2]|0)+32>>2]=(c[k>>2]|0)+(c[i>>2]|0);c[(c[f>>2]|0)+28>>2]=c[g>>2]|0?c[j>>2]|0:c[i>>2]|0;_a(c[f>>2]|0);l=e;return}function Va(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;d=l;l=l+32|0;e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[(c[e>>2]|0)+28>>2];c[h>>2]=c[(c[e>>2]|0)+32>>2];c[i>>2]=(c[g>>2]|0)>>>(c[f>>2]|0);c[j>>2]=(c[h>>2]|0)>>>0<(c[i>>2]|0)>>>0&1;if(!(c[j>>2]|0))c[(c[e>>2]|0)+32>>2]=(c[h>>2]|0)-(c[i>>2]|0);if(c[j>>2]|0){k=c[i>>2]|0;m=c[e>>2]|0;n=m+28|0;c[n>>2]=k;o=c[e>>2]|0;Ya(o);p=c[j>>2]|0;l=d;return p|0}else{k=(c[g>>2]|0)-(c[i>>2]|0)|0;m=c[e>>2]|0;n=m+28|0;c[n>>2]=k;o=c[e>>2]|0;Ya(o);p=c[j>>2]|0;l=d;return p|0}return 0}function Wa(a){a=a|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;e=d+6|0;f=d;g=d+4|0;b[e>>1]=a;c[f>>2]=4096+(R(b[e>>1]|0,b[e>>1]|0)|0)>>13;b[g>>1]=c[f>>2];b[g>>1]=32767-(b[g>>1]|0)+(16384+(R(b[g>>1]|0,((16384+(R(b[g>>1]|0,(8277+(16384+(R(-626,b[g>>1]|0)|0)>>15)&65535)<<16>>16)|0)>>15)+-7651&65535)<<16>>16)|0)>>15);l=d;return 1+(b[g>>1]|0)&65535|0}function Xa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=32-(U(c[f>>2]|0)|0);c[h>>2]=32-(U(c[e>>2]|0)|0);c[f>>2]=c[f>>2]<<15-(c[g>>2]|0);c[e>>2]=c[e>>2]<<15-(c[h>>2]|0);b=((c[h>>2]|0)-(c[g>>2]|0)<<11)+(16384+(R((c[e>>2]&65535)<<16>>16,((16384+(R((c[e>>2]&65535)<<16>>16,-2597)|0)>>15)+7932&65535)<<16>>16)|0)>>15)|0;e=b-(16384+(R((c[f>>2]&65535)<<16>>16,((16384+(R((c[f>>2]&65535)<<16>>16,-2597)|0)>>15)+7932&65535)<<16>>16)|0)>>15)|0;l=d;return e|0}function Ya(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;while(1){if((c[(c[d>>2]|0)+28>>2]|0)>>>0>8388608)break;a=(c[d>>2]|0)+20|0;c[a>>2]=(c[a>>2]|0)+8;a=(c[d>>2]|0)+28|0;c[a>>2]=c[a>>2]<<8;c[e>>2]=c[(c[d>>2]|0)+40>>2];a=Za(c[d>>2]|0)|0;c[(c[d>>2]|0)+40>>2]=a;c[e>>2]=(c[e>>2]<<8|c[(c[d>>2]|0)+40>>2])>>1;c[(c[d>>2]|0)+32>>2]=(c[(c[d>>2]|0)+32>>2]<<8)+(255&~c[e>>2])&2147483647}l=b;return}function Za(a){a=a|0;var b=0,e=0,f=0,g=0;b=l;l=l+16|0;e=b;c[e>>2]=a;if((c[(c[e>>2]|0)+24>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){f=0;l=b;return f|0}a=c[c[e>>2]>>2]|0;g=(c[e>>2]|0)+24|0;e=c[g>>2]|0;c[g>>2]=e+1;f=d[a+e>>0]|0;l=b;return f|0}function _a(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;while(1){if((c[(c[d>>2]|0)+28>>2]|0)>>>0>8388608)break;$a(c[d>>2]|0,(c[(c[d>>2]|0)+32>>2]|0)>>>23);c[(c[d>>2]|0)+32>>2]=c[(c[d>>2]|0)+32>>2]<<8&2147483647;a=(c[d>>2]|0)+28|0;c[a>>2]=c[a>>2]<<8;a=(c[d>>2]|0)+20|0;c[a>>2]=(c[a>>2]|0)+8}l=b;return}function $a(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;if((c[f>>2]|0)==255){b=(c[e>>2]|0)+36|0;c[b>>2]=(c[b>>2]|0)+1;l=d;return}c[g>>2]=c[f>>2]>>8;if((c[(c[e>>2]|0)+40>>2]|0)>=0){b=ab(c[e>>2]|0,(c[(c[e>>2]|0)+40>>2]|0)+(c[g>>2]|0)|0)|0;a=(c[e>>2]|0)+44|0;c[a>>2]=c[a>>2]|b}if((c[(c[e>>2]|0)+36>>2]|0)>>>0>0){c[h>>2]=255+(c[g>>2]|0)&255;do{g=ab(c[e>>2]|0,c[h>>2]|0)|0;b=(c[e>>2]|0)+44|0;c[b>>2]=c[b>>2]|g;g=(c[e>>2]|0)+36|0;b=(c[g>>2]|0)+-1|0;c[g>>2]=b}while(b>>>0>0)}c[(c[e>>2]|0)+40>>2]=c[f>>2]&255;l=d;return}function ab(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[g>>2]=b;c[h>>2]=d;if(((c[(c[g>>2]|0)+24>>2]|0)+(c[(c[g>>2]|0)+8>>2]|0)|0)>>>0>=(c[(c[g>>2]|0)+4>>2]|0)>>>0){c[f>>2]=-1;i=c[f>>2]|0;l=e;return i|0}else{d=c[h>>2]&255;h=c[c[g>>2]>>2]|0;b=(c[g>>2]|0)+24|0;g=c[b>>2]|0;c[b>>2]=g+1;a[h+g>>0]=d;c[f>>2]=0;i=c[f>>2]|0;l=e;return i|0}return 0}function bb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0}function cb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0}function db(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=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>2]|0)|0)|0;k=+rb(e,d,b,c[g>>2]|0);l=f;return +k}function mb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=+e;f=+f;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;h=l;l=l+32|0;i=h+28|0;j=h+24|0;k=h+20|0;m=h+16|0;n=h+12|0;o=h+8|0;p=h+4|0;q=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;g[m>>2]=e;g[n>>2]=f;g[p>>2]=+g[m>>2];f=1.0/+F(+(+g[p>>2]));g[q>>2]=f*+g[n>>2];c[o>>2]=0;do{g[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=+g[q>>2]*+(c[(c[i>>2]|0)+(c[o>>2]<<2)>>2]|0);n=(c[o>>2]|0)+1|0;c[o>>2]=n}while((n|0)<(c[k>>2]|0));l=h;return}function nb(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;i=l;l=l+64|0;j=i+48|0;k=i+44|0;m=i+40|0;n=i+36|0;o=i+32|0;p=i+28|0;q=i+24|0;r=i+20|0;s=i+16|0;t=i+12|0;u=i+8|0;v=i+4|0;w=i;c[j>>2]=a;c[k>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;c[v>>2]=0;if((c[p>>2]|0)==0?1:(c[o>>2]<<1|0)>=(c[k>>2]|0)){l=i;return}c[w>>2]=c[332+((c[p>>2]|0)-1<<2)>>2];g[t>>2]=+(c[k>>2]|0)*1.0/+((c[k>>2]|0)+(R(c[w>>2]|0,c[o>>2]|0)|0)|0);g[u>>2]=+g[t>>2]*+g[t>>2]*.5;g[r>>2]=+H(+(+g[u>>2]*1.5707963705062866));g[s>>2]=+H(+((1.0-+g[u>>2])*1.5707963705062866));a:do if((c[k>>2]|0)>=(c[n>>2]<<3|0)){c[v>>2]=1;while(1){u=R(c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)+b;if((c[(c[f>>2]|0)+(c[h>>2]<<2)>>2]|0)<0){if(((c[e>>2]|0)-(c[h>>2]|0)|0)<((c[i>>2]|0)+1|0))m=(c[e>>2]|0)-(c[h>>2]|0)|0;else m=(c[i>>2]|0)+1|0;if(((c[e>>2]|0)-(c[h>>2]|0)|0)>((c[i>>2]|0)+1|0))n=(c[e>>2]|0)-(c[h>>2]|0)|0;else n=(c[i>>2]|0)+1|0;c[g>>2]=(c[g>>2]|0)+(c[(c[344+(m<<2)>>2]|0)+(n<<2)>>2]|0)}}while((c[h>>2]|0)>0);l=d;return c[g>>2]|0}function ub(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;a=c[d>>2]|0;a:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{f=7;break a}}c[e>>2]=6;break}else{switch(a|0){case 12e3:break;default:{f=7;break a}}c[e>>2]=4;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{f=7;break a}}c[e>>2]=3;break}if((a|0)<48e3){switch(a|0){case 24e3:break;default:{f=7;break a}}c[e>>2]=2;break}else{switch(a|0){case 48e3:break;default:{f=7;break a}}c[e>>2]=1;break}}while(0);if((f|0)==7)c[e>>2]=0;l=b;return c[e>>2]|0}function vb(a,b,d,e,f,h,i,j,k,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=+h;i=+i;j=j|0;k=k|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;o=l;l=l+96|0;p=o+92|0;q=o+88|0;r=o+84|0;s=o+80|0;t=o+76|0;u=o+72|0;v=o+68|0;w=o+64|0;x=o+60|0;y=o+56|0;z=o+52|0;A=o+48|0;B=o+44|0;C=o+40|0;D=o+36|0;E=o+32|0;F=o+28|0;G=o+24|0;H=o+20|0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>>2]|0)|0)>>2;c[(c[j>>2]|0)+(c[n>>2]<<2)>>2]=g;c[n>>2]=(c[n>>2]|0)+1}l=h;return}function yb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;a:while(1){if((c[j>>2]|0)>=1){m=12;break}c[k>>2]=0;while(1){if((c[k>>2]|0)>=4)break;if((c[g>>2]|0)==(c[c[5560+(c[j>>2]<<2)>>2]>>2]|0)?(c[h>>2]<>2]|0)==(R(c[(c[5560+(c[j>>2]<<2)>>2]|0)+44>>2]|0,c[(c[5560+(c[j>>2]<<2)>>2]|0)+40>>2]|0)|0):0){m=7;break a}c[k>>2]=(c[k>>2]|0)+1}c[j>>2]=(c[j>>2]|0)+1}if((m|0)==7){if(c[i>>2]|0)c[c[i>>2]>>2]=0;c[f>>2]=c[5560+(c[j>>2]<<2)>>2];n=c[f>>2]|0;l=e;return n|0}else if((m|0)==12){if(c[i>>2]|0)c[c[i>>2]>>2]=-1;c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}return 0}function zb(a,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;var x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,ea=0,fa=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0;x=l;l=l+160|0;y=x+144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]|0)+(c[ea>>2]<<2)>>2]=(c[(c[U>>2]|0)+(c[ea>>2]<<2)>>2]|0)<1&1;c[ea>>2]=(c[ea>>2]|0)+1}l=C;return c[ha>>2]|0}function Bb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0}function Cb(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(U(c[(c[d>>2]|0)+28>>2]|0)|0))|0;l=b;return a|0}function Db(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=32736-(c[e>>2]|0);e=(R(c[g>>2]|0,16384-(c[f>>2]|0)|0)|0)>>>15;l=d;return e|0}function Eb(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;e=l;l=l+64|0;f=e+60|0;g=e+56|0;h=e+52|0;i=e+48|0;j=e+44|0;k=e+40|0;m=e+8|0;n=e+4|0;o=e;c[f>>2]=a;c[g>>2]=d;if((c[(c[f>>2]|0)+8>>2]|0)>0)p=c[(c[f>>2]|0)+8>>2]|0;else p=0;c[o>>2]=p;c[m>>2]=1;c[k>>2]=0;do{c[j>>2]=b[(c[f>>2]|0)+12+(c[k>>2]<<1<<1)>>1];c[i>>2]=b[(c[f>>2]|0)+12+((c[k>>2]<<1)+1<<1)>>1];p=R(c[m+(c[k>>2]<<2)>>2]|0,c[j>>2]|0)|0;c[m+((c[k>>2]|0)+1<<2)>>2]=p;c[k>>2]=(c[k>>2]|0)+1}while((c[i>>2]|0)!=1);c[i>>2]=b[(c[f>>2]|0)+12+((c[k>>2]<<1)-1<<1)>>1];c[n>>2]=(c[k>>2]|0)-1;while(1){if((c[n>>2]|0)<0)break;if(c[n>>2]|0)c[h>>2]=b[(c[f>>2]|0)+12+((c[n>>2]<<1)-1<<1)>>1];else c[h>>2]=1;switch(b[(c[f>>2]|0)+12+(c[n>>2]<<1<<1)>>1]|0){case 2:{Fb(c[g>>2]|0,c[i>>2]|0,c[m+(c[n>>2]<<2)>>2]|0);break}case 4:{Gb(c[g>>2]|0,c[m+(c[n>>2]<<2)>>2]<>2],c[f>>2]|0,c[i>>2]|0,c[m+(c[n>>2]<<2)>>2]|0,c[h>>2]|0);break}case 3:{Hb(c[g>>2]|0,c[m+(c[n>>2]<<2)>>2]<>2],c[f>>2]|0,c[i>>2]|0,c[m+(c[n>>2]<<2)>>2]|0,c[h>>2]|0);break}case 5:{Ib(c[g>>2]|0,c[m+(c[n>>2]<<2)>>2]<>2],c[f>>2]|0,c[i>>2]|0,c[m+(c[n>>2]<<2)>>2]|0,c[h>>2]|0);break}default:{}}c[i>>2]=c[h>>2];c[n>>2]=(c[n>>2]|0)+-1}l=e;return}function Fb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+28|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;m=e;c[f>>2]=a;c[e+24>>2]=b;c[h>>2]=d;g[k>>2]=.7071067690849304;c[j>>2]=0;while(1){if((c[j>>2]|0)>=(c[h>>2]|0))break;c[i>>2]=(c[f>>2]|0)+32;d=c[i>>2]|0;c[m>>2]=c[d>>2];c[m+4>>2]=c[d+4>>2];g[c[i>>2]>>2]=+g[c[f>>2]>>2]-+g[m>>2];g[(c[i>>2]|0)+4>>2]=+g[(c[f>>2]|0)+4>>2]-+g[m+4>>2];d=c[f>>2]|0;g[d>>2]=+g[d>>2]+ +g[m>>2];d=(c[f>>2]|0)+4|0;g[d>>2]=+g[d>>2]+ +g[m+4>>2];g[m>>2]=(+g[(c[i>>2]|0)+8>>2]+ +g[(c[i>>2]|0)+8+4>>2])*+g[k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c[i>>2]|0)+4>>2]>>2])*.5}Pb(c[j>>2]|0,p,0,0,4,c[k>>2]>>1,c[n>>2]|0)|0;g[p>>2]=+g[p>>2]*1.000100016593933;c[o>>2]=1;while(1){if((c[o>>2]|0)>4)break;n=p+(c[o>>2]<<2)|0;g[n>>2]=+g[n>>2]-+g[p+(c[o>>2]<<2)>>2]*(+(c[o>>2]|0)*.00800000037997961)*(+(c[o>>2]|0)*.00800000037997961);c[o>>2]=(c[o>>2]|0)+1}Qb(r,p,4);c[o>>2]=0;while(1){if((c[o>>2]|0)>=4)break;g[q>>2]=+g[q>>2]*.8999999761581421;g[r+(c[o>>2]<<2)>>2]=+g[r+(c[o>>2]<<2)>>2]*+g[q>>2];c[o>>2]=(c[o>>2]|0)+1}g[t>>2]=+g[r>>2]+.800000011920929;g[t+4>>2]=+g[r+4>>2]+ +g[u>>2]*+g[r>>2];g[t+8>>2]=+g[r+8>>2]+ +g[u>>2]*+g[r+4>>2];g[t+12>>2]=+g[r+12>>2]+ +g[u>>2]*+g[r+8>>2];g[t+16>>2]=+g[u>>2]*+g[r+12>>2];Rb(c[j>>2]|0,t,c[j>>2]|0,c[k>>2]>>1,s);l=h;return}function Kb(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,F=0;i=l;l=l+80|0;j=i+64|0;k=i+60|0;m=i+56|0;n=i+52|0;o=i+48|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+24|0;t=i+20|0;u=i+16|0;v=i+12|0;w=i+8|0;x=i+4|0;y=i;c[j>>2]=a;c[k>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[i+44>>2]=h;c[s>>2]=0;c[s+4>>2]=0;c[r>>2]=(c[m>>2]|0)+(c[n>>2]|0);h=c[m>>2]>>2;c[u>>2]=da()|0;f=l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2]|0;b=yb(48e3,960,0)|0;c[j>>2]=Vb(d,b,c[i>>2]|0)|0;if(c[j>>2]|0){c[f>>2]=c[j>>2];k=c[f>>2]|0;l=e;return k|0}j=ub(c[h>>2]|0)|0;c[(c[g>>2]|0)+16>>2]=j;if(!(c[(c[g>>2]|0)+16>>2]|0)){c[f>>2]=-1;k=c[f>>2]|0;l=e;return k|0}else{c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function Vb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if((c[i>>2]|0)<0|(c[i>>2]|0)>2){c[f>>2]=-1;j=c[f>>2]|0;l=e;return j|0}if(!(c[g>>2]|0)){c[f>>2]=-7;j=c[f>>2]|0;l=e;return j|0}else{d=c[g>>2]|0;He(d|0,0,Tb(c[h>>2]|0,c[i>>2]|0)|0)|0;c[c[g>>2]>>2]=c[h>>2];c[(c[g>>2]|0)+4>>2]=c[(c[h>>2]|0)+4>>2];h=c[i>>2]|0;c[(c[g>>2]|0)+8>>2]=h;c[(c[g>>2]|0)+12>>2]=h;c[(c[g>>2]|0)+16>>2]=1;c[(c[g>>2]|0)+20>>2]=0;c[(c[g>>2]|0)+24>>2]=c[(c[c[g>>2]>>2]|0)+12>>2];c[(c[g>>2]|0)+28>>2]=1;h=Wb()|0;c[(c[g>>2]|0)+32>>2]=h;c[(c[g>>2]|0)+48>>2]=0;Xb(c[g>>2]|0,4028,e)|0;c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}return 0}function Wb(){return 0}function Xb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;e=l;l=l+128|0;f=e+120|0;h=e+116|0;i=e+112|0;j=e+96|0;k=e+88|0;m=e+84|0;n=e+80|0;o=e+76|0;p=e+72|0;q=e+68|0;r=e+64|0;s=e+60|0;t=e+56|0;u=e+52|0;v=e+48|0;w=e+44|0;x=e+40|0;y=e+36|0;z=e+32|0;A=e+28|0;B=e+24|0;C=e+20|0;D=e+16|0;E=e+12|0;F=e+8|0;G=e+4|0;H=e;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;a:do switch(c[i>>2]|0){case 10010:{d=(c[j>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[j>>2]=d+4;c[m>>2]=b;c[k>>2]=c[m>>2];if((c[k>>2]|0)>=0?(c[k>>2]|0)<(c[(c[c[h>>2]>>2]|0)+8>>2]|0):0){c[(c[h>>2]|0)+20>>2]=c[k>>2];I=24}else I=25;break}case 10012:{b=(c[j>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[j>>2]=b+4;c[o>>2]=d;c[n>>2]=c[o>>2];if((c[n>>2]|0)>=1?(c[n>>2]|0)<=(c[(c[c[h>>2]>>2]|0)+8>>2]|0):0){c[(c[h>>2]|0)+24>>2]=c[n>>2];I=24}else I=25;break}case 10008:{d=(c[j>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[j>>2]=d+4;c[q>>2]=b;c[p>>2]=c[q>>2];if((c[p>>2]|0)<1|(c[p>>2]|0)>2)I=25;else{c[(c[h>>2]|0)+12>>2]=c[p>>2];I=24}break}case 10007:{b=(c[j>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[j>>2]=b+4;c[s>>2]=d;c[r>>2]=c[s>>2];if(!(c[r>>2]|0))I=25;else{c[c[r>>2]>>2]=c[(c[h>>2]|0)+40>>2];c[(c[h>>2]|0)+40>>2]=0;I=24}break}case 4027:{d=(c[j>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[j>>2]=d+4;c[u>>2]=b;c[t>>2]=c[u>>2];if(!(c[t>>2]|0))I=25;else{c[c[t>>2]>>2]=(c[(c[h>>2]|0)+4>>2]|0)/(c[(c[h>>2]|0)+16>>2]|0)|0;I=24}break}case 4028:{c[w>>2]=(c[h>>2]|0)+84+((R(2048+(c[(c[h>>2]|0)+4>>2]|0)|0,c[(c[h>>2]|0)+8>>2]|0)|0)<<2);c[x>>2]=(c[w>>2]|0)+((c[(c[h>>2]|0)+8>>2]|0)*24<<2);c[y>>2]=(c[x>>2]|0)+(c[(c[c[h>>2]>>2]|0)+8>>2]<<1<<2);c[z>>2]=(c[y>>2]|0)+(c[(c[c[h>>2]>>2]|0)+8>>2]<<1<<2);He((c[h>>2]|0)+36|0,0,(Tb(c[c[h>>2]>>2]|0,c[(c[h>>2]|0)+8>>2]|0)|0)-((c[h>>2]|0)+36-(c[h>>2]|0))|0)|0;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[c[h>>2]>>2]|0)+8>>2]<<1|0)){I=24;break a}g[(c[z>>2]|0)+(c[v>>2]<<2)>>2]=-28.0;g[(c[y>>2]|0)+(c[v>>2]<<2)>>2]=-28.0;c[v>>2]=(c[v>>2]|0)+1}break}case 4033:{b=(c[j>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[j>>2]=b+4;c[B>>2]=d;c[A>>2]=c[B>>2];if(!(c[A>>2]|0))I=25;else{c[c[A>>2]>>2]=c[(c[h>>2]|0)+52>>2];I=24}break}case 10015:{d=(c[j>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[j>>2]=d+4;c[D>>2]=b;c[C>>2]=c[D>>2];if(!(c[C>>2]|0))I=25;else{c[c[C>>2]>>2]=c[c[h>>2]>>2];I=24}break}case 10016:{b=(c[j>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[j>>2]=b+4;c[F>>2]=d;c[E>>2]=c[F>>2];c[(c[h>>2]|0)+28>>2]=c[E>>2];I=24;break}case 4031:{d=(c[j>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[j>>2]=d+4;c[H>>2]=b;c[G>>2]=c[H>>2];if(!(c[G>>2]|0))I=25;else{c[c[G>>2]>>2]=c[(c[h>>2]|0)+36>>2];I=24}break}default:{c[f>>2]=-5;J=c[f>>2]|0;l=e;return J|0}}while(0);if((I|0)==24){c[f>>2]=0;J=c[f>>2]|0;l=e;return J|0}else if((I|0)==25){c[f>>2]=-1;J=c[f>>2]|0;l=e;return J|0}return 0} +function Yb(a,d,e,f,h,i,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,ea=0,fa=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,ta=0,ua=0,va=0,wa=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0.0;k=l;l=l+288|0;m=k+280|0;n=k+276|0;o=k+272|0;p=k+268|0;q=k+264|0;r=k+260|0;s=k+256|0;t=k+252|0;u=k+248|0;v=k+244|0;w=k+240|0;x=k+236|0;y=k+232|0;z=k+184|0;A=k+176|0;B=k+168|0;C=k+164|0;D=k+160|0;E=k+156|0;F=k+152|0;G=k+148|0;H=k+144|0;I=k+140|0;J=k+136|0;K=k+132|0;L=k+128|0;M=k+124|0;N=k+120|0;O=k+116|0;P=k+112|0;Q=k+108|0;S=k+104|0;T=k+100|0;U=k+96|0;V=k+92|0;W=k+88|0;X=k+84|0;Y=k+80|0;Z=k+76|0;_=k+72|0;$=k+68|0;aa=k+64|0;ba=k+60|0;ca=k+56|0;ea=k+52|0;fa=k+48|0;ha=k+44|0;ia=k+40|0;ja=k+36|0;ka=k+32|0;la=k+28|0;ma=k+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[u>>2]<<2)>>2]=C;c[B+(c[u>>2]<<2)>>2]=(c[A+(c[u>>2]<<2)>>2]|0)+8192+(0-(c[w>>2]|0)<<2);C=(c[u>>2]|0)+1|0;c[u>>2]=C}while((C|0)<(c[K>>2]|0));c[P>>2]=c[O>>2];if((c[P>>2]|0)>(c[(c[fa>>2]|0)+12>>2]|0))c[P>>2]=c[(c[fa>>2]|0)+12>>2];if((c[o>>2]|0)==0|(c[p>>2]|0)<=1){Zb(c[n>>2]|0,c[w>>2]|0,c[L>>2]|0);_b(B,c[q>>2]|0,c[w>>2]|0,c[K>>2]|0,c[(c[n>>2]|0)+16>>2]|0,(c[fa>>2]|0)+16|0,(c[n>>2]|0)+76|0,c[t>>2]|0);c[m>>2]=(c[r>>2]|0)/(c[(c[n>>2]|0)+16>>2]|0)|0;ua=c[m>>2]|0;l=k;return ua|0}if(!(c[s>>2]|0)){$b(z,c[o>>2]|0,c[p>>2]|0);c[s>>2]=z}a:do if((c[ea>>2]|0)==1){c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[ha>>2]|0))break a;if(+g[(c[D>>2]|0)+(c[v>>2]<<2)>>2]>+g[(c[D>>2]|0)+((c[ha>>2]|0)+(c[v>>2]|0)<<2)>>2])va=c[v>>2]|0;else va=(c[ha>>2]|0)+(c[v>>2]|0)|0;g[(c[D>>2]|0)+(c[v>>2]<<2)>>2]=+g[(c[D>>2]|0)+(va<<2)>>2];c[v>>2]=(c[v>>2]|0)+1}}while(0);c[X>>2]=c[p>>2]<<3;c[Z>>2]=ac(c[s>>2]|0)|0;do if((c[Z>>2]|0)<(c[X>>2]|0))if((c[Z>>2]|0)==1){c[ca>>2]=Va(c[s>>2]|0,15)|0;break}else{c[ca>>2]=0;break}else c[ca>>2]=1;while(0);if(c[ca>>2]|0){c[Z>>2]=c[p>>2]<<3;va=c[Z>>2]|0;z=va-(ac(c[s>>2]|0)|0)|0;va=(c[s>>2]|0)+20|0;c[va>>2]=(c[va>>2]|0)+z}g[U>>2]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E=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,ea=0,fa=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,ra=0,sa=0,ta=0;f=l;l=l+4608|0;h=f+4604|0;i=f+4600|0;j=f+4596|0;k=f+4592|0;m=f+4588|0;n=f+4584|0;o=f+4576|0;p=f+4568|0;q=f+4560|0;r=f+4556|0;s=f+4552|0;t=f+4548|0;u=f+4544|0;v=f+4540|0;w=f+4536|0;x=f+4532|0;y=f+4528|0;z=f+4524|0;A=f+4520|0;B=f+4516|0;C=f+4512|0;D=f+4508|0;E=f+4504|0;G=f+4500|0;H=f+4496|0;I=f+4492|0;J=f+4488|0;K=f+4484|0;L=f+4480|0;M=f+4476|0;N=f+4472|0;O=f+4468|0;P=f+4464|0;Q=f+368|0;S=f+360|0;T=f+356|0;U=f+352|0;V=f+348|0;W=f+344|0;X=f+340|0;Y=f+336|0;Z=f+332|0;_=f+232|0;$=f+136|0;aa=f+128|0;ba=f+124|0;ca=f+120|0;ea=f+116|0;fa=f+112|0;ha=f+16|0;ia=f+12|0;ja=f+8|0;ka=f+4|0;la=f;c[h>>2]=a;c[i>>2]=d;c[j>>2]=e;c[n>>2]=c[(c[h>>2]|0)+8>>2];c[v>>2]=c[c[h>>2]>>2];c[w>>2]=c[(c[v>>2]|0)+8>>2];c[x>>2]=c[(c[v>>2]|0)+4>>2];c[B>>2]=c[(c[v>>2]|0)+32>>2];c[k>>2]=0;do{e=(c[h>>2]|0)+84+((R(c[k>>2]|0,2048+(c[x>>2]|0)|0)|0)<<2)|0;c[o+(c[k>>2]<<2)>>2]=e;c[p+(c[k>>2]<<2)>>2]=(c[o+(c[k>>2]<<2)>>2]|0)+8192+(0-(c[i>>2]|0)<<2);e=(c[k>>2]|0)+1|0;c[k>>2]=e}while((e|0)<(c[n>>2]|0));c[q>>2]=(c[h>>2]|0)+84+((R(2048+(c[x>>2]|0)|0,c[n>>2]|0)|0)<<2);c[r>>2]=(c[q>>2]|0)+((c[n>>2]|0)*24<<2);c[s>>2]=(c[r>>2]|0)+(c[w>>2]<<1<<2);c[t>>2]=(c[s>>2]|0)+(c[w>>2]<<1<<2);c[u>>2]=(c[t>>2]|0)+(c[w>>2]<<1<<2);c[z>>2]=c[(c[h>>2]|0)+48>>2];c[y>>2]=c[(c[h>>2]|0)+20>>2];c[A>>2]=((c[z>>2]|0)>=5?1:(c[y>>2]|0)!=0)&1;if(c[A>>2]|0){c[E>>2]=c[(c[h>>2]|0)+24>>2];if((c[E>>2]|0)<(c[(c[v>>2]|0)+12>>2]|0))ma=c[E>>2]|0;else ma=c[(c[v>>2]|0)+12>>2]|0;do if((c[y>>2]|0)<=(ma|0))if((c[E>>2]|0)<(c[(c[v>>2]|0)+12>>2]|0)){na=c[E>>2]|0;break}else{na=c[(c[v>>2]|0)+12>>2]|0;break}else na=c[y>>2]|0;while(0);c[G>>2]=na;na=R(c[n>>2]|0,c[i>>2]|0)|0;c[H>>2]=da()|0;ma=l;l=l+((1*(na<<2)|0)+15&-16)|0;if((c[z>>2]|0)>=5)c[D>>2]=c[u>>2];else{g[I>>2]=(c[z>>2]|0)==0?1.5:.5;c[k>>2]=0;do{c[m>>2]=c[y>>2];while(1){if((c[m>>2]|0)>=(c[E>>2]|0))break;u=R(c[k>>2]|0,c[w>>2]|0)|0;na=(c[r>>2]|0)+(u+(c[m>>2]|0)<<2)|0;g[na>>2]=+g[na>>2]-+g[I>>2];c[m>>2]=(c[m>>2]|0)+1}na=(c[k>>2]|0)+1|0;c[k>>2]=na}while((na|0)<(c[n>>2]|0));c[D>>2]=c[r>>2]}c[C>>2]=c[(c[h>>2]|0)+36>>2];c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[n>>2]|0))break;c[m>>2]=c[y>>2];while(1){if((c[m>>2]|0)>=(c[G>>2]|0))break;r=R(c[i>>2]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}while((v|0)<(c[n>>2]|0));ga(c[P>>2]|0);oa=c[z>>2]|0;pa=oa+1|0;ra=c[h>>2]|0;sa=ra+48|0;c[sa>>2]=pa;l=f;return}function _b(a,b,d,e,f,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0;k=l;l=l+80|0;m=k+72|0;n=k+68|0;o=k+64|0;p=k+60|0;q=k+56|0;r=k+52|0;s=k+48|0;t=k+40|0;u=k+36|0;v=k+32|0;w=k+28|0;x=k+24|0;y=k+20|0;z=k+16|0;A=k+12|0;B=k+8|0;C=k+4|0;D=k;c[m>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=h;c[s>>2]=i;c[k+44>>2]=j;c[v>>2]=0;j=c[o>>2]|0;c[x>>2]=da()|0;i=l;l=l+((1*(j<<2)|0)+15&-16)|0;g[w>>2]=+g[c[r>>2]>>2];c[u>>2]=(c[o>>2]|0)/(c[q>>2]|0)|0;c[t>>2]=0;do{g[B>>2]=+g[(c[s>>2]|0)+(c[t>>2]<<2)>>2];c[z>>2]=c[(c[m>>2]|0)+(c[t>>2]<<2)>>2];c[A>>2]=(c[n>>2]|0)+(c[t>>2]<<2);r=(c[q>>2]|0)>1;c[y>>2]=0;a:do if(r){while(1){if((c[y>>2]|0)>=(c[o>>2]|0))break;g[C>>2]=+g[(c[z>>2]|0)+(c[y>>2]<<2)>>2]+ +g[B>>2]+1.0000000031710769e-30;g[B>>2]=+g[w>>2]*+g[C>>2];g[i+(c[y>>2]<<2)>>2]=+g[C>>2];c[y>>2]=(c[y>>2]|0)+1}c[v>>2]=1}else while(1){if((c[y>>2]|0)>=(c[o>>2]|0))break a;g[D>>2]=+g[(c[z>>2]|0)+(c[y>>2]<<2)>>2]+ +g[B>>2]+1.0000000031710769e-30;g[B>>2]=+g[w>>2]*+g[D>>2];g[(c[A>>2]|0)+((R(c[y>>2]|0,c[p>>2]|0)|0)<<2)>>2]=+g[D>>2]*.000030517578125;c[y>>2]=(c[y>>2]|0)+1}while(0);g[(c[s>>2]|0)+(c[t>>2]<<2)>>2]=+g[B>>2];b:do if(c[v>>2]|0){c[y>>2]=0;while(1){if((c[y>>2]|0)>=(c[u>>2]|0))break b;E=+g[i+((R(c[y>>2]|0,c[q>>2]|0)|0)<<2)>>2]*.000030517578125;g[(c[A>>2]|0)+((R(c[y>>2]|0,c[p>>2]|0)|0)<<2)>>2]=E;c[y>>2]=(c[y>>2]|0)+1}}while(0);r=(c[t>>2]|0)+1|0;c[t>>2]=r}while((r|0)<(c[p>>2]|0));ga(c[x>>2]|0);l=k;return}function $b(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=c[g>>2];c[(c[f>>2]|0)+4>>2]=c[h>>2];c[(c[f>>2]|0)+8>>2]=0;c[(c[f>>2]|0)+12>>2]=0;c[(c[f>>2]|0)+16>>2]=0;c[(c[f>>2]|0)+20>>2]=9;c[(c[f>>2]|0)+24>>2]=0;c[(c[f>>2]|0)+28>>2]=128;h=Za(c[f>>2]|0)|0;c[(c[f>>2]|0)+40>>2]=h;c[(c[f>>2]|0)+32>>2]=(c[(c[f>>2]|0)+28>>2]|0)-1-(c[(c[f>>2]|0)+40>>2]>>1);c[(c[f>>2]|0)+44>>2]=0;Ya(c[f>>2]|0);l=e;return}function ac(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(U(c[(c[d>>2]|0)+28>>2]|0)|0))|0;l=b;return a|0}function bc(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0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)>>2])*.5;c[D>>2]=(c[D>>2]|0)+1}c[F>>2]=0;while(1){if((c[F>>2]|0)>=(c[G>>2]|0))break;D=(c[c[s>>2]>>2]|0)+((R(c[I>>2]|0,c[F>>2]|0)|0)<<2)|0;ic((c[q>>2]|0)+64|0,n+(c[F>>2]<<2)|0,D,c[(c[q>>2]|0)+60>>2]|0,c[L>>2]|0,c[J>>2]|0,c[G>>2]|0);c[F>>2]=(c[F>>2]|0)+1}P=c[M>>2]|0;ga(P|0);l=p;return}function hc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;l=b;return c[(c[d>>2]|0)+44>>2]|0}function ic(a,d,e,f,h,i,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0.0;k=l;l=l+144|0;m=k+136|0;n=k+132|0;o=k+128|0;p=k+124|0;q=k+120|0;r=k+116|0;s=k+112|0;t=k+108|0;u=k+104|0;v=k+100|0;w=k+96|0;x=k+92|0;y=k+88|0;z=k+84|0;A=k+80|0;B=k+76|0;C=k+72|0;D=k+68|0;E=k+64|0;F=k+60|0;G=k+56|0;H=k+52|0;I=k+48|0;J=k+44|0;K=k+40|0;L=k+36|0;M=k+32|0;N=k+28|0;O=k+24|0;P=k+20|0;Q=k+16|0;S=k+12|0;T=k+8|0;U=k+4|0;V=k;c[m>>2]=a;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=h;c[r>>2]=i;c[s>>2]=j;c[u>>2]=c[c[m>>2]>>2];c[x>>2]=c[(c[m>>2]|0)+24>>2];c[t>>2]=0;while(1){W=c[u>>2]>>1;if((c[t>>2]|0)>=(c[r>>2]|0))break;c[u>>2]=W;c[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}l=k;return}function jc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;e=l;l=l+32|0;f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;m=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;c[k>>2]=kc(c[f>>2]|0,15)|0;c[j>>2]=0;do if((c[k>>2]|0)>>>0>=(c[g>>2]|0)>>>0){c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=c[g>>2];c[g>>2]=(Db(c[g>>2]|0,c[h>>2]|0)|0)+1;while(1){if((c[g>>2]|0)>>>0>1)n=(c[k>>2]|0)>>>0>=((c[j>>2]|0)+(c[g>>2]<<1)|0)>>>0;else n=0;o=c[g>>2]|0;if(!n)break;c[g>>2]=o<<1;c[j>>2]=(c[j>>2]|0)+(c[g>>2]|0);c[g>>2]=(R((c[g>>2]|0)-2|0,c[h>>2]|0)|0)>>>15;c[g>>2]=(c[g>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+1}if(o>>>0<=1){c[m>>2]=((c[k>>2]|0)-(c[j>>2]|0)|0)>>>1;c[i>>2]=(c[i>>2]|0)+(c[m>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[m>>2]<<1)}if((c[k>>2]|0)>>>0<((c[j>>2]|0)+(c[g>>2]|0)|0)>>>0){c[i>>2]=0-(c[i>>2]|0);break}else{c[j>>2]=(c[j>>2]|0)+(c[g>>2]|0);break}}while(0);k=c[f>>2]|0;f=c[j>>2]|0;if(((c[j>>2]|0)+(c[g>>2]|0)|0)>>>0>=32768){p=32768;Oa(k,f,p,32768);q=c[i>>2]|0;l=e;return q|0}p=(c[j>>2]|0)+(c[g>>2]|0)|0;Oa(k,f,p,32768);q=c[i>>2]|0;l=e;return q|0}function kc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[(c[e>>2]|0)+36>>2]=(c[(c[e>>2]|0)+28>>2]|0)>>>(c[f>>2]|0);c[g>>2]=((c[(c[e>>2]|0)+32>>2]|0)>>>0)/((c[(c[e>>2]|0)+36>>2]|0)>>>0)|0;l=d;return (1<>2])-((c[g>>2]|0)+1+((1<>2])-((c[g>>2]|0)+1)&0-(1<>2]>>>0<((c[g>>2]|0)+1|0)>>>0&1)))|0}function lc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+4112|0;f=e+4108|0;g=e+4104|0;h=e+4100|0;i=e+4096|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;Jb(c[f>>2]|0,j,2048,c[g>>2]|0,c[h>>2]|0);Kb(j+1440|0,j,1328,620,i,c[h>>2]|0);c[i>>2]=720-(c[i>>2]|0);l=e;return c[i>>2]|0}function mc(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;i=l;l=l+64|0;j=i+56|0;k=i+52|0;m=i+48|0;n=i+44|0;o=i+40|0;p=i+36|0;q=i+32|0;r=i+28|0;s=i+24|0;t=i+8|0;u=i;c[j>>2]=a;c[k>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;h=c[o>>2]|0;c[s>>2]=da()|0;f=l;l=l+((1*(h<<2)|0)+15&-16)|0;h=l;l=l+((1*((c[n>>2]|0)+(c[o>>2]|0)<<2)|0)+15&-16)|0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[o>>2]|0))break;g[f+(c[q>>2]<<2)>>2]=+g[(c[k>>2]|0)+((c[o>>2]|0)-(c[q>>2]|0)-1<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[o>>2]|0))break;g[h+(c[q>>2]<<2)>>2]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;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[g>>2]=32767/((c[(c[e>>2]|0)+2340>>2]|0)+1|0)|0;c[h>>2]=0;c[f>>2]=0;while(1){if((c[f>>2]|0)>=(c[(c[e>>2]|0)+2340>>2]|0))break;c[h>>2]=(c[h>>2]|0)+(c[g>>2]|0);b[(c[e>>2]|0)+2772+1280+(c[f>>2]<<1)>>1]=c[h>>2];c[f>>2]=(c[f>>2]|0)+1}c[(c[e>>2]|0)+2772+1376>>2]=0;c[(c[e>>2]|0)+2772+1380>>2]=3176576;l=d;return}function qc(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=l;l=l+80|0;h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;m=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+40|0;r=g+4|0;s=g;c[h>>2]=a;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[r>>2]=(c[h>>2]|0)+2772;if((c[(c[h>>2]|0)+2316>>2]|0)!=(c[(c[r>>2]|0)+1384>>2]|0)){pc(c[h>>2]|0);c[(c[r>>2]|0)+1384>>2]=c[(c[h>>2]|0)+2316>>2]}a:do if((c[(c[h>>2]|0)+4160>>2]|0)==0?(c[(c[h>>2]|0)+4164>>2]|0)==0:0){c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[(c[h>>2]|0)+2340>>2]|0))break;f=(c[r>>2]|0)+1280+(c[m>>2]<<1)|0;b[f>>1]=(b[f>>1]|0)+((((b[(c[h>>2]|0)+2344+(c[m>>2]<<1)>>1]|0)-(b[(c[r>>2]|0)+1280+(c[m>>2]<<1)>>1]|0)>>16)*16348|0)+(((b[(c[h>>2]|0)+2344+(c[m>>2]<<1)>>1]|0)-(b[(c[r>>2]|0)+1280+(c[m>>2]<<1)>>1]|0)&65535)*16348>>16));c[m>>2]=(c[m>>2]|0)+1}c[p>>2]=0;c[n>>2]=0;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[(c[h>>2]|0)+2324>>2]|0))break;if((c[(c[i>>2]|0)+16+(c[m>>2]<<2)>>2]|0)>(c[p>>2]|0)){c[p>>2]=c[(c[i>>2]|0)+16+(c[m>>2]<<2)>>2];c[n>>2]=c[m>>2]}c[m>>2]=(c[m>>2]|0)+1}Le((c[r>>2]|0)+(c[(c[h>>2]|0)+2332>>2]<<2)|0,c[r>>2]|0,(R((c[(c[h>>2]|0)+2324>>2]|0)-1|0,c[(c[h>>2]|0)+2332>>2]|0)|0)<<2|0)|0;f=(c[h>>2]|0)+4+((R(c[n>>2]|0,c[(c[h>>2]|0)+2332>>2]|0)|0)<<2)|0;Ie(c[r>>2]|0,f|0,c[(c[h>>2]|0)+2332>>2]<<2|0)|0;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[(c[h>>2]|0)+2324>>2]|0))break a;f=(c[r>>2]|0)+1376|0;c[f>>2]=(c[f>>2]|0)+((((c[(c[i>>2]|0)+16+(c[m>>2]<<2)>>2]|0)-(c[(c[r>>2]|0)+1376>>2]|0)>>16)*4634|0)+(((c[(c[i>>2]|0)+16+(c[m>>2]<<2)>>2]|0)-(c[(c[r>>2]|0)+1376>>2]|0)&65535)*4634>>16));c[m>>2]=(c[m>>2]|0)+1}}while(0);if(!(c[(c[h>>2]|0)+4160>>2]|0)){He((c[r>>2]|0)+1312|0,0,c[(c[h>>2]|0)+2340>>2]<<2|0)|0;l=g;return}i=(c[k>>2]|0)+16|0;c[s>>2]=da()|0;n=l;l=l+((1*(i<<2)|0)+15&-16)|0;rc(n+64|0,c[r>>2]|0,c[(c[r>>2]|0)+1376>>2]|0,c[k>>2]|0,(c[r>>2]|0)+1380|0);sc(q,(c[r>>2]|0)+1280|0,c[(c[h>>2]|0)+2340>>2]|0);i=n;p=(c[r>>2]|0)+1312|0;f=i+64|0;do{c[i>>2]=c[p>>2];i=i+4|0;p=p+4|0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0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-8<<2)>>2]&65535,b[q+14>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-9<<2)>>2]>>16,b[q+16>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-9<<2)>>2]&65535,b[q+16>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-10<<2)>>2]>>16,b[q+18>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-10<<2)>>2]&65535,b[q+18>>1]|0)|0)>>16));if((c[(c[h>>2]|0)+2340>>2]|0)==16){e=R(c[n+(16+(c[m>>2]|0)-11<<2)>>2]>>16,b[q+20>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-11<<2)>>2]&65535,b[q+20>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-12<<2)>>2]>>16,b[q+22>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-12<<2)>>2]&65535,b[q+22>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-13<<2)>>2]>>16,b[q+24>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-13<<2)>>2]&65535,b[q+24>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-14<<2)>>2]>>16,b[q+26>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-14<<2)>>2]&65535,b[q+26>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-15<<2)>>2]>>16,b[q+28>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-15<<2)>>2]&65535,b[q+28>>1]|0)|0)>>16));e=R(c[n+(16+(c[m>>2]|0)-16<<2)>>2]>>16,b[q+30>>1]|0)|0;c[o>>2]=(c[o>>2]|0)+(e+((R(c[n+(16+(c[m>>2]|0)-16<<2)>>2]&65535,b[q+30>>1]|0)|0)>>16))}c[n+(16+(c[m>>2]|0)<<2)>>2]=(c[n+(16+(c[m>>2]|0)<<2)>>2]|0)+(c[o>>2]<<4);if(((b[(c[j>>2]|0)+(c[m>>2]<<1)>>1]|0)+((c[o>>2]>>5)+1>>1)|0)<=32767)if(((b[(c[j>>2]|0)+(c[m>>2]<<1)>>1]|0)+((c[o>>2]>>5)+1>>1)|0)<-32768)t=-32768;else t=(b[(c[j>>2]|0)+(c[m>>2]<<1)>>1]|0)+((c[o>>2]>>5)+1>>1)|0;else t=32767;b[(c[j>>2]|0)+(c[m>>2]<<1)>>1]=t;c[m>>2]=(c[m>>2]|0)+1}i=(c[r>>2]|0)+1312|0;p=n+(c[k>>2]<<2)|0;f=i+64|0;do{c[i>>2]=c[p>>2];i=i+4|0;p=p+4|0}while((i|0)<(f|0));ga(c[s>>2]|0);l=g;return}function rc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;m=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;q=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[q>>2]=255;while(1){if((c[q>>2]|0)<=(c[k>>2]|0))break;c[q>>2]=c[q>>2]>>1}c[n>>2]=c[c[m>>2]>>2];c[o>>2]=0;while(1){r=c[n>>2]|0;if((c[o>>2]|0)>=(c[k>>2]|0))break;c[n>>2]=907633515+(R(r,196314165)|0);c[p>>2]=c[n>>2]>>24&c[q>>2];f=R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;e=f+((R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;if((e+(R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0)<=32767){e=R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;f=e+((R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;if((f+(R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0)<-32768)s=-32768;else{f=R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]>>16,(c[j>>2]>>4&65535)<<16>>16)|0;e=f+((R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]&65535,(c[j>>2]>>4&65535)<<16>>16)|0)>>16)|0;s=e+(R(c[(c[i>>2]|0)+(c[p>>2]<<2)>>2]|0,(c[j>>2]>>4>>15)+1>>1)|0)|0}}else s=32767;c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]=(s&65535)<<16>>16;c[o>>2]=(c[o>>2]|0)+1}c[c[m>>2]>>2]=r;l=g;return}function sc(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;g=l;l=l+272|0;h=g+264|0;i=g+260|0;j=g+256|0;k=g+252|0;m=g+248|0;n=g+244|0;o=g+240|0;p=g+176|0;q=g+140|0;r=g+104|0;s=g+100|0;t=g+96|0;u=g+92|0;v=g+88|0;w=g+84|0;x=g+80|0;y=g+16|0;z=g+12|0;A=g+8|0;B=g+4|0;C=g;c[h>>2]=a;c[i>>2]=e;c[j>>2]=f;c[B>>2]=0;c[k>>2]=(c[j>>2]|0)==16?25152:25168;c[m>>2]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(c[z>>2]|0,(c[B>>2]|0)+1|0)|0)>>2|0)|0);uc(y,c[j>>2]|0,c[C>>2]|0);c[n>>2]=(c[n>>2]|0)+1}C=(c[n>>2]|0)==10;c[m>>2]=0;a:do if(C)while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break a;if(((c[y+(c[m>>2]<<2)>>2]>>4)+1>>1|0)<=32767)if(((c[y+(c[m>>2]<<2)>>2]>>4)+1>>1|0)<-32768)D=-32768;else D=(c[y+(c[m>>2]<<2)>>2]>>4)+1>>1;else D=32767;b[(c[h>>2]|0)+(c[m>>2]<<1)>>1]=D;c[y+(c[m>>2]<<2)>>2]=b[(c[h>>2]|0)+(c[m>>2]<<1)>>1]<<5;c[m>>2]=(c[m>>2]|0)+1}else while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break a;b[(c[h>>2]|0)+(c[m>>2]<<1)>>1]=(c[y+(c[m>>2]<<2)>>2]>>4)+1>>1;c[m>>2]=(c[m>>2]|0)+1}while(0);c[n>>2]=0;while(1){if((c[n>>2]|0)>=16){E=31;break}if((vc(c[h>>2]|0,c[j>>2]|0)|0)>=107374){E=31;break}uc(y,c[j>>2]|0,65536-(2<>2])|0);c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break;b[(c[h>>2]|0)+(c[m>>2]<<1)>>1]=(c[y+(c[m>>2]<<2)>>2]>>4)+1>>1;c[m>>2]=(c[m>>2]|0)+1}c[n>>2]=(c[n>>2]|0)+1}if((E|0)==31){l=g;return}}function tc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=65536;c[(c[f>>2]|0)+4>>2]=0-(c[c[g>>2]>>2]|0);c[i>>2]=1;while(1){if((c[i>>2]|0)>=(c[h>>2]|0))break;c[k>>2]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0,(c[(c[f>>2]|0)+(c[i>>2]<<2)>>2]>>15)+1>>1)|0)|0;c[(c[f>>2]|0)+(c[i>>2]<<2)>>2]=d;d=((R(c[h>>2]|0,c[j>>2]|0)|0)>>15)+1>>1;c[h>>2]=(c[h>>2]|0)+d;c[i>>2]=(c[i>>2]|0)+1}i=R(k,(c[m+((c[g>>2]|0)-1<<2)>>2]&65535)<<16>>16)|0;m=i+((R(c[h>>2]&65535,(c[(c[f>>2]|0)+((c[g>>2]|0)-1<<2)>>2]&65535)<<16>>16)|0)>>16)|0;i=m+(R(c[h>>2]|0,(c[(c[f>>2]|0)+((c[g>>2]|0)-1<<2)>>2]>>15)+1>>1)|0)|0;c[(c[f>>2]|0)+((c[g>>2]|0)-1<<2)>>2]=i;l=e;return}function vc(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+160|0;f=e+148|0;g=e+144|0;h=e+140|0;i=e+136|0;j=e+8|0;k=e+4|0;m=e;c[g>>2]=a;c[h>>2]=d;c[m>>2]=0;c[k>>2]=j+((c[h>>2]&1)<<6);c[i>>2]=0;while(1){if((c[i>>2]|0)>=(c[h>>2]|0))break;c[m>>2]=(c[m>>2]|0)+(b[(c[g>>2]|0)+(c[i>>2]<<1)>>1]|0);c[(c[k>>2]|0)+(c[i>>2]<<2)>>2]=b[(c[g>>2]|0)+(c[i>>2]<<1)>>1]<<12;c[i>>2]=(c[i>>2]|0)+1}if((c[m>>2]|0)>=4096){c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}else{c[f>>2]=wc(j,c[h>>2]|0)|0;n=c[f>>2]|0;l=e;return n|0}return 0}function wc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=l;l=l+64|0;e=d+48|0;f=d+44|0;g=d+40|0;h=d+36|0;i=d+32|0;j=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(b){b=Fe(g|0,u|0,1)|0;a=C;v=c[p>>2]|0;w=c[o>>2]|0;x=Ke(v|0,((v|0)<0)<<31>>31|0,w|0,((w|0)<0)<<31>>31|0)|0;w=Ge(b|0,a|0,x&1|0,0)|0;y=C;z=w}else{w=Fe(g|0,u|0,(c[j>>2]|0)-1|0)|0;u=Ge(w|0,C|0,1,0)|0;w=Fe(u|0,C|0,1)|0;y=C;z=w}c[(c[r>>2]|0)+(c[i>>2]<<2)>>2]=z;c[i>>2]=(c[i>>2]|0)+1}c[h>>2]=(c[h>>2]|0)+-1}if((t|0)==5){c[e>>2]=0;A=c[e>>2]|0;l=d;return A|0}if((c[s>>2]|0)<=16773022?(c[c[r>>2]>>2]|0)>=-16773022:0){c[m>>2]=0-(c[c[r>>2]>>2]<<7);r=c[m>>2]|0;s=c[m>>2]|0;m=Ke(r|0,((r|0)<0)<<31>>31|0,s|0,((s|0)<0)<<31>>31|0)|0;s=Fe(m|0,C|0,32)|0;c[n>>2]=1073741824-s;s=c[k>>2]|0;m=c[n>>2]|0;n=Ke(s|0,((s|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0;m=Fe(n|0,C|0,32)|0;c[k>>2]=m<<2;c[e>>2]=c[k>>2];A=c[e>>2]|0;l=d;return A|0}c[e>>2]=0;A=c[e>>2]|0;l=d;return A|0}function xc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b;c[d>>2]=a;if(!(c[d>>2]|0)){e=32;l=b;return e|0}e=32-(32-(U(c[d>>2]|0)|0))|0;l=b;return e|0}function yc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;d=l;l=l+48|0;e=d+32|0;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+12|0;k=d+8|0;m=d+4|0;n=d;c[f>>2]=a;c[g>>2]=b;b=c[f>>2]|0;c[h>>2]=(xc((c[f>>2]|0)>0?b:0-b|0)|0)-1;c[k>>2]=c[f>>2]<>2];c[j>>2]=536870911/(c[k>>2]>>16|0)|0;c[n>>2]=c[j>>2]<<16;f=R(c[k>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;c[m>>2]=536870912-(f+((R(c[k>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))<<3;k=R(c[m>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;f=(c[n>>2]|0)+(k+((R(c[m>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))|0;c[n>>2]=f+(R(c[m>>2]|0,(c[j>>2]>>15)+1>>1)|0);c[i>>2]=61-(c[h>>2]|0)-(c[g>>2]|0);g=c[i>>2]|0;if((c[i>>2]|0)>0)if((g|0)<32){c[e>>2]=c[n>>2]>>c[i>>2];o=c[e>>2]|0;l=d;return o|0}else{c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}h=c[n>>2]|0;j=0-(c[i>>2]|0)|0;do if((-2147483648>>0-g|0)>(2147483647>>0-(c[i>>2]|0)|0)){if((h|0)>(-2147483648>>j|0)){p=-2147483648>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(2147483647>>0-(c[i>>2]|0)|0)){p=2147483647>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}else{if((h|0)>(2147483647>>j|0)){p=2147483647>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(-2147483648>>0-(c[i>>2]|0)|0)){p=-2147483648>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}while(0);c[e>>2]=p<<0-(c[i>>2]|0);o=c[e>>2]|0;l=d;return o|0}function zc(d,e,f,g,h,i){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;j=l;l=l+48|0;k=j+40|0;m=j+36|0;n=j+32|0;o=j+28|0;p=j+24|0;q=j+20|0;r=j+16|0;s=j+12|0;t=j+8|0;u=j+44|0;v=j+4|0;w=j;c[k>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=i;a[u+1>>0]=0;c[v>>2]=c[m>>2];c[r>>2]=(((c[p>>2]|0)+(c[o>>2]<<1)&65535)<<16>>16)*7;c[w>>2]=23696+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+8>>4;c[r>>2]=0;while(1){if((c[r>>2]|0)>=(c[n>>2]|0))break;c[t>>2]=c[(c[q>>2]|0)+(c[r>>2]<<2)>>2];a:do if((c[t>>2]|0)>0){a[u>>0]=a[(c[w>>2]|0)+((c[t>>2]&31|0)<6?c[t>>2]&31:6)>>0]|0;c[s>>2]=0;while(1){if((c[s>>2]|0)>=16)break a;if((b[(c[v>>2]|0)+(c[s>>2]<<1)>>1]|0)>0){o=((bc(c[k>>2]|0,u,8)|0)<<1)-1|0;p=(c[v>>2]|0)+(c[s>>2]<<1)|0;b[p>>1]=R(b[p>>1]|0,o)|0}c[s>>2]=(c[s>>2]|0)+1}}while(0);c[v>>2]=(c[v>>2]|0)+32;c[r>>2]=(c[r>>2]|0)+1}l=j;return}function Ac(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;He(c[d>>2]|0,0,4260)|0;c[(c[d>>2]|0)+2376>>2]=1;c[c[d>>2]>>2]=65536;pc(c[d>>2]|0);Bc(c[d>>2]|0);l=b;return 0}function Bc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;c[(c[d>>2]|0)+4168>>2]=c[(c[d>>2]|0)+2328>>2]<<7;c[(c[d>>2]|0)+4168+72>>2]=65536;c[(c[d>>2]|0)+4168+72+4>>2]=65536;c[(c[d>>2]|0)+4168+88>>2]=20;c[(c[d>>2]|0)+4168+84>>2]=2;l=b;return}function Cc(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;h=l;l=l+144|0;i=h+96|0;j=h+92|0;k=h+88|0;m=h+84|0;n=h+80|0;o=h+76|0;p=h+72|0;q=h+68|0;r=h+64|0;s=h+60|0;t=h+56|0;u=h+52|0;v=h+48|0;w=h+44|0;x=h+104|0;y=h+40|0;z=h+36|0;A=h+32|0;B=h+28|0;C=h+24|0;D=h+20|0;E=h+16|0;F=h+12|0;G=h+8|0;H=h+4|0;I=h;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[m>>2]=g;c[p>>2]=0;g=c[(c[i>>2]|0)+2336>>2]|0;c[I>>2]=da()|0;f=l;l=l+((1*(g<<1)|0)+15&-16)|0;g=l;l=l+((1*((c[(c[i>>2]|0)+2336>>2]|0)+(c[(c[i>>2]|0)+2328>>2]|0)<<2)|0)+15&-16)|0;e=l;l=l+((1*(c[(c[i>>2]|0)+2332>>2]<<2)|0)+15&-16)|0;d=l;l=l+((1*((c[(c[i>>2]|0)+2332>>2]|0)+16<<2)|0)+15&-16)|0;c[E>>2]=b[17776+(a[(c[i>>2]|0)+2736+29>>0]>>1<<2)+(a[(c[i>>2]|0)+2736+30>>0]<<1)>>1];if((a[(c[i>>2]|0)+2736+31>>0]|0)<4)c[s>>2]=1;else c[s>>2]=0;c[D>>2]=a[(c[i>>2]|0)+2736+34>>0];c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[(c[i>>2]|0)+2328>>2]|0))break;c[D>>2]=907633515+(R(c[D>>2]|0,196314165)|0);c[(c[i>>2]|0)+4+(c[n>>2]<<2)>>2]=b[(c[m>>2]|0)+(c[n>>2]<<1)>>1]<<14;J=(c[i>>2]|0)+4+(c[n>>2]<<2)|0;K=c[J>>2]|0;if((c[(c[i>>2]|0)+4+(c[n>>2]<<2)>>2]|0)<=0){if((K|0)<0){L=(c[i>>2]|0)+4+(c[n>>2]<<2)|0;c[L>>2]=(c[L>>2]|0)+1280}}else c[J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2]<<2)>>2]=K;c[n>>2]=(c[n>>2]|0)+1}}else c[C>>2]=65536;while(0);c[c[i>>2]>>2]=c[(c[j>>2]|0)+16+(c[o>>2]<<2)>>2];if((c[(c[i>>2]|0)+4160>>2]|0?(c[(c[i>>2]|0)+4164>>2]|0)==2:0)?((c[o>>2]|0)<2?(a[(c[i>>2]|0)+2736+29>>0]|0)!=2:0):0){K=c[v>>2]|0;b[K>>1]=0;b[K+2>>1]=0;b[K+4>>1]=0;b[K+6>>1]=0;b[K+8>>1]=0;b[(c[v>>2]|0)+4>>1]=4096;c[t>>2]=2;c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=c[(c[i>>2]|0)+2308>>2]}b:do if((c[t>>2]|0)==2){c[p>>2]=c[(c[j>>2]|0)+(c[o>>2]<<2)>>2];if(c[o>>2]|0?!((c[o>>2]|0)==2&(c[s>>2]|0)!=0):0){if((c[C>>2]|0)==65536)break;c[n>>2]=0;while(1){if((c[n>>2]|0)>=((c[p>>2]|0)+2|0))break b;K=R(c[C>>2]>>16,(c[g+((c[r>>2]|0)-(c[n>>2]|0)-1<<2)>>2]&65535)<<16>>16)|0;J=K+((R(c[C>>2]&65535,(c[g+((c[r>>2]|0)-(c[n>>2]|0)-1<<2)>>2]&65535)<<16>>16)|0)>>16)|0;K=J+(R(c[C>>2]|0,(c[g+((c[r>>2]|0)-(c[n>>2]|0)-1<<2)>>2]>>15)+1>>1)|0)|0;c[g+((c[r>>2]|0)-(c[n>>2]|0)-1<<2)>>2]=K;c[n>>2]=(c[n>>2]|0)+1}}c[q>>2]=(c[(c[i>>2]|0)+2336>>2]|0)-(c[p>>2]|0)-(c[(c[i>>2]|0)+2340>>2]|0)-2;if((c[o>>2]|0)==2)Ie((c[i>>2]|0)+1348+(c[(c[i>>2]|0)+2336>>2]<<1)|0,c[k>>2]|0,c[(c[i>>2]|0)+2332>>2]<<1<<1|0)|0;K=(c[i>>2]|0)+1348+((c[q>>2]|0)+(R(c[o>>2]|0,c[(c[i>>2]|0)+2332>>2]|0)|0)<<1)|0;Fc(f+(c[q>>2]<<1)|0,K,c[u>>2]|0,(c[(c[i>>2]|0)+2336>>2]|0)-(c[q>>2]|0)|0,c[(c[i>>2]|0)+2340>>2]|0);if(!(c[o>>2]|0)){K=R(c[B>>2]>>16,(c[(c[j>>2]|0)+136>>2]&65535)<<16>>16)|0;c[B>>2]=K+((R(c[B>>2]&65535,(c[(c[j>>2]|0)+136>>2]&65535)<<16>>16)|0)>>16)<<2}c[n>>2]=0;while(1){if((c[n>>2]|0)>=((c[p>>2]|0)+2|0))break b;K=R(c[B>>2]>>16,b[f+((c[(c[i>>2]|0)+2336>>2]|0)-(c[n>>2]|0)-1<<1)>>1]|0)|0;J=K+((R(c[B>>2]&65535,b[f+((c[(c[i>>2]|0)+2336>>2]|0)-(c[n>>2]|0)-1<<1)>>1]|0)|0)>>16)|0;c[g+((c[r>>2]|0)-(c[n>>2]|0)-1<<2)>>2]=J;c[n>>2]=(c[n>>2]|0)+1}}while(0);c:do if((c[t>>2]|0)==2){c[F>>2]=g+((c[r>>2]|0)-(c[p>>2]|0)+2<<2);c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[(c[i>>2]|0)+2332>>2]|0))break c;c[y>>2]=2;J=R(c[c[F>>2]>>2]>>16,b[c[v>>2]>>1]|0)|0;c[y>>2]=(c[y>>2]|0)+(J+((R(c[c[F>>2]>>2]&65535,b[c[v>>2]>>1]|0)|0)>>16));J=R(c[(c[F>>2]|0)+-4>>2]>>16,b[(c[v>>2]|0)+2>>1]|0)|0;c[y>>2]=(c[y>>2]|0)+(J+((R(c[(c[F>>2]|0)+-4>>2]&65535,b[(c[v>>2]|0)+2>>1]|0)|0)>>16));J=R(c[(c[F>>2]|0)+-8>>2]>>16,b[(c[v>>2]|0)+4>>1]|0)|0;c[y>>2]=(c[y>>2]|0)+(J+((R(c[(c[F>>2]|0)+-8>>2]&65535,b[(c[v>>2]|0)+4>>1]|0)|0)>>16));J=R(c[(c[F>>2]|0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2]|0)-4<<2)>>2]&65535,b[x+6>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-5<<2)>>2]>>16,b[x+8>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-5<<2)>>2]&65535,b[x+8>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-6<<2)>>2]>>16,b[x+10>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-6<<2)>>2]&65535,b[x+10>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-7<<2)>>2]>>16,b[x+12>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-7<<2)>>2]&65535,b[x+12>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-8<<2)>>2]>>16,b[x+14>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-8<<2)>>2]&65535,b[x+14>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-9<<2)>>2]>>16,b[x+16>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-9<<2)>>2]&65535,b[x+16>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-10<<2)>>2]>>16,b[x+18>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-10<<2)>>2]&65535,b[x+18>>1]|0)|0)>>16));if((c[(c[i>>2]|0)+2340>>2]|0)==16){J=R(c[d+(16+(c[n>>2]|0)-11<<2)>>2]>>16,b[x+20>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-11<<2)>>2]&65535,b[x+20>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-12<<2)>>2]>>16,b[x+22>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-12<<2)>>2]&65535,b[x+22>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-13<<2)>>2]>>16,b[x+24>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-13<<2)>>2]&65535,b[x+24>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-14<<2)>>2]>>16,b[x+26>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-14<<2)>>2]&65535,b[x+26>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-15<<2)>>2]>>16,b[x+28>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-15<<2)>>2]&65535,b[x+28>>1]|0)|0)>>16));J=R(c[d+(16+(c[n>>2]|0)-16<<2)>>2]>>16,b[x+30>>1]|0)|0;c[z>>2]=(c[z>>2]|0)+(J+((R(c[d+(16+(c[n>>2]|0)-16<<2)>>2]&65535,b[x+30>>1]|0)|0)>>16))}c[d+(16+(c[n>>2]|0)<<2)>>2]=(c[(c[H>>2]|0)+(c[n>>2]<<2)>>2]|0)+(c[z>>2]<<4);J=R(c[d+(16+(c[n>>2]|0)<<2)>>2]>>16,(c[A>>2]&65535)<<16>>16)|0;K=J+((R(c[d+(16+(c[n>>2]|0)<<2)>>2]&65535,(c[A>>2]&65535)<<16>>16)|0)>>16)|0;if(((K+(R(c[d+(16+(c[n>>2]|0)<<2)>>2]|0,(c[A>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){K=R(c[d+(16+(c[n>>2]|0)<<2)>>2]>>16,(c[A>>2]&65535)<<16>>16)|0;J=K+((R(c[d+(16+(c[n>>2]|0)<<2)>>2]&65535,(c[A>>2]&65535)<<16>>16)|0)>>16)|0;if(((J+(R(c[d+(16+(c[n>>2]|0)<<2)>>2]|0,(c[A>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)M=-32768;else{J=R(c[d+(16+(c[n>>2]|0)<<2)>>2]>>16,(c[A>>2]&65535)<<16>>16)|0;K=J+((R(c[d+(16+(c[n>>2]|0)<<2)>>2]&65535,(c[A>>2]&65535)<<16>>16)|0)>>16)|0;M=(K+(R(c[d+(16+(c[n>>2]|0)<<2)>>2]|0,(c[A>>2]>>15)+1>>1)|0)>>7)+1>>1}}else M=32767;b[(c[w>>2]|0)+(c[n>>2]<<1)>>1]=M;c[n>>2]=(c[n>>2]|0)+1}m=d;D=d+(c[(c[i>>2]|0)+2332>>2]<<2)|0;E=m+64|0;do{c[m>>2]=c[D>>2];m=m+4|0;D=D+4|0}while((m|0)<(E|0));c[G>>2]=(c[G>>2]|0)+(c[(c[i>>2]|0)+2332>>2]<<2);c[w>>2]=(c[w>>2]|0)+(c[(c[i>>2]|0)+2332>>2]<<1);c[o>>2]=(c[o>>2]|0)+1}m=(c[i>>2]|0)+1284|0;D=d;E=m+64|0;do{c[m>>2]=c[D>>2];m=m+4|0;D=D+4|0}while((m|0)<(E|0));ga(c[I>>2]|0);l=h;return}function Dc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;d=l;l=l+48|0;e=d+32|0;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+12|0;k=d+8|0;m=d+4|0;n=d;c[f>>2]=a;c[g>>2]=b;b=c[f>>2]|0;c[h>>2]=(Gc((c[f>>2]|0)>0?b:0-b|0)|0)-1;c[k>>2]=c[f>>2]<>2];c[j>>2]=536870911/(c[k>>2]>>16|0)|0;c[n>>2]=c[j>>2]<<16;f=R(c[k>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;c[m>>2]=536870912-(f+((R(c[k>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))<<3;k=R(c[m>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;f=(c[n>>2]|0)+(k+((R(c[m>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))|0;c[n>>2]=f+(R(c[m>>2]|0,(c[j>>2]>>15)+1>>1)|0);c[i>>2]=61-(c[h>>2]|0)-(c[g>>2]|0);g=c[i>>2]|0;if((c[i>>2]|0)>0)if((g|0)<32){c[e>>2]=c[n>>2]>>c[i>>2];o=c[e>>2]|0;l=d;return o|0}else{c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}h=c[n>>2]|0;j=0-(c[i>>2]|0)|0;do if((-2147483648>>0-g|0)>(2147483647>>0-(c[i>>2]|0)|0)){if((h|0)>(-2147483648>>j|0)){p=-2147483648>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(2147483647>>0-(c[i>>2]|0)|0)){p=2147483647>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}else{if((h|0)>(2147483647>>j|0)){p=2147483647>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(-2147483648>>0-(c[i>>2]|0)|0)){p=-2147483648>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}while(0);c[e>>2]=p<<0-(c[i>>2]|0);o=c[e>>2]|0;l=d;return o|0}function Ec(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+48|0;f=e+40|0;g=e+36|0;h=e+32|0;i=e+28|0;j=e+24|0;k=e+20|0;m=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=c[g>>2]|0;c[j>>2]=(Gc((c[g>>2]|0)>0?d:0-d|0)|0)-1;c[o>>2]=c[g>>2]<>2];g=c[h>>2]|0;c[k>>2]=(Gc((c[h>>2]|0)>0?g:0-g|0)|0)-1;c[p>>2]=c[h>>2]<>2];c[n>>2]=536870911/(c[p>>2]>>16|0)|0;h=R(c[o>>2]>>16,(c[n>>2]&65535)<<16>>16)|0;c[q>>2]=h+((R(c[o>>2]&65535,(c[n>>2]&65535)<<16>>16)|0)>>16);h=c[o>>2]|0;g=c[p>>2]|0;p=c[q>>2]|0;d=Ke(g|0,((g|0)<0)<<31>>31|0,p|0,((p|0)<0)<<31>>31|0)|0;p=Fe(d|0,C|0,32)|0;c[o>>2]=h-(p<<3);p=R(c[o>>2]>>16,(c[n>>2]&65535)<<16>>16)|0;c[q>>2]=(c[q>>2]|0)+(p+((R(c[o>>2]&65535,(c[n>>2]&65535)<<16>>16)|0)>>16));c[m>>2]=29+(c[j>>2]|0)-(c[k>>2]|0)-(c[i>>2]|0);i=c[m>>2]|0;if((c[m>>2]|0)>=0)if((i|0)<32){c[f>>2]=c[q>>2]>>c[m>>2];r=c[f>>2]|0;l=e;return r|0}else{c[f>>2]=0;r=c[f>>2]|0;l=e;return r|0}k=c[q>>2]|0;j=0-(c[m>>2]|0)|0;do if((-2147483648>>0-i|0)>(2147483647>>0-(c[m>>2]|0)|0)){if((k|0)>(-2147483648>>j|0)){s=-2147483648>>0-(c[m>>2]|0);break}if((c[q>>2]|0)<(2147483647>>0-(c[m>>2]|0)|0)){s=2147483647>>0-(c[m>>2]|0);break}else{s=c[q>>2]|0;break}}else{if((k|0)>(2147483647>>j|0)){s=2147483647>>0-(c[m>>2]|0);break}if((c[q>>2]|0)<(-2147483648>>0-(c[m>>2]|0)|0)){s=-2147483648>>0-(c[m>>2]|0);break}else{s=c[q>>2]|0;break}}while(0);c[f>>2]=s<<0-(c[m>>2]|0);r=c[f>>2]|0;l=e;return r|0}function Fc(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;i=h+36|0;j=h+32|0;k=h+28|0;m=h+24|0;n=h+20|0;o=h+16|0;p=h+12|0;q=h+8|0;r=h+4|0;s=h;c[i>>2]=a;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[n>>2]=g;c[p>>2]=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=32;l=b;return e|0}e=32-(32-(U(c[d>>2]|0)|0))|0;l=b;return e|0}function Hc(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;i=l;l=l+192|0;j=i+176|0;k=i+172|0;m=i+168|0;n=i+164|0;o=i+160|0;p=i+156|0;q=i+152|0;r=i+148|0;s=i+144|0;t=i+4|0;u=i;c[j>>2]=b;c[k>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[s>>2]=0;c[q>>2]=c[(c[j>>2]|0)+2328>>2];c[t+136>>2]=0;do if(!(c[o>>2]|0))v=4;else{if((c[o>>2]|0)==2?(c[(c[j>>2]|0)+2420+(c[(c[j>>2]|0)+2388>>2]<<2)>>2]|0)==1:0){v=4;break}Lc(c[j>>2]|0,t,c[m>>2]|0,1)}while(0);if((v|0)==4){v=(c[q>>2]|0)+16-1&-16;c[u>>2]=da()|0;h=l;l=l+((1*(v<<1)|0)+15&-16)|0;Ic(c[j>>2]|0,c[k>>2]|0,c[(c[j>>2]|0)+2388>>2]|0,c[o>>2]|0,c[p>>2]|0);Jc(c[k>>2]|0,h,a[(c[j>>2]|0)+2736+29>>0]|0,a[(c[j>>2]|0)+2736+30>>0]|0,c[(c[j>>2]|0)+2328>>2]|0);Kc(c[j>>2]|0,t,c[p>>2]|0);Cc(c[j>>2]|0,t,c[m>>2]|0,h);Lc(c[j>>2]|0,t,c[m>>2]|0,0);c[(c[j>>2]|0)+4160>>2]=0;c[(c[j>>2]|0)+4164>>2]=a[(c[j>>2]|0)+2736+29>>0];c[(c[j>>2]|0)+2376>>2]=0;ga(c[u>>2]|0)}c[r>>2]=(c[(c[j>>2]|0)+2336>>2]|0)-(c[(c[j>>2]|0)+2328>>2]|0);Le((c[j>>2]|0)+1348|0,(c[j>>2]|0)+1348+(c[(c[j>>2]|0)+2328>>2]<<1)|0,c[r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[j>>2]|0)+2324>>2]|0))break;n=(bc(w,20582,8)|0)&255;a[(c[j>>2]|0)+2736+(c[p>>2]|0)>>0]=n;c[p>>2]=(c[p>>2]|0)+1}n=(bc(w,(c[(c[(c[j>>2]|0)+2732>>2]|0)+12>>2]|0)+(R(a[(c[j>>2]|0)+2736+29>>0]>>1,b[c[(c[j>>2]|0)+2732>>2]>>1]|0)|0)|0,8)|0)&255;a[(c[j>>2]|0)+2736+8>>0]=n;dd(u,v,c[(c[j>>2]|0)+2732>>2]|0,a[(c[j>>2]|0)+2736+8>>0]|0);c[p>>2]=0;while(1){if((c[p>>2]|0)>=(b[(c[(c[j>>2]|0)+2732>>2]|0)+2>>1]|0))break;c[r>>2]=bc(c[k>>2]|0,(c[(c[(c[j>>2]|0)+2732>>2]|0)+24>>2]|0)+(b[u+(c[p>>2]<<1)>>1]|0)|0,8)|0;if(c[r>>2]|0){if((c[r>>2]|0)==8){v=bc(c[k>>2]|0,22753,8)|0;c[r>>2]=(c[r>>2]|0)+v}}else{v=bc(c[k>>2]|0,22753,8)|0;c[r>>2]=(c[r>>2]|0)-v}a[(c[j>>2]|0)+2736+8+((c[p>>2]|0)+1)>>0]=(c[r>>2]|0)-4;c[p>>2]=(c[p>>2]|0)+1}if((c[(c[j>>2]|0)+2324>>2]|0)==4){p=(bc(c[k>>2]|0,22722,8)|0)&255;x=p;y=c[j>>2]|0}else{x=4;y=c[j>>2]|0}a[y+2736+31>>0]=x;if((a[(c[j>>2]|0)+2736+29>>0]|0)!=2){z=c[j>>2]|0;A=z+2736|0;B=A+29|0;C=a[B>>0]|0;D=C<<24>>24;E=c[j>>2]|0;F=E+2396|0;c[F>>2]=D;G=c[k>>2]|0;H=bc(G,22730,8)|0;I=H&255;J=c[j>>2]|0;K=J+2736|0;L=K+34|0;a[L>>0]=I;l=i;return}c[s>>2]=1;if(((c[o>>2]|0)==2?(c[(c[j>>2]|0)+2396>>2]|0)==2:0)?(c[t>>2]=((bc(c[k>>2]|0,22792,8)|0)&65535)<<16>>16,(c[t>>2]|0)>0):0){c[t>>2]=(c[t>>2]|0)-9;b[(c[j>>2]|0)+2736+26>>1]=(b[(c[j>>2]|0)+2400>>1]|0)+(c[t>>2]|0);c[s>>2]=0}if(c[s>>2]|0){s=((bc(c[k>>2]|0,22760,8)|0)&65535)<<16>>16;t=(R(s,c[(c[j>>2]|0)+2316>>2]>>1)|0)&65535;b[(c[j>>2]|0)+2736+26>>1]=t;t=((bc(c[k>>2]|0,c[(c[j>>2]|0)+2380>>2]|0,8)|0)&65535)<<16>>16;s=(c[j>>2]|0)+2736+26|0;b[s>>1]=(b[s>>1]|0)+t}b[(c[j>>2]|0)+2400>>1]=b[(c[j>>2]|0)+2736+26>>1]|0;t=(bc(c[k>>2]|0,c[(c[j>>2]|0)+2384>>2]|0,8)|0)&255;a[(c[j>>2]|0)+2736+28>>0]=t;t=(bc(c[k>>2]|0,20623,8)|0)&255;a[(c[j>>2]|0)+2736+32>>0]=t;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[(c[j>>2]|0)+2324>>2]|0))break;t=(bc(c[k>>2]|0,c[108+(a[(c[j>>2]|0)+2736+32>>0]<<2)>>2]|0,8)|0)&255;a[(c[j>>2]|0)+2736+4+(c[q>>2]|0)>>0]=t;c[q>>2]=(c[q>>2]|0)+1}if(!(c[o>>2]|0)){o=(bc(c[k>>2]|0,22713,8)|0)&255;M=o;N=c[j>>2]|0}else{M=0;N=c[j>>2]|0}a[N+2736+33>>0]=M;z=c[j>>2]|0;A=z+2736|0;B=A+29|0;C=a[B>>0]|0;D=C<<24>>24;E=c[j>>2]|0;F=E+2396|0;c[F>>2]=D;G=c[k>>2]|0;H=bc(G,22730,8)|0;I=H&255;J=c[j>>2]|0;K=J+2736|0;L=K+34|0;a[L>>0]=I;l=i;return}function Jc(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;h=l;l=l+224|0;i=h+212|0;j=h+208|0;k=h+204|0;m=h+200|0;n=h+196|0;o=h+192|0;p=h+188|0;q=h+184|0;r=h+180|0;s=h+176|0;t=h+172|0;u=h+168|0;v=h+88|0;w=h+8|0;x=h+4|0;y=h;c[i>>2]=a;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[n>>2]=g;c[u>>2]=bc(c[i>>2]|0,23053+((c[k>>2]>>1)*9|0)|0,8)|0;c[r>>2]=c[n>>2]>>4;if((c[r>>2]<<4|0)<(c[n>>2]|0))c[r>>2]=(c[r>>2]|0)+1;c[y>>2]=22873+((c[u>>2]|0)*18|0);c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[r>>2]|0))break;c[w+(c[o>>2]<<2)>>2]=0;u=bc(c[i>>2]|0,c[y>>2]|0,8)|0;g=c[o>>2]|0;f=u;while(1){c[v+(g<<2)>>2]=f;z=c[o>>2]|0;if((c[v+(c[o>>2]<<2)>>2]|0)!=17)break;u=w+(z<<2)|0;c[u>>2]=(c[u>>2]|0)+1;u=bc(c[i>>2]|0,23035+((c[w+(c[o>>2]<<2)>>2]|0)==10&1)|0,8)|0;g=c[o>>2]|0;f=u}c[o>>2]=z+1}c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[r>>2]|0))break;z=(c[j>>2]|0)+((c[o>>2]&65535)<<16>>16<<4<<1)|0;if((c[v+(c[o>>2]<<2)>>2]|0)>0)td(z,c[i>>2]|0,c[v+(c[o>>2]<<2)>>2]|0);else{y=z;z=y+32|0;do{b[y>>1]=0;y=y+2|0}while((y|0)<(z|0))}c[o>>2]=(c[o>>2]|0)+1}c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[r>>2]|0))break;if((c[w+(c[o>>2]<<2)>>2]|0)>0){c[t>>2]=c[w+(c[o>>2]<<2)>>2];c[x>>2]=(c[j>>2]|0)+((c[o>>2]&65535)<<16>>16<<4<<1);c[q>>2]=0;while(1){if((c[q>>2]|0)>=16)break;c[s>>2]=b[(c[x>>2]|0)+(c[q>>2]<<1)>>1];c[p>>2]=0;while(1){A=c[s>>2]|0;if((c[p>>2]|0)>=(c[t>>2]|0))break;c[s>>2]=A<<1;y=bc(c[i>>2]|0,22711,8)|0;c[s>>2]=(c[s>>2]|0)+y;c[p>>2]=(c[p>>2]|0)+1}b[(c[x>>2]|0)+(c[q>>2]<<1)>>1]=A;c[q>>2]=(c[q>>2]|0)+1}y=v+(c[o>>2]<<2)|0;c[y>>2]=c[y>>2]|c[t>>2]<<5}c[o>>2]=(c[o>>2]|0)+1}zc(c[i>>2]|0,c[j>>2]|0,c[n>>2]|0,c[k>>2]|0,c[m>>2]|0,v);l=h;return}function Kc(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+96|0;h=g+24|0;i=g+20|0;j=g+16|0;k=g+12|0;m=g+8|0;n=g+4|0;o=g+64|0;p=g+32|0;q=g;c[h>>2]=d;c[i>>2]=e;c[j>>2]=f;ad((c[i>>2]|0)+16|0,(c[h>>2]|0)+2736|0,(c[h>>2]|0)+2312|0,(c[j>>2]|0)==2&1,c[(c[h>>2]|0)+2324>>2]|0);bd(o,(c[h>>2]|0)+2736+8|0,c[(c[h>>2]|0)+2732>>2]|0);sc((c[i>>2]|0)+32+32|0,o,c[(c[h>>2]|0)+2340>>2]|0);if((c[(c[h>>2]|0)+2376>>2]|0)==1)a[(c[h>>2]|0)+2736+31>>0]=4;if((a[(c[h>>2]|0)+2736+31>>0]|0)<4){c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[(c[h>>2]|0)+2340>>2]|0))break;j=(b[(c[h>>2]|0)+2344+(c[k>>2]<<1)>>1]|0)+((R(a[(c[h>>2]|0)+2736+31>>0]|0,(b[o+(c[k>>2]<<1)>>1]|0)-(b[(c[h>>2]|0)+2344+(c[k>>2]<<1)>>1]|0)|0)|0)>>2)&65535;b[p+(c[k>>2]<<1)>>1]=j;c[k>>2]=(c[k>>2]|0)+1}sc((c[i>>2]|0)+32|0,p,c[(c[h>>2]|0)+2340>>2]|0)}else Ie((c[i>>2]|0)+32|0,(c[i>>2]|0)+32+32|0,c[(c[h>>2]|0)+2340>>2]<<1|0)|0;Ie((c[h>>2]|0)+2344|0,o|0,c[(c[h>>2]|0)+2340>>2]<<1|0)|0;if(c[(c[h>>2]|0)+4160>>2]|0){Yc((c[i>>2]|0)+32|0,c[(c[h>>2]|0)+2340>>2]|0,63570);Yc((c[i>>2]|0)+32+32|0,c[(c[h>>2]|0)+2340>>2]|0,63570)}if((a[(c[h>>2]|0)+2736+29>>0]|0)!=2){He(c[i>>2]|0,0,c[(c[h>>2]|0)+2324>>2]<<2|0)|0;He((c[i>>2]|0)+96|0,0,(c[(c[h>>2]|0)+2324>>2]|0)*5<<1|0)|0;a[(c[h>>2]|0)+2736+32>>0]=0;r=0;s=c[i>>2]|0;t=s+136|0;c[t>>2]=r;l=g;return}cd(b[(c[h>>2]|0)+2736+26>>1]|0,a[(c[h>>2]|0)+2736+28>>0]|0,c[i>>2]|0,c[(c[h>>2]|0)+2316>>2]|0,c[(c[h>>2]|0)+2324>>2]|0);c[q>>2]=c[120+(a[(c[h>>2]|0)+2736+32>>0]<<2)>>2];c[m>>2]=0;while(1){u=(c[h>>2]|0)+2736|0;if((c[m>>2]|0)>=(c[(c[h>>2]|0)+2324>>2]|0))break;c[n>>2]=a[u+4+(c[m>>2]|0)>>0];c[k>>2]=0;while(1){if((c[k>>2]|0)>=5)break;b[(c[i>>2]|0)+96+(((c[m>>2]|0)*5|0)+(c[k>>2]|0)<<1)>>1]=a[(c[q>>2]|0)+(((c[n>>2]|0)*5|0)+(c[k>>2]|0))>>0]<<7;c[k>>2]=(c[k>>2]|0)+1}c[m>>2]=(c[m>>2]|0)+1}c[n>>2]=a[u+33>>0];r=b[17784+(c[n>>2]<<1)>>1]|0;s=c[i>>2]|0;t=s+136|0;c[t>>2]=r;l=g;return}function Lc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if((c[(c[g>>2]|0)+2316>>2]|0)!=(c[(c[g>>2]|0)+4168+80>>2]|0)){Bc(c[g>>2]|0);c[(c[g>>2]|0)+4168+80>>2]=c[(c[g>>2]|0)+2316>>2]}e=c[g>>2]|0;d=c[h>>2]|0;if(c[j>>2]|0){Tc(e,d,c[i>>2]|0);i=(c[g>>2]|0)+4160|0;c[i>>2]=(c[i>>2]|0)+1;l=f;return}else{Uc(e,d);l=f;return}}function Mc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+48|0;g=f+40|0;h=f+36|0;i=f+32|0;j=f+28|0;k=f+24|0;m=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;c[n>>2]=(c[g>>2]|0)+4168;if(c[(c[g>>2]|0)+4160>>2]|0){Nc((c[n>>2]|0)+60|0,(c[n>>2]|0)+64|0,c[h>>2]|0,c[i>>2]|0);s=1;t=c[n>>2]|0;u=t+48|0;c[u>>2]=s;l=f;return}a:do if(c[(c[g>>2]|0)+4168+48>>2]|0){Nc(m,k,c[h>>2]|0,c[i>>2]|0);if((c[k>>2]|0)<=(c[(c[n>>2]|0)+64>>2]|0)){if((c[k>>2]|0)<(c[(c[n>>2]|0)+64>>2]|0))c[m>>2]=c[m>>2]>>(c[(c[n>>2]|0)+64>>2]|0)-(c[k>>2]|0)}else c[(c[n>>2]|0)+60>>2]=c[(c[n>>2]|0)+60>>2]>>(c[k>>2]|0)-(c[(c[n>>2]|0)+64>>2]|0);if((c[m>>2]|0)>(c[(c[n>>2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16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function Qc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;d=b+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[e>>2]=a;if((c[e>>2]|0)<=0){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}Rc(c[e>>2]|0,g,h);if(c[g>>2]&1|0)c[f>>2]=32768;else c[f>>2]=46214;c[f>>2]=c[f>>2]>>(c[g>>2]>>1);g=R(c[f>>2]>>16,(((c[h>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[f>>2]=(c[f>>2]|0)+(g+((R(c[f>>2]&65535,(((c[h>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[d>>2]=c[f>>2];i=c[d>>2]|0;l=b;return i|0}function Rc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Oc(c[f>>2]|0)|0;c[c[g>>2]>>2]=c[i>>2];g=(Sc(c[f>>2]|0,24-(c[i>>2]|0)|0)|0)&127;c[c[h>>2]>>2]=g;l=e;return}function Sc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=c[f>>2];c[i>>2]=c[g>>2];c[j>>2]=0-(c[g>>2]|0);if(!(c[g>>2]|0)){c[e>>2]=c[f>>2];k=c[e>>2]|0;l=d;return k|0}f=c[h>>2]|0;if((c[g>>2]|0)<0){c[e>>2]=f<>2]|(c[h>>2]|0)>>>(32-(c[j>>2]|0)|0);k=c[e>>2]|0;l=d;return k|0}else{c[e>>2]=f<<32-(c[i>>2]|0)|(c[h>>2]|0)>>>(c[i>>2]|0);k=c[e>>2]|0;l=d;return k|0}return 0}function Tc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0;f=l;l=l+160|0;g=f+116|0;h=f+112|0;i=f+108|0;j=f+104|0;k=f+100|0;m=f+96|0;n=f+92|0;o=f+88|0;p=f+84|0;q=f+80|0;r=f+76|0;s=f+72|0;t=f+68|0;u=f+64|0;v=f+60|0;w=f+56|0;x=f+52|0;y=f+48|0;z=f+44|0;A=f+40|0;B=f+36|0;C=f+152|0;D=f+32|0;E=f+28|0;F=f+120|0;G=f+24|0;H=f+16|0;I=f+8|0;J=f+4|0;K=f;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;c[G>>2]=(c[g>>2]|0)+4168;e=(c[(c[g>>2]|0)+2336>>2]|0)+(c[(c[g>>2]|0)+2328>>2]|0)|0;c[I>>2]=da()|0;d=l;l=l+((1*(e<<2)|0)+15&-16)|0;e=l;l=l+((1*(c[(c[g>>2]|0)+2336>>2]<<1)|0)+15&-16)|0;c[H>>2]=c[(c[G>>2]|0)+72>>2]>>6;c[H+4>>2]=c[(c[G>>2]|0)+72+4>>2]>>6;if(c[(c[g>>2]|0)+2376>>2]|0){L=(c[G>>2]|0)+14|0;M=L+32|0;do{b[L>>1]=0;L=L+2|0}while((L|0)<(M|0))}Vc(w,q,x,r,(c[g>>2]|0)+4|0,H,c[(c[g>>2]|0)+2332>>2]|0,c[(c[g>>2]|0)+2324>>2]|0);a=(c[g>>2]|0)+4|0;N=c[(c[G>>2]|0)+84>>2]|0;if((c[w>>2]>>c[r>>2]|0)<(c[x>>2]>>c[q>>2]|0))c[y>>2]=a+((Wc(0,(R(N-1|0,c[(c[G>>2]|0)+88>>2]|0)|0)-128|0)|0)<<2);else c[y>>2]=a+((Wc(0,(R(N,c[(c[G>>2]|0)+88>>2]|0)|0)-128|0)|0)<<2);c[D>>2]=(c[G>>2]|0)+4;b[C>>1]=b[(c[G>>2]|0)+56>>1]|0;c[t>>2]=b[20502+((Xc(1,c[(c[g>>2]|0)+4160>>2]|0)|0)<<1)>>1];N=(c[(c[g>>2]|0)+4164>>2]|0)==2;a=Xc(1,c[(c[g>>2]|0)+4160>>2]|0)|0;if(N)c[u>>2]=b[20506+(a<<1)>>1];else c[u>>2]=b[20510+(a<<1)>>1];Yc((c[G>>2]|0)+14|0,c[(c[g>>2]|0)+2340>>2]|0,64881);Ie(F|0,(c[G>>2]|0)+14|0,c[(c[g>>2]|0)+2340>>2]<<1|0)|0;do if(!(c[(c[g>>2]|0)+4160>>2]|0)){b[C>>1]=16384;if((c[(c[g>>2]|0)+4164>>2]|0)!=2){c[J>>2]=vc((c[G>>2]|0)+14|0,c[(c[g>>2]|0)+2340>>2]|0)|0;c[K>>2]=_c(134217728,c[J>>2]|0)|0;c[K>>2]=Pc(4194304,c[K>>2]|0)|0;c[K>>2]=c[K>>2]<<3;a=R(c[K>>2]>>16,(c[u>>2]&65535)<<16>>16)|0;c[u>>2]=a+((R(c[K>>2]&65535,(c[u>>2]&65535)<<16>>16)|0)>>16)>>14;break}c[j>>2]=0;while(1){if((c[j>>2]|0)>=5)break;b[C>>1]=(b[C>>1]|0)-(b[(c[D>>2]|0)+(c[j>>2]<<1)>>1]|0);c[j>>2]=(c[j>>2]|0)+1}b[C>>1]=Zc(3277,b[C>>1]|0)|0;b[C>>1]=(R(b[C>>1]|0,b[(c[G>>2]|0)+68>>1]|0)|0)>>14}while(0);c[s>>2]=c[(c[G>>2]|0)+52>>2];c[n>>2]=(c[c[G>>2]>>2]>>7)+1>>1;c[p>>2]=c[(c[g>>2]|0)+2336>>2];c[o>>2]=(c[(c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>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((u+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){u=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;m=u+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((m+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)P=-32768;else{m=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;u=m+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;P=(u+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else P=32767;if((P|0)<=32767){u=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;m=u+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((m+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){m=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;u=m+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((u+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)Q=-32768;else{u=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;m=u+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;Q=(m+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else Q=32767;if((Q|0)>=-32768){m=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;u=m+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((u+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<=32767){u=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;m=u+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;if(((m+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1|0)<-32768)S=-32768;else{m=R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]>>16,(c[H+4>>2]&65535)<<16>>16)|0;u=m+((R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]&65535,(c[H+4>>2]&65535)<<16>>16)|0)>>16)|0;S=(u+(R(c[(c[E>>2]|0)+(16+(c[j>>2]|0)<<2)>>2]|0,(c[H+4>>2]>>15)+1>>1)|0)>>7)+1>>1}}else S=32767}else S=-32768}else S=32767;b[(c[i>>2]|0)+(c[j>>2]<<1)>>1]=S;c[j>>2]=(c[j>>2]|0)+1}L=O+1284|0;d=(c[E>>2]|0)+(c[(c[g>>2]|0)+2328>>2]<<2)|0;M=L+64|0;do{c[L>>2]=c[d>>2];L=L+4|0;d=d+4|0}while((L|0)<(M|0));c[(c[G>>2]|0)+52>>2]=c[s>>2];b[(c[G>>2]|0)+56>>1]=b[C>>1]|0;c[j>>2]=0;while(1){if((c[j>>2]|0)>=4)break;c[(c[h>>2]|0)+(c[j>>2]<<2)>>2]=c[n>>2];c[j>>2]=(c[j>>2]|0)+1}ga(c[I>>2]|0);l=f;return}function Uc(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0;f=l;l=l+48|0;g=f+40|0;h=f+36|0;i=f+32|0;j=f+28|0;k=f+24|0;m=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[g>>2]=d;c[h>>2]=e;c[n>>2]=(c[g>>2]|0)+4168;c[(c[g>>2]|0)+4164>>2]=a[(c[g>>2]|0)+2736+29>>0];c[i>>2]=0;a:do if((a[(c[g>>2]|0)+2736+29>>0]|0)==2){c[m>>2]=0;while(1){e=R(c[m>>2]|0,c[(c[g>>2]|0)+2332>>2]|0)|0;if((e|0)>=(c[(c[h>>2]|0)+((c[(c[g>>2]|0)+2324>>2]|0)-1<<2)>>2]|0))break;if((c[m>>2]|0)==(c[(c[g>>2]|0)+2324>>2]|0))break;c[j>>2]=0;c[k>>2]=0;while(1){if((c[k>>2]|0)>=5)break;c[j>>2]=(c[j>>2]|0)+(b[(c[h>>2]|0)+96+((((c[(c[g>>2]|0)+2324>>2]|0)-1-(c[m>>2]|0)|0)*5|0)+(c[k>>2]|0)<<1)>>1]|0);c[k>>2]=(c[k>>2]|0)+1}if((c[j>>2]|0)>(c[i>>2]|0)){c[i>>2]=c[j>>2];e=(c[n>>2]|0)+4|0;d=(c[h>>2]|0)+96+((((c[(c[g>>2]|0)+2324>>2]|0)-1-(c[m>>2]|0)&65535)<<16>>16)*5<<1)|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;b[e+4>>1]=b[d+4>>1]|0;b[e+6>>1]=b[d+6>>1]|0;b[e+8>>1]=b[d+8>>1]|0;c[c[n>>2]>>2]=c[(c[h>>2]|0)+((c[(c[g>>2]|0)+2324>>2]|0)-1-(c[m>>2]|0)<<2)>>2]<<8}c[m>>2]=(c[m>>2]|0)+1}d=(c[n>>2]|0)+4|0;c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;b[(c[n>>2]|0)+4+4>>1]=c[i>>2];if((c[i>>2]|0)<11469){c[p>>2]=11744256;c[o>>2]=(c[p>>2]|0)/(((c[i>>2]|0)>1?c[i>>2]|0:1)|0)|0;c[k>>2]=0;while(1){if((c[k>>2]|0)>=5)break a;d=(R(b[(c[n>>2]|0)+4+(c[k>>2]<<1)>>1]|0,(c[o>>2]&65535)<<16>>16)|0)>>10&65535;b[(c[n>>2]|0)+4+(c[k>>2]<<1)>>1]=d;c[k>>2]=(c[k>>2]|0)+1}}if((c[i>>2]|0)>15565){c[r>>2]=255016960;c[q>>2]=(c[r>>2]|0)/(((c[i>>2]|0)>1?c[i>>2]|0:1)|0)|0;c[k>>2]=0;while(1){if((c[k>>2]|0)>=5)break a;d=(R(b[(c[n>>2]|0)+4+(c[k>>2]<<1)>>1]|0,(c[q>>2]&65535)<<16>>16)|0)>>14&65535;b[(c[n>>2]|0)+4+(c[k>>2]<<1)>>1]=d;c[k>>2]=(c[k>>2]|0)+1}}}else{c[c[n>>2]>>2]=((c[(c[g>>2]|0)+2316>>2]&65535)<<16>>16)*18<<8;d=(c[n>>2]|0)+4|0;c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0}while(0);Ie((c[n>>2]|0)+14|0,(c[h>>2]|0)+32+32|0,c[(c[g>>2]|0)+2340>>2]<<1|0)|0;b[(c[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>>2]|0)+1}Nc(c[m>>2]|0,c[n>>2]|0,i,c[s>>2]|0);Nc(c[o>>2]|0,c[p>>2]|0,i+(c[s>>2]<<1)|0,c[s>>2]|0);ga(c[x>>2]|0);l=k;return}function Wc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function Xc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)<(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function Yc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;c[k>>2]=(c[i>>2]|0)-65536;c[j>>2]=0;while(1){m=c[i>>2]|0;n=c[g>>2]|0;if((c[j>>2]|0)>=((c[h>>2]|0)-1|0))break;e=((R(m,b[n+(c[j>>2]<<1)>>1]|0)|0)>>15)+1>>1&65535;b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]=e;e=((R(c[i>>2]|0,c[k>>2]|0)|0)>>15)+1>>1;c[i>>2]=(c[i>>2]|0)+e;c[j>>2]=(c[j>>2]|0)+1}j=((R(m,b[n+((c[h>>2]|0)-1<<1)>>1]|0)|0)>>15)+1>>1&65535;b[(c[g>>2]|0)+((c[h>>2]|0)-1<<1)>>1]=j;l=f;return}function Zc(a,c){a=a|0;c=c|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+2|0;f=d;b[e>>1]=a;b[f>>1]=c;l=d;return ((b[e>>1]|0)>(b[f>>1]|0)?b[e>>1]|0:b[f>>1]|0)&65535|0}function _c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)<(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function $c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;d=l;l=l+48|0;e=d+32|0;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+12|0;k=d+8|0;m=d+4|0;n=d;c[f>>2]=a;c[g>>2]=b;b=c[f>>2]|0;c[h>>2]=(Oc((c[f>>2]|0)>0?b:0-b|0)|0)-1;c[k>>2]=c[f>>2]<>2];c[j>>2]=536870911/(c[k>>2]>>16|0)|0;c[n>>2]=c[j>>2]<<16;f=R(c[k>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;c[m>>2]=536870912-(f+((R(c[k>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))<<3;k=R(c[m>>2]>>16,(c[j>>2]&65535)<<16>>16)|0;f=(c[n>>2]|0)+(k+((R(c[m>>2]&65535,(c[j>>2]&65535)<<16>>16)|0)>>16))|0;c[n>>2]=f+(R(c[m>>2]|0,(c[j>>2]>>15)+1>>1)|0);c[i>>2]=61-(c[h>>2]|0)-(c[g>>2]|0);g=c[i>>2]|0;if((c[i>>2]|0)>0)if((g|0)<32){c[e>>2]=c[n>>2]>>c[i>>2];o=c[e>>2]|0;l=d;return o|0}else{c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}h=c[n>>2]|0;j=0-(c[i>>2]|0)|0;do if((-2147483648>>0-g|0)>(2147483647>>0-(c[i>>2]|0)|0)){if((h|0)>(-2147483648>>j|0)){p=-2147483648>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(2147483647>>0-(c[i>>2]|0)|0)){p=2147483647>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}else{if((h|0)>(2147483647>>j|0)){p=2147483647>>0-(c[i>>2]|0);break}if((c[n>>2]|0)<(-2147483648>>0-(c[i>>2]|0)|0)){p=-2147483648>>0-(c[i>>2]|0);break}else{p=c[n>>2]|0;break}}while(0);c[e>>2]=p<<0-(c[i>>2]|0);o=c[e>>2]|0;l=d;return o|0}function ad(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+32|0;i=h+28|0;j=h+24|0;k=h+20|0;m=h+16|0;n=h+12|0;o=h+8|0;p=h+4|0;q=h;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[n>>2]=g;c[o>>2]=0;while(1){if((c[o>>2]|0)>=(c[n>>2]|0))break;g=a[(c[j>>2]|0)+(c[o>>2]|0)>>0]|0;if((c[o>>2]|0)==0&(c[m>>2]|0)==0){f=(qd(g,(a[c[k>>2]>>0]|0)-16|0)|0)&255;a[c[k>>2]>>0]=f}else{c[p>>2]=g+-4;c[q>>2]=8+(a[c[k>>2]>>0]|0);g=c[p>>2]|0;if((c[p>>2]|0)>(c[q>>2]|0)){r=(g<<1)-(c[q>>2]|0)|0;s=c[k>>2]|0}else{r=g;s=c[k>>2]|0}a[s>>0]=(a[s>>0]|0)+r}if((a[c[k>>2]>>0]|0)<=63)if((a[c[k>>2]>>0]|0)<0)t=0;else t=a[c[k>>2]>>0]|0;else t=63;a[c[k>>2]>>0]=t;g=sd(rd(((a[c[k>>2]>>0]<<16>>16)*29|0)+((a[c[k>>2]>>0]<<16>>16)*7281>>16)+2090|0,3967)|0)|0;c[(c[i>>2]|0)+(c[o>>2]<<2)>>2]=g;c[o>>2]=(c[o>>2]|0)+1}l=h;return}function bd(e,f,g){e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;h=l;l=l+144|0;i=h+24|0;j=h+20|0;k=h+16|0;m=h+12|0;n=h+128|0;o=h+96|0;p=h+64|0;q=h+32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)if(h){c[u>>2]=23768;c[t>>2]=11;break}else{c[u>>2]=23738;c[t>>2]=3;break}else if(h){c[u>>2]=23812;c[t>>2]=34;break}else{c[u>>2]=23744;c[t>>2]=12;break}while(0);c[r>>2]=(c[n>>2]&65535)<<16>>16<<1;c[s>>2]=((c[n>>2]&65535)<<16>>16)*18;c[p>>2]=(c[r>>2]|0)+(b[j>>1]|0);c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[o>>2]|0))break;j=R(c[q>>2]|0,c[t>>2]|0)|0;c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]=(c[p>>2]|0)+(a[(c[u>>2]|0)+(j+(a[k>>0]|0))>>0]|0);j=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;do if((c[r>>2]|0)>(c[s>>2]|0)){if((j|0)>(c[r>>2]|0)){v=c[r>>2]|0;break}if((c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0)<(c[s>>2]|0)){v=c[s>>2]|0;break}else{v=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;break}}else{if((j|0)>(c[s>>2]|0)){v=c[s>>2]|0;break}if((c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0)<(c[r>>2]|0)){v=c[r>>2]|0;break}else{v=c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]|0;break}}while(0);c[(c[m>>2]|0)+(c[q>>2]<<2)>>2]=v;c[q>>2]=(c[q>>2]|0)+1}l=i;return}function dd(e,f,g,h){e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;i=l;l=l+32|0;j=i+20|0;k=i+16|0;m=i+12|0;n=i+8|0;o=i+4|0;p=i+24|0;q=i;c[j>>2]=e;c[k>>2]=f;c[m>>2]=g;c[n>>2]=h;c[q>>2]=(c[(c[m>>2]|0)+20>>2]|0)+((R(c[n>>2]|0,b[(c[m>>2]|0)+2>>1]|0)|0)/2|0);c[o>>2]=0;while(1){if((c[o>>2]|0)>=(b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1)>>1]=c[r>>2];c[q>>2]=(c[q>>2]|0)+-1}l=j;return}function fd(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;c[k>>2]=od(b[c[h>>2]>>1]|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;c[m>>2]=od((b[(c[h>>2]|0)+2>>1]|0)-(b[c[h>>2]>>1]|0)|0,1)|0;c[m>>2]=131072/(c[m>>2]|0)|0;e=(pd((c[k>>2]|0)+(c[m>>2]|0)|0,32767)|0)&65535;b[c[g>>2]>>1]=e;c[j>>2]=1;while(1){n=c[h>>2]|0;if((c[j>>2]|0)>=((c[i>>2]|0)-1|0))break;c[k>>2]=od((b[n+((c[j>>2]|0)+1<<1)>>1]|0)-(b[(c[h>>2]|0)+(c[j>>2]<<1)>>1]|0)|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;e=(pd((c[k>>2]|0)+(c[m>>2]|0)|0,32767)|0)&65535;b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]=e;c[m>>2]=od((b[(c[h>>2]|0)+((c[j>>2]|0)+2<<1)>>1]|0)-(b[(c[h>>2]|0)+((c[j>>2]|0)+1<<1)>>1]|0)|0,1)|0;c[m>>2]=131072/(c[m>>2]|0)|0;e=(pd((c[k>>2]|0)+(c[m>>2]|0)|0,32767)|0)&65535;b[(c[g>>2]|0)+((c[j>>2]|0)+1<<1)>>1]=e;c[j>>2]=(c[j>>2]|0)+2}c[k>>2]=od(32768-(b[n+((c[i>>2]|0)-1<<1)>>1]|0)|0,1)|0;c[k>>2]=131072/(c[k>>2]|0)|0;n=(pd((c[k>>2]|0)+(c[m>>2]|0)|0,32767)|0)&65535;b[(c[g>>2]|0)+((c[i>>2]|0)-1<<1)>>1]=n;l=f;return}function gd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;d=b+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[e>>2]=a;if((c[e>>2]|0)<=0){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}ld(c[e>>2]|0,g,h);if(c[g>>2]&1|0)c[f>>2]=32768;else c[f>>2]=46214;c[f>>2]=c[f>>2]>>(c[g>>2]>>1);g=R(c[f>>2]>>16,(((c[h>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0;c[f>>2]=(c[f>>2]|0)+(g+((R(c[f>>2]&65535,(((c[h>>2]&65535)<<16>>16)*213&65535)<<16>>16)|0)>>16));c[d>>2]=c[f>>2];i=c[d>>2]|0;l=b;return i|0}function hd(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+48|0;g=f+40|0;h=f+36|0;i=f+32|0;j=f+28|0;k=f+24|0;m=f+20|0;n=f+16|0;o=f+44|0;p=f+12|0;q=f+8|0;r=f+4|0;s=f;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;c[k>>2]=0;c[n>>2]=0;while(1){if((c[n>>2]|0)>=20)break;c[q>>2]=(b[c[g>>2]>>1]|0)-(b[c[h>>2]>>1]|0);c[k>>2]=0;c[j>>2]=1;while(1){t=c[g>>2]|0;if((c[j>>2]|0)>((c[i>>2]|0)-1|0))break;c[p>>2]=(b[t+(c[j>>2]<<1)>>1]|0)-((b[(c[g>>2]|0)+((c[j>>2]|0)-1<<1)>>1]|0)+(b[(c[h>>2]|0)+(c[j>>2]<<1)>>1]|0));if((c[p>>2]|0)<(c[q>>2]|0)){c[q>>2]=c[p>>2];c[k>>2]=c[j>>2]}c[j>>2]=(c[j>>2]|0)+1}c[p>>2]=32768-((b[t+((c[i>>2]|0)-1<<1)>>1]|0)+(b[(c[h>>2]|0)+(c[i>>2]<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0)+(c[j>>2]<<1)>>1]|0)|0)|0)&65535;b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]=n;c[j>>2]=(c[j>>2]|0)+1}n=(kd(b[A+((c[i>>2]|0)-1<<1)>>1]|0,32768-(b[(c[h>>2]|0)+(c[i>>2]<<1)>>1]|0)|0)|0)&65535;b[(c[g>>2]|0)+((c[i>>2]|0)-1<<1)>>1]=n;c[j>>2]=(c[i>>2]|0)-2;while(1){if((c[j>>2]|0)<0)break;i=(kd(b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]|0,(b[(c[g>>2]|0)+((c[j>>2]|0)+1<<1)>>1]|0)-(b[(c[h>>2]|0)+((c[j>>2]|0)+1<<1)>>1]|0)|0)|0)&65535;b[(c[g>>2]|0)+(c[j>>2]<<1)>>1]=i;c[j>>2]=(c[j>>2]|0)+-1}l=f;return}function id(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=d;c[i>>2]=1;while(1){if((c[i>>2]|0)>=(c[g>>2]|0))break;c[h>>2]=b[(c[f>>2]|0)+(c[i>>2]<<1)>>1];c[j>>2]=(c[i>>2]|0)-1;while(1){if((c[j>>2]|0)<0)break;if((c[h>>2]|0)>=(b[(c[f>>2]|0)+(c[j>>2]<<1)>>1]|0))break;b[(c[f>>2]|0)+((c[j>>2]|0)+1<<1)>>1]=b[(c[f>>2]|0)+(c[j>>2]<<1)>>1]|0;c[j>>2]=(c[j>>2]|0)+-1}b[(c[f>>2]|0)+((c[j>>2]|0)+1<<1)>>1]=c[h>>2];c[i>>2]=(c[i>>2]|0)+1}l=e;return}function jd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function kd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)<(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function ld(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=md(c[f>>2]|0)|0;c[c[g>>2]>>2]=c[i>>2];g=(nd(c[f>>2]|0,24-(c[i>>2]|0)|0)|0)&127;c[c[h>>2]>>2]=g;l=e;return}function md(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b;c[d>>2]=a;if(!(c[d>>2]|0)){e=32;l=b;return e|0}e=32-(32-(U(c[d>>2]|0)|0))|0;l=b;return e|0}function nd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=c[f>>2];c[i>>2]=c[g>>2];c[j>>2]=0-(c[g>>2]|0);if(!(c[g>>2]|0)){c[e>>2]=c[f>>2];k=c[e>>2]|0;l=d;return k|0}f=c[h>>2]|0;if((c[g>>2]|0)<0){c[e>>2]=f<>2]|(c[h>>2]|0)>>>(32-(c[j>>2]|0)|0);k=c[e>>2]|0;l=d;return k|0}else{c[e>>2]=f<<32-(c[i>>2]|0)|(c[h>>2]|0)>>>(c[i>>2]|0);k=c[e>>2]|0;l=d;return k|0}return 0}function od(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function pd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)<(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function qd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)>(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function rd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return ((c[e>>2]|0)<(c[f>>2]|0)?c[e>>2]|0:c[f>>2]|0)|0}function sd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;if((c[e>>2]|0)<0){c[d>>2]=0;h=c[d>>2]|0;l=b;return h|0}if((c[e>>2]|0)>=3967){c[d>>2]=2147483647;h=c[d>>2]|0;l=b;return h|0}c[f>>2]=1<<(c[e>>2]>>7);c[g>>2]=c[e>>2]&127;a=c[f>>2]|0;i=c[f>>2]|0;if((c[e>>2]|0)<2048){e=R((R((c[g>>2]&65535)<<16>>16,(128-(c[g>>2]|0)&65535)<<16>>16)|0)>>16,-174)|0;c[f>>2]=a+((R(i,(c[g>>2]|0)+(e+((R((R((c[g>>2]&65535)<<16>>16,(128-(c[g>>2]|0)&65535)<<16>>16)|0)&65535,-174)|0)>>16))|0)|0)>>7)}else{e=R((R((c[g>>2]&65535)<<16>>16,(128-(c[g>>2]|0)&65535)<<16>>16)|0)>>16,-174)|0;c[f>>2]=a+(R(i>>7,(c[g>>2]|0)+(e+((R((R((c[g>>2]&65535)<<16>>16,(128-(c[g>>2]|0)&65535)<<16>>16)|0)&65535,-174)|0)>>16))|0)|0)}c[d>>2]=c[f>>2];h=c[d>>2]|0;l=b;return h|0}function td(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+48|0;g=f+8|0;h=f+4|0;i=f;j=f+40|0;k=f+32|0;m=f+16|0;c[g>>2]=a;c[h>>2]=d;c[i>>2]=e;ud(j,j+2|0,c[h>>2]|0,c[i>>2]|0,23527);ud(k,k+2|0,c[h>>2]|0,b[j>>1]|0,23375);ud(m,m+2|0,c[h>>2]|0,b[k>>1]|0,23223);ud(c[g>>2]|0,(c[g>>2]|0)+2|0,c[h>>2]|0,b[m>>1]|0,23071);ud((c[g>>2]|0)+4|0,(c[g>>2]|0)+6|0,c[h>>2]|0,b[m+2>>1]|0,23071);ud(m+4|0,m+6|0,c[h>>2]|0,b[k+2>>1]|0,23223);ud((c[g>>2]|0)+8|0,(c[g>>2]|0)+10|0,c[h>>2]|0,b[m+4>>1]|0,23071);ud((c[g>>2]|0)+12|0,(c[g>>2]|0)+14|0,c[h>>2]|0,b[m+6>>1]|0,23071);ud(k+4|0,k+6|0,c[h>>2]|0,b[j+2>>1]|0,23375);ud(m+8|0,m+10|0,c[h>>2]|0,b[k+4>>1]|0,23223);ud((c[g>>2]|0)+16|0,(c[g>>2]|0)+18|0,c[h>>2]|0,b[m+8>>1]|0,23071);ud((c[g>>2]|0)+20|0,(c[g>>2]|0)+22|0,c[h>>2]|0,b[m+10>>1]|0,23071);ud(m+12|0,m+14|0,c[h>>2]|0,b[k+6>>1]|0,23223);ud((c[g>>2]|0)+24|0,(c[g>>2]|0)+26|0,c[h>>2]|0,b[m+12>>1]|0,23071);ud((c[g>>2]|0)+28|0,(c[g>>2]|0)+30|0,c[h>>2]|0,b[m+14>>1]|0,23071);l=f;return}function ud(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;i=l;l=l+32|0;j=i+16|0;k=i+12|0;m=i+8|0;n=i+4|0;o=i;c[j>>2]=a;c[k>>2]=e;c[m>>2]=f;c[n>>2]=g;c[o>>2]=h;if((c[n>>2]|0)>0){h=(bc(c[m>>2]|0,(c[o>>2]|0)+(d[23679+(c[n>>2]|0)>>0]|0)|0,8)|0)&65535;b[c[j>>2]>>1]=h;p=(c[n>>2]|0)-(b[c[j>>2]>>1]|0)&65535;q=c[k>>2]|0;b[q>>1]=p;l=i;return}else{b[c[j>>2]>>1]=0;p=0;q=c[k>>2]|0;b[q>>1]=p;l=i;return}}function vd(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[k>>2]=0;c[(c[g>>2]|0)+2332>>2]=((c[h>>2]&65535)<<16>>16)*5;c[j>>2]=R((c[(c[g>>2]|0)+2324>>2]&65535)<<16>>16,(c[(c[g>>2]|0)+2332>>2]&65535)<<16>>16)|0;if(!((c[(c[g>>2]|0)+2316>>2]|0)==(c[h>>2]|0)?(c[(c[g>>2]|0)+2320>>2]|0)==(c[i>>2]|0):0)){e=wd((c[g>>2]|0)+2432|0,((c[h>>2]&65535)<<16>>16)*1e3|0,c[i>>2]|0,0)|0;c[k>>2]=(c[k>>2]|0)+e;c[(c[g>>2]|0)+2320>>2]=c[i>>2]}if((c[(c[g>>2]|0)+2316>>2]|0)==(c[h>>2]|0)?(c[j>>2]|0)==(c[(c[g>>2]|0)+2328>>2]|0):0){m=c[k>>2]|0;l=f;return m|0}i=(c[(c[g>>2]|0)+2324>>2]|0)==4;c[(c[g>>2]|0)+2384>>2]=(c[h>>2]|0)==8?(i?22847:22870):i?22813:22858;if((c[(c[g>>2]|0)+2316>>2]|0)!=(c[h>>2]|0)){c[(c[g>>2]|0)+2336>>2]=((c[h>>2]&65535)<<16>>16)*20;i=(c[g>>2]|0)+2340|0;if((c[h>>2]|0)==8|(c[h>>2]|0)==12){c[i>>2]=10;n=c[g>>2]|0;o=132}else{c[i>>2]=16;n=c[g>>2]|0;o=168}c[n+2732>>2]=o;do if((c[h>>2]|0)!=16){if((c[h>>2]|0)==12){p=22739;q=c[g>>2]|0;r=16;break}if((c[h>>2]|0)==8){p=22730;q=c[g>>2]|0;r=16}}else{p=22745;q=c[g>>2]|0;r=16}while(0);if((r|0)==16)c[q+2380>>2]=p;c[(c[g>>2]|0)+2376>>2]=1;c[(c[g>>2]|0)+2308>>2]=100;a[(c[g>>2]|0)+2312>>0]=10;c[(c[g>>2]|0)+4164>>2]=0;He((c[g>>2]|0)+1348|0,0,960)|0;p=(c[g>>2]|0)+1284|0;q=p+64|0;do{c[p>>2]=0;p=p+4|0}while((p|0)<(q|0))}c[(c[g>>2]|0)+2316>>2]=c[h>>2];c[(c[g>>2]|0)+2328>>2]=c[j>>2];m=c[k>>2]|0;l=f;return m|0}function wd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;m=g+4|0;n=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;He(c[i>>2]|0,0,300)|0;f=(c[j>>2]|0)!=8e3&(c[j>>2]|0)!=12e3&(c[j>>2]|0)!=16e3;do if(c[m>>2]|0){if(!(f&(c[j>>2]|0)!=24e3&(c[j>>2]|0)!=48e3)?!((c[k>>2]|0)!=8e3&(c[k>>2]|0)!=12e3&(c[k>>2]|0)!=16e3):0){o=c[i>>2]|0;p=a[25178+((((c[j>>2]>>12)-((c[j>>2]|0)>16e3&1)>>((c[j>>2]|0)>24e3&1))-1|0)*3|0)+(((c[k>>2]>>12)-((c[k>>2]|0)>16e3&1)>>((c[k>>2]|0)>24e3&1))-1)>>0]|0;break}c[h>>2]=-1;q=c[h>>2]|0;l=g;return q|0}else{if(!f?!((c[k>>2]|0)!=8e3&(c[k>>2]|0)!=12e3&(c[k>>2]|0)!=16e3&(c[k>>2]|0)!=24e3&(c[k>>2]|0)!=48e3):0){o=c[i>>2]|0;p=a[25193+((((c[j>>2]>>12)-((c[j>>2]|0)>16e3&1)>>((c[j>>2]|0)>24e3&1))-1|0)*5|0)+(((c[k>>2]>>12)-((c[k>>2]|0)>16e3&1)>>((c[k>>2]|0)>24e3&1))-1)>>0]|0;break}c[h>>2]=-1;q=c[h>>2]|0;l=g;return q|0}while(0);c[o+292>>2]=p;c[(c[i>>2]|0)+284>>2]=(c[j>>2]|0)/1e3|0;c[(c[i>>2]|0)+288>>2]=(c[k>>2]|0)/1e3|0;c[(c[i>>2]|0)+268>>2]=(c[(c[i>>2]|0)+284>>2]|0)*10;c[n>>2]=0;p=c[k>>2]|0;o=c[j>>2]|0;do if((c[k>>2]|0)>(c[j>>2]|0)){f=(c[i>>2]|0)+264|0;if((p|0)==(o<<1|0)){c[f>>2]=1;break}else{c[f>>2]=2;c[n>>2]=1;break}}else{f=(c[i>>2]|0)+264|0;if((p|0)>=(o|0)){c[f>>2]=0;break}c[f>>2]=3;if((c[k>>2]<<2|0)==((c[j>>2]|0)*3|0)){c[(c[i>>2]|0)+280>>2]=3;c[(c[i>>2]|0)+276>>2]=18;c[(c[i>>2]|0)+296>>2]=18048;break}if(((c[k>>2]|0)*3|0)==(c[j>>2]<<1|0)){c[(c[i>>2]|0)+280>>2]=2;c[(c[i>>2]|0)+276>>2]=18;c[(c[i>>2]|0)+296>>2]=18106;break}if((c[k>>2]<<1|0)==(c[j>>2]|0)){c[(c[i>>2]|0)+280>>2]=1;c[(c[i>>2]|0)+276>>2]=24;c[(c[i>>2]|0)+296>>2]=18146;break}if(((c[k>>2]|0)*3|0)==(c[j>>2]|0)){c[(c[i>>2]|0)+280>>2]=1;c[(c[i>>2]|0)+276>>2]=36;c[(c[i>>2]|0)+296>>2]=18174;break}if((c[k>>2]<<2|0)==(c[j>>2]|0)){c[(c[i>>2]|0)+280>>2]=1;c[(c[i>>2]|0)+276>>2]=36;c[(c[i>>2]|0)+296>>2]=18214;break}if(((c[k>>2]|0)*6|0)==(c[j>>2]|0)){c[(c[i>>2]|0)+280>>2]=1;c[(c[i>>2]|0)+276>>2]=36;c[(c[i>>2]|0)+296>>2]=18254;break}c[h>>2]=-1;q=c[h>>2]|0;l=g;return q|0}while(0);c[(c[i>>2]|0)+272>>2]=((c[j>>2]<<14+(c[n>>2]|0)|0)/(c[k>>2]|0)|0)<<2;while(1){o=R(c[(c[i>>2]|0)+272>>2]>>16,(c[k>>2]&65535)<<16>>16)|0;p=o+((R(c[(c[i>>2]|0)+272>>2]&65535,(c[k>>2]&65535)<<16>>16)|0)>>16)|0;o=p+(R(c[(c[i>>2]|0)+272>>2]|0,(c[k>>2]>>15)+1>>1)|0)|0;if((o|0)>=(c[j>>2]<>2]|0))break;o=(c[i>>2]|0)+272|0;c[o>>2]=(c[o>>2]|0)+1}c[h>>2]=0;q=c[h>>2]|0;l=g;return q|0}function xd(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=0;c[c[d>>2]>>2]=8544;l=b;return c[e>>2]|0}function yd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[f>>2]=0;c[g>>2]=c[d>>2];c[e>>2]=0;while(1){if((c[e>>2]|0)>=2)break;c[f>>2]=Ac((c[g>>2]|0)+((c[e>>2]|0)*4260|0)|0)|0;c[e>>2]=(c[e>>2]|0)+1}e=(c[d>>2]|0)+8520|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[(c[d>>2]|0)+8540>>2]=0;l=b;return c[f>>2]|0}function zd(d,e,f,g,h,i,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;k=l;l=l+768|0;m=k+124|0;n=k+120|0;o=k+116|0;p=k+112|0;q=k+108|0;r=k+104|0;s=k+100|0;t=k+96|0;u=k+92|0;v=k+88|0;w=k+84|0;x=k+80|0;y=k+76|0;z=k+72|0;A=k+64|0;B=k+56|0;C=k+52|0;D=k+48|0;E=k+44|0;F=k+40|0;G=k+36|0;H=k+32|0;I=k+28|0;J=k+128|0;K=k+24|0;L=k+20|0;M=k+16|0;N=k+12|0;O=k;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[t>>2]=j;c[w>>2]=0;c[x>>2]=0;c[B>>2]=0;c[B+4>>2]=0;c[D>>2]=c[n>>2];c[E>>2]=c[D>>2];a:do if(c[q>>2]|0){c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break a;c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2388>>2]=0;c[v>>2]=(c[v>>2]|0)+1}}while(0);if((c[(c[o>>2]|0)+4>>2]|0)>(c[(c[D>>2]|0)+8536>>2]|0)){q=Ac((c[E>>2]|0)+4260|0)|0;c[x>>2]=(c[x>>2]|0)+q}if((c[(c[o>>2]|0)+4>>2]|0)==1?(c[(c[D>>2]|0)+8536>>2]|0)==2:0)P=(c[(c[o>>2]|0)+12>>2]|0)==((c[(c[E>>2]|0)+2316>>2]|0)*1e3|0);else P=0;c[G>>2]=P&1;b:do if(!(c[(c[E>>2]|0)+2388>>2]|0)){c[v>>2]=0;c:while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break b;do if(!(c[(c[o>>2]|0)+16>>2]|0)){c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]=1;Q=2;S=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0}else{if((c[(c[o>>2]|0)+16>>2]|0)==10){c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]=1;Q=2;S=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0;break}if((c[(c[o>>2]|0)+16>>2]|0)==20){c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]=1;Q=4;S=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0;break}if((c[(c[o>>2]|0)+16>>2]|0)==40){c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]=2;Q=4;S=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0;break}if((c[(c[o>>2]|0)+16>>2]|0)!=60){T=23;break c}c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]=3;Q=4;S=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0}while(0);c[S+2324>>2]=Q;c[I>>2]=(c[(c[o>>2]|0)+12>>2]>>10)+1;if((c[I>>2]|0)!=8&(c[I>>2]|0)!=12&(c[I>>2]|0)!=16){T=25;break}P=vd((c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0,c[I>>2]|0,c[(c[o>>2]|0)+8>>2]|0)|0;c[x>>2]=(c[x>>2]|0)+P;c[v>>2]=(c[v>>2]|0)+1}if((T|0)==23){c[m>>2]=-203;U=c[m>>2]|0;l=k;return U|0}else if((T|0)==25){c[m>>2]=-200;U=c[m>>2]|0;l=k;return U|0}}while(0);do if((c[c[o>>2]>>2]|0)==2?(c[(c[o>>2]|0)+4>>2]|0)==2:0){if((c[(c[D>>2]|0)+8532>>2]|0)!=1?(c[(c[D>>2]|0)+8536>>2]|0)!=1:0)break;c[(c[D>>2]|0)+8520>>2]=0;c[(c[D>>2]|0)+8520+8>>2]=0;Ie((c[E>>2]|0)+4260+2432|0,(c[E>>2]|0)+2432|0,300)|0}while(0);c[(c[D>>2]|0)+8532>>2]=c[c[o>>2]>>2];c[(c[D>>2]|0)+8536>>2]=c[(c[o>>2]|0)+4>>2];if((c[(c[o>>2]|0)+8>>2]|0)<=48e3?(c[(c[o>>2]|0)+8>>2]|0)>=8e3:0){d:do if((c[p>>2]|0)!=1?(c[(c[E>>2]|0)+2388>>2]|0)==0:0){c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break;c[u>>2]=0;while(1){I=(c[u>>2]|0)<(c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]|0);V=Va(c[r>>2]|0,1)|0;W=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0;if(!I)break;c[W+2404+(c[u>>2]<<2)>>2]=V;c[u>>2]=(c[u>>2]|0)+1}c[W+2416>>2]=V;c[v>>2]=(c[v>>2]|0)+1}c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break;I=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420|0;c[I>>2]=0;c[I+4>>2]=0;c[I+8>>2]=0;e:do if(c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2416>>2]|0){if((c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]|0)==1){c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420>>2]=1;break}c[z>>2]=(bc(c[r>>2]|0,c[204+((c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]|0)-2<<2)>>2]|0,8)|0)+1;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2392>>2]|0))break e;c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420+(c[u>>2]<<2)>>2]=c[z>>2]>>c[u>>2]&1;c[u>>2]=(c[u>>2]|0)+1}}while(0);c[v>>2]=(c[v>>2]|0)+1}if(!(c[p>>2]|0)){c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[(c[E>>2]|0)+2392>>2]|0))break d;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break;if(c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420+(c[u>>2]<<2)>>2]|0){do if((c[v>>2]|0)==0?(c[(c[o>>2]|0)+4>>2]|0)==2:0){Ad(c[r>>2]|0,B);if(c[(c[E>>2]|0)+4260+2420+(c[u>>2]<<2)>>2]|0)break;Bd(c[r>>2]|0,w)}while(0);do if((c[u>>2]|0)>0){if(!(c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420+((c[u>>2]|0)-1<<2)>>2]|0)){T=64;break}c[K>>2]=2}else T=64;while(0);if((T|0)==64){T=0;c[K>>2]=0}Ic((c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0,c[r>>2]|0,c[u>>2]|0,1,c[K>>2]|0);Jc(c[r>>2]|0,J,a[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2736+29>>0]|0,a[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2736+30>>0]|0,c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2328>>2]|0)}c[v>>2]=(c[v>>2]|0)+1}c[u>>2]=(c[u>>2]|0)+1}}}while(0);f:do if((c[(c[o>>2]|0)+4>>2]|0)==2){do if(c[p>>2]|0){if((c[p>>2]|0)==2?(c[(c[E>>2]|0)+2420+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0)==1:0)break;c[v>>2]=0;while(1){if((c[v>>2]|0)>=2)break f;c[B+(c[v>>2]<<2)>>2]=b[(c[D>>2]|0)+8520+(c[v>>2]<<1)>>1];c[v>>2]=(c[v>>2]|0)+1}}while(0);Ad(c[r>>2]|0,B);if(!((c[p>>2]|0)==0?!(c[(c[E>>2]|0)+4260+2404+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0):0))T=74;do if((T|0)==74){if((c[p>>2]|0)==2?(c[(c[E>>2]|0)+4260+2420+(c[(c[E>>2]|0)+2388>>2]<<2)>>2]|0)==0:0)break;c[w>>2]=0;break f}while(0);Bd(c[r>>2]|0,w)}while(0);if(((c[w>>2]|0)==0?(c[(c[o>>2]|0)+4>>2]|0)==2:0)?(c[(c[D>>2]|0)+8540>>2]|0)==1:0){He((c[D>>2]|0)+4260+1348|0,0,960)|0;T=(c[D>>2]|0)+4260+1284|0;J=T+64|0;do{c[T>>2]=0;T=T+4|0}while((T|0)<(J|0));c[(c[D>>2]|0)+4260+2308>>2]=100;a[(c[D>>2]|0)+4260+2312>>0]=10;c[(c[D>>2]|0)+4260+4164>>2]=0;c[(c[D>>2]|0)+4260+2376>>2]=1}T=R(c[(c[o>>2]|0)+12>>2]|0,c[(c[o>>2]|0)+4>>2]|0)|0;c[H>>2]=(T|0)<(R(c[(c[o>>2]|0)+8>>2]|0,c[c[o>>2]>>2]|0)|0)&1;if(c[H>>2]|0)X=1;else X=R(c[(c[o>>2]|0)+4>>2]|0,(c[(c[E>>2]|0)+2328>>2]|0)+2|0)|0;c[L>>2]=da()|0;T=l;l=l+((1*(X<<1)|0)+15&-16)|0;if(c[H>>2]|0){c[A>>2]=c[s>>2];Y=c[E>>2]|0;Z=c[s>>2]|0}else{c[A>>2]=T;Y=c[E>>2]|0;Z=T}c[A+4>>2]=Z+(c[Y+2328>>2]<<1)+4;if(!(c[p>>2]|0))c[F>>2]=((c[w>>2]|0)!=0^1)&1;else{if(c[(c[D>>2]|0)+8540>>2]|0)if((c[p>>2]|0)==2?(c[(c[o>>2]|0)+4>>2]|0)==2:0)_=(c[(c[E>>2]|0)+4260+2420+(c[(c[E>>2]|0)+4260+2388>>2]<<2)>>2]|0)==1;else _=0;else _=1;c[F>>2]=_&1}c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[o>>2]|0)+4>>2]|0))break;if((c[v>>2]|0)==0|(c[F>>2]|0)!=0){c[M>>2]=(c[(c[E>>2]|0)+2388>>2]|0)-(c[v>>2]|0);g:do if((c[M>>2]|0)<=0)c[N>>2]=0;else{if((c[p>>2]|0)==2){c[N>>2]=c[(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2420+((c[M>>2]|0)-1<<2)>>2]|0?2:0;break}do if((c[v>>2]|0)>0){if(!(c[(c[D>>2]|0)+8540>>2]|0))break;c[N>>2]=1;break g}while(0);c[N>>2]=2}while(0);_=Hc((c[E>>2]|0)+((c[v>>2]|0)*4260|0)|0,c[r>>2]|0,(c[A+(c[v>>2]<<2)>>2]|0)+4|0,y,c[p>>2]|0,c[N>>2]|0)|0;c[x>>2]=(c[x>>2]|0)+_}else He((c[A+(c[v>>2]<<2)>>2]|0)+4|0,0,c[y>>2]<<1|0)|0;_=(c[E>>2]|0)+((c[v>>2]|0)*4260|0)+2388|0;c[_>>2]=(c[_>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+1}if((c[c[o>>2]>>2]|0)==2?(c[(c[o>>2]|0)+4>>2]|0)==2:0)Cd((c[D>>2]|0)+8520|0,c[A>>2]|0,c[A+4>>2]|0,B,c[(c[E>>2]|0)+2316>>2]|0,c[y>>2]|0);else{B=c[A>>2]|0;N=(c[D>>2]|0)+8520+4|0;b[B>>1]=b[N>>1]|0;b[B+2>>1]=b[N+2>>1]|0;N=(c[D>>2]|0)+8520+4|0;B=(c[A>>2]|0)+(c[y>>2]<<1)|0;b[N>>1]=b[B>>1]|0;b[N+2>>1]=b[B+2>>1]|0}B=R(c[y>>2]|0,c[(c[o>>2]|0)+8>>2]|0)|0;c[c[t>>2]>>2]=(B|0)/(((c[(c[E>>2]|0)+2316>>2]&65535)<<16>>16)*1e3|0)|0;if((c[c[o>>2]>>2]|0)==2)$=c[c[t>>2]>>2]|0;else $=1;B=l;l=l+((1*($<<1)|0)+15&-16)|0;if((c[c[o>>2]>>2]|0)==2)c[C>>2]=B;else c[C>>2]=c[s>>2];if(c[H>>2]|0)aa=R(c[(c[o>>2]|0)+4>>2]|0,(c[(c[E>>2]|0)+2328>>2]|0)+2|0)|0;else aa=1;B=l;l=l+((1*(aa<<1)|0)+15&-16)|0;if(c[H>>2]|0){H=(R(c[(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==2){c[O>>2]=c[4358];c[O+4>>2]=c[4359];c[O+8>>2]=c[4360];s=R(c[(c[E>>2]|0)+2308>>2]|0,c[O+((c[(c[E>>2]|0)+2316>>2]|0)-8>>2<<2)>>2]|0)|0;ba=s;ca=c[o>>2]|0}else{ba=0;ca=c[o>>2]|0}c[ca+20>>2]=ba;j:do if((c[p>>2]|0)==1){c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[(c[D>>2]|0)+8536>>2]|0))break j;a[(c[D>>2]|0)+((c[u>>2]|0)*4260|0)+2312>>0]=10;c[u>>2]=(c[u>>2]|0)+1}}else c[(c[D>>2]|0)+8540>>2]=c[w>>2];while(0);c[m>>2]=c[x>>2];ga(c[L>>2]|0);U=c[m>>2]|0;l=k;return U|0}c[x>>2]=-200;c[m>>2]=c[x>>2];U=c[m>>2]|0;l=k;return U|0}function Ad(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+48|0;f=e+40|0;g=e+36|0;h=e+32|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=d;c[h>>2]=bc(c[f>>2]|0,22674,8)|0;c[i+8>>2]=(c[h>>2]|0)/5|0;c[i+12+8>>2]=(c[h>>2]|0)-((c[i+8>>2]|0)*5|0);c[h>>2]=0;while(1){if((c[h>>2]|0)>=2)break;d=bc(c[f>>2]|0,22727,8)|0;c[i+((c[h>>2]|0)*12|0)>>2]=d;d=bc(c[f>>2]|0,22734,8)|0;c[i+((c[h>>2]|0)*12|0)+4>>2]=d;c[h>>2]=(c[h>>2]|0)+1}c[h>>2]=0;while(1){if((c[h>>2]|0)>=2)break;f=i+((c[h>>2]|0)*12|0)|0;c[f>>2]=(c[f>>2]|0)+((c[i+((c[h>>2]|0)*12|0)+8>>2]|0)*3|0);c[j>>2]=b[17744+(c[i+((c[h>>2]|0)*12|0)>>2]<<1)>>1];c[k>>2]=(((b[17744+((c[i+((c[h>>2]|0)*12|0)>>2]|0)+1<<1)>>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;b[g+2>>1]=b[h+2>>1]|0;c[w>>2]=b[c[j>>2]>>1];c[x>>2]=b[(c[j>>2]|0)+2>>1];c[r>>2]=65536/(c[o>>2]<<3|0)|0;c[s>>2]=((R(((c[c[n>>2]>>2]|0)-(b[c[j>>2]>>1]|0)&65535)<<16>>16,(c[r>>2]&65535)<<16>>16)|0)>>15)+1>>1;c[t>>2]=((R(((c[(c[n>>2]|0)+4>>2]|0)-(b[(c[j>>2]|0)+2>>1]|0)&65535)<<16>>16,(c[r>>2]&65535)<<16>>16)|0)>>15)+1>>1;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[o>>2]<<3|0))break;c[w>>2]=(c[w>>2]|0)+(c[s>>2]|0);c[x>>2]=(c[x>>2]|0)+(c[t>>2]|0);c[u>>2]=(b[(c[k>>2]|0)+(c[q>>2]<<1)>>1]|0)+(b[(c[k>>2]|0)+((c[q>>2]|0)+2<<1)>>1]|0)+(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<1)<<9;r=R(c[u>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;c[u>>2]=(b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<8)+(r+((R(c[u>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16));r=R(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<11>>16,(c[x>>2]&65535)<<16>>16)|0;c[u>>2]=(c[u>>2]|0)+(r+((R(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<11&65535,(c[x>>2]&65535)<<16>>16)|0)>>16));if(((c[u>>2]>>7)+1>>1|0)<=32767)if(((c[u>>2]>>7)+1>>1|0)<-32768)y=-32768;else y=(c[u>>2]>>7)+1>>1;else y=32767;b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]=y;c[q>>2]=(c[q>>2]|0)+1}c[w>>2]=c[c[n>>2]>>2];c[x>>2]=c[(c[n>>2]|0)+4>>2];c[q>>2]=c[o>>2]<<3;while(1){if((c[q>>2]|0)>=(c[p>>2]|0))break;c[u>>2]=(b[(c[k>>2]|0)+(c[q>>2]<<1)>>1]|0)+(b[(c[k>>2]|0)+((c[q>>2]|0)+2<<1)>>1]|0)+(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<1)<<9;o=R(c[u>>2]>>16,(c[w>>2]&65535)<<16>>16)|0;c[u>>2]=(b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<8)+(o+((R(c[u>>2]&65535,(c[w>>2]&65535)<<16>>16)|0)>>16));o=R(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<11>>16,(c[x>>2]&65535)<<16>>16)|0;c[u>>2]=(c[u>>2]|0)+(o+((R(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]<<11&65535,(c[x>>2]&65535)<<16>>16)|0)>>16));if(((c[u>>2]>>7)+1>>1|0)<=32767)if(((c[u>>2]>>7)+1>>1|0)<-32768)z=-32768;else z=(c[u>>2]>>7)+1>>1;else z=32767;b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]=z;c[q>>2]=(c[q>>2]|0)+1}b[c[j>>2]>>1]=c[c[n>>2]>>2];b[(c[j>>2]|0)+2>>1]=c[(c[n>>2]|0)+4>>2];c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[p>>2]|0))break;c[u>>2]=(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]|0)+(b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]|0);c[v>>2]=(b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]|0)-(b[(c[m>>2]|0)+((c[q>>2]|0)+1<<1)>>1]|0);if((c[u>>2]|0)>32767)A=32767;else A=(c[u>>2]|0)<-32768?-32768:c[u>>2]|0;b[(c[k>>2]|0)+((c[q>>2]|0)+1<<1)>>1]=A;if((c[v>>2]|0)>32767)B=32767;else B=(c[v>>2]|0)<-32768?-32768:c[v>>2]|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)>>16));o=R(c[(c[u>>2]|0)+60>>2]>>16,b[(c[w>>2]|0)+4>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+60>>2]&65535,b[(c[w>>2]|0)+4>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+56>>2]>>16,b[(c[w>>2]|0)+6>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+56>>2]&65535,b[(c[w>>2]|0)+6>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+52>>2]>>16,b[(c[w>>2]|0)+8>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+52>>2]&65535,b[(c[w>>2]|0)+8>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+48>>2]>>16,b[(c[w>>2]|0)+10>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+48>>2]&65535,b[(c[w>>2]|0)+10>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+44>>2]>>16,b[(c[w>>2]|0)+12>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+44>>2]&65535,b[(c[w>>2]|0)+12>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+40>>2]>>16,b[(c[w>>2]|0)+14>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+40>>2]&65535,b[(c[w>>2]|0)+14>>1]|0)|0)>>16));o=R(c[(c[u>>2]|0)+36>>2]>>16,b[(c[w>>2]|0)+16>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(o+((R(c[(c[u>>2]|0)+36>>2]&65535,b[(c[w>>2]|0)+16>>1]|0)|0)>>16));if(((c[t>>2]>>5)+1>>1|0)<=32767)if(((c[t>>2]>>5)+1>>1|0)<-32768)x=-32768;else x=(c[t>>2]>>5)+1>>1;else x=32767;o=c[k>>2]|0;c[k>>2]=o+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(x+((R((c[(c[u>>2]|0)+40>>2]|0)+(c[(c[u>>2]|0)+52>>2]|0)&65535,b[(c[n>>2]|0)+20>>1]|0)|0)>>16));x=R((c[(c[u>>2]|0)+44>>2]|0)+(c[(c[u>>2]|0)+48>>2]|0)>>16,b[(c[n>>2]|0)+22>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(x+((R((c[(c[u>>2]|0)+44>>2]|0)+(c[(c[u>>2]|0)+48>>2]|0)&65535,b[(c[n>>2]|0)+22>>1]|0)|0)>>16));if(((c[t>>2]>>5)+1>>1|0)<=32767)if(((c[t>>2]>>5)+1>>1|0)<-32768)z=-32768;else z=(c[t>>2]>>5)+1>>1;else z=32767;x=c[k>>2]|0;c[k>>2]=x+2;b[x>>1]=z;c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0)}y=c[k>>2]|0;l=j;return y|0}case 36:{c[s>>2]=0;while(1){if((c[s>>2]|0)>=(c[q>>2]|0))break;c[u>>2]=(c[m>>2]|0)+(c[s>>2]>>16<<2);z=R((c[c[u>>2]>>2]|0)+(c[(c[u>>2]|0)+140>>2]|0)>>16,b[c[n>>2]>>1]|0)|0;c[t>>2]=z+((R((c[c[u>>2]>>2]|0)+(c[(c[u>>2]|0)+140>>2]|0)&65535,b[c[n>>2]>>1]|0)|0)>>16);z=R((c[(c[u>>2]|0)+4>>2]|0)+(c[(c[u>>2]|0)+136>>2]|0)>>16,b[(c[n>>2]|0)+2>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+4>>2]|0)+(c[(c[u>>2]|0)+136>>2]|0)&65535,b[(c[n>>2]|0)+2>>1]|0)|0)>>16));z=R((c[(c[u>>2]|0)+8>>2]|0)+(c[(c[u>>2]|0)+132>>2]|0)>>16,b[(c[n>>2]|0)+4>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+8>>2]|0)+(c[(c[u>>2]|0)+132>>2]|0)&65535,b[(c[n>>2]|0)+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u>>2]|0)+56>>2]|0)+(c[(c[u>>2]|0)+84>>2]|0)>>16,b[(c[n>>2]|0)+28>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+56>>2]|0)+(c[(c[u>>2]|0)+84>>2]|0)&65535,b[(c[n>>2]|0)+28>>1]|0)|0)>>16));z=R((c[(c[u>>2]|0)+60>>2]|0)+(c[(c[u>>2]|0)+80>>2]|0)>>16,b[(c[n>>2]|0)+30>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+60>>2]|0)+(c[(c[u>>2]|0)+80>>2]|0)&65535,b[(c[n>>2]|0)+30>>1]|0)|0)>>16));z=R((c[(c[u>>2]|0)+64>>2]|0)+(c[(c[u>>2]|0)+76>>2]|0)>>16,b[(c[n>>2]|0)+32>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+64>>2]|0)+(c[(c[u>>2]|0)+76>>2]|0)&65535,b[(c[n>>2]|0)+32>>1]|0)|0)>>16));z=R((c[(c[u>>2]|0)+68>>2]|0)+(c[(c[u>>2]|0)+72>>2]|0)>>16,b[(c[n>>2]|0)+34>>1]|0)|0;c[t>>2]=(c[t>>2]|0)+(z+((R((c[(c[u>>2]|0)+68>>2]|0)+(c[(c[u>>2]|0)+72>>2]|0)&65535,b[(c[n>>2]|0)+34>>1]|0)|0)>>16));if(((c[t>>2]>>5)+1>>1|0)<=32767)if(((c[t>>2]>>5)+1>>1|0)<-32768)A=-32768;else A=(c[t>>2]>>5)+1>>1;else A=32767;z=c[k>>2]|0;c[k>>2]=z+2;b[z>>1]=A;c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0)}y=c[k>>2]|0;l=j;return y|0}default:{y=c[k>>2]|0;l=j;return y|0}}return 0}function Jd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=l;l=l+48|0;h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;m=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[h>>2]=a;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[k>>2]|0))break;c[n>>2]=b[(c[j>>2]|0)+(c[m>>2]<<1)>>1]<<10;c[q>>2]=(c[n>>2]|0)-(c[c[h>>2]>>2]|0);f=R(c[q>>2]>>16,b[10257]|0)|0;c[r>>2]=f+((R(c[q>>2]&65535,b[10257]|0)|0)>>16);c[o>>2]=(c[c[h>>2]>>2]|0)+(c[r>>2]|0);c[c[h>>2]>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[o>>2]|0)-(c[(c[h>>2]|0)+4>>2]|0);f=R(c[q>>2]>>16,b[10258]|0)|0;c[r>>2]=f+((R(c[q>>2]&65535,b[10258]|0)|0)>>16);c[p>>2]=(c[(c[h>>2]|0)+4>>2]|0)+(c[r>>2]|0);c[(c[h>>2]|0)+4>>2]=(c[o>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[p>>2]|0)-(c[(c[h>>2]|0)+8>>2]|0);f=R(c[q>>2]>>16,b[10259]|0)|0;c[r>>2]=(c[q>>2]|0)+(f+((R(c[q>>2]&65535,b[10259]|0)|0)>>16));c[o>>2]=(c[(c[h>>2]|0)+8>>2]|0)+(c[r>>2]|0);c[(c[h>>2]|0)+8>>2]=(c[p>>2]|0)+(c[r>>2]|0);if(((c[o>>2]>>9)+1>>1|0)<=32767)if(((c[o>>2]>>9)+1>>1|0)<-32768)s=-32768;else s=(c[o>>2]>>9)+1>>1;else s=32767;b[(c[i>>2]|0)+(c[m>>2]<<1<<1)>>1]=s;c[q>>2]=(c[n>>2]|0)-(c[(c[h>>2]|0)+12>>2]|0);f=R(c[q>>2]>>16,b[10260]|0)|0;c[r>>2]=f+((R(c[q>>2]&65535,b[10260]|0)|0)>>16);c[o>>2]=(c[(c[h>>2]|0)+12>>2]|0)+(c[r>>2]|0);c[(c[h>>2]|0)+12>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[o>>2]|0)-(c[(c[h>>2]|0)+16>>2]|0);f=R(c[q>>2]>>16,b[10261]|0)|0;c[r>>2]=f+((R(c[q>>2]&65535,b[10261]|0)|0)>>16);c[p>>2]=(c[(c[h>>2]|0)+16>>2]|0)+(c[r>>2]|0);c[(c[h>>2]|0)+16>>2]=(c[o>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[p>>2]|0)-(c[(c[h>>2]|0)+20>>2]|0);f=R(c[q>>2]>>16,b[10262]|0)|0;c[r>>2]=(c[q>>2]|0)+(f+((R(c[q>>2]&65535,b[10262]|0)|0)>>16));c[o>>2]=(c[(c[h>>2]|0)+20>>2]|0)+(c[r>>2]|0);c[(c[h>>2]|0)+20>>2]=(c[p>>2]|0)+(c[r>>2]|0);if(((c[o>>2]>>9)+1>>1|0)<=32767)if(((c[o>>2]>>9)+1>>1|0)<-32768)t=-32768;else t=(c[o>>2]>>9)+1>>1;else t=32767;b[(c[i>>2]|0)+((c[m>>2]<<1)+1<<1)>>1]=t;c[m>>2]=(c[m>>2]|0)+1}l=g;return}function Kd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;m=g+12|0;n=g+8|0;o=g+4|0;p=g;c[h>>2]=a;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break;c[p>>2]=(((c[m>>2]&65535)>>16)*12|0)+((c[m>>2]&65535)*12>>16);c[o>>2]=(c[i>>2]|0)+(c[m>>2]>>16<<1);c[n>>2]=R(b[c[o>>2]>>1]|0,b[18294+(c[p>>2]<<3)>>1]|0)|0;c[n>>2]=(c[n>>2]|0)+(R(b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>>2]|0)<1|(c[i>>2]|0)<1)^1)&(c[h>>2]|0)!=0&(c[k>>2]|0)!=0)){l=f;return}c[n>>2]=0;while(1){if((c[n>>2]|0)>=(R(c[i>>2]|0,c[j>>2]|0)|0))break;if(2.0<+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2])z=2.0;else z=+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2];if(!(-2.0>z))if(2.0<+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2])A=2.0;else A=+g[(c[h>>2]|0)+(c[n>>2]<<2)>>2];else A=-2.0;g[(c[h>>2]|0)+(c[n>>2]<<2)>>2]=A;c[n>>2]=(c[n>>2]|0)+1}c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0))break;c[o>>2]=(c[h>>2]|0)+(c[m>>2]<<2);g[p>>2]=+g[(c[k>>2]|0)+(c[m>>2]<<2)>>2];c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[i>>2]|0))break;A=+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2];if(A*+g[p>>2]>=0.0)break;A=+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2];z=+g[p>>2]*+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2];B=A+z*+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2];g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2]=B;c[n>>2]=(c[n>>2]|0)+1}c[r>>2]=0;g[q>>2]=+g[c[o>>2]>>2];do{c[v>>2]=0;c[n>>2]=c[r>>2];while(1){if((c[n>>2]|0)>=(c[i>>2]|0))break;if(+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2]>1.0)break;if(+g[(c[o>>2]|0)+((R(c[n>>2]|0,c[j>>2]|0)|0)<<2)>>2]<-1.0)break;c[n>>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]>>0]|0;if((b&96|0)==96){c[h>>2]=(c[g>>2]|0)/((a&8|0?50:100)|0)|0;i=c[h>>2]|0;l=e;return i|0}c[h>>2]=a>>3&3;a=c[g>>2]|0;if((c[h>>2]|0)==3){c[h>>2]=(a*60|0)/1e3|0;i=c[h>>2]|0;l=e;return i|0}else{c[h>>2]=(a<>2]|0)/100|0;i=c[h>>2]|0;l=e;return i|0}return 0}function Nd(e,f,g,h,i,j,k,m){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;n=l;l=l+80|0;o=n+72|0;p=n+68|0;q=n+64|0;r=n+60|0;s=n+56|0;t=n+52|0;u=n+48|0;v=n+44|0;w=n+40|0;x=n+36|0;y=n+32|0;z=n+28|0;A=n+24|0;B=n+77|0;C=n+76|0;D=n+20|0;E=n+16|0;F=n+12|0;G=n+8|0;H=n+4|0;I=n;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[t>>2]=i;c[u>>2]=j;c[v>>2]=k;c[w>>2]=m;c[F>>2]=0;c[G>>2]=c[p>>2];if(!(c[u>>2]|0)){c[o>>2]=-1;J=c[o>>2]|0;l=n;return J|0}c[D>>2]=Md(c[p>>2]|0,48e3)|0;c[A>>2]=0;m=c[p>>2]|0;c[p>>2]=m+1;a[C>>0]=a[m>>0]|0;c[q>>2]=(c[q>>2]|0)+-1;c[E>>2]=c[q>>2];a:do switch(d[C>>0]&3|0){case 0:{c[z>>2]=1;break}case 1:{c[z>>2]=2;c[A>>2]=1;if(!(c[r>>2]|0)){if(!(c[q>>2]&1)){c[E>>2]=(c[q>>2]|0)/2|0;b[c[u>>2]>>1]=c[E>>2];break a}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}break}case 2:{c[z>>2]=2;c[y>>2]=Od(c[p>>2]|0,c[q>>2]|0,c[u>>2]|0)|0;c[q>>2]=(c[q>>2]|0)-(c[y>>2]|0);if((b[c[u>>2]>>1]|0)>=0?(b[c[u>>2]>>1]|0)<=(c[q>>2]|0):0){c[p>>2]=(c[p>>2]|0)+(c[y>>2]|0);c[E>>2]=(c[q>>2]|0)-(b[c[u>>2]>>1]|0);break a}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}default:{if((c[q>>2]|0)<1){c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}m=c[p>>2]|0;c[p>>2]=m+1;a[B>>0]=a[m>>0]|0;c[z>>2]=d[B>>0]&63;if((c[z>>2]|0)>0?(R(c[D>>2]|0,c[z>>2]|0)|0)<=5760:0){c[q>>2]=(c[q>>2]|0)+-1;b:do if(d[B>>0]&64|0){while(1){if((c[q>>2]|0)<=0)break;m=c[p>>2]|0;c[p>>2]=m+1;c[H>>2]=d[m>>0];c[q>>2]=(c[q>>2]|0)+-1;c[I>>2]=(c[H>>2]|0)==255?254:c[H>>2]|0;c[q>>2]=(c[q>>2]|0)-(c[I>>2]|0);c[F>>2]=(c[F>>2]|0)+(c[I>>2]|0);if((c[H>>2]|0)!=255)break b}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}while(0);if((c[q>>2]|0)<0){c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}c[A>>2]=((d[B>>0]&128|0)!=0^1)&1;if(c[A>>2]|0){if(c[r>>2]|0)break a;c[E>>2]=(c[q>>2]|0)/(c[z>>2]|0)|0;m=R(c[E>>2]|0,c[z>>2]|0)|0;if((m|0)!=(c[q>>2]|0)){c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}c[x>>2]=0;while(1){if((c[x>>2]|0)>=((c[z>>2]|0)-1|0))break a;b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]=c[E>>2];c[x>>2]=(c[x>>2]|0)+1}}c[E>>2]=c[q>>2];c[x>>2]=0;while(1){if((c[x>>2]|0)>=((c[z>>2]|0)-1|0))break;c[y>>2]=Od(c[p>>2]|0,c[q>>2]|0,(c[u>>2]|0)+(c[x>>2]<<1)|0)|0;c[q>>2]=(c[q>>2]|0)-(c[y>>2]|0);if((b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]|0)<0){K=29;break}if((b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]|0)>(c[q>>2]|0)){K=29;break}c[p>>2]=(c[p>>2]|0)+(c[y>>2]|0);c[E>>2]=(c[E>>2]|0)-((c[y>>2]|0)+(b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]|0));c[x>>2]=(c[x>>2]|0)+1}if((K|0)==29){c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}if((c[E>>2]|0)>=0)break a;c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}}while(0);c:do if(c[r>>2]|0){c[y>>2]=Od(c[p>>2]|0,c[q>>2]|0,(c[u>>2]|0)+(c[z>>2]<<1)+-2|0)|0;c[q>>2]=(c[q>>2]|0)-(c[y>>2]|0);if((b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)>=0?(b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)<=(c[q>>2]|0):0){c[p>>2]=(c[p>>2]|0)+(c[y>>2]|0);if(!(c[A>>2]|0)){if(((c[y>>2]|0)+(b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0)|0)<=(c[E>>2]|0))break;c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}K=R(b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0,c[z>>2]|0)|0;if((K|0)>(c[q>>2]|0)){c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}c[x>>2]=0;while(1){if((c[x>>2]|0)>=((c[z>>2]|0)-1|0))break c;b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]=b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]|0;c[x>>2]=(c[x>>2]|0)+1}}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}else{if((c[E>>2]|0)<=1275){b[(c[u>>2]|0)+((c[z>>2]|0)-1<<1)>>1]=c[E>>2];break}c[o>>2]=-4;J=c[o>>2]|0;l=n;return J|0}while(0);if(c[v>>2]|0)c[c[v>>2]>>2]=(c[p>>2]|0)-(c[G>>2]|0);c[x>>2]=0;while(1){if((c[x>>2]|0)>=(c[z>>2]|0))break;if(c[t>>2]|0)c[(c[t>>2]|0)+(c[x>>2]<<2)>>2]=c[p>>2];c[p>>2]=(c[p>>2]|0)+(b[(c[u>>2]|0)+(c[x>>2]<<1)>>1]|0);c[x>>2]=(c[x>>2]|0)+1}if(c[w>>2]|0)c[c[w>>2]>>2]=(c[F>>2]|0)+((c[p>>2]|0)-(c[G>>2]|0));if(c[s>>2]|0)a[c[s>>2]>>0]=a[C>>0]|0;c[o>>2]=c[z>>2];J=c[o>>2]|0;l=n;return J|0}function Od(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0;g=l;l=l+16|0;h=g+12|0;i=g+8|0;j=g+4|0;k=g;c[i>>2]=a;c[j>>2]=e;c[k>>2]=f;if((c[j>>2]|0)<1){b[c[k>>2]>>1]=-1;c[h>>2]=-1;m=c[h>>2]|0;l=g;return m|0}if((d[c[i>>2]>>0]|0|0)<252){b[c[k>>2]>>1]=d[c[i>>2]>>0]|0;c[h>>2]=1;m=c[h>>2]|0;l=g;return m|0}if((c[j>>2]|0)<2){b[c[k>>2]>>1]=-1;c[h>>2]=-1;m=c[h>>2]|0;l=g;return m|0}else{b[c[k>>2]>>1]=((d[(c[i>>2]|0)+1>>0]|0)<<2)+(d[c[i>>2]>>0]|0);c[h>>2]=2;m=c[h>>2]|0;l=g;return m|0}return 0}function Pd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;d=b+16|0;e=b+12|0;f=b+8|0;g=b+4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0){c[o>>2]=-1;N=c[o>>2]|0;l=n;return N|0}if((c[r>>2]|0)==0|(c[q>>2]|0)==0){c[I>>2]=0;while(1){m=(c[s>>2]|0)+((R(c[I>>2]|0,c[(c[p>>2]|0)+8>>2]|0)|0)<<2)|0;c[J>>2]=Td(c[p>>2]|0,0,0,m,(c[t>>2]|0)-(c[I>>2]|0)|0,0)|0;O=c[J>>2]|0;if((c[J>>2]|0)<0){P=9;break}c[I>>2]=(c[I>>2]|0)+O;if((c[I>>2]|0)>=(c[t>>2]|0)){P=11;break}}if((P|0)==9){c[o>>2]=O;N=c[o>>2]|0;l=n;return N|0}else if((P|0)==11){Ud()|0;c[(c[p>>2]|0)+68>>2]=c[I>>2];c[o>>2]=c[I>>2];N=c[o>>2]|0;l=n;return N|0}}if((c[r>>2]|0)<0){c[o>>2]=-1;N=c[o>>2]|0;l=n;return N|0}c[F>>2]=Vd(c[q>>2]|0)|0;c[E>>2]=Wd(c[q>>2]|0)|0;c[D>>2]=Md(c[q>>2]|0,c[(c[p>>2]|0)+12>>2]|0)|0;c[G>>2]=Xd(c[q>>2]|0)|0;c[A>>2]=Nd(c[q>>2]|0,c[r>>2]|0,c[v>>2]|0,C,0,H,B,c[w>>2]|0)|0;if((c[A>>2]|0)<0){c[o>>2]=c[A>>2];N=c[o>>2]|0;l=n;return N|0}c[q>>2]=(c[q>>2]|0)+(c[B>>2]|0);if(c[u>>2]|0){if(!((c[F>>2]|0)==1002?1:(c[t>>2]|0)<(c[D>>2]|0))?(c[(c[p>>2]|0)+52>>2]|0)!=1002:0){c[K>>2]=c[(c[p>>2]|0)+68>>2];if((c[t>>2]|0)-(c[D>>2]|0)|0?(c[L>>2]=Sd(c[p>>2]|0,0,0,c[s>>2]|0,(c[t>>2]|0)-(c[D>>2]|0)|0,0,0,0,c[x>>2]|0)|0,(c[L>>2]|0)<0):0){c[(c[p>>2]|0)+68>>2]=c[K>>2];c[o>>2]=c[L>>2];N=c[o>>2]|0;l=n;return N|0}c[(c[p>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if(c[x>>2]|0)Ld(c[s>>2]|0,c[z>>2]|0,c[(c[p>>2]|0)+8>>2]|0,(c[p>>2]|0)+72|0);else{g[(c[p>>2]|0)+72+4>>2]=0.0;g[(c[p>>2]|0)+72>>2]=0.0}c[o>>2]=c[z>>2];N=c[o>>2]|0;l=n;return N|0}function Td(d,e,f,h,i,j){d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,ea=0,fa=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0;k=l;l=l+320|0;m=k+80|0;n=k+72|0;o=k+64|0;p=k+56|0;q=k+48|0;r=k+40|0;s=k+32|0;t=k+24|0;u=k+16|0;v=k+8|0;w=k;x=k+308|0;y=k+304|0;z=k+300|0;A=k+296|0;B=k+292|0;C=k+288|0;D=k+284|0;E=k+280|0;F=k+276|0;G=k+272|0;H=k+268|0;I=k+264|0;J=k+216|0;K=k+212|0;L=k+208|0;M=k+204|0;N=k+200|0;P=k+196|0;Q=k+192|0;S=k+188|0;T=k+184|0;U=k+180|0;V=k+176|0;W=k+172|0;X=k+168|0;Y=k+164|0;Z=k+160|0;_=k+156|0;$=k+152|0;aa=k+148|0;ba=k+144|0;ca=k+140|0;ea=k+136|0;fa=k+132|0;ha=k+128|0;ia=k+124|0;ja=k+120|0;ka=k+116|0;la=k+112|0;ma=k+108|0;na=k+104|0;oa=k+100|0;pa=k+96|0;qa=k+312|0;ra=k+92|0;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+8>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+(wa<<2);c[S>>2]=(c[S>>2]|0)-(c[ha>>2]|0);if((c[S>>2]|0)<=0){ya=22;break}}if((ya|0)==20){c[x>>2]=xa;ua=c[x>>2]|0;l=k;return ua|0}else if((ya|0)==22){c[x>>2]=c[C>>2];ua=c[x>>2]|0;l=k;return ua|0}}if((c[S>>2]|0)<(c[ba>>2]|0)){if((c[S>>2]|0)>(c[aa>>2]|0)){c[S>>2]=c[aa>>2];break}if(((c[T>>2]|0)!=1e3?(c[S>>2]|0)>(c[$>>2]|0):0)?(c[S>>2]|0)<(c[aa>>2]|0):0)c[S>>2]=c[$>>2]}}else{c[S>>2]=c[(c[y>>2]|0)+60>>2];c[T>>2]=c[(c[y>>2]|0)+52>>2];$b(J,c[z>>2]|0,c[A>>2]|0)}while(0);c[fa>>2]=0;c[M>>2]=1;c[N>>2]=1;do if(c[z>>2]|0?(c[(c[y>>2]|0)+56>>2]|0)>0:0){if(!(((c[T>>2]|0)==1002?(c[(c[y>>2]|0)+56>>2]|0)!=1002:0)?!(c[(c[y>>2]|0)+64>>2]|0):0)){if((c[T>>2]|0)==1002)break;if((c[(c[y>>2]|0)+56>>2]|0)!=1002)break}c[U>>2]=1;ya=R(c[$>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0;if((c[T>>2]|0)==1002){c[N>>2]=ya;break}else{c[M>>2]=ya;break}}while(0);ya=c[N>>2]|0;c[ia>>2]=da()|0;N=l;l=l+((1*(ya<<2)|0)+15&-16)|0;if((c[U>>2]|0)!=0&(c[T>>2]|0)==1002){c[P>>2]=N;Td(c[y>>2]|0,0,0,c[P>>2]|0,(c[$>>2]|0)<(c[S>>2]|0)?c[$>>2]|0:c[S>>2]|0,0)|0}a:do if((c[S>>2]|0)>(c[C>>2]|0)){c[x>>2]=-1;c[ja>>2]=1}else{c[C>>2]=c[S>>2];if((c[T>>2]|0)==1002|(c[fa>>2]|0)!=0)za=1;else za=R((c[aa>>2]|0)>(c[C>>2]|0)?c[aa>>2]|0:c[C>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0;c[L>>2]=za;N=l;l=l+((1*(c[L>>2]<<1)|0)+15&-16)|0;b:do if((c[T>>2]|0)!=1002){c[ma>>2]=N;if((c[(c[y>>2]|0)+56>>2]|0)==1002)yd(c[E>>2]|0)|0;if(10>(((c[S>>2]|0)*1e3|0)/(c[(c[y>>2]|0)+12>>2]|0)|0|0))Aa=10;else Aa=((c[S>>2]|0)*1e3|0)/(c[(c[y>>2]|0)+12>>2]|0)|0;c[(c[y>>2]|0)+16+16>>2]=Aa;if(c[z>>2]|0){c[(c[y>>2]|0)+16+4>>2]=c[(c[y>>2]|0)+44>>2];ya=c[y>>2]|0;if((c[T>>2]|0)==1e3){xa=c[y>>2]|0;if((c[ya+48>>2]|0)==1101){Ba=8e3;Ca=xa}else{ha=(c[xa+48>>2]|0)==1102;Ba=ha?12e3:16e3;Ca=ha?c[y>>2]|0:c[y>>2]|0}}else{Ba=16e3;Ca=ya}c[Ca+16+12>>2]=Ba}c[ka>>2]=(c[z>>2]|0)==0?1:c[D>>2]<<1;c[la>>2]=0;c:while(1){c[na>>2]=(c[la>>2]|0)==0&1;c[H>>2]=zd(c[E>>2]|0,(c[y>>2]|0)+16|0,c[ka>>2]|0,c[na>>2]|0,J,c[ma>>2]|0,K)|0;d:do if(c[H>>2]|0){if(!(c[ka>>2]|0))break c;c[K>>2]=c[C>>2];c[G>>2]=0;while(1){if((c[G>>2]|0)>=(R(c[C>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0))break d;b[(c[ma>>2]|0)+(c[G>>2]<<1)>>1]=0;c[G>>2]=(c[G>>2]|0)+1}}while(0);ya=R(c[K>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0;c[ma>>2]=(c[ma>>2]|0)+(ya<<1);c[la>>2]=(c[la>>2]|0)+(c[K>>2]|0);if((c[la>>2]|0)>=(c[C>>2]|0))break b}c[x>>2]=-3;c[ja>>2]=1;break a}while(0);c[V>>2]=0;if((c[D>>2]|0)==0&(c[T>>2]|0)!=1002&(c[z>>2]|0)!=0?(ya=(Yd(J)|0)+17|0,(ya+(((c[(c[y>>2]|0)+52>>2]|0)==1001&1)*20|0)|0)<=(c[A>>2]<<3|0)):0){if((c[T>>2]|0)==1001)c[W>>2]=Va(J,12)|0;else c[W>>2]=1;if(c[W>>2]|0){c[Y>>2]=Va(J,1)|0;if((c[T>>2]|0)==1001)Da=(Qa(J,256)|0)+2|0;else{ya=c[A>>2]|0;Da=ya-((Yd(J)|0)+7>>3)|0}c[X>>2]=Da;c[A>>2]=(c[A>>2]|0)-(c[X>>2]|0);ya=c[A>>2]<<3;if((ya|0)<(Yd(J)|0)){c[A>>2]=0;c[X>>2]=0;c[W>>2]=0}ya=J+4|0;c[ya>>2]=(c[ya>>2]|0)-(c[X>>2]|0)}}if((c[T>>2]|0)!=1002)c[V>>2]=17;c[oa>>2]=21;switch(c[(c[y>>2]|0)+48>>2]|0){case 1101:{c[oa>>2]=13;break}case 1103:case 1102:{c[oa>>2]=17;break}case 1104:{c[oa>>2]=19;break}case 1105:{c[oa>>2]=21;break}default:{}}ya=c[F>>2]|0;c[w>>2]=c[oa>>2];Xb(ya,10012,w)|0;ya=c[F>>2]|0;c[v>>2]=c[(c[y>>2]|0)+44>>2];Xb(ya,10008,v)|0;if(c[W>>2]|0){c[U>>2]=0;c[M>>2]=1}ya=l;l=l+((1*(c[M>>2]<<2)|0)+15&-16)|0;if((c[U>>2]|0)!=0&(c[T>>2]|0)!=1002){c[P>>2]=ya;Td(c[y>>2]|0,0,0,c[P>>2]|0,(c[$>>2]|0)<(c[S>>2]|0)?c[$>>2]|0:c[S>>2]|0,0)|0}if(c[W>>2]|0)Ea=R(c[$>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0;else Ea=1;c[Q>>2]=Ea;ya=l;l=l+((1*(c[Q>>2]<<2)|0)+15&-16)|0;if((c[W>>2]|0)!=0&(c[Y>>2]|0)!=0){ha=c[F>>2]|0;c[u>>2]=0;Xb(ha,10010,u)|0;Yb(c[F>>2]|0,(c[z>>2]|0)+(c[A>>2]|0)|0,c[X>>2]|0,ya,c[$>>2]|0,0,0)|0;ha=c[F>>2]|0;c[t>>2]=ea+(((ea-ea|0)/4|0)<<2);Xb(ha,4031,t)|0}ha=c[F>>2]|0;c[s>>2]=c[V>>2];Xb(ha,10010,s)|0;do if((c[T>>2]|0)==1e3){a[qa>>0]=a[25208]|0;a[qa+1>>0]=a[25209]|0;e:do if(!(c[fa>>2]|0)){c[G>>2]=0;while(1){if((c[G>>2]|0)>=(R(c[C>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0))break e;g[(c[B>>2]|0)+(c[G>>2]<<2)>>2]=0.0;c[G>>2]=(c[G>>2]|0)+1}}while(0);if((c[(c[y>>2]|0)+56>>2]|0)==1001){if((c[W>>2]|0)!=0&(c[Y>>2]|0)!=0?c[(c[y>>2]|0)+64>>2]|0:0)break;ha=c[F>>2]|0;c[q>>2]=0;Xb(ha,10010,q)|0;Yb(c[F>>2]|0,qa,2,c[B>>2]|0,c[_>>2]|0,0,c[fa>>2]|0)|0}}else{c[pa>>2]=(c[ba>>2]|0)<(c[C>>2]|0)?c[ba>>2]|0:c[C>>2]|0;do if((c[T>>2]|0)!=(c[(c[y>>2]|0)+56>>2]|0)){if((c[(c[y>>2]|0)+56>>2]|0)<=0)break;if(c[(c[y>>2]|0)+64>>2]|0)break;Xb(c[F>>2]|0,4028,r)|0}while(0);c[I>>2]=Yb(c[F>>2]|0,c[D>>2]|0?0:c[z>>2]|0,c[A>>2]|0,c[B>>2]|0,c[pa>>2]|0,J,c[fa>>2]|0)|0}while(0);f:do if(!((c[T>>2]|0)==1002|(c[fa>>2]|0)!=0)){c[G>>2]=0;while(1){if((c[G>>2]|0)>=(R(c[C>>2]|0,c[(c[y>>2]|0)+8>>2]|0)|0))break f;g[(c[B>>2]|0)+(c[G>>2]<<2)>>2]=+g[(c[B>>2]|0)+(c[G>>2]<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);if((c[A>>2]|0)<=1){Ga=c[y>>2]|0;Ha=0}else{Ga=c[y>>2]|0;Ha=c[J+28>>2]^c[ea>>2]}c[Ga+80>>2]=Ha;c[(c[y>>2]|0)+56>>2]=c[T>>2];if(c[W>>2]|0)Ia=(c[Y>>2]|0)!=0^1;else Ia=0;c[(c[y>>2]|0)+64>>2]=Ia&1;if((c[I>>2]|0)>=0)Ud()|0;c[x>>2]=(c[I>>2]|0)<0?c[I>>2]|0:c[S>>2]|0;c[ja>>2]=1}while(0);ga(c[ia>>2]|0);ua=c[x>>2]|0;l=k;return ua|0}function Ud(){return 0}function Vd(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;e=b+4|0;f=b;c[e>>2]=a;do if(!((d[c[e>>2]>>0]|0)&128|0))if(((d[c[e>>2]>>0]|0)&96|0)==96){c[f>>2]=1001;break}else{c[f>>2]=1e3;break}else c[f>>2]=1002;while(0);l=b;return c[f>>2]|0}function Wd(a){a=a|0;var b=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;e=b+4|0;f=b;c[e>>2]=a;a=d[c[e>>2]>>0]|0;if((d[c[e>>2]>>0]|0)&128|0){g=1102+(a>>5&3)|0;c[f>>2]=g;c[f>>2]=(c[f>>2]|0)==1102?1101:g;h=c[f>>2]|0;l=b;return h|0}g=d[c[e>>2]>>0]|0;if((a&96|0)==96){c[f>>2]=g&16|0?1105:1104;h=c[f>>2]|0;l=b;return h|0}else{c[f>>2]=1101+(g>>5&3);h=c[f>>2]|0;l=b;return h|0}return 0}function Xd(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;e=b;c[e>>2]=a;l=b;return ((d[c[e>>2]>>0]|0)&4|0?2:1)|0}function Yd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=(c[(c[d>>2]|0)+20>>2]|0)-(32-(U(c[(c[d>>2]|0)+28>>2]|0)|0))|0;l=b;return a|0}function Zd(a,b,d,e,f,h,i){a=a|0;b=b|0;d=d|0;e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0)>((c[i>>2]|0)*3|0)){c[f>>2]=-4;m=c[f>>2]|0;l=e;return m|0}else{c[f>>2]=c[j>>2];m=c[f>>2]|0;l=e;return m|0}return 0}function $d(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;do if((c[h>>2]|0)>=1){c[i>>2]=(d[c[g>>2]>>0]|0)&3;if(!(c[i>>2]|0)){c[f>>2]=1;break}if((c[i>>2]|0)!=3){c[f>>2]=2;break}if((c[h>>2]|0)<2){c[f>>2]=-4;break}else{c[f>>2]=(d[(c[g>>2]|0)+1>>0]|0)&63;break}}else c[f>>2]=-1;while(0);l=e;return c[f>>2]|0}function ae(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;e=l;l=l+112|0;f=e+8|0;g=e+108|0;h=e+104|0;i=e+100|0;j=e+96|0;k=e+80|0;m=e+72|0;n=e+68|0;o=e+64|0;p=e+60|0;q=e+56|0;r=e+52|0;s=e+48|0;t=e+44|0;u=e+40|0;v=e+36|0;w=e+32|0;x=e+28|0;y=e+24|0;z=e+20|0;A=e+16|0;B=e+12|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=0;c[m>>2]=(c[h>>2]|0)+(c[(c[h>>2]|0)+4>>2]|0);c[n>>2]=(c[h>>2]|0)+(c[c[h>>2]>>2]|0);c[k>>2]=d;a:do switch(c[i>>2]|0){case 4009:{d=(c[k>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[k>>2]=d+4;c[p>>2]=b;c[o>>2]=c[p>>2];if(c[o>>2]|0){c[c[o>>2]>>2]=c[(c[h>>2]|0)+48>>2];C=20}else C=21;break}case 4031:{b=(c[k>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[k>>2]=b+4;c[r>>2]=d;c[q>>2]=c[r>>2];if(c[q>>2]|0){c[c[q>>2]>>2]=c[(c[h>>2]|0)+80>>2];C=20}else C=21;break}case 4028:{He((c[h>>2]|0)+44|0,0,84-((c[h>>2]|0)+44-(c[h>>2]|0))|0)|0;Xb(c[n>>2]|0,4028,e)|0;yd(c[m>>2]|0)|0;c[(c[h>>2]|0)+44>>2]=c[(c[h>>2]|0)+8>>2];c[(c[h>>2]|0)+60>>2]=(c[(c[h>>2]|0)+12>>2]|0)/400|0;C=20;break}case 4029:{d=(c[k>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[k>>2]=d+4;c[t>>2]=b;c[s>>2]=c[t>>2];if(c[s>>2]|0){c[c[s>>2]>>2]=c[(c[h>>2]|0)+12>>2];C=20}else C=21;break}case 4033:{b=(c[k>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[k>>2]=b+4;c[v>>2]=d;c[u>>2]=c[v>>2];if(c[u>>2]|0)if((c[(c[h>>2]|0)+56>>2]|0)==1002){d=c[n>>2]|0;c[f>>2]=(c[u>>2]|0)+((((c[u>>2]|0)-(c[u>>2]|0)|0)/4|0)<<2);Xb(d,4033,f)|0;C=20;break a}else{c[c[u>>2]>>2]=c[(c[h>>2]|0)+16+20>>2];C=20;break a}else C=21;break}case 4045:{d=(c[k>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[k>>2]=d+4;c[x>>2]=b;c[w>>2]=c[x>>2];if(c[w>>2]|0){c[c[w>>2]>>2]=c[(c[h>>2]|0)+40>>2];C=20}else C=21;break}case 4034:{b=(c[k>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[k>>2]=b+4;c[z>>2]=d;c[y>>2]=c[z>>2];if((c[y>>2]|0)<-32768|(c[y>>2]|0)>32767)C=21;else{c[(c[h>>2]|0)+40>>2]=c[y>>2];C=20}break}case 4039:{d=(c[k>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[k>>2]=d+4;c[B>>2]=b;c[A>>2]=c[B>>2];if(c[A>>2]|0){c[c[A>>2]>>2]=c[(c[h>>2]|0)+68>>2];C=20}else C=21;break}default:{c[j>>2]=-5;C=20}}while(0);if((C|0)==20){c[g>>2]=c[j>>2];D=c[g>>2]|0;l=e;return D|0}else if((C|0)==21){c[g>>2]=-1;D=c[g>>2]|0;l=e;return D|0}return 0}function be(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[f>>2]=a;c[h>>2]=(c[(c[f>>2]|0)+4>>2]|0)+(c[(c[f>>2]|0)+8>>2]|0);if((c[h>>2]|0)>255){c[e>>2]=0;i=c[e>>2]|0;l=b;return i|0}c[g>>2]=0;while(1){if((c[g>>2]|0)>=(c[c[f>>2]>>2]|0)){j=9;break}if((d[(c[f>>2]|0)+12+(c[g>>2]|0)>>0]|0|0)>=(c[h>>2]|0)?(d[(c[f>>2]|0)+12+(c[g>>2]|0)>>0]|0|0)!=255:0){j=7;break}c[g>>2]=(c[g>>2]|0)+1}if((j|0)==7){c[e>>2]=0;i=c[e>>2]|0;l=b;return i|0}else if((j|0)==9){c[e>>2]=1;i=c[e>>2]|0;l=b;return i|0}return 0}function ce(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=(c[j>>2]|0)<0?0:(c[j>>2]|0)+1|0;while(1){if((c[k>>2]|0)>=(c[c[h>>2]>>2]|0)){m=6;break}n=c[k>>2]|0;if((d[(c[h>>2]|0)+12+(c[k>>2]|0)>>0]|0|0)==(c[i>>2]<<1|0)){m=4;break}c[k>>2]=n+1}if((m|0)==4){c[g>>2]=n;o=c[g>>2]|0;l=f;return o|0}else if((m|0)==6){c[g>>2]=-1;o=c[g>>2]|0;l=f;return o|0}return 0}function de(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=(c[j>>2]|0)<0?0:(c[j>>2]|0)+1|0;while(1){if((c[k>>2]|0)>=(c[c[h>>2]>>2]|0)){m=6;break}n=c[k>>2]|0;if((d[(c[h>>2]|0)+12+(c[k>>2]|0)>>0]|0|0)==((c[i>>2]<<1)+1|0)){m=4;break}c[k>>2]=n+1}if((m|0)==4){c[g>>2]=n;o=c[g>>2]|0;l=f;return o|0}else if((m|0)==6){c[g>>2]=-1;o=c[g>>2]|0;l=f;return o|0}return 0}function ee(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=(c[j>>2]|0)<0?0:(c[j>>2]|0)+1|0;while(1){if((c[k>>2]|0)>=(c[c[h>>2]>>2]|0)){m=6;break}n=c[k>>2]|0;if((d[(c[h>>2]|0)+12+(c[k>>2]|0)>>0]|0|0)==((c[i>>2]|0)+(c[(c[h>>2]|0)+8>>2]|0)|0)){m=4;break}c[k>>2]=n+1}if((m|0)==4){c[g>>2]=n;o=c[g>>2]|0;l=f;return o|0}else if((m|0)==6){c[g>>2]=-1;o=c[g>>2]|0;l=f;return o|0}return 0}function fe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;if((c[f>>2]|0)>=1?!((c[g>>2]|0)<0?1:(c[g>>2]|0)>(c[f>>2]|0)):0){c[h>>2]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[k>>2]|0)+8>>2]|0))break;c[u>>2]=Rd(c[v>>2]|0,c[m>>2]|0,2)|0;if(c[u>>2]|0){x=13;break}q=ge(c[r>>2]|0)|0;c[v>>2]=(c[v>>2]|0)+q;c[t>>2]=(c[t>>2]|0)+1}if((x|0)==13){c[j>>2]=c[u>>2];w=c[j>>2]|0;l=i;return w|0}while(1){if((c[t>>2]|0)>=(c[(c[k>>2]|0)+4>>2]|0)){x=19;break}c[u>>2]=Rd(c[v>>2]|0,c[m>>2]|0,1)|0;if(c[u>>2]|0){x=17;break}r=ge(c[s>>2]|0)|0;c[v>>2]=(c[v>>2]|0)+r;c[t>>2]=(c[t>>2]|0)+1}if((x|0)==17){c[j>>2]=c[u>>2];w=c[j>>2]|0;l=i;return w|0}else if((x|0)==19){c[j>>2]=0;w=c[j>>2]|0;l=i;return w|0}}c[j>>2]=-1;w=c[j>>2]|0;l=i;return w|0}function ie(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=l;l=l+48|0;i=h+32|0;j=h+28|0;k=h+24|0;m=h+20|0;n=h+16|0;o=h+12|0;p=h+8|0;q=h+4|0;r=h;c[j>>2]=a;c[k>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;if((!((c[k>>2]|0)>255|(c[k>>2]|0)<1)?(c[n>>2]|0)<=(c[m>>2]|0):0)?!(((c[m>>2]|0)<1?1:((c[n>>2]|0)+(c[m>>2]|0)|0)>255)|(c[n>>2]|0)<0):0){c[r>>2]=je(fe(c[m>>2]|0,c[n>>2]|0)|0)|0;if(!(c[r>>2]|0)){if(c[p>>2]|0)c[c[p>>2]>>2]=-7;c[i>>2]=0;s=c[i>>2]|0;l=h;return s|0}c[q>>2]=he(c[r>>2]|0,c[j>>2]|0,c[k>>2]|0,c[m>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;if(c[p>>2]|0)c[c[p>>2]>>2]=c[q>>2];if(c[q>>2]|0){ke(c[r>>2]|0);c[r>>2]=0}c[i>>2]=c[r>>2];s=c[i>>2]|0;l=h;return s|0}if(c[p>>2]|0)c[c[p>>2]>>2]=-1;c[i>>2]=0;s=c[i>>2]|0;l=h;return s|0}function je(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=Ce(c[d>>2]|0)|0;l=b;return a|0}function ke(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;De(c[d>>2]|0);l=b;return}function le(a,b,e,f,g,h,i,j){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;k=l;l=l+112|0;m=k;n=k+104|0;o=k+100|0;p=k+96|0;q=k+92|0;r=k+88|0;s=k+84|0;t=k+80|0;u=k+76|0;v=k+72|0;w=k+68|0;x=k+64|0;y=k+60|0;z=k+56|0;A=k+52|0;B=k+48|0;C=k+44|0;D=k+40|0;E=k+36|0;F=k+32|0;G=k+28|0;H=k+24|0;I=k+20|0;J=k+16|0;K=k+12|0;L=k+8|0;M=k+4|0;c[o>>2]=a;c[p>>2]=b;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=i;c[v>>2]=j;c[C>>2]=0;j=c[o>>2]|0;c[m>>2]=w+(((w-w|0)/4|0)<<2);me(j,4029,m)|0;if((c[t>>2]|0)<(((c[w>>2]|0)/25|0)*3|0))N=c[t>>2]|0;else N=((c[w>>2]|0)/25|0)*3|0;c[t>>2]=N;N=c[t>>2]<<1;c[D>>2]=da()|0;m=l;l=l+((1*(N<<2)|0)+15&-16)|0;N=c[o>>2]|0;c[B>>2]=N+(ge(268)|0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2]|0)|0;c[J>>2]=w;if((w|0)==-1)break;ia[c[s>>2]&1](c[r>>2]|0,c[c[o>>2]>>2]|0,c[J>>2]|0,m,2,c[t>>2]|0);c[K>>2]=c[J>>2]}c[K>>2]=-1;while(1){w=de(c[o>>2]|0,c[z>>2]|0,c[K>>2]|0)|0;c[J>>2]=w;if((w|0)==-1)break a;ia[c[s>>2]&1](c[r>>2]|0,c[c[o>>2]>>2]|0,c[J>>2]|0,m+4|0,2,c[t>>2]|0);c[K>>2]=c[J>>2]}}else{c[M>>2]=-1;while(1){w=ee(c[o>>2]|0,c[z>>2]|0,c[M>>2]|0)|0;c[L>>2]=w;if((w|0)==-1)break a;ia[c[s>>2]&1](c[r>>2]|0,c[c[o>>2]>>2]|0,c[L>>2]|0,m,1,c[t>>2]|0);c[M>>2]=c[L>>2]}}while(0);c[z>>2]=(c[z>>2]|0)+1}if((Q|0)==19){c[n>>2]=-3;c[E>>2]=1;O=c[D>>2]|0;ga(O|0);P=c[n>>2]|0;l=k;return P|0}else if((Q|0)==21){c[n>>2]=R;c[E>>2]=1;O=c[D>>2]|0;ga(O|0);P=c[n>>2]|0;l=k;return P|0}else if((Q|0)==33){c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[c[o>>2]>>2]|0))break;if((d[(c[o>>2]|0)+12+(c[A>>2]|0)>>0]|0|0)==255)ia[c[s>>2]&1](c[r>>2]|0,c[c[o>>2]>>2]|0,c[A>>2]|0,0,0,c[t>>2]|0);c[A>>2]=(c[A>>2]|0)+1}c[n>>2]=c[t>>2];c[E>>2]=1;O=c[D>>2]|0;ga(O|0);P=c[n>>2]|0;l=k;return P|0}return 0}function me(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;e=l;l=l+160|0;f=e+24|0;g=e+16|0;h=e+8|0;i=e;j=e+144|0;k=e+140|0;m=e+136|0;n=e+120|0;o=e+116|0;p=e+112|0;q=e+108|0;r=e+104|0;s=e+100|0;t=e+96|0;u=e+92|0;v=e+88|0;w=e+84|0;x=e+80|0;y=e+76|0;z=e+72|0;A=e+68|0;B=e+64|0;C=e+60|0;D=e+56|0;E=e+52|0;F=e+48|0;G=e+44|0;H=e+40|0;I=e+36|0;J=e+32|0;K=e+28|0;c[k>>2]=a;c[m>>2]=b;c[r>>2]=0;c[n>>2]=d;c[o>>2]=Pd(2)|0;c[p>>2]=Pd(1)|0;d=c[k>>2]|0;c[q>>2]=d+(ge(268)|0);a:do switch(c[m>>2]|0){case 4039:case 4045:case 4029:case 4009:{d=(c[n>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[n>>2]=d+4;c[u>>2]=b;c[t>>2]=c[u>>2];c[s>>2]=c[q>>2];b=c[s>>2]|0;d=c[m>>2]|0;c[i>>2]=c[t>>2];c[r>>2]=ae(b,d,i)|0;L=37;break}case 4031:{d=(c[n>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[n>>2]=d+4;c[x>>2]=b;c[w>>2]=c[x>>2];if(c[w>>2]|0){c[c[w>>2]>>2]=0;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[(c[k>>2]|0)+4>>2]|0)){L=37;break a}c[z>>2]=c[q>>2];if((c[v>>2]|0)<(c[(c[k>>2]|0)+8>>2]|0)){b=ge(c[o>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+b}else{b=ge(c[p>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+b}b=c[z>>2]|0;d=c[m>>2]|0;c[h>>2]=y;c[r>>2]=ae(b,d,h)|0;if(c[r>>2]|0){L=37;break a}d=c[w>>2]|0;c[d>>2]=c[d>>2]^c[y>>2];c[v>>2]=(c[v>>2]|0)+1}}else L=38;break}case 4028:{c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[(c[k>>2]|0)+4>>2]|0)){L=37;break a}c[B>>2]=c[q>>2];if((c[A>>2]|0)<(c[(c[k>>2]|0)+8>>2]|0)){d=ge(c[o>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+d}else{d=ge(c[p>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+d}c[r>>2]=ae(c[B>>2]|0,4028,g)|0;if(c[r>>2]|0){L=37;break a}c[A>>2]=(c[A>>2]|0)+1}break}case 5122:{d=(c[n>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[n>>2]=d+4;c[F>>2]=b;c[D>>2]=c[F>>2];if(!((c[D>>2]|0)>=0?(c[D>>2]|0)<(c[(c[k>>2]|0)+4>>2]|0):0))c[r>>2]=-1;b=(c[n>>2]|0)+(4-1)&~(4-1);d=c[b>>2]|0;c[n>>2]=b+4;c[G>>2]=d;c[E>>2]=c[G>>2];if(c[E>>2]|0){c[C>>2]=0;while(1){if((c[C>>2]|0)>=(c[D>>2]|0))break;if((c[C>>2]|0)<(c[(c[k>>2]|0)+8>>2]|0)){d=ge(c[o>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+d}else{d=ge(c[p>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+d}c[C>>2]=(c[C>>2]|0)+1}c[c[E>>2]>>2]=c[q>>2];L=37}else L=38;break}case 4034:{d=(c[n>>2]|0)+(4-1)&~(4-1);b=c[d>>2]|0;c[n>>2]=d+4;c[J>>2]=b;c[I>>2]=c[J>>2];c[H>>2]=0;while(1){if((c[H>>2]|0)>=(c[(c[k>>2]|0)+4>>2]|0)){L=37;break a}c[K>>2]=c[q>>2];if((c[H>>2]|0)<(c[(c[k>>2]|0)+8>>2]|0)){b=ge(c[o>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+b}else{b=ge(c[p>>2]|0)|0;c[q>>2]=(c[q>>2]|0)+b}b=c[K>>2]|0;d=c[m>>2]|0;c[f>>2]=c[I>>2];c[r>>2]=ae(b,d,f)|0;if(c[r>>2]|0){L=37;break a}c[H>>2]=(c[H>>2]|0)+1}break}default:{c[r>>2]=-5;L=37}}while(0);if((L|0)==37){c[j>>2]=c[r>>2];M=c[j>>2]|0;l=e;return M|0}else if((L|0)==38){c[j>>2]=-1;M=c[j>>2]|0;l=e;return M|0}return 0}function ne(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+144|0;g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;m=f+16|0;n=f+12|0;o=f+136|0;p=f+40|0;q=f+8|0;r=f+4|0;s=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[q>>2]=0;c[m>>2]=0;while(1){if((c[m>>2]|0)>=(c[j>>2]|0)){t=11;break}if((c[i>>2]|0)<=0){t=4;break}c[n>>2]=Nd(c[h>>2]|0,c[i>>2]|0,(c[m>>2]|0)!=((c[j>>2]|0)-1|0)&1,o,0,p,0,r)|0;if((c[n>>2]|0)<0){t=6;break}c[s>>2]=_d(c[h>>2]|0,c[r>>2]|0,c[k>>2]|0)|0;if(c[m>>2]|0?(c[q>>2]|0)!=(c[s>>2]|0):0){t=9;break}c[q>>2]=c[s>>2];c[h>>2]=(c[h>>2]|0)+(c[r>>2]|0);c[i>>2]=(c[i>>2]|0)-(c[r>>2]|0);c[m>>2]=(c[m>>2]|0)+1}if((t|0)==4){c[g>>2]=-4;u=c[g>>2]|0;l=f;return u|0}else if((t|0)==6){c[g>>2]=c[n>>2];u=c[g>>2]|0;l=f;return u|0}else if((t|0)==9){c[g>>2]=-4;u=c[g>>2]|0;l=f;return u|0}else if((t|0)==11){c[g>>2]=c[q>>2];u=c[g>>2]|0;l=f;return u|0}return 0}function oe(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0;h=l;l=l+32|0;i=h+20|0;j=h+16|0;k=h+12|0;m=h+8|0;n=h+4|0;o=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;g=le(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[m>>2]|0,1,c[n>>2]|0,c[o>>2]|0,0)|0;l=h;return g|0}function pe(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0;i=l;l=l+32|0;j=i+28|0;k=i+24|0;m=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[j>>2]=a;c[k>>2]=b;c[m>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=h;c[q>>2]=c[j>>2];j=(c[n>>2]|0)!=0;c[r>>2]=0;if(j){while(1){if((c[r>>2]|0)>=(c[p>>2]|0))break;s=+g[(c[n>>2]|0)+((R(c[r>>2]|0,c[o>>2]|0)|0)<<2)>>2];j=R(c[r>>2]|0,c[k>>2]|0)|0;g[(c[q>>2]|0)+(j+(c[m>>2]|0)<<2)>>2]=s;c[r>>2]=(c[r>>2]|0)+1}l=i;return}else{while(1){if((c[r>>2]|0)>=(c[p>>2]|0))break;o=R(c[r>>2]|0,c[k>>2]|0)|0;g[(c[q>>2]|0)+(o+(c[m>>2]|0)<<2)>>2]=0.0;c[r>>2]=(c[r>>2]|0)+1}l=i;return}}function qe(){return}function re(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,h=0,i=0.0;d=l;l=l+48|0;e=d+32|0;f=d;ue(f,a,b);switch(c[6305]|0){case 0:{b=we(f,25228,25232,25236,25240,25244)|0;c[6306]=b;if(!b){h=0;l=d;return h|0}c[6305]=1;i=+g[6310];if(i!=0.0){c[e>>2]=~~i;me(b,4034,e)|0}c[6305]=1;h=1;l=d;return h|0}case 1:{c[6305]=2;h=1;l=d;return h|0}default:{$(c[6308]|0,48e3);h=1;l=d;return h|0}}return 0}function se(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=Ce((c[6308]|0)*23040|0)|0;e=oe(c[6306]|0,a,b,d,5760,0)|0;if((e|0)<0){f=0;De(d);return f|0}b=c[6309]|0;if((e|0)>(b|0)){a=e-b|0;g=c[6308]|0;h=Ce(R(a<<2,g)|0)|0;i=Ce(g<<2)|0;if((g|0)>0){j=0;do{k=h+((R(j,a)|0)<<2)|0;c[i+(j<<2)>>2]=k;l=b;do{c[k+(l-b<<2)>>2]=c[d+((R(l,g)|0)+j<<2)>>2];l=l+1|0}while((l|0)!=(e|0));j=j+1|0}while((j|0)<(g|0))}ea(i|0,g|0,a|0);De(i);De(h);m=c[6309]|0;n=b}else{m=b;n=e}c[6309]=m-n;f=1;De(d);return f|0}function te(){return}function ue(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=b;c[a+4>>2]=d;d=a+8|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[d+20>>2]=0;return}function ve(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;g=l;l=l+16|0;h=g;a[h+8>>0]=0;if((e|0)<19){i=0;l=g;return i|0}j=b;k=j;m=j+4|0;j=d[m>>0]|d[m+1>>0]<<8|d[m+2>>0]<<16|d[m+3>>0]<<24;m=h;c[m>>2]=d[k>>0]|d[k+1>>0]<<8|d[k+2>>0]<<16|d[k+3>>0]<<24;c[m+4>>2]=j;if(Be(h,25210,8)|0){i=0;l=g;return i|0}h=e+-1|0;j=d[b+8>>0]|0;c[f>>2]=j;if(j&240|0){i=0;l=g;return i|0}m=a[b+9>>0]|0;k=f+4|0;c[k>>2]=m&255;if(!(m<<24>>24!=0&(e+-2|0)>9)){i=0;l=g;return i|0}c[f+8>>2]=(d[b+11>>0]|0)<<8|(d[b+10>>0]|0);n=f+12|0;if((e+-4|0)<12){i=0;l=g;return i|0}o=d[b+12>>0]|0;c[n>>2]=o;p=(d[b+13>>0]|0)<<8|o;c[n>>2]=p;o=(d[b+14>>0]|0)<<16|p;c[n>>2]=o;c[n>>2]=(d[b+15>>0]|0)<<24|o;c[f+16>>2]=((d[b+17>>0]|0)<<8|(d[b+16>>0]|0))<<16>>16;o=a[b+18>>0]|0;c[f+20>>2]=o&255;do if(!(o<<24>>24))if((m&255)>2){i=0;l=g;return i|0}else{c[f+24>>2]=1;c[f+28>>2]=m<<24>>24==2&1;a[f+32>>0]=0;a[f+33>>0]=1;q=j;r=19;break}else{if((h|0)<=18){i=0;l=g;return i|0}n=a[b+19>>0]|0;if(!(n<<24>>24)){i=0;l=g;return i|0}p=n&255;s=f+24|0;c[s>>2]=p;if((h|0)<=19){i=0;l=g;return i|0}t=a[b+20>>0]|0;u=t&255;if((t&255)>(n&255)|(u+p|0)>>>0>255){i=0;l=g;return i|0}p=f+28|0;c[p>>2]=u;u=0;n=21;while(1){if((n|0)>=(e|0)){i=0;v=19;break}t=a[b+n>>0]|0;a[f+32+u>>0]=t;n=n+1|0;u=u+1|0;if(!(t<<24>>24==-1?1:(t&255|0)<=((c[p>>2]|0)+(c[s>>2]|0)|0))){i=0;v=19;break}if((u|0)>=(c[k>>2]|0)){v=17;break}}if((v|0)==17){q=c[f>>2]|0;r=n;break}else if((v|0)==19){l=g;return i|0}}while(0);i=((r|0)==(e|0)|q>>>0>1)&1;l=g;return i|0}function we(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,m=0,n=0;i=l;l=l+304|0;j=i;k=i+296|0;m=i+8|0;if(!(ve(c[a>>2]|0,c[a+4>>2]|0,m)|0)){n=0;l=i;return n|0}c[b>>2]=c[m+20>>2];b=c[m+4>>2]|0;c[d>>2]=b;c[e>>2]=c[m+8>>2];e=m+24|0;d=ie(48e3,b,c[e>>2]|0,c[m+28>>2]|0,m+32|0,k)|0;if((d|0)==0|(c[k>>2]|0)!=0){n=0;l=i;return n|0}c[h>>2]=c[e>>2];e=m+16|0;m=c[e>>2]|0;a:do if(m|0){c[j>>2]=m;h=me(d,4034,j)|0;c[k>>2]=h;switch(h|0){case 0:{break a;break}case -5:{g[f>>2]=+G(10.0,+(+(c[e>>2]|0)/5120.0));break a;break}default:{n=0;l=i;return n|0}}}while(0);n=d;l=i;return n|0}function xe(){return 25248}function ye(){return (ze()|0)+64|0}function ze(){return Ae()|0}function Ae(){return 17444}function Be(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=b;g=d;h=c;while(1){i=a[f>>0]|0;j=a[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0} +function Ce(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0;b=l;l=l+16|0;d=b;do if(a>>>0<245){e=a>>>0<11?16:a+11&-8;f=e>>>3;g=c[6328]|0;h=g>>>f;if(h&3|0){i=(h&1^1)+f|0;j=25352+(i<<1<<2)|0;k=j+8|0;m=c[k>>2]|0;n=m+8|0;o=c[n>>2]|0;do if((j|0)!=(o|0)){if(o>>>0<(c[6332]|0)>>>0)ba();p=o+12|0;if((c[p>>2]|0)==(m|0)){c[p>>2]=j;c[k>>2]=o;break}else ba()}else c[6328]=g&~(1<>2]=o|3;k=m+o+4|0;c[k>>2]=c[k>>2]|1;q=n;l=b;return q|0}k=c[6330]|0;if(e>>>0>k>>>0){if(h|0){o=2<>>12&16;p=o>>>j;o=p>>>5&8;r=p>>>o;p=r>>>2&4;s=r>>>p;r=s>>>1&2;t=s>>>r;s=t>>>1&1;u=(o|j|p|r|s)+(t>>>s)|0;s=25352+(u<<1<<2)|0;t=s+8|0;r=c[t>>2]|0;p=r+8|0;j=c[p>>2]|0;do if((s|0)!=(j|0)){if(j>>>0<(c[6332]|0)>>>0)ba();o=j+12|0;if((c[o>>2]|0)==(r|0)){c[o>>2]=s;c[t>>2]=j;v=g;break}else ba()}else{o=g&~(1<>2]=e|3;t=r+e|0;c[t+4>>2]=j|1;c[t+j>>2]=j;if(k|0){s=c[6333]|0;f=k>>>3;h=25352+(f<<1<<2)|0;n=1<>2]|0;if(m>>>0<(c[6332]|0)>>>0)ba();else{w=f;x=m}}else{c[6328]=v|n;w=h+8|0;x=h}c[w>>2]=s;c[x+12>>2]=s;c[s+8>>2]=x;c[s+12>>2]=h}c[6330]=j;c[6333]=t;q=p;l=b;return q|0}t=c[6329]|0;if(t){j=(t&0-t)+-1|0;h=j>>>12&16;s=j>>>h;j=s>>>5&8;n=s>>>j;s=n>>>2&4;m=n>>>s;n=m>>>1&2;f=m>>>n;m=f>>>1&1;i=c[25616+((j|h|s|n|m)+(f>>>m)<<2)>>2]|0;m=(c[i+4>>2]&-8)-e|0;f=c[i+16+(((c[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!f){y=m;z=i}else{n=f;f=m;m=i;while(1){i=(c[n+4>>2]&-8)-e|0;s=i>>>0>>0;h=s?i:f;i=s?n:m;n=c[n+16+(((c[n+16>>2]|0)==0&1)<<2)>>2]|0;if(!n){y=h;z=i;break}else{f=h;m=i}}}m=c[6332]|0;if(z>>>0>>0)ba();f=z+e|0;if(z>>>0>=f>>>0)ba();n=c[z+24>>2]|0;p=c[z+12>>2]|0;do if((p|0)==(z|0)){r=z+20|0;u=c[r>>2]|0;if(!u){i=z+16|0;h=c[i>>2]|0;if(!h){A=0;break}else{B=h;C=i}}else{B=u;C=r}while(1){r=B+20|0;u=c[r>>2]|0;if(u|0){B=u;C=r;continue}r=B+16|0;u=c[r>>2]|0;if(!u)break;else{B=u;C=r}}if(C>>>0>>0)ba();else{c[C>>2]=0;A=B;break}}else{r=c[z+8>>2]|0;if(r>>>0>>0)ba();u=r+12|0;if((c[u>>2]|0)!=(z|0))ba();i=p+8|0;if((c[i>>2]|0)==(z|0)){c[u>>2]=p;c[i>>2]=r;A=p;break}else ba()}while(0);a:do if(n|0){p=c[z+28>>2]|0;m=25616+(p<<2)|0;do if((z|0)==(c[m>>2]|0)){c[m>>2]=A;if(!A){c[6329]=t&~(1<>>0>=(c[6332]|0)>>>0){c[n+16+(((c[n+16>>2]|0)!=(z|0)&1)<<2)>>2]=A;if(!A)break a;else break}else ba();while(0);p=c[6332]|0;if(A>>>0

>>0)ba();c[A+24>>2]=n;m=c[z+16>>2]|0;do if(m|0)if(m>>>0

>>0)ba();else{c[A+16>>2]=m;c[m+24>>2]=A;break}while(0);m=c[z+20>>2]|0;if(m|0)if(m>>>0<(c[6332]|0)>>>0)ba();else{c[A+20>>2]=m;c[m+24>>2]=A;break}}while(0);if(y>>>0<16){n=y+e|0;c[z+4>>2]=n|3;t=z+n+4|0;c[t>>2]=c[t>>2]|1}else{c[z+4>>2]=e|3;c[f+4>>2]=y|1;c[f+y>>2]=y;if(k|0){t=c[6333]|0;n=k>>>3;m=25352+(n<<1<<2)|0;p=1<>2]|0;if(r>>>0<(c[6332]|0)>>>0)ba();else{D=n;E=r}}else{c[6328]=g|p;D=m+8|0;E=m}c[D>>2]=t;c[E+12>>2]=t;c[t+8>>2]=E;c[t+12>>2]=m}c[6330]=y;c[6333]=f}q=z+8|0;l=b;return q|0}else F=e}else F=e}else if(a>>>0<=4294967231){m=a+11|0;t=m&-8;p=c[6329]|0;if(p){r=0-t|0;n=m>>>8;if(n)if(t>>>0>16777215)G=31;else{m=(n+1048320|0)>>>16&8;i=n<>>16&4;u=i<>>16&2;h=14-(n|m|i)+(u<>>15)|0;G=t>>>(h+7|0)&1|h<<1}else G=0;h=c[25616+(G<<2)>>2]|0;b:do if(!h){H=r;I=0;J=0;K=81}else{i=r;u=0;m=t<<((G|0)==31?0:25-(G>>>1)|0);n=h;s=0;while(1){j=(c[n+4>>2]&-8)-t|0;if(j>>>0>>0)if(!j){L=0;M=n;N=n;K=85;break b}else{O=j;P=n}else{O=i;P=s}j=c[n+20>>2]|0;n=c[n+16+(m>>>31<<2)>>2]|0;o=(j|0)==0|(j|0)==(n|0)?u:j;j=(n|0)==0;if(j){H=O;I=o;J=P;K=81;break}else{i=O;u=o;m=m<<((j^1)&1);s=P}}}while(0);if((K|0)==81){if((I|0)==0&(J|0)==0){h=2<>>12&16;e=h>>>r;h=e>>>5&8;f=e>>>h;e=f>>>2&4;g=f>>>e;f=g>>>1&2;k=g>>>f;g=k>>>1&1;Q=c[25616+((h|r|e|f|g)+(k>>>g)<<2)>>2]|0;R=0}else{Q=I;R=J}if(!Q){S=H;T=R}else{L=H;M=Q;N=R;K=85}}if((K|0)==85)while(1){K=0;g=(c[M+4>>2]&-8)-t|0;k=g>>>0>>0;f=k?g:L;g=k?M:N;M=c[M+16+(((c[M+16>>2]|0)==0&1)<<2)>>2]|0;if(!M){S=f;T=g;break}else{L=f;N=g;K=85}}if((T|0)!=0?S>>>0<((c[6330]|0)-t|0)>>>0:0){g=c[6332]|0;if(T>>>0>>0)ba();f=T+t|0;if(T>>>0>=f>>>0)ba();k=c[T+24>>2]|0;e=c[T+12>>2]|0;do if((e|0)==(T|0)){r=T+20|0;h=c[r>>2]|0;if(!h){s=T+16|0;m=c[s>>2]|0;if(!m){U=0;break}else{V=m;W=s}}else{V=h;W=r}while(1){r=V+20|0;h=c[r>>2]|0;if(h|0){V=h;W=r;continue}r=V+16|0;h=c[r>>2]|0;if(!h)break;else{V=h;W=r}}if(W>>>0>>0)ba();else{c[W>>2]=0;U=V;break}}else{r=c[T+8>>2]|0;if(r>>>0>>0)ba();h=r+12|0;if((c[h>>2]|0)!=(T|0))ba();s=e+8|0;if((c[s>>2]|0)==(T|0)){c[h>>2]=e;c[s>>2]=r;U=e;break}else ba()}while(0);c:do if(k){e=c[T+28>>2]|0;g=25616+(e<<2)|0;do if((T|0)==(c[g>>2]|0)){c[g>>2]=U;if(!U){r=p&~(1<>>0>=(c[6332]|0)>>>0){c[k+16+(((c[k+16>>2]|0)!=(T|0)&1)<<2)>>2]=U;if(!U){X=p;break c}else break}else ba();while(0);e=c[6332]|0;if(U>>>0>>0)ba();c[U+24>>2]=k;g=c[T+16>>2]|0;do if(g|0)if(g>>>0>>0)ba();else{c[U+16>>2]=g;c[g+24>>2]=U;break}while(0);g=c[T+20>>2]|0;if(g)if(g>>>0<(c[6332]|0)>>>0)ba();else{c[U+20>>2]=g;c[g+24>>2]=U;X=p;break}else X=p}else X=p;while(0);do if(S>>>0>=16){c[T+4>>2]=t|3;c[f+4>>2]=S|1;c[f+S>>2]=S;p=S>>>3;if(S>>>0<256){k=25352+(p<<1<<2)|0;g=c[6328]|0;e=1<>2]|0;if(r>>>0<(c[6332]|0)>>>0)ba();else{Y=p;Z=r}}else{c[6328]=g|e;Y=k+8|0;Z=k}c[Y>>2]=f;c[Z+12>>2]=f;c[f+8>>2]=Z;c[f+12>>2]=k;break}k=S>>>8;if(k)if(S>>>0>16777215)_=31;else{e=(k+1048320|0)>>>16&8;g=k<>>16&4;r=g<>>16&2;p=14-(k|e|g)+(r<>>15)|0;_=S>>>(p+7|0)&1|p<<1}else _=0;p=25616+(_<<2)|0;c[f+28>>2]=_;g=f+16|0;c[g+4>>2]=0;c[g>>2]=0;g=1<<_;if(!(X&g)){c[6329]=X|g;c[p>>2]=f;c[f+24>>2]=p;c[f+12>>2]=f;c[f+8>>2]=f;break}g=S<<((_|0)==31?0:25-(_>>>1)|0);r=c[p>>2]|0;while(1){if((c[r+4>>2]&-8|0)==(S|0)){K=139;break}$=r+16+(g>>>31<<2)|0;p=c[$>>2]|0;if(!p){K=136;break}else{g=g<<1;r=p}}if((K|0)==136)if($>>>0<(c[6332]|0)>>>0)ba();else{c[$>>2]=f;c[f+24>>2]=r;c[f+12>>2]=f;c[f+8>>2]=f;break}else if((K|0)==139){g=r+8|0;p=c[g>>2]|0;e=c[6332]|0;if(p>>>0>=e>>>0&r>>>0>=e>>>0){c[p+12>>2]=f;c[g>>2]=f;c[f+8>>2]=p;c[f+12>>2]=r;c[f+24>>2]=0;break}else ba()}}else{p=S+t|0;c[T+4>>2]=p|3;g=T+p+4|0;c[g>>2]=c[g>>2]|1}while(0);q=T+8|0;l=b;return q|0}else F=t}else F=t}else F=-1;while(0);T=c[6330]|0;if(T>>>0>=F>>>0){S=T-F|0;$=c[6333]|0;if(S>>>0>15){_=$+F|0;c[6333]=_;c[6330]=S;c[_+4>>2]=S|1;c[_+S>>2]=S;c[$+4>>2]=F|3}else{c[6330]=0;c[6333]=0;c[$+4>>2]=T|3;S=$+T+4|0;c[S>>2]=c[S>>2]|1}q=$+8|0;l=b;return q|0}$=c[6331]|0;if($>>>0>F>>>0){S=$-F|0;c[6331]=S;T=c[6334]|0;_=T+F|0;c[6334]=_;c[_+4>>2]=S|1;c[T+4>>2]=F|3;q=T+8|0;l=b;return q|0}if(!(c[6446]|0)){c[6448]=4096;c[6447]=4096;c[6449]=-1;c[6450]=-1;c[6451]=0;c[6439]=0;T=d&-16^1431655768;c[d>>2]=T;c[6446]=T;aa=4096}else aa=c[6448]|0;T=F+48|0;d=F+47|0;S=aa+d|0;_=0-aa|0;aa=S&_;if(aa>>>0<=F>>>0){q=0;l=b;return q|0}X=c[6438]|0;if(X|0?(Z=c[6436]|0,Y=Z+aa|0,Y>>>0<=Z>>>0|Y>>>0>X>>>0):0){q=0;l=b;return q|0}d:do if(!(c[6439]&4)){X=c[6334]|0;e:do if(X){Y=25760;while(1){Z=c[Y>>2]|0;if(Z>>>0<=X>>>0?(ca=Y+4|0,(Z+(c[ca>>2]|0)|0)>>>0>X>>>0):0)break;Z=c[Y+8>>2]|0;if(!Z){K=163;break e}else Y=Z}r=S-$&_;if(r>>>0<2147483647){Z=Me(r|0)|0;if((Z|0)==((c[Y>>2]|0)+(c[ca>>2]|0)|0))if((Z|0)==(-1|0))da=r;else{ea=Z;fa=r;K=180;break d}else{ga=Z;ha=r;K=171}}else da=0}else K=163;while(0);do if((K|0)==163){X=Me(0)|0;if((X|0)!=(-1|0)?(t=X,r=c[6447]|0,Z=r+-1|0,U=((Z&t|0)==0?0:(Z+t&0-r)-t|0)+aa|0,t=c[6436]|0,r=U+t|0,U>>>0>F>>>0&U>>>0<2147483647):0){Z=c[6438]|0;if(Z|0?r>>>0<=t>>>0|r>>>0>Z>>>0:0){da=0;break}Z=Me(U|0)|0;if((Z|0)==(X|0)){ea=X;fa=U;K=180;break d}else{ga=Z;ha=U;K=171}}else da=0}while(0);do if((K|0)==171){U=0-ha|0;if(!(T>>>0>ha>>>0&(ha>>>0<2147483647&(ga|0)!=(-1|0))))if((ga|0)==(-1|0)){da=0;break}else{ea=ga;fa=ha;K=180;break d}Z=c[6448]|0;X=d-ha+Z&0-Z;if(X>>>0>=2147483647){ea=ga;fa=ha;K=180;break d}if((Me(X|0)|0)==(-1|0)){Me(U|0)|0;da=0;break}else{ea=ga;fa=X+ha|0;K=180;break d}}while(0);c[6439]=c[6439]|4;ia=da;K=178}else{ia=0;K=178}while(0);if(((K|0)==178?aa>>>0<2147483647:0)?(da=Me(aa|0)|0,aa=Me(0)|0,ha=aa-da|0,ga=ha>>>0>(F+40|0)>>>0,!((da|0)==(-1|0)|ga^1|da>>>0>>0&((da|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){ea=da;fa=ga?ha:ia;K=180}if((K|0)==180){ia=(c[6436]|0)+fa|0;c[6436]=ia;if(ia>>>0>(c[6437]|0)>>>0)c[6437]=ia;ia=c[6334]|0;do if(ia){ha=25760;while(1){ja=c[ha>>2]|0;ka=ha+4|0;la=c[ka>>2]|0;if((ea|0)==(ja+la|0)){K=190;break}ga=c[ha+8>>2]|0;if(!ga)break;else ha=ga}if(((K|0)==190?(c[ha+12>>2]&8|0)==0:0)?ia>>>0>>0&ia>>>0>=ja>>>0:0){c[ka>>2]=la+fa;ga=ia+8|0;da=(ga&7|0)==0?0:0-ga&7;ga=ia+da|0;aa=(c[6331]|0)+(fa-da)|0;c[6334]=ga;c[6331]=aa;c[ga+4>>2]=aa|1;c[ga+aa+4>>2]=40;c[6335]=c[6450];break}aa=c[6332]|0;if(ea>>>0>>0){c[6332]=ea;ma=ea}else ma=aa;aa=ea+fa|0;ga=25760;while(1){if((c[ga>>2]|0)==(aa|0)){K=198;break}da=c[ga+8>>2]|0;if(!da)break;else ga=da}if((K|0)==198?(c[ga+12>>2]&8|0)==0:0){c[ga>>2]=ea;ha=ga+4|0;c[ha>>2]=(c[ha>>2]|0)+fa;ha=ea+8|0;da=ea+((ha&7|0)==0?0:0-ha&7)|0;ha=aa+8|0;d=aa+((ha&7|0)==0?0:0-ha&7)|0;ha=da+F|0;T=d-da-F|0;c[da+4>>2]=F|3;do if((d|0)!=(ia|0)){if((d|0)==(c[6333]|0)){ca=(c[6330]|0)+T|0;c[6330]=ca;c[6333]=ha;c[ha+4>>2]=ca|1;c[ha+ca>>2]=ca;break}ca=c[d+4>>2]|0;if((ca&3|0)==1){_=ca&-8;$=ca>>>3;f:do if(ca>>>0>=256){S=c[d+24>>2]|0;X=c[d+12>>2]|0;do if((X|0)==(d|0)){U=d+16|0;Z=U+4|0;r=c[Z>>2]|0;if(!r){t=c[U>>2]|0;if(!t){na=0;break}else{oa=t;pa=U}}else{oa=r;pa=Z}while(1){Z=oa+20|0;r=c[Z>>2]|0;if(r|0){oa=r;pa=Z;continue}Z=oa+16|0;r=c[Z>>2]|0;if(!r)break;else{oa=r;pa=Z}}if(pa>>>0>>0)ba();else{c[pa>>2]=0;na=oa;break}}else{Z=c[d+8>>2]|0;if(Z>>>0>>0)ba();r=Z+12|0;if((c[r>>2]|0)!=(d|0))ba();U=X+8|0;if((c[U>>2]|0)==(d|0)){c[r>>2]=X;c[U>>2]=Z;na=X;break}else ba()}while(0);if(!S)break;X=c[d+28>>2]|0;Z=25616+(X<<2)|0;do if((d|0)!=(c[Z>>2]|0))if(S>>>0>=(c[6332]|0)>>>0){c[S+16+(((c[S+16>>2]|0)!=(d|0)&1)<<2)>>2]=na;if(!na)break f;else break}else ba();else{c[Z>>2]=na;if(na|0)break;c[6329]=c[6329]&~(1<>>0>>0)ba();c[na+24>>2]=S;Z=d+16|0;U=c[Z>>2]|0;do if(U|0)if(U>>>0>>0)ba();else{c[na+16>>2]=U;c[U+24>>2]=na;break}while(0);U=c[Z+4>>2]|0;if(!U)break;if(U>>>0<(c[6332]|0)>>>0)ba();else{c[na+20>>2]=U;c[U+24>>2]=na;break}}else{U=c[d+8>>2]|0;X=c[d+12>>2]|0;S=25352+($<<1<<2)|0;do if((U|0)!=(S|0)){if(U>>>0>>0)ba();if((c[U+12>>2]|0)==(d|0))break;ba()}while(0);if((X|0)==(U|0)){c[6328]=c[6328]&~(1<<$);break}do if((X|0)==(S|0))qa=X+8|0;else{if(X>>>0>>0)ba();Z=X+8|0;if((c[Z>>2]|0)==(d|0)){qa=Z;break}ba()}while(0);c[U+12>>2]=X;c[qa>>2]=U}while(0);ra=d+_|0;sa=_+T|0}else{ra=d;sa=T}$=ra+4|0;c[$>>2]=c[$>>2]&-2;c[ha+4>>2]=sa|1;c[ha+sa>>2]=sa;$=sa>>>3;if(sa>>>0<256){ca=25352+($<<1<<2)|0;Y=c[6328]|0;S=1<<$;do if(!(Y&S)){c[6328]=Y|S;ta=ca+8|0;ua=ca}else{$=ca+8|0;Z=c[$>>2]|0;if(Z>>>0>=(c[6332]|0)>>>0){ta=$;ua=Z;break}ba()}while(0);c[ta>>2]=ha;c[ua+12>>2]=ha;c[ha+8>>2]=ua;c[ha+12>>2]=ca;break}S=sa>>>8;do if(!S)va=0;else{if(sa>>>0>16777215){va=31;break}Y=(S+1048320|0)>>>16&8;_=S<>>16&4;$=_<>>16&2;r=14-(Z|Y|_)+($<<_>>>15)|0;va=sa>>>(r+7|0)&1|r<<1}while(0);S=25616+(va<<2)|0;c[ha+28>>2]=va;ca=ha+16|0;c[ca+4>>2]=0;c[ca>>2]=0;ca=c[6329]|0;r=1<>2]=ha;c[ha+24>>2]=S;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}r=sa<<((va|0)==31?0:25-(va>>>1)|0);ca=c[S>>2]|0;while(1){if((c[ca+4>>2]&-8|0)==(sa|0)){K=265;break}wa=ca+16+(r>>>31<<2)|0;S=c[wa>>2]|0;if(!S){K=262;break}else{r=r<<1;ca=S}}if((K|0)==262)if(wa>>>0<(c[6332]|0)>>>0)ba();else{c[wa>>2]=ha;c[ha+24>>2]=ca;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}else if((K|0)==265){r=ca+8|0;S=c[r>>2]|0;_=c[6332]|0;if(S>>>0>=_>>>0&ca>>>0>=_>>>0){c[S+12>>2]=ha;c[r>>2]=ha;c[ha+8>>2]=S;c[ha+12>>2]=ca;c[ha+24>>2]=0;break}else ba()}}else{S=(c[6331]|0)+T|0;c[6331]=S;c[6334]=ha;c[ha+4>>2]=S|1}while(0);q=da+8|0;l=b;return q|0}ha=25760;while(1){T=c[ha>>2]|0;if(T>>>0<=ia>>>0?(xa=T+(c[ha+4>>2]|0)|0,xa>>>0>ia>>>0):0)break;ha=c[ha+8>>2]|0}ha=xa+-47|0;da=ha+8|0;T=ha+((da&7|0)==0?0:0-da&7)|0;da=ia+16|0;ha=T>>>0>>0?ia:T;T=ha+8|0;d=ea+8|0;aa=(d&7|0)==0?0:0-d&7;d=ea+aa|0;ga=fa+-40-aa|0;c[6334]=d;c[6331]=ga;c[d+4>>2]=ga|1;c[d+ga+4>>2]=40;c[6335]=c[6450];ga=ha+4|0;c[ga>>2]=27;c[T>>2]=c[6440];c[T+4>>2]=c[6441];c[T+8>>2]=c[6442];c[T+12>>2]=c[6443];c[6440]=ea;c[6441]=fa;c[6443]=0;c[6442]=T;T=ha+24|0;do{d=T;T=T+4|0;c[T>>2]=7}while((d+8|0)>>>0>>0);if((ha|0)!=(ia|0)){T=ha-ia|0;c[ga>>2]=c[ga>>2]&-2;c[ia+4>>2]=T|1;c[ha>>2]=T;d=T>>>3;if(T>>>0<256){aa=25352+(d<<1<<2)|0;S=c[6328]|0;r=1<>2]|0;if(_>>>0<(c[6332]|0)>>>0)ba();else{ya=d;za=_}}else{c[6328]=S|r;ya=aa+8|0;za=aa}c[ya>>2]=ia;c[za+12>>2]=ia;c[ia+8>>2]=za;c[ia+12>>2]=aa;break}aa=T>>>8;if(aa)if(T>>>0>16777215)Aa=31;else{r=(aa+1048320|0)>>>16&8;S=aa<>>16&4;_=S<>>16&2;d=14-(aa|r|S)+(_<>>15)|0;Aa=T>>>(d+7|0)&1|d<<1}else Aa=0;d=25616+(Aa<<2)|0;c[ia+28>>2]=Aa;c[ia+20>>2]=0;c[da>>2]=0;S=c[6329]|0;_=1<>2]=ia;c[ia+24>>2]=d;c[ia+12>>2]=ia;c[ia+8>>2]=ia;break}_=T<<((Aa|0)==31?0:25-(Aa>>>1)|0);S=c[d>>2]|0;while(1){if((c[S+4>>2]&-8|0)==(T|0)){K=292;break}Ba=S+16+(_>>>31<<2)|0;d=c[Ba>>2]|0;if(!d){K=289;break}else{_=_<<1;S=d}}if((K|0)==289)if(Ba>>>0<(c[6332]|0)>>>0)ba();else{c[Ba>>2]=ia;c[ia+24>>2]=S;c[ia+12>>2]=ia;c[ia+8>>2]=ia;break}else if((K|0)==292){_=S+8|0;T=c[_>>2]|0;da=c[6332]|0;if(T>>>0>=da>>>0&S>>>0>=da>>>0){c[T+12>>2]=ia;c[_>>2]=ia;c[ia+8>>2]=T;c[ia+12>>2]=S;c[ia+24>>2]=0;break}else ba()}}}else{T=c[6332]|0;if((T|0)==0|ea>>>0>>0)c[6332]=ea;c[6440]=ea;c[6441]=fa;c[6443]=0;c[6337]=c[6446];c[6336]=-1;T=0;do{_=25352+(T<<1<<2)|0;c[_+12>>2]=_;c[_+8>>2]=_;T=T+1|0}while((T|0)!=32);T=ea+8|0;S=(T&7|0)==0?0:0-T&7;T=ea+S|0;_=fa+-40-S|0;c[6334]=T;c[6331]=_;c[T+4>>2]=_|1;c[T+_+4>>2]=40;c[6335]=c[6450]}while(0);fa=c[6331]|0;if(fa>>>0>F>>>0){ea=fa-F|0;c[6331]=ea;fa=c[6334]|0;ia=fa+F|0;c[6334]=ia;c[ia+4>>2]=ea|1;c[fa+4>>2]=F|3;q=fa+8|0;l=b;return q|0}}c[(ye()|0)>>2]=12;q=0;l=b;return q|0}function De(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;if(!a)return;b=a+-8|0;d=c[6332]|0;if(b>>>0>>0)ba();e=c[a+-4>>2]|0;a=e&3;if((a|0)==1)ba();f=e&-8;g=b+f|0;a:do if(!(e&1)){h=c[b>>2]|0;if(!a)return;i=b+(0-h)|0;j=h+f|0;if(i>>>0>>0)ba();if((i|0)==(c[6333]|0)){k=g+4|0;l=c[k>>2]|0;if((l&3|0)!=3){m=i;n=i;o=j;break}c[6330]=j;c[k>>2]=l&-2;c[i+4>>2]=j|1;c[i+j>>2]=j;return}l=h>>>3;if(h>>>0<256){h=c[i+8>>2]|0;k=c[i+12>>2]|0;p=25352+(l<<1<<2)|0;if((h|0)!=(p|0)){if(h>>>0>>0)ba();if((c[h+12>>2]|0)!=(i|0))ba()}if((k|0)==(h|0)){c[6328]=c[6328]&~(1<>>0>>0)ba();p=k+8|0;if((c[p>>2]|0)==(i|0))q=p;else ba()}else q=k+8|0;c[h+12>>2]=k;c[q>>2]=h;m=i;n=i;o=j;break}h=c[i+24>>2]|0;k=c[i+12>>2]|0;do if((k|0)==(i|0)){p=i+16|0;l=p+4|0;r=c[l>>2]|0;if(!r){s=c[p>>2]|0;if(!s){t=0;break}else{u=s;v=p}}else{u=r;v=l}while(1){l=u+20|0;r=c[l>>2]|0;if(r|0){u=r;v=l;continue}l=u+16|0;r=c[l>>2]|0;if(!r)break;else{u=r;v=l}}if(v>>>0>>0)ba();else{c[v>>2]=0;t=u;break}}else{l=c[i+8>>2]|0;if(l>>>0>>0)ba();r=l+12|0;if((c[r>>2]|0)!=(i|0))ba();p=k+8|0;if((c[p>>2]|0)==(i|0)){c[r>>2]=k;c[p>>2]=l;t=k;break}else ba()}while(0);if(h){k=c[i+28>>2]|0;l=25616+(k<<2)|0;do if((i|0)==(c[l>>2]|0)){c[l>>2]=t;if(!t){c[6329]=c[6329]&~(1<>>0>=(c[6332]|0)>>>0){c[h+16+(((c[h+16>>2]|0)!=(i|0)&1)<<2)>>2]=t;if(!t){m=i;n=i;o=j;break a}else break}else ba();while(0);k=c[6332]|0;if(t>>>0>>0)ba();c[t+24>>2]=h;l=i+16|0;p=c[l>>2]|0;do if(p|0)if(p>>>0>>0)ba();else{c[t+16>>2]=p;c[p+24>>2]=t;break}while(0);p=c[l+4>>2]|0;if(p)if(p>>>0<(c[6332]|0)>>>0)ba();else{c[t+20>>2]=p;c[p+24>>2]=t;m=i;n=i;o=j;break}else{m=i;n=i;o=j}}else{m=i;n=i;o=j}}else{m=b;n=b;o=f}while(0);if(m>>>0>=g>>>0)ba();f=g+4|0;b=c[f>>2]|0;if(!(b&1))ba();if(!(b&2)){t=c[6333]|0;if((g|0)==(c[6334]|0)){d=(c[6331]|0)+o|0;c[6331]=d;c[6334]=n;c[n+4>>2]=d|1;if((n|0)!=(t|0))return;c[6333]=0;c[6330]=0;return}if((g|0)==(t|0)){t=(c[6330]|0)+o|0;c[6330]=t;c[6333]=m;c[n+4>>2]=t|1;c[m+t>>2]=t;return}t=(b&-8)+o|0;d=b>>>3;b:do if(b>>>0>=256){u=c[g+24>>2]|0;v=c[g+12>>2]|0;do if((v|0)==(g|0)){q=g+16|0;a=q+4|0;e=c[a>>2]|0;if(!e){p=c[q>>2]|0;if(!p){w=0;break}else{x=p;y=q}}else{x=e;y=a}while(1){a=x+20|0;e=c[a>>2]|0;if(e|0){x=e;y=a;continue}a=x+16|0;e=c[a>>2]|0;if(!e)break;else{x=e;y=a}}if(y>>>0<(c[6332]|0)>>>0)ba();else{c[y>>2]=0;w=x;break}}else{a=c[g+8>>2]|0;if(a>>>0<(c[6332]|0)>>>0)ba();e=a+12|0;if((c[e>>2]|0)!=(g|0))ba();q=v+8|0;if((c[q>>2]|0)==(g|0)){c[e>>2]=v;c[q>>2]=a;w=v;break}else ba()}while(0);if(u|0){v=c[g+28>>2]|0;j=25616+(v<<2)|0;do if((g|0)==(c[j>>2]|0)){c[j>>2]=w;if(!w){c[6329]=c[6329]&~(1<>>0>=(c[6332]|0)>>>0){c[u+16+(((c[u+16>>2]|0)!=(g|0)&1)<<2)>>2]=w;if(!w)break b;else break}else ba();while(0);v=c[6332]|0;if(w>>>0>>0)ba();c[w+24>>2]=u;j=g+16|0;i=c[j>>2]|0;do if(i|0)if(i>>>0>>0)ba();else{c[w+16>>2]=i;c[i+24>>2]=w;break}while(0);i=c[j+4>>2]|0;if(i|0)if(i>>>0<(c[6332]|0)>>>0)ba();else{c[w+20>>2]=i;c[i+24>>2]=w;break}}}else{i=c[g+8>>2]|0;v=c[g+12>>2]|0;u=25352+(d<<1<<2)|0;if((i|0)!=(u|0)){if(i>>>0<(c[6332]|0)>>>0)ba();if((c[i+12>>2]|0)!=(g|0))ba()}if((v|0)==(i|0)){c[6328]=c[6328]&~(1<>>0<(c[6332]|0)>>>0)ba();u=v+8|0;if((c[u>>2]|0)==(g|0))z=u;else ba()}else z=v+8|0;c[i+12>>2]=v;c[z>>2]=i}while(0);c[n+4>>2]=t|1;c[m+t>>2]=t;if((n|0)==(c[6333]|0)){c[6330]=t;return}else A=t}else{c[f>>2]=b&-2;c[n+4>>2]=o|1;c[m+o>>2]=o;A=o}o=A>>>3;if(A>>>0<256){m=25352+(o<<1<<2)|0;b=c[6328]|0;f=1<>2]|0;if(t>>>0<(c[6332]|0)>>>0)ba();else{B=o;C=t}}else{c[6328]=b|f;B=m+8|0;C=m}c[B>>2]=n;c[C+12>>2]=n;c[n+8>>2]=C;c[n+12>>2]=m;return}m=A>>>8;if(m)if(A>>>0>16777215)D=31;else{C=(m+1048320|0)>>>16&8;B=m<>>16&4;f=B<>>16&2;b=14-(m|C|B)+(f<>>15)|0;D=A>>>(b+7|0)&1|b<<1}else D=0;b=25616+(D<<2)|0;c[n+28>>2]=D;c[n+20>>2]=0;c[n+16>>2]=0;B=c[6329]|0;f=1<>>1)|0);m=c[b>>2]|0;while(1){if((c[m+4>>2]&-8|0)==(A|0)){E=124;break}F=m+16+(C>>>31<<2)|0;t=c[F>>2]|0;if(!t){E=121;break}else{C=C<<1;m=t}}if((E|0)==121)if(F>>>0<(c[6332]|0)>>>0)ba();else{c[F>>2]=n;c[n+24>>2]=m;c[n+12>>2]=n;c[n+8>>2]=n;break}else if((E|0)==124){C=m+8|0;j=c[C>>2]|0;t=c[6332]|0;if(j>>>0>=t>>>0&m>>>0>=t>>>0){c[j+12>>2]=n;c[C>>2]=n;c[n+8>>2]=j;c[n+12>>2]=m;c[n+24>>2]=0;break}else ba()}}else{c[6329]=B|f;c[b>>2]=n;c[n+24>>2]=b;c[n+12>>2]=n;c[n+8>>2]=n}while(0);n=(c[6336]|0)+-1|0;c[6336]=n;if(!n)G=25768;else return;while(1){n=c[G>>2]|0;if(!n)break;else G=n+8|0}c[6336]=-1;return}function Ee(){}function Fe(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>c;return a>>>c|(b&(1<>c-32|0}function Ge(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=a+c>>>0;return (C=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function He(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;d=d&255;if((e|0)>=67){while(b&3){a[b>>0]=d;b=b+1|0}g=f&-4|0;h=g-64|0;i=d|d<<8|d<<16|d<<24;while((b|0)<=(h|0)){c[b>>2]=i;c[b+4>>2]=i;c[b+8>>2]=i;c[b+12>>2]=i;c[b+16>>2]=i;c[b+20>>2]=i;c[b+24>>2]=i;c[b+28>>2]=i;c[b+32>>2]=i;c[b+36>>2]=i;c[b+40>>2]=i;c[b+44>>2]=i;c[b+48>>2]=i;c[b+52>>2]=i;c[b+56>>2]=i;c[b+60>>2]=i;b=b+64|0}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return f-e|0}function Ie(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((e|0)>=8192)return fa(b|0,d|0,e|0)|0;f=b|0;g=b+e|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}h=g&-4|0;e=h-64|0;while((b|0)<=(e|0)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];c[b+12>>2]=c[d+12>>2];c[b+16>>2]=c[d+16>>2];c[b+20>>2]=c[d+20>>2];c[b+24>>2]=c[d+24>>2];c[b+28>>2]=c[d+28>>2];c[b+32>>2]=c[d+32>>2];c[b+36>>2]=c[d+36>>2];c[b+40>>2]=c[d+40>>2];c[b+44>>2]=c[d+44>>2];c[b+48>>2]=c[d+48>>2];c[b+52>>2]=c[d+52>>2];c[b+56>>2]=c[d+56>>2];c[b+60>>2]=c[d+60>>2];b=b+64|0;d=d+64|0}while((b|0)<(h|0)){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0}}else{h=g-4|0;while((b|0)<(h|0)){a[b>>0]=a[d>>0]|0;a[b+1>>0]=a[d+1>>0]|0;a[b+2>>0]=a[d+2>>0]|0;a[b+3>>0]=a[d+3>>0]|0;b=b+4|0;d=d+4|0}}while((b|0)<(g|0)){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}return f|0}function Je(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=R(d,c)|0;f=a>>>16;a=(e>>>16)+(R(d,f)|0)|0;d=b>>>16;b=R(d,c)|0;return (C=(a>>>16)+(R(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function Ke(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=Je(e,a)|0;f=C;return (C=(R(b,a)|0)+(R(d,e)|0)+f|f&0,c|0|0)|0}function Le(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else Ie(b,c,d)|0;return b|0}function Me(a){a=a|0;var b=0,d=0;a=a+15&-16|0;b=c[i>>2]|0;d=b+a|0;if((a|0)>0&(d|0)<(b|0)|(d|0)<0){Z()|0;ca(12);return -1}c[i>>2]=d;if((d|0)>(Y()|0)?(X()|0)==0:0){ca(12);c[i>>2]=b;return -1}return b|0}function Ne(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ia[a&1](b|0,c|0,d|0,e|0,f|0,g|0)}function Oe(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;V(0)} + +// EMSCRIPTEN_END_FUNCS +var ia=[Oe,pe];return{setThrew:na,_bitshift64Ashr:Fe,_memset:He,_ogv_audio_decoder_process_header:re,_sbrk:Me,_memcpy:Ie,stackAlloc:ja,___muldi3:Ke,getTempRet0:pa,setTempRet0:oa,_i64Add:Ge,_emscripten_get_global_libc:xe,stackSave:ka,___muldsi3:Je,_free:De,runPostSets:Ee,_ogv_audio_decoder_destroy:te,_ogv_audio_decoder_init:qe,establishStackSpace:ma,_memmove:Le,stackRestore:la,_malloc:Ce,_ogv_audio_decoder_process_audio:se,stackAlloc:ja,stackSave:ka,stackRestore:la,establishStackSpace:ma,setThrew:na,setTempRet0:oa,getTempRet0:pa,dynCall_viiiiii:Ne}}) + + +// EMSCRIPTEN_END_ASM +(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var setThrew=Module["setThrew"]=asm["setThrew"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _memset=Module["_memset"]=asm["_memset"];var _ogv_audio_decoder_process_header=Module["_ogv_audio_decoder_process_header"]=asm["_ogv_audio_decoder_process_header"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _emscripten_get_global_libc=Module["_emscripten_get_global_libc"]=asm["_emscripten_get_global_libc"];var stackSave=Module["stackSave"]=asm["stackSave"];var ___muldsi3=Module["___muldsi3"]=asm["___muldsi3"];var _free=Module["_free"]=asm["_free"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var _ogv_audio_decoder_destroy=Module["_ogv_audio_decoder_destroy"]=asm["_ogv_audio_decoder_destroy"];var _ogv_audio_decoder_init=Module["_ogv_audio_decoder_init"]=asm["_ogv_audio_decoder_init"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var _memmove=Module["_memmove"]=asm["_memmove"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var _malloc=Module["_malloc"]=asm["_malloc"];var _ogv_audio_decoder_process_audio=Module["_ogv_audio_decoder_process_audio"]=asm["_ogv_audio_decoder_process_audio"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];Runtime.stackAlloc=Module["stackAlloc"];Runtime.stackSave=Module["stackSave"];Runtime.stackRestore=Module["stackRestore"];Runtime.establishStackSpace=Module["establishStackSpace"];Runtime.setTempRet0=Module["setTempRet0"];Runtime.getTempRet0=Module["getTempRet0"];Module["asm"]=asm;Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=false;if(Module["noInitialRun"]){shouldRunNow=false}Module["noExitRuntime"]=true;run();var inputBuffer,inputBufferSize;function reallocInputBuffer(size){if(inputBuffer&&inputBufferSize>=size){return inputBuffer}if(inputBuffer){Module._free(inputBuffer)}inputBufferSize=size;inputBuffer=Module._malloc(inputBufferSize);return inputBuffer}var getTimestamp;if(typeof performance==="undefined"||typeof performance.now==="undefined"){getTimestamp=Date.now}else{getTimestamp=performance.now.bind(performance)}function time(func){var start=getTimestamp(),ret;ret=func();Module.cpuTime+=getTimestamp()-start;return ret}Module.loadedMetadata=!!options.audioFormat;Module.audioFormat=options.audioFormat||null;Module.audioBuffer=null;Module.cpuTime=0;Object.defineProperty(Module,"processing",{get:function getProcessing(){return false}});Module.init=(function(callback){function finish(){time((function(){Module._ogv_audio_decoder_init()}));callback()}if(Module.wasmBinary){Module.onRuntimeInitialized=(function(){finish()})}else{finish()}});Module.processHeader=(function(data,callback){var ret=time((function(){var len=data.byteLength;var buffer=reallocInputBuffer(len);Module.HEAPU8.set(new Uint8Array(data),buffer);return Module._ogv_audio_decoder_process_header(buffer,len)}));callback(ret)});Module.processAudio=(function(data,callback){var ret=time((function(){var len=data.byteLength;var buffer=reallocInputBuffer(len);Module.HEAPU8.set(new Uint8Array(data),buffer);return Module._ogv_audio_decoder_process_audio(buffer,len)}));callback(ret)});Module.close=(function(){});Math.imul=Math_imul_orig + + + + + + return OGVDecoderAudioOpus; +}; +})(); diff --git a/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-vorbis.js b/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-vorbis.js new file mode 100644 index 0000000000..1f7415a65c --- /dev/null +++ b/data/promote.telegram.org/js/ogvjs/ogv-decoder-audio-vorbis.js @@ -0,0 +1,30 @@ +var OGVDecoderAudioVorbis +(function() { + var scriptSrc; + if (typeof document !== 'undefined' && document.currentScript) scriptSrc = document.currentScript.src; +OGVDecoderAudioVorbis = function(OGVDecoderAudioVorbis) { + OGVDecoderAudioVorbis = OGVDecoderAudioVorbis || {}; + if (!OGVDecoderAudioVorbis.currentScriptUrl) OGVDecoderAudioVorbis.currentScriptUrl = scriptSrc; + var Module = OGVDecoderAudioVorbis; + +var options=Module;Module={print:(function(str){console.log(str)})};if(typeof OGVLoader!=="undefined"){Module["pthreadMainPrefixURL"]=OGVLoader.base+"/"}if(options["memoryLimit"]&&!options.wasmBinary){Module["TOTAL_MEMORY"]=options["memoryLimit"]}for(option in options){if(options.hasOwnProperty(option)){Module[option]=options[option]}}var Math_imul_orig=Math.imul;var OGVDecoderAudioVorbis=Module;var Module;if(!Module)Module=(typeof OGVDecoderAudioVorbis!=="undefined"?OGVDecoderAudioVorbis:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else if(Module["ENVIRONMENT"]==="PTHREAD"){ENVIRONMENT_IS_WORKER=true;ENVIRONMENT_IS_PTHREAD=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function shell_read(){throw"no read() available"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return xhr.response}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function shell_print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function shell_printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}if(!Module["quit"]){Module["quit"]=(function(status,toThrow){throw toThrow})}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value;return value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i>2];var end=(ret+size+15|0)&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=Runtime.stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){var __cxa_demangle_func=Module["___cxa_demangle"]||Module["__cxa_demangle"];if(__cxa_demangle_func){try{var s=func.substr(1);var len=lengthBytesUTF8(s)+1;var buf=_malloc(len);stringToUTF8(s,buf,len);var status=_malloc(4);var ret=__cxa_demangle_func(buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}return func}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];if(!Math["trunc"])Math["trunc"]=(function(x){return x<0?Math.ceil(x):Math.floor(x)});Math.trunc=Math["trunc"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=Runtime.GLOBAL_BASE;STATICTOP=STATIC_BASE+58496;__ATINIT__.push();allocate([0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,63,0,0,0,0,0,0,240,63,0,0,0,0,0,0,248,63,0,0,0,0,0,0,4,64,0,0,0,0,0,0,18,64,0,0,0,0,0,0,33,64,0,0,0,0,0,128,48,64,0,0,0,4,107,244,52,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,63,0,0,0,0,0,0,240,63,0,0,0,0,0,0,248,63,0,0,0,0,0,0,0,64,0,0,0,0,0,0,4,64,0,0,0,0,0,0,18,64,0,0,0,0,0,0,33,64,0,0,0,4,107,244,52,66,0,0,0,0,1,0,0,0,3,0,0,0,7,0,0,0,15,0,0,0,31,0,0,0,63,0,0,0,127,0,0,0,255,0,0,0,255,1,0,0,255,3,0,0,255,7,0,0,255,15,0,0,255,31,0,0,255,63,0,0,255,127,0,0,255,255,0,0,255,255,1,0,255,255,3,0,255,255,7,0,255,255,15,0,255,255,31,0,255,255,63,0,255,255,127,0,255,255,255,0,255,255,255,1,255,255,255,3,255,255,255,7,255,255,255,15,255,255,255,31,255,255,255,63,255,255,255,127,255,255,255,255,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,6,0,0,0,2,0,0,0,0,0,0,0,7,0,0,0,8,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,7,0,0,0,8,0,0,0,5,0,0,0,6,0,0,0,2,0,0,0,1,0,0,0,3,0,0,0,2,0,0,0,7,0,0,0,8,0,0,0,5,0,0,0,6,0,0,0,4,0,0,0,2,0,0,0,5,0,0,0,1,0,0,0,9,0,0,0,7,0,0,0,1,0,0,0,10,0,0,0,56,1,0,0,28,1,0,0,84,1,0,0,116,1,0,0,148,1,0,0,62,180,228,51,9,145,243,51,139,178,1,52,60,32,10,52,35,26,19,52,96,169,28,52,167,215,38,52,75,175,49,52,80,59,61,52,112,135,73,52,35,160,86,52,184,146,100,52,85,109,115,52,136,159,129,52,252,11,138,52,147,4,147,52,105,146,156,52,50,191,166,52,63,149,177,52,147,31,189,52,228,105,201,52,173,128,214,52,54,113,228,52,166,73,243,52,136,140,1,53,192,247,9,53,6,239,18,53,118,123,28,53,192,166,38,53,55,123,49,53,218,3,61,53,94,76,73,53,59,97,86,53,185,79,100,53,252,37,115,53,138,121,129,53,134,227,137,53,124,217,146,53,133,100,156,53,82,142,166,53,51,97,177,53,37,232,188,53,220,46,201,53,206,65,214,53,65,46,228,53,87,2,243,53,143,102,1,54,79,207,9,54,245,195,18,54,152,77,28,54,232,117,38,54,50,71,49,54,116,204,60,54,94,17,73,54,101,34,86,54,206,12,100,54,184,222,114,54,151,83,129,54,28,187,137,54,114,174,146,54,175,54,156,54,129,93,166,54,53,45,177,54,199,176,188,54,228,243,200,54,1,3,214,54,96,235,227,54,30,187,242,54,162,64,1,55,235,166,9,55,241,152,18,55,201,31,28,55,30,69,38,55,61,19,49,55,30,149,60,55,111,214,72,55,162,227,85,55,247,201,99,55,137,151,114,55,175,45,129,55,190,146,137,55,116,131,146,55,230,8,156,55,190,44,166,55,71,249,176,55,121,121,188,55,254,184,200,55,71,196,213,55,146,168,227,55,248,115,242,55,192,26,1,56,147,126,9,56,249,109,18,56,6,242,27,56,98,20,38,56,86,223,48,56,216,93,60,56,146,155,72,56,242,164,85,56,51,135,99,56,110,80,114,56,211,7,129,56,107,106,137,56,130,88,146,56,42,219,155,56,9,252,165,56,104,197,176,56,59,66,188,56,41,126,200,56,160,133,213,56,217,101,227,56,232,44,242,56,233,244,0,57,70,86,9,57,14,67,18,57,81,196,27,57,181,227,37,57,127,171,48,57,162,38,60,57,197,96,72,57,83,102,85,57,131,68,99,57,104,9,114,57,1,226,128,57,36,66,137,57,157,45,146,57,123,173,155,57,99,203,165,57,153,145,176,57,13,11,188,57,102,67,200,57,11,71,213,57,50,35,227,57,237,229,241,57,29,207,0,58,5,46,9,58,48,24,18,58,169,150,27,58,21,179,37,58,183,119,48,58,124,239,59,58,10,38,72,58,199,39,85,58,230,1,99,58,120,194,113,58,59,188,128,58,233,25,137,58,198,2,146,58,219,127,155,58,203,154,165,58,216,93,176,58,239,211,187,58,179,8,200,58,136,8,213,58,159,224,226,58,7,159,241,58,92,169,0,59,208,5,9,59,94,237,17,59,15,105,27,59,132,130,37,59,253,67,48,59,103,184,59,59,97,235,71,59,77,233,84,59,93,191,98,59,156,123,113,59,127,150,128,59,186,241,136,59,249,215,145,59,71,82,155,59,65,106,165,59,39,42,176,59,226,156,187,59,18,206,199,59,23,202,212,59,32,158,226,59,53,88,241,59,166,131,0,60,167,221,8,60,152,194,17,60,130,59,27,60,1,82,37,60,84,16,48,60,97,129,59,60,200,176,71,60,229,170,84,60,232,124,98,60,212,52,113,60,207,112,128,60,150,201,136,60,58,173,145,60,192,36,155,60,197,57,165,60,133,246,175,60,229,101,187,60,130,147,199,60,185,139,212,60,180,91,226,60,121,17,241,60,251,93,0,61,137,181,8,61,223,151,17,61,2,14,27,61,141,33,37,61,185,220,47,61,109,74,59,61,64,118,71,61,145,108,84,61,133,58,98,61,34,238,112,61,42,75,128,61,127,161,136,61,136,130,145,61,72,247,154,61,88,9,165,61,242,194,175,61,248,46,187,61,3,89,199,61,109,77,212,61,92,25,226,61,209,202,240,61,91,56,0,62,119,141,8,62,51,109,17,62,144,224,26,62,39,241,36,62,46,169,47,62,135,19,59,62,202,59,71,62,77,46,84,62,55,248,97,62,132,167,112,62,143,37,128,62,115,121,136,62,226,87,145,62,220,201,154,62,249,216,164,62,109,143,175,62,27,248,186,62,149,30,199,62,51,15,212,62,23,215,225,62,61,132,240,62,198,18,0,63,114,101,8,63,147,66,17,63,43,179,26,63,206,192,36,63,177,117,47,63,178,220,58,63,101,1,71,63,29,240,83,63,251,181,97,63,251,96,112,63,0,0,128,63,252,5,0,0,124,6,0,0,124,7,0,0,124,9,0,0,124,13,0,0,124,21,0,0,124,37,0,0,124,69,0,0,24,0,120,58,76,70,11,60,242,204,192,60,116,252,59,61,86,73,154,61,241,93,228,61,248,163,29,62,180,231,78,62,54,157,130,62,78,220,159,62,193,174,190,62,65,132,222,62,173,194,254,62,186,101,15,63,248,0,31,63,29,233,45,63,249,219,59,63,45,162,72,63,160,17,84,63,38,15,94,63,46,143,102,63,112,149,109,63,174,51,115,63,159,135,119,63,66,184,122,63,196,242,124,63,75,103,126,63,196,69,127,63,241,186,127,63,217,237,127,63,162,253,127,63,248,255,127,63,168,9,120,57,17,119,11,59,135,139,193,59,74,113,61,60,148,82,156,60,94,8,233,60,42,83,34,61,74,118,87,61,138,227,137,61,7,140,171,61,34,154,208,61,108,239,248,61,164,52,18,62,100,112,41,62,65,21,66,62,67,11,92,62,47,56,119,62,197,191,137,62,92,97,152,62,135,112,167,62,4,220,182,62,188,145,198,62,231,126,214,62,48,144,230,62,227,177,246,62,13,104,3,63,121,107,11,63,98,89,19,63,42,40,27,63,137,206,34,63,166,67,42,63,49,127,49,63,126,121,56,63,153,43,63,63,92,143,69,63,127,159,75,63,165,87,81,63,104,180,86,63,89,179,91,63,8,83,96,63,252,146,100,63,177,115,104,63,138,246,107,63,198,29,111,63,109,236,113,63,62,102,116,63,154,143,118,63,104,109,120,63,3,5,122,63,26,92,123,63,153,120,124,63,143,96,125,63,17,26,126,63,39,171,126,63,176,25,127,63,74,107,127,63,68,165,127,63,132,204,127,63,123,229,127,63,17,244,127,63,158,251,127,63,219,254,127,63,218,255,127,63,0,0,128,63,5,12,120,56,50,131,11,58,118,186,193,58,226,203,61,59,38,207,156,59,139,32,234,59,245,102,35,60,63,100,89,60,184,127,139,60,59,23,174,60,239,114,212,60,96,140,254,60,45,46,22,61,114,237,46,61,155,127,73,61,220,223,101,61,123,4,130,61,159,250,145,61,71,207,162,61,38,127,180,61,173,6,199,61,16,98,218,61,63,141,238,61,244,193,1,62,185,160,12,62,128,224,23,62,182,126,35,62,166,120,47,62,116,203,59,62,34,116,72,62,141,111,85,62,107,186,98,62,83,81,112,62,180,48,126,62,110,42,134,62,252,92,141,62,9,174,148,62,138,27,156,62,100,163,163,62,112,67,171,62,119,249,178,62,54,195,186,62,93,158,194,62,147,136,202,62,118,127,210,62,154,128,218,62,142,137,226,62,217,151,234,62,2,169,242,62,139,186,250,62,251,100,1,63,99,106,5,63,65,108,9,63,89,105,13,63,116,96,17,63,94,80,21,63,231,55,25,63,231,21,29,63,58,233,32,63,197,176,36,63,116,107,40,63,62,24,44,63,35,182,47,63,43,68,51,63,109,193,54,63,10,45,58,63,48,134,61,63,26,204,64,63,17,254,67,63,107,27,71,63,142,35,74,63,238,21,77,63,15,242,79,63,132,183,82,63,239,101,85,63,3,253,87,63,129,124,90,63,60,228,92,63,21,52,95,63,254,107,97,63,246,139,99,63,14,148,101,63,98,132,103,63,33,93,105,63,133,30,107,63,213,200,108,63,103,92,110,63,155,217,111,63,224,64,113,63,172,146,114,63,131,207,115,63,241,247,116,63,139,12,118,63,239,13,119,63,193,252,119,63,172,217,120,63,99,165,121,63,155,96,122,63,15,12,123,63,124,168,123,63,163,54,124,63,71,183,124,63,41,43,125,63,13,147,125,63,183,239,125,63,229,65,126,63,89,138,126,63,205,201,126,63,251,0,127,63,150,48,127,63,78,89,127,63,205,123,127,63,182,152,127,63,167,176,127,63,53,196,127,63,239,211,127,63,91,224,127,63,245,233,127,63,51,241,127,63,127,246,127,63,59,250,127,63,190,252,127,63,84,254,127,63,64,255,127,63,186,255,127,63,238,255,127,63,254,255,127,63,0,0,128,63,169,12,120,55,54,134,11,57,38,198,193,57,94,226,61,58,234,237,156,58,85,101,234,58,56,170,35,59,207,219,89,59,169,226,139,59,42,178,174,59,13,91,213,59,204,219,255,59,91,25,23,60,250,46,48,60,194,45,75,60,156,20,104,60,46,113,131,60,225,202,147,60,185,22,165,60,1,84,183,60,245,129,202,60,198,159,222,60,155,172,243,60,199,211,4,61,213,71,16,61,250,49,28,61,174,145,40,61,101,102,53,61,141,175,66,61,140,108,80,61,193,156,94,61,133,63,109,61,41,84,124,61,252,236,133,61,26,232,141,61,13,27,150,61,110,133,158,61,212,38,167,61,210,254,175,61,245,12,185,61,200,80,194,61,209,201,203,61,146,119,213,61,139,89,223,61,51,111,233,61,2,184,243,61,105,51,254,61,106,112,4,62,214,223,9,62,171,103,15,62,153,7,21,62,77,191,26,62,116,142,32,62,181,116,38,62,184,113,44,62,34,133,50,62,149,174,56,62,178,237,62,62,21,66,69,62,92,171,75,62,30,41,82,62,243,186,88,62,112,96,95,62,40,25,102,62,170,228,108,62,132,194,115,62,68,178,122,62,185,217,128,62,203,98,132,62,26,244,135,62,105,141,139,62,120,46,143,62,6,215,146,62,211,134,150,62,156,61,154,62,29,251,157,62,19,191,161,62,57,137,165,62,71,89,169,62,249,46,173,62,5,10,177,62,36,234,180,62,13,207,184,62,117,184,188,62,18,166,192,62,153,151,196,62,190,140,200,62,52,133,204,62,175,128,208,62,225,126,212,62,125,127,216,62,52,130,220,62,184,134,224,62,185,140,228,62,233,147,232,62,248,155,236,62,150,164,240,62,117,173,244,62,67,182,248,62,178,190,252,62,57,99,0,63,153,102,2,63,82,105,4,63,60,107,6,63,48,108,8,63,6,108,10,63,151,106,12,63,188,103,14,63,78,99,16,63,39,93,18,63,33,85,20,63,21,75,22,63,222,62,24,63,87,48,26,63,92,31,28,63,199,11,30,63,117,245,31,63,66,220,33,63,12,192,35,63,176,160,37,63,12,126,39,63,254,87,41,63,104,46,43,63,39,1,45,63,29,208,46,63,43,155,48,63,51,98,50,63,23,37,52,63,188,227,53,63,4,158,55,63,214,83,57,63,23,5,59,63,173,177,60,63,128,89,62,63,120,252,63,63,126,154,65,63,124,51,67,63,93,199,68,63,12,86,70,63,119,223,71,63,138,99,73,63,54,226,74,63,104,91,76,63,17,207,77,63,35,61,79,63,145,165,80,63,76,8,82,63,75,101,83,63,130,188,84,63,231,13,86,63,114,89,87,63,26,159,88,63,218,222,89,63,172,24,91,63,138,76,92,63,113,122,93,63,93,162,94,63,78,196,95,63,67,224,96,63,58,246,97,63,54,6,99,63,56,16,100,63,67,20,101,63,92,18,102,63,133,10,103,63,198,252,103,63,37,233,104,63,168,207,105,63,89,176,106,63,64,139,107,63,102,96,108,63,216,47,109,63,159,249,109,63,201,189,110,63,97,124,111,63,118,53,112,63,23,233,112,63,81,151,113,63,53,64,114,63,212,227,114,63,61,130,115,63,131,27,116,63,184,175,116,63,238,62,117,63,56,201,117,63,171,78,118,63,90,207,118,63,90,75,119,63,192,194,119,63,162,53,120,63,21,164,120,63,48,14,121,63,8,116,121,63,182,213,121,63,79,51,122,63,235,140,122,63,162,226,122,63,139,52,123,63,191,130,123,63,85,205,123,63,102,20,124,63,9,88,124,63,88,152,124,63,106,213,124,63,88,15,125,63,58,70,125,63,41,122,125,63,62,171,125,63,143,217,125,63,54,5,126,63,75,46,126,63,228,84,126,63,27,121,126,63,7,155,126,63,190,186,126,63,88,216,126,63,236,243,126,63,144,13,127,63,91,37,127,63,99,59,127,63,188,79,127,63,125,98,127,63,185,115,127,63,135,131,127,63,249,145,127,63,36,159,127,63,26,171,127,63,238,181,127,63,179,191,127,63,122,200,127,63,85,208,127,63,84,215,127,63,136,221,127,63,0,227,127,63,204,231,127,63,249,235,127,63,150,239,127,63,177,242,127,63,85,245,127,63,144,247,127,63,109,249,127,63,246,250,127,63,54,252,127,63,55,253,127,63,1,254,127,63,156,254,127,63,18,255,127,63,103,255,127,63,163,255,127,63,204,255,127,63,229,255,127,63,244,255,127,63,252,255,127,63,255,255,127,63,0,0,128,63,0,0,128,63,60,12,120,54,253,134,11,56,19,201,193,56,248,231,61,57,148,245,156,57,115,118,234,57,238,186,35,58,113,249,89,58,32,251,139,58,96,216,174,58,34,148,213,58,3,23,0,59,209,82,23,59,65,125,48,59,21,150,75,59,8,157,104,59,233,200,131,59,20,58,148,59,218,161,165,59,16,0,184,59,136,84,203,59,16,159,223,59,118,223,244,59,194,138,5,60,128,32,17,60,217,48,29,60,172,187,41,60,219,192,54,60,67,64,68,60,194,57,82,60,52,173,96,60,115,154,111,60,88,1,127,60,222,112,135,60,186,157,143,60,42,7,152,60,25,173,160,60,112,143,169,60,23,174,178,60,246,8,188,60,243,159,197,60,245,114,207,60,225,129,217,60,156,204,227,60,10,83,238,60,14,21,249,60,70,9,2,61,177,165,7,61,187,95,13,61,81,55,19,61,102,44,25,61,230,62,31,61,195,110,37,61,233,187,43,61,71,38,50,61,202,173,56,61,97,82,63,61,247,19,70,61,121,242,76,61,210,237,83,61,240,5,91,61,187,58,98,61,32,140,105,61,8,250,112,61,93,132,120,61,132,21,128,61,249,246,131,61,130,230,135,61,19,228,139,61,159,239,143,61,26,9,148,61,119,48,152,61,169,101,156,61,163,168,160,61,88,249,164,61,186,87,169,61,186,195,173,61,76,61,178,61,95,196,182,61,230,88,187,61,209,250,191,61,18,170,196,61,152,102,201,61,85,48,206,61,56,7,211,61,48,235,215,61,47,220,220,61,34,218,225,61,248,228,230,61,161,252,235,61,11,33,241,61,35,82,246,61,217,143,251,61,13,109,0,62,105,24,3,62,247,201,5,62,174,129,8,62,133,63,11,62,113,3,14,62,104,205,16,62,96,157,19,62,79,115,22,62,42,79,25,62,232,48,28,62,124,24,31,62,221,5,34,62,255,248,36,62,215,241,39,62,90,240,42,62,125,244,45,62,51,254,48,62,114,13,52,62,45,34,55,62,88,60,58,62,232,91,61,62,208,128,64,62,3,171,67,62,118,218,70,62,26,15,74,62,229,72,77,62,199,135,80,62,181,203,83,62,162,20,87,62,127,98,90,62,63,181,93,62,213,12,97,62,50,105,100,62,73,202,103,62,12,48,107,62,108,154,110,62,92,9,114,62,203,124,117,62,173,244,120,62,241,112,124,62,138,241,127,62,52,187,129,62,190,127,131,62,91,70,133,62,4,15,135,62,176,217,136,62,89,166,138,62,245,116,140,62,126,69,142,62,234,23,144,62,50,236,145,62,78,194,147,62,54,154,149,62,224,115,151,62,70,79,153,62,93,44,155,62,31,11,157,62,130,235,158,62,127,205,160,62,11,177,162,62,31,150,164,62,177,124,166,62,186,100,168,62,47,78,170,62,9,57,172,62,62,37,174,62,198,18,176,62,150,1,178,62,167,241,179,62,238,226,181,62,100,213,183,62,254,200,185,62,179,189,187,62,122,179,189,62,74,170,191,62,25,162,193,62,221,154,195,62,142,148,197,62,34,143,199,62,142,138,201,62,203,134,203,62,205,131,205,62,140,129,207,62,253,127,209,62,24,127,211,62,210,126,213,62,33,127,215,62,252,127,217,62,88,129,219,62,45,131,221,62,112,133,223,62,23,136,225,62,25,139,227,62,108,142,229,62,5,146,231,62,219,149,233,62,228,153,235,62,21,158,237,62,102,162,239,62,203,166,241,62,59,171,243,62,173,175,245,62,21,180,247,62,107,184,249,62,164,188,251,62,181,192,253,62,150,196,255,62,30,228,0,63,207,229,1,63,88,231,2,63,182,232,3,63,226,233,4,63,215,234,5,63,146,235,6,63,12,236,7,63,66,236,8,63,45,236,9,63,202,235,10,63,19,235,11,63,4,234,12,63,151,232,13,63,200,230,14,63,145,228,15,63,239,225,16,63,220,222,17,63,84,219,18,63,81,215,19,63,208,210,20,63,202,205,21,63,61,200,22,63,34,194,23,63,117,187,24,63,50,180,25,63,85,172,26,63,215,163,27,63,182,154,28,63,236,144,29,63,117,134,30,63,77,123,31,63,110,111,32,63,214,98,33,63,126,85,34,63,100,71,35,63,130,56,36,63,212,40,37,63,87,24,38,63,5,7,39,63,219,244,39,63,213,225,40,63,239,205,41,63,36,185,42,63,113,163,43,63,209,140,44,63,64,117,45,63,188,92,46,63,63,67,47,63,199,40,48,63,78,13,49,63,211,240,49,63,80,211,50,63,195,180,51,63,39,149,52,63,122,116,53,63,184,82,54,63,220,47,55,63,229,11,56,63,206,230,56,63,149,192,57,63,54,153,58,63,174,112,59,63,249,70,60,63,21,28,61,63,255,239,61,63,179,194,62,63,48,148,63,63,113,100,64,63,116,51,65,63,55,1,66,63,182,205,66,63,239,152,67,63,224,98,68,63,134,43,69,63,222,242,69,63,230,184,70,63,156,125,71,63,253,64,72,63,7,3,73,63,184,195,73,63,14,131,74,63,6,65,75,63,159,253,75,63,215,184,76,63,172,114,77,63,28,43,78,63,38,226,78,63,199,151,79,63,253,75,80,63,201,254,80,63,39,176,81,63,22,96,82,63,150,14,83,63,164,187,83,63,63,103,84,63,103,17,85,63,26,186,85,63,86,97,86,63,28,7,87,63,105,171,87,63,62,78,88,63,152,239,88,63,120,143,89,63,221,45,90,63,198,202,90,63,50,102,91,63,33,0,92,63,147,152,92,63,134,47,93,63,251,196,93,63,242,88,94,63,105,235,94,63,98,124,95,63,219,11,96,63,213,153,96,63,80,38,97,63,76,177,97,63,201,58,98,63,199,194,98,63,70,73,99,63,71,206,99,63,202,81,100,63,208,211,100,63,88,84,101,63,100,211,101,63,244,80,102,63,9,205,102,63,163,71,103,63,195,192,103,63,107,56,104,63,154,174,104,63,82,35,105,63,147,150,105,63,96,8,106,63,184,120,106,63,157,231,106,63,16,85,107,63,19,193,107,63,166,43,108,63,203,148,108,63,132,252,108,63,209,98,109,63,180,199,109,63,48,43,110,63,68,141,110,63,244,237,110,63,64,77,111,63,42,171,111,63,181,7,112,63,225,98,112,63,177,188,112,63,38,21,113,63,67,108,113,63,10,194,113,63,123,22,114,63,155,105,114,63,106,187,114,63,234,11,115,63,31,91,115,63,9,169,115,63,172,245,115,63,9,65,116,63,35,139,116,63,252,211,116,63,151,27,117,63,245,97,117,63,26,167,117,63,8,235,117,63,193,45,118,63,72,111,118,63,159,175,118,63,202,238,118,63,201,44,119,63,161,105,119,63,84,165,119,63,228,223,119,63,85,25,120,63,168,81,120,63,226,136,120,63,3,191,120,63,16,244,120,63,11,40,121,63,247,90,121,63,215,140,121,63,173,189,121,63,125,237,121,63,73,28,122,63,20,74,122,63,226,118,122,63,181,162,122,63,144,205,122,63,118,247,122,63,107,32,123,63,112,72,123,63,138,111,123,63,186,149,123,63,5,187,123,63,109,223,123,63,245,2,124,63,160,37,124,63,113,71,124,63,108,104,124,63,147,136,124,63,233,167,124,63,114,198,124,63,48,228,124,63,38,1,125,63,89,29,125,63,201,56,125,63,124,83,125,63,115,109,125,63,178,134,125,63,60,159,125,63,19,183,125,63,60,206,125,63,184,228,125,63,139,250,125,63,184,15,126,63,66,36,126,63,44,56,126,63,120,75,126,63,43,94,126,63,70,112,126,63,204,129,126,63,194,146,126,63,41,163,126,63,4,179,126,63,86,194,126,63,35,209,126,63,109,223,126,63,55,237,126,63,131,250,126,63,85,7,127,63,175,19,127,63,148,31,127,63,7,43,127,63,10,54,127,63,160,64,127,63,205,74,127,63,146,84,127,63,242,93,127,63,239,102,127,63,141,111,127,63,206,119,127,63,181,127,127,63,67,135,127,63,124,142,127,63,98,149,127,63,247,155,127,63,61,162,127,63,56,168,127,63,233,173,127,63,83,179,127,63,120,184,127,63,90,189,127,63,252,193,127,63,95,198,127,63,134,202,127,63,116,206,127,63,41,210,127,63,168,213,127,63,244,216,127,63,13,220,127,63,247,222,127,63,179,225,127,63,67,228,127,63,168,230,127,63,229,232,127,63,252,234,127,63,237,236,127,63,188,238,127,63,105,240,127,63,246,241,127,63,101,243,127,63,183,244,127,63,238,245,127,63,11,247,127,63,16,248,127,63,254,248,127,63,214,249,127,63,155,250,127,63,76,251,127,63,236,251,127,63,124,252,127,63,252,252,127,63,110,253,127,63,211,253,127,63,44,254,127,63,121,254,127,63,189,254,127,63,247,254,127,63,42,255,127,63,84,255,127,63,120,255,127,63,150,255,127,63,175,255,127,63,195,255,127,63,211,255,127,63,224,255,127,63,234,255,127,63,241,255,127,63,246,255,127,63,250,255,127,63,253,255,127,63,254,255,127,63,255,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,171,15,120,53,24,135,11,55,225,201,193,55,107,233,61,56,128,247,156,56,187,122,234,56,24,191,35,57,213,0,90,57,56,1,140,57,229,225,174,57,88,162,213,57,60,33,0,58,24,97,23,58,175,144,48,58,243,175,75,58,212,190,104,58,159,222,131,58,143,85,148,58,48,196,165,58,119,42,184,58,90,136,203,58,204,221,223,58,191,42,245,58,148,183,5,59,124,85,17,59,16,111,29,59,73,4,42,59,31,21,55,59,138,161,68,59,129,169,82,59,252,44,97,59,241,43,112,59,88,166,127,59,19,206,135,59,169,6,144,59,233,124,152,59,204,48,161,59,79,34,170,59,106,81,179,59,26,190,188,59,86,104,198,59,26,80,208,59,95,117,218,59,31,216,228,59,83,120,239,59,244,85,250,59,126,184,2,60,177,100,8,60,145,47,14,60,25,25,20,60,70,33,26,60,19,72,32,60,126,141,38,60,129,241,44,60,25,116,51,60,65,21,58,60,246,212,64,60,50,179,71,60,243,175,78,60,50,203,85,60,235,4,93,60,26,93,100,60,186,211,107,60,198,104,115,60,58,28,123,60,7,119,129,60,33,111,133,60,102,118,137,60,212,140,141,60,105,178,145,60,33,231,149,60,251,42,154,60,243,125,158,60,6,224,162,60,50,81,167,60,115,209,171,60,199,96,176,60,43,255,180,60,154,172,185,60,19,105,190,60,146,52,195,60,20,15,200,60,149,248,204,60,19,241,209,60,137,248,214,60,245,14,220,60,83,52,225,60,160,104,230,60,215,171,235,60,246,253,240,60,249,94,246,60,220,206,251,60,205,166,0,61,153,109,3,61,207,59,6,61,109,17,9,61,114,238,11,61,220,210,14,61,167,190,17,61,211,177,20,61,94,172,23,61,68,174,26,61,133,183,29,61,30,200,32,61,12,224,35,61,78,255,38,61,225,37,42,61,196,83,45,61,243,136,48,61,109,197,51,61,47,9,55,61,55,84,58,61,130,166,61,61,15,0,65,61,218,96,68,61,226,200,71,61,35,56,75,61,156,174,78,61,73,44,82,61,40,177,85,61,55,61,89,61,115,208,92,61,217,106,96,61,103,12,100,61,25,181,103,61,238,100,107,61,227,27,111,61,244,217,114,61,30,159,118,61,96,107,122,61,182,62,126,61,143,12,129,61,73,253,130,61,138,241,132,61,79,233,134,61,150,228,136,61,94,227,138,61,167,229,140,61,109,235,142,61,175,244,144,61,109,1,147,61,164,17,149,61,83,37,151,61,120,60,153,61,17,87,155,61,30,117,157,61,155,150,159,61,136,187,161,61,226,227,163,61,169,15,166,61,218,62,168,61,116,113,170,61,116,167,172,61,218,224,174,61,162,29,177,61,205,93,179,61,87,161,181,61,62,232,183,61,130,50,186,61,32,128,188,61,22,209,190,61,98,37,193,61,2,125,195,61,245,215,197,61,57,54,200,61,203,151,202,61,169,252,204,61,211,100,207,61,68,208,209,61,252,62,212,61,249,176,214,61,56,38,217,61,184,158,219,61,117,26,222,61,111,153,224,61,163,27,227,61,14,161,229,61,175,41,232,61,132,181,234,61,138,68,237,61,191,214,239,61,33,108,242,61,174,4,245,61,99,160,247,61,62,63,250,61,61,225,252,61,93,134,255,61,78,23,1,62,252,108,2,62,56,196,3,62,255,28,5,62,81,119,6,62,45,211,7,62,145,48,9,62,125,143,10,62,238,239,11,62,228,81,13,62,94,181,14,62,89,26,16,62,214,128,17,62,210,232,18,62,77,82,20,62,69,189,21,62,184,41,23,62,166,151,24,62,13,7,26,62,236,119,27,62,65,234,28,62,11,94,30,62,73,211,31,62,250,73,33,62,28,194,34,62,173,59,36,62,172,182,37,62,24,51,39,62,240,176,40,62,50,48,42,62,220,176,43,62,238,50,45,62,101,182,46,62,64,59,48,62,126,193,49,62,30,73,51,62,29,210,52,62,123,92,54,62,54,232,55,62,76,117,57,62,187,3,59,62,131,147,60,62,162,36,62,62,22,183,63,62,222,74,65,62,248,223,66,62,98,118,68,62,28,14,70,62,35,167,71,62,117,65,73,62,18,221,74,62,247,121,76,62,35,24,78,62,149,183,79,62,74,88,81,62,66,250,82,62,121,157,84,62,240,65,86,62,163,231,87,62,146,142,89,62,186,54,91,62,26,224,92,62,177,138,94,62,124,54,96,62,122,227,97,62,169,145,99,62,7,65,101,62,147,241,102,62,75,163,104,62,44,86,106,62,54,10,108,62,102,191,109,62,187,117,111,62,51,45,113,62,204,229,114,62,132,159,116,62,90,90,118,62,75,22,120,62,85,211,121,62,120,145,123,62,176,80,125,62,253,16,127,62,46,105,128,62,101,74,129,62,36,44,130,62,105,14,131,62,52,241,131,62,130,212,132,62,84,184,133,62,169,156,134,62,127,129,135,62,213,102,136,62,171,76,137,62,255,50,138,62,209,25,139,62,32,1,140,62,233,232,140,62,46,209,141,62,236,185,142,62,34,163,143,62,208,140,144,62,244,118,145,62,142,97,146,62,156,76,147,62,29,56,148,62,17,36,149,62,118,16,150,62,76,253,150,62,144,234,151,62,67,216,152,62,99,198,153,62,239,180,154,62,230,163,155,62,71,147,156,62,17,131,157,62,67,115,158,62,219,99,159,62,218,84,160,62,60,70,161,62,3,56,162,62,43,42,163,62,181,28,164,62,160,15,165,62,233,2,166,62,145,246,166,62,149,234,167,62,245,222,168,62,176,211,169,62,197,200,170,62,50,190,171,62,246,179,172,62,17,170,173,62,129,160,174,62,69,151,175,62,91,142,176,62,196,133,177,62,125,125,178,62,133,117,179,62,220,109,180,62,128,102,181,62,112,95,182,62,171,88,183,62,47,82,184,62,252,75,185,62,17,70,186,62,108,64,187,62,11,59,188,62,239,53,189,62,22,49,190,62,126,44,191,62,38,40,192,62,13,36,193,62,51,32,194,62,150,28,195,62,52,25,196,62,12,22,197,62,30,19,198,62,104,16,199,62,233,13,200,62,159,11,201,62,138,9,202,62,169,7,203,62,249,5,204,62,123,4,205,62,44,3,206,62,11,2,207,62,24,1,208,62,81,0,209,62,181,255,209,62,66,255,210,62,248,254,211,62,213,254,212,62,216,254,213,62,255,254,214,62,75,255,215,62,184,255,216,62,71,0,218,62,245,0,219,62,195,1,220,62,173,2,221,62,180,3,222,62,214,4,223,62,17,6,224,62,101,7,225,62,208,8,226,62,81,10,227,62,231,11,228,62,144,13,229,62,76,15,230,62,25,17,231,62,245,18,232,62,224,20,233,62,217,22,234,62,221,24,235,62,236,26,236,62,5,29,237,62,39,31,238,62,79,33,239,62,125,35,240,62,176,37,241,62,230,39,242,62,31,42,243,62,88,44,244,62,145,46,245,62,200,48,246,62,253,50,247,62,45,53,248,62,88,55,249,62,124,57,250,62,153,59,251,62,172,61,252,62,181,63,253,62,179,65,254,62,163,67,255,62,195,34,0,63,173,163,0,63,142,36,1,63,102,165,1,63,53,38,2,63,250,166,2,63,180,39,3,63,99,168,3,63,5,41,4,63,155,169,4,63,36,42,5,63,159,170,5,63,12,43,6,63,105,171,6,63,183,43,7,63,244,171,7,63,32,44,8,63,59,172,8,63,68,44,9,63,58,172,9,63,28,44,10,63,235,171,10,63,164,43,11,63,73,171,11,63,216,42,12,63,80,170,12,63,177,41,13,63,251,168,13,63,44,40,14,63,69,167,14,63,68,38,15,63,41,165,15,63,243,35,16,63,162,162,16,63,53,33,17,63,172,159,17,63,5,30,18,63,65,156,18,63,95,26,19,63,94,152,19,63,61,22,20,63,252,147,20,63,155,17,21,63,24,143,21,63,116,12,22,63,173,137,22,63,195,6,23,63,182,131,23,63,133,0,24,63,46,125,24,63,179,249,24,63,18,118,25,63,74,242,25,63,91,110,26,63,69,234,26,63,6,102,27,63,159,225,27,63,14,93,28,63,84,216,28,63,111,83,29,63,95,206,29,63,36,73,30,63,188,195,30,63,40,62,31,63,102,184,31,63,119,50,32,63,90,172,32,63,14,38,33,63,146,159,33,63,230,24,34,63,10,146,34,63,253,10,35,63,190,131,35,63,77,252,35,63,169,116,36,63,211,236,36,63,200,100,37,63,138,220,37,63,22,84,38,63,110,203,38,63,143,66,39,63,122,185,39,63,47,48,40,63,172,166,40,63,241,28,41,63,254,146,41,63,210,8,42,63,108,126,42,63,205,243,42,63,243,104,43,63,223,221,43,63,143,82,44,63,3,199,44,63,59,59,45,63,54,175,45,63,244,34,46,63,116,150,46,63,182,9,47,63,185,124,47,63,125,239,47,63,1,98,48,63,69,212,48,63,72,70,49,63,10,184,49,63,139,41,50,63,202,154,50,63,198,11,51,63,127,124,51,63,246,236,51,63,40,93,52,63,22,205,52,63,191,60,53,63,36,172,53,63,66,27,54,63,27,138,54,63,174,248,54,63,249,102,55,63,254,212,55,63,187,66,56,63,47,176,56,63,91,29,57,63,63,138,57,63,217,246,57,63,41,99,58,63,48,207,58,63,236,58,59,63,93,166,59,63,130,17,60,63,93,124,60,63,235,230,60,63,44,81,61,63,33,187,61,63,201,36,62,63,35,142,62,63,48,247,62,63,238,95,63,63,94,200,63,63,126,48,64,63,80,152,64,63,209,255,64,63,3,103,65,63,228,205,65,63,117,52,66,63,181,154,66,63,163,0,67,63,64,102,67,63,139,203,67,63,131,48,68,63,41,149,68,63,124,249,68,63,123,93,69,63,39,193,69,63,127,36,70,63,132,135,70,63,51,234,70,63,142,76,71,63,148,174,71,63,68,16,72,63,159,113,72,63,164,210,72,63,83,51,73,63,172,147,73,63,174,243,73,63,89,83,74,63,173,178,74,63,169,17,75,63,77,112,75,63,154,206,75,63,143,44,76,63,43,138,76,63,110,231,76,63,89,68,77,63,234,160,77,63,34,253,77,63,0,89,78,63,133,180,78,63,176,15,79,63,128,106,79,63,246,196,79,63,18,31,80,63,210,120,80,63,56,210,80,63,66,43,81,63,242,131,81,63,69,220,81,63,61,52,82,63,217,139,82,63,24,227,82,63,252,57,83,63,131,144,83,63,174,230,83,63,123,60,84,63,236,145,84,63,0,231,84,63,183,59,85,63,16,144,85,63,12,228,85,63,170,55,86,63,235,138,86,63,206,221,86,63,83,48,87,63,121,130,87,63,66,212,87,63,172,37,88,63,184,118,88,63,101,199,88,63,180,23,89,63,164,103,89,63,53,183,89,63,104,6,90,63,59,85,90,63,175,163,90,63,197,241,90,63,123,63,91,63,210,140,91,63,201,217,91,63,97,38,92,63,154,114,92,63,115,190,92,63,237,9,93,63,7,85,93,63,194,159,93,63,29,234,93,63,24,52,94,63,179,125,94,63,239,198,94,63,203,15,95,63,72,88,95,63,100,160,95,63,33,232,95,63,126,47,96,63,123,118,96,63,24,189,96,63,85,3,97,63,51,73,97,63,177,142,97,63,207,211,97,63,141,24,98,63,236,92,98,63,235,160,98,63,138,228,98,63,202,39,99,63,170,106,99,63,42,173,99,63,75,239,99,63,13,49,100,63,111,114,100,63,114,179,100,63,21,244,100,63,90,52,101,63,63,116,101,63,197,179,101,63,236,242,101,63,180,49,102,63,29,112,102,63,39,174,102,63,211,235,102,63,32,41,103,63,15,102,103,63,159,162,103,63,209,222,103,63,164,26,104,63,26,86,104,63,49,145,104,63,235,203,104,63,71,6,105,63,69,64,105,63,230,121,105,63,42,179,105,63,16,236,105,63,153,36,106,63,197,92,106,63,148,148,106,63,7,204,106,63,29,3,107,63,214,57,107,63,52,112,107,63,53,166,107,63,218,219,107,63,36,17,108,63,18,70,108,63,164,122,108,63,220,174,108,63,184,226,108,63,57,22,109,63,96,73,109,63,44,124,109,63,157,174,109,63,181,224,109,63,115,18,110,63,214,67,110,63,225,116,110,63,146,165,110,63,233,213,110,63,232,5,111,63,142,53,111,63,219,100,111,63,209,147,111,63,110,194,111,63,179,240,111,63,160,30,112,63,54,76,112,63,117,121,112,63,93,166,112,63,239,210,112,63,41,255,112,63,14,43,113,63,156,86,113,63,213,129,113,63,184,172,113,63,70,215,113,63,127,1,114,63,99,43,114,63,243,84,114,63,46,126,114,63,21,167,114,63,169,207,114,63,233,247,114,63,214,31,115,63,113,71,115,63,184,110,115,63,173,149,115,63,80,188,115,63,162,226,115,63,161,8,116,63,80,46,116,63,174,83,116,63,187,120,116,63,119,157,116,63,228,193,116,63,1,230,116,63,206,9,117,63,76,45,117,63,123,80,117,63,92,115,117,63,238,149,117,63,51,184,117,63,42,218,117,63,211,251,117,63,48,29,118,63,64,62,118,63,3,95,118,63,122,127,118,63,166,159,118,63,134,191,118,63,27,223,118,63,101,254,118,63,101,29,119,63,27,60,119,63,135,90,119,63,169,120,119,63,131,150,119,63,19,180,119,63,91,209,119,63,91,238,119,63,20,11,120,63,132,39,120,63,174,67,120,63,145,95,120,63,46,123,120,63,132,150,120,63,149,177,120,63,96,204,120,63,231,230,120,63,41,1,121,63,38,27,121,63,223,52,121,63,85,78,121,63,136,103,121,63,120,128,121,63,37,153,121,63,144,177,121,63,185,201,121,63,161,225,121,63,72,249,121,63,174,16,122,63,212,39,122,63,185,62,122,63,96,85,122,63,198,107,122,63,238,129,122,63,216,151,122,63,131,173,122,63,241,194,122,63,33,216,122,63,20,237,122,63,202,1,123,63,68,22,123,63,130,42,123,63,133,62,123,63,77,82,123,63,217,101,123,63,43,121,123,63,68,140,123,63,34,159,123,63,200,177,123,63,52,196,123,63,104,214,123,63,99,232,123,63,39,250,123,63,180,11,124,63,9,29,124,63,40,46,124,63,17,63,124,63,196,79,124,63,65,96,124,63,137,112,124,63,156,128,124,63,124,144,124,63,39,160,124,63,158,175,124,63,226,190,124,63,244,205,124,63,211,220,124,63,128,235,124,63,251,249,124,63,69,8,125,63,94,22,125,63,71,36,125,63,255,49,125,63,136,63,125,63,225,76,125,63,11,90,125,63,7,103,125,63,212,115,125,63,115,128,125,63,229,140,125,63,42,153,125,63,66,165,125,63,46,177,125,63,238,188,125,63,130,200,125,63,235,211,125,63,41,223,125,63,61,234,125,63,38,245,125,63,230,255,125,63,124,10,126,63,234,20,126,63,47,31,126,63,75,41,126,63,64,51,126,63,13,61,126,63,180,70,126,63,51,80,126,63,140,89,126,63,191,98,126,63,205,107,126,63,181,116,126,63,120,125,126,63,23,134,126,63,146,142,126,63,233,150,126,63,28,159,126,63,44,167,126,63,26,175,126,63,229,182,126,63,142,190,126,63,22,198,126,63,124,205,126,63,194,212,126,63,231,219,126,63,235,226,126,63,208,233,126,63,149,240,126,63,59,247,126,63,195,253,126,63,44,4,127,63,118,10,127,63,163,16,127,63,179,22,127,63,165,28,127,63,123,34,127,63,52,40,127,63,210,45,127,63,83,51,127,63,186,56,127,63,5,62,127,63,53,67,127,63,75,72,127,63,72,77,127,63,42,82,127,63,243,86,127,63,163,91,127,63,58,96,127,63,185,100,127,63,32,105,127,63,111,109,127,63,166,113,127,63,199,117,127,63,208,121,127,63,196,125,127,63,161,129,127,63,104,133,127,63,25,137,127,63,182,140,127,63,61,144,127,63,176,147,127,63,14,151,127,63,89,154,127,63,143,157,127,63,179,160,127,63,195,163,127,63,192,166,127,63,171,169,127,63,132,172,127,63,74,175,127,63,255,177,127,63,163,180,127,63,53,183,127,63,183,185,127,63,40,188,127,63,137,190,127,63,217,192,127,63,26,195,127,63,76,197,127,63,111,199,127,63,130,201,127,63,135,203,127,63,126,205,127,63,102,207,127,63,65,209,127,63,14,211,127,63,205,212,127,63,128,214,127,63,38,216,127,63,191,217,127,63,76,219,127,63,204,220,127,63,65,222,127,63,170,223,127,63,8,225,127,63,91,226,127,63,163,227,127,63,224,228,127,63,19,230,127,63,59,231,127,63,90,232,127,63,110,233,127,63,122,234,127,63,124,235,127,63,116,236,127,63,100,237,127,63,75,238,127,63,42,239,127,63,1,240,127,63,207,240,127,63,149,241,127,63,84,242,127,63,12,243,127,63,188,243,127,63,101,244,127,63,7,245,127,63,162,245,127,63,55,246,127,63,198,246,127,63,78,247,127,63,209,247,127,63,77,248,127,63,196,248,127,63,54,249,127,63,162,249,127,63,9,250,127,63,108,250,127,63,201,250,127,63,34,251,127,63,118,251,127,63,198,251,127,63,18,252,127,63,89,252,127,63,157,252,127,63,221,252,127,63,26,253,127,63,83,253,127,63,136,253,127,63,187,253,127,63,234,253,127,63,22,254,127,63,64,254,127,63,103,254,127,63,139,254,127,63,173,254,127,63,204,254,127,63,234,254,127,63,5,255,127,63,30,255,127,63,53,255,127,63,74,255,127,63,94,255,127,63,112,255,127,63,128,255,127,63,143,255,127,63,157,255,127,63,169,255,127,63,180,255,127,63,191,255,127,63,200,255,127,63,208,255,127,63,215,255,127,63,221,255,127,63,227,255,127,63,232,255,127,63,236,255,127,63,239,255,127,63,243,255,127,63,245,255,127,63,248,255,127,63,249,255,127,63,251,255,127,63,252,255,127,63,253,255,127,63,254,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,204,8,120,52,171,134,11,54,79,202,193,54,190,233,61,55,238,247,156,55,192,123,234,55,43,192,35,56,161,2,90,56,189,2,140,56,76,228,174,56,227,165,213,56,199,35,0,57,168,100,23,57,134,149,48,57,104,182,75,57,64,199,104,57,7,228,131,57,105,92,148,57,191,204,165,57,6,53,184,57,65,149,203,57,105,237,223,57,120,61,245,57,184,194,5,58,166,98,17,58,134,126,29,58,81,22,42,58,9,42,55,58,172,185,68,58,54,197,82,58,165,76,97,58,250,79,112,58,47,207,127,58,34,229,135,58,154,32,144,58,255,153,152,58,80,81,161,58,139,70,170,58,174,121,179,58,186,234,188,58,171,153,198,58,129,134,208,58,58,177,218,58,212,25,229,58,79,192,239,58,167,164,250,58,109,227,2,59,117,147,8,59,105,98,14,59,73,80,20,59,19,93,26,59,199,136,32,59,100,211,38,59,232,60,45,59,83,197,51,59,164,108,58,59,218,50,65,59,243,23,72,59,239,27,79,59,204,62,86,59,138,128,93,59,38,225,100,59,161,96,108,59,249,254,115,59,45,188,123,59,29,204,129,59,145,201,133,59,113,214,137,59,188,242,141,59,113,30,146,59,145,89,150,59,26,164,154,59,12,254,158,59,102,103,163,59,40,224,167,59,80,104,172,59,222,255,176,59,209,166,181,59,40,93,186,59,228,34,191,59,2,248,195,59,131,220,200,59,101,208,205,59,168,211,210,59,74,230,215,59,76,8,221,59,172,57,226,59,105,122,231,59,131,202,236,59,249,41,242,59,202,152,247,59,245,22,253,59,60,82,1,60,170,32,4,60,196,246,6,60,137,212,9,60,249,185,12,60,19,167,15,60,216,155,18,60,69,152,21,60,92,156,24,60,26,168,27,60,129,187,30,60,143,214,33,60,69,249,36,60,160,35,40,60,162,85,43,60,73,143,46,60,149,208,49,60,133,25,53,60,26,106,56,60,81,194,59,60,44,34,63,60,168,137,66,60,199,248,69,60,134,111,73,60,230,237,76,60,231,115,80,60,134,1,84,60,197,150,87,60,162,51,91,60,28,216,94,60,52,132,98,60,232,55,102,60,56,243,105,60,35,182,109,60,170,128,113,60,202,82,117,60,131,44,121,60,214,13,125,60,96,123,128,60,161,115,130,60,174,111,132,60,134,111,134,60,40,115,136,60,149,122,138,60,205,133,140,60,206,148,142,60,152,167,144,60,44,190,146,60,136,216,148,60,173,246,150,60,154,24,153,60,78,62,155,60,202,103,157,60,13,149,159,60,23,198,161,60,231,250,163,60,125,51,166,60,217,111,168,60,249,175,170,60,223,243,172,60,137,59,175,60,247,134,177,60,40,214,179,60,29,41,182,60,213,127,184,60,80,218,186,60,140,56,189,60,138,154,191,60,74,0,194,60,202,105,196,60,11,215,198,60],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([12,72,201,60,205,188,203,60,77,53,206,60,140,177,208,60,137,49,211,60,69,181,213,60,189,60,216,60,243,199,218,60,230,86,221,60,149,233,223,60,0,128,226,60,39,26,229,60,8,184,231,60,164,89,234,60,250,254,236,60,9,168,239,60,210,84,242,60,83,5,245,60,141,185,247,60,126,113,250,60,39,45,253,60,134,236,255,60,206,87,1,61,52,187,2,61,117,32,4,61,144,135,5,61,133,240,6,61,84,91,8,61,253,199,9,61,128,54,11,61,219,166,12,61,16,25,14,61,29,141,15,61,3,3,17,61,193,122,18,61,87,244,19,61,197,111,21,61,10,237,22,61,39,108,24,61,26,237,25,61,228,111,27,61,132,244,28,61,251,122,30,61,71,3,32,61,105,141,33,61,96,25,35,61,45,167,36,61,206,54,38,61,67,200,39,61,141,91,41,61,171,240,42,61,156,135,44,61,96,32,46,61,248,186,47,61,99,87,49,61,160,245,50,61,175,149,52,61,144,55,54,61,67,219,55,61,199,128,57,61,28,40,59,61,65,209,60,61,56,124,62,61,254,40,64,61,148,215,65,61,250,135,67,61,47,58,69,61,51,238,70,61,5,164,72,61,166,91,74,61,20,21,76,61,80,208,77,61,90,141,79,61,49,76,81,61,212,12,83,61,68,207,84,61,128,147,86,61,135,89,88,61,90,33,90,61,248,234,91,61,97,182,93,61,148,131,95,61,145,82,97,61,88,35,99,61,232,245,100,61,65,202,102,61,100,160,104,61,78,120,106,61,1,82,108,61,123,45,110,61,188,10,112,61,197,233,113,61,148,202,115,61,41,173,117,61,133,145,119,61,166,119,121,61,140,95,123,61,55,73,125,61,166,52,127,61,237,144,128,61,105,136,129,61,198,128,130,61,5,122,131,61,37,116,132,61,39,111,133,61,9,107,134,61,204,103,135,61,112,101,136,61,244,99,137,61,88,99,138,61,157,99,139,61,193,100,140,61,196,102,141,61,167,105,142,61,106,109,143,61,11,114,144,61,139,119,145,61,234,125,146,61,40,133,147,61,67,141,148,61,61,150,149,61,20,160,150,61,201,170,151,61,92,182,152,61,203,194,153,61,24,208,154,61,66,222,155,61,72,237,156,61,42,253,157,61,233,13,159,61,132,31,160,61,250,49,161,61,76,69,162,61,122,89,163,61,130,110,164,61,101,132,165,61,35,155,166,61,188,178,167,61,47,203,168,61,124,228,169,61,162,254,170,61,163,25,172,61,124,53,173,61,47,82,174,61,187,111,175,61,31,142,176,61,92,173,177,61,113,205,178,61,94,238,179,61,35,16,181,61,192,50,182,61,52,86,183,61,127,122,184,61,160,159,185,61,153,197,186,61,104,236,187,61,13,20,189,61,136,60,190,61,217,101,191,61,255,143,192,61,250,186,193,61,202,230,194,61,111,19,196,61,233,64,197,61,55,111,198,61,89,158,199,61,78,206,200,61,23,255,201,61,179,48,203,61,35,99,204,61,101,150,205,61,121,202,206,61,96,255,207,61,25,53,209,61,164,107,210,61,0,163,211,61,45,219,212,61,44,20,214,61,251,77,215,61,154,136,216,61,10,196,217,61,74,0,219,61,89,61,220,61,56,123,221,61,230,185,222,61,99,249,223,61,174,57,225,61,200,122,226,61,176,188,227,61,102,255,228,61,233,66,230,61,58,135,231,61,88,204,232,61,66,18,234,61,249,88,235,61,124,160,236,61,203,232,237,61,230,49,239,61,204,123,240,61,125,198,241,61,249,17,243,61,63,94,244,61,79,171,245,61,42,249,246,61,206,71,248,61,60,151,249,61,114,231,250,61,114,56,252,61,58,138,253,61,202,220,254,61,17,24,0,62,33,194,0,62,149,108,1,62,108,23,2,62,166,194,2,62,68,110,3,62,69,26,4,62,168,198,4,62,111,115,5,62,152,32,6,62,35,206,6,62,17,124,7,62,98,42,8,62,20,217,8,62,40,136,9,62,157,55,10,62,117,231,10,62,173,151,11,62,71,72,12,62,66,249,12,62,158,170,13,62,91,92,14,62,120,14,15,62,246,192,15,62,213,115,16,62,19,39,17,62,177,218,17,62,175,142,18,62,13,67,19,62,202,247,19,62,231,172,20,62,99,98,21,62,62,24,22,62,120,206,22,62,16,133,23,62,7,60,24,62,92,243,24,62,16,171,25,62,33,99,26,62,145,27,27,62,94,212,27,62,137,141,28,62,17,71,29,62,246,0,30,62,56,187,30,62,215,117,31,62,211,48,32,62,43,236,32,62,224,167,33,62,241,99,34,62,93,32,35,62,38,221,35,62,74,154,36,62,202,87,37,62,165,21,38,62,219,211,38,62,108,146,39,62,88,81,40,62,159,16,41,62,64,208,41,62,59,144,42,62,144,80,43,62,63,17,44,62,72,210,44,62,170,147,45,62,102,85,46,62,122,23,47,62,232,217,47,62,175,156,48,62,206,95,49,62,69,35,50,62,21,231,50,62,61,171,51,62,189,111,52,62,148,52,53,62,195,249,53,62,73,191,54,62,38,133,55,62,91,75,56,62,230,17,57,62,199,216,57,62,255,159,58,62,141,103,59,62,113,47,60,62,171,247,60,62,59,192,61,62,31,137,62,62,89,82,63,62,232,27,64,62,204,229,64,62,5,176,65,62,146,122,66,62,115,69,67,62,168,16,68,62,49,220,68,62,14,168,69,62,62,116,70,62,194,64,71,62,152,13,72,62,193,218,72,62,61,168,73,62,12,118,74,62,44,68,75,62,159,18,76,62,100,225,76,62,122,176,77,62,225,127,78,62,154,79,79,62,164,31,80,62,255,239,80,62,170,192,81,62,166,145,82,62,242,98,83,62,141,52,84,62,121,6,85,62,180,216,85,62,63,171,86,62,25,126,87,62,65,81,88,62,185,36,89,62,126,248,89,62,147,204,90,62,245,160,91,62,165,117,92,62,163,74,93,62,238,31,94,62,135,245,94,62,109,203,95,62,159,161,96,62,30,120,97,62,233,78,98,62,1,38,99,62,100,253,99,62,19,213,100,62,14,173,101,62,84,133,102,62,229,93,103,62,193,54,104,62,231,15,105,62,88,233,105,62,19,195,106,62,24,157,107,62,103,119,108,62,255,81,109,62,224,44,110,62,11,8,111,62,126,227,111,62,58,191,112,62,62,155,113,62,139,119,114,62,31,84,115,62,251,48,116,62,31,14,117,62,138,235,117,62,59,201,118,62,52,167,119,62,115,133,120,62,248,99,121,62,196,66,122,62,213,33,123,62,44,1,124,62,200,224,124,62,170,192,125,62,208,160,126,62,59,129,127,62,245,48,128,62,111,161,128,62,11,18,129,62,201,130,129,62,168,243,129,62,169,100,130,62,204,213,130,62,15,71,131,62,117,184,131,62,251,41,132,62,162,155,132,62,107,13,133,62,84,127,133,62,93,241,133,62,136,99,134,62,210,213,134,62,61,72,135,62,200,186,135,62,116,45,136,62,63,160,136,62,42,19,137,62,52,134,137,62,94,249,137,62,168,108,138,62,17,224,138,62,153,83,139,62,64,199,139,62,6,59,140,62,235,174,140,62,239,34,141,62,17,151,141,62,82,11,142,62,177,127,142,62,46,244,142,62,201,104,143,62,130,221,143,62,89,82,144,62,78,199,144,62,96,60,145,62,143,177,145,62,220,38,146,62,70,156,146,62,205,17,147,62,113,135,147,62,50,253,147,62,16,115,148,62,9,233,148,62,32,95,149,62,82,213,149,62,161,75,150,62,12,194,150,62,146,56,151,62,53,175,151,62,243,37,152,62,204,156,152,62,193,19,153,62,209,138,153,62,252,1,154,62,66,121,154,62,163,240,154,62,31,104,155,62,181,223,155,62,101,87,156,62,48,207,156,62,21,71,157,62,20,191,157,62,45,55,158,62,96,175,158,62,172,39,159,62,18,160,159,62,145,24,160,62,41,145,160,62,218,9,161,62,165,130,161,62,136,251,161,62,132,116,162,62,152,237,162,62,197,102,163,62,10,224,163,62,103,89,164,62,220,210,164,62,105,76,165,62,14,198,165,62,202,63,166,62,158,185,166,62,137,51,167,62,139,173,167,62,164,39,168,62,213,161,168,62,27,28,169,62,121,150,169,62,237,16,170,62,119,139,170,62,24,6,171,62,206,128,171,62,155,251,171,62,125,118,172,62,117,241,172,62,130,108,173,62,165,231,173,62,221,98,174,62,42,222,174,62,140,89,175,62,2,213,175,62,142,80,176,62,46,204,176,62,226,71,177,62,170,195,177,62,135,63,178,62,119,187,178,62,124,55,179,62,148,179,179,62,191,47,180,62,254,171,180,62,80,40,181,62,181,164,181,62,45,33,182,62,184,157,182,62,85,26,183,62,5,151,183,62,199,19,184,62,156,144,184,62,130,13,185,62,123,138,185,62,133,7,186,62,161,132,186,62,206,1,187,62,13,127,187,62,93,252,187,62,190,121,188,62,48,247,188,62,178,116,189,62,70,242,189,62,233,111,190,62,157,237,190,62,98,107,191,62,54,233,191,62,26,103,192,62,14,229,192,62,17,99,193,62,36,225,193,62,70,95,194,62,119,221,194,62,184,91,195,62,7,218,195,62,100,88,196,62,209,214,196,62,75,85,197,62,212,211,197,62,107,82,198,62,16,209,198,62,195,79,199,62,132,206,199,62,82,77,200,62,45,204,200,62,21,75,201,62,11,202,201,62,13,73,202,62,29,200,202,62,56,71,203,62,97,198,203,62,149,69,204,62,214,196,204,62,34,68,205,62,123,195,205,62,223,66,206,62,79,194,206,62,202,65,207,62,81,193,207,62,226,64,208,62,127,192,208,62,38,64,209,62,216,191,209,62,148,63,210,62,91,191,210,62,44,63,211,62,7,191,211,62,235,62,212,62,218,190,212,62,210,62,213,62,211,190,213,62,222,62,214,62,242,190,214,62,15,63,215,62,53,191,215,62,99,63,216,62,154,191,216,62,217,63,217,62,32,192,217,62,112,64,218,62,199,192,218,62,38,65,219,62,140,193,219,62,250,65,220,62,112,194,220,62,236,66,221,62,112,195,221,62,250,67,222,62,139,196,222,62,34,69,223,62,192,197,223,62,100,70,224,62,14,199,224,62,189,71,225,62,115,200,225,62,46,73,226,62,239,201,226,62,181,74,227,62,127,203,227,62,79,76,228,62,36,205,228,62,253,77,229,62,219,206,229,62,190,79,230,62,164,208,230,62,142,81,231,62,125,210,231,62,111,83,232,62,100,212,232,62,93,85,233,62,89,214,233,62,89,87,234,62,91,216,234,62,96,89,235,62,104,218,235,62,114,91,236,62,126,220,236,62,141,93,237,62,158,222,237,62,176,95,238,62,196,224,238,62,218,97,239,62,241,226,239,62,10,100,240,62,35,229,240,62,62,102,241,62,89,231,241,62,116,104,242,62,145,233,242,62,173,106,243,62,202,235,243,62,230,108,244,62,3,238,244,62,31,111,245,62,59,240,245,62,86,113,246,62,112,242,246,62,137,115,247,62,161,244,247,62,184,117,248,62,206,246,248,62,226,119,249,62,244,248,249,62,4,122,250,62,18,251,250,62,30,124,251,62,40,253,251,62,47,126,252,62,52,255,252,62,54,128,253,62,52,1,254,62,48,130,254,62,40,3,255,62,29,132,255,62,135,2,0,63,254,66,0,63,115,131,0,63,230,195,0,63,86,4,1,63,197,68,1,63,49,133,1,63,155,197,1,63,3,6,2,63,103,70,2,63,202,134,2,63,42,199,2,63,135,7,3,63,225,71,3,63,56,136,3,63,141,200,3,63,222,8,4,63,44,73,4,63,119,137,4,63,191,201,4,63,3,10,5,63,68,74,5,63,130,138,5,63,188,202,5,63,242,10,6,63,36,75,6,63,83,139,6,63,126,203,6,63,165,11,7,63,199,75,7,63,230,139,7,63,1,204,7,63,23,12,8,63,41,76,8,63,54,140,8,63,63,204,8,63,67,12,9,63,67,76,9,63,62,140,9,63,52,204,9,63,37,12,10,63,18,76,10,63,249,139,10,63,219,203,10,63,184,11,11,63,144,75,11,63,98,139,11,63,47,203,11,63,246,10,12,63,184,74,12,63,116,138,12,63,43,202,12,63,219,9,13,63,134,73,13,63,43,137,13,63,202,200,13,63,98,8,14,63,245,71,14,63,129,135,14,63,7,199,14,63,135,6,15,63,0,70,15,63,114,133,15,63,222,196,15,63,67,4,16,63,161,67,16,63,249,130,16,63,73,194,16,63,147,1,17,63,213,64,17,63,17,128,17,63,69,191,17,63,114,254,17,63,151,61,18,63,181,124,18,63,203,187,18,63,218,250,18,63,225,57,19,63,225,120,19,63,216,183,19,63,200,246,19,63,176,53,20,63,143,116,20,63,103,179,20,63,54,242,20,63,253,48,21,63,188,111,21,63,114,174,21,63,32,237,21,63,197,43,22,63,98,106,22,63,246,168,22,63,129,231,22,63,3,38,23,63,125,100,23,63,237,162,23,63,84,225,23,63,178,31,24,63,7,94,24,63,83,156,24,63,149,218,24,63,206,24,25,63,253,86,25,63,35,149,25,63,63,211,25,63,82,17,26,63,90,79,26,63,89,141,26,63,78,203,26,63,57,9,27,63,25,71,27,63,240,132,27,63,188,194,27,63,126,0,28,63,54,62,28,63,227,123,28,63,134,185,28,63,30,247,28,63,172,52,29,63,47,114,29,63,167,175,29,63,20,237,29,63,118,42,30,63,206,103,30,63,26,165,30,63,91,226,30,63,145,31,31,63,188,92,31,63,219,153,31,63,239,214,31,63,247,19,32,63,244,80,32,63,230,141,32,63,203,202,32,63,165,7,33,63,115,68,33,63,53,129,33,63,235,189,33,63,150,250,33,63,52,55,34,63,198,115,34,63,75,176,34,63,197,236,34,63,50,41,35,63,146,101,35,63,230,161,35,63,46,222,35,63,105,26,36,63,151,86,36,63,185,146,36,63,205,206,36,63,213,10,37,63,208,70,37,63,190,130,37,63,158,190,37,63,114,250,37,63,56,54,38,63,241,113,38,63,157,173,38,63,59,233,38,63,204,36,39,63,79,96,39,63,197,155,39,63,45,215,39,63,135,18,40,63,211,77,40,63,18,137,40,63,66,196,40,63,101,255,40,63,121,58,41,63,128,117,41,63,120,176,41,63,98,235,41,63,62,38,42,63,11,97,42,63,202,155,42,63,122,214,42,63,28,17,43,63,175,75,43,63,52,134,43,63,170,192,43,63,16,251,43,63,105,53,44,63,178,111,44,63,236,169,44,63,23,228,44,63,51,30,45,63,64,88,45,63,61,146,45,63,43,204,45,63,10,6,46,63,218,63,46,63,154,121,46,63,74,179,46,63,235,236,46,63,124,38,47,63,254,95,47,63,112,153,47,63,210,210,47,63,36,12,48,63,102,69,48,63,152,126,48,63,186,183,48,63,204,240,48,63,205,41,49,63,191,98,49,63,160,155,49,63,113,212,49,63,49,13,50,63,225,69,50,63,128,126,50,63,15,183,50,63,141,239,50,63,251,39,51,63,87,96,51,63,163,152,51,63,222,208,51,63,8,9,52,63,34,65,52,63,42,121,52,63,33,177,52,63,7,233,52,63,219,32,53,63,159,88,53,63,81,144,53,63,242,199,53,63,129,255,53,63,255,54,54,63,108,110,54,63,198,165,54,63,16,221,54,63,71,20,55,63,109,75,55,63,129,130,55,63,131,185,55,63,116,240,55,63,82,39,56,63,30,94,56,63,217,148,56,63,129,203,56,63,23,2,57,63,155,56,57,63,13,111,57,63,108,165,57,63,185,219,57,63,244,17,58,63,28,72,58,63,50,126,58,63,53,180,58,63,38,234,58,63,4,32,59,63,207,85,59,63,135,139,59,63,45,193,59,63,192,246,59,63,64,44,60,63,173,97,60,63,7,151,60,63,78,204,60,63,130,1,61,63,163,54,61,63,177,107,61,63,171,160,61,63,146,213,61,63,102,10,62,63,39,63,62,63,212,115,62,63,110,168,62,63,244,220,62,63,103,17,63,63,198,69,63,63,17,122,63,63,73,174,63,63,109,226,63,63,126,22,64,63,122,74,64,63,99,126,64,63,56,178,64,63,248,229,64,63,165,25,65,63,62,77,65,63,195,128,65,63,52,180,65,63,144,231,65,63,216,26,66,63,13,78,66,63,44,129,66,63,56,180,66,63,47,231,66,63,18,26,67,63,224,76,67,63,154,127,67,63,64,178,67,63,208,228,67,63,77,23,68,63,180,73,68,63,7,124,68,63,69,174,68,63,111,224,68,63,131,18,69,63,131,68,69,63,110,118,69,63,68,168,69,63,5,218,69,63,177,11,70,63,72,61,70,63,202,110,70,63,55,160,70,63,143,209,70,63,210,2,71,63,255,51,71,63,23,101,71,63,26,150,71,63,8,199,71,63,224,247,71,63,163,40,72,63,81,89,72,63,233,137,72,63,107,186,72,63,216,234,72,63,48,27,73,63,114,75,73,63,158,123,73,63,181,171,73,63,181,219,73,63,161,11,74,63,118,59,74,63,54,107,74,63,224,154,74,63,116,202,74,63,242,249,74,63,90,41,75,63,173,88,75,63,233,135,75,63,15,183,75,63,32,230,75,63,26,21,76,63,254,67,76,63,204,114,76,63,132,161,76,63,38,208,76,63,177,254,76,63,38,45,77,63,133,91,77,63,206,137,77,63,0,184,77,63,28,230,77,63,34,20,78,63,17,66,78,63,234,111,78,63,172,157,78,63,88,203,78,63,238,248,78,63,108,38,79,63,213,83,79,63,38,129,79,63,97,174,79,63,134,219,79,63,147,8,80,63,138,53,80,63,107,98,80,63,52,143,80,63,231,187,80,63,131,232,80,63,8,21,81,63,119,65,81,63,206,109,81,63,15,154,81,63,57,198,81,63,76,242,81,63,71,30,82,63,44,74,82,63,250,117,82,63,177,161,82,63,81,205,82,63,218,248,82,63,76,36,83,63,166,79,83,63,234,122,83,63,22,166,83,63,44,209,83,63,42,252,83,63,17,39,84,63,224,81,84,63,153,124,84,63,58,167,84,63,196,209,84,63,54,252,84,63,146,38,85,63,214,80,85,63,2,123,85,63,24,165,85,63,22,207,85,63,252,248,85,63,204,34,86,63,131,76,86,63,36,118,86,63,172,159,86,63,30,201,86,63,120,242,86,63,186,27,87,63,229,68,87,63,248,109,87,63,244,150,87,63,216,191,87,63,165,232,87,63,90,17,88,63,248,57,88,63,126,98,88,63,236,138,88,63,67,179,88,63,130,219,88,63,169,3,89,63,185,43,89,63,177,83,89,63,145,123,89,63,90,163,89,63,11,203,89,63,164,242,89,63,37,26,90,63,143,65,90,63,225,104,90,63,27,144,90,63,62,183,90,63,72,222,90,63,59,5,91,63,22,44,91,63,217,82,91,63,133,121,91,63,24,160,91,63,148,198,91,63,248,236,91,63,68,19,92,63,120,57,92,63,149,95,92,63,153,133,92,63,134,171,92,63,91,209,92,63,24,247,92,63,189,28,93,63,74,66,93,63,191,103,93,63,28,141,93,63,98,178,93,63,143,215,93,63,165,252,93,63,162,33,94,63,136,70,94,63,86,107,94,63,11,144,94,63,169,180,94,63,47,217,94,63,157,253,94,63,243,33,95,63,49,70,95,63,88,106,95,63,102,142,95,63,92,178,95,63,59,214,95,63,1,250,95,63,175,29,96,63,70,65,96,63,196,100,96,63,43,136,96,63,122,171,96,63,176,206,96,63,207,241,96,63,214,20,97,63,197,55,97,63,155,90,97,63,90,125,97,63,1,160,97,63,144,194,97,63,8,229,97,63,103,7,98,63,174,41,98,63,221,75,98,63,245,109,98,63,244,143,98,63,220,177,98,63,171,211,98,63,99,245,98,63,3,23,99,63,139,56,99,63,251,89,99,63,83,123,99,63,147,156,99,63,188,189,99,63,204,222,99,63,197,255,99,63,166,32,100,63,110,65,100,63,32,98,100,63,185,130,100,63,58,163,100,63,164,195,100,63,245,227,100,63,47,4,101,63,82,36,101,63,92,68,101,63,78,100,101,63,41,132,101,63,236,163,101,63,151,195,101,63,43,227,101,63,167,2,102,63,11,34,102,63,87,65,102,63,139,96,102,63,168,127,102,63,174,158,102,63,155,189,102,63,113,220,102,63,47,251,102,63,214,25,103,63,101,56,103,63,220,86,103,63,59,117,103,63,132,147,103,63,180,177,103,63,205,207,103,63,206,237,103,63,184,11,104,63,138,41,104,63,69,71,104,63,233,100,104,63,116,130,104,63,233,159,104,63,69,189,104,63,139,218,104,63,185,247,104,63,207,20,105,63,207,49,105,63,182,78,105,63,135,107,105,63,64,136,105,63,225,164,105,63,108,193,105,63,223,221,105,63,59,250,105,63,127,22,106,63,172,50,106,63,195,78,106,63,193,106,106,63,169,134,106,63,121,162,106,63,51,190,106,63,213,217,106,63,96,245,106,63,212,16,107,63,48,44,107,63,118,71,107,63,165,98,107,63,188,125,107,63,189,152,107,63,167,179,107,63,121,206,107,63,53,233,107,63,218,3,108,63,104,30,108,63,223,56,108,63,63,83,108,63,136,109,108,63,187,135,108,63,214,161,108,63,219,187,108,63,201,213,108,63,161,239,108,63,97,9,109,63,11,35,109,63,159,60,109,63,27,86,109,63,129,111,109,63,209,136,109,63,9,162,109,63,44,187,109,63,56,212,109,63,45,237,109,63,12,6,110,63,212,30,110,63,134,55,110,63,33,80,110,63,166,104,110,63,21,129,110,63,110,153,110,63,176,177,110,63,220,201,110,63,241,225,110,63,241,249,110,63,218,17,111,63,173,41,111,63,106,65,111,63,16,89,111,63,161,112,111,63,28,136,111,63,128,159,111,63,207,182,111,63,7,206,111,63,42,229,111,63,54,252,111,63,45,19,112,63,14,42,112,63,217,64,112,63,142,87,112,63,46,110,112,63,184,132,112,63,43,155,112,63,138,177,112,63,210,199,112,63,5,222,112,63,35,244,112,63,42,10,113,63,29,32,113,63,249,53,113,63,193,75,113,63,114,97,113,63,15,119,113,63,150,140,113,63,7,162,113,63,99,183,113,63,170,204,113,63,220,225,113,63,249,246,113,63,0,12,114,63,242,32,114,63,207,53,114,63,151,74,114,63,73,95,114,63,231,115,114,63,112,136,114,63,227,156,114,63,66,177,114,63,140,197,114,63,193,217,114,63,225,237,114,63,236,1,115,63,227,21,115,63,197,41,115,63,146,61,115,63,74,81,115,63,238,100,115,63,125,120,115,63,248,139,115,63,94,159,115,63,175,178,115,63,236,197,115,63,21,217,115,63,41,236,115,63,41,255,115,63,21,18,116,63,236,36,116,63,175,55,116,63,94,74,116,63,248,92,116,63,127,111,116,63,241,129,116,63,80,148,116,63,154,166,116,63,208,184,116,63,242,202,116,63,1,221,116,63,251,238,116,63,226,0,117,63,181,18,117,63,116,36,117,63,31,54,117,63,183,71,117,63,59,89,117,63,171,106,117,63,8,124,117,63,81,141,117,63,135,158,117,63,169,175,117,63,184,192,117,63,179,209,117,63,155,226,117,63,112,243,117,63,50,4,118,63,224,20,118,63,123,37,118,63,3,54,118,63,120,70,118,63,217,86,118,63,40,103,118,63,100,119,118,63,140,135,118,63,162,151,118,63,165,167,118,63,149,183,118,63,114,199,118,63,61,215,118,63,245,230,118,63,154,246,118,63,44,6,119,63,172,21,119,63,26,37,119,63,117,52,119,63,189,67,119,63,243,82,119,63,22,98,119,63,40,113,119,63,39,128,119,63,19,143,119,63,238,157,119,63,182,172,119,63,108,187,119,63,16,202,119,63,162,216,119,63,34,231,119,63,144,245,119,63,236,3,120,63,55,18,120,63,111,32,120,63,150,46,120,63,170,60,120,63,174,74,120,63,159,88,120,63,127,102,120,63,77,116,120,63,10,130,120,63,181,143,120,63,79,157,120,63,215,170,120,63,78,184,120,63,180,197,120,63,8,211,120,63,76,224,120,63,126,237,120,63,158,250,120,63,174,7,121,63,173,20,121,63,155,33,121,63,119,46,121,63,67,59,121,63,254,71,121,63,168,84,121,63,66,97,121,63,202,109,121,63,66,122,121,63,169,134,121,63,0,147,121,63,70,159,121,63,124,171,121,63,161,183,121,63,181,195,121,63,186,207,121,63,173,219,121,63,145,231,121,63,100,243,121,63,40,255,121,63,219,10,122,63,126,22,122,63,16,34,122,63,147,45,122,63,6,57,122,63,105,68,122,63,188,79,122,63,255,90,122,63,51,102,122,63,86,113,122,63,106,124,122,63,111,135,122,63,99,146,122,63,72,157,122,63,30,168,122,63,228,178,122,63,155,189,122,63,66,200,122,63,218,210,122,63,99,221,122,63,221,231,122,63,71,242,122,63,162,252,122,63,238,6,123,63,43,17,123,63,89,27,123,63,120,37,123,63,137,47,123,63,138,57,123,63,124,67,123,63,96,77,123,63,53,87,123,63,252,96,123,63,179,106,123,63,92,116,123,63,247,125,123,63,131,135,123,63,1,145,123,63,112,154,123,63,209,163,123,63,36,173,123,63,104,182,123,63,158,191,123,63,198,200,123,63,224,209,123,63,236,218,123,63,234,227,123,63,218,236,123,63,188,245,123,63,144,254,123,63,86,7,124,63,14,16,124,63,185,24,124,63,86,33,124,63,230,41,124,63,104,50,124,63,220,58,124,63,67,67,124,63,156,75,124,63,232,83,124,63,39,92,124,63,88,100,124,63,124,108,124,63,147,116,124,63,157,124,124,63,153,132,124,63,137,140,124,63,107,148,124,63,65,156,124,63,9,164,124,63,197,171,124,63,116,179,124,63,22,187,124,63,172,194,124,63,52,202,124,63,176,209,124,63,32,217,124,63,131,224,124,63,217,231,124,63,35,239,124,63,97,246,124,63,146,253,124,63,183,4,125,63,208,11,125,63,221,18,125,63,221,25,125,63,209,32,125,63,185,39,125,63,150,46,125,63,102,53,125,63,42,60,125,63,227,66,125,63,143,73,125,63,48,80,125,63,197,86,125,63,78,93,125,63,204,99,125,63,62,106,125,63,165,112,125,63,0,119,125,63,80,125,125,63,148,131,125,63,205,137,125,63,251,143,125,63,29,150,125,63,52,156,125,63,64,162,125,63,65,168,125,63,55,174,125,63,34,180,125,63,2,186,125,63,215,191,125,63,161,197,125,63,96,203,125,63,21,209,125,63,190,214,125,63,93,220,125,63,242,225,125,63,124,231,125,63,251,236,125,63,112,242,125,63,218,247,125,63,58,253,125,63,143,2,126,63,219,7,126,63,28,13,126,63,82,18,126,63,127,23,126,63,161,28,126,63,186,33,126,63,200,38,126,63,204,43,126,63,199,48,126,63,183,53,126,63,158,58,126,63,123,63,126,63,78,68,126,63,23,73,126,63,215,77,126,63,141,82,126,63,58,87,126,63,221,91,126,63,118,96,126,63,6,101,126,63,141,105,126,63,10,110,126,63,126,114,126,63,233,118,126,63,75,123,126,63,164,127,126,63,243,131,126,63,57,136,126,63,119,140,126,63,171,144,126,63,214,148,126,63,249,152,126,63,18,157,126,63,35,161,126,63,44,165,126,63,43,169,126,63,34,173,126,63,16,177,126,63,246,180,126,63,211,184,126,63,167,188,126,63,115,192,126,63,55,196,126,63,243,199,126,63,166,203,126,63,81,207,126,63,243,210,126,63,142,214,126,63,32,218,126,63,171,221,126,63,45,225,126,63,167,228,126,63,26,232,126,63,132,235,126,63,231,238,126,63,66,242,126,63,149,245,126,63,224,248,126,63,36,252,126,63,96,255,126,63,148,2,127,63,193,5,127,63,230,8,127,63,4,12,127,63,27,15,127,63,42,18,127,63,50,21,127,63,50,24,127,63,43,27,127,63,29,30,127,63,8,33,127,63,236,35,127,63,201,38,127,63,158,41,127,63,109,44,127,63,53,47,127,63,246,49,127,63,175,52,127,63,99,55,127,63,15,58,127,63,181,60,127,63,83,63,127,63,236,65,127,63,125,68,127,63,8,71,127,63,141,73,127,63,11,76,127,63,131,78,127,63,244,80,127,63,95,83,127,63,195,85,127,63,33,88,127,63,121,90,127,63,203,92,127,63,23,95,127,63,92,97,127,63,155,99,127,63,213,101,127,63,8,104,127,63,54,106,127,63,93,108,127,63,127,110,127,63,155,112,127,63,177,114,127,63,193,116,127,63,203,118,127,63,208,120,127,63,207,122,127,63,201,124,127,63,189,126,127,63,171,128,127,63,148,130,127,63,120,132,127,63,86,134,127,63,47,136,127,63,2,138,127,63,209,139,127,63,153,141,127,63,93,143,127,63,28,145,127,63,213,146,127,63,137,148,127,63,57,150,127,63,227,151,127,63,136,153,127,63,40,155,127,63,196,156,127,63,90,158,127,63,236,159,127,63,121,161,127,63,1,163,127,63,132,164,127,63,3,166,127,63,125,167,127,63,242,168,127,63,99,170,127,63,207,171,127,63,55,173,127,63,154,174,127,63,249,175,127,63,84,177,127,63,170,178,127,63,251,179,127,63,73,181,127,63,146,182,127,63,215,183,127,63,24,185,127,63,85,186,127,63,141,187,127,63,193,188,127,63,242,189,127,63,30,191,127,63,71,192,127,63,107,193,127,63,140,194,127,63,168,195,127,63,193,196,127,63,214,197,127,63,231,198,127,63,245,199,127,63,255,200,127,63,5,202,127,63,7,203,127,63,6,204,127,63,1,205,127,63,249,205,127,63,237,206,127,63,222,207,127,63,203,208,127,63,181,209,127,63,156,210,127,63,127,211,127,63,95,212,127,63,59,213,127,63,20,214,127,63,234,214,127,63,189,215,127,63,141,216,127,63,90,217,127,63,35,218,127,63,233,218,127,63,173,219,127,63,109,220,127,63,43,221,127,63,229,221,127,63,156,222,127,63,81,223,127,63,3,224,127,63,178,224,127,63,94,225,127,63,7,226,127,63,174,226,127,63,82,227,127,63,243,227,127,63,146,228,127,63,46,229,127,63,199,229,127,63,94,230,127,63,242,230,127,63,132,231,127,63,19,232,127,63,160,232,127,63,42,233,127,63,178,233,127,63,56,234,127,63,187,234,127,63,60,235,127,63,187,235,127,63,55,236,127,63,177,236,127,63,41,237,127,63,159,237,127,63,18,238,127,63,132,238,127,63,243,238,127,63,96,239,127,63,204,239,127,63,53,240,127,63,156,240,127,63,1,241,127,63,101,241,127,63,198,241,127,63,37,242,127,63,131,242,127,63,222,242,127,63,56,243,127,63,144,243,127,63,231,243,127,63,59,244,127,63,142,244,127,63,223,244,127,63,46,245,127,63,124,245,127,63,200,245,127,63,19,246,127,63,91,246,127,63,163,246,127,63,233,246,127,63,45,247,127,63,111,247,127,63,177,247,127,63,240,247,127,63,47,248,127,63,108,248,127,63,167,248,127,63,225,248,127,63,26,249,127,63,82,249,127,63,136,249,127,63,188,249,127,63,240,249,127,63,34,250,127,63,83,250,127,63,131,250,127,63,178,250,127,63,224,250,127,63,12,251,127,63,55,251,127,63,97,251,127,63,138,251,127,63,178,251,127,63,217,251,127,63,255,251,127,63,36,252,127,63,72,252,127,63,107,252,127,63,141,252,127,63,173,252,127,63,205,252,127,63,237,252,127,63,11,253,127,63,40,253,127,63,69,253,127,63,96,253,127,63,123,253,127,63,149,253,127,63,174,253,127,63,199,253,127,63,222,253,127,63,245,253,127,63,12,254,127,63,33,254,127,63,54,254,127,63,74,254,127,63,93,254,127,63,112,254,127,63,130,254,127,63,148,254,127,63,165,254,127,63,181,254,127,63,197,254,127,63,212,254,127,63,227,254,127,63,241,254,127,63,254,254,127,63,11,255,127,63,24,255,127,63,36,255,127,63,47,255,127,63,59,255,127,63,69,255,127,63,79,255,127,63,89,255,127,63,99,255,127,63,108,255,127,63,116,255,127,63,124,255,127,63,132,255,127,63,140,255,127,63,147,255,127,63,154,255,127,63,160,255,127,63,166,255,127,63,172,255,127,63,178,255,127,63,183,255,127,63,188,255,127,63,193,255,127,63,197,255,127,63,202,255,127,63,206,255,127,63,209,255,127,63,213,255,127,63,216,255,127,63,220,255,127,63,223,255,127,63,225,255,127,63,228,255,127,63,230,255,127,63,233,255,127,63,235,255,127,63,237,255,127,63,239,255,127,63,240,255,127,63,242,255,127,63,243,255,127,63,245,255,127,63,246,255,127,63,247,255,127,63,248,255,127,63,249,255,127,63,250,255,127,63,251,255,127,63,251,255,127,63,252,255,127,63,252,255,127,63,253,255,127,63,253,255,127,63,254,255,127,63,254,255,127,63,254,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,198,63,120,51,98,136,11,53,151,200,193,53,80,233,61,54,183,247,156,54,46,124,234,54,153,192,35,55,244,2,90,55,56,3,140,55,227,228,174,55,177,166,213,55,108,36,0,56,146,101,23,56,201,150,48,56,18,184,75,56,81,201,104,56,94,229,131,56,29,94,148,56,229,206,165,56,167,55,184,56,128,152,203,56,85,241,223,56,36,66,245,56,126,197,5,57,238,101,17,57,99,130,29,57,207,26,42,57,63,47,55,57,179,191,68,57,30,204,82,57,141,84,97,57,243,88,112,57,94,217,127,57,227,234,135,57,18,39,144,57,64,161,152,57,105,89,161,57,146,79,170,57,181,131,179,57,215,245,188,57,245,165,198,57,14,148,208,57,34,192,218,57,46,42,229,57,57,210,239,57,60,184,250,57,27,238,2,58,22,159,8,58,13,111,14,58,0,94,20,58,239,107,26,58,218,152,32,58,192,228,38,58,161,79,45,58,124,217,51,58,83,130,58,58,37,74,65,58,240,48,72,58,182,54,79,58,116,91,86,58,45,159,93,58,222,1,101,58,136,131,108,58,42,36,116,58,196,227,123,58,44,225,129,58,241,223,133,58,49,238,137,58,238,11,142,58,37,57,146,58,215,117,150,58,5,194,154,58,174,29,159,58,209,136,163,58,110,3,168,58,134,141,172,58,24,39,177,58,36,208,181,58,169,136,186,58,169,80,191,58,33,40,196,58,19,15,201,58,126,5,206,58,98,11,211,58,191,32,216,58,148,69,221,58,225,121,226,58,166,189,231,58,227,16,237,58,152,115,242,58,196,229,247,58,103,103,253,58,65,124,1,59,137,76,4,59,141,36,7,59,76,4,10,59,198,235,12,59,251,218,15,59,235,209,18,59,149,208,21,59,251,214,24,59,26,229,27,59,244,250,30,59,136,24,34,59,215,61,37,59,223,106,40,59,161,159,43,59,29,220,46,59,83,32,50,59,66,108,53,59,234,191,56,59,76,27,60,59,103,126,63,59,59,233,66,59,199,91,70,59,12,214,73,59,10,88,77,59,193,225,80,59,48,115,84,59,86,12,88,59,53,173,91,59,204,85,95,59,26,6,99,59,32,190,102,59,222,125,106,59,82,69,110,59,127,20,114,59,97,235,117,59,251,201,121,59,76,176,125,59,41,207,128,59,8,202,130,59,194,200,132,59,87,203,134,59,198,209,136,59,17,220,138,59,55,234,140,59,55,252,142,59,18,18,145,59,199,43,147,59,87,73,149,59,194,106,151,59,6,144,153,59,37,185,155,59,30,230,157,59,241,22,160,59,158,75,162,59,37,132,164,59,134,192,166,59,192,0,169,59,212,68,171,59,193,140,173,59,137,216,175,59,41,40,178,59,163,123,180,59,245,210,182,59,33,46,185,59,38,141,187,59,4,240,189,59,186,86,192,59,73,193,194,59,177,47,197,59,242,161,199,59,10,24,202,59,251,145,204,59,196,15,207,59,102,145,209,59,223,22,212,59,49,160,214,59,90,45,217,59,91,190,219,59,51,83,222,59,227,235,224,59,107,136,227,59,201,40,230,59,255,204,232,59,12,117,235,59,240,32,238,59,171,208,240,59,61,132,243,59,165,59,246,59,228,246,248,59,250,181,251,59,229,120,254,59,212,159,0,60,32,5,2,60,87,108,3,60,121,213,4,60,134,64,6,60,126,173,7,60,96,28,9,60,45,141,10,60,229,255,11,60,136,116,13,60,21,235,14,60,141,99,16,60,239,221,17,60,59,90,19,60,114,216,20,60,147,88,22,60,158,218,23,60,147,94,25,60,115,228,26,60,60,108,28,60,240,245,29,60,141,129,31,60,20,15,33,60,133,158,34,60,224,47,36,60,36,195,37,60,82,88,39,60,105,239,40,60,106,136,42,60,84,35,44,60,40,192,45,60,229,94,47,60,139,255,48,60,26,162,50,60,146,70,52,60,243,236,53,60,61,149,55,60,112,63,57,60,140,235,58,60,145,153,60,60,126,73,62,60,84,251,63,60,18,175,65,60,185,100,67,60,72,28,69,60,192,213,70,60,31,145,72,60,103,78,74,60,151,13,76,60,175,206,77,60,176,145,79,60,152,86,81,60,103,29,83,60,31,230,84,60,190,176,86,60,69,125,88,60,179,75,90,60,9,28,92,60,71,238,93,60,107,194,95,60,119,152,97,60,106,112,99,60,68,74,101,60,5,38,103,60,173,3,105,60,60,227,106,60,178,196,108,60,14,168,110,60,81,141,112,60,123,116,114,60,139,93,116,60,130,72,118,60,95,53,120,60,34,36,122,60,203,20,124,60,90,7,126,60,208,251,127,60,22,249,128,60,54,245,129,60,74,242,130,60,80,240,131,60,73,239,132,60,53,239,133,60,19,240,134,60,229,241,135,60,169,244,136,60,95,248,137,60,8,253,138,60,164,2,140,60,50,9,141,60,178,16,142,60,37,25,143,60,139,34,144,60,226,44,145,60,44,56,146,60,104,68,147,60,150,81,148,60,182,95,149,60,201,110,150,60,205,126,151,60,196,143,152,60,172,161,153,60,135,180,154,60,83,200,155,60,17,221,156,60,193,242,157,60,98,9,159,60,245,32,160,60,122,57,161,60,241,82,162,60,89,109,163,60,178,136,164,60,253,164,165,60,57,194,166,60,103,224,167,60,134,255,168,60,151,31,170,60,152,64,171,60,139,98,172,60,111,133,173,60,68,169,174,60,10,206,175,60,193,243,176,60,105,26,178,60,2,66,179,60,139,106,180,60,6,148,181,60,113,190,182,60,205,233,183,60,26,22,185,60,87,67,186,60,133,113,187,60,163,160,188,60,177,208,189,60,177,1,191,60,160,51,192,60,128,102,193,60,80,154,194,60,16,207,195,60,193,4,197,60,97,59,198,60,242,114,199,60,114,171,200,60,227,228,201,60,67,31,203,60,147,90,204,60,211,150,205,60,3,212,206,60,34,18,208,60,49,81,209,60,48,145,210,60,30,210,211,60,252,19,213,60,201,86,214,60,133,154,215,60,49,223,216,60,204,36,218,60,86,107,219,60,208,178,220,60,56,251,221,60,144,68,223,60,214,142,224,60,12,218,225,60,48,38,227,60,67,115,228,60,69,193,229,60,54,16,231,60,21,96,232,60,227,176,233,60,160,2,235,60,75,85,236,60,228,168,237,60,108,253,238,60,226,82,240,60,70,169,241,60,153,0,243,60,218,88,244,60,8,178,245,60,37,12,247,60,48,103,248,60,41,195,249,60,15,32,251,60,228,125,252,60,166,220,253,60,85,60,255,60,121,78,0,61,63,255,0,61,123,176,1,61,46,98,2,61,88,20,3,61,248,198,3,61,15,122,4,61,156,45,5,61,161,225,5,61,27,150,6,61,12,75,7,61,116,0,8,61,82,182,8,61,167,108,9,61,113,35,10,61,179,218,10,61,106,146,11,61,152,74,12,61,60,3,13,61,87,188,13,61,231,117,14,61,238,47,15,61,107,234,15,61,94,165,16,61,199,96,17,61,166,28,18,61,251,216,18,61,198,149,19,61,7,83,20,61,190,16,21,61,234,206,21,61,141,141,22,61,165,76,23,61,52,12,24,61,56,204,24,61,177,140,25,61,161,77,26,61,6,15,27,61,224,208,27,61,48,147,28,61,246,85,29,61,49,25,30,61,226,220,30,61,8,161,31,61,164,101,32,61,181,42,33,61,59,240,33,61,55,182,34,61,168,124,35,61,142,67,36,61,233,10,37,61,186,210,37,61,255,154,38,61,186,99,39,61,234,44,40,61,143,246,40,61,168,192,41,61,55,139,42,61,59,86,43,61,180,33,44,61,161,237,44,61,4,186,45,61,219,134,46,61,38,84,47,61,231,33,48,61,28,240,48,61,198,190,49,61,229,141,50,61,120,93,51,61,127,45,52,61,251,253,52,61,236,206,53,61,81,160,54,61,42,114,55,61,120,68,56,61,58,23,57,61,112,234,57,61,27,190,58,61,58,146,59,61,204,102,60,61,211,59,61,61,79,17,62,61,62,231,62,61,161,189,63,61,120,148,64,61,195,107,65,61,130,67,66,61,181,27,67,61,92,244,67,61,118,205,68,61,4,167,69,61,6,129,70,61,124,91,71,61,101,54,72,61,194,17,73,61,146,237,73,61,214,201,74,61,141,166,75,61,184,131,76,61,86,97,77,61,104,63,78,61,236,29,79,61,229,252,79,61,80,220,80,61,46,188,81,61,128,156,82,61,69,125,83,61,125,94,84,61,40,64,85,61,69,34,86,61,214,4,87,61,218,231,87,61,81,203,88,61,58,175,89,61,150,147,90,61,101,120,91,61,167,93,92,61,91,67,93,61,130,41,94,61,28,16,95,61,40,247,95,61,167,222,96,61,152,198,97,61,251,174,98,61,209,151,99,61,25,129,100,61,212,106,101,61,0,85,102,61,159,63,103,61,176,42,104,61,51,22,105,61,41,2,106,61,144,238,106,61,105,219,107,61,180,200,108,61,113,182,109,61,160,164,110,61,65,147,111,61,84,130,112,61,216,113,113,61,206,97,114,61,54,82,115,61,15,67,116,61,89,52,117,61,22,38,118,61,67,24,119,61,226,10,120,61,243,253,120,61,117,241,121,61,104,229,122,61,204,217,123,61,162,206,124,61,232,195,125,61,160,185,126,61,201,175,127,61,49,83,128,61,183,206,128,61,117,74,129,61,107,198,129,61,154,66,130,61,1,191,130,61,160,59,131,61,120,184,131,61,136,53,132,61,209,178,132,61,81,48,133,61,10,174,133,61,251,43,134,61,37,170,134,61,134,40,135,61,32,167,135,61,242,37,136,61,252,164,136,61,62,36,137,61,184,163,137,61,106,35,138,61,84,163,138,61,118,35,139,61,209,163,139,61,99,36,140,61,45,165,140,61,46,38,141,61,104,167,141,61,218,40,142,61,131,170,142,61,100,44,143,61,125,174,143,61,206,48,144,61,86,179,144,61,23,54,145,61,14,185,145,61,62,60,146,61,165,191,146,61,67,67,147,61,26,199,147,61,39,75,148,61,109,207,148,61,234,83,149,61,158,216,149,61,138,93,150,61,173,226,150,61,7,104,151,61,153,237,151,61,98,115,152,61,99,249,152,61,155,127,153,61,10,6,154,61,176,140,154,61,142,19,155,61,163,154,155,61,239,33,156,61,114,169,156,61,44,49,157,61,29,185,157,61,69,65,158,61,165,201,158,61,59,82,159,61,8,219,159,61,13,100,160,61,72,237,160,61,186,118,161,61,99,0,162,61,67,138,162,61,90,20,163,61,167,158,163,61,43,41,164,61,230,179,164,61,216,62,165,61,0,202,165,61,95,85,166,61,245,224,166,61,193,108,167,61,196,248,167,61,254,132,168,61,110,17,169,61,20,158,169,61,241,42,170,61,4,184,170,61,78,69,171,61,206,210,171,61,133,96,172,61,113,238,172,61,149,124,173,61,238,10,174,61,126,153,174,61,67,40,175,61,63,183,175,61,114,70,176,61,218,213,176,61,120,101,177,61,77,245,177,61,88,133,178,61,152,21,179,61,15,166,179,61,187,54,180,61,158,199,180,61,182,88,181,61,4,234,181,61,137,123,182,61,67,13,183,61,50,159,183,61,88,49,184,61,179,195,184,61,68,86,185,61,11,233,185,61,7,124,186,61,57,15,187,61,160,162,187,61,61,54,188,61,16,202,188,61,24,94,189,61,85,242,189,61,200,134,190,61,112,27,191,61,78,176,191,61,97,69,192,61,170,218,192,61,39,112,193,61,218,5,194,61,194,155,194,61,224,49,195,61,50,200,195,61,186,94,196,61,119,245,196,61,104,140,197,61,143,35,198,61,235,186,198,61,124,82,199,61,66,234,199,61,61,130,200,61,108,26,201,61,209,178,201,61,106,75,202,61,57,228,202,61,59,125,203,61,115,22,204,61,224,175,204,61,129,73,205,61,86,227,205,61,97,125,206,61,159,23,207,61,19,178,207,61,187,76,208,61,151,231,208,61,168,130,209,61,237,29,210,61],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([103,185,210,61,21,85,211,61,248,240,211,61,14,141,212,61,89,41,213,61,216,197,213,61,140,98,214,61,115,255,214,61,143,156,215,61,223,57,216,61,99,215,216,61,27,117,217,61,7,19,218,61,38,177,218,61,122,79,219,61,2,238,219,61,189,140,220,61,173,43,221,61,208,202,221,61,39,106,222,61,178,9,223,61,112,169,223,61,98,73,224,61,136,233,224,61,226,137,225,61,111,42,226,61,47,203,226,61,35,108,227,61,74,13,228,61,165,174,228,61,52,80,229,61,245,241,229,61,234,147,230,61,19,54,231,61,110,216,231,61,253,122,232,61,191,29,233,61,180,192,233,61,221,99,234,61,56,7,235,61,199,170,235,61,136,78,236,61,125,242,236,61,164,150,237,61,255,58,238,61,140,223,238,61,76,132,239,61,63,41,240,61,101,206,240,61,189,115,241,61,73,25,242,61,7,191,242,61,247,100,243,61,26,11,244,61,112,177,244,61,248,87,245,61,179,254,245,61,160,165,246,61,192,76,247,61,18,244,247,61,151,155,248,61,77,67,249,61,55,235,249,61,82,147,250,61,159,59,251,61,31,228,251,61,209,140,252,61,181,53,253,61,203,222,253,61,19,136,254,61,141,49,255,61,57,219,255,61,140,66,0,62,148,151,0,62,181,236,0,62,238,65,1,62,65,151,1,62,173,236,1,62,49,66,2,62,206,151,2,62,132,237,2,62,83,67,3,62,59,153,3,62,59,239,3,62,84,69,4,62,134,155,4,62,209,241,4,62,52,72,5,62,176,158,5,62,68,245,5,62,242,75,6,62,183,162,6,62,150,249,6,62,141,80,7,62,156,167,7,62,196,254,7,62,5,86,8,62,94,173,8,62,207,4,9,62,89,92,9,62,252,179,9,62,183,11,10,62,138,99,10,62,118,187,10,62,122,19,11,62,150,107,11,62,203,195,11,62,24,28,12,62,125,116,12,62,250,204,12,62,144,37,13,62,62,126,13,62,4,215,13,62,227,47,14,62,217,136,14,62,232,225,14,62,15,59,15,62,78,148,15,62,165,237,15,62,20,71,16,62,155,160,16,62,58,250,16,62,241,83,17,62,193,173,17,62,168,7,18,62,167,97,18,62,190,187,18,62,237,21,19,62,51,112,19,62,146,202,19,62,9,37,20,62,151,127,20,62,61,218,20,62,251,52,21,62,209,143,21,62,190,234,21,62,195,69,22,62,224,160,22,62,21,252,22,62,97,87,23,62,197,178,23,62,64,14,24,62,211,105,24,62,126,197,24,62,64,33,25,62,26,125,25,62,11,217,25,62,20,53,26,62,52,145,26,62,108,237,26,62,187,73,27,62,34,166,27,62,160,2,28,62,53,95,28,62,226,187,28,62,166,24,29,62,129,117,29,62,116,210,29,62,126,47,30,62,159,140,30,62,215,233,30,62,39,71,31,62,141,164,31,62,11,2,32,62,160,95,32,62,76,189,32,62,16,27,33,62,234,120,33,62,219,214,33,62,228,52,34,62,3,147,34,62,58,241,34,62,135,79,35,62,235,173,35,62,103,12,36,62,249,106,36,62,162,201,36,62,98,40,37,62,56,135,37,62,38,230,37,62,42,69,38,62,69,164,38,62,119,3,39,62,192,98,39,62,31,194,39,62,149,33,40,62,33,129,40,62,197,224,40,62,126,64,41,62,79,160,41,62,54,0,42,62,51,96,42,62,72,192,42,62,114,32,43,62,179,128,43,62,11,225,43,62,121,65,44,62,253,161,44,62,152,2,45,62,73,99,45,62,16,196,45,62,238,36,46,62,226,133,46,62,237,230,46,62,13,72,47,62,68,169,47,62,145,10,48,62,245,107,48,62,110,205,48,62,254,46,49,62,163,144,49,62,95,242,49,62,49,84,50,62,25,182,50,62,23,24,51,62,43,122,51,62,85,220,51,62,148,62,52,62,234,160,52,62,86,3,53,62,216,101,53,62,111,200,53,62,28,43,54,62,223,141,54,62,184,240,54,62,167,83,55,62,171,182,55,62,197,25,56,62,245,124,56,62,59,224,56,62,150,67,57,62,7,167,57,62,141,10,58,62,41,110,58,62,219,209,58,62,162,53,59,62,126,153,59,62,112,253,59,62,120,97,60,62,149,197,60,62,199,41,61,62,15,142,61,62,108,242,61,62,222,86,62,62,102,187,62,62,3,32,63,62,181,132,63,62,125,233,63,62,90,78,64,62,75,179,64,62,83,24,65,62,111,125,65,62,160,226,65,62,231,71,66,62,66,173,66,62,179,18,67,62,57,120,67,62,211,221,67,62,131,67,68,62,71,169,68,62,33,15,69,62,15,117,69,62,18,219,69,62,42,65,70,62,87,167,70,62,153,13,71,62,240,115,71,62,91,218,71,62,219,64,72,62,111,167,72,62,25,14,73,62,215,116,73,62,169,219,73,62,144,66,74,62,140,169,74,62,157,16,75,62,193,119,75,62,251,222,75,62,73,70,76,62,171,173,76,62,34,21,77,62,173,124,77,62,76,228,77,62,0,76,78,62,200,179,78,62,164,27,79,62,149,131,79,62,154,235,79,62,179,83,80,62,225,187,80,62,34,36,81,62,120,140,81,62,225,244,81,62,95,93,82,62,241,197,82,62,151,46,83,62,81,151,83,62,31,0,84,62,1,105,84,62,247,209,84,62,0,59,85,62,30,164,85,62,79,13,86,62,149,118,86,62,238,223,86,62,91,73,87,62,219,178,87,62,112,28,88,62,24,134,88,62,211,239,88,62,163,89,89,62,134,195,89,62,124,45,90,62,134,151,90,62,164,1,91,62,213,107,91,62,26,214,91,62,114,64,92,62,221,170,92,62,92,21,93,62,239,127,93,62,148,234,93,62,77,85,94,62,26,192,94,62,249,42,95,62,236,149,95,62,242,0,96,62,11,108,96,62,55,215,96,62,119,66,97,62,202,173,97,62,47,25,98,62,168,132,98,62,52,240,98,62,210,91,99,62,132,199,99,62,73,51,100,62,32,159,100,62,11,11,101,62,8,119,101,62,24,227,101,62,59,79,102,62,113,187,102,62,186,39,103,62,21,148,103,62,131,0,104,62,3,109,104,62,151,217,104,62,60,70,105,62,245,178,105,62,192,31,106,62,157,140,106,62,141,249,106,62,144,102,107,62,165,211,107,62,204,64,108,62,6,174,108,62,82,27,109,62,176,136,109,62,33,246,109,62,164,99,110,62,57,209,110,62,225,62,111,62,154,172,111,62,102,26,112,62,68,136,112,62,52,246,112,62,55,100,113,62,75,210,113,62,113,64,114,62,169,174,114,62,243,28,115,62,80,139,115,62,190,249,115,62,61,104,116,62,207,214,116,62,115,69,117,62,40,180,117,62,239,34,118,62,200,145,118,62,179,0,119,62,175,111,119,62,189,222,119,62,221,77,120,62,14,189,120,62,80,44,121,62,165,155,121,62,10,11,122,62,130,122,122,62,10,234,122,62,164,89,123,62,80,201,123,62,13,57,124,62,219,168,124,62,186,24,125,62,171,136,125,62,173,248,125,62,192,104,126,62,228,216,126,62,26,73,127,62,96,185,127,62,220,20,128,62,16,77,128,62,77,133,128,62,147,189,128,62,225,245,128,62,55,46,129,62,150,102,129,62,253,158,129,62,109,215,129,62,229,15,130,62,102,72,130,62,238,128,130,62,128,185,130,62,25,242,130,62,187,42,131,62,102,99,131,62,24,156,131,62,211,212,131,62,150,13,132,62,98,70,132,62,53,127,132,62,17,184,132,62,245,240,132,62,226,41,133,62,214,98,133,62,211,155,133,62,216,212,133,62,229,13,134,62,250,70,134,62,23,128,134,62,61,185,134,62,106,242,134,62,160,43,135,62,221,100,135,62,35,158,135,62,112,215,135,62,198,16,136,62,35,74,136,62,137,131,136,62,247,188,136,62,108,246,136,62,233,47,137,62,111,105,137,62,252,162,137,62,145,220,137,62,46,22,138,62,211,79,138,62,127,137,138,62,52,195,138,62,240,252,138,62,180,54,139,62,128,112,139,62,84,170,139,62,47,228,139,62,18,30,140,62,253,87,140,62,239,145,140,62,233,203,140,62,235,5,141,62,245,63,141,62,6,122,141,62,31,180,141,62,63,238,141,62,103,40,142,62,150,98,142,62,205,156,142,62,12,215,142,62,82,17,143,62,159,75,143,62,245,133,143,62,81,192,143,62,181,250,143,62,33,53,144,62,147,111,144,62,14,170,144,62,143,228,144,62,25,31,145,62,169,89,145,62,65,148,145,62,224,206,145,62,134,9,146,62,52,68,146,62,233,126,146,62,165,185,146,62,105,244,146,62,52,47,147,62,6,106,147,62,223,164,147,62,191,223,147,62,167,26,148,62,150,85,148,62,139,144,148,62,136,203,148,62,140,6,149,62,152,65,149,62,170,124,149,62,195,183,149,62,227,242,149,62,11,46,150,62,57,105,150,62,111,164,150,62,171,223,150,62,238,26,151,62,56,86,151,62,138,145,151,62,226,204,151,62,65,8,152,62,167,67,152,62,19,127,152,62,135,186,152,62,1,246,152,62,130,49,153,62,10,109,153,62,153,168,153,62,47,228,153,62,203,31,154,62,110,91,154,62,24,151,154,62,200,210,154,62,127,14,155,62,61,74,155,62,2,134,155,62,205,193,155,62,158,253,155,62,119,57,156,62,85,117,156,62,59,177,156,62,39,237,156,62,25,41,157,62,18,101,157,62,18,161,157,62,24,221,157,62,36,25,158,62,55,85,158,62,80,145,158,62,112,205,158,62,150,9,159,62,195,69,159,62,246,129,159,62,47,190,159,62,111,250,159,62,180,54,160,62,1,115,160,62,83,175,160,62,172,235,160,62,11,40,161,62,112,100,161,62,219,160,161,62,77,221,161,62,196,25,162,62,66,86,162,62,198,146,162,62,81,207,162,62,225,11,163,62,119,72,163,62,20,133,163,62,182,193,163,62,95,254,163,62,13,59,164,62,194,119,164,62,125,180,164,62,61,241,164,62,4,46,165,62,208,106,165,62,162,167,165,62,123,228,165,62,89,33,166,62,61,94,166,62,39,155,166,62,23,216,166,62,12,21,167,62,7,82,167,62,8,143,167,62,15,204,167,62,28,9,168,62,46,70,168,62,70,131,168,62,100,192,168,62,136,253,168,62,177,58,169,62,223,119,169,62,20,181,169,62,78,242,169,62,141,47,170,62,211,108,170,62,29,170,170,62,109,231,170,62,195,36,171,62,31,98,171,62,127,159,171,62,230,220,171,62,81,26,172,62,194,87,172,62,57,149,172,62,181,210,172,62,54,16,173,62,189,77,173,62,73,139,173,62,218,200,173,62,113,6,174,62,13,68,174,62,174,129,174,62,85,191,174,62,0,253,174,62,177,58,175,62,103,120,175,62,35,182,175,62,227,243,175,62,169,49,176,62,116,111,176,62,68,173,176,62,25,235,176,62,243,40,177,62,210,102,177,62,182,164,177,62,160,226,177,62,142,32,178,62,129,94,178,62,121,156,178,62,119,218,178,62,121,24,179,62,128,86,179,62,140,148,179,62,157,210,179,62,178,16,180,62,205,78,180,62,236,140,180,62,16,203,180,62,57,9,181,62,103,71,181,62,154,133,181,62,209,195,181,62,13,2,182,62,78,64,182,62,147,126,182,62,221,188,182,62,44,251,182,62,127,57,183,62,215,119,183,62,52,182,183,62,149,244,183,62,251,50,184,62,101,113,184,62,212,175,184,62,71,238,184,62,191,44,185,62,59,107,185,62,188,169,185,62,65,232,185,62,202,38,186,62,88,101,186,62,235,163,186,62,129,226,186,62,28,33,187,62,188,95,187,62,95,158,187,62,7,221,187,62,180,27,188,62,100,90,188,62,25,153,188,62,210,215,188,62,143,22,189,62,80,85,189,62,22,148,189,62,223,210,189,62,173,17,190,62,127,80,190,62,85,143,190,62,47,206,190,62,13,13,191,62,239,75,191,62,213,138,191,62,191,201,191,62,173,8,192,62,159,71,192,62,149,134,192,62,143,197,192,62,141,4,193,62,143,67,193,62,148,130,193,62,158,193,193,62,171,0,194,62,188,63,194,62,209,126,194,62,234,189,194,62,6,253,194,62,38,60,195,62,74,123,195,62,113,186,195,62,157,249,195,62,204,56,196,62,254,119,196,62,52,183,196,62,110,246,196,62,171,53,197,62,236,116,197,62,49,180,197,62,121,243,197,62,196,50,198,62,19,114,198,62,102,177,198,62,188,240,198,62,21,48,199,62,114,111,199,62,210,174,199,62,54,238,199,62,157,45,200,62,7,109,200,62,117,172,200,62,230,235,200,62,90,43,201,62,209,106,201,62,76,170,201,62,202,233,201,62,75,41,202,62,208,104,202,62,88,168,202,62,226,231,202,62,112,39,203,62,1,103,203,62,149,166,203,62,45,230,203,62,199,37,204,62,100,101,204,62,4,165,204,62,168,228,204,62,78,36,205,62,248,99,205,62,164,163,205,62,83,227,205,62,5,35,206,62,186,98,206,62,114,162,206,62,45,226,206,62,234,33,207,62,171,97,207,62,110,161,207,62,52,225,207,62,253,32,208,62,200,96,208,62,150,160,208,62,103,224,208,62,59,32,209,62,17,96,209,62,234,159,209,62,198,223,209,62,164,31,210,62,133,95,210,62,104,159,210,62,78,223,210,62,55,31,211,62,33,95,211,62,15,159,211,62,255,222,211,62,241,30,212,62,230,94,212,62,221,158,212,62,215,222,212,62,211,30,213,62,209,94,213,62,210,158,213,62,213,222,213,62,219,30,214,62,226,94,214,62,236,158,214,62,248,222,214,62,7,31,215,62,24,95,215,62,42,159,215,62,63,223,215,62,87,31,216,62,112,95,216,62,139,159,216,62,169,223,216,62,200,31,217,62,234,95,217,62,14,160,217,62,51,224,217,62,91,32,218,62,133,96,218,62,176,160,218,62,222,224,218,62,13,33,219,62,63,97,219,62,114,161,219,62,167,225,219,62,222,33,220,62,23,98,220,62,82,162,220,62,142,226,220,62,204,34,221,62,12,99,221,62,78,163,221,62,146,227,221,62,215,35,222,62,29,100,222,62,102,164,222,62,176,228,222,62,252,36,223,62,73,101,223,62,152,165,223,62,232,229,223,62,58,38,224,62,142,102,224,62,227,166,224,62,57,231,224,62,145,39,225,62,234,103,225,62,69,168,225,62,161,232,225,62,255,40,226,62,94,105,226,62,190,169,226,62,32,234,226,62,131,42,227,62,231,106,227,62,76,171,227,62,179,235,227,62,27,44,228,62,132,108,228,62,238,172,228,62,90,237,228,62,199,45,229,62,52,110,229,62,163,174,229,62,19,239,229,62,133,47,230,62,247,111,230,62,106,176,230,62,222,240,230,62,83,49,231,62,202,113,231,62,65,178,231,62,185,242,231,62,50,51,232,62,172,115,232,62,38,180,232,62,162,244,232,62,31,53,233,62,156,117,233,62,26,182,233,62,153,246,233,62,25,55,234,62,153,119,234,62,26,184,234,62,156,248,234,62,31,57,235,62,162,121,235,62,38,186,235,62,170,250,235,62,47,59,236,62,181,123,236,62,59,188,236,62,194,252,236,62,73,61,237,62,209,125,237,62,89,190,237,62,226,254,237,62,107,63,238,62,245,127,238,62,127,192,238,62,10,1,239,62,149,65,239,62,32,130,239,62,171,194,239,62,55,3,240,62,196,67,240,62,80,132,240,62,221,196,240,62,106,5,241,62,247,69,241,62,132,134,241,62,18,199,241,62,160,7,242,62,45,72,242,62,187,136,242,62,74,201,242,62,216,9,243,62,102,74,243,62,244,138,243,62,131,203,243,62,17,12,244,62,159,76,244,62,46,141,244,62,188,205,244,62,74,14,245,62,216,78,245,62,102,143,245,62,244,207,245,62,129,16,246,62,15,81,246,62,156,145,246,62,41,210,246,62,182,18,247,62,67,83,247,62,207,147,247,62,91,212,247,62,231,20,248,62,115,85,248,62,254,149,248,62,136,214,248,62,19,23,249,62,157,87,249,62,38,152,249,62,175,216,249,62,56,25,250,62,192,89,250,62,72,154,250,62,207,218,250,62,86,27,251,62,220,91,251,62,97,156,251,62,230,220,251,62,106,29,252,62,238,93,252,62,113,158,252,62,243,222,252,62,117,31,253,62,245,95,253,62,118,160,253,62,245,224,253,62,116,33,254,62,241,97,254,62,110,162,254,62,235,226,254,62,102,35,255,62,224,99,255,62,90,164,255,62,211,228,255,62,165,18,0,63,225,50,0,63,27,83,0,63,86,115,0,63,144,147,0,63,201,179,0,63,2,212,0,63,58,244,0,63,114,20,1,63,169,52,1,63,224,84,1,63,22,117,1,63,76,149,1,63,129,181,1,63,181,213,1,63,233,245,1,63,28,22,2,63,78,54,2,63,128,86,2,63,178,118,2,63,226,150,2,63,18,183,2,63,65,215,2,63,112,247,2,63,157,23,3,63,203,55,3,63,247,87,3,63,35,120,3,63,78,152,3,63,120,184,3,63,161,216,3,63,202,248,3,63,242,24,4,63,25,57,4,63,63,89,4,63,101,121,4,63,137,153,4,63,173,185,4,63,208,217,4,63,243,249,4,63,20,26,5,63,52,58,5,63,84,90,5,63,115,122,5,63,145,154,5,63,173,186,5,63,202,218,5,63,229,250,5,63,255,26,6,63,24,59,6,63,48,91,6,63,72,123,6,63,94,155,6,63,116,187,6,63,136,219,6,63,155,251,6,63,174,27,7,63,191,59,7,63,208,91,7,63,223,123,7,63,237,155,7,63,250,187,7,63,7,220,7,63,18,252,7,63,28,28,8,63,37,60,8,63,44,92,8,63,51,124,8,63,57,156,8,63,61,188,8,63,64,220,8,63,67,252,8,63,68,28,9,63,68,60,9,63,66,92,9,63,64,124,9,63,60,156,9,63,55,188,9,63,49,220,9,63,41,252,9,63,33,28,10,63,23,60,10,63,12,92,10,63,255,123,10,63,242,155,10,63,227,187,10,63,211,219,10,63,193,251,10,63,174,27,11,63,154,59,11,63,133,91,11,63,110,123,11,63,86,155,11,63,60,187,11,63,33,219,11,63,5,251,11,63,231,26,12,63,200,58,12,63,168,90,12,63,134,122,12,63,98,154,12,63,62,186,12,63,23,218,12,63,240,249,12,63,199,25,13,63,156,57,13,63,112,89,13,63,66,121,13,63,19,153,13,63,227,184,13,63,176,216,13,63,125,248,13,63,72,24,14,63,17,56,14,63,216,87,14,63,159,119,14,63,99,151,14,63,38,183,14,63,232,214,14,63,167,246,14,63,101,22,15,63,34,54,15,63,221,85,15,63,150,117,15,63,78,149,15,63,4,181,15,63,184,212,15,63,106,244,15,63,27,20,16,63,202,51,16,63,120,83,16,63,36,115,16,63,206,146,16,63,118,178,16,63,28,210,16,63,193,241,16,63,100,17,17,63,6,49,17,63,165,80,17,63,67,112,17,63,223,143,17,63,121,175,17,63,17,207,17,63,167,238,17,63,60,14,18,63,206,45,18,63,95,77,18,63,238,108,18,63,123,140,18,63,7,172,18,63,144,203,18,63,23,235,18,63,157,10,19,63,32,42,19,63,162,73,19,63,34,105,19,63,159,136,19,63,27,168,19,63,149,199,19,63,13,231,19,63,131,6,20,63,247,37,20,63,104,69,20,63,216,100,20,63,70,132,20,63,178,163,20,63,27,195,20,63,131,226,20,63,233,1,21,63,76,33,21,63,174,64,21,63,13,96,21,63,106,127,21,63,197,158,21,63,31,190,21,63,117,221,21,63,202,252,21,63,29,28,22,63,109,59,22,63,188,90,22,63,8,122,22,63,82,153,22,63,153,184,22,63,223,215,22,63,34,247,22,63,100,22,23,63,162,53,23,63,223,84,23,63,26,116,23,63,82,147,23,63,136,178,23,63,187,209,23,63,237,240,23,63,28,16,24,63,73,47,24,63,115,78,24,63,155,109,24,63,193,140,24,63,228,171,24,63,6,203,24,63,36,234,24,63,65,9,25,63,91,40,25,63,115,71,25,63,136,102,25,63,155,133,25,63,171,164,25,63,185,195,25,63,197,226,25,63,206,1,26,63,213,32,26,63,217,63,26,63,219,94,26,63,218,125,26,63,215,156,26,63,210,187,26,63,202,218,26,63,191,249,26,63,178,24,27,63,162,55,27,63,144,86,27,63,123,117,27,63,100,148,27,63,74,179,27,63,46,210,27,63,15,241,27,63,237,15,28,63,201,46,28,63,162,77,28,63,121,108,28,63,77,139,28,63,31,170,28,63,237,200,28,63,185,231,28,63,131,6,29,63,74,37,29,63,14,68,29,63,207,98,29,63,142,129,29,63,74,160,29,63,3,191,29,63,186,221,29,63,110,252,29,63,31,27,30,63,205,57,30,63,121,88,30,63,34,119,30,63,200,149,30,63,107,180,30,63,12,211,30,63,170,241,30,63,69,16,31,63,221,46,31,63,114,77,31,63,5,108,31,63,148,138,31,63,33,169,31,63,171,199,31,63,50,230,31,63,182,4,32,63,56,35,32,63,182,65,32,63,50,96,32,63,170,126,32,63,32,157,32,63,147,187,32,63,3,218,32,63,112,248,32,63,218,22,33,63,65,53,33,63,165,83,33,63,6,114,33,63,100,144,33,63,191,174,33,63,23,205,33,63,108,235,33,63,190,9,34,63,13,40,34,63,89,70,34,63,162,100,34,63,232,130,34,63,43,161,34,63,107,191,34,63,167,221,34,63,225,251,34,63,24,26,35,63,75,56,35,63,123,86,35,63,168,116,35,63,211,146,35,63,249,176,35,63,29,207,35,63,62,237,35,63,91,11,36,63,118,41,36,63,141,71,36,63,161,101,36,63,177,131,36,63,191,161,36,63,201,191,36,63,208,221,36,63,212,251,36,63,213,25,37,63,210,55,37,63,204,85,37,63,195,115,37,63,183,145,37,63,167,175,37,63,148,205,37,63,126,235,37,63,101,9,38,63,72,39,38,63,40,69,38,63,4,99,38,63,221,128,38,63,179,158,38,63,134,188,38,63,85,218,38,63,33,248,38,63,233,21,39,63,174,51,39,63,112,81,39,63,46,111,39,63,233,140,39,63,160,170,39,63,84,200,39,63,4,230,39,63,178,3,40,63,91,33,40,63,1,63,40,63,164,92,40,63,67,122,40,63,223,151,40,63,120,181,40,63,12,211,40,63,158,240,40,63,43,14,41,63,182,43,41,63,60,73,41,63,192,102,41,63,63,132,41,63,187,161,41,63,52,191,41,63,169,220,41,63,26,250,41,63,136,23,42,63,242,52,42,63,89,82,42,63,188,111,42,63,28,141,42,63,119,170,42,63,208,199,42,63,36,229,42,63,117,2,43,63,194,31,43,63,12,61,43,63,82,90,43,63,148,119,43,63,211,148,43,63,14,178,43,63,69,207,43,63,120,236,43,63,168,9,44,63,212,38,44,63,252,67,44,63,33,97,44,63,66,126,44,63,95,155,44,63,120,184,44,63,142,213,44,63,159,242,44,63,173,15,45,63,184,44,45,63,190,73,45,63,193,102,45,63,191,131,45,63,186,160,45,63,177,189,45,63,165,218,45,63,148,247,45,63,128,20,46,63,103,49,46,63,75,78,46,63,43,107,46,63,7,136,46,63,224,164,46,63,180,193,46,63,132,222,46,63,81,251,46,63,26,24,47,63,222,52,47,63,159,81,47,63,92,110,47,63,21,139,47,63,202,167,47,63,123,196,47,63,40,225,47,63,209,253,47,63,118,26,48,63,23,55,48,63,180,83,48,63,77,112,48,63,226,140,48,63,115,169,48,63,0,198,48,63,137,226,48,63,14,255,48,63,142,27,49,63,11,56,49,63,132,84,49,63,248,112,49,63,105,141,49,63,214,169,49,63,62,198,49,63,162,226,49,63,2,255,49,63,95,27,50,63,182,55,50,63,10,84,50,63,90,112,50,63,166,140,50,63,237,168,50,63,48,197,50,63,111,225,50,63,170,253,50,63,225,25,51,63,19,54,51,63,66,82,51,63,108,110,51,63,146,138,51,63,180,166,51,63,209,194,51,63,234,222,51,63,0,251,51,63,16,23,52,63,29,51,52,63,37,79,52,63,41,107,52,63,41,135,52,63,37,163,52,63,28,191,52,63,15,219,52,63,253,246,52,63,232,18,53,63,206,46,53,63,176,74,53,63,141,102,53,63,102,130,53,63,59,158,53,63,11,186,53,63,215,213,53,63,159,241,53,63,98,13,54,63,33,41,54,63,220,68,54,63,146,96,54,63,68,124,54,63,241,151,54,63,154,179,54,63,63,207,54,63,223,234,54,63,123,6,55,63,18,34,55,63,165,61,55,63,52,89,55,63,190,116,55,63,67,144,55,63,196,171,55,63,65,199,55,63,185,226,55,63,45,254,55,63,156,25,56,63,7,53,56,63,109,80,56,63,207,107,56,63,44,135,56,63,133,162,56,63,217,189,56,63,40,217,56,63,115,244,56,63,186,15,57,63,252,42,57,63,57,70,57,63,114,97,57,63,166,124,57,63,214,151,57,63,1,179,57,63,40,206,57,63,74,233,57,63,103,4,58,63,128,31,58,63,148,58,58,63,163,85,58,63,174,112,58,63,180,139,58,63,182,166,58,63,179,193,58,63,171,220,58,63,159,247,58,63,142,18,59,63,120,45,59,63,94,72,59,63,63,99,59,63,27,126,59,63,243,152,59,63,197,179,59,63,148,206,59,63,93,233,59,63,34,4,60,63,226,30,60,63,157,57,60,63,84,84,60,63,5,111,60,63,178,137,60,63,91,164,60,63,254,190,60,63,157,217,60,63,55,244,60,63,204,14,61,63,93,41,61,63,232,67,61,63,111,94,61,63,241,120,61,63,110,147,61,63,231,173,61,63,91,200,61,63,201,226,61,63,51,253,61,63,152,23,62,63,249,49,62,63,84,76,62,63,171,102,62,63,252,128,62,63,73,155,62,63,145,181,62,63,212,207,62,63,19,234,62,63,76,4,63,63,128,30,63,63,176,56,63,63,219,82,63,63,0,109,63,63,33,135,63,63,61,161,63,63,84,187,63,63,102,213,63,63,115,239,63,63,123,9,64,63,127,35,64,63,125,61,64,63,118,87,64,63,106,113,64,63,90,139,64,63,68,165,64,63,42,191,64,63,10,217,64,63,229,242,64,63,188,12,65,63,141,38,65,63,90,64,65,63,33,90,65,63,228,115,65,63,161,141,65,63,89,167,65,63,13,193,65,63,187,218,65,63,100,244,65,63,8,14,66,63,167,39,66,63,65,65,66,63,214,90,66,63,102,116,66,63,241,141,66,63,119,167,66,63,248,192,66,63,115,218,66,63,234,243,66,63,91,13,67,63,199,38,67,63,47,64,67,63,145,89,67,63,238,114,67,63,69,140,67,63,152,165,67,63,230,190,67,63,46,216,67,63,113,241,67,63,175,10,68,63,232,35,68,63,28,61,68,63,75,86,68,63,116,111,68,63,153,136,68,63,184,161,68,63,210,186,68,63,230,211,68,63,246,236,68,63,0,6,69,63,5,31,69,63,5,56,69,63,0,81,69,63,245,105,69,63,230,130,69,63,209,155,69,63,182,180,69,63,151,205,69,63,114,230,69,63,72,255,69,63,25,24,70,63,229,48,70,63,171,73,70,63,108,98,70,63,40,123,70,63,222,147,70,63,143,172,70,63,59,197,70,63,226,221,70,63,131,246,70,63,31,15,71,63,182,39,71,63,71,64,71,63,211,88,71,63,90,113,71,63,220,137,71,63,88,162,71,63,207,186,71,63,64,211,71,63,172,235,71,63,19,4,72,63,116,28,72,63,209,52,72,63,39,77,72,63,121,101,72,63,197,125,72,63,11,150,72,63,77,174,72,63,137,198,72,63,191,222,72,63,240,246,72,63,28,15,73,63,66,39,73,63,99,63,73,63,127,87,73,63,149,111,73,63,166,135,73,63,177,159,73,63,183,183,73,63,183,207,73,63,178,231,73,63,168,255,73,63,152,23,74,63,131,47,74,63,104,71,74,63,72,95,74,63,34,119,74,63,247,142,74,63,199,166,74,63,145,190,74,63,85,214,74,63,20,238,74,63,206,5,75,63,130,29,75,63,49,53,75,63,218,76,75,63,126,100,75,63,28,124,75,63,181,147,75,63,72,171,75,63,213,194,75,63,93,218,75,63,224,241,75,63,93,9,76,63,213,32,76,63,71,56,76,63,179,79,76,63,26,103,76,63,124,126,76,63,216,149,76,63,46,173,76,63,127,196,76,63,202,219,76,63,16,243,76,63,80,10,77,63,139,33,77,63,192,56,77,63,240,79,77,63,26,103,77,63,62,126,77,63,93,149,77,63,118,172,77,63,137,195,77,63,151,218,77,63,160,241,77,63,163,8,78,63,160,31,78,63,151,54,78,63,137,77,78,63,118,100,78,63,93,123,78,63,62,146,78,63,25,169,78,63,239,191,78,63,192,214,78,63,138,237,78,63,79,4,79,63,15,27,79,63,201,49,79,63,125,72,79,63,43,95,79,63,212,117,79,63,119,140,79,63,21,163,79,63,172,185,79,63,63,208,79,63,203,230,79,63,82,253,79,63,211,19,80,63,79,42,80,63,197,64,80,63,53,87,80,63,159,109,80,63,4,132,80,63,99,154,80,63,189,176,80,63,16,199,80,63,94,221,80,63,167,243,80,63,233,9,81,63,38,32,81,63,93,54,81,63,143,76,81,63,187,98,81,63,225,120,81,63,1,143,81,63,28,165,81,63,48,187,81,63,64,209,81,63,73,231,81,63,77,253,81,63,75,19,82,63,67,41,82,63,53,63,82,63,34,85,82,63,9,107,82,63,234,128,82,63,198,150,82,63,155,172,82,63,107,194,82,63,53,216,82,63,250,237,82,63,185,3,83,63,113,25,83,63,37,47,83,63,210,68,83,63,121,90,83,63,27,112,83,63,183,133,83,63,77,155,83,63,222,176,83,63,104,198,83,63,237,219,83,63,108,241,83,63,230,6,84,63,89,28,84,63,199,49,84,63,46,71,84,63,145,92,84,63,237,113,84,63,67,135,84,63,148,156,84,63,223,177,84,63,35,199,84,63,99,220,84,63,156,241,84,63,207,6,85,63,253,27,85,63,37,49,85,63,71,70,85,63,99,91,85,63,121,112,85,63,138,133,85,63,149,154,85,63,153,175,85,63,152,196,85,63,146,217,85,63,133,238,85,63,114,3,86,63,90,24,86,63,60,45,86,63,24,66,86,63,238,86,86,63,190,107,86,63,136,128,86,63,76,149,86,63,11,170,86,63,196,190,86,63,118,211,86,63,35,232,86,63,203,252,86,63,108,17,87,63,7,38,87,63,156,58,87,63,44,79,87,63,182,99,87,63,58,120,87,63,183,140,87,63,47,161,87,63,162,181,87,63,14,202,87,63,116,222,87,63,213,242,87,63,47,7,88,63,132,27,88,63,211,47,88,63,28,68,88,63,95,88,88,63,156,108,88,63,211,128,88,63,4,149,88,63,47,169,88,63,85,189,88,63,116,209,88,63,142,229,88,63,162,249,88,63,175,13,89,63,183,33,89,63,185,53,89,63,181,73,89,63,171,93,89,63,155,113,89,63,134,133,89,63,106,153,89,63,72,173,89,63,33,193,89,63,243,212,89,63,192,232,89,63,135,252,89,63,71,16,90,63,2,36,90,63,183,55,90,63,102,75,90,63,15,95,90,63,178,114,90,63,79,134,90,63,230,153,90,63,119,173,90,63,3,193,90,63,136,212,90,63,7,232,90,63,129,251,90,63,244,14,91,63,98,34,91,63,201,53,91,63,43,73,91,63,135,92,91,63,220,111,91,63,44,131,91,63,118,150,91,63,186,169,91,63,248,188,91,63,47,208,91,63,97,227,91,63,141,246,91,63,179,9,92,63,212,28,92,63,238,47,92,63,2,67,92,63,16,86,92,63,24,105,92,63,26,124,92,63,23,143,92,63,13,162,92,63,253,180,92,63,232,199,92,63,204,218,92,63,171,237,92,63,131,0,93,63,86,19,93,63,34,38,93,63,233,56,93,63,169,75,93,63,100,94,93,63,24,113,93,63,199,131,93,63,112,150,93,63,18,169,93,63,175,187,93,63,70,206,93,63,215,224,93,63,97,243,93,63,230,5,94,63,101,24,94,63,222,42,94,63,81,61,94,63,190,79,94,63,36,98,94,63,133,116,94,63,224,134,94,63,53,153,94,63,132,171,94,63,205,189,94,63,16,208,94,63,77,226,94,63,132,244,94,63,181,6,95,63,224,24,95,63,5,43,95,63,36,61,95,63,61,79,95,63,80,97,95,63,93,115,95,63,101,133,95,63,102,151,95,63,97,169,95,63,86,187,95,63,69,205,95,63,46,223,95,63,18,241,95,63,239,2,96,63,198,20,96,63,151,38,96,63,98,56,96,63,40,74,96,63,231,91,96,63,160,109,96,63,84,127,96,63,1,145,96,63,168,162,96,63,73,180,96,63,229,197,96,63,122,215,96,63,10,233,96,63,147,250,96,63,22,12,97,63,148,29,97,63,11,47,97,63,125,64,97,63,232,81,97,63,77,99,97,63,173,116,97,63,6,134,97,63,90,151,97,63,167,168,97,63,239,185,97,63,48,203,97,63,108,220,97,63,162,237,97,63,209,254,97,63,251,15,98,63,30,33,98,63,60,50,98,63,84,67,98,63,101,84,98,63,113,101,98,63,119,118,98,63,119,135,98,63,112,152,98,63,100,169,98,63,82,186,98,63,58,203,98,63,28,220,98,63,247,236,98,63,205,253,98,63,157,14,99,63,103,31,99,63,43,48,99,63,233,64,99,63,161,81,99,63,83,98,99,63,255,114,99,63,165,131,99,63,69,148,99,63,224,164,99,63,116,181,99,63,2,198,99,63,138,214,99,63,13,231,99,63,137,247,99,63,255,7,100,63,112,24,100,63,218,40,100,63,62,57,100,63,157,73,100,63,246,89,100,63,72,106,100,63,149,122,100,63,219,138,100,63,28,155,100,63,87,171,100,63,140,187,100,63,186,203,100,63,227,219,100,63,6,236,100,63,35,252,100,63,58,12,101,63,75,28,101,63,86,44,101,63,91,60,101,63,91,76,101,63,84,92,101,63,71,108,101,63,53,124,101,63,28,140,101,63,254,155,101,63,217,171,101,63,175,187,101,63,126,203,101,63,72,219,101,63,12,235,101,63,202,250,101,63,130,10,102,63,52,26,102,63,224,41,102,63,134,57,102,63,38,73,102,63,193,88,102,63,85,104,102,63,227,119,102,63,108,135,102,63,238,150,102,63,107,166,102,63,226,181,102,63,83,197,102,63,190,212,102,63,35,228,102,63,130,243,102,63,219,2,103,63,46,18,103,63,124,33,103,63,195,48,103,63,5,64,103,63,64,79,103,63,118,94,103,63,166,109,103,63,208,124,103,63,244,139,103,63,18,155,103,63,42,170,103,63,61,185,103,63,73,200,103,63,80,215,103,63,80,230,103,63,75,245,103,63,64,4,104,63,47,19,104,63,24,34,104,63,251,48,104,63,217,63,104,63,176,78,104,63,130,93,104,63,78,108,104,63,20,123,104,63,212,137,104,63,142,152,104,63,66,167,104,63,240,181,104,63,153,196,104,63,60,211,104,63,217,225,104,63,112,240,104,63,1,255,104,63,140,13,105,63,17,28,105,63,145,42,105,63,11,57,105,63,127,71,105,63,237,85,105,63,85,100,105,63,183,114,105,63,20,129,105,63,106,143,105,63,187,157,105,63,6,172,105,63,75,186,105,63,139,200,105,63,196,214,105,63,248,228,105,63,38,243,105,63,78,1,106,63,112,15,106,63,141,29,106,63,163,43,106,63,180,57,106,63,191,71,106,63,196,85,106,63,196,99,106,63,189,113,106,63,177,127,106,63,159,141,106,63,135,155,106,63,106,169,106,63,70,183,106,63,29,197,106,63,238,210,106,63,186,224,106,63,127,238,106,63,63,252,106,63,249,9,107,63,173,23,107,63,91,37,107,63,4,51,107,63,167,64,107,63,68,78,107,63,219,91,107,63,109,105,107,63,249,118,107,63,127,132,107,63,255,145,107,63,122,159,107,63,238,172,107,63,94,186,107,63,199,199,107,63,42,213,107,63,136,226,107,63,224,239,107,63,51,253,107,63,128,10,108,63,198,23,108,63,8,37,108,63,67,50,108,63,121,63,108,63,169,76,108,63,211,89,108,63,248,102,108,63,23,116,108,63,48,129,108,63,68,142,108,63,82,155,108,63,90,168,108,63,92,181,108,63,89,194,108,63,80,207,108,63,65,220,108,63,45,233,108,63,19,246,108,63,243,2,109,63,206,15,109,63,163,28,109,63,114,41,109,63,60,54,109,63,0,67,109,63,190,79,109,63,119,92,109,63,42,105,109,63,215,117,109,63,127,130,109,63,33,143,109,63,189,155,109,63,84,168,109,63,229,180,109,63,113,193,109,63,247,205,109,63,119,218,109,63,242,230,109,63,103,243,109,63,214,255,109,63,64,12,110,63,164,24,110,63,3,37,110,63,91,49,110,63,175,61,110,63,253,73,110,63,69,86,110,63,135,98,110,63,196,110,110,63,252,122,110,63,45,135,110,63,90,147,110,63,128,159,110,63,161,171,110,63,189,183,110,63,211,195,110,63,227,207,110,63,238,219,110,63,243,231,110,63,243,243,110,63,237,255,110,63,226,11,111,63,209,23,111,63,186,35,111,63,158,47,111,63,125,59,111,63,85,71,111,63,41,83,111,63,247,94,111,63,191,106,111,63,130,118,111,63,63,130,111,63,247,141,111,63,169,153,111,63,86,165,111,63,253,176,111,63,159,188,111,63,59,200,111,63,210,211,111,63,99,223,111,63,239,234,111,63,117,246,111,63,246,1,112,63,114,13,112,63,231,24,112,63,88,36,112,63,195,47,112,63,40,59,112,63,137,70,112,63,227,81,112,63,56,93,112,63,136,104,112,63,210,115,112,63,23,127,112,63,87,138,112,63,145,149,112,63,197,160,112,63,244,171,112,63,30,183,112,63,66,194,112,63,97,205,112,63,123,216,112,63,143,227,112,63,157,238,112,63,167,249,112,63,171,4,113,63,169,15,113,63,162,26,113,63,150,37,113,63,132,48,113,63,109,59,113,63,81,70,113,63,47,81,113,63,8,92,113,63,219,102,113,63,170,113,113,63,114,124,113,63,54,135,113,63,244,145,113,63,173,156,113,63,96,167,113,63,14,178,113,63,183,188,113,63,91,199,113,63,249,209,113,63,146,220,113,63,37,231,113,63,179,241,113,63,60,252,113,63,192,6,114,63,62,17,114,63,183,27,114,63,43,38,114,63,154,48,114,63,3,59,114,63,103,69,114,63,197,79,114,63,31,90,114,63,115,100,114,63,194,110,114,63,11,121,114,63,79,131,114,63,143,141,114,63,200,151,114,63,253,161,114,63,44,172,114,63,87,182,114,63,123,192,114,63,155,202,114,63,182,212,114,63,203,222,114,63,219,232,114,63,230,242,114,63,235,252,114,63,236,6,115,63,231,16,115,63,221,26,115,63,206,36,115,63,186,46,115,63,160,56,115,63,130,66,115,63,94,76,115,63,53,86,115,63,7,96,115,63,212,105,115,63,155,115,115,63,94,125,115,63,27,135,115,63,211,144,115,63,134,154,115,63,52,164,115,63,221,173,115,63,128,183,115,63,31,193,115,63,184,202,115,63,77,212,115,63,220,221,115,63,102,231,115,63,235,240,115,63,107,250,115,63,230,3,116,63,92,13,116,63,204,22,116,63,56,32,116,63,159,41,116,63,0,51,116,63,93,60,116,63,180,69,116,63,6,79,116,63,84,88,116,63,156,97,116,63,223,106,116,63,29,116,116,63,87,125,116,63,139,134,116,63,186,143,116,63,228,152,116,63,9,162,116,63,41,171,116,63,68,180,116,63,91,189,116,63,108,198,116,63,120,207,116,63,127,216,116,63,129,225,116,63,127,234,116,63,119,243,116,63,106,252,116,63,89,5,117,63,66,14,117,63,38,23,117,63,6,32,117,63,225,40,117,63,182,49,117,63,135,58,117,63,83,67,117,63,26,76,117,63,220,84,117,63,153,93,117,63,81,102,117,63,4,111,117,63,179,119,117,63,92,128,117,63,1,137,117,63,160,145,117,63,59,154,117,63,209,162,117,63,98,171,117,63,239,179,117,63,118,188,117,63,249,196,117,63,118,205,117,63,239,213,117,63,99,222,117,63,210,230,117,63,61,239,117,63,162,247,117,63,3,0,118,63,95,8,118,63,182,16,118,63,8,25,118,63,86,33,118,63,159,41,118,63,227,49,118,63,34,58,118,63,92,66,118,63,146,74,118,63,195,82,118,63,239,90,118,63,22,99,118,63,57,107,118,63,86,115,118,63,112,123,118,63,132,131,118,63,148,139,118,63,158,147,118,63,165,155,118,63,166,163,118,63,163,171,118,63,155,179,118,63,142,187,118,63,125,195,118,63,103,203,118,63,76,211,118,63,45,219,118,63,9,227,118,63,224,234,118,63,178,242,118,63,128,250,118,63,74,2,119,63,14,10,119,63,206,17,119,63,137,25,119,63,64,33,119,63,242,40,119,63,160,48,119,63,72,56,119,63,237,63,119,63,140,71,119,63,39,79,119,63,190,86,119,63,79,94,119,63,220,101,119,63,101,109,119,63,233,116,119,63,105,124,119,63,228,131,119,63,90,139,119,63,204,146,119,63,57,154,119,63,162,161,119,63,6,169,119,63,101,176,119,63,192,183,119,63,23,191,119,63,105,198,119,63,182,205,119,63,255,212,119,63,68,220,119,63,132,227,119,63,191,234,119,63,246,241,119,63,41,249,119,63,87,0,120,63,129,7,120,63,166,14,120,63,198,21,120,63,227,28,120,63,250,35,120,63,14,43,120,63,28,50,120,63,39,57,120,63,45,64,120,63,46,71,120,63,44,78,120,63,36,85,120,63,25,92,120,63,9,99,120,63,244,105,120,63,219,112,120,63,190,119,120,63,156,126,120,63,118,133,120,63,76,140,120,63,29,147,120,63,234,153,120,63,179,160,120,63,119,167,120,63,55,174,120,63,242,180,120,63,169,187,120,63,92,194,120,63,11,201,120,63,181,207,120,63,91,214,120,63,252,220,120,63,154,227,120,63,51,234,120,63,199,240,120,63,88,247,120,63,228,253,120,63,108,4,121,63,240,10,121,63,111,17,121,63,234,23,121,63,97,30,121,63,211,36,121,63,66,43,121,63,172,49,121,63,18,56,121,63,116,62,121,63,209,68,121,63,42,75,121,63,127,81,121,63,208,87,121,63,29,94,121,63,101,100,121,63,170,106,121,63,234,112,121,63,38,119,121,63,93,125,121,63,145,131,121,63,193,137,121,63,236,143,121,63,19,150,121,63,54,156,121,63,85,162,121,63,112,168,121,63,134,174,121,63,153,180,121,63,167,186,121,63,178,192,121,63,184,198,121,63,186,204,121,63,184,210,121,63,178,216,121,63,168,222,121,63,154,228,121,63,135,234,121,63,113,240,121,63,87,246,121,63,56,252,121,63,22,2,122,63,239,7,122,63,197,13,122,63,150,19,122,63,100,25,122,63,45,31,122,63,243,36,122,63,180,42,122,63,113,48,122,63,43,54,122,63,224,59,122,63,146,65,122,63,63,71,122,63,233,76,122,63,142,82,122,63,48,88,122,63,206,93,122,63,103,99,122,63,253,104,122,63,143,110,122,63,29,116,122,63,167,121,122,63,45,127,122,63,175,132,122,63,45,138,122,63,168,143,122,63,30,149,122,63,145,154,122,63,255,159,122,63,106,165,122,63,209,170,122,63,52,176,122,63,147,181,122,63,239,186,122,63,70,192,122,63,154,197,122,63,234,202,122,63,54,208,122,63,126,213,122,63,194,218,122,63,3,224,122,63,64,229,122,63,121,234,122,63,174,239,122,63,223,244,122,63,13,250,122,63,55,255,122,63,93,4,123,63,127,9,123,63,157,14,123,63,184,19,123,63,207,24,123,63,227,29,123,63,242,34,123,63,254,39,123,63,6,45,123,63,10,50,123,63,11,55,123,63,8,60,123,63,1,65,123,63,247,69,123,63,233,74,123,63,215,79,123,63,193,84,123,63,168,89,123,63,139,94,123,63,107,99,123,63,71,104,123,63,31,109,123,63,243,113,123,63,196,118,123,63,146,123,123,63,91,128,123,63,33,133,123,63,228,137,123,63,163,142,123,63,94,147,123,63,22,152,123,63,202,156,123,63,122,161,123,63,39,166,123,63,208,170,123,63,118,175,123,63,24,180,123,63,183,184,123,63,82,189,123,63,233,193,123,63,125,198,123,63,14,203,123,63,155,207,123,63,36,212,123,63,170,216,123,63,45,221,123,63,172,225,123,63,39,230,123,63,159,234,123,63,19,239,123,63,132,243,123,63,242,247,123,63,92,252,123,63,195,0,124,63,38,5,124,63,133,9,124,63,226,13,124,63,58,18,124,63,144,22,124,63,226,26,124,63,48,31,124,63,123,35,124,63,195,39,124,63,7,44,124,63,72,48,124,63,134,52,124,63,192,56,124,63,247,60,124,63,42,65,124,63,90,69,124,63,135,73,124,63,176,77,124,63,214,81,124,63,249,85,124,63,24,90,124,63,52,94,124,63,77,98,124,63,98,102,124,63,116,106,124,63,131,110,124,63,142,114,124,63,150,118,124,63,155,122,124,63,157,126,124,63,155,130,124,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([150,134,124,63,142,138,124,63,130,142,124,63,116,146,124,63,98,150,124,63,77,154,124,63,52,158,124,63,24,162,124,63,249,165,124,63,215,169,124,63,178,173,124,63,137,177,124,63,94,181,124,63,47,185,124,63,253,188,124,63,199,192,124,63,143,196,124,63,83,200,124,63,20,204,124,63,211,207,124,63,141,211,124,63,69,215,124,63,250,218,124,63,171,222,124,63,90,226,124,63,5,230,124,63,173,233,124,63,82,237,124,63,244,240,124,63,147,244,124,63,46,248,124,63,199,251,124,63,93,255,124,63,239,2,125,63,127,6,125,63,11,10,125,63,148,13,125,63,27,17,125,63,158,20,125,63,30,24,125,63,155,27,125,63,21,31,125,63,140,34,125,63,0,38,125,63,114,41,125,63,224,44,125,63,75,48,125,63,179,51,125,63,24,55,125,63,122,58,125,63,217,61,125,63,54,65,125,63,143,68,125,63,229,71,125,63,56,75,125,63,137,78,125,63,214,81,125,63,33,85,125,63,104,88,125,63,173,91,125,63,239,94,125,63,46,98,125,63,106,101,125,63,163,104,125,63,217,107,125,63,12,111,125,63,61,114,125,63,106,117,125,63,149,120,125,63,189,123,125,63,226,126,125,63,4,130,125,63,36,133,125,63,64,136,125,63,90,139,125,63,112,142,125,63,133,145,125,63,150,148,125,63,164,151,125,63,176,154,125,63,185,157,125,63,191,160,125,63,194,163,125,63,194,166,125,63,192,169,125,63,187,172,125,63,179,175,125,63,168,178,125,63,155,181,125,63,139,184,125,63,120,187,125,63,99,190,125,63,74,193,125,63,48,196,125,63,18,199,125,63,241,201,125,63,206,204,125,63,169,207,125,63,128,210,125,63,85,213,125,63,39,216,125,63,247,218,125,63,196,221,125,63,142,224,125,63,85,227,125,63,26,230,125,63,220,232,125,63,156,235,125,63,89,238,125,63,19,241,125,63,203,243,125,63,128,246,125,63,51,249,125,63,227,251,125,63,144,254,125,63,59,1,126,63,227,3,126,63,137,6,126,63,44,9,126,63,204,11,126,63,106,14,126,63,6,17,126,63,158,19,126,63,53,22,126,63,200,24,126,63,90,27,126,63,232,29,126,63,116,32,126,63,254,34,126,63,133,37,126,63,10,40,126,63,140,42,126,63,12,45,126,63,137,47,126,63,4,50,126,63,124,52,126,63,242,54,126,63,101,57,126,63,214,59,126,63,68,62,126,63,176,64,126,63,26,67,126,63,129,69,126,63,230,71,126,63,72,74,126,63,168,76,126,63,5,79,126,63,96,81,126,63,185,83,126,63,15,86,126,63,99,88,126,63,181,90,126,63,4,93,126,63,81,95,126,63,155,97,126,63,227,99,126,63,41,102,126,63,108,104,126,63,173,106,126,63,236,108,126,63,40,111,126,63,98,113,126,63,154,115,126,63,208,117,126,63,3,120,126,63,51,122,126,63,98,124,126,63,142,126,126,63,184,128,126,63,224,130,126,63,5,133,126,63,40,135,126,63,73,137,126,63,104,139,126,63,132,141,126,63,159,143,126,63,183,145,126,63,204,147,126,63,224,149,126,63,241,151,126,63,0,154,126,63,13,156,126,63,24,158,126,63,32,160,126,63,38,162,126,63,42,164,126,63,44,166,126,63,44,168,126,63,41,170,126,63,37,172,126,63,30,174,126,63,21,176,126,63,10,178,126,63,253,179,126,63,238,181,126,63,220,183,126,63,201,185,126,63,179,187,126,63,155,189,126,63,129,191,126,63,101,193,126,63,71,195,126,63,39,197,126,63,5,199,126,63,224,200,126,63,186,202,126,63,145,204,126,63,103,206,126,63,58,208,126,63,12,210,126,63,219,211,126,63,168,213,126,63,115,215,126,63,61,217,126,63,4,219,126,63,201,220,126,63,140,222,126,63,77,224,126,63,12,226,126,63,202,227,126,63,133,229,126,63,62,231,126,63,245,232,126,63,170,234,126,63,94,236,126,63,15,238,126,63,190,239,126,63,108,241,126,63,23,243,126,63,193,244,126,63,104,246,126,63,14,248,126,63,178,249,126,63,84,251,126,63,243,252,126,63,145,254,126,63,46,0,127,63,200,1,127,63,96,3,127,63,247,4,127,63,139,6,127,63,30,8,127,63,175,9,127,63,62,11,127,63,203,12,127,63,86,14,127,63,223,15,127,63,103,17,127,63,237,18,127,63,112,20,127,63,242,21,127,63,115,23,127,63,241,24,127,63,110,26,127,63,233,27,127,63,98,29,127,63,217,30,127,63,78,32,127,63,194,33,127,63,52,35,127,63,164,36,127,63,18,38,127,63,127,39,127,63,234,40,127,63,83,42,127,63,186,43,127,63,32,45,127,63,131,46,127,63,230,47,127,63,70,49,127,63,165,50,127,63,2,52,127,63,93,53,127,63,182,54,127,63,14,56,127,63,100,57,127,63,185,58,127,63,12,60,127,63,93,61,127,63,172,62,127,63,250,63,127,63,70,65,127,63,145,66,127,63,217,67,127,63,33,69,127,63,102,70,127,63,170,71,127,63,236,72,127,63,45,74,127,63,108,75,127,63,169,76,127,63,229,77,127,63,31,79,127,63,88,80,127,63,143,81,127,63,196,82,127,63,248,83,127,63,42,85,127,63,91,86,127,63,138,87,127,63,184,88,127,63,228,89,127,63,14,91,127,63,55,92,127,63,94,93,127,63,132,94,127,63,169,95,127,63,203,96,127,63,237,97,127,63,12,99,127,63,42,100,127,63,71,101,127,63,98,102,127,63,124,103,127,63,148,104,127,63,171,105,127,63,192,106,127,63,212,107,127,63,230,108,127,63,247,109,127,63,6,111,127,63,20,112,127,63,33,113,127,63,44,114,127,63,53,115,127,63,61,116,127,63,68,117,127,63,73,118,127,63,77,119,127,63,79,120,127,63,80,121,127,63,80,122,127,63,78,123,127,63,75,124,127,63,70,125,127,63,64,126,127,63,57,127,127,63,48,128,127,63,38,129,127,63,27,130,127,63,14,131,127,63,0,132,127,63,240,132,127,63,223,133,127,63,205,134,127,63,185,135,127,63,164,136,127,63,142,137,127,63,118,138,127,63,93,139,127,63,67,140,127,63,40,141,127,63,11,142,127,63,237,142,127,63,205,143,127,63,173,144,127,63,139,145,127,63,103,146,127,63,67,147,127,63,29,148,127,63,246,148,127,63,205,149,127,63,164,150,127,63,121,151,127,63,77,152,127,63,31,153,127,63,241,153,127,63,193,154,127,63,144,155,127,63,93,156,127,63,42,157,127,63,245,157,127,63,191,158,127,63,136,159,127,63,79,160,127,63,22,161,127,63,219,161,127,63,159,162,127,63,98,163,127,63,36,164,127,63,228,164,127,63,163,165,127,63,98,166,127,63,31,167,127,63,219,167,127,63,149,168,127,63,79,169,127,63,7,170,127,63,190,170,127,63,117,171,127,63,42,172,127,63,221,172,127,63,144,173,127,63,66,174,127,63,242,174,127,63,162,175,127,63,80,176,127,63,253,176,127,63,169,177,127,63,85,178,127,63,254,178,127,63,167,179,127,63,79,180,127,63,246,180,127,63,156,181,127,63,64,182,127,63,228,182,127,63,134,183,127,63,40,184,127,63,200,184,127,63,103,185,127,63,6,186,127,63,163,186,127,63,63,187,127,63,219,187,127,63,117,188,127,63,14,189,127,63,166,189,127,63,61,190,127,63,212,190,127,63,105,191,127,63,253,191,127,63,144,192,127,63,34,193,127,63,180,193,127,63,68,194,127,63,211,194,127,63,98,195,127,63,239,195,127,63,123,196,127,63,7,197,127,63,145,197,127,63,27,198,127,63,163,198,127,63,43,199,127,63,178,199,127,63,56,200,127,63,189,200,127,63,65,201,127,63,196,201,127,63,70,202,127,63,199,202,127,63,71,203,127,63,199,203,127,63,69,204,127,63,195,204,127,63,64,205,127,63,187,205,127,63,54,206,127,63,177,206,127,63,42,207,127,63,162,207,127,63,26,208,127,63,144,208,127,63,6,209,127,63,123,209,127,63,239,209,127,63,98,210,127,63,213,210,127,63,70,211,127,63,183,211,127,63,39,212,127,63,150,212,127,63,4,213,127,63,114,213,127,63,222,213,127,63,74,214,127,63,181,214,127,63,32,215,127,63,137,215,127,63,242,215,127,63,89,216,127,63,192,216,127,63,39,217,127,63,140,217,127,63,241,217,127,63,85,218,127,63,184,218,127,63,27,219,127,63,124,219,127,63,221,219,127,63,61,220,127,63,157,220,127,63,251,220,127,63,89,221,127,63,183,221,127,63,19,222,127,63,111,222,127,63,202,222,127,63,36,223,127,63,126,223,127,63,215,223,127,63,47,224,127,63,134,224,127,63,221,224,127,63,51,225,127,63,137,225,127,63,221,225,127,63,49,226,127,63,133,226,127,63,215,226,127,63,41,227,127,63,122,227,127,63,203,227,127,63,27,228,127,63,106,228,127,63,185,228,127,63,7,229,127,63,84,229,127,63,161,229,127,63,237,229,127,63,56,230,127,63,131,230,127,63,205,230,127,63,23,231,127,63,96,231,127,63,168,231,127,63,239,231,127,63,54,232,127,63,125,232,127,63,195,232,127,63,8,233,127,63,76,233,127,63,144,233,127,63,212,233,127,63,23,234,127,63,89,234,127,63,154,234,127,63,219,234,127,63,28,235,127,63,92,235,127,63,155,235,127,63,218,235,127,63,24,236,127,63,86,236,127,63,147,236,127,63,207,236,127,63,11,237,127,63,71,237,127,63,130,237,127,63,188,237,127,63,246,237,127,63,47,238,127,63,104,238,127,63,160,238,127,63,216,238,127,63,15,239,127,63,69,239,127,63,123,239,127,63,177,239,127,63,230,239,127,63,27,240,127,63,79,240,127,63,130,240,127,63,182,240,127,63,232,240,127,63,26,241,127,63,76,241,127,63,125,241,127,63,174,241,127,63,222,241,127,63,14,242,127,63,61,242,127,63,108,242,127,63,154,242,127,63,200,242,127,63,245,242,127,63,34,243,127,63,79,243,127,63,123,243,127,63,166,243,127,63,209,243,127,63,252,243,127,63,38,244,127,63,80,244,127,63,121,244,127,63,162,244,127,63,203,244,127,63,243,244,127,63,27,245,127,63,66,245,127,63,105,245,127,63,143,245,127,63,181,245,127,63,219,245,127,63,0,246,127,63,37,246,127,63,73,246,127,63,109,246,127,63,145,246,127,63,180,246,127,63,215,246,127,63,250,246,127,63,28,247,127,63,62,247,127,63,95,247,127,63,128,247,127,63,160,247,127,63,193,247,127,63,225,247,127,63,0,248,127,63,31,248,127,63,62,248,127,63,93,248,127,63,123,248,127,63,152,248,127,63,182,248,127,63,211,248,127,63,240,248,127,63,12,249,127,63,40,249,127,63,68,249,127,63,95,249,127,63,122,249,127,63,149,249,127,63,175,249,127,63,202,249,127,63,227,249,127,63,253,249,127,63,22,250,127,63,47,250,127,63,71,250,127,63,96,250,127,63,120,250,127,63,143,250,127,63,166,250,127,63,190,250,127,63,212,250,127,63,235,250,127,63,1,251,127,63,23,251,127,63,44,251,127,63,66,251,127,63,87,251,127,63,108,251,127,63,128,251,127,63,148,251,127,63,168,251,127,63,188,251,127,63,208,251,127,63,227,251,127,63,246,251,127,63,8,252,127,63,27,252,127,63,45,252,127,63,63,252,127,63,81,252,127,63,98,252,127,63,115,252,127,63,132,252,127,63,149,252,127,63,165,252,127,63,182,252,127,63,198,252,127,63,213,252,127,63,229,252,127,63,244,252,127,63,3,253,127,63,18,253,127,63,33,253,127,63,47,253,127,63,62,253,127,63,76,253,127,63,89,253,127,63,103,253,127,63,116,253,127,63,130,253,127,63,143,253,127,63,155,253,127,63,168,253,127,63,181,253,127,63,193,253,127,63,205,253,127,63,217,253,127,63,228,253,127,63,240,253,127,63,251,253,127,63,6,254,127,63,17,254,127,63,28,254,127,63,38,254,127,63,49,254,127,63,59,254,127,63,69,254,127,63,79,254,127,63,89,254,127,63,98,254,127,63,108,254,127,63,117,254,127,63,126,254,127,63,135,254,127,63,144,254,127,63,152,254,127,63,161,254,127,63,169,254,127,63,177,254,127,63,185,254,127,63,193,254,127,63,201,254,127,63,208,254,127,63,216,254,127,63,223,254,127,63,230,254,127,63,237,254,127,63,244,254,127,63,251,254,127,63,2,255,127,63,8,255,127,63,14,255,127,63,21,255,127,63,27,255,127,63,33,255,127,63,39,255,127,63,45,255,127,63,50,255,127,63,56,255,127,63,61,255,127,63,67,255,127,63,72,255,127,63,77,255,127,63,82,255,127,63,87,255,127,63,92,255,127,63,96,255,127,63,101,255,127,63,105,255,127,63,110,255,127,63,114,255,127,63,118,255,127,63,122,255,127,63,126,255,127,63,130,255,127,63,134,255,127,63,138,255,127,63,142,255,127,63,145,255,127,63,149,255,127,63,152,255,127,63,155,255,127,63,159,255,127,63,162,255,127,63,165,255,127,63,168,255,127,63,171,255,127,63,174,255,127,63,176,255,127,63,179,255,127,63,182,255,127,63,184,255,127,63,187,255,127,63,189,255,127,63,192,255,127,63,194,255,127,63,196,255,127,63,198,255,127,63,201,255,127,63,203,255,127,63,205,255,127,63,207,255,127,63,209,255,127,63,210,255,127,63,212,255,127,63,214,255,127,63,216,255,127,63,217,255,127,63,219,255,127,63,220,255,127,63,222,255,127,63,223,255,127,63,225,255,127,63,226,255,127,63,227,255,127,63,229,255,127,63,230,255,127,63,231,255,127,63,232,255,127,63,233,255,127,63,234,255,127,63,235,255,127,63,236,255,127,63,237,255,127,63,238,255,127,63,239,255,127,63,240,255,127,63,241,255,127,63,241,255,127,63,242,255,127,63,243,255,127,63,244,255,127,63,244,255,127,63,245,255,127,63,246,255,127,63,246,255,127,63,247,255,127,63,247,255,127,63,248,255,127,63,248,255,127,63,249,255,127,63,249,255,127,63,250,255,127,63,250,255,127,63,250,255,127,63,251,255,127,63,251,255,127,63,251,255,127,63,252,255,127,63,252,255,127,63,252,255,127,63,253,255,127,63,253,255,127,63,253,255,127,63,253,255,127,63,254,255,127,63,254,255,127,63,254,255,127,63,254,255,127,63,254,255,127,63,254,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,255,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,180,1,0,0,4,0,0,0,2,0,0,0,3,0,0,0,5,0,0,0,0,0,76,194,0,0,80,194,0,0,84,194,0,0,88,194,0,0,92,194,0,0,96,194,0,0,100,194,0,0,104,194,0,0,108,194,0,0,112,194,0,0,116,194,0,0,120,194,0,0,124,194,0,0,128,194,0,0,130,194,0,0,132,194,0,0,134,194,0,0,136,194,0,0,138,194,0,0,140,194,0,0,142,194,0,0,144,194,0,0,146,194,0,0,148,194,0,0,150,194,0,0,152,194,0,0,154,194,0,0,156,194,0,0,160,194,0,0,162,194,0,0,164,194,0,0,166,194,0,0,168,194,0,0,170,194,0,0,172,194,0,0,174,194,0,0,176,194,0,0,176,194,0,0,178,194,0,0,178,194,0,0,180,194,0,0,182,194,0,0,182,194,0,0,184,194,0,0,186,194,0,0,188,194,0,0,190,194,0,0,192,194,0,0,192,194,0,0,194,194,0,0,196,194,0,0,196,194,0,0,198,194,0,0,198,194,0,0,200,194,0,0,200,194,0,0,202,194,0,0,204,194,0,0,206,194,0,0,208,194,0,0,212,194,0,0,214,194,0,0,214,194,0,0,214,194,0,0,214,194,0,0,210,194,0,0,206,194,0,0,204,194,0,0,202,194,0,0,198,194,0,0,196,194,0,0,192,194,0,0,190,194,0,0,190,194,0,0,192,194,0,0,194,194,0,0,192,194,0,0,190,194,0,0,186,194,0,0,180,194,0,0,160,194,0,0,140,194,0,0,72,194,0,0,32,194,0,0,240,193,0,0,240,193,0,0,240,193,0,0,240,193,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,112,194,0,0,120,194,0,0,120,194,0,0,130,194,0,0,146,194,0,0,138,194,0,0,136,194,0,0,136,194,0,0,134,194,0,0,140,194,0,0,140,194,0,0,144,194,0,0,148,194,0,0,150,194,0,0,158,194,0,0,158,194,0,0,160,194,0,0,166,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,84,194,0,0,116,194,0,0,132,194,0,0,132,194,0,0,136,194,0,0,134,194,0,0,140,194,0,0,152,194,0,0,152,194,0,0,144,194,0,0,146,194,0,0,150,194,0,0,152,194,0,0,156,194,0,0,158,194,0,0,166,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,20,194,0,0,20,194,0,0,20,194,0,0,20,194,0,0,20,194,0,0,20,194,0,0,20,194,0,0,20,194,0,0,24,194,0,0,32,194,0,0,40,194,0,0,56,194,0,0,64,194,0,0,84,194,0,0,92,194,0,0,120,194,0,0,130,194,0,0,104,194,0,0,96,194,0,0,96,194,0,0,116,194,0,0,112,194,0,0,130,194,0,0,134,194,0,0,138,194,0,0,142,194,0,0,154,194,0,0,154,194,0,0,156,194,0,0,160,194,0,0,164,194,0,0,168,194,0,0,176,194,0,0,186,194,0,0,196,194,0,0,212,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,200,193,0,0,208,193,0,0,216,193,0,0,232,193,0,0,0,194,0,0,24,194,0,0,64,194,0,0,80,194,0,0,80,194,0,0,72,194,0,0,64,194,0,0,64,194,0,0,76,194,0,0,80,194,0,0,88,194,0,0,112,194,0,0,134,194,0,0,134,194,0,0,132,194,0,0,136,194,0,0,138,194,0,0,146,194,0,0,146,194,0,0,152,194,0,0,160,194,0,0,162,194,0,0,162,194,0,0,170,194,0,0,170,194,0,0,172,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,128,193,0,0,128,193,0,0,128,193,0,0,128,193,0,0,128,193,0,0,128,193,0,0,128,193,0,0,128,193,0,0,136,193,0,0,152,193,0,0,160,193,0,0,176,193,0,0,208,193,0,0,224,193,0,0,248,193,0,0,32,194,0,0,60,194,0,0,28,194,0,0,28,194,0,0,32,194,0,0,40,194,0,0,44,194,0,0,60,194,0,0,76,194,0,0,100,194,0,0,80,194,0,0,92,194,0,0,92,194,0,0,112,194,0,0,104,194,0,0,120,194,0,0,124,194,0,0,140,194,0,0,134,194,0,0,138,194,0,0,144,194,0,0,146,194,0,0,154,194,0,0,160,194,0,0,164,194,0,0,166,194,0,0,174,194,0,0,180,194,0,0,188,194,0,0,196,194,0,0,208,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,0,193,0,0,32,193,0,0,48,193,0,0,112,193,0,0,152,193,0,0,200,193,0,0,240,193,0,0,8,194,0,0,248,193,0,0,240,193,0,0,248,193,0,0,232,193,0,0,0,194,0,0,12,194,0,0,40,194,0,0,64,194,0,0,40,194,0,0,48,194,0,0,56,194,0,0,72,194,0,0,72,194,0,0,76,194,0,0,80,194,0,0,108,194,0,0,88,194,0,0,92,194,0,0,92,194,0,0,104,194,0,0,120,194,0,0,124,194,0,0,132,194,0,0,144,194,0,0,146,194,0,0,152,194,0,0,150,194,0,0,156,194,0,0,160,194,0,0,160,194,0,0,162,194,0,0,168,194,0,0,176,194,0,0,180,194,0,0,188,194,0,0,196,194,0,0,202,194,0,0,212,194,0,0,220,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,134,194,0,0,134,194,0,0,134,194,0,0,152,194,0,0,144,194,0,0,142,194,0,0,148,194,0,0,152,194,0,0,152,194,0,0,150,194,0,0,156,194,0,0,158,194,0,0,158,194,0,0,162,194,0,0,166,194,0,0,172,194,0,0,178,194,0,0,186,194,0,0,194,194,0,0,200,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,64,194,0,0,76,194,0,0,92,194,0,0,108,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,134,194,0,0,132,194,0,0,136,194,0,0,138,194,0,0,140,194,0,0,148,194,0,0,158,194,0,0,154,194,0,0,154,194,0,0,156,194,0,0,160,194,0,0,162,194,0,0,164,194,0,0,168,194,0,0,172,194,0,0,176,194,0,0,182,194,0,0,190,194,0,0,200,194,0,0,216,194,0,0,232,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,20,194,0,0,20,194,0,0,36,194,0,0,48,194,0,0,64,194,0,0,76,194,0,0,104,194,0,0,120,194,0,0,112,194,0,0,100,194,0,0,108,194,0,0,108,194,0,0,112,194,0,0,124,194,0,0,130,194,0,0,144,194,0,0,142,194,0,0,140,194,0,0,144,194,0,0,148,194,0,0,154,194,0,0,152,194,0,0,156,194,0,0,162,194,0,0,162,194,0,0,160,194,0,0,166,194,0,0,172,194,0,0,182,194,0,0,192,194,0,0,200,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,240,193,0,0,0,194,0,0,0,194,0,0,4,194,0,0,12,194,0,0,36,194,0,0,68,194,0,0,72,194,0,0,68,194,0,0,60,194,0,0,64,194,0,0,64,194,0,0,80,194,0,0,76,194,0,0,100,194,0,0,130,194,0,0,116,194,0,0,108,194,0,0,116,194,0,0,128,194,0,0,138,194,0,0,140,194,0,0,148,194,0,0,154,194,0,0,154,194,0,0,156,194,0,0,162,194,0,0,168,194,0,0,170,194,0,0,174,194,0,0,180,194,0,0,184,194,0,0,192,194,0,0,200,194,0,0,214,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,152,193,0,0,152,193,0,0,152,193,0,0,152,193,0,0,152,193,0,0,152,193,0,0,152,193,0,0,152,193,0,0,160,193,0,0,168,193,0,0,184,193,0,0,216,193,0,0,240,193,0,0,12,194,0,0,16,194,0,0,36,194,0,0,56,194,0,0,48,194,0,0,40,194,0,0,32,194,0,0,36,194,0,0,36,194,0,0,44,194,0,0,64,194,0,0,92,194,0,0,84,194,0,0,80,194,0,0,84,194,0,0,96,194,0,0,108,194,0,0,104,194,0,0,112,194,0,0,134,194,0,0,132,194,0,0,138,194,0,0,142,194,0,0,144,194,0,0,150,194,0,0,158,194,0,0,162,194,0,0,168,194,0,0,174,194,0,0,180,194,0,0,186,194,0,0,194,194,0,0,202,194,0,0,214,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,16,193,0,0,16,193,0,0,16,193,0,0,16,193,0,0,16,193,0,0,16,193,0,0,16,193,0,0,16,193,0,0,48,193,0,0,64,193,0,0,64,193,0,0,112,193,0,0,128,193,0,0,160,193,0,0,184,193,0,0,240,193,0,0,20,194,0,0,8,194,0,0,4,194,0,0,8,194,0,0,248,193,0,0,0,194,0,0,0,194,0,0,24,194,0,0,60,194,0,0,48,194,0,0,36,194,0,0,32,194,0,0,60,194,0,0,68,194,0,0,56,194,0,0,56,194,0,0,104,194,0,0,72,194,0,0,72,194,0,0,88,194,0,0,104,194,0,0,120,194,0,0,128,194,0,0,134,194,0,0,134,194,0,0,140,194,0,0,144,194,0,0,152,194,0,0,158,194,0,0,166,194,0,0,174,194,0,0,182,194,0,0,192,194,0,0,200,194,0,0,208,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,124,194,0,0,128,194,0,0,132,194,0,0,134,194,0,0,132,194,0,0,136,194,0,0,150,194,0,0,144,194,0,0,152,194,0,0,150,194,0,0,152,194,0,0,156,194,0,0,158,194,0,0,164,194,0,0,168,194,0,0,170,194,0,0,180,194,0,0,188,194,0,0,202,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,108,194,0,0,112,194,0,0,112,194,0,0,116,194,0,0,124,194,0,0,132,194,0,0,142,194,0,0,136,194,0,0,140,194,0,0,140,194,0,0,142,194,0,0,144,194,0,0,144,194,0,0,150,194,0,0,162,194,0,0,156,194,0,0,158,194,0,0,164,194,0,0,166,194,0,0,172,194,0,0,180,194,0,0,194,194,0,0,206,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,84,194,0,0,88,194,0,0,92,194,0,0,100,194,0,0,96,194,0,0,100,194,0,0,92,194,0,0,116,194,0,0,130,194,0,0,112,194,0,0,112,194,0,0,120,194,0,0,124,194,0,0,124,194,0,0,132,194,0,0,136,194,0,0,148,194,0,0,146,194,0,0,150,194,0,0,150,194,0,0,156,194,0,0,160,194,0,0,160,194,0,0,164,194,0,0,170,194,0,0,180,194,0,0,192,194,0,0,202,194,0,0,216,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,56,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,60,194,0,0,64,194,0,0,76,194,0,0,100,194,0,0,76,194,0,0,68,194,0,0,72,194,0,0,76,194,0,0,84,194,0,0,88,194,0,0,108,194,0,0,132,194,0,0,112,194,0,0,120,194,0,0,134,194,0,0,134,194,0,0,140,194,0,0,144,194,0,0,150,194,0,0,152,194,0,0,156,194,0,0,162,194,0,0,170,194,0,0,176,194,0,0,188,194,0,0,194,194,0,0,208,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,16,194,0,0,28,194,0,0,36,194,0,0,40,194,0,0,40,194,0,0,28,194,0,0,24,194,0,0,36,194,0,0,44,194,0,0,80,194,0,0,48,194,0,0,32,194,0,0,28,194,0,0,20,194,0,0,20,194,0,0,32,194,0,0,60,194,0,0,88,194,0,0,72,194,0,0,64,194,0,0,72,194,0,0,92,194,0,0,116,194,0,0,108,194,0,0,120,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,138,194,0,0,138,194,0,0,146,194,0,0,148,194,0,0,148,194,0,0,150,194,0,0,154,194,0,0,158,194,0,0,164,194,0,0,174,194,0,0,182,194,0,0,190,194,0,0,200,194,0,0,216,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,224,193,0,0,208,193,0,0,192,193,0,0,176,193,0,0,160,193,0,0,160,193,0,0,184,193,0,0,232,193,0,0,240,193,0,0,248,193,0,0,224,193,0,0,216,193,0,0,224,193,0,0,224,193,0,0,224,193,0,0,12,194,0,0,32,194,0,0,4,194,0,0,0,194,0,0,232,193,0,0,240,193,0,0,240,193,0,0,240,193,0,0,20,194,0,0,52,194,0,0,36,194,0,0,20,194,0,0,24,194,0,0,52,194,0,0,60,194,0,0,60,194,0,0,64,194,0,0,84,194,0,0,68,194,0,0,64,194,0,0,72,194,0,0,68,194,0,0,68,194,0,0,76,194,0,0,80,194,0,0,104,194,0,0,96,194,0,0,100,194,0,0,96,194,0,0,112,194,0,0,116,194,0,0,120,194,0,0,140,194,0,0,144,194,0,0,148,194,0,0,156,194,0,0,166,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,212,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,210,194,0,0,200,194,0,0,190,194,0,0,182,194,0,0,174,194,0,0,166,194,0,0,160,194,0,0,156,194,0,0,152,194,0,0,156,194,0,0,156,194,0,0,162,194,0,0,166,194,0,0,170,194,0,0,172,194,0,0,170,194,0,0,172,194,0,0,174,194,0,0,180,194,0,0,194,194,0,0,214,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,162,194,0,0,154,194,0,0,146,194,0,0,140,194,0,0,134,194,0,0,134,194,0,0,136,194,0,0,150,194,0,0,146,194,0,0,140,194,0,0,138,194,0,0,140,194,0,0,144,194,0,0,150,194,0,0,158,194,0,0,168,194,0,0,166,194,0,0,168,194,0,0,172,194,0,0,176,194,0,0,178,194,0,0,178,194,0,0,186,194,0,0,196,194,0,0,210,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,160,194,0,0,152,194,0,0,142,194,0,0,136,194,0,0,136,194,0,0,130,194,0,0,124,194,0,0,124,194,0,0,120,194,0,0,120,194,0,0,128,194,0,0,130,194,0,0,128,194,0,0,116,194,0,0,120,194,0,0,124,194,0,0,128,194,0,0,132,194,0,0,136,194,0,0,146,194,0,0,146,194,0,0,148,194,0,0,150,194,0,0,152,194,0,0,162,194,0,0,166,194,0,0,170,194,0,0,176,194,0,0,178,194,0,0,184,194,0,0,190,194,0,0,200,194,0,0,216,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,160,194,0,0,150,194,0,0,142,194,0,0,136,194,0,0,130,194,0,0,124,194,0,0,120,194,0,0,116,194,0,0,116,194,0,0,116,194,0,0,116,194,0,0,108,194,0,0,96,194,0,0,100,194,0,0,84,194,0,0,72,194,0,0,104,194,0,0,80,194,0,0,72,194,0,0,72,194,0,0,80,194,0,0,84,194,0,0,88,194,0,0,104,194,0,0,134,194,0,0,124,194,0,0,134,194,0,0,136,194,0,0,144,194,0,0,150,194,0,0,156,194,0,0,160,194,0,0,162,194,0,0,162,194,0,0,164,194,0,0,170,194,0,0,178,194,0,0,180,194,0,0,186,194,0,0,194,194,0,0,202,194,0,0,214,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,130,194,0,0,116,194,0,0,108,194,0,0,100,194,0,0,96,194,0,0,92,194,0,0,92,194,0,0,96,194,0,0,96,194,0,0,100,194,0,0,92,194,0,0,84,194,0,0,80,194,0,0,60,194,0,0,48,194,0,0,48,194,0,0,72,194,0,0,48,194,0,0,36,194,0,0,28,194,0,0,28,194,0,0,40,194,0,0,32,194,0,0,56,194,0,0,76,194,0,0,68,194,0,0,72,194,0,0,84,194,0,0,88,194,0,0,124,194,0,0,112,194,0,0,116,194,0,0,120,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,140,194,0,0,146,194,0,0,148,194,0,0,150,194,0,0,152,194,0,0,150,194,0,0,158,194,0,0,170,194,0,0,178,194,0,0,182,194,0,0,192,194,0,0,204,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,80,194,0,0,72,194,0,0,68,194,0,0,68,194,0,0,64,194,0,0,64,194,0,0,64,194,0,0,68,194,0,0,72,194,0,0,72,194,0,0,68,194,0,0,56,194,0,0,44,194,0,0,28,194,0,0,12,194,0,0,4,194,0,0,24,194,0,0,16,194,0,0,0,194,0,0,232,193,0,0,0,194,0,0,0,194,0,0,0,194,0,0,12,194,0,0,48,194,0,0,28,194,0,0,24,194,0,0,24,194,0,0,56,194,0,0,72,194,0,0,52,194,0,0,56,194,0,0,84,194,0,0,72,194,0,0,72,194,0,0,72,194,0,0,88,194,0,0,88,194,0,0,84,194,0,0,84,194,0,0,96,194,0,0,100,194,0,0,108,194,0,0,132,194,0,0,140,194,0,0,144,194,0,0,148,194,0,0,158,194,0,0,166,194,0,0,170,194,0,0,180,194,0,0,194,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,172,194,0,0,160,194,0,0,150,194,0,0,150,194,0,0,158,194,0,0,160,194,0,0,158,194,0,0,160,194,0,0,162,194,0,0,164,194,0,0,176,194,0,0,190,194,0,0,206,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,176,194,0,0,166,194,0,0,158,194,0,0,156,194,0,0,150,194,0,0,142,194,0,0,134,194,0,0,136,194,0,0,146,194,0,0,146,194,0,0,144,194,0,0,146,194,0,0,150,194,0,0,154,194,0,0,160,194,0,0,164,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,214,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,210,194,0,0,202,194,0,0,192,194,0,0,180,194,0,0,172,194,0,0,162,194,0,0,154,194,0,0,146,194,0,0,138,194,0,0,132,194,0,0,116,194,0,0,120,194,0,0,132,194,0,0,128,194,0,0,120,194,0,0,130,194,0,0,132,194,0,0,140,194,0,0,144,194,0,0,152,194,0,0,162,194,0,0,160,194,0,0,168,194,0,0,180,194,0,0,190,194,0,0,204,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,206,194,0,0,194,194,0,0,184,194,0,0,176,194,0,0,166,194,0,0,158,194,0,0,148,194,0,0,140,194,0,0,132,194,0,0,108,194,0,0,84,194,0,0,104,194,0,0,120,194,0,0,92,194,0,0,88,194,0,0,88,194,0,0,88,194,0,0,104,194,0,0,116,194,0,0,120,194,0,0,144,194,0,0,140,194,0,0,144,194,0,0,150,194,0,0,156,194,0,0,160,194,0,0,162,194,0,0,160,194,0,0,166,194,0,0,166,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,214,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,160,194,0,0,150,194,0,0,140,194,0,0,132,194,0,0,120,194,0,0,96,194,0,0,64,194,0,0,48,194,0,0,64,194,0,0,56,194,0,0,56,194,0,0,44,194,0,0,56,194,0,0,64,194,0,0,64,194,0,0,76,194,0,0,104,194,0,0,104,194,0,0,108,194,0,0,112,194,0,0,120,194,0,0,120,194,0,0,116,194,0,0,116,194,0,0,130,194,0,0,128,194,0,0,130,194,0,0,136,194,0,0,140,194,0,0,148,194],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720);allocate([0,0,150,194,0,0,156,194,0,0,162,194,0,0,172,194,0,0,190,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,160,194,0,0,150,194,0,0,140,194,0,0,130,194,0,0,116,194,0,0,92,194,0,0,68,194,0,0,28,194,0,0,4,194,0,0,32,194,0,0,12,194,0,0,0,194,0,0,24,194,0,0,32,194,0,0,4,194,0,0,12,194,0,0,20,194,0,0,56,194,0,0,36,194,0,0,52,194,0,0,48,194,0,0,56,194,0,0,40,194,0,0,52,194,0,0,56,194,0,0,80,194,0,0,72,194,0,0,72,194,0,0,72,194,0,0,88,194,0,0,88,194,0,0,92,194,0,0,100,194,0,0,120,194,0,0,128,194,0,0,132,194,0,0,136,194,0,0,140,194,0,0,152,194,0,0,162,194,0,0,180,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,196,194,0,0,180,194,0,0,170,194,0,0,164,194,0,0,166,194,0,0,160,194,0,0,156,194,0,0,168,194,0,0,158,194,0,0,160,194,0,0,166,194,0,0,174,194,0,0,178,194,0,0,182,194,0,0,186,194,0,0,198,194,0,0,212,194,0,0,234,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,196,194,0,0,180,194,0,0,170,194,0,0,160,194,0,0,150,194,0,0,140,194,0,0,136,194,0,0,148,194,0,0,144,194,0,0,148,194,0,0,154,194,0,0,160,194,0,0,164,194,0,0,170,194,0,0,174,194,0,0,184,194,0,0,178,194,0,0,182,194,0,0,190,194,0,0,200,194,0,0,212,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,196,194,0,0,180,194,0,0,166,194,0,0,150,194,0,0,142,194,0,0,124,194,0,0,128,194,0,0,134,194,0,0,120,194,0,0,128,194,0,0,134,194,0,0,140,194,0,0,146,194,0,0,154,194,0,0,162,194,0,0,168,194,0,0,166,194,0,0,170,194,0,0,178,194,0,0,180,194,0,0,186,194,0,0,196,194,0,0,208,194,0,0,218,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,206,194,0,0,192,194,0,0,176,194,0,0,162,194,0,0,150,194,0,0,136,194,0,0,104,194,0,0,88,194,0,0,96,194,0,0,88,194,0,0,96,194,0,0,96,194,0,0,104,194,0,0,112,194,0,0,124,194,0,0,132,194,0,0,148,194,0,0,138,194,0,0,144,194,0,0,144,194,0,0,150,194,0,0,148,194,0,0,154,194,0,0,162,194,0,0,162,194,0,0,164,194,0,0,168,194,0,0,174,194,0,0,186,194,0,0,192,194,0,0,198,194,0,0,208,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,204,194,0,0,192,194,0,0,182,194,0,0,170,194,0,0,160,194,0,0,148,194,0,0,136,194,0,0,112,194,0,0,76,194,0,0,56,194,0,0,64,194,0,0,56,194,0,0,44,194,0,0,52,194,0,0,60,194,0,0,60,194,0,0,68,194,0,0,64,194,0,0,96,194,0,0,84,194,0,0,92,194,0,0,104,194,0,0,100,194,0,0,124,194,0,0,104,194,0,0,112,194,0,0,132,194,0,0,128,194,0,0,134,194,0,0,140,194,0,0,140,194,0,0,148,194,0,0,154,194,0,0,168,194,0,0,172,194,0,0,178,194,0,0,182,194,0,0,186,194,0,0,188,194,0,0,202,194,0,0,218,194,0,0,236,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,176,194,0,0,166,194,0,0,156,194,0,0,146,194,0,0,136,194,0,0,112,194,0,0,84,194,0,0,48,194,0,0,12,194,0,0,24,194,0,0,24,194,0,0,8,194,0,0,8,194,0,0,16,194,0,0,32,194,0,0,36,194,0,0,48,194,0,0,76,194,0,0,52,194,0,0,56,194,0,0,60,194,0,0,56,194,0,0,88,194,0,0,72,194,0,0,68,194,0,0,72,194,0,0,72,194,0,0,72,194,0,0,76,194,0,0,88,194,0,0,100,194,0,0,104,194,0,0,112,194,0,0,132,194,0,0,132,194,0,0,132,194,0,0,128,194,0,0,130,194,0,0,136,194,0,0,154,194,0,0,164,194,0,0,174,194,0,0,190,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,204,194,0,0,194,194,0,0,184,194,0,0,174,194,0,0,166,194,0,0,156,194,0,0,150,194,0,0,164,194,0,0,158,194,0,0,166,194,0,0,170,194,0,0,178,194,0,0,184,194,0,0,190,194,0,0,196,194,0,0,202,194,0,0,210,194,0,0,218,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,212,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,172,194,0,0,162,194,0,0,156,194,0,0,148,194,0,0,138,194,0,0,148,194,0,0,148,194,0,0,152,194,0,0,158,194,0,0,166,194,0,0,168,194,0,0,172,194,0,0,178,194,0,0,184,194,0,0,194,194,0,0,186,194,0,0,200,194,0,0,206,194,0,0,214,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,212,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,174,194,0,0,166,194,0,0,160,194,0,0,150,194,0,0,138,194,0,0,112,194,0,0,132,194,0,0,132,194,0,0,136,194,0,0,140,194,0,0,148,194,0,0,156,194,0,0,158,194,0,0,162,194,0,0,162,194,0,0,166,194,0,0,168,194,0,0,174,194,0,0,186,194,0,0,192,194,0,0,198,194,0,0,206,194,0,0,214,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,178,194,0,0,170,194,0,0,164,194,0,0,156,194,0,0,142,194,0,0,120,194,0,0,92,194,0,0,104,194,0,0,104,194,0,0,88,194,0,0,88,194,0,0,92,194,0,0,108,194,0,0,116,194,0,0,120,194,0,0,140,194,0,0,132,194,0,0,132,194,0,0,134,194,0,0,140,194,0,0,144,194,0,0,150,194,0,0,156,194,0,0,168,194,0,0,168,194,0,0,168,194,0,0,176,194,0,0,182,194,0,0,180,194,0,0,190,194,0,0,196,194,0,0,204,194,0,0,206,194,0,0,212,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,188,194,0,0,180,194,0,0,174,194,0,0,164,194,0,0,158,194,0,0,146,194,0,0,134,194,0,0,104,194,0,0,60,194,0,0,72,194,0,0,52,194,0,0,36,194,0,0,52,194,0,0,64,194,0,0,48,194,0,0,48,194,0,0,68,194,0,0,88,194,0,0,76,194,0,0,64,194,0,0,60,194,0,0,68,194,0,0,72,194,0,0,76,194,0,0,100,194,0,0,104,194,0,0,112,194,0,0,124,194,0,0,138,194,0,0,140,194,0,0,138,194,0,0,142,194,0,0,148,194,0,0,156,194,0,0,164,194,0,0,180,194,0,0,190,194,0,0,202,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,202,194,0,0,194,194,0,0,186,194,0,0,180,194,0,0,170,194,0,0,160,194,0,0,154,194,0,0,144,194,0,0,130,194,0,0,96,194,0,0,64,194,0,0,20,194,0,0,32,194,0,0,16,194,0,0,8,194,0,0,32,194,0,0,72,194,0,0,60,194,0,0,24,194,0,0,36,194,0,0,60,194,0,0,24,194,0,0,12,194,0,0,28,194,0,0,24,194,0,0,44,194,0,0,32,194,0,0,52,194,0,0,72,194,0,0,52,194,0,0,48,194,0,0,60,194,0,0,72,194,0,0,92,194,0,0,64,194,0,0,64,194,0,0,80,194,0,0,132,194,0,0,140,194,0,0,152,194,0,0,164,194,0,0,180,194,0,0,194,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,172,194,0,0,158,194,0,0,152,194,0,0,166,194,0,0,162,194,0,0,170,194,0,0,174,194,0,0,178,194,0,0,186,194,0,0,196,194,0,0,204,194,0,0,214,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,172,194,0,0,158,194,0,0,142,194,0,0,154,194,0,0,148,194,0,0,154,194,0,0,158,194,0,0,162,194,0,0,168,194,0,0,170,194,0,0,180,194,0,0,184,194,0,0,186,194,0,0,184,194,0,0,196,194,0,0,202,194,0,0,216,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,206,194,0,0,196,194,0,0,186,194,0,0,174,194,0,0,156,194,0,0,136,194,0,0,130,194,0,0,132,194,0,0,120,194,0,0,130,194,0,0,134,194,0,0,140,194,0,0,146,194,0,0,150,194,0,0,156,194,0,0,164,194,0,0,164,194,0,0,166,194,0,0,168,194,0,0,182,194,0,0,186,194,0,0,196,194,0,0,204,194,0,0,212,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,164,194,0,0,148,194,0,0,120,194,0,0,100,194,0,0,104,194,0,0,96,194,0,0,76,194,0,0,80,194,0,0,80,194,0,0,88,194,0,0,88,194,0,0,104,194,0,0,132,194,0,0,108,194,0,0,112,194,0,0,124,194,0,0,132,194,0,0,138,194,0,0,146,194,0,0,158,194,0,0,166,194,0,0,168,194,0,0,160,194,0,0,162,194,0,0,162,194,0,0,164,194,0,0,176,194,0,0,184,194,0,0,196,194,0,0,210,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,204,194,0,0,194,194,0,0,184,194,0,0,168,194,0,0,158,194,0,0,138,194,0,0,100,194,0,0,60,194,0,0,80,194,0,0,60,194,0,0,48,194,0,0,52,194,0,0,72,194,0,0,80,194,0,0,40,194,0,0,40,194,0,0,84,194,0,0,44,194,0,0,44,194,0,0,64,194,0,0,76,194,0,0,96,194,0,0,92,194,0,0,80,194,0,0,100,194,0,0,108,194,0,0,116,194,0,0,120,194,0,0,134,194,0,0,142,194,0,0,156,194,0,0,166,194,0,0,172,194,0,0,188,194,0,0,196,194,0,0,206,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,190,194,0,0,180,194,0,0,168,194,0,0,156,194,0,0,140,194,0,0,116,194,0,0,76,194,0,0,36,194,0,0,32,194,0,0,24,194,0,0,32,194,0,0,56,194,0,0,80,194,0,0,76,194,0,0,36,194,0,0,32,194,0,0,56,194,0,0,32,194,0,0,24,194,0,0,24,194,0,0,36,194,0,0,56,194,0,0,36,194,0,0,56,194,0,0,60,194,0,0,44,194,0,0,44,194,0,0,52,194,0,0,36,194,0,0,52,194,0,0,96,194,0,0,134,194,0,0,136,194,0,0,166,194,0,0,174,194,0,0,180,194,0,0,190,194,0,0,204,194,0,0,214,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,218,194,0,0,210,194,0,0,202,194,0,0,192,194,0,0,182,194,0,0,168,194,0,0,154,194,0,0,164,194,0,0,164,194,0,0,170,194,0,0,178,194,0,0,188,194,0,0,200,194,0,0,212,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,212,194,0,0,206,194,0,0,196,194,0,0,184,194,0,0,170,194,0,0,160,194,0,0,142,194,0,0,150,194,0,0,144,194,0,0,152,194,0,0,160,194,0,0,168,194,0,0,172,194,0,0,178,194,0,0,186,194,0,0,200,194,0,0,214,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,208,194,0,0,202,194,0,0,194,194,0,0,184,194,0,0,176,194,0,0,168,194,0,0,160,194,0,0,128,194,0,0,132,194,0,0,124,194,0,0,128,194,0,0,132,194,0,0,138,194,0,0,146,194,0,0,154,194,0,0,166,194,0,0,166,194,0,0,172,194,0,0,182,194,0,0,196,194,0,0,208,194,0,0,222,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,208,194,0,0,202,194,0,0,194,194,0,0,184,194,0,0,180,194,0,0,168,194,0,0,148,194,0,0,100,194,0,0,104,194,0,0,80,194,0,0,92,194,0,0,88,194,0,0,72,194,0,0,80,194,0,0,72,194,0,0,80,194,0,0,124,194,0,0,120,194,0,0,138,194,0,0,152,194,0,0,154,194,0,0,156,194,0,0,156,194,0,0,158,194,0,0,164,194,0,0,176,194,0,0,188,194,0,0,200,194,0,0,212,194,0,0,222,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,212,194,0,0,204,194,0,0,196,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,166,194,0,0,156,194,0,0,140,194,0,0,72,194,0,0,72,194,0,0,36,194,0,0,48,194,0,0,68,194,0,0,60,194,0,0,72,194,0,0,72,194,0,0,48,194,0,0,92,194,0,0,56,194,0,0,60,194,0,0,64,194,0,0,64,194,0,0,88,194,0,0,68,194,0,0,68,194,0,0,104,194,0,0,120,194,0,0,142,194,0,0,162,194,0,0,174,194,0,0,184,194,0,0,194,194,0,0,204,194,0,0,216,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,212,194,0,0,204,194,0,0,196,194,0,0,190,194,0,0,180,194,0,0,170,194,0,0,166,194,0,0,156,194,0,0,140,194,0,0,52,194,0,0,44,194,0,0,36,194,0,0,60,194,0,0,72,194,0,0,76,194,0,0,72,194,0,0,68,194,0,0,52,194,0,0,60,194,0,0,36,194,0,0,48,194,0,0,36,194,0,0,28,194,0,0,44,194,0,0,24,194,0,0,20,194,0,0,32,194,0,0,36,194,0,0,48,194,0,0,72,194,0,0,104,194,0,0,130,194,0,0,146,194,0,0,158,194,0,0,170,194,0,0,184,194,0,0,194,194,0,0,202,194,0,0,210,194,0,0,218,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,200,194,0,0,190,194,0,0,174,194,0,0,162,194,0,0,170,194,0,0,166,194,0,0,176,194,0,0,186,194,0,0,200,194,0,0,214,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,202,194,0,0,190,194,0,0,176,194,0,0,166,194,0,0,152,194,0,0,146,194,0,0,144,194,0,0,158,194,0,0,168,194,0,0,180,194,0,0,190,194,0,0,200,194,0,0,210,194,0,0,220,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,208,194,0,0,196,194,0,0,184,194,0,0,174,194,0,0,162,194,0,0,140,194,0,0,130,194,0,0,120,194,0,0,134,194,0,0,142,194,0,0,148,194,0,0,160,194,0,0,170,194,0,0,182,194,0,0,190,194,0,0,198,194,0,0,206,194,0,0,216,194,0,0,222,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,206,194,0,0,194,194,0,0,180,194,0,0,170,194,0,0,152,194,0,0,112,194,0,0,96,194,0,0,88,194,0,0,112,194,0,0,120,194,0,0,116,194,0,0,96,194,0,0,124,194,0,0,130,194,0,0,146,194,0,0,148,194,0,0,154,194,0,0,150,194,0,0,156,194,0,0,162,194,0,0,172,194,0,0,174,194,0,0,176,194,0,0,182,194,0,0,188,194,0,0,196,194,0,0,206,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,194,194,0,0,184,194,0,0,172,194,0,0,162,194,0,0,158,194,0,0,140,194,0,0,100,194,0,0,76,194,0,0,60,194,0,0,76,194,0,0,104,194,0,0,112,194,0,0,96,194,0,0,84,194,0,0,72,194,0,0,104,194,0,0,80,194,0,0,72,194,0,0,72,194,0,0,84,194,0,0,92,194,0,0,128,194,0,0,138,194,0,0,142,194,0,0,170,194,0,0,164,194,0,0,156,194,0,0,162,194,0,0,170,194,0,0,190,194,0,0,204,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,200,194,0,0,194,194,0,0,184,194,0,0,170,194,0,0,166,194,0,0,158,194,0,0,144,194,0,0,68,194,0,0,32,194,0,0,44,194,0,0,44,194,0,0,88,194,0,0,96,194,0,0,76,194,0,0,72,194,0,0,32,194,0,0,44,194,0,0,24,194,0,0,16,194,0,0,12,194,0,0,20,194,0,0,24,194,0,0,20,194,0,0,48,194,0,0,88,194,0,0,112,194,0,0,100,194,0,0,112,194,0,0,140,194,0,0,150,194,0,0,168,194,0,0,184,194,0,0,206,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,204,194,0,0,190,194,0,0,178,194,0,0,164,194,0,0,166,194,0,0,168,194,0,0,180,194,0,0,184,194,0,0,198,194,0,0,214,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,202,194,0,0,190,194,0,0,178,194,0,0,166,194,0,0,144,194,0,0,148,194,0,0,156,194,0,0,170,194,0,0,176,194,0,0,176,194,0,0,180,194,0,0,184,194,0,0,196,194,0,0,210,194,0,0,222,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,218,194,0,0,206,194,0,0,194,194,0,0,186,194,0,0,174,194,0,0,162,194,0,0,140,194,0,0,140,194,0,0,134,194,0,0,150,194,0,0,146,194,0,0,152,194,0,0,158,194,0,0,162,194,0,0,166,194,0,0,176,194,0,0,178,194,0,0,194,194,0,0,206,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,214,194,0,0,200,194,0,0,188,194,0,0,176,194,0,0,166,194,0,0,150,194,0,0,124,194,0,0,108,194,0,0,108,194,0,0,124,194,0,0,132,194,0,0,112,194,0,0,120,194,0,0,134,194,0,0,134,194,0,0,154,194,0,0,152,194,0,0,162,194,0,0,176,194,0,0,172,194,0,0,184,194,0,0,192,194,0,0,204,194,0,0,218,194,0,0,232,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,196,194,0,0,184,194,0,0,172,194,0,0,162,194,0,0,146,194,0,0,96,194,0,0,80,194,0,0,60,194,0,0,92,194,0,0,112,194,0,0,104,194,0,0,80,194,0,0,76,194,0,0,52,194,0,0,68,194,0,0,72,194,0,0,84,194,0,0,88,194,0,0,116,194,0,0,142,194,0,0,140,194,0,0,138,194,0,0,156,194,0,0,158,194,0,0,174,194,0,0,180,194,0,0,192,194,0,0,208,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,206,194,0,0,192,194,0,0,180,194,0,0,172,194,0,0,156,194,0,0,140,194,0,0,76,194,0,0,40,194,0,0,60,194,0,0,64,194,0,0,92,194,0,0,88,194,0,0,88,194,0,0,84,194,0,0,40,194,0,0,12,194,0,0,224,193,0,0,4,194,0,0,24,194,0,0,20,194,0,0,48,194,0,0,60,194,0,0,68,194,0,0,88,194,0,0,124,194,0,0,136,194,0,0,156,194,0,0,164,194,0,0,178,194,0,0,188,194,0,0,198,194,0,0,208,194,0,0,218,194,0,0,228,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,180,194,0,0,158,194,0,0,170,194,0,0,162,194,0,0,164,194,0,0,164,194,0,0,178,194,0,0,188,194,0,0,198,194,0,0,206,194,0,0,218,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,194,194,0,0,170,194,0,0,144,194,0,0,148,194,0,0,140,194,0,0,140,194,0,0,140,194,0,0,152,194,0,0,170,194,0,0,182,194,0,0,186,194,0,0,194,194,0,0,206,194,0,0,218,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,224,194,0,0,186,194,0,0,162,194,0,0,136,194,0,0,120,194,0,0,112,194,0,0,112,194,0,0,100,194,0,0,124,194,0,0,140,194,0,0,154,194,0,0,164,194,0,0,180,194,0,0,186,194,0,0,196,194,0,0,208,194,0,0,218,194,0,0,226,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,226,194,0,0,200,194,0,0,186,194,0,0,168,194,0,0,124,194,0,0,104,194,0,0,64,194,0,0,84,194,0,0,88,194,0,0,80,194,0,0,80,194,0,0,100,194,0,0,128,194,0,0,132,194,0,0,152,194,0,0,166,194,0,0,162,194,0,0,170,194,0,0,170,194,0,0,180,194,0,0,190,194,0,0,196,194,0,0,202,194,0,0,206,194,0,0,212,194,0,0,216,194,0,0,222,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,210,194,0,0,190,194,0,0,172,194,0,0,148,194,0,0,84,194,0,0,72,194,0,0,24,194,0,0,44,194,0,0,68,194,0,0,44,194,0,0,40,194,0,0,28,194,0,0,28,194,0,0,56,194,0,0,80,194,0,0,100,194,0,0,96,194,0,0,144,194,0,0,138,194,0,0,148,194,0,0,162,194,0,0,174,194,0,0,184,194,0,0,188,194,0,0,194,194,0,0,198,194,0,0,204,194,0,0,210,194,0,0,216,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,216,194,0,0,198,194,0,0,180,194,0,0,152,194,0,0,132,194,0,0,52,194,0,0,44,194,0,0,36,194,0,0,48,194,0,0,60,194,0,0,44,194,0,0,60,194,0,0,32,194,0,0,240,193,0,0,248,193,0,0,248,193,0,0,28,194,0,0,4,194,0,0,32,194,0,0,36,194,0,0,44,194,0,0,84,194,0,0,108,194,0,0,140,194,0,0,146,194,0,0,154,194,0,0,158,194,0,0,164,194,0,0,168,194,0,0,174,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,182,194,0,0,152,194,0,0,150,194,0,0,170,194,0,0,186,194,0,0,196,194,0,0,208,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,182,194,0,0,140,194,0,0,140,194,0,0,150,194,0,0,172,194,0,0,178,194,0,0,188,194,0,0,196,194,0,0,202,194,0,0,212,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,190,194,0,0,160,194,0,0,112,194,0,0,130,194,0,0,128,194,0,0,148,194,0,0,166,194,0,0,176,194,0,0,182,194],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+40960);allocate([0,0,190,194,0,0,198,194,0,0,206,194,0,0,214,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,190,194,0,0,160,194,0,0,104,194,0,0,92,194,0,0,68,194,0,0,132,194,0,0,136,194,0,0,142,194,0,0,156,194,0,0,156,194,0,0,160,194,0,0,176,194,0,0,170,194,0,0,178,194,0,0,194,194,0,0,200,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,190,194,0,0,160,194,0,0,84,194,0,0,80,194,0,0,36,194,0,0,108,194,0,0,108,194,0,0,68,194,0,0,104,194,0,0,96,194,0,0,124,194,0,0,172,194,0,0,158,194,0,0,180,194,0,0,186,194,0,0,196,194,0,0,206,194,0,0,214,194,0,0,224,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,194,194,0,0,182,194,0,0,146,194,0,0,52,194,0,0,32,194,0,0,4,194,0,0,84,194,0,0,116,194,0,0,68,194,0,0,88,194,0,0,72,194,0,0,72,194,0,0,112,194,0,0,80,194,0,0,134,194,0,0,148,194,0,0,162,194,0,0,184,194,0,0,192,194,0,0,200,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,226,194,0,0,212,194,0,0,198,194,0,0,184,194,0,0,154,194,0,0,160,194,0,0,176,194,0,0,194,194,0,0,212,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,232,194,0,0,218,194,0,0,204,194,0,0,190,194,0,0,178,194,0,0,148,194,0,0,144,194,0,0,176,194,0,0,174,194,0,0,190,194,0,0,204,194,0,0,218,194,0,0,232,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,232,194,0,0,218,194,0,0,204,194,0,0,190,194,0,0,178,194,0,0,150,194,0,0,132,194,0,0,148,194,0,0,154,194,0,0,156,194,0,0,172,194,0,0,174,194,0,0,180,194,0,0,192,194,0,0,210,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,230,194,0,0,216,194,0,0,202,194,0,0,188,194,0,0,176,194,0,0,132,194,0,0,96,194,0,0,116,194,0,0,140,194,0,0,130,194,0,0,156,194,0,0,144,194,0,0,166,194,0,0,168,194,0,0,186,194,0,0,196,194,0,0,210,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,210,194,0,0,190,194,0,0,178,194,0,0,164,194,0,0,100,194,0,0,80,194,0,0,80,194,0,0,108,194,0,0,96,194,0,0,108,194,0,0,104,194,0,0,138,194,0,0,134,194,0,0,176,194,0,0,164,194,0,0,164,194,0,0,178,194,0,0,188,194,0,0,200,194,0,0,216,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,202,194,0,0,192,194,0,0,180,194,0,0,166,194,0,0,154,194,0,0,88,194,0,0,44,194,0,0,24,194,0,0,72,194,0,0,64,194,0,0,80,194,0,0,64,194,0,0,40,194,0,0,40,194,0,0,76,194,0,0,80,194,0,0,84,194,0,0,108,194,0,0,130,194,0,0,142,194,0,0,156,194,0,0,170,194,0,0,190,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,240,194,0,0,210,194,0,0,172,194,0,0,136,194,0,0,156,194,0,0,158,194,0,0,180,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,240,194,0,0,210,194,0,0,172,194,0,0,132,194,0,0,146,194,0,0,154,194,0,0,176,194,0,0,192,194,0,0,210,194,0,0,230,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,240,194,0,0,210,194,0,0,184,194,0,0,160,194,0,0,116,194,0,0,128,194,0,0,136,194,0,0,160,194,0,0,174,194,0,0,184,194,0,0,200,194,0,0,220,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,240,194,0,0,208,194,0,0,182,194,0,0,158,194,0,0,80,194,0,0,112,194,0,0,88,194,0,0,128,194,0,0,138,194,0,0,154,194,0,0,160,194,0,0,164,194,0,0,168,194,0,0,170,194,0,0,174,194,0,0,176,194,0,0,180,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,236,194,0,0,200,194,0,0,174,194,0,0,154,194,0,0,68,194,0,0,72,194,0,0,48,194,0,0,104,194,0,0,116,194,0,0,116,194,0,0,134,194,0,0,130,194,0,0,120,194,0,0,120,194,0,0,120,194,0,0,130,194,0,0,136,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,230,194,0,0,196,194,0,0,168,194,0,0,120,194,0,0,68,194,0,0,48,194,0,0,24,194,0,0,56,194,0,0,68,194,0,0,68,194,0,0,56,194,0,0,28,194,0,0,20,194,0,0,28,194,0,0,32,194,0,0,40,194,0,0,44,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,176,194,0,0,148,194,0,0,154,194,0,0,164,194,0,0,164,194,0,0,170,194,0,0,180,194,0,0,188,194,0,0,198,194,0,0,208,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,176,194,0,0,132,194,0,0,140,194,0,0,162,194,0,0,160,194,0,0,162,194,0,0,168,194,0,0,176,194,0,0,182,194,0,0,186,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,176,194,0,0,116,194,0,0,124,194,0,0,140,194,0,0,142,194,0,0,148,194,0,0,154,194,0,0,160,194,0,0,166,194,0,0,170,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,172,194,0,0,120,194,0,0,124,194,0,0,120,194,0,0,120,194,0,0,104,194,0,0,80,194,0,0,72,194,0,0,72,194,0,0,80,194,0,0,88,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,236,194,0,0,216,194,0,0,168,194,0,0,84,194,0,0,72,194,0,0,72,194,0,0,72,194,0,0,92,194,0,0,60,194,0,0,52,194,0,0,32,194,0,0,32,194,0,0,32,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,236,194,0,0,200,194,0,0,146,194,0,0,44,194,0,0,20,194,0,0,40,194,0,0,44,194,0,0,84,194,0,0,24,194,0,0,20,194,0,0,12,194,0,0,12,194,0,0,24,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,182,194,0,0,168,194,0,0,148,194,0,0,160,194,0,0,160,194,0,0,160,194,0,0,160,194,0,0,160,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,182,194,0,0,168,194,0,0,148,194,0,0,136,194,0,0,136,194,0,0,136,194,0,0,136,194,0,0,136,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,172,194,0,0,156,194,0,0,140,194,0,0,112,194,0,0,52,194,0,0,240,193,0,0,168,193,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,174,194,0,0,156,194,0,0,134,194,0,0,64,194,0,0,24,194,0,0,232,193,0,0,168,193,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,172,194,0,0,138,194,0,0,96,194,0,0,52,194,0,0,12,194,0,0,4,194,0,0,232,193,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,220,194,0,0,200,194,0,0,166,194,0,0,142,194,0,0,64,194,0,0,216,193,0,0,24,194,0,0,20,194,0,0,8,194,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,192,121,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,226,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118,111,114,98,105,115,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+51200);var tempDoublePtr=STATICTOP;STATICTOP+=16;Module["_i64Subtract"]=_i64Subtract;var _llvm_pow_f64=Math_pow;Module["_i64Add"]=_i64Add;Module["_memset"]=_memset;function _ogvjs_callback_init_audio(channels,rate){Module.audioFormat={channels:channels,rate:rate};Module.loadedMetadata=true}Module["_bitshift64Shl"]=_bitshift64Shl;function _abort(){Module["abort"]()}Module["_llvm_bswap_i32"]=_llvm_bswap_i32;function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}Module["_sbrk"]=_sbrk;var _llvm_sqrt_f64=Math_sqrt;function __exit(status){Module["exit"](status)}function _exit(status){__exit(status)}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function _ogvjs_callback_audio(buffers,channels,sampleCount){var HEAPU32=Module.HEAPU32;var HEAPF32=Module.HEAPF32;var outputBuffers=[];if(buffers!==0){var inPtr,inArray,inBuffer,outArray;for(var channel=0;channel>2]=DYNAMIC_BASE;staticSealed=true;function invoke_iiiii(index,a1,a2,a3,a4){try{return Module["dynCall_iiiii"](index,a1,a2,a3,a4)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_vi(index,a1){try{Module["dynCall_vi"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_vii(index,a1,a2){try{Module["dynCall_vii"](index,a1,a2)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_ii(index,a1){try{return Module["dynCall_ii"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_viii(index,a1,a2,a3){try{Module["dynCall_viii"](index,a1,a2,a3)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8){try{return Module["dynCall_iiiiiiiii"](index,a1,a2,a3,a4,a5,a6,a7,a8)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iii(index,a1,a2){try{return Module["dynCall_iii"](index,a1,a2)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){try{return Module["dynCall_iiiiii"](index,a1,a2,a3,a4,a5)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}Module.asmGlobalArg={"Math":Math,"Int8Array":Int8Array,"Int16Array":Int16Array,"Int32Array":Int32Array,"Uint8Array":Uint8Array,"Uint16Array":Uint16Array,"Uint32Array":Uint32Array,"Float32Array":Float32Array,"Float64Array":Float64Array,"NaN":NaN,"Infinity":Infinity};Module.asmLibraryArg={"abort":abort,"assert":assert,"enlargeMemory":enlargeMemory,"getTotalMemory":getTotalMemory,"abortOnCannotGrowMemory":abortOnCannotGrowMemory,"invoke_iiiii":invoke_iiiii,"invoke_vi":invoke_vi,"invoke_vii":invoke_vii,"invoke_ii":invoke_ii,"invoke_viii":invoke_viii,"invoke_iiiiiiiii":invoke_iiiiiiiii,"invoke_iii":invoke_iii,"invoke_iiiiii":invoke_iiiiii,"_ogvjs_callback_init_audio":_ogvjs_callback_init_audio,"_llvm_pow_f64":_llvm_pow_f64,"_llvm_sqrt_f64":_llvm_sqrt_f64,"_abort":_abort,"___setErrNo":___setErrNo,"_ogvjs_callback_audio":_ogvjs_callback_audio,"_emscripten_memcpy_big":_emscripten_memcpy_big,"_exit":_exit,"__exit":__exit,"DYNAMICTOP_PTR":DYNAMICTOP_PTR,"tempDoublePtr":tempDoublePtr,"ABORT":ABORT,"STACKTOP":STACKTOP,"STACK_MAX":STACK_MAX};// EMSCRIPTEN_START_ASM +var asm=(function(global,env,buffer) { +"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.DYNAMICTOP_PTR|0;var j=env.tempDoublePtr|0;var k=env.ABORT|0;var l=env.STACKTOP|0;var m=env.STACK_MAX|0;var n=0;var o=0;var p=0;var q=0;var r=global.NaN,s=global.Infinity;var t=0,u=0,v=0,w=0,x=0.0,y=0,z=0,A=0,B=0.0;var C=0;var D=global.Math.floor;var E=global.Math.abs;var F=global.Math.sqrt;var G=global.Math.pow;var H=global.Math.cos;var I=global.Math.sin;var J=global.Math.tan;var K=global.Math.acos;var L=global.Math.asin;var M=global.Math.atan;var N=global.Math.atan2;var O=global.Math.exp;var P=global.Math.log;var Q=global.Math.ceil;var R=global.Math.imul;var S=global.Math.min;var T=global.Math.max;var U=global.Math.clz32;var V=env.abort;var W=env.assert;var X=env.enlargeMemory;var Y=env.getTotalMemory;var Z=env.abortOnCannotGrowMemory;var _=env.invoke_iiiii;var $=env.invoke_vi;var aa=env.invoke_vii;var ba=env.invoke_ii;var ca=env.invoke_viii;var da=env.invoke_iiiiiiiii;var ea=env.invoke_iii;var fa=env.invoke_iiiiii;var ga=env._ogvjs_callback_init_audio;var ha=env._llvm_pow_f64;var ia=env._llvm_sqrt_f64;var ja=env._abort;var ka=env.___setErrNo;var la=env._ogvjs_callback_audio;var ma=env._emscripten_memcpy_big;var na=env._exit;var oa=env.__exit;var pa=0.0; +// EMSCRIPTEN_START_FUNCS +function ya(a){a=a|0;var b=0;b=l;l=l+a|0;l=l+15&-16;return b|0}function za(){return l|0}function Aa(a){a=a|0;l=a}function Ba(a,b){a=a|0;b=b|0;l=a;m=b}function Ca(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function Da(a){a=a|0;C=a}function Ea(){return C|0}function Fa(b){b=b|0;var d=0;d=b;c[d>>2]=0;c[d+4>>2]=0;d=$c(256)|0;c[b+8>>2]=d;c[b+12>>2]=d;a[d>>0]=0;c[b+16>>2]=256;return}function Ga(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;do if(f>>>0<=32){g=b+16|0;h=c[g>>2]|0;i=b+12|0;j=c[i>>2]|0;if((c[b>>2]|0)<(h+-4|0))k=j;else{if(!j)return;if((h|0)>2147483391)break;j=b+8|0;l=cd(c[j>>2]|0,h+256|0)|0;if(!l)break;c[j>>2]=l;c[g>>2]=(c[g>>2]|0)+256;g=l+(c[b>>2]|0)|0;c[i>>2]=g;k=g}g=c[152+(f<<2)>>2]&e;l=b+4|0;j=c[l>>2]|0;h=j+f|0;a[k>>0]=d[k>>0]|0|g<7?(a[(c[i>>2]|0)+1>>0]=g>>>(8-(c[l>>2]|0)|0),(h|0)>15):0)?(a[(c[i>>2]|0)+2>>0]=g>>>(16-(c[l>>2]|0)|0),(h|0)>23):0)?(a[(c[i>>2]|0)+3>>0]=g>>>(24-(c[l>>2]|0)|0),(h|0)>31):0){j=c[l>>2]|0;a[(c[i>>2]|0)+4>>0]=(j|0)==0?0:g>>>(32-j|0)&255}j=(h|0)/8|0;c[b>>2]=(c[b>>2]|0)+j;c[i>>2]=(c[i>>2]|0)+j;c[l>>2]=h&7;return}while(0);k=c[b+8>>2]|0;if(k|0)ad(k);c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;return}function Ha(a){a=a|0;var b=0;b=c[a+8>>2]|0;if(b|0)ad(b);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;return}function Ia(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=a;c[e>>2]=0;c[e+4>>2]=0;c[a+12>>2]=b;c[a+8>>2]=b;c[a+16>>2]=d;return}function Ja(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(b>>>0>32){e=-1;return e|0}f=c[152+(b<<2)>>2]|0;g=c[a+4>>2]|0;h=g+b|0;b=c[a>>2]|0;i=c[a+16>>2]|0;if((b|0)>=(i+-4|0)){if((b|0)>(i-(h+7>>3)|0)){e=-1;return e|0}if(!h){e=0;return e|0}}i=c[a+12>>2]|0;a=(d[i>>0]|0)>>>g;if((h|0)>8){b=(d[i+1>>0]|0)<<8-g|a;if((h|0)>16){j=(d[i+2>>0]|0)<<16-g|b;if((h|0)>24){k=(d[i+3>>0]|0)<<24-g|j;if((g|0)==0|(h|0)<33)l=k;else l=(d[i+4>>0]|0)<<32-g|k}else l=j}else l=b}else l=a;e=l&f;return e|0}function Ka(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=a+4|0;e=(c[d>>2]|0)+b|0;b=c[a>>2]|0;f=c[a+16>>2]|0;if((b|0)>(f-(e+7>>3)|0)){c[a+12>>2]=0;c[a>>2]=f;g=1;c[d>>2]=g;return}else{f=(e|0)/8|0;h=a+12|0;c[h>>2]=(c[h>>2]|0)+f;c[a>>2]=f+b;g=e&7;c[d>>2]=g;return}}function La(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=c[a+16>>2]|0;do if(b>>>0>32){f=a+4|0;g=a}else{h=c[152+(b<<2)>>2]|0;i=a+4|0;j=c[i>>2]|0;k=j+b|0;l=c[a>>2]|0;if((l|0)>=(e+-4|0)){if((l|0)>(e-(k+7>>3)|0)){f=i;g=a;break}if(!k){m=0;return m|0}}n=a+12|0;o=c[n>>2]|0;p=(d[o>>0]|0)>>>j;if((k|0)>8){q=(d[o+1>>0]|0)<<8-j|p;if((k|0)>16){r=(d[o+2>>0]|0)<<16-j|q;if((k|0)>24){s=(d[o+3>>0]|0)<<24-j|r;if((j|0)==0|(k|0)<33)t=s;else t=(d[o+4>>0]|0)<<32-j|s}else t=r}else t=q}else t=p;p=(k|0)/8|0;c[n>>2]=o+p;c[a>>2]=l+p;c[i>>2]=k&7;m=t&h;return m|0}while(0);c[a+12>>2]=0;c[g>>2]=e;c[f>>2]=1;m=-1;return m|0}function Ma(a){a=a|0;return (((c[a+4>>2]|0)+7|0)/8|0)+(c[a>>2]|0)|0}function Na(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=a+836|0;e=c[a+840>>2]|0;Ga(b,c[a>>2]|0,5);if((c[a>>2]|0)>0){f=a+4|0;g=0;h=-1;do{i=f+(g<<2)|0;Ga(b,c[i>>2]|0,4);j=c[i>>2]|0;h=(h|0)<(j|0)?j:h;g=g+1|0}while((g|0)<(c[a>>2]|0));if((h|0)>=0){g=a+128|0;f=a+192|0;j=a+256|0;i=a+320|0;k=0;while(1){Ga(b,(c[g+(k<<2)>>2]|0)+-1|0,3);l=f+(k<<2)|0;Ga(b,c[l>>2]|0,2);if(!((c[l>>2]|0)!=0?(Ga(b,c[j+(k<<2)>>2]|0,8),(c[l>>2]|0)==31):0)){m=0;n=8}if((n|0)==8)while(1){n=0;Ga(b,(c[i+(k<<5)+(m<<2)>>2]|0)+1|0,8);m=m+1|0;if((m|0)>=(1<>2]|0))break;else n=8}if((k|0)==(h|0))break;else k=k+1|0}}}Ga(b,(c[a+832>>2]|0)+-1|0,2);k=e+-1|0;if((e|0)==0|(k|0)==0){Ga(b,0,4);o=0}else{e=0;h=k;do{e=e+1|0;h=h>>>1}while((h|0)!=0);Ga(b,e,4);e=0;h=k;while(1){k=e+1|0;h=h>>>1;if(!h){o=k;break}else e=k}}e=c[a>>2]|0;if((e|0)<=0)return;h=a+128|0;k=a+4|0;n=e;e=0;m=0;i=0;while(1){e=(c[h+(c[k+(m<<2)>>2]<<2)>>2]|0)+e|0;if((i|0)<(e|0)){j=i;do{Ga(b,c[d+(j+2<<2)>>2]|0,o);j=j+1|0}while((j|0)!=(e|0));p=c[a>>2]|0;q=e}else{p=n;q=i}m=m+1|0;if((m|0)>=(p|0))break;else{n=p;i=q}}return}function Oa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;d=l;l=l+272|0;e=d;f=c[a+28>>2]|0;a=bd(1,1120)|0;g=La(b,5)|0;c[a>>2]=g;a:do if((g|0)>0){h=a+4|0;i=0;j=-1;do{k=La(b,4)|0;c[h+(i<<2)>>2]=k;if((k|0)<0)break a;j=(j|0)<(k|0)?k:j;i=i+1|0}while((i|0)<(c[a>>2]|0));if((j|0)>=0){i=a+128|0;h=a+192|0;k=a+256|0;m=f+24|0;n=a+320|0;o=0;while(1){c[i+(o<<2)>>2]=(La(b,3)|0)+1;p=La(b,2)|0;q=h+(o<<2)|0;c[q>>2]=p;if((p|0)<0)break a;r=k+(o<<2)|0;if(!p)s=c[r>>2]|0;else{p=La(b,8)|0;c[r>>2]=p;s=p}if((s|0)<0)break a;if((s|0)>=(c[m>>2]|0))break a;if((c[q>>2]|0)!=31){p=0;do{r=La(b,8)|0;c[n+(o<<5)+(p<<2)>>2]=r+-1;if((r|0)<0)break a;p=p+1|0;if((r|0)>(c[m>>2]|0))break a}while((p|0)<(1<>2]|0))}if((o|0)<(j|0))o=o+1|0;else{t=18;break}}}else t=18}else t=18;while(0);b:do if((t|0)==18?(c[a+832>>2]=(La(b,2)|0)+1,s=La(b,4)|0,(s|0)>=0):0){f=c[a>>2]|0;if((f|0)>0){g=a+128|0;o=a+4|0;j=a+836|0;m=1<>2]<<2)>>2]|0)+f|0;if((i|0)>63)break b;if((h|0)<(i|0)){q=h;do{p=La(b,s)|0;c[j+(q+2<<2)>>2]=p;if(!((p|0)>-1&(p|0)<(m|0)))break b;q=q+1|0}while((q|0)<(i|0));u=c[a>>2]|0;v=q}else{u=n;v=h}k=k+1|0;if((k|0)>=(u|0)){w=i;x=j;y=m;break}else{n=u;f=i;h=v}}}else{w=0;x=a+836|0;y=1<>2]=0;c[a+840>>2]=y;h=w+2|0;if((w|0)>-2){f=0;do{c[e+(f<<2)>>2]=x+(f<<2);f=f+1|0}while((f|0)<(h|0))}Pc(e,h,4,11);c:do if((h|0)>1){f=c[c[e>>2]>>2]|0;s=1;while(1){n=f;f=c[c[e+(s<<2)>>2]>>2]|0;s=s+1|0;if((n|0)==(f|0))break;if((s|0)>=(h|0))break c}if(!a)z=0;else break b;l=d;return z|0}while(0);z=a;l=d;return z|0}while(0);ad(a);z=0;l=d;return z|0}function Pa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;a=l;l=l+272|0;d=a;e=bd(1,1312)|0;c[e+1296>>2]=b;f=b+836|0;g=e+1288|0;c[g>>2]=c[b+840>>2];h=c[b>>2]|0;if((h|0)>0){i=b+128|0;j=b+4|0;k=0;m=0;do{m=(c[i+(c[j+(k<<2)>>2]<<2)>>2]|0)+m|0;k=k+1|0}while((k|0)<(h|0));h=m+2|0;c[e+1284>>2]=h;if((m|0)>-2){n=h;o=m;p=7}else{Pc(d,h,4,11);q=m}}else{c[e+1284>>2]=2;n=2;o=0;p=7}if((p|0)==7){m=0;do{c[d+(m<<2)>>2]=f+(m<<2);m=m+1|0}while((m|0)<(n|0));Pc(d,n,4,11);m=f;h=e+260|0;k=0;do{c[h+(k<<2)>>2]=(c[d+(k<<2)>>2]|0)-m>>2;k=k+1|0}while((k|0)<(n|0));k=e+520|0;m=e+260|0;d=0;do{c[k+(c[m+(d<<2)>>2]<<2)>>2]=d;d=d+1|0}while((d|0)<(n|0));d=e+260|0;m=0;do{c[e+(m<<2)>>2]=c[f+(c[d+(m<<2)>>2]<<2)>>2];m=m+1|0}while((m|0)<(n|0));q=o}switch(c[b+832>>2]|0){case 1:{r=256;p=19;break}case 2:{r=128;p=19;break}case 3:{r=86;p=19;break}case 4:{r=64;p=19;break}default:{}}if((p|0)==19)c[e+1292>>2]=r;if((q|0)<=0){l=a;return e|0}r=e+1032|0;p=e+780|0;b=0;o=2;while(1){n=c[f+(b+2<<2)>>2]|0;m=1;d=c[g>>2]|0;k=0;h=0;j=0;while(1){i=c[f+(k<<2)>>2]|0;s=(i|0)>(j|0)&(i|0)<(n|0);h=s?k:h;t=(i|0)<(d|0)&(i|0)>(n|0);m=t?k:m;k=k+1|0;if((k|0)==(o|0))break;else{d=t?i:d;j=s?i:j}}c[r+(b<<2)>>2]=h;c[p+(b<<2)>>2]=m;b=b+1|0;if((b|0)==(q|0))break;else o=o+1|0}l=a;return e|0}function Qa(a){a=a|0;if(!a)return;ad(a);return}function Ra(a){a=a|0;if(!a)return;ad(a);return}function Sa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=c[b+1296>>2]|0;e=c[(c[(c[(c[a+64>>2]|0)+4>>2]|0)+28>>2]|0)+2848>>2]|0;f=a+4|0;if((La(f,1)|0)!=1){g=0;return g|0}h=b+1284|0;i=Ua(a,c[h>>2]<<2)|0;a=b+1292|0;j=(c[a>>2]|0)+-1|0;if(!j)k=0;else{l=0;m=j;while(1){j=l+1|0;m=m>>>1;if(!m){k=j;break}else l=j}}c[i>>2]=La(f,k)|0;k=(c[a>>2]|0)+-1|0;if(!k)n=0;else{l=0;m=k;while(1){k=l+1|0;m=m>>>1;if(!m){n=k;break}else l=k}}c[i+4>>2]=La(f,n)|0;a:do if((c[d>>2]|0)>0){n=0;l=2;b:while(1){m=c[d+4+(n<<2)>>2]|0;k=c[d+128+(m<<2)>>2]|0;j=c[d+192+(m<<2)>>2]|0;o=1<>2]|0)*56|0)|0,f)|0;if((p|0)==-1){g=0;q=29;break}else r=p}else r=0;if((k|0)>0){p=o+-1|0;o=r;s=0;do{t=c[d+320+(m<<5)+((o&p)<<2)>>2]|0;o=o>>j;if((t|0)>-1){u=Va(e+(t*56|0)|0,f)|0;c[i+(s+l<<2)>>2]=u;if((u|0)==-1){g=0;q=29;break b}}else c[i+(s+l<<2)>>2]=0;s=s+1|0}while((s|0)<(k|0))}n=n+1|0;if((n|0)>=(c[d>>2]|0))break a;else l=k+l|0}if((q|0)==29)return g|0}while(0);if((c[h>>2]|0)<=2){g=i;return g|0}q=b+1032|0;f=b+780|0;b=2;do{e=b+-2|0;r=q+(e<<2)|0;l=c[r>>2]|0;n=c[d+836+(l<<2)>>2]|0;s=f+(e<<2)|0;e=c[s>>2]|0;j=c[i+(l<<2)>>2]&32767;l=(c[i+(e<<2)>>2]&32767)-j|0;o=(R((l|0)>-1?l:0-l|0,(c[d+836+(b<<2)>>2]|0)-n|0)|0)/((c[d+836+(e<<2)>>2]|0)-n|0)|0;n=((l|0)<0?0-o|0:o)+j|0;j=(c[a>>2]|0)-n|0;o=i+(b<<2)|0;l=c[o>>2]|0;if(!l)c[o>>2]=n|32768;else{do if((l|0)<(((j|0)<(n|0)?j:n)<<1|0))if(!(l&1)){v=l>>1;break}else{v=0-(l+1>>1)|0;break}else if((j|0)>(n|0)){v=l-n|0;break}else{v=~(l-j);break}while(0);c[o>>2]=v+n&32767;j=i+(c[r>>2]<<2)|0;c[j>>2]=c[j>>2]&32767;j=i+(c[s>>2]<<2)|0;c[j>>2]=c[j>>2]&32767}b=b+1|0}while((b|0)<(c[h>>2]|0));g=i;return g|0}function Ta(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0.0;f=c[b+1296>>2]|0;h=(c[(c[(c[(c[a+64>>2]|0)+4>>2]|0)+28>>2]|0)+(c[a+28>>2]<<2)>>2]|0)/2|0;if(!d){id(e|0,0,h<<2|0)|0;i=0;return i|0}a=c[f+832>>2]|0;j=R(a,c[d>>2]|0)|0;k=(j|0)<0?0:(j|0)<255?j:255;j=c[b+1284>>2]|0;if((j|0)>1){l=b+260|0;b=0;m=1;n=0;o=k;while(1){p=c[l+(m<<2)>>2]|0;q=c[d+(p<<2)>>2]|0;a:do if((q&32767|0)==(q|0)){r=c[f+836+(p<<2)>>2]|0;s=R(a,q)|0;t=(s|0)<0?0:(s|0)<255?s:255;s=t-o|0;u=r-n|0;v=(s|0)/(u|0)|0;w=s>>31|1;x=R(v,u)|0;y=((s|0)>-1?s:0-s|0)-((x|0)>-1?x:0-x|0)|0;x=(h|0)>(r|0)?r:h;if((x|0)>(n|0)){z=0;A=n;B=o;C=8}else{D=0;E=n;F=o}while(1){if((C|0)==8){C=0;s=e+(A<<2)|0;g[s>>2]=+g[s>>2]*+g[476+(B<<2)>>2];D=z;E=A;F=B}s=E+1|0;if((s|0)>=(x|0)){G=r;H=r;I=t;break a}J=D+y|0;K=(J|0)<(u|0);z=J-(K?0:u)|0;A=s;B=F+v+(K?0:w)|0;C=8}}else{G=b;H=n;I=o}while(0);m=m+1|0;if((m|0)>=(j|0)){L=G;M=I;break}else{b=G;n=H;o=I}}}else{L=0;M=k}if((L|0)>=(h|0)){i=1;return i|0}N=+g[476+(M<<2)>>2];M=L;do{L=e+(M<<2)|0;g[L>>2]=+g[L>>2]*N;M=M+1|0}while((M|0)!=(h|0));i=1;return i|0}function Ua(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=b+7&-8;b=a+72|0;e=c[b>>2]|0;f=a+76|0;g=a+68|0;h=c[g>>2]|0;if((e+d|0)<=(c[f>>2]|0)){i=h;j=e;k=i+j|0;l=j+d|0;c[b>>2]=l;return k|0}if(h|0){m=$c(8)|0;n=a+80|0;c[n>>2]=(c[n>>2]|0)+e;e=a+84|0;c[m+4>>2]=c[e>>2];c[m>>2]=h;c[e>>2]=m}c[f>>2]=d;f=$c(d)|0;c[g>>2]=f;c[b>>2]=0;i=f;j=0;k=i+j|0;l=j+d|0;c[b>>2]=l;return k|0}function Va(a,b){a=a|0;b=b|0;var d=0,e=0;if((c[a+8>>2]|0)<=0){d=-1;return d|0}e=Wa(a,b)|0;if((e|0)<=-1){d=-1;return d|0}d=c[(c[a+24>>2]|0)+(e<<2)>>2]|0;return d|0}function Wa(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=c[b+40>>2]|0;f=Ja(d,c[b+36>>2]|0)|0;do if((f|0)>-1){g=c[(c[b+32>>2]|0)+(f<<2)>>2]|0;if((g|0)<0){h=(c[b+8>>2]|0)-(g&32767)|0;i=g>>>15&32767;break}j=g+-1|0;Ka(d,a[(c[b+28>>2]|0)+j>>0]|0);k=j;return k|0}else{h=c[b+8>>2]|0;i=0}while(0);f=e;while(1){l=Ja(d,f)|0;m=(l|0)<0;if((f|0)>1&m)f=f+-1|0;else break}if(m){k=-1;return k|0}m=kd(l|0)|0;l=m>>>4&252645135|m<<4&-252645136;m=l>>>2&858993459|l<<2&-858993460;l=m>>>1&1431655765|m<<1&-1431655766;m=h-i|0;if((m|0)>1){e=c[b+20>>2]|0;j=h;h=i;g=m;while(1){m=g>>>1;n=(c[e+(m+h<<2)>>2]|0)>>>0>l>>>0;o=(n?0:m)+h|0;j=j-(n?m:0)|0;g=j-o|0;if((g|0)<=1){p=o;break}else h=o}}else p=i;i=a[(c[b+28>>2]|0)+p>>0]|0;if((i|0)>(f|0)){Ka(d,f);k=-1;return k|0}else{Ka(d,i);k=p;return k|0}return 0}function Xa(a,b){a=a|0;b=b|0;return (c[c[a>>2]>>2]|0)-(c[c[b>>2]>>2]|0)|0}function Ya(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=c[a+28>>2]|0;a=$c(96)|0;e=La(b,8)|0;c[a>>2]=e;f=La(b,16)|0;c[a+4>>2]=f;g=La(b,16)|0;c[a+8>>2]=g;c[a+12>>2]=La(b,6)|0;c[a+16>>2]=La(b,8)|0;h=La(b,4)|0;i=a+20|0;c[i>>2]=h+1;a:do if((e|0)<1){if(!a){j=0;return j|0}}else if((f|0)>=1?!((h|0)<0|(g|0)<1):0){if((h|0)<=-1){j=a;return j|0}k=a+24|0;l=d+24|0;m=0;while(1){n=La(b,8)|0;c[k+(m<<2)>>2]=n;if((n|0)<0)break a;if((n|0)>=(c[l>>2]|0))break a;o=c[d+1824+(n<<2)>>2]|0;if(!(c[o+12>>2]|0))break a;m=m+1|0;if((c[o>>2]|0)<1)break a;if((m|0)>=(c[i>>2]|0)){j=a;break}}return j|0}while(0);ad(a);j=0;return j|0}function Za(a,b){a=a|0;b=b|0;a=bd(1,32)|0;c[a+4>>2]=c[b>>2];c[a>>2]=c[b+8>>2];c[a+20>>2]=b;c[a+8>>2]=bd(2,4)|0;return a|0}function _a(a){a=a|0;if(!a)return;ad(a);return}function $a(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;if(!a)return;b=a+8|0;d=c[b>>2]|0;if(d|0){e=c[d>>2]|0;if(!e)f=d;else{ad(e);f=c[b>>2]|0}e=c[f+4>>2]|0;if(!e)g=f;else{ad(e);g=c[b>>2]|0}ad(g)}ad(a);return}function ab(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,h=0,i=0,j=0.0,k=0.0,l=0,m=0,n=0;d=c[b+20>>2]|0;e=a+4|0;f=d+12|0;h=La(e,c[f>>2]|0)|0;if((h|0)<=0){i=0;return i|0}j=+(h|0)/+((1<>2])+-1|0)*+(c[d+16>>2]|0);f=d+20|0;h=La(e,db(c[f>>2]|0)|0)|0;if((h|0)==-1){i=0;return i|0}if((h|0)>=(c[f>>2]|0)){i=0;return i|0}f=(c[(c[(c[(c[a+64>>2]|0)+4>>2]|0)+28>>2]|0)+2848>>2]|0)+((c[d+24+(h<<2)>>2]|0)*56|0)|0;h=b+4|0;b=Ua(a,((c[f>>2]|0)+(c[h>>2]|0)<<2)+4|0)|0;if((eb(f,b,e,c[h>>2]|0)|0)==-1){i=0;return i|0}e=c[h>>2]|0;if((e|0)>0){h=0;k=0.0;while(1){a:do if((h|0)<(e|0)){a=c[f>>2]|0;d=h;l=0;while(1){if((l|0)>=(a|0)){m=d;break a}n=b+(d<<2)|0;g[n>>2]=+g[n>>2]+k;n=d+1|0;if((n|0)<(e|0)){d=n;l=l+1|0}else{m=n;break}}}else m=h;while(0);if((m|0)<(e|0)){h=m;k=+g[b+(m+-1<<2)>>2]}else break}}g[b+(e<<2)>>2]=j;i=b;return i|0}function bb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0;f=c[b+20>>2]|0;h=b+8|0;i=c[a+28>>2]|0;j=(c[h>>2]|0)+(i<<2)|0;if(!(c[j>>2]|0)){k=c[(c[(c[(c[a+64>>2]|0)+4>>2]|0)+28>>2]|0)+(i<<2)>>2]|0;a=(k|0)/2|0;l=c[b>>2]|0;m=+(c[f+4>>2]|0);c[j>>2]=$c((a<<2)+4|0)|0;j=c[(c[h>>2]|0)+(i<<2)>>2]|0;a:do if((k|0)>1){n=m*.5/+(a|0);o=+(l|0)/(+M(+(m*m*4.624999938585006e-09))*2.240000009536743+m*4.999999873689376e-05+ +M(+(m*3.699999942909926e-04))*13.100000381469727);p=l;q=0;while(1){r=+(q|0)*n;s=~~+D(+((+M(+(r*r*1.8499999754340024e-08))*2.240000009536743+ +M(+(r*7.399999885819852e-04))*13.100000381469727+r*9.999999747378752e-05)*o));c[j+(q<<2)>>2]=(s|0)<(p|0)?s:p+-1|0;s=q+1|0;if((s|0)>=(a|0)){t=s;break a}p=c[b>>2]|0;q=s}}else t=0;while(0);c[j+(t<<2)>>2]=-1;c[b+12+(i<<2)>>2]=a;u=a}else u=c[b+12+(i<<2)>>2]|0;if(!d){id(e|0,0,u<<2|0)|0;v=0;return v|0}else{a=c[b+4>>2]|0;cb(e,c[(c[h>>2]|0)+(i<<2)>>2]|0,u,c[b>>2]|0,d,a,+g[d+(a<<2)>>2],+(c[f+16>>2]|0));v=1;return v|0}return 0}function cb(a,b,d,e,f,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=+i;j=+j;var k=0.0,l=0,m=0.0,n=0,o=0.0,p=0.0,q=0.0,r=0,s=0,t=0,u=0.0,v=0.0,w=0;k=3.141592653589793/+(e|0);if((h|0)>0){e=0;do{l=f+(e<<2)|0;g[l>>2]=+H(+(+g[l>>2]))*2.0;e=e+1|0}while((e|0)!=(h|0))}if((d|0)<=0)return;m=i;i=j;if((h|0)<=1){e=(h|0)==1;l=c[b>>2]|0;n=0;while(1){j=+H(+(+(l|0)*k))*2.0;if(e){o=(j-+g[f>>2])*.5;p=4.0-j*j;q=o*o}else{p=2.0-j;q=(j+2.0)*.25}j=+O(+((m/+F(+(q+p*.25))-i)*.1151292473077774));r=n;do{s=a+(r<<2)|0;g[s>>2]=+g[s>>2]*j;r=r+1|0;t=c[b+(r<<2)>>2]|0}while((t|0)==(l|0));if((r|0)<(d|0)){l=t;n=r}else break}return}n=h+-2|0;t=((n&-2)+3|0)==(h|0);l=f+((n|1)+1<<2)|0;n=c[b>>2]|0;e=0;while(1){p=+H(+(+(n|0)*k))*2.0;s=1;q=.5;j=.5;do{j=(p-+g[f+(s+-1<<2)>>2])*j;q=(p-+g[f+(s<<2)>>2])*q;s=s+2|0}while((s|0)<(h|0));if(t){o=(p-+g[l>>2])*j;u=q*q*(4.0-p*p);v=o*o}else{u=q*q*(2.0-p);v=j*j*(p+2.0)}o=+O(+((m/+F(+(v+u))-i)*.1151292473077774));s=e;do{r=a+(s<<2)|0;g[r>>2]=+g[r>>2]*o;s=s+1|0;w=c[b+(s<<2)>>2]|0}while((w|0)==(n|0));if((s|0)<(d|0)){n=w;e=s}else break}return}function db(a){a=a|0;var b=0,c=0,d=0;if(!a){b=0;return b|0}else{c=0;d=a}while(1){a=c+1|0;d=d>>>1;if(!d){b=a;break}else c=a}return b|0}function eb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;f=(e|0)>0;if((c[a+8>>2]|0)<=0){if(!f){g=0;return g|0}id(b|0,0,e<<2|0)|0;g=0;return g|0}if(!f){g=0;return g|0}f=a+16|0;h=0;while(1){i=Wa(a,d)|0;if((i|0)==-1){g=-1;j=10;break}k=c[a>>2]|0;l=(c[f>>2]|0)+((R(k,i)|0)<<2)|0;if((k|0)>0&(h|0)<(e|0)){i=h;m=0;while(1){n=i+1|0;c[b+(i<<2)>>2]=c[l+(m<<2)>>2];m=m+1|0;if(!((m|0)<(k|0)&(n|0)<(e|0))){o=n;break}else i=n}}else o=h;if((o|0)<(e|0))h=o;else{g=0;j=10;break}}if((j|0)==10)return g|0;return 0}function fb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=bd(1,2840)|0;e=c[a+28>>2]|0;c[d>>2]=La(b,24)|0;c[d+4>>2]=La(b,24)|0;c[d+8>>2]=(La(b,24)|0)+1;a=La(b,6)|0;f=d+12|0;c[f>>2]=a+1;g=La(b,8)|0;h=d+20|0;c[h>>2]=g;a:do if((g|0)>=0){if((a|0)>-1){i=d+24|0;j=0;k=0;do{l=La(b,3)|0;m=La(b,1)|0;if((m|0)<0){n=25;break a}if(m){m=La(b,5)|0;if(!(m>>31&2))o=((m|0)<0?0:m<<3)|l;else{n=25;break a}}else o=l;c[i+(k<<2)>>2]=o;if(!o)p=0;else{l=0;m=o;while(1){q=(m&1)+l|0;m=m>>>1;if(!m){p=q;break}else l=q}}j=p+j|0;k=k+1|0}while((k|0)<(c[f>>2]|0));k=(j|0)>0;if(k){i=d+280|0;l=0;while(1){m=La(b,8)|0;if((m|0)<0)break a;c[i+(l<<2)>>2]=m;l=l+1|0;if((l|0)>=(j|0)){r=j;s=k;break}}}else{r=j;s=0}}else{r=0;s=0}k=c[h>>2]|0;l=c[e+24>>2]|0;if((k|0)<(l|0)){if(s){i=d+280|0;m=0;do{q=c[i+(m<<2)>>2]|0;if((q|0)>=(l|0))break a;m=m+1|0;if(!(c[(c[e+1824+(q<<2)>>2]|0)+12>>2]|0))break a}while((m|0)<(r|0))}m=c[e+1824+(k<<2)>>2]|0;l=c[m+4>>2]|0;i=c[m>>2]|0;if((i|0)>=1){m=c[f>>2]|0;j=i;i=1;while(1){i=R(m,i)|0;if((i|0)>(l|0))break a;if((j|0)<=1)break;else j=j+-1|0}c[d+16>>2]=i;t=d;return t|0}}}else n=25;while(0);if((n|0)==25?(d|0)==0:0){t=0;return t|0}ad(d);t=0;return t|0}function gb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;d=bd(1,44)|0;e=c[(c[a+4>>2]|0)+28>>2]|0;c[d>>2]=b;a=c[b+12>>2]|0;c[d+4>>2]=a;f=e+2848|0;e=c[f>>2]|0;c[d+12>>2]=e;g=e+((c[b+20>>2]|0)*56|0)|0;c[d+16>>2]=g;e=c[g>>2]|0;g=bd(a,4)|0;c[d+20>>2]=g;if((a|0)>0){h=b+24|0;i=b+280|0;b=0;j=0;k=0;while(1){l=c[h+(j<<2)>>2]|0;if(l){m=0;n=l;while(1){o=m+1|0;n=n>>>1;if(!n)break;else m=o}n=(o|0)>(k|0)?o:k;c[g+(j<<2)>>2]=bd(o,4)|0;if((m|0)<0){p=b;q=n}else{r=g+(j<<2)|0;s=b;t=0;while(1){if(!(l&1<>2]|0)+(t<<2)>>2]=(c[f>>2]|0)+((c[i+(s<<2)>>2]|0)*56|0);u=s+1|0}t=t+1|0;if((t|0)==(o|0)){p=u;q=n;break}else s=u}}}else{p=b;q=k}j=j+1|0;if((j|0)>=(a|0)){v=q;break}else{b=p;k=q}}}else v=0;q=d+24|0;c[q>>2]=1;k=(e|0)>0;if(k){p=1;b=0;do{p=R(p,a)|0;b=b+1|0}while((b|0)!=(e|0));c[q>>2]=p;w=p<<2;x=p}else{w=4;x=1}c[d+8>>2]=v;v=$c(w)|0;c[d+28>>2]=v;if((x|0)<=0)return d|0;w=e<<2;if(k)y=0;else{k=0;do{c[v+(k<<2)>>2]=$c(w)|0;k=k+1|0}while((k|0)<(x|0));return d|0}do{k=$c(w)|0;c[v+(y<<2)>>2]=k;p=x;q=0;b=y;do{p=(p|0)/(a|0)|0;j=(b|0)/(p|0)|0;b=b-(R(j,p)|0)|0;c[k+(q<<2)>>2]=j;q=q+1|0}while((q|0)!=(e|0));y=y+1|0}while((y|0)<(x|0));return d|0}function hb(a){a=a|0;if(!a)return;ad(a);return}function ib(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;if(!a)return;b=a+4|0;d=c[b>>2]|0;e=a+20|0;f=c[e>>2]|0;if((d|0)>0){g=d;d=f;h=0;while(1){i=c[d+(h<<2)>>2]|0;if(!i){j=d;k=g}else{ad(i);j=c[e>>2]|0;k=c[b>>2]|0}h=h+1|0;if((h|0)>=(k|0)){l=j;break}else{g=k;d=j}}}else l=f;ad(l);l=a+24|0;f=a+28|0;j=c[f>>2]|0;if((c[l>>2]|0)>0){d=j;k=0;while(1){ad(c[d+(k<<2)>>2]|0);k=k+1|0;g=c[f>>2]|0;if((k|0)>=(c[l>>2]|0)){m=g;break}else d=g}}else m=j;ad(m);ad(a);return}function jb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;if((f|0)>0){g=0;h=0}else return 0;while(1){if(!(c[e+(g<<2)>>2]|0))i=h;else{c[d+(h<<2)>>2]=c[d+(g<<2)>>2];i=h+1|0}g=g+1|0;if((g|0)==(f|0))break;else h=i}if(!i)return 0;lb(a,b,d,i,3);return 0}function kb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;if((c[a+8>>2]|0)<=0){h=0;l=f;return h|0}i=c[a>>2]|0;j=(e|0)/(i|0)|0;e=l;l=l+((1*(j<<2)|0)+15&-16)|0;k=(j|0)>0;a:do if(k){m=a+16|0;n=0;while(1){o=Wa(a,d)|0;if((o|0)==-1){h=-1;break}p=c[a>>2]|0;c[e+(n<<2)>>2]=(c[m>>2]|0)+((R(p,o)|0)<<2);n=n+1|0;if((n|0)>=(j|0)){q=p;break a}}l=f;return h|0}else q=i;while(0);if((q|0)<1|k^1){h=0;l=f;return h|0}else{r=0;s=0}while(1){k=0;do{i=b+(k+s<<2)|0;g[i>>2]=+g[i>>2]+ +g[(c[e+(k<<2)>>2]|0)+(r<<2)>>2];k=k+1|0}while((k|0)!=(j|0));r=r+1|0;if((r|0)>=(q|0)){h=0;break}else s=s+j|0}l=f;return h|0}function lb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;g=l;h=c[b>>2]|0;i=c[h+8>>2]|0;j=b+16|0;k=c[c[j>>2]>>2]|0;m=c[a+36>>2]>>1;n=c[h+4>>2]|0;o=((n|0)<(m|0)?n:m)-(c[h>>2]|0)|0;if((o|0)<=0){l=g;return}m=(o|0)/(i|0)|0;o=l;l=l+((1*(e<<2)|0)+15&-16)|0;n=(e|0)>0;if(n){p=((k+-1+m|0)/(k|0)|0)<<2;q=0;do{c[o+(q<<2)>>2]=Ua(a,p)|0;q=q+1|0}while((q|0)!=(e|0))}q=b+8|0;p=c[q>>2]|0;if((p|0)<=0){l=g;return}r=(m|0)>0;s=a+4|0;a=h+16|0;t=b+28|0;u=(k|0)>0;v=b+20|0;b=0-k|0;w=(e|0)<1;x=p;p=0;a:while(1){if(r){y=1<>2]|0,s)|0;if((D|0)==-1){E=26;break a}if((D|0)>=(c[a>>2]|0)){E=26;break a}F=c[(c[t>>2]|0)+(D<<2)>>2]|0;c[(c[o+(C<<2)>>2]|0)+(B<<2)>>2]=F;C=C+1|0;if(!F){E=26;break a}}while((C|0)<(e|0))}do if(u&(A|0)<(m|0)){if(n){G=A;H=0}else{C=A-m|0;I=A-(C>>>0>>0?b:C)|0;break}while(1){C=R(G,i)|0;F=0;do{D=(c[h>>2]|0)+C|0;J=c[(c[(c[o+(F<<2)>>2]|0)+(B<<2)>>2]|0)+(H<<2)>>2]|0;if((c[h+24+(J<<2)>>2]&y|0?(K=c[(c[(c[v>>2]|0)+(J<<2)>>2]|0)+(p<<2)>>2]|0,K|0):0)?(qa[f&7](K,(c[d+(F<<2)>>2]|0)+(D<<2)|0,s,i)|0)==-1:0){E=26;break a}F=F+1|0}while((F|0)<(e|0));H=H+1|0;F=G+1|0;if(!((H|0)<(k|0)&(F|0)<(m|0))){I=F;break}else G=F}}else I=A;while(0);if((I|0)<(m|0)){A=I;B=B+1|0}else break}L=c[q>>2]|0}else L=x;p=p+1|0;if((p|0)>=(L|0)){E=26;break}else x=L}if((E|0)==26){l=g;return}}function mb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;Ga(b,c[a>>2]|0,24);Ga(b,c[a+4>>2]|0,24);Ga(b,(c[a+8>>2]|0)+-1|0,24);d=a+12|0;Ga(b,(c[d>>2]|0)+-1|0,6);Ga(b,c[a+20>>2]|0,8);if((c[d>>2]|0)<=0)return;e=a+24|0;f=0;g=0;do{h=e+(g<<2)|0;i=c[h>>2]|0;if(i){j=0;k=i;while(1){k=k>>>1;if(!k)break;else j=j+1|0}if((j|0)>2){Ga(b,i,3);Ga(b,1,1);Ga(b,c[h>>2]>>3,5)}else l=9}else l=9;if((l|0)==9){l=0;Ga(b,i,4)}k=c[h>>2]|0;if(!k)m=0;else{n=0;o=k;while(1){k=(o&1)+n|0;o=o>>>1;if(!o){m=k;break}else n=k}}f=m+f|0;g=g+1|0}while((g|0)<(c[d>>2]|0));if((f|0)<=0)return;d=a+280|0;a=0;do{Ga(b,c[d+(a<<2)>>2]|0,8);a=a+1|0}while((a|0)!=(f|0));return}function nb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;if((f|0)>0){g=0;h=0}else{i=0;return i|0}while(1){if(!(c[e+(g<<2)>>2]|0))j=h;else{c[d+(h<<2)>>2]=c[d+(g<<2)>>2];j=h+1|0}g=g+1|0;if((g|0)==(f|0))break;else h=j}if(!j){i=0;return i|0}h=c[b>>2]|0;f=c[h+8>>2]|0;g=c[h+12>>2]|0;e=((c[h+4>>2]|0)-(c[h>>2]|0)|0)/(f|0)|0;k=Ua(a,j<<2)|0;l=100.0/+(f|0);m=(j|0)>0;if(m){n=e<<2;o=0;do{p=Ua(a,n)|0;c[k+(o<<2)>>2]=p;id(p|0,0,n|0)|0;o=o+1|0}while((o|0)!=(j|0))}if((e|0)>0){o=(f|0)>0;n=g+-1|0;a=(g|0)>1;g=0;do{p=R(g,f)|0;q=(c[h>>2]|0)+p|0;a:do if(m){if(!o){if(a)r=0;else{p=0;while(1){c[(c[k+(p<<2)>>2]|0)+(g<<2)>>2]=0;p=p+1|0;if((p|0)==(j|0))break a}}while(1){p=0;while(1){if((c[h+2328+(p<<2)>>2]|0)>=0?c[h+2584+(p<<2)>>2]|0:0){s=p;break}t=p+1|0;if((t|0)<(n|0))p=t;else{s=t;break}}c[(c[k+(r<<2)>>2]|0)+(g<<2)>>2]=s;r=r+1|0;if((r|0)==(j|0))break a}}if(a)u=0;else{p=0;while(1){c[(c[k+(p<<2)>>2]|0)+(g<<2)>>2]=0;p=p+1|0;if((p|0)==(j|0))break a}}do{p=c[d+(u<<2)>>2]|0;t=0;v=0;w=0;do{x=c[p+(q+v<<2)>>2]|0;y=(x|0)>-1?x:0-x|0;w=(y|0)>(w|0)?y:w;t=y+t|0;v=v+1|0}while((v|0)!=(f|0));v=~~(+(t|0)*l);p=0;while(1){if((w|0)<=(c[h+2328+(p<<2)>>2]|0)?(y=c[h+2584+(p<<2)>>2]|0,(y|0)<0|(v|0)<(y|0)):0){z=p;break}y=p+1|0;if((y|0)<(n|0))p=y;else{z=y;break}}c[(c[k+(u<<2)>>2]|0)+(g<<2)>>2]=z;u=u+1|0}while((u|0)!=(j|0))}while(0);g=g+1|0}while((g|0)!=(e|0))}e=b+40|0;c[e>>2]=(c[e>>2]|0)+1;i=k;return i|0}function ob(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0;if((g|0)>0){j=0;k=0}else return 0;while(1){if(!(c[f+(j<<2)>>2]|0))l=k;else{c[e+(k<<2)>>2]=c[e+(j<<2)>>2];l=k+1|0}j=j+1|0;if((j|0)==(g|0))break;else k=l}if(!l)return 0;rb(a,d,e,l,h);return 0}function pb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;if((f|0)>0){g=0;h=0}else return 0;while(1){if(!(c[e+(g<<2)>>2]|0))i=h;else{c[d+(h<<2)>>2]=c[d+(g<<2)>>2];i=h+1|0}g=g+1|0;if((g|0)==(f|0))break;else h=i}if(!i)return 0;lb(a,b,d,i,4);return 0}function qb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;if((c[a+8>>2]|0)<=0){f=0;return f|0}if((c[a>>2]|0)>8){if((e|0)<=0){f=0;return f|0}h=a+16|0;i=0;while(1){j=Wa(a,d)|0;if((j|0)==-1){f=-1;k=29;break}l=c[a>>2]|0;m=(c[h>>2]|0)+((R(l,j)|0)<<2)|0;if((l|0)>0){j=i;n=0;while(1){o=b+(j<<2)|0;g[o>>2]=+g[o>>2]+ +g[m+(n<<2)>>2];n=n+1|0;if((n|0)==(l|0))break;else j=j+1|0}p=i+l|0}else p=i;if((p|0)<(e|0))i=p;else{f=0;k=29;break}}if((k|0)==29)return f|0}p=a+16|0;if((e|0)>0)q=0;else{f=0;return f|0}a:while(1){b:while(1){r=Wa(a,d)|0;if((r|0)==-1){f=-1;k=29;break a}s=c[p>>2]|0;switch(c[a>>2]|0){case 8:{k=21;break b;break}case 7:{k=22;break b;break}case 6:{k=23;break b;break}case 5:{k=24;break b;break}case 4:{k=25;break b;break}case 3:{k=26;break b;break}case 2:{k=27;break b;break}case 1:{k=28;break b;break}default:{}}}if((k|0)==21){k=0;l=s+(r<<3<<2)|0;i=b+(q<<2)|0;g[i>>2]=+g[i>>2]+ +g[l>>2];t=l;u=q+1|0;v=1;k=11}else if((k|0)==22){k=0;t=s+(r*7<<2)|0;u=q;v=0;k=11}else if((k|0)==23){k=0;w=s+(r*6<<2)|0;x=q;y=0;k=12}else if((k|0)==24){k=0;z=s+(r*5<<2)|0;A=q;B=0;k=13}else if((k|0)==25){k=0;C=s+(r<<2<<2)|0;D=q;E=0;k=14}else if((k|0)==26){k=0;F=s+(r*3<<2)|0;G=q;H=0;k=15}else if((k|0)==27){k=0;I=s+(r<<1<<2)|0;J=q;K=0;k=16}else if((k|0)==28){k=0;L=s+(r<<2)|0;M=q;N=0}if((k|0)==11){k=0;l=b+(u<<2)|0;g[l>>2]=+g[l>>2]+ +g[t+(v<<2)>>2];w=t;x=u+1|0;y=v+1|0;k=12}if((k|0)==12){k=0;l=b+(x<<2)|0;g[l>>2]=+g[l>>2]+ +g[w+(y<<2)>>2];z=w;A=x+1|0;B=y+1|0;k=13}if((k|0)==13){k=0;l=b+(A<<2)|0;g[l>>2]=+g[l>>2]+ +g[z+(B<<2)>>2];C=z;D=A+1|0;E=B+1|0;k=14}if((k|0)==14){k=0;l=b+(D<<2)|0;g[l>>2]=+g[l>>2]+ +g[C+(E<<2)>>2];F=C;G=D+1|0;H=E+1|0;k=15}if((k|0)==15){k=0;l=b+(G<<2)|0;g[l>>2]=+g[l>>2]+ +g[F+(H<<2)>>2];I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H=H+1|0;if((H|0)==(e|0))break a}}do{H=c[f+(G<<2)>>2]|0;K=1;I=c[H+(F<<2)>>2]|0;while(1){J=R(I,o)|0;L=K+F|0;if((L|0)<(r|0))M=(c[H+(L<<2)>>2]|0)+J|0;else M=J;K=K+1|0;if((K|0)==(q|0))break;else I=M}I=c[p>>2]|0;if((M|0)<(c[I+4>>2]|0)){K=sb(I,M,a)|0;c[w>>2]=(c[w>>2]|0)+K}G=G+1|0}while((G|0)!=(e|0))}while(0);if(x&(F|0)<(r|0)){K=F;I=0;while(1){H=R(K,n)|0;J=(c[m>>2]|0)+H|0;if(y){H=0;do{L=f+(H<<2)|0;N=c[L>>2]|0;O=c[N+(K<<2)>>2]|0;P=k+(O<<2)|0;if(C)c[P>>2]=(c[P>>2]|0)+n;if(c[m+24+(O<<2)>>2]&D|0?(P=c[(c[(c[z>>2]|0)+(O<<2)>>2]|0)+(t<<2)>>2]|0,P|0):0){O=(c[d+(H<<2)>>2]|0)+(J<<2)|0;Q=c[P>>2]|0;S=(n|0)/(Q|0)|0;if((S|0)>0){T=P+48|0;U=P+52|0;V=P+44|0;W=P+12|0;X=P+4|0;Y=Q;Z=0;_=0;while(1){$=O+((R(_,Q)|0)<<2)|0;aa=c[T>>2]|0;ba=c[U>>2]|0;ca=c[V>>2]|0;da=ca>>1;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;c[h+20>>2]=0;c[h+24>>2]=0;c[h+28>>2]=0;ea=(Y|0)>0;do if((ba|0)==1){if(!ea){fa=0;break}ga=ca+-1|0;md(h|0,$|0,Y<<2|0)|0;ha=0;ia=0;ja=Y;while(1){ja=ja+-1|0;ka=(c[$+(ja<<2)>>2]|0)-aa|0;if((ka|0)<(da|0))la=(da-ka<<1)+-1|0;else la=ka-da<<1;ka=R(ia,ca)|0;ma=((la|0)<0?0:(la|0)>=(ca|0)?ga:la)+ka|0;ha=ha+1|0;if((ha|0)==(Y|0)){fa=ma;break}else ia=ma}}else{if(!ea){fa=0;break}ia=(ba>>1)-aa|0;ha=ca+-1|0;ga=0;ja=0;ma=Y;while(1){ma=ma+-1|0;ka=(ia+(c[$+(ma<<2)>>2]|0)|0)/(ba|0)|0;if((ka|0)<(da|0))na=(da-ka<<1)+-1|0;else na=ka-da<<1;oa=R(ja,ca)|0;pa=((na|0)<0?0:(na|0)>=(ca|0)?ha:na)+oa|0;c[h+(ma<<2)>>2]=(R(ka,ba)|0)+aa;ga=ga+1|0;if((ga|0)==(Y|0)){fa=pa;break}else ja=pa}}while(0);da=c[(c[W>>2]|0)+8>>2]|0;if((c[da+(fa<<2)>>2]|0)<1){c[i>>2]=0;c[i+4>>2]=0;c[i+8>>2]=0;c[i+12>>2]=0;c[i+16>>2]=0;c[i+20>>2]=0;c[i+24>>2]=0;c[i+28>>2]=0;ja=(R(ca+-1|0,ba)|0)+aa|0;ga=c[X>>2]|0;b:do if((ga|0)>0){if(ea){qa=-1;ra=0;sa=fa}else{ma=-1;ha=0;ia=fa;while(1){do if((c[da+(ha<<2)>>2]|0)>0){if(!((ma|0)==-1|(ma|0)>0)){ta=ma;ua=ia;break};c[h>>2]=c[i>>2];c[h+4>>2]=c[i+4>>2];c[h+8>>2]=c[i+8>>2];c[h+12>>2]=c[i+12>>2];c[h+16>>2]=c[i+16>>2];c[h+20>>2]=c[i+20>>2];c[h+24>>2]=c[i+24>>2];c[h+28>>2]=c[i+28>>2];ta=0;ua=ha}else{ta=ma;ua=ia}while(0);pa=c[i>>2]|0;if((pa|0)<(ja|0)){va=pa;wa=i}else{pa=i;ka=0;while(1){ka=ka+1|0;c[pa>>2]=0;oa=i+(ka<<2)|0;xa=c[oa>>2]|0;if((xa|0)<(ja|0)){va=xa;wa=oa;break}else pa=oa}}pa=va+ba|0;if((va|0)>-1){c[wa>>2]=pa;ya=pa}else ya=va;c[wa>>2]=0-ya;ha=ha+1|0;if((ha|0)==(ga|0)){za=ua;break b}else{ma=ta;ia=ua}}}while(1){do if((c[da+(ra<<2)>>2]|0)>0){ia=0;ma=0;do{ha=(c[i+(ia<<2)>>2]|0)-(c[$+(ia<<2)>>2]|0)|0;ma=(R(ha,ha)|0)+ma|0;ia=ia+1|0}while((ia|0)!=(Y|0));if(!((qa|0)==-1|(ma|0)<(qa|0))){Aa=qa;Ba=sa;break};c[h>>2]=c[i>>2];c[h+4>>2]=c[i+4>>2];c[h+8>>2]=c[i+8>>2];c[h+12>>2]=c[i+12>>2];c[h+16>>2]=c[i+16>>2];c[h+20>>2]=c[i+20>>2];c[h+24>>2]=c[i+24>>2];c[h+28>>2]=c[i+28>>2];Aa=ma;Ba=ra}else{Aa=qa;Ba=sa}while(0);ia=c[i>>2]|0;if((ia|0)<(ja|0)){Ca=ia;Da=i}else{ia=i;ha=0;while(1){ha=ha+1|0;c[ia>>2]=0;pa=i+(ha<<2)|0;ka=c[pa>>2]|0;if((ka|0)<(ja|0)){Ca=ka;Da=pa;break}else ia=pa}}ia=Ca+ba|0;if((Ca|0)>-1){c[Da>>2]=ia;Ea=ia}else Ea=Ca;c[Da>>2]=0-Ea;ra=ra+1|0;if((ra|0)==(ga|0)){za=Ba;break}else{qa=Aa;sa=Ba}}}else za=fa;while(0);Fa=za}else Fa=fa;if(ea&(Fa|0)>-1){ga=$;ba=0;while(1){c[ga>>2]=(c[ga>>2]|0)-(c[h+(ba<<2)>>2]|0);ba=ba+1|0;if((ba|0)==(Y|0))break;else ga=ga+4|0}}Ga=(sb(P,Fa,a)|0)+Z|0;ga=_+1|0;if((ga|0)==(S|0))break;Y=c[P>>2]|0;Z=Ga;_=ga}Ha=c[L>>2]|0;Ia=Ga}else{Ha=N;Ia=0}c[A>>2]=(c[A>>2]|0)+Ia;_=j+(c[Ha+(K<<2)>>2]<<2)|0;c[_>>2]=(c[_>>2]|0)+Ia}H=H+1|0}while((H|0)!=(e|0))}I=I+1|0;H=K+1|0;if(!((I|0)<(q|0)&(H|0)<(r|0))){Ja=H;break}else K=H}}else Ja=F;if((Ja|0)<(r|0))F=Ja;else break}Ka=c[s>>2]|0}else Ka=B;t=t+1|0;if((t|0)>=(Ka|0))break;else B=Ka}l=g;return}function sb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;if((b|0)<0){e=0;return e|0}f=a+12|0;g=c[f>>2]|0;if((c[g+4>>2]|0)<=(b|0)){e=0;return e|0}Ga(d,c[(c[a+20>>2]|0)+(b<<2)>>2]|0,c[(c[g+8>>2]|0)+(b<<2)>>2]|0);e=c[(c[(c[f>>2]|0)+8>>2]|0)+(b<<2)>>2]|0;return e|0}function tb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;if((f|0)>0){g=0;h=0}else{i=0;return i|0}do{h=((c[e+(g<<2)>>2]|0)!=0&1)+h|0;g=g+1|0}while((g|0)!=(f|0));if(!h){i=0;return i|0}h=c[b>>2]|0;g=c[h+8>>2]|0;e=c[h+12>>2]|0;j=((c[h+4>>2]|0)-(c[h>>2]|0)|0)/(g|0)|0;k=Ua(a,4)|0;l=j<<2;m=Ua(a,l)|0;c[k>>2]=m;id(m|0,0,l|0)|0;a:do if((j|0)>0){m=e+-1|0;a=(e|0)>1;n=c[k>>2]|0;if((g|0)<=0){if(a)o=0;else{id(n|0,0,l|0)|0;break}while(1){p=0;while(1){if((c[h+2328+(p<<2)>>2]|0)>=0?(c[h+2584+(p<<2)>>2]|0)>=0:0){q=p;break}r=p+1|0;if((r|0)<(m|0))p=r;else{q=r;break}}c[n+(o<<2)>>2]=q;o=o+1|0;if((o|0)==(j|0))break a}}p=(c[h>>2]|0)/(f|0)|0;r=c[d>>2]|0;if((f|0)>1){s=0;t=p}else{u=0;v=p;while(1){p=0;w=v;x=0;do{y=c[r+(w<<2)>>2]|0;z=(y|0)>-1?y:0-y|0;x=(z|0)>(x|0)?z:x;w=w+1|0;p=p+f|0}while((p|0)<(g|0));b:do if(a){p=0;while(1){if((x|0)<=(c[h+2328+(p<<2)>>2]|0)?(c[h+2584+(p<<2)>>2]|0)>=0:0){A=p;break b}z=p+1|0;if((z|0)<(m|0))p=z;else{A=z;break}}}else A=0;while(0);c[n+(u<<2)>>2]=A;u=u+1|0;if((u|0)==(j|0))break a;else v=w}}while(1){v=0;u=0;x=t;p=0;while(1){z=c[r+(x<<2)>>2]|0;y=(z|0)>-1?z:0-z|0;B=v;z=1;do{C=c[(c[d+(z<<2)>>2]|0)+(x<<2)>>2]|0;D=(C|0)>-1?C:0-C|0;B=(D|0)>(B|0)?D:B;z=z+1|0}while((z|0)!=(f|0));p=(y|0)>(p|0)?y:p;x=x+1|0;u=u+f|0;if((u|0)>=(g|0))break;else v=B}c:do if(a){v=0;while(1){if((p|0)<=(c[h+2328+(v<<2)>>2]|0)?(B|0)<=(c[h+2584+(v<<2)>>2]|0):0){E=v;break c}u=v+1|0;if((u|0)<(m|0))v=u;else{E=u;break}}}else E=0;while(0);c[n+(s<<2)>>2]=E;s=s+1|0;if((s|0)==(j|0))break;else t=x}}while(0);t=b+40|0;c[t>>2]=(c[t>>2]|0)+1;i=k;return i|0}function ub(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+16|0;j=i;k=c[b+36>>2]|0;m=(k|0)/2|0;n=Ua(b,R(g<<2,m)|0)|0;c[j>>2]=n;if((g|0)<=0){l=i;return 0}if((k|0)>1){k=0;b=0;while(1){o=c[e+(k<<2)>>2]|0;p=(c[f+(k<<2)>>2]|0)!=0&1;q=0;r=k;while(1){c[n+(r<<2)>>2]=c[o+(q<<2)>>2];q=q+1|0;if((q|0)>=(m|0))break;else r=r+g|0}r=p+b|0;k=k+1|0;if((k|0)==(g|0)){s=r;break}else b=r}}else{b=0;k=0;while(1){m=((c[f+(b<<2)>>2]|0)!=0&1)+k|0;b=b+1|0;if((b|0)==(g|0)){s=m;break}else k=m}}if(!s){l=i;return 0}rb(a,d,j,1,h);l=i;return 0}function vb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;g=c[b>>2]|0;h=c[g+8>>2]|0;i=b+16|0;j=c[c[i>>2]>>2]|0;k=(R(c[a+36>>2]|0,f)|0)>>1;l=c[g+4>>2]|0;m=((l|0)<(k|0)?l:k)-(c[g>>2]|0)|0;if((m|0)<=0)return 0;k=(m|0)/(h|0)|0;m=Ua(a,((j+-1+k|0)/(j|0)|0)<<2)|0;a:do if((f|0)>0){l=0;while(1){if(c[e+(l<<2)>>2]|0){n=l;break a}o=l+1|0;if((o|0)<(f|0))l=o;else{n=o;break}}}else n=0;while(0);if((n|0)==(f|0))return 0;n=b+8|0;if((c[n>>2]|0)<=0)return 0;e=(k|0)>0;l=a+4|0;a=g+16|0;o=b+28|0;p=(j|0)>0;q=b+20|0;b=0;b:while(1){c:do if(e){r=1<>2]|0)+(y<<2)>>2]|0;if((c[g+24+(z<<2)>>2]&r|0?(A=c[(c[(c[q>>2]|0)+(z<<2)>>2]|0)+(b<<2)>>2]|0,A|0):0)?(z=R(x,h)|0,(wb(A,d,(c[g>>2]|0)+z|0,f,l,h)|0)==-1):0){B=28;break b}y=y+1|0;z=x+1|0;if(!((y|0)<(j|0)&(z|0)<(k|0))){C=z;break}else x=z}}else C=u;if((C|0)<(k|0)){u=C;v=v+1|0}else break c}}while(1){v=Va(c[i>>2]|0,l)|0;if((v|0)==-1){B=28;break b}if((v|0)>=(c[a>>2]|0)){B=28;break b}u=c[(c[o>>2]|0)+(v<<2)>>2]|0;v=m+(t<<2)|0;c[v>>2]=u;if(!u){B=28;break b}d:do if(p&(s|0)<(k|0)){x=u;y=s;w=0;while(1){z=c[x+(w<<2)>>2]|0;if((c[g+24+(z<<2)>>2]&r|0?(A=c[c[(c[q>>2]|0)+(z<<2)>>2]>>2]|0,A|0):0)?(z=R(y,h)|0,(wb(A,d,(c[g>>2]|0)+z|0,f,l,h)|0)==-1):0){B=28;break b}z=w+1|0;A=y+1|0;if(!((z|0)<(j|0)&(A|0)<(k|0))){D=A;break d}x=c[v>>2]|0;y=A;w=z}}else D=s;while(0);if((D|0)<(k|0)){s=D;t=t+1|0}else break}}while(0);b=b+1|0;if((b|0)>=(c[n>>2]|0)){B=28;break}}if((B|0)==28)return 0;return 0}function wb(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;if((c[a+8>>2]|0)<=0){i=0;return i|0}j=(d|0)/(e|0)|0;k=(h+d|0)/(e|0)|0;if((j|0)>=(k|0)){i=0;return i|0}d=a+16|0;h=0;l=j;while(1){j=Wa(a,f)|0;if((j|0)==-1){i=-1;m=8;break}n=c[a>>2]|0;o=(c[d>>2]|0)+((R(n,j)|0)<<2)|0;if((n|0)>0){j=h;p=l;q=0;while(1){r=j+1|0;s=(c[b+(j<<2)>>2]|0)+(p<<2)|0;g[s>>2]=+g[s>>2]+ +g[o+(q<<2)>>2];s=(r|0)==(e|0);t=(s&1)+p|0;u=s?0:r;q=q+1|0;if((q|0)==(n|0)){v=u;w=t;break}else{j=u;p=t}}}else{v=h;w=l}if((w|0)<(k|0)){h=v;l=w}else{i=0;m=8;break}}if((m|0)==8)return i|0;return 0}function xb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((c[b>>2]|0)>1){Ga(d,1,1);Ga(d,(c[b>>2]|0)+-1|0,4)}else Ga(d,0,1);e=b+1156|0;if((c[e>>2]|0)>0){Ga(d,1,1);Ga(d,(c[e>>2]|0)+-1|0,8);if((c[e>>2]|0)>0){f=b+1160|0;g=a+4|0;h=b+2184|0;i=0;do{j=c[f+(i<<2)>>2]|0;k=c[g>>2]|0;l=k+-1|0;if((k|0)==0|(l|0)==0)m=0;else{k=0;n=l;while(1){l=k+1|0;n=n>>>1;if(!n){m=l;break}else k=l}}Ga(d,j,m);k=c[h+(i<<2)>>2]|0;n=c[g>>2]|0;l=n+-1|0;if((n|0)==0|(l|0)==0)o=0;else{n=0;p=l;while(1){l=n+1|0;p=p>>>1;if(!p){o=l;break}else n=l}}Ga(d,k,o);i=i+1|0}while((i|0)<(c[e>>2]|0))}}else Ga(d,0,1);Ga(d,0,2);e=c[b>>2]|0;if((e|0)>1){i=a+4|0;if((c[i>>2]|0)>0){a=b+4|0;o=0;do{Ga(d,c[a+(o<<2)>>2]|0,4);o=o+1|0}while((o|0)<(c[i>>2]|0));q=c[b>>2]|0;r=17}}else{q=e;r=17}if((r|0)==17?(q|0)<=0:0)return;q=b+1028|0;r=b+1092|0;e=0;do{Ga(d,0,8);Ga(d,c[q+(e<<2)>>2]|0,8);Ga(d,c[r+(e<<2)>>2]|0,8);e=e+1|0}while((e|0)<(c[b>>2]|0));return}function yb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=bd(1,3208)|0;e=c[a+28>>2]|0;id(d|0,0,3208)|0;f=La(b,1)|0;a:do if((f|0)<0){if(!d){g=0;return g|0}}else{if(f){h=La(b,4)|0;c[d>>2]=h+1;if((h|0)<0)break}else c[d>>2]=1;h=La(b,1)|0;if((h|0)>=0){if(h|0){h=La(b,8)|0;i=d+1156|0;c[i>>2]=h+1;if((h|0)<0)break;h=a+4|0;j=d+1160|0;k=d+2184|0;l=c[h>>2]|0;m=0;do{n=l+-1|0;if((l|0)==0|(n|0)==0)o=0;else{p=0;q=n;while(1){n=p+1|0;q=q>>>1;if(!q){o=n;break}else p=n}}p=La(b,o)|0;c[j+(m<<2)>>2]=p;q=c[h>>2]|0;n=q+-1|0;if((q|0)==0|(n|0)==0)r=0;else{q=0;s=n;while(1){n=q+1|0;s=s>>>1;if(!s){r=n;break}else q=n}}q=La(b,r)|0;c[k+(m<<2)>>2]=q;if((p|0)==(q|0)|(q|p|0)<0)break a;l=c[h>>2]|0;m=m+1|0;if(!((p|0)<(l|0)&(q|0)<(l|0)))break a}while((m|0)<(c[i>>2]|0))}if(!(La(b,2)|0)){i=c[d>>2]|0;if((i|0)>1){m=a+4|0;if((c[m>>2]|0)>0){l=d+4|0;h=0;while(1){k=La(b,4)|0;c[l+(h<<2)>>2]=k;j=c[d>>2]|0;h=h+1|0;if((k|0)<0|(k|0)>=(j|0))break a;if((h|0)>=(c[m>>2]|0)){t=j;u=20;break}}}}else{t=i;u=20}if((u|0)==20?(t|0)<=0:0){g=d;return g|0}m=d+1028|0;h=e+16|0;l=d+1092|0;j=e+20|0;k=0;while(1){La(b,8)|0;q=La(b,8)|0;c[m+(k<<2)>>2]=q;if((q|0)<0?1:(q|0)>=(c[h>>2]|0))break a;q=La(b,8)|0;c[l+(k<<2)>>2]=q;k=k+1|0;if((q|0)<0?1:(q|0)>=(c[j>>2]|0))break a;if((k|0)>=(c[d>>2]|0)){g=d;break}}return g|0}}}while(0);ad(d);g=0;return g|0}function zb(a){a=a|0;if(!a)return;ad(a);return}function Ab(a){a=a|0;var b=0,d=0,e=0,f=0,h=0,i=0,k=0,m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0.0,B=0,C=0,D=0,E=0.0,F=0,G=0.0,H=0.0,I=0,J=0,K=0,L=0,M=0.0,N=0.0,O=0,P=0.0,Q=0,R=0,S=0.0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0;b=l;d=c[a+64>>2]|0;e=c[d+4>>2]|0;f=c[e+28>>2]|0;h=c[d+104>>2]|0;d=c[a+104>>2]|0;i=c[a+36>>2]|0;k=e+4|0;e=c[k>>2]<<2;m=l;l=l+((1*e|0)+15&-16)|0;n=Ua(a,e)|0;e=Ua(a,c[k>>2]<<2)|0;o=Ua(a,c[k>>2]<<2)|0;p=d+4|0;q=+g[p>>2];r=c[k>>2]|0;s=l;l=l+((1*(r<<2)|0)+15&-16)|0;t=a+28|0;u=c[t>>2]|0;v=c[f+544+(u<<2)>>2]|0;w=(c[h+56>>2]|0)+((c[d+8>>2]|0)*52|0)+((u|0?2:0)*52|0)|0;x=a+40|0;c[x>>2]=u;a:do if((r|0)>0){y=(i|0)/2|0;z=y<<2;A=+(((g[j>>2]=4.0/+(i|0),c[j>>2]|0)&2147483647)>>>0)*7.177114298428933e-07+-764.6162109375+.345;B=h+4|0;C=a+24|0;D=a+32|0;E=A+-764.6162109375;F=i+-1|0;G=A+-382.30810546875;if((F|0)>1){H=q;I=0}else{A=q;J=0;while(1){K=c[(c[a>>2]|0)+(J<<2)>>2]|0;c[e+(J<<2)>>2]=Ua(a,z)|0;L=n+(J<<2)|0;c[L>>2]=Ua(a,z)|0;Eb(K,B,f,c[C>>2]|0,c[t>>2]|0,c[D>>2]|0);Fb(c[c[h+12+(c[t>>2]<<2)>>2]>>2]|0,K,c[L>>2]|0);Gb(h+20+((c[t>>2]|0)*12|0)|0,K);M=E+ +((c[K>>2]&2147483647)>>>0)*7.177114298428933e-07+.345;g[K>>2]=M;N=M>0.0?0.0:M;g[s+(J<<2)>>2]=N;M=N>A?N:A;J=J+1|0;if((J|0)>=(c[k>>2]|0)){O=y;P=M;Q=z;break a}else A=M}}while(1){J=c[(c[a>>2]|0)+(I<<2)>>2]|0;c[e+(I<<2)>>2]=Ua(a,z)|0;K=n+(I<<2)|0;c[K>>2]=Ua(a,z)|0;Eb(J,B,f,c[C>>2]|0,c[t>>2]|0,c[D>>2]|0);Fb(c[c[h+12+(c[t>>2]<<2)>>2]>>2]|0,J,c[K>>2]|0);Gb(h+20+((c[t>>2]|0)*12|0)|0,J);A=E+ +((c[J>>2]&2147483647)>>>0)*7.177114298428933e-07+.345;g[J>>2]=A;K=s+(I<<2)|0;g[K>>2]=A;M=A;L=1;do{A=+g[J+(L<<2)>>2];R=L+1|0;N=+g[J+(R<<2)>>2];S=G+ +(((g[j>>2]=N*N+A*A,c[j>>2]|0)&2147483647)>>>0)*3.5885571492144663e-07+.345;g[J+(R>>1<<2)>>2]=S;M=S>M?S:M;L=L+2|0}while((L|0)<(F|0));S=M>0.0?0.0:M;g[K>>2]=S;A=S>H?S:H;I=I+1|0;if((I|0)>=(c[k>>2]|0)){O=y;P=A;Q=z;break}else H=A}}else{z=(i|0)/2|0;O=z;P=q;Q=z<<2}while(0);I=Ua(a,Q)|0;r=Ua(a,Q)|0;Q=c[k>>2]|0;b:do if((Q|0)>0){z=(i|0)>1;y=h+48|0;F=0;while(1){D=c[v+4+(F<<2)>>2]|0;C=c[n+(F<<2)>>2]|0;B=c[(c[a>>2]|0)+(F<<2)>>2]|0;L=B+(O<<2)|0;c[x>>2]=u;J=Ua(a,60)|0;R=o+(F<<2)|0;c[R>>2]=J;T=J;J=T+60|0;do{c[T>>2]=0;T=T+4|0}while((T|0)<(J|0));if(z){T=0;do{g[L+(T<<2)>>2]=+((c[C+(T<<2)>>2]&2147483647)>>>0)*7.177114298428933e-07+-764.6162109375+.345;T=T+1|0}while((T|0)<(O|0))}Hb(w,L,I);Ib(w,B,r,P,+g[s+(F<<2)>>2]);Jb(w,I,r,1,B,C,L);T=v+1028+(D<<2)|0;J=c[T>>2]|0;if((c[f+800+(J<<2)>>2]|0)!=1){U=-1;break}K=Kb(a,c[(c[y>>2]|0)+(J<<2)>>2]|0,L,B)|0;c[(c[R>>2]|0)+28>>2]=K;if(Lb(a)|0?c[(c[R>>2]|0)+28>>2]|0:0){Jb(w,I,r,2,B,C,L);K=Kb(a,c[(c[y>>2]|0)+(c[T>>2]<<2)>>2]|0,L,B)|0;c[(c[R>>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2]|0)!=0&1;c[V+(z<<2)>>2]=c[e+(J<<2)>>2];Y=c[k>>2]|0;Z=z+1|0}else{Y=K;Z=z}J=J+1|0;if((J|0)>=(Y|0)){_=Z;break}else{K=Y;z=Z}}}else _=0;z=f+1312+(F<<2)|0;K=xa[c[(c[464+(c[z>>2]<<2)>>2]|0)+20>>2]&7](a,c[(c[x>>2]|0)+(F<<2)>>2]|0,V,Q,_)|0;J=c[k>>2]|0;if((J|0)>0){R=0;B=0;while(1){if((c[v+4+(B<<2)>>2]|0)==(y|0)){c[V+(R<<2)>>2]=c[e+(B<<2)>>2];$=R+1|0}else $=R;B=B+1|0;if((B|0)>=(J|0)){aa=$;break}else R=$}}else aa=0;va[c[(c[464+(c[z>>2]<<2)>>2]|0)+24>>2]&3](p,a,c[(c[x>>2]|0)+(F<<2)>>2]|0,V,Q,aa,K,y)|0;y=y+1|0}while((y|0)<(c[v>>2]|0))}y=(Lb(a)|0)!=0;if((h|0)<((y?14:7)|0))h=h+1|0;else{U=0;break}}l=b;return U|0}function Bb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0.0,E=0.0,F=0.0,G=0,H=0,I=0.0,J=0;d=l;e=c[a+64>>2]|0;f=c[e+4>>2]|0;h=c[f+28>>2]|0;i=c[e+104>>2]|0;e=a+28|0;j=c[h+(c[e>>2]<<2)>>2]|0;c[a+36>>2]=j;k=f+4|0;f=c[k>>2]|0;m=f<<2;n=l;l=l+((1*m|0)+15&-16)|0;o=l;l=l+((1*m|0)+15&-16)|0;p=l;l=l+((1*m|0)+15&-16)|0;q=l;l=l+((1*m|0)+15&-16)|0;if((f|0)>0){m=b+4|0;r=b+1028|0;s=i+48|0;t=j<<1&2147483646;u=0;do{v=c[r+(c[m+(u<<2)>>2]<<2)>>2]|0;w=wa[c[(c[456+(c[h+800+(v<<2)>>2]<<2)>>2]|0)+20>>2]&15](a,c[(c[s>>2]|0)+(v<<2)>>2]|0)|0;c[q+(u<<2)>>2]=w;c[p+(u<<2)>>2]=(w|0)!=0&1;id(c[(c[a>>2]|0)+(u<<2)>>2]|0,0,t|0)|0;u=u+1|0;w=c[k>>2]|0}while((u|0)<(w|0));x=w}else x=f;f=b+1156|0;u=c[f>>2]|0;if((u|0)>0){t=b+1160|0;s=b+2184|0;m=0;do{r=p+(c[t+(m<<2)>>2]<<2)|0;w=p+(c[s+(m<<2)>>2]<<2)|0;if(!((c[r>>2]|0)==0?!(c[w>>2]|0):0)){c[r>>2]=1;c[w>>2]=1}m=m+1|0}while((m|0)<(u|0))}if((c[b>>2]|0)>0){m=b+1092|0;s=i+52|0;t=b+4|0;w=x;x=0;while(1){if((w|0)>0){r=w;v=0;y=0;while(1){if((c[t+(y<<2)>>2]|0)==(x|0)){c[o+(v<<2)>>2]=(c[p+(y<<2)>>2]|0)!=0&1;c[n+(v<<2)>>2]=c[(c[a>>2]|0)+(y<<2)>>2];z=c[k>>2]|0;A=v+1|0}else{z=r;A=v}y=y+1|0;if((y|0)>=(z|0)){B=A;break}else{r=z;v=A}}}else B=0;v=c[m+(x<<2)>>2]|0;xa[c[(c[464+(c[h+1312+(v<<2)>>2]<<2)>>2]|0)+28>>2]&7](a,c[(c[s>>2]|0)+(v<<2)>>2]|0,n,o,B)|0;v=x+1|0;if((v|0)>=(c[b>>2]|0))break;w=c[k>>2]|0;x=v}C=c[f>>2]|0}else C=u;if((C|0)>0?(u=c[a>>2]|0,f=b+1160|0,x=b+2184|0,w=(j|0)/2|0,(j|0)>1):0){j=C;do{C=j;j=j+-1|0;B=c[u+(c[f+(j<<2)>>2]<<2)>>2]|0;o=c[u+(c[x+(j<<2)>>2]<<2)>>2]|0;n=0;do{s=B+(n<<2)|0;D=+g[s>>2];m=o+(n<<2)|0;E=+g[m>>2];A=E>0.0;if(D>0.0){if(A){F=D-E;G=m}else{g[m>>2]=D;F=E+D;G=s}g[G>>2]=F}else{if(A){H=m;I=E+D}else{g[m>>2]=D;H=s;I=D-E}g[H>>2]=I}n=n+1|0}while((n|0)<(w|0))}while((C|0)>1)}if((c[k>>2]|0)<=0){l=d;return 0}w=b+4|0;H=b+1028|0;b=i+48|0;G=0;do{j=c[H+(c[w+(G<<2)>>2]<<2)>>2]|0;qa[c[(c[456+(c[h+800+(j<<2)>>2]<<2)>>2]|0)+24>>2]&7](a,c[(c[b>>2]|0)+(j<<2)>>2]|0,c[q+(G<<2)>>2]|0,c[(c[a>>2]|0)+(G<<2)>>2]|0)|0;G=G+1|0;J=c[k>>2]|0}while((G|0)<(J|0));if((J|0)<=0){l=d;return 0}J=0;do{G=c[(c[a>>2]|0)+(J<<2)>>2]|0;Cb(c[c[i+12+(c[e>>2]<<2)>>2]>>2]|0,G,G);J=J+1|0}while((J|0)<(c[k>>2]|0));l=d;return 0}function Cb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0,B=0.0,C=0.0,D=0.0,E=0,F=0;e=c[a>>2]|0;f=e>>1;h=e>>2;e=b+(f<<2)|0;i=d+(f<<2)|0;j=i+(h<<2)|0;k=a+8|0;l=c[k>>2]|0;m=l+(h<<2)|0;n=m;o=e+-28|0;p=j;while(1){q=p;p=p+-16|0;r=o+8|0;s=n+12|0;t=n+8|0;g[p>>2]=-(+g[r>>2]*+g[s>>2])-+g[t>>2]*+g[o>>2];g[q+-12>>2]=+g[s>>2]*+g[o>>2]-+g[t>>2]*+g[r>>2];r=o+24|0;t=n+4|0;s=o+16|0;g[q+-8>>2]=-(+g[r>>2]*+g[t>>2])-+g[n>>2]*+g[s>>2];g[q+-4>>2]=+g[t>>2]*+g[s>>2]-+g[n>>2]*+g[r>>2];o=o+-32|0;if(o>>>0>>0)break;else n=n+16|0}n=m;m=e+-32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k+n;g[f>>2]=r+p;g[l>>2]=m*.9238795042037964-B*.3826834261417389;g[o>>2]=B*.9238795042037964+m*.3826834261417389;q=e+104|0;m=+g[q>>2];t=e+40|0;B=+g[t>>2];p=m-B;s=e+108|0;r=+g[s>>2];w=e+44|0;n=+g[w>>2];k=r-n;g[q>>2]=B+m;g[s>>2]=n+r;g[t>>2]=(p-k)*.7071067690849304;g[w>>2]=(k+p)*.7071067690849304;v=e+96|0;p=+g[v>>2];u=e+32|0;k=+g[u>>2];r=p-k;y=e+100|0;n=+g[y>>2];z=e+36|0;m=+g[z>>2];B=n-m;g[v>>2]=k+p;g[y>>2]=m+n;n=r*.3826834261417389-B*.9238795042037964;g[u>>2]=n;m=B*.3826834261417389+r*.9238795042037964;g[z>>2]=m;x=e+88|0;r=+g[x>>2];C=e+24|0;B=+g[C>>2];p=r-B;D=e+28|0;k=+g[D>>2];E=e+92|0;F=+g[E>>2];G=k-F;g[x>>2]=B+r;g[E>>2]=F+k;g[D>>2]=p;H=e+16|0;k=+g[H>>2];I=e+80|0;F=+g[I>>2];r=k-F;J=e+20|0;B=+g[J>>2];K=e+84|0;L=+g[K>>2];M=B-L;g[I>>2]=F+k;g[K>>2]=L+B;B=M*.9238795042037964+r*.3826834261417389;L=M*.3826834261417389-r*.9238795042037964;N=e+8|0;r=+g[N>>2];O=e+72|0;M=+g[O>>2];k=r-M;P=e+12|0;F=+g[P>>2];Q=e+76|0;S=+g[Q>>2];T=F-S;g[O>>2]=M+r;g[Q>>2]=S+F;F=(T+k)*.7071067690849304;S=(T-k)*.7071067690849304;k=+g[e>>2];U=e+64|0;T=+g[U>>2];r=k-T;V=e+4|0;M=+g[V>>2];W=e+68|0;X=+g[W>>2];Y=M-X;Z=T+k;g[U>>2]=Z;k=X+M;g[W>>2]=k;M=Y*.3826834261417389+r*.9238795042037964;X=Y*.9238795042037964-r*.3826834261417389;r=X-m;Y=M-n;T=M+n;n=X+m;m=Y+r;X=r-Y;Y=+g[w>>2];r=S-Y;M=+g[t>>2];_=M-F;$=M+F;F=Y+S;S=+g[l>>2];Y=S-B;M=+g[o>>2];aa=M-L;ba=S+B;B=M+L;L=Y-aa;M=aa+Y;Y=+g[b>>2];aa=Y-G;S=+g[i>>2];ca=S-p;da=Y+G;G=S+p;p=aa+r;S=aa-r;r=(L+m)*.7071067690849304;aa=(L-m)*.7071067690849304;g[C>>2]=r+p;g[H>>2]=p-r;r=(M-X)*.7071067690849304;p=ca-_;g[e>>2]=r+S;g[N>>2]=S-r;r=(M+X)*.7071067690849304;X=ca+_;g[P>>2]=p+aa;g[V>>2]=p-aa;g[D>>2]=X+r;g[J>>2]=X-r;r=da+$;X=da-$;$=ba+T;da=ba-T;g[b>>2]=r+$;g[l>>2]=r-$;$=B-n;r=G-F;g[u>>2]=X+$;g[t>>2]=X-$;$=B+n;n=G+F;g[w>>2]=r+da;g[z>>2]=r-da;g[i>>2]=n+$;g[o>>2]=n-$;$=+g[y>>2];n=k-$;da=+g[v>>2];r=Z-da;F=da+Z;Z=$+k;k=r+n;$=n-r;r=+g[Q>>2];n=+g[s>>2];da=r-n;G=+g[q>>2];B=+g[O>>2];X=G-B;T=B+G;G=n+r;r=+g[j>>2];n=+g[I>>2];B=r-n;ba=+g[f>>2];aa=+g[K>>2];p=ba-aa;_=n+r;r=aa+ba;ba=B-p;aa=p+B;B=+g[a>>2];p=+g[x>>2];n=B-p;ca=+g[h>>2];M=+g[E>>2];S=ca-M;m=p+B;B=M+ca;ca=n+da;M=n-da;da=(ba+k)*.7071067690849304;n=(ba-k)*.7071067690849304;g[x>>2]=da+ca;g[I>>2]=ca-da;da=(aa-$)*.7071067690849304;ca=S-X;g[U>>2]=da+M;g[O>>2]=M-da;da=(aa+$)*.7071067690849304;$=S+X;g[Q>>2]=ca+n;g[W>>2]=ca-n;g[E>>2]=$+da;g[K>>2]=$-da;da=m+T;$=m-T;T=_+F;m=_-F;g[a>>2]=da+T;g[j>>2]=da-T;T=r-Z;da=B-G;g[v>>2]=$+T;g[q>>2]=$-T;T=r+Z;Z=B+G;g[s>>2]=da+m;g[y>>2]=da-m;g[h>>2]=Z+T;g[f>>2]=Z-T;A=A+32|0}while((A|0)<(d|0));return}function Eb(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;i=(f|0)!=0;j=i?e:0;e=i?h:0;h=c[1500+(c[b+(j<<2)>>2]<<2)>>2]|0;i=c[1500+(c[b+(e<<2)>>2]<<2)>>2]|0;b=c[d+(f<<2)>>2]|0;f=c[d+(j<<2)>>2]|0;j=c[d+(e<<2)>>2]|0;e=(b|0)/4|0;d=(f|0)/4|0;k=e-d|0;l=(f|0)/2|0;f=((b|0)/2|0)+e+((j|0)/-4|0)|0;m=(j|0)/2|0;n=f+m|0;if((k|0)>0){id(a|0,0,e-d<<2|0)|0;o=k}else o=0;if((o|0)<(k+l|0)){k=l+e-o-d|0;d=o;o=0;while(1){e=a+(d<<2)|0;g[e>>2]=+g[e>>2]*+g[h+(o<<2)>>2];o=o+1|0;if((o|0)==(k|0))break;else d=d+1|0}}if((j|0)>1){j=f;d=m;while(1){d=d+-1|0;m=a+(j<<2)|0;g[m>>2]=+g[m>>2]*+g[i+(d<<2)>>2];m=j+1|0;if((m|0)>=(n|0)){p=m;break}else j=m}}else p=f;if((b|0)<=(p|0))return;id(a+(p<<2)|0,0,b-p<<2|0)|0;return}function Fb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0.0,B=0.0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0.0,M=0.0,N=0.0,O=0.0,P=0.0;e=l;f=c[a>>2]|0;h=f>>1;i=f>>2;j=f>>3;k=l;l=l+((1*(f<<2)|0)+15&-16)|0;m=k+(h<<2)|0;n=b+(h<<2)+(i<<2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-1|0)|0)|0;p=1-l|0;a:do switch(m|0){case 4:{q=i+n|0;r=f+(i<<2)+-4|0;s=f+(q<<2)+-4|0;t=f+(q+n<<2)+-4|0;if(!p){Ub(n,k,b,e,r,s,t);u=0;break a}else{Ub(n,k,e,b,r,s,t);u=p;break a}break}case 2:{t=f+(i<<2)+-4|0;if(!p){Vb(n,k,b,e,t);u=0;break a}else{Vb(n,k,e,b,t);u=p;break a}break}default:{t=f+(i<<2)+-4|0;if(!(((n|0)==1?l:p)|0)){Wb(n,m,k,o,b,b,b,e,e,t);u=1;break a}else{Wb(n,m,k,o,e,e,e,b,b,t);u=0;break a}}}while(0);j=j+1|0;if((j|0)==(a|0))break;else l=u}if((d|0)>0&(u|0)!=1)v=0;else return;do{c[b+(v<<2)>>2]=c[e+(v<<2)>>2];v=v+1|0}while((v|0)!=(d|0));return}function Hb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0;e=l;f=c[a>>2]|0;h=l;l=l+((1*(f<<2)|0)+15&-16)|0;i=a+24|0;Tb(f,c[i>>2]|0,b,d,140.0,-1);j=(f|0)>0;if(j){k=0;do{g[h+(k<<2)>>2]=+g[b+(k<<2)>>2]-+g[d+(k<<2)>>2];k=k+1|0}while((k|0)!=(f|0))}k=a+4|0;Tb(f,c[i>>2]|0,h,d,0.0,c[(c[k>>2]|0)+128>>2]|0);if(j)m=0;else{l=e;return}do{i=h+(m<<2)|0;g[i>>2]=+g[b+(m<<2)>>2]-+g[i>>2];m=m+1|0}while((m|0)!=(f|0));if(!j){l=e;return}j=c[k>>2]|0;k=0;do{m=d+(k<<2)|0;b=~~(+g[m>>2]+.5);g[m>>2]=+g[j+336+(((b|0)>0?((b|0)<39?b:39):0)<<2)>>2]+ +g[h+(k<<2)>>2];k=k+1|0}while((k|0)!=(f|0));l=e;return}function Ib(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=+e;f=+f;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0.0,q=0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0,K=0.0,L=0,M=0,N=0,O=0;h=l;i=c[a>>2]|0;j=a+40|0;k=c[j>>2]|0;m=l;l=l+((1*(k<<2)|0)+15&-16)|0;n=a+4|0;o=c[n>>2]|0;p=+g[o+4>>2]+f;if((k|0)>0){q=0;do{g[m+(q<<2)>>2]=-9999.0;q=q+1|0}while((q|0)!=(k|0))}f=+g[o+8>>2];r=p0;if(q){s=c[a+16>>2]|0;t=0;do{g[d+(t<<2)>>2]=+g[s+(t<<2)>>2]+r;t=t+1|0}while((t|0)!=(i|0));t=c[a+8>>2]|0;r=+g[o+496>>2]-e;if(q){q=c[a+20>>2]|0;o=a+32|0;s=a+36|0;u=a+28|0;v=0;while(1){w=c[q+(v<<2)>>2]|0;x=v;e=+g[b+(v<<2)>>2];a:while(1){y=x;while(1){z=y+1|0;if((z|0)>=(i|0)){A=0;break a}if((c[q+(z<<2)>>2]|0)!=(w|0)){A=1;break a}p=+g[b+(z<<2)>>2];if(p>e){x=z;e=p;continue a}else y=z}}if(e+6.0>+g[d+(y<<2)>>2]?(x=w>>c[o>>2],B=c[s>>2]|0,C=~~((r+e+-30.0)*.10000000149011612),D=(C|0)>0?C:0,C=c[(c[t+(((x|0)>0?((x|0)<16?x:16):0)<<2)>>2]|0)+(((D|0)<7?D:7)<<2)>>2]|0,D=C+8|0,x=~~+g[C+4>>2],p=+g[C>>2],C=~~p,(C|0)<(x|0)):0){E=C;C=~~((p+-16.0)*+(B|0)-+(B>>1|0)+ +((c[q+(y<<2)>>2]|0)-(c[u>>2]|0)|0));do{if((C|0)>0?(p=+g[D+(E<<2)>>2]+e,F=m+(C<<2)|0,+g[F>>2]>2]=p;C=C+B|0;E=E+1|0}while((E|0)<(x|0)&(C|0)<(k|0))}if(A)v=z;else{G=s;break}}}else H=7}else H=7;if((H|0)==7)G=a+36|0;H=c[G>>2]|0;Sb(m,H,k);k=c[a>>2]|0;b:do if((k|0)>1){G=c[a+20>>2]|0;s=c[G>>2]|0;z=c[a+28>>2]|0;v=(c[n>>2]|0)+32|0;A=s;u=1;y=0;q=s-(H>>1)-z|0;while(1){r=+g[m+(q<<2)>>2];s=((c[G+(u<<2)>>2]|0)+A>>1)-z|0;e=+g[v>>2];p=r>e?e:r;c:do if((q|0)<(s|0)){t=q;r=p;while(1){o=t+1|0;d:do if(r==-9999.0){I=+g[m+(o<<2)>>2];J=o}else{b=o;while(1){e=+g[m+(b<<2)>>2];if(e>-9999.0&e=(k|0)|(A|0)>(s|0))M=y;else{t=y;while(1){o=d+(t<<2)|0;if(+g[o>>2]>2]=K;o=t+1|0;if((o|0)>=(k|0)){M=o;break e}if((c[G+(o<<2)>>2]|0)>(s|0)){M=o;break}else t=o}}while(0);s=M+1|0;if((s|0)>=(k|0)){N=M;break b}A=c[G+(M<<2)>>2]|0;u=s;y=M;q=L}}else N=0;while(0);K=+g[m+((c[j>>2]|0)+-1<<2)>>2];if((N|0)<(k|0))O=N;else{l=h;return}do{N=d+(O<<2)|0;if(+g[N>>2]>2]=K;O=O+1|0}while((O|0)!=(k|0));l=h;return}function Jb(a,b,d,e,f,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;var j=0,k=0,l=0.0,m=0,n=0,o=0.0,p=0.0,q=0.0,r=0,s=0.0,t=0.0,u=0.0;j=c[a>>2]|0;k=c[a+4>>2]|0;l=+g[k+12+(e<<2)>>2];if((j|0)<=0)return;m=c[(c[a+12>>2]|0)+(e<<2)>>2]|0;n=k+108|0;o=+g[a+48>>2];p=o*.005;q=o*.0003;if((e|0)==1)r=0;else{e=0;do{o=+g[m+(e<<2)>>2]+ +g[b+(e<<2)>>2];s=+g[n>>2];t=o>s?s:o;o=+g[d+(e<<2)>>2]+l;g[f+(e<<2)>>2]=t>2]+ +g[b+(r<<2)>>2];o=+g[n>>2];s=t>o?o:t;t=+g[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ia*7.314285755157471+1023.5);N=(Ya|0)>1023?1023:(Ya|0)>0?Ya:0;Ya=R(Za,_a)|0;Xa=(($a|0)>-1?$a:0-$a|0)-((Ya|0)>-1?Ya:0-Ya|0)|0;Ya=Q-N|0;$a=R(Ya,Ya)|0;cb=+g[Ma>>2];if(cb+ +g[d+(bb<<2)>>2]>=ia){ia=+(Q|0);db=+(N|0);if(!(+g[Oa>>2]+ia>2]>db):0)Ea=36}else Ea=36;c:do if((Ea|0)==36){Ea=0;N=bb+1|0;if((N|0)<(M|0)){Ya=0;U=N;N=$a;Wa=1;S=Q;while(1){Va=Ya+Xa|0;L=(Va|0)<(_a|0);Ya=Va-(L?0:_a)|0;S=S+Za+(L?0:W)|0;db=+g[e+(U<<2)>>2];L=~~(db*7.314285755157471+1023.5);Va=(L|0)>1023?1023:(L|0)>0?L:0;L=S-Va|0;Ta=(R(L,L)|0)+N|0;L=Wa+1|0;if(Va|0?+g[d+(U<<2)>>2]+cb>=db:0){db=+(S|0);ia=+(Va|0);if(+g[Oa>>2]+db>2]>ia)break c}U=U+1|0;if((U|0)>=(M|0)){eb=Ta;fb=L;break}else{N=Ta;Wa=L}}}else{eb=$a;fb=1}ia=+g[Oa>>2];db=+(fb|0);gb=+g[Qa>>2];if((!(ia*ia/db>gb)?(ia=+g[Ia>>2],!(ia*ia/db>gb)):0)?+((eb|0)/(fb|0)|0|0)>gb:0)break;c[i+(Ka<<2)>>2]=-200;c[j+(Ka<<2)>>2]=-200;break b}while(0);c[q>>2]=-200;c[r>>2]=-200;c[s>>2]=-200;c[t>>2]=-200;$a=Rb(h+(Ja*56|0)|0,La-Ja|0,q,r,u)|0;M=Rb(h+(La*56|0)|0,D-La|0,s,t,u)|0;W=($a|0)!=0;if(W){c[q>>2]=Q;c[r>>2]=c[s>>2]}if((M|0)!=0?(c[s>>2]=c[r>>2],c[t>>2]=P,W):0){c[i+(Ka<<2)>>2]=-200;c[j+(Ka<<2)>>2]=-200}else Ea=49;d:do if((Ea|0)==49){Ea=0;W=c[q>>2]|0;c[T>>2]=W;if(!Na)c[i>>2]=W;W=c[r>>2]|0;c[i+(Ka<<2)>>2]=W;M=c[s>>2]|0;c[j+(Ka<<2)>>2]=M;$a=c[t>>2]|0;c[ab>>2]=$a;if((Ha|0)==1)c[p>>2]=$a;if((M&W|0)>-1){e:do if((La|0)>0){W=La;do{M=W;W=W+-1|0;$a=m+(W<<2)|0;if((c[$a>>2]|0)!=(Ha|0))break e;c[$a>>2]=Ka}while((M|0)>1)}while(0);W=La+1|0;if((W|0)<(w|0)){M=W;do{W=k+(M<<2)|0;if((c[W>>2]|0)!=(Na|0))break d;c[W>>2]=Ka;M=M+1|0}while((M|0)<(w|0))}}}while(0)}while(0);Ka=Ka+1|0;if((Ka|0)>=(w|0)){Ea=63;break}}if((Ea|0)==32)na(1);else if((Ea|0)==63){hb=c[i>>2]|0;ib=c[j>>2]|0;jb=c[Fa>>2]|0;kb=c[p>>2]|0;break}}else{hb=Da;ib=Da;jb=o;kb=o}while(0);o=Ua(a,w<<2)|0;c[o>>2]=(hb|0)<0?ib:(ib|0)<0?hb:ib+hb>>1;c[o+4>>2]=(jb|0)<0?kb:(kb|0)<0?jb:kb+jb>>1;if(Ga){Ga=2;do{jb=Ga+-2|0;kb=c[b+1032+(jb<<2)>>2]|0;hb=c[b+780+(jb<<2)>>2]|0;jb=c[u+836+(kb<<2)>>2]|0;ib=c[o+(kb<<2)>>2]&32767;kb=(c[o+(hb<<2)>>2]&32767)-ib|0;a=(R((kb|0)>-1?kb:0-kb|0,(c[u+836+(Ga<<2)>>2]|0)-jb|0)|0)/((c[u+836+(hb<<2)>>2]|0)-jb|0)|0;jb=((kb|0)<0?0-a|0:a)+ib|0;ib=c[i+(Ga<<2)>>2]|0;a=c[j+(Ga<<2)>>2]|0;kb=(ib|0)<0?a:(a|0)<0?ib:a+ib>>1;c[o+(Ga<<2)>>2]=(kb|0)<0|(jb|0)==(kb|0)?jb|32768:kb;Ga=Ga+1|0}while((Ga|0)!=(w|0))}z=o;l=f;return z|0}function Lb(a){a=a|0;return (c[(c[(c[a+64>>2]|0)+104>>2]|0)+80>>2]|0)!=0|0}function Mb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=c[b+1284>>2]|0;if(!((d|0)!=0&(e|0)!=0)){h=0;return h|0}b=Ua(a,g<<2)|0;if((g|0)<=0){h=b;return h|0}a=65536-f|0;i=0;do{j=d+(i<<2)|0;k=R(c[j>>2]&32767,a)|0;l=e+(i<<2)|0;m=k+32768+(R(c[l>>2]&32767,f)|0)>>16;k=b+(i<<2)|0;c[k>>2]=m;if(c[j>>2]&32768|0?c[l>>2]&32768|0:0)c[k>>2]=m|32768;i=i+1|0}while((i|0)!=(g|0));h=b;return h|0}function Nb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;g=l;l=l+336|0;h=g+64|0;i=g+32|0;j=g;k=c[d+1296>>2]|0;m=d+1284|0;n=c[m>>2]|0;o=c[(c[(c[b+64>>2]|0)+4>>2]|0)+28>>2]|0;p=c[o+2848>>2]|0;if(!e){Ga(a,0,1);id(f|0,0,((c[b+36>>2]|0)/2|0)<<2|0)|0;q=0;l=g;return q|0}a:do if((n|0)>0){r=k+832|0;s=0;while(1){t=e+(s<<2)|0;u=c[t>>2]|0;v=u&32767;switch(c[r>>2]|0){case 1:{w=v>>>2;break}case 2:{w=v>>>3;break}case 3:{w=(v>>>0)/12|0;break}case 4:{w=v>>>4;break}default:w=v}c[t>>2]=u&32768|w;s=s+1|0;if((s|0)==(n|0))break a}}while(0);c[h>>2]=c[e>>2];w=h+4|0;c[w>>2]=c[e+4>>2];s=d+1292|0;if((n|0)>2){r=2;do{u=r+-2|0;t=c[d+1032+(u<<2)>>2]|0;v=c[d+780+(u<<2)>>2]|0;u=c[k+836+(t<<2)>>2]|0;x=e+(t<<2)|0;t=e+(v<<2)|0;y=c[x>>2]&32767;z=(c[t>>2]&32767)-y|0;A=(R((z|0)>-1?z:0-z|0,(c[k+836+(r<<2)>>2]|0)-u|0)|0)/((c[k+836+(v<<2)>>2]|0)-u|0)|0;u=((z|0)<0?0-A|0:A)+y|0;A=e+(r<<2)|0;z=c[A>>2]|0;if((z&32768|0)!=0|(z|0)==(u|0)){c[A>>2]=u|32768;c[h+(r<<2)>>2]=0}else{A=(c[s>>2]|0)-u|0;v=(A|0)<(u|0)?A:u;A=z-u|0;do if((A|0)<0)if((A|0)<(0-v|0)){B=v+~A|0;break}else{B=~(A<<1);break}else if((v|0)>(A|0)){B=A<<1;break}else{B=v+A|0;break}while(0);c[h+(r<<2)>>2]=B;c[x>>2]=y;c[t>>2]=c[t>>2]&32767}r=r+1|0}while((r|0)!=(n|0))}Ga(a,1,1);n=d+1308|0;c[n>>2]=(c[n>>2]|0)+1;n=(c[s>>2]|0)+-1|0;r=(n|0)==0;if(!r){B=0;A=n;do{B=B+1|0;A=A>>>1}while((A|0)!=0);A=d+1304|0;c[A>>2]=(c[A>>2]|0)+(B<<1);B=c[h>>2]|0;if(r){C=B;D=A;E=0}else{r=0;v=n;while(1){n=r+1|0;v=v>>>1;if(!v){C=B;D=A;E=n;break}else r=n}}}else{C=c[h>>2]|0;D=d+1304|0;E=0}Ga(a,C,E);E=c[w>>2]|0;w=(c[s>>2]|0)+-1|0;if(!w)F=0;else{s=0;C=w;while(1){w=s+1|0;C=C>>>1;if(!C){F=w;break}else s=w}}Ga(a,E,F);if((c[k>>2]|0)>0){F=d+1300|0;E=0;s=2;while(1){C=c[k+4+(E<<2)>>2]|0;w=c[k+128+(C<<2)>>2]|0;r=c[k+192+(C<<2)>>2]|0;A=1<>2]=0;c[i+4>>2]=0;c[i+8>>2]=0;c[i+12>>2]=0;c[i+16>>2]=0;c[i+20>>2]=0;c[i+24>>2]=0;c[i+28>>2]=0;if(r|0){B=(r|0)==31;if(!B){v=0;do{n=c[k+320+(C<<5)+(v<<2)>>2]|0;if((n|0)<0)G=1;else G=c[(c[o+1824+(n<<2)>>2]|0)+4>>2]|0;c[j+(v<<2)>>2]=G;v=v+1|0}while((v|0)<(A|0))}b:do if((w|0)>0){if(B){v=0;t=0;y=0;while(1){x=c[i+(y<<2)>>2]<>2]|0;v=0;while(1){if((t|0)<(c[j+(v<<2)>>2]|0)){L=38;break}y=v+1|0;if((y|0)<(A|0))v=y;else{L=39;break}}if((L|0)==38){L=0;c[i+(K<<2)>>2]=v;M=v}else if((L|0)==39){L=0;M=c[i+(K<<2)>>2]|0}t=M<>2]|0)*56|0)|0,H,a)|0;c[F>>2]=(c[F>>2]|0)+r}if((w|0)>0){r=0;do{A=c[k+320+(C<<5)+(c[i+(r<<2)>>2]<<2)>>2]|0;if((A|0)>-1?(B=c[h+(r+s<<2)>>2]|0,(B|0)<(c[p+(A*56|0)+4>>2]|0)):0){t=sb(p+(A*56|0)|0,B,a)|0;c[D>>2]=(c[D>>2]|0)+t}r=r+1|0}while((r|0)!=(w|0))}E=E+1|0;if((E|0)>=(c[k>>2]|0))break;else s=w+s|0}}s=k+832|0;E=R(c[s>>2]|0,c[e>>2]|0)|0;D=(c[o+(c[b+28>>2]<<2)>>2]|0)/2|0;o=c[m>>2]|0;if((o|0)>1){a=o;o=0;p=1;h=0;i=E;while(1){F=c[d+260+(p<<2)>>2]|0;H=c[e+(F<<2)>>2]|0;if((H&32767|0)==(H|0)){J=R(c[s>>2]|0,H)|0;H=c[k+836+(F<<2)>>2]|0;F=J-i|0;I=H-h|0;K=(F|0)/(I|0)|0;M=F>>31|1;j=R(K,I)|0;G=((F|0)>-1?F:0-F|0)-((j|0)>-1?j:0-j|0)|0;j=(D|0)>(H|0)?H:D;if((j|0)>(h|0)){N=0;O=h;P=i;L=56}else{Q=0;S=h;T=i}while(1){if((L|0)==56){L=0;c[f+(O<<2)>>2]=P;Q=N;S=O;T=P}F=S+1|0;if((F|0)>=(j|0))break;r=Q+G|0;C=(r|0)<(I|0);N=r-(C?0:I)|0;O=F;P=T+K+(C?0:M)|0;L=56}U=c[m>>2]|0;V=H;W=H;X=J}else{U=a;V=o;W=h;X=i}p=p+1|0;if((p|0)>=(U|0)){Y=V;Z=X;break}else{a=U;o=V;h=W;i=X}}}else{Y=0;Z=E}E=b+36|0;if((Y|0)<((c[E>>2]|0)/2|0|0))_=Y;else{q=1;l=g;return q|0}do{c[f+(_<<2)>>2]=Z;_=_+1|0}while((_|0)<((c[E>>2]|0)/2|0|0));q=1;l=g;return q|0}function Ob(a,b,d,e,f,i,j,k,m){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;i=i|0;j=j|0;k=k|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0.0,t=0,u=0,v=0,w=0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0.0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0.0,ka=0.0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0;n=l;o=c[d>>2]|0;p=d+4|0;d=c[p>>2]|0;if(!(c[d+500>>2]|0))q=16;else q=c[d+508>>2]|0;r=c[b+132+((c[d>>2]|0)*60|0)+(a<<2)>>2]|0;s=+h[8+(c[b+252+(a<<2)>>2]<<3)>>3];d=m<<2;t=l;l=l+((1*d|0)+15&-16)|0;u=l;l=l+((1*d|0)+15&-16)|0;v=l;l=l+((1*d|0)+15&-16)|0;w=l;l=l+((1*d|0)+15&-16)|0;x=l;l=l+((1*d|0)+15&-16)|0;y=e+1156|0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>>2]=+E(+ja)}else{ka=+E(+Q)+ +E(+O);g[$+(fa<<2)>>2]=ka;g[ha>>2]=ja<0.0?-ka:ka}g[aa+(fa<<2)>>2]=0.0;g[W>>2]=0.0;c[ia>>2]=1;c[Y+(fa<<2)>>2]=0;break}g[ha>>2]=+E(+Q)+ +E(+O);ha=$+(fa<<2)|0;g[ha>>2]=+g[aa+(fa<<2)>>2]+ +g[ha>>2];c[ia>>2]=1;c[P>>2]=1;P=X+(fa<<2)|0;ia=c[P>>2]|0;ha=Y+(fa<<2)|0;W=c[ha>>2]|0;if((((ia|0)>-1?ia:0-ia|0)|0)>(((W|0)>-1?W:0-W|0)|0)){la=(ia|0)>0?ia-W|0:W-ia|0;ma=ha}else{c[ha>>2]=(W|0)>0?ia-W|0:W-ia|0;la=W;ma=P}c[ma>>2]=la;W=c[ha>>2]|0;ia=c[P>>2]|0;if((W|0)>=(((ia|0)>-1?ia:0-ia|0)<<1|0)){c[ha>>2]=0-W;c[P>>2]=0-(c[P>>2]|0)}}while(0);P=ba+(fa<<2)|0;W=ca+(fa<<2)|0;O=+g[W>>2]+ +g[P>>2];g[W>>2]=O;g[P>>2]=O;fa=fa+1|0}while((fa|0)<(F|0))}+Pb(c[p>>2]|0,r,Z,$,ba,da,A,F,X);ga=c[y>>2]|0}S=S+1|0;if((S|0)>=(ga|0)){na=ga;break}else M=ga}}else na=H;A=A+q|0}while((o|0)>(A|0));oa=na}else oa=C;if((oa|0)>0){pa=oa;qa=0}else{l=n;return}while(1){oa=j+(c[e+1160+(qa<<2)>>2]<<2)|0;C=e+2184+(qa<<2)|0;if((c[oa>>2]|0)==0?(c[j+(c[C>>2]<<2)>>2]|0)==0:0)ra=pa;else{c[oa>>2]=1;c[j+(c[C>>2]<<2)>>2]=1;ra=c[y>>2]|0}qa=qa+1|0;if((qa|0)>=(ra|0))break;else pa=ra}l=n;return}function Pb(a,b,d,e,f,i,k,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;i=i|0;k=k|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0.0,u=0,v=0,w=0.0,x=0.0,y=0.0,z=0.0,A=0,B=0.0,C=0.0,D=0,E=0.0,G=0,H=0.0,I=0.0,J=0;o=l;p=l;l=l+((1*(m<<2)|0)+15&-16)|0;if(!(c[a+500>>2]|0))q=m;else q=(c[a+504>>2]|0)-k|0;r=(q|0)>(m|0)?m:q;a:do if((r|0)>0){if(!i){q=0;while(1){s=+g[d+(q<<2)>>2]<0.0;t=+Zc(+F(+(+g[e+(q<<2)>>2]/+g[f+(q<<2)>>2])));c[n+(q<<2)>>2]=~~(s?-t:t);q=q+1|0;if((q|0)>=(r|0)){u=r;break a}}}else v=0;do{if(!(c[i+(v<<2)>>2]|0)){q=+g[d+(v<<2)>>2]<0.0;t=+Zc(+F(+(+g[e+(v<<2)>>2]/+g[f+(v<<2)>>2])));c[n+(v<<2)>>2]=~~(q?-t:t)}v=v+1|0}while((v|0)<(r|0));u=r}else u=0;while(0);if((u|0)>=(m|0)){w=0.0;l=o;return +w}r=b-k|0;if(!i){t=0.0;k=0;b=u;while(1){v=e+(b<<2)|0;x=+g[f+(b<<2)>>2];y=+g[v>>2]/x;if(y<.25){c[p+(k<<2)>>2]=v;z=y+t;A=k+1|0}else{q=+g[d+(b<<2)>>2]<0.0;B=+Zc(+F(+y));s=~~(q?-B:B);c[n+(b<<2)>>2]=s;g[v>>2]=+(R(s,s)|0)*x;z=t;A=k}b=b+1|0;if((b|0)==(m|0)){C=z;D=A;break}else{t=z;k=A}}}else{z=0.0;A=0;k=u;while(1){do if(!(c[i+(k<<2)>>2]|0)){u=e+(k<<2)|0;t=+g[f+(k<<2)>>2];x=+g[u>>2]/t;if(!(x<.25)|(k|0)<(r|0)){b=+g[d+(k<<2)>>2]<0.0;B=+Zc(+F(+x));s=~~(b?-B:B);c[n+(k<<2)>>2]=s;g[u>>2]=+(R(s,s)|0)*t;E=z;G=A;break}else{c[p+(A<<2)>>2]=u;E=x+z;G=A+1|0;break}}else{E=z;G=A}while(0);k=k+1|0;if((k|0)==(m|0)){C=E;D=G;break}else{z=E;A=G}}}if(!D){w=C;l=o;return +w}Pc(p,D,4,12);if((D|0)<=0){w=C;l=o;return +w}G=e;E=+h[a+512>>3];z=C;a=0;while(1){e=c[p+(a<<2)>>2]|0;A=e-G>>2;if(!(z>=E)){H=0.0;I=z;J=0}else{H=+g[f+(A<<2)>>2];I=z+-1.0;J=~~(c[j>>2]=c[d+(A<<2)>>2]&-2147483648|1065353216,+g[j>>2])}c[n+(A<<2)>>2]=J;g[e>>2]=H;a=a+1|0;if((a|0)==(D|0)){w=I;break}else z=I}l=o;return +w}function Qb(a,b){a=a|0;b=b|0;var d=0.0,e=0.0;d=+g[c[a>>2]>>2];e=+g[c[b>>2]>>2];return (de&1)|0}function Rb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0.0,k=0.0,l=0.0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0.0,L=0.0,M=0,N=0,O=0,P=0,Q=0,S=0,T=0;h=c[a>>2]|0;i=c[a+((b+-1|0)*56|0)+4>>2]|0;if((b|0)>0){j=+g[f+1108>>2];k=0.0;f=0;l=0.0;m=0.0;n=0.0;o=0.0;while(1){p=c[a+(f*56|0)+52>>2]|0;q=c[a+(f*56|0)+28>>2]|0;r=+(q+p|0)*j/+(q+1|0)+1.0;s=+(c[a+(f*56|0)+32>>2]|0)+m+r*+(c[a+(f*56|0)+8>>2]|0);t=+(c[a+(f*56|0)+36>>2]|0)+o+ +(c[a+(f*56|0)+12>>2]|0)*r;u=+(c[a+(f*56|0)+40>>2]|0)+l+ +(c[a+(f*56|0)+16>>2]|0)*r;v=+(c[a+(f*56|0)+48>>2]|0)+n+ +(c[a+(f*56|0)+24>>2]|0)*r;w=+(p|0)+k+r*+(q|0);f=f+1|0;if((f|0)==(b|0)){x=w;y=u;z=s;A=v;B=t;break}else{k=w;l=u;m=s;n=v;o=t}}}else{x=0.0;y=0.0;z=0.0;A=0.0;B=0.0}b=c[d>>2]|0;if((b|0)>-1){C=x+1.0;D=y+ +(R(h,h)|0);E=z+ +(h|0);F=+(R(b,h)|0)+A;G=+(b|0)+B}else{C=x;D=y;E=z;F=A;G=B}b=c[e>>2]|0;if((b|0)>-1){H=C+1.0;I=D+ +(R(i,i)|0);J=E+ +(i|0);K=+(R(b,i)|0)+F;L=+(b|0)+G}else{H=C;I=D;J=E;K=F;L=G}G=I*H-J*J;if(G>0.0){F=(L*I-J*K)/G;I=(K*H-J*L)/G;c[d>>2]=~~+Zc(I*+(h|0)+F);h=~~+Zc(I*+(i|0)+F);c[e>>2]=h;i=c[d>>2]|0;if((i|0)>1023){c[d>>2]=1023;M=c[e>>2]|0;N=1023}else{M=h;N=i}if((M|0)>1023){c[e>>2]=1023;O=c[d>>2]|0;P=1023}else{O=N;P=M}if((O|0)<0){c[d>>2]=0;Q=c[e>>2]|0}else Q=P;if((Q|0)<0)S=0;else{T=0;return T|0}}else{c[d>>2]=0;S=1}c[e>>2]=0;T=S;return T|0}function Sb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,m=0,n=0.0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0;e=l;f=d<<2;h=l;l=l+((1*f|0)+15&-16)|0;i=l;l=l+((1*f|0)+15&-16)|0;if((d|0)>0){j=0;k=0}else{l=e;return}do{if((k|0)<2){c[h+(k<<2)>>2]=j;c[i+(k<<2)>>2]=c[a+(j<<2)>>2];m=k}else{n=+g[a+(j<<2)>>2];f=k;while(1){o=f+-1|0;p=+g[i+(o<<2)>>2];if(n1?(j|0)<((c[h+(o<<2)>>2]|0)+b|0):0))break;q=f+-2|0;if(!(p<=+g[i+(q<<2)>>2]))break;if((j|0)<((c[h+(q<<2)>>2]|0)+b|0))f=o;else break}c[h+(f<<2)>>2]=j;g[i+(f<<2)>>2]=n;m=f}k=m+1|0;j=j+1|0}while((j|0)!=(d|0));if((m|0)<=-1){l=e;return}j=b+1|0;b=0;o=0;while(1){if((b|0)<(m|0)?(q=b+1|0,+g[i+(q<<2)>>2]>+g[i+(b<<2)>>2]):0)r=c[h+(q<<2)>>2]|0;else r=j+(c[h+(b<<2)>>2]|0)|0;q=(r|0)>(d|0)?d:r;if((o|0)<(q|0)){s=c[i+(b<<2)>>2]|0;t=o;do{c[a+(t<<2)>>2]=s;t=t+1|0}while((t|0)<(q|0));u=q}else u=o;b=b+1|0;if((b|0)==(k|0))break;else o=u}l=e;return}function Tb(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0.0,r=0.0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0,A=0.0,B=0.0,C=0.0,D=0,E=0.0,F=0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0,M=0.0,N=0.0,O=0.0,P=0.0,Q=0,R=0.0,S=0.0,T=0.0,U=0.0,V=0,W=0.0,X=0,Y=0.0;i=l;j=a<<2;k=l;l=l+((1*j|0)+15&-16)|0;m=l;l=l+((1*j|0)+15&-16)|0;n=l;l=l+((1*j|0)+15&-16)|0;o=l;l=l+((1*j|0)+15&-16)|0;p=l;l=l+((1*j|0)+15&-16)|0;q=+g[d>>2]+f;r=q<1.0?1.0:q;q=r*r*.5;s=q*r;g[k>>2]=q;g[m>>2]=q;g[n>>2]=0.0;g[o>>2]=s;g[p>>2]=0.0;if((a|0)>1){j=1;r=q;t=q;q=0.0;u=0.0;v=s;s=1.0;while(1){w=+g[d+(j<<2)>>2]+f;x=w<1.0?1.0:w;w=x*x;r=w+r;y=w*s;t=y+t;q=y*s+q;v=w*x+v;u=y*x+u;g[k+(j<<2)>>2]=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else E=E+1.0}}if((h|0)<1){l=i;return}D=h>>>1;L=D-h|0;if((L|0)>-1){N=I;O=J;P=K;Q=0;R=0.0}else{j=h-D|0;F=D;G=0;b=L;K=0.0;while(1){L=0-b|0;J=+g[k+(L<<2)>>2]+ +g[k+(F<<2)>>2];I=+g[m+(F<<2)>>2]-+g[m+(L<<2)>>2];E=+g[n+(L<<2)>>2]+ +g[n+(F<<2)>>2];M=+g[o+(L<<2)>>2]+ +g[o+(F<<2)>>2];C=+g[p+(F<<2)>>2]-+g[p+(L<<2)>>2];B=M*E-C*I;A=C*J-M*I;M=E*J-I*I;I=(A*K+B)/M-f;L=e+(G<<2)|0;if(I<+g[L>>2])g[L>>2]=I;G=G+1|0;I=K+1.0;L=G+D|0;if((G|0)==(j|0)){N=B;O=A;P=M;Q=j;R=I;break}else{F=L;b=L-h|0;K=I}}}b=Q+D|0;if((b|0)<(a|0)){F=a-D|0;j=b;b=Q;K=R;while(1){G=j-h|0;I=+g[k+(j<<2)>>2]-+g[k+(G<<2)>>2];M=+g[m+(j<<2)>>2]-+g[m+(G<<2)>>2];A=+g[n+(j<<2)>>2]-+g[n+(G<<2)>>2];B=+g[o+(j<<2)>>2]-+g[o+(G<<2)>>2];J=+g[p+(j<<2)>>2]-+g[p+(G<<2)>>2];E=B*A-J*M;C=J*I-B*M;B=A*I-M*M;M=(C*K+E)/B-f;G=e+(b<<2)|0;if(M<+g[G>>2])g[G>>2]=M;G=b+1|0;M=K+1.0;if((G|0)==(F|0)){S=E;T=C;U=B;V=F;W=M;break}else{j=G+D|0;b=G;K=M}}}else{S=N;T=O;U=P;V=Q;W=R}if((V|0)<(a|0)){X=V;Y=W}else{l=i;return}while(1){W=(Y*T+S)/U-f;V=e+(X<<2)|0;if(W<+g[V>>2])g[V>>2]=W;X=X+1|0;if((X|0)==(a|0))break;else Y=Y+1.0}l=i;return}function Ub(a,b,c,d,e,f,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;h=h|0;var i=0,j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D;g[d+(z+-3<<2)>>2]=B-H;g[d+(s<<2)>>2]=x-A;z=l+r|0;g[d+(z+-1<<2)>>2]=H+B;g[d+(z<<2)>>2]=x+A;z=s+r|0;g[d+(z+-1<<2)>>2]=I-u;g[d+(z<<2)>>2]=C-D;n=n+2|0}while((n|0)<(a|0));q=q+1|0;if((q|0)==(b|0))break;else p=p+a|0}}if(a&1|0)return}p=a+-1+i|0;q=a<<2;r=a<<1;if(!k)return;k=0;h=p;f=p+j|0;j=a;p=a;while(1){D=+g[c+(h<<2)>>2];C=+g[c+(f<<2)>>2];u=(C+D)*-.7071067690849304;I=(D-C)*.7071067690849304;e=c+(p+-1<<2)|0;g[d+(j+-1<<2)>>2]=I+ +g[e>>2];n=j+r|0;g[d+(n+-1<<2)>>2]=+g[e>>2]-I;e=c+(h+i<<2)|0;g[d+(j<<2)>>2]=u-+g[e>>2];g[d+(n<<2)>>2]=+g[e>>2]+u;k=k+1|0;if((k|0)==(b|0))break;else{h=h+a|0;f=f+a|0;j=j+q|0;p=p+a|0}}return}function Vb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0,B=0.0;h=R(b,a)|0;i=a<<1;j=(b|0)>0;if(j){k=i+-1|0;l=0;m=0;n=h;while(1){o=d+(m<<2)|0;p=d+(n<<2)|0;q=m<<1;g[e+(q<<2)>>2]=+g[p>>2]+ +g[o>>2];g[e+(k+q<<2)>>2]=+g[o>>2]-+g[p>>2];l=l+1|0;if((l|0)==(b|0))break;else{m=m+a|0;n=n+a|0}}}if((a|0)<2)return;if((a|0)!=2){if(j){n=0;m=0;l=h;while(1){k=m<<1;p=2;o=l;q=k+i|0;r=m;s=k;do{k=o;o=o+2|0;t=q;q=q+-2|0;u=r;r=r+2|0;v=s;s=s+2|0;w=+g[f+(p+-2<<2)>>2];x=+g[d+(k+1<<2)>>2];y=+g[f+(p+-1<<2)>>2];z=+g[d+(o<<2)>>2];A=z*y+x*w;B=z*w-y*x;k=d+(r<<2)|0;g[e+(s<<2)>>2]=B+ +g[k>>2];g[e+(q<<2)>>2]=B-+g[k>>2];k=d+(u+1<<2)|0;g[e+((v|1)<<2)>>2]=+g[k>>2]+A;g[e+(t+-3<<2)>>2]=+g[k>>2]-A;p=p+2|0}while((p|0)<(a|0));n=n+1|0;if((n|0)==(b|0))break;else{m=m+a|0;l=l+a|0}}}if(((a|0)%2|0|0)==1)return}l=a+-1|0;if(!j)return;j=0;m=a;n=h+l|0;h=l;while(1){g[e+(m<<2)>>2]=-+g[d+(n<<2)>>2];c[e+(m+-1<<2)>>2]=c[d+(h<<2)>>2];j=j+1|0;if((j|0)==(b|0))break;else{m=m+i|0;n=n+a|0;h=h+a|0}}return}function Wb(a,b,d,e,f,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0.0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0.0,Q=0.0,S=0.0;m=6.2831854820251465/+(b|0);n=+H(+m);o=+I(+m);p=b+1>>1;q=a+-1>>1;r=R(d,a)|0;s=R(b,a)|0;t=(a|0)==1;do if(!t){if((e|0)>0){u=0;do{c[k+(u<<2)>>2]=c[i+(u<<2)>>2];u=u+1|0}while((u|0)!=(e|0))}u=(b|0)>1;if(u&(d|0)>0){v=1;w=0;do{w=w+r|0;x=0;y=w;while(1){c[j+(y<<2)>>2]=c[h+(y<<2)>>2];x=x+1|0;if((x|0)==(d|0))break;else y=y+a|0}v=v+1|0}while((v|0)!=(b|0))}v=0-a|0;if((q|0)>(d|0)){if(u){w=(d|0)>0;y=(a|0)>2;x=v;z=1;A=0;do{A=A+r|0;x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0}while((F|0)!=(d|0));w=w+2|0}while((w|0)<(a|0))}z=z+1|0}while((z|0)!=(p|0))}else{if(!x)break;z=(d|0)<1|(a|0)<3;u=1;v=0;A=y;do{v=v+r|0;A=A-r|0;if(!z){w=0;C=v;D=A;while(1){F=2;B=C;G=D;do{L=B;B=B+2|0;M=L+1|0;L=j+(M<<2)|0;E=G+1|0;G=G+2|0;N=j+(E<<2)|0;g[h+(M<<2)>>2]=+g[N>>2]+ +g[L>>2];M=j+(B<<2)|0;K=j+(G<<2)|0;g[h+(E<<2)>>2]=+g[M>>2]-+g[K>>2];g[h+(B<<2)>>2]=+g[K>>2]+ +g[M>>2];g[h+(G<<2)>>2]=+g[N>>2]-+g[L>>2];F=F+2|0}while((F|0)<(a|0));w=w+1|0;if((w|0)==(d|0))break;else{C=C+a|0;D=D+a|0}}}u=u+1|0}while((u|0)!=(p|0))}}while(0);l=(e|0)>0;if(l){u=0;do{c[i+(u<<2)>>2]=c[k+(u<<2)>>2];u=u+1|0}while((u|0)!=(e|0))}u=R(e,b)|0;A=(p|0)>1;do if(A){if((d|0)>0){v=1;z=0;y=u;do{z=z+r|0;y=y-r|0;x=0;D=z-a|0;C=y-a|0;do{D=D+a|0;C=C+a|0;w=j+(D<<2)|0;F=j+(C<<2)|0;g[h+(D<<2)>>2]=+g[F>>2]+ +g[w>>2];g[h+(C<<2)>>2]=+g[F>>2]-+g[w>>2];x=x+1|0}while((x|0)!=(d|0));v=v+1|0}while((v|0)!=(p|0));if(!A)break}v=R(b+-1|0,e)|0;y=(p|0)==2|l^1;m=0.0;O=1.0;z=1;x=0;C=u;do{x=x+e|0;C=C-e|0;P=O;O=O*n-m*o;m=P*o+m*n;if(l){D=0;w=x;F=C;G=v;B=e;while(1){g[k+(w<<2)>>2]=+g[i+(B<<2)>>2]*O+ +g[i+(D<<2)>>2];g[k+(F<<2)>>2]=+g[i+(G<<2)>>2]*m;D=D+1|0;if((D|0)==(e|0))break;else{w=w+1|0;F=F+1|0;G=G+1|0;B=B+1|0}}}if(!y){P=m;Q=O;B=2;G=e;F=v;do{G=G+e|0;F=F-e|0;S=Q;Q=Q*O-P*m;P=S*m+P*O;w=0;D=x;L=C;N=G;M=F;while(1){K=k+(D<<2)|0;g[K>>2]=+g[K>>2]+ +g[i+(N<<2)>>2]*Q;K=k+(L<<2)|0;g[K>>2]=+g[K>>2]+ +g[i+(M<<2)>>2]*P;w=w+1|0;if((w|0)==(e|0))break;else{D=D+1|0;L=L+1|0;N=N+1|0;M=M+1|0}}B=B+1|0}while((B|0)<(p|0))}z=z+1|0}while((z|0)!=(p|0));if(A&l){z=1;C=0;do{C=C+e|0;x=0;v=C;while(1){y=k+(x<<2)|0;g[y>>2]=+g[y>>2]+ +g[i+(v<<2)>>2];x=x+1|0;if((x|0)==(e|0))break;else v=v+1|0}z=z+1|0}while((z|0)!=(p|0))}}while(0);if((a|0)<(d|0)){if((a|0)>0&(d|0)>0){e=0;do{i=0;k=e;l=e;while(1){c[f+(l<<2)>>2]=c[j+(k<<2)>>2];i=i+1|0;if((i|0)==(d|0))break;else{k=k+a|0;l=l+s|0}}e=e+1|0}while((e|0)!=(a|0))}}else if((d|0)>0&(a|0)>0){e=0;l=0;k=0;while(1){i=0;u=l;h=k;while(1){c[f+(h<<2)>>2]=c[j+(u<<2)>>2];i=i+1|0;if((i|0)==(a|0))break;else{u=u+1|0;h=h+1|0}}e=e+1|0;if((e|0)==(d|0))break;else{l=l+a|0;k=k+s|0}}}k=a<<1;l=R(r,b)|0;if(A&(d|0)>0){b=1;e=0;h=0;u=l;do{e=e+k|0;h=h+r|0;u=u-r|0;i=0;z=e;C=h;v=u;while(1){c[f+(z+-1<<2)>>2]=c[j+(C<<2)>>2];c[f+(z<<2)>>2]=c[j+(v<<2)>>2];i=i+1|0;if((i|0)==(d|0))break;else{z=z+s|0;C=C+a|0;v=v+a|0}}b=b+1|0}while((b|0)!=(p|0))}if(t)return;t=0-a|0;if((q|0)>=(d|0)){if(!A)return;q=(d|0)<1|(a|0)<3;b=1;u=t;h=0;e=0;v=l;do{u=u+k|0;h=h+k|0;e=e+r|0;v=v-r|0;if(!q){C=0;z=u;i=h;x=e;y=v;while(1){B=2;do{F=B+x|0;G=j+(F+-1<<2)|0;M=B+y|0;N=j+(M+-1<<2)|0;L=B+i|0;g[f+(L+-1<<2)>>2]=+g[N>>2]+ +g[G>>2];D=a-B+z|0;g[f+(D+-1<<2)>>2]=+g[G>>2]-+g[N>>2];N=j+(F<<2)|0;F=j+(M<<2)|0;g[f+(L<<2)>>2]=+g[F>>2]+ +g[N>>2];g[f+(D<<2)>>2]=+g[F>>2]-+g[N>>2];B=B+2|0}while((B|0)<(a|0));C=C+1|0;if((C|0)==(d|0))break;else{z=z+s|0;i=i+s|0;x=x+a|0;y=y+a|0}}}b=b+1|0}while((b|0)!=(p|0));return}if(!A)return;A=(a|0)>2;b=(d|0)>0;v=1;e=t;t=0;h=0;u=l;do{e=e+k|0;t=t+k|0;h=h+r|0;u=u-r|0;if(A?(l=e+a|0,b):0){q=2;do{y=0;x=l-q|0;i=q+t|0;z=q+h|0;C=q+u|0;while(1){B=j+(z+-1<<2)|0;N=j+(C+-1<<2)|0;g[f+(i+-1<<2)>>2]=+g[N>>2]+ +g[B>>2];g[f+(x+-1<<2)>>2]=+g[B>>2]-+g[N>>2];N=j+(z<<2)|0;B=j+(C<<2)|0;g[f+(i<<2)>>2]=+g[B>>2]+ +g[N>>2];g[f+(x<<2)>>2]=+g[B>>2]-+g[N>>2];y=y+1|0;if((y|0)==(d|0))break;else{x=x+s|0;i=i+s|0;z=z+a|0;C=C+a|0}}q=q+2|0}while((q|0)<(a|0))}v=v+1|0}while((v|0)!=(p|0));return}function Xb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,h=0,i=0.0,j=0,k=0.0,l=0,m=0.0,n=0.0,o=0,p=0.0,q=0,r=0,s=0;d=(b|0)/4|0;e=$c(d<<2)|0;f=$c(d+b<<2)|0;h=b>>1;i=+(b|0);j=~~+Zc(+P(+i)*1.4426950408889634);c[a+4>>2]=j;c[a>>2]=b;c[a+8>>2]=f;c[a+12>>2]=e;if((b|0)<=3){k=4.0/i;l=a+16|0;g[l>>2]=k;return}m=3.141592653589793/+(b|0);n=3.141592653589793/+(b<<1|0);o=0;do{p=+(o<<2|0)*m;q=o<<1;g[f+(q<<2)>>2]=+H(+p);r=q|1;g[f+(r<<2)>>2]=-+I(+p);p=+(r|0)*n;r=q+h|0;g[f+(r<<2)>>2]=+H(+p);g[f+(r+1<<2)>>2]=+I(+p);o=o+1|0}while((o|0)<(d|0));d=(b|0)/8|0;o=(b|0)>7;if(!o){k=4.0/i;l=a+16|0;g[l>>2]=k;return}n=3.141592653589793/+(b|0);h=0;do{m=+(h<<2|2|0)*n;r=(h<<1)+b|0;g[f+(r<<2)>>2]=+H(+m)*.5;g[f+(r+1<<2)>>2]=+I(+m)*-.5;h=h+1|0}while((h|0)<(d|0));h=(1<>2]=k;return}do{o=0;j=0;b=f;do{o=((b&s|0)==0?0:1<>j}while((b|0)!=0);b=s<<1;c[e+(b<<2)>>2]=(h&~o)+-1;c[e+((b|1)<<2)>>2]=o;s=s+1|0}while((s|0)<(d|0));k=4.0/i;l=a+16|0;g[l>>2]=k;return}function Yb(a){a=a|0;var b=0;if(!a)return;b=c[a+8>>2]|0;if(b|0)ad(b);b=c[a+12>>2]|0;if(b|0)ad(b);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;return}function Zb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,J=0.0,K=0.0,L=0.0;c[a>>2]=b;d=bd(b*3|0,4)|0;c[a+4>>2]=d;e=bd(32,4)|0;c[a+8>>2]=e;if((b|0)==1)return;a=d+(b<<2)|0;d=e+8|0;f=-1;h=0;i=b;j=0;a:while(1){k=f+1|0;if((k|0)<4)l=c[34176+(k<<2)>>2]|0;else l=j+2|0;if((l|0)==2){m=h;n=i}else{o=h;p=i;while(1){q=p;p=(p|0)/(l|0)|0;if((q|0)!=(R(p,l)|0)){f=k;h=o;i=q;j=l;continue a}r=o+1|0;c[e+(o+2<<2)>>2]=l;if((p|0)==1){s=9;break a}else o=r}}while(1){p=m+1|0;q=n;n=(n|0)/2|0;if((q|0)!=(n<<1|0)){f=k;h=m;i=q;j=l;continue a}c[e+(m+2<<2)>>2]=2;t=(m|0)==0;if(!t){if((m|0)>=1){u=1;do{v=p-u|0;c[e+(v+2<<2)>>2]=c[e+(v+1<<2)>>2];u=u+1|0}while((u|0)!=(p|0))}c[d>>2]=2}if((q&-2|0)==2){w=t;x=p;y=m;break a}else m=p}}if((s|0)==9){w=(o|0)==0;x=r;y=o}c[e>>2]=b;c[e+4>>2]=x;z=6.2831854820251465/+(b|0);if((y|0)>0&(w^1)){A=0;B=0;C=1}else return;while(1){w=c[e+(B+2<<2)>>2]|0;x=C;C=R(w,C)|0;o=(b|0)/(C|0)|0;r=w+-1|0;do if((w|0)>1){s=R(o,r)|0;if((o|0)>2){D=A;E=0;F=0}else{G=s+A|0;break}while(1){F=F+x|0;J=+(F|0)*z;K=0.0;m=D;d=2;while(1){K=K+1.0;L=J*K;g[a+(m<<2)>>2]=+H(+L);g[a+(m+1<<2)>>2]=+I(+L);d=d+2|0;if((d|0)>=(o|0))break;else m=m+2|0}E=E+1|0;if((E|0)==(r|0))break;else D=D+o|0}G=s+A|0}else G=A;while(0);B=B+1|0;if((B|0)==(y|0))break;else A=G}return}function _b(a){a=a|0;var b=0;if(!a)return;b=c[a+4>>2]|0;if(b|0)ad(b);b=c[a+8>>2]|0;if(b|0)ad(b);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function $b(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=b;e=d+112|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));c[b+64>>2]=a;c[b+76>>2]=0;c[b+68>>2]=0;if(!(c[a>>2]|0))return 0;a=bd(1,72)|0;c[b+104>>2]=a;g[a+4>>2]=-9999.0;d=b+4|0;b=a+12|0;a=0;do{if((a|0)==7)f=d;else f=bd(1,20)|0;c[b+(a<<2)>>2]=f;Fa(f);a=a+1|0}while((a|0)!=15);return 0}function ac(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=a+84|0;d=c[b>>2]|0;if(d|0){e=d;do{d=e;e=c[e+4>>2]|0;ad(c[d>>2]|0);ad(d)}while((e|0)!=0)}e=a+80|0;d=c[e>>2]|0;if(!d){f=a+72|0;c[f>>2]=0;c[b>>2]=0;return}g=a+68|0;h=a+76|0;c[g>>2]=cd(c[g>>2]|0,(c[h>>2]|0)+d|0)|0;c[h>>2]=(c[h>>2]|0)+(c[e>>2]|0);c[e>>2]=0;f=a+72|0;c[f>>2]=0;c[b>>2]=0;return}function bc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=c[a+104>>2]|0;d=a+84|0;e=c[d>>2]|0;if(e|0){f=e;do{e=f;f=c[f+4>>2]|0;ad(c[e>>2]|0);ad(e)}while((f|0)!=0)}f=a+80|0;e=c[f>>2]|0;g=a+68|0;h=c[g>>2]|0;if(!e)i=h;else{j=a+76|0;k=cd(h,(c[j>>2]|0)+e|0)|0;c[g>>2]=k;c[j>>2]=(c[j>>2]|0)+(c[f>>2]|0);c[f>>2]=0;i=k}c[a+72>>2]=0;c[d>>2]=0;if(i|0)ad(i);if(!b){l=a;m=l+112|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(m|0));return 0}i=b+12|0;d=0;while(1){k=i+(d<<2)|0;Ha(c[k>>2]|0);if((d|0)==7){d=8;continue}ad(c[k>>2]|0);d=d+1|0;if((d|0)==15)break}ad(b);l=a;m=l+112|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(m|0));return 0}function cc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;e=c[b+28>>2]|0;if(!e){f=1;return f|0}g=c[e+3656>>2]|0;h=a;i=h+112|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(i|0));h=bd(1,136)|0;c[a+104>>2]=h;c[a+4>>2]=b;i=c[e+8>>2]|0;j=i+-1|0;if((i|0)==0|(j|0)==0)k=0;else{i=0;l=j;while(1){j=i+1|0;l=l>>>1;if(!l){k=j;break}else i=j}}c[h+44>>2]=k;k=bd(1,4)|0;i=h+12|0;c[i>>2]=k;l=bd(1,4)|0;j=h+16|0;c[j>>2]=l;c[k>>2]=bd(1,20)|0;c[l>>2]=bd(1,20)|0;Xb(c[c[i>>2]>>2]|0,c[e>>2]>>g);i=e+4|0;Xb(c[c[j>>2]>>2]|0,c[i>>2]>>g);g=c[e>>2]|0;j=g+-1|0;if((g|0)==0|(j|0)==0)m=0;else{l=0;k=j;while(1){j=l+1|0;k=k>>>1;if(!k){m=j;break}else l=j}}c[h+4>>2]=m+-6;m=c[i>>2]|0;l=m+-1|0;if((m|0)==0|(l|0)==0)n=0;else{m=0;k=l;while(1){l=m+1|0;k=k>>>1;if(!k){n=l;break}else m=l}}c[h+8>>2]=n+-6;a:do if(!d){n=e+2848|0;if((c[n>>2]|0)==0?(m=e+24|0,c[n>>2]=bd(c[m>>2]|0,56)|0,k=c[m>>2]|0,(k|0)>0):0){l=k;k=0;while(1){j=e+1824+(k<<2)|0;o=c[j>>2]|0;if(!o){p=l;break}if(fc((c[n>>2]|0)+(k*56|0)|0,o)|0){q=23;break}gc(c[j>>2]|0);c[j>>2]=0;k=k+1|0;l=c[m>>2]|0;if((k|0)>=(l|0))break a}if((q|0)==23)p=c[m>>2]|0;if((p|0)>0){l=p;k=0;while(1){n=e+1824+(k<<2)|0;j=c[n>>2]|0;if(!j)r=l;else{gc(j);c[n>>2]=0;r=c[m>>2]|0}k=k+1|0;if((k|0)>=(r|0))break;else l=r}}hc(a);f=-1;return f|0}}else{Zb(h+20|0,g);Zb(h+32|0,c[i>>2]|0);l=e+2848|0;if(((c[l>>2]|0)==0?(k=e+24|0,m=bd(c[k>>2]|0,56)|0,c[l>>2]=m,(c[k>>2]|0)>0):0)?(dc(m,c[e+1824>>2]|0)|0,(c[k>>2]|0)>1):0){m=1;do{dc((c[l>>2]|0)+(m*56|0)|0,c[e+1824+(m<<2)>>2]|0)|0;m=m+1|0}while((m|0)<(c[k>>2]|0))}k=e+28|0;m=bd(c[k>>2]|0,52)|0;l=h+56|0;c[l>>2]=m;b:do if((c[k>>2]|0)>0){n=e+2868|0;j=b+8|0;o=m;s=0;while(1){t=c[e+2852+(s<<2)>>2]|0;ec(o+(s*52|0)|0,t,n,(c[e+(c[t>>2]<<2)>>2]|0)/2|0,c[j>>2]|0);t=s+1|0;if((t|0)>=(c[k>>2]|0))break b;o=c[l>>2]|0;s=t}}while(0);c[a>>2]=1}while(0);g=c[i>>2]|0;c[a+16>>2]=g;r=c[b+4>>2]|0;b=r<<2;p=$c(b)|0;q=a+8|0;c[q>>2]=p;c[a+12>>2]=$c(b)|0;if((r|0)>0?(c[p>>2]=bd(g,4)|0,(r|0)!=1):0){p=1;do{b=c[q>>2]|0;c[b+(p<<2)>>2]=bd(g,4)|0;p=p+1|0}while((p|0)<(r|0))}c[a+36>>2]=0;c[a+40>>2]=0;r=(c[i>>2]|0)/2|0;c[a+48>>2]=r;c[a+20>>2]=r;r=e+16|0;i=h+48|0;c[i>>2]=bd(c[r>>2]|0,4)|0;p=e+20|0;g=h+52|0;c[g>>2]=bd(c[p>>2]|0,4)|0;if((c[r>>2]|0)>0){h=0;do{q=wa[c[(c[456+(c[e+800+(h<<2)>>2]<<2)>>2]|0)+8>>2]&15](a,c[e+1056+(h<<2)>>2]|0)|0;c[(c[i>>2]|0)+(h<<2)>>2]=q;h=h+1|0}while((h|0)<(c[r>>2]|0))}if((c[p>>2]|0)>0)u=0;else{f=0;return f|0}do{r=wa[c[(c[464+(c[e+1312+(u<<2)>>2]<<2)>>2]|0)+8>>2]&15](a,c[e+1568+(u<<2)>>2]|0)|0;c[(c[g>>2]|0)+(u<<2)>>2]=r;u=u+1|0}while((u|0)<(c[p>>2]|0));f=0;return f|0} +function dc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0.0;d=a+16|0;e=d+40|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));c[a+12>>2]=b;d=b+4|0;e=c[d>>2]|0;c[a+4>>2]=e;c[a+8>>2]=e;c[a>>2]=c[b>>2];c[a+20>>2]=mc(c[b+8>>2]|0,e,0)|0;e=c[d>>2]|0;d=c[b>>2]|0;if((d|0)<=0)while(1){}f=~~+D(+(+G(+(+(e|0)),+(1.0/+(d|0)))));while(1){g=f+1|0;h=1;i=1;j=0;do{h=R(h,f)|0;i=R(i,g)|0;j=j+1|0}while((j|0)!=(d|0));if((i|0)>(e|0)&(h|0)<=(e|0))break;else f=((h|0)>(e|0)?-1:1)+f|0}c[a+44>>2]=f;f=c[b+16>>2]|0;k=+(f&2097151|0);c[a+48>>2]=~~+_c(+Yc((f|0)<0?-k:k,(f>>>21&1023)+-788|0));f=c[b+20>>2]|0;k=+(f&2097151|0);c[a+52>>2]=~~+_c(+Yc((f|0)<0?-k:k,(f>>>21&1023)+-788|0));return 0}function ec(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0.0,k=0.0,l=0.0,m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0.0;h=a+8|0;c[h>>2]=0;c[h+4>>2]=0;h=c[d>>2]|0;c[a+36>>2]=h;d=~~(+Zc(+P(+(+(h|0)*8.0))*1.4426950408889634)+-1.0);i=a+32|0;c[i>>2]=d;j=+(f|0);k=+(e|0);l=+(1<>2]=d;c[a+40>>2]=1-d+~~(l*(+P(+((+(e|0)+.25)*j*.5/k))*1.4426950216293335+-5.965784072875977)+.5);d=e<<2;h=$c(d)|0;c[a+16>>2]=h;m=$c(d)|0;c[a+20>>2]=m;n=$c(d)|0;c[a+24>>2]=n;o=a+4|0;c[o>>2]=b;c[a>>2]=e;c[a+44>>2]=f;p=a+48|0;g[p>>2]=1.0;if((f|0)>=26e3)if((f|0)>=38e3){if((f|0)>46e3){q=1.274999976158142;r=4}}else{q=.9399999976158142;r=4}else{q=0.0;r=4}if((r|0)==4)g[p>>2]=q;q=k*2.0;j=+(f|0);p=0;s=0;a:while(1){t=(s|0)<(e|0);u=p;while(1){v=u;while(1){if((v|0)>=87)break a;w=v+1|0;x=~~+Zc(q*+O(+(+(w|0)*.08664337545633316+2.7488713472395148))/j);if((x|0)>(s|0))break;else v=w}if(t)break;else u=w}l=+g[34192+(v<<2)>>2];y=(+g[34192+(w<<2)>>2]-l)/+(x-s|0);z=l;u=s;while(1){g[h+(u<<2)>>2]=z+100.0;t=u+1|0;if((t|0)<(x|0)&(t|0)<(e|0)){z=z+y;u=t}else{p=w;s=t;continue a}}}if((s|0)<(e|0)){w=c[h+((s<<2)+-4)>>2]|0;p=s;do{c[h+(p<<2)>>2]=w;p=p+1|0}while((p|0)!=(e|0))}p=(e|0)>0;if(p){w=(f|0)/(e<<1|0)|0;f=c[b+120>>2]|0;h=b+124|0;s=b+116|0;x=b+112|0;v=1;u=0;t=-99;while(1){A=R(w,u)|0;y=+(A|0);z=+M(+(+(R(A,A)|0)*1.8499999754340024e-08))*2.240000009536743+ +M(+(y*7.399999885819852e-04))*13.100000381469727+y*9.999999747378752e-05;b:do if((f+t|0)<(u|0)){y=z-+g[x>>2];A=t;while(1){B=R(A,w)|0;l=+(B|0);if(!(+M(+(l*7.399999885819852e-04))*13.100000381469727+l*9.999999747378752e-05+ +M(+(+(R(B,B)|0)*1.8499999754340024e-08))*2.240000009536743(e|0))D=v;else{A=(c[h>>2]|0)+u|0;B=v;while(1){if((B|0)>=(A|0)?(E=R(B,w)|0,y=+(E|0),l=+M(+(y*7.399999885819852e-04))*13.100000381469727+y*9.999999747378752e-05+ +M(+(+(R(E,E)|0)*1.8499999754340024e-08))*2.240000009536743,!(l<+g[s>>2]+z)):0){D=B;break c}E=B+1|0;if((B|0)<(e|0))B=E;else{D=E;break}}}while(0);c[n+(u<<2)>>2]=(C<<16)+-65537+D;u=u+1|0;if((u|0)==(e|0))break;else{v=D;t=C}}if(p){z=j*.5;l=+(1<<(c[i>>2]|0)+1|0);i=0;do{c[m+(i<<2)>>2]=~~(l*(+P(+(z*(+(i|0)+.25)/k))*1.4426950216293335+-5.965784072875977)+.5);i=i+1|0}while((i|0)!=(e|0));F=z}else r=19}else r=19;if((r|0)==19)F=j*.5;c[a+8>>2]=pc(b+36|0,F/k,e,+g[b+24>>2],+g[b+28>>2])|0;b=$c(12)|0;r=a+12|0;c[r>>2]=b;c[b>>2]=$c(d)|0;c[b+4>>2]=$c(d)|0;b=$c(d)|0;c[(c[r>>2]|0)+8>>2]=b;if(!p)return;p=c[o>>2]|0;o=c[r>>2]|0;r=c[o>>2]|0;b=c[o+4>>2]|0;d=c[o+8>>2]|0;o=0;do{k=+P(+((+(o|0)+.5)*j/q))*2.885390043258667+-11.931568145751953;F=k<0.0?0.0:k;k=F>=16.0?16.0:F;a=~~k;F=k-+(a|0);k=1.0-F;i=a+1|0;g[r+(o<<2)>>2]=+g[p+132+(i<<2)>>2]*F+ +g[p+132+(a<<2)>>2]*k;g[b+(o<<2)>>2]=+g[p+200+(i<<2)>>2]*F+ +g[p+200+(a<<2)>>2]*k;g[d+(o<<2)>>2]=+g[p+268+(i<<2)>>2]*F+ +g[p+268+(a<<2)>>2]*k;o=o+1|0}while((o|0)!=(e|0));return}function fc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;e=l;f=b;g=f+56|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));h=d+4|0;i=c[h>>2]|0;if((i|0)>0){j=c[d+8>>2]|0;k=0;m=0;while(1){n=((c[j+(k<<2)>>2]|0)>0&1)+m|0;k=k+1|0;if((k|0)>=(i|0)){o=n;break}else m=n}}else o=0;c[b+4>>2]=i;m=b+8|0;c[m>>2]=o;c[b>>2]=c[d>>2];if((o|0)<=0){p=0;l=e;return p|0}k=d+8|0;j=mc(c[k>>2]|0,i,o)|0;i=o<<2;n=l;l=l+((1*i|0)+15&-16)|0;if(!j){q=c[b+16>>2]|0;if(q|0)ad(q);q=c[b+20>>2]|0;if(q|0)ad(q);q=c[b+24>>2]|0;if(q|0)ad(q);q=c[b+28>>2]|0;if(q|0)ad(q);q=c[b+32>>2]|0;if(q|0)ad(q);f=b;g=f+56|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));p=-1;l=e;return p|0}else r=0;do{f=j+(r<<2)|0;g=kd(c[f>>2]|0)|0;q=g>>>4&252645135|g<<4&-252645136;g=q>>>2&858993459|q<<2&-858993460;c[f>>2]=g>>>1&1431655765|g<<1&-1431655766;c[n+(r<<2)>>2]=f;r=r+1|0}while((r|0)!=(o|0));Pc(n,o,4,13);r=l;l=l+((1*i|0)+15&-16)|0;f=$c(i)|0;g=b+20|0;c[g>>2]=f;q=j;s=0;do{c[r+((c[n+(s<<2)>>2]|0)-q>>2<<2)>>2]=s;s=s+1|0}while((s|0)!=(o|0));t=0;do{c[f+(c[r+(t<<2)>>2]<<2)>>2]=c[j+(t<<2)>>2];t=t+1|0}while((t|0)!=(o|0));ad(j);c[b+16>>2]=oc(d,o,r)|0;o=$c(i)|0;c[b+24>>2]=o;i=c[h>>2]|0;d=(i|0)>0;if(d){j=c[k>>2]|0;t=0;f=0;while(1){if((c[j+(t<<2)>>2]|0)>0){c[o+(c[r+(f<<2)>>2]<<2)>>2]=t;u=f+1|0}else u=f;t=t+1|0;if((t|0)>=(i|0))break;else f=u}f=b+28|0;c[f>>2]=$c(u)|0;if(d){d=i;i=0;u=0;while(1){t=c[(c[k>>2]|0)+(i<<2)>>2]|0;if((t|0)>0){a[(c[f>>2]|0)+(c[r+(u<<2)>>2]|0)>>0]=t;v=c[h>>2]|0;w=u+1|0}else{v=d;w=u}i=i+1|0;if((i|0)>=(v|0)){x=f;y=w;break}else{d=v;u=w}}}else{x=f;y=0}}else{f=b+28|0;c[f>>2]=$c(0)|0;x=f;y=0}f=c[m>>2]|0;if(!f)z=-4;else{m=0;w=f;while(1){w=w>>>1;if(!w)break;else m=m+1|0}z=m+-3|0}m=b+36|0;w=(z|0)>5?z:5;z=(w|0)<8?w:8;c[m>>2]=z;w=1<>2]=f;u=b+40|0;c[u>>2]=0;a:do if((y|0)>0){b=c[x>>2]|0;v=0;d=z;i=0;while(1){h=b+i|0;r=a[h>>0]|0;k=r<<24>>24;if((v|0)<(k|0)){c[u>>2]=k;A=a[h>>0]|0}else A=r;r=A<<24>>24;if((d|0)>=(r|0)?(k=kd(c[(c[g>>2]|0)+(i<<2)>>2]|0)|0,t=k>>>4&252645135|k<<4&-252645136,k=t>>>2&858993459|t<<2&-858993460,t=k>>>1&1431655765|k<<1&-1431655766,(d-r|0)!=31):0){k=i+1|0;o=r;r=0;do{c[f+((t|r<>2]=k;r=r+1|0;j=c[m>>2]|0;o=a[h>>0]|0}while((r|0)<(1<>2]|0;d=B;i=o}}else C=z;while(0);z=-2<<31-C;B=C;C=0;u=0;A=0;while(1){x=u<<32-B;i=kd(x|0)|0;d=i>>>4&252645135|i<<4&-252645136;i=d>>>2&858993459|d<<2&-858993460;d=f+((i>>>1&1431655765|i<<1&-1431655766)<<2)|0;if(!(c[d>>2]|0)){i=A;while(1){v=i+1|0;if((v|0)>=(y|0))break;if((c[(c[g>>2]|0)+(v<<2)>>2]|0)>>>0>x>>>0)break;else i=v}b:do if((y|0)>(C|0)){v=c[g>>2]|0;b=C;while(1){if(x>>>0<(c[v+(b<<2)>>2]&z)>>>0){D=b;break b}o=b+1|0;if((y|0)>(o|0))b=o;else{D=o;break}}}else D=C;while(0);x=y-D|0;c[d>>2]=(i>>>0<32767?i:32767)<<15|(x>>>0<32767?x:32767)|-2147483648;E=D;F=i}else{E=C;F=A}x=u+1|0;if((x|0)>=(w|0)){p=0;break}B=c[m>>2]|0;C=E;u=x;A=F}l=e;return p|0}function gc(a){a=a|0;var b=0;if(!(c[a+36>>2]|0))return;b=c[a+32>>2]|0;if(b|0)ad(b);b=c[a+8>>2]|0;if(b|0)ad(b);ad(a);return}function hc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(!a)return;b=c[a+4>>2]|0;d=(b|0)!=0;if(d)e=c[b+28>>2]|0;else e=0;f=c[a+104>>2]|0;g=(f|0)!=0;if(g){h=c[f>>2]|0;if(h|0){ic(h);ad(c[f>>2]|0)}h=f+12|0;i=c[h>>2]|0;if(i|0){Yb(c[i>>2]|0);ad(c[c[h>>2]>>2]|0);ad(c[h>>2]|0)}h=f+16|0;i=c[h>>2]|0;if(i|0){Yb(c[i>>2]|0);ad(c[c[h>>2]>>2]|0);ad(c[h>>2]|0)}h=f+48|0;i=c[h>>2]|0;if(i|0){if((e|0)!=0?(j=e+16|0,(c[j>>2]|0)>0):0){ra[c[(c[456+(c[e+800>>2]<<2)>>2]|0)+16>>2]&7](c[i>>2]|0);if((c[j>>2]|0)>1){k=1;do{ra[c[(c[456+(c[e+800+(k<<2)>>2]<<2)>>2]|0)+16>>2]&7](c[(c[h>>2]|0)+(k<<2)>>2]|0);k=k+1|0}while((k|0)<(c[j>>2]|0))}l=c[h>>2]|0}else l=i;ad(l)}l=f+52|0;i=c[l>>2]|0;if(i|0){if((e|0)!=0?(h=e+20|0,(c[h>>2]|0)>0):0){ra[c[(c[464+(c[e+1312>>2]<<2)>>2]|0)+16>>2]&7](c[i>>2]|0);if((c[h>>2]|0)>1){j=1;do{ra[c[(c[464+(c[e+1312+(j<<2)>>2]<<2)>>2]|0)+16>>2]&7](c[(c[l>>2]|0)+(j<<2)>>2]|0);j=j+1|0}while((j|0)<(c[h>>2]|0))}m=c[l>>2]|0}else m=i;ad(m)}m=f+56|0;i=c[m>>2]|0;if(i|0){if((e|0)!=0?(l=e+28|0,(c[l>>2]|0)>0):0){jc(i);if((c[l>>2]|0)>1){e=1;do{jc((c[m>>2]|0)+(e*52|0)|0);e=e+1|0}while((e|0)<(c[l>>2]|0))}n=c[m>>2]|0}else n=i;ad(n)}n=c[f+60>>2]|0;if(n|0)kc(n);lc(f+80|0);_b(f+20|0);_b(f+32|0)}n=a+8|0;i=c[n>>2]|0;if(i|0){if(d?(d=b+4|0,b=c[d>>2]|0,(b|0)>0):0){m=i;l=b;b=0;while(1){e=c[m+(b<<2)>>2]|0;if(!e)o=l;else{ad(e);o=c[d>>2]|0}e=b+1|0;if((e|0)>=(o|0))break;m=c[n>>2]|0;l=o;b=e}p=c[n>>2]|0}else p=i;ad(p);p=c[a+12>>2]|0;if(p|0)ad(p)}if(g){g=c[f+64>>2]|0;if(g|0)ad(g);g=c[f+68>>2]|0;if(g|0)ad(g);g=c[f+72>>2]|0;if(g|0)ad(g);ad(f)}f=a;a=f+112|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(a|0));return}function ic(a){a=a|0;Yb(a+16|0);ad(c[a+48>>2]|0);ad(c[a+64>>2]|0);ad(c[a+80>>2]|0);ad(c[a+96>>2]|0);ad(c[a+112>>2]|0);ad(c[a+128>>2]|0);ad(c[a+144>>2]|0);ad(c[a+36>>2]|0);ad(c[a+152>>2]|0);ad(c[a+160>>2]|0);id(a|0,0,180)|0;return}function jc(a){a=a|0;var b=0,d=0,e=0,f=0;if(!a)return;b=c[a+16>>2]|0;if(b|0)ad(b);b=c[a+20>>2]|0;if(b|0)ad(b);b=c[a+24>>2]|0;if(b|0)ad(b);b=a+8|0;d=c[b>>2]|0;if(d|0){e=d;d=0;while(1){ad(c[c[e+(d<<2)>>2]>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+4>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+8>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+12>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+16>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+20>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+24>>2]|0);ad(c[(c[(c[b>>2]|0)+(d<<2)>>2]|0)+28>>2]|0);ad(c[(c[b>>2]|0)+(d<<2)>>2]|0);f=d+1|0;if((f|0)==17)break;e=c[b>>2]|0;d=f}ad(c[b>>2]|0)}b=a+12|0;d=c[b>>2]|0;if(d|0){ad(c[d>>2]|0);ad(c[(c[b>>2]|0)+4>>2]|0);ad(c[(c[b>>2]|0)+8>>2]|0);ad(c[b>>2]|0)}b=a;a=b+52|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function kc(a){a=a|0;if(!a)return;ad(a);return}function lc(a){a=a|0;var b=0;b=a;a=b+48|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function mc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=l;l=l+144|0;f=e;g=(d|0)!=0;h=$c((g?d:b)<<2)|0;id(f|0,0,132)|0;i=(b|0)>0;a:do if(i){j=f+4|0;k=(d|0)==0&1;m=0;n=0;b:while(1){o=c[a+(n<<2)>>2]|0;c:do if((o|0)>0){p=c[f+(o<<2)>>2]|0;if(!((o|0)>31|(p>>>o|0)==0))break b;q=m+1|0;c[h+(m<<2)>>2]=p;r=f+(o<<2)|0;d:do if(!(p&1)){s=p;t=r;u=o;while(1){c[t>>2]=s+1;v=u+-1|0;if((u|0)<=1)break d;s=c[f+(v<<2)>>2]|0;w=f+(v<<2)|0;if(s&1|0){x=w;y=v;z=7;break}else{t=w;u=v}}}else{x=r;y=o;z=7}while(0);do if((z|0)==7){z=0;if((y|0)==1){c[j>>2]=(c[j>>2]|0)+1;break}else{c[x>>2]=c[f+(y+-1<<2)>>2]<<1;break}}while(0);r=o+1|0;if((r|0)<33){u=p;t=o;s=r;while(1){r=f+(s<<2)|0;v=u;u=c[r>>2]|0;if((u>>>1|0)!=(v|0)){A=q;break c}c[r>>2]=c[f+(t<<2)>>2]<<1;r=s+1|0;if((r|0)>=33){A=q;break}else{v=s;s=r;t=v}}}else A=q}else A=m+k|0;while(0);n=n+1|0;if((n|0)>=(b|0))break a;else m=A}ad(h);B=0;l=e;return B|0}while(0);e:do if((d|0)!=1){A=1;while(1){if(c[f+(A<<2)>>2]&-1>>>(32-A|0)|0)break;A=A+1|0;if((A|0)>=33)break e}ad(h);B=0;l=e;return B|0}while(0);if(!i){B=h;l=e;return B|0}if(g){C=0;D=0}else{g=0;do{i=c[a+(g<<2)>>2]|0;f=h+(g<<2)|0;if((i|0)>0){d=c[f>>2]|0;A=0;y=0;while(1){x=d>>>A&1|y<<1;A=A+1|0;if((A|0)>=(i|0)){E=x;break}else y=x}}else E=0;g=g+1|0;c[f>>2]=E}while((g|0)!=(b|0));B=h;l=e;return B|0}while(1){g=c[a+(D<<2)>>2]|0;if((g|0)>0){E=c[h+(C<<2)>>2]|0;y=0;i=0;while(1){A=E>>>y&1|i<<1;y=y+1|0;if((y|0)>=(g|0)){F=A;break}else i=A}}else F=0;if(!g)G=C;else{c[h+(C<<2)>>2]=F;G=C+1|0}D=D+1|0;if((D|0)==(b|0)){B=h;break}else C=G}l=e;return B|0}function nc(a,b){a=a|0;b=b|0;var d=0;d=c[c[a>>2]>>2]|0;a=c[c[b>>2]>>2]|0;return (d>>>0>a>>>0&1)-(d>>>0>>0&1)|0}function oc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,i=0.0,j=0.0,k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0.0,B=0,C=0;e=c[a+12>>2]|0;if((e+-1|0)>>>0>=2){f=0;return f|0}h=c[a+16>>2]|0;i=+(h&2097151|0);j=+Yc((h|0)<0?-i:i,(h>>>21&1023)+-788|0);h=c[a+20>>2]|0;i=+(h&2097151|0);k=+Yc((h|0)<0?-i:i,(h>>>21&1023)+-788|0);h=c[a>>2]|0;l=bd(R(h,b)|0,4)|0;switch(e|0){case 1:{e=c[a+4>>2]|0;if((h|0)<=0)while(1){}b=~~+D(+(+G(+(+(e|0)),+(1.0/+(h|0)))));while(1){m=b+1|0;n=1;o=1;p=0;do{n=R(n,b)|0;o=R(o,m)|0;p=p+1|0}while((p|0)!=(h|0));if((o|0)>(e|0)&(n|0)<=(e|0))break;else b=((n|0)>(e|0)?-1:1)+b|0}if((e|0)<=0){f=l;return f|0}p=(d|0)==0;m=a+8|0;q=a+32|0;i=k;r=j;s=a+28|0;t=0;u=0;while(1){if(p){v=c[q>>2]|0;w=R(t,h)|0;if(!(c[s>>2]|0)){x=1;y=0;do{g[l+(w+y<<2)>>2]=r+ +E(+(+(c[v+((((u|0)/(x|0)|0|0)%(b|0)|0)<<2)>>2]|0)))*i;x=R(x,b)|0;y=y+1|0}while((y|0)<(h|0));z=21}else{y=1;x=0;A=0.0;do{A=A+r+ +E(+(+(c[v+((((u|0)/(y|0)|0|0)%(b|0)|0)<<2)>>2]|0)))*i;g[l+(w+x<<2)>>2]=A;y=R(y,b)|0;x=x+1|0}while((x|0)<(h|0));z=21}}else if(c[(c[m>>2]|0)+(u<<2)>>2]|0){x=c[q>>2]|0;y=R(c[d+(t<<2)>>2]|0,h)|0;if(!(c[s>>2]|0)){w=1;v=0;do{g[l+(y+v<<2)>>2]=r+ +E(+(+(c[x+((((u|0)/(w|0)|0|0)%(b|0)|0)<<2)>>2]|0)))*i;w=R(w,b)|0;v=v+1|0}while((v|0)<(h|0));z=21}else{v=1;w=0;A=0.0;do{A=A+r+ +E(+(+(c[x+((((u|0)/(v|0)|0|0)%(b|0)|0)<<2)>>2]|0)))*i;g[l+(y+w<<2)>>2]=A;v=R(v,b)|0;w=w+1|0}while((w|0)<(h|0));z=21}}else B=t;if((z|0)==21){z=0;B=t+1|0}u=u+1|0;if((u|0)>=(e|0)){f=l;break}else t=B}return f|0}case 2:{B=c[a+4>>2]|0;if((B|0)<=0){f=l;return f|0}t=(d|0)!=0;e=a+8|0;u=a+32|0;i=k;k=j;z=a+28|0;a=(h|0)>0;b=0;s=0;while(1){if(t?(c[(c[e>>2]|0)+(s<<2)>>2]|0)==0:0)C=b;else{if(a){q=c[u>>2]|0;m=(c[z>>2]|0)==0;if(t){p=R(h,s)|0;w=R(c[d+(b<<2)>>2]|0,h)|0;if(m){v=0;do{g[l+(w+v<<2)>>2]=k+ +E(+(+(c[q+(p+v<<2)>>2]|0)))*i;v=v+1|0}while((v|0)<(h|0))}else{v=0;j=0.0;do{j=j+k+ +E(+(+(c[q+(p+v<<2)>>2]|0)))*i;g[l+(w+v<<2)>>2]=j;v=v+1|0}while((v|0)<(h|0))}}else{v=R(h,s)|0;w=R(b,h)|0;if(m){p=0;do{g[l+(w+p<<2)>>2]=k+ +E(+(+(c[q+(v+p<<2)>>2]|0)))*i;p=p+1|0}while((p|0)<(h|0))}else{p=0;j=0.0;do{j=j+k+ +E(+(+(c[q+(v+p<<2)>>2]|0)))*i;g[l+(w+p<<2)>>2]=j;p=p+1|0}while((p|0)<(h|0))}}}C=b+1|0}s=s+1|0;if((s|0)>=(B|0)){f=l;break}else b=C}return f|0}default:{f=l;return f|0}}return 0}function pc(a,b,d,e,f){a=a|0;b=+b;d=d|0;e=+e;f=+f;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0,w=0.0,x=0.0,y=0.0,z=0.0,A=0.0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0.0,M=0;h=l;l=l+32480|0;i=h+32256|0;j=h+1792|0;k=h;m=l;l=l+((1*(d<<2)|0)+15&-16)|0;n=$c(68)|0;id(j|0,0,30464)|0;o=e>0.0;p=e<0.0;q=0;do{r=q<<2;s=0;do{t=s+r|0;if((t|0)<88)u=+g[34192+(t<<2)>>2];else u=-30.0;v=t+1|0;if((v|0)<88){w=+g[34192+(v<<2)>>2];if(u>w)x=w;else x=u}else if(u>-30.0)x=-30.0;else x=u;v=t+2|0;if((v|0)<88){w=+g[34192+(v<<2)>>2];if(x>w)y=w;else y=x}else if(x>-30.0)y=-30.0;else y=x;v=t+3|0;if((v|0)<88){w=+g[34192+(v<<2)>>2];if(y>w)z=w;else z=y}else if(y>-30.0)z=-30.0;else z=y;g[i+(s<<2)>>2]=z;s=s+1|0}while((s|0)!=56);s=34544+(q*1344|0)|0;md(j+(q*1792|0)+448|0,s|0,224)|0;md(j+(q*1792|0)+672|0,34544+(q*1344|0)+224|0,224)|0;md(j+(q*1792|0)+896|0,34544+(q*1344|0)+448|0,224)|0;md(j+(q*1792|0)+1120|0,34544+(q*1344|0)+672|0,224)|0;md(j+(q*1792|0)+1344|0,34544+(q*1344|0)+896|0,224)|0;md(j+(q*1792|0)+1568|0,34544+(q*1344|0)+1120|0,224)|0;md(j+(q*1792|0)|0,s|0,224)|0;md(j+(q*1792|0)+224|0,s|0,224)|0;if(o){s=0;do{if(p){r=0;do{v=16-r|0;w=+(((v|0)>-1?v:0-v|0)|0)*f+e;A=w<0.0?0.0:w;v=j+(q*1792|0)+(s*224|0)+(r<<2)|0;g[v>>2]=+g[v>>2]+(A>0.0?0.0:A);r=r+1|0}while((r|0)!=56)}else{r=0;do{v=16-r|0;A=+(((v|0)>-1?v:0-v|0)|0)*f+e;v=j+(q*1792|0)+(s*224|0)+(r<<2)|0;g[v>>2]=+g[v>>2]+(A<0.0?0.0:A);r=r+1|0}while((r|0)!=56)}s=s+1|0}while((s|0)!=8)}else{s=0;do{if(p){r=0;do{v=16-r|0;A=+(((v|0)>-1?v:0-v|0)|0)*f+e;v=j+(q*1792|0)+(s*224|0)+(r<<2)|0;g[v>>2]=+g[v>>2]+(A>0.0?0.0:A);r=r+1|0}while((r|0)!=56)}else{r=0;do{v=16-r|0;t=j+(q*1792|0)+(s*224|0)+(r<<2)|0;g[t>>2]=+g[t>>2]+(+(((v|0)>-1?v:0-v|0)|0)*f+e);r=r+1|0}while((r|0)!=56)}s=s+1|0}while((s|0)!=8)}A=+g[a+(q<<2)>>2];s=0;do{w=+(((s|0)>2?s:2)|0)*-10.0+70.0+A;r=0;do{v=j+(q*1792|0)+(s*224|0)+(r<<2)|0;g[v>>2]=+g[v>>2]+w;r=r+1|0}while((r|0)!=56);md(k+(s*224|0)|0,i|0,224)|0;w=+(s|0)*-10.0+70.0;r=0;do{v=k+(s*224|0)+(r<<2)|0;g[v>>2]=w+ +g[v>>2];r=r+1|0}while((r|0)!=56);B=0;do{w=+g[j+(q*1792|0)+(s*224|0)+(B<<2)>>2];r=k+(s*224|0)+(B<<2)|0;if(w>+g[r>>2])g[r>>2]=w;B=B+1|0}while((B|0)!=56);s=s+1|0}while((s|0)!=8);C=1;do{s=C+-1|0;r=0;do{A=+g[k+(s*224|0)+(r<<2)>>2];v=k+(C*224|0)+(r<<2)|0;if(A<+g[v>>2])g[v>>2]=A;r=r+1|0}while((r|0)!=56);E=0;do{A=+g[k+(C*224|0)+(E<<2)>>2];r=j+(q*1792|0)+(C*224|0)+(E<<2)|0;if(A<+g[r>>2])g[r>>2]=A;E=E+1|0}while((E|0)!=56);C=C+1|0}while((C|0)!=8);q=q+1|0}while((q|0)!=17);e=b;q=(d|0)>0;C=0;do{E=$c(32)|0;k=n+(C<<2)|0;c[k>>2]=E;f=+(C|0);z=f*.5;B=~~+D(+(+O(+(f*.34657350182533264+4.135165354540845))/e));i=~~+Q(+(+P(+(+(B|0)*b+1.0))*2.885390043258667+-11.931568145751953));a=~~+D(+(+P(+(+(B+1|0)*b))*2.885390043258667+-11.931568145751953));B=(i|0)>(C|0)?C:i;i=(B|0)>0?B:0;B=(a|0)<16?a:16;a=(i|0)>(B|0);C=C+1|0;p=(C|0)<17;f=z+3.9657840728759766;o=E;E=0;do{c[o+(E<<2)>>2]=$c(232)|0;if(q){r=0;do{g[m+(r<<2)>>2]=999.0;r=r+1|0}while((r|0)!=(d|0))}if(!a){r=i;while(1){y=+(r|0)*.5;s=0;v=0;while(1){x=+(s|0)*.125+y;t=~~(+O(+((x+3.9032840728759766)*.6931470036506653))/e);F=~~(+O(+((x+4.028284072875977)*.6931470036506653))/e+1.0);G=(t|0)>0?t:0;t=(G|0)>(d|0)?d:G;G=(t|0)<(v|0)?t:v;t=(F|0)>0?F:0;F=(t|0)>(d|0)?d:t;if((G|0)<(F|0)&(G|0)<(d|0)){x=+g[j+(r*1792|0)+(E*224|0)+(s<<2)>>2];t=G;while(1){H=m+(t<<2)|0;if(+g[H>>2]>x)g[H>>2]=x;H=t+1|0;if((H|0)<(F|0)&(H|0)<(d|0))t=H;else{I=H;break}}}else I=G;s=s+1|0;if((s|0)==56)break;else v=I}if((I|0)<(d|0)){y=+g[j+(r*1792|0)+(E*224|0)+220>>2];v=I;do{s=m+(v<<2)|0;if(+g[s>>2]>y)g[s>>2]=y;v=v+1|0}while((v|0)!=(d|0))}if((r|0)<(B|0))r=r+1|0;else break}}if(p){r=0;v=0;while(1){y=+(r|0)*.125+z;s=~~(+O(+((y+3.9032840728759766)*.6931470036506653))/e);t=~~(+O(+((y+4.028284072875977)*.6931470036506653))/e+1.0);F=(s|0)>0?s:0;s=(F|0)>(d|0)?d:F;F=(s|0)<(v|0)?s:v;s=(t|0)>0?t:0;t=(s|0)>(d|0)?d:s;if((F|0)<(t|0)&(F|0)<(d|0)){y=+g[j+(C*1792|0)+(E*224|0)+(r<<2)>>2];s=F;while(1){H=m+(s<<2)|0;if(+g[H>>2]>y)g[H>>2]=y;H=s+1|0;if((H|0)<(t|0)&(H|0)<(d|0))s=H;else{J=H;break}}}else J=F;r=r+1|0;if((r|0)==56)break;else v=J}if((J|0)<(d|0)){y=+g[j+(C*1792|0)+(E*224|0)+220>>2];v=J;do{r=m+(v<<2)|0;if(+g[r>>2]>y)g[r>>2]=y;v=v+1|0}while((v|0)!=(d|0))}}o=c[k>>2]|0;v=c[o+(E<<2)>>2]|0;r=0;do{s=~~(+O(+((f+ +(r|0)*.125)*.6931470036506653))/e);if((s|0)>-1&(s|0)<(d|0))K=+g[m+(s<<2)>>2];else K=-999.0;g[v+(r+2<<2)>>2]=K;r=r+1|0}while((r|0)!=56);do if(!(+g[v+8>>2]>-200.0))if(!(+g[v+12>>2]>-200.0))if(!(+g[v+16>>2]>-200.0))if(!(+g[v+20>>2]>-200.0))if(!(+g[v+24>>2]>-200.0))if(!(+g[v+28>>2]>-200.0))if(!(+g[v+32>>2]>-200.0))if(!(+g[v+36>>2]>-200.0))if(!(+g[v+40>>2]>-200.0))if(!(+g[v+44>>2]>-200.0))if(!(+g[v+48>>2]>-200.0))if(!(+g[v+52>>2]>-200.0))if(!(+g[v+56>>2]>-200.0))if(+g[v+60>>2]>-200.0)L=13.0;else{if(+g[v+64>>2]>-200.0){L=14.0;break}if(+g[v+68>>2]>-200.0){L=15.0;break}L=16.0}else L=12.0;else L=11.0;else L=10.0;else L=9.0;else L=8.0;else L=7.0;else L=6.0;else L=5.0;else L=4.0;else L=3.0;else L=2.0;else L=1.0;else L=0.0;while(0);g[v>>2]=L;r=55;while(1){if(+g[v+(r+2<<2)>>2]>-200.0){M=r;break}s=r+-1|0;if((s|0)>17)r=s;else{M=s;break}}g[v+4>>2]=+(M|0);E=E+1|0}while((E|0)!=8)}while((C|0)!=17);l=h;return n|0}function qc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;if(cc(a,b,0)|0){hc(a);d=1;return d|0}b=c[a+4>>2]|0;e=c[a+104>>2]|0;if((b|0)==0|(e|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0)/4|0)|0;z=hd(f|0,((f|0)<0)<<31>>31|0,ca|0,u|0)|0;da=z;ea=C}z=ba;c[z>>2]=da;c[z+4>>2]=ea;z=a+56|0;ba=z;u=c[ba>>2]|0;ca=c[ba+4>>2]|0;ba=b+48|0;f=c[ba>>2]|0;aa=c[ba+4>>2]|0;ba=(f|0)!=-1|(aa|0)!=-1;do if((u|0)==-1&(ca|0)==-1){if(ba?(v=z,c[v>>2]=f,c[v+4>>2]=aa,(ea|0)>(aa|0)|(ea|0)==(aa|0)&da>>>0>f>>>0):0){v=gd(da|0,ea|0,f|0,aa|0)|0;$=(v|0)>0?v:0;if(!(c[b+44>>2]|0)){v=y+($>>>h)|0;c[l>>2]=(v|0)>(x|0)?x:v;break}else{v=x-y<>2]=x-((($|0)>(v|0)?v:$)>>h);break}}}else{$=((c[e+(c[n>>2]<<2)>>2]|0)/4|0)+((c[e+(c[p>>2]<<2)>>2]|0)/4|0)|0;v=hd($|0,(($|0)<0)<<31>>31|0,u|0,ca|0)|0;$=C;k=z;c[k>>2]=v;c[k+4>>2]=$;if(!((v|0)==(f|0)&($|0)==(aa|0)|ba^1)){if((($|0)>(aa|0)|($|0)==(aa|0)&v>>>0>f>>>0?(k=gd(v|0,$|0,f|0,aa|0)|0,k|0):0)?c[b+44>>2]|0:0){$=x-y<($|0)?$:k;c[j>>2]=x-(((v|0)>0?v:0)>>>h)}v=z;c[v>>2]=f;c[v+4>>2]=aa}}while(0);if(!(c[b+44>>2]|0)){i=0;return i|0}c[a+32>>2]=1;i=0;return i|0}function sc(a){a=a|0;return c[1500+(a<<2)>>2]|0}function tc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=c[a+24>>2]|0;if((d|0)<=-1){e=0;return e|0}f=c[a+20>>2]|0;if((f|0)<=(d|0)){e=0;return e|0}if(b|0){g=c[(c[a+4>>2]|0)+4>>2]|0;h=a+12|0;i=c[h>>2]|0;if((g|0)>0){j=a+8|0;a=i;k=0;while(1){c[a+(k<<2)>>2]=(c[(c[j>>2]|0)+(k<<2)>>2]|0)+(d<<2);k=k+1|0;l=c[h>>2]|0;if((k|0)>=(g|0)){m=l;break}else a=l}}else m=i;c[b>>2]=m}e=f-d|0;return e|0}function uc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=a+24|0;e=(c[d>>2]|0)+b|0;if(b|0?(e|0)>(c[a+20>>2]|0):0){f=-131;return f|0}c[d>>2]=e;f=0;return f|0}function vc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=(a|0)!=0;if(d?(e=c[a+64>>2]|0,(e|0)!=0):0){f=c[e+104>>2]|0;g=c[e+4>>2]|0;if(!g){h=f;i=0;j=0;k=0;l=1}else{h=f;i=c[g+28>>2]|0;j=g;k=1;l=1}}else{h=0;i=0;j=0;k=0;l=0}g=d?a+4|0:0;if(!(d&((i|0)!=0&(k&(l&(h|0)!=0))))){m=-136;return m|0}ac(a);Ia(g,c[b>>2]|0,c[b+4>>2]|0);if(La(g,1)|0){m=-135;return m|0}l=La(g,c[h+44>>2]|0)|0;if((l|0)==-1){m=-136;return m|0}c[a+40>>2]=l;h=i+32+(l<<2)|0;l=c[h>>2]|0;if(!l){m=-136;return m|0}k=c[l>>2]|0;l=a+28|0;c[l>>2]=k;do if(k){c[a+24>>2]=La(g,1)|0;d=La(g,1)|0;c[a+32>>2]=d;if((d|0)==-1){m=-136;return m|0}else{n=c[l>>2]|0;break}}else{c[a+24>>2]=0;c[a+32>>2]=0;n=0}while(0);l=b+16|0;g=c[l+4>>2]|0;k=a+48|0;c[k>>2]=c[l>>2];c[k+4>>2]=g;g=b+24|0;k=c[g+4>>2]|0;l=a+56|0;c[l>>2]=c[g>>2];c[l+4>>2]=k;c[a+44>>2]=c[b+12>>2];b=a+36|0;c[b>>2]=c[i+(n<<2)>>2];n=j+4|0;c[a>>2]=Ua(a,c[n>>2]<<2)|0;if((c[n>>2]|0)>0){j=0;do{k=Ua(a,c[b>>2]<<2)|0;c[(c[a>>2]|0)+(j<<2)>>2]=k;j=j+1|0}while((j|0)<(c[n>>2]|0))}n=c[(c[h>>2]|0)+12>>2]|0;m=wa[c[(c[34172+(c[i+288+(n<<2)>>2]<<2)>>2]|0)+16>>2]&15](a,c[i+544+(n<<2)>>2]|0)|0;return m|0}function wc(a){a=a|0;if(!a)return;ad(a);return}function xc(a){a=a|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;return}function yc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!a)return;b=c[a>>2]|0;if(b|0){d=a+8|0;e=c[d>>2]|0;if((e|0)>0){f=b;g=e;e=0;while(1){h=c[f+(e<<2)>>2]|0;if(!h){i=g;j=f}else{ad(h);i=c[d>>2]|0;j=c[a>>2]|0}e=e+1|0;if((e|0)>=(i|0)){k=j;break}else{f=j;g=i}}}else k=b;ad(k)}k=c[a+4>>2]|0;if(k|0)ad(k);k=c[a+12>>2]|0;if(k|0)ad(k);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;return}function zc(a){a=a|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;c[a+28>>2]=bd(1,3664)|0;return}function Ac(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=c[a+28>>2]|0;if(!b){c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;c[a+28>>2]=0;return}d=b+8|0;e=c[d>>2]|0;if((e|0)>0){f=b+32|0;g=e;e=0;while(1){h=c[f+(e<<2)>>2]|0;if(!h)i=g;else{ad(h);i=c[d>>2]|0}e=e+1|0;if((e|0)>=(i|0))break;else g=i}}i=b+12|0;g=c[i>>2]|0;if((g|0)>0){e=b+544|0;d=b+288|0;f=g;g=0;while(1){h=c[e+(g<<2)>>2]|0;if(!h)j=f;else{ra[c[(c[34172+(c[d+(g<<2)>>2]<<2)>>2]|0)+8>>2]&7](h);j=c[i>>2]|0}g=g+1|0;if((g|0)>=(j|0))break;else f=j}}j=b+16|0;f=c[j>>2]|0;if((f|0)>0){g=b+1056|0;i=b+800|0;d=f;f=0;while(1){e=c[g+(f<<2)>>2]|0;if(!e)k=d;else{ra[c[(c[456+(c[i+(f<<2)>>2]<<2)>>2]|0)+12>>2]&7](e);k=c[j>>2]|0}f=f+1|0;if((f|0)>=(k|0))break;else d=k}}k=b+20|0;d=c[k>>2]|0;if((d|0)>0){f=b+1568|0;j=b+1312|0;i=d;d=0;while(1){g=c[f+(d<<2)>>2]|0;if(!g)l=i;else{ra[c[(c[464+(c[j+(d<<2)>>2]<<2)>>2]|0)+12>>2]&7](g);l=c[k>>2]|0}d=d+1|0;if((d|0)>=(l|0))break;else i=l}}l=b+24|0;if((c[l>>2]|0)>0){i=b+1824|0;d=b+2848|0;k=0;do{j=c[i+(k<<2)>>2]|0;if(j|0)gc(j);j=c[d>>2]|0;if(j|0)Bc(j+(k*56|0)|0);k=k+1|0}while((k|0)<(c[l>>2]|0));m=d}else m=b+2848|0;d=c[m>>2]|0;if(d|0)ad(d);d=b+28|0;if((c[d>>2]|0)>0){m=b+2852|0;l=0;do{wc(c[m+(l<<2)>>2]|0);l=l+1|0}while((l|0)<(c[d>>2]|0))}ad(b);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;c[a+28>>2]=0;return}function Bc(a){a=a|0;var b=0,d=0,e=0;b=c[a+16>>2]|0;if(b|0)ad(b);b=c[a+20>>2]|0;if(b|0)ad(b);b=c[a+24>>2]|0;if(b|0)ad(b);b=c[a+28>>2]|0;if(b|0)ad(b);b=c[a+32>>2]|0;if(!b){d=a;e=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));return}ad(b);d=a;e=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));return}function Cc(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+32|0;g=f;h=f+20|0;if(!e){i=-133;l=f;return i|0}Ia(g,c[e>>2]|0,c[e+4>>2]|0);j=La(g,8)|0;a[h>>0]=La(g,8)|0;a[h+1>>0]=La(g,8)|0;a[h+2>>0]=La(g,8)|0;a[h+3>>0]=La(g,8)|0;a[h+4>>0]=La(g,8)|0;a[h+5>>0]=La(g,8)|0;a:do if(!(Oc(h,57636,6)|0))switch(j|0){case 1:{if(!(c[e+8>>2]|0)){k=-133;break a}m=b+8|0;if(c[m>>2]|0){k=-133;break a}n=c[b+28>>2]|0;if(!n){k=-129;break a}o=La(g,32)|0;c[b>>2]=o;if(o|0){k=-134;break a}o=b+4|0;c[o>>2]=La(g,8)|0;c[m>>2]=La(g,32)|0;c[b+12>>2]=La(g,32)|0;c[b+16>>2]=La(g,32)|0;c[b+20>>2]=La(g,32)|0;c[n>>2]=1<<(La(g,4)|0);p=1<<(La(g,4)|0);c[n+4>>2]=p;if((((c[m>>2]|0)>=1?(c[o>>2]|0)>=1:0)?(o=c[n>>2]|0,!((p|0)>8192|((o|0)<64|(p|0)<(o|0)))):0)?(La(g,1)|0)==1:0){k=0;break a}Ac(b);k=-133;break a;break}case 3:{if(!(c[b+8>>2]|0)){k=-133;break a}o=La(g,32)|0;b:do if((o|0)>=0?(p=g+16|0,(o|0)<=((c[p>>2]|0)+-8|0)):0){n=bd(o+1|0,1)|0;c[d+12>>2]=n;if(o|0){m=n;n=o;while(1){n=n+-1|0;a[m>>0]=La(g,8)|0;if(!n)break;else m=m+1|0}}m=La(g,32)|0;if((m|0)>=0?(n=c[p>>2]|0,(m|0)<=(n-(Ma(g)|0)>>2|0)):0){n=d+8|0;c[n>>2]=m;q=m+1|0;c[d>>2]=bd(q,4)|0;r=d+4|0;c[r>>2]=bd(q,4)|0;if((m|0)>0){m=0;do{q=La(g,32)|0;if((q|0)<0){s=d;break b}t=c[p>>2]|0;if((q|0)>(t-(Ma(g)|0)|0)){s=d;break b}c[(c[r>>2]|0)+(m<<2)>>2]=q;t=bd(q+1|0,1)|0;c[(c[d>>2]|0)+(m<<2)>>2]=t;if(q|0){t=c[(c[d>>2]|0)+(m<<2)>>2]|0;u=q;while(1){u=u+-1|0;a[t>>0]=La(g,8)|0;if(!u)break;else t=t+1|0}}m=m+1|0}while((m|0)<(c[n>>2]|0))}if((La(g,1)|0)==1){k=0;break a}else s=d}else v=28}else v=28;while(0);if((v|0)==28){if(!d){k=-133;break a}s=d}o=c[s>>2]|0;if(o|0){n=d+8|0;m=c[n>>2]|0;if((m|0)>0){r=o;p=m;m=0;while(1){t=c[r+(m<<2)>>2]|0;if(!t){w=p;x=r}else{ad(t);w=c[n>>2]|0;x=c[s>>2]|0}m=m+1|0;if((m|0)>=(w|0)){y=x;break}else{r=x;p=w}}}else y=o;ad(y)}p=c[d+4>>2]|0;if(p|0)ad(p);p=c[d+12>>2]|0;if(p|0)ad(p);c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;k=-133;break a;break}case 5:{if(!(c[b+8>>2]|0)){k=-133;break a}if(!(c[d+12>>2]|0)){k=-133;break a}p=c[b+28>>2]|0;if(!p){k=-129;break a}r=La(g,8)|0;m=p+24|0;c[m>>2]=r+1;c:do if((r|0)>=0){n=0;do{t=Dc(g)|0;c[p+1824+(n<<2)>>2]=t;n=n+1|0;if(!t)break c}while((n|0)<(c[m>>2]|0));n=La(g,6)|0;if((n|0)>=0){t=0;while(1){if(La(g,16)|0)break c;if((t|0)<(n|0))t=t+1|0;else break}t=La(g,6)|0;n=p+16|0;c[n>>2]=t+1;if((t|0)>=0){t=0;do{u=La(g,16)|0;c[p+800+(t<<2)>>2]=u;if(u>>>0>1)break c;q=wa[c[(c[456+(u<<2)>>2]|0)+4>>2]&15](b,g)|0;c[p+1056+(t<<2)>>2]=q;t=t+1|0;if(!q)break c}while((t|0)<(c[n>>2]|0));n=La(g,6)|0;t=p+20|0;c[t>>2]=n+1;if((n|0)>=0){n=0;do{q=La(g,16)|0;c[p+1312+(n<<2)>>2]=q;if(q>>>0>2)break c;u=wa[c[(c[464+(q<<2)>>2]|0)+4>>2]&15](b,g)|0;c[p+1568+(n<<2)>>2]=u;n=n+1|0;if(!u)break c}while((n|0)<(c[t>>2]|0));t=La(g,6)|0;n=p+12|0;c[n>>2]=t+1;if((t|0)>=0){t=0;do{u=La(g,16)|0;c[p+288+(t<<2)>>2]=u;if(u|0)break c;u=wa[c[(c[8543]|0)+4>>2]&15](b,g)|0;c[p+544+(t<<2)>>2]=u;t=t+1|0;if(!u)break c}while((t|0)<(c[n>>2]|0));t=La(g,6)|0;u=p+8|0;c[u>>2]=t+1;if((t|0)>=0){t=0;do{q=p+32+(t<<2)|0;c[q>>2]=bd(1,16)|0;z=La(g,1)|0;c[c[q>>2]>>2]=z;z=La(g,16)|0;c[(c[q>>2]|0)+4>>2]=z;z=La(g,16)|0;c[(c[q>>2]|0)+8>>2]=z;z=La(g,8)|0;A=c[q>>2]|0;c[A+12>>2]=z;if((c[A+4>>2]|0)>0)break c;if((c[A+8>>2]|0)>0)break c;t=t+1|0;if((z|0)<0?1:(z|0)>=(c[n>>2]|0))break c}while((t|0)<(c[u>>2]|0));if((La(g,1)|0)==1){k=0;break a}}}}}}}while(0);Ac(b);k=-133;break a;break}default:{k=-133;break a}}else k=-132;while(0);i=k;l=f;return i|0}function Dc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;b=bd(1,40)|0;c[b+36>>2]=1;a:do if(((La(a,24)|0)==5653314?(c[b>>2]=La(a,16)|0,d=La(a,24)|0,e=b+4|0,c[e>>2]=d,(d|0)!=-1):0)?(d=db(c[b>>2]|0)|0,((db(c[e>>2]|0)|0)+d|0)<=24):0){b:do switch(La(a,1)|0){case 0:{d=(La(a,1)|0)!=0;if(((R(d?1:5,c[e>>2]|0)|0)+7>>3|0)>((c[a+16>>2]|0)-(Ma(a)|0)|0))break a;f=c[e>>2]|0;g=b+8|0;c[g>>2]=$c(f<<2)|0;h=(f|0)>0;if(!d){if(h)i=0;else break b;while(1){d=La(a,5)|0;if((d|0)==-1)break a;c[(c[g>>2]|0)+(i<<2)>>2]=d+1;i=i+1|0;if((i|0)>=(c[e>>2]|0))break b}}if(h){d=0;do{if(La(a,1)|0){f=La(a,5)|0;if((f|0)==-1)break a;else j=f+1|0}else j=0;c[(c[g>>2]|0)+(d<<2)>>2]=j;d=d+1|0}while((d|0)<(c[e>>2]|0))}break}case 1:{d=(La(a,5)|0)+1|0;if(!d)break a;g=c[e>>2]|0;h=b+8|0;c[h>>2]=$c(g<<2)|0;if((g|0)>0){f=g;g=0;k=d;while(1){d=La(a,db(f-g|0)|0)|0;if((k|0)>32|(d|0)==-1)break a;l=c[e>>2]|0;if((d|0)>(l-g|0))break a;if((d|0)>0){if((d+-1>>k+-1|0)>1)break a;m=c[h>>2]|0;n=g;o=0;while(1){c[m+(n<<2)>>2]=k;o=o+1|0;if((o|0)==(d|0))break;else n=n+1|0}p=c[e>>2]|0;q=d+g|0}else{p=l;q=g}if((p|0)>(q|0)){f=p;g=q;k=k+1|0}else break}}break}default:break a}while(0);k=La(a,4)|0;g=b+12|0;c[g>>2]=k;switch(k|0){case 2:case 1:break;case 0:{r=b;return r|0}default:break a}c[b+16>>2]=La(a,32)|0;c[b+20>>2]=La(a,32)|0;k=b+24|0;c[k>>2]=(La(a,4)|0)+1;f=La(a,1)|0;c[b+28>>2]=f;if((f|0)!=-1){switch(c[g>>2]|0){case 1:{if(!(c[b>>2]|0))s=0;else s=Ec(b)|0;break}case 2:{s=R(c[b>>2]|0,c[e>>2]|0)|0;break}default:s=0}g=(R(c[k>>2]|0,s)|0)+7>>3;f=c[a+16>>2]|0;if((g|0)<=(f-(Ma(a)|0)|0)){f=$c(s<<2)|0;g=b+32|0;c[g>>2]=f;if((s|0)>0){h=0;do{n=La(a,c[k>>2]|0)|0;o=c[g>>2]|0;c[o+(h<<2)>>2]=n;h=h+1|0}while((h|0)!=(s|0));t=o}else t=f;if(!s){r=b;return r|0}if((c[t+(s+-1<<2)>>2]|0)!=-1){r=b;return r|0}}}}while(0);gc(b);r=0;return r|0}function Ec(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=c[a+4>>2]|0;d=c[a>>2]|0;if((d|0)<=0)while(1){}a=~~+D(+(+G(+(+(b|0)),+(1.0/+(d|0)))));while(1){e=a+1|0;f=1;g=1;h=0;do{f=R(f,a)|0;g=R(g,e)|0;h=h+1|0}while((h|0)<(d|0));if((f|0)<=(b|0)&(g|0)>(b|0))break;else a=((f|0)>(b|0)?-1:1)+a|0}return a|0}function Fc(){zc(57876);xc(57908);return}function Gc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;e=d;Jc(e,a,b);if(!(c[14468]|0))c[e+8>>2]=1;if(Cc(57876,57908,e)|0){f=0;l=d;return f|0}e=(c[14468]|0)+1|0;c[14468]=e;if((e|0)<3){f=1;l=d;return f|0}qc(57648,57876)|0;$b(57648,57760)|0;ga(c[14470]|0,c[14471]|0);f=1;l=d;return f|0}function Hc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+48|0;e=d;f=d+32|0;Jc(e,a,b);if(vc(57760,e)|0){g=0;l=d;return g|0}rc(57648,57760)|0;e=tc(57648,f)|0;la(c[f>>2]|0,c[14470]|0,e|0);uc(57648,e)|0;g=1;l=d;return g|0}function Ic(){if(!(c[14468]|0))return;Ac(57876);hc(57648);bc(57760)|0;yc(57908);return}function Jc(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=b;c[a+4>>2]=d;d=a+8|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[d+20>>2]=0;return}function Kc(){return 57924}function Lc(){return (Mc()|0)+64|0}function Mc(){return Nc()|0}function Nc(){return 57392}function Oc(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=b;g=d;h=c;while(1){i=a[f>>0]|0;j=a[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Pc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+208|0;g=f+8|0;h=f;i=R(d,b)|0;b=h;c[b>>2]=1;c[b+4>>2]=0;a:do if(i|0){b=0-d|0;c[g+4>>2]=d;c[g>>2]=d;j=d;k=d;m=2;while(1){n=j+d+k|0;c[g+(m<<2)>>2]=n;if(n>>>0>>0){o=k;k=n;m=m+1|0;j=o}else break}j=a+i+b|0;if(j>>>0>a>>>0){m=j;k=1;o=a;n=1;while(1){do if((k&3|0)!=3){p=n+-1|0;if((c[g+(p<<2)>>2]|0)>>>0<(m-o|0)>>>0)Qc(o,d,e,n,g);else Sc(o,d,e,h,n,0,g);if((n|0)==1){Tc(h,1);q=0;break}else{Tc(h,p);q=1;break}}else{Qc(o,d,e,n,g);Rc(h,2);q=n+2|0}while(0);p=c[h>>2]|1;c[h>>2]=p;r=o+d|0;if(r>>>0>>0){k=p;o=r;n=q}else{s=p;t=r;u=q;break}}}else{s=1;t=a;u=1}Sc(t,d,e,h,u,0,g);n=h+4|0;o=s;k=t;j=u;while(1){if((j|0)==1&(o|0)==1){if(!(c[n>>2]|0))break a}else if((j|0)>=2){Tc(h,2);m=j+-2|0;c[h>>2]=c[h>>2]^7;Rc(h,1);Sc(k+(0-(c[g+(m<<2)>>2]|0))+b|0,d,e,h,j+-1|0,1,g);Tc(h,1);r=c[h>>2]|1;c[h>>2]=r;p=k+b|0;Sc(p,d,e,h,m,1,g);o=r;k=p;j=m;continue}m=Uc(h)|0;Rc(h,m);o=c[h>>2]|0;k=k+b|0;j=m+j|0}}while(0);l=f;return}function Qc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;g=l;l=l+240|0;h=g;c[h>>2]=a;a:do if((e|0)>1){i=0-b|0;j=a;k=a;m=1;n=e;while(1){o=k+i|0;p=n+-2|0;q=o+(0-(c[f+(p<<2)>>2]|0))|0;if((wa[d&15](j,q)|0)>-1?(wa[d&15](j,o)|0)>-1:0){r=m;break a}s=m+1|0;t=h+(m<<2)|0;if((wa[d&15](q,o)|0)>-1){c[t>>2]=q;u=q;v=n+-1|0}else{c[t>>2]=o;u=o;v=p}if((v|0)<=1){r=s;break a}j=c[h>>2]|0;k=u;m=s;n=v}}else r=1;while(0);Wc(b,h,r);l=g;return}function Rc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=a+4|0;if(b>>>0>31){e=c[d>>2]|0;c[a>>2]=e;c[d>>2]=0;f=e;g=0;h=b+-32|0}else{f=c[a>>2]|0;g=c[d>>2]|0;h=b}c[a>>2]=g<<32-h|f>>>h;c[d>>2]=g>>>h;return}function Sc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;i=l;l=l+240|0;j=i+232|0;k=i;m=c[e>>2]|0;c[j>>2]=m;n=c[e+4>>2]|0;e=j+4|0;c[e>>2]=n;c[k>>2]=a;a:do if((m|0)!=1|(n|0)!=0?(o=0-b|0,p=a+(0-(c[h+(f<<2)>>2]|0))|0,(wa[d&15](p,a)|0)>=1):0){q=p;p=a;r=1;s=f;t=(g|0)==0;while(1){if(t&(s|0)>1){u=p+o|0;v=c[h+(s+-2<<2)>>2]|0;if((wa[d&15](u,q)|0)>-1){w=p;x=r;y=s;z=10;break a}if((wa[d&15](u+(0-v)|0,q)|0)>-1){w=p;x=r;y=s;z=10;break a}}v=r+1|0;c[k+(r<<2)>>2]=q;u=Uc(j)|0;Rc(j,u);A=u+s|0;if(!((c[j>>2]|0)!=1|(c[e>>2]|0)!=0)){w=q;x=v;y=A;z=10;break a}u=q+(0-(c[h+(A<<2)>>2]|0))|0;if((wa[d&15](u,c[k>>2]|0)|0)<1){B=q;C=v;D=A;E=0;z=9;break}else{F=q;q=u;r=v;s=A;t=1;p=F}}}else{B=a;C=1;D=f;E=g;z=9}while(0);if((z|0)==9?(E|0)==0:0){w=B;x=C;y=D;z=10}if((z|0)==10){Wc(b,k,x);Qc(w,b,d,y,h)}l=i;return}function Tc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=a+4|0;if(b>>>0>31){e=c[a>>2]|0;c[d>>2]=e;c[a>>2]=0;f=e;g=0;h=b+-32|0}else{f=c[d>>2]|0;g=c[a>>2]|0;h=b}c[d>>2]=g>>>(32-h|0)|f<>2]=g<>2]|0)+-1|0)|0;if(!b){d=Vc(c[a+4>>2]|0)|0;return ((d|0)==0?0:d+32|0)|0}else return b|0;return 0}function Vc(a){a=a|0;var b=0,c=0,d=0;if(a)if(!(a&1)){b=0;c=a;while(1){a=b+1|0;c=c>>>1;if(c&1|0){d=a;break}else b=a}}else d=0;else d=32;return d|0}function Wc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+256|0;f=e;a:do if((d|0)>=2?(g=b+(d<<2)|0,c[g>>2]=f,a|0):0){h=f;i=a;while(1){j=i>>>0<256?i:256;md(h|0,c[b>>2]|0,j|0)|0;k=0;do{m=b+(k<<2)|0;k=k+1|0;md(c[m>>2]|0,c[b+(k<<2)>>2]|0,j|0)|0;c[m>>2]=(c[m>>2]|0)+j}while((k|0)!=(d|0));k=i-j|0;if(!k)break a;h=c[g>>2]|0;i=k}}while(0);l=e;return}function Xc(a,b){a=+a;b=b|0;var d=0.0,e=0,f=0,g=0,i=0,k=0.0;if((b|0)<=1023)if((b|0)<-1022){d=a*2.2250738585072014e-308;e=b+1022|0;f=(e|0)<-1022;g=b+2044|0;i=f?((g|0)>-1022?g:-1022):e;k=f?d*2.2250738585072014e-308:d}else{i=b;k=a}else{d=a*8988465674311579538646525.0e283;f=b+-1023|0;e=(f|0)>1023;g=b+-2046|0;i=e?((g|0)<1023?g:1023):f;k=e?d*8988465674311579538646525.0e283:d}e=jd(i+1023|0,0,52)|0;i=C;c[j>>2]=e;c[j+4>>2]=i;return +(k*+h[j>>3])}function Yc(a,b){a=+a;b=b|0;return +(+Xc(a,b))}function Zc(a){a=+a;var b=0,d=0,e=0.0,f=0.0;h[j>>3]=a;b=c[j+4>>2]|0;d=b&2146435072;if(!(d>>>0>1126170624|(d|0)==1126170624&0>0)){d=(b|0)<0;e=(d?4503599627370496.0:-4503599627370496.0)+((d?-4503599627370496.0:4503599627370496.0)+a);if(e==0.0)f=d?-0.0:0.0;else f=e}else f=a;return +f}function _c(a){a=+a;var b=0,d=0,e=0.0,f=0.0;b=(g[j>>2]=a,c[j>>2]|0);if((b&2130706432)>>>0<=1249902592){d=(b|0)<0;e=(d?8388608.0:-8388608.0)+((d?-8388608.0:8388608.0)+a);if(e==0.0)f=d?-0.0:0.0;else f=e}else f=a;return +f}function $c(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0;b=l;l=l+16|0;d=b;do if(a>>>0<245){e=a>>>0<11?16:a+11&-8;f=e>>>3;g=c[14497]|0;h=g>>>f;if(h&3|0){i=(h&1^1)+f|0;j=58028+(i<<1<<2)|0;k=j+8|0;m=c[k>>2]|0;n=m+8|0;o=c[n>>2]|0;do if((j|0)!=(o|0)){if(o>>>0<(c[14501]|0)>>>0)ja();p=o+12|0;if((c[p>>2]|0)==(m|0)){c[p>>2]=j;c[k>>2]=o;break}else ja()}else c[14497]=g&~(1<>2]=o|3;k=m+o+4|0;c[k>>2]=c[k>>2]|1;q=n;l=b;return q|0}k=c[14499]|0;if(e>>>0>k>>>0){if(h|0){o=2<>>12&16;p=o>>>j;o=p>>>5&8;r=p>>>o;p=r>>>2&4;s=r>>>p;r=s>>>1&2;t=s>>>r;s=t>>>1&1;u=(o|j|p|r|s)+(t>>>s)|0;s=58028+(u<<1<<2)|0;t=s+8|0;r=c[t>>2]|0;p=r+8|0;j=c[p>>2]|0;do if((s|0)!=(j|0)){if(j>>>0<(c[14501]|0)>>>0)ja();o=j+12|0;if((c[o>>2]|0)==(r|0)){c[o>>2]=s;c[t>>2]=j;v=g;break}else ja()}else{o=g&~(1<>2]=e|3;t=r+e|0;c[t+4>>2]=j|1;c[t+j>>2]=j;if(k|0){s=c[14502]|0;f=k>>>3;h=58028+(f<<1<<2)|0;n=1<>2]|0;if(m>>>0<(c[14501]|0)>>>0)ja();else{w=f;x=m}}else{c[14497]=v|n;w=h+8|0;x=h}c[w>>2]=s;c[x+12>>2]=s;c[s+8>>2]=x;c[s+12>>2]=h}c[14499]=j;c[14502]=t;q=p;l=b;return q|0}t=c[14498]|0;if(t){j=(t&0-t)+-1|0;h=j>>>12&16;s=j>>>h;j=s>>>5&8;n=s>>>j;s=n>>>2&4;m=n>>>s;n=m>>>1&2;f=m>>>n;m=f>>>1&1;i=c[58292+((j|h|s|n|m)+(f>>>m)<<2)>>2]|0;m=(c[i+4>>2]&-8)-e|0;f=c[i+16+(((c[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!f){y=m;z=i}else{n=f;f=m;m=i;while(1){i=(c[n+4>>2]&-8)-e|0;s=i>>>0>>0;h=s?i:f;i=s?n:m;n=c[n+16+(((c[n+16>>2]|0)==0&1)<<2)>>2]|0;if(!n){y=h;z=i;break}else{f=h;m=i}}}m=c[14501]|0;if(z>>>0>>0)ja();f=z+e|0;if(z>>>0>=f>>>0)ja();n=c[z+24>>2]|0;p=c[z+12>>2]|0;do if((p|0)==(z|0)){r=z+20|0;u=c[r>>2]|0;if(!u){i=z+16|0;h=c[i>>2]|0;if(!h){A=0;break}else{B=h;C=i}}else{B=u;C=r}while(1){r=B+20|0;u=c[r>>2]|0;if(u|0){B=u;C=r;continue}r=B+16|0;u=c[r>>2]|0;if(!u)break;else{B=u;C=r}}if(C>>>0>>0)ja();else{c[C>>2]=0;A=B;break}}else{r=c[z+8>>2]|0;if(r>>>0>>0)ja();u=r+12|0;if((c[u>>2]|0)!=(z|0))ja();i=p+8|0;if((c[i>>2]|0)==(z|0)){c[u>>2]=p;c[i>>2]=r;A=p;break}else ja()}while(0);a:do if(n|0){p=c[z+28>>2]|0;m=58292+(p<<2)|0;do if((z|0)==(c[m>>2]|0)){c[m>>2]=A;if(!A){c[14498]=t&~(1<>>0>=(c[14501]|0)>>>0){c[n+16+(((c[n+16>>2]|0)!=(z|0)&1)<<2)>>2]=A;if(!A)break a;else break}else ja();while(0);p=c[14501]|0;if(A>>>0

>>0)ja();c[A+24>>2]=n;m=c[z+16>>2]|0;do if(m|0)if(m>>>0

>>0)ja();else{c[A+16>>2]=m;c[m+24>>2]=A;break}while(0);m=c[z+20>>2]|0;if(m|0)if(m>>>0<(c[14501]|0)>>>0)ja();else{c[A+20>>2]=m;c[m+24>>2]=A;break}}while(0);if(y>>>0<16){n=y+e|0;c[z+4>>2]=n|3;t=z+n+4|0;c[t>>2]=c[t>>2]|1}else{c[z+4>>2]=e|3;c[f+4>>2]=y|1;c[f+y>>2]=y;if(k|0){t=c[14502]|0;n=k>>>3;m=58028+(n<<1<<2)|0;p=1<>2]|0;if(r>>>0<(c[14501]|0)>>>0)ja();else{D=n;E=r}}else{c[14497]=g|p;D=m+8|0;E=m}c[D>>2]=t;c[E+12>>2]=t;c[t+8>>2]=E;c[t+12>>2]=m}c[14499]=y;c[14502]=f}q=z+8|0;l=b;return q|0}else F=e}else F=e}else if(a>>>0<=4294967231){m=a+11|0;t=m&-8;p=c[14498]|0;if(p){r=0-t|0;n=m>>>8;if(n)if(t>>>0>16777215)G=31;else{m=(n+1048320|0)>>>16&8;i=n<>>16&4;u=i<>>16&2;h=14-(n|m|i)+(u<>>15)|0;G=t>>>(h+7|0)&1|h<<1}else G=0;h=c[58292+(G<<2)>>2]|0;b:do if(!h){H=r;I=0;J=0;K=81}else{i=r;u=0;m=t<<((G|0)==31?0:25-(G>>>1)|0);n=h;s=0;while(1){j=(c[n+4>>2]&-8)-t|0;if(j>>>0>>0)if(!j){L=0;M=n;N=n;K=85;break b}else{O=j;P=n}else{O=i;P=s}j=c[n+20>>2]|0;n=c[n+16+(m>>>31<<2)>>2]|0;o=(j|0)==0|(j|0)==(n|0)?u:j;j=(n|0)==0;if(j){H=O;I=o;J=P;K=81;break}else{i=O;u=o;m=m<<((j^1)&1);s=P}}}while(0);if((K|0)==81){if((I|0)==0&(J|0)==0){h=2<>>12&16;e=h>>>r;h=e>>>5&8;f=e>>>h;e=f>>>2&4;g=f>>>e;f=g>>>1&2;k=g>>>f;g=k>>>1&1;Q=c[58292+((h|r|e|f|g)+(k>>>g)<<2)>>2]|0;R=0}else{Q=I;R=J}if(!Q){S=H;T=R}else{L=H;M=Q;N=R;K=85}}if((K|0)==85)while(1){K=0;g=(c[M+4>>2]&-8)-t|0;k=g>>>0>>0;f=k?g:L;g=k?M:N;M=c[M+16+(((c[M+16>>2]|0)==0&1)<<2)>>2]|0;if(!M){S=f;T=g;break}else{L=f;N=g;K=85}}if((T|0)!=0?S>>>0<((c[14499]|0)-t|0)>>>0:0){g=c[14501]|0;if(T>>>0>>0)ja();f=T+t|0;if(T>>>0>=f>>>0)ja();k=c[T+24>>2]|0;e=c[T+12>>2]|0;do if((e|0)==(T|0)){r=T+20|0;h=c[r>>2]|0;if(!h){s=T+16|0;m=c[s>>2]|0;if(!m){U=0;break}else{V=m;W=s}}else{V=h;W=r}while(1){r=V+20|0;h=c[r>>2]|0;if(h|0){V=h;W=r;continue}r=V+16|0;h=c[r>>2]|0;if(!h)break;else{V=h;W=r}}if(W>>>0>>0)ja();else{c[W>>2]=0;U=V;break}}else{r=c[T+8>>2]|0;if(r>>>0>>0)ja();h=r+12|0;if((c[h>>2]|0)!=(T|0))ja();s=e+8|0;if((c[s>>2]|0)==(T|0)){c[h>>2]=e;c[s>>2]=r;U=e;break}else ja()}while(0);c:do if(k){e=c[T+28>>2]|0;g=58292+(e<<2)|0;do if((T|0)==(c[g>>2]|0)){c[g>>2]=U;if(!U){r=p&~(1<>>0>=(c[14501]|0)>>>0){c[k+16+(((c[k+16>>2]|0)!=(T|0)&1)<<2)>>2]=U;if(!U){X=p;break c}else break}else ja();while(0);e=c[14501]|0;if(U>>>0>>0)ja();c[U+24>>2]=k;g=c[T+16>>2]|0;do if(g|0)if(g>>>0>>0)ja();else{c[U+16>>2]=g;c[g+24>>2]=U;break}while(0);g=c[T+20>>2]|0;if(g)if(g>>>0<(c[14501]|0)>>>0)ja();else{c[U+20>>2]=g;c[g+24>>2]=U;X=p;break}else X=p}else X=p;while(0);do if(S>>>0>=16){c[T+4>>2]=t|3;c[f+4>>2]=S|1;c[f+S>>2]=S;p=S>>>3;if(S>>>0<256){k=58028+(p<<1<<2)|0;g=c[14497]|0;e=1<>2]|0;if(r>>>0<(c[14501]|0)>>>0)ja();else{Y=p;Z=r}}else{c[14497]=g|e;Y=k+8|0;Z=k}c[Y>>2]=f;c[Z+12>>2]=f;c[f+8>>2]=Z;c[f+12>>2]=k;break}k=S>>>8;if(k)if(S>>>0>16777215)_=31;else{e=(k+1048320|0)>>>16&8;g=k<>>16&4;r=g<>>16&2;p=14-(k|e|g)+(r<>>15)|0;_=S>>>(p+7|0)&1|p<<1}else _=0;p=58292+(_<<2)|0;c[f+28>>2]=_;g=f+16|0;c[g+4>>2]=0;c[g>>2]=0;g=1<<_;if(!(X&g)){c[14498]=X|g;c[p>>2]=f;c[f+24>>2]=p;c[f+12>>2]=f;c[f+8>>2]=f;break}g=S<<((_|0)==31?0:25-(_>>>1)|0);r=c[p>>2]|0;while(1){if((c[r+4>>2]&-8|0)==(S|0)){K=139;break}$=r+16+(g>>>31<<2)|0;p=c[$>>2]|0;if(!p){K=136;break}else{g=g<<1;r=p}}if((K|0)==136)if($>>>0<(c[14501]|0)>>>0)ja();else{c[$>>2]=f;c[f+24>>2]=r;c[f+12>>2]=f;c[f+8>>2]=f;break}else if((K|0)==139){g=r+8|0;p=c[g>>2]|0;e=c[14501]|0;if(p>>>0>=e>>>0&r>>>0>=e>>>0){c[p+12>>2]=f;c[g>>2]=f;c[f+8>>2]=p;c[f+12>>2]=r;c[f+24>>2]=0;break}else ja()}}else{p=S+t|0;c[T+4>>2]=p|3;g=T+p+4|0;c[g>>2]=c[g>>2]|1}while(0);q=T+8|0;l=b;return q|0}else F=t}else F=t}else F=-1;while(0);T=c[14499]|0;if(T>>>0>=F>>>0){S=T-F|0;$=c[14502]|0;if(S>>>0>15){_=$+F|0;c[14502]=_;c[14499]=S;c[_+4>>2]=S|1;c[_+S>>2]=S;c[$+4>>2]=F|3}else{c[14499]=0;c[14502]=0;c[$+4>>2]=T|3;S=$+T+4|0;c[S>>2]=c[S>>2]|1}q=$+8|0;l=b;return q|0}$=c[14500]|0;if($>>>0>F>>>0){S=$-F|0;c[14500]=S;T=c[14503]|0;_=T+F|0;c[14503]=_;c[_+4>>2]=S|1;c[T+4>>2]=F|3;q=T+8|0;l=b;return q|0}if(!(c[14615]|0)){c[14617]=4096;c[14616]=4096;c[14618]=-1;c[14619]=-1;c[14620]=0;c[14608]=0;T=d&-16^1431655768;c[d>>2]=T;c[14615]=T;aa=4096}else aa=c[14617]|0;T=F+48|0;d=F+47|0;S=aa+d|0;_=0-aa|0;aa=S&_;if(aa>>>0<=F>>>0){q=0;l=b;return q|0}X=c[14607]|0;if(X|0?(Z=c[14605]|0,Y=Z+aa|0,Y>>>0<=Z>>>0|Y>>>0>X>>>0):0){q=0;l=b;return q|0}d:do if(!(c[14608]&4)){X=c[14503]|0;e:do if(X){Y=58436;while(1){Z=c[Y>>2]|0;if(Z>>>0<=X>>>0?(ba=Y+4|0,(Z+(c[ba>>2]|0)|0)>>>0>X>>>0):0)break;Z=c[Y+8>>2]|0;if(!Z){K=163;break e}else Y=Z}r=S-$&_;if(r>>>0<2147483647){Z=ld(r|0)|0;if((Z|0)==((c[Y>>2]|0)+(c[ba>>2]|0)|0))if((Z|0)==(-1|0))ca=r;else{da=Z;ea=r;K=180;break d}else{fa=Z;ga=r;K=171}}else ca=0}else K=163;while(0);do if((K|0)==163){X=ld(0)|0;if((X|0)!=(-1|0)?(t=X,r=c[14616]|0,Z=r+-1|0,U=((Z&t|0)==0?0:(Z+t&0-r)-t|0)+aa|0,t=c[14605]|0,r=U+t|0,U>>>0>F>>>0&U>>>0<2147483647):0){Z=c[14607]|0;if(Z|0?r>>>0<=t>>>0|r>>>0>Z>>>0:0){ca=0;break}Z=ld(U|0)|0;if((Z|0)==(X|0)){da=X;ea=U;K=180;break d}else{fa=Z;ga=U;K=171}}else ca=0}while(0);do if((K|0)==171){U=0-ga|0;if(!(T>>>0>ga>>>0&(ga>>>0<2147483647&(fa|0)!=(-1|0))))if((fa|0)==(-1|0)){ca=0;break}else{da=fa;ea=ga;K=180;break d}Z=c[14617]|0;X=d-ga+Z&0-Z;if(X>>>0>=2147483647){da=fa;ea=ga;K=180;break d}if((ld(X|0)|0)==(-1|0)){ld(U|0)|0;ca=0;break}else{da=fa;ea=X+ga|0;K=180;break d}}while(0);c[14608]=c[14608]|4;ha=ca;K=178}else{ha=0;K=178}while(0);if(((K|0)==178?aa>>>0<2147483647:0)?(ca=ld(aa|0)|0,aa=ld(0)|0,ga=aa-ca|0,fa=ga>>>0>(F+40|0)>>>0,!((ca|0)==(-1|0)|fa^1|ca>>>0>>0&((ca|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){da=ca;ea=fa?ga:ha;K=180}if((K|0)==180){ha=(c[14605]|0)+ea|0;c[14605]=ha;if(ha>>>0>(c[14606]|0)>>>0)c[14606]=ha;ha=c[14503]|0;do if(ha){ga=58436;while(1){ia=c[ga>>2]|0;ka=ga+4|0;la=c[ka>>2]|0;if((da|0)==(ia+la|0)){K=190;break}fa=c[ga+8>>2]|0;if(!fa)break;else ga=fa}if(((K|0)==190?(c[ga+12>>2]&8|0)==0:0)?ha>>>0>>0&ha>>>0>=ia>>>0:0){c[ka>>2]=la+ea;fa=ha+8|0;ca=(fa&7|0)==0?0:0-fa&7;fa=ha+ca|0;aa=(c[14500]|0)+(ea-ca)|0;c[14503]=fa;c[14500]=aa;c[fa+4>>2]=aa|1;c[fa+aa+4>>2]=40;c[14504]=c[14619];break}aa=c[14501]|0;if(da>>>0>>0){c[14501]=da;ma=da}else ma=aa;aa=da+ea|0;fa=58436;while(1){if((c[fa>>2]|0)==(aa|0)){K=198;break}ca=c[fa+8>>2]|0;if(!ca)break;else fa=ca}if((K|0)==198?(c[fa+12>>2]&8|0)==0:0){c[fa>>2]=da;ga=fa+4|0;c[ga>>2]=(c[ga>>2]|0)+ea;ga=da+8|0;ca=da+((ga&7|0)==0?0:0-ga&7)|0;ga=aa+8|0;d=aa+((ga&7|0)==0?0:0-ga&7)|0;ga=ca+F|0;T=d-ca-F|0;c[ca+4>>2]=F|3;do if((d|0)!=(ha|0)){if((d|0)==(c[14502]|0)){ba=(c[14499]|0)+T|0;c[14499]=ba;c[14502]=ga;c[ga+4>>2]=ba|1;c[ga+ba>>2]=ba;break}ba=c[d+4>>2]|0;if((ba&3|0)==1){_=ba&-8;$=ba>>>3;f:do if(ba>>>0>=256){S=c[d+24>>2]|0;X=c[d+12>>2]|0;do if((X|0)==(d|0)){U=d+16|0;Z=U+4|0;r=c[Z>>2]|0;if(!r){t=c[U>>2]|0;if(!t){na=0;break}else{oa=t;pa=U}}else{oa=r;pa=Z}while(1){Z=oa+20|0;r=c[Z>>2]|0;if(r|0){oa=r;pa=Z;continue}Z=oa+16|0;r=c[Z>>2]|0;if(!r)break;else{oa=r;pa=Z}}if(pa>>>0>>0)ja();else{c[pa>>2]=0;na=oa;break}}else{Z=c[d+8>>2]|0;if(Z>>>0>>0)ja();r=Z+12|0;if((c[r>>2]|0)!=(d|0))ja();U=X+8|0;if((c[U>>2]|0)==(d|0)){c[r>>2]=X;c[U>>2]=Z;na=X;break}else ja()}while(0);if(!S)break;X=c[d+28>>2]|0;Z=58292+(X<<2)|0;do if((d|0)!=(c[Z>>2]|0))if(S>>>0>=(c[14501]|0)>>>0){c[S+16+(((c[S+16>>2]|0)!=(d|0)&1)<<2)>>2]=na;if(!na)break f;else break}else ja();else{c[Z>>2]=na;if(na|0)break;c[14498]=c[14498]&~(1<>>0>>0)ja();c[na+24>>2]=S;Z=d+16|0;U=c[Z>>2]|0;do if(U|0)if(U>>>0>>0)ja();else{c[na+16>>2]=U;c[U+24>>2]=na;break}while(0);U=c[Z+4>>2]|0;if(!U)break;if(U>>>0<(c[14501]|0)>>>0)ja();else{c[na+20>>2]=U;c[U+24>>2]=na;break}}else{U=c[d+8>>2]|0;X=c[d+12>>2]|0;S=58028+($<<1<<2)|0;do if((U|0)!=(S|0)){if(U>>>0>>0)ja();if((c[U+12>>2]|0)==(d|0))break;ja()}while(0);if((X|0)==(U|0)){c[14497]=c[14497]&~(1<<$);break}do if((X|0)==(S|0))qa=X+8|0;else{if(X>>>0>>0)ja();Z=X+8|0;if((c[Z>>2]|0)==(d|0)){qa=Z;break}ja()}while(0);c[U+12>>2]=X;c[qa>>2]=U}while(0);ra=d+_|0;sa=_+T|0}else{ra=d;sa=T}$=ra+4|0;c[$>>2]=c[$>>2]&-2;c[ga+4>>2]=sa|1;c[ga+sa>>2]=sa;$=sa>>>3;if(sa>>>0<256){ba=58028+($<<1<<2)|0;Y=c[14497]|0;S=1<<$;do if(!(Y&S)){c[14497]=Y|S;ta=ba+8|0;ua=ba}else{$=ba+8|0;Z=c[$>>2]|0;if(Z>>>0>=(c[14501]|0)>>>0){ta=$;ua=Z;break}ja()}while(0);c[ta>>2]=ga;c[ua+12>>2]=ga;c[ga+8>>2]=ua;c[ga+12>>2]=ba;break}S=sa>>>8;do if(!S)va=0;else{if(sa>>>0>16777215){va=31;break}Y=(S+1048320|0)>>>16&8;_=S<>>16&4;$=_<>>16&2;r=14-(Z|Y|_)+($<<_>>>15)|0;va=sa>>>(r+7|0)&1|r<<1}while(0);S=58292+(va<<2)|0;c[ga+28>>2]=va;ba=ga+16|0;c[ba+4>>2]=0;c[ba>>2]=0;ba=c[14498]|0;r=1<>2]=ga;c[ga+24>>2]=S;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}r=sa<<((va|0)==31?0:25-(va>>>1)|0);ba=c[S>>2]|0;while(1){if((c[ba+4>>2]&-8|0)==(sa|0)){K=265;break}wa=ba+16+(r>>>31<<2)|0;S=c[wa>>2]|0;if(!S){K=262;break}else{r=r<<1;ba=S}}if((K|0)==262)if(wa>>>0<(c[14501]|0)>>>0)ja();else{c[wa>>2]=ga;c[ga+24>>2]=ba;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}else if((K|0)==265){r=ba+8|0;S=c[r>>2]|0;_=c[14501]|0;if(S>>>0>=_>>>0&ba>>>0>=_>>>0){c[S+12>>2]=ga;c[r>>2]=ga;c[ga+8>>2]=S;c[ga+12>>2]=ba;c[ga+24>>2]=0;break}else ja()}}else{S=(c[14500]|0)+T|0;c[14500]=S;c[14503]=ga;c[ga+4>>2]=S|1}while(0);q=ca+8|0;l=b;return q|0}ga=58436;while(1){T=c[ga>>2]|0;if(T>>>0<=ha>>>0?(xa=T+(c[ga+4>>2]|0)|0,xa>>>0>ha>>>0):0)break;ga=c[ga+8>>2]|0}ga=xa+-47|0;ca=ga+8|0;T=ga+((ca&7|0)==0?0:0-ca&7)|0;ca=ha+16|0;ga=T>>>0>>0?ha:T;T=ga+8|0;d=da+8|0;aa=(d&7|0)==0?0:0-d&7;d=da+aa|0;fa=ea+-40-aa|0;c[14503]=d;c[14500]=fa;c[d+4>>2]=fa|1;c[d+fa+4>>2]=40;c[14504]=c[14619];fa=ga+4|0;c[fa>>2]=27;c[T>>2]=c[14609];c[T+4>>2]=c[14610];c[T+8>>2]=c[14611];c[T+12>>2]=c[14612];c[14609]=da;c[14610]=ea;c[14612]=0;c[14611]=T;T=ga+24|0;do{d=T;T=T+4|0;c[T>>2]=7}while((d+8|0)>>>0>>0);if((ga|0)!=(ha|0)){T=ga-ha|0;c[fa>>2]=c[fa>>2]&-2;c[ha+4>>2]=T|1;c[ga>>2]=T;d=T>>>3;if(T>>>0<256){aa=58028+(d<<1<<2)|0;S=c[14497]|0;r=1<>2]|0;if(_>>>0<(c[14501]|0)>>>0)ja();else{ya=d;za=_}}else{c[14497]=S|r;ya=aa+8|0;za=aa}c[ya>>2]=ha;c[za+12>>2]=ha;c[ha+8>>2]=za;c[ha+12>>2]=aa;break}aa=T>>>8;if(aa)if(T>>>0>16777215)Aa=31;else{r=(aa+1048320|0)>>>16&8;S=aa<>>16&4;_=S<>>16&2;d=14-(aa|r|S)+(_<>>15)|0;Aa=T>>>(d+7|0)&1|d<<1}else Aa=0;d=58292+(Aa<<2)|0;c[ha+28>>2]=Aa;c[ha+20>>2]=0;c[ca>>2]=0;S=c[14498]|0;_=1<>2]=ha;c[ha+24>>2]=d;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}_=T<<((Aa|0)==31?0:25-(Aa>>>1)|0);S=c[d>>2]|0;while(1){if((c[S+4>>2]&-8|0)==(T|0)){K=292;break}Ba=S+16+(_>>>31<<2)|0;d=c[Ba>>2]|0;if(!d){K=289;break}else{_=_<<1;S=d}}if((K|0)==289)if(Ba>>>0<(c[14501]|0)>>>0)ja();else{c[Ba>>2]=ha;c[ha+24>>2]=S;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}else if((K|0)==292){_=S+8|0;T=c[_>>2]|0;ca=c[14501]|0;if(T>>>0>=ca>>>0&S>>>0>=ca>>>0){c[T+12>>2]=ha;c[_>>2]=ha;c[ha+8>>2]=T;c[ha+12>>2]=S;c[ha+24>>2]=0;break}else ja()}}}else{T=c[14501]|0;if((T|0)==0|da>>>0>>0)c[14501]=da;c[14609]=da;c[14610]=ea;c[14612]=0;c[14506]=c[14615];c[14505]=-1;T=0;do{_=58028+(T<<1<<2)|0;c[_+12>>2]=_;c[_+8>>2]=_;T=T+1|0}while((T|0)!=32);T=da+8|0;S=(T&7|0)==0?0:0-T&7;T=da+S|0;_=ea+-40-S|0;c[14503]=T;c[14500]=_;c[T+4>>2]=_|1;c[T+_+4>>2]=40;c[14504]=c[14619]}while(0);ea=c[14500]|0;if(ea>>>0>F>>>0){da=ea-F|0;c[14500]=da;ea=c[14503]|0;ha=ea+F|0;c[14503]=ha;c[ha+4>>2]=da|1;c[ea+4>>2]=F|3;q=ea+8|0;l=b;return q|0}}c[(Lc()|0)>>2]=12;q=0;l=b;return q|0}function ad(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;if(!a)return;b=a+-8|0;d=c[14501]|0;if(b>>>0>>0)ja();e=c[a+-4>>2]|0;a=e&3;if((a|0)==1)ja();f=e&-8;g=b+f|0;a:do if(!(e&1)){h=c[b>>2]|0;if(!a)return;i=b+(0-h)|0;j=h+f|0;if(i>>>0>>0)ja();if((i|0)==(c[14502]|0)){k=g+4|0;l=c[k>>2]|0;if((l&3|0)!=3){m=i;n=i;o=j;break}c[14499]=j;c[k>>2]=l&-2;c[i+4>>2]=j|1;c[i+j>>2]=j;return}l=h>>>3;if(h>>>0<256){h=c[i+8>>2]|0;k=c[i+12>>2]|0;p=58028+(l<<1<<2)|0;if((h|0)!=(p|0)){if(h>>>0>>0)ja();if((c[h+12>>2]|0)!=(i|0))ja()}if((k|0)==(h|0)){c[14497]=c[14497]&~(1<>>0>>0)ja();p=k+8|0;if((c[p>>2]|0)==(i|0))q=p;else ja()}else q=k+8|0;c[h+12>>2]=k;c[q>>2]=h;m=i;n=i;o=j;break}h=c[i+24>>2]|0;k=c[i+12>>2]|0;do if((k|0)==(i|0)){p=i+16|0;l=p+4|0;r=c[l>>2]|0;if(!r){s=c[p>>2]|0;if(!s){t=0;break}else{u=s;v=p}}else{u=r;v=l}while(1){l=u+20|0;r=c[l>>2]|0;if(r|0){u=r;v=l;continue}l=u+16|0;r=c[l>>2]|0;if(!r)break;else{u=r;v=l}}if(v>>>0>>0)ja();else{c[v>>2]=0;t=u;break}}else{l=c[i+8>>2]|0;if(l>>>0>>0)ja();r=l+12|0;if((c[r>>2]|0)!=(i|0))ja();p=k+8|0;if((c[p>>2]|0)==(i|0)){c[r>>2]=k;c[p>>2]=l;t=k;break}else ja()}while(0);if(h){k=c[i+28>>2]|0;l=58292+(k<<2)|0;do if((i|0)==(c[l>>2]|0)){c[l>>2]=t;if(!t){c[14498]=c[14498]&~(1<>>0>=(c[14501]|0)>>>0){c[h+16+(((c[h+16>>2]|0)!=(i|0)&1)<<2)>>2]=t;if(!t){m=i;n=i;o=j;break a}else break}else ja();while(0);k=c[14501]|0;if(t>>>0>>0)ja();c[t+24>>2]=h;l=i+16|0;p=c[l>>2]|0;do if(p|0)if(p>>>0>>0)ja();else{c[t+16>>2]=p;c[p+24>>2]=t;break}while(0);p=c[l+4>>2]|0;if(p)if(p>>>0<(c[14501]|0)>>>0)ja();else{c[t+20>>2]=p;c[p+24>>2]=t;m=i;n=i;o=j;break}else{m=i;n=i;o=j}}else{m=i;n=i;o=j}}else{m=b;n=b;o=f}while(0);if(m>>>0>=g>>>0)ja();f=g+4|0;b=c[f>>2]|0;if(!(b&1))ja();if(!(b&2)){t=c[14502]|0;if((g|0)==(c[14503]|0)){d=(c[14500]|0)+o|0;c[14500]=d;c[14503]=n;c[n+4>>2]=d|1;if((n|0)!=(t|0))return;c[14502]=0;c[14499]=0;return}if((g|0)==(t|0)){t=(c[14499]|0)+o|0;c[14499]=t;c[14502]=m;c[n+4>>2]=t|1;c[m+t>>2]=t;return}t=(b&-8)+o|0;d=b>>>3;b:do if(b>>>0>=256){u=c[g+24>>2]|0;v=c[g+12>>2]|0;do if((v|0)==(g|0)){q=g+16|0;a=q+4|0;e=c[a>>2]|0;if(!e){p=c[q>>2]|0;if(!p){w=0;break}else{x=p;y=q}}else{x=e;y=a}while(1){a=x+20|0;e=c[a>>2]|0;if(e|0){x=e;y=a;continue}a=x+16|0;e=c[a>>2]|0;if(!e)break;else{x=e;y=a}}if(y>>>0<(c[14501]|0)>>>0)ja();else{c[y>>2]=0;w=x;break}}else{a=c[g+8>>2]|0;if(a>>>0<(c[14501]|0)>>>0)ja();e=a+12|0;if((c[e>>2]|0)!=(g|0))ja();q=v+8|0;if((c[q>>2]|0)==(g|0)){c[e>>2]=v;c[q>>2]=a;w=v;break}else ja()}while(0);if(u|0){v=c[g+28>>2]|0;j=58292+(v<<2)|0;do if((g|0)==(c[j>>2]|0)){c[j>>2]=w;if(!w){c[14498]=c[14498]&~(1<>>0>=(c[14501]|0)>>>0){c[u+16+(((c[u+16>>2]|0)!=(g|0)&1)<<2)>>2]=w;if(!w)break b;else break}else ja();while(0);v=c[14501]|0;if(w>>>0>>0)ja();c[w+24>>2]=u;j=g+16|0;i=c[j>>2]|0;do if(i|0)if(i>>>0>>0)ja();else{c[w+16>>2]=i;c[i+24>>2]=w;break}while(0);i=c[j+4>>2]|0;if(i|0)if(i>>>0<(c[14501]|0)>>>0)ja();else{c[w+20>>2]=i;c[i+24>>2]=w;break}}}else{i=c[g+8>>2]|0;v=c[g+12>>2]|0;u=58028+(d<<1<<2)|0;if((i|0)!=(u|0)){if(i>>>0<(c[14501]|0)>>>0)ja();if((c[i+12>>2]|0)!=(g|0))ja()}if((v|0)==(i|0)){c[14497]=c[14497]&~(1<>>0<(c[14501]|0)>>>0)ja();u=v+8|0;if((c[u>>2]|0)==(g|0))z=u;else ja()}else z=v+8|0;c[i+12>>2]=v;c[z>>2]=i}while(0);c[n+4>>2]=t|1;c[m+t>>2]=t;if((n|0)==(c[14502]|0)){c[14499]=t;return}else A=t}else{c[f>>2]=b&-2;c[n+4>>2]=o|1;c[m+o>>2]=o;A=o}o=A>>>3;if(A>>>0<256){m=58028+(o<<1<<2)|0;b=c[14497]|0;f=1<>2]|0;if(t>>>0<(c[14501]|0)>>>0)ja();else{B=o;C=t}}else{c[14497]=b|f;B=m+8|0;C=m}c[B>>2]=n;c[C+12>>2]=n;c[n+8>>2]=C;c[n+12>>2]=m;return}m=A>>>8;if(m)if(A>>>0>16777215)D=31;else{C=(m+1048320|0)>>>16&8;B=m<>>16&4;f=B<>>16&2;b=14-(m|C|B)+(f<>>15)|0;D=A>>>(b+7|0)&1|b<<1}else D=0;b=58292+(D<<2)|0;c[n+28>>2]=D;c[n+20>>2]=0;c[n+16>>2]=0;B=c[14498]|0;f=1<>>1)|0);m=c[b>>2]|0;while(1){if((c[m+4>>2]&-8|0)==(A|0)){E=124;break}F=m+16+(C>>>31<<2)|0;t=c[F>>2]|0;if(!t){E=121;break}else{C=C<<1;m=t}}if((E|0)==121)if(F>>>0<(c[14501]|0)>>>0)ja();else{c[F>>2]=n;c[n+24>>2]=m;c[n+12>>2]=n;c[n+8>>2]=n;break}else if((E|0)==124){C=m+8|0;j=c[C>>2]|0;t=c[14501]|0;if(j>>>0>=t>>>0&m>>>0>=t>>>0){c[j+12>>2]=n;c[C>>2]=n;c[n+8>>2]=j;c[n+12>>2]=m;c[n+24>>2]=0;break}else ja()}}else{c[14498]=B|f;c[b>>2]=n;c[n+24>>2]=b;c[n+12>>2]=n;c[n+8>>2]=n}while(0);n=(c[14505]|0)+-1|0;c[14505]=n;if(!n)G=58444;else return;while(1){n=c[G>>2]|0;if(!n)break;else G=n+8|0}c[14505]=-1;return}function bd(a,b){a=a|0;b=b|0;var d=0,e=0;if(a){d=R(b,a)|0;if((b|a)>>>0>65535)e=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1;else e=d}else e=0;d=$c(e)|0;if(!d)return d|0;if(!(c[d+-4>>2]&3))return d|0;id(d|0,0,e|0)|0;return d|0}function cd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;if(!a){d=$c(b)|0;return d|0}if(b>>>0>4294967231){c[(Lc()|0)>>2]=12;d=0;return d|0}e=dd(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(e|0){d=e+8|0;return d|0}e=$c(b)|0;if(!e){d=0;return d|0}f=c[a+-4>>2]|0;g=(f&-8)-((f&3|0)==0?8:4)|0;md(e|0,a|0,(g>>>0>>0?g:b)|0)|0;ad(a);d=e;return d|0}function dd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=a+4|0;e=c[d>>2]|0;f=e&-8;g=a+f|0;h=c[14501]|0;i=e&3;if(!((i|0)!=1&a>>>0>=h>>>0&a>>>0>>0))ja();j=c[g+4>>2]|0;if(!(j&1))ja();if(!i){if(b>>>0<256){k=0;return k|0}if(f>>>0>=(b+4|0)>>>0?(f-b|0)>>>0<=c[14617]<<1>>>0:0){k=a;return k|0}k=0;return k|0}if(f>>>0>=b>>>0){i=f-b|0;if(i>>>0<=15){k=a;return k|0}l=a+b|0;c[d>>2]=e&1|b|2;c[l+4>>2]=i|3;m=l+i+4|0;c[m>>2]=c[m>>2]|1;ed(l,i);k=a;return k|0}if((g|0)==(c[14503]|0)){i=(c[14500]|0)+f|0;l=i-b|0;m=a+b|0;if(i>>>0<=b>>>0){k=0;return k|0}c[d>>2]=e&1|b|2;c[m+4>>2]=l|1;c[14503]=m;c[14500]=l;k=a;return k|0}if((g|0)==(c[14502]|0)){l=(c[14499]|0)+f|0;if(l>>>0>>0){k=0;return k|0}m=l-b|0;i=e&1;if(m>>>0>15){n=a+b|0;o=n+m|0;c[d>>2]=i|b|2;c[n+4>>2]=m|1;c[o>>2]=m;p=o+4|0;c[p>>2]=c[p>>2]&-2;q=n;r=m}else{c[d>>2]=i|l|2;i=a+l+4|0;c[i>>2]=c[i>>2]|1;q=0;r=0}c[14499]=r;c[14502]=q;k=a;return k|0}if(j&2|0){k=0;return k|0}q=(j&-8)+f|0;if(q>>>0>>0){k=0;return k|0}f=q-b|0;r=j>>>3;a:do if(j>>>0>=256){i=c[g+24>>2]|0;l=c[g+12>>2]|0;do if((l|0)==(g|0)){m=g+16|0;n=m+4|0;p=c[n>>2]|0;if(!p){o=c[m>>2]|0;if(!o){s=0;break}else{t=o;u=m}}else{t=p;u=n}while(1){n=t+20|0;p=c[n>>2]|0;if(p|0){t=p;u=n;continue}n=t+16|0;p=c[n>>2]|0;if(!p)break;else{t=p;u=n}}if(u>>>0>>0)ja();else{c[u>>2]=0;s=t;break}}else{n=c[g+8>>2]|0;if(n>>>0>>0)ja();p=n+12|0;if((c[p>>2]|0)!=(g|0))ja();m=l+8|0;if((c[m>>2]|0)==(g|0)){c[p>>2]=l;c[m>>2]=n;s=l;break}else ja()}while(0);if(i|0){l=c[g+28>>2]|0;n=58292+(l<<2)|0;do if((g|0)==(c[n>>2]|0)){c[n>>2]=s;if(!s){c[14498]=c[14498]&~(1<>>0>=(c[14501]|0)>>>0){c[i+16+(((c[i+16>>2]|0)!=(g|0)&1)<<2)>>2]=s;if(!s)break a;else break}else ja();while(0);l=c[14501]|0;if(s>>>0>>0)ja();c[s+24>>2]=i;n=g+16|0;m=c[n>>2]|0;do if(m|0)if(m>>>0>>0)ja();else{c[s+16>>2]=m;c[m+24>>2]=s;break}while(0);m=c[n+4>>2]|0;if(m|0)if(m>>>0<(c[14501]|0)>>>0)ja();else{c[s+20>>2]=m;c[m+24>>2]=s;break}}}else{m=c[g+8>>2]|0;l=c[g+12>>2]|0;i=58028+(r<<1<<2)|0;if((m|0)!=(i|0)){if(m>>>0>>0)ja();if((c[m+12>>2]|0)!=(g|0))ja()}if((l|0)==(m|0)){c[14497]=c[14497]&~(1<>>0>>0)ja();i=l+8|0;if((c[i>>2]|0)==(g|0))v=i;else ja()}else v=l+8|0;c[m+12>>2]=l;c[v>>2]=m}while(0);v=e&1;if(f>>>0<16){c[d>>2]=q|v|2;e=a+q+4|0;c[e>>2]=c[e>>2]|1;k=a;return k|0}else{e=a+b|0;c[d>>2]=v|b|2;c[e+4>>2]=f|3;b=e+f+4|0;c[b>>2]=c[b>>2]|1;ed(e,f);k=a;return k|0}return 0}function ed(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=a+b|0;e=c[a+4>>2]|0;a:do if(!(e&1)){f=c[a>>2]|0;if(!(e&3))return;g=a+(0-f)|0;h=f+b|0;i=c[14501]|0;if(g>>>0>>0)ja();if((g|0)==(c[14502]|0)){j=d+4|0;k=c[j>>2]|0;if((k&3|0)!=3){l=g;m=h;break}c[14499]=h;c[j>>2]=k&-2;c[g+4>>2]=h|1;c[g+h>>2]=h;return}k=f>>>3;if(f>>>0<256){f=c[g+8>>2]|0;j=c[g+12>>2]|0;n=58028+(k<<1<<2)|0;if((f|0)!=(n|0)){if(f>>>0>>0)ja();if((c[f+12>>2]|0)!=(g|0))ja()}if((j|0)==(f|0)){c[14497]=c[14497]&~(1<>>0>>0)ja();n=j+8|0;if((c[n>>2]|0)==(g|0))o=n;else ja()}else o=j+8|0;c[f+12>>2]=j;c[o>>2]=f;l=g;m=h;break}f=c[g+24>>2]|0;j=c[g+12>>2]|0;do if((j|0)==(g|0)){n=g+16|0;k=n+4|0;p=c[k>>2]|0;if(!p){q=c[n>>2]|0;if(!q){r=0;break}else{s=q;t=n}}else{s=p;t=k}while(1){k=s+20|0;p=c[k>>2]|0;if(p|0){s=p;t=k;continue}k=s+16|0;p=c[k>>2]|0;if(!p)break;else{s=p;t=k}}if(t>>>0>>0)ja();else{c[t>>2]=0;r=s;break}}else{k=c[g+8>>2]|0;if(k>>>0>>0)ja();p=k+12|0;if((c[p>>2]|0)!=(g|0))ja();n=j+8|0;if((c[n>>2]|0)==(g|0)){c[p>>2]=j;c[n>>2]=k;r=j;break}else ja()}while(0);if(f){j=c[g+28>>2]|0;i=58292+(j<<2)|0;do if((g|0)==(c[i>>2]|0)){c[i>>2]=r;if(!r){c[14498]=c[14498]&~(1<>>0>=(c[14501]|0)>>>0){c[f+16+(((c[f+16>>2]|0)!=(g|0)&1)<<2)>>2]=r;if(!r){l=g;m=h;break a}else break}else ja();while(0);j=c[14501]|0;if(r>>>0>>0)ja();c[r+24>>2]=f;i=g+16|0;k=c[i>>2]|0;do if(k|0)if(k>>>0>>0)ja();else{c[r+16>>2]=k;c[k+24>>2]=r;break}while(0);k=c[i+4>>2]|0;if(k)if(k>>>0<(c[14501]|0)>>>0)ja();else{c[r+20>>2]=k;c[k+24>>2]=r;l=g;m=h;break}else{l=g;m=h}}else{l=g;m=h}}else{l=a;m=b}while(0);b=c[14501]|0;if(d>>>0>>0)ja();a=d+4|0;r=c[a>>2]|0;if(!(r&2)){s=c[14502]|0;if((d|0)==(c[14503]|0)){t=(c[14500]|0)+m|0;c[14500]=t;c[14503]=l;c[l+4>>2]=t|1;if((l|0)!=(s|0))return;c[14502]=0;c[14499]=0;return}if((d|0)==(s|0)){s=(c[14499]|0)+m|0;c[14499]=s;c[14502]=l;c[l+4>>2]=s|1;c[l+s>>2]=s;return}s=(r&-8)+m|0;t=r>>>3;b:do if(r>>>0>=256){o=c[d+24>>2]|0;e=c[d+12>>2]|0;do if((e|0)==(d|0)){k=d+16|0;j=k+4|0;f=c[j>>2]|0;if(!f){n=c[k>>2]|0;if(!n){u=0;break}else{v=n;w=k}}else{v=f;w=j}while(1){j=v+20|0;f=c[j>>2]|0;if(f|0){v=f;w=j;continue}j=v+16|0;f=c[j>>2]|0;if(!f)break;else{v=f;w=j}}if(w>>>0>>0)ja();else{c[w>>2]=0;u=v;break}}else{j=c[d+8>>2]|0;if(j>>>0>>0)ja();f=j+12|0;if((c[f>>2]|0)!=(d|0))ja();k=e+8|0;if((c[k>>2]|0)==(d|0)){c[f>>2]=e;c[k>>2]=j;u=e;break}else ja()}while(0);if(o|0){e=c[d+28>>2]|0;h=58292+(e<<2)|0;do if((d|0)==(c[h>>2]|0)){c[h>>2]=u;if(!u){c[14498]=c[14498]&~(1<>>0>=(c[14501]|0)>>>0){c[o+16+(((c[o+16>>2]|0)!=(d|0)&1)<<2)>>2]=u;if(!u)break b;else break}else ja();while(0);e=c[14501]|0;if(u>>>0>>0)ja();c[u+24>>2]=o;h=d+16|0;g=c[h>>2]|0;do if(g|0)if(g>>>0>>0)ja();else{c[u+16>>2]=g;c[g+24>>2]=u;break}while(0);g=c[h+4>>2]|0;if(g|0)if(g>>>0<(c[14501]|0)>>>0)ja();else{c[u+20>>2]=g;c[g+24>>2]=u;break}}}else{g=c[d+8>>2]|0;e=c[d+12>>2]|0;o=58028+(t<<1<<2)|0;if((g|0)!=(o|0)){if(g>>>0>>0)ja();if((c[g+12>>2]|0)!=(d|0))ja()}if((e|0)==(g|0)){c[14497]=c[14497]&~(1<>>0>>0)ja();o=e+8|0;if((c[o>>2]|0)==(d|0))x=o;else ja()}else x=e+8|0;c[g+12>>2]=e;c[x>>2]=g}while(0);c[l+4>>2]=s|1;c[l+s>>2]=s;if((l|0)==(c[14502]|0)){c[14499]=s;return}else y=s}else{c[a>>2]=r&-2;c[l+4>>2]=m|1;c[l+m>>2]=m;y=m}m=y>>>3;if(y>>>0<256){r=58028+(m<<1<<2)|0;a=c[14497]|0;s=1<>2]|0;if(x>>>0<(c[14501]|0)>>>0)ja();else{z=m;A=x}}else{c[14497]=a|s;z=r+8|0;A=r}c[z>>2]=l;c[A+12>>2]=l;c[l+8>>2]=A;c[l+12>>2]=r;return}r=y>>>8;if(r)if(y>>>0>16777215)B=31;else{A=(r+1048320|0)>>>16&8;z=r<>>16&4;s=z<>>16&2;a=14-(r|A|z)+(s<>>15)|0;B=y>>>(a+7|0)&1|a<<1}else B=0;a=58292+(B<<2)|0;c[l+28>>2]=B;c[l+20>>2]=0;c[l+16>>2]=0;z=c[14498]|0;s=1<>2]=l;c[l+24>>2]=a;c[l+12>>2]=l;c[l+8>>2]=l;return}s=y<<((B|0)==31?0:25-(B>>>1)|0);B=c[a>>2]|0;while(1){if((c[B+4>>2]&-8|0)==(y|0)){C=121;break}D=B+16+(s>>>31<<2)|0;a=c[D>>2]|0;if(!a){C=118;break}else{s=s<<1;B=a}}if((C|0)==118){if(D>>>0<(c[14501]|0)>>>0)ja();c[D>>2]=l;c[l+24>>2]=B;c[l+12>>2]=l;c[l+8>>2]=l;return}else if((C|0)==121){C=B+8|0;D=c[C>>2]|0;s=c[14501]|0;if(!(D>>>0>=s>>>0&B>>>0>=s>>>0))ja();c[D+12>>2]=l;c[C>>2]=l;c[l+8>>2]=D;c[l+12>>2]=B;c[l+24>>2]=0;return}}function fd(){}function gd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (C=e,a-c>>>0|0)|0}function hd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=a+c>>>0;return (C=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function id(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;d=d&255;if((e|0)>=67){while(b&3){a[b>>0]=d;b=b+1|0}g=f&-4|0;h=g-64|0;i=d|d<<8|d<<16|d<<24;while((b|0)<=(h|0)){c[b>>2]=i;c[b+4>>2]=i;c[b+8>>2]=i;c[b+12>>2]=i;c[b+16>>2]=i;c[b+20>>2]=i;c[b+24>>2]=i;c[b+28>>2]=i;c[b+32>>2]=i;c[b+36>>2]=i;c[b+40>>2]=i;c[b+44>>2]=i;c[b+48>>2]=i;c[b+52>>2]=i;c[b+56>>2]=i;c[b+60>>2]=i;b=b+64|0}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return f-e|0}function jd(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b<>>32-c;return a<>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function ld(a){a=a|0;var b=0,d=0;a=a+15&-16|0;b=c[i>>2]|0;d=b+a|0;if((a|0)>0&(d|0)<(b|0)|(d|0)<0){Z()|0;ka(12);return -1}c[i>>2]=d;if((d|0)>(Y()|0)?(X()|0)==0:0){ka(12);c[i>>2]=b;return -1}return b|0}function md(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((e|0)>=8192)return ma(b|0,d|0,e|0)|0;f=b|0;g=b+e|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}h=g&-4|0;e=h-64|0;while((b|0)<=(e|0)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];c[b+12>>2]=c[d+12>>2];c[b+16>>2]=c[d+16>>2];c[b+20>>2]=c[d+20>>2];c[b+24>>2]=c[d+24>>2];c[b+28>>2]=c[d+28>>2];c[b+32>>2]=c[d+32>>2];c[b+36>>2]=c[d+36>>2];c[b+40>>2]=c[d+40>>2];c[b+44>>2]=c[d+44>>2];c[b+48>>2]=c[d+48>>2];c[b+52>>2]=c[d+52>>2];c[b+56>>2]=c[d+56>>2];c[b+60>>2]=c[d+60>>2];b=b+64|0;d=d+64|0}while((b|0)<(h|0)){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0}}else{h=g-4|0;while((b|0)<(h|0)){a[b>>0]=a[d>>0]|0;a[b+1>>0]=a[d+1>>0]|0;a[b+2>>0]=a[d+2>>0]|0;a[b+3>>0]=a[d+3>>0]|0;b=b+4|0;d=d+4|0}}while((b|0)<(g|0)){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}return f|0}function nd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return qa[a&7](b|0,c|0,d|0,e|0)|0}function od(a,b){a=a|0;b=b|0;ra[a&7](b|0)}function pd(a,b,c){a=a|0;b=b|0;c=c|0;sa[a&3](b|0,c|0)}function qd(a,b){a=a|0;b=b|0;return ta[a&1](b|0)|0}function rd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ua[a&1](b|0,c|0,d|0)}function sd(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;return va[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)|0}function td(a,b,c){a=a|0;b=b|0;c=c|0;return wa[a&15](b|0,c|0)|0}function ud(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return xa[a&7](b|0,c|0,d|0,e|0,f|0)|0}function vd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;V(0);return 0}function wd(a){a=a|0;V(1)}function xd(a,b){a=a|0;b=b|0;V(2)}function yd(a){a=a|0;V(3);return 0}function zd(a,b,c){a=a|0;b=b|0;c=c|0;V(4)}function Ad(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;V(5);return 0}function Bd(a,b){a=a|0;b=b|0;V(6);return 0}function Cd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;V(7);return 0} + +// EMSCRIPTEN_END_FUNCS +var qa=[vd,Ta,bb,kb,qb,vd,vd,vd];var ra=[wd,Qa,Ra,_a,$a,hb,ib,zb];var sa=[xd,Na,mb,xd];var ta=[yd,Ab];var ua=[zd,xb];var va=[Ad,ob,ub,Ad];var wa=[Bd,Oa,Pa,Sa,Ya,Za,ab,fb,gb,yb,Bb,Xa,Qb,nc,Bd,Bd];var xa=[Cd,jb,nb,pb,tb,vb,Cd,Cd];return{_llvm_bswap_i32:kd,getTempRet0:Ea,setThrew:Ca,_bitshift64Shl:jd,_memset:id,_ogv_audio_decoder_process_header:Gc,_sbrk:ld,_memcpy:md,stackAlloc:ya,_i64Subtract:gd,setTempRet0:Da,_i64Add:hd,_emscripten_get_global_libc:Kc,stackSave:za,_free:ad,runPostSets:fd,_ogv_audio_decoder_destroy:Ic,_ogv_audio_decoder_init:Fc,establishStackSpace:Ba,stackRestore:Aa,_malloc:$c,_ogv_audio_decoder_process_audio:Hc,stackAlloc:ya,stackSave:za,stackRestore:Aa,establishStackSpace:Ba,setThrew:Ca,setTempRet0:Da,getTempRet0:Ea,dynCall_iiiii:nd,dynCall_vi:od,dynCall_vii:pd,dynCall_ii:qd,dynCall_viii:rd,dynCall_iiiiiiiii:sd,dynCall_iii:td,dynCall_iiiiii:ud}}) + + +// EMSCRIPTEN_END_ASM +(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var setThrew=Module["setThrew"]=asm["setThrew"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _memset=Module["_memset"]=asm["_memset"];var _ogv_audio_decoder_process_header=Module["_ogv_audio_decoder_process_header"]=asm["_ogv_audio_decoder_process_header"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _emscripten_get_global_libc=Module["_emscripten_get_global_libc"]=asm["_emscripten_get_global_libc"];var stackSave=Module["stackSave"]=asm["stackSave"];var _free=Module["_free"]=asm["_free"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var _ogv_audio_decoder_destroy=Module["_ogv_audio_decoder_destroy"]=asm["_ogv_audio_decoder_destroy"];var _ogv_audio_decoder_init=Module["_ogv_audio_decoder_init"]=asm["_ogv_audio_decoder_init"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var _malloc=Module["_malloc"]=asm["_malloc"];var _ogv_audio_decoder_process_audio=Module["_ogv_audio_decoder_process_audio"]=asm["_ogv_audio_decoder_process_audio"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=asm["dynCall_iiiiiiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];Runtime.stackAlloc=Module["stackAlloc"];Runtime.stackSave=Module["stackSave"];Runtime.stackRestore=Module["stackRestore"];Runtime.establishStackSpace=Module["establishStackSpace"];Runtime.setTempRet0=Module["setTempRet0"];Runtime.getTempRet0=Module["getTempRet0"];Module["asm"]=asm;Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=false;if(Module["noInitialRun"]){shouldRunNow=false}Module["noExitRuntime"]=true;run();var inputBuffer,inputBufferSize;function reallocInputBuffer(size){if(inputBuffer&&inputBufferSize>=size){return inputBuffer}if(inputBuffer){Module._free(inputBuffer)}inputBufferSize=size;inputBuffer=Module._malloc(inputBufferSize);return inputBuffer}var getTimestamp;if(typeof performance==="undefined"||typeof performance.now==="undefined"){getTimestamp=Date.now}else{getTimestamp=performance.now.bind(performance)}function time(func){var start=getTimestamp(),ret;ret=func();Module.cpuTime+=getTimestamp()-start;return ret}Module.loadedMetadata=!!options.audioFormat;Module.audioFormat=options.audioFormat||null;Module.audioBuffer=null;Module.cpuTime=0;Object.defineProperty(Module,"processing",{get:function getProcessing(){return false}});Module.init=(function(callback){function finish(){time((function(){Module._ogv_audio_decoder_init()}));callback()}if(Module.wasmBinary){Module.onRuntimeInitialized=(function(){finish()})}else{finish()}});Module.processHeader=(function(data,callback){var ret=time((function(){var len=data.byteLength;var buffer=reallocInputBuffer(len);Module.HEAPU8.set(new Uint8Array(data),buffer);return Module._ogv_audio_decoder_process_header(buffer,len)}));callback(ret)});Module.processAudio=(function(data,callback){var ret=time((function(){var len=data.byteLength;var buffer=reallocInputBuffer(len);Module.HEAPU8.set(new Uint8Array(data),buffer);return Module._ogv_audio_decoder_process_audio(buffer,len)}));callback(ret)});Module.close=(function(){});Math.imul=Math_imul_orig + + + + + + return OGVDecoderAudioVorbis; +}; +})(); diff --git a/data/promote.telegram.org/js/ogvjs/ogv-demuxer-ogg.js b/data/promote.telegram.org/js/ogvjs/ogv-demuxer-ogg.js new file mode 100644 index 0000000000..0d47441aa0 --- /dev/null +++ b/data/promote.telegram.org/js/ogvjs/ogv-demuxer-ogg.js @@ -0,0 +1,30 @@ +var OGVDemuxerOgg +(function() { + var scriptSrc; + if (typeof document !== 'undefined' && document.currentScript) scriptSrc = document.currentScript.src; +OGVDemuxerOgg = function(OGVDemuxerOgg) { + OGVDemuxerOgg = OGVDemuxerOgg || {}; + if (!OGVDemuxerOgg.currentScriptUrl) OGVDemuxerOgg.currentScriptUrl = scriptSrc; + var Module = OGVDemuxerOgg; + +var options=Module;Module={print:(function(str){console.log(str)})};if(typeof OGVLoader!=="undefined"){Module["pthreadMainPrefixURL"]=OGVLoader.base+"/"}if(options["memoryLimit"]&&!options.wasmBinary){Module["TOTAL_MEMORY"]=options["memoryLimit"]}for(option in options){if(options.hasOwnProperty(option)){Module[option]=options[option]}}var Math_imul_orig=Math.imul;var OGVDemuxerOgg=Module;var Module;if(!Module)Module=(typeof OGVDemuxerOgg!=="undefined"?OGVDemuxerOgg:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else if(Module["ENVIRONMENT"]==="PTHREAD"){ENVIRONMENT_IS_WORKER=true;ENVIRONMENT_IS_PTHREAD=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function shell_read(){throw"no read() available"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return xhr.response}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function shell_print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function shell_printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}if(!Module["quit"]){Module["quit"]=(function(status,toThrow){throw toThrow})}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value;return value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i>2];var end=(ret+size+15|0)&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=Runtime.stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){var __cxa_demangle_func=Module["___cxa_demangle"]||Module["__cxa_demangle"];if(__cxa_demangle_func){try{var s=func.substr(1);var len=lengthBytesUTF8(s)+1;var buf=_malloc(len);stringToUTF8(s,buf,len);var status=_malloc(4);var ret=__cxa_demangle_func(buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}return func}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];if(!Math["trunc"])Math["trunc"]=(function(x){return x<0?Math.ceil(x):Math.floor(x)});Math.trunc=Math["trunc"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=Runtime.GLOBAL_BASE;STATICTOP=STATIC_BASE+7216;__ATINIT__.push();allocate([0,0,0,0,183,29,193,4,110,59,130,9,217,38,67,13,220,118,4,19,107,107,197,23,178,77,134,26,5,80,71,30,184,237,8,38,15,240,201,34,214,214,138,47,97,203,75,43,100,155,12,53,211,134,205,49,10,160,142,60,189,189,79,56,112,219,17,76,199,198,208,72,30,224,147,69,169,253,82,65,172,173,21,95,27,176,212,91,194,150,151,86,117,139,86,82,200,54,25,106,127,43,216,110,166,13,155,99,17,16,90,103,20,64,29,121,163,93,220,125,122,123,159,112,205,102,94,116,224,182,35,152,87,171,226,156,142,141,161,145,57,144,96,149,60,192,39,139,139,221,230,143,82,251,165,130,229,230,100,134,88,91,43,190,239,70,234,186,54,96,169,183,129,125,104,179,132,45,47,173,51,48,238,169,234,22,173,164,93,11,108,160,144,109,50,212,39,112,243,208,254,86,176,221,73,75,113,217,76,27,54,199,251,6,247,195,34,32,180,206,149,61,117,202,40,128,58,242,159,157,251,246,70,187,184,251,241,166,121,255,244,246,62,225,67,235,255,229,154,205,188,232,45,208,125,236,119,112,134,52,192,109,71,48,25,75,4,61,174,86,197,57,171,6,130,39,28,27,67,35,197,61,0,46,114,32,193,42,207,157,142,18,120,128,79,22,161,166,12,27,22,187,205,31,19,235,138,1,164,246,75,5,125,208,8,8,202,205,201,12,7,171,151,120,176,182,86,124,105,144,21,113,222,141,212,117,219,221,147,107,108,192,82,111,181,230,17,98,2,251,208,102,191,70,159,94,8,91,94,90,209,125,29,87,102,96,220,83,99,48,155,77,212,45,90,73,13,11,25,68,186,22,216,64,151,198,165,172,32,219,100,168,249,253,39,165,78,224,230,161,75,176,161,191,252,173,96,187,37,139,35,182,146,150,226,178,47,43,173,138,152,54,108,142,65,16,47,131,246,13,238,135,243,93,169,153,68,64,104,157,157,102,43,144,42,123,234,148,231,29,180,224,80,0,117,228,137,38,54,233,62,59,247,237,59,107,176,243,140,118,113,247,85,80,50,250,226,77,243,254,95,240,188,198,232,237,125,194,49,203,62,207,134,214,255,203,131,134,184,213,52,155,121,209,237,189,58,220,90,160,251,216,238,224,12,105,89,253,205,109,128,219,142,96,55,198,79,100,50,150,8,122,133,139,201,126,92,173,138,115,235,176,75,119,86,13,4,79,225,16,197,75,56,54,134,70,143,43,71,66,138,123,0,92,61,102,193,88,228,64,130,85,83,93,67,81,158,59,29,37,41,38,220,33,240,0,159,44,71,29,94,40,66,77,25,54,245,80,216,50,44,118,155,63,155,107,90,59,38,214,21,3,145,203,212,7,72,237,151,10,255,240,86,14,250,160,17,16,77,189,208,20,148,155,147,25,35,134,82,29,14,86,47,241,185,75,238,245,96,109,173,248,215,112,108,252,210,32,43,226,101,61,234,230,188,27,169,235,11,6,104,239,182,187,39,215,1,166,230,211,216,128,165,222,111,157,100,218,106,205,35,196,221,208,226,192,4,246,161,205,179,235,96,201,126,141,62,189,201,144,255,185,16,182,188,180,167,171,125,176,162,251,58,174,21,230,251,170,204,192,184,167,123,221,121,163,198,96,54,155,113,125,247,159,168,91,180,146,31,70,117,150,26,22,50,136,173,11,243,140,116,45,176,129,195,48,113,133,153,144,138,93,46,141,75,89,247,171,8,84,64,182,201,80,69,230,142,78,242,251,79,74,43,221,12,71,156,192,205,67,33,125,130,123,150,96,67,127,79,70,0,114,248,91,193,118,253,11,134,104,74,22,71,108,147,48,4,97,36,45,197,101,233,75,155,17,94,86,90,21,135,112,25,24,48,109,216,28,53,61,159,2,130,32,94,6,91,6,29,11,236,27,220,15,81,166,147,55,230,187,82,51,63,157,17,62,136,128,208,58,141,208,151,36,58,205,86,32,227,235,21,45,84,246,212,41,121,38,169,197,206,59,104,193,23,29,43,204,160,0,234,200,165,80,173,214,18,77,108,210,203,107,47,223,124,118,238,219,193,203,161,227,118,214,96,231,175,240,35,234,24,237,226,238,29,189,165,240,170,160,100,244,115,134,39,249,196,155,230,253,9,253,184,137,190,224,121,141,103,198,58,128,208,219,251,132,213,139,188,154,98,150,125,158,187,176,62,147,12,173,255,151,177,16,176,175,6,13,113,171,223,43,50,166,104,54,243,162,109,102,180,188,218,123,117,184,3,93,54,181,180,64,247,177,229,9,0,0,7,0,0,0,237,9,0,0,1,0,0,0,1,0,0,0,2,0,0,0,244,9,0,0,7,0,0,0,252,9,0,0,3,0,0,0,2,0,0,0,4,0,0,0,3,10,0,0,5,0,0,0,3,10,0,0,5,0,0,0,3,0,0,0,0,0,0,0,9,10,0,0,8,0,0,0,18,10,0,0,6,0,0,0,0,0,0,0,0,0,0,0,22,10,0,0,8,0,0,0,31,10,0,0,7,0,0,0,0,0,0,0,0,0,0,0,36,10,0,0,7,0,0,0,36,10,0,0,8,0,0,0,0,0,0,0,0,0,0,0,44,10,0,0,7,0,0,0,52,10,0,0,9,0,0,0,0,0,0,0,0,0,0,0,61,10,0,0,4,0,0,0,66,10,0,0,10,0,0,0,4,0,0,0,0,0,0,0,72,10,0,0,5,0,0,0,78,10,0,0,11,0,0,0,4,0,0,0,0,0,0,0,83,10,0,0,7,0,0,0,83,10,0,0,12,0,0,0,0,0,0,0,0,0,0,0,91,10,0,0,8,0,0,0,100,10,0,0,13,0,0,0,5,0,0,0,0,0,0,0,105,10,0,0,8,0,0,0,114,10,0,0,14,0,0,0,0,0,0,0,0,0,0,0,119,10,0,0,5,0,0,0,125,10,0,0,15,0,0,0,0,0,0,0,0,0,0,0,131,10,0,0,8,0,0,0,140,10,0,0,16,0,0,0,6,0,0,0,17,0,0,0,145,10,0,0,5,0,0,0,151,10,0,0,18,0,0,0,7,0,0,0,0,0,0,0,36,24,0,0,0,0,0,0,155,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,1,0,0,192,3,0,0,128,7,0,0,64,11,0,0,224,1,0,0,192,3,0,0,128,7,0,0,64,11,0,0,224,1,0,0,192,3,0,0,128,7,0,0,64,11,0,0,224,1,0,0,192,3,0,0,224,1,0,0,192,3,0,0,120,0,0,0,240,0,0,0,224,1,0,0,192,3,0,0,120,0,0,0,240,0,0,0,224,1,0,0,192,3,0,0,120,0,0,0,240,0,0,0,224,1,0,0,192,3,0,0,120,0,0,0,240,0,0,0,224,1,0,0,192,3,0,0,128,2,0,0,204,1,0,0,24,0,0,0,1,0,0,0,176,0,0,0,120,0,0,0,96,1,0,0,240,0,0,0,96,1,0,0,32,1,0,0,192,2,0,0,224,1,0,0,192,2,0,0,64,2,0,0,208,2,0,0,224,1,0,0,208,2,0,0,64,2,0,0,0,5,0,0,208,2,0,0,0,5,0,0,208,2,0,0,128,7,0,0,56,4,0,0,128,7,0,0,56,4,0,0,128,7,0,0,56,4,0,0,128,7,0,0,56,4,0,0,0,8,0,0,56,4,0,0,0,16,0,0,112,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,9,0,0,0,10,0,0,0,9,0,0,0,10,0,0,0,9,0,0,0,10,0,0,0,4,0,0,0,3,0,0,0,7,0,0,0,6,0,0,0,4,0,0,0,3,0,0,0,7,0,0,0,6,0,0,0,2,0,0,0,2,0,0,0,7,0,0,0,6,0,0,0,7,0,0,0,6,0,0,0,1,0,0,0,1,0,0,0,192,93,0,0,233,3,0,0,24,0,0,0,1,0,0,0,25,0,0,0,1,0,0,0,48,117,0,0,233,3,0,0,30,0,0,0,1,0,0,0,50,0,0,0,1,0,0,0,96,234,0,0,233,3,0,0,60,0,0,0,1,0,0,0,152,58,0,0,233,3,0,0,25,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,7,0,0,0,15,0,0,0,31,0,0,0,63,0,0,0,127,0,0,0,255,0,0,0,255,1,0,0,255,3,0,0,255,7,0,0,255,15,0,0,255,31,0,0,255,63,0,0,255,127,0,0,255,255,0,0,255,255,1,0,255,255,3,0,255,255,7,0,255,255,15,0,255,255,31,0,255,255,63,0,255,255,127,0,255,255,255,0,255,255,255,1,255,255,255,3,255,255,255,7,255,255,255,15,255,255,255,31,255,255,255,63,255,255,255,127,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,9,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,45,24,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,9,0,0,79,103,103,83,0,128,116,104,101,111,114,97,0,84,104,101,111,114,97,0,1,118,111,114,98,105,115,0,86,111,114,98,105,115,0,83,112,101,101,120,0,80,67,77,32,32,32,32,32,0,80,67,77,0,67,77,77,76,0,0,0,0,0,67,77,77,76,0,65,110,110,111,100,101,120,0,102,105,115,104,101,97,100,0,83,107,101,108,101,116,111,110,0,102,76,97,67,0,70,108,97,99,48,0,127,70,76,65,67,0,70,108,97,99,0,65,110,120,68,97,116,97,0,67,69,76,84,32,32,32,32,0,67,69,76,84,0,128,107,97,116,101,0,0,0,0,75,97,116,101,0,66,66,67,68,0,0,68,105,114,97,99,0,79,112,117,115,72,101,97,100,0,79,112,117,115,0,79,86,80,56,48,0,86,80,56,0,85,110,107,110,111,119,110,0,86,80,56,48,0,3,118,111,114,98,105,115,0,129,116,104,101,111,114,97,0,129,107,97,116,101,0,0,0,0,79,112,117,115,84,97,103,115,0,79,86,80,56,48,2,32,0,102,105,115,98,111,110,101,0,0,102,105,115,104,101,97,100,0,0,105,110,100,101,120,0,0,66,117,102,102,101,114,32,115,101,101,107,32,102,97,105,108,117,114,101,32,105,110,32,111,103,103,32,100,101,109,117,120,101,114,59,32,37,108,108,100,32,40,37,108,100,32,37,100,41,10,0,116,104,101,111,114,97,0,118,111,114,98,105,115,0,111,112,117,115,0,73,110,118,97,108,105,100,32,111,103,103,32,115,107,101,108,101,116,111,110,32,116,114,97,99,107,32,100,97,116,97,63,32,37,100,10,0,73,110,118,97,108,105,100,32,115,116,97,116,101,32,105,110,32,79,103,103,32,114,101,97,100,80,97,99,107,101,116,67,97,108,108,98,97,99,107,0,69,114,114,111,114,32,112,114,111,99,101,115,115,105,110,103,32,115,107,101,108,101,116,111,110,32,112,97,99,107,101,116,58,32,37,100,10,0,69,114,114,111,114,32,37,100,32,102,114,111,109,32,111,103,103,122,95,114,101,97,100,10,0,70,97,105,108,101,100,32,116,111,32,39,115,101,101,107,39,32,111,103,103,122,32,37,100,10,0,116,114,121,105,110,103,32,116,111,32,115,101,101,107,32,116,111,32,37,108,108,100,10,0,102,97,105,108,101,100,32,98,113,95,114,101,97,100,32,108,101,110,32,37,100,32,97,116,32,112,111,115,32,37,108,108,100,10,0,102,97,105,108,101,100,32,97,32,98,113,95,114,101,97,100,32,108,101,110,32,37,100,32,97,116,32,112,111,115,32,37,108,108,100,10,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);var tempDoublePtr=STATICTOP;STATICTOP+=16;Module["_bitshift64Ashr"]=_bitshift64Ashr;function _ogvjs_callback_loaded_metadata(videoCodecStr,audioCodecStr){if(videoCodecStr){Module.videoCodec=Module.Pointer_stringify(videoCodecStr)}if(audioCodecStr){Module.audioCodec=Module.Pointer_stringify(audioCodecStr)}var len=Module._ogv_demuxer_media_duration();if(len>=0){Module.duration=len}else{Module.duration=NaN}Module.loadedMetadata=true}Module["_i64Subtract"]=_i64Subtract;Module["_i64Add"]=_i64Add;Module["_memset"]=_memset;Module["_bitshift64Lshr"]=_bitshift64Lshr;Module["_bitshift64Shl"]=_bitshift64Shl;function _abort(){Module["abort"]()}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);Module["_llvm_cttz_i32"]=_llvm_cttz_i32;Module["___udivmoddi4"]=___udivmoddi4;Module["___divdi3"]=___divdi3;var SYSCALLS={varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall3(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.read(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___lock(){}function ___unlock(){}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["___udivdi3"]=___udivdi3;Module["___muldsi3"]=___muldsi3;Module["___muldi3"]=___muldi3;function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}Module["_sbrk"]=_sbrk;function _ogvjs_callback_audio_packet(buffer,len,audioTimestamp){Module.audioPackets.push({data:Module.HEAPU8.buffer.slice?Module.HEAPU8.buffer.slice(buffer,buffer+len):(new Uint8Array(new Uint8Array(Module.HEAPU8.buffer,buffer,len))).buffer,timestamp:audioTimestamp})}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;Module["_memmove"]=_memmove;function _ogvjs_callback_video_packet(buffer,len,frameTimestamp,keyframeTimestamp,isKeyframe){Module.videoPackets.push({data:Module.HEAPU8.buffer.slice?Module.HEAPU8.buffer.slice(buffer,buffer+len):(new Uint8Array(new Uint8Array(Module.HEAPU8.buffer,buffer,len))).buffer,timestamp:frameTimestamp,keyframeTimestamp:keyframeTimestamp,isKeyframe:!!isKeyframe})}Module["___uremdi3"]=___uremdi3;Module["_llvm_bswap_i32"]=_llvm_bswap_i32;function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;assert(offset_high===0);FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffer){___syscall146.buffers=[null,[],[]];___syscall146.printChar=(function(stream,curr){var buffer=___syscall146.buffers[stream];assert(buffer);if(curr===0||curr===10){(stream===1?Module["print"]:Module["printErr"])(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}})}for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=DYNAMIC_BASE;staticSealed=true;function invoke_iiii(index,a1,a2,a3){try{return Module["dynCall_iiii"](index,a1,a2,a3)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_vi(index,a1){try{Module["dynCall_vi"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_ii(index,a1){try{return Module["dynCall_ii"](index,a1)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iiiii(index,a1,a2,a3,a4){try{return Module["dynCall_iiiii"](index,a1,a2,a3,a4)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iii(index,a1,a2){try{return Module["dynCall_iii"](index,a1,a2)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){try{return Module["dynCall_iiiiii"](index,a1,a2,a3,a4,a5)}catch(e){if(typeof e!=="number"&&e!=="longjmp")throw e;Module["setThrew"](1,0)}}Module.asmGlobalArg={"Math":Math,"Int8Array":Int8Array,"Int16Array":Int16Array,"Int32Array":Int32Array,"Uint8Array":Uint8Array,"Uint16Array":Uint16Array,"Uint32Array":Uint32Array,"Float32Array":Float32Array,"Float64Array":Float64Array,"NaN":NaN,"Infinity":Infinity};Module.asmLibraryArg={"abort":abort,"assert":assert,"enlargeMemory":enlargeMemory,"getTotalMemory":getTotalMemory,"abortOnCannotGrowMemory":abortOnCannotGrowMemory,"invoke_iiii":invoke_iiii,"invoke_vi":invoke_vi,"invoke_ii":invoke_ii,"invoke_iiiii":invoke_iiiii,"invoke_iii":invoke_iii,"invoke_iiiiii":invoke_iiiiii,"_ogvjs_callback_loaded_metadata":_ogvjs_callback_loaded_metadata,"___syscall3":___syscall3,"___lock":___lock,"___syscall6":___syscall6,"___setErrNo":___setErrNo,"_abort":_abort,"___unlock":___unlock,"_emscripten_memcpy_big":_emscripten_memcpy_big,"___syscall54":___syscall54,"_ogvjs_callback_audio_packet":_ogvjs_callback_audio_packet,"___syscall140":___syscall140,"___syscall146":___syscall146,"_ogvjs_callback_video_packet":_ogvjs_callback_video_packet,"DYNAMICTOP_PTR":DYNAMICTOP_PTR,"tempDoublePtr":tempDoublePtr,"ABORT":ABORT,"STACKTOP":STACKTOP,"STACK_MAX":STACK_MAX,"cttz_i8":cttz_i8};// EMSCRIPTEN_START_ASM +var asm=(function(global,env,buffer) { +"use asm";var a=new global.Int8Array(buffer);var b=new global.Int16Array(buffer);var c=new global.Int32Array(buffer);var d=new global.Uint8Array(buffer);var e=new global.Uint16Array(buffer);var f=new global.Uint32Array(buffer);var g=new global.Float32Array(buffer);var h=new global.Float64Array(buffer);var i=env.DYNAMICTOP_PTR|0;var j=env.tempDoublePtr|0;var k=env.ABORT|0;var l=env.STACKTOP|0;var m=env.STACK_MAX|0;var n=env.cttz_i8|0;var o=0;var p=0;var q=0;var r=0;var s=global.NaN,t=global.Infinity;var u=0,v=0,w=0,x=0,y=0.0,z=0,A=0,B=0,C=0.0;var D=0;var E=global.Math.floor;var F=global.Math.abs;var G=global.Math.sqrt;var H=global.Math.pow;var I=global.Math.cos;var J=global.Math.sin;var K=global.Math.tan;var L=global.Math.acos;var M=global.Math.asin;var N=global.Math.atan;var O=global.Math.atan2;var P=global.Math.exp;var Q=global.Math.log;var R=global.Math.ceil;var S=global.Math.imul;var T=global.Math.min;var U=global.Math.max;var V=global.Math.clz32;var W=env.abort;var X=env.assert;var Y=env.enlargeMemory;var Z=env.getTotalMemory;var _=env.abortOnCannotGrowMemory;var $=env.invoke_iiii;var aa=env.invoke_vi;var ba=env.invoke_ii;var ca=env.invoke_iiiii;var da=env.invoke_iii;var ea=env.invoke_iiiiii;var fa=env._ogvjs_callback_loaded_metadata;var ga=env.___syscall3;var ha=env.___lock;var ia=env.___syscall6;var ja=env.___setErrNo;var ka=env._abort;var la=env.___unlock;var ma=env._emscripten_memcpy_big;var na=env.___syscall54;var oa=env._ogvjs_callback_audio_packet;var pa=env.___syscall140;var qa=env.___syscall146;var ra=env._ogvjs_callback_video_packet;var sa=0.0; +// EMSCRIPTEN_START_FUNCS +function za(a){a=a|0;var b=0;b=l;l=l+a|0;l=l+15&-16;return b|0}function Aa(){return l|0}function Ba(a){a=a|0;l=a}function Ca(a,b){a=a|0;b=b|0;l=a;m=b}function Da(a,b){a=a|0;b=b|0;if(!o){o=a;p=b}}function Ea(a){a=a|0;D=a}function Fa(){return D|0}function Ga(b){b=b|0;return a[(c[b>>2]|0)+5>>0]&1|0}function Ha(b){b=b|0;return a[(c[b>>2]|0)+5>>0]&2|0}function Ia(a){a=a|0;var b=0,e=0;b=c[a>>2]|0;a=Of(d[b+13>>0]|0|0,0,8)|0;e=Of(a|(d[b+12>>0]|0)|0,D|0,8)|0;a=Of(e|(d[b+11>>0]|0)|0,D|0,8)|0;e=Of(a|(d[b+10>>0]|0)|0,D|0,8)|0;a=Of(e|(d[b+9>>0]|0)|0,D|0,8)|0;e=Of(a|(d[b+8>>0]|0)|0,D|0,8)|0;a=Of(e|(d[b+7>>0]|0)|0,D|0,8)|0;return a|(d[b+6>>0]|0)|0}function Ja(a){a=a|0;var b=0;b=c[a>>2]|0;return (d[b+15>>0]|0)<<8|(d[b+14>>0]|0)|(d[b+16>>0]|0)<<16|(d[b+17>>0]|0)<<24|0}function Ka(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!a){d=-1;return d|0}Mf(a+8|0,0,352)|0;c[a+4>>2]=16384;c[a+24>>2]=1024;e=Cf(16384)|0;c[a>>2]=e;f=Cf(4096)|0;g=a+16|0;c[g>>2]=f;h=Cf(8192)|0;i=a+20|0;c[i>>2]=h;do if(!e){j=f;k=f}else{if((h|0)==0|(f|0)==0){Df(e);l=c[g>>2]|0;j=l;k=l;break}c[a+336>>2]=b;d=0;return d|0}while(0);if(j|0)Df(k);k=c[i>>2]|0;if(k|0)Df(k);Mf(a|0,0,360)|0;d=-1;return d|0}function La(a){a=a|0;var b=0;if(!a)return 0;b=c[a>>2]|0;if(b|0)Df(b);b=c[a+16>>2]|0;if(b|0)Df(b);b=c[a+20>>2]|0;if(b|0)Df(b);Mf(a|0,0,360)|0;return 0}function Ma(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=a+24|0;e=c[d>>2]|0;if((e-b|0)>(c[a+28>>2]|0)){f=0;return f|0}if((e|0)>(2147483647-b|0)){g=c[a>>2]|0;if(g|0)Df(g);g=c[a+16>>2]|0;if(g|0)Df(g);g=c[a+20>>2]|0;if(g|0)Df(g);Mf(a|0,0,360)|0;f=-1;return f|0}g=e+b|0;b=(g|0)<2147483615?g+32|0:g;g=a+16|0;e=Ff(c[g>>2]|0,b<<2)|0;if(!e){h=c[a>>2]|0;if(h|0)Df(h);h=c[g>>2]|0;if(h|0)Df(h);h=c[a+20>>2]|0;if(h|0)Df(h);Mf(a|0,0,360)|0;f=-1;return f|0}c[g>>2]=e;e=a+20|0;h=Ff(c[e>>2]|0,b<<3)|0;if(h|0){c[e>>2]=h;c[d>>2]=b;f=0;return f|0}b=c[a>>2]|0;if(b|0)Df(b);b=c[g>>2]|0;if(b|0)Df(b);b=c[e>>2]|0;if(b|0)Df(b);Mf(a|0,0,360)|0;f=-1;return f|0}function Na(a){a=a|0;if(!a)return 0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;return 0}function Oa(a){a=a|0;var b=0;if(!a)return 0;b=c[a>>2]|0;if(b|0)Df(b);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;return 0}function Pa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=a+4|0;e=c[d>>2]|0;if((e|0)<=-1){f=0;return f|0}g=a+12|0;h=c[g>>2]|0;i=a+8|0;if(!h)j=e;else{k=(c[i>>2]|0)-h|0;c[i>>2]=k;if((k|0)>0){l=c[a>>2]|0;Xf(l|0,l+h|0,k|0)|0;m=c[d>>2]|0}else m=e;c[g>>2]=0;j=m}m=c[i>>2]|0;do if((j-m|0)<(b|0)){g=b+4096+m|0;e=c[a>>2]|0;if(!e)n=Cf(g)|0;else n=Ff(e,g)|0;if(n|0){c[a>>2]=n;c[d>>2]=g;o=n;p=c[i>>2]|0;break}g=c[a>>2]|0;if(g|0)Df(g);c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;c[a+24>>2]=0;f=0;return f|0}else{o=c[a>>2]|0;p=m}while(0);f=o+p|0;return f|0}function Qa(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=c[a+4>>2]|0;if((d|0)<=-1){e=-1;return e|0}f=a+8|0;a=(c[f>>2]|0)+b|0;if((a|0)>(d|0)){e=-1;return e|0}c[f>>2]=a;e=0;return e|0}function Ra(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;f=l;l=l+16|0;g=f;h=c[b>>2]|0;i=b+12|0;j=c[i>>2]|0;k=h+j|0;m=b+8|0;n=(c[m>>2]|0)-j|0;if((c[b+4>>2]|0)<=-1){o=0;l=f;return o|0}j=b+20|0;p=c[j>>2]|0;do if(!p){if((n|0)<27){o=0;l=f;return o|0}if(De(k,2528,4)|0){q=h;r=b+24|0;break}s=k+26|0;t=a[s>>0]|0;u=(t&255)+27|0;if((n|0)<(u|0)){o=0;l=f;return o|0}if(t<<24>>24){t=b+24|0;v=c[t>>2]|0;w=0;do{v=v+(d[k+(w+27)>>0]|0)|0;c[t>>2]=v;w=w+1|0}while((w|0)<(d[s>>0]|0|0))}c[j>>2]=u;x=u;y=11}else{x=p;y=11}while(0);do if((y|0)==11){p=b+24|0;if((x+(c[p>>2]|0)|0)>(n|0)){o=0;l=f;return o|0}h=k+22|0;s=d[h>>0]|d[h+1>>0]<<8|d[h+2>>0]<<16|d[h+3>>0]<<24;c[g>>2]=s;a[h>>0]=0;a[h+1>>0]=0;a[h+2>>0]=0;a[h+3>>0]=0;w=c[j>>2]|0;v=k+w|0;t=c[p>>2]|0;z=k+23|0;A=k+24|0;B=k+25|0;a[h>>0]=0;a[h+1>>0]=0;a[h+2>>0]=0;a[h+3>>0]=0;if((w|0)>0){C=0;D=0;while(1){E=c[8+(((d[k+D>>0]|0)^C>>>24)<<2)>>2]^C<<8;D=D+1|0;if((D|0)==(w|0)){F=E;break}else C=E}}else F=0;C=F>>>24;if((t|0)>0){w=F;D=0;u=C;while(1){E=c[8+(((d[v+D>>0]|0)^u)<<2)>>2]^w<<8;D=D+1|0;G=E>>>24;if((D|0)==(t|0)){H=E;I=G;break}else{w=E;u=G}}}else{H=F;I=C}a[h>>0]=H;a[z>>0]=H>>>8;a[A>>0]=H>>>16;a[B>>0]=I;if(De(g,h,4)|0){a[h>>0]=s;a[h+1>>0]=s>>8;a[h+2>>0]=s>>16;a[h+3>>0]=s>>24;q=c[b>>2]|0;r=p;break}u=c[i>>2]|0;w=(c[b>>2]|0)+u|0;t=c[j>>2]|0;D=c[p>>2]|0;if(e|0){c[e>>2]=w;c[e+4>>2]=t;c[e+8>>2]=w+t;c[e+12>>2]=D}c[b+16>>2]=0;w=D+t|0;c[i>>2]=w+u;c[j>>2]=0;c[p>>2]=0;o=w;l=f;return o|0}while(0);c[j>>2]=0;c[r>>2]=0;r=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-u;z=b+32|0;c[z>>2]=(c[z>>2]|0)-u;c[t>>2]=0}if(e<<24>>24?1:(i|0)!=(c[b+336>>2]|0)){r=-1;return r|0}if(Ma(b,q+1|0)|0){r=-1;return r|0}i=b+340|0;e=c[i>>2]|0;if((o|0)!=(e|0)){t=b+32|0;u=c[t>>2]|0;z=b+28|0;v=c[z>>2]|0;if((u|0)<(v|0)){w=c[b+16>>2]|0;y=b+8|0;s=u;x=c[y>>2]|0;do{x=x-(c[w+(s<<2)>>2]&255)|0;s=s+1|0}while((s|0)<(v|0));c[y>>2]=x}c[z>>2]=u;if((e|0)!=-1){e=c[b+16>>2]|0;x=u+1|0;c[z>>2]=x;c[e+(u<<2)>>2]=1024;c[t>>2]=x}}a:do if(j<<24>>24){x=c[b+28>>2]|0;if((x|0)>=1?(c[(c[b+16>>2]|0)+(x+-1<<2)>>2]|0)!=1024:0){A=g;B=h;C=k;E=0;break}if(!(p<<24>>24)){A=g;B=h;C=0;E=0}else{x=g;t=h;u=0;while(1){e=a[f+(u+27)>>0]|0;z=e&255;y=x+z|0;v=t-z|0;z=e<<24>>24==-1;e=((z^1)&1)+u|0;if(!z){A=y;B=v;C=0;E=e;break a}z=e+1|0;if((z|0)<(q|0)){x=y;t=v;u=z}else{A=y;B=v;C=0;E=z;break}}}}else{A=g;B=h;C=k;E=0}while(0);if(B|0){k=b+4|0;h=c[k>>2]|0;g=b+8|0;p=c[g>>2]|0;do if((h-B|0)>(p|0)){F=c[b>>2]|0;G=p}else{if((h|0)>(2147483647-B|0)){j=c[b>>2]|0;if(j|0)Df(j);j=c[b+16>>2]|0;if(j|0)Df(j);j=c[b+20>>2]|0;if(j|0)Df(j);Mf(b|0,0,360)|0;r=-1;return r|0}j=h+B|0;u=(j|0)<2147482623?j+1024|0:j;j=Ff(c[b>>2]|0,u)|0;if(j|0){c[k>>2]=u;c[b>>2]=j;F=j;G=c[g>>2]|0;break}j=c[b>>2]|0;if(j|0)Df(j);j=c[b+16>>2]|0;if(j|0)Df(j);j=c[b+20>>2]|0;if(j|0)Df(j);Mf(b|0,0,360)|0;r=-1;return r|0}while(0);Wf(F+G|0,A|0,B|0)|0;c[g>>2]=(c[g>>2]|0)+B}B=b+16|0;g=b+28|0;A=b+20|0;G=b+32|0;F=C;C=-1;k=E;b:while(1){E=F;h=k;while(1){if((h|0)>=(q|0))break b;p=a[f+(h+27)>>0]|0;j=p&255;H=c[g>>2]|0;u=(c[B>>2]|0)+(H<<2)|0;c[u>>2]=j;t=(c[A>>2]|0)+(H<<3)|0;c[t>>2]=-1;c[t+4>>2]=-1;if(E|0)c[u>>2]=j|256;I=H+1|0;c[g>>2]=I;h=h+1|0;if(p<<24>>24!=-1)break;else E=0}c[G>>2]=I;F=0;C=H;k=h}if((C|0)!=-1){k=(c[A>>2]|0)+(C<<3)|0;c[k>>2]=n;c[k+4>>2]=m}if(l<<24>>24?(c[b+328>>2]=1,b=c[g>>2]|0,(b|0)>0):0){g=(c[B>>2]|0)+(b+-1<<2)|0;c[g>>2]=c[g>>2]|512}c[i>>2]=o+1;r=0;return r|0}function Ta(a){a=a|0;var b=0,d=0;if((c[a+4>>2]|0)<=-1){b=-1;return b|0}d=a+8|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;b=0;return b|0}function Ua(a){a=a|0;var b=0,d=0;if(!a){b=-1;return b|0}if(!(c[a>>2]|0)){b=-1;return b|0}c[a+8>>2]=0;c[a+12>>2]=0;c[a+28>>2]=0;c[a+32>>2]=0;c[a+36>>2]=0;c[a+324>>2]=0;c[a+328>>2]=0;c[a+332>>2]=0;c[a+340>>2]=-1;d=a+344|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;b=0;return b|0}function Va(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;if(!a){d=0;return d|0}e=c[a>>2]|0;if(!e){d=0;return d|0}f=a+36|0;g=c[f>>2]|0;if((c[a+32>>2]|0)<=(g|0)){d=0;return d|0}h=c[a+16>>2]|0;i=c[h+(g<<2)>>2]|0;if(i&1024|0){c[f>>2]=g+1;j=a+344|0;k=j;l=Lf(c[k>>2]|0,c[k+4>>2]|0,1,0)|0;k=j;c[k>>2]=l;c[k+4>>2]=D;d=-1;return d|0}k=(b|0)==0;l=i&255;j=i&512;m=i&256;if((l|0)==255){i=255;n=j;o=g;while(1){p=o+1|0;q=c[h+(p<<2)>>2]|0;r=q&255;s=(q&512|0)==0?n:512;q=r+i|0;if((r|0)==255){i=q;n=s;o=p}else{t=q;u=s;v=p;break}}}else{t=l;u=j;v=g}if(k){k=a+12|0;g=a+344|0;j=g;w=c[k>>2]|0;x=c[j>>2]|0;y=c[j+4>>2]|0;z=k;A=g}else{c[b+12>>2]=u;c[b+8>>2]=m;m=a+12|0;u=c[m>>2]|0;c[b>>2]=e+u;e=a+344|0;g=e;k=c[g>>2]|0;j=c[g+4>>2]|0;g=b+24|0;c[g>>2]=k;c[g+4>>2]=j;g=(c[a+20>>2]|0)+(v<<3)|0;a=c[g+4>>2]|0;l=b+16|0;c[l>>2]=c[g>>2];c[l+4>>2]=a;c[b+4>>2]=t;w=u;x=k;y=j;z=m;A=e}c[z>>2]=w+t;c[f>>2]=v+1;v=Lf(x|0,y|0,1,0)|0;y=A;c[y>>2]=v;c[y+4>>2]=D;d=1;return d|0}function Wa(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;i=l;l=l+48|0;j=i+40|0;k=i+36|0;m=i+32|0;n=i+28|0;o=i+24|0;p=i+16|0;q=i+12|0;r=i+8|0;s=i+4|0;t=i+44|0;u=i;c[k>>2]=b;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[i+20>>2]=h;c[p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=(c[k>>2]|0)+488|0;g=c[q>>2]|0;if((c[m>>2]|0)==-1?(c[m+4>>2]|0)==-1:0){c[g>>2]=1;m=i;c[m>>2]=-1;c[m+4>>2]=-1;break}if(!(c[g>>2]|0)){c[c[q>>2]>>2]=1;g=i;c[g>>2]=-1;c[g+4>>2]=-1;break}g=c[k>>2]|0;if((d[p>>0]|0)&64|0){m=g+488|0;s=Lf(c[m>>2]|0,c[m+4>>2]|0,1,0)|0;m=i;c[m>>2]=s;c[m+4>>2]=D;break}else{c[o>>2]=c[g+408>>2];g=(c[k>>2]|0)+488|0;m=Jf(c[g>>2]|0,c[g+4>>2]|0,c[o>>2]|0)|0;c[n>>2]=m;m=(c[k>>2]|0)+488|0;g=(1<>2])-1|0;s=Lf(c[m>>2]&g|0,c[m+4>>2]&((g|0)<0)<<31>>31|0,1,0)|0;g=c[n>>2]|0;m=Lf(g|0,((g|0)<0)<<31>>31|0,s|0,D|0)|0;c[n>>2]=m;m=c[n>>2]|0;s=Of(m|0,((m|0)<0)<<31>>31|0,c[o>>2]|0)|0;m=i;c[m>>2]=s;c[m+4>>2]=D;break}}else{do if(!(c[q>>2]|0)){m=Cf(4)|0;c[(c[k>>2]|0)+504>>2]=m;if(!(c[(c[k>>2]|0)+504>>2]|0)){m=i;c[m>>2]=-1;c[m+4>>2]=-1;break a}else{c[q>>2]=c[(c[k>>2]|0)+504>>2];break}}while(0);c[c[q>>2]>>2]=0;m=i;c[m>>2]=0;c[m+4>>2]=0}while(0);q=i;D=c[q+4>>2]|0;l=h;return c[q>>2]|0}function Ya(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=l;l=l+48|0;h=g+8|0;i=g;j=g+32|0;k=g+20|0;m=g+16|0;n=i;c[n>>2]=a;c[n+4>>2]=b;c[j>>2]=d;c[g+28>>2]=e;c[g+24>>2]=f;f=i;e=Jf(c[f>>2]|0,c[f+4>>2]|0,c[(c[j>>2]|0)+408>>2]|0)|0;c[k>>2]=e;e=i;i=c[k>>2]<>2]|0)+408>>2];f=Kf(c[e>>2]|0,c[e+4>>2]|0,i|0,((i|0)<0)<<31>>31|0)|0;c[m>>2]=f;f=c[k>>2]|0;if(!(c[m>>2]|0)){k=(f-60<>2]|0)+408>>2])+59|0;i=h;c[i>>2]=k;c[i+4>>2]=((k|0)<0)<<31>>31;o=h;p=o;q=c[p>>2]|0;r=o+4|0;s=r;t=c[s>>2]|0;D=t;l=g;return q|0}else{k=Of(f|0,((f|0)<0)<<31>>31|0,c[(c[j>>2]|0)+408>>2]|0)|0;j=(c[m>>2]|0)-1|0;m=Lf(k|0,D|0,j|0,((j|0)<0)<<31>>31|0)|0;j=h;c[j>>2]=m;c[j+4>>2]=D;o=h;p=o;q=c[p>>2]|0;r=o+4|0;s=r;t=c[s>>2]|0;D=t;l=g;return q|0}return 0}function Za(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;g=l;l=l+48|0;h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;m=g+16|0;n=g+8|0;o=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[m>>2]=e;c[g+12>>2]=f;c[n>>2]=c[k>>2];k=o;c[k>>2]=0;c[k+4>>2]=0;if((c[m>>2]|0)<30){c[h>>2]=0;p=c[h>>2]|0;l=g;return p|0}else{m=Qb((c[n>>2]|0)+12|0)|0;n=o;c[n>>2]=m;c[n+4>>2]=((m|0)<0)<<31>>31;m=o;ub(c[i>>2]|0,c[j>>2]|0,c[m>>2]|0,c[m+4>>2]|0,1e3,0)|0;Tb(c[i>>2]|0,c[j>>2]|0,2)|0;wb(c[i>>2]|0,c[j>>2]|0,3)|0;c[h>>2]=1;p=c[h>>2]|0;l=g;return p|0}return 0}function _a(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,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e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+32|0;g=f+8|0;h=f;i=f+24|0;j=f+20|0;k=f+16|0;m=h;c[m>>2]=a;c[m+4>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=c[(c[i>>2]|0)+504>>2];do if(!(c[(c[i>>2]|0)+504>>2]|0)){e=Cf(12)|0;c[(c[i>>2]|0)+504>>2]=e;if(!(c[(c[i>>2]|0)+504>>2]|0)){e=g;c[e>>2]=-1;c[e+4>>2]=-1;break}else{c[k>>2]=c[(c[i>>2]|0)+504>>2];c[(c[k>>2]|0)+8>>2]=0;e=S(c[(c[c[j>>2]>>2]|0)+64>>2]|0,c[(c[c[j>>2]>>2]|0)+56>>2]|0)|0;c[(c[k>>2]|0)+4>>2]=e;c[c[k>>2]>>2]=1;e=g;c[e>>2]=0;c[e+4>>2]=0;break}}else{e=c[k>>2]|0;if((c[c[k>>2]>>2]|0)<2)c[e>>2]=(c[e>>2]|0)+1;else c[e+8>>2]=1;e=h;d=c[e+4>>2]|0;if((d|0)>-1|(d|0)==-1&(c[e>>2]|0)>>>0>4294967295){e=h;d=c[e+4>>2]|0;b=g;c[b>>2]=c[e>>2];c[b+4>>2]=d;break}if(!(c[(c[k>>2]|0)+8>>2]|0)){d=g;c[d>>2]=0;c[d+4>>2]=0;break}d=(c[i>>2]|0)+488|0;b=c[d+4>>2]|0;if((b|0)>0|(b|0)==0&(c[d>>2]|0)>>>0>0){d=(c[i>>2]|0)+488|0;b=c[(c[k>>2]|0)+4>>2]|0;e=Lf(c[d>>2]|0,c[d+4>>2]|0,b|0,((b|0)<0)<<31>>31|0)|0;b=g;c[b>>2]=e;c[b+4>>2]=D;break}else{b=g;c[b>>2]=-1;c[b+4>>2]=-1;break}}while(0);k=g;D=c[k+4>>2]|0;l=f;return c[k>>2]|0}function cb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p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h+24|0;n=h+20|0;o=h+32|0;p=h+16|0;q=j;c[q>>2]=b;c[q+4>>2]=e;c[k>>2]=f;c[m>>2]=g;do if(c[(c[k>>2]|0)+504>>2]|0){c[n>>2]=c[(c[k>>2]|0)+504>>2];if((d[c[c[m>>2]>>2]>>0]|0|0)==255)c[(c[n>>2]|0)+8>>2]=1;g=j;if((((c[g>>2]|0)==-1?(c[g+4>>2]|0)==-1:0)?(d[c[c[m>>2]>>2]>>0]|0|0)==255:0)?(c[(c[m>>2]|0)+4>>2]|0)>2:0){a[o>>0]=((d[(c[c[m>>2]>>2]|0)+2>>0]|0)&240)>>4;do switch(d[o>>0]|0|0){case 0:{c[p>>2]=-1;break}case 1:{c[p>>2]=192;break}case 2:{c[p>>2]=576;break}case 3:{c[p>>2]=1152;break}case 4:{c[p>>2]=2304;break}case 5:{c[p>>2]=4608;break}case 6:{c[p>>2]=-1;break}case 7:{c[p>>2]=-1;break}case 8:{c[p>>2]=256;break}case 9:{c[p>>2]=512;break}case 10:{c[p>>2]=1024;break}case 11:{c[p>>2]=2048;break}case 12:{c[p>>2]=4096;break}case 13:{c[p>>2]=8192;break}case 14:{c[p>>2]=16384;break}case 15:{c[p>>2]=32768;break}default:c[p>>2]=-1}while(0);if((c[p>>2]|0)==-1)break;g=c[n>>2]|0;f=c[p>>2]|0;e=Lf(c[g>>2]|0,c[g+4>>2]|0,f|0,((f|0)<0)<<31>>31|0)|0;f=j;c[f>>2]=e;c[f+4>>2]=D;break}f=j;if(((c[f>>2]|0)==-1?(c[f+4>>2]|0)==-1:0)?(c[(c[n>>2]|0)+8>>2]|0)==0:0){f=j;c[f>>2]=0;c[f+4>>2]=0}}else{f=Cf(16)|0;c[(c[k>>2]|0)+504>>2]=f;if(c[(c[k>>2]|0)+504>>2]|0){c[n>>2]=c[(c[k>>2]|0)+504>>2];f=c[n>>2]|0;c[f>>2]=0;c[f+4>>2]=0;c[(c[n>>2]|0)+8>>2]=0;break}f=i;c[f>>2]=-1;c[f+4>>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;l=l+32|0;g=f+8|0;h=f;i=f+24|0;j=f+16|0;k=h;c[k>>2]=a;c[k+4>>2]=b;c[i>>2]=d;c[f+20>>2]=e;c[j>>2]=c[(c[i>>2]|0)+504>>2];do if(!(c[(c[i>>2]|0)+504>>2]|0)){e=Cf(12)|0;c[(c[i>>2]|0)+504>>2]=e;if(!(c[(c[i>>2]|0)+504>>2]|0)){e=g;c[e>>2]=-1;c[e+4>>2]=-1;break}else{c[j>>2]=c[(c[i>>2]|0)+504>>2];c[(c[j>>2]|0)+8>>2]=0;c[(c[j>>2]|0)+4>>2]=256;c[c[j>>2]>>2]=1;e=g;c[e>>2]=0;c[e+4>>2]=0;break}}else{e=c[j>>2]|0;if((c[c[j>>2]>>2]|0)<2)c[e>>2]=(c[e>>2]|0)+1;else c[e+8>>2]=1;e=h;d=c[e+4>>2]|0;if((d|0)>-1|(d|0)==-1&(c[e>>2]|0)>>>0>4294967295){e=h;d=c[e+4>>2]|0;b=g;c[b>>2]=c[e>>2];c[b+4>>2]=d;break}if(!(c[(c[j>>2]|0)+8>>2]|0)){d=g;c[d>>2]=0;c[d+4>>2]=0;break}d=(c[i>>2]|0)+488|0;b=c[d+4>>2]|0;if((b|0)>0|(b|0)==0&(c[d>>2]|0)>>>0>0){d=(c[i>>2]|0)+488|0;b=c[(c[j>>2]|0)+4>>2]|0;e=Lf(c[d>>2]|0,c[d+4>>2]|0,b|0,((b|0)<0)<<31>>31|0)|0;b=g;c[b>>2]=e;c[b+4>>2]=D;break}else{b=g;c[b>>2]=-1;c[b+4>>2]=-1;break}}while(0);j=g;D=c[j+4>>2]|0;l=f;return c[j>>2]|0}function mb(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;i=l;l=l+48|0;j=i+36|0;k=i+32|0;m=i+28|0;n=i+24|0;o=i+20|0;p=i+12|0;q=i+8|0;r=i+4|0;s=i+40|0;t=i;c[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h>>2]=1;p=c[h>>2]|0;l=g;return p|0}return 0}function ob(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;i=l;l=l+32|0;j=i+24|0;k=i+20|0;m=i+16|0;n=i+12|0;o=i+8|0;p=i+28|0;c[k>>2]=b;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;c[i+4>>2]=h;c[i>>2]=c[n>>2];if((c[o>>2]|0)<19){c[j>>2]=0;q=c[j>>2]|0;l=i;return q|0}a[p>>0]=a[(c[n>>2]|0)+9>>0]|0;if((d[p>>0]|0|0)<1){c[j>>2]=0;q=c[j>>2]|0;l=i;return q|0}else{ub(c[k>>2]|0,c[m>>2]|0,48e3,0,1e3,0)|0;vb(c[k>>2]|0,c[m>>2]|0,0)|0;p=c[k>>2]|0;o=c[m>>2]|0;Jb(p,o,(Ib((c[n>>2]|0)+10|0)|0)&65535,0)|0;wb(c[k>>2]|0,c[m>>2]|0,2)|0;c[j>>2]=1;q=c[j>>2]|0;l=i;return q|0}return 0}function pb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=l;l=l+48|0;g=f+24|0;h=f+16|0;i=f+40|0;j=f+36|0;k=f+32|0;m=f+8|0;n=f;o=h;c[o>>2]=a;c[o+4>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=c[(c[i>>2]|0)+504>>2];if(!(c[(c[i>>2]|0)+504>>2]|0)){e=Cf(16)|0;c[(c[i>>2]|0)+504>>2]=e;if(!(c[(c[i>>2]|0)+504>>2]|0)){e=g;c[e>>2]=-1;c[e+4>>2]=-1;p=g;q=p;r=c[q>>2]|0;s=p+4|0;t=s;u=c[t>>2]|0;D=u;l=f;return r|0}else{c[k>>2]=c[(c[i>>2]|0)+504>>2];c[(c[k>>2]|0)+4>>2]=0;c[c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|0;e=c[o+4>>2]|0;h=n;c[h>>2]=c[o>>2];c[h+4>>2]=e}e=(c[m>>2]|0)+8|0;c[e>>2]=0;c[e+4>>2]=0;p=n;q=p;r=c[q>>2]|0;s=p+4|0;t=s;u=c[t>>2]|0;D=u;l=g;return r|0}function rb(a,b,e,f,g){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0;h=l;l=l+48|0;i=h+32|0;j=h+28|0;k=h+24|0;m=h+20|0;n=h+16|0;o=h+8|0;p=h+4|0;q=h;c[j>>2]=a;c[k>>2]=b;c[m>>2]=e;c[n>>2]=f;c[h+12>>2]=g;c[o>>2]=c[m>>2];if((c[n>>2]|0)<26){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}if((d[c[m>>2]>>0]|0|0)!=79){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}if(De((c[m>>2]|0)+1|0,2723,4)|0){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}if((d[(c[m>>2]|0)+5>>0]|0|0)!=1){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}if((d[(c[m>>2]|0)+6>>0]|0|0)!=1){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}else{c[p>>2]=tb((c[o>>2]|0)+18|0)|0;c[q>>2]=tb((c[o>>2]|0)+22|0)|0;o=c[j>>2]|0;m=c[k>>2]|0;n=c[p>>2]|0;p=c[q>>2]|0;q=Uf(1e3,0,p|0,((p|0)<0)<<31>>31|0)|0;ub(o,m,n,((n|0)<0)<<31>>31,q,D)|0;vb(c[j>>2]|0,c[k>>2]|0,32)|0;wb(c[j>>2]|0,c[k>>2]|0,1)|0;c[i>>2]=1;r=c[i>>2]|0;l=h;return r|0}return 0}function sb(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0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]|0,3)|0;o=t;c[o>>2]=r|s;c[o+4>>2]=q|D;q=t;t=c[q+4>>2]|0;o=h;c[o>>2]=c[q>>2];c[o+4>>2]=t;v=h;w=v;x=c[w>>2]|0;y=v+4|0;z=y;A=c[z>>2]|0;D=A;l=g;return x|0}function tb(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;e=b;c[e>>2]=a;l=b;return (d[c[e>>2]>>0]|0)<<24|(d[(c[e>>2]|0)+1>>0]|0)<<16|(d[(c[e>>2]|0)+2>>0]|0)<<8|(d[(c[e>>2]|0)+3>>0]|0)|0}function ub(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;h=l;l=l+32|0;i=h+28|0;j=h+24|0;k=h+20|0;m=h+8|0;n=h;o=h+16|0;c[j>>2]=a;c[k>>2]=b;b=m;c[b>>2]=d;c[b+4>>2]=e;e=n;c[e>>2]=f;c[e+4>>2]=g;if(!(c[j>>2]|0)){c[i>>2]=-2;p=c[i>>2]|0;l=h;return p|0}c[o>>2]=xb(c[j>>2]|0,c[k>>2]|0)|0;if(!(c[o>>2]|0)){c[i>>2]=-20;p=c[i>>2]|0;l=h;return p|0}else{g=m;m=c[g+4>>2]|0;e=(c[o>>2]|0)+376|0;c[e>>2]=c[g>>2];c[e+4>>2]=m;m=n;n=c[m+4>>2]|0;e=(c[o>>2]|0)+384|0;c[e>>2]=c[m>>2];c[e+4>>2]=n;c[i>>2]=Ab(c[j>>2]|0,c[k>>2]|0)|0;p=c[i>>2]|0;l=h;return p|0}return 0}function vb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;k=c[f>>2]|0;l=e;return k|0}c[j>>2]=xb(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-20;k=c[f>>2]|0;l=e;return k|0}else{c[(c[j>>2]|0)+408>>2]=c[i>>2];c[f>>2]=Ab(c[g>>2]|0,c[h>>2]|0)|0;k=c[f>>2]|0;l=e;return k|0}return 0}function wb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;k=c[f>>2]|0;l=e;return k|0}c[j>>2]=xb(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-20;k=c[f>>2]|0;l=e;return k|0}else{c[(c[j>>2]|0)+364>>2]=c[i>>2];c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function xb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if((c[g>>2]|0)==-1){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=zb(c[(c[f>>2]|0)+80>>2]|0,1,c[g>>2]|0)|0;h=c[e>>2]|0;l=d;return h|0}return 0}function yb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];l=d;return (c[(c[g>>2]|0)+336>>2]|0)==(c[f>>2]|0)|0}function zb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=0;while(1){if((c[k>>2]|0)>=(c[(c[g>>2]|0)+4>>2]|0)){m=6;break}c[j>>2]=c[(c[(c[g>>2]|0)+8>>2]|0)+(c[k>>2]<<2)>>2];if(xa[c[h>>2]&1](c[j>>2]|0,c[i>>2]|0)|0){m=4;break}c[k>>2]=(c[k>>2]|0)+1}if((m|0)==4){c[f>>2]=c[j>>2];n=c[f>>2]|0;l=e;return n|0}else if((m|0)==6){c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}return 0}function Ab(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=-2;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=xb(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[e>>2]=-20;i=c[e>>2]|0;l=d;return i|0}b=(c[h>>2]|0)+376|0;if((c[b>>2]|0)==0&(c[b+4>>2]|0)==0){b=(c[h>>2]|0)+376|0;c[b>>2]=1;c[b+4>>2]=0;b=(c[h>>2]|0)+384|0;c[b>>2]=0;c[b+4>>2]=0}b=c[f>>2]|0;a=c[g>>2]|0;if(!(c[(c[h>>2]|0)+408>>2]|0)){c[e>>2]=Cb(b,a,19,0,1)|0;i=c[e>>2]|0;l=d;return i|0}h=(Db(b,a)|0)==12;a=c[f>>2]|0;b=c[g>>2]|0;if(h){c[e>>2]=Cb(a,b,20,0,1)|0;i=c[e>>2]|0;l=d;return i|0}h=(Db(a,b)|0)==14;b=c[f>>2]|0;f=c[g>>2]|0;if(h){c[e>>2]=Cb(b,f,21,0,1)|0;i=c[e>>2]|0;l=d;return i|0}else{c[e>>2]=Cb(b,f,22,0,1)|0;i=c[e>>2]|0;l=d;return i|0}return 0}function Bb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0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c[(c[i>>2]|0)+88>>2]=c[k>>2];c[(c[i>>2]|0)+92>>2]=c[m>>2];c[(c[i>>2]|0)+96>>2]=c[n>>2]}else{c[o>>2]=xb(f,c[j>>2]|0)|0;if(!(c[o>>2]|0)){c[h>>2]=-20;p=c[h>>2]|0;l=g;return p|0}if(c[(c[o>>2]|0)+456>>2]|0?c[(c[o>>2]|0)+452>>2]|0:0)Df(c[(c[o>>2]|0)+452>>2]|0);c[(c[o>>2]|0)+448>>2]=c[k>>2];c[(c[o>>2]|0)+452>>2]=c[m>>2];c[(c[o>>2]|0)+456>>2]=c[n>>2]}c[h>>2]=0;p=c[h>>2]|0;l=g;return p|0}function Db(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=-2;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=xb(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[e>>2]=-20;i=c[e>>2]|0;l=d;return i|0}else{c[e>>2]=c[(c[h>>2]|0)+360>>2];i=c[e>>2]|0;l=d;return i|0}return 0}function Eb(a,d,f,g,h){a=a|0;d=d|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;i=l;l=l+80|0;j=i+40|0;k=i+64|0;m=i+60|0;n=i+32|0;o=i+52|0;p=i+24|0;q=i+16|0;r=i+48|0;s=i+68|0;t=i+8|0;u=i;c[k>>2]=a;c[m>>2]=d;d=n;c[d>>2]=f;c[d+4>>2]=g;c[i+56>>2]=h;c[o>>2]=xb(c[k>>2]|0,c[m>>2]|0)|0;if(!(c[o>>2]|0)){m=j;c[m>>2]=-1;c[m+4>>2]=-1;v=j;w=v;x=c[w>>2]|0;y=v+4|0;z=y;A=c[z>>2]|0;D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[n+4>>2]|0)|0;n=k;c[n>>2]=o;c[n+4>>2]=D;n=k;o=c[n+4>>2]|0;if((o|0)>0|(o|0)==0&(c[n>>2]|0)>>>0>0){n=(c[m>>2]|0)+392|0;o=k;e=Kf(c[o>>2]|0,c[o+4>>2]|0,c[n>>2]|0,c[n+4>>2]|0)|0;n=k;c[n>>2]=e;c[n+4>>2]=D}n=k;k=(c[m>>2]|0)+384|0;e=Uf(c[n>>2]|0,c[n+4>>2]|0,c[k>>2]|0,c[k+4>>2]|0)|0;k=(c[m>>2]|0)+376|0;m=Rf(e|0,D|0,c[k>>2]|0,c[k+4>>2]|0)|0;k=p;c[k>>2]=m;c[k+4>>2]=D;k=p;p=c[k+4>>2]|0;m=h;c[m>>2]=c[k>>2];c[m+4>>2]=p;q=h;r=q;s=c[r>>2]|0;t=q+4|0;u=t;v=c[u>>2]|0;D=v;l=g;return s|0}function Hb(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+32|0;f=e;g=e+16|0;h=e+22|0;i=e+21|0;j=e+20|0;k=e+12|0;m=e+8|0;c[g>>2]=b;do if((c[(c[g>>2]|0)+4>>2]|0)>=1){a[h>>0]=a[c[c[g>>2]>>2]>>0]|0;a[i>>0]=(d[h>>0]|0)&3;c[k>>2]=c[1416+((d[h>>0]|0)>>3<<2)>>2];if((d[i>>0]|0|0)==3?(c[(c[g>>2]|0)+4>>2]|0)<2:0){b=f;c[b>>2]=0;c[b+4>>2]=0;break}switch(d[i>>0]|0|0){case 0:{a[j>>0]=1;break}case 2:case 1:{a[j>>0]=2;break}case 3:{a[j>>0]=(d[(c[c[g>>2]>>2]|0)+1>>0]|0)&63;break}default:{}}c[m>>2]=S(c[k>>2]|0,d[j>>0]|0)|0;if((c[m>>2]|0)>5760){b=f;c[b>>2]=0;c[b+4>>2]=0;break}else{b=c[m>>2]|0;n=f;c[n>>2]=b;c[n+4>>2]=((b|0)<0)<<31>>31;break}}else{b=f;c[b>>2]=0;c[b+4>>2]=0}while(0);m=f;D=c[m+4>>2]|0;l=e;return c[m>>2]|0}function Ib(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;e=b;c[e>>2]=a;l=b;return (d[c[e>>2]>>0]|0|(d[(c[e>>2]|0)+1>>0]|0)<<8)&65535|0}function Jb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f;k=f+8|0;c[h>>2]=a;c[i>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;if(!(c[h>>2]|0)){c[g>>2]=-2;m=c[g>>2]|0;l=f;return m|0}c[k>>2]=xb(c[h>>2]|0,c[i>>2]|0)|0;if(!(c[k>>2]|0)){c[g>>2]=-20;m=c[g>>2]|0;l=f;return m|0}else{e=j;j=c[e+4>>2]|0;b=(c[k>>2]|0)+392|0;c[b>>2]=c[e>>2];c[b+4>>2]=j;c[g>>2]=Ab(c[h>>2]|0,c[i>>2]|0)|0;m=c[g>>2]|0;l=f;return m|0}return 0}function Kb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;e=l;l=l+48|0;f=e+44|0;g=e+40|0;h=e+36|0;i=e+32|0;j=e+16|0;k=e+8|0;m=e+4|0;n=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;Lb(j,c[h>>2]|0,c[i>>2]|0);Mb(j,104);i=Nb(j)|0;c[c[g>>2]>>2]=i;i=Nb(j)|0;c[(c[g>>2]|0)+4>>2]=i;i=Nb(j)|0;c[(c[g>>2]|0)+8>>2]=i;i=Nb(j)|0;c[(c[g>>2]|0)+12>>2]=i;i=Nb(j)|0;c[k>>2]=i;c[(c[g>>2]|0)+20>>2]=i;if((c[k>>2]|0)>>>0>=17){c[f>>2]=-1;o=c[f>>2]|0;l=e;return o|0}c[(c[g>>2]|0)+24>>2]=c[1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|0)+12|0;c[b>>2]=(c[b>>2]|0)-(c[f>>2]|0);while(1){if((c[(c[e>>2]|0)+12>>2]|0)>0)break;f=(c[e>>2]|0)+4|0;c[f>>2]=(c[f>>2]|0)+1;f=(c[e>>2]|0)+12|0;c[f>>2]=(c[f>>2]|0)+8}l=d;return}function Nb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=0;c[f>>2]=0;while(1){a=(Pb(c[d>>2]|0,1)|0)!=0^1;g=c[e>>2]|0;if(!a)break;c[e>>2]=g+1;c[f>>2]=c[f>>2]<<1;a=Pb(c[d>>2]|0,1)|0;c[f>>2]=c[f>>2]|a}l=b;return (1<>2]|0)|0}function Ob(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=Pb(c[d>>2]|0,1)|0;l=b;return a|0}function Pb(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[j>>2]=0;while(1){if((c[h>>2]|0)<=0){k=9;break}if((c[(c[g>>2]|0)+4>>2]|0)>>>0>=(c[(c[g>>2]|0)+8>>2]|0)>>>0){k=9;break}b=(c[(c[g>>2]|0)+12>>2]|0)-(c[h>>2]|0)|0;c[i>>2]=b;m=d[c[(c[g>>2]|0)+4>>2]>>0]|0;if((b|0)>=0)break;c[j>>2]=c[j>>2]|(m&c[2020+(c[(c[g>>2]|0)+12>>2]<<2)>>2])<<0-(c[i>>2]|0);c[h>>2]=(c[h>>2]|0)-(c[(c[g>>2]|0)+12>>2]|0);b=(c[g>>2]|0)+4|0;c[b>>2]=(c[b>>2]|0)+1;c[(c[g>>2]|0)+12>>2]=8}if((k|0)==9){c[f>>2]=c[j>>2];n=c[f>>2]|0;l=e;return n|0}c[j>>2]=c[j>>2]|m>>c[i>>2]&c[2020+(c[h>>2]<<2)>>2];i=(c[g>>2]|0)+12|0;c[i>>2]=(c[i>>2]|0)-(c[h>>2]|0);if(!(c[(c[g>>2]|0)+12>>2]|0)){h=(c[g>>2]|0)+4|0;c[h>>2]=(c[h>>2]|0)+1;c[(c[g>>2]|0)+12>>2]=8}c[f>>2]=c[j>>2];n=c[f>>2]|0;l=e;return n|0}function Qb(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;e=b;c[e>>2]=a;l=b;return d[c[e>>2]>>0]|0|(d[(c[e>>2]|0)+1>>0]|0)<<8|(d[(c[e>>2]|0)+2>>0]|0)<<16|(d[(c[e>>2]|0)+3>>0]|0)<<24|0}function Rb(a){a=a|0;var b=0,e=0,f=0,g=0;b=l;l=l+16|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[f>>2]=d[c[e>>2]>>0]|0|(d[(c[e>>2]|0)+1>>0]|0)<<8|(d[(c[e>>2]|0)+2>>0]|0)<<16|(d[(c[e>>2]|0)+3>>0]|0)<<24;c[g>>2]=d[(c[e>>2]|0)+4>>0]|0|(d[(c[e>>2]|0)+5>>0]|0)<<8|(d[(c[e>>2]|0)+6>>0]|0)<<16|(d[(c[e>>2]|0)+7>>0]|0)<<24;D=c[g>>2]|0;l=b;return c[f>>2]|0}function Sb(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;e=b;c[e>>2]=a;l=b;return ((d[c[e>>2]>>0]|0)<<8|(d[(c[e>>2]|0)+1>>0]|0))&65535|0}function Tb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;k=c[f>>2]|0;l=e;return k|0}c[j>>2]=xb(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-20;k=c[f>>2]|0;l=e;return k|0}else{c[(c[j>>2]|0)+368>>2]=c[i>>2];c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function Ub(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;if(Vb(c[e>>2]|0)|0){c[d>>2]=0;g=c[d>>2]|0;l=b;return g|0}c[f>>2]=Cf(568)|0;if(!(c[f>>2]|0)){c[d>>2]=0;g=c[d>>2]|0;l=b;return g|0}c[c[f>>2]>>2]=c[e>>2];c[(c[f>>2]|0)+4>>2]=0;c[(c[f>>2]|0)+8>>2]=0;c[(c[f>>2]|0)+64>>2]=0;c[(c[f>>2]|0)+68>>2]=0;c[(c[f>>2]|0)+72>>2]=1024;c[(c[f>>2]|0)+76>>2]=0;e=Wb()|0;c[(c[f>>2]|0)+80>>2]=e;do if(c[(c[f>>2]|0)+80>>2]|0){c[(c[f>>2]|0)+84>>2]=0;c[(c[f>>2]|0)+88>>2]=0;c[(c[f>>2]|0)+92>>2]=0;c[(c[f>>2]|0)+96>>2]=0;c[(c[f>>2]|0)+100>>2]=0;c[(c[f>>2]|0)+104>>2]=0;e=Xb()|0;c[(c[f>>2]|0)+560>>2]=e;e=c[f>>2]|0;if(!(c[(c[f>>2]|0)+560>>2]|0)){Df(c[e+80>>2]|0);break}Yb(e)|0;c[d>>2]=c[f>>2];g=c[d>>2]|0;l=b;return g|0}while(0);Df(c[f>>2]|0);c[d>>2]=0;g=c[d>>2]|0;l=b;return g|0}function Vb(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;if(c[e>>2]&1|0)c[d>>2]=-11;else c[d>>2]=0;l=b;return c[d>>2]|0}function Wb(){var a=0,b=0,d=0,e=0;a=l;l=l+16|0;b=a+4|0;d=a;c[d>>2]=Cf(20)|0;if(!(c[d>>2]|0)){c[b>>2]=0;e=c[b>>2]|0;l=a;return e|0}else{c[c[d>>2]>>2]=0;c[(c[d>>2]|0)+4>>2]=0;c[(c[d>>2]|0)+8>>2]=0;c[(c[d>>2]|0)+12>>2]=0;c[(c[d>>2]|0)+16>>2]=0;c[b>>2]=c[d>>2];e=c[b>>2]|0;l=a;return e|0}return 0}function Xb(){var a=0,b=0,d=0,e=0,f=0,g=0;a=l;l=l+16|0;b=a+12|0;d=a+8|0;e=a+4|0;f=a;c[d>>2]=Cf(8)|0;if(!(c[d>>2]|0)){c[b>>2]=0;g=c[b>>2]|0;l=a;return g|0}c[e>>2]=Cf(12)|0;if(!(c[e>>2]|0)){Df(c[d>>2]|0);c[b>>2]=0;g=c[b>>2]|0;l=a;return g|0}c[f>>2]=Cf(12)|0;if(!(c[f>>2]|0)){Df(c[e>>2]|0);Df(c[d>>2]|0);c[b>>2]=0;g=c[b>>2]|0;l=a;return g|0}else{c[c[e>>2]>>2]=c[f>>2];c[(c[e>>2]|0)+4>>2]=0;c[(c[f>>2]|0)+4>>2]=c[e>>2];c[c[f>>2]>>2]=0;c[c[d>>2]>>2]=c[e>>2];c[(c[d>>2]|0)+4>>2]=c[f>>2];c[b>>2]=c[d>>2];g=c[b>>2]|0;l=a;return g|0}return 0}function Yb(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=(c[d>>2]|0)+112;Na(c[e>>2]|0)|0;Ka((c[e>>2]|0)+32|0,-1)|0;c[(c[e>>2]|0)+392>>2]=-1;c[(c[e>>2]|0)+396>>2]=0;c[(c[e>>2]|0)+400>>2]=0;c[(c[e>>2]|0)+404>>2]=0;c[(c[e>>2]|0)+408>>2]=0;a=(c[e>>2]|0)+416|0;c[a>>2]=0;c[a+4>>2]=0;c[(c[e>>2]|0)+432>>2]=0;c[(c[e>>2]|0)+436>>2]=0;c[(c[e>>2]|0)+440>>2]=0;l=b;return c[d>>2]|0}function Zb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;a=c[e>>2]|0;do if(c[(c[e>>2]|0)+4>>2]|0)if((pf(c[a+4>>2]|0)|0)==-1)c[d>>2]=-10;else g=10;else{h=c[a+8>>2]|0;c[f>>2]=h;if(!h){c[d>>2]=-3;break}if(!(c[(c[f>>2]|0)+32>>2]|0)){c[d>>2]=-3;break}if((va[c[(c[f>>2]|0)+32>>2]&15](c[(c[f>>2]|0)+36>>2]|0)|0)==-1)c[d>>2]=-1;else g=10}while(0);if((g|0)==10)c[d>>2]=0;l=b;return c[d>>2]|0}function _b(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;if(!(c[e>>2]|0)){c[d>>2]=-2;f=c[d>>2]|0;l=b;return f|0}$b(c[e>>2]|0)|0;bc(c[(c[e>>2]|0)+80>>2]|0,2)|0;cc(c[(c[e>>2]|0)+80>>2]|0);ec(c[(c[e>>2]|0)+560>>2]|0,3)|0;fc(c[(c[e>>2]|0)+560>>2]|0);if(c[(c[e>>2]|0)+96>>2]|0)Df(c[(c[e>>2]|0)+92>>2]|0);if(c[(c[e>>2]|0)+4>>2]|0?(of(c[(c[e>>2]|0)+4>>2]|0)|0)==-1:0){c[d>>2]=-10;f=c[d>>2]|0;l=b;return f|0}if(c[(c[e>>2]|0)+8>>2]|0){Zb(c[e>>2]|0)|0;Df(c[(c[e>>2]|0)+8>>2]|0)}Df(c[e>>2]|0);c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}function $b(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=(c[d>>2]|0)+112;La((c[e>>2]|0)+32|0)|0;Oa(c[e>>2]|0)|0;l=b;return c[d>>2]|0}function ac(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];ic(c[e>>2]|0)|0;if((c[(c[e>>2]|0)+336>>2]|0)!=-1)La(c[e>>2]|0)|0;if(c[(c[e>>2]|0)+456>>2]|0)Df(c[(c[e>>2]|0)+452>>2]|0);if(!(c[(c[e>>2]|0)+504>>2]|0)){f=c[e>>2]|0;Df(f);l=b;return 0}Df(c[(c[e>>2]|0)+504>>2]|0);f=c[e>>2]|0;Df(f);l=b;return 0}function bc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=0;while(1){if((c[g>>2]|0)>=(c[(c[e>>2]|0)+4>>2]|0))break;va[c[f>>2]&15](c[(c[(c[e>>2]|0)+8>>2]|0)+(c[g>>2]<<2)>>2]|0)|0;c[g>>2]=(c[g>>2]|0)+1}l=d;return 0}function cc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;hc(c[d>>2]|0);Df(c[d>>2]|0);l=b;return}function dc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];gc(c[e>>2]|0);l=b;return 1}function ec(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[e>>2]=a;c[f>>2]=b;c[i>>2]=0;c[g>>2]=c[c[c[e>>2]>>2]>>2];while(1){if((c[g>>2]|0)==(c[(c[e>>2]|0)+4>>2]|0)){k=7;break}c[j>>2]=va[c[f>>2]&15](c[(c[g>>2]|0)+8>>2]|0)|0;if((c[j>>2]|0)==-1)c[i>>2]=-1;if(!(c[j>>2]|0)){k=7;break}c[h>>2]=c[c[g>>2]>>2];c[c[(c[g>>2]|0)+4>>2]>>2]=c[c[g>>2]>>2];c[(c[c[g>>2]>>2]|0)+4>>2]=c[(c[g>>2]|0)+4>>2];Df(c[g>>2]|0);c[g>>2]=c[h>>2]}if((k|0)==7){l=d;return c[i>>2]|0}return 0}function fc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[c[c[d>>2]>>2]>>2];while(1){if(!(c[e>>2]|0))break;Df(c[(c[e>>2]|0)+4>>2]|0);c[e>>2]=c[c[e>>2]>>2]}Df(c[(c[d>>2]|0)+4>>2]|0);Df(c[d>>2]|0);l=b;return}function gc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;Df(c[c[d>>2]>>2]|0);Df(c[d>>2]|0);l=b;return}function hc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;if(c[(c[d>>2]|0)+8>>2]|0){Df(c[(c[d>>2]|0)+8>>2]|0);c[(c[d>>2]|0)+8>>2]=0}c[(c[d>>2]|0)+4>>2]=0;c[c[d>>2]>>2]=0;l=b;return}function ic(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b;c[d>>2]=a;bc(c[(c[d>>2]|0)+416>>2]|0,1)|0;cc(c[(c[d>>2]|0)+416>>2]|0);c[(c[d>>2]|0)+416>>2]=0;if(!(c[(c[d>>2]|0)+412>>2]|0)){e=c[d>>2]|0;f=e+412|0;c[f>>2]=0;l=b;return 0}Df(c[(c[d>>2]|0)+412>>2]|0);e=c[d>>2]|0;f=e+412|0;c[f>>2]=0;l=b;return 0}function jc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}if(c[c[d>>2]>>2]|0)Df(c[c[d>>2]>>2]|0);if(c[(c[d>>2]|0)+4>>2]|0)Df(c[(c[d>>2]|0)+4>>2]|0);Df(c[d>>2]|0);l=b;return}function kc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;d=b;e=b+12|0;f=b+8|0;c[e>>2]=a;do if(c[e>>2]|0)if(c[c[e>>2]>>2]&1|0){a=d;c[a>>2]=-3;c[a+4>>2]=-1;break}else{c[f>>2]=(c[e>>2]|0)+112;a=(c[f>>2]|0)+416|0;g=c[a+4>>2]|0;h=d;c[h>>2]=c[a>>2];c[h+4>>2]=g;break}else{g=d;c[g>>2]=-2;c[g+4>>2]=-1}while(0);f=d;D=c[f+4>>2]|0;l=b;return c[f>>2]|0}function lc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;d=b;e=b+8|0;c[e>>2]=a;do if(c[e>>2]|0)if(c[c[e>>2]>>2]&1|0){a=d;c[a>>2]=-3;c[a+4>>2]=-1;break}else{a=(c[e>>2]|0)+112+424|0;f=c[a+4>>2]|0;g=d;c[g>>2]=c[a>>2];c[g+4>>2]=f;break}else{f=d;c[f>>2]=-2;c[f+4>>2]=-1}while(0);e=d;D=c[e+4>>2]|0;l=b;return c[e>>2]|0}function mc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;d=l;l=l+48|0;e=d+36|0;f=d+32|0;g=d+28|0;h=d+24|0;i=d+20|0;j=d+16|0;k=d+12|0;m=d+8|0;n=d+4|0;o=d;c[f>>2]=a;c[g>>2]=b;c[k>>2]=1;c[m>>2]=c[g>>2];c[n>>2]=0;c[o>>2]=0;if(!(c[f>>2]|0)){c[e>>2]=-2;p=c[e>>2]|0;l=d;return p|0}if(c[c[f>>2]>>2]&1|0){c[e>>2]=-3;p=c[e>>2]|0;l=d;return p|0}g=c[(c[f>>2]|0)+76>>2]|0;c[o>>2]=g;b=c[f>>2]|0;if(g|0){c[b+76>>2]=0;c[e>>2]=nc(c[o>>2]|0)|0;p=c[e>>2]|0;l=d;return p|0}c[h>>2]=b+112;c[o>>2]=oc(c[f>>2]|0)|0;if((c[o>>2]|0)==-18){c[e>>2]=c[o>>2];p=c[e>>2]|0;l=d;return p|0}while(1){if(!((c[o>>2]|0)!=-1&(c[o>>2]|0)!=1&(c[k>>2]|0)>0&(c[m>>2]|0)>0)){q=15;break}c[j>>2]=(c[m>>2]|0)<65536?c[m>>2]|0:65536;c[i>>2]=Pa(c[h>>2]|0,c[j>>2]|0)|0;c[k>>2]=pc(c[f>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;if((c[k>>2]|0)==-10){q=11;break}if((c[k>>2]|0)<=0)continue;Qa(c[h>>2]|0,c[k>>2]|0)|0;c[m>>2]=(c[m>>2]|0)-(c[k>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[k>>2]|0);c[o>>2]=oc(c[f>>2]|0)|0;if((c[o>>2]|0)==-18|(c[o>>2]|0)==-17){q=14;break}}if((q|0)==11){c[e>>2]=-10;p=c[e>>2]|0;l=d;return p|0}else if((q|0)==14){c[e>>2]=c[o>>2];p=c[e>>2]|0;l=d;return p|0}else if((q|0)==15){if((c[o>>2]|0)==-1)qc(c[f>>2]|0)|0;if(c[n>>2]|0){if((c[o>>2]|0)==-404)c[o>>2]=0;c[(c[f>>2]|0)+76>>2]=c[o>>2];c[e>>2]=c[n>>2];p=c[e>>2]|0;l=d;return p|0}switch(c[k>>2]|0){case -10:case -16:{c[e>>2]=c[k>>2];p=c[e>>2]|0;l=d;return p|0}default:{}}if((c[o>>2]|0)==-404){c[e>>2]=0;p=c[e>>2]|0;l=d;return p|0}else{c[e>>2]=nc(c[o>>2]|0)|0;p=c[e>>2]|0;l=d;return p|0}}return 0}function nc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;switch(c[e>>2]|0){case 0:{c[d>>2]=0;break}case 1:{c[d>>2]=-14;break}case -1:{c[d>>2]=-15;break}default:c[d>>2]=c[e>>2]}l=b;return c[d>>2]|0}function oc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;b=l;l=l+160|0;d=b+148|0;e=b+144|0;f=b+140|0;g=b+136|0;h=b+132|0;i=b+128|0;j=b+124|0;k=b+120|0;m=b+24|0;n=b+104|0;o=b+96|0;p=b+16|0;q=b+92|0;r=b+88|0;s=b+84|0;t=b+8|0;u=b+80|0;v=b;c[e>>2]=a;c[f>>2]=(c[e>>2]|0)+112;c[o>>2]=0;c[i>>2]=m;c[j>>2]=m+32;a:while(1){if(c[o>>2]|0){w=76;break}b:do if((c[o>>2]|0)==0?(c[(c[f>>2]|0)+392>>2]|0)!=-1:0)do{c[k>>2]=c[(c[f>>2]|0)+392>>2];c[g>>2]=xb(c[e>>2]|0,c[k>>2]|0)|0;if((c[g>>2]|0)==0?(a=zc(c[e>>2]|0,c[k>>2]|0)|0,c[g>>2]=a,(a|0)==0):0){w=7;break a}c[h>>2]=c[g>>2];c[q>>2]=Va(c[h>>2]|0,c[i>>2]|0)|0;if((c[q>>2]|0)==-1){a=(c[g>>2]|0)+440|0;x=c[a+4>>2]|0;y=(c[(c[g>>2]|0)+364>>2]|0)-1|0;z=((y|0)<0)<<31>>31;if((x|0)<(z|0)|((x|0)==(z|0)?(c[a>>2]|0)>>>0>>0:0)){w=10;break a}c[q>>2]=Va(c[h>>2]|0,c[i>>2]|0)|0;if((c[q>>2]|0)==-1){w=12;break a}c[(c[f>>2]|0)+440>>2]=1;c[(c[f>>2]|0)+436>>2]=c[(c[e>>2]|0)+64>>2];c[(c[f>>2]|0)+444>>2]=1}if((c[q>>2]|0)<=0)break b;y=(c[g>>2]|0)+440|0;a=y;z=Lf(c[a>>2]|0,c[a+4>>2]|0,1,0)|0;a=y;c[a>>2]=z;c[a+4>>2]=D;a=(c[i>>2]|0)+16|0;z=c[a+4>>2]|0;y=p;c[y>>2]=c[a>>2];c[y+4>>2]=z;c[r>>2]=Db(c[e>>2]|0,c[k>>2]|0)|0;do if(!((c[r>>2]|0)<0|(c[r>>2]|0)>=15)){if(((c[r>>2]|0)==6?1:(c[(c[g>>2]|0)+448>>2]|0)==0)?c[c[e>>2]>>2]&32|0:0)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>>2]|0)+436>>2];c[(c[j>>2]|0)+12>>2]=c[(c[e>>2]|0)+64>>2];c[(c[j>>2]|0)+16>>2]=c[(c[f>>2]|0)+440>>2];c[(c[j>>2]|0)+20>>2]=c[(c[f>>2]|0)+444>>2];do if(c[c[e>>2]>>2]&32|0){y=(c[f>>2]|0)+424|0;x=c[e>>2]|0;if((c[y>>2]|0)==-1?(c[y+4>>2]|0)==-1:0){c[s>>2]=Ec(x,m,c[k>>2]|0,c[g>>2]|0,c[f>>2]|0)|0;Fc(c[(c[e>>2]|0)+560>>2]|0,c[s>>2]|0)|0;w=45;break}if(!(Gc(c[x+560>>2]|0)|0)){x=(c[g>>2]|0)+488|0;y=c[x+4>>2]|0;z=t;c[z>>2]=c[x>>2];c[z+4>>2]=y;c[(c[g>>2]|0)+508>>2]=c[i>>2];Ic(c[(c[e>>2]|0)+560>>2]|0,4);c[(c[e>>2]|0)+76>>2]=0;if((ec(c[(c[e>>2]|0)+560>>2]|0,5)|0)==-1){w=36;break a}y=(c[e>>2]|0)+76|0;if((c[(c[e>>2]|0)+76>>2]|0)>0){c[o>>2]=c[y>>2];c[(c[e>>2]|0)+76>>2]=0;break}c[y>>2]=0;y=t;z=c[y+4>>2]|0;x=(c[g>>2]|0)+488|0;c[x>>2]=c[y>>2];c[x+4>>2]=z;if(!(Gc(c[(c[e>>2]|0)+560>>2]|0)|0)){c[u>>2]=Ec(c[e>>2]|0,m,c[k>>2]|0,c[g>>2]|0,c[f>>2]|0)|0;Fc(c[(c[e>>2]|0)+560>>2]|0,c[u>>2]|0)|0;w=45}else w=41}else w=41}else w=41;while(0);do if((w|0)==41){w=0;if(c[(c[g>>2]|0)+468>>2]|0){c[o>>2]=wa[c[(c[g>>2]|0)+468>>2]&15](c[e>>2]|0,m,c[k>>2]|0,c[(c[g>>2]|0)+472>>2]|0)|0;w=45;break}if(c[(c[f>>2]|0)+396>>2]|0){c[o>>2]=wa[c[(c[f>>2]|0)+396>>2]&15](c[e>>2]|0,m,c[k>>2]|0,c[(c[f>>2]|0)+400>>2]|0)|0;w=45}else w=45}while(0);if((w|0)==45){w=0;if((c[(c[f>>2]|0)+436>>2]|0)==(c[(c[e>>2]|0)+64>>2]|0)){z=(c[f>>2]|0)+444|0;c[z>>2]=(c[z>>2]|0)+1}else{c[(c[f>>2]|0)+436>>2]=c[(c[e>>2]|0)+64>>2];c[(c[f>>2]|0)+444>>2]=1}c[(c[f>>2]|0)+440>>2]=1;if(!(c[(c[i>>2]|0)+8>>2]|0))c[(c[g>>2]|0)+420>>2]=1}}while(!(c[o>>2]|0));while(0);if((c[o>>2]|0)==1|(c[o>>2]|0)==-1|(c[o>>2]|0)==-17){w=51;break}if((Kc(c[e>>2]|0,n)|0)<0){w=53;break}c[k>>2]=Ja(n)|0;c[(c[f>>2]|0)+392>>2]=c[k>>2];c[g>>2]=xb(c[e>>2]|0,c[k>>2]|0)|0;z=c[e>>2]|0;x=c[k>>2]|0;if(!(c[g>>2]|0)){y=zc(z,x)|0;c[g>>2]=y;if(!y){w=56;break}Lc(c[e>>2]|0,n,c[k>>2]|0)|0;if(c[c[e>>2]>>2]&32|0)Mc(c[e>>2]|0,n,c[k>>2]|0,0)|0}else if((Db(z,x)|0)==9)Lc(c[e>>2]|0,n,c[k>>2]|0)|0;c[h>>2]=c[g>>2];x=Ia(n)|0;z=v;c[z>>2]=x;c[z+4>>2]=D;z=v;x=c[z+4>>2]|0;y=(c[g>>2]|0)+496|0;c[y>>2]=c[z>>2];c[y+4>>2]=x;if(c[(c[e>>2]|0)+88>>2]|0){x=v;if((c[x>>2]|0)!=-1?1:(c[x+4>>2]|0)!=-1)w=64;else w=65}else{x=v;if((c[(c[g>>2]|0)+448>>2]|0)!=0&((c[x>>2]|0)!=-1?1:(c[x+4>>2]|0)!=-1))w=64;else w=65}if((w|0)==64){w=0;x=v;y=Cc(c[e>>2]|0,c[k>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;A=c[f>>2]|0;B=y;C=D;w=67}else if((w|0)==65?(w=0,y=v,(c[y>>2]|0)==0&(c[y+4>>2]|0)==0):0){A=c[f>>2]|0;B=0;C=0;w=67}if((w|0)==67){w=0;y=A+416|0;c[y>>2]=B;c[y+4>>2]=C}if(!(c[(c[g>>2]|0)+476>>2]|0)){if(c[(c[f>>2]|0)+404>>2]|0)c[o>>2]=wa[c[(c[f>>2]|0)+404>>2]&15](c[e>>2]|0,n,c[k>>2]|0,c[(c[f>>2]|0)+408>>2]|0)|0}else c[o>>2]=wa[c[(c[g>>2]|0)+476>>2]&15](c[e>>2]|0,n,c[k>>2]|0,c[(c[g>>2]|0)+480>>2]|0)|0;Sa(c[h>>2]|0,n)|0;y=(Ga(n)|0)!=0;x=(c[f>>2]|0)+440|0;if(!y){c[x>>2]=1;c[(c[f>>2]|0)+436>>2]=c[(c[e>>2]|0)+64>>2];c[(c[f>>2]|0)+444>>2]=0;continue}if((c[x>>2]|0)==-1)continue;x=(c[f>>2]|0)+440|0;c[x>>2]=(c[x>>2]|0)+1}if((w|0)==7){c[d>>2]=-18;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==10){c[d>>2]=-17;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==12){c[d>>2]=-17;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==36){c[d>>2]=-17;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==51){c[d>>2]=c[o>>2];E=c[d>>2]|0;l=b;return E|0}else if((w|0)==53){c[d>>2]=-404;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==56){c[d>>2]=-18;E=c[d>>2]|0;l=b;return E|0}else if((w|0)==76){c[d>>2]=c[o>>2];E=c[d>>2]|0;l=b;return E|0}return 0}function pc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=c[g>>2]|0;do if(c[(c[g>>2]|0)+4>>2]|0){b=zf(c[d+4>>2]|0)|0;a=jf(b,c[h>>2]|0,c[i>>2]|0)|0;c[k>>2]=a;if((a|0)==0?rf(c[(c[g>>2]|0)+4>>2]|0)|0:0){c[f>>2]=-10;m=c[f>>2]|0;l=e;return m|0}}else{a=c[d+8>>2]|0;c[j>>2]=a;if(!a){c[f>>2]=-3;m=c[f>>2]|0;l=e;return m|0}if(c[c[j>>2]>>2]|0){c[k>>2]=ta[c[c[j>>2]>>2]&7](c[(c[j>>2]|0)+4>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;break}c[f>>2]=-1;m=c[f>>2]|0;l=e;return m|0}while(0);c[f>>2]=c[k>>2];m=c[f>>2]|0;l=e;return m|0}function qc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;do if(!(c[e>>2]|0))c[d>>2]=-2;else{if(c[c[e>>2]>>2]&1|0){c[d>>2]=-3;break}rc(c[e>>2]|0);if(c[(c[e>>2]|0)+4>>2]|0?(sc(c[e>>2]|0,c[(c[e>>2]|0)+64>>2]|0,-1,-1,0)|0)<0:0){c[d>>2]=-10;break}c[d>>2]=0}while(0);l=b;return c[d>>2]|0}function rc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;bc(c[(c[d>>2]|0)+80>>2]|0,6)|0;l=b;return}function sc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=l;l=l+32|0;h=g+16|0;i=g+12|0;j=g;k=g+8|0;c[h>>2]=a;c[i>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;c[k>>2]=f;rc(c[h>>2]|0);f=j;j=tc(c[h>>2]|0,c[i>>2]|0,c[f>>2]|0,c[f+4>>2]|0,c[k>>2]|0)|0;l=g;return j|0}function tc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m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>2]=-10;k=c[f>>2]|0;l=e;return k|0}}else{g=c[d+8>>2]|0;c[j>>2]=g;if(!g){c[f>>2]=-3;k=c[f>>2]|0;l=e;return k|0}if(!(c[(c[j>>2]|0)+16>>2]|0)){c[f>>2]=-1;k=c[f>>2]|0;l=e;return k|0}if((ta[c[(c[j>>2]|0)+16>>2]&7](c[(c[j>>2]|0)+20>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)==-1){c[f>>2]=-1;k=c[f>>2]|0;l=e;return k|0}}c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}function wc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;a=c[e>>2]|0;do if(c[(c[e>>2]|0)+4>>2]|0){h=Af(c[a+4>>2]|0)|0;c[g>>2]=h;if((h|0)==-1){ve()|0;c[d>>2]=-1}else i=10}else{h=c[a+8>>2]|0;c[f>>2]=h;if(!h){c[d>>2]=-3;break}if(!(c[(c[f>>2]|0)+24>>2]|0)){c[d>>2]=-1;break}h=va[c[(c[f>>2]|0)+24>>2]&15](c[(c[f>>2]|0)+28>>2]|0)|0;c[g>>2]=h;if((h|0)==-1)c[d>>2]=-1;else i=10}while(0);if((i|0)==10)c[d>>2]=c[g>>2];l=b;return c[d>>2]|0}function xc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;a=(c[d>>2]|0)+488|0;c[a>>2]=-1;c[a+4>>2]=-1;l=b;return 0}function yc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];if((c[(c[e>>2]|0)+336>>2]|0)==-1){l=b;return 0}Ua(c[e>>2]|0)|0;l=b;return 0}function zc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[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l+32|0;g=f+8|0;h=f+24|0;i=f+20|0;j=f;k=f+16|0;c[h>>2]=a;c[i>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;do if(!(c[h>>2]|0)){e=g;c[e>>2]=-2;c[e+4>>2]=-1}else{e=j;if((c[e>>2]|0)==-1?(c[e+4>>2]|0)==-1:0){e=g;c[e>>2]=-1;c[e+4>>2]=-1;break}e=c[h>>2]|0;if((c[i>>2]|0)==-1){if(c[e+88>>2]|0){b=j;d=ya[c[(c[h>>2]|0)+88>>2]&31](c[h>>2]|0,c[i>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[(c[h>>2]|0)+92>>2]|0)|0;b=g;c[b>>2]=d;c[b+4>>2]=D;break}}else{c[k>>2]=xb(e,c[i>>2]|0)|0;if(!(c[k>>2]|0)){e=g;c[e>>2]=-1;c[e+4>>2]=-1;break}if(c[(c[k>>2]|0)+448>>2]|0){e=j;b=ya[c[(c[k>>2]|0)+448>>2]&31](c[h>>2]|0,c[i>>2]|0,c[e>>2]|0,c[e+4>>2]|0,c[(c[k>>2]|0)+452>>2]|0)|0;e=g;c[e>>2]=b;c[e+4>>2]=D;break}if(c[(c[h>>2]|0)+88>>2]|0){e=j;b=ya[c[(c[h>>2]|0)+88>>2]&31](c[h>>2]|0,c[i>>2]|0,c[e>>2]|0,c[e+4>>2]|0,c[(c[h>>2]|0)+92>>2]|0)|0;e=g;c[e>>2]=b;c[e+4>>2]=D;break}}e=g;c[e>>2]=-1;c[e+4>>2]=-1}while(0);h=g;D=c[h+4>>2]|0;l=f;return c[h>>2]|0}function Dc(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0;g=l;l=l+32|0;h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;m=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[m>>2]=-1;c[n>>2]=-1;switch(c[(c[i>>2]|0)+360>>2]|0){case 1:{if((c[(c[k>>2]|0)+4>>2]|0)>7?(De(c[c[k>>2]>>2]|0,2728,7)|0)==0:0)c[m>>2]=7;break}case 3:case 2:{c[m>>2]=0;break}case 0:{if((c[(c[k>>2]|0)+4>>2]|0)>7?(De(c[c[k>>2]>>2]|0,2736,7)|0)==0:0)c[m>>2]=7;break}case 11:{if((c[(c[k>>2]|0)+4>>2]|0)>9?(De(c[c[k>>2]>>2]|0,2744,8)|0)==0:0)c[m>>2]=9;break}case 8:{if((c[(c[k>>2]|0)+4>>2]|0)>4?((d[c[c[k>>2]>>2]>>0]|0)&7|0)==4:0){c[n>>2]=((d[(c[c[k>>2]>>2]|0)+1>>0]|0)<<16)+((d[(c[c[k>>2]>>2]|0)+2>>0]|0)<<8)+(d[(c[c[k>>2]>>2]|0)+3>>0]|0);c[m>>2]=4}break}case 13:{if((c[(c[k>>2]|0)+4>>2]|0)>8?(De(c[c[k>>2]>>2]|0,2753,8)|0)==0:0)c[m>>2]=8;break}case 14:{if((c[(c[k>>2]|0)+4>>2]|0)>7?(De(c[c[k>>2]>>2]|0,2762,7)|0)==0:0)c[m>>2]=7;break}default:{}}if((c[n>>2]|0)==-1)c[n>>2]=(c[(c[k>>2]|0)+4>>2]|0)-(c[m>>2]|0);if((c[m>>2]|0)<0){l=g;return 0}Tc(c[h>>2]|0,c[j>>2]|0,(c[c[k>>2]>>2]|0)+(c[m>>2]|0)|0,c[n>>2]|0)|0;l=g;return 0}function Ec(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;m=g+12|0;n=g+8|0;o=g+4|0;p=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[m>>2]=e;c[n>>2]=f;c[p>>2]=c[j>>2];f=Cf(72)|0;c[o>>2]=f;if(!f){c[h>>2]=0;q=c[h>>2]|0;l=g;return q|0}f=c[o>>2]|0;e=c[j>>2]|0;j=f+56|0;do{c[f>>2]=c[e>>2];f=f+4|0;e=e+4|0}while((f|0)<(j|0));e=Cf(c[(c[p>>2]|0)+4>>2]|0)|0;c[c[o>>2]>>2]=e;f=c[o>>2]|0;if(!e){Df(f);c[h>>2]=0;q=c[h>>2]|0;l=g;return q|0}else{Wf(c[f>>2]|0,c[c[p>>2]>>2]|0,c[(c[p>>2]|0)+4>>2]|0)|0;c[(c[o>>2]|0)+56>>2]=c[m>>2];c[(c[o>>2]|0)+68>>2]=c[k>>2];c[(c[o>>2]|0)+60>>2]=c[n>>2];c[(c[o>>2]|0)+64>>2]=c[i>>2];c[h>>2]=c[o>>2];q=c[h>>2]|0;l=g;return q|0}return 0}function Fc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=-1;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=Cf(12)|0;if(!(c[h>>2]|0)){c[e>>2]=-1;i=c[e>>2]|0;l=d;return i|0}else{c[(c[h>>2]|0)+8>>2]=c[g>>2];c[c[h>>2]>>2]=c[(c[f>>2]|0)+4>>2];c[(c[h>>2]|0)+4>>2]=c[(c[(c[f>>2]|0)+4>>2]|0)+4>>2];c[c[(c[h>>2]|0)+4>>2]>>2]=c[h>>2];c[(c[c[h>>2]>>2]|0)+4>>2]=c[h>>2];c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}return 0}function Gc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=a;l=b;return (c[c[c[d>>2]>>2]>>2]|0)==(c[(c[d>>2]|0)+4>>2]|0)|0}function Hc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+16|0;d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[f>>2]=c[e>>2];e=(c[f>>2]|0)+32|0;do if(((c[e>>2]|0)==-1?(c[e+4>>2]|0)==-1:0)?(a=(c[(c[f>>2]|0)+56>>2]|0)+488|0,(c[a>>2]|0)!=-1?1:(c[a+4>>2]|0)!=-1):0){c[g>>2]=Db(c[(c[f>>2]|0)+64>>2]|0,c[(c[f>>2]|0)+68>>2]|0)|0;if(!((c[g>>2]|0)<0|(c[g>>2]|0)>=15)){a=(c[(c[f>>2]|0)+56>>2]|0)+488|0;h=Sc(c[g>>2]|0,c[a>>2]|0,c[a+4>>2]|0,c[(c[f>>2]|0)+56>>2]|0,c[f>>2]|0,c[(c[(c[f>>2]|0)+56>>2]|0)+508>>2]|0)|0;a=(c[f>>2]|0)+32|0;c[a>>2]=h;c[a+4>>2]=D;a=(c[f>>2]|0)+32|0;h=c[a+4>>2]|0;i=(c[(c[f>>2]|0)+56>>2]|0)+488|0;c[i>>2]=c[a>>2];c[i+4>>2]=h;c[(c[(c[f>>2]|0)+56>>2]|0)+508>>2]=c[f>>2];break}c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}while(0);c[d>>2]=1;j=c[d>>2]|0;l=b;return j|0}function Ic(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[(c[(c[e>>2]|0)+4>>2]|0)+4>>2];while(1){if((c[g>>2]|0)==(c[c[e>>2]>>2]|0)){h=5;break}if(!(va[c[f>>2]&15](c[(c[g>>2]|0)+8>>2]|0)|0)){h=5;break}c[g>>2]=c[(c[g>>2]|0)+4>>2]}if((h|0)==5){l=d;return}}function Jc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+32|0;d=b+28|0;e=b+24|0;f=b+20|0;g=b+8|0;h=b;i=b+16|0;c[e>>2]=a;c[f>>2]=c[e>>2];e=(c[f>>2]|0)+32|0;if((c[e>>2]|0)==-1?(c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;c[e>>2]=c[i>>2];c[e+4>>2]=g;g=h;h=c[g+4>>2]|0;e=(c[(c[f>>2]|0)+60>>2]|0)+416|0;c[e>>2]=c[g>>2];c[e+4>>2]=h;gc(c[f>>2]|0);c[d>>2]=1;j=c[d>>2]|0;l=b;return j|0}function Kc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;d=l;l=l+32|0;e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=(c[f>>2]|0)+112;c[j>>2]=0;b=(c[f>>2]|0)+64|0;c[b>>2]=(c[b>>2]|0)+(c[(c[h>>2]|0)+432>>2]|0);while(1){c[i>>2]=Ra(c[h>>2]|0,c[g>>2]|0)|0;if(!(c[i>>2]|0)){k=3;break}b=c[i>>2]|0;if((c[i>>2]|0)<0){a=(c[f>>2]|0)+64|0;c[a>>2]=(c[a>>2]|0)+(0-b)}else{c[(c[h>>2]|0)+432>>2]=b;c[j>>2]=1}if(!((c[j>>2]|0)!=0^1)){k=8;break}}if((k|0)==3){c[e>>2]=-2;m=c[e>>2]|0;l=d;return m|0}else if((k|0)==8){c[e>>2]=c[(c[f>>2]|0)+64>>2];m=c[e>>2]|0;l=d;return m|0}return 0}function Lc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Qc(c[f>>2]|0,c[h>>2]|0,c[(c[g>>2]|0)+8>>2]|0,c[(c[g>>2]|0)+12>>2]|0)|0;l=e;return d|0}function Mc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=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0;m=r;r=Uf(1e3,0,c[m>>2]|0,c[m+4>>2]|0)|0;ub(o,n,q,g,r,D)|0;vb(c[j>>2]|0,c[p>>2]|0,c[s>>2]|0)|0;c[t>>2]=Pc(c[j>>2]|0,c[k>>2]|0)|0;wb(c[j>>2]|0,c[k>>2]|0,(c[t>>2]|0)+1|0)|0;c[i>>2]=1;u=c[i>>2]|0;l=h;return u|0}return 0}function Oc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;do if(!(c[(c[f>>2]|0)+88>>2]|0)){c[h>>2]=xb(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[e>>2]=-20;break}if(c[(c[h>>2]|0)+448>>2]|0){c[e>>2]=1;break}else{c[e>>2]=0;break}}else c[e>>2]=1;while(0);l=d;return c[e>>2]|0}function Pc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=-2;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=xb(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[e>>2]=-20;i=c[e>>2]|0;l=d;return i|0}else{c[e>>2]=c[(c[h>>2]|0)+364>>2];i=c[e>>2]|0;l=d;return i|0}return 0}function Qc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0;f=l;l=l+32|0;g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;m=f+4|0;n=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=0;while(1){if((c[m>>2]|0)>=15){o=7;break}c[n>>2]=1032+((c[m>>2]|0)*24|0);if((c[k>>2]|0)>=(c[(c[n>>2]|0)+4>>2]|0)?(De(c[j>>2]|0,c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+4>>2]|0)|0)==0:0){o=5;break}c[m>>2]=(c[m>>2]|0)+1}if((o|0)==5){Rc(c[h>>2]|0,c[i>>2]|0,c[m>>2]|0)|0;c[g>>2]=1;p=c[g>>2]|0;l=f;return p|0}else if((o|0)==7){Rc(c[h>>2]|0,c[i>>2]|0,15)|0;c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}return 0}function Rc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=xb(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-20;k=c[f>>2]|0;l=e;return k|0}else{c[(c[j>>2]|0)+360>>2]=c[i>>2];c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function Sc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;h=l;l=l+32|0;i=h+8|0;j=h+28|0;k=h;m=h+24|0;n=h+20|0;o=h+16|0;c[j>>2]=a;a=k;c[a>>2]=b;c[a+4>>2]=d;c[m>>2]=e;c[n>>2]=f;c[o>>2]=g;if(c[1032+((c[j>>2]|0)*24|0)+20>>2]|0){g=k;k=ya[c[1032+((c[j>>2]|0)*24|0)+20>>2]&31](c[g>>2]|0,c[g+4>>2]|0,c[m>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;o=i;c[o>>2]=k;c[o+4>>2]=D;p=i;q=p;r=c[q>>2]|0;s=p+4|0;t=s;u=c[t>>2]|0;D=u;l=h;return r|0}else{o=i;c[o>>2]=0;c[o+4>>2]=0;p=i;q=p;r=c[q>>2]|0;s=p+4|0;t=s;u=c[t>>2]|0;D=u;l=h;return r|0}return 0}function Tc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=l;l=l+64|0;h=g+56|0;i=g+52|0;j=g+48|0;k=g+44|0;m=g+40|0;n=g+36|0;o=g+32|0;p=g+28|0;q=g+24|0;r=g+20|0;s=g+16|0;t=g+12|0;u=g+8|0;v=g+4|0;w=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[m>>2]=f;c[o>>2]=c[k>>2];c[w>>2]=0;if((c[m>>2]|0)<8){c[h>>2]=-1;x=c[h>>2]|0;l=g;return x|0}c[t>>2]=(c[o>>2]|0)+(c[m>>2]|0);c[s>>2]=a[(c[o>>2]|0)+3>>0]<<24&-16777216|a[(c[o>>2]|0)+2>>0]<<16&16711680|a[(c[o>>2]|0)+1>>0]<<8&65280|a[c[o>>2]>>0]&255;c[o>>2]=(c[o>>2]|0)+4;if((c[s>>2]|0)>>>0>((c[t>>2]|0)-(c[o>>2]|0)|0)>>>0){c[h>>2]=-1;x=c[h>>2]|0;l=g;return x|0}c[n>>2]=xb(c[i>>2]|0,c[j>>2]|0)|0;if(!(c[n>>2]|0)){c[h>>2]=-20;x=c[h>>2]|0;l=g;return x|0}if((c[s>>2]|0)>>>0>0){m=Uc(c[o>>2]|0,c[s>>2]|0)|0;c[w>>2]=m;if(!m){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}m=(Vc(c[i>>2]|0,c[j>>2]|0,c[w>>2]|0)|0)==-18;Df(c[w>>2]|0);if(m){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}}c[o>>2]=(c[o>>2]|0)+(c[s>>2]|0);if(((c[o>>2]|0)+4|0)>>>0>(c[t>>2]|0)>>>0){c[h>>2]=-1;x=c[h>>2]|0;l=g;return x|0}c[q>>2]=a[(c[o>>2]|0)+3>>0]<<24&-16777216|a[(c[o>>2]|0)+2>>0]<<16&16711680|a[(c[o>>2]|0)+1>>0]<<8&65280|a[c[o>>2]>>0]&255;c[o>>2]=(c[o>>2]|0)+4;c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[q>>2]|0)){y=34;break}if(((c[o>>2]|0)+4|0)>>>0>(c[t>>2]|0)>>>0){y=17;break}c[s>>2]=a[(c[o>>2]|0)+3>>0]<<24&-16777216|a[(c[o>>2]|0)+2>>0]<<16&16711680|a[(c[o>>2]|0)+1>>0]<<8&65280|a[c[o>>2]>>0]&255;c[o>>2]=(c[o>>2]|0)+4;if((c[s>>2]|0)>>>0>((c[t>>2]|0)-(c[o>>2]|0)|0)>>>0){y=19;break}c[r>>2]=0;c[u>>2]=c[o>>2];c[v>>2]=Wc(c[o>>2]|0,61,c[s>>2]|0)|0;if(c[v>>2]|0){a[c[v>>2]>>0]=0;c[v>>2]=(c[v>>2]|0)+1;c[r>>2]=(c[o>>2]|0)+(c[s>>2]|0)-(c[v>>2]|0)}if(c[r>>2]|0){m=Uc(c[v>>2]|0,c[r>>2]|0)|0;c[w>>2]=m;if(!m){y=24;break}m=(Xc(c[n>>2]|0,c[u>>2]|0,c[w>>2]|0)|0)==0;Df(c[w>>2]|0);if(m){y=26;break}}else{m=Uc(c[u>>2]|0,c[s>>2]|0)|0;c[w>>2]=m;if(!m){y=28;break}m=(Xc(c[n>>2]|0,c[w>>2]|0,0)|0)==0;Df(c[w>>2]|0);if(m){y=30;break}}if(c[v>>2]|0)a[(c[v>>2]|0)+-1>>0]=61;c[o>>2]=(c[o>>2]|0)+(c[s>>2]|0);c[p>>2]=(c[p>>2]|0)+1}if((y|0)==17){c[h>>2]=-1;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==19){c[h>>2]=-1;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==24){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==26){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==28){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==30){c[h>>2]=-18;x=c[h>>2]|0;l=g;return x|0}else if((y|0)==34){c[h>>2]=0;x=c[h>>2]|0;l=g;return x|0}return 0}function Uc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=b;c[h>>2]=d;do if(c[g>>2]|0){if(!(c[h>>2]|0)){c[f>>2]=0;break}c[h>>2]=(c[h>>2]|0)>>>0<4294967294?c[h>>2]|0:-2;c[i>>2]=Cf((c[h>>2]|0)+1|0)|0;if(!(c[i>>2]|0)){c[f>>2]=0;break}d=(vf(c[i>>2]|0,c[g>>2]|0,c[h>>2]|0)|0)==0;b=c[i>>2]|0;if(d){Df(b);c[f>>2]=0;break}else{a[b+(c[h>>2]|0)>>0]=0;c[f>>2]=c[i>>2];break}}else c[f>>2]=0;while(0);l=e;return c[f>>2]|0}function Vc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;k=c[f>>2]|0;l=e;return k|0}c[j>>2]=xb(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-20;k=c[f>>2]|0;l=e;return k|0}if(c[(c[j>>2]|0)+412>>2]|0)Df(c[(c[j>>2]|0)+412>>2]|0);h=ed(c[i>>2]|0)|0;c[(c[j>>2]|0)+412>>2]=h;if(!h){c[f>>2]=-18;k=c[f>>2]|0;l=e;return k|0}else{c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function Wc(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+12|0;h=f+8|0;i=f+16|0;j=f+4|0;k=f;c[h>>2]=b;a[i>>0]=d;c[j>>2]=e;c[k>>2]=0;while(1){if(!(a[c[h>>2]>>0]|0)){m=7;break}if((c[k>>2]|0)>=(c[j>>2]|0)){m=7;break}if((a[c[h>>2]>>0]|0)==(a[i>>0]|0)){m=5;break}c[k>>2]=(c[k>>2]|0)+1;c[h>>2]=(c[h>>2]|0)+1}if((m|0)==5){c[g>>2]=c[h>>2];n=c[g>>2]|0;l=f;return n|0}else if((m|0)==7){c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}return 0}function Xc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;e=l;l=l+32|0;f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;m=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[m>>2]=0;a:while(1){d=c[m>>2]|0;if((d|0)>=(Yc(c[(c[g>>2]|0)+416>>2]|0)|0)){n=14;break}c[j>>2]=Zc(c[(c[g>>2]|0)+416>>2]|0,c[m>>2]|0)|0;do if(c[c[j>>2]>>2]|0?(ef(c[h>>2]|0,c[c[j>>2]>>2]|0)|0)==0:0){d=c[i>>2]|0;if(!(c[(c[j>>2]|0)+4>>2]|0))if(!d){n=7;break a}else break;if(d|0?(Ce(c[i>>2]|0,c[(c[j>>2]|0)+4>>2]|0)|0)==0:0){n=12;break a}if((c[i>>2]|0)==0?(c[(c[j>>2]|0)+4>>2]|0)==0:0){n=12;break a}}while(0);c[m>>2]=(c[m>>2]|0)+1}if((n|0)==7){c[f>>2]=c[j>>2];o=c[f>>2]|0;l=e;return o|0}else if((n|0)==12){c[f>>2]=c[j>>2];o=c[f>>2]|0;l=e;return o|0}else if((n|0)==14){n=_c(c[h>>2]|0,c[i>>2]|0)|0;c[k>>2]=n;if(!n){c[f>>2]=0;o=c[f>>2]|0;l=e;return o|0}else{c[f>>2]=$c(c[(c[g>>2]|0)+416>>2]|0,c[k>>2]|0)|0;o=c[f>>2]|0;l=e;return o|0}}return 0}function Yc(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;if(!(c[e>>2]|0)){c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}else{c[d>>2]=c[(c[e>>2]|0)+4>>2];f=c[d>>2]|0;l=b;return f|0}return 0}function Zc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}if((c[g>>2]|0)>=(c[(c[f>>2]|0)+4>>2]|0)){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=c[(c[(c[f>>2]|0)+8>>2]|0)+(c[g>>2]<<2)>>2];h=c[e>>2]|0;l=d;return h|0}return 0}function _c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(dd(c[f>>2]|0)|0)){c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=Cf(8)|0;if(!(c[h>>2]|0)){c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}b=ed(c[f>>2]|0)|0;c[c[h>>2]>>2]=b;if(!(c[c[h>>2]>>2]|0)){Df(c[h>>2]|0);c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}if(c[g>>2]|0){b=ed(c[g>>2]|0)|0;c[(c[h>>2]|0)+4>>2]=b;if(!(c[(c[h>>2]|0)+4>>2]|0)){Df(c[c[h>>2]>>2]|0);Df(c[h>>2]|0);c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}}else c[(c[h>>2]|0)+4>>2]=0;c[e>>2]=c[h>>2];i=c[e>>2]|0;l=d;return i|0}function $c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if(!(ad(c[f>>2]|0)|0)){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}else{c[(c[(c[f>>2]|0)+8>>2]|0)+((c[(c[f>>2]|0)+4>>2]|0)-1<<2)>>2]=c[g>>2];bd(c[f>>2]|0);c[e>>2]=c[g>>2];h=c[e>>2]|0;l=d;return h|0}return 0}function ad(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;a=(c[e>>2]|0)+4|0;c[a>>2]=(c[a>>2]|0)+1;do if((c[(c[e>>2]|0)+4>>2]|0)>(c[c[e>>2]>>2]|0)){if(!(c[c[e>>2]>>2]|0))c[g>>2]=1;else c[g>>2]=c[c[e>>2]>>2]<<1;c[f>>2]=Ff(c[(c[e>>2]|0)+8>>2]|0,c[g>>2]<<2)|0;if(c[f>>2]|0){c[c[e>>2]>>2]=c[g>>2];c[(c[e>>2]|0)+8>>2]=c[f>>2];break}a=(c[e>>2]|0)+4|0;c[a>>2]=(c[a>>2]|0)+-1;c[d>>2]=0;h=c[d>>2]|0;l=b;return h|0}while(0);c[d>>2]=c[e>>2];h=c[d>>2]|0;l=b;return h|0}function bd(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;if(!(c[(c[d>>2]|0)+12>>2]|0)){l=b;return}c[e>>2]=(c[(c[d>>2]|0)+4>>2]|0)-1;while(1){if((c[e>>2]|0)<=0){f=6;break}if((ta[c[(c[d>>2]|0)+12>>2]&7](c[(c[(c[d>>2]|0)+8>>2]|0)+((c[e>>2]|0)-1<<2)>>2]|0,c[(c[(c[d>>2]|0)+8>>2]|0)+(c[e>>2]<<2)>>2]|0,c[(c[d>>2]|0)+16>>2]|0)|0)<=0){f=6;break}cd(c[(c[d>>2]|0)+8>>2]|0,c[e>>2]|0,(c[e>>2]|0)-1|0);c[e>>2]=(c[e>>2]|0)+-1}if((f|0)==6){l=b;return}}function cd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[(c[f>>2]|0)+(c[g>>2]<<2)>>2];c[(c[f>>2]|0)+(c[g>>2]<<2)>>2]=c[(c[f>>2]|0)+(c[h>>2]<<2)>>2];c[(c[f>>2]|0)+(c[h>>2]<<2)>>2]=c[i>>2];l=e;return}function dd(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+8|0;f=d+4|0;g=d;c[f>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}c[g>>2]=c[f>>2];while(1){if(!(a[c[g>>2]>>0]|0)){i=10;break}if((a[c[g>>2]>>0]|0)<32){i=8;break}if((a[c[g>>2]>>0]|0)>125){i=8;break}if((a[c[g>>2]>>0]|0)==61){i=8;break}c[g>>2]=(c[g>>2]|0)+1}if((i|0)==8){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}else if((i|0)==10){c[e>>2]=1;h=c[e>>2]|0;l=d;return h|0}return 0}function ed(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;do if(c[e>>2]|0){c[f>>2]=Cf((fd(c[e>>2]|0)|0)+1|0)|0;if(!(c[f>>2]|0)){c[d>>2]=0;break}else{c[d>>2]=gf(c[f>>2]|0,c[e>>2]|0)|0;break}}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function fd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;if(!(c[e>>2]|0)){c[d>>2]=0;g=c[d>>2]|0;l=b;return g|0}else{c[f>>2]=ff(c[e>>2]|0)|0;c[d>>2]=(c[f>>2]|0)>>>0<4294967294?c[f>>2]|0:-2;g=c[d>>2]|0;l=b;return g|0}return 0}function gd(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;c[(c[e>>2]|0)+412>>2]=0;a=Wb()|0;c[(c[e>>2]|0)+416>>2]=a;if(!(c[(c[e>>2]|0)+416>>2]|0)){c[d>>2]=-1;f=c[d>>2]|0;l=b;return f|0}else{id(c[(c[e>>2]|0)+416>>2]|0,3,0)|0;c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}return 0}function hd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;c[g>>2]=a;c[h>>2]=b;c[e>>2]=d;do if((c[g>>2]|0)!=(c[h>>2]|0)){if(!((c[g>>2]|0)!=0&(c[h>>2]|0)!=0)){c[f>>2]=0;break}if(ef(c[c[g>>2]>>2]|0,c[c[h>>2]>>2]|0)|0){c[f>>2]=0;break}if(Ce(c[(c[g>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+4>>2]|0)|0){c[f>>2]=0;break}else{c[f>>2]=1;break}}else c[f>>2]=1;while(0);l=e;return c[f>>2]|0}function id(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[(c[f>>2]|0)+12>>2]=c[g>>2];c[(c[f>>2]|0)+16>>2]=c[h>>2];if(!(c[g>>2]|0)){l=e;return 0}jd(c[f>>2]|0,0,(c[(c[f>>2]|0)+4>>2]|0)-1|0);l=e;return 0}function jd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[k>>2]=c[(c[f>>2]|0)+8>>2];if((c[g>>2]|0)>=(c[h>>2]|0)){l=e;return}cd(c[k>>2]|0,c[g>>2]|0,((c[g>>2]|0)+(c[h>>2]|0)|0)/2|0);c[j>>2]=c[g>>2];c[i>>2]=(c[g>>2]|0)+1;while(1){if((c[i>>2]|0)>(c[h>>2]|0))break;if((ta[c[(c[f>>2]|0)+12>>2]&7](c[(c[k>>2]|0)+(c[i>>2]<<2)>>2]|0,c[(c[k>>2]|0)+(c[g>>2]<<2)>>2]|0,c[(c[f>>2]|0)+16>>2]|0)|0)<0){d=c[k>>2]|0;b=(c[j>>2]|0)+1|0;c[j>>2]=b;cd(d,b,c[i>>2]|0)}c[i>>2]=(c[i>>2]|0)+1}cd(c[k>>2]|0,c[g>>2]|0,c[j>>2]|0);jd(c[f>>2]|0,c[g>>2]|0,(c[j>>2]|0)-1|0);jd(c[f>>2]|0,(c[j>>2]|0)+1|0,c[h>>2]|0);l=e;return}function kd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;j=c[f>>2]|0;l=e;return j|0}if(c[(c[g>>2]|0)+4>>2]|0){c[f>>2]=-3;j=c[f>>2]|0;l=e;return j|0}if((c[(c[g>>2]|0)+8>>2]|0)==0?(ld(c[g>>2]|0)|0)==-1:0){c[f>>2]=-18;j=c[f>>2]|0;l=e;return j|0}c[c[(c[g>>2]|0)+8>>2]>>2]=c[h>>2];c[(c[(c[g>>2]|0)+8>>2]|0)+4>>2]=c[i>>2];c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}function ld(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;a=Cf(40)|0;c[(c[e>>2]|0)+8>>2]=a;if(!(c[(c[e>>2]|0)+8>>2]|0)){c[d>>2]=-1;f=c[d>>2]|0;l=b;return f|0}else{a=c[(c[e>>2]|0)+8>>2]|0;e=a+40|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(e|0));c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}return 0}function md(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;j=c[f>>2]|0;l=e;return j|0}if(c[(c[g>>2]|0)+4>>2]|0){c[f>>2]=-3;j=c[f>>2]|0;l=e;return j|0}if((c[(c[g>>2]|0)+8>>2]|0)==0?(ld(c[g>>2]|0)|0)==-1:0){c[f>>2]=-18;j=c[f>>2]|0;l=e;return j|0}c[(c[(c[g>>2]|0)+8>>2]|0)+16>>2]=c[h>>2];c[(c[(c[g>>2]|0)+8>>2]|0)+20>>2]=c[i>>2];c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}function nd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0)){c[f>>2]=-2;j=c[f>>2]|0;l=e;return j|0}if(c[(c[g>>2]|0)+4>>2]|0){c[f>>2]=-3;j=c[f>>2]|0;l=e;return j|0}if((c[(c[g>>2]|0)+8>>2]|0)==0?(ld(c[g>>2]|0)|0)==-1:0){c[f>>2]=-18;j=c[f>>2]|0;l=e;return j|0}c[(c[(c[g>>2]|0)+8>>2]|0)+24>>2]=c[h>>2];c[(c[(c[g>>2]|0)+8>>2]|0)+28>>2]=c[i>>2];c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}function od(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0;f=l;l=l+32|0;g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;m=f+4|0;n=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if(!(c[h>>2]|0)){c[g>>2]=-2;o=c[g>>2]|0;l=f;return o|0}c[m>>2]=(c[h>>2]|0)+112;if(c[c[h>>2]>>2]&1|0){c[g>>2]=-3;o=c[g>>2]|0;l=f;return o|0}do if((c[i>>2]|0)==-1){c[(c[m>>2]|0)+396>>2]=c[j>>2];c[(c[m>>2]|0)+400>>2]=c[k>>2]}else{c[n>>2]=xb(c[h>>2]|0,c[i>>2]|0)|0;if(!(c[n>>2]|0))c[n>>2]=zc(c[h>>2]|0,c[i>>2]|0)|0;if(c[n>>2]|0){c[(c[n>>2]|0)+468>>2]=c[j>>2];c[(c[n>>2]|0)+472>>2]=c[k>>2];break}c[g>>2]=-18;o=c[g>>2]|0;l=f;return o|0}while(0);c[g>>2]=0;o=c[g>>2]|0;l=f;return o|0}function pd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=k;c[d>>2]=-1;c[d+4>>2]=-1;if(!(c[g>>2]|0)){c[f>>2]=-1;m=c[f>>2]|0;l=e;return m|0}if(c[c[g>>2]>>2]&1|0){c[f>>2]=-1;m=c[f>>2]|0;l=e;return m|0}if((c[h>>2]|0)==0&(c[i>>2]|0)==0){d=k;c[d>>2]=0;c[d+4>>2]=0}c[j>>2]=(c[g>>2]|0)+112;if(!((c[h>>2]|0)==0&(c[i>>2]|0)==1)){d=(c[j>>2]|0)+416|0;c[d>>2]=-1;c[d+4>>2]=-1}d=k;c[f>>2]=sc(c[g>>2]|0,c[h>>2]|0,c[d>>2]|0,c[d+4>>2]|0,c[i>>2]|0)|0;m=c[f>>2]|0;l=e;return m|0}function qd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0)){c[e>>2]=-2;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=xb(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[e>>2]=-20;i=c[e>>2]|0;l=d;return i|0}else{c[e>>2]=c[(c[h>>2]|0)+408>>2];i=c[e>>2]|0;l=d;return i|0}return 0}function rd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if(!(c[h>>2]|0)){c[g>>2]=-2;n=c[g>>2]|0;l=f;return n|0}c[m>>2]=xb(c[h>>2]|0,c[i>>2]|0)|0;if(!(c[m>>2]|0)){c[g>>2]=-20;n=c[g>>2]|0;l=f;return n|0}else{i=(c[m>>2]|0)+376|0;h=c[i+4>>2]|0;e=c[j>>2]|0;c[e>>2]=c[i>>2];c[e+4>>2]=h;h=(c[m>>2]|0)+384|0;m=Sf(c[h>>2]|0,c[h+4>>2]|0,1e3,0)|0;h=c[k>>2]|0;c[h>>2]=m;c[h+4>>2]=D;c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}return 0}function sd(){var a=0,d=0,e=0,f=0,g=0;a=l;l=l+16|0;d=a+4|0;e=a;c[e>>2]=0;c[e>>2]=Ef(1,136)|0;if(!(c[e>>2]|0)){c[d>>2]=0;f=c[d>>2]|0;l=a;return f|0}g=td()|0;c[(c[e>>2]|0)+112>>2]=g;g=c[e>>2]|0;if(!(c[(c[e>>2]|0)+112>>2]|0)){Df(g);c[d>>2]=0;f=c[d>>2]|0;l=a;return f|0}else{b[g+116>>1]=0;b[(c[e>>2]|0)+118>>1]=0;c[(c[e>>2]|0)+120>>2]=0;g=(c[e>>2]|0)+128|0;c[g>>2]=0;c[g+4>>2]=0;c[d>>2]=c[e>>2];f=c[d>>2]|0;l=a;return f|0}return 0}function td(){var a=0,b=0,d=0;a=l;l=l+16|0;b=a+4|0;d=a;c[d>>2]=Ef(1,8)|0;if(!(c[d>>2]|0))c[b>>2]=0;else c[b>>2]=c[d>>2];l=a;return c[b>>2]|0}function ud(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[e>>2]=a;if(!(c[e>>2]|0)){c[d>>2]=-2;f=c[d>>2]|0;l=b;return f|0}else{vd(c[(c[e>>2]|0)+112>>2]|0);Df(c[e>>2]|0);c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}return 0}function vd(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=0;if(!(c[d>>2]|0)){l=b;return}if(c[(c[d>>2]|0)+4>>2]|0){c[e>>2]=0;while(1){f=c[(c[d>>2]|0)+4>>2]|0;if((c[e>>2]|0)>>>0>=(c[c[d>>2]>>2]|0)>>>0)break;if(c[f+((c[e>>2]|0)*12|0)+4>>2]|0){if(c[(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+4>>2]|0)+48>>2]|0)Df(c[(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+4>>2]|0)+48>>2]|0);Df(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+4>>2]|0)}if(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+8>>2]|0){if(c[(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+8>>2]|0)+40>>2]|0)Df(c[(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+8>>2]|0)+40>>2]|0);Df(c[(c[(c[d>>2]|0)+4>>2]|0)+((c[e>>2]|0)*12|0)+8>>2]|0)}c[e>>2]=(c[e>>2]|0)+1}Df(f)}Df(c[d>>2]|0);l=b;return}function wd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;do if(c[g>>2]|0){if(!(c[h>>2]|0)){c[f>>2]=-1;break}c[j>>2]=xd(c[g>>2]|0,c[i>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-4;break}if(c[(c[j>>2]|0)+4>>2]|0){c[f>>2]=-1;break}else{c[(c[j>>2]|0)+4>>2]=c[h>>2];c[f>>2]=1;break}}else c[f>>2]=-1;while(0);l=e;return c[f>>2]|0}function xd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;b=yd(c[f>>2]|0,c[g>>2]|0)|0;c[h>>2]=b;do if(!b){c[h>>2]=Ff(c[(c[f>>2]|0)+4>>2]|0,((c[c[f>>2]>>2]|0)+1|0)*12|0)|0;if(c[h>>2]|0){c[(c[f>>2]|0)+4>>2]=c[h>>2];a=c[f>>2]|0;c[a>>2]=(c[a>>2]|0)+1;c[h>>2]=(c[(c[f>>2]|0)+4>>2]|0)+(((c[c[f>>2]>>2]|0)-1|0)*12|0);c[c[h>>2]>>2]=c[g>>2];c[(c[h>>2]|0)+4>>2]=0;c[(c[h>>2]|0)+8>>2]=0;break}c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}while(0);c[e>>2]=c[h>>2];i=c[e>>2]|0;l=d;return i|0}function yd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;c[h>>2]=0;while(1){if((c[h>>2]|0)>>>0>=(c[c[f>>2]>>2]|0)>>>0){i=6;break}if((c[(c[(c[f>>2]|0)+4>>2]|0)+((c[h>>2]|0)*12|0)>>2]|0)==(c[g>>2]|0)){i=4;break}c[h>>2]=(c[h>>2]|0)+1}if((i|0)==4){c[e>>2]=(c[(c[f>>2]|0)+4>>2]|0)+((c[h>>2]|0)*12|0);j=c[e>>2]|0;l=d;return j|0}else if((i|0)==6){c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}return 0}function zd(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=d;c[i>>2]=-1;if(!(c[g>>2]|0)){c[f>>2]=-2;j=c[f>>2]|0;l=e;return j|0}if(!(c[h>>2]|0)){c[f>>2]=-13;j=c[f>>2]|0;l=e;return j|0}if(c[(c[h>>2]|0)+12>>2]|0){if((c[(c[g>>2]|0)+120>>2]|0)!=1){c[f>>2]=-1;j=c[f>>2]|0;l=e;return j|0}b[(c[g>>2]|0)+118>>1]=1;c[(c[g>>2]|0)+120>>2]=2;if(c[(c[h>>2]|0)+4>>2]|0){c[f>>2]=-6;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}}do if(!(De(c[c[h>>2]>>2]|0,2779,8)|0)){c[i>>2]=Ad(c[g>>2]|0,c[h>>2]|0)|0;if(c[i>>2]|0){if(c[(c[h>>2]|0)+8>>2]|0){if(c[(c[g>>2]|0)+120>>2]|0)c[i>>2]=-14}else c[i>>2]=-12;c[(c[g>>2]|0)+120>>2]=1}}else{if(!(De(c[c[h>>2]>>2]|0,2770,8)|0)){c[i>>2]=Bd(c[g>>2]|0,c[h>>2]|0)|0;if(!(c[i>>2]|0))break;if((c[(c[g>>2]|0)+120>>2]|0)==1)break;c[i>>2]=-14;break}if(De(c[c[h>>2]>>2]|0,2788,6)|0){c[i>>2]=-1;break}b[(c[g>>2]|0)+116>>1]=1;c[i>>2]=Cd(c[g>>2]|0,c[h>>2]|0)|0;if(c[i>>2]|0?(c[(c[g>>2]|0)+120>>2]|0)!=1:0)c[i>>2]=-14}while(0);c[f>>2]=c[i>>2];j=c[f>>2]|0;l=e;return j|0}function Ad(b,d){b=b|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+32|0;g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=b;c[i>>2]=d;c[k>>2]=0;if(!(c[h>>2]|0)){c[g>>2]=-2;m=c[g>>2]|0;l=f;return m|0}if(c[i>>2]|0?c[c[i>>2]>>2]|0:0){c[k>>2]=(c[c[i>>2]>>2]|0)+8;c[k>>2]=Id(c[k>>2]|0,c[h>>2]|0)|0;c[k>>2]=Id(c[k>>2]|0,(c[h>>2]|0)+2|0)|0;c[j>>2]=(e[c[h>>2]>>1]|0)<<16|(e[(c[h>>2]|0)+2>>1]|0);if((c[j>>2]|0)>>>0>262144){c[g>>2]=-11;m=c[g>>2]|0;l=f;return m|0}if((c[j>>2]|0)==262144?(c[(c[i>>2]|0)+4>>2]|0)!=80:0){c[g>>2]=-18;m=c[g>>2]|0;l=f;return m|0}if((e[c[h>>2]>>1]|0|0)==3){if((e[(c[h>>2]|0)+2>>1]|0|0)>=2?(c[(c[i>>2]|0)+4>>2]|0)!=112:0){c[g>>2]=-18;m=c[g>>2]|0;l=f;return m|0}if((e[(c[h>>2]|0)+2>>1]|0|0)==0?(c[(c[i>>2]|0)+4>>2]|0)!=64:0){c[g>>2]=-18;m=c[g>>2]|0;l=f;return m|0}}c[k>>2]=Ed(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0;l=e;return i|0}return 0}function Ed(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=-1;c[i>>2]=-1;if((c[f>>2]|0)==0|(c[g>>2]|0)==0){c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}else{c[f>>2]=Hd(c[f>>2]|0,h)|0;c[f>>2]=Dd(c[f>>2]|0,i)|0;b=c[i>>2]|0;i=Lf(c[h>>2]|0,0,0,b|0)|0;b=c[g>>2]|0;c[b>>2]=i;c[b+4>>2]=D;c[e>>2]=c[f>>2];j=c[e>>2]|0;l=d;return j|0}return 0}function Fd(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;b=i;c[b>>2]=0;c[b+4>>2]=0;b=c[g>>2]|0;c[b>>2]=0;c[b+4>>2]=0;do{b=i;c[b>>2]=d[c[f>>2]>>0];c[b+4>>2]=0;b=Of(c[i>>2]&127|0,0,c[h>>2]|0)|0;a=c[g>>2]|0;j=a;k=c[j+4>>2]|D;m=a;c[m>>2]=c[j>>2]|b;c[m+4>>2]=k;c[h>>2]=(c[h>>2]|0)+7;c[f>>2]=(c[f>>2]|0)+1}while(0?1:(c[i>>2]&128|0)!=128);l=e;return c[f>>2]|0}function Gd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;do if(c[g>>2]|0){if(!(c[h>>2]|0)){c[f>>2]=-1;break}c[j>>2]=xd(c[g>>2]|0,c[i>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=-4;break}if(c[(c[j>>2]|0)+8>>2]|0){c[f>>2]=-1;break}else{c[(c[j>>2]|0)+8>>2]=c[h>>2];c[f>>2]=1;break}}else c[f>>2]=-1;while(0);l=e;return c[f>>2]|0}function Hd(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[g>>2]=a;c[h>>2]=b;if((c[g>>2]|0)==0|(c[h>>2]|0)==0){c[f>>2]=0;i=c[f>>2]|0;l=e;return i|0}else{c[c[h>>2]>>2]=d[c[g>>2]>>0]|0|(d[(c[g>>2]|0)+1>>0]|0)<<8|(d[(c[g>>2]|0)+2>>0]|0)<<16|(d[(c[g>>2]|0)+3>>0]|0)<<24;c[f>>2]=(c[g>>2]|0)+4;i=c[f>>2]|0;l=e;return i|0}return 0}function Id(a,e){a=a|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;g=f+8|0;h=f+4|0;i=f;c[h>>2]=a;c[i>>2]=e;if((c[h>>2]|0)==0|(c[i>>2]|0)==0){c[g>>2]=0;j=c[g>>2]|0;l=f;return j|0}else{b[c[i>>2]>>1]=d[c[h>>2]>>0]|0|(d[(c[h>>2]|0)+1>>0]|0)<<8;c[g>>2]=(c[h>>2]|0)+2;j=c[g>>2]|0;l=f;return j|0}return 0}function Jd(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=d;c[i>>2]=-1;d=Kd(c[g>>2]|0,c[h>>2]|0)|0;c[i>>2]=d;if((d|0)<0){c[f>>2]=c[i>>2];j=c[f>>2]|0;l=e;return j|0}else{b[c[h>>2]>>1]=b[c[g>>2]>>1]|0;c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}return 0}function Kd(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;f=e+8|0;g=e+4|0;h=e;c[g>>2]=a;c[h>>2]=d;do if(c[g>>2]|0){if(!(b[(c[g>>2]|0)+118>>1]|0)){c[f>>2]=-5;break}if(!(c[h>>2]|0)){c[f>>2]=-16;break}else{c[f>>2]=0;break}}else c[f>>2]=-2;while(0);l=e;return c[f>>2]|0}function Ld(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=d;c[i>>2]=-1;d=Kd(c[g>>2]|0,c[h>>2]|0)|0;c[i>>2]=d;if((d|0)<0){c[f>>2]=c[i>>2];j=c[f>>2]|0;l=e;return j|0}else{b[c[h>>2]>>1]=b[(c[g>>2]|0)+2>>1]|0;c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}return 0}function Md(a,b){a=a|0;b=b|0;var d=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[g>>2]=a;c[h>>2]=b;c[i>>2]=-1;c[j>>2]=0;b=Kd(c[g>>2]|0,c[h>>2]|0)|0;c[i>>2]=b;if((b|0)<0){c[f>>2]=c[i>>2];k=c[f>>2]|0;l=d;return k|0}c[j>>2]=(e[c[g>>2]>>1]|0)<<16|(e[(c[g>>2]|0)+2>>1]|0);if((c[j>>2]|0)>>>0<196610){c[f>>2]=-1;k=c[f>>2]|0;l=d;return k|0}else{j=(c[g>>2]|0)+96|0;g=c[j+4>>2]|0;i=c[h>>2]|0;c[i>>2]=c[j>>2];c[i+4>>2]=g;c[f>>2]=0;k=c[f>>2]|0;l=d;return k|0}return 0}function Nd(a,d,f,g,h,i){a=a|0;d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;j=l;l=l+64|0;k=j+48|0;m=j+44|0;n=j+40|0;o=j+36|0;p=j+8|0;q=j+32|0;r=j+28|0;s=j+24|0;t=j+20|0;u=j;v=j+16|0;c[m>>2]=a;c[n>>2]=d;c[o>>2]=f;f=p;c[f>>2]=g;c[f+4>>2]=h;c[q>>2]=i;c[r>>2]=0;c[s>>2]=-1;c[t>>2]=0;i=u;c[i>>2]=-1;c[i+4>>2]=2147483647;i=Kd(c[m>>2]|0,c[q>>2]|0)|0;c[s>>2]=i;if((i|0)<0){c[k>>2]=c[s>>2];w=c[k>>2]|0;l=j;return w|0}if(!(b[(c[m>>2]|0)+116>>1]|0)){c[k>>2]=-19;w=c[k>>2]|0;l=j;return w|0}if((c[n>>2]|0)==0|(c[o>>2]|0)==0){c[k>>2]=-1;w=c[k>>2]|0;l=j;return w|0}do if((e[c[m>>2]>>1]|0)==3){s=(c[m>>2]|0)+80|0;i=c[s+4>>2]|0;h=p;f=c[h+4>>2]|0;if(!((i|0)<(f|0)|((i|0)==(f|0)?(c[s>>2]|0)>>>0<(c[h>>2]|0)>>>0:0))?(h=p,s=c[h+4>>2]|0,f=(c[m>>2]|0)+64|0,i=c[f+4>>2]|0,!((s|0)<(i|0)|((s|0)==(i|0)?(c[h>>2]|0)>>>0<(c[f>>2]|0)>>>0:0))):0)break;c[k>>2]=-17;w=c[k>>2]|0;l=j;return w|0}while(0);c[t>>2]=0;while(1){if((c[t>>2]|0)>>>0>=(c[o>>2]|0)>>>0){x=23;break}c[v>>2]=0;f=Od(c[(c[m>>2]|0)+112>>2]|0,c[(c[n>>2]|0)+(c[t>>2]<<2)>>2]|0)|0;c[r>>2]=f;if(!f){x=14;break}if((e[c[m>>2]>>1]|0)==4){f=(c[r>>2]|0)+32|0;h=c[f+4>>2]|0;i=p;s=c[i+4>>2]|0;if((h|0)<(s|0)|((h|0)==(s|0)?(c[f>>2]|0)>>>0<(c[i>>2]|0)>>>0:0)){x=18;break}i=p;f=c[i+4>>2]|0;s=(c[r>>2]|0)+24|0;h=c[s+4>>2]|0;if((f|0)<(h|0)|((f|0)==(h|0)?(c[i>>2]|0)>>>0<(c[s>>2]|0)>>>0:0)){x=18;break}}s=p;c[v>>2]=Pd(c[r>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;if(c[v>>2]|0?(s=c[v>>2]|0,i=c[s+4>>2]|0,h=u,f=c[h+4>>2]|0,!((i|0)>(f|0)|((i|0)==(f|0)?(c[s>>2]|0)>>>0>(c[h>>2]|0)>>>0:0))):0){h=c[v>>2]|0;s=c[h+4>>2]|0;f=u;c[f>>2]=c[h>>2];c[f+4>>2]=s}c[t>>2]=(c[t>>2]|0)+1}if((x|0)==14){c[k>>2]=-8;w=c[k>>2]|0;l=j;return w|0}else if((x|0)==18){c[k>>2]=-17;w=c[k>>2]|0;l=j;return w|0}else if((x|0)==23){x=u;if((c[x>>2]|0)==-1?(c[x+4>>2]|0)==2147483647:0){c[k>>2]=-1;w=c[k>>2]|0;l=j;return w|0}else{x=u;u=c[x+4>>2]|0;t=c[q>>2]|0;c[t>>2]=c[x>>2];c[t+4>>2]=u;c[k>>2]=0;w=c[k>>2]|0;l=j;return w|0}}return 0}function Od(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;if(!(c[f>>2]|0)){c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}c[h>>2]=yd(c[f>>2]|0,c[g>>2]|0)|0;if(!(c[h>>2]|0))j=0;else j=c[(c[h>>2]|0)+8>>2]|0;c[e>>2]=j;i=c[e>>2]|0;l=d;return i|0}function Pd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0;e=l;l=l+48|0;f=e+36|0;g=e+32|0;h=e+24|0;i=e+16|0;j=e+8|0;k=e;c[g>>2]=a;a=h;c[a>>2]=b;c[a+4>>2]=d;d=i;c[d>>2]=0;c[d+4>>2]=0;d=j;c[d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|0,c[j>>2]|0)|0;c[k>>2]=d;if((d|0)<0){c[g>>2]=c[k>>2];n=c[g>>2]|0;l=f;return n|0}do if((e[c[h>>2]>>1]|0|0)<4){k=(c[h>>2]|0)+64|0;d=c[k+4>>2]|0;b=c[j>>2]|0;c[b>>2]=c[k>>2];c[b+4>>2]=d}else{c[m>>2]=0;d=Od(c[(c[h>>2]|0)+112>>2]|0,c[i>>2]|0)|0;c[m>>2]=d;if(d|0){d=(c[m>>2]|0)+24|0;b=c[d+4>>2]|0;k=c[j>>2]|0;c[k>>2]=c[d>>2];c[k+4>>2]=b;break}c[g>>2]=-8;n=c[g>>2]|0;l=f;return n|0}while(0);c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}function Rd(a,b,d){a=a|0;b=b|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=-1;d=Kd(c[h>>2]|0,c[j>>2]|0)|0;c[k>>2]=d;if((d|0)<0){c[g>>2]=c[k>>2];n=c[g>>2]|0;l=f;return n|0}do if((e[c[h>>2]>>1]|0|0)<4){k=(c[h>>2]|0)+72|0;d=c[k+4>>2]|0;b=c[j>>2]|0;c[b>>2]=c[k>>2];c[b+4>>2]=d}else{c[m>>2]=0;d=Od(c[(c[h>>2]|0)+112>>2]|0,c[i>>2]|0)|0;c[m>>2]=d;if(d|0){d=(c[m>>2]|0)+16|0;b=c[d+4>>2]|0;k=c[j>>2]|0;c[k>>2]=c[d>>2];c[k+4>>2]=b;break}c[g>>2]=-8;n=c[g>>2]|0;l=f;return n|0}while(0);c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}function Sd(a,b,d){a=a|0;b=b|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=-1;d=Kd(c[h>>2]|0,c[j>>2]|0)|0;c[k>>2]=d;if((d|0)<0){c[g>>2]=c[k>>2];n=c[g>>2]|0;l=f;return n|0}do if((e[c[h>>2]>>1]|0|0)<4){k=(c[h>>2]|0)+80|0;d=c[k+4>>2]|0;b=c[j>>2]|0;c[b>>2]=c[k>>2];c[b+4>>2]=d}else{c[m>>2]=0;d=Od(c[(c[h>>2]|0)+112>>2]|0,c[i>>2]|0)|0;c[m>>2]=d;if(d|0){d=(c[m>>2]|0)+32|0;b=c[d+4>>2]|0;k=c[j>>2]|0;c[k>>2]=c[d>>2];c[k+4>>2]=b;break}c[g>>2]=-8;n=c[g>>2]|0;l=f;return n|0}while(0);c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}function Td(a,b,d){a=a|0;b=b|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0;f=l;l=l+32|0;g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;m=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=-1;d=Kd(c[h>>2]|0,c[j>>2]|0)|0;c[k>>2]=d;if((d|0)<0){c[g>>2]=c[k>>2];n=c[g>>2]|0;l=f;return n|0}do if((e[c[h>>2]>>1]|0|0)<4){k=(c[h>>2]|0)+88|0;d=c[k+4>>2]|0;b=c[j>>2]|0;c[b>>2]=c[k>>2];c[b+4>>2]=d}else{c[m>>2]=0;d=Od(c[(c[h>>2]|0)+112>>2]|0,c[i>>2]|0)|0;c[m>>2]=d;if(d|0){d=(c[m>>2]|0)+16|0;b=c[d+4>>2]|0;k=c[j>>2]|0;c[k>>2]=c[d>>2];c[k+4>>2]=b;break}c[g>>2]=-8;n=c[g>>2]|0;l=f;return n|0}while(0);c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}function Ud(){var a=0;c[1394]=0;c[1401]=ie()|0;a=Ub(32)|0;c[1395]=a;od(a,-1,8,0)|0;kd(c[1395]|0,4,c[1401]|0)|0;md(c[1395]|0,5,c[1401]|0)|0;nd(c[1395]|0,8,c[1401]|0)|0;c[1396]=sd()|0;return}function Vd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;e=l;l=l+16|0;a=e+8|0;f=e;a:do switch(c[1394]|0){case 0:{if(!(c[b+8>>2]|0))if(!(c[1393]|0)){c[1394]=2;fa(c[1390]|0,c[1392]|0);g=_d(b,d)|0;break a}else{c[1394]=1;g=Zd(b,d)|0;break a}h=Db(c[1395]|0,d)|0;if(!(c[1389]|h)){c[1389]=1;c[1390]=2846;c[1398]=d;ra(c[b>>2]|0,c[b+4>>2]|0,-1.0,-1.0,0);g=0;break a}i=(c[1391]|0)==0;if((h|0)==1&i){c[1391]=1;c[1392]=2853;c[1399]=d;oa(c[b>>2]|0,c[b+4>>2]|0,-1.0);g=0;break a}if((h|0)==13&i){c[1391]=1;c[1392]=2860;c[1399]=d;oa(c[b>>2]|0,c[b+4>>2]|0,-1.0);g=0;break a}if((h|0)==6&(c[1393]|0)==0){c[1393]=1;c[1400]=d;h=zd(c[1396]|0,b)|0;if(!h){c[1397]=1;g=0;break a}if((h|0)<=0){c[f>>2]=h;Bf(2865,f)|0;g=-1}else g=0}else g=0;break}case 1:{g=Zd(b,d)|0;break}case 2:{g=_d(b,d)|0;break}default:{Bf(2902,a)|0;g=-1}}while(0);l=e;return g|0}function Wd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=ke(a)|0;e=d>>>0>c>>>0?c:d;d=(oe(a,b,e)|0)<0;return (d?-1:e)|0}function Xd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;f=e;switch(d|0){case 0:{g=b;h=((b|0)<0)<<31>>31;break}case 1:{g=Lf(je(a)|0,D|0,b|0,((b|0)<0)<<31>>31|0)|0;h=D;break}default:{i=-1;l=e;return i|0}}if(!(le(a,g,h)|0)){i=g;l=e;return i|0}else{a=f;c[a>>2]=g;c[a+4>>2]=h;c[f+8>>2]=b;c[f+12>>2]=d;Bf(2795,f)|0;i=-1;l=e;return i|0}return 0}function Yd(a){a=a|0;var b=0;b=je(a)|0;return b|0}function Zd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0.0,j=0,k=0,m=0,n=0.0,o=0;d=l;l=l+32|0;e=d+16|0;f=d+8|0;g=d;h=kc(c[1395]|0)|0;i=(+(h>>>0)+4294967296.0*+(D|0))/1.0e3;h=lc(c[1395]|0)|0;j=D;k=qd(c[1395]|0,b)|0;m=f;c[m>>2]=0;c[m+4>>2]=0;m=g;c[m>>2]=0;c[m+4>>2]=0;rd(c[1395]|0,b,f,g)|0;m=Jf(h|0,j|0,k|0)|0;k=g;g=f;n=(+(m>>>0)+4294967296.0*+(D|0))*(+((c[k>>2]|0)>>>0)+4294967296.0*+(c[k+4>>2]|0))/(+((c[g>>2]|0)>>>0)+4294967296.0*+(c[g+4>>2]|0));do if((c[1393]|0)!=0&(c[1400]|0)==(b|0)){g=zd(c[1396]|0,a)|0;if((g|0)<0){c[e>>2]=g;Bf(2942,e)|0;o=-1;l=d;return o|0}else{if(!(c[a+12>>2]|0))break;c[1397]=1;c[1394]=2;fa(c[1390]|0,c[1392]|0);break}}while(0);if((c[1389]|0)!=0&(c[1398]|0)==(b|0)){e=c[a>>2]|0;g=c[a+4>>2]|0;k=lc(c[1395]|0)|0;m=D;f=qd(c[1395]|0,c[1398]|0)|0;j=Jf(k|0,m|0,f|0)|0;h=Of(j|0,D|0,f|0)|0;ra(e|0,g|0,+i,+n,(k|0)==(h|0)&(m|0)==(D|0)&1|0)}if(!((c[1391]|0)!=0&(c[1399]|0)==(b|0))){o=0;l=d;return o|0}oa(c[a>>2]|0,c[a+4>>2]|0,+i);o=0;l=d;return o|0}function _d(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0.0,i=0,j=0,k=0,m=0.0,n=0,o=0;d=l;l=l+16|0;e=d+8|0;f=d;g=kc(c[1395]|0)|0;h=(+(g>>>0)+4294967296.0*+(D|0))/1.0e3;g=lc(c[1395]|0)|0;i=D;j=qd(c[1395]|0,b)|0;k=e;c[k>>2]=0;c[k+4>>2]=0;k=f;c[k>>2]=0;c[k+4>>2]=0;rd(c[1395]|0,b,e,f)|0;k=Jf(g|0,i|0,j|0)|0;j=f;f=e;m=(+(k>>>0)+4294967296.0*+(D|0))*(+((c[j>>2]|0)>>>0)+4294967296.0*+(c[j+4>>2]|0))/(+((c[f>>2]|0)>>>0)+4294967296.0*+(c[f+4>>2]|0));if((c[1389]|0)!=0&(c[1398]|0)==(b|0)?(f=c[a+4>>2]|0,(f|0)>0):0){j=c[a>>2]|0;k=lc(c[1395]|0)|0;e=D;i=qd(c[1395]|0,c[1398]|0)|0;g=Jf(k|0,e|0,i|0)|0;n=Of(g|0,D|0,i|0)|0;ra(j|0,f|0,+h,+m,(k|0)==(n|0)&(e|0)==(D|0)&1|0);o=1;l=d;return o|0}if(!((c[1391]|0)!=0&(c[1399]|0)==(b|0))){o=0;l=d;return o|0}oa(c[a>>2]|0,c[a+4>>2]|0,+h);o=1;l=d;return o|0}function $d(a,b){a=a|0;b=b|0;ne(c[1401]|0,a,b);return}function ae(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0;a=l;l=l+16|0;b=a;do{d=ke(c[1401]|0)|0;e=D;f=(e|0)<0|(e|0)==0&d>>>0<65536;e=f?d:65536;g=mc(c[1395]|0,e)|0;if((g|0)==-14){h=1;i=6;break}}while((g|0)>0);if((i|0)==6){l=a;return h|0}if(!g){h=0;l=a;return h|0}c[b>>2]=g;Bf(2980,b)|0;h=0;l=a;return h|0}function be(){ud(c[1396]|0)|0;_b(c[1395]|0)|0;pe(c[1401]|0);c[1401]=0;return} +function ce(){var a=0,b=0,d=0,e=0;a=l;l=l+16|0;b=a;d=b;c[d>>2]=-1;c[d+4>>2]=-1;if(!(c[1397]|0)){e=-1;l=a;return e|0}Md(c[1396]|0,b)|0;e=c[b>>2]|0;l=a;return e|0}function de(){var a=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0.0,m=0,n=0.0,o=0.0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0.0,v=0.0;a=l;l=l+48|0;d=a+42|0;e=a+40|0;f=a+32|0;g=a+24|0;h=a+16|0;i=a+8|0;j=a;if(!(c[1397]|0)){k=-1.0;l=a;return +k}b[d>>1]=-1;b[e>>1]=-1;Jd(c[1396]|0,d)|0;Ld(c[1396]|0,e)|0;e=c[1398]|0;if(!e)m=0;else{c[f>>2]=e;m=1}e=c[1399]|0;if(!e)if(!m){n=-1.0;o=-1.0}else{p=1;q=7}else{c[f+(m<<2)>>2]=e;p=m+1|0;q=7}if((q|0)==7){r=-1.0;q=0;s=-1.0;while(1){m=g;c[m>>2]=-1;c[m+4>>2]=-1;m=h;c[m>>2]=-1;c[m+4>>2]=-1;m=i;c[m>>2]=-1;c[m+4>>2]=-1;m=j;c[m>>2]=-1;c[m+4>>2]=-1;m=c[f+(q<<2)>>2]|0;Qd(c[1396]|0,m,g)|0;Rd(c[1396]|0,m,h)|0;Sd(c[1396]|0,m,i)|0;Td(c[1396]|0,m,j)|0;m=g;e=h;t=(+((c[m>>2]|0)>>>0)+4294967296.0*+(c[m+4>>2]|0))/(+((c[e>>2]|0)>>>0)+4294967296.0*+(c[e+4>>2]|0));u=r==-1.0|t>2]|0)>>>0)+4294967296.0*+(c[e+4>>2]|0))/(+((c[m>>2]|0)>>>0)+4294967296.0*+(c[m+4>>2]|0));v=s==-1.0|t>s?t:s;q=q+1|0;if((q|0)==(p|0)){n=u;o=v;break}else{r=u;s=v}}}k=o-n;l=a;return +k}function ee(){return 1}function fe(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;d=b;e=b+8|0;f=d;c[f>>2]=-1;c[f+4>>2]=-1;if(!(c[1397]|0)){g=-1;l=b;return g|0}if(!(c[1389]|0))if(!(c[1391]|0)){h=e;i=0}else{j=5596;k=5}else{j=5592;k=5}if((k|0)==5){c[e>>2]=c[j>>2];h=e;i=1}Nd(c[1396]|0,h,i,a,((a|0)<0)<<31>>31,d)|0;g=c[d>>2]|0;l=b;return g|0}function ge(a){a=a|0;return 0}function he(){var a=0,b=0,d=0;a=l;l=l+16|0;b=a;qc(c[1395]|0)|0;d=pd(c[1395]|0,0,1)|0;if((d|0)<0){c[b>>2]=d;Bf(3005,b)|0}me(c[1401]|0);l=a;return}function ie(){var a=0,b=0;a=Cf(32)|0;b=a+16|0;c[b>>2]=0;c[b+4>>2]=0;c[a+4>>2]=0;c[a+8>>2]=8;c[a>>2]=Cf(192)|0;return a|0}function je(a){a=a|0;var b=0;b=a+16|0;D=c[b+4>>2]|0;return c[b>>2]|0}function ke(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;b=c[a+4>>2]|0;if(!b){d=a+16|0;e=c[d>>2]|0;f=c[d+4>>2]|0;g=e;h=f;i=e;j=f;k=Kf(g|0,h|0,i|0,j|0)|0;l=D;D=l;return k|0}else{f=c[a>>2]|0;e=b+-1|0;b=f+(e*24|0)+8|0;d=Lf(c[f+(e*24|0)+16>>2]|0,0,c[b>>2]|0,c[b+4>>2]|0)|0;b=a+16|0;g=d;h=D;i=c[b>>2]|0;j=c[b+4>>2]|0;k=Kf(g|0,h|0,i|0,j|0)|0;l=D;D=l;return k|0}return 0}function le(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=l;l=l+16|0;f=e+8|0;g=e;h=c[a+4>>2]|0;i=(h|0)==0;if(i)j=a+16|0;else j=(c[a>>2]|0)+8|0;k=j;j=c[k+4>>2]|0;if((j|0)>(d|0)|((j|0)==(d|0)?(c[k>>2]|0)>>>0>b>>>0:0)){k=g;c[k>>2]=b;c[k+4>>2]=d;Bf(3031,g)|0;m=a+24|0;n=-1;o=m;p=o;c[p>>2]=b;q=o+4|0;r=q;c[r>>2]=d;l=e;return n|0}if(i){i=a+16|0;s=c[i+4>>2]|0;t=c[i>>2]|0}else{i=c[a>>2]|0;g=h+-1|0;h=i+(g*24|0)+8|0;k=Lf(c[i+(g*24|0)+16>>2]|0,0,c[h>>2]|0,c[h+4>>2]|0)|0;s=D;t=k}if((s|0)<(d|0)|(s|0)==(d|0)&t>>>0>>0){t=f;c[t>>2]=b;c[t+4>>2]=d;Bf(3031,f)|0;m=a+24|0;n=-1;o=m;p=o;c[p>>2]=b;q=o+4|0;r=q;c[r>>2]=d;l=e;return n|0}else{m=a+16|0;n=0;o=m;p=o;c[p>>2]=b;q=o+4|0;r=q;c[r>>2]=d;l=e;return n|0}return 0}function me(a){a=a|0;var b=0,d=0,e=0;b=a+4|0;if(!(c[b>>2]|0)){c[b>>2]=0;return}d=c[a>>2]|0;e=0;do{Df(c[d+(e*24|0)>>2]|0);d=c[a>>2]|0;c[d+(e*24|0)>>2]=0;e=e+1|0}while(e>>>0<(c[b>>2]|0)>>>0);c[b>>2]=0;return}function ne(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0;e=a+4|0;f=c[e>>2]|0;g=a+8|0;do if((f|0)==(c[g>>2]|0))if(!f)h=0;else{i=a+16|0;j=c[a>>2]|0;k=f;l=0;while(1){m=j+(l*24|0)+8|0;n=Lf(c[j+(l*24|0)+16>>2]|0,0,c[m>>2]|0,c[m+4>>2]|0)|0;m=D;o=i;p=c[o+4>>2]|0;if(!((m|0)<(p|0)|((m|0)==(p|0)?n>>>0<(c[o>>2]|0)>>>0:0))){q=6;break}Df(c[j+(l*24|0)>>2]|0);o=c[a>>2]|0;c[o+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1|0;s=m+(r*24|0)+8|0;t=Lf(c[m+(r*24|0)+16>>2]|0,0,c[s>>2]|0,c[s+4>>2]|0)|0;p=t;q=D}t=Kf(p|0,q|0,n|0,o|0)|0;q=D;if((q|0)<0|(q|0)==0&t>>>0>>0){c[g>>2]=d;t=g+8|0;c[t>>2]=n;c[t+4>>2]=o;Bf(3055,g)|0;u=-1;l=e;return u|0}a:do if(j){v=n;w=o}else{g=o;t=n;q=i;p=0;s=0;r=d;while(1){m=c[a>>2]|0;x=m+(p*24|0)+8|0;y=c[x>>2]|0;z=c[x+4>>2]|0;x=c[m+(p*24|0)+16>>2]|0;A=Lf(x|0,0,y|0,z|0)|0;B=D;if((B|0)<(g|0)|(B|0)==(g|0)&A>>>0>>0){C=q;E=t;F=g;G=s;H=r}else{A=Kf(t|0,g|0,y|0,z|0)|0;z=x-A|0;x=z>>>0>r>>>0?r:z;Wf(b+s|0,(c[m+(p*24|0)>>2]|0)+A|0,x|0)|0;A=k;m=Lf(c[A>>2]|0,c[A+4>>2]|0,x|0,0)|0;A=D;z=k;c[z>>2]=m;c[z+4>>2]=A;z=r-x|0;if(!z){u=0;break}C=c[h>>2]|0;E=m;F=A;G=x+s|0;H=z}p=p+1|0;if(p>>>0>=C>>>0){v=E;w=F;break a}else{g=F;t=E;q=C;s=G;r=H}}l=e;return u|0}while(0);c[f>>2]=d;d=f+8|0;c[d>>2]=v;c[d+4>>2]=w;Bf(3090,f)|0;u=-1;l=e;return u|0}function pe(a){a=a|0;var b=0,d=0,e=0,f=0;b=a+4|0;if(!(c[b>>2]|0)){d=c[a>>2]|0;c[b>>2]=0;Df(d);Df(a);return}e=c[a>>2]|0;f=0;do{Df(c[e+(f*24|0)>>2]|0);e=c[a>>2]|0;c[e+(f*24|0)>>2]=0;f=f+1|0}while(f>>>0<(c[b>>2]|0)>>>0);d=e;c[b>>2]=0;Df(d);Df(a);return}function qe(){return 5608}function re(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;d=b;c[d>>2]=ye(c[a+60>>2]|0)|0;a=ue(ia(6,d|0)|0)|0;l=b;return a|0}function se(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=l;l=l+48|0;f=e+16|0;g=e;h=e+32|0;i=a+28|0;j=c[i>>2]|0;c[h>>2]=j;k=a+20|0;m=(c[k>>2]|0)-j|0;c[h+4>>2]=m;c[h+8>>2]=b;c[h+12>>2]=d;b=m+d|0;m=a+60|0;c[g>>2]=c[m>>2];c[g+4>>2]=h;c[g+8>>2]=2;j=ue(qa(146,g|0)|0)|0;a:do if((b|0)!=(j|0)){g=j;n=h;o=2;p=b;while(1){if((g|0)<0)break;p=p-g|0;q=c[n+4>>2]|0;r=g>>>0>q>>>0;s=r?n+8|0:n;t=(r<<31>>31)+o|0;u=g-(r?q:0)|0;c[s>>2]=(c[s>>2]|0)+u;q=s+4|0;c[q>>2]=(c[q>>2]|0)-u;c[f>>2]=c[m>>2];c[f+4>>2]=s;c[f+8>>2]=t;g=ue(qa(146,f|0)|0)|0;if((p|0)==(g|0)){v=3;break a}else{n=s;o=t}}c[a+16>>2]=0;c[i>>2]=0;c[k>>2]=0;c[a>>2]=c[a>>2]|32;if((o|0)==2)w=0;else w=d-(c[n+4>>2]|0)|0}else v=3;while(0);if((v|0)==3){v=c[a+44>>2]|0;c[a+16>>2]=v+(c[a+48>>2]|0);c[i>>2]=v;c[k>>2]=v;w=d}l=e;return w|0}function te(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;f=e;g=e+20|0;c[f>>2]=c[a+60>>2];c[f+4>>2]=0;c[f+8>>2]=b;c[f+12>>2]=g;c[f+16>>2]=d;if((ue(pa(140,f|0)|0)|0)<0){c[g>>2]=-1;h=-1}else h=c[g>>2]|0;l=e;return h|0}function ue(a){a=a|0;var b=0;if(a>>>0>4294963200){c[(ve()|0)>>2]=0-a;b=-1}else b=a;return b|0}function ve(){return (we()|0)+64|0}function we(){return xe()|0}function xe(){return 2152}function ye(a){a=a|0;return a|0}function ze(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+32|0;g=f;c[b+36>>2]=6;if((c[b>>2]&64|0)==0?(c[g>>2]=c[b+60>>2],c[g+4>>2]=21523,c[g+8>>2]=f+16,na(54,g|0)|0):0)a[b+75>>0]=-1;g=se(b,d,e)|0;l=f;return g|0}function Ae(a){a=a|0;var b=0;b=(Be(a)|0)==0;return (b?a:a|32)|0}function Be(a){a=a|0;return (a+-65|0)>>>0<26|0}function Ce(b,c){b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=a[b>>0]|0;e=a[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24){f=e;g=d}else{d=b;b=c;do{d=d+1|0;b=b+1|0;c=a[d>>0]|0;e=a[b>>0]|0}while(!(c<<24>>24==0?1:c<<24>>24!=e<<24>>24));f=e;g=c}return (g&255)-(f&255)|0}function De(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=b;g=d;h=c;while(1){i=a[f>>0]|0;j=a[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Ee(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+224|0;g=f+120|0;h=f+80|0;i=f;j=f+136|0;k=h;m=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(m|0));c[g>>2]=c[e>>2];if((Fe(0,d,g,i,h)|0)<0)n=-1;else{if((c[b+76>>2]|0)>-1)o=Ge(b)|0;else o=0;e=c[b>>2]|0;k=e&32;if((a[b+74>>0]|0)<1)c[b>>2]=e&-33;e=b+48|0;if(!(c[e>>2]|0)){m=b+44|0;p=c[m>>2]|0;c[m>>2]=j;q=b+28|0;c[q>>2]=j;r=b+20|0;c[r>>2]=j;c[e>>2]=80;s=b+16|0;c[s>>2]=j+80;j=Fe(b,d,g,i,h)|0;if(!p)t=j;else{ta[c[b+36>>2]&7](b,0,0)|0;u=(c[r>>2]|0)==0?-1:j;c[m>>2]=p;c[e>>2]=0;c[s>>2]=0;c[q>>2]=0;c[r>>2]=0;t=u}}else t=Fe(b,d,g,i,h)|0;h=c[b>>2]|0;c[b>>2]=h|k;if(o|0)He(b);n=(h&32|0)==0?t:-1}l=f;return n|0}function Fe(d,e,f,g,i){d=d|0;e=e|0;f=f|0;g=g|0;i=i|0;var j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0;j=l;l=l+64|0;k=j+16|0;m=j;n=j+24|0;o=j+8|0;p=j+20|0;c[k>>2]=e;q=(d|0)!=0;r=n+40|0;s=r;t=n+39|0;n=o+4|0;u=e;e=0;v=0;w=0;a:while(1){do if((e|0)>-1)if((v|0)>(2147483647-e|0)){c[(ve()|0)>>2]=75;x=-1;break}else{x=v+e|0;break}else x=e;while(0);y=a[u>>0]|0;if(!(y<<24>>24)){z=87;break}else{A=y;B=u}b:while(1){switch(A<<24>>24){case 37:{C=B;E=B;z=9;break b;break}case 0:{F=B;G=B;break b;break}default:{}}y=B+1|0;c[k>>2]=y;A=a[y>>0]|0;B=y}c:do if((z|0)==9)while(1){z=0;if((a[C+1>>0]|0)!=37){F=C;G=E;break c}y=E+1|0;H=C+2|0;c[k>>2]=H;if((a[H>>0]|0)==37){C=H;E=y;z=9}else{F=H;G=y;break}}while(0);y=G-u|0;if(q)Ie(d,u,y);if(y|0){u=F;e=x;v=y;continue}y=F+1|0;H=(a[y>>0]|0)+-48|0;if(H>>>0<10){I=(a[F+2>>0]|0)==36;J=I?H:-1;K=I?1:w;L=I?F+3|0:y}else{J=-1;K=w;L=y}c[k>>2]=L;y=a[L>>0]|0;I=(y<<24>>24)+-32|0;d:do if(I>>>0<32){H=y;M=0;N=L;O=I;while(1){P=1<>2]=P;U=a[P>>0]|0;O=(U<<24>>24)+-32|0;if(O>>>0>=32){Q=U;R=P;S=T;break}else{H=U;M=T;N=P}}}else{Q=y;R=L;S=0}while(0);if(Q<<24>>24==42){y=R+1|0;I=(a[y>>0]|0)+-48|0;if(I>>>0<10?(a[R+2>>0]|0)==36:0){c[i+(I<<2)>>2]=10;V=1;W=R+3|0;X=c[g+((a[y>>0]|0)+-48<<3)>>2]|0}else{if(K|0){Y=-1;break}if(q){I=(c[f>>2]|0)+(4-1)&~(4-1);N=c[I>>2]|0;c[f>>2]=I+4;V=0;W=y;X=N}else{V=0;W=y;X=0}}c[k>>2]=W;y=(X|0)<0;Z=W;_=y?S|8192:S;$=V;aa=y?0-X|0:X}else{y=Je(k)|0;if((y|0)<0){Y=-1;break}Z=c[k>>2]|0;_=S;$=K;aa=y}do if((a[Z>>0]|0)==46){if((a[Z+1>>0]|0)!=42){c[k>>2]=Z+1;y=Je(k)|0;ba=c[k>>2]|0;ca=y;break}y=Z+2|0;N=(a[y>>0]|0)+-48|0;if(N>>>0<10?(a[Z+3>>0]|0)==36:0){c[i+(N<<2)>>2]=10;N=c[g+((a[y>>0]|0)+-48<<3)>>2]|0;I=Z+4|0;c[k>>2]=I;ba=I;ca=N;break}if($|0){Y=-1;break a}if(q){N=(c[f>>2]|0)+(4-1)&~(4-1);I=c[N>>2]|0;c[f>>2]=N+4;da=I}else da=0;c[k>>2]=y;ba=y;ca=da}else{ba=Z;ca=-1}while(0);y=ba;I=0;while(1){if(((a[y>>0]|0)+-65|0)>>>0>57){Y=-1;break a}ea=y+1|0;c[k>>2]=ea;fa=a[(a[y>>0]|0)+-65+(3127+(I*58|0))>>0]|0;ga=fa&255;if((ga+-1|0)>>>0<8){y=ea;I=ga}else break}if(!(fa<<24>>24)){Y=-1;break}N=(J|0)>-1;do if(fa<<24>>24==19)if(N){Y=-1;break a}else z=49;else{if(N){c[i+(J<<2)>>2]=ga;M=g+(J<<3)|0;H=c[M+4>>2]|0;O=m;c[O>>2]=c[M>>2];c[O+4>>2]=H;z=49;break}if(!q){Y=0;break a}Ke(m,ga,f)}while(0);if((z|0)==49?(z=0,!q):0){u=ea;e=x;v=0;w=$;continue}N=a[y>>0]|0;H=(I|0)!=0&(N&15|0)==3?N&-33:N;N=_&-65537;O=(_&8192|0)==0?_:N;e:do switch(H|0){case 110:{switch((I&255)<<24>>24){case 0:{c[c[m>>2]>>2]=x;u=ea;e=x;v=0;w=$;continue a;break}case 1:{c[c[m>>2]>>2]=x;u=ea;e=x;v=0;w=$;continue a;break}case 2:{M=c[m>>2]|0;c[M>>2]=x;c[M+4>>2]=((x|0)<0)<<31>>31;u=ea;e=x;v=0;w=$;continue a;break}case 3:{b[c[m>>2]>>1]=x;u=ea;e=x;v=0;w=$;continue a;break}case 4:{a[c[m>>2]>>0]=x;u=ea;e=x;v=0;w=$;continue a;break}case 6:{c[c[m>>2]>>2]=x;u=ea;e=x;v=0;w=$;continue a;break}case 7:{M=c[m>>2]|0;c[M>>2]=x;c[M+4>>2]=((x|0)<0)<<31>>31;u=ea;e=x;v=0;w=$;continue a;break}default:{u=ea;e=x;v=0;w=$;continue a}}break}case 112:{ha=O|8;ia=ca>>>0>8?ca:8;ja=120;z=61;break}case 88:case 120:{ha=O;ia=ca;ja=H;z=61;break}case 111:{M=m;P=c[M>>2]|0;T=c[M+4>>2]|0;M=Me(P,T,r)|0;U=s-M|0;ka=P;la=T;ma=M;na=O;oa=(O&8|0)==0|(ca|0)>(U|0)?ca:U+1|0;pa=0;qa=3591;z=67;break}case 105:case 100:{U=m;M=c[U>>2]|0;T=c[U+4>>2]|0;if((T|0)<0){U=Kf(0,0,M|0,T|0)|0;P=D;ra=m;c[ra>>2]=U;c[ra+4>>2]=P;sa=U;ta=P;ua=1;va=3591;z=66;break e}else{sa=M;ta=T;ua=(O&2049|0)!=0&1;va=(O&2048|0)==0?((O&1|0)==0?3591:3593):3592;z=66;break e}break}case 117:{T=m;sa=c[T>>2]|0;ta=c[T+4>>2]|0;ua=0;va=3591;z=66;break}case 99:{a[t>>0]=c[m>>2];wa=t;xa=N;ya=1;za=0;Aa=3591;Ba=r;break}case 109:{Ca=Oe(c[(ve()|0)>>2]|0)|0;z=71;break}case 115:{T=c[m>>2]|0;Ca=T|0?T:3601;z=71;break}case 67:{c[o>>2]=c[m>>2];c[n>>2]=0;c[m>>2]=o;Da=o;Ea=-1;z=75;break}case 83:{T=c[m>>2]|0;if(!ca){Qe(d,32,aa,0,O);Fa=0;z=84}else{Da=T;Ea=ca;z=75}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=ea;e=x;v=Se(d,+h[m>>3],aa,ca,O,H)|0;w=$;continue a;break}default:{wa=u;xa=O;ya=ca;za=0;Aa=3591;Ba=r}}while(0);f:do if((z|0)==61){z=0;H=m;I=c[H>>2]|0;y=c[H+4>>2]|0;H=Le(I,y,r,ja&32)|0;T=(ha&8|0)==0|(I|0)==0&(y|0)==0;ka=I;la=y;ma=H;na=ha;oa=ia;pa=T?0:2;qa=T?3591:3591+(ja>>4)|0;z=67}else if((z|0)==66){z=0;ka=sa;la=ta;ma=Ne(sa,ta,r)|0;na=O;oa=ca;pa=ua;qa=va;z=67}else if((z|0)==71){z=0;T=Pe(Ca,0,ca)|0;H=(T|0)==0;wa=Ca;xa=N;ya=H?ca:T-Ca|0;za=0;Aa=3591;Ba=H?Ca+ca|0:T}else if((z|0)==75){z=0;T=0;H=0;y=Da;while(1){I=c[y>>2]|0;if(!I){Ga=T;Ha=H;break}M=Re(p,I)|0;if((M|0)<0|M>>>0>(Ea-T|0)>>>0){Ga=T;Ha=M;break}I=M+T|0;if(Ea>>>0>I>>>0){T=I;H=M;y=y+4|0}else{Ga=I;Ha=M;break}}if((Ha|0)<0){Y=-1;break a}Qe(d,32,aa,Ga,O);if(!Ga){Fa=0;z=84}else{y=0;H=Da;while(1){T=c[H>>2]|0;if(!T){Fa=Ga;z=84;break f}M=Re(p,T)|0;y=M+y|0;if((y|0)>(Ga|0)){Fa=Ga;z=84;break f}Ie(d,p,M);if(y>>>0>=Ga>>>0){Fa=Ga;z=84;break}else H=H+4|0}}}while(0);if((z|0)==67){z=0;N=(ka|0)!=0|(la|0)!=0;H=(oa|0)!=0|N;y=((N^1)&1)+(s-ma)|0;wa=H?ma:r;xa=(oa|0)>-1?na&-65537:na;ya=H?((oa|0)>(y|0)?oa:y):oa;za=pa;Aa=qa;Ba=r}else if((z|0)==84){z=0;Qe(d,32,aa,Fa,O^8192);u=ea;e=x;v=(aa|0)>(Fa|0)?aa:Fa;w=$;continue}y=Ba-wa|0;H=(ya|0)<(y|0)?y:ya;N=H+za|0;M=(aa|0)<(N|0)?N:aa;Qe(d,32,M,N,xa);Ie(d,Aa,za);Qe(d,48,M,N,xa^65536);Qe(d,48,H,y,0);Ie(d,wa,y);Qe(d,32,M,N,xa^8192);u=ea;e=x;v=M;w=$}g:do if((z|0)==87)if(!d)if(!w)Y=0;else{$=1;while(1){v=c[i+($<<2)>>2]|0;if(!v){Ia=$;break}Ke(g+($<<3)|0,v,f);$=$+1|0;if(($|0)>=10){Y=1;break g}}while(1){if(c[i+(Ia<<2)>>2]|0){Y=-1;break g}Ia=Ia+1|0;if((Ia|0)>=10){Y=1;break}}}else Y=x;while(0);l=j;return Y|0}function Ge(a){a=a|0;return 0}function He(a){a=a|0;return}function Ie(a,b,d){a=a|0;b=b|0;d=d|0;if(!(c[a>>2]&32))cf(b,d,a)|0;return}function Je(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=c[b>>2]|0;e=(a[d>>0]|0)+-48|0;if(e>>>0<10){f=d;d=0;g=e;while(1){e=g+(d*10|0)|0;f=f+1|0;c[b>>2]=f;g=(a[f>>0]|0)+-48|0;if(g>>>0>=10){h=e;break}else d=e}}else h=0;return h|0}function Ke(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,i=0,j=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=f;break a;break}case 10:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a;break}case 11:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=f;c[e+4>>2]=0;break a;break}case 12:{e=(c[d>>2]|0)+(8-1)&~(8-1);f=e;g=c[f>>2]|0;i=c[f+4>>2]|0;c[d>>2]=e+8;e=a;c[e>>2]=g;c[e+4>>2]=i;break a;break}case 13:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=(e&65535)<<16>>16;e=a;c[e>>2]=i;c[e+4>>2]=((i|0)<0)<<31>>31;break a;break}case 14:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=a;c[i>>2]=e&65535;c[i+4>>2]=0;break a;break}case 15:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=(e&255)<<24>>24;e=a;c[e>>2]=i;c[e+4>>2]=((i|0)<0)<<31>>31;break a;break}case 16:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=a;c[i>>2]=e&255;c[i+4>>2]=0;break a;break}case 17:{i=(c[d>>2]|0)+(8-1)&~(8-1);j=+h[i>>3];c[d>>2]=i+8;h[a>>3]=j;break a;break}case 18:{i=(c[d>>2]|0)+(8-1)&~(8-1);j=+h[i>>3];c[d>>2]=i+8;h[a>>3]=j;break a;break}default:break a}while(0);while(0);return}function Le(b,c,e,f){b=b|0;c=c|0;e=e|0;f=f|0;var g=0,h=0;if((b|0)==0&(c|0)==0)g=e;else{h=b;b=c;c=e;while(1){e=c+-1|0;a[e>>0]=d[3643+(h&15)>>0]|0|f;h=Nf(h|0,b|0,4)|0;b=D;if((h|0)==0&(b|0)==0){g=e;break}else c=e}}return g|0}function Me(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0;if((b|0)==0&(c|0)==0)e=d;else{f=b;b=c;c=d;while(1){d=c+-1|0;a[d>>0]=f&7|48;f=Nf(f|0,b|0,3)|0;b=D;if((f|0)==0&(b|0)==0){e=d;break}else c=d}}return e|0}function Ne(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295){e=b;f=c;c=d;while(1){g=Yf(e|0,f|0,10,0)|0;c=c+-1|0;a[c>>0]=g&255|48;g=e;e=Sf(e|0,f|0,10,0)|0;if(!(f>>>0>9|(f|0)==9&g>>>0>4294967295))break;else f=D}h=c;i=e}else{h=d;i=b}if(!i)j=h;else{b=h;h=i;while(1){i=b+-1|0;a[i>>0]=(h>>>0)%10|0|48;if(h>>>0<10){j=i;break}else{b=i;h=(h>>>0)/10|0}}}return j|0}function Oe(a){a=a|0;return Ze(a,c[(Ye()|0)+188>>2]|0)|0}function Pe(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;f=d&255;g=(e|0)!=0;a:do if(g&(b&3|0)!=0){h=d&255;i=e;j=b;while(1){if((a[j>>0]|0)==h<<24>>24){k=i;l=j;m=6;break a}n=j+1|0;o=i+-1|0;p=(o|0)!=0;if(p&(n&3|0)!=0){i=o;j=n}else{q=o;r=n;s=p;m=5;break}}}else{q=e;r=b;s=g;m=5}while(0);if((m|0)==5)if(s){k=q;l=r;m=6}else{t=0;u=r}b:do if((m|0)==6){r=d&255;if((a[l>>0]|0)==r<<24>>24){t=k;u=l}else{q=S(f,16843009)|0;c:do if(k>>>0>3){s=k;g=l;while(1){b=c[g>>2]^q;if((b&-2139062144^-2139062144)&b+-16843009|0)break;b=g+4|0;e=s+-4|0;if(e>>>0>3){s=e;g=b}else{v=e;w=b;m=11;break c}}x=s;y=g}else{v=k;w=l;m=11}while(0);if((m|0)==11)if(!v){t=0;u=w;break}else{x=v;y=w}while(1){if((a[y>>0]|0)==r<<24>>24){t=x;u=y;break b}q=y+1|0;x=x+-1|0;if(!x){t=0;u=q;break}else y=q}}}while(0);return (t|0?u:0)|0}function Qe(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=l;l=l+256|0;g=f;if((c|0)>(d|0)&(e&73728|0)==0){e=c-d|0;Mf(g|0,b|0,(e>>>0<256?e:256)|0)|0;if(e>>>0>255){b=c-d|0;d=e;do{Ie(a,g,256);d=d+-256|0}while(d>>>0>255);h=b&255}else h=e;Ie(a,g,h)}l=f;return}function Re(a,b){a=a|0;b=b|0;var c=0;if(!a)c=0;else c=We(a,b,0)|0;return c|0}function Se(b,e,f,g,h,i){b=b|0;e=+e;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0.0,E=0.0,F=0,G=0,H=0,I=0.0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0.0,fa=0.0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0;j=l;l=l+560|0;k=j+8|0;m=j;n=j+524|0;o=n;p=j+512|0;c[m>>2]=0;q=p+12|0;Te(e)|0;if((D|0)<0){r=1;s=3608;t=-e}else{r=(h&2049|0)!=0&1;s=(h&2048|0)==0?((h&1|0)==0?3609:3614):3611;t=e}Te(t)|0;u=D&2146435072;do if(u>>>0<2146435072|(u|0)==2146435072&0<0){e=+Ue(t,m)*2.0;v=e!=0.0;if(v)c[m>>2]=(c[m>>2]|0)+-1;w=i|32;if((w|0)==97){x=i&32;y=(x|0)==0?s:s+9|0;z=r|2;A=12-g|0;do if(!(g>>>0>11|(A|0)==0)){B=A;C=8.0;do{B=B+-1|0;C=C*16.0}while((B|0)!=0);if((a[y>>0]|0)==45){E=-(C+(-e-C));break}else{E=e+C-C;break}}else E=e;while(0);A=c[m>>2]|0;B=(A|0)<0?0-A|0:A;F=Ne(B,((B|0)<0)<<31>>31,q)|0;if((F|0)==(q|0)){B=p+11|0;a[B>>0]=48;G=B}else G=F;a[G+-1>>0]=(A>>31&2)+43;A=G+-2|0;a[A>>0]=i+15;F=(g|0)<1;B=(h&8|0)==0;H=n;I=E;while(1){J=~~I;K=H+1|0;a[H>>0]=d[3643+J>>0]|x;I=(I-+(J|0))*16.0;if((K-o|0)==1?!(B&(F&I==0.0)):0){a[K>>0]=46;L=H+2|0}else L=K;if(!(I!=0.0))break;else H=L}H=L-o|0;F=q-A|0;B=(g|0)!=0&(H+-2|0)<(g|0)?g+2|0:H;x=F+z+B|0;Qe(b,32,f,x,h);Ie(b,y,z);Qe(b,48,f,x,h^65536);Ie(b,n,H);Qe(b,48,B-H|0,0,0);Ie(b,A,F);Qe(b,32,f,x,h^8192);M=x;break}x=(g|0)<0?6:g;if(v){F=(c[m>>2]|0)+-28|0;c[m>>2]=F;N=F;O=e*268435456.0}else{N=c[m>>2]|0;O=e}F=(N|0)<0?k:k+288|0;I=O;H=F;do{B=~~I>>>0;c[H>>2]=B;H=H+4|0;I=(I-+(B>>>0))*1.0e9}while(I!=0.0);if((N|0)>0){v=N;A=F;z=H;while(1){y=(v|0)<29?v:29;B=z+-4|0;if(B>>>0>=A>>>0){K=0;J=B;do{B=Of(c[J>>2]|0,0,y|0)|0;P=Lf(B|0,D|0,K|0,0)|0;B=D;Q=Yf(P|0,B|0,1e9,0)|0;c[J>>2]=Q;K=Sf(P|0,B|0,1e9,0)|0;J=J+-4|0}while(J>>>0>=A>>>0);if(K){J=A+-4|0;c[J>>2]=K;R=J}else R=A}else R=A;J=z;while(1){if(J>>>0<=R>>>0)break;B=J+-4|0;if(!(c[B>>2]|0))J=B;else break}K=(c[m>>2]|0)-y|0;c[m>>2]=K;if((K|0)>0){v=K;A=R;z=J}else{T=K;U=R;V=J;break}}}else{T=N;U=F;V=H}if((T|0)<0){z=((x+25|0)/9|0)+1|0;A=(w|0)==102;v=T;K=U;B=V;while(1){P=0-v|0;Q=(P|0)<9?P:9;if(K>>>0>>0){P=(1<>>Q;X=0;Y=K;do{Z=c[Y>>2]|0;c[Y>>2]=(Z>>>Q)+X;X=S(Z&P,W)|0;Y=Y+4|0}while(Y>>>0>>0);Y=(c[K>>2]|0)==0?K+4|0:K;if(!X){_=Y;$=B}else{c[B>>2]=X;_=Y;$=B+4|0}}else{_=(c[K>>2]|0)==0?K+4|0:K;$=B}Y=A?F:_;W=($-Y>>2|0)>(z|0)?Y+(z<<2)|0:$;v=(c[m>>2]|0)+Q|0;c[m>>2]=v;if((v|0)>=0){aa=_;ba=W;break}else{K=_;B=W}}}else{aa=U;ba=V}B=F;if(aa>>>0>>0){K=(B-aa>>2)*9|0;v=c[aa>>2]|0;if(v>>>0<10)ca=K;else{z=K;K=10;while(1){K=K*10|0;A=z+1|0;if(v>>>0>>0){ca=A;break}else z=A}}}else ca=0;z=(w|0)==103;K=(x|0)!=0;v=x-((w|0)!=102?ca:0)+((K&z)<<31>>31)|0;if((v|0)<(((ba-B>>2)*9|0)+-9|0)){A=v+9216|0;v=F+4+(((A|0)/9|0)+-1024<<2)|0;H=((A|0)%9|0)+1|0;if((H|0)<9){A=10;W=H;while(1){H=A*10|0;W=W+1|0;if((W|0)==9){da=H;break}else A=H}}else da=10;A=c[v>>2]|0;W=(A>>>0)%(da>>>0)|0;w=(v+4|0)==(ba|0);if(!(w&(W|0)==0)){C=(((A>>>0)/(da>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;H=(da|0)/2|0;I=W>>>0>>0?.5:w&(W|0)==(H|0)?1.0:1.5;if(!r){ea=C;fa=I}else{H=(a[s>>0]|0)==45;ea=H?-C:C;fa=H?-I:I}H=A-W|0;c[v>>2]=H;if(ea+fa!=ea){W=H+da|0;c[v>>2]=W;if(W>>>0>999999999){W=aa;H=v;while(1){A=H+-4|0;c[H>>2]=0;if(A>>>0>>0){w=W+-4|0;c[w>>2]=0;ga=w}else ga=W;w=(c[A>>2]|0)+1|0;c[A>>2]=w;if(w>>>0>999999999){W=ga;H=A}else{ha=ga;ia=A;break}}}else{ha=aa;ia=v}H=(B-ha>>2)*9|0;W=c[ha>>2]|0;if(W>>>0<10){ja=ha;ka=ia;la=H}else{A=H;H=10;while(1){H=H*10|0;w=A+1|0;if(W>>>0>>0){ja=ha;ka=ia;la=w;break}else A=w}}}else{ja=aa;ka=v;la=ca}}else{ja=aa;ka=v;la=ca}A=ka+4|0;ma=ja;na=la;oa=ba>>>0>A>>>0?A:ba}else{ma=aa;na=ca;oa=ba}A=oa;while(1){if(A>>>0<=ma>>>0){pa=0;break}H=A+-4|0;if(!(c[H>>2]|0))A=H;else{pa=1;break}}v=0-na|0;do if(z){H=((K^1)&1)+x|0;if((H|0)>(na|0)&(na|0)>-5){qa=H+-1-na|0;ra=i+-1|0}else{qa=H+-1|0;ra=i+-2|0}H=h&8;if(!H){if(pa?(W=c[A+-4>>2]|0,(W|0)!=0):0)if(!((W>>>0)%10|0)){w=10;Y=0;while(1){w=w*10|0;P=Y+1|0;if((W>>>0)%(w>>>0)|0|0){sa=P;break}else Y=P}}else sa=0;else sa=9;Y=((A-B>>2)*9|0)+-9|0;if((ra|32|0)==102){w=Y-sa|0;W=(w|0)>0?w:0;ta=0;ua=(qa|0)<(W|0)?qa:W;va=ra;break}else{W=Y+na-sa|0;Y=(W|0)>0?W:0;ta=0;ua=(qa|0)<(Y|0)?qa:Y;va=ra;break}}else{ta=H;ua=qa;va=ra}}else{ta=h&8;ua=x;va=i}while(0);x=ua|ta;B=(x|0)!=0&1;K=(va|32|0)==102;if(K){wa=0;xa=(na|0)>0?na:0}else{z=(na|0)<0?v:na;Y=Ne(z,((z|0)<0)<<31>>31,q)|0;z=q;if((z-Y|0)<2){W=Y;while(1){w=W+-1|0;a[w>>0]=48;if((z-w|0)<2)W=w;else{ya=w;break}}}else ya=Y;a[ya+-1>>0]=(na>>31&2)+43;W=ya+-2|0;a[W>>0]=va;wa=W;xa=z-W|0}W=r+1+ua+B+xa|0;Qe(b,32,f,W,h);Ie(b,s,r);Qe(b,48,f,W,h^65536);if(K){v=ma>>>0>F>>>0?F:ma;w=n+9|0;Q=w;X=n+8|0;P=v;do{J=Ne(c[P>>2]|0,0,w)|0;if((P|0)==(v|0))if((J|0)==(w|0)){a[X>>0]=48;za=X}else za=J;else if(J>>>0>n>>>0){Mf(n|0,48,J-o|0)|0;y=J;while(1){Z=y+-1|0;if(Z>>>0>n>>>0)y=Z;else{za=Z;break}}}else za=J;Ie(b,za,Q-za|0);P=P+4|0}while(P>>>0<=F>>>0);if(x|0)Ie(b,3659,1);if(P>>>0>>0&(ua|0)>0){F=P;Q=ua;while(1){X=Ne(c[F>>2]|0,0,w)|0;if(X>>>0>n>>>0){Mf(n|0,48,X-o|0)|0;v=X;while(1){K=v+-1|0;if(K>>>0>n>>>0)v=K;else{Aa=K;break}}}else Aa=X;Ie(b,Aa,(Q|0)<9?Q:9);F=F+4|0;v=Q+-9|0;if(!(F>>>0>>0&(Q|0)>9)){Ba=v;break}else Q=v}}else Ba=ua;Qe(b,48,Ba+9|0,9,0)}else{Q=pa?A:ma+4|0;if((ua|0)>-1){F=n+9|0;w=(ta|0)==0;P=F;x=0-o|0;v=n+8|0;J=ma;K=ua;while(1){B=Ne(c[J>>2]|0,0,F)|0;if((B|0)==(F|0)){a[v>>0]=48;Ca=v}else Ca=B;do if((J|0)==(ma|0)){B=Ca+1|0;Ie(b,Ca,1);if(w&(K|0)<1){Da=B;break}Ie(b,3659,1);Da=B}else{if(Ca>>>0<=n>>>0){Da=Ca;break}Mf(n|0,48,Ca+x|0)|0;B=Ca;while(1){z=B+-1|0;if(z>>>0>n>>>0)B=z;else{Da=z;break}}}while(0);X=P-Da|0;Ie(b,Da,(K|0)>(X|0)?X:K);B=K-X|0;J=J+4|0;if(!(J>>>0>>0&(B|0)>-1)){Ea=B;break}else K=B}}else Ea=ua;Qe(b,48,Ea+18|0,18,0);Ie(b,wa,q-wa|0)}Qe(b,32,f,W,h^8192);M=W}else{K=(i&32|0)!=0;Q=r+3|0;Qe(b,32,f,Q,h&-65537);Ie(b,s,r);Ie(b,t!=t|0.0!=0.0?(K?3635:3639):K?3627:3631,3);Qe(b,32,f,Q,h^8192);M=Q}while(0);l=j;return ((M|0)<(f|0)?f:M)|0}function Te(a){a=+a;var b=0;h[j>>3]=a;b=c[j>>2]|0;D=c[j+4>>2]|0;return b|0}function Ue(a,b){a=+a;b=b|0;return +(+Ve(a,b))}function Ve(a,b){a=+a;b=b|0;var d=0,e=0,f=0,g=0.0,i=0,k=0.0,l=0.0;h[j>>3]=a;d=c[j>>2]|0;e=c[j+4>>2]|0;f=Nf(d|0,e|0,52)|0;switch(f&2047){case 0:{if(a!=0.0){g=+Ve(a*18446744073709551616.0,b);i=(c[b>>2]|0)+-64|0;k=g}else{i=0;k=a}c[b>>2]=i;l=k;break}case 2047:{l=a;break}default:{c[b>>2]=(f&2047)+-1022;c[j>>2]=d;c[j+4>>2]=e&-2146435073|1071644672;l=+h[j>>3]}}return +l}function We(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;do if(b){if(d>>>0<128){a[b>>0]=d;f=1;break}if(!(c[c[(Xe()|0)+188>>2]>>2]|0))if((d&-128|0)==57216){a[b>>0]=d;f=1;break}else{c[(ve()|0)>>2]=84;f=-1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;f=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;f=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;f=4;break}else{c[(ve()|0)>>2]=84;f=-1;break}}else f=1;while(0);return f|0}function Xe(){return xe()|0}function Ye(){return xe()|0}function Ze(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=0;while(1){if((d[3661+f>>0]|0)==(b|0)){g=2;break}h=f+1|0;if((h|0)==87){i=87;j=3749;g=5;break}else f=h}if((g|0)==2)if(!f)k=3749;else{i=f;j=3749;g=5}if((g|0)==5)while(1){g=0;f=j;do{b=f;f=f+1|0}while((a[b>>0]|0)!=0);i=i+-1|0;if(!i){k=f;break}else{j=f;g=5}}return _e(k,c[e+20>>2]|0)|0}function _e(a,b){a=a|0;b=b|0;return $e(a,b)|0}function $e(a,b){a=a|0;b=b|0;var d=0;if(!b)d=0;else d=af(c[b>>2]|0,c[b+4>>2]|0,a)|0;return (d|0?d:a)|0}function af(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;f=(c[b>>2]|0)+1794895138|0;g=bf(c[b+8>>2]|0,f)|0;h=bf(c[b+12>>2]|0,f)|0;i=bf(c[b+16>>2]|0,f)|0;a:do if((g>>>0>>2>>>0?(j=d-(g<<2)|0,h>>>0>>0&i>>>0>>0):0)?((i|h)&3|0)==0:0){j=h>>>2;k=i>>>2;l=0;m=g;while(1){n=m>>>1;o=l+n|0;p=o<<1;q=p+j|0;r=bf(c[b+(q<<2)>>2]|0,f)|0;s=bf(c[b+(q+1<<2)>>2]|0,f)|0;if(!(s>>>0>>0&r>>>0<(d-s|0)>>>0)){t=0;break a}if(a[b+(s+r)>>0]|0){t=0;break a}r=Ce(e,b+s|0)|0;if(!r)break;s=(r|0)<0;if((m|0)==1){t=0;break a}else{l=s?l:o;m=s?n:m-n|0}}m=p+k|0;l=bf(c[b+(m<<2)>>2]|0,f)|0;j=bf(c[b+(m+1<<2)>>2]|0,f)|0;if(j>>>0>>0&l>>>0<(d-j|0)>>>0)t=(a[b+(j+l)>>0]|0)==0?b+j|0:0;else t=0}else t=0;while(0);return t|0}function bf(a,b){a=a|0;b=b|0;var c=0;c=Zf(a|0)|0;return ((b|0)==0?a:c)|0}function cf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;f=e+16|0;g=c[f>>2]|0;if(!g)if(!(df(e)|0)){h=c[f>>2]|0;i=5}else j=0;else{h=g;i=5}a:do if((i|0)==5){g=e+20|0;f=c[g>>2]|0;k=f;if((h-f|0)>>>0>>0){j=ta[c[e+36>>2]&7](e,b,d)|0;break}b:do if((a[e+75>>0]|0)>-1){f=d;while(1){if(!f){l=k;m=0;n=d;o=b;break b}p=f+-1|0;if((a[b+p>>0]|0)==10)break;else f=p}p=ta[c[e+36>>2]&7](e,b,f)|0;if(p>>>0>>0){j=p;break a}l=c[g>>2]|0;m=f;n=d-f|0;o=b+f|0}else{l=k;m=0;n=d;o=b}while(0);Wf(l|0,o|0,n|0)|0;c[g>>2]=(c[g>>2]|0)+n;j=m+n|0}while(0);return j|0}function df(b){b=b|0;var d=0,e=0,f=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;e=c[b>>2]|0;if(!(e&8)){c[b+8>>2]=0;c[b+4>>2]=0;d=c[b+44>>2]|0;c[b+28>>2]=d;c[b+20>>2]=d;c[b+16>>2]=d+(c[b+48>>2]|0);f=0}else{c[b>>2]=e|32;f=-1}return f|0}function ef(b,c){b=b|0;c=c|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=a[b>>0]|0;f=e&255;a:do if(!(e<<24>>24)){g=f;h=c}else{i=e;j=f;k=b;l=c;while(1){m=a[l>>0]|0;if(!(m<<24>>24)){g=j;h=l;break a}if(i<<24>>24!=m<<24>>24?(n=Ae(j)|0,(n|0)!=(Ae(m&255)|0)):0){g=j;h=l;break a}k=k+1|0;m=l+1|0;i=a[k>>0]|0;n=i&255;if(!(i<<24>>24)){g=n;h=m;break}else{j=n;l=m}}}while(0);c=Ae(g)|0;return c-(Ae(d[h>>0]|0)|0)|0}function ff(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=b;a:do if(!(d&3)){e=b;f=4}else{g=d;h=b;while(1){if(!(a[h>>0]|0)){i=g;break a}j=h+1|0;g=j;if(!(g&3)){e=j;f=4;break}else h=j}}while(0);if((f|0)==4){f=e;while(1){k=c[f>>2]|0;if(!((k&-2139062144^-2139062144)&k+-16843009))f=f+4|0;else break}if(!((k&255)<<24>>24))l=f;else{k=f;while(1){f=k+1|0;if(!(a[f>>0]|0)){l=f;break}else k=f}}i=l}return i-d|0}function gf(a,b){a=a|0;b=b|0;hf(a,b)|0;return a|0}function hf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=d;a:do if(!((e^b)&3)){if(!(e&3)){f=b;g=d}else{h=b;i=d;while(1){j=a[i>>0]|0;a[h>>0]=j;if(!(j<<24>>24)){k=h;break a}j=i+1|0;l=h+1|0;if(!(j&3)){f=l;g=j;break}else{h=l;i=j}}}i=c[g>>2]|0;if(!((i&-2139062144^-2139062144)&i+-16843009)){h=i;i=f;j=g;while(1){l=j+4|0;m=i+4|0;c[i>>2]=h;h=c[l>>2]|0;if((h&-2139062144^-2139062144)&h+-16843009|0){n=m;o=l;break}else{i=m;j=l}}}else{n=f;o=g}p=n;q=o;r=8}else{p=b;q=d;r=8}while(0);if((r|0)==8){r=a[q>>0]|0;a[p>>0]=r;if(!(r<<24>>24))k=p;else{r=p;p=q;while(1){p=p+1|0;q=r+1|0;d=a[p>>0]|0;a[q>>0]=d;if(!(d<<24>>24)){k=q;break}else r=q}}}return k|0}function jf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;f=e;c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;d=ue(ga(3,f|0)|0)|0;l=e;return d|0}function kf(a){a=a|0;var b=0,d=0,e=0;if(c[a+68>>2]|0){b=c[a+116>>2]|0;d=a+112|0;if(b|0)c[b+112>>2]=c[d>>2];a=c[d>>2]|0;if(!a)e=(lf()|0)+232|0;else e=a+116|0;c[e>>2]=b}return}function lf(){return xe()|0}function mf(){ha(5672);return 5680}function nf(){la(5672);return}function of(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;if((c[a+76>>2]|0)>-1)b=Ge(a)|0;else b=0;kf(a);d=(c[a>>2]&1|0)!=0;if(!d){e=mf()|0;f=c[a+52>>2]|0;g=a+56|0;if(f|0)c[f+56>>2]=c[g>>2];h=c[g>>2]|0;if(h|0)c[h+52>>2]=f;if((c[e>>2]|0)==(a|0))c[e>>2]=h;nf()}h=pf(a)|0;e=va[c[a+12>>2]&15](a)|0|h;h=c[a+92>>2]|0;if(h|0)Df(h);if(d){if(b|0)He(a)}else Df(a);return e|0}function pf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;do if(a){if((c[a+76>>2]|0)<=-1){b=qf(a)|0;break}d=(Ge(a)|0)==0;e=qf(a)|0;if(d)b=e;else{He(a);b=e}}else{if(!(c[631]|0))f=0;else f=pf(c[631]|0)|0;e=c[(mf()|0)>>2]|0;if(!e)g=f;else{d=e;e=f;while(1){if((c[d+76>>2]|0)>-1)h=Ge(d)|0;else h=0;if((c[d+20>>2]|0)>>>0>(c[d+28>>2]|0)>>>0)i=qf(d)|0|e;else i=e;if(h|0)He(d);d=c[d+56>>2]|0;if(!d){g=i;break}else e=i}}nf();b=g}while(0);return b|0}function qf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=a+20|0;d=a+28|0;if((c[b>>2]|0)>>>0>(c[d>>2]|0)>>>0?(ta[c[a+36>>2]&7](a,0,0)|0,(c[b>>2]|0)==0):0)e=-1;else{f=a+4|0;g=c[f>>2]|0;h=a+8|0;i=c[h>>2]|0;if(g>>>0>>0)ta[c[a+40>>2]&7](a,g-i|0,1)|0;c[a+16>>2]=0;c[d>>2]=0;c[b>>2]=0;c[h>>2]=0;c[f>>2]=0;e=0}return e|0}function rf(a){a=a|0;var b=0,d=0,e=0;if((c[a+76>>2]|0)>-1){b=(Ge(a)|0)==0;d=(c[a>>2]|0)>>>5&1;if(b)e=d;else e=d}else e=(c[a>>2]|0)>>>5&1;return e|0}function sf(a,b,c){a=a|0;b=b|0;c=c|0;return tf(a,b,c)|0}function tf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;if((c[a+76>>2]|0)>-1){e=(Ge(a)|0)==0;f=uf(a,b,d)|0;if(e)g=f;else{He(a);g=f}}else g=uf(a,b,d)|0;return g|0}function uf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;if((d|0)==1)e=b-(c[a+8>>2]|0)+(c[a+4>>2]|0)|0;else e=b;b=a+20|0;f=a+28|0;if((c[b>>2]|0)>>>0>(c[f>>2]|0)>>>0?(ta[c[a+36>>2]&7](a,0,0)|0,(c[b>>2]|0)==0):0)g=-1;else{c[a+16>>2]=0;c[f>>2]=0;c[b>>2]=0;if((ta[c[a+40>>2]&7](a,e,d)|0)<0)g=-1;else{c[a+8>>2]=0;c[a+4>>2]=0;c[a>>2]=c[a>>2]&-17;g=0}}return g|0}function vf(a,b,c){a=a|0;b=b|0;c=c|0;wf(a,b,c)|0;return a|0}function wf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;f=d;do if(!((f^b)&3)){g=(e|0)!=0;a:do if(g&(f&3|0)!=0){h=b;i=e;j=d;while(1){k=a[j>>0]|0;a[h>>0]=k;if(!(k<<24>>24)){l=h;m=i;n=j;break a}k=i+-1|0;o=j+1|0;p=h+1|0;q=(k|0)!=0;if(q&(o&3|0)!=0){h=p;i=k;j=o}else{r=p;s=k;t=o;u=q;v=5;break}}}else{r=b;s=e;t=d;u=g;v=5}while(0);if((v|0)==5)if(u){l=r;m=s;n=t}else{w=r;x=0;break}if(!(a[n>>0]|0)){w=l;x=m}else{b:do if(m>>>0>3){g=m;j=l;i=n;while(1){h=c[i>>2]|0;if((h&-2139062144^-2139062144)&h+-16843009|0){y=g;z=j;A=i;break b}c[j>>2]=h;h=g+-4|0;q=i+4|0;o=j+4|0;if(h>>>0>3){g=h;j=o;i=q}else{y=h;z=o;A=q;break}}}else{y=m;z=l;A=n}while(0);B=z;C=y;D=A;v=11}}else{B=b;C=e;D=d;v=11}while(0);c:do if((v|0)==11)if(!C){w=B;x=0}else{d=B;e=C;b=D;while(1){A=a[b>>0]|0;a[d>>0]=A;if(!(A<<24>>24)){w=d;x=e;break c}e=e+-1|0;A=d+1|0;if(!e){w=A;x=0;break}else{d=A;b=b+1|0}}}while(0);Mf(w|0,0,x|0)|0;return w|0}function xf(a){a=a|0;var b=0,d=0,e=0;if((c[a+76>>2]|0)>-1){b=(Ge(a)|0)==0;d=yf(a)|0;if(b)e=d;else e=d}else e=yf(a)|0;return e|0}function yf(a){a=a|0;var b=0,d=0,e=0;if(!(c[a>>2]&128))b=1;else b=(c[a+20>>2]|0)>>>0>(c[a+28>>2]|0)>>>0?2:1;d=ta[c[a+40>>2]&7](a,0,b)|0;if((d|0)<0)e=d;else e=d-(c[a+8>>2]|0)+(c[a+4>>2]|0)+(c[a+20>>2]|0)-(c[a+28>>2]|0)|0;return e|0}function zf(a){a=a|0;(c[a+76>>2]|0)>-1?Ge(a)|0:0;return c[a+60>>2]|0}function Af(a){a=a|0;return xf(a)|0}function Bf(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;e=d;c[e>>2]=b;b=Ee(c[599]|0,a,e)|0;l=d;return b|0}function Cf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0;b=l;l=l+16|0;d=b;do if(a>>>0<245){e=a>>>0<11?16:a+11&-8;f=e>>>3;g=c[1421]|0;h=g>>>f;if(h&3|0){i=(h&1^1)+f|0;j=5724+(i<<1<<2)|0;k=j+8|0;m=c[k>>2]|0;n=m+8|0;o=c[n>>2]|0;do if((j|0)!=(o|0)){if(o>>>0<(c[1425]|0)>>>0)ka();p=o+12|0;if((c[p>>2]|0)==(m|0)){c[p>>2]=j;c[k>>2]=o;break}else ka()}else c[1421]=g&~(1<>2]=o|3;k=m+o+4|0;c[k>>2]=c[k>>2]|1;q=n;l=b;return q|0}k=c[1423]|0;if(e>>>0>k>>>0){if(h|0){o=2<>>12&16;p=o>>>j;o=p>>>5&8;r=p>>>o;p=r>>>2&4;s=r>>>p;r=s>>>1&2;t=s>>>r;s=t>>>1&1;u=(o|j|p|r|s)+(t>>>s)|0;s=5724+(u<<1<<2)|0;t=s+8|0;r=c[t>>2]|0;p=r+8|0;j=c[p>>2]|0;do if((s|0)!=(j|0)){if(j>>>0<(c[1425]|0)>>>0)ka();o=j+12|0;if((c[o>>2]|0)==(r|0)){c[o>>2]=s;c[t>>2]=j;v=g;break}else ka()}else{o=g&~(1<>2]=e|3;t=r+e|0;c[t+4>>2]=j|1;c[t+j>>2]=j;if(k|0){s=c[1426]|0;f=k>>>3;h=5724+(f<<1<<2)|0;n=1<>2]|0;if(m>>>0<(c[1425]|0)>>>0)ka();else{w=f;x=m}}else{c[1421]=v|n;w=h+8|0;x=h}c[w>>2]=s;c[x+12>>2]=s;c[s+8>>2]=x;c[s+12>>2]=h}c[1423]=j;c[1426]=t;q=p;l=b;return q|0}t=c[1422]|0;if(t){j=(t&0-t)+-1|0;h=j>>>12&16;s=j>>>h;j=s>>>5&8;n=s>>>j;s=n>>>2&4;m=n>>>s;n=m>>>1&2;f=m>>>n;m=f>>>1&1;i=c[5988+((j|h|s|n|m)+(f>>>m)<<2)>>2]|0;m=(c[i+4>>2]&-8)-e|0;f=c[i+16+(((c[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!f){y=m;z=i}else{n=f;f=m;m=i;while(1){i=(c[n+4>>2]&-8)-e|0;s=i>>>0>>0;h=s?i:f;i=s?n:m;n=c[n+16+(((c[n+16>>2]|0)==0&1)<<2)>>2]|0;if(!n){y=h;z=i;break}else{f=h;m=i}}}m=c[1425]|0;if(z>>>0>>0)ka();f=z+e|0;if(z>>>0>=f>>>0)ka();n=c[z+24>>2]|0;p=c[z+12>>2]|0;do if((p|0)==(z|0)){r=z+20|0;u=c[r>>2]|0;if(!u){i=z+16|0;h=c[i>>2]|0;if(!h){A=0;break}else{B=h;C=i}}else{B=u;C=r}while(1){r=B+20|0;u=c[r>>2]|0;if(u|0){B=u;C=r;continue}r=B+16|0;u=c[r>>2]|0;if(!u)break;else{B=u;C=r}}if(C>>>0>>0)ka();else{c[C>>2]=0;A=B;break}}else{r=c[z+8>>2]|0;if(r>>>0>>0)ka();u=r+12|0;if((c[u>>2]|0)!=(z|0))ka();i=p+8|0;if((c[i>>2]|0)==(z|0)){c[u>>2]=p;c[i>>2]=r;A=p;break}else ka()}while(0);a:do if(n|0){p=c[z+28>>2]|0;m=5988+(p<<2)|0;do if((z|0)==(c[m>>2]|0)){c[m>>2]=A;if(!A){c[1422]=t&~(1<>>0>=(c[1425]|0)>>>0){c[n+16+(((c[n+16>>2]|0)!=(z|0)&1)<<2)>>2]=A;if(!A)break a;else break}else ka();while(0);p=c[1425]|0;if(A>>>0

>>0)ka();c[A+24>>2]=n;m=c[z+16>>2]|0;do if(m|0)if(m>>>0

>>0)ka();else{c[A+16>>2]=m;c[m+24>>2]=A;break}while(0);m=c[z+20>>2]|0;if(m|0)if(m>>>0<(c[1425]|0)>>>0)ka();else{c[A+20>>2]=m;c[m+24>>2]=A;break}}while(0);if(y>>>0<16){n=y+e|0;c[z+4>>2]=n|3;t=z+n+4|0;c[t>>2]=c[t>>2]|1}else{c[z+4>>2]=e|3;c[f+4>>2]=y|1;c[f+y>>2]=y;if(k|0){t=c[1426]|0;n=k>>>3;m=5724+(n<<1<<2)|0;p=1<>2]|0;if(r>>>0<(c[1425]|0)>>>0)ka();else{D=n;E=r}}else{c[1421]=g|p;D=m+8|0;E=m}c[D>>2]=t;c[E+12>>2]=t;c[t+8>>2]=E;c[t+12>>2]=m}c[1423]=y;c[1426]=f}q=z+8|0;l=b;return q|0}else F=e}else F=e}else if(a>>>0<=4294967231){m=a+11|0;t=m&-8;p=c[1422]|0;if(p){r=0-t|0;n=m>>>8;if(n)if(t>>>0>16777215)G=31;else{m=(n+1048320|0)>>>16&8;i=n<>>16&4;u=i<>>16&2;h=14-(n|m|i)+(u<>>15)|0;G=t>>>(h+7|0)&1|h<<1}else G=0;h=c[5988+(G<<2)>>2]|0;b:do if(!h){H=r;I=0;J=0;K=81}else{i=r;u=0;m=t<<((G|0)==31?0:25-(G>>>1)|0);n=h;s=0;while(1){j=(c[n+4>>2]&-8)-t|0;if(j>>>0>>0)if(!j){L=0;M=n;N=n;K=85;break b}else{O=j;P=n}else{O=i;P=s}j=c[n+20>>2]|0;n=c[n+16+(m>>>31<<2)>>2]|0;o=(j|0)==0|(j|0)==(n|0)?u:j;j=(n|0)==0;if(j){H=O;I=o;J=P;K=81;break}else{i=O;u=o;m=m<<((j^1)&1);s=P}}}while(0);if((K|0)==81){if((I|0)==0&(J|0)==0){h=2<>>12&16;e=h>>>r;h=e>>>5&8;f=e>>>h;e=f>>>2&4;g=f>>>e;f=g>>>1&2;k=g>>>f;g=k>>>1&1;Q=c[5988+((h|r|e|f|g)+(k>>>g)<<2)>>2]|0;R=0}else{Q=I;R=J}if(!Q){S=H;T=R}else{L=H;M=Q;N=R;K=85}}if((K|0)==85)while(1){K=0;g=(c[M+4>>2]&-8)-t|0;k=g>>>0>>0;f=k?g:L;g=k?M:N;M=c[M+16+(((c[M+16>>2]|0)==0&1)<<2)>>2]|0;if(!M){S=f;T=g;break}else{L=f;N=g;K=85}}if((T|0)!=0?S>>>0<((c[1423]|0)-t|0)>>>0:0){g=c[1425]|0;if(T>>>0>>0)ka();f=T+t|0;if(T>>>0>=f>>>0)ka();k=c[T+24>>2]|0;e=c[T+12>>2]|0;do if((e|0)==(T|0)){r=T+20|0;h=c[r>>2]|0;if(!h){s=T+16|0;m=c[s>>2]|0;if(!m){U=0;break}else{V=m;W=s}}else{V=h;W=r}while(1){r=V+20|0;h=c[r>>2]|0;if(h|0){V=h;W=r;continue}r=V+16|0;h=c[r>>2]|0;if(!h)break;else{V=h;W=r}}if(W>>>0>>0)ka();else{c[W>>2]=0;U=V;break}}else{r=c[T+8>>2]|0;if(r>>>0>>0)ka();h=r+12|0;if((c[h>>2]|0)!=(T|0))ka();s=e+8|0;if((c[s>>2]|0)==(T|0)){c[h>>2]=e;c[s>>2]=r;U=e;break}else ka()}while(0);c:do if(k){e=c[T+28>>2]|0;g=5988+(e<<2)|0;do if((T|0)==(c[g>>2]|0)){c[g>>2]=U;if(!U){r=p&~(1<>>0>=(c[1425]|0)>>>0){c[k+16+(((c[k+16>>2]|0)!=(T|0)&1)<<2)>>2]=U;if(!U){X=p;break c}else break}else ka();while(0);e=c[1425]|0;if(U>>>0>>0)ka();c[U+24>>2]=k;g=c[T+16>>2]|0;do if(g|0)if(g>>>0>>0)ka();else{c[U+16>>2]=g;c[g+24>>2]=U;break}while(0);g=c[T+20>>2]|0;if(g)if(g>>>0<(c[1425]|0)>>>0)ka();else{c[U+20>>2]=g;c[g+24>>2]=U;X=p;break}else X=p}else X=p;while(0);do if(S>>>0>=16){c[T+4>>2]=t|3;c[f+4>>2]=S|1;c[f+S>>2]=S;p=S>>>3;if(S>>>0<256){k=5724+(p<<1<<2)|0;g=c[1421]|0;e=1<>2]|0;if(r>>>0<(c[1425]|0)>>>0)ka();else{Y=p;Z=r}}else{c[1421]=g|e;Y=k+8|0;Z=k}c[Y>>2]=f;c[Z+12>>2]=f;c[f+8>>2]=Z;c[f+12>>2]=k;break}k=S>>>8;if(k)if(S>>>0>16777215)_=31;else{e=(k+1048320|0)>>>16&8;g=k<>>16&4;r=g<>>16&2;p=14-(k|e|g)+(r<>>15)|0;_=S>>>(p+7|0)&1|p<<1}else _=0;p=5988+(_<<2)|0;c[f+28>>2]=_;g=f+16|0;c[g+4>>2]=0;c[g>>2]=0;g=1<<_;if(!(X&g)){c[1422]=X|g;c[p>>2]=f;c[f+24>>2]=p;c[f+12>>2]=f;c[f+8>>2]=f;break}g=S<<((_|0)==31?0:25-(_>>>1)|0);r=c[p>>2]|0;while(1){if((c[r+4>>2]&-8|0)==(S|0)){K=139;break}$=r+16+(g>>>31<<2)|0;p=c[$>>2]|0;if(!p){K=136;break}else{g=g<<1;r=p}}if((K|0)==136)if($>>>0<(c[1425]|0)>>>0)ka();else{c[$>>2]=f;c[f+24>>2]=r;c[f+12>>2]=f;c[f+8>>2]=f;break}else if((K|0)==139){g=r+8|0;p=c[g>>2]|0;e=c[1425]|0;if(p>>>0>=e>>>0&r>>>0>=e>>>0){c[p+12>>2]=f;c[g>>2]=f;c[f+8>>2]=p;c[f+12>>2]=r;c[f+24>>2]=0;break}else ka()}}else{p=S+t|0;c[T+4>>2]=p|3;g=T+p+4|0;c[g>>2]=c[g>>2]|1}while(0);q=T+8|0;l=b;return q|0}else F=t}else F=t}else F=-1;while(0);T=c[1423]|0;if(T>>>0>=F>>>0){S=T-F|0;$=c[1426]|0;if(S>>>0>15){_=$+F|0;c[1426]=_;c[1423]=S;c[_+4>>2]=S|1;c[_+S>>2]=S;c[$+4>>2]=F|3}else{c[1423]=0;c[1426]=0;c[$+4>>2]=T|3;S=$+T+4|0;c[S>>2]=c[S>>2]|1}q=$+8|0;l=b;return q|0}$=c[1424]|0;if($>>>0>F>>>0){S=$-F|0;c[1424]=S;T=c[1427]|0;_=T+F|0;c[1427]=_;c[_+4>>2]=S|1;c[T+4>>2]=F|3;q=T+8|0;l=b;return q|0}if(!(c[1539]|0)){c[1541]=4096;c[1540]=4096;c[1542]=-1;c[1543]=-1;c[1544]=0;c[1532]=0;T=d&-16^1431655768;c[d>>2]=T;c[1539]=T;aa=4096}else aa=c[1541]|0;T=F+48|0;d=F+47|0;S=aa+d|0;_=0-aa|0;aa=S&_;if(aa>>>0<=F>>>0){q=0;l=b;return q|0}X=c[1531]|0;if(X|0?(Z=c[1529]|0,Y=Z+aa|0,Y>>>0<=Z>>>0|Y>>>0>X>>>0):0){q=0;l=b;return q|0}d:do if(!(c[1532]&4)){X=c[1427]|0;e:do if(X){Y=6132;while(1){Z=c[Y>>2]|0;if(Z>>>0<=X>>>0?(ba=Y+4|0,(Z+(c[ba>>2]|0)|0)>>>0>X>>>0):0)break;Z=c[Y+8>>2]|0;if(!Z){K=163;break e}else Y=Z}r=S-$&_;if(r>>>0<2147483647){Z=Vf(r|0)|0;if((Z|0)==((c[Y>>2]|0)+(c[ba>>2]|0)|0))if((Z|0)==(-1|0))ca=r;else{da=Z;ea=r;K=180;break d}else{fa=Z;ga=r;K=171}}else ca=0}else K=163;while(0);do if((K|0)==163){X=Vf(0)|0;if((X|0)!=(-1|0)?(t=X,r=c[1540]|0,Z=r+-1|0,U=((Z&t|0)==0?0:(Z+t&0-r)-t|0)+aa|0,t=c[1529]|0,r=U+t|0,U>>>0>F>>>0&U>>>0<2147483647):0){Z=c[1531]|0;if(Z|0?r>>>0<=t>>>0|r>>>0>Z>>>0:0){ca=0;break}Z=Vf(U|0)|0;if((Z|0)==(X|0)){da=X;ea=U;K=180;break d}else{fa=Z;ga=U;K=171}}else ca=0}while(0);do if((K|0)==171){U=0-ga|0;if(!(T>>>0>ga>>>0&(ga>>>0<2147483647&(fa|0)!=(-1|0))))if((fa|0)==(-1|0)){ca=0;break}else{da=fa;ea=ga;K=180;break d}Z=c[1541]|0;X=d-ga+Z&0-Z;if(X>>>0>=2147483647){da=fa;ea=ga;K=180;break d}if((Vf(X|0)|0)==(-1|0)){Vf(U|0)|0;ca=0;break}else{da=fa;ea=X+ga|0;K=180;break d}}while(0);c[1532]=c[1532]|4;ha=ca;K=178}else{ha=0;K=178}while(0);if(((K|0)==178?aa>>>0<2147483647:0)?(ca=Vf(aa|0)|0,aa=Vf(0)|0,ga=aa-ca|0,fa=ga>>>0>(F+40|0)>>>0,!((ca|0)==(-1|0)|fa^1|ca>>>0>>0&((ca|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){da=ca;ea=fa?ga:ha;K=180}if((K|0)==180){ha=(c[1529]|0)+ea|0;c[1529]=ha;if(ha>>>0>(c[1530]|0)>>>0)c[1530]=ha;ha=c[1427]|0;do if(ha){ga=6132;while(1){ia=c[ga>>2]|0;ja=ga+4|0;la=c[ja>>2]|0;if((da|0)==(ia+la|0)){K=190;break}fa=c[ga+8>>2]|0;if(!fa)break;else ga=fa}if(((K|0)==190?(c[ga+12>>2]&8|0)==0:0)?ha>>>0>>0&ha>>>0>=ia>>>0:0){c[ja>>2]=la+ea;fa=ha+8|0;ca=(fa&7|0)==0?0:0-fa&7;fa=ha+ca|0;aa=(c[1424]|0)+(ea-ca)|0;c[1427]=fa;c[1424]=aa;c[fa+4>>2]=aa|1;c[fa+aa+4>>2]=40;c[1428]=c[1543];break}aa=c[1425]|0;if(da>>>0>>0){c[1425]=da;ma=da}else ma=aa;aa=da+ea|0;fa=6132;while(1){if((c[fa>>2]|0)==(aa|0)){K=198;break}ca=c[fa+8>>2]|0;if(!ca)break;else fa=ca}if((K|0)==198?(c[fa+12>>2]&8|0)==0:0){c[fa>>2]=da;ga=fa+4|0;c[ga>>2]=(c[ga>>2]|0)+ea;ga=da+8|0;ca=da+((ga&7|0)==0?0:0-ga&7)|0;ga=aa+8|0;d=aa+((ga&7|0)==0?0:0-ga&7)|0;ga=ca+F|0;T=d-ca-F|0;c[ca+4>>2]=F|3;do if((d|0)!=(ha|0)){if((d|0)==(c[1426]|0)){ba=(c[1423]|0)+T|0;c[1423]=ba;c[1426]=ga;c[ga+4>>2]=ba|1;c[ga+ba>>2]=ba;break}ba=c[d+4>>2]|0;if((ba&3|0)==1){_=ba&-8;$=ba>>>3;f:do if(ba>>>0>=256){S=c[d+24>>2]|0;X=c[d+12>>2]|0;do if((X|0)==(d|0)){U=d+16|0;Z=U+4|0;r=c[Z>>2]|0;if(!r){t=c[U>>2]|0;if(!t){na=0;break}else{oa=t;pa=U}}else{oa=r;pa=Z}while(1){Z=oa+20|0;r=c[Z>>2]|0;if(r|0){oa=r;pa=Z;continue}Z=oa+16|0;r=c[Z>>2]|0;if(!r)break;else{oa=r;pa=Z}}if(pa>>>0>>0)ka();else{c[pa>>2]=0;na=oa;break}}else{Z=c[d+8>>2]|0;if(Z>>>0>>0)ka();r=Z+12|0;if((c[r>>2]|0)!=(d|0))ka();U=X+8|0;if((c[U>>2]|0)==(d|0)){c[r>>2]=X;c[U>>2]=Z;na=X;break}else ka()}while(0);if(!S)break;X=c[d+28>>2]|0;Z=5988+(X<<2)|0;do if((d|0)!=(c[Z>>2]|0))if(S>>>0>=(c[1425]|0)>>>0){c[S+16+(((c[S+16>>2]|0)!=(d|0)&1)<<2)>>2]=na;if(!na)break f;else break}else ka();else{c[Z>>2]=na;if(na|0)break;c[1422]=c[1422]&~(1<>>0>>0)ka();c[na+24>>2]=S;Z=d+16|0;U=c[Z>>2]|0;do if(U|0)if(U>>>0>>0)ka();else{c[na+16>>2]=U;c[U+24>>2]=na;break}while(0);U=c[Z+4>>2]|0;if(!U)break;if(U>>>0<(c[1425]|0)>>>0)ka();else{c[na+20>>2]=U;c[U+24>>2]=na;break}}else{U=c[d+8>>2]|0;X=c[d+12>>2]|0;S=5724+($<<1<<2)|0;do if((U|0)!=(S|0)){if(U>>>0>>0)ka();if((c[U+12>>2]|0)==(d|0))break;ka()}while(0);if((X|0)==(U|0)){c[1421]=c[1421]&~(1<<$);break}do if((X|0)==(S|0))qa=X+8|0;else{if(X>>>0>>0)ka();Z=X+8|0;if((c[Z>>2]|0)==(d|0)){qa=Z;break}ka()}while(0);c[U+12>>2]=X;c[qa>>2]=U}while(0);ra=d+_|0;sa=_+T|0}else{ra=d;sa=T}$=ra+4|0;c[$>>2]=c[$>>2]&-2;c[ga+4>>2]=sa|1;c[ga+sa>>2]=sa;$=sa>>>3;if(sa>>>0<256){ba=5724+($<<1<<2)|0;Y=c[1421]|0;S=1<<$;do if(!(Y&S)){c[1421]=Y|S;ta=ba+8|0;ua=ba}else{$=ba+8|0;Z=c[$>>2]|0;if(Z>>>0>=(c[1425]|0)>>>0){ta=$;ua=Z;break}ka()}while(0);c[ta>>2]=ga;c[ua+12>>2]=ga;c[ga+8>>2]=ua;c[ga+12>>2]=ba;break}S=sa>>>8;do if(!S)va=0;else{if(sa>>>0>16777215){va=31;break}Y=(S+1048320|0)>>>16&8;_=S<>>16&4;$=_<>>16&2;r=14-(Z|Y|_)+($<<_>>>15)|0;va=sa>>>(r+7|0)&1|r<<1}while(0);S=5988+(va<<2)|0;c[ga+28>>2]=va;ba=ga+16|0;c[ba+4>>2]=0;c[ba>>2]=0;ba=c[1422]|0;r=1<>2]=ga;c[ga+24>>2]=S;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}r=sa<<((va|0)==31?0:25-(va>>>1)|0);ba=c[S>>2]|0;while(1){if((c[ba+4>>2]&-8|0)==(sa|0)){K=265;break}wa=ba+16+(r>>>31<<2)|0;S=c[wa>>2]|0;if(!S){K=262;break}else{r=r<<1;ba=S}}if((K|0)==262)if(wa>>>0<(c[1425]|0)>>>0)ka();else{c[wa>>2]=ga;c[ga+24>>2]=ba;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}else if((K|0)==265){r=ba+8|0;S=c[r>>2]|0;_=c[1425]|0;if(S>>>0>=_>>>0&ba>>>0>=_>>>0){c[S+12>>2]=ga;c[r>>2]=ga;c[ga+8>>2]=S;c[ga+12>>2]=ba;c[ga+24>>2]=0;break}else ka()}}else{S=(c[1424]|0)+T|0;c[1424]=S;c[1427]=ga;c[ga+4>>2]=S|1}while(0);q=ca+8|0;l=b;return q|0}ga=6132;while(1){T=c[ga>>2]|0;if(T>>>0<=ha>>>0?(xa=T+(c[ga+4>>2]|0)|0,xa>>>0>ha>>>0):0)break;ga=c[ga+8>>2]|0}ga=xa+-47|0;ca=ga+8|0;T=ga+((ca&7|0)==0?0:0-ca&7)|0;ca=ha+16|0;ga=T>>>0>>0?ha:T;T=ga+8|0;d=da+8|0;aa=(d&7|0)==0?0:0-d&7;d=da+aa|0;fa=ea+-40-aa|0;c[1427]=d;c[1424]=fa;c[d+4>>2]=fa|1;c[d+fa+4>>2]=40;c[1428]=c[1543];fa=ga+4|0;c[fa>>2]=27;c[T>>2]=c[1533];c[T+4>>2]=c[1534];c[T+8>>2]=c[1535];c[T+12>>2]=c[1536];c[1533]=da;c[1534]=ea;c[1536]=0;c[1535]=T;T=ga+24|0;do{d=T;T=T+4|0;c[T>>2]=7}while((d+8|0)>>>0>>0);if((ga|0)!=(ha|0)){T=ga-ha|0;c[fa>>2]=c[fa>>2]&-2;c[ha+4>>2]=T|1;c[ga>>2]=T;d=T>>>3;if(T>>>0<256){aa=5724+(d<<1<<2)|0;S=c[1421]|0;r=1<>2]|0;if(_>>>0<(c[1425]|0)>>>0)ka();else{ya=d;za=_}}else{c[1421]=S|r;ya=aa+8|0;za=aa}c[ya>>2]=ha;c[za+12>>2]=ha;c[ha+8>>2]=za;c[ha+12>>2]=aa;break}aa=T>>>8;if(aa)if(T>>>0>16777215)Aa=31;else{r=(aa+1048320|0)>>>16&8;S=aa<>>16&4;_=S<>>16&2;d=14-(aa|r|S)+(_<>>15)|0;Aa=T>>>(d+7|0)&1|d<<1}else Aa=0;d=5988+(Aa<<2)|0;c[ha+28>>2]=Aa;c[ha+20>>2]=0;c[ca>>2]=0;S=c[1422]|0;_=1<>2]=ha;c[ha+24>>2]=d;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}_=T<<((Aa|0)==31?0:25-(Aa>>>1)|0);S=c[d>>2]|0;while(1){if((c[S+4>>2]&-8|0)==(T|0)){K=292;break}Ba=S+16+(_>>>31<<2)|0;d=c[Ba>>2]|0;if(!d){K=289;break}else{_=_<<1;S=d}}if((K|0)==289)if(Ba>>>0<(c[1425]|0)>>>0)ka();else{c[Ba>>2]=ha;c[ha+24>>2]=S;c[ha+12>>2]=ha;c[ha+8>>2]=ha;break}else if((K|0)==292){_=S+8|0;T=c[_>>2]|0;ca=c[1425]|0;if(T>>>0>=ca>>>0&S>>>0>=ca>>>0){c[T+12>>2]=ha;c[_>>2]=ha;c[ha+8>>2]=T;c[ha+12>>2]=S;c[ha+24>>2]=0;break}else ka()}}}else{T=c[1425]|0;if((T|0)==0|da>>>0>>0)c[1425]=da;c[1533]=da;c[1534]=ea;c[1536]=0;c[1430]=c[1539];c[1429]=-1;T=0;do{_=5724+(T<<1<<2)|0;c[_+12>>2]=_;c[_+8>>2]=_;T=T+1|0}while((T|0)!=32);T=da+8|0;S=(T&7|0)==0?0:0-T&7;T=da+S|0;_=ea+-40-S|0;c[1427]=T;c[1424]=_;c[T+4>>2]=_|1;c[T+_+4>>2]=40;c[1428]=c[1543]}while(0);ea=c[1424]|0;if(ea>>>0>F>>>0){da=ea-F|0;c[1424]=da;ea=c[1427]|0;ha=ea+F|0;c[1427]=ha;c[ha+4>>2]=da|1;c[ea+4>>2]=F|3;q=ea+8|0;l=b;return q|0}}c[(ve()|0)>>2]=12;q=0;l=b;return q|0}function Df(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;if(!a)return;b=a+-8|0;d=c[1425]|0;if(b>>>0>>0)ka();e=c[a+-4>>2]|0;a=e&3;if((a|0)==1)ka();f=e&-8;g=b+f|0;a:do if(!(e&1)){h=c[b>>2]|0;if(!a)return;i=b+(0-h)|0;j=h+f|0;if(i>>>0>>0)ka();if((i|0)==(c[1426]|0)){k=g+4|0;l=c[k>>2]|0;if((l&3|0)!=3){m=i;n=i;o=j;break}c[1423]=j;c[k>>2]=l&-2;c[i+4>>2]=j|1;c[i+j>>2]=j;return}l=h>>>3;if(h>>>0<256){h=c[i+8>>2]|0;k=c[i+12>>2]|0;p=5724+(l<<1<<2)|0;if((h|0)!=(p|0)){if(h>>>0>>0)ka();if((c[h+12>>2]|0)!=(i|0))ka()}if((k|0)==(h|0)){c[1421]=c[1421]&~(1<>>0>>0)ka();p=k+8|0;if((c[p>>2]|0)==(i|0))q=p;else ka()}else q=k+8|0;c[h+12>>2]=k;c[q>>2]=h;m=i;n=i;o=j;break}h=c[i+24>>2]|0;k=c[i+12>>2]|0;do if((k|0)==(i|0)){p=i+16|0;l=p+4|0;r=c[l>>2]|0;if(!r){s=c[p>>2]|0;if(!s){t=0;break}else{u=s;v=p}}else{u=r;v=l}while(1){l=u+20|0;r=c[l>>2]|0;if(r|0){u=r;v=l;continue}l=u+16|0;r=c[l>>2]|0;if(!r)break;else{u=r;v=l}}if(v>>>0>>0)ka();else{c[v>>2]=0;t=u;break}}else{l=c[i+8>>2]|0;if(l>>>0>>0)ka();r=l+12|0;if((c[r>>2]|0)!=(i|0))ka();p=k+8|0;if((c[p>>2]|0)==(i|0)){c[r>>2]=k;c[p>>2]=l;t=k;break}else ka()}while(0);if(h){k=c[i+28>>2]|0;l=5988+(k<<2)|0;do if((i|0)==(c[l>>2]|0)){c[l>>2]=t;if(!t){c[1422]=c[1422]&~(1<>>0>=(c[1425]|0)>>>0){c[h+16+(((c[h+16>>2]|0)!=(i|0)&1)<<2)>>2]=t;if(!t){m=i;n=i;o=j;break a}else break}else ka();while(0);k=c[1425]|0;if(t>>>0>>0)ka();c[t+24>>2]=h;l=i+16|0;p=c[l>>2]|0;do if(p|0)if(p>>>0>>0)ka();else{c[t+16>>2]=p;c[p+24>>2]=t;break}while(0);p=c[l+4>>2]|0;if(p)if(p>>>0<(c[1425]|0)>>>0)ka();else{c[t+20>>2]=p;c[p+24>>2]=t;m=i;n=i;o=j;break}else{m=i;n=i;o=j}}else{m=i;n=i;o=j}}else{m=b;n=b;o=f}while(0);if(m>>>0>=g>>>0)ka();f=g+4|0;b=c[f>>2]|0;if(!(b&1))ka();if(!(b&2)){t=c[1426]|0;if((g|0)==(c[1427]|0)){d=(c[1424]|0)+o|0;c[1424]=d;c[1427]=n;c[n+4>>2]=d|1;if((n|0)!=(t|0))return;c[1426]=0;c[1423]=0;return}if((g|0)==(t|0)){t=(c[1423]|0)+o|0;c[1423]=t;c[1426]=m;c[n+4>>2]=t|1;c[m+t>>2]=t;return}t=(b&-8)+o|0;d=b>>>3;b:do if(b>>>0>=256){u=c[g+24>>2]|0;v=c[g+12>>2]|0;do if((v|0)==(g|0)){q=g+16|0;a=q+4|0;e=c[a>>2]|0;if(!e){p=c[q>>2]|0;if(!p){w=0;break}else{x=p;y=q}}else{x=e;y=a}while(1){a=x+20|0;e=c[a>>2]|0;if(e|0){x=e;y=a;continue}a=x+16|0;e=c[a>>2]|0;if(!e)break;else{x=e;y=a}}if(y>>>0<(c[1425]|0)>>>0)ka();else{c[y>>2]=0;w=x;break}}else{a=c[g+8>>2]|0;if(a>>>0<(c[1425]|0)>>>0)ka();e=a+12|0;if((c[e>>2]|0)!=(g|0))ka();q=v+8|0;if((c[q>>2]|0)==(g|0)){c[e>>2]=v;c[q>>2]=a;w=v;break}else ka()}while(0);if(u|0){v=c[g+28>>2]|0;j=5988+(v<<2)|0;do if((g|0)==(c[j>>2]|0)){c[j>>2]=w;if(!w){c[1422]=c[1422]&~(1<>>0>=(c[1425]|0)>>>0){c[u+16+(((c[u+16>>2]|0)!=(g|0)&1)<<2)>>2]=w;if(!w)break b;else break}else ka();while(0);v=c[1425]|0;if(w>>>0>>0)ka();c[w+24>>2]=u;j=g+16|0;i=c[j>>2]|0;do if(i|0)if(i>>>0>>0)ka();else{c[w+16>>2]=i;c[i+24>>2]=w;break}while(0);i=c[j+4>>2]|0;if(i|0)if(i>>>0<(c[1425]|0)>>>0)ka();else{c[w+20>>2]=i;c[i+24>>2]=w;break}}}else{i=c[g+8>>2]|0;v=c[g+12>>2]|0;u=5724+(d<<1<<2)|0;if((i|0)!=(u|0)){if(i>>>0<(c[1425]|0)>>>0)ka();if((c[i+12>>2]|0)!=(g|0))ka()}if((v|0)==(i|0)){c[1421]=c[1421]&~(1<>>0<(c[1425]|0)>>>0)ka();u=v+8|0;if((c[u>>2]|0)==(g|0))z=u;else ka()}else z=v+8|0;c[i+12>>2]=v;c[z>>2]=i}while(0);c[n+4>>2]=t|1;c[m+t>>2]=t;if((n|0)==(c[1426]|0)){c[1423]=t;return}else A=t}else{c[f>>2]=b&-2;c[n+4>>2]=o|1;c[m+o>>2]=o;A=o}o=A>>>3;if(A>>>0<256){m=5724+(o<<1<<2)|0;b=c[1421]|0;f=1<>2]|0;if(t>>>0<(c[1425]|0)>>>0)ka();else{B=o;C=t}}else{c[1421]=b|f;B=m+8|0;C=m}c[B>>2]=n;c[C+12>>2]=n;c[n+8>>2]=C;c[n+12>>2]=m;return}m=A>>>8;if(m)if(A>>>0>16777215)D=31;else{C=(m+1048320|0)>>>16&8;B=m<>>16&4;f=B<>>16&2;b=14-(m|C|B)+(f<>>15)|0;D=A>>>(b+7|0)&1|b<<1}else D=0;b=5988+(D<<2)|0;c[n+28>>2]=D;c[n+20>>2]=0;c[n+16>>2]=0;B=c[1422]|0;f=1<>>1)|0);m=c[b>>2]|0;while(1){if((c[m+4>>2]&-8|0)==(A|0)){E=124;break}F=m+16+(C>>>31<<2)|0;t=c[F>>2]|0;if(!t){E=121;break}else{C=C<<1;m=t}}if((E|0)==121)if(F>>>0<(c[1425]|0)>>>0)ka();else{c[F>>2]=n;c[n+24>>2]=m;c[n+12>>2]=n;c[n+8>>2]=n;break}else if((E|0)==124){C=m+8|0;j=c[C>>2]|0;t=c[1425]|0;if(j>>>0>=t>>>0&m>>>0>=t>>>0){c[j+12>>2]=n;c[C>>2]=n;c[n+8>>2]=j;c[n+12>>2]=m;c[n+24>>2]=0;break}else ka()}}else{c[1422]=B|f;c[b>>2]=n;c[n+24>>2]=b;c[n+12>>2]=n;c[n+8>>2]=n}while(0);n=(c[1429]|0)+-1|0;c[1429]=n;if(!n)G=6140;else return;while(1){n=c[G>>2]|0;if(!n)break;else G=n+8|0}c[1429]=-1;return}function Ef(a,b){a=a|0;b=b|0;var d=0,e=0;if(a){d=S(b,a)|0;if((b|a)>>>0>65535)e=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1;else e=d}else e=0;d=Cf(e)|0;if(!d)return d|0;if(!(c[d+-4>>2]&3))return d|0;Mf(d|0,0,e|0)|0;return d|0}function Ff(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;if(!a){d=Cf(b)|0;return d|0}if(b>>>0>4294967231){c[(ve()|0)>>2]=12;d=0;return d|0}e=Gf(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(e|0){d=e+8|0;return d|0}e=Cf(b)|0;if(!e){d=0;return d|0}f=c[a+-4>>2]|0;g=(f&-8)-((f&3|0)==0?8:4)|0;Wf(e|0,a|0,(g>>>0>>0?g:b)|0)|0;Df(a);d=e;return d|0}function Gf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=a+4|0;e=c[d>>2]|0;f=e&-8;g=a+f|0;h=c[1425]|0;i=e&3;if(!((i|0)!=1&a>>>0>=h>>>0&a>>>0>>0))ka();j=c[g+4>>2]|0;if(!(j&1))ka();if(!i){if(b>>>0<256){k=0;return k|0}if(f>>>0>=(b+4|0)>>>0?(f-b|0)>>>0<=c[1541]<<1>>>0:0){k=a;return k|0}k=0;return k|0}if(f>>>0>=b>>>0){i=f-b|0;if(i>>>0<=15){k=a;return k|0}l=a+b|0;c[d>>2]=e&1|b|2;c[l+4>>2]=i|3;m=l+i+4|0;c[m>>2]=c[m>>2]|1;Hf(l,i);k=a;return k|0}if((g|0)==(c[1427]|0)){i=(c[1424]|0)+f|0;l=i-b|0;m=a+b|0;if(i>>>0<=b>>>0){k=0;return k|0}c[d>>2]=e&1|b|2;c[m+4>>2]=l|1;c[1427]=m;c[1424]=l;k=a;return k|0}if((g|0)==(c[1426]|0)){l=(c[1423]|0)+f|0;if(l>>>0>>0){k=0;return k|0}m=l-b|0;i=e&1;if(m>>>0>15){n=a+b|0;o=n+m|0;c[d>>2]=i|b|2;c[n+4>>2]=m|1;c[o>>2]=m;p=o+4|0;c[p>>2]=c[p>>2]&-2;q=n;r=m}else{c[d>>2]=i|l|2;i=a+l+4|0;c[i>>2]=c[i>>2]|1;q=0;r=0}c[1423]=r;c[1426]=q;k=a;return k|0}if(j&2|0){k=0;return k|0}q=(j&-8)+f|0;if(q>>>0>>0){k=0;return k|0}f=q-b|0;r=j>>>3;a:do if(j>>>0>=256){i=c[g+24>>2]|0;l=c[g+12>>2]|0;do if((l|0)==(g|0)){m=g+16|0;n=m+4|0;p=c[n>>2]|0;if(!p){o=c[m>>2]|0;if(!o){s=0;break}else{t=o;u=m}}else{t=p;u=n}while(1){n=t+20|0;p=c[n>>2]|0;if(p|0){t=p;u=n;continue}n=t+16|0;p=c[n>>2]|0;if(!p)break;else{t=p;u=n}}if(u>>>0>>0)ka();else{c[u>>2]=0;s=t;break}}else{n=c[g+8>>2]|0;if(n>>>0>>0)ka();p=n+12|0;if((c[p>>2]|0)!=(g|0))ka();m=l+8|0;if((c[m>>2]|0)==(g|0)){c[p>>2]=l;c[m>>2]=n;s=l;break}else ka()}while(0);if(i|0){l=c[g+28>>2]|0;n=5988+(l<<2)|0;do if((g|0)==(c[n>>2]|0)){c[n>>2]=s;if(!s){c[1422]=c[1422]&~(1<>>0>=(c[1425]|0)>>>0){c[i+16+(((c[i+16>>2]|0)!=(g|0)&1)<<2)>>2]=s;if(!s)break a;else break}else ka();while(0);l=c[1425]|0;if(s>>>0>>0)ka();c[s+24>>2]=i;n=g+16|0;m=c[n>>2]|0;do if(m|0)if(m>>>0>>0)ka();else{c[s+16>>2]=m;c[m+24>>2]=s;break}while(0);m=c[n+4>>2]|0;if(m|0)if(m>>>0<(c[1425]|0)>>>0)ka();else{c[s+20>>2]=m;c[m+24>>2]=s;break}}}else{m=c[g+8>>2]|0;l=c[g+12>>2]|0;i=5724+(r<<1<<2)|0;if((m|0)!=(i|0)){if(m>>>0>>0)ka();if((c[m+12>>2]|0)!=(g|0))ka()}if((l|0)==(m|0)){c[1421]=c[1421]&~(1<>>0>>0)ka();i=l+8|0;if((c[i>>2]|0)==(g|0))v=i;else ka()}else v=l+8|0;c[m+12>>2]=l;c[v>>2]=m}while(0);v=e&1;if(f>>>0<16){c[d>>2]=q|v|2;e=a+q+4|0;c[e>>2]=c[e>>2]|1;k=a;return k|0}else{e=a+b|0;c[d>>2]=v|b|2;c[e+4>>2]=f|3;b=e+f+4|0;c[b>>2]=c[b>>2]|1;Hf(e,f);k=a;return k|0}return 0}function Hf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=a+b|0;e=c[a+4>>2]|0;a:do if(!(e&1)){f=c[a>>2]|0;if(!(e&3))return;g=a+(0-f)|0;h=f+b|0;i=c[1425]|0;if(g>>>0>>0)ka();if((g|0)==(c[1426]|0)){j=d+4|0;k=c[j>>2]|0;if((k&3|0)!=3){l=g;m=h;break}c[1423]=h;c[j>>2]=k&-2;c[g+4>>2]=h|1;c[g+h>>2]=h;return}k=f>>>3;if(f>>>0<256){f=c[g+8>>2]|0;j=c[g+12>>2]|0;n=5724+(k<<1<<2)|0;if((f|0)!=(n|0)){if(f>>>0>>0)ka();if((c[f+12>>2]|0)!=(g|0))ka()}if((j|0)==(f|0)){c[1421]=c[1421]&~(1<>>0>>0)ka();n=j+8|0;if((c[n>>2]|0)==(g|0))o=n;else ka()}else o=j+8|0;c[f+12>>2]=j;c[o>>2]=f;l=g;m=h;break}f=c[g+24>>2]|0;j=c[g+12>>2]|0;do if((j|0)==(g|0)){n=g+16|0;k=n+4|0;p=c[k>>2]|0;if(!p){q=c[n>>2]|0;if(!q){r=0;break}else{s=q;t=n}}else{s=p;t=k}while(1){k=s+20|0;p=c[k>>2]|0;if(p|0){s=p;t=k;continue}k=s+16|0;p=c[k>>2]|0;if(!p)break;else{s=p;t=k}}if(t>>>0>>0)ka();else{c[t>>2]=0;r=s;break}}else{k=c[g+8>>2]|0;if(k>>>0>>0)ka();p=k+12|0;if((c[p>>2]|0)!=(g|0))ka();n=j+8|0;if((c[n>>2]|0)==(g|0)){c[p>>2]=j;c[n>>2]=k;r=j;break}else ka()}while(0);if(f){j=c[g+28>>2]|0;i=5988+(j<<2)|0;do if((g|0)==(c[i>>2]|0)){c[i>>2]=r;if(!r){c[1422]=c[1422]&~(1<>>0>=(c[1425]|0)>>>0){c[f+16+(((c[f+16>>2]|0)!=(g|0)&1)<<2)>>2]=r;if(!r){l=g;m=h;break a}else break}else ka();while(0);j=c[1425]|0;if(r>>>0>>0)ka();c[r+24>>2]=f;i=g+16|0;k=c[i>>2]|0;do if(k|0)if(k>>>0>>0)ka();else{c[r+16>>2]=k;c[k+24>>2]=r;break}while(0);k=c[i+4>>2]|0;if(k)if(k>>>0<(c[1425]|0)>>>0)ka();else{c[r+20>>2]=k;c[k+24>>2]=r;l=g;m=h;break}else{l=g;m=h}}else{l=g;m=h}}else{l=a;m=b}while(0);b=c[1425]|0;if(d>>>0>>0)ka();a=d+4|0;r=c[a>>2]|0;if(!(r&2)){s=c[1426]|0;if((d|0)==(c[1427]|0)){t=(c[1424]|0)+m|0;c[1424]=t;c[1427]=l;c[l+4>>2]=t|1;if((l|0)!=(s|0))return;c[1426]=0;c[1423]=0;return}if((d|0)==(s|0)){s=(c[1423]|0)+m|0;c[1423]=s;c[1426]=l;c[l+4>>2]=s|1;c[l+s>>2]=s;return}s=(r&-8)+m|0;t=r>>>3;b:do if(r>>>0>=256){o=c[d+24>>2]|0;e=c[d+12>>2]|0;do if((e|0)==(d|0)){k=d+16|0;j=k+4|0;f=c[j>>2]|0;if(!f){n=c[k>>2]|0;if(!n){u=0;break}else{v=n;w=k}}else{v=f;w=j}while(1){j=v+20|0;f=c[j>>2]|0;if(f|0){v=f;w=j;continue}j=v+16|0;f=c[j>>2]|0;if(!f)break;else{v=f;w=j}}if(w>>>0>>0)ka();else{c[w>>2]=0;u=v;break}}else{j=c[d+8>>2]|0;if(j>>>0>>0)ka();f=j+12|0;if((c[f>>2]|0)!=(d|0))ka();k=e+8|0;if((c[k>>2]|0)==(d|0)){c[f>>2]=e;c[k>>2]=j;u=e;break}else ka()}while(0);if(o|0){e=c[d+28>>2]|0;h=5988+(e<<2)|0;do if((d|0)==(c[h>>2]|0)){c[h>>2]=u;if(!u){c[1422]=c[1422]&~(1<>>0>=(c[1425]|0)>>>0){c[o+16+(((c[o+16>>2]|0)!=(d|0)&1)<<2)>>2]=u;if(!u)break b;else break}else ka();while(0);e=c[1425]|0;if(u>>>0>>0)ka();c[u+24>>2]=o;h=d+16|0;g=c[h>>2]|0;do if(g|0)if(g>>>0>>0)ka();else{c[u+16>>2]=g;c[g+24>>2]=u;break}while(0);g=c[h+4>>2]|0;if(g|0)if(g>>>0<(c[1425]|0)>>>0)ka();else{c[u+20>>2]=g;c[g+24>>2]=u;break}}}else{g=c[d+8>>2]|0;e=c[d+12>>2]|0;o=5724+(t<<1<<2)|0;if((g|0)!=(o|0)){if(g>>>0>>0)ka();if((c[g+12>>2]|0)!=(d|0))ka()}if((e|0)==(g|0)){c[1421]=c[1421]&~(1<>>0>>0)ka();o=e+8|0;if((c[o>>2]|0)==(d|0))x=o;else ka()}else x=e+8|0;c[g+12>>2]=e;c[x>>2]=g}while(0);c[l+4>>2]=s|1;c[l+s>>2]=s;if((l|0)==(c[1426]|0)){c[1423]=s;return}else y=s}else{c[a>>2]=r&-2;c[l+4>>2]=m|1;c[l+m>>2]=m;y=m}m=y>>>3;if(y>>>0<256){r=5724+(m<<1<<2)|0;a=c[1421]|0;s=1<>2]|0;if(x>>>0<(c[1425]|0)>>>0)ka();else{z=m;A=x}}else{c[1421]=a|s;z=r+8|0;A=r}c[z>>2]=l;c[A+12>>2]=l;c[l+8>>2]=A;c[l+12>>2]=r;return}r=y>>>8;if(r)if(y>>>0>16777215)B=31;else{A=(r+1048320|0)>>>16&8;z=r<>>16&4;s=z<>>16&2;a=14-(r|A|z)+(s<>>15)|0;B=y>>>(a+7|0)&1|a<<1}else B=0;a=5988+(B<<2)|0;c[l+28>>2]=B;c[l+20>>2]=0;c[l+16>>2]=0;z=c[1422]|0;s=1<>2]=l;c[l+24>>2]=a;c[l+12>>2]=l;c[l+8>>2]=l;return}s=y<<((B|0)==31?0:25-(B>>>1)|0);B=c[a>>2]|0;while(1){if((c[B+4>>2]&-8|0)==(y|0)){C=121;break}D=B+16+(s>>>31<<2)|0;a=c[D>>2]|0;if(!a){C=118;break}else{s=s<<1;B=a}}if((C|0)==118){if(D>>>0<(c[1425]|0)>>>0)ka();c[D>>2]=l;c[l+24>>2]=B;c[l+12>>2]=l;c[l+8>>2]=l;return}else if((C|0)==121){C=B+8|0;D=c[C>>2]|0;s=c[1425]|0;if(!(D>>>0>=s>>>0&B>>>0>=s>>>0))ka();c[D+12>>2]=l;c[C>>2]=l;c[l+8>>2]=D;c[l+12>>2]=B;c[l+24>>2]=0;return}}function If(){}function Jf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>c;return a>>>c|(b&(1<>c-32|0}function Kf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (D=e,a-c>>>0|0)|0}function Lf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=a+c>>>0;return (D=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function Mf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;d=d&255;if((e|0)>=67){while(b&3){a[b>>0]=d;b=b+1|0}g=f&-4|0;h=g-64|0;i=d|d<<8|d<<16|d<<24;while((b|0)<=(h|0)){c[b>>2]=i;c[b+4>>2]=i;c[b+8>>2]=i;c[b+12>>2]=i;c[b+16>>2]=i;c[b+20>>2]=i;c[b+24>>2]=i;c[b+28>>2]=i;c[b+32>>2]=i;c[b+36>>2]=i;c[b+40>>2]=i;c[b+44>>2]=i;c[b+48>>2]=i;c[b+52>>2]=i;c[b+56>>2]=i;c[b+60>>2]=i;b=b+64|0}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return f-e|0}function Nf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>>c;return a>>>c|(b&(1<>>c-32|0}function Of(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b<>>32-c;return a<>0]|0;if((c|0)<8)return c|0;c=a[n+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[n+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[n+(b>>>24)>>0]|0)+24|0}function Qf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0;g=a;h=b;i=h;j=d;k=e;l=k;if(!i){m=(f|0)!=0;if(!l){if(m){c[f>>2]=(g>>>0)%(j>>>0);c[f+4>>2]=0}n=0;o=(g>>>0)/(j>>>0)>>>0;return (D=n,o)|0}else{if(!m){n=0;o=0;return (D=n,o)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;o=0;return (D=n,o)|0}}m=(l|0)==0;do if(j){if(!m){p=(V(l|0)|0)-(V(i|0)|0)|0;if(p>>>0<=31){q=p+1|0;r=31-p|0;s=p-31>>31;t=q;u=g>>>(q>>>0)&s|i<>>(q>>>0)&s;w=0;x=g<>2]=a|0;c[f+4>>2]=h|b&0;n=0;o=0;return (D=n,o)|0}r=j-1|0;if(r&j|0){s=(V(j|0)|0)+33-(V(i|0)|0)|0;q=64-s|0;p=32-s|0;y=p>>31;z=s-32|0;A=z>>31;t=s;u=p-1>>31&i>>>(z>>>0)|(i<>>(s>>>0))&A;v=A&i>>>(s>>>0);w=g<>>(z>>>0))&y|g<>31;break}if(f|0){c[f>>2]=r&g;c[f+4>>2]=0}if((j|0)==1){n=h|b&0;o=a|0|0;return (D=n,o)|0}else{r=Pf(j|0)|0;n=i>>>(r>>>0)|0;o=i<<32-r|g>>>(r>>>0)|0;return (D=n,o)|0}}else{if(m){if(f|0){c[f>>2]=(i>>>0)%(j>>>0);c[f+4>>2]=0}n=0;o=(i>>>0)/(j>>>0)>>>0;return (D=n,o)|0}if(!g){if(f|0){c[f>>2]=0;c[f+4>>2]=(i>>>0)%(l>>>0)}n=0;o=(i>>>0)/(l>>>0)>>>0;return (D=n,o)|0}r=l-1|0;if(!(r&l)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=r&i|b&0}n=0;o=i>>>((Pf(l|0)|0)>>>0);return (D=n,o)|0}r=(V(l|0)|0)-(V(i|0)|0)|0;if(r>>>0<=30){s=r+1|0;p=31-r|0;t=s;u=i<>>(s>>>0);v=i>>>(s>>>0);w=0;x=g<>2]=a|0;c[f+4>>2]=h|b&0;n=0;o=0;return (D=n,o)|0}while(0);if(!t){B=x;C=w;E=v;F=u;G=0;H=0}else{b=d|0|0;d=k|e&0;e=Lf(b|0,d|0,-1,-1)|0;k=D;h=x;x=w;w=v;v=u;u=t;t=0;do{a=h;h=x>>>31|h<<1;x=t|x<<1;g=v<<1|a>>>31|0;a=v>>>31|w<<1|0;Kf(e|0,k|0,g|0,a|0)|0;i=D;l=i>>31|((i|0)<0?-1:0)<<1;t=l&1;v=Kf(g|0,a|0,l&b|0,(((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1)&d|0)|0;w=D;u=u-1|0}while((u|0)!=0);B=h;C=x;E=w;F=v;G=0;H=t}t=C;C=0;if(f|0){c[f>>2]=F;c[f+4>>2]=E}n=(t|0)>>>31|(B|C)<<1|(C<<1|t>>>31)&0|G;o=(t<<1|0>>>31)&-2|H;return (D=n,o)|0}function Rf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;g=d>>31|((d|0)<0?-1:0)<<1;h=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;i=Kf(e^a|0,f^b|0,e|0,f|0)|0;b=D;a=g^e;e=h^f;return Kf((Qf(i,b,Kf(g^c|0,h^d|0,g|0,h|0)|0,D,0)|0)^a|0,D^e|0,a|0,e|0)|0}function Sf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Qf(a,b,c,d,0)|0}function Tf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=S(d,c)|0;f=a>>>16;a=(e>>>16)+(S(d,f)|0)|0;d=b>>>16;b=S(d,c)|0;return (D=(a>>>16)+(S(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function Uf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=Tf(e,a)|0;f=D;return (D=(S(b,a)|0)+(S(d,e)|0)+f|f&0,c|0|0)|0}function Vf(a){a=a|0;var b=0,d=0;a=a+15&-16|0;b=c[i>>2]|0;d=b+a|0;if((a|0)>0&(d|0)<(b|0)|(d|0)<0){_()|0;ja(12);return -1}c[i>>2]=d;if((d|0)>(Z()|0)?(Y()|0)==0:0){ja(12);c[i>>2]=b;return -1}return b|0}function Wf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((e|0)>=8192)return ma(b|0,d|0,e|0)|0;f=b|0;g=b+e|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}h=g&-4|0;e=h-64|0;while((b|0)<=(e|0)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];c[b+12>>2]=c[d+12>>2];c[b+16>>2]=c[d+16>>2];c[b+20>>2]=c[d+20>>2];c[b+24>>2]=c[d+24>>2];c[b+28>>2]=c[d+28>>2];c[b+32>>2]=c[d+32>>2];c[b+36>>2]=c[d+36>>2];c[b+40>>2]=c[d+40>>2];c[b+44>>2]=c[d+44>>2];c[b+48>>2]=c[d+48>>2];c[b+52>>2]=c[d+52>>2];c[b+56>>2]=c[d+56>>2];c[b+60>>2]=c[d+60>>2];b=b+64|0;d=d+64|0}while((b|0)<(h|0)){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0}}else{h=g-4|0;while((b|0)<(h|0)){a[b>>0]=a[d>>0]|0;a[b+1>>0]=a[d+1>>0]|0;a[b+2>>0]=a[d+2>>0]|0;a[b+3>>0]=a[d+3>>0]|0;b=b+4|0;d=d+4|0}}while((b|0)<(g|0)){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}return f|0}function Xf(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else Wf(b,c,d)|0;return b|0}function Yf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;g=f|0;Qf(a,b,d,e,g)|0;l=f;return (D=c[g+4>>2]|0,c[g>>2]|0)|0}function Zf(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function _f(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ta[a&7](b|0,c|0,d|0)|0}function $f(a,b){a=a|0;b=b|0;ua[a&1](b|0)}function ag(a,b){a=a|0;b=b|0;return va[a&15](b|0)|0}function bg(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return wa[a&15](b|0,c|0,d|0,e|0)|0}function cg(a,b,c){a=a|0;b=b|0;c=c|0;return xa[a&1](b|0,c|0)|0}function dg(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return ya[a&31](b|0,c|0,d|0,e|0,f|0)|0}function eg(a,b,c){a=a|0;b=b|0;c=c|0;W(0);return 0}function fg(a){a=a|0;W(1)}function gg(a){a=a|0;W(2);return 0}function hg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;W(3);return 0}function ig(a,b){a=a|0;b=b|0;W(4);return 0}function jg(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;W(5);return 0} + +// EMSCRIPTEN_END_FUNCS +var ta=[eg,ze,te,hd,Wd,Xd,se,eg];var ua=[fg,jc];var va=[gg,re,ac,dc,Hc,Jc,yc,xc,Yd,gg,gg,gg,gg,gg,gg,gg];var wa=[hg,Xa,_a,bb,hb,lb,pb,sb,Vd,hg,hg,hg,hg,hg,hg,hg];var xa=[ig,yb];var ya=[jg,Wa,Ya,Za,$a,ab,cb,db,eb,fb,gb,ib,jb,kb,mb,nb,ob,qb,rb,Bb,Eb,Fb,Gb,jg,jg,jg,jg,jg,jg,jg,jg,jg];return{_ogv_demuxer_receive_input:$d,stackSave:Aa,getTempRet0:Fa,___udivdi3:Sf,setThrew:Da,_bitshift64Lshr:Nf,_bitshift64Shl:Of,_ogv_demuxer_keypoint_offset:fe,_ogv_demuxer_process:ae,_bitshift64Ashr:Jf,_llvm_cttz_i32:Pf,_ogv_demuxer_destroy:be,_sbrk:Vf,_ogv_demuxer_media_duration:de,stackAlloc:za,___muldi3:Uf,___uremdi3:Yf,___divdi3:Rf,_i64Subtract:Kf,___udivmoddi4:Qf,setTempRet0:Ea,_i64Add:Lf,_ogv_demuxer_seekable:ee,_ogv_demuxer_media_length:ce,_free:Df,stackRestore:Ba,_llvm_bswap_i32:Zf,___muldsi3:Tf,_ogv_demuxer_seek_to_keypoint:ge,runPostSets:If,establishStackSpace:Ca,_ogv_demuxer_flush:he,_ogv_demuxer_init:Ud,_emscripten_get_global_libc:qe,_malloc:Cf,_memcpy:Wf,_memmove:Xf,_memset:Mf,stackAlloc:za,stackSave:Aa,stackRestore:Ba,establishStackSpace:Ca,setThrew:Da,setTempRet0:Ea,getTempRet0:Fa,dynCall_iiii:_f,dynCall_vi:$f,dynCall_ii:ag,dynCall_iiiii:bg,dynCall_iii:cg,dynCall_iiiiii:dg}}) + + +// EMSCRIPTEN_END_ASM +(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var _ogv_demuxer_receive_input=Module["_ogv_demuxer_receive_input"]=asm["_ogv_demuxer_receive_input"];var stackSave=Module["stackSave"]=asm["stackSave"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var setThrew=Module["setThrew"]=asm["setThrew"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _ogv_demuxer_keypoint_offset=Module["_ogv_demuxer_keypoint_offset"]=asm["_ogv_demuxer_keypoint_offset"];var _ogv_demuxer_process=Module["_ogv_demuxer_process"]=asm["_ogv_demuxer_process"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _llvm_cttz_i32=Module["_llvm_cttz_i32"]=asm["_llvm_cttz_i32"];var _ogv_demuxer_destroy=Module["_ogv_demuxer_destroy"]=asm["_ogv_demuxer_destroy"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _ogv_demuxer_media_duration=Module["_ogv_demuxer_media_duration"]=asm["_ogv_demuxer_media_duration"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var ___udivmoddi4=Module["___udivmoddi4"]=asm["___udivmoddi4"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _ogv_demuxer_seekable=Module["_ogv_demuxer_seekable"]=asm["_ogv_demuxer_seekable"];var _ogv_demuxer_media_length=Module["_ogv_demuxer_media_length"]=asm["_ogv_demuxer_media_length"];var _free=Module["_free"]=asm["_free"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var ___muldsi3=Module["___muldsi3"]=asm["___muldsi3"];var _ogv_demuxer_seek_to_keypoint=Module["_ogv_demuxer_seek_to_keypoint"]=asm["_ogv_demuxer_seek_to_keypoint"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var _ogv_demuxer_flush=Module["_ogv_demuxer_flush"]=asm["_ogv_demuxer_flush"];var _ogv_demuxer_init=Module["_ogv_demuxer_init"]=asm["_ogv_demuxer_init"];var _emscripten_get_global_libc=Module["_emscripten_get_global_libc"]=asm["_emscripten_get_global_libc"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memmove=Module["_memmove"]=asm["_memmove"];var _memset=Module["_memset"]=asm["_memset"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];Runtime.stackAlloc=Module["stackAlloc"];Runtime.stackSave=Module["stackSave"];Runtime.stackRestore=Module["stackRestore"];Runtime.establishStackSpace=Module["establishStackSpace"];Runtime.setTempRet0=Module["setTempRet0"];Runtime.getTempRet0=Module["getTempRet0"];Module["asm"]=asm;Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=false;if(Module["noInitialRun"]){shouldRunNow=false}Module["noExitRuntime"]=true;run();var inputBuffer,inputBufferSize;function reallocInputBuffer(size){if(inputBuffer&&inputBufferSize>=size){return inputBuffer}if(inputBuffer){Module._free(inputBuffer)}inputBufferSize=size;inputBuffer=Module._malloc(inputBufferSize);return inputBuffer}var getTimestamp;if(typeof performance==="undefined"||typeof performance.now==="undefined"){getTimestamp=Date.now}else{getTimestamp=performance.now.bind(performance)}function time(func){var start=getTimestamp(),ret;ret=func();var delta=getTimestamp()-start;Module.cpuTime+=delta;return ret}Module.loadedMetadata=false;Module.videoCodec=null;Module.audioCodec=null;Module.duration=NaN;Module.onseek=null;Module.cpuTime=0;Module.audioPackets=[];Object.defineProperty(Module,"hasAudio",{get:(function(){return Module.loadedMetadata&&Module.audioCodec})});Object.defineProperty(Module,"audioReady",{get:(function(){return Module.audioPackets.length>0})});Object.defineProperty(Module,"audioTimestamp",{get:(function(){if(Module.audioPackets.length>0){return Module.audioPackets[0].timestamp}else{return-1}})});Module.videoPackets=[];Object.defineProperty(Module,"hasVideo",{get:(function(){return Module.loadedMetadata&&Module.videoCodec})});Object.defineProperty(Module,"frameReady",{get:(function(){return Module.videoPackets.length>0})});Object.defineProperty(Module,"frameTimestamp",{get:(function(){if(Module.videoPackets.length>0){return Module.videoPackets[0].timestamp}else{return-1}})});Object.defineProperty(Module,"keyframeTimestamp",{get:(function(){if(Module.videoPackets.length>0){return Module.videoPackets[0].keyframeTimestamp}else{return-1}})});Object.defineProperty(Module,"nextKeyframeTimestamp",{get:(function(){for(var i=0;i + * @copyright 2015 + * @license MIT-style + */ + function OGVProxyClass(initialProps, methods) { + return function(worker, className, options) { + options = options || {}; + var self = this; + + var transferables = (function() { + var buffer = new ArrayBuffer(1024), + bytes = new Uint8Array(buffer); + try { + worker.postMessage({ + action: 'transferTest', + bytes: bytes + }, [buffer]); + if (buffer.byteLength) { + // No transferable support + return false; + } else { + return true; + } + } catch (e) { + return false; + } + })(); + + // Set up proxied property getters + var props = {}; + for (var iPropName in initialProps) { + if (initialProps.hasOwnProperty(iPropName)) { + (function(propName) { + props[propName] = initialProps[propName]; + Object.defineProperty(self, propName, { + get: function getProperty() { + return props[propName]; + } + }); + })(iPropName); + } + } + + // Current player wants to avoid async confusion. + var processingQueue = 0; + Object.defineProperty(self, 'processing', { + get: function() { + return (processingQueue > 0); + } + }); + + // Set up proxied methods + for (var method in methods) { + if (methods.hasOwnProperty(method)) { + self[method] = methods[method]; + } + } + + // And some infrastructure! + var messageCount = 0, + pendingCallbacks = {}; + this.proxy = function(action, args, callback, transfers) { + if (!worker) { + throw 'Tried to call "' + action + '" method on closed proxy object'; + } + var callbackId = 'callback-' + (++messageCount) + '-' + action; + if (callback) { + pendingCallbacks[callbackId] = callback; + } + var out = { + 'action': action, + 'callbackId': callbackId, + 'args': args || [] + }; + processingQueue++; + if (transferables) { + worker.postMessage(out, transfers || []); + } else { + worker.postMessage(out); + } + }; + this.terminate = function() { + if (worker) { + worker.terminate(); + worker = null; + processingQueue = 0; + pendingCallbacks = {}; + } + }; + + worker.addEventListener('message', function proxyOnMessage(event) { + processingQueue--; + if (event.data.action !== 'callback') { + // ignore + return; + } + + var data = event.data, + callbackId = data.callbackId, + args = data.args, + callback = pendingCallbacks[callbackId]; + + // Save any updated properties returned to us... + if (data.props) { + for (var propName in data.props) { + if (data.props.hasOwnProperty(propName)) { + props[propName] = data.props[propName]; + } + } + } + + if (callback) { + delete pendingCallbacks[callbackId]; + callback.apply(this, args); + } + }); + + // Tell the proxy to load and initialize the appropriate class + self.proxy('construct', [className, options], function() {}); + + return self; + }; + } + + module.exports = OGVProxyClass; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + var OGVProxyClass = __webpack_require__(5); + + var OGVDecoderVideoProxy = OGVProxyClass({ + loadedMetadata: false, + videoFormat: null, + frameBuffer: null, + cpuTime: 0 + }, { + init: function(callback) { + this.proxy('init', [], callback); + }, + + processHeader: function(data, callback) { + this.proxy('processHeader', [data], callback, [data]); + }, + + processFrame: function(data, callback) { + this.proxy('processFrame', [data], callback, [data]); + }, + + close: function() { + this.terminate(); + } + }); + + module.exports = OGVDecoderVideoProxy; + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/data/promote.telegram.org/js/ogvjs/ogv.js b/data/promote.telegram.org/js/ogvjs/ogv.js new file mode 100644 index 0000000000..d6a784946b --- /dev/null +++ b/data/promote.telegram.org/js/ogvjs/ogv.js @@ -0,0 +1,9663 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["ogvjs"] = factory(); + else + root["ogvjs"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + // + // -- ogv.js + // https://github.com/brion/ogv.js + // Copyright (c) 2013-2016 Brion Vibber + // + + var OGVCompat = __webpack_require__(1), + OGVLoader = __webpack_require__(3), + OGVMediaType = __webpack_require__(7), + OGVPlayer = __webpack_require__(8), + OGVVersion = ("1.4.2-20170425024925-504d7197"); + + // Version 1.0's web-facing and test-facing interfaces + if (window) { + window.OGVCompat = OGVCompat; + window.OGVLoader = OGVLoader; + window.OGVMediaType = OGVMediaType; + window.OGVPlayer = OGVPlayer; + window.OGVVersion = OGVVersion; + } + + module.exports = { + OGVCompat: OGVCompat, + OGVLoader: OGVLoader, + OGVMediaType: OGVMediaType, + OGVPlayer: OGVPlayer, + OGVVersion: OGVVersion + }; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + var BogoSlow = __webpack_require__(2); + + var OGVCompat = { + benchmark: new BogoSlow(), + + hasTypedArrays: function() { + // emscripten-compiled code requires typed arrays + return !!window.Uint32Array; + }, + + hasWebAudio: function() { + return !!(window.AudioContext || window.webkitAudioContext); + }, + + hasFlash: function() { + if (navigator.userAgent.indexOf('Trident') !== -1) { + // We only do the ActiveX test because we only need Flash in + // Internet Explorer 10/11. Other browsers use Web Audio directly + // (Edge, Safari) or native playback, so there's no need to test + // other ways of loading Flash. + try { + var obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + return true; + } catch(e) { + return false; + } + } + return false; + }, + + hasAudio: function() { + return this.hasWebAudio() || this.hasFlash(); + }, + + isBlacklisted: function(userAgent) { + // JIT bugs in old Safari versions + var blacklist = [ + /\(i.* OS [67]_.* like Mac OS X\).* Mobile\/.* Safari\//, + /\(Macintosh.* Version\/6\..* Safari\/\d/ + ]; + var blacklisted = false; + blacklist.forEach(function(regex) { + if (userAgent.match(regex)) { + blacklisted = true; + } + }); + return blacklisted; + }, + + isSlow: function() { + return this.benchmark.slow; + }, + + isTooSlow: function() { + return this.benchmark.tooSlow; + }, + + supported: function(component) { + if (component === 'OGVDecoder') { + return (this.hasTypedArrays() && !this.isBlacklisted(navigator.userAgent)); + } + if (component === 'OGVPlayer') { + return (this.supported('OGVDecoder') && this.hasAudio() && !this.isTooSlow()); + } + return false; + } + }; + + module.exports = OGVCompat; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + /** + * A quick CPU/JS engine benchmark to guesstimate whether we're + * fast enough to handle 360p video in JavaScript. + */ + function BogoSlow() { + var self = this; + + var timer; + // FIXME: avoid to use window scope here + if (window.performance && window.performance.now) { + timer = function() { + return window.performance.now(); + }; + } else { + timer = function() { + return Date.now(); + }; + } + + var savedSpeed = null; + function run() { + var ops = 0; + var fibonacci = function(n) { + ops++; + if (n < 2) { + return n; + } else { + return fibonacci(n - 2) + fibonacci(n - 1); + } + }; + + var start = timer(); + + fibonacci(30); + + var delta = timer() - start; + savedSpeed = (ops / delta); + } + + /** + * Return a scale value of operations/sec from the benchmark. + * If the benchmark has already been run, uses a memoized result. + * + * @property {number} + */ + Object.defineProperty(self, 'speed', { + get: function() { + if (savedSpeed === null) { + run(); + } + return savedSpeed; + } + }); + + /** + * Return the defined cutoff speed value for 'slow' devices, + * based on results measured from some test devices. + * + * @property {number} + */ + Object.defineProperty(self, 'slowCutoff', { + get: function() { + // 2012 Retina MacBook Pro (Safari 7) ~150,000 + // 2009 Dell T5500 (IE 11) ~100,000 + // iPad Air (iOS 7) ~65,000 + // 2010 MBP / OS X 10.9 (Safari 7) ~62,500 + // 2010 MBP / Win7 VM (IE 11) ~50,000+- + // ^ these play 360p ok + // ----------- line of moderate doom ---------- + return 50000; + // v these play 160p ok + // iPad Mini non-Retina (iOS 8 beta) ~25,000 + // Dell Inspiron Duo (IE 11) ~25,000 + // Surface RT (IE 11) ~18,000 + // iPod Touch 5th-gen (iOS 8 beta) ~16,000 + } + }); + + /** + * Return the defined cutoff speed value for 'too slow' devices, + * based on results measured from some test devices. + * + * No longer used. + * + * @property {number} + * @deprecated + */ + Object.defineProperty(self, 'tooSlowCutoff', { + get: function() { + return 0; + } + }); + + /** + * 'Slow' devices can play audio and should sorta play our + * extra-tiny Wikimedia 160p15 transcodes + * + * @property {boolean} + */ + Object.defineProperty(self, 'slow', { + get: function() { + return (self.speed < self.slowCutoff); + } + }); + + /** + * 'Too slow' devices aren't reliable at all + * + * @property {boolean} + */ + Object.defineProperty(self, 'tooSlow', { + get: function() { + return (self.speed < self.tooSlowCutoff); + } + }); + } + + module.exports = BogoSlow; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + + var OGVVersion = ("1.4.2-20170425024925-504d7197"); + + (function() { + var global = this; + + var scriptMap = { + OGVDemuxerOgg: 'ogv-demuxer-ogg.js', + OGVDemuxerOggW: 'ogv-demuxer-ogg-wasm.js', + OGVDemuxerWebM: 'ogv-demuxer-webm.js', + OGVDemuxerWebMW: 'ogv-demuxer-webm-wasm.js', + OGVDecoderAudioOpus: 'ogv-decoder-audio-opus.js', + OGVDecoderAudioOpusW: 'ogv-decoder-audio-opus-wasm.js', + OGVDecoderAudioVorbis: 'ogv-decoder-audio-vorbis.js', + OGVDecoderAudioVorbisW: 'ogv-decoder-audio-vorbis-wasm.js', + OGVDecoderVideoTheora: 'ogv-decoder-video-theora.js', + OGVDecoderVideoTheoraW: 'ogv-decoder-video-theora-wasm.js', + OGVDecoderVideoVP8: 'ogv-decoder-video-vp8.js', + OGVDecoderVideoVP8W: 'ogv-decoder-video-vp8-wasm.js', + OGVDecoderVideoVP8MT: 'ogv-decoder-video-vp8-mt.js', + OGVDecoderVideoVP9: 'ogv-decoder-video-vp9.js', + OGVDecoderVideoVP9W: 'ogv-decoder-video-vp9-wasm.js', + OGVDecoderVideoVP9MT: 'ogv-decoder-video-vp9-mt.js' + }; + + // @fixme make this less awful + var proxyTypes = { + OGVDecoderAudioOpus: 'audio', + OGVDecoderAudioOpusW: 'audio', + OGVDecoderAudioVorbis: 'audio', + OGVDecoderAudioVorbisW: 'audio', + OGVDecoderVideoTheora: 'video', + OGVDecoderVideoTheoraW: 'video', + OGVDecoderVideoVP8: 'video', + OGVDecoderVideoVP8W: 'video', + OGVDecoderVideoVP9: 'video', + OGVDecoderVideoVP9W: 'video' + }; + var proxyInfo = { + audio: { + proxy: __webpack_require__(4), + worker: 'ogv-worker-audio.js', + }, + video: { + proxy: __webpack_require__(6), + worker: 'ogv-worker-video.js' + } + } + + function urlForClass(className) { + var scriptName = scriptMap[className]; + if (scriptName) { + return urlForScript(scriptName); + } else { + throw new Error('asked for URL for unknown class ' + className); + } + }; + + function urlForScript(scriptName) { + if (scriptName) { + var base = OGVLoader.base; + if (base === undefined) { + base = ''; + } else { + base += '/'; + } + return base + scriptName + '?version=' + encodeURIComponent(OGVVersion); + } else { + throw new Error('asked for URL for unknown script ' + scriptName); + } + }; + + var scriptStatus = {}, + scriptCallbacks = {}; + function loadWebScript(src, callback) { + if (scriptStatus[src] == 'done') { + callback(); + } else if (scriptStatus[src] == 'loading') { + scriptCallbacks[src].push(callback); + } else { + scriptStatus[src] = 'loading'; + scriptCallbacks[src] = [callback]; + + var scriptNode = document.createElement('script'); + function done(event) { + var callbacks = scriptCallbacks[src]; + delete scriptCallbacks[src]; + scriptStatus[src] = 'done'; + + callbacks.forEach(function(cb) { + cb(); + }); + } + scriptNode.addEventListener('load', done); + scriptNode.addEventListener('error', done); + scriptNode.src = src; + document.querySelector('head').appendChild(scriptNode); + } + } + + function loadWebAssembly(src, callback) { + if (!src.match(/-wasm\.js/)) { + callback(null); + } else { + var wasmSrc = src.replace(/-wasm\.js/, '-wasm.wasm'); + var xhr = new XMLHttpRequest(); + xhr.responseType = 'arraybuffer'; + xhr.onload = function() { + callback(xhr.response); + }; + xhr.onerror = function() { + callback(null); + }; + xhr.open('GET', wasmSrc); + xhr.send(); + } + } + + function defaultBase() { + if (typeof global.window === 'object') { + + // for browser, try to autodetect + var scriptNodes = document.querySelectorAll('script'), + regex = /^(?:|(.*)\/)ogv(?:-support)?\.js(?:\?|#|$)/, + path, + matches; + for (var i = 0; i < scriptNodes.length; i++) { + path = scriptNodes[i].getAttribute('src'); + if (path) { + matches = path.match(regex); + if (matches) { + return matches[1]; + } + } + } + + return undefined; // current dir + + } else { + + // for workers, assume current directory + // if not a worker, too bad. + return undefined; + + } + } + + var OGVLoader = { + base: defaultBase(), + + loadClass: function(className, callback, options) { + options = options || {}; + if (options.worker) { + this.workerProxy(className, callback); + return; + } + var url = urlForClass(className); + loadWebAssembly(url, function(wasmBinary) { + function wasmClassWrapper(options) { + options = options || {}; + if (wasmBinary !== null) { + options.wasmBinary = wasmBinary; + } + return new global[className](options); + } + if (typeof global[className] === 'function') { + // already loaded! + callback(wasmClassWrapper); + } else if (typeof global.window === 'object') { + loadWebScript(url, function() { + callback(wasmClassWrapper); + }); + } else if (typeof global.importScripts === 'function') { + // worker has convenient sync importScripts + global.importScripts(url); + callback(wasmClassWrapper); + } + }); + }, + + workerProxy: function(className, callback) { + var proxyType = proxyTypes[className], + info = proxyInfo[proxyType]; + + if (!info) { + throw new Error('Requested worker for class with no proxy: ' + className); + } + + var proxyClass = info.proxy, + workerScript = info.worker, + codecUrl = urlForScript(scriptMap[className]), + workerUrl = urlForScript(workerScript), + worker; + + var construct = function(options) { + return new proxyClass(worker, className, options); + }; + + if (workerUrl.match(/^https?:|\/\//i)) { + // Can't load workers natively cross-domain, but if CORS + // is set up we can fetch the worker stub and the desired + // class and load them from a blob. + var getCodec, + getWorker, + codecResponse, + workerResponse, + codecLoaded = false, + workerLoaded = false, + blob; + + function completionCheck() { + if ((codecLoaded == true) && (workerLoaded == true)) { + try { + blob = new Blob([codecResponse + " " + workerResponse], {type: 'application/javascript'}); + } catch (e) { // Backwards-compatibility + window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder; + blob = new BlobBuilder(); + blob.append(codecResponse + " " + workerResponse); + blob = blob.getBlob(); + } + // Create the web worker + worker = new Worker(URL.createObjectURL(blob)); + callback(construct); + } + } + + // Load the codec + getCodec = new XMLHttpRequest(); + getCodec.open("GET", codecUrl, true); + getCodec.onreadystatechange = function() { + if(getCodec.readyState == 4 && getCodec.status == 200) { + codecResponse = getCodec.responseText; + // Update the codec response loaded flag + codecLoaded = true; + completionCheck(); + } + }; + getCodec.send(); + + // Load the worker + getWorker = new XMLHttpRequest(); + getWorker.open("GET", workerUrl, true); + getWorker.onreadystatechange = function() { + if(getWorker.readyState == 4 && getWorker.status == 200) { + workerResponse = getWorker.responseText; + // Update the worker response loaded flag + workerLoaded = true; + completionCheck(); + } + }; + getWorker.send(); + } else { + // Local URL; load it directly for simplicity. + worker = new Worker(workerUrl); + callback(construct); + } + } + }; + + module.exports = OGVLoader; + + })(); + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + + var OGVProxyClass = __webpack_require__(5); + + var OGVDecoderAudioProxy = OGVProxyClass({ + loadedMetadata: false, + audioFormat: null, + audioBuffer: null, + cpuTime: 0 + }, { + init: function(callback) { + this.proxy('init', [], callback); + }, + + processHeader: function(data, callback) { + this.proxy('processHeader', [data], callback, [data]); + }, + + processAudio: function(data, callback) { + this.proxy('processAudio', [data], callback, [data]); + }, + + close: function() { + this.terminate(); + } + }); + + module.exports = OGVDecoderAudioProxy; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + + /** + * Proxy object for web worker interface for codec classes. + * + * Used by the high-level player interface. + * + * @author Brion Vibber + * @copyright 2015 + * @license MIT-style + */ + function OGVProxyClass(initialProps, methods) { + return function(worker, className, options) { + options = options || {}; + var self = this; + + var transferables = (function() { + var buffer = new ArrayBuffer(1024), + bytes = new Uint8Array(buffer); + try { + worker.postMessage({ + action: 'transferTest', + bytes: bytes + }, [buffer]); + if (buffer.byteLength) { + // No transferable support + return false; + } else { + return true; + } + } catch (e) { + return false; + } + })(); + + // Set up proxied property getters + var props = {}; + for (var iPropName in initialProps) { + if (initialProps.hasOwnProperty(iPropName)) { + (function(propName) { + props[propName] = initialProps[propName]; + Object.defineProperty(self, propName, { + get: function getProperty() { + return props[propName]; + } + }); + })(iPropName); + } + } + + // Current player wants to avoid async confusion. + var processingQueue = 0; + Object.defineProperty(self, 'processing', { + get: function() { + return (processingQueue > 0); + } + }); + + // Set up proxied methods + for (var method in methods) { + if (methods.hasOwnProperty(method)) { + self[method] = methods[method]; + } + } + + // And some infrastructure! + var messageCount = 0, + pendingCallbacks = {}; + this.proxy = function(action, args, callback, transfers) { + if (!worker) { + throw 'Tried to call "' + action + '" method on closed proxy object'; + } + var callbackId = 'callback-' + (++messageCount) + '-' + action; + if (callback) { + pendingCallbacks[callbackId] = callback; + } + var out = { + 'action': action, + 'callbackId': callbackId, + 'args': args || [] + }; + processingQueue++; + if (transferables) { + worker.postMessage(out, transfers || []); + } else { + worker.postMessage(out); + } + }; + this.terminate = function() { + if (worker) { + worker.terminate(); + worker = null; + processingQueue = 0; + pendingCallbacks = {}; + } + }; + + worker.addEventListener('message', function proxyOnMessage(event) { + processingQueue--; + if (event.data.action !== 'callback') { + // ignore + return; + } + + var data = event.data, + callbackId = data.callbackId, + args = data.args, + callback = pendingCallbacks[callbackId]; + + // Save any updated properties returned to us... + if (data.props) { + for (var propName in data.props) { + if (data.props.hasOwnProperty(propName)) { + props[propName] = data.props[propName]; + } + } + } + + if (callback) { + delete pendingCallbacks[callbackId]; + callback.apply(this, args); + } + }); + + // Tell the proxy to load and initialize the appropriate class + self.proxy('construct', [className, options], function() {}); + + return self; + }; + } + + module.exports = OGVProxyClass; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + var OGVProxyClass = __webpack_require__(5); + + var OGVDecoderVideoProxy = OGVProxyClass({ + loadedMetadata: false, + videoFormat: null, + frameBuffer: null, + cpuTime: 0 + }, { + init: function(callback) { + this.proxy('init', [], callback); + }, + + processHeader: function(data, callback) { + this.proxy('processHeader', [data], callback, [data]); + }, + + processFrame: function(data, callback) { + this.proxy('processFrame', [data], callback, [data]); + }, + + close: function() { + this.terminate(); + } + }); + + module.exports = OGVDecoderVideoProxy; + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + + function OGVMediaType(contentType) { + contentType = '' + contentType; + + var self = this; + self.major = null; + self.minor = null; + self.codecs = null; + + function trim(str) { + return str.replace(/^\s+/, '').replace(/\s+$/, ''); + } + + function split(str, sep, limit) { + var bits = str.split(sep, limit).map(function(substr) { + return trim(substr); + }); + if (typeof limit === 'number') { + while (bits.length < limit) { + bits.push(null); + } + } + return bits; + } + + var parts = split(contentType, ';'); + if (parts.length) { + var base = parts.shift(); + if (base) { + var bits = split(base, '/', 2); + self.major = bits[0]; + self.minor = bits[1]; + } + + parts.forEach(function(str) { + var matches = str.match(/^codecs\s*=\s*"(.*?)"$/); + if (matches) { + self.codecs = split(matches[1], ','); + } + }); + } + } + + module.exports = OGVMediaType; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(9).polyfill(); + + var YUVCanvas = __webpack_require__(12); + + // -- OGVLoader.js + var OGVLoader = __webpack_require__(3); + + // -- StreamFile.js + var StreamFile = __webpack_require__(19); + + // -- AudioFeeder.js + var AudioFeeder = __webpack_require__(30), + dynamicaudio_swf = __webpack_require__(31); + + // -- Bisector.js + var Bisector = __webpack_require__(32); + + // -- OGVMediaType.js + var OGVMediaType = __webpack_require__(7); + + // -- OGVWrapperCodec.js + var OGVWrapperCodec = __webpack_require__(33); + + // -- OGVDecoderAudioProxy.js + var OGVDecoderAudioProxy = __webpack_require__(4); + + // -- OGVDecoderVideoProxy.js + var OGVDecoderVideoProxy = __webpack_require__(6); + + /** + * Constructor for an analogue of the TimeRanges class + * returned by various HTMLMediaElement properties + * + * Pass an array of two-element arrays, each containing a start and end time. + */ + // FIXME: not use window scope if possible here + var OGVTimeRanges = window.OGVTimeRanges = function(ranges) { + Object.defineProperty(this, 'length', { + get: function getLength() { + return ranges.length; + } + }); + this.start = function(i) { + return ranges[i][0]; + }; + this.end = function(i) { + return ranges[i][1]; + }; + return this; + }; + + var OGVMediaErrorConstants = { + MEDIA_ERR_ABORTED: 1, + MEDIA_ERR_NETWORK: 2, + MEDIA_ERR_DECODE: 3, + MEDIA_ERR_SRC_NOT_SUPPORTED: 4 + }; + function extend(dest, src) { + for (prop in src) { + if (src.hasOwnProperty(prop)) { + dest[prop] = src[prop]; + } + } + } + + /** + * Constructor for analogue of the MediaError class + * returned by HTMLMediaElement.error property + */ + var OGVMediaError = window.OGVMediaError = function(code, message) { + this.code = code; + this.message = message; + }; + extend(OGVMediaError, OGVMediaErrorConstants); + extend(OGVMediaError.prototype, OGVMediaErrorConstants); + + /** + * Player class -- instantiate one of these to get an 'ogvjs' HTML element + * which has a similar interface to the HTML audio/video elements. + * + * @param options: optional dictionary of options: + * 'base': string; base URL for additional resources, such as Flash audio shim + * 'webGL': bool; pass true to use WebGL acceleration if available + * 'forceWebGL': bool; pass true to require WebGL even if not detected + * 'sync': string; A/V sync plan: one of: + * 'delay-audio' (pre-1.3.2 behavior) stop audio when behind, then play all frames to catch up + * 'skip-frames' (default) to preserve audio, skipping frames until the next sync point (keyframe) + */ + var OGVPlayer = function(options) { + options = options || {}; + + var instanceId = 'ogvjs' + (++OGVPlayer.instanceCount); + + var codecClass = null, + codecType = null; + + var canvasOptions = {}; + if (options.webGL !== undefined) { + // @fixme confirm format of webGL option + canvasOptions.webGL = options.webGL; + } + if(!!options.forceWebGL) { + canvasOptions.webGL = 'required'; + } + + // Experimental options + var enableWebM = !!options.enableWebM; + + // Running the codec in a worker thread equals happy times! + var enableWorker = !!window.Worker; + if (typeof options.worker !== 'undefined') { + enableWorker = !!options.worker; + } + var enableThreading = !!options.threading; + var enableWASM = !!options.wasm; + + if (options.sync === undefined) { + options.sync = 'skip-frames'; + } + + var State = { + INITIAL: 'INITIAL', + SEEKING_END: 'SEEKING_END', + LOADED: 'LOADED', + PRELOAD: 'PRELOAD', + READY: 'READY', + PLAYING: 'PLAYING', + SEEKING: 'SEEKING', + ENDED: 'ENDED', + ERROR: 'ERROR' + }, state = State.INITIAL; + + var SeekState = { + NOT_SEEKING: 'NOT_SEEKING', + BISECT_TO_TARGET: 'BISECT_TO_TARGET', + BISECT_TO_KEYPOINT: 'BISECT_TO_KEYPOINT', + LINEAR_TO_TARGET: 'LINEAR_TO_TARGET' + }, seekState = SeekState.NOT_SEEKING; + + var audioOptions = {}, + codecOptions = {}; + options.base = options.base || OGVLoader.base; + if (typeof options.base === 'string') { + // Pass the resource dir down to AudioFeeder, so it can load the dynamicaudio.swf + audioOptions.base = options.base; + + // And to the worker thread, so it can load the codec JS + codecOptions.base = options.base; + } + if (typeof options.audioContext !== 'undefined') { + // Try passing a pre-created audioContext in? + audioOptions.audioContext = options.audioContext; + } + if (typeof options.audioDestination !== 'undefined') { + // Try passing a pre-created audioContext in? + audioOptions.output = options.audioDestination; + } + // Buffer in largeish chunks to survive long CPU spikes on slow CPUs (eg, 32-bit iOS) + audioOptions.bufferSize = 8192; + + codecOptions.worker = enableWorker; + codecOptions.threading = enableThreading; + codecOptions.wasm = enableWASM; + if (typeof options.memoryLimit === 'number') { + codecOptions.memoryLimit = options.memoryLimit; + } + + var canvas = document.createElement('canvas'); + var frameSink; + + // Return a magical custom element! + var self = document.createElement('ogvjs'); + self.className = instanceId; + + extend(self, constants); + + canvas.style.position = 'absolute'; + canvas.style.top = '0'; + canvas.style.left = '0'; + canvas.style.width = '100%'; + canvas.style.height = '100%'; + canvas.style.objectFit = 'contain'; + self.appendChild(canvas); + + var getTimestamp; + // FIXME: don't use window scope, see BogoSlow.js + if (window.performance === undefined || window.performance.now === undefined) { + getTimestamp = Date.now; + } else { + getTimestamp = window.performance.now.bind(window.performance); + } + function time(cb) { + var start = getTimestamp(); + cb(); + var delta = getTimestamp() - start; + lastFrameDecodeTime += delta; + return delta; + } + + var then = getTimestamp(); + function log(msg) { + if (options.debug) { + var now = getTimestamp(), + delta = now - then; + + //console.log('+' + delta + 'ms ' + msg); + //then = now; + + if (!options.debugFilter || msg.match(options.debugFilter)) { + console.log('[' + (Math.round(delta * 10) / 10) + 'ms] ' + msg); + } + } + } + + function fireEvent(eventName, props) { + log('fireEvent ' + eventName); + var event; + props = props || {}; + + var standard = (typeof window.Event == 'function'); + if (standard) { + // standard event creation + event = new CustomEvent(eventName); + } else { + // IE back-compat mode + // https://msdn.microsoft.com/en-us/library/dn905219%28v=vs.85%29.aspx + event = document.createEvent('Event'); + event.initEvent(eventName, false, false); + } + + for (var prop in props) { + if (props.hasOwnProperty(prop)) { + event[prop] = props[prop]; + } + } + + var allowDefault = self.dispatchEvent(event); + if (!standard && eventName === 'resize' && self.onresize && allowDefault) { + // resize demands special treatment! + // in IE 11 it doesn't fire through to the .onresize handler + // for some crazy reason + self.onresize.call(self, event); + } + } + function fireEventAsync(eventName, props) { + log('fireEventAsync ' + eventName); + setTimeout(function() { + fireEvent(eventName, props); + }, 0); + } + + var codec = null, + videoInfo = null, + audioInfo = null, + actionQueue = [], + audioFeeder = null; + var muted = false, + initialPlaybackPosition = 0.0, + initialPlaybackOffset = 0.0, + prebufferingAudio = false, + stoppedForLateFrame = false, + initialSeekTime = 0.0; + function initAudioFeeder() { + audioFeeder = new AudioFeeder( audioOptions ); + audioFeeder.init(audioInfo.channels, audioInfo.rate); + + // At our requested 8192 buffer size, bufferDuration should be + // about 185ms at 44.1 kHz or 170ms at 48 kHz output, covering + // 4-6 frames at 24-30fps. + // + // 2 or 3 buffers' worth will be in flight at any given time; + // be warned that durationBuffered includes that in-flight stuff. + // + // Set our bufferThreshold to a full 1s for plenty of extra headroom, + // and make sure we've queued up twice that when we're operating. + audioFeeder.bufferThreshold = 1; + + audioFeeder.volume = self.volume; + audioFeeder.muted = self.muted; + + // If we're in a background tab, timers may be throttled. + // audioFeeder will call us when buffers need refilling, + // without any throttling. + audioFeeder.onbufferlow = function audioCallback() { + log('onbufferlow'); + if ((stream && (stream.buffering || stream.seeking)) || pendingAudio) { + // We're waiting on input or other async processing; + // we'll get triggered later. + } else { + // We're in an async event so it's safe to run the loop: + pingProcessing(); + } + }; + + // If we ran out of audio *completely* schedule some more processing. + // This shouldn't happen if we keep up with onbufferlow, except at + // the very beginning of playback when we haven't buffered any data yet. + // @todo pre-buffer a little data to avoid needing this + audioFeeder.onstarved = function () { + if (dataEnded) { + // Probably end of file. + // Do nothing! + log('onstarved: appear to have reached end of audio'); + } else { + log('onstarved: halting audio due to starvation'); + stopPlayback(); + prebufferingAudio = true; + } + if (isProcessing()) { + // We're waiting on input or other async processing; + // we'll get triggered later. + } else { + // Schedule loop after this synchronous event. + pingProcessing(0); + } + }; + } + + function startPlayback(offset) { + if (audioFeeder) { + audioFeeder.start(); + var state = audioFeeder.getPlaybackState(); + initialPlaybackPosition = state.playbackPosition; + } else { + initialPlaybackPosition = getTimestamp() / 1000; + } + if (offset !== undefined) { + initialPlaybackOffset = offset; + } + // Clear the late flag if it was set. + prebufferingAudio = false; + stoppedForLateFrame = false; + log('continuing at ' + initialPlaybackPosition + ', ' + initialPlaybackOffset); + } + + function stopPlayback() { + initialPlaybackOffset = getPlaybackTime(); + log('pausing at ' + initialPlaybackOffset); + if (audioFeeder) { + audioFeeder.stop(); + } + } + + /** + * Get audio playback time position in file's units + * + * @return {number} seconds since file start + */ + function getPlaybackTime(state) { + if (prebufferingAudio || stoppedForLateFrame || paused) { + return initialPlaybackOffset; + } else { + var position; + if (audioFeeder) { + state = state || audioFeeder.getPlaybackState(); + position = state.playbackPosition; + } else { + // @fixme handle paused/stoped time better + position = getTimestamp() / 1000; + } + return (position - initialPlaybackPosition) + initialPlaybackOffset; + } + } + + var currentSrc = '', + stream, + streamEnded = false, + seekCancel = {}, + readCancel = {}, + mediaError = null, + dataEnded = false, + byteLength = 0, + duration = null, + lastSeenTimestamp = null, + nextProcessingTimer, + nextFrameTimer = null, + loading = false, + started = false, + paused = true, + ended = false, + startedPlaybackInDocument = false; + + var framesPlayed = 0; + // Benchmark data, exposed via getPlaybackStats() + var framesProcessed = 0, // frames + targetPerFrameTime = 1000 / 60, // ms + actualPerFrameTime = 0, // ms + totalFrameTime = 0, // ms + totalFrameCount = 0, // frames + playTime = 0, // ms + bufferTime = 0, // ms + drawingTime = 0, // ms + proxyTime = 0, // ms + totalJitter = 0; // sum of ms we're off from expected frame delivery time + // Benchmark data that doesn't clear + var droppedAudio = 0, // number of times we were starved for audio + delayedAudio = 0, // seconds audio processing was delayed by blocked CPU + lateFrames = 0; // number of times a frame was late and we had to halt audio + var poster = '', thumbnail; + + // called when stopping old video on load() + function stopVideo() { + log("STOPPING"); + // kill the previous video if any + state = State.INITIAL; + seekState = SeekState.NOT_SEEKING; + started = false; + //paused = true; // don't change this? + ended = false; + frameEndTimestamp = 0.0; + audioEndTimestamp = 0.0; + lastFrameDecodeTime = 0.0; + stoppedForLateFrame = false; + prebufferingAudio = false; + + // Abort all queued actions + actionQueue.splice(0, actionQueue.length); + + if (stream) { + // @todo fire an abort event if still loading + // @todo fire an emptied event if previously had data + stream.abort(); + stream = null; + streamEnded = false; + } + if (codec) { + codec.close(); + codec = null; + pendingFrame = 0; + pendingAudio = 0; + dataEnded = false; + } + videoInfo = null; + audioInfo = null; + if (audioFeeder) { + audioFeeder.close(); + audioFeeder = null; + } + if (nextProcessingTimer) { + clearTimeout(nextProcessingTimer); + nextProcessingTimer = null; + } + if (nextFrameTimer) { + clearTimeout(nextFrameTimer); + nextFrameTimer = null; + } + if (frameSink) { + frameSink.clear(); + frameSink = null; + } + if (decodedFrames) { + decodedFrames = []; + } + if (pendingFrames) { + pendingFrames = []; + } + initialSeekTime = 0.0; + // @todo set playback position, may need to fire timeupdate if wasnt previously 0 + initialPlaybackPosition = 0; + initialPlaybackOffset = 0; + duration = null; // do not fire durationchange + // timeline offset to 0? + } + + var lastFrameTime = getTimestamp(), + frameEndTimestamp = 0.0, + audioEndTimestamp = 0.0, + decodedFrames = [], + pendingFrames = []; + var lastFrameDecodeTime = 0.0, + lastFrameVideoCpuTime = 0, + lastFrameAudioCpuTime = 0, + lastFrameDemuxerCpuTime = 0, + lastFrameDrawingTime = 0, + lastFrameBufferTime = 0, + lastFrameProxyTime = 0, + lastVideoCpuTime = 0, + lastAudioCpuTime = 0, + lastDemuxerCpuTime = 0, + lastBufferTime = 0, + lastProxyTime = 0, + lastDrawingTime = 0; + var lastFrameTimestamp = 0.0, + currentVideoCpuTime = 0.0; + + var lastTimeUpdate = 0, // ms + timeUpdateInterval = 250; // ms + + function doFrameComplete(data) { + data = data || {}; + + if (startedPlaybackInDocument && !document.body.contains(self)) { + // We've been de-parented since we last ran + // Stop playback at next opportunity! + setTimeout(function() { + self.stop(); + }, 0); + } + + var newFrameTimestamp = getTimestamp(), + wallClockTime = newFrameTimestamp - lastFrameTimestamp, + //jitter = wallClockTime - targetPerFrameTime; + jitter = actualPerFrameTime - targetPerFrameTime; + totalJitter += Math.abs(jitter); + playTime += wallClockTime; + + var timing = { + cpuTime: lastFrameDecodeTime, + drawingTime: drawingTime - lastFrameDrawingTime, + bufferTime: bufferTime - lastFrameBufferTime, + proxyTime: proxyTime - lastFrameProxyTime, + + demuxerTime: 0, + videoTime: 0, + audioTime: 0, + //clockTime: wallClockTime + clockTime: actualPerFrameTime, + + late: stoppedForLateFrame || data.dropped, + dropped: data.dropped + }; + if (codec) { + timing.demuxerTime = (codec.demuxerCpuTime - lastFrameDemuxerCpuTime); + timing.videoTime += (currentVideoCpuTime - lastFrameVideoCpuTime); + timing.audioTime += (codec.audioCpuTime - lastFrameAudioCpuTime); + } + timing.cpuTime += timing.demuxerTime; + lastFrameDecodeTime = 0; + lastFrameTimestamp = newFrameTimestamp; + if (codec) { + lastFrameVideoCpuTime = currentVideoCpuTime; + lastFrameAudioCpuTime = codec.audioCpuTime; + lastFrameDemuxerCpuTime = codec.demuxerCpuTime; + } else { + lastFrameVideoCpuTime = 0; + lastFrameAudioCpuTime = 0; + lastFrameDemuxerCpuTime = 0; + } + lastFrameDrawingTime = drawingTime; + lastFrameBufferTime = bufferTime; + lastFrameProxyTime = proxyTime; + + function n(x) { + return Math.round(x * 10) / 10; + } + log('drew frame ' + data.frameEndTimestamp + ': ' + + 'clock time ' + n(wallClockTime) + ' (jitter ' + n(jitter) + ') ' + + 'cpu: ' + n(timing.cpuTime) + ' (mux: ' + n(timing.demuxerTime) + ' buf: ' + n(timing.bufferTime) + ' draw: ' + n(timing.drawingTime) + ' proxy: ' + n(timing.proxyTime) + ') ' + + 'vid: ' + n(timing.videoTime) + ' aud: ' + n(timing.audioTime)); + fireEventAsync('framecallback', timing); + + if (!lastTimeUpdate || (newFrameTimestamp - lastTimeUpdate) >= timeUpdateInterval) { + lastTimeUpdate = newFrameTimestamp; + fireEventAsync('timeupdate'); + } + } + + + // -- seek functions + var seekTargetTime = 0.0, + seekTargetKeypoint = 0.0, + bisectTargetTime = 0.0, + seekMode, + lastSeekPosition, + lastFrameSkipped, + seekBisector, + didSeek; + + var SeekMode = { + EXACT: "exact", + FAST: "fast" + }; + + function Cancel(msg) { + Error.call(this, msg); + } + Cancel.prototype = Object.create(Error); + + function seekStream(offset) { + if (stream.seeking) { + seekCancel.cancel(new Cancel('cancel for new seek')); + } + if (stream.buffering) { + readCancel.cancel(new Cancel('cancel for new seek')); + } + streamEnded = false; + dataEnded = false; + ended = false; + stream.seek(offset, seekCancel).then(function() { + readBytesAndWait(); + }).catch(onStreamError); + } + + function startBisection(targetTime) { + // leave room for potentially long Ogg page syncing + var endPoint = Math.max(0, stream.length - 65536); + + bisectTargetTime = targetTime; + seekBisector = new Bisector({ + start: 0, + end: endPoint, + process: function(start, end, position) { + if (position == lastSeekPosition) { + return false; + } else { + lastSeekPosition = position; + lastFrameSkipped = false; + codec.flush(function() { + seekStream(position); + }); + return true; + } + } + }); + seekBisector.start(); + } + + function seek(toTime, mode) { + log('requested seek to ' + toTime + ', mode ' + mode); + + if (self.readyState == self.HAVE_NOTHING) { + log('not yet loaded; saving seek position for later'); + initialSeekTime = toTime; + return; + } + + if (stream && !stream.seekable) { + console.log(stream) + throw new Error('Cannot seek a non-seekable stream'); + } + + function prepForSeek(callback) { + if (stream && stream.buffering) { + readCancel.cancel(new Cancel('cancel for new seek')); + } + if (stream && stream.seeking) { + seekCancel.cancel(new Cancel('cancel for new seek')); + } + // clear any queued input/seek-start + actionQueue.splice(0, actionQueue.length); + stopPlayback(); + prebufferingAudio = false; + stoppedForLateFrame = false; + if (audioFeeder) { + audioFeeder.flush(); + } + state = State.SEEKING; + seekTargetTime = toTime; + seekMode = mode; + if (codec) { + codec.flush(callback); + } else { + callback(); + } + } + + // Abort any previous seek or play suitably + prepForSeek(function() { + if (isProcessing()) { + // already waiting on input + } else { + // start up the new load *after* event loop churn + pingProcessing(0); + } + }); + + actionQueue.push(function() { + // Just in case another async task stopped us... + prepForSeek(function() { + doSeek(toTime) + }); + }); + } + + function doSeek(toTime) { + streamEnded = false; + dataEnded = false; + ended = false; + state = State.SEEKING; + seekTargetTime = toTime; + seekTargetKeypoint = -1; + lastFrameSkipped = false; + lastSeekPosition = -1; + + decodedFrames = []; + pendingFrames = []; + pendingFrame = 0; + pendingAudio = 0; + + didSeek = false; + codec.seekToKeypoint(toTime, function(seeking) { + if (seeking) { + seekState = SeekState.LINEAR_TO_TARGET; + fireEventAsync('seeking'); + + if (didSeek) { + // wait for i/o to trigger readBytesAndWait + return; + } else { + pingProcessing(); + return; + } + } + // Use the old interface still implemented on ogg demuxer + codec.getKeypointOffset(toTime, function(offset) { + if (offset > 0) { + // This file has an index! + // + // Start at the keypoint, then decode forward to the desired time. + // + seekState = SeekState.LINEAR_TO_TARGET; + seekStream(offset); + } else { + // No index. + // + // Bisect through the file finding our target time, then we'll + // have to do it again to reach the keypoint, and *then* we'll + // have to decode forward back to the desired time. + // + seekState = SeekState.BISECT_TO_TARGET; + startBisection(seekTargetTime); + } + + fireEventAsync('seeking'); + }); + }); + } + + function continueSeekedPlayback() { + seekState = SeekState.NOT_SEEKING; + state = State.READY; + frameEndTimestamp = codec.frameTimestamp; + audioEndTimestamp = codec.audioTimestamp; + if (codec.hasAudio) { + seekTargetTime = codec.audioTimestamp; + } else { + seekTargetTime = codec.frameTimestamp; + } + initialPlaybackOffset = seekTargetTime; + + function finishedSeeking() { + lastTimeUpdate = seekTargetTime; + fireEventAsync('timeupdate'); + fireEventAsync('seeked'); + if (isProcessing()) { + // wait for whatever's going on to complete + } else { + pingProcessing(); + } + } + + // Decode and show first frame immediately + if (codec.hasVideo && codec.frameReady) { + // hack! move this into the main loop when retooling + // to avoid maintaining this double draw + codec.decodeFrame(function(ok) { + if (ok) { + if (thumbnail) { + self.removeChild(thumbnail); + thumbnail = null; + } + frameSink.drawFrame(codec.frameBuffer); + } + finishedSeeking(); + } ); + return; + } else { + finishedSeeking(); + } + } + + /** + * @return {boolean} true to continue processing, false to wait for input data + */ + function doProcessLinearSeeking() { + var frameDuration; + if (codec.hasVideo) { + frameDuration = targetPerFrameTime / 1000; + } else { + frameDuration = 1 / 256; // approximate packet audio size, fake! + } + + if (codec.hasVideo) { + if (pendingFrame) { + // wait + return; + } else if (!codec.frameReady) { + // Haven't found a frame yet, process more data + codec.process(function(more) { + if (more) { + // need more packets + pingProcessing(); + } else if (streamEnded) { + log('stream ended during linear seeking on video'); + dataEnded = true; + continueSeekedPlayback(); + } else { + readBytesAndWait(); + } + }); + return; + } else if (seekMode === SeekMode.FAST && codec.keyframeTimestamp == codec.frameTimestamp) { + // Found some frames? Go ahead now! + continueSeekedPlayback(); + return; + } else if (codec.frameTimestamp + frameDuration < seekTargetTime) { + // Haven't found a time yet, or haven't reached the target time. + // Decode it in case we're at our keyframe or a following intraframe... + codec.decodeFrame(function() { + pingProcessing(); + }); + return; + } else { + // Reached or surpassed the target time. + if (codec.hasAudio) { + // Keep processing the audio track + // fall through... + } else { + continueSeekedPlayback(); + return; + } + } + } + if (codec.hasAudio) { + if (pendingAudio) { + // wait + return; + } if (!codec.audioReady) { + // Haven't found an audio packet yet, process more data + codec.process(function(more) { + if (more) { + // need more packets + pingProcessing(); + } else if (streamEnded) { + log('stream ended during linear seeking on audio'); + dataEnded = true; + continueSeekedPlayback(); + } else { + readBytesAndWait(); + } + }); + return; + } else if (codec.audioTimestamp + frameDuration < seekTargetTime) { + // Haven't found a time yet, or haven't reached the target time. + // Decode it so when we reach the target we've got consistent data. + codec.decodeAudio(function() { + pingProcessing(); + }); + return; + } else { + continueSeekedPlayback(); + return; + } + } + } + + function doProcessBisectionSeek() { + var frameDuration, + timestamp; + if (codec.hasVideo) { + timestamp = codec.frameTimestamp; + frameDuration = targetPerFrameTime / 1000; + } else if (codec.hasAudio) { + timestamp = codec.audioTimestamp; + frameDuration = 1 / 256; // approximate packet audio size, fake! + } else { + throw new Error('Invalid seek state; no audio or video track available'); + } + + if (timestamp < 0) { + // Haven't found a packet yet. + codec.process(function(more) { + if (more) { + // need more data + pingProcessing(); + } else if (streamEnded) { + log('stream ended during bisection seek'); + // We may have to go back further to find packets. + if (seekBisector.right()) { + // wait for new data to come in + } else { + log('failed going back'); + throw new Error('not sure what to do'); + } + } else { + readBytesAndWait(); + } + }); + } else if (timestamp - frameDuration / 2 > bisectTargetTime) { + if (seekBisector.left()) { + // wait for new data to come in + } else { + log('close enough (left)'); + + // We're having trouble finding a new packet position; + // likely it's an audio file with lots of small packets. + // Since we can't find an earlier packet, just continue here. + seekTargetTime = timestamp; + continueSeekedPlayback(); + } + } else if (timestamp + frameDuration / 2 < bisectTargetTime) { + if (seekBisector.right()) { + // wait for new data to come in + } else { + log('close enough (right)'); + + // We're having trouble finding a new packet position; + // likely it's an audio file with lots of small packets. + // Switch to linear mode to find the final target. + seekState = SeekState.LINEAR_TO_TARGET; + pingProcessing(); + } + } else { + // Reached the bisection target! + if (seekState == SeekState.BISECT_TO_TARGET && (codec.hasVideo && codec.keyframeTimestamp < codec.frameTimestamp)) { + // We have to go back and find a keyframe. Sigh. + log('finding the keypoint now'); + seekState = SeekState.BISECT_TO_KEYPOINT; + startBisection(codec.keyframeTimestamp); + } else { + log('straight seeking now'); + // Switch to linear mode to find the final target. + seekState = SeekState.LINEAR_TO_TARGET; + pingProcessing(); + } + } + } + + function setupVideo() { + if (videoInfo.fps > 0) { + targetPerFrameTime = 1000 / videoInfo.fps; + } else { + targetPerFrameTime = 16.667; // recalc this later + } + + canvas.width = videoInfo.displayWidth; + canvas.height = videoInfo.displayHeight; + OGVPlayer.styleManager.appendRule('.' + instanceId, { + width: videoInfo.displayWidth + 'px', + height: videoInfo.displayHeight + 'px' + }); + OGVPlayer.updatePositionOnResize(); + + frameSink = YUVCanvas.attach(canvas, canvasOptions); + } + + var depth = 0, + needProcessing = false, + pendingFrame = 0, + pendingAudio = 0, + framePipelineDepth = 3, + audioPipelineDepth = 4; + + function doProcessing() { + if (didSeek) { + didSeek = false; + } + nextProcessingTimer = null; + + if (isProcessing()) { + // Called async while waiting for something else to complete... + // let it finish, then we'll get called again to continue. + //return; + //throw new Error('REENTRANCY FAIL: doProcessing during processing'); + } + + if (depth > 0) { + throw new Error('REENTRANCY FAIL: doProcessing recursing unexpectedly'); + } + var iters = 0; + do { + needProcessing = false; + depth++; + doProcessingLoop(); + depth--; + + if (needProcessing && isProcessing()) { + throw new Error('REENTRANCY FAIL: waiting on input or codec but asked to keep processing'); + } + if (++iters > 500) { + log('stuck in processing loop; breaking with timer'); + needProcessing = 0; + pingProcessing(0); + } + } while (needProcessing); + } + + function doProcessingLoop() { + + if (actionQueue.length) { + // data or user i/o to process in our serialized event stream + // The function should eventually bring us back here via pingProcessing(), + // directly or via further i/o. + + var action = actionQueue.shift(); + action(); + + } else if (state == State.INITIAL) { + + if (codec.loadedMetadata) { + // we just fell over from headers into content; call onloadedmetadata etc + if (!codec.hasVideo && !codec.hasAudio) { + throw new Error('No audio or video found, something is wrong'); + } + if (codec.hasAudio) { + audioInfo = codec.audioFormat; + } + if (codec.hasVideo) { + videoInfo = codec.videoFormat; + setupVideo(); + } + if (!isNaN(codec.duration)) { + duration = codec.duration; + } + if (duration === null) { + if (stream.seekable) { + state = State.SEEKING_END; + lastSeenTimestamp = -1; + codec.flush(function() { + seekStream(Math.max(0, stream.length - 65536 * 2)); + }); + } else { + // Stream not seekable and no x-content-duration; assuming infinite stream. + state = State.LOADED; + pingProcessing(); + } + } else { + // We already know the duration. + state = State.LOADED; + pingProcessing(); + } + } else { + codec.process(function processInitial(more) { + if (more) { + // Keep processing headers + pingProcessing(); + } else if (streamEnded) { + throw new Error('end of file before headers found'); + } else { + // Read more data! + log('reading more cause we are out of data'); + readBytesAndWait(); + } + }); + } + + } else if (state == State.SEEKING_END) { + + // Look for the last item. + if (codec.frameReady) { + log('saw frame with ' + codec.frameTimestamp); + lastSeenTimestamp = Math.max(lastSeenTimestamp, codec.frameTimestamp); + codec.discardFrame(function() { + pingProcessing(); + }); + } else if (codec.audioReady) { + log('saw audio with ' + codec.audioTimestamp); + lastSeenTimestamp = Math.max(lastSeenTimestamp, codec.audioTimestamp); + codec.discardAudio(function() { + pingProcessing(); + }); + } else { + codec.process(function processSeekingEnd(more) { + if (more) { + // Keep processing headers + pingProcessing(); + } else { + // Read more data! + if (!stream.eof) { + readBytesAndWait(); + } else { + // We are at the end! + log('seek-duration: we are at the end: ' + lastSeenTimestamp); + if (lastSeenTimestamp > 0) { + duration = lastSeenTimestamp; + } + + // Ok, seek back to the beginning and resync the streams. + state = State.LOADED; + codec.flush(function() { + streamEnded = false; + dataEnded = false; + seekStream(0); + }); + } + } + }); + } + + } else if (state == State.LOADED) { + + state = State.PRELOAD; + fireEventAsync('loadedmetadata'); + fireEventAsync('durationchange'); + if (codec.hasVideo) { + fireEventAsync('resize'); + } + pingProcessing(0); + + } else if (state == State.PRELOAD) { + + if ((codec.frameReady || !codec.hasVideo) && + (codec.audioReady || !codec.hasAudio)) { + + state = State.READY; + fireEventAsync('loadeddata'); + pingProcessing(); + } else { + codec.process(function doProcessPreload(more) { + if (more) { + pingProcessing(); + } else if (streamEnded) { + // Ran out of data before data available...? + ended = true; + } else { + readBytesAndWait(); + } + }); + } + + } else if (state == State.READY) { + log('initial seek to ' + initialSeekTime); + + if (initialSeekTime > 0) { + + var target = initialSeekTime; + initialSeekTime = 0; + log('initial seek to ' + target); + doSeek(target); + + } else if (paused) { + + // Paused? stop here. + log('paused while in ready'); + + } else { + + function finishStartPlaying() { + log('finishStartPlaying'); + + state = State.PLAYING; + lastFrameTimestamp = getTimestamp(); + + if (codec.hasAudio && audioFeeder) { + // Pre-queue audio before we start the clock + prebufferingAudio = true; + } else { + startPlayback(); + } + pingProcessing(0); + fireEventAsync('play'); + fireEventAsync('playing'); + } + + if (codec.hasAudio && !audioFeeder && !muted) { + initAudioFeeder(); + audioFeeder.waitUntilReady(finishStartPlaying); + } else { + finishStartPlaying(); + } + } + + } else if (state == State.SEEKING) { + + if (seekState == SeekState.NOT_SEEKING) { + throw new Error('seeking in invalid state (not seeking?)'); + } else if (seekState == SeekState.BISECT_TO_TARGET) { + doProcessBisectionSeek(); + } else if (seekState == SeekState.BISECT_TO_KEYPOINT) { + doProcessBisectionSeek(); + } else if (seekState == SeekState.LINEAR_TO_TARGET) { + doProcessLinearSeeking(); + } else { + throw new Error('Invalid seek state ' + seekState); + } + + } else if (state == State.PLAYING) { + + function doProcessPlay() { + + //console.log(more, codec.audioReady, codec.frameReady, codec.audioTimestamp, codec.frameTimestamp); + + if (paused) { + + // ok we're done for now! + log('paused during playback; stopping loop'); + + } else { + + if ((!codec.hasAudio || codec.audioReady || pendingAudio || dataEnded) && + (!codec.hasVideo || codec.frameReady || pendingFrame || decodedFrames.length || dataEnded) + ) { + + var audioState = null, + playbackPosition = 0, + readyForAudioDecode, + audioEnded = false, + readyForFrameDraw, + frameDelay = 0, + readyForFrameDecode, + // timers never fire earlier than 4ms + timerMinimum = 4, + // ok to draw a couple ms early + fudgeDelta = timerMinimum; + + + if (codec.hasAudio && audioFeeder) { + // Drive on the audio clock! + + audioState = audioFeeder.getPlaybackState(); + playbackPosition = getPlaybackTime(audioState); + audioEnded = (dataEnded && audioFeeder.durationBuffered == 0); + + if (prebufferingAudio && (audioFeeder.durationBuffered >= audioFeeder.bufferThreshold * 2 || dataEnded)) { + log('prebuffering audio done; buffered to ' + audioFeeder.durationBuffered); + startPlayback(playbackPosition); + prebufferingAudio = false; + } + + if (audioState.dropped != droppedAudio) { + log('dropped ' + (audioState.dropped - droppedAudio)); + } + if (audioState.delayed != delayedAudio) { + log('delayed ' + (audioState.delayed - delayedAudio)); + } + droppedAudio = audioState.dropped; + delayedAudio = audioState.delayed; + + readyForAudioDecode = audioFeeder.durationBuffered <= + audioFeeder.bufferThreshold * 2; + + if (!readyForAudioDecode) { + // just to skip the remaining items in debug log + } else if (!codec.audioReady) { + // NEED MOAR BUFFERS + readyForAudioDecode = false; + } else if (pendingAudio >= audioPipelineDepth) { + // We'll check in when done decoding + log('audio decode disabled: ' + pendingAudio + ' packets in flight'); + readyForAudioDecode = false; + } + + } else { + // No audio; drive on the general clock. + // @fixme account for dropped frame times... + playbackPosition = getPlaybackTime(); + + // If playing muted with no audio output device, + // just keep up with audio in general. + readyForAudioDecode = codec.audioReady && (audioEndTimestamp < playbackPosition); + } + + if (codec.hasVideo) { + readyForFrameDraw = decodedFrames.length > 0; + readyForFrameDecode = (pendingFrame + decodedFrames.length < framePipelineDepth) && codec.frameReady; + + if (readyForFrameDraw) { + frameDelay = (decodedFrames[0].frameEndTimestamp - playbackPosition) * 1000; + actualPerFrameTime = targetPerFrameTime - frameDelay; + //frameDelay = Math.max(0, frameDelay); + //frameDelay = Math.min(frameDelay, targetPerFrameTime); + } + + var audioSyncThreshold = targetPerFrameTime; + if (prebufferingAudio) { + if (readyForFrameDecode) { + log('decoding a frame during prebuffering'); + } + readyForFrameDraw = false; + } else if (readyForFrameDraw && dataEnded && audioEnded) { + // If audio timeline reached end, make sure the last frame draws + log('audio timeline ended? ready to draw frame'); + } else if (readyForFrameDraw && -frameDelay >= audioSyncThreshold) { + // late frame! + if (options.sync == 'delay-audio') { + // Delay audio while video catches up. Old default. + if (!stoppedForLateFrame) { + log('late frame at ' + playbackPosition + ': ' + (-frameDelay) + ' expected ' + audioSyncThreshold); + lateFrames++; + if (decodedFrames.length > 1) { + log('late frame has a neighbor; skipping to next frame'); + var frame = decodedFrames.shift(); + frameDelay = (frame.frameEndTimestamp - playbackPosition) * 1000; + actualPerFrameTime = targetPerFrameTime - frameDelay; + framesProcessed++; // pretend! + doFrameComplete({ + frameEndTimestamp: frame.frameEndTimestamp, + dropped: true + }); + } else { + stopPlayback(); + stoppedForLateFrame = true; + } + } + } else if (options.sync == 'skip-frames') { + var skipPast = -1; + for (var i = 0; i < decodedFrames.length - 1; i++) { + if (decodedFrames[i].frameEndTimestamp < playbackPosition) { + skipPast = i - 1; + } + } + if (skipPast >= 0) { + while (skipPast-- >= 0) { + lateFrames++; + var frame = decodedFrames.shift(); + log('skipping already-decoded late frame at ' + frame.frameEndTimestamp); + frameDelay = (frame.frameEndTimestamp - playbackPosition) * 1000; + frameEndTimestamp = frame.frameEndTimestamp; + actualPerFrameTime = targetPerFrameTime - frameDelay; + framesProcessed++; // pretend! + frame.dropped = true; + doFrameComplete(); + } + } + + // Resync at the next keyframe. Default as of 1.3.2. + var nextKeyframe = codec.nextKeyframeTimestamp; + + // When resyncing, allow time to decode a couple frames! + var videoSyncPadding = (targetPerFrameTime / 1000) * (framePipelineDepth + pendingFrame); + var timeToResync = nextKeyframe - videoSyncPadding; + + if (nextKeyframe >= 0 && nextKeyframe != codec.frameTimestamp && playbackPosition >= timeToResync) { + log('skipping late frame at ' + decodedFrames[0].frameEndTimestamp + ' vs ' + playbackPosition + ', expect to see keyframe at ' + nextKeyframe); + + // First skip any already-decoded frames + for (var i = 0; i < decodedFrames.length; i++) { + var frame = decodedFrames[i]; + lateFrames++; + framesProcessed++; // pretend! + frameEndTimestamp = frame.frameEndTimestamp; + frameDelay = (frame.frameEndTimestamp - playbackPosition) * 1000; + actualPerFrameTime = targetPerFrameTime - frameDelay; + frame.dropped = true; + doFrameComplete(frame); + } + decodedFrames = []; + for (var i = 0; i < pendingFrames.length; i++) { + var frame = pendingFrames[i]; + lateFrames++; + framesProcessed++; // pretend! + frameEndTimestamp = frame.frameEndTimestamp; + frameDelay = (frame.frameEndTimestamp - playbackPosition) * 1000; + actualPerFrameTime = targetPerFrameTime - frameDelay; + frame.dropped = true; + doFrameComplete(frame); + } + pendingFrames = []; + pendingFrame = 0; + + // Now discard anything up to the keyframe + while (codec.frameReady && codec.frameTimestamp < nextKeyframe) { + // note: this is a known synchronous operation :) + var frame = { + frameEndTimestamp: codec.frameTimestamp, + dropped: true + }; + frameDelay = (frame.frameEndTimestamp - playbackPosition) * 1000; + actualPerFrameTime = targetPerFrameTime - frameDelay; + lateFrames++; + codec.discardFrame(function() {/*fake*/}); + framesProcessed++; // pretend! + doFrameComplete(frame); + } + if (isProcessing()) { + // wait + } else { + pingProcessing(); + } + return; + } + } + } else if (readyForFrameDraw && stoppedForLateFrame && !readyForFrameDecode && !readyForAudioDecode && frameDelay > fudgeDelta) { + // catching up, ok if we were early + log('late frame recovery reached ' + frameDelay); + startPlayback(playbackPosition); + stoppedForLateFrame = false; + readyForFrameDraw = false; // go back through the loop again + } else if (readyForFrameDraw && stoppedForLateFrame) { + // draw asap + } else if (readyForFrameDraw && frameDelay <= fudgeDelta) { + // on time! draw + } else { + // not yet + readyForFrameDraw = false; + } + } + + if (readyForFrameDecode) { + + log('play loop: ready to decode frame; thread depth: ' + pendingFrame + ', have buffered: ' + decodedFrames.length); + + if (videoInfo.fps == 0 && (codec.frameTimestamp - frameEndTimestamp) > 0) { + // WebM doesn't encode a frame rate + targetPerFrameTime = (codec.frameTimestamp - frameEndTimestamp) * 1000; + } + totalFrameTime += targetPerFrameTime; + totalFrameCount++; + + var nextFrameEndTimestamp = frameEndTimestamp = codec.frameTimestamp; + pendingFrame++; + pendingFrames.push({ + frameEndTimestamp: nextFrameEndTimestamp + }); + var currentPendingFrames = pendingFrames; + var wasAsync = false; + var frameDecodeTime = time(function() { + codec.decodeFrame(function processingDecodeFrame(ok) { + if (currentPendingFrames !== pendingFrames) { + log('play loop callback after flush, discarding'); + return; + } + log('play loop callback: decoded frame'); + pendingFrame--; + pendingFrames.shift(); + if (ok) { + // Save the buffer until it's time to draw + decodedFrames.push({ + yCbCrBuffer: codec.frameBuffer, + videoCpuTime: codec.videoCpuTime, + frameEndTimestamp: nextFrameEndTimestamp + }); + } else { + // Bad packet or something. + log('Bad video packet or something'); + } + codec.process(function() { + if (isProcessing()) { + // wait + } else { + pingProcessing(wasAsync ? undefined : 0); + } + }); + }); + }); + if (pendingFrame) { + wasAsync = true; + proxyTime += frameDecodeTime; + // We can process something else while that's running + pingProcessing(); + } + + } else if (readyForAudioDecode) { + + log('play loop: ready for audio; depth: ' + pendingAudio); + + pendingAudio++; + var nextAudioEndTimestamp = codec.audioTimestamp; + var audioDecodeTime = time(function() { + codec.decodeAudio(function processingDecodeAudio(ok) { + pendingAudio--; + log('play loop callback: decoded audio'); + audioEndTimestamp = nextAudioEndTimestamp; + + if (ok) { + var buffer = codec.audioBuffer; + if (buffer) { + // Keep track of how much time we spend queueing audio as well + // This is slow when using the Flash shim on IE 10/11 + bufferTime += time(function() { + if (audioFeeder) { + audioFeeder.bufferData(buffer); + } + }); + if (!codec.hasVideo) { + framesProcessed++; // pretend! + var frame = { + frameEndTimestamp: audioEndTimestamp + }; + doFrameComplete(frame); + } + } + } + if (isProcessing()) { + // wait + } else { + pingProcessing(); + } + }); + }); + if (pendingAudio) { + proxyTime += audioDecodeTime; + // We can process something else while that's running + if (codec.audioReady) { + pingProcessing(); + } else { + // Trigger a demux immediately if we need it; + // audio processing is our mostly-idle time + doProcessPlayDemux(); + } + } + + } else if (readyForFrameDraw) { + + log('play loop: ready to draw frame'); + + if (nextFrameTimer) { + clearTimeout(nextFrameTimer); + nextFrameTimer = null; + } + + // Ready to draw the decoded frame... + if (thumbnail) { + self.removeChild(thumbnail); + thumbnail = null; + } + + var frame = decodedFrames.shift(); + currentVideoCpuTime = frame.videoCpuTime; + + drawingTime += time(function() { + frameSink.drawFrame(frame.yCbCrBuffer); + }); + + framesProcessed++; + framesPlayed++; + + doFrameComplete(frame); + + pingProcessing(); + + } else if (decodedFrames.length && !nextFrameTimer && !prebufferingAudio) { + + var targetTimer = frameDelay; + // @todo consider using requestAnimationFrame + log('play loop: setting a timer for drawing ' + targetTimer); + nextFrameTimer = setTimeout(function() { + nextFrameTimer = null; + pingProcessing(); + }, targetTimer); + + } else if (dataEnded && !(pendingAudio || pendingFrame || decodedFrames.length)) { + log('play loop: playback reached end of data ' + [pendingAudio, pendingFrame, decodedFrames.length]); + var finalDelay = 0; + if (codec.hasAudio && audioFeeder) { + finalDelay = audioFeeder.durationBuffered * 1000; + } + if (finalDelay > 0) { + log('play loop: ending pending ' + finalDelay + ' ms'); + pingProcessing(Math.max(0, finalDelay)); + } else { + log('play loop: ENDING NOW: playback time ' + getPlaybackTime() + '; frameEndTimestamp: ' + frameEndTimestamp); + stopPlayback(); + stoppedForLateFrame = false; + prebufferingAudio = false; + initialPlaybackOffset = Math.max(audioEndTimestamp, frameEndTimestamp); + ended = true; + // @todo implement loop behavior + paused = true; + fireEventAsync('pause'); + fireEventAsync('ended'); + } + + } else { + + log('play loop: waiting on async/timers'); + + } + + } else { + + log('play loop: demuxing'); + + doProcessPlayDemux(); + } + } + } + + function doProcessPlayDemux() { + var wasFrameReady = codec.frameReady, + wasAudioReady = codec.audioReady; + codec.process(function doProcessPlayDemuxHandler(more) { + if ((codec.frameReady && !wasFrameReady) || (codec.audioReady && !wasAudioReady)) { + log('demuxer has packets'); + pingProcessing(); + } else if (more) { + // Have to process some more pages to find data. + log('demuxer processing to find more packets'); + pingProcessing(); + } else { + log('demuxer ran out of data'); + if (!streamEnded) { + // Ran out of buffered input + log('demuxer loading more data'); + readBytesAndWait(); + } else { + // Ran out of stream! + log('demuxer reached end of data stream'); + dataEnded = true; + pingProcessing(); + } + } + }); + } + + doProcessPlay(); + + } else if (state == State.ERROR) { + + // Nothing to do. + console.log("Reached error state. Sorry bout that."); + + } else { + + throw new Error('Unexpected OGVPlayer state ' + state); + + } + } + + /** + * Are we waiting on an async operation that will return later? + */ + function isProcessing() { + return (stream && (stream.buffering || stream.seeking)) || (codec && codec.processing); + } + + function readBytesAndWait() { + if (stream.buffering || stream.seeking) { + log('readBytesAndWait during i/o'); + return; + } + // keep i/o size small to reduce CPU impact of demuxing on slow machines + // @todo make buffer size larger when packets are larger? + var bufferSize = 32768; + stream.read(bufferSize, readCancel).then(function(data) { + log('got input ' + [data.byteLength]); + + if (data.byteLength) { + // Save chunk to pass into the codec's buffer + actionQueue.push(function doReceiveInput() { + codec.receiveInput(data, function() { + pingProcessing(); + }); + }); + } + if (stream.eof) { + // @todo record doneness in networkState + log('stream is at end!'); + streamEnded = true; + } + if (isProcessing()) { + // We're waiting on the codec already... + } else { + // Let the read/decode/draw loop know we're out! + pingProcessing(); + } + }).catch(onStreamError); + } + + function onStreamError(err) { + if (err instanceof Cancel) { + // do nothing + log('i/o promise canceled; ignoring'); + } else { + log("i/o error: " + err); + mediaError = new OGVMediaError(OGVMediaError.MEDIA_ERR_NETWORK, '' + err); + state = State.ERROR; + stopPlayback(); + } + } + + function pingProcessing(delay) { + if (delay === undefined) { + delay = -1; + } + /* + if (isProcessing()) { + // We'll get pinged again when whatever we were doing returns... + log('REENTRANCY FAIL: asked to pingProcessing() while already waiting'); + return; + } + */ + if (stream && stream.waiting) { + // wait for this input pls + log('waiting on input'); + return; + } + if (nextProcessingTimer) { + log('canceling old processing timer'); + clearTimeout(nextProcessingTimer); + nextProcessingTimer = null; + } + var fudge = -1 / 256; + if (delay > fudge) { + //log('pingProcessing delay: ' + delay); + nextProcessingTimer = setTimeout(function() { + // run through pingProcessing again to check + // in case some io started asynchronously in the meantime + pingProcessing(); + }, delay); + } else if (depth) { + //log('pingProcessing tail call (' + delay + ')'); + needProcessing = true; + } else { + doProcessing(); + } + } + + var videoInfo, + audioInfo; + + function startProcessingVideo() { + if (started || codec) { + return; + } + + framesProcessed = 0; + bufferTime = 0; + drawingTime = 0; + proxyTime = 0; + started = true; + ended = false; + + codec = new codecClass(codecOptions); + lastVideoCpuTime = 0; + lastAudioCpuTime = 0; + lastDemuxerCpuTime = 0; + lastBufferTime = 0; + lastDrawingTime = 0; + lastProxyTime = 0; + lastFrameVideoCpuTime = 0; + lastFrameAudioCpuTime = 0; + lastFrameDemuxerCpuTime = 0; + lastFrameBufferTime = 0; + lastFrameProxyTime = 0; + lastFrameDrawingTime = 0; + currentVideoCpuTime = 0; + codec.onseek = function(offset) { + didSeek = true; + if (stream) { + seekStream(offset); + } + }; + codec.init(function() { + readBytesAndWait(); + }); + } + + function loadCodec(callback) { + // @todo use the demuxer and codec interfaces directly + + // @todo fix detection proper + if (enableWebM && currentSrc.match(/\.webm$/i)) { + codecOptions.type = 'video/webm'; + } else { + codecOptions.type = 'video/ogg'; + } + + codecClass = OGVWrapperCodec; + callback(); + } + + /** + * HTMLMediaElement load method + * + * https://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-algorithm + */ + self.load = function() { + prepForLoad(); + }; + + function prepForLoad(preload) { + stopVideo(); + + function doLoad() { + // @todo networkState == NETWORK_LOADING + stream = new StreamFile({ + url: self.src, + cacheSize: 16 * 1024 * 1024, + }); + stream.load().then(function() { + loading = false; + + // @todo handle failure / unrecognized type + + currentSrc = self.src; + + // Fire off the read/decode/draw loop... + byteLength = stream.seekable ? stream.length : 0; + + // If we get X-Content-Duration, that's as good as an explicit hint + var durationHeader = stream.headers['x-content-duration']; + if (typeof durationHeader === 'string') { + duration = parseFloat(durationHeader); + } + loadCodec(startProcessingVideo); + }).catch(onStreamError); + } + + // @todo networkState = self.NETWORK_NO_SOURCE; + // @todo show poster + // @todo set 'delay load event flag' + + currentSrc = ''; + loading = true; + actionQueue.push(function() { + if (preload && self.preload === 'none') { + // Done for now, we'll pick up if someone hits play() or load() + loading = false; + } else { + doLoad(); + } + }); + pingProcessing(0); + } + + /** + * HTMLMediaElement canPlayType method + */ + self.canPlayType = function(contentType) { + var type = new OGVMediaType(contentType); + if (type.minor === 'ogg' && + (type.major === 'audio' || type.major === 'video' || type.major === 'application')) { + if (type.codecs) { + var supported = ['vorbis', 'opus', 'theora'], + knownCodecs = 0, + unknownCodecs = 0; + type.codecs.forEach(function(codec) { + if (supported.indexOf(codec) >= 0) { + knownCodecs++; + } else { + unknownCodecs++; + } + }); + if (knownCodecs === 0) { + return ''; + } else if (unknownCodecs > 0) { + return ''; + } + // All listed codecs are ones we know. Neat! + return 'probably'; + } else { + return 'maybe'; + } + } else { + // @todo when webm support is more complete, handle it + return ''; + } + }; + + /** + * HTMLMediaElement play method + */ + self.play = function() { + if (!muted && !audioOptions.audioContext) { + OGVPlayer.initSharedAudioContext(); + } + + if (paused) { + startedPlaybackInDocument = document.body.contains(self); + + paused = false; + + if (state == State.SEEKING) { + + // Seeking? Just make sure we know to pick up after. + + } else if (started && codec && codec.loadedMetadata) { + + if (ended && stream && byteLength) { + + log('.play() starting over after end'); + seek(0); + + } else { + log('.play() while already started'); + } + + state = State.READY; + if (isProcessing()) { + // waiting on the codec already + } else { + pingProcessing(); + } + + } else if (loading) { + + log('.play() while loading'); + + } else { + + log('.play() before started'); + + // Let playback begin when metadata loading is complete + if (!stream) { + self.load(); + } + + } + } + }; + + /** + * custom getPlaybackStats method + */ + self.getPlaybackStats = function() { + return { + targetPerFrameTime: targetPerFrameTime, + framesProcessed: framesProcessed, + playTime: playTime, + demuxingTime: codec ? (codec.demuxerCpuTime - lastDemuxerCpuTime) : 0, + videoDecodingTime: codec ? (codec.videoCpuTime - lastVideoCpuTime) : 0, + audioDecodingTime: codec ? (codec.audioCpuTime - lastAudioCpuTime) : 0, + bufferTime: bufferTime - lastBufferTime, + drawingTime: drawingTime - lastDrawingTime, + proxyTime: proxyTime - lastProxyTime, + droppedAudio: droppedAudio, + delayedAudio: delayedAudio, + jitter: totalJitter / framesProcessed, + lateFrames: lateFrames + }; + }; + self.resetPlaybackStats = function() { + framesProcessed = 0; + playTime = 0; + if (codec) { + lastDemuxerCpuTime = codec.demuxerCpuTime; + lastVideoCpuTime = codec.videoCpuTime; + lastAudioCpuTime = codec.audioCpuTime; + } + lastBufferTime = bufferTime; + lastDrawingTime = drawingTime; + lastProxyTime = proxyTime; + totalJitter = 0; + totalFrameTime = 0; + totalFrameCount = 0; + }; + + self.getVideoFrameSink = function() { + return frameSink; + }; + + self.getCanvas = function() { + return canvas; + }; + + /** + * HTMLMediaElement pause method + */ + self.pause = function() { + if (!paused) { + clearTimeout(nextProcessingTimer); + nextProcessingTimer = null; + stopPlayback(); + prebufferingAudio = false; + stoppedForLateFrame = false; + paused = true; + fireEvent('pause'); + } + }; + + /** + * custom 'stop' method + */ + self.stop = function() { + stopVideo(); + paused = true; + }; + + /** + * @todo implement the fast part of the behavior! + */ + self.fastSeek = function(seekToTime) { + seek(+seekToTime, SeekMode.FAST); + }; + + /** + * HTMLMediaElement src property + */ + Object.defineProperty(self, "src", { + get: function getSrc() { + return self.getAttribute('src') || ''; + }, + set: function setSrc(val) { + self.setAttribute('src', val); + loading = false; // just in case? + prepForLoad("interactive"); + } + }); + + /** + * HTMLMediaElement buffered property + */ + Object.defineProperty(self, "buffered", { + get: function getBuffered() { + var ranges; + if (stream && byteLength && duration) { + ranges = stream.getBufferedRanges().map(function(range) { + return range.map(function(offset) { + return (offset / stream.length) * duration; + }); + }); + } else { + ranges = [[0, 0]]; + } + return new OGVTimeRanges(ranges); + } + }); + + /** + * HTMLMediaElement seekable property + */ + Object.defineProperty(self, "seekable", { + get: function getSeekable() { + if (self.duration < Infinity && stream && stream.seekable && codec && codec.seekable) { + return new OGVTimeRanges([[0, duration]]); + } else { + return new OGVTimeRanges([]); + } + } + }); + + /** + * HTMLMediaElement currentTime property + */ + Object.defineProperty(self, "currentTime", { + get: function getCurrentTime() { + if (state == State.SEEKING) { + return seekTargetTime; + } else { + if (codec) { + if (state == State.PLAYING && !paused) { + return getPlaybackTime(); + } else { + return initialPlaybackOffset; + } + } else { + return initialSeekTime; + } + } + }, + set: function setCurrentTime(val) { + seek(val, SeekMode.EXACT); + } + }); + + /** + * HTMLMediaElement duration property + */ + Object.defineProperty(self, "duration", { + get: function getDuration() { + if (codec && codec.loadedMetadata) { + if (duration !== null) { + return duration; + } else { + return Infinity; + } + } else { + return NaN; + } + } + }); + + /** + * HTMLMediaElement paused property + */ + Object.defineProperty(self, "paused", { + get: function getPaused() { + return paused; + } + }); + + /** + * HTMLMediaElement ended property + */ + Object.defineProperty(self, "ended", { + get: function getEnded() { + return ended; + } + }); + + /** + * HTMLMediaElement ended property + */ + Object.defineProperty(self, "seeking", { + get: function getSeeking() { + return (state == State.SEEKING); + } + }); + + /** + * HTMLMediaElement muted property + */ + Object.defineProperty(self, "muted", { + get: function getMuted() { + return muted; + }, + set: function setMuted(val) { + muted = val; + if (audioFeeder) { + audioFeeder.muted = muted; + } else if (started && !muted && codec && codec.hasAudio) { + log('unmuting: switching from timer to audio clock'); + initAudioFeeder(); + startPlayback(audioEndTimestamp); + } + fireEventAsync('volumechange'); + } + }); + + Object.defineProperty(self, "poster", { + get: function getPoster() { + return poster; + }, + set: function setPoster(val) { + poster = val; + if (!started) { + if (thumbnail) { + self.removeChild(thumbnail); + } + thumbnail = new Image(); + thumbnail.src = poster; + thumbnail.className = 'ogvjs-poster'; + thumbnail.style.position = 'absolute'; + thumbnail.style.top = '0'; + thumbnail.style.left = '0'; + thumbnail.style.width = '100%'; + thumbnail.style.height = '100%'; + thumbnail.style.objectFit = 'contain'; + thumbnail.style.visibility = 'hidden'; + thumbnail.addEventListener('load', function() { + if (thumbnail === this) { + OGVPlayer.styleManager.appendRule('.' + instanceId, { + width: thumbnail.naturalWidth + 'px', + height: thumbnail.naturalHeight + 'px' + }); + OGVPlayer.updatePositionOnResize(); + thumbnail.style.visibility = 'visible'; + } + }); + self.appendChild(thumbnail); + } + } + }); + + // Video metadata properties... + Object.defineProperty(self, "videoWidth", { + get: function getVideoWidth() { + if (videoInfo) { + return videoInfo.displayWidth; + } else { + return 0; + } + } + }); + Object.defineProperty(self, "videoHeight", { + get: function getVideoHeight() { + if (videoInfo) { + return videoInfo.displayHeight; + } else { + return 0; + } + } + }); + Object.defineProperty(self, "ogvjsVideoFrameRate", { + get: function getOgvJsVideoFrameRate() { + if (videoInfo) { + if (videoInfo.fps == 0) { + return totalFrameCount / (totalFrameTime / 1000); + } else { + return videoInfo.fps; + } + } else { + return 0; + } + } + }); + + // Audio metadata properties... + Object.defineProperty(self, "ogvjsAudioChannels", { + get: function getOgvJsAudioChannels() { + if (audioInfo) { + return audioInfo.channels; + } else { + return 0; + } + } + }); + Object.defineProperty(self, "ogvjsAudioSampleRate", { + get: function getOgvJsAudioChannels() { + if (audioInfo) { + return audioInfo.rate; + } else { + return 0; + } + } + }); + + // Display size... + var width = 0, height = 0; + /** + * @property width + * @todo reflect to the width attribute? + */ + Object.defineProperty(self, "width", { + get: function getWidth() { + return width; + }, + set: function setWidth(val) { + width = parseInt(val, 10); + self.style.width = width + 'px'; + OGVPlayer.updatePositionOnResize(); + } + }); + + /** + * @property height + * @todo reflect to the height attribute? + */ + Object.defineProperty(self, "height", { + get: function getHeight() { + return height; + }, + set: function setHeight(val) { + height = parseInt(val, 10); + self.style.height = height + 'px'; + OGVPlayer.updatePositionOnResize(); + } + }); + + /** + * @property autoplay {boolean} stub prop + * @todo reflect to the autoplay attribute? + * @todo implement actual autoplay behavior + */ + Object.defineProperty(self, "autoplay", { + get: function getAutoplay() { + return false; + }, + set: function setAutoplay(val) { + // ignore + } + }); + + /** + * @property controls {boolean} stub prop + * @todo reflect to the controls attribute? + * @todo implement actual control behavior + */ + Object.defineProperty(self, "controls", { + get: function getControls() { + return false; + }, + set: function setControls(val) { + // ignore + } + }); + + /** + * @property loop {boolean} stub prop + * @todo reflect to the controls attribute? + * @todo implement actual loop behavior + */ + Object.defineProperty(self, "loop", { + get: function getLoop() { + return false; + }, + set: function setLoop(val) { + // ignore + } + }); + + /** + * @property crossOrigin {string|null} stub prop + * @todo reflect to the crossorigin attribute? + * @todo implement actual behavior + */ + Object.defineProperty(self, "crossOrigin", { + get: function getCrossOrigin() { + return null; + }, + set: function setCrossOrigin(val) { + // ignore + } + }); + + /** + * Returns the URL to the currently-playing resource. + * @property currentSrc {string|null} + */ + Object.defineProperty(self, "currentSrc", { + get: function getCurrentSrc() { + // @todo return absolute URL per spec + return currentSrc; + } + }); + + Object.defineProperty(self, "defaultMuted", { + get: function getDefaultMuted() { + return false; + } + }); + + Object.defineProperty(self, "defaultPlaybackRate", { + get: function getDefaultPlaybackRate() { + return 1; + } + }); + + /** + * @property error {string|null} + * @todo implement + */ + Object.defineProperty(self, "error", { + get: function getError() { + if (state === State.ERROR) { + if (mediaError) { + return mediaError; + } else { + return new OGVMediaError("unknown error occurred in media procesing"); + } + } else { + return null; + } + } + }); + /** + * @property preload {string} + */ + Object.defineProperty(self, "preload", { + get: function getPreload() { + return self.getAttribute('preload') || ''; + }, + set: function setPreload(val) { + self.setAttribute('preload', val); + } + }); + + /** + * @property readyState {number} + * @todo return more accurate info about availability of data + */ + Object.defineProperty(self, "readyState", { + get: function getReadyState() { + if (stream && codec && codec.loadedMetadata) { + // for now we don't really calc this stuff + // just pretend we have lots of data coming in already + return OGVPlayer.HAVE_ENOUGH_DATA; + } else { + return OGVPlayer.HAVE_NOTHING; + } + } + }); + + /** + * @property networkState {number} + * @todo implement + */ + Object.defineProperty(self, "networkState", { + get: function getNetworkState() { + if (stream) { + if (stream.waiting) { + return OGVPlayer.NETWORK_LOADING; + } else { + return OGVPlayer.NETWORK_IDLE; + } + } else { + if (self.readyState == OGVPlayer.HAVE_NOTHING) { + return OGVPlayer.NETWORK_EMPTY; + } else { + return OGVPlayer.NETWORK_NO_SOURCE; + } + } + } + }); + + /** + * @property playbackRate {number} + * @todo implement + */ + Object.defineProperty(self, "playbackRate", { + get: function getPlaybackRate() { + return 1; + }, + set: function setPlaybackRate(val) { + // ignore + } + }); + + /** + * @property played {OGVTimeRanges} + * @todo implement correctly more or less + */ + Object.defineProperty(self, "played", { + get: function getPlayed() { + return new OGVTimeRanges([[0, self.currentTime]]); + } + }); + + var _volume = 1; + + /** + * @property volume {number} + * @todo implement + */ + Object.defineProperty(self, "volume", { + get: function getVolume() { + return _volume; + }, + set: function setVolume(val) { + _volume = +val; + if (audioFeeder) { + audioFeeder.volume = _volume; + } + fireEventAsync('volumechange'); + } + }); + + + // Events! + + /** + * custom onframecallback, takes frame decode time in ms + */ + self.onframecallback = null; + + /** + * Network state events + * @todo implement + */ + self.onloadstate = null; + self.onprogress = null; + self.onsuspend = null; + self.onabort = null; + self.onemptied = null; + self.onstalled = null; + + /** + * Called when all metadata is available. + * Note in theory we must know 'duration' at this point. + */ + self.onloadedmetadata = null; + + /** + * Called when enough data for first frame is ready. + * @todo implement + */ + self.onloadeddata = null; + + /** + * Called when enough data is ready to start some playback. + * @todo implement + */ + self.oncanplay = null; + + /** + * Called when enough data is ready to play through to the + * end if no surprises in network download rate. + * @todo implement + */ + self.oncanplaythrough = null; + + /** + * Called when playback continues after a stall + * @todo implement + */ + self.onplaying = null; + + /** + * Called when playback is delayed waiting on data + * @todo implement + */ + self.onwaiting = null; + + /** + * Called when seeking begins + * @todo implement + */ + self.onseeking = null; + + /** + * Called when seeking ends + * @todo implement + */ + self.onseeked = null; + + /** + * Called when playback ends + */ + self.onended = null; + + /** + * Called when duration becomes known + * @todo implement + */ + self.ondurationchange = null; + + /** + * Called periodically during playback + */ + self.ontimeupdate = null; + + /** + * Called when we start playback + */ + self.onplay = null; + + /** + * Called when we get paused + */ + self.onpause = null; + + /** + * Called when the playback rate changes + * @todo implement + */ + self.onratechange = null; + + /** + * Called when the size of the video stream changes + * @todo implement + */ + self.onresize = null; + + /** + * Called when the volume setting changes + * @todo implement + */ + self.onvolumechange = null; + + return self; + }; + + OGVPlayer.initSharedAudioContext = function() { + AudioFeeder.initSharedAudioContext(); + }; + + /** + * Set up constants on the class and instances + */ + var constants = { + /** + * Constants for networkState + */ + NETWORK_EMPTY: 0, + NETWORK_IDLE: 1, + NETWORK_LOADING: 2, + NETWORK_NO_SOURCE: 3, + + /** + * Constants for readyState + */ + HAVE_NOTHING: 0, + HAVE_METADATA: 1, + HAVE_CURRENT_DATA: 2, + HAVE_FUTURE_DATA: 3, + HAVE_ENOUGH_DATA: 4 + }; + extend(OGVPlayer, constants); + + OGVPlayer.instanceCount = 0; + + function StyleManager() { + var self = this; + var el = document.createElement('style'); + el.type = 'text/css'; + el.textContent = 'ogvjs { ' + + 'display: inline-block; ' + + 'position: relative; ' + + '-webkit-user-select: none; ' + + '-webkit-tap-highlight-color: rgba(0,0,0,0); ' + '}'; + document.head.appendChild(el); + + var sheet = el.sheet; + + self.appendRule = function(selector, defs) { + var bits = []; + for (var prop in defs) { + if (defs.hasOwnProperty(prop)) { + bits.push(prop + ':' + defs[prop]); + } + } + var rule = selector + '{' + bits.join(';') + '}'; + sheet.insertRule(rule, sheet.cssRules.length - 1); + }; + } + OGVPlayer.styleManager = new StyleManager(); + + // IE 10/11 and Edge 12 don't support object-fit. + // Also just for fun, IE 10 doesn't support 'auto' sizing on canvas. o_O + OGVPlayer.supportsObjectFit = (typeof document.createElement('div').style.objectFit === 'string'); + if (OGVPlayer.supportsObjectFit && navigator.userAgent.match(/iPhone|iPad|iPod Touch/)) { + // Safari for iOS 8/9 supports it but positions our incorrectly when using WebGL >:( + OGVPlayer.supportsObjectFit = false; + } + if (OGVPlayer.supportsObjectFit) { + OGVPlayer.updatePositionOnResize = function() { + // no-op + }; + } else { + OGVPlayer.updatePositionOnResize = function() { + function fixup(el, width, height) { + var container = el.offsetParent || el.parentNode, + containerAspect = container.offsetWidth / container.offsetHeight, + intrinsicAspect = width / height; + if (intrinsicAspect > containerAspect) { + var vsize = container.offsetWidth / intrinsicAspect, + vpad = (container.offsetHeight - vsize) / 2; + el.style.width = '100%'; + el.style.height = vsize + 'px'; + el.style.marginLeft = 0; + el.style.marginRight = 0; + el.style.marginTop = vpad + 'px'; + el.style.marginBottom = vpad + 'px'; + } else { + var hsize = container.offsetHeight * intrinsicAspect, + hpad = (container.offsetWidth - hsize) / 2; + el.style.width = hsize + 'px'; + el.style.height = '100%'; + el.style.marginLeft = hpad + 'px'; + el.style.marginRight = hpad + 'px'; + el.style.marginTop = 0; + el.style.marginBottom = 0; + } + } + function queryOver(selector, callback) { + var nodeList = document.querySelectorAll(selector), + nodeArray = Array.prototype.slice.call(nodeList); + nodeArray.forEach(callback); + } + + queryOver('ogvjs > canvas', function(canvas) { + fixup(canvas, canvas.width, canvas.height); + }); + queryOver('ogvjs > img', function(poster) { + fixup(poster, poster.naturalWidth, poster.naturalHeight); + }); + }; + var fullResizeVideo = function() { + // fullscreens may ping us before the resize happens + setTimeout(OGVPlayer.updatePositionOnResize, 0); + }; + + window.addEventListener('resize', OGVPlayer.updatePositionOnResize); + window.addEventListener('orientationchange', OGVPlayer.updatePositionOnResize); + + document.addEventListener('fullscreenchange', fullResizeVideo); + document.addEventListener('mozfullscreenchange', fullResizeVideo); + document.addEventListener('webkitfullscreenchange', fullResizeVideo); + document.addEventListener('MSFullscreenChange', fullResizeVideo); + } + + module.exports = OGVPlayer; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + var require;/* WEBPACK VAR INJECTION */(function(process, global) {/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version 4.1.0 + */ + + (function (global, factory) { + true ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ES6Promise = factory()); + }(this, (function () { 'use strict'; + + function objectOrFunction(x) { + return typeof x === 'function' || typeof x === 'object' && x !== null; + } + + function isFunction(x) { + return typeof x === 'function'; + } + + var _isArray = undefined; + if (!Array.isArray) { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + _isArray = Array.isArray; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = undefined; + var customSchedulerFn = undefined; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var r = require; + var vertx = __webpack_require__(11); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = undefined; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && "function" === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var _arguments = arguments; + + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + if (_state) { + (function () { + var callback = _arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + })(); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + _resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(16); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + var GET_THEN_ERROR = new ErrorObject(); + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function getThen(promise) { + try { + return promise.then; + } catch (error) { + GET_THEN_ERROR.error = error; + return GET_THEN_ERROR; + } + } + + function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + _resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + _reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + _reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + _reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return _resolve(promise, value); + }, function (reason) { + return _reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$) { + if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$ === GET_THEN_ERROR) { + _reject(promise, GET_THEN_ERROR.error); + GET_THEN_ERROR.error = null; + } else if (then$$ === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$)) { + handleForeignThenable(promise, maybeThenable, then$$); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function _resolve(promise, value) { + if (promise === value) { + _reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + handleMaybeThenable(promise, value, getThen(value)); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function _reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = undefined, + callback = undefined, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function ErrorObject() { + this.error = null; + } + + var TRY_CATCH_ERROR = new ErrorObject(); + + function tryCatch(callback, detail) { + try { + return callback(detail); + } catch (e) { + TRY_CATCH_ERROR.error = e; + return TRY_CATCH_ERROR; + } + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = undefined, + error = undefined, + succeeded = undefined, + failed = undefined; + + if (hasCallback) { + value = tryCatch(callback, detail); + + if (value === TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value.error = null; + } else { + succeeded = true; + } + + if (promise === value) { + _reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + _resolve(promise, value); + } else if (failed) { + _reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + _reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + _resolve(promise, value); + }, function rejectPromise(reason) { + _reject(promise, reason); + }); + } catch (e) { + _reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this._input = input; + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + _reject(this.promise, validationError()); + } + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + }; + + Enumerator.prototype._enumerate = function () { + var length = this.length; + var _input = this._input; + + for (var i = 0; this._state === PENDING && i < length; i++) { + this._eachEntry(_input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function (entry, i) { + var c = this._instanceConstructor; + var resolve$$ = c.resolve; + + if (resolve$$ === resolve) { + var _then = getThen(entry); + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise) { + var promise = new c(noop); + handleMaybeThenable(promise, entry, _then); + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$) { + return resolve$$(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$(entry), i); + } + }; + + Enumerator.prototype._settledAt = function (state, i, value) { + var promise = this.promise; + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + _reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function (promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + _reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + Promise.all = all; + Promise.race = race; + Promise.resolve = resolve; + Promise.reject = reject; + Promise._setScheduler = setScheduler; + Promise._setAsap = setAsap; + Promise._asap = asap; + + Promise.prototype = { + constructor: Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + let result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + let author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: then, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function _catch(onRejection) { + return this.then(null, onRejection); + } + }; + + function polyfill() { + var local = undefined; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise; + } + + // Strange compat.. + Promise.polyfill = polyfill; + Promise.Promise = Promise; + + return Promise; + + }))); + + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), (function() { return this; }()))) + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + + /* (ignored) */ + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + Copyright (c) 2014-2016 Brion Vibber + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + (function() { + "use strict"; + + var FrameSink = __webpack_require__(13), + SoftwareFrameSink = __webpack_require__(14), + WebGLFrameSink = __webpack_require__(17); + + /** + * @typedef {Object} YUVCanvasOptions + * @property {boolean} webGL - Whether to use WebGL to draw to the canvas and accelerate color space conversion. If left out, defaults to auto-detect. + */ + + var YUVCanvas = { + FrameSink: FrameSink, + + SoftwareFrameSink: SoftwareFrameSink, + + WebGLFrameSink: WebGLFrameSink, + + /** + * Attach a suitable FrameSink instance to an HTML5 canvas element. + * + * This will take over the drawing context of the canvas and may turn + * it into a WebGL 3d canvas if possible. Do not attempt to use the + * drawing context directly after this. + * + * @param {HTMLCanvasElement} canvas - HTML canvas element to attach to + * @param {YUVCanvasOptions} options - map of options + * @returns {FrameSink} - instance of suitable subclass. + */ + attach: function(canvas, options) { + options = options || {}; + var webGL = ('webGL' in options) ? options.webGL : WebGLFrameSink.isAvailable(); + if (webGL) { + return new WebGLFrameSink(canvas, options); + } else { + return new SoftwareFrameSink(canvas, options); + } + } + }; + + module.exports = YUVCanvas; + })(); + + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + + (function() { + "use strict"; + + /** + * Create a YUVCanvas and attach it to an HTML5 canvas element. + * + * This will take over the drawing context of the canvas and may turn + * it into a WebGL 3d canvas if possible. Do not attempt to use the + * drawing context directly after this. + * + * @param {HTMLCanvasElement} canvas - HTML canvas element to attach to + * @param {YUVCanvasOptions} options - map of options + * @throws exception if WebGL requested but unavailable + * @constructor + * @abstract + */ + function FrameSink(canvas, options) { + throw new Error('abstract'); + } + + /** + * Draw a single YUV frame on the underlying canvas, converting to RGB. + * If necessary the canvas will be resized to the optimal pixel size + * for the given buffer's format. + * + * @param {YUVBuffer} buffer - the YUV buffer to draw + * @see {@link https://www.npmjs.com/package/yuv-buffer|yuv-buffer} for format + */ + FrameSink.prototype.drawFrame = function(buffer) { + throw new Error('abstract'); + }; + + /** + * Clear the canvas using appropriate underlying 2d or 3d context. + */ + FrameSink.prototype.clear = function() { + throw new Error('abstract'); + }; + + module.exports = FrameSink; + + })(); + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + Copyright (c) 2014-2016 Brion Vibber + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + (function() { + "use strict"; + + var FrameSink = __webpack_require__(13), + YCbCr = __webpack_require__(15); + + /** + * @param {HTMLCanvasElement} canvas - HTML canvas eledment to attach to + * @constructor + */ + function SoftwareFrameSink(canvas) { + var self = this, + ctx = canvas.getContext('2d'), + imageData = null, + resampleCanvas = null, + resampleContext = null; + + + + function initImageData(width, height) { + imageData = ctx.createImageData(width, height); + + // Prefill the alpha to opaque + var data = imageData.data, + pixelCount = width * height * 4; + for (var i = 0; i < pixelCount; i += 4) { + data[i + 3] = 255; + } + } + + function initResampleCanvas(cropWidth, cropHeight) { + resampleCanvas = document.createElement('canvas'); + resampleCanvas.width = cropWidth; + resampleCanvas.height = cropHeight; + resampleContext = resampleCanvas.getContext('2d'); + } + + /** + * Actually draw a frame into the canvas. + * @param {YUVFrame} buffer - YUV frame buffer object to draw + */ + self.drawFrame = function drawFrame(buffer) { + var format = buffer.format; + + if (canvas.width !== format.displayWidth || canvas.height !== format.displayHeight) { + // Keep the canvas at the right size... + canvas.width = format.displayWidth; + canvas.height = format.displayHeight; + } + + if (imageData === null || + imageData.width != format.width || + imageData.height != format.height) { + initImageData(format.width, format.height); + } + + // YUV -> RGB over the entire encoded frame + YCbCr.convertYCbCr(buffer, imageData.data); + + var resample = (format.cropWidth != format.displayWidth || format.cropHeight != format.displayHeight); + var drawContext; + if (resample) { + // hack for non-square aspect-ratio + // putImageData doesn't resample, so we have to draw in two steps. + if (!resampleCanvas) { + initResampleCanvas(format.cropWidth, format.cropHeight); + } + drawContext = resampleContext; + } else { + drawContext = ctx; + } + + // Draw cropped frame to either the final or temporary canvas + drawContext.putImageData(imageData, + 0, 0, + format.cropLeft, format.cropTop, + format.cropWidth, format.cropHeight); + + if (resample) { + ctx.drawImage(resampleCanvas, 0, 0, format.displayWidth, format.displayHeight); + } + }; + + self.clear = function() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + }; + + return self; + } + + SoftwareFrameSink.prototype = Object.create(FrameSink.prototype); + + module.exports = SoftwareFrameSink; + })(); + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + Copyright (c) 2014-2016 Brion Vibber + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + (function() { + "use strict"; + + var depower = __webpack_require__(16); + + /** + * Basic YCbCr->RGB conversion + * + * @author Brion Vibber + * @copyright 2014-2016 + * @license MIT-style + * + * @param {YUVFrame} buffer - input frame buffer + * @param {Uint8ClampedArray} output - array to draw RGBA into + * Assumes that the output array already has alpha channel set to opaque. + */ + function convertYCbCr(buffer, output) { + var width = buffer.format.width, + height = buffer.format.height, + hdec = depower(buffer.format.width / buffer.format.chromaWidth), + vdec = depower(buffer.format.height / buffer.format.chromaHeight), + bytesY = buffer.y.bytes, + bytesCb = buffer.u.bytes, + bytesCr = buffer.v.bytes, + strideY = buffer.y.stride, + strideCb = buffer.u.stride, + strideCr = buffer.v.stride, + outStride = 4 * width, + YPtr = 0, Y0Ptr = 0, Y1Ptr = 0, + CbPtr = 0, CrPtr = 0, + outPtr = 0, outPtr0 = 0, outPtr1 = 0, + colorCb = 0, colorCr = 0, + multY = 0, multCrR = 0, multCbCrG = 0, multCbB = 0, + x = 0, y = 0, xdec = 0, ydec = 0; + + if (hdec == 1 && vdec == 1) { + // Optimize for 4:2:0, which is most common + outPtr0 = 0; + outPtr1 = outStride; + ydec = 0; + for (y = 0; y < height; y += 2) { + Y0Ptr = y * strideY; + Y1Ptr = Y0Ptr + strideY; + CbPtr = ydec * strideCb; + CrPtr = ydec * strideCr; + for (x = 0; x < width; x += 2) { + colorCb = bytesCb[CbPtr++]; + colorCr = bytesCr[CrPtr++]; + + // Quickie YUV conversion + // https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion + // multiplied by 256 for integer-friendliness + multCrR = (409 * colorCr) - 57088; + multCbCrG = (100 * colorCb) + (208 * colorCr) - 34816; + multCbB = (516 * colorCb) - 70912; + + multY = (298 * bytesY[Y0Ptr++]); + output[outPtr0++] = (multY + multCrR) >> 8; + output[outPtr0++] = (multY - multCbCrG) >> 8; + output[outPtr0++] = (multY + multCbB) >> 8; + outPtr0++; + + multY = (298 * bytesY[Y0Ptr++]); + output[outPtr0++] = (multY + multCrR) >> 8; + output[outPtr0++] = (multY - multCbCrG) >> 8; + output[outPtr0++] = (multY + multCbB) >> 8; + outPtr0++; + + multY = (298 * bytesY[Y1Ptr++]); + output[outPtr1++] = (multY + multCrR) >> 8; + output[outPtr1++] = (multY - multCbCrG) >> 8; + output[outPtr1++] = (multY + multCbB) >> 8; + outPtr1++; + + multY = (298 * bytesY[Y1Ptr++]); + output[outPtr1++] = (multY + multCrR) >> 8; + output[outPtr1++] = (multY - multCbCrG) >> 8; + output[outPtr1++] = (multY + multCbB) >> 8; + outPtr1++; + } + outPtr0 += outStride; + outPtr1 += outStride; + ydec++; + } + } else { + outPtr = 0; + for (y = 0; y < height; y++) { + xdec = 0; + ydec = y >> vdec; + YPtr = y * strideY; + CbPtr = ydec * strideCb; + CrPtr = ydec * strideCr; + + for (x = 0; x < width; x++) { + xdec = x >> hdec; + colorCb = bytesCb[CbPtr + xdec]; + colorCr = bytesCr[CrPtr + xdec]; + + // Quickie YUV conversion + // https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion + // multiplied by 256 for integer-friendliness + multCrR = (409 * colorCr) - 57088; + multCbCrG = (100 * colorCb) + (208 * colorCr) - 34816; + multCbB = (516 * colorCb) - 70912; + + multY = 298 * bytesY[YPtr++]; + output[outPtr++] = (multY + multCrR) >> 8; + output[outPtr++] = (multY - multCbCrG) >> 8; + output[outPtr++] = (multY + multCbB) >> 8; + outPtr++; + } + } + } + } + + module.exports = { + convertYCbCr: convertYCbCr + }; + })(); + + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + + /* + Copyright (c) 2014-2016 Brion Vibber + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + (function() { + "use strict"; + + /** + * Convert a ratio into a bit-shift count; for instance a ratio of 2 + * becomes a bit-shift of 1, while a ratio of 1 is a bit-shift of 0. + * + * @author Brion Vibber + * @copyright 2016 + * @license MIT-style + * + * @param {number} ratio - the integer ratio to convert. + * @returns {number} - number of bits to shift to multiply/divide by the ratio. + * @throws exception if given a non-power-of-two + */ + function depower(ratio) { + var shiftCount = 0, + n = ratio >> 1; + while (n != 0) { + n = n >> 1; + shiftCount++ + } + if (ratio !== (1 << shiftCount)) { + throw 'chroma plane dimensions must be power of 2 ratio to luma plane dimensions; got ' + ratio; + } + return shiftCount; + } + + module.exports = depower; + })(); + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + Copyright (c) 2014-2016 Brion Vibber + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + (function() { + "use strict"; + + var FrameSink = __webpack_require__(13), + shaders = __webpack_require__(18); + + /** + * Warning: canvas must not have been used for 2d drawing prior! + * + * @param {HTMLCanvasElement} canvas - HTML canvas element to attach to + * @constructor + */ + function WebGLFrameSink(canvas) { + var self = this, + gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'), + debug = false; // swap this to enable more error checks, which can slow down rendering + + if (gl === null) { + throw new Error('WebGL unavailable'); + } + + // GL! + function checkError() { + if (debug) { + err = gl.getError(); + if (err !== 0) { + throw new Error("GL error " + err); + } + } + } + + function compileShader(type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + var err = gl.getShaderInfoLog(shader); + gl.deleteShader(shader); + throw new Error('GL shader compilation for ' + type + ' failed: ' + err); + } + + return shader; + } + + + var vertexShader, + fragmentShader, + program, + buf, + err; + + // In the world of GL there are no rectangles. + // There are only triangles. + // THERE IS NO SPOON. + var rectangle = new Float32Array([ + // First triangle (top left, clockwise) + -1.0, -1.0, + +1.0, -1.0, + -1.0, +1.0, + + // Second triangle (bottom right, clockwise) + -1.0, +1.0, + +1.0, -1.0, + +1.0, +1.0 + ]); + + var textures = {}; + function attachTexture(name, register, index, width, height, data) { + var texture, + texWidth = WebGLFrameSink.stripe ? (width / 4) : width, + format = WebGLFrameSink.stripe ? gl.RGBA : gl.LUMINANCE, + filter = WebGLFrameSink.stripe ? gl.NEAREST : gl.LINEAR; + + if (textures[name]) { + // Reuse & update the existing texture + texture = textures[name]; + } else { + textures[name] = texture = gl.createTexture(); + checkError(); + + gl.uniform1i(gl.getUniformLocation(program, name), index); + checkError(); + } + gl.activeTexture(register); + checkError(); + gl.bindTexture(gl.TEXTURE_2D, texture); + checkError(); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + checkError(); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + checkError(); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + checkError(); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + checkError(); + + gl.texImage2D( + gl.TEXTURE_2D, + 0, // mip level + format, // internal format + texWidth, + height, + 0, // border + format, // format + gl.UNSIGNED_BYTE, //type + data // data! + ); + checkError(); + + return texture; + } + + function buildStripe(width, height) { + var len = width * height, + out = new Uint32Array(len); + for (var i = 0; i < len; i += 4) { + out[i ] = 0x000000ff; + out[i + 1] = 0x0000ff00; + out[i + 2] = 0x00ff0000; + out[i + 3] = 0xff000000; + } + return new Uint8Array(out.buffer); + } + + function init(buffer) { + vertexShader = compileShader(gl.VERTEX_SHADER, shaders.vertex); + if (WebGLFrameSink.stripe) { + fragmentShader = compileShader(gl.FRAGMENT_SHADER, shaders.fragmentStripe); + } else { + fragmentShader = compileShader(gl.FRAGMENT_SHADER, shaders.fragment); + } + + program = gl.createProgram(); + gl.attachShader(program, vertexShader); + checkError(); + + gl.attachShader(program, fragmentShader); + checkError(); + + gl.linkProgram(program); + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + var err = gl.getProgramInfoLog(program); + gl.deleteProgram(program); + throw new Error('GL program linking failed: ' + err); + } + + gl.useProgram(program); + checkError(); + + if (WebGLFrameSink.stripe) { + attachTexture( + 'uStripeLuma', + gl.TEXTURE3, + 3, + buffer.y.stride * 4, + buffer.format.height, + buildStripe(buffer.y.stride, buffer.format.height) + ); + checkError(); + + attachTexture( + 'uStripeChroma', + gl.TEXTURE4, + 4, + buffer.u.stride * 4, + buffer.format.chromaHeight, + buildStripe(buffer.u.stride, buffer.format.chromaHeight) + ); + checkError(); + } + } + + /** + * Actually draw a frame. + * @param {YUVFrame} buffer - YUV frame buffer object + */ + self.drawFrame = function(buffer) { + var format = buffer.format; + + if (canvas.width !== format.displayWidth || canvas.height !== format.displayHeight) { + // Keep the canvas at the right size... + canvas.width = format.displayWidth; + canvas.height = format.displayHeight; + self.clear(); + } + + if (!program) { + init(buffer); + } + + // Set up the rectangle and draw it + + // + // Set up geometry + // + + buf = gl.createBuffer(); + checkError(); + + gl.bindBuffer(gl.ARRAY_BUFFER, buf); + checkError(); + + gl.bufferData(gl.ARRAY_BUFFER, rectangle, gl.STATIC_DRAW); + checkError(); + + var positionLocation = gl.getAttribLocation(program, 'aPosition'); + checkError(); + + gl.enableVertexAttribArray(positionLocation); + checkError(); + + gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0); + checkError(); + + + // Set up the texture geometry... + function setupTexturePosition(varname, texWidth) { + // Warning: assumes that the stride for Cb and Cr is the same size in output pixels + var textureX0 = format.cropLeft / texWidth; + var textureX1 = (format.cropLeft + format.cropWidth) / texWidth; + var textureY0 = (format.cropTop + format.cropHeight) / format.height; + var textureY1 = format.cropTop / format.height; + var textureRectangle = new Float32Array([ + textureX0, textureY0, + textureX1, textureY0, + textureX0, textureY1, + textureX0, textureY1, + textureX1, textureY0, + textureX1, textureY1 + ]); + + var texturePositionBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, texturePositionBuffer); + checkError(); + + gl.bufferData(gl.ARRAY_BUFFER, textureRectangle, gl.STATIC_DRAW); + checkError(); + + var texturePositionLocation = gl.getAttribLocation(program, varname); + checkError(); + + gl.enableVertexAttribArray(texturePositionLocation); + checkError(); + + gl.vertexAttribPointer(texturePositionLocation, 2, gl.FLOAT, false, 0, 0); + checkError(); + } + setupTexturePosition('aLumaPosition', buffer.y.stride); + setupTexturePosition('aChromaPosition', buffer.u.stride * format.width / format.chromaWidth); + + // Create the textures... + var textureY = attachTexture( + 'uTextureY', + gl.TEXTURE0, + 0, + buffer.y.stride, + format.height, + buffer.y.bytes + ); + var textureCb = attachTexture( + 'uTextureCb', + gl.TEXTURE1, + 1, + buffer.u.stride, + format.chromaHeight, + buffer.u.bytes + ); + var textureCr = attachTexture( + 'uTextureCr', + gl.TEXTURE2, + 2, + buffer.v.stride, + format.chromaHeight, + buffer.v.bytes + ); + + // Aaaaand draw stuff. + gl.drawArrays(gl.TRIANGLES, 0, rectangle.length / 2); + checkError(); + }; + + self.clear = function() { + gl.viewport(0, 0, canvas.width, canvas.height); + gl.clearColor(0.0, 0.0, 0.0, 0.0); + gl.clear(gl.COLOR_BUFFER_BIT); + }; + + self.clear(); + + return self; + } + + // For Windows; luminance and alpha textures are ssllooww to upload, + // so we pack into RGBA and unpack in the shaders. + // + // This seems to affect all browsers on Windows, probably due to fun + // mismatches between GL and D3D. + WebGLFrameSink.stripe = (function() { + if (navigator.userAgent.indexOf('Windows') !== -1) { + return true; + } + return false; + })(); + + /** + * Static function to check if WebGL will be available with appropriate features. + * + * @returns {boolean} - true if available + */ + WebGLFrameSink.isAvailable = function() { + var canvas = document.createElement('canvas'), + gl; + canvas.width = 1; + canvas.height = 1; + var options = { + // Still dithering on whether to use this. + // Recommend avoiding it, as it's overly conservative + //failIfMajorPerformanceCaveat: true + }; + try { + gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options); + } catch (e) { + return false; + } + if (gl) { + var register = gl.TEXTURE0, + width = 4, + height = 4, + texture = gl.createTexture(), + data = new Uint8Array(width * height), + texWidth = WebGLFrameSink.stripe ? (width / 4) : width, + format = WebGLFrameSink.stripe ? gl.RGBA : gl.LUMINANCE, + filter = WebGLFrameSink.stripe ? gl.NEAREST : gl.LINEAR; + + gl.activeTexture(register); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + gl.texImage2D( + gl.TEXTURE_2D, + 0, // mip level + format, // internal format + texWidth, + height, + 0, // border + format, // format + gl.UNSIGNED_BYTE, //type + data // data! + ); + + var err = gl.getError(); + if (err) { + // Doesn't support luminance textures? + return false; + } else { + return true; + } + } else { + return false; + } + }; + + WebGLFrameSink.prototype = Object.create(FrameSink.prototype); + + module.exports = WebGLFrameSink; + })(); + + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + + module.exports = { + vertex: "attribute vec2 aPosition;\nattribute vec2 aLumaPosition;\nattribute vec2 aChromaPosition;\nvarying vec2 vLumaPosition;\nvarying vec2 vChromaPosition;\nvoid main() {\n gl_Position = vec4(aPosition, 0, 1);\n vLumaPosition = aLumaPosition;\n vChromaPosition = aChromaPosition;\n}\n", + fragment: "// inspired by https://github.com/mbebenita/Broadway/blob/master/Player/canvas.js\n\nprecision mediump float;\nuniform sampler2D uTextureY;\nuniform sampler2D uTextureCb;\nuniform sampler2D uTextureCr;\nvarying vec2 vLumaPosition;\nvarying vec2 vChromaPosition;\nvoid main() {\n // Y, Cb, and Cr planes are uploaded as LUMINANCE textures.\n float fY = texture2D(uTextureY, vLumaPosition).x;\n float fCb = texture2D(uTextureCb, vChromaPosition).x;\n float fCr = texture2D(uTextureCr, vChromaPosition).x;\n\n // Premultipy the Y...\n float fYmul = fY * 1.1643828125;\n\n // And convert that to RGB!\n gl_FragColor = vec4(\n fYmul + 1.59602734375 * fCr - 0.87078515625,\n fYmul - 0.39176171875 * fCb - 0.81296875 * fCr + 0.52959375,\n fYmul + 2.017234375 * fCb - 1.081390625,\n 1\n );\n}\n", + fragmentStripe: "// inspired by https://github.com/mbebenita/Broadway/blob/master/Player/canvas.js\n// extra 'stripe' texture fiddling to work around IE 11's poor performance on gl.LUMINANCE and gl.ALPHA textures\n\nprecision mediump float;\nuniform sampler2D uStripeLuma;\nuniform sampler2D uStripeChroma;\nuniform sampler2D uTextureY;\nuniform sampler2D uTextureCb;\nuniform sampler2D uTextureCr;\nvarying vec2 vLumaPosition;\nvarying vec2 vChromaPosition;\nvoid main() {\n // Y, Cb, and Cr planes are mapped into a pseudo-RGBA texture\n // so we can upload them without expanding the bytes on IE 11\n // which doesn\\'t allow LUMINANCE or ALPHA textures.\n // The stripe textures mark which channel to keep for each pixel.\n vec4 vStripeLuma = texture2D(uStripeLuma, vLumaPosition);\n vec4 vStripeChroma = texture2D(uStripeChroma, vChromaPosition);\n\n // Each texture extraction will contain the relevant value in one\n // channel only.\n vec4 vY = texture2D(uTextureY, vLumaPosition) * vStripeLuma;\n vec4 vCb = texture2D(uTextureCb, vChromaPosition) * vStripeChroma;\n vec4 vCr = texture2D(uTextureCr, vChromaPosition) * vStripeChroma;\n\n // Now assemble that into a YUV vector, and premultipy the Y...\n vec3 YUV = vec3(\n (vY.x + vY.y + vY.z + vY.w) * 1.1643828125,\n (vCb.x + vCb.y + vCb.z + vCb.w),\n (vCr.x + vCr.y + vCr.z + vCr.w)\n );\n // And convert that to RGB!\n gl_FragColor = vec4(\n YUV.x + 1.59602734375 * YUV.z - 0.87078515625,\n YUV.x - 0.39176171875 * YUV.y - 0.81296875 * YUV.z + 0.52959375,\n YUV.x + 2.017234375 * YUV.y - 1.081390625,\n 1\n );\n}\n" + }; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var EventEmitter = __webpack_require__(20); + var CachePool = __webpack_require__(21); + var Backend = __webpack_require__(24); + + /** + * @typedef {Object} StreamFileOptions + * @property {string} url - the URL to fetch + * @property {number} chunkSize - max size of each chunked HTTP request / readahead target + * @property {number} cacheSize - max amount of data to keep buffered in memory for seeks + */ + + /** + * Utility class for chunked streaming of large files via XMLHttpRequest. + * Provides an abstraction of a seekable input stream, backed by in-memory + * caching, and some convenient promise-based i/o methods. + * @param {StreamFileOptions} options + * @constructor + */ + + var StreamFile = function () { + function StreamFile(_ref) { + var _ref$url = _ref.url; + var url = _ref$url === undefined ? '' : _ref$url; + var _ref$chunkSize = _ref.chunkSize; + var chunkSize = _ref$chunkSize === undefined ? 1 * 1024 * 1024 : _ref$chunkSize; + var _ref$cacheSize = _ref.cacheSize; + var cacheSize = _ref$cacheSize === undefined ? 0 : _ref$cacheSize; + + _classCallCheck(this, StreamFile); + + // InputStream public API + this.length = -1; + this.loaded = false; + this.loading = false; + this.seekable = false; + this.buffering = false; + this.seeking = false; + + Object.defineProperties(this, { + /** + * Byte offset of the read head + */ + offset: { + get: function get() { + return this._cache.readOffset; + } + }, + + /** + * Is the read head at the end of the file? + */ + eof: { + get: function get() { + return this.length === this._cache.readOffset; + } + } + }); + + // StreamFile public API + this.url = url; + this.headers = {}; + + // Private + this._cache = new CachePool({ + cacheSize: cacheSize + }); + + this._backend = null; + this._cachever = 0; + this._chunkSize = chunkSize; + } + + /** + * Open the file, get metadata, and start buffering some data. + * On success, loaded will become true, headers may be filled out, + * and length may be available. + * + * @returns {Promise} + */ + + + _createClass(StreamFile, [{ + key: 'load', + value: function load() { + var _this = this; + + return new Promise(function (resolve, reject) { + if (_this.loading) { + throw new Error('cannot load when loading'); + } + if (_this.loaded) { + throw new Error('cannot load when loaded'); + } + _this.loading = true; + _this._openBackend().then(function (backend) { + // Save metadata from the first set... + // Beware this._backend may be null already, + // if the first segment was very short! + _this.seekable = backend.seekable; + _this.headers = backend.headers; + _this.length = backend.length; + _this.loaded = true; + _this.loading = false; + resolve(); + }).catch(function (err) { + if (err.name !== 'AbortError') { + _this.loading = false; + } + reject(err); + }); + }); + } + + /** + * Create a backend and wait for it to load. + * The returned 'backend' object may be null if there is no data to read. + * + * @returns {Promise} + */ + + }, { + key: '_openBackend', + value: function _openBackend() { + var _this2 = this; + + return new Promise(function (resolve, reject) { + if (_this2._backend) { + resolve(_this2._backend); + } else if (_this2.eof) { + reject(new Error('cannot open at end of file')); + } else { + var cache = _this2._cache; + var max = _this2._chunkSize; + + // Seek forward to the next unread point, up to chunk size + var readable = cache.bytesReadable(max); + var readTail = cache.readOffset + readable; + cache.seekWrite(readTail); + + // Did we already cache the entire file? + if (_this2.length >= 0 && readTail >= _this2.length) { + resolve(null); + return; + } + + // Do we have space to write within that chunk? + var writable = cache.bytesWritable(max); + if (writable === 0) { + // Nothing to read/write within the current readahead area. + resolve(null); + } else { + (function () { + var backend = _this2._backend = new Backend({ + url: _this2.url, + offset: _this2._cache.writeOffset, + length: writable, + cachever: _this2._cachever + }); + + var oncomplete = null; + + var checkOpen = function checkOpen() { + if (backend !== _this2._backend) { + oncomplete(); + reject(new Error('invalid state')); + } else { + backend.on('buffer', function (buffer) { + if (backend === _this2._backend) { + _this2._cache.write(buffer); + } + }); + backend.on('done', function () { + if (backend === _this2._backend) { + if (_this2.length === -1) { + // save length on those final thingies + _this2.length = _this2._backend.offset + _this2._backend.bytesRead; + } + _this2._backend = null; + } + }); + resolve(backend); + } + }; + + var checkError = function checkError(err) { + if (backend !== _this2._backend) { + reject(new Error('invalid state')); + } else { + _this2._backend = null; + reject(err); + } + }; + + oncomplete = function oncomplete() { + backend.off('open', checkOpen); + backend.off('error', checkError); + }; + backend.on('open', checkOpen); + backend.on('error', checkError); + backend.on('cachever', function () { + _this2._cachever++; + }); + + backend.load(); + })(); + } + } + }); + } + + /** + * If we have empty space within the readahead area and there is not already + * a download backend in place, create one and start it loading in background. + * @returns {Promise} + */ + + }, { + key: '_readAhead', + value: function _readAhead() { + var _this3 = this; + + return new Promise(function (resolve, reject) { + if (_this3._backend || _this3.eof) { + // do nothing + resolve(); + } else { + _this3._openBackend().then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } + }); + } + + /** + * Seek the read position to a new location in the file, asynchronously. + * After succesful completion, reads will continue at the new offset. + * May fail due to network problems, invalid input, or bad state. + * @param {number} offset - target byte offset from beginning of file + * @returns {Promise} - resolved when ready to read at the new position + */ + + }, { + key: 'seek', + value: function seek(offset) { + var _this4 = this; + + return new Promise(function (resolve, reject) { + if (!_this4.loaded || _this4.buffering || _this4.seeking) { + throw new Error('invalid state'); + } else if (offset !== (offset | 0) || offset < 0) { + throw new Error('invalid input'); + } else if (_this4.length >= 0 && offset > _this4.length) { + throw new Error('seek past end of file'); + } else if (!_this4.seekable) { + throw new Error('seek on non-seekable stream'); + } else { + if (_this4._backend) { + // @todo if a short seek forward, just keep reading? + _this4.abort(); + } + _this4._cache.seekRead(offset); + _this4._cache.seekWrite(offset); + + // Fire off a download if necessary. + _this4._readAhead().then(resolve).catch(reject); + } + }); + } + + /** + * Read up to the requested number of bytes, or until end of file is reached, + * and advance the read head. + * + * May wait on network activity if data is not yet available. + * + * @param {number} nbytes - max number of bytes to read + * @returns {ArrayBuffer} - between 0 and nbytes of data, inclusive + */ + + }, { + key: 'read', + value: function read(nbytes) { + var _this5 = this; + + return this.buffer(nbytes).then(function (available) { + return _this5.readSync(available); + }); + } + + /** + * Read up to the requested number of bytes, or however much is available + * in the buffer until the next empty segment, and advance the read head. + * + * Returns immediately. + * + * @param {number} nbytes - max number of bytes to read + * @returns {ArrayBuffer} - between 0 and nbytes of data, inclusive + */ + + }, { + key: 'readSync', + value: function readSync(nbytes) { + var available = this.bytesAvailable(nbytes); + var dest = new Uint8Array(available); + var actual = this.readBytes(dest); + if (actual !== available) { + throw new Error('failed to read expected data'); + } + return dest.buffer; + } + + /** + * Read bytes into destination array until out of buffer or space, + * and advance the read head. + * + * Returns immediately. + * + * @param {dest} Uint8Array - destination byte array + * @returns {number} - count of actual bytes read + */ + + }, { + key: 'readBytes', + value: function readBytes(dest) { + if (!this.loaded || this.buffering || this.seeking) { + throw new Error('invalid state'); + } else if (!(dest instanceof Uint8Array)) { + throw new Error('invalid input'); + } + var nbytes = this._cache.readBytes(dest); + + // Trigger readahead if necessary. + this._readAhead(); + + return nbytes; + } + + /** + * Wait until the given number of bytes are available to read, or end of file. + * @param {number} nbytes - max bytes to wait for + * @returns {Promise} - resolved with available byte count when ready + */ + + }, { + key: 'buffer', + value: function buffer(nbytes) { + var _this6 = this; + + return new Promise(function (resolve, reject) { + if (!_this6.loaded || _this6.buffering || _this6.seeking) { + throw new Error('invalid state'); + } else if (nbytes !== (nbytes | 0) || nbytes < 0) { + throw new Error('invalid input'); + } + var end = _this6._clampToLength(_this6.offset + nbytes); + var readable = end - _this6.offset; + + var canceled = false; + + var available = _this6.bytesAvailable(readable); + if (available >= readable) { + // Requested data is immediately available. + resolve(available); + } else { + _this6.buffering = true; + + // If we don't already have a backend open, start downloading. + _this6._openBackend().then(function (backend) { + if (backend) { + return backend.bufferToOffset(end).then(function () { + // We might have to roll over to another download, + // so loop back around! + _this6.buffering = false; + return _this6.buffer(nbytes); + }); + } else { + // No more data to read. + return Promise.resolve(available); + } + }).then(function (available) { + _this6.buffering = false; + resolve(available); + }).catch(function (err) { + if (err.name !== 'AbortError') { + // was already set synchronously; avoid stomping on old promise + _this6.buffering = false; + } + reject(err); + }); + } + }); + } + + /** + * Number of bytes available to read immediately from the current offset. + * This is the max number of bytes that can be returned from a read() call. + * @returns {boolean} + */ + + }, { + key: 'bytesAvailable', + value: function bytesAvailable() { + var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; + + return this._cache.bytesReadable(max); + } + + /** + * Abort any currently running downloads and operations. + */ + + }, { + key: 'abort', + value: function abort() { + // Clear state synchronously, so can immediately launch new i/o... + if (this.loading) { + this.loading = false; + } + if (this.buffering) { + this.buffering = false; + } + if (this.seeking) { + this.seeking = false; + } + + // Abort any active backend request... + if (this._backend) { + this._backend.abort(); + this._backend = null; + } + } + + /** + * Return an array of byte ranges that are buffered. + * Each range is a two-element array of start and end. + * @returns {Array>} + */ + + }, { + key: 'getBufferedRanges', + value: function getBufferedRanges() { + return this._cache.ranges(); + } + + // ------ + // private methods + // ------ + + }, { + key: '_clampToLength', + value: function _clampToLength(offset) { + if (this.length < 0) { + return offset; + } else { + return Math.min(this.length, offset); + } + } + }]); + + return StreamFile; + }(); + + module.exports = StreamFile; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + "use strict"; + + // just the bits we need + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var TinyEvents = function () { + function TinyEvents() { + _classCallCheck(this, TinyEvents); + + this._e = {}; + } + + _createClass(TinyEvents, [{ + key: "on", + value: function on(name, handler) { + (this._e[name] || (this._e[name] = [])).push(handler); + } + }, { + key: "off", + value: function off(name, handler) { + var l = this._e[name] || []; + var i = l.indexOf(handler); + if (handler >= 0) { + l.splice(i, 1); + } + } + }, { + key: "emit", + value: function emit(name, arg) { + (this._e[name] || []).slice().forEach(function (f) { + return f(arg); + }); + } + }]); + + return TinyEvents; + }(); + + module.exports = TinyEvents; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + module.exports = __webpack_require__(22); + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var CacheItem = __webpack_require__(23); + + /** + * Seekable, readable, writable buffer cache to represent a file. + * @todo add max cache size and LRU cache expiration + * + * Internally, will always contain entries from 0 to some given out point. + * Each item may either contain data, or be empty. + * Empty ranges cannot be copied out via read(), non-empty ranges can. + * Empty ranges can be filled up with write(), non-empty ranges cannot. + * + * Internal invariants: + * - head and tail are always present, may be same for empty + * - tail item is always empty/eof + * - non-empty items are never 0 bytes + * - adjacent list items are always continguous + * - empty items are never adjacent to each other + */ + + var CachePool = function () { + function CachePool() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var _ref$cacheSize = _ref.cacheSize; + var cacheSize = _ref$cacheSize === undefined ? 0 : _ref$cacheSize; + + _classCallCheck(this, CachePool); + + var eof = new CacheItem({ eof: true }); + this.head = eof; + this.tail = eof; + this.readOffset = 0; + this.readCursor = eof; + this.writeOffset = 0; + this.writeCursor = eof; + this.cacheSize = cacheSize; + } + + /** + * Is the read cursor at the end of the file? + */ + + + _createClass(CachePool, [{ + key: 'bytesReadable', + + + /** + * Count how many bytes are available from the given offset. + * @param {number} max - optional maximum to read + * @returns {number} 0 or more + */ + value: function bytesReadable() { + var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; + + var offset = this.readOffset; + var cursor = this.readCursor; + var last = cursor.last(function (item) { + return !item.empty && item.start <= offset + max; + }); + if (last) { + return Math.min(max, last.end - offset); + } + return 0; + } + + /** + * Count how many bytes are available to write. + * @param {number} max - optional maximum to write + * @returns {number} 0 or more, or +Infinity + */ + + }, { + key: 'bytesWritable', + value: function bytesWritable() { + var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; + + var offset = this.writeOffset; + var cursor = this.writeCursor; + if (cursor.eof) { + return max; + } + var last = cursor.last(function (item) { + return item.empty && item.start <= offset + max; + }); + if (last) { + return Math.min(max, last.end - offset); + } + return 0; + } + + /** + * Move the read head to a given offset. The read head can move beyond the + * currently known end of the file, but cannot move before 0. + * @param {number} offset - bytes from beginning of virtual file to read from + */ + + }, { + key: 'seekRead', + value: function seekRead(offset) { + var target = this.head.first(function (item) { + return item.contains(offset); + }); + if (!target) { + throw new Error('read seek out of range'); + } + this.readOffset = offset; + this.readCursor = target; + } + + /** + * Move the write head to a given offset. The write head can move beyond the + * currently known end of the file, but cannot move before 0. + * @param {number} offset - bytes from beginning of virtual file to write to + */ + + }, { + key: 'seekWrite', + value: function seekWrite(offset) { + var target = this.head.first(function (item) { + return item.contains(offset); + }); + if (!target) { + throw new Error('write seek out of range'); + } + this.writeOffset = offset; + this.writeCursor = target; + } + + /** + * Read up to the requested number of bytes, or however much is available + * in the buffer until the next empty segment, and advance the read head. + * + * Returns immediately. + * + * @param {Uint8Array} dest - destination array to read to + * @returns {number} - count of bytes actually read + */ + + }, { + key: 'readBytes', + value: function readBytes(dest) { + var nbytes = dest.byteLength; + var len = this.bytesReadable(nbytes); + var start = this.readOffset; + var end = start + len; + + var readHead = start; + var writeHead = 0; + for (var item = this.readCursor; item; item = item.next) { + if (item.empty) { + break; + } + if (item.start >= end) { + break; + } + var readTail = Math.min(end, item.end); + var chunk = dest.subarray(readHead - start, readTail - start); + item.readBytes(chunk, readHead, readTail); + readHead = readTail; + } + this.readOffset = readHead; + this.readCursor = this.readCursor.first(function (item) { + return item.contains(readHead); + }); + + return len; + } + + /** + * Write a data buffer at the write head and advance the write head. + * The data must fit in the available empty space in the buffer cache. + * @param {ArrayBuffer|String} buffer + */ + + }, { + key: 'write', + value: function write(buffer) { + var item = this.bufferItem(buffer); + var cursor = this.writeCursor; + + if (!cursor.empty) { + throw new Error('write cursor not empty'); + } + if (!cursor.contains(item.end) && cursor.end !== item.end) { + throw new Error('write cursor too small'); + } + + if (cursor.start < item.start) { + this.split(cursor, item.start); + cursor = this.writeCursor; + } + + if (item.end < cursor.end || cursor.eof) { + this.split(cursor, item.end); + cursor = this.writeCursor; + } + + this.splice(cursor, cursor, item, item); + this.writeOffset = item.end; + this.writeCursor = item.next; + + this.gc(); + } + }, { + key: 'bufferItem', + value: function bufferItem(buffer) { + if (buffer instanceof ArrayBuffer) { + return new CacheItem({ + start: this.writeOffset, + end: this.writeOffset + buffer.byteLength, + buffer: buffer + }); + } else if (typeof buffer === 'string') { + return new CacheItem({ + start: this.writeOffset, + end: this.writeOffset + buffer.length, + string: buffer + }); + } else { + throw new Error('invalid input to write'); + } + } + }, { + key: 'split', + value: function split(oldItem, offset) { + var items = oldItem.split(offset); + this.splice(oldItem, oldItem, items[0], items[1]); + } + + /** + * Return an array of arrays of consolidated cached ranges + */ + + }, { + key: 'ranges', + value: function ranges() { + var ranges = []; + + for (var item = this.head; item; item = item.next) { + if (item.empty) { + continue; + } + var start = item; + item = item.last(function (i) { + return !i.empty; + }); + ranges.push([start.start, item.end]); + } + + return ranges; + } + }, { + key: 'gc', + value: function gc() { + // Simple gc: look at anything not between read head and write head, + // and discard the oldest items until we have room + var cachedBytes = 0; + var candidates = []; + for (var item = this.head; item; item = item.next) { + if (!item.empty) { + cachedBytes += item.length; + if (item.end < this.readOffset || item.start > this.readOffset + this.chunkSize) { + // Not in the 'hot' readahead range + candidates.push(item); + } + } + } + if (cachedBytes > this.cacheSize) { + candidates.sort(function (a, b) { + return a.timestamp - b.timestamp; + }); + + for (var i = 0; i < candidates.length; i++) { + var _item = candidates[i]; + if (cachedBytes <= this.cacheSize) { + break; + } + this.remove(_item); + cachedBytes -= _item.length; + } + } + } + }, { + key: 'remove', + value: function remove(item) { + var replacement = new CacheItem({ + start: item.start, + end: item.end + }); + this.splice(item, item, replacement, replacement); + item = replacement; + + // Consolidate adjacent ranges + if (item.prev && item.prev.empty) { + item = this.consolidate(item.prev); + } + if (item.next && item.next.empty && !item.next.eof) { + item = this.consolidate(item); + } + if (item.start === 0) { + this.head = item; + } + } + }, { + key: 'consolidate', + value: function consolidate(first) { + var last = first.last(function (item) { + return item.empty && !item.eof; + }); + var replacement = new CacheItem({ + start: first.start, + end: last.end + }); + this.splice(first, last, replacement, replacement); + return replacement; + } + }, { + key: 'splice', + value: function splice(oldHead, oldTail, newHead, newTail) { + var _this = this; + + if (oldHead.start !== newHead.start) { + throw new Error('invalid splice head'); + } + if (oldTail.end !== newTail.end) { + if (oldTail.eof && newTail.eof) { + // only eof is expandable + } else { + throw new Error('invalid splice tail'); + } + } + var prev = oldHead.prev; + var next = oldTail.next; + + oldHead.prev = null; + oldTail.next = null; + + if (prev) { + prev.next = newHead; + newHead.prev = prev; + } + if (next) { + next.prev = newTail; + newTail.next = next; + } + + if (oldHead === this.head) { + this.head = newHead; + } + if (oldTail === this.tail) { + this.tail = newTail; + } + this.readCursor = this.head.first(function (item) { + return item.contains(_this.readOffset); + }); + this.writeCursor = this.head.first(function (item) { + return item.contains(_this.writeOffset); + }); + } + }, { + key: 'eof', + get: function get() { + return this.readCursor.eof; + } + }]); + + return CachePool; + }(); + + module.exports = CachePool; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Double-linked list cache items + */ + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var CacheItem = function () { + function CacheItem() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + var _ref$buffer = _ref.buffer; + var buffer = _ref$buffer === undefined ? undefined : _ref$buffer; + var _ref$string = _ref.string; + var string = _ref$string === undefined ? undefined : _ref$string; + var _ref$start = _ref.start; + var start = _ref$start === undefined ? 0 : _ref$start; + var _ref$end = _ref.end; + var end = _ref$end === undefined ? start + (buffer ? buffer.byteLength : string ? string.length : 0) : _ref$end; + var _ref$prev = _ref.prev; + var prev = _ref$prev === undefined ? null : _ref$prev; + var _ref$next = _ref.next; + var next = _ref$next === undefined ? null : _ref$next; + var _ref$eof = _ref.eof; + var eof = _ref$eof === undefined ? false : _ref$eof; + var _ref$empty = _ref.empty; + var empty = _ref$empty === undefined ? !(buffer || string) : _ref$empty; + var _ref$timestamp = _ref.timestamp; + var timestamp = _ref$timestamp === undefined ? Date.now() : _ref$timestamp; + + _classCallCheck(this, CacheItem); + + this.start = start; + this.end = end; + this.prev = prev; + this.next = next; + this.eof = eof; + this.empty = empty; + this.timestamp = timestamp; + this.buffer = buffer; + this.string = string; + Object.defineProperty(this, 'length', { + get: function get() { + return this.end - this.start; + } + }); + } + + /** + * True if this cache item contains the given byte offset. + * False if outside. + */ + + + _createClass(CacheItem, [{ + key: 'contains', + value: function contains(offset) { + return offset >= this.start && (offset < this.end || this.eof); + } + }, { + key: 'readBytes', + value: function readBytes(dest, start, end) { + var readHead = start - this.start; + var len = end - start; + if (this.buffer) { + var sourceBytes = new Uint8Array(this.buffer, readHead, len); + dest.set(sourceBytes); + } else if (this.string) { + var chunk = this.string; + for (var i = 0; i < len; i++) { + dest[i] = chunk.charCodeAt(readHead + i); + } + } else { + throw new Error('invalid state'); + } + this.timestamp = Date.now(); + } + }, { + key: 'split', + value: function split(offset) { + if (!this.empty || !this.contains(offset)) { + throw new Error('invalid split'); + } + var a = new CacheItem({ + start: this.start, + end: offset + }); + var b = new CacheItem({ + start: offset, + end: this.eof ? offset : this.end, + eof: this.eof + }); + a.next = b; + b.prev = a; + return [a, b]; + } + + /** + * Iterate forwards, returning the first element matching the callback. + * @param {function} callback - return true for a match on item + * @returns {CacheItem|null} - matching item or null if none found + */ + + }, { + key: 'first', + value: function first(callback) { + for (var item = this; item; item = item.next) { + if (callback(item)) { + return item; + } + } + return null; + } + + /** + * Iterate forwards, returning the last element matching the callback before + * reaching one that doesn't match or we find the end. + * @param {function} callback - return true for a match on item + * @returns {CacheItem|null} - matching item or null if none found + */ + + }, { + key: 'last', + value: function last(callback) { + var last = null; + for (var item = this; item; item = item.next) { + if (!callback(item)) { + break; + } + last = item; + } + return last; + } + }]); + + return CacheItem; + }(); + + module.exports = CacheItem; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var MozChunkedBackend = __webpack_require__(25); + var MSStreamBackend = __webpack_require__(28); + var BinaryStringBackend = __webpack_require__(29); + + function autoselect() { + if (MozChunkedBackend.supported()) { + return MozChunkedBackend; + } else if (BinaryStringBackend.supported()) { + return BinaryStringBackend; + } else if (MSStreamBackend.supported()) { + return MSStreamBackend; + } else { + return null; + } + } + + var backendClass = null; + + function instantiate(options) { + if (!backendClass) { + backendClass = autoselect(); + } + if (!backendClass) { + throw new Error('No supported backend class'); + } + return new backendClass(options); + } + + module.exports = instantiate; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var DownloadBackend = __webpack_require__(26); + + var type = 'moz-chunked-arraybuffer'; + + var MozChunkedBackend = function (_DownloadBackend) { + _inherits(MozChunkedBackend, _DownloadBackend); + + function MozChunkedBackend() { + _classCallCheck(this, MozChunkedBackend); + + return _possibleConstructorReturn(this, (MozChunkedBackend.__proto__ || Object.getPrototypeOf(MozChunkedBackend)).apply(this, arguments)); + } + + _createClass(MozChunkedBackend, [{ + key: 'initXHR', + value: function initXHR() { + _get(MozChunkedBackend.prototype.__proto__ || Object.getPrototypeOf(MozChunkedBackend.prototype), 'initXHR', this).call(this); + this.xhr.responseType = type; + } + }, { + key: 'onXHRProgress', + value: function onXHRProgress() { + var buffer = this.xhr.response; + this.bytesRead += buffer.byteLength; + this.emit('buffer', buffer); + } + }]); + + return MozChunkedBackend; + }(DownloadBackend); + + MozChunkedBackend.supported = function () { + try { + var xhr = new XMLHttpRequest(); + xhr.responseType = type; + return xhr.responseType === type; + } catch (e) { + return false; + } + }; + + module.exports = MozChunkedBackend; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Backend = __webpack_require__(27); + + /** + * Backend for progressive downloading. + * Subclasses handle details of strings/buffers. + */ + + var DownloadBackend = function (_Backend) { + _inherits(DownloadBackend, _Backend); + + function DownloadBackend() { + _classCallCheck(this, DownloadBackend); + + return _possibleConstructorReturn(this, (DownloadBackend.__proto__ || Object.getPrototypeOf(DownloadBackend)).apply(this, arguments)); + } + + _createClass(DownloadBackend, [{ + key: 'bufferToOffset', + value: function bufferToOffset(end) { + var _this2 = this; + + return new Promise(function (resolve, reject) { + if (_this2.eof || _this2.offset >= end) { + resolve(); + } else { + (function () { + var oncomplete = null; + _this2._onAbort = function (err) { + oncomplete(); + reject(reason); + }; + + var checkBuffer = function checkBuffer() { + if (_this2.offset >= end && !_this2.eof) { + oncomplete(); + resolve(); + } + }; + var checkDone = function checkDone() { + oncomplete(); + resolve(); + }; + var checkError = function checkError() { + oncomplete(); + reject(new Error('error streaming')); + }; + + oncomplete = function oncomplete() { + _this2.buffering = false; + _this2.off('buffer', checkBuffer); + _this2.off('done', checkDone); + _this2.off('error', checkError); + _this2._onAbort = null; + }; + + _this2.buffering = true; + _this2.on('buffer', checkBuffer); + _this2.on('done', checkDone); + _this2.on('error', checkError); + })(); + } + }); + } + }, { + key: 'initXHR', + value: function initXHR() { + _get(DownloadBackend.prototype.__proto__ || Object.getPrototypeOf(DownloadBackend.prototype), 'initXHR', this).call(this); + } + }, { + key: 'onXHRStart', + value: function onXHRStart() { + var _this3 = this; + + // Event handlers to drive output + this.xhr.addEventListener('progress', function () { + return _this3.onXHRProgress(); + }); + this.xhr.addEventListener('error', function () { + return _this3.onXHRError(); + }); + this.xhr.addEventListener('load', function () { + return _this3.onXHRLoad(); + }); + + this.emit('open'); + } + }, { + key: 'onXHRProgress', + value: function onXHRProgress() { + throw new Error('abstract'); + } + }, { + key: 'onXHRError', + value: function onXHRError() { + this.emit('error'); + } + }, { + key: 'onXHRLoad', + value: function onXHRLoad() { + this.eof = true; + this.emit('done'); + } + }]); + + return DownloadBackend; + }(Backend); + + module.exports = DownloadBackend; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var TinyEvents = __webpack_require__(20); + + /** + * Extract the file's total length from the XHR returned headers. + * @returns {number} - byte length or -1 + * @access private + */ + function getXHRLength(xhr) { + if (xhr.status == 206) { + return getXHRRangeTotal(xhr); + } else { + var contentLength = xhr.getResponseHeader('Content-Length'); + if (contentLength === null || contentLength === '') { + // Unknown file length... maybe streaming live? + return -1; + } else { + return parseInt(contentLength, 10); + } + } + } + + /** + * Extract the range chunk info from the XHR returned headers. + * @returns {Array} - byte length or -1 + * @access private + */ + function getXHRRangeMatches(xhr) { + // Note Content-Range must be whitelisted for CORS requests + var contentRange = xhr.getResponseHeader('Content-Range'); + return contentRange && contentRange.match(/^bytes (\d+)-(\d+)\/(\d+)/); + } + + /** + * Extract the chunk start position from the XHR returned headers. + * @returns {number} - byte position or 0 + * @access private + */ + function getXHRRangeStart(xhr) { + var matches = getXHRRangeMatches(xhr); + if (matches) { + return parseInt(matches[1], 10); + } else { + return 0; + } + } + + /** + * Extract the file's total length from the XHR returned headers. + * @returns {number} - byte length or -1 + * @access private + */ + function getXHRRangeTotal(xhr) { + var matches = getXHRRangeMatches(xhr); + if (matches) { + return parseInt(matches[3], 10); + } else { + return -1; + } + } + + /** + * Record the HTTP headers from the initial request, in case some are useful. + * @returns {Object} map of headers + * @access private + */ + function getXHRHeaders(xhr) { + var headers = {}; + var headerLines = xhr.getAllResponseHeaders().split(/\n/); + headerLines.forEach(function (line) { + var bits = line.split(/:\s*/, 2); + if (bits.length > 1) { + headers[bits[0].toLowerCase()] = bits[1]; + } + }); + return headers; + } + + /** + * Represents a single HTTP request pass through part of a URL. + * + * Subclasses handle details of chunking/strings/streams and provide + * a unified internal API. + * + * Events sent: + * - 'open' - called when file metadata ready + * - 'buffer' - passes a BufferSegment in with some new data + * - 'done' - called at end of file + * - 'error' - called in case of error + * - 'cachever' - triggered when old Safari caching bug found + */ + + var Backend = function (_TinyEvents) { + _inherits(Backend, _TinyEvents); + + function Backend(_ref) { + var url = _ref.url; + var offset = _ref.offset; + var length = _ref.length; + var _ref$cachever = _ref.cachever; + var cachever = _ref$cachever === undefined ? 0 : _ref$cachever; + + _classCallCheck(this, Backend); + + var _this = _possibleConstructorReturn(this, (Backend.__proto__ || Object.getPrototypeOf(Backend)).call(this)); + + _this.url = url; + _this.offset = offset; + _this.length = length; + _this.cachever = cachever; + + _this.loaded = false; + _this.seekable = false; + _this.headers = {}; + _this.eof = false; + _this.bytesRead = 0; + _this.xhr = new XMLHttpRequest(); + return _this; + } + + _createClass(Backend, [{ + key: 'load', + value: function load() { + var _this2 = this; + + return new Promise(function (resolve, reject) { + var oncomplete = null; + _this2._onAbort = function (err) { + oncomplete(); + reject(err); + }; + var checkOpen = function checkOpen() { + // There doesn't seem to be a good match for readyState 2 on the XHR2 events model. + if (_this2.xhr.readyState == 2) { + if (_this2.xhr.status == 206) { + // Partial content -- we are streamable + var foundPosition = getXHRRangeStart(_this2.xhr); + if (_this2.offset != foundPosition) { + // + // Safari sometimes messes up and gives us the wrong chunk. + // Seems to be a general problem with Safari and cached XHR ranges. + // + // Interestingly, it allows you to request _later_ ranges successfully, + // but when requesting _earlier_ ranges it returns the latest one retrieved. + // So we only need to update the cache-buster when we rewind and actually + // get an incorrect range. + // + // https://bugs.webkit.org/show_bug.cgi?id=82672 + // + console.log('Expected start at ' + _this2.offset + ' but got ' + foundPosition + '; working around Safari range caching bug: https://bugs.webkit.org/show_bug.cgi?id=82672'); + _this2.cachever++; + _this2.emit('cachever'); + _this2.abort(); + oncomplete(); + _this2.load().then(resolve).catch(reject); + return; + } + _this2.seekable = true; + } + if (_this2.xhr.status >= 200 && _this2.xhr.status < 300) { + _this2.length = getXHRLength(_this2.xhr); + _this2.headers = getXHRHeaders(_this2.xhr); + _this2.onXHRStart(); + + if (_this2.xhr.responseURL && + _this2.xhr.responseURL.substr(0, 5) == 'data:') { + _this2.seekable = true; + } + } else { + oncomplete(); + reject(new Error('HTTP error ' + _this2.xhr.status)); + } + } + }; + var checkError = function checkError() { + oncomplete(); + reject(new Error('network error')); + }; + var checkBackendOpen = function checkBackendOpen() { + oncomplete(); + resolve(); + }; + oncomplete = function oncomplete() { + _this2.xhr.removeEventListener('readystatechange', checkOpen); + _this2.xhr.removeEventListener('error', checkError); + _this2.off('open', checkBackendOpen); + _this2._onAbort = null; + }; + + _this2.initXHR(); + + // Events for the open promise + _this2.xhr.addEventListener('readystatechange', checkOpen); + _this2.xhr.addEventListener('error', checkError); + _this2.on('open', checkBackendOpen); + + _this2.xhr.send(); + }); + } + + /** + * Wait until we download up to the given offset, reach eof, or error out. + * Actual data will be returned via 'buffer' events in the meantime. + * + * Note that MSStream backend will need this to be called explicitly, + * while the other backends download progressively even without a call. + */ + + }, { + key: 'bufferToOffset', + value: function bufferToOffset(end) { + return Promise.reject(new Error('abstract')); + } + }, { + key: 'abort', + value: function abort() { + this.xhr.abort(); + + if (this._onAbort) { + var onAbort = this._onAbort; + this._onAbort = null; + + var err = new Error('Aborted'); + err.name = 'AbortError'; + + onAbort(err); + } + } + + // --------------- + // Private methods + // --------------- + + }, { + key: 'initXHR', + value: function initXHR() { + var getUrl = this.url; + if (this.cachever) { + // + // Safari sometimes messes up and gives us the wrong chunk. + // Seems to be a general problem with Safari and cached XHR ranges. + // + // Interestingly, it allows you to request _later_ ranges successfully, + // but when requesting _earlier_ ranges it returns the latest one retrieved. + // So we only need to update the cache-buster when we rewind. + // + // https://bugs.webkit.org/show_bug.cgi?id=82672 + // + getUrl += '?buggy_cachever=' + this.cachever; + } + + this.xhr.open("GET", getUrl); + + var range = null; + if (this.offset || this.length) { + range = 'bytes=' + this.offset + '-'; + } + if (this.length) { + range += this.offset + this.length - 1; + } + if (range !== null) { + this.xhr.setRequestHeader('Range', range); + } + } + }, { + key: 'onXHRStart', + value: function onXHRStart() { + throw new Error('abstract'); + } + }]); + + return Backend; + }(TinyEvents); + + module.exports = Backend; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Backend = __webpack_require__(27); + + var type = 'ms-stream'; + + var MSStreamBackend = function (_Backend) { + _inherits(MSStreamBackend, _Backend); + + function MSStreamBackend(options) { + _classCallCheck(this, MSStreamBackend); + + var _this = _possibleConstructorReturn(this, (MSStreamBackend.__proto__ || Object.getPrototypeOf(MSStreamBackend)).call(this, options)); + + _this.stream = null; + _this.streamReader = null; + return _this; + } + + _createClass(MSStreamBackend, [{ + key: 'initXHR', + value: function initXHR() { + _get(MSStreamBackend.prototype.__proto__ || Object.getPrototypeOf(MSStreamBackend.prototype), 'initXHR', this).call(this); + this.xhr.responseType = type; + } + }, { + key: 'onXHRStart', + value: function onXHRStart() { + var _this2 = this; + + var checkProgress = function checkProgress() { + if (_this2.xhr.readyState === 3) { + // We don't get the stream until readyState 3, and it's gone after load. + _this2.stream = _this2.xhr.response; + _this2.xhr.removeEventListener('readystatechange', checkProgress); + _this2.emit('open'); + } + }; + this.xhr.addEventListener('readystatechange', checkProgress); + } + }, { + key: 'waitForStream', + value: function waitForStream() { + var _this3 = this; + + return new Promise(function (resolve, reject) { + if (_this3.stream) { + resolve(_this3.stream); + } else { + (function () { + var oncomplete = null; + _this3._onAbort = function (err) { + oncomplete(); + reject(err); + }; + var checkStart = function checkStart() { + resolve(_this3.stream); + }; + oncomplete = function oncomplete() { + _this3.off('open', checkStart); + _this3._onAbort = null; + }; + _this3.on('open', checkStart); + })(); + } + }); + } + + /** + * Trigger further download of bytes + * @returns {Promise} + */ + + }, { + key: 'bufferToOffset', + value: function bufferToOffset(end) { + var _this4 = this; + + return this.waitForStream().then(function (stream) { + return new Promise(function (resolve, reject) { + if (_this4.streamReader) { + throw new Error('cannot trigger read when reading'); + } + if (_this4.offset >= end || _this4.eof) { + resolve(); + } else { + var nbytes = end - _this4.offset; + _this4.streamReader = new MSStreamReader(); + _this4.streamReader.onload = function (event) { + _this4.streamReader = null; + var buffer = event.target.result; + if (buffer.byteLength > 0) { + _this4.bytesRead += buffer.byteLength; + _this4.emit('buffer', buffer); + } else { + // Zero length means end of stream. + _this4.eof = true; + _this4.emit('done'); + } + resolve(); + }; + _this4.streamReader.onerror = function () { + _this4.streamReader = null; + _this4.stream = null; + _this4.emit('error'); + reject(new Error('mystery error streaming')); + }; + _this4._onAbort = function (err) { + _this4.streamReader.abort(); + _this4.streamReader = null; + _this4.stream = null; + _this4.emit('error'); + reject(reason); + }; + _this4.streamReader.readAsArrayBuffer(stream, nbytes); + } + }); + }); + } + }, { + key: 'abort', + value: function abort() { + if (this.streamReader) { + this.streamReader.abort(); + this.streamReader = null; + } + if (this.stream) { + this.stream.msClose(); + this.stream = null; + } + _get(MSStreamBackend.prototype.__proto__ || Object.getPrototypeOf(MSStreamBackend.prototype), 'abort', this).call(this); + } + }]); + + return MSStreamBackend; + }(Backend); + + MSStreamBackend.supported = function () { + try { + var xhr = new XMLHttpRequest(); + // IE demands that open() be called before we can set xhr.responseType + xhr.open("GET", "/robots.txt"); + xhr.responseType = type; + return xhr.responseType === type; + } catch (e) { + return false; + } + }; + + module.exports = MSStreamBackend; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var DownloadBackend = __webpack_require__(26); + + var BinaryStringBackend = function (_DownloadBackend) { + _inherits(BinaryStringBackend, _DownloadBackend); + + function BinaryStringBackend() { + _classCallCheck(this, BinaryStringBackend); + + return _possibleConstructorReturn(this, (BinaryStringBackend.__proto__ || Object.getPrototypeOf(BinaryStringBackend)).apply(this, arguments)); + } + + _createClass(BinaryStringBackend, [{ + key: "initXHR", + value: function initXHR() { + _get(BinaryStringBackend.prototype.__proto__ || Object.getPrototypeOf(BinaryStringBackend.prototype), "initXHR", this).call(this); + this.xhr.responseType = "text"; + this.xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + }, { + key: "onXHRProgress", + value: function onXHRProgress() { + var slice = this.xhr.responseText.slice(this.bytesRead); + if (slice.length > 0) { + this.bytesRead += slice.length; + this.emit('buffer', slice); + } + } + }, { + key: "onXHRLoad", + value: function onXHRLoad() { + // We may or may not get that final event + this.onXHRProgress(); + _get(BinaryStringBackend.prototype.__proto__ || Object.getPrototypeOf(BinaryStringBackend.prototype), "onXHRLoad", this).call(this); + } + }]); + + return BinaryStringBackend; + }(DownloadBackend); + + BinaryStringBackend.supported = function () { + try { + var xhr = new XMLHttpRequest(); + return !!xhr.overrideMimeType; + } catch (e) { + return false; + } + }; + + module.exports = BinaryStringBackend; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + + (function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["AudioFeeder"] = factory(); + else + root["AudioFeeder"] = factory(); + })(this, function() { + return /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; + + /******/ // The require function + /******/ function __webpack_require__(moduleId) { + + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) + /******/ return installedModules[moduleId].exports; + + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ exports: {}, + /******/ id: moduleId, + /******/ loaded: false + /******/ }; + + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + + /******/ // Flag the module as loaded + /******/ module.loaded = true; + + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + + + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; + + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; + + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ""; + + /******/ // Load entry module and return exports + /******/ return __webpack_require__(0); + /******/ }) + /************************************************************************/ + /******/ ([ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + + (function() { + + var BufferQueue = __webpack_require__(1), + WebAudioBackend = __webpack_require__(2), + FlashBackend = __webpack_require__(4); + + + /** + * Audio sample buffer format passed to {@link AudioFeeder#bufferData} and its backends. + * + * Buffers are arrays containing one Float32Array of sample data + * per channel. Channel counts must match the expected value, and + * all channels within a buffer must have the same length in samples. + * + * Since input data may be stored for a while before being taken + * back out, be sure that your Float32Arrays for channel data are + * standalone, not backed on an ArrayBuffer that might change! + * + * @typedef {SampleBuffer} SampleBuffer + * @todo consider replacing this with AudioBuffer-like wrapper object + */ + + /** + * Object dictionary format used to pass options into {@link AudioFeeder} and its backends. + * + * @typedef {Object} AudioFeederOptions + * @property {string} base - (optional) base URL to find additional resources in, + * such as the Flash audio output shim + * @property {AudioContext} audioContext - (optional) Web Audio API AudioContext + * instance to use inplace of creating a default one + */ + + /** + * Object dictionary format returned from {@link AudioFeeder#getPlaybackState} and friends. + * + * @typedef {Object} PlaybackState + * @property {number} playbackPosition - total seconds so far of audio data that have played + * @property {number} samplesQueued - number of samples at target rate that are queued up for playback + * @property {number} dropped - number of underrun events, when we had to play silence due to data starvation + * @property {number} delayedTime - total seconds so far of silent time during playback due to data starvation + * @todo drop 'dropped' in favor of delayedTime + * @todo replace sampledQueued with a time unit? + */ + + /** + * Object that we can throw audio data into and have it drain out. + * @class + * @param {AudioFeederOptions} options - dictionary of config settings + * + * @classdesc + * Object that we can throw audio data into and have it drain out. + */ + function AudioFeeder(options) { + this._options = options || {}; + this._backend = null; // AudioBackend instance, after init... + }; + + /** + * Sample rate in Hz, as requested by the caller in {@link AudioFeeder#init}. + * + * If the backend's actual sample rate differs from this requested rate, + * input data will be resampled automatically. + * + * @type {number} + * @readonly + * @see AudioFeeder#targetRate + */ + AudioFeeder.prototype.rate = 0; + + /** + * Actual output sample rate in Hz, as provided by the backend. + * This may differ from the rate requested, in which case input data + * will be resampled automatically. + * + * @type {number} + * @readonly + * @see AudioFeeder#rate + */ + AudioFeeder.prototype.targetRate = 0; + + /** + * Number of output channels, as requested by the caller in {@link AudioFeeder#init}. + * + * If the backend's actual channel count differs from this requested count, + * input data will be resampled automatically. + * + * Warning: currently more than 2 channels may result in additional channels + * being cropped out, as downmixing has not yet been implemented. + * + * @type {number} + * @readonly + */ + AudioFeeder.prototype.channels = 0; + + /** + * Size of output buffers in samples, as a hint for latency/scheduling + * @type {number} + * @readonly + */ + AudioFeeder.prototype.bufferSize = 0; + + /** + * Duration of the minimum buffer size, in seconds. + * If the amount of buffered data falls below this, + * caller will receive a synchronous 'starved' event + * with a last chance to buffer more data. + * + * @type {number} + * @readonly + */ + Object.defineProperty(AudioFeeder.prototype, 'bufferDuration', { + get: function getBufferDuration() { + if (this.targetRate) { + return this.bufferSize / this.targetRate; + } else { + return 0; + } + } + }); + + /** + * Duration of remaining data at which a 'bufferlow' event will be + * triggered, in seconds. + * + * This defaults to twice bufferDuration, but can be overridden. + * + * @type {number} + */ + Object.defineProperty(AudioFeeder.prototype, 'bufferThreshold', { + get: function getBufferThreshold() { + if (this._backend) { + return this._backend.bufferThreshold / this.targetRate; + } else { + return 0; + } + }, + set: function setBufferThreshold(val) { + if (this._backend) { + this._backend.bufferThreshold = Math.round(val * this.targetRate); + } else { + throw 'Invalid state: AudioFeeder cannot set bufferThreshold before init'; + } + } + }); + + /** + * Current playback position, in seconds. + * This compensates for drops and underruns, and is suitable for a/v sync. + * + * @type {number} + * @readonly + */ + Object.defineProperty(AudioFeeder.prototype, 'playbackPosition', { + get: function getPlaybackPosition() { + if (this._backend) { + var playbackState = this.getPlaybackState(); + return playbackState.playbackPosition; + } else { + return 0; + } + } + }); + + /** + * Duration of remaining queued data, in seconds. + * + * @type {number} + */ + Object.defineProperty(AudioFeeder.prototype, 'durationBuffered', { + get: function getDurationBuffered() { + if (this._backend) { + var playbackState = this.getPlaybackState(); + return playbackState.samplesQueued / this.targetRate; + } else { + return 0; + } + } + }); + + /** + * Is the feeder currently set to mute output? + * When muted, this overrides the volume property. + * + * @type {boolean} + */ + Object.defineProperty(AudioFeeder.prototype, 'muted', { + get: function getMuted() { + if (this._backend) { + return this._backend.muted; + } else { + throw 'Invalid state: cannot get mute before init'; + } + }, + set: function setMuted(val) { + if (this._backend) { + this._backend.muted = val; + } else { + throw 'Invalid state: cannot set mute before init'; + } + } + }); + + /** + * @deprecated in favor of muted and volume properties + */ + AudioFeeder.prototype.mute = function() { + this.muted = true; + }; + + /** + * @deprecated in favor of muted and volume properties + */ + AudioFeeder.prototype.unmute = function() { + this.muted = false; + }; + + /** + * Volume multiplier, defaults to 1.0. + * @name volume + * @type {number} + */ + Object.defineProperty(AudioFeeder.prototype, 'volume', { + get: function getVolume() { + if (this._backend) { + return this._backend.volume; + } else { + throw 'Invalid state: cannot get volume before init'; + } + }, + set: function setVolume(val) { + if (this._backend) { + this._backend.volume = val; + } else { + throw 'Invalid state: cannot set volume before init'; + } + } + }); + + /** + * Start setting up for output with the given channel count and sample rate. + * Audio data you provide will be resampled if necessary to whatever the + * backend actually supports. + * + * @param {number} numChannels - requested number of channels (output may differ) + * @param {number} sampleRate - requested sample rate in Hz (output may differ) + * + * @todo merge into constructor? + */ + AudioFeeder.prototype.init = function(numChannels, sampleRate) { + this.channels = numChannels; + this.rate = sampleRate; + + if (WebAudioBackend.isSupported()) { + this._backend = new WebAudioBackend(numChannels, sampleRate, this._options); + } else if (FlashBackend.isSupported()) { + this._backend = new FlashBackend(numChannels, sampleRate, this._options); + } else { + throw 'No supported backend'; + } + + this.targetRate = this._backend.rate; + this.bufferSize = this._backend.bufferSize; + + // Pass through the starved event + this._backend.onstarved = (function() { + if (this.onstarved) { + this.onstarved(); + } + }).bind(this); + this._backend.onbufferlow = (function() { + if (this.onbufferlow) { + this.onbufferlow(); + } + }).bind(this); + }; + + /** + * Resample a buffer from the input rate/channel count to the output. + * + * This is horribly naive and wrong. + * Replace me with a better algo! + * + * @param {SampleBuffer} sampleData - input data in requested sample rate / channel count + * @returns {SampleBuffer} output data in backend's sample rate/channel count + */ + AudioFeeder.prototype._resample = function(sampleData) { + var rate = this.rate, + channels = this.channels, + targetRate = this._backend.rate, + targetChannels = this._backend.channels; + + if (rate == targetRate && channels == targetChannels) { + return sampleData; + } else { + var newSamples = []; + for (var channel = 0; channel < targetChannels; channel++) { + var inputChannel = channel; + if (channel >= channels) { + // Flash forces output to stereo; if input is mono, dupe the first channel + inputChannel = 0; + } + var input = sampleData[inputChannel], + output = new Float32Array(Math.round(input.length * targetRate / rate)); + for (var i = 0; i < output.length; i++) { + output[i] = input[(i * rate / targetRate) | 0]; + } + newSamples.push(output); + } + return newSamples; + } + }; + + /** + * Queue up some audio data for playback. + * + * @param {SampleBuffer} sampleData - input data to queue up for playback + * + * @todo throw if data invalid or uneven + */ + AudioFeeder.prototype.bufferData = function(sampleData) { + if (this._backend) { + var samples = this._resample(sampleData); + this._backend.appendBuffer(samples); + } else { + throw 'Invalid state: AudioFeeder cannot bufferData before init'; + } + }; + + /** + * Get an object with information about the current playback state. + * + * @return {PlaybackState} - info about current playback state + */ + AudioFeeder.prototype.getPlaybackState = function() { + if (this._backend) { + return this._backend.getPlaybackState(); + } else { + throw 'Invalid state: AudioFeeder cannot getPlaybackState before init'; + } + }; + + /** + * Checks if audio system is ready and calls the callback when ready + * to begin playback. + * + * This will wait for the Flash shim to load on IE 10/11; waiting + * is not required when using native Web Audio but you should use + * this callback to support older browsers. + * + * @param {function} callback - called when ready + */ + AudioFeeder.prototype.waitUntilReady = function(callback) { + if (this._backend) { + this._backend.waitUntilReady(callback); + } else { + throw 'Invalid state: AudioFeeder cannot waitUntilReady before init'; + } + }; + + /** + * Start/continue playback as soon as possible. + * + * You should buffer some audio ahead of time to avoid immediately + * running into starvation. + */ + AudioFeeder.prototype.start = function() { + if (this._backend) { + this._backend.start(); + } else { + throw 'Invalid state: AudioFeeder cannot start before init'; + } + }; + + /** + * Stop/pause playback as soon as possible. + * + * Audio that has been buffered but not yet sent to the device will + * remain buffered, and can be continued with another call to start(). + */ + AudioFeeder.prototype.stop = function() { + if (this._backend) { + this._backend.stop(); + } else { + throw 'Invalid state: AudioFeeder cannot stop before init'; + } + }; + + /** + * Flush any queued data out of the system. + */ + AudioFeeder.prototype.flush = function() { + if (this._backend) { + this._backend.flush(); + } else { + throw 'Invalid state: AudioFeeder cannot flush before init'; + } + } + + /** + * Close out the audio channel. The AudioFeeder instance will no + * longer be usable after closing. + * + * @todo close out the AudioContext if no longer needed + * @todo make the instance respond more consistently once closed + */ + AudioFeeder.prototype.close = function() { + if (this._backend) { + this._backend.close(); + this._backend = null; + } + }; + + /** + * Synchronous callback when we find we're out of buffered data. + * + * @type {function} + */ + AudioFeeder.prototype.onstarved = null; + + /** + * Asynchronous callback when we're running low on buffered data. + * + * @type {function} + */ + AudioFeeder.prototype.onbufferlow = null; + + /** + * Is the AudioFeeder class supported in this browser? + * + * Note that it's still possible to be supported but not work, for instance + * if there are no audio output devices but the APIs are available. + * + * @returns {boolean} - true if Web Audio API is available + */ + AudioFeeder.isSupported = function() { + return !!Float32Array && (WebAudioBackend.isSupported() || FlashBackend.isSupported()); + }; + + /** + * Force initialization of the default Web Audio API context, if applicable. + * + * Some browsers (such as mobile Safari) disable audio output unless + * first triggered from a UI event handler; call this method as a hint + * that you will be starting up an AudioFeeder soon but won't have data + * for it until a later callback. + * + * @returns {AudioContext|null} - initialized AudioContext instance, if applicable + */ + AudioFeeder.initSharedAudioContext = function() { + if (WebAudioBackend.isSupported()) { + return WebAudioBackend.initSharedAudioContext(); + } else { + return null; + } + }; + + module.exports = AudioFeeder; + + })(); + + + /***/ }, + /* 1 */ + /***/ function(module, exports) { + + /** + * @file Abstraction around a queue of audio buffers. + * + * @author Brion Vibber + * @copyright (c) 2013-2016 Brion Vibber + * @license MIT + */ + + /** + * Constructor for BufferQueue class. + * @class + * @param {number} numChannels - channel count to validate against + * @param {number} bufferSize - desired size of pre-chunked output buffers, in samples + * + * @classdesc + * Abstraction around a queue of audio buffers. + * + * Stuff input buffers of any length in via {@link BufferQueue#appendBuffer}, + * check how much is queued with {@link BufferQueue#sampleCount}, and pull out + * data in fixed-size chunks from the start with {@link BufferQueue#shift}. + */ + function BufferQueue(numChannels, bufferSize) { + if (numChannels < 1 || numChannels !== Math.round(numChannels)) { + throw 'Invalid channel count for BufferQueue'; + } + this.channels = numChannels; + this.bufferSize = bufferSize; + this.flush(); + } + + /** + * Flush any data out of the queue, resetting to empty state. + */ + BufferQueue.prototype.flush = function() { + this._buffers = []; + this._pendingBuffer = this.createBuffer(this.bufferSize); + this._pendingPos = 0; + }; + + /** + * Count how many samples are queued up + * + * @returns {number} - total count in samples + */ + BufferQueue.prototype.sampleCount = function() { + var count = 0; + this._buffers.forEach(function(buffer) { + count += buffer[0].length; + }); + return count; + }; + + /** + * Create an empty audio sample buffer with space for the given count of samples. + * + * @param {number} sampleCount - number of samples to reserve in the buffer + * @returns {SampleBuffer} - empty buffer + */ + BufferQueue.prototype.createBuffer = function(sampleCount) { + var output = []; + for (var i = 0; i < this.channels; i++) { + output[i] = new Float32Array(sampleCount); + } + return output; + }; + + /** + * Validate a buffer for correct object layout + * + * @param {SampleBuffer} buffer - an audio buffer to check + * @returns {boolean} - true if input buffer is valid + */ + BufferQueue.prototype.validate = function(buffer) { + if (buffer.length !== this.channels) { + return false; + } + + var sampleCount; + for (var i = 0; i < buffer.length; i++) { + var channelData = buffer[i]; + if (!(channelData instanceof Float32Array)) { + return false; + } + if (i == 0) { + sampleCount = channelData.length; + } else if (channelData.length !== sampleCount) { + return false; + } + } + + return true; + }; + + /** + * Append a buffer of input data to the queue... + * + * @param {SampleBuffer} sampleData - an audio buffer to append + * @throws exception on invalid input + */ + BufferQueue.prototype.appendBuffer = function(sampleData) { + if (!this.validate(sampleData)) { + throw "Invalid audio buffer passed to BufferQueue.appendBuffer"; + } + + var firstChannel = sampleData[0], + sampleCount = firstChannel.length; + + // @todo this seems hella inefficient + for (var i = 0; i < sampleCount; i++) { + for (var channel = 0; channel < this.channels; channel++) { + this._pendingBuffer[channel][this._pendingPos] = sampleData[channel][i]; + } + if (++this._pendingPos == this.bufferSize) { + this._buffers.push(this._pendingBuffer); + this._pendingPos = 0; + this._pendingBuffer = this.createBuffer(this.bufferSize); + } + } + + }; + + /** + * Unshift the given sample buffer onto the beginning of the buffer queue. + * + * @param {SampleBuffer} sampleData - an audio buffer to prepend + * @throws exception on invalid input + * + * @todo this is currently pretty inefficient as it rechunks all the buffers. + */ + BufferQueue.prototype.prependBuffer = function(sampleData) { + if (!this.validate(sampleData)) { + throw "Invalid audio buffer passed to BufferQueue.prependBuffer"; + } + + // Since everything is pre-chunked in the queue, we're going to have + // to pull everything out and re-append it. + var buffers = this._buffers.slice(0) + buffers.push(this.trimBuffer(this._pendingBuffer, 0, this._pendingPos)); + + this.flush(); + this.appendBuffer(sampleData); + + // Now put back any old buffers, dividing them up into chunks. + for (var i = 0; i < buffers.length; i++) { + this.appendBuffer(buffers[i]); + } + }; + + /** + * Shift out a buffer from the head of the queue, containing a maximum of + * {@link BufferQueue#bufferSize} samples; if there are not enough samples + * you may get a shorter buffer. Call {@link BufferQueue#sampleCount} to + * check if enough samples are available for your needs. + * + * @returns {SampleBuffer} - an audio buffer with zero or more samples + */ + BufferQueue.prototype.nextBuffer = function() { + if (this._buffers.length) { + return this._buffers.shift(); + } else { + var trimmed = this.trimBuffer(this._pendingBuffer, 0, this._pendingPos); + this._pendingBuffer = this.createBuffer(this.bufferSize); + this._pendingPos = 0; + return trimmed; + } + }; + + /** + * Trim a buffer down to a given maximum sample count. + * Any additional samples will simply be cropped off of the view. + * If no trimming is required, the same buffer will be returned. + * + * @param {SampleBuffer} sampleData - input data + * @param {number} start - sample number to start at + * @param {number} maxSamples - count of samples to crop to + * @returns {SampleBuffer} - output data with at most maxSamples samples + */ + BufferQueue.prototype.trimBuffer = function(sampleData, start, maxSamples) { + var bufferLength = sampleData[0].length, + end = start + Math.min(maxSamples, bufferLength); + if (start == 0 && end >= bufferLength) { + return sampleData; + } else { + var output = []; + for (var i = 0; i < this.channels; i++) { + output[i] = sampleData[i].subarray(start, end); + } + return output; + } + }; + + module.exports = BufferQueue; + + + /***/ }, + /* 2 */ + /***/ function(module, exports, __webpack_require__) { + + /** + * @file Web Audio API backend for AudioFeeder + * @author Brion Vibber + * @copyright (c) 2013-2016 Brion Vibber + * @license MIT + */ + + (function() { + + var AudioContext = window.AudioContext || window.webkitAudioContext, + BufferQueue = __webpack_require__(1), + nextTick = __webpack_require__(3); + + /** + * Constructor for AudioFeeder's Web Audio API backend. + * @class + * @param {number} numChannels - requested count of output channels + * @param {number} sampleRate - requested sample rate for output + * @param {Object} options - pass URL path to directory containing 'dynamicaudio.swf' in 'base' parameter + * + * @classdesc Web Audio API output backend for AudioFeeder. + * Maintains an internal {@link BufferQueue} of audio samples to be output on demand. + */ + function WebAudioBackend(numChannels, sampleRate, options) { + var context = options.audioContext || WebAudioBackend.initSharedAudioContext(); + + this._context = context; + + + /* + * Optional audio node can be provided to connect the feeder to + * @type {AudioNode} + */ + this.output = options.output || context.destination + + /** + * Actual sample rate supported for output, in Hz + * @type {number} + * @readonly + */ + this.rate = context.sampleRate; + + /** + * Actual count of channels supported for output + * @type {number} + * @readonly + */ + this.channels = Math.min(numChannels, 2); // @fixme remove this limit + + if (options.bufferSize) { + this.bufferSize = (options.bufferSize | 0); + } + this.bufferThreshold = 2 * this.bufferSize; + + this._bufferQueue = new BufferQueue(this.channels, this.bufferSize); + this._playbackTimeAtBufferTail = context.currentTime; + this._queuedTime = 0; + this._delayedTime = 0; + this._dropped = 0; + this._liveBuffer = this._bufferQueue.createBuffer(this.bufferSize); + + // @todo support new audio worker mode too + if (context.createScriptProcessor) { + this._node = context.createScriptProcessor(this.bufferSize, 0, this.channels); + } else if (context.createJavaScriptNode) { + // In older Safari versions + this._node = context.createJavaScriptNode(this.bufferSize, 0, this.channels); + } else { + throw new Error("Bad version of web audio API?"); + } + } + + /** + * Size of output buffers in samples, as a hint for latency/scheduling + * @type {number} + * @readonly + */ + WebAudioBackend.prototype.bufferSize = 4096; + + /** + * Remaining sample count at which a 'bufferlow' event will be triggered. + * + * Will be pinged when falling below bufferThreshold or bufferSize, + * whichever is larger. + * + * @type {number} + */ + WebAudioBackend.prototype.bufferThreshold = 8192; + + /** + * Internal volume property backing. + * @type {number} + * @access private + */ + WebAudioBackend.prototype._volume = 1; + + /** + * Volume multiplier, defaults to 1.0. + * @name volume + * @type {number} + */ + Object.defineProperty(WebAudioBackend.prototype, 'volume', { + get: function getVolume() { + return this._volume; + }, + set: function setVolume(val) { + this._volume = +val; + } + }); + + /** + * Internal muted property backing. + * @type {number} + * @access private + */ + WebAudioBackend.prototype._muted = false; + + /** + * Is the backend currently set to mute output? + * When muted, this overrides the volume property. + * + * @type {boolean} + */ + Object.defineProperty(WebAudioBackend.prototype, 'muted', { + get: function getMuted() { + return this._muted; + }, + set: function setMuted(val) { + this._muted = !!val; + } + }); + + /** + * onaudioprocess event handler for the ScriptProcessorNode + * @param {AudioProcessingEvent} event - audio processing event object + * @access private + */ + WebAudioBackend.prototype._audioProcess = function(event) { + var channel, input, output, i, playbackTime; + if (typeof event.playbackTime === 'number') { + playbackTime = event.playbackTime; + } else { + // Safari 6.1 hack + playbackTime = this._context.currentTime + (this.bufferSize / this.rate); + } + + var expectedTime = this._playbackTimeAtBufferTail; + if (expectedTime < playbackTime) { + // we may have lost some time while something ran too slow + this._delayedTime += (playbackTime - expectedTime); + } + + if (this._bufferQueue.sampleCount() < this.bufferSize) { + // We might be in a throttled background tab; go ping the decoder + // and let it know we need more data now! + // @todo use standard event firing? + if (this.onstarved) { + this.onstarved(); + } + } + + // If we still haven't got enough data, write a buffer of silence + // to all channels and record an underrun event. + // @todo go ahead and output the data we _do_ have? + if (this._bufferQueue.sampleCount() < this.bufferSize) { + for (channel = 0; channel < this.channels; channel++) { + output = event.outputBuffer.getChannelData(channel); + for (i = 0; i < this.bufferSize; i++) { + output[i] = 0; + } + } + this._dropped++; + return; + } + + var volume = (this.muted ? 0 : this.volume); + + // Actually get that data and write it out... + var inputBuffer = this._bufferQueue.nextBuffer(); + if (inputBuffer[0].length < this.bufferSize) { + // This should not happen, but trust no invariants! + throw 'Audio buffer not expected length.'; + } + for (channel = 0; channel < this.channels; channel++) { + input = inputBuffer[channel]; + + // Save this buffer data for later in case we pause + this._liveBuffer[channel].set(inputBuffer[channel]); + + // And play it out with volume applied... + output = event.outputBuffer.getChannelData(channel); + for (i = 0; i < input.length; i++) { + output[i] = input[i] * volume; + } + } + this._queuedTime += (this.bufferSize / this.rate); + this._playbackTimeAtBufferTail = playbackTime + (this.bufferSize / this.rate); + + if (this._bufferQueue.sampleCount() < Math.max(this.bufferSize, this.bufferThreshold)) { + // Let the decoder know ahead of time we're running low on data. + // @todo use standard event firing? + if (this.onbufferlow) { + nextTick(this.onbufferlow.bind(this)); + } + } + }; + + + /** + * Return a count of samples that have been queued or output but not yet played. + * + * @returns {number} - sample count + * @access private + */ + WebAudioBackend.prototype._samplesQueued = function() { + var bufferedSamples = this._bufferQueue.sampleCount(); + var remainingSamples = Math.floor(this._timeAwaitingPlayback() * this.rate); + + return bufferedSamples + remainingSamples; + }; + + /** + * Return time duration between the present and the endpoint of audio + * we have already sent out from our queue to Web Audio. + * + * @returns {number} - seconds + */ + WebAudioBackend.prototype._timeAwaitingPlayback = function() { + return Math.max(0, this._playbackTimeAtBufferTail - this._context.currentTime); + }; + + /** + * Get info about current playback state. + * + * @return {PlaybackState} - info about current playback state + */ + WebAudioBackend.prototype.getPlaybackState = function() { + return { + playbackPosition: this._queuedTime - this._timeAwaitingPlayback(), + samplesQueued: this._samplesQueued(), + dropped: this._dropped, + delayed: this._delayedTime + }; + }; + + /** + * Wait asynchronously until the backend is ready before continuing. + * + * This will always call immediately for the Web Audio API backend, + * as there is no async setup process. + * + * @param {function} callback - to be called when ready + */ + WebAudioBackend.prototype.waitUntilReady = function(callback) { + callback(); + }; + + /** + * Append a buffer of audio data to the output queue for playback. + * + * Audio data must be at the expected sample rate; resampling is done + * upstream in {@link AudioFeeder}. + * + * @param {SampleBuffer} sampleData - audio data at target sample rate + */ + WebAudioBackend.prototype.appendBuffer = function(sampleData) { + this._bufferQueue.appendBuffer(sampleData); + }; + + /** + * Start playback. + * + * Audio should have already been queued at this point, + * or starvation may occur immediately. + */ + WebAudioBackend.prototype.start = function() { + this._node.onaudioprocess = this._audioProcess.bind(this); + this._node.connect(this.output); + this._playbackTimeAtBufferTail = this._context.currentTime; + }; + + /** + * Stop playback, but don't release resources or clear the buffers. + * We'll probably come back soon. + */ + WebAudioBackend.prototype.stop = function() { + if (this._node) { + var timeRemaining = this._timeAwaitingPlayback(); + if (timeRemaining > 0) { + // We have some leftover samples that got queued but didn't get played. + // Unshift them back onto the beginning of the buffer. + // @todo make this not a horrible hack + var samplesRemaining = Math.round(timeRemaining * this.rate), + samplesAvailable = this._liveBuffer ? this._liveBuffer[0].length : 0; + if (samplesRemaining > samplesAvailable) { + //console.log('liveBuffer size ' + samplesRemaining + ' vs ' + samplesAvailable); + this._bufferQueue.prependBuffer(this._liveBuffer); + this._bufferQueue.prependBuffer( + this._bufferQueue.createBuffer(samplesRemaining - samplesAvailable)); + } else { + this._bufferQueue.prependBuffer( + this._bufferQueue.trimBuffer(this._liveBuffer, samplesAvailable - samplesRemaining, samplesRemaining)); + } + this._playbackTimeAtBufferTail -= timeRemaining; + } + this._node.onaudioprocess = null; + this._node.disconnect(); + } + }; + + /** + * Flush any queued data out of the system. + */ + WebAudioBackend.prototype.flush = function() { + this._bufferQueue.flush(); + }; + + /** + * Close out the playback system and release resources. + * + * @todo consider releasing the AudioContext when possible + */ + WebAudioBackend.prototype.close = function() { + this.stop(); + + this._context = null; + }; + + /** + * Synchronous callback for when we run out of input data + * + * @type function|null + */ + WebAudioBackend.prototype.onstarved = null; + + /** + * Asynchronous callback for when the buffer runs low and + * should be refilled soon. + * + * @type function|null + */ + WebAudioBackend.prototype.onbufferlow = null; + + /** + * Check if Web Audio API appears to be supported. + * + * Note this is somewhat optimistic; will return true even if there are no + * audio devices available, as long as the API is present. + * + * @returns {boolean} - true if this browser appears to support Web Audio API + */ + WebAudioBackend.isSupported = function() { + return !!AudioContext; + }; + + /** + * Holder of audio context to be used/reused by WebAudioBackend. + * @see {WebAudioBackend#initSharedAudioContext} + * + * @type {AudioContext} + */ + WebAudioBackend.sharedAudioContext = null; + + /** + * Force initialization of the default Web Audio API context. + * + * Some browsers (such as mobile Safari) disable audio output unless + * first triggered from a UI event handler; call this method as a hint + * that you will be starting up an AudioFeeder soon but won't have data + * for it until a later callback. + * + * @returns {AudioContext|null} - initialized AudioContext instance, if applicable + */ + WebAudioBackend.initSharedAudioContext = function() { + if (!WebAudioBackend.sharedAudioContext) { + if (WebAudioBackend.isSupported()) { + // We're only allowed 4 contexts on many browsers + // and there's no way to discard them (!)... + var context = new AudioContext(), + node; + if (context.createScriptProcessor) { + node = context.createScriptProcessor(1024, 0, 2); + } else if (context.createJavaScriptNode) { + node = context.createJavaScriptNode(1024, 0, 2); + } else { + throw new Error( "Bad version of web audio API?" ); + } + + // Don't actually run any audio, just start & stop the node + node.connect(context.destination); + node.disconnect(); + + // So far so good. Keep it around! + WebAudioBackend.sharedAudioContext = context; + } + } + return WebAudioBackend.sharedAudioContext; + }; + + module.exports = WebAudioBackend; + + })(); + + + /***/ }, + /* 3 */ + /***/ function(module, exports) { + + module.exports = (function() { + // Don't try to check for setImmediate directly; webpack implements + // it using setTimeout which will be throttled in background tabs. + // Checking directly on the global window object skips this interference. + if (typeof window.setImmediate !== 'undefined') { + return window.setImmediate; + } + + // window.postMessage goes straight to the event loop, no throttling. + if (window && window.postMessage) { + var nextTickQueue = []; + window.addEventListener('message', function(event) { + if (event.source === window) { + var data = event.data; + if (typeof data === 'object' && data.nextTickBrowserPingMessage) { + var callback = nextTickQueue.pop(); + if (callback) { + callback(); + } + } + } + }); + return function(callback) { + nextTickQueue.push(callback); + window.postMessage({ + nextTickBrowserPingMessage: true + }, document.location.toString()) + }; + } + + // Timeout fallback may be poor in background tabs + return function(callback) { + setTimeout(callback, 0); + } + })(); + + + /***/ }, + /* 4 */ + /***/ function(module, exports, __webpack_require__) { + + (function() { + + /* global ActiveXObject */ + var dynamicaudio_swf = __webpack_require__(5); + + var nextTick = __webpack_require__(3); + + /** + * Constructor for AudioFeeder's Flash audio backend. + * @class + * @param {number} numChannels - requested count of output channels (actual will be fixed at 2) + * @param {number} sampleRate - requested sample rate for output (actual will be fixed at 44.1 kHz) + * @param {Object} options - pass URL path to directory containing 'dynamicaudio.swf' in 'base' parameter + * + * @classdesc Flash audio output backend for AudioFeeder. + * Maintains a local queue of data to be sent down to the Flash shim. + * Resampling to stereo 44.1 kHz is done upstream in AudioFeeder. + */ + var FlashBackend = function(numChannels, sampleRate, options) { + options = options || {}; + var flashOptions = {}; + if (typeof options.base === 'string') { + // @fixme replace the version string with an auto-updateable one + flashOptions.swf = options.base + '/' + dynamicaudio_swf; + } + if (options.bufferSize) { + this.bufferSize = (options.bufferSize | 0); + } + + this._flashaudio = new DynamicAudio(flashOptions); + this._flashBuffer = ''; + this._flushTimeout = null; + this._flushInterval = 40; // flush added buffers no more often than every X ms + this._cachedFlashState = null; + this._cachedFlashTime = 0; + this._cachedFlashInterval = 40; // resync state no more often than every X ms + + this._waitUntilReadyQueue = []; + this.onready = function() { + this._flashaudio.flashElement.setBufferSize(this.bufferSize); + this._flashaudio.flashElement.setBufferThreshold(this.bufferThreshold); + while (this._waitUntilReadyQueue.length) { + var callback = this._waitUntilReadyQueue.shift(); + callback.apply(this); + } + }; + this.onlog = function(msg) { + console.log('AudioFeeder FlashBackend: ' + msg); + } + + this.bufferThreshold = this.bufferSize * 2; + + var events = { + 'ready': 'sync', + 'log': 'sync', + 'starved': 'sync', + 'bufferlow': 'async' + }; + this._callbackName = 'AudioFeederFlashBackendCallback' + this._flashaudio.id; + var self = this; + window[this._callbackName] = (function(eventName) { + var method = events[eventName], + callback = this['on' + eventName]; + if (method && callback) { + if (method === 'async') { + nextTick(callback.bind(this)); + } else { + callback.apply(this, Array.prototype.slice.call(arguments, 1)); + this._flushFlashBuffer(); + } + } + }).bind(this); + }; + + /** + * Actual sample rate supported for output, in Hz + * Fixed to 44.1 kHz for Flash backend. + * @type {number} + * @readonly + */ + FlashBackend.prototype.rate = 44100; + + /** + * Actual count of channels supported for output + * Fixed to stereo for Flash backend. + * @type {number} + * @readonly + */ + FlashBackend.prototype.channels = 2; + + /** + * Buffer size hint. + * @type {number} + * @readonly + */ + FlashBackend.prototype.bufferSize = 4096; + + /** + * Internal bufferThreshold property backing. + * @type {number} + * @access private + */ + FlashBackend.prototype._bufferThreshold = 8192; + + /** + * Remaining sample count at which a 'bufferlow' event will be triggered. + * + * Will be pinged when falling below bufferThreshold or bufferSize, + * whichever is larger. + * + * @type {number} + */ + Object.defineProperty(FlashBackend.prototype, 'bufferThreshold', { + get: function getBufferThreshold() { + return this._bufferThreshold; + }, + set: function setBufferThreshold(val) { + this._bufferThreshold = val | 0; + this.waitUntilReady((function() { + this._flashaudio.flashElement.setBufferThreshold(this._bufferThreshold); + }).bind(this)); + } + }); + + /** + * Internal volume property backing. + * @type {number} + * @access private + */ + FlashBackend.prototype._volume = 1; + + /** + * Volume multiplier, defaults to 1.0. + * @name volume + * @type {number} + */ + Object.defineProperty(FlashBackend.prototype, 'volume', { + get: function getVolume() { + return this._volume; + }, + set: function setVolume(val) { + this._volume = +val; + this.waitUntilReady(this._flashVolumeUpdate.bind(this)); + } + }); + + /** + * Internal muted property backing. + * @type {number} + * @access private + */ + FlashBackend.prototype._muted = false; + + /** + * Is the backend currently set to mute output? + * When muted, this overrides the volume property. + * + * @type {boolean} + */ + Object.defineProperty(FlashBackend.prototype, 'muted', { + get: function getMuted() { + return this._muted; + }, + set: function setMuted(val) { + this._muted = !!val; + this.waitUntilReady(this._flashVolumeUpdate.bind(this)); + } + }); + + /** + * Are we paused/idle? + * @type {boolean} + * @access private + */ + FlashBackend.prototype._paused = true; + + /** + * Pass the currently configured muted+volume state down to the Flash plugin + * @access private + */ + FlashBackend.prototype._flashVolumeUpdate = function() { + if (this._flashaudio && this._flashaudio.flashElement && this._flashaudio.flashElement.setVolume) { + this._flashaudio.flashElement.setVolume(this.muted ? 0 : this.volume); + } + } + + /** + * Scaling and reordering of output for the Flash fallback. + * Input data must be pre-resampled to the correct sample rate. + * + * @param {SampleBuffer} samples - input data as separate channels of 32-bit float + * @returns {Int16Array} - interleaved stereo 16-bit signed integer output + * @access private + * + * @todo handle input with higher channel counts better + * @todo try sending floats to flash without losing precision? + */ + FlashBackend.prototype._resampleFlash = function(samples) { + var sampleincr = 1; + var samplecount = samples[0].length; + var newSamples = new Int16Array(samplecount * 2); + var chanLeft = samples[0]; + var chanRight = this.channels > 1 ? samples[1] : chanLeft; + var volume = this.muted ? 0 : this.volume; + var multiplier = volume * 16384; // smaller than 32768 to allow some headroom from those floats + for(var s = 0; s < samplecount; s++) { + var idx = (s * sampleincr) | 0; + var idx_out = s * 2; + // Use a smaller + newSamples[idx_out] = chanLeft[idx] * multiplier; + newSamples[idx_out + 1] = chanRight[idx] * multiplier; + } + return newSamples; + }; + + var hexDigits = ['0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; + var hexBytes = []; + for (var i = 0; i < 256; i++) { + hexBytes[i] = hexDigits[(i & 0x0f)] + + hexDigits[(i & 0xf0) >> 4]; + } + function hexString(buffer) { + var samples = new Uint8Array(buffer); + var digits = "", + len = samples.length; + for (var i = 0; i < len; i++) { + // Note that in IE 11 string concatenation is twice as fast as + // the traditional make-an-array-and-join here. + digits += hexBytes[samples[i]]; + } + return digits; + } + + /** + * Send any pending data off to the Flash plugin. + * + * @access private + */ + FlashBackend.prototype._flushFlashBuffer = function() { + var chunk = this._flashBuffer, + flashElement = this._flashaudio.flashElement; + + if (this._cachedFlashState) { + this._cachedFlashState.samplesQueued += chunk.length / 8; + } + this._flashBuffer = ''; + this._flushTimeout = null; + + if (chunk.length > 0) { + this.waitUntilReady(function() { + flashElement.write(chunk); + }); + } + }; + + /** + * Append a buffer of audio data to the output queue for playback. + * + * Audio data must be at the expected sample rate; resampling is done + * upstream in {@link AudioFeeder}. + * + * @param {SampleBuffer} sampleData - audio data at target sample rate + */ + FlashBackend.prototype.appendBuffer = function(sampleData) { + var resamples = this._resampleFlash(sampleData); + if (resamples.length > 0) { + var str = hexString(resamples.buffer); + this._flashBuffer += str; + if (!this._flushTimeout) { + // consolidate multiple consecutive tiny buffers in one pass; + // pushing data to Flash is relatively expensive on slow machines + this._flushTimeout = setTimeout(this._flushFlashBuffer.bind(this), this._flushInterval); + } + } + }; + + /** + * Get info about current playback state. + * + * @return {PlaybackState} - info about current playback state + */ + FlashBackend.prototype.getPlaybackState = function() { + if (this._flashaudio && this._flashaudio.flashElement && this._flashaudio.flashElement.write) { + var now = Date.now(), + delta = this._paused ? 0 : (now - this._cachedFlashTime), + state; + if (this._cachedFlashState && delta < this._cachedFlashInterval) { + var cachedFlashState = this._cachedFlashState; + state = { + playbackPosition: cachedFlashState.playbackPosition + delta / 1000, + samplesQueued: cachedFlashState.samplesQueued - + Math.max(0, Math.round(delta * this.rate / 1000)), + dropped: cachedFlashState.dropped, + delayed: cachedFlashState.delayed + }; + } else { + state = this._flashaudio.flashElement.getPlaybackState(); + this._cachedFlashState = state; + this._cachedFlashTime = now; + } + state.samplesQueued += this._flashBuffer.length / 8; + return state; + } else { + //console.log('getPlaybackState USED TOO EARLY'); + return { + playbackPosition: 0, + samplesQueued: 0, + dropped: 0, + delayed: 0 + }; + } + }; + + /** + * Wait until the backend is ready to start, then call the callback. + * + * @param {function} callback - called on completion + * @todo handle fail case better? + */ + FlashBackend.prototype.waitUntilReady = function(callback) { + if (this._flashaudio && this._flashaudio.flashElement.write) { + callback.apply(this); + } else { + this._waitUntilReadyQueue.push(callback); + } + }; + + /** + * Start playback. + * + * Audio should have already been queued at this point, + * or starvation may occur immediately. + */ + FlashBackend.prototype.start = function() { + this._flashaudio.flashElement.start(); + this._paused = false; + this._cachedFlashState = null; + }; + + /** + * Stop playback, but don't release resources or clear the buffers. + * We'll probably come back soon. + */ + FlashBackend.prototype.stop = function() { + this._flashaudio.flashElement.stop(); + this._paused = true; + this._cachedFlashState = null; + }; + + /** + * Flush any queued data out of the system. + */ + FlashBackend.prototype.flush = function() { + this._flashaudio.flashElement.flush(); + this._cachedFlashState = null; + }; + + /** + * Close out the playback system and release resources. + */ + FlashBackend.prototype.close = function() { + this.stop(); + + var wrapper = this._flashaudio.flashWrapper; + wrapper.parentNode.removeChild(wrapper); + this._flashaudio = null; + delete window[this._callbackName]; + }; + + /** + * Synchronous callback for when we run out of input data + * + * @type function|null + */ + FlashBackend.prototype.onstarved = null; + + /** + * Asynchronous callback for when the buffer runs low and + * should be refilled soon. + * + * @type function|null + */ + FlashBackend.prototype.onbufferlow = null; + + /** + * Check if the browser appears to support Flash. + * + * Note this is somewhat optimistic, in that Flash may be supported + * but the dynamicaudio.swf file might not load, or it might load + * but there might be no audio devices, etc. + * + * Currently only checks for the ActiveX Flash plugin for Internet Explorer, + * as other target browsers support Web Audio API. + * + * @returns {boolean} - true if this browser appears to support Flash + */ + FlashBackend.isSupported = function() { + if (navigator.userAgent.indexOf('Trident') !== -1) { + // We only do the ActiveX test because we only need Flash in + // Internet Explorer 10/11. Other browsers use Web Audio directly + // (Edge, Safari) or native playback, so there's no need to test + // other ways of loading Flash. + try { + var obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + return true; + } catch(e) { + return false; + } + } + return false; + }; + + /** Flash fallback **/ + + /* + The Flash fallback is based on https://github.com/an146/dynamicaudio.js + + This is the contents of the LICENSE file: + + Copyright (c) 2010, Ben Firshman + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The names of its contributors may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + + /** + * Wrapper class for instantiating Flash plugin. + * + * @constructor + * @param {Object} args - pass 'swf' to override default dynamicaudio.swf URL + * @access private + */ + function DynamicAudio(args) { + if (this instanceof arguments.callee) { + if (typeof this.init === "function") { + this.init.apply(this, (args && args.callee) ? args : arguments); + } + } else { + return new arguments.callee(arguments); + } + } + + + DynamicAudio.nextId = 1; + + DynamicAudio.prototype = { + nextId: null, + swf: dynamicaudio_swf, + + flashWrapper: null, + flashElement: null, + + init: function(opts) { + var self = this; + self.id = DynamicAudio.nextId++; + + if (opts && typeof opts.swf !== 'undefined') { + self.swf = opts.swf; + } + + + self.flashWrapper = document.createElement('div'); + self.flashWrapper.id = 'dynamicaudio-flashwrapper-'+self.id; + // Credit to SoundManager2 for this: + var s = self.flashWrapper.style; + s.position = 'fixed'; + s.width = '11px'; // must be at least 6px for flash to run fast + s.height = '11px'; + s.bottom = s.left = '0px'; + s.overflow = 'hidden'; + self.flashElement = document.createElement('div'); + self.flashElement.id = 'dynamicaudio-flashelement-'+self.id; + self.flashWrapper.appendChild(self.flashElement); + + document.body.appendChild(self.flashWrapper); + + var id = self.flashElement.id; + var params = ''; + + self.flashWrapper.innerHTML = "" + params + ""; + self.flashElement = document.getElementById(id); + }, + }; + + module.exports = FlashBackend; + + })(); + + + /***/ }, + /* 5 */ + /***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__.p + "dynamicaudio.swf?version=0f98a83acdc72cf30968c16a018e1cf1"; + + /***/ } + /******/ ]) + }); + ; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__.p + "dynamicaudio.swf?version=0f98a83acdc72cf30968c16a018e1cf1"; + +/***/ }), +/* 32 */ +/***/ (function(module, exports) { + + /** + * Give as your 'process' function something that will trigger an async + * operation, then call the left() or right() methods to run another + * iteration, bisecting to the given direction. + * + * Caller is responsible for determining when done. + * + * @params options object { + * start: number, + * end: number, + * process: function(start, position, end) + * } + */ + function Bisector(options) { + var start = options.start, + end = options.end, + position = 0, + self = this, + n = 0; + + function iterate() { + n++; + position = Math.floor((start + end) / 2); + return options.process(start, end, position); + } + + self.start = function() { + iterate(); + return self; + }; + + self.left = function() { + end = position; + return iterate(); + }; + + self.right = function() { + start = position; + return iterate(); + }; + } + + module.exports = Bisector; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Proxy object for web worker interface for codec classes. + * + * Used by the high-level player interface. + * + * @author Brion Vibber + * @copyright 2015 + * @license MIT-style + */ + var OGVLoader = __webpack_require__(3); + + var OGVWrapperCodec = (function(options) { + options = options || {}; + var self = this, + suffix = '?version=' + encodeURIComponent(("1.4.2-20170425024925-504d7197")), + base = (typeof options.base === 'string') ? (options.base + '/') : '', + type = (typeof options.type === 'string') ? options.type : 'video/ogg', + processing = false, + demuxer = null, + videoDecoder = null, + audioDecoder = null, + flushIter = 0; + + // Wrapper for callbacks to drop them after a flush + function flushSafe(func) { + var savedFlushIter = flushIter; + return function(arg) { + if (flushIter <= savedFlushIter) { + func(arg); + } + }; + } + + var loadedMetadata = false; + Object.defineProperty(self, 'loadedMetadata', { + get: function() { + return loadedMetadata; + } + }); + + Object.defineProperty(self, 'processing', { + get: function() { + return processing/* + || (videoDecoder && videoDecoder.processing) + || (audioDecoder && audioDecoder.processing)*/; + } + }); + + Object.defineProperty(self, 'duration', { + get: function() { + if (self.loadedMetadata) { + return demuxer.duration; + } else { + return NaN; + } + } + }); + + Object.defineProperty(self, 'hasAudio', { + get: function() { + return self.loadedMetadata && !!audioDecoder; + } + }); + + Object.defineProperty(self, 'audioReady', { + get: function() { + return self.hasAudio && demuxer.audioReady; + } + }); + + Object.defineProperty(self, 'audioTimestamp', { + get: function() { + return demuxer.audioTimestamp; + } + }); + + Object.defineProperty(self, 'audioFormat', { + get: function() { + if (self.hasAudio) { + return audioDecoder.audioFormat; + } else { + return null; + } + } + }); + + Object.defineProperty(self, 'audioBuffer', { + get: function() { + if (self.hasAudio) { + return audioDecoder.audioBuffer; + } else { + return null; + } + } + }); + + Object.defineProperty(self, 'hasVideo', { + get: function() { + return self.loadedMetadata && !!videoDecoder; + } + }); + + Object.defineProperty(self, 'frameReady', { + get: function() { + return self.hasVideo && demuxer.frameReady; + } + }); + + Object.defineProperty(self, 'frameTimestamp', { + get: function() { + return demuxer.frameTimestamp; + } + }); + + Object.defineProperty(self, 'keyframeTimestamp', { + get: function() { + return demuxer.keyframeTimestamp; + } + }); + + Object.defineProperty(self, 'nextKeyframeTimestamp', { + get: function() { + return demuxer.nextKeyframeTimestamp; + } + }); + + Object.defineProperty(self, 'videoFormat', { + get: function() { + if (self.hasVideo) { + return videoDecoder.videoFormat; + } else { + return null; + } + } + }); + + Object.defineProperty(self, 'frameBuffer', { + get: function() { + if (self.hasVideo) { + return videoDecoder.frameBuffer; + } else { + return null; + } + } + }); + + Object.defineProperty(self, 'seekable', { + get: function() { + return demuxer.seekable; + } + }); + + // - public methods + self.init = function(callback) { + var demuxerClassName; + if (options.type === 'video/webm') { + demuxerClassName = options.wasm ? 'OGVDemuxerWebMW' : 'OGVDemuxerWebM'; + } else { + demuxerClassName = options.wasm ? 'OGVDemuxerOggW' : 'OGVDemuxerOgg'; + } + processing = true; + OGVLoader.loadClass(demuxerClassName, function(demuxerClass) { + demuxer = new demuxerClass(); + demuxer.onseek = function(offset) { + if (self.onseek) { + self.onseek(offset); + } + }; + demuxer.init(function() { + processing = false; + callback(); + }); + }); + }; + + self.close = function() { + if (demuxer) { + demuxer.close(); + demuxer = null; + } + if (videoDecoder) { + videoDecoder.close(); + videoDecoder = null; + } + if (audioDecoder) { + audioDecoder.close(); + audioDecoder = null; + } + }; + + self.receiveInput = function(data, callback) { + demuxer.receiveInput(data, callback); + }; + + var audioClassMap = { + vorbis: options.wasm ? 'OGVDecoderAudioVorbisW' : 'OGVDecoderAudioVorbis', + opus: options.wasm ? 'OGVDecoderAudioOpusW' : 'OGVDecoderAudioOpus' + }; + function loadAudioCodec(callback) { + if (demuxer.audioCodec) { + var className = audioClassMap[demuxer.audioCodec]; + processing = true; + OGVLoader.loadClass(className, function(audioCodecClass) { + var audioOptions = {}; + if (demuxer.audioFormat) { + audioOptions.audioFormat = demuxer.audioFormat; + } + audioDecoder = new audioCodecClass(audioOptions); + audioDecoder.init(function() { + loadedAudioMetadata = audioDecoder.loadedMetadata; + processing = false; + callback(); + }); + }, { + worker: options.worker + }); + } else { + callback(); + } + } + + var videoClassMap = { + theora: options.wasm ? 'OGVDecoderVideoTheoraW' : 'OGVDecoderVideoTheora', + vp8: options.wasm ? 'OGVDecoderVideoVP8W' : (options.threading ? 'OGVDecoderVideoVP8MT' : 'OGVDecoderVideoVP8'), + vp9: options.wasm ? 'OGVDecoderVideoVP9W' : (options.threading ? 'OGVDecoderVideoVP9MT' : 'OGVDecoderVideoVP9') + }; + function loadVideoCodec(callback) { + if (demuxer.videoCodec) { + var className = videoClassMap[demuxer.videoCodec]; + processing = true; + OGVLoader.loadClass(className, function(videoCodecClass) { + var videoOptions = {}; + if (demuxer.videoFormat) { + videoOptions.videoFormat = demuxer.videoFormat; + } + if (options.memoryLimit) { + videoOptions.memoryLimit = options.memoryLimit; + } + videoDecoder = new videoCodecClass(videoOptions); + videoDecoder.init(function() { + loadedVideoMetadata = videoDecoder.loadedMetadata; + processing = false; + callback(); + }); + }, { + worker: options.worker && !options.threading + }); + } else { + callback(); + } + } + + var loadedDemuxerMetadata = false, + loadedAudioMetadata = false, + loadedVideoMetadata = false, + loadedAllMetadata = false; + + self.process = function(callback) { + if (processing) { + throw new Error('reentrancy fail on OGVWrapperCodec.process'); + } + processing = true; + + var videoPacketCount = demuxer.videoPackets.length, + audioPacketCount = demuxer.audioPackets.length, + start = (window.performance ? performance.now() : Date.now()); + function finish(result) { + processing = false; + var delta = (window.performance ? performance.now() : Date.now()) - start; + if (delta > 8) { + console.log('slow demux in ' + delta + ' ms; ' + + (demuxer.videoPackets.length - videoPacketCount) + ' +video packets, ' + + (demuxer.audioPackets.length - audioPacketCount) + ' +audio packets'); + } + //console.log('demux returned ' + (result ? 'true' : 'false') + '; ' + demuxer.videoPackets.length + '; ' + demuxer.audioPackets.length); + callback(result); + } + + function doProcessData() { + demuxer.process(finish); + } + + if (demuxer.loadedMetadata && !loadedDemuxerMetadata) { + + // Demuxer just reached its metadata. Load the relevant codecs! + loadAudioCodec(function() { + loadVideoCodec(function() { + loadedDemuxerMetadata = true; + loadedAudioMetadata = !audioDecoder; + loadedVideoMetadata = !videoDecoder; + loadedAllMetadata = loadedAudioMetadata && loadedVideoMetadata; + finish(true); + }); + }); + + } else if (loadedDemuxerMetadata && !loadedAudioMetadata) { + + if (audioDecoder.loadedMetadata) { + + loadedAudioMetadata = true; + loadedAllMetadata = loadedAudioMetadata && loadedVideoMetadata; + finish(true); + + } else if (demuxer.audioReady) { + + demuxer.dequeueAudioPacket(function(packet) { + audioDecoder.processHeader(packet, function(ret) { + finish(true); + }); + }); + + } else { + + doProcessData(); + + } + + } else if (loadedAudioMetadata && !loadedVideoMetadata) { + + if (videoDecoder.loadedMetadata) { + + loadedVideoMetadata = true; + loadedAllMetadata = loadedAudioMetadata && loadedVideoMetadata; + finish(true); + + } else if (demuxer.frameReady) { + + processing = true; + demuxer.dequeueVideoPacket(function(packet) { + videoDecoder.processHeader(packet, function() { + finish(true); + }); + }); + + } else { + + doProcessData(); + + } + + } else if (loadedVideoMetadata && !self.loadedMetadata && loadedAllMetadata) { + + // Ok we've found all the metadata there is. Enjoy. + loadedMetadata = true; + finish(true); + + } else if (self.loadedMetadata && (!self.hasAudio || demuxer.audioReady) && (!self.hasVideo || demuxer.frameReady)) { + + // Already queued up some packets. Go read them! + finish(true); + + } else { + + // We need to process more of the data we've already received, + // or ask for more if we ran out! + doProcessData(); + + } + + }; + + self.decodeFrame = function(callback) { + var cb = flushSafe(callback), + timestamp = self.frameTimestamp, + keyframeTimestamp = self.keyframeTimestamp; + demuxer.dequeueVideoPacket(function(packet) { + videoDecoder.processFrame(packet, function(ok) { + // hack + if (videoDecoder.frameBuffer) { + videoDecoder.frameBuffer.timestamp = timestamp; + videoDecoder.frameBuffer.keyframeTimestamp = keyframeTimestamp; + } + cb(ok); + }); + }); + }; + + self.decodeAudio = function(callback) { + var cb = flushSafe(callback); + demuxer.dequeueAudioPacket(function(packet) { + audioDecoder.processAudio(packet, cb); + }); + } + + self.discardFrame = function(callback) { + demuxer.dequeueVideoPacket(function(packet) { + callback(); + }); + }; + + self.discardAudio = function(callback) { + demuxer.dequeueAudioPacket(function(packet) { + callback(); + }); + }; + + self.flush = function(callback) { + flushIter++; + demuxer.flush(callback); + }; + + self.getKeypointOffset = function(timeSeconds, callback) { + demuxer.getKeypointOffset(timeSeconds, callback); + }; + + self.seekToKeypoint = function(timeSeconds, callback) { + demuxer.seekToKeypoint(timeSeconds, flushSafe(callback)); + } + + self.onseek = null; + + Object.defineProperty(self, "demuxerCpuTime", { + get: function() { + if (demuxer) { + return demuxer.cpuTime; + } else { + return 0; + } + } + }); + Object.defineProperty(self, "audioCpuTime", { + get: function() { + if (audioDecoder) { + return audioDecoder.cpuTime; + } else { + return 0; + } + } + }); + Object.defineProperty(self, "videoCpuTime", { + get: function() { + if (videoDecoder) { + return videoDecoder.cpuTime; + } else { + return 0; + } + } + }); + + return self; + }); + + module.exports = OGVWrapperCodec; + + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/data/telegram.org/js/pako-inflate.min.js b/data/telegram.org/js/pako-inflate.min.js new file mode 100644 index 0000000000..a191a78a89 --- /dev/null +++ b/data/telegram.org/js/pako-inflate.min.js @@ -0,0 +1 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pako=e()}}(function(){return function r(o,s,f){function l(t,e){if(!s[t]){if(!o[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(d)return d(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var a=s[t]={exports:{}};o[t][0].call(a.exports,function(e){return l(o[t][1][e]||e)},a,a.exports,r,o,s,f)}return s[t].exports}for(var d="function"==typeof require&&require,e=0;e>>6:(i<65536?t[r++]=224|i>>>12:(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63),t[r++]=128|i>>>6&63),t[r++]=128|63&i);return t},i.buf2binstring=function(e){return d(e,e.length)},i.binstring2buf=function(e){for(var t=new f.Buf8(e.length),i=0,n=t.length;i>10&1023,s[n++]=56320|1023&a)}return d(s,n)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0?t:0===i?t:i+l[e[i]]>t?i:t}},{"./common":1}],3:[function(e,t,i){"use strict";t.exports=function(e,t,i,n){for(var a=65535&e|0,r=e>>>16&65535|0,o=0;0!==i;){for(i-=o=2e3>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var a=s,r=n+i;e^=-1;for(var o=n;o>>8^a[255&(e^t[o])];return-1^e}},{}],6:[function(e,t,i){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(e,t,i){"use strict";t.exports=function(e,t){var i,n,a,r,o,s,f,l,d,c,u,h,b,m,w,k,_,g,v,p,x,y,S,E,Z;i=e.state,n=e.next_in,E=e.input,a=n+(e.avail_in-5),r=e.next_out,Z=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),f=i.dmax,l=i.wsize,d=i.whave,c=i.wnext,u=i.window,h=i.hold,b=i.bits,m=i.lencode,w=i.distcode,k=(1<>>=v=g>>>24,b-=v,0===(v=g>>>16&255))Z[r++]=65535&g;else{if(!(16&v)){if(0==(64&v)){g=m[(65535&g)+(h&(1<>>=v,b-=v),b<15&&(h+=E[n++]<>>=v=g>>>24,b-=v,!(16&(v=g>>>16&255))){if(0==(64&v)){g=w[(65535&g)+(h&(1<>>=v,b-=v,(v=r-o)>3,h&=(1<<(b-=p<<3))-1,e.next_in=n,e.next_out=r,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function r(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new z.Buf16(320),this.work=new z.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=F,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new z.Buf32(n),t.distcode=t.distdyn=new z.Buf32(a),t.sane=1,t.back=-1,T):U}function s(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,o(e)):U}function f(e,t){var i,n;return e&&e.state?(n=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=r.wsize?(z.arraySet(r.window,t,i-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(n<(a=r.wsize-r.wnext)&&(a=n),z.arraySet(r.window,t,i-n,a,r.wnext),(n-=a)?(z.arraySet(r.window,t,i-n,n,0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,i.check=N(i.check,B,2,0),d=l=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&l)){e.msg="unknown compression method",i.mode=30;break}if(d-=4,x=8+(15&(l>>>=4)),0===i.wbits)i.wbits=x;else if(x>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(B[0]=255&l,B[1]=l>>>8&255,i.check=N(i.check,B,2,0)),d=l=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,l+=n[r++]<>>8&255,B[2]=l>>>16&255,B[3]=l>>>24&255,i.check=N(i.check,B,4,0)),d=l=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,l+=n[r++]<>8),512&i.flags&&(B[0]=255&l,B[1]=l>>>8&255,i.check=N(i.check,B,2,0)),d=l=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,l+=n[r++]<>>8&255,i.check=N(i.check,B,2,0)),d=l=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(s<(h=i.length)&&(h=s),h&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),z.arraySet(i.head.extra,n,r,h,x)),512&i.flags&&(i.check=N(i.check,n,h,r)),s-=h,r+=h,i.length-=h),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;for(h=0;x=n[r+h++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x)),x&&h>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,l+=n[r++]<>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,l+=n[r++]<>>=1)){case 0:i.mode=14;break;case 1:if(H(i),i.mode=20,6!==t)break;l>>>=2,d-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}l>>>=2,d-=2;break;case 14:for(l>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,l+=n[r++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&l,d=l=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(h=i.length){if(s>>=5,d-=5,i.ndist=1+(31&l),l>>>=5,d-=5,i.ncode=4+(15&l),l>>>=4,d-=4,286>>=3,d-=3}for(;i.have<19;)i.lens[A[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,S={bits:i.lenbits},y=C(0,i.lens,0,19,i.lencode,0,i.work,S),i.lenbits=S.bits,y){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=w,d-=w,i.lens[i.have++]=_;else{if(16===_){for(E=w+2;d>>=w,d-=w,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}x=i.lens[i.have-1],h=3+(3&l),l>>>=2,d-=2}else if(17===_){for(E=w+3;d>>=w)),l>>>=3,d-=3}else{for(E=w+7;d>>=w)),l>>>=7,d-=7}if(i.have+h>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;h--;)i.lens[i.have++]=x}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,S={bits:i.lenbits},y=C(I,i.lens,0,i.nlen,i.lencode,0,i.work,S),i.lenbits=S.bits,y){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,S={bits:i.distbits},y=C(D,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,S),i.distbits=S.bits,y){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=s&&258<=f){e.next_out=o,e.avail_out=f,e.next_in=r,e.avail_in=s,i.hold=l,i.bits=d,O(e,u),o=e.next_out,a=e.output,f=e.avail_out,r=e.next_in,n=e.input,s=e.avail_in,l=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;k=(Z=i.lencode[l&(1<>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>g)])>>>16&255,_=65535&Z,!(g+(w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=g,d-=g,i.back+=g}if(l>>>=w,d-=w,i.back+=w,i.length=_,0===k){i.mode=26;break}if(32&k){i.back=-1,i.mode=12;break}if(64&k){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&k,i.mode=22;case 22:if(i.extra){for(E=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;k=(Z=i.distcode[l&(1<>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>g)])>>>16&255,_=65535&Z,!(g+(w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=g,d-=g,i.back+=g}if(l>>>=w,d-=w,i.back+=w,64&k){e.msg="invalid distance code",i.mode=30;break}i.offset=_,i.extra=15&k,i.mode=24;case 24:if(i.extra){for(E=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===f)break e;if(h=u-f,i.offset>h){if((h=i.offset-h)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}h>i.wnext?(h-=i.wnext,b=i.wsize-h):b=i.wnext-h,h>i.length&&(h=i.length),m=i.window}else m=a,b=o-i.offset,h=i.length;for(fh?(m=O[C+o[g]],w=A[z+o[g]]):(m=96,w=0),f=1<<_-S,v=l=1<>S)+(l-=f)]=b<<24|m<<16|w|0,0!==l;);for(f=1<<_-1;B&f;)f>>=1;if(0!==f?(B&=f-1,B+=f):B=0,g++,0==--R[_]){if(_===p)break;_=t[i+o[g]]}if(x<_&&(B&c)!==d){for(0===S&&(S=x),u+=v,E=1<<(y=_-S);y+S1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){arguments_=scriptArgs}else if(typeof arguments!="undefined"){arguments_=arguments}if(typeof quit==="function"){quit_=function(status){quit(status)}}if(typeof print!=="undefined"){if(typeof console==="undefined")console={};console.log=print;console.warn=console.error=typeof printErr!=="undefined"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}read_=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];function dynamicAlloc(size){var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end>_emscripten_get_heap_size()){abort()}HEAP32[DYNAMICTOP_PTR>>2]=end;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0,"getNativeTypeSize invalid bits "+bits+", type "+type);return bits/8}else{return 0}}}}var asm2wasmImports={"f64-rem":function(x,y){return x%y},"debugger":function(){}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};var getTempRet0=function(){return tempRet0};var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime;if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(typeof WebAssembly!=="object"){err("no native wasm support detected")}function setValue(ptr,value,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":HEAP8[ptr>>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var wasmMemory;var wasmTable=new WebAssembly.Table({"initial":684,"maximum":684,"element":"anyfunc"});var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}var WASM_PAGE_SIZE=65536;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var DYNAMIC_BASE=5316768,DYNAMICTOP_PTR=73680;var INITIAL_TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_TOTAL_MEMORY/WASM_PAGE_SIZE})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_TOTAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var Math_abs=Math.abs;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_min=Math.min;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="rlottie-wasm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(){var info={"env":asmLibraryArg,"wasi_unstable":asmLibraryArg,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function"){fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}Module["asm"]=createWasm;var tempDouble;var tempI64;__ATINIT__.push({func:function(){__GLOBAL__sub_I_rlottie_wrapper_cpp()}});function demangle(func){return func}function demangleAll(text){var regex=/\b__Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}function ___cxa_thread_atexit(){return _atexit.apply(null,arguments)}function ___cxa_uncaught_exceptions(){err("missing function: __cxa_uncaught_exceptions");abort(-1)}function ___lock(){}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}function ___map_file(pathname,size){___setErrNo(1);return-1}var PATH={splitPath:function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:function(l,r){return PATH.normalize(l+"/"+r)}};var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:function(from,to){from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(1)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+lengthe2.timestamp){create.push(key);total++}});var remove=[];Object.keys(dst.entries).forEach(function(key){var e=dst.entries[key];var e2=src.entries[key];if(!e2){remove.push(key);total++}});if(!total){return callback(null)}var errored=false;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err&&!errored){errored=true;return callback(err)}}transaction.onerror=function(e){done(this.error);e.preventDefault()};transaction.oncomplete=function(e){if(!errored){callback(null)}};create.sort().forEach(function(path){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,function(err,entry){if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)})}else{IDBFS.loadLocalEntry(path,function(err,entry){if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)})}});remove.sort().reverse().forEach(function(path){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}})}};var NODEFS={isWindows:false,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/);var flags=process["binding"]("constants");if(flags["fs"]){flags=flags["fs"]}NODEFS.flagsForNodeMap={1024:flags["O_APPEND"],64:flags["O_CREAT"],128:flags["O_EXCL"],0:flags["O_RDONLY"],2:flags["O_RDWR"],4096:flags["O_SYNC"],512:flags["O_TRUNC"],1:flags["O_WRONLY"]}},bufferFrom:function(arrayBuffer){return Buffer["alloc"]?Buffer.from(arrayBuffer):new Buffer(arrayBuffer)},mount:function(mount){assert(ENVIRONMENT_HAS_NODE);return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)},createNode:function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(22)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node},getMode:function(path){var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&292)>>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(22)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(-e.errno)}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(-e.errno)}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(-e.errno)}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(-e.errno)}}}if(position<0){throw new FS.ErrnoError(22)}return position}}};var WORKERFS={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(mount){assert(ENVIRONMENT_IS_WORKER);if(!WORKERFS.reader)WORKERFS.reader=new FileReaderSync;var root=WORKERFS.createNode(null,"/",WORKERFS.DIR_MODE,0);var createdParents={};function ensureParent(path){var parts=path.split("/");var parent=root;for(var i=0;i=stream.node.size)return 0;var chunk=stream.node.contents.slice(position,position+length);var ab=WORKERFS.reader.readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return chunk.size},write:function(stream,buffer,offset,length,position){throw new FS.ErrnoError(5)},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.size}}if(position<0){throw new FS.ErrnoError(22)}return position}}};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH_FS.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags==="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:function(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf("r")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf("w")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf("x")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,"x");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,"wx");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate==="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split("/");var d="";for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);if(typeof Uint8Array!="undefined")xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}};var lazyArray=this;lazyArray.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!=="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags){var buffer=new Uint8Array(HEAPU8.subarray(addr,addr+len));FS.msync(stream,buffer,0,len,flags)},doMkdir:function(path,mode){path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0},doMknod:function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-22}FS.mknod(path,mode,dev);return 0},doReadlink:function(path,buf,bufsize){if(bufsize<=0)return-22;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len},doAccess:function(path,amode){if(amode&~7){return-22}var node;var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;if(!node){return-2}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-13}return 0},doDup:function(path,flags,suggestFD){var suggest=FS.getStream(suggestFD);if(suggest)FS.close(suggest);return FS.open(path,flags,0,suggestFD,suggestFD).fd},doReadv:function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},getStreamFromFD:function(){var stream=FS.getStream(SYSCALLS.get());if(!stream)throw new FS.ErrnoError(9);return stream},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return-75}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[result>>2]=tempI64[0],HEAP32[result+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-22}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0;case 16:case 8:return-22;case 9:___setErrNo(22);return-1;default:{return-22}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-25;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-25;return 0}case 21519:{if(!stream.tty)return-25;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-25;return-22}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-25;return 0}case 21524:{if(!stream.tty)return-25;return 0}default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function __emscripten_syscall_munmap(addr,len){if(addr===-1||len===0){return-22}var info=SYSCALLS.mappings[addr];if(!info)return 0;if(len===info.len){var stream=FS.getStream(info.fd);SYSCALLS.doMsync(addr,stream,len,info.flags);FS.munmap(stream);SYSCALLS.mappings[addr]=null;if(info.allocated){_free(info.malloc)}}return 0}function ___syscall91(which,varargs){SYSCALLS.varargs=varargs;try{var addr=SYSCALLS.get(),len=SYSCALLS.get();return __emscripten_syscall_munmap(addr,len)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _fd_write(stream,iov,iovcnt,pnum){try{stream=FS.getStream(stream);if(!stream)throw new FS.ErrnoError(9);var num=SYSCALLS.doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___wasi_fd_write(){return _fd_write.apply(null,arguments)}function _abort(){abort()}function _emscripten_get_heap_size(){return HEAP8.length}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"},"%V":function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}var ___dso_handle=73712;FS.staticInit();if(ENVIRONMENT_HAS_NODE){var fs=require("fs");var NODEJS_PATH=require("path");NODEFS.staticInit()}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function invoke_iii(index,a1,a2){var sp=stackSave();try{return dynCall_iii(index,a1,a2)}catch(e){stackRestore(sp);if(e!==e+0&&e!=="longjmp")throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{dynCall_vi(index,a1)}catch(e){stackRestore(sp);if(e!==e+0&&e!=="longjmp")throw e;_setThrew(1,0)}}var asmGlobalArg={};var asmLibraryArg={"b":___assert_fail,"r":___cxa_pure_virtual,"q":___cxa_thread_atexit,"p":___cxa_uncaught_exceptions,"a":___dso_handle,"m":___lock,"H":___map_file,"G":___syscall140,"F":___syscall145,"l":___syscall221,"E":___syscall5,"D":___syscall54,"o":___syscall6,"C":___syscall91,"g":___unlock,"B":___wasi_fd_write,"__memory_base":1024,"__table_base":0,"c":_abort,"A":_emscripten_get_heap_size,"z":_emscripten_memcpy_big,"y":_emscripten_resize_heap,"j":_getenv,"f":_llvm_stackrestore,"e":_llvm_stacksave,"x":_llvm_trap,"i":_longjmp,"w":_pthread_cond_destroy,"u":_pthread_cond_signal,"n":_pthread_cond_wait,"t":_strftime_l,"d":abort,"k":getTempRet0,"v":invoke_iii,"s":invoke_vi,"memory":wasmMemory,"h":setTempRet0,"table":wasmTable};var asm=Module["asm"](asmGlobalArg,asmLibraryArg,buffer);Module["asm"]=asm;var __GLOBAL__sub_I_rlottie_wrapper_cpp=Module["__GLOBAL__sub_I_rlottie_wrapper_cpp"]=function(){return Module["asm"]["I"].apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return Module["asm"]["J"].apply(null,arguments)};var _free=Module["_free"]=function(){return Module["asm"]["K"].apply(null,arguments)};var _lottie_buffer=Module["_lottie_buffer"]=function(){return Module["asm"]["L"].apply(null,arguments)};var _lottie_destroy=Module["_lottie_destroy"]=function(){return Module["asm"]["M"].apply(null,arguments)};var _lottie_frame_count=Module["_lottie_frame_count"]=function(){return Module["asm"]["N"].apply(null,arguments)};var _lottie_init=Module["_lottie_init"]=function(){return Module["asm"]["O"].apply(null,arguments)};var _lottie_load_from_data=Module["_lottie_load_from_data"]=function(){return Module["asm"]["P"].apply(null,arguments)};var _lottie_render=Module["_lottie_render"]=function(){return Module["asm"]["Q"].apply(null,arguments)};var _lottie_resize=Module["_lottie_resize"]=function(){return Module["asm"]["R"].apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return Module["asm"]["S"].apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return Module["asm"]["T"].apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return Module["asm"]["X"].apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return Module["asm"]["Y"].apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return Module["asm"]["Z"].apply(null,arguments)};var dynCall_iii=Module["dynCall_iii"]=function(){return Module["asm"]["U"].apply(null,arguments)};var dynCall_v=Module["dynCall_v"]=function(){return Module["asm"]["V"].apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return Module["asm"]["W"].apply(null,arguments)};Module["asm"]=asm;Module["intArrayFromString"]=intArrayFromString;Module["cwrap"]=cwrap;Module["allocate"]=allocate;var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run(); diff --git a/data/telegram.org/js/tgsticker-worker.js b/data/telegram.org/js/tgsticker-worker.js new file mode 100644 index 0000000000..e61325a7fa --- /dev/null +++ b/data/telegram.org/js/tgsticker-worker.js @@ -0,0 +1,206 @@ +importScripts('rlottie-wasm.js'); +importScripts('pako-inflate.min.js'); + +function RLottieItem(reqId, jsString, width, height, fps) { + this.stringOnWasmHeap = null; + this.handle = null; + this.frameCount = 0; + + this.reqId = reqId; + this.width = width; + this.height = height; + this.fps = Math.max(1, Math.min(60, fps || 60)); + + this.dead = false; + + this.init(jsString, width, height); + + reply('loaded', this.reqId, this.frameCount, this.fps); +} + +RLottieItem.prototype.init = function(jsString) { + try { + this.handle = RLottieWorker.Api.init(); + + this.stringOnWasmHeap = allocate(intArrayFromString(jsString), 'i8', 0); + + this.frameCount = RLottieWorker.Api.loadFromData(this.handle, this.stringOnWasmHeap); + + RLottieWorker.Api.resize(this.handle, this.width, this.height); + } catch(e) { + console.error('init RLottieItem error:', e); + } +}; + +RLottieItem.prototype.render = function(frameNo, clamped) { + if(this.dead) return; + + if(this.frameCount < frameNo || frameNo < 0) { + return; + } + + try { + RLottieWorker.Api.render(this.handle, frameNo); + + var bufferPointer = RLottieWorker.Api.buffer(this.handle); + + var data = Module.HEAPU8.subarray(bufferPointer, bufferPointer + (this.width * this.height * 4)); + + if(!clamped) { + clamped = new Uint8ClampedArray(data); + } else { + clamped.set(data); + } + + reply('frame', this.reqId, frameNo, clamped); + } catch(e) { + console.error('Render error:', e); + this.dead = true; + } +}; + +RLottieItem.prototype.destroy = function() { + this.dead = true; + + RLottieWorker.Api.destroy(this.handle); +}; + +var RLottieWorker = (function() { + var worker = {}; + worker.Api = {}; + + function initApi() { + worker.Api = { + init: Module.cwrap('lottie_init', '', []), + destroy: Module.cwrap('lottie_destroy', '', ['number']), + resize: Module.cwrap('lottie_resize', '', ['number', 'number', 'number']), + buffer: Module.cwrap('lottie_buffer', 'number', ['number']), + frameCount: Module.cwrap('lottie_frame_count', 'number', ['number']), + render: Module.cwrap('lottie_render', '', ['number', 'number']), + loadFromData: Module.cwrap('lottie_load_from_data', 'number', ['number', 'number']), + }; + } + + worker.init = function() { + initApi(); + reply('ready'); + }; + + return worker; +}()); + +Module.onRuntimeInitialized = function() { + RLottieWorker.init(); +}; + +var items = {}; +var queryableFunctions = { + loadFromData: function(reqId, url, width, height) { + getUrlContent(url, function(err, data) { + if (err) { + return console.warn('Can\'t fetch file ' + url, err); + } + try { + var json = pako.inflate(data, {to: 'string'}); + var json_parsed = JSON.parse(json); + items[reqId] = new RLottieItem(reqId, json, width, height, json_parsed.fr); + } catch (e) { + return console.warn('Invalid file ' + url); + } + }); + }, + destroy: function(reqId) { + items[reqId].destroy(); + delete items[reqId]; + }, + renderFrame: function(reqId, frameNo, clamped) { + items[reqId].render(frameNo, clamped); + } +}; + +function defaultReply(message) { + // your default PUBLIC function executed only when main page calls the queryableWorker.postMessage() method directly + // do something +} + +/** + * Returns true when run in WebKit derived browsers. + * This is used as a workaround for a memory leak in Safari caused by using Transferable objects to + * transfer data between WebWorkers and the main thread. + * https://github.com/mapbox/mapbox-gl-js/issues/8771 + * + * This should be removed once the underlying Safari issue is fixed. + * + * @private + * @param scope {WindowOrWorkerGlobalScope} Since this function is used both on the main thread and WebWorker context, + * let the calling scope pass in the global scope object. + * @returns {boolean} + */ +var _isSafari = null; +function isSafari(scope) { + if(_isSafari == null) { + var userAgent = scope.navigator ? scope.navigator.userAgent : null; + _isSafari = !!scope.safari || + !!(userAgent && (/\b(iPad|iPhone|iPod)\b/.test(userAgent) || (!!userAgent.match('Safari') && !userAgent.match('Chrome')))); + } + return _isSafari; +} + +function reply() { + if(arguments.length < 1) { + throw new TypeError('reply - not enough arguments'); + } + + var args = Array.prototype.slice.call(arguments, 1); + if(isSafari(self)) { + postMessage({ 'queryMethodListener': arguments[0], 'queryMethodArguments': args }); + } else { + var transfer = []; + for(var i = 0; i < args.length; i++) { + if(args[i] instanceof ArrayBuffer) { + transfer.push(args[i]); + } + + if(args[i].buffer && args[i].buffer instanceof ArrayBuffer) { + transfer.push(args[i].buffer); + } + } + + postMessage({ 'queryMethodListener': arguments[0], 'queryMethodArguments': args }, transfer); + } +} + +onmessage = function(oEvent) { + if(oEvent.data instanceof Object && oEvent.data.hasOwnProperty('queryMethod') && oEvent.data.hasOwnProperty('queryMethodArguments')) { + queryableFunctions[oEvent.data.queryMethod].apply(self, oEvent.data.queryMethodArguments); + } else { + defaultReply(oEvent.data); + } +}; + + + +function getUrlContent(path, callback) { + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, true); + if ('responseType' in xhr) { + xhr.responseType = 'arraybuffer'; + } + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + xhr.onreadystatechange = function (event) { + if (xhr.readyState === 4) { + if (xhr.status === 200 || xhr.status === 0) { + callback(null, xhr.response || xhr.responseText); + } else { + callback(new Error('Ajax error: ' + this.status + ' ' + this.statusText)); + } + } + }; + xhr.send(); + } catch (e) { + callback(new Error(e)); + } +}; \ No newline at end of file diff --git a/data/tsf.telegram.org/js/billboard.js b/data/tsf.telegram.org/js/billboard.js new file mode 100644 index 0000000000..35d5efebbd --- /dev/null +++ b/data/tsf.telegram.org/js/billboard.js @@ -0,0 +1,13312 @@ +/*! + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * + * billboard.js, JavaScript chart library + * http://naver.github.io/billboard.js/ + * + * @version 1.7.1-snapshot + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("d3-time-format"), require("d3-selection"), require("d3-transition"), require("d3-axis"), require("d3-brush"), require("d3-scale"), require("d3-dsv"), require("d3-drag"), require("d3-shape"), require("d3-interpolate"), require("d3-color"), require("d3-zoom"), require("d3-ease")); + else if(typeof define === 'function' && define.amd) + define(["d3-time-format", "d3-selection", "d3-transition", "d3-axis", "d3-brush", "d3-scale", "d3-dsv", "d3-drag", "d3-shape", "d3-interpolate", "d3-color", "d3-zoom", "d3-ease"], factory); + else { + var a = typeof exports === 'object' ? factory(require("d3-time-format"), require("d3-selection"), require("d3-transition"), require("d3-axis"), require("d3-brush"), require("d3-scale"), require("d3-dsv"), require("d3-drag"), require("d3-shape"), require("d3-interpolate"), require("d3-color"), require("d3-zoom"), require("d3-ease")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(window, function(__WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__15__, __WEBPACK_EXTERNAL_MODULE__16__, __WEBPACK_EXTERNAL_MODULE__17__, __WEBPACK_EXTERNAL_MODULE__18__, __WEBPACK_EXTERNAL_MODULE__19__, __WEBPACK_EXTERNAL_MODULE__20__, __WEBPACK_EXTERNAL_MODULE__21__, __WEBPACK_EXTERNAL_MODULE__22__, __WEBPACK_EXTERNAL_MODULE__23__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 25); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +module.exports = _classCallCheck; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayWithHoles = __webpack_require__(2); + +var iterableToArrayLimit = __webpack_require__(3); + +var nonIterableRest = __webpack_require__(4); + +function _slicedToArray(arr, i) { + return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); +} + +module.exports = _slicedToArray; + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +module.exports = _arrayWithHoles; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +function _iterableToArrayLimit(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +module.exports = _iterableToArrayLimit; + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +module.exports = _nonIterableRest; + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +module.exports = _createClass; + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__6__; + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__7__; + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__8__; + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__9__; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +var arrayWithoutHoles = __webpack_require__(11); + +var iterableToArray = __webpack_require__(12); + +var nonIterableSpread = __webpack_require__(13); + +function _toConsumableArray(arr) { + return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); +} + +module.exports = _toConsumableArray; + +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } +} + +module.exports = _arrayWithoutHoles; + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +module.exports = _iterableToArray; + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +module.exports = _nonIterableSpread; + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } + +function _typeof(obj) { + if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { + module.exports = _typeof = function _typeof(obj) { + return _typeof2(obj); + }; + } else { + module.exports = _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); + }; + } + + return _typeof(obj); +} + +module.exports = _typeof; + +/***/ }), +/* 15 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__15__; + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__16__; + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__17__; + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__18__; + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__19__; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__20__; + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__21__; + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__22__; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__23__; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +// extracted by mini-css-extract-plugin + +/***/ }), +/* 25 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js +var classCallCheck = __webpack_require__(0); +var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js +var slicedToArray = __webpack_require__(1); +var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js +var createClass = __webpack_require__(5); +var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass); + +// EXTERNAL MODULE: external {"commonjs":"d3-time-format","commonjs2":"d3-time-format","amd":"d3-time-format","root":"d3"} +var external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_ = __webpack_require__(6); + +// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"} +var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(7); + +// EXTERNAL MODULE: external {"commonjs":"d3-transition","commonjs2":"d3-transition","amd":"d3-transition","root":"d3"} +var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_ = __webpack_require__(8); + +// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"} +var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(9); + +// CONCATENATED MODULE: ./src/config/classes.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + +/** + * CSS class names definition + * @private + */ +/* harmony default export */ var config_classes = ({ + arc: "bb-arc", + arcs: "bb-arcs", + area: "bb-area", + areas: "bb-areas", + axis: "bb-axis", + axisX: "bb-axis-x", + axisXLabel: "bb-axis-x-label", + axisY: "bb-axis-y", + axisY2: "bb-axis-y2", + axisY2Label: "bb-axis-y2-label", + axisYLabel: "bb-axis-y-label", + bar: "bb-bar", + bars: "bb-bars", + brush: "bb-brush", + button: "bb-button", + buttonZoomReset: "bb-zoom-reset", + chart: "bb-chart", + chartArc: "bb-chart-arc", + chartArcs: "bb-chart-arcs", + chartArcsBackground: "bb-chart-arcs-background", + chartArcsGaugeMax: "bb-chart-arcs-gauge-max", + chartArcsGaugeMin: "bb-chart-arcs-gauge-min", + chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit", + chartArcsTitle: "bb-chart-arcs-title", + chartBar: "bb-chart-bar", + chartBars: "bb-chart-bars", + chartLine: "bb-chart-line", + chartLines: "bb-chart-lines", + chartRadar: "bb-chart-radar", + chartRadars: "bb-chart-radars", + chartText: "bb-chart-text", + chartTexts: "bb-chart-texts", + circle: "bb-circle", + circles: "bb-circles", + colorPattern: "bb-color-pattern", + defocused: "bb-defocused", + dragarea: "bb-dragarea", + empty: "bb-empty", + eventRect: "bb-event-rect", + eventRects: "bb-event-rects", + eventRectsMultiple: "bb-event-rects-multiple", + eventRectsSingle: "bb-event-rects-single", + focused: "bb-focused", + gaugeValue: "bb-gauge-value", + grid: "bb-grid", + gridLines: "bb-grid-lines", + legendBackground: "bb-legend-background", + legendItem: "bb-legend-item", + legendItemEvent: "bb-legend-item-event", + legendItemFocused: "bb-legend-item-focused", + legendItemHidden: "bb-legend-item-hidden", + legendItemPoint: "bb-legend-item-point", + legendItemTile: "bb-legend-item-tile", + level: "bb-level", + levels: "bb-levels", + line: "bb-line", + lines: "bb-lines", + region: "bb-region", + regions: "bb-regions", + selectedCircle: "bb-selected-circle", + selectedCircles: "bb-selected-circles", + shape: "bb-shape", + shapes: "bb-shapes", + target: "bb-target", + text: "bb-text", + texts: "bb-texts", + title: "bb-title", + tooltip: "bb-tooltip", + tooltipContainer: "bb-tooltip-container", + tooltipName: "bb-tooltip-name", + xgrid: "bb-xgrid", + xgridFocus: "bb-xgrid-focus", + xgridLine: "bb-xgrid-line", + xgridLines: "bb-xgrid-lines", + xgrids: "bb-xgrids", + ygrid: "bb-ygrid", + ygridLine: "bb-ygrid-line", + ygridLines: "bb-ygrid-lines", + ygrids: "bb-ygrids", + zoomBrush: "bb-zoom-brush", + zoomRect: "bb-zoom-rect", + EXPANDED: "_expanded_", + SELECTED: "_selected_", + INCLUDED: "_included_" +}); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js +var toConsumableArray = __webpack_require__(10); +var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js +var helpers_typeof = __webpack_require__(14); +var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof); + +// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"} +var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(15); + +// CONCATENATED MODULE: ./src/internals/util.js + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * @ignore + */ + + + + +var isValue = function (v) { + return v || v === 0; +}, + isFunction = function (v) { + return typeof v === "function"; +}, + isString = function (v) { + return typeof v === "string"; +}, + isNumber = function (v) { + return typeof v === "number"; +}, + isUndefined = function (v) { + return typeof v === "undefined"; +}, + isDefined = function (v) { + return typeof v !== "undefined"; +}, + isBoolean = function (v) { + return typeof v === "boolean"; +}, + ceil10 = function (v) { + return Math.ceil(v / 10) * 10; +}, + asHalfPixel = function (n) { + return Math.ceil(n) + .5; +}, + diffDomain = function (d) { + return d[1] - d[0]; +}, + isObjectType = function (v) { + return typeof_default()(v) === "object"; +}, + isEmpty = function (o) { + return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o); +}, + notEmpty = function (o) { + return !isEmpty(o); +}, + isArray = function (arr) { + return arr && arr.constructor === Array; +}, + isObject = function (obj) { + return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj); +}, + getOption = function (options, key, defaultValue) { + return isDefined(options[key]) ? options[key] : defaultValue; +}, + util_hasValue = function (dict, value) { + var found = !1; + return Object.keys(dict).forEach(function (key) { + return dict[key] === value && (found = !0); + }), found; +}, + callFn = function (fn) { + for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key]; + + return isFn && fn.call.apply(fn, args), isFn; +}, + sanitise = function (str) { + return isString(str) ? str.replace(//g, ">") : str; +}, + getRectSegList = function (path) { + /* + * seg1 ---------- seg2 + * | | + * | | + * | | + * seg0 ---------- seg3 + * */ + var _path$getBBox = path.getBBox(), + x = _path$getBBox.x, + y = _path$getBBox.y, + width = _path$getBBox.width, + height = _path$getBBox.height; + + return [{ + x: x, + y: y + height + }, // seg0 + { + x: x, + y: y + }, // seg1 + { + x: x + width, + y: y + }, // seg2 + { + x: x + width, + y: y + height // seg3 + + }]; +}, + getPathBox = function (path) { + var _path$getBoundingClie = path.getBoundingClientRect(), + width = _path$getBoundingClie.width, + height = _path$getBoundingClie.height, + items = getRectSegList(path), + x = items[0].x, + y = Math.min(items[0].y, items[1].y); + + return { + x: x, + y: y, + width: width, + height: height + }; +}, + getBrushSelection = function (ctx) { + var selection = null, + event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"], + main = ctx.context || ctx.main; + return event && event.constructor.name === "BrushEvent" ? selection = event.selection : main && (selection = main.select(".".concat(config_classes.brush)).node()) && (selection = Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushSelection"])(selection)), selection; +}, + getRandom = function () { + var asStr = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0]; + return Math.random() + (asStr ? "" : 0); +}, + brushEmpty = function (ctx) { + var selection = getBrushSelection(ctx); + return !selection || selection[0] === selection[1]; +}, + extend = function () { + var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + source = arguments.length > 1 ? arguments[1] : undefined; + + for (var p in source) target[p] = source[p]; + + return target; +}, + capitalize = function (str) { + return str.charAt(0).toUpperCase() + str.slice(1); +}, + toArray = function (v) { + return [].slice.call(v); +}, + getCssRules = function (styleSheets) { + var rules = []; + return styleSheets.forEach(function (sheet) { + try { + sheet.cssRules && sheet.cssRules.length && (rules = rules.concat(toArray(sheet.cssRules))); + } catch (e) { + console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString())); + } + }), rules; +}, + getUnique = function (data) { + return data.filter(function (v, i, self) { + return self.indexOf(v) === i; + }); +}, + mergeArray = function (arr) { + return arr && arr.length ? arr.reduce(function (p, c) { + return p.concat(c); + }) : []; +}, + sortValue = function (data) { + var fn, + isAsc = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1]; + return data[0] instanceof Date ? fn = isAsc ? function (a, b) { + return a - b; + } : function (a, b) { + return b - a; + } : !isAsc && (fn = function (a, b) { + return a > b && -1 || a < b && 1 || a === b && 0; + }), data.concat().sort(fn); +}, + getMinMax = function (type, data) { + var res = data.filter(function (v) { + return notEmpty(v); + }); + return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, toConsumableArray_default()(res)) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res; +}, + getRange = function (start, end) { + var res = []; + + for (var i = start; i < end; i++) res.push(i); + + return res; +}, + emulateEvent = { + mouse: function () { + var getParams = function () { + return { + bubbles: !1, + cancelable: !1, + screenX: 0, + screenY: 0, + clientX: 0, + clientY: 0 + }; + }; + + try { + return new MouseEvent("t"), function (el, eventType) { + var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams(); + el.dispatchEvent(new MouseEvent(eventType, params)); + }; + } catch (e) { + // Polyfills DOM4 MouseEvent + return function (el, eventType) { + var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams(), + mouseEvent = document.createEvent("MouseEvent"); + mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, // the event's mouse click count + params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent); + }; + } + }(), + touch: function touch(el, eventType, params) { + var touchObj = new Touch(Object.assign({ + identifier: Date.now(), + target: el, + radiusX: 2.5, + radiusY: 2.5, + rotationAngle: 10, + force: .5 + }, params)); + el.dispatchEvent(new TouchEvent(eventType, { + cancelable: !0, + bubbles: !0, + shiftKey: !0, + touches: [touchObj], + targetTouches: [], + changedTouches: [touchObj] + })); + } +}; + + +// EXTERNAL MODULE: external {"commonjs":"d3-scale","commonjs2":"d3-scale","amd":"d3-scale","root":"d3"} +var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(16); + +// CONCATENATED MODULE: ./src/axis/AxisRendererHelper.js + + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * @ignore + */ + + + +var AxisRendererHelper_AxisRendererHelper = +/*#__PURE__*/ +function () { + function AxisRendererHelper(config, params) { + classCallCheck_default()(this, AxisRendererHelper); + + var scale = Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleLinear"])(); + this.config = config, this.scale = scale, params.config.transition_duration || (config.noTransition = !0), config.range = scale.rangeExtent ? scale.rangeExtent() : this.scaleExtent((params.orgXScale || scale).range()); + } + /** + * Compute a character dimension + * @param {d3.selection} node + * @return {{w: number, h: number}} + * @private + */ + + + return createClass_default()(AxisRendererHelper, [{ + key: "axisX", + value: function axisX(selection, x) { + var tickOffset = this.config.tickOffset; + selection.attr("transform", function (d) { + return "translate(".concat(Math.ceil(x(d) + tickOffset), ", 0)"); + }); + } + }, { + key: "axisY", + value: function axisY(selection, y) { + selection.attr("transform", function (d) { + return "translate(0,".concat(Math.ceil(y(d)), ")"); + }); + } + }, { + key: "scaleExtent", + value: function scaleExtent(domain) { + var start = domain[0], + stop = domain[domain.length - 1]; + return start < stop ? [start, stop] : [stop, start]; + } + }, { + key: "generateTicks", + value: function generateTicks(scale) { + var ticks = []; + if (scale.ticks) return scale.ticks.apply(scale, toConsumableArray_default()(this.config.tickArguments || [])).map(function (v) { + return (// round the tick value if is number + isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v + ); + }); + + for (var domain = scale.domain(), i = Math.ceil(domain[0]); i < domain[1]; i++) ticks.push(i); + + return ticks.length > 0 && ticks[0] > 0 && ticks.unshift(ticks[0] - (ticks[1] - ticks[0])), ticks; + } + }, { + key: "copyScale", + value: function copyScale() { + var newScale = this.scale.copy(); + return newScale.domain().length || newScale.domain(this.scale.domain()), newScale; + } + }, { + key: "textFormatted", + value: function textFormatted(v) { + var tickFormat = this.config.tickFormat, + value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v, + formatted = tickFormat ? tickFormat(value) : value; // to round float numbers from 'binary floating point' + // https://en.wikipedia.org/wiki/Double-precision_floating-point_format + // https://stackoverflow.com/questions/17849101/laymans-explanation-for-why-javascript-has-weird-floating-math-ieee-754-stand + + return isDefined(formatted) ? formatted : ""; + } + }, { + key: "transitionise", + value: function transitionise(selection) { + var config = this.config; + return config.noTransition ? selection.interrupt() : selection.transition(config.transition); + } + }], [{ + key: "getSizeFor1Char", + value: function getSizeFor1Char(node) { + // default size for one character + var size = { + w: 5.5, + h: 11.5 + }; + return node.empty() || node.select("text").text("0").call(function (el) { + try { + var _el$node$getBBox = el.node().getBBox(), + width = _el$node$getBBox.width, + height = _el$node$getBBox.height; + + width && height && (size.w = width, size.h = height), el.text(""); + } catch (e) {} + }), this.getSizeFor1Char = function () { + return size; + }, size; + } + }]), AxisRendererHelper; +}(); + + +// CONCATENATED MODULE: ./src/axis/AxisRenderer.js + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * @ignore + */ + + + + +var AxisRenderer_AxisRenderer = +/*#__PURE__*/ +function () { + function AxisRenderer() { + var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + classCallCheck_default()(this, AxisRenderer); + + var config = { + innerTickSize: 6, + outerTickSize: params.outerTick ? 6 : 0, + orient: "bottom", + range: [], + tickArguments: null, + tickCentered: null, + tickCulling: !0, + tickFormat: null, + tickLength: 9, + tickOffset: 0, + tickPadding: 3, + tickValues: null, + transition: null, + noTransition: params.noTransition + }; + config.tickLength = Math.max(config.innerTickSize, 0) + config.tickPadding, this.helper = new AxisRendererHelper_AxisRendererHelper(config, params), this.config = config, this.params = params; + } + /** + * Create axis element + * @param {d3.selection} g + * @private + */ + + + return createClass_default()(AxisRenderer, [{ + key: "create", + value: function create(g) { + var ctx = this, + config = this.config, + params = this.params, + helperInst = this.helper, + scale = helperInst.scale, + orient = config.orient, + splitTickText = this.splitTickText.bind(this), + isLeftRight = /^(left|right)$/.test(orient), + isTopBottom = /^(top|bottom)$/.test(orient), + tickTransform = helperInst[isTopBottom ? "axisX" : "axisY"], + axisPx = tickTransform === helperInst.axisX ? "y" : "x", + sign = /^(top|left)$/.test(orient) ? -1 : 1, + rotate = params.tickTextRotate; + this.config.range = scale.rangeExtent ? scale.rangeExtent() : helperInst.scaleExtent((params.orgXScale || scale).range()); + var _config = config, + innerTickSize = _config.innerTickSize, + tickLength = _config.tickLength, + range = _config.range, + name = params.name, + tickTextPos = name && /^(x|y|y2)$/.test(name) ? params.config["axis_".concat(name, "_tick_text_position")] : { + x: 0, + y: 0 + }, + prefix = name === "subX" ? "subchart_axis_x" : "axis_".concat(name), + axisShow = params.config["".concat(prefix, "_show")], + tickShow = { + tick: !!axisShow && params.config["".concat(prefix, "_tick_show")], + text: !!axisShow && params.config["".concat(prefix, "_tick_text_show")] + }, + $g = null; // // get the axis' tick position configuration + + g.each(function () { + var g = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + scale0 = this.__chart__ || scale, + scale1 = helperInst.copyScale(); + $g = g, this.__chart__ = scale1, config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0; + // update selection - data join + var path = g.selectAll(".domain").data([0]); // enter + update selection + + if (path.enter().append("path").attr("class", "domain").merge(helperInst.transitionise(path)).attr("d", function () { + var outerTickSized = config.outerTickSize * sign; + return isTopBottom ? "M".concat(range[0], ",").concat(outerTickSized, "V0H").concat(range[1], "V").concat(outerTickSized) : "M".concat(outerTickSized, ",").concat(range[0], "H0V").concat(range[1], "H").concat(outerTickSized); + }), tickShow.tick || tickShow.text) { + // count of tick data in array + var ticks = config.tickValues || helperInst.generateTicks(scale1), + tick = g.selectAll(".tick").data(ticks, scale1), + tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", "1"), + tickExit = tick.exit().remove(); // update selection + + tick = tickEnter.merge(tick), tickShow.tick && tickEnter.append("line"), tickShow.text && tickEnter.append("text"); + var sizeFor1Char = AxisRendererHelper_AxisRendererHelper.getSizeFor1Char(tick), + counts = [], + tspan = tick.select("text").selectAll("tspan").data(function (d, index) { + var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helperInst.textFormatted(d)) ? helperInst.textFormatted(d).concat() : [helperInst.textFormatted(d)]; + return counts[index] = split.length, split.map(function (splitted) { + return { + index: index, + splitted: splitted + }; + }); + }); + tspan.exit().remove(), tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) { + return d.splitted; + }), tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () { + var dx = 0; + return orient === "bottom" && rotate && (dx = 8 * Math.sin(Math.PI * (rotate / 180))), dx + (tickTextPos.x || 0); + }()).attr("dy", function (d, i) { + var dy = 0; + return orient !== "top" && (dy = sizeFor1Char.h, i === 0 && (dy = isLeftRight ? -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) : tickTextPos.y === 0 ? ".71em" : 0)), isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || ".71em"; + }); + var lineUpdate = tick.select("line"), + textUpdate = tick.select("text"); + + if (tickEnter.select("line").attr("".concat(axisPx, "2"), innerTickSize * sign), tickEnter.select("text").attr("".concat(axisPx), tickLength * sign), ctx.setTickLineTextPosition(lineUpdate, textUpdate), params.tickTitle && textUpdate.append && textUpdate.append("title").each(function (index) { + Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).text(params.tickTitle[index]); + }), scale1.bandwidth) { + var x = scale1, + dx = x.bandwidth() / 2; + scale0 = function (d) { + return x(d) + dx; + }, scale1 = scale0; + } else scale0.bandwidth ? scale0 = scale1 : tickTransform.call(helperInst, tickExit, scale1); + + tickTransform.call(helperInst, tickEnter, scale0), tickTransform.call(helperInst, helperInst.transitionise(tick).style("opacity", 1), scale1); + } + }), this.g = $g; + } + /** + * Get tick x/y coordinate + * @return {{x: number, y: number}} + * @private + */ + + }, { + key: "getTickXY", + value: function getTickXY() { + var config = this.config, + pos = { + x: 0, + y: 0 + }; + return this.params.isCategory && (pos.x = config.tickCentered ? 0 : config.tickOffset, pos.y = config.tickCentered ? config.tickOffset : 0), pos; + } + /** + * Get tick size + * @param d + * @return {number} + * @private + */ + + }, { + key: "getTickSize", + value: function getTickSize(d) { + var scale = this.helper.scale, + config = this.config, + innerTickSize = config.innerTickSize, + range = config.range, + tickPosition = scale(d) + (config.tickCentered ? 0 : config.tickOffset); + return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0; + } + /** + * Set tick's line & text position + * @param lineUpdate + * @param textUpdate + * @param scale + * @private + */ + + }, { + key: "setTickLineTextPosition", + value: function setTickLineTextPosition(lineUpdate, textUpdate) { + var tickPos = this.getTickXY(), + _this$config = this.config, + innerTickSize = _this$config.innerTickSize, + orient = _this$config.orient, + tickLength = _this$config.tickLength, + tickOffset = _this$config.tickOffset, + rotate = this.params.tickTextRotate; + orient === "bottom" ? (lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this)), textUpdate.attr("x", 0).attr("y", function yForText(r) { + return r ? 11.5 - 2.5 * (r / 15) * (r > 0 ? 1 : -1) : tickLength; + }(rotate)).style("text-anchor", function textAnchorForText(r) { + return r ? r > 0 ? "start" : "end" : "middle"; + }(rotate)).attr("transform", function textTransform(r) { + return r ? "rotate(".concat(r, ")") : null; + }(rotate))) : orient === "top" ? (lineUpdate.attr("x2", 0).attr("y2", -innerTickSize), textUpdate.attr("x", 0).attr("y", -tickLength * 2).style("text-anchor", "middle")) : orient === "left" ? (lineUpdate.attr("x2", -innerTickSize).attr("y1", tickPos.y).attr("y2", tickPos.y), textUpdate.attr("x", -tickLength).attr("y", tickOffset).style("text-anchor", "end")) : orient === "right" ? (lineUpdate.attr("x2", innerTickSize).attr("y2", 0), textUpdate.attr("x", tickLength).attr("y", 0).style("text-anchor", "start")) : void 0; + } // this should be called only when category axis + + }, { + key: "splitTickText", + value: function splitTickText(d, scale, ticks, isLeftRight, charWidth) { + function split(splitted, text) { + for (var subtext, spaceIndex, textWidth, i = 1; i < text.length; i++) // if text width gets over tick width, split by space index or current index + if (text.charAt(i) === " " && (spaceIndex = i), subtext = text.substr(0, i + 1), textWidth = charWidth * subtext.length, tickWidth < textWidth) return split(splitted.concat(text.substr(0, spaceIndex || i)), text.slice(spaceIndex ? spaceIndex + 1 : i)); + + return splitted.concat(text); + } + + var params = this.params, + tickText = this.helper.textFormatted(d), + splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : []; + if (splitted.length) return splitted; + if (isArray(tickText)) return tickText; + var tickWidth = params.tickWidth; + return (!tickWidth || tickWidth <= 0) && (tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110), split(splitted, tickText + ""); + } + }, { + key: "scale", + value: function scale(x) { + return arguments.length ? (this.helper.scale = x, this) : this.helper.scale; + } + }, { + key: "orient", + value: function orient(x) { + return arguments.length ? (this.config.orient = x in { + top: 1, + right: 1, + bottom: 1, + left: 1 + } ? x + "" : "bottom", this) : this.config.orient; + } + }, { + key: "tickFormat", + value: function tickFormat(format) { + return arguments.length ? (this.config.tickFormat = format, this) : this.config.tickFormat; + } + }, { + key: "tickCentered", + value: function tickCentered(isCentered) { + var config = this.config; + return arguments.length ? (config.tickCentered = isCentered, this) : config.tickCentered; + } + /** + * Return tick's offset value. + * The value will be set for 'category' axis type. + * @return {number} + * @private + */ + + }, { + key: "tickOffset", + value: function tickOffset() { + return this.config.tickOffset; + } + /** + * Get tick interval count + * @private + * @param {Number} size Total data size + * @return {number} + */ + + }, { + key: "tickInterval", + value: function tickInterval(size) { + var interval; + if (this.params.isCategory) interval = this.config.tickOffset * 2;else { + var length = this.g.select("path.domain").node().getTotalLength() - this.config.outerTickSize * 2; + interval = length / (size || this.g.selectAll("line").size()); + } + return interval === Infinity ? 0 : interval; + } + }, { + key: "ticks", + value: function ticks() { + for (var config = this.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; + + return args.length ? (config.tickArguments = toArray(args), this) : config.tickArguments; + } + }, { + key: "tickCulling", + value: function tickCulling(culling) { + var config = this.config; + return arguments.length ? (config.tickCulling = culling, this) : config.tickCulling; + } + }, { + key: "tickValues", + value: function tickValues(x) { + var _this = this, + config = this.config; + + if (isFunction(x)) config.tickValues = function () { + return x(_this.helper.scale.domain()); + };else { + if (!arguments.length) return config.tickValues; + config.tickValues = x; + } + return this; + } + }, { + key: "setTransition", + value: function setTransition(t) { + return this.config.transition = t, this; + } + }]), AxisRenderer; +}(); + + +// CONCATENATED MODULE: ./src/axis/Axis.js + + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +var isHorizontal = function ($$, forHorizontal) { + var isRotated = $$.config.axis_rotated; + return forHorizontal ? isRotated : !isRotated; +}, + getAxisClassName = function (id) { + return "".concat(config_classes.axis, " ").concat(config_classes["axis".concat(capitalize(id))]); +}; + +var Axis_Axis = +/*#__PURE__*/ +function () { + function Axis(owner) { + classCallCheck_default()(this, Axis), this.owner = owner; + } + + return createClass_default()(Axis, [{ + key: "init", + value: function init() { + var _this = this, + $$ = this.owner, + config = $$.config, + isRotated = config.axis_rotated, + main = $$.main, + target = ["x", "y"]; + + config.axis_y2_show && target.push("y2"), $$.axesList = {}, target.forEach(function (v) { + var classAxis = getAxisClassName(v), + classLabel = config_classes["axis".concat(capitalize(v), "Label")]; + $$.axes[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () { + var res = null; + return v === "x" ? res = $$.clipPathForXAxis : v === "y" && config.axis_y_inner && (res = $$.clipPathForYAxis), res; + }).attr("transform", $$.getTranslate(v)).style("visibility", config["axis_".concat(v, "_show")] ? "visible" : "hidden"), $$.axes[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", _this.textAnchorForXAxisLabel.bind(_this)), _this.generateAxes(v); + }); + } + /** + * Generate axes + * It's used when axis' axes option is set + * @param {String} id Axis id + * @private + */ + + }, { + key: "generateAxes", + value: function generateAxes(id) { + var d3Axis, + $$ = this.owner, + config = $$.config, + axes = [], + axesConfig = config["axis_".concat(id, "_axes")], + isRotated = config.axis_rotated; + id === "x" ? d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisLeft"] : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisBottom"] : id === "y" ? d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisBottom"] : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisLeft"] : id === "y2" && (d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisTop"] : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisRight"]), axesConfig.length && axesConfig.forEach(function (v) { + var tick = v.tick; + axes.push(d3Axis($$[id]).ticks(tick.count).tickFormat(tick.format || function (x) { + return x; + }).tickValues(tick.values).tickSizeOuter(tick.outer === !1 ? 0 : 6)); + }), $$.axesList[id] = axes; + } + /** + * Update axes nodes + * @private + */ + + }, { + key: "updateAxes", + value: function updateAxes() { + var $$ = this.owner, + config = $$.config; + Object.keys($$.axesList).forEach(function (id) { + $$.axesList[id].forEach(function (v, i) { + var className = "".concat(getAxisClassName(id), "-").concat(i + 1), + g = $$.main.select(".".concat(className.replace(/\s/, "."))); + g.empty() ? g = $$.main.append("g").attr("class", className).style("visibility", config["axis_".concat(id, "_show")] ? "visible" : "hidden").call(v) : $$.xAxis.helper.transitionise(g).call(v.scale($$[id])), g.attr("transform", $$.getTranslate(id, i + 1)); + }); + }); + } // called from : updateScales() & getMaxTickWidth() + + }, { + key: "getXAxis", + value: function getXAxis(name, scale, outerTick, noTransition, noTickTextRotate) { + var $$ = this.owner, + config = $$.config, + isCategory = $$.isCategorized(), + orient = $$["".concat(name, "Orient")], + tickFormat = $$.xAxisTickFormat, + tickValues = $$.xAxisTickValues, + axisParams = { + isCategory: isCategory, + outerTick: outerTick, + noTransition: noTransition, + config: config, + name: name, + tickMultiline: config.axis_x_tick_multiline, + tickWidth: config.axis_x_tick_width, + tickTextRotate: noTickTextRotate ? 0 : config.axis_x_tick_rotate, + tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(), + orgXScale: $$.x + }, + axis = new AxisRenderer_AxisRenderer(axisParams).scale($$.zoomScale || scale).orient(orient), + newTickValues = tickValues; + return $$.isTimeSeries() && tickValues && !isFunction(tickValues) && (newTickValues = tickValues.map(function (v) { + return $$.parseDate(v); + })), axis.tickFormat(tickFormat).tickValues(newTickValues), isCategory && (axis.tickCentered(config.axis_x_tick_centered), isEmpty(config.axis_x_tick_culling) && (config.axis_x_tick_culling = !1)), axis; + } // called from : updateScales() & getMaxTickWidth() + + }, { + key: "getYAxis", + value: function getYAxis(name, scale, outerTick, noTransition, noTickTextRotate) { + var $$ = this.owner, + config = $$.config, + orient = $$["".concat(name, "Orient")], + tickFormat = config["axis_".concat(name, "_tick_format")], + tickValues = $$["".concat(name, "AxisTickValues")], + axisParams = { + outerTick: outerTick, + noTransition: noTransition, + config: config, + name: name, + tickTextRotate: noTickTextRotate ? 0 : config.axis_y_tick_rotate + }, + axis = new AxisRenderer_AxisRenderer(axisParams).scale(scale).orient(orient).tickFormat(tickFormat || $$.isStackNormalized() && function (x) { + return "".concat(x, "%"); + }); + return $$.isTimeSeriesY() ? // https://github.com/d3/d3/blob/master/CHANGES.md#time-intervals-d3-time + axis.ticks(config.axis_y_tick_time_value) : axis.tickValues(tickValues), axis; + } + }, { + key: "updateXAxisTickValues", + value: function updateXAxisTickValues(targets, axis) { + var tickValues, + $$ = this.owner, + config = $$.config, + xTickCount = config.axis_x_tick_count; + return (config.axis_x_tick_fit || xTickCount) && (tickValues = this.generateTickValues($$.mapTargetsToUniqueXs(targets), xTickCount, $$.isTimeSeries())), axis ? axis.tickValues(tickValues) : $$.xAxis && ($$.xAxis.tickValues(tickValues), $$.subXAxis.tickValues(tickValues)), tickValues; + } + }, { + key: "getId", + value: function getId(id) { + var config = this.owner.config; + return id in config.data_axes ? config.data_axes[id] : "y"; + } + }, { + key: "getXAxisTickFormat", + value: function getXAxisTickFormat() { + var format, + $$ = this.owner, + config = $$.config, + tickFormat = config.axis_x_tick_format, + isTimeSeries = $$.isTimeSeries(), + isCategorized = $$.isCategorized(); + return tickFormat ? isFunction(tickFormat) ? format = tickFormat : isTimeSeries && (format = function (date) { + return date ? $$.axisTimeFormat(tickFormat)(date) : ""; + }) : format = isTimeSeries ? $$.defaultAxisTimeFormat : isCategorized ? $$.categoryName : function (v) { + return v < 0 ? v.toFixed(0) : v; + }, isFunction(format) ? function (v) { + return format.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]); + } : format; + } + }, { + key: "getTickValues", + value: function getTickValues(id) { + var $$ = this.owner, + tickValues = $$.config["axis_".concat(id, "_tick_values")], + axis = $$["".concat(id, "Axis")]; + return tickValues || (axis ? axis.tickValues() : undefined); + } + }, { + key: "getXAxisTickValues", + value: function getXAxisTickValues() { + return this.getTickValues("x"); + } + }, { + key: "getYAxisTickValues", + value: function getYAxisTickValues() { + return this.getTickValues("y"); + } + }, { + key: "getY2AxisTickValues", + value: function getY2AxisTickValues() { + return this.getTickValues("y2"); + } + }, { + key: "getLabelOptionByAxisId", + value: function getLabelOptionByAxisId(id) { + return this.owner.config["axis_".concat(id, "_label")]; + } + }, { + key: "getLabelText", + value: function getLabelText(id) { + var option = this.getLabelOptionByAxisId(id); + return isString(option) ? option : option ? option.text : null; + } + }, { + key: "setLabelText", + value: function setLabelText(id, text) { + var $$ = this.owner, + config = $$.config, + option = this.getLabelOptionByAxisId(id); + isString(option) ? config["axis_".concat(id, "_label")] = text : option && (option.text = text); + } + }, { + key: "getLabelPosition", + value: function getLabelPosition(id, defaultPosition) { + var isRotated = this.owner.config.axis_rotated, + option = this.getLabelOptionByAxisId(id), + position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated], + has = function (v) { + return !!~position.indexOf(v); + }; + + return { + isInner: has("inner"), + isOuter: has("outer"), + isLeft: has("left"), + isCenter: has("center"), + isRight: has("right"), + isTop: has("top"), + isMiddle: has("middle"), + isBottom: has("bottom") + }; + } + }, { + key: "getXAxisLabelPosition", + value: function getXAxisLabelPosition() { + return this.getLabelPosition("x", ["inner-top", "inner-right"]); + } + }, { + key: "getYAxisLabelPosition", + value: function getYAxisLabelPosition() { + return this.getLabelPosition("y", ["inner-right", "inner-top"]); + } + }, { + key: "getY2AxisLabelPosition", + value: function getY2AxisLabelPosition() { + return this.getLabelPosition("y2", ["inner-right", "inner-top"]); + } + }, { + key: "getLabelPositionById", + value: function getLabelPositionById(id) { + return this["get".concat(id.toUpperCase(), "AxisLabelPosition")](); + } + }, { + key: "textForXAxisLabel", + value: function textForXAxisLabel() { + return this.getLabelText("x"); + } + }, { + key: "textForYAxisLabel", + value: function textForYAxisLabel() { + return this.getLabelText("y"); + } + }, { + key: "textForY2AxisLabel", + value: function textForY2AxisLabel() { + return this.getLabelText("y2"); + } + }, { + key: "xForAxisLabel", + value: function xForAxisLabel(position) { + var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1], + $$ = this.owner, + x = position.isMiddle ? -$$.height / 2 : 0; + return isHorizontal($$, forHorizontal) ? x = position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width : position.isBottom && (x = -$$.height), x; + } + }, { + key: "dxForAxisLabel", + value: function dxForAxisLabel(position) { + var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1], + $$ = this.owner, + dx = position.isBottom ? "0.5em" : "0"; + return isHorizontal($$, forHorizontal) ? dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0" : position.isTop && (dx = "-0.5em"), dx; + } + }, { + key: "textAnchorForAxisLabel", + value: function textAnchorForAxisLabel(position) { + var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1], + $$ = this.owner, + anchor = position.isMiddle ? "middle" : "end"; + return isHorizontal($$, forHorizontal) ? anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end" : position.isBottom && (anchor = "start"), anchor; + } + }, { + key: "xForXAxisLabel", + value: function xForXAxisLabel() { + return this.xForAxisLabel(this.getXAxisLabelPosition(), !1); + } + }, { + key: "xForYAxisLabel", + value: function xForYAxisLabel() { + return this.xForAxisLabel(this.getYAxisLabelPosition()); + } + }, { + key: "xForY2AxisLabel", + value: function xForY2AxisLabel() { + return this.xForAxisLabel(this.getY2AxisLabelPosition()); + } + }, { + key: "dxForXAxisLabel", + value: function dxForXAxisLabel() { + return this.dxForAxisLabel(this.getXAxisLabelPosition(), !1); + } + }, { + key: "dxForYAxisLabel", + value: function dxForYAxisLabel() { + return this.dxForAxisLabel(this.getYAxisLabelPosition()); + } + }, { + key: "dxForY2AxisLabel", + value: function dxForY2AxisLabel() { + return this.dxForAxisLabel(this.getY2AxisLabelPosition()); + } + }, { + key: "dyForXAxisLabel", + value: function dyForXAxisLabel() { + var $$ = this.owner, + config = $$.config, + isInner = this.getXAxisLabelPosition().isInner, + xHeight = config.axis_x_height; + return config.axis_rotated ? isInner ? "1.2em" : -25 - this.getMaxTickWidth("x") : isInner ? "-0.5em" : xHeight ? xHeight - 10 : "3em"; + } + }, { + key: "dyForYAxisLabel", + value: function dyForYAxisLabel() { + var $$ = this.owner, + isInner = this.getYAxisLabelPosition().isInner; + return $$.config.axis_rotated ? isInner ? "-0.5em" : "3em" : isInner ? "1.2em" : -10 - ($$.config.axis_y_inner ? 0 : this.getMaxTickWidth("y") + 10); + } + }, { + key: "dyForY2AxisLabel", + value: function dyForY2AxisLabel() { + var $$ = this.owner, + isInner = this.getY2AxisLabelPosition().isInner; + return $$.config.axis_rotated ? isInner ? "1.2em" : "-2.2em" : isInner ? "-0.5em" : 15 + ($$.config.axis_y2_inner ? 0 : this.getMaxTickWidth("y2") + 15); + } + }, { + key: "textAnchorForXAxisLabel", + value: function textAnchorForXAxisLabel() { + return this.textAnchorForAxisLabel(this.getXAxisLabelPosition(), !1); + } + }, { + key: "textAnchorForYAxisLabel", + value: function textAnchorForYAxisLabel() { + return this.textAnchorForAxisLabel(this.getYAxisLabelPosition()); + } + }, { + key: "textAnchorForY2AxisLabel", + value: function textAnchorForY2AxisLabel() { + return this.textAnchorForAxisLabel(this.getY2AxisLabelPosition()); + } + }, { + key: "getMaxTickWidth", + value: function getMaxTickWidth(id, withoutRecompute) { + var $$ = this.owner, + config = $$.config, + currentTickMax = $$.currentMaxTickWidths[id], + maxWidth = 0; + if (withoutRecompute || !config["axis_".concat(id, "_show")]) return currentTickMax.size; + + if ($$.svg) { + var isYAxis = /^y2?$/.test(id), + targetsToShow = $$.filterTargetsToShow($$.data.targets), + getFrom = isYAxis ? "getY" : "getX", + scale = $$[id].copy().domain($$["".concat(getFrom, "Domain")](targetsToShow, id)), + domain = scale.domain().toString(); + // do not compute if domain is same + if (currentTickMax.domain === domain) return currentTickMax.size; + currentTickMax.domain = domain; + var axis = this["".concat(getFrom, "Axis")](id, scale, !1, !0, !0); + isYAxis || this.updateXAxisTickValues(targetsToShow, axis); + var dummy = $$.selectChart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0px").style("left", "0px"); + axis.create(dummy), dummy.selectAll("text").each(function () { + maxWidth = Math.max(maxWidth, this.getBoundingClientRect().width); + }), dummy.remove(); + } + + return maxWidth > 0 && (currentTickMax.size = maxWidth), currentTickMax.size; + } + }, { + key: "updateLabels", + value: function updateLabels(withTransition) { + var _this2 = this, + $$ = this.owner, + labels = { + X: $$.main.select(".".concat(config_classes.axisX, " .").concat(config_classes.axisXLabel)), + Y: $$.main.select(".".concat(config_classes.axisY, " .").concat(config_classes.axisYLabel)), + Y2: $$.main.select(".".concat(config_classes.axisY2, " .").concat(config_classes.axisY2Label)) + }; + + Object.keys(labels).filter(function (id) { + return !labels[id].empty(); + }).forEach(function (v) { + var node = labels[v], + axisLabel = "".concat(v, "AxisLabel"); + (withTransition ? node.transition() : node).attr("x", _this2["xFor".concat(axisLabel)].bind(_this2)).attr("dx", _this2["dxFor".concat(axisLabel)].bind(_this2)).attr("dy", _this2["dyFor".concat(axisLabel)].bind(_this2)).text(_this2["textFor".concat(axisLabel)].bind(_this2)); + }); + } + }, { + key: "getPadding", + value: function getPadding(padding, key, defaultValue, domainLength) { + var p = isNumber(padding) ? padding : padding[key]; + return isValue(p) ? padding.unit === "ratio" ? padding[key] * domainLength : this.convertPixelsToAxisPadding(p, domainLength) : defaultValue; // assume padding is pixels if unit is not specified + } + }, { + key: "convertPixelsToAxisPadding", + value: function convertPixelsToAxisPadding(pixels, domainLength) { + var $$ = this.owner, + length = $$.config.axis_rotated ? $$.width : $$.height; + return domainLength * (pixels / length); + } + }, { + key: "generateTickValues", + value: function generateTickValues(values, tickCount, forTimeSeries) { + var start, + end, + count, + interval, + i, + tickValue, + tickValues = values; + + if (tickCount) { + var targetCount = isFunction(tickCount) ? tickCount() : tickCount; // compute ticks according to tickCount + + if (targetCount === 1) tickValues = [values[0]];else if (targetCount === 2) tickValues = [values[0], values[values.length - 1]];else if (targetCount > 2) { + for (count = targetCount - 2, start = values[0], end = values[values.length - 1], interval = (end - start) / (count + 1), tickValues = [start], i = 0; i < count; i++) tickValue = +start + interval * (i + 1), tickValues.push(forTimeSeries ? new Date(tickValue) : tickValue); + + tickValues.push(end); + } + } + + return forTimeSeries || (tickValues = tickValues.sort(function (a, b) { + return a - b; + })), tickValues; + } + }, { + key: "generateTransitions", + value: function generateTransitions(duration) { + var $$ = this.owner, + axes = $$.axes, + _map = ["x", "y", "y2", "subx"].map(function (v) { + var axis = axes[v]; + return axis && duration && (axis = axis.transition().duration(duration)), axis; + }), + _map2 = slicedToArray_default()(_map, 4), + axisX = _map2[0], + axisY = _map2[1], + axisY2 = _map2[2], + axisSubX = _map2[3]; + + return { + axisX: axisX, + axisY: axisY, + axisY2: axisY2, + axisSubX: axisSubX + }; + } + }, { + key: "redraw", + value: function redraw(transitions, isHidden) { + var $$ = this.owner, + opacity = isHidden ? "0" : "1"; + ["x", "y", "y2", "subX"].forEach(function (id) { + var axis = $$["".concat(id, "Axis")]; + axis && ($$.axes[id.toLowerCase()].style("opacity", opacity), axis.create(transitions["axis".concat(capitalize(id))])); + }), this.updateAxes(); + } + }]), Axis; +}(); + + +// CONCATENATED MODULE: ./src/internals/ChartInternal.js + + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * @ignore + */ + + + + + + +/** + * Internal chart class. + * - Note: Instantiated internally, not exposed for public. + * @class ChartInternal + * @ignore + * @private +*/ + +var ChartInternal_ChartInternal = +/*#__PURE__*/ +function () { + function ChartInternal(api) { + classCallCheck_default()(this, ChartInternal); + + var $$ = this; + $$.api = api, $$.config = $$.getOptions(), $$.data = {}, $$.cache = {}, $$.axes = {}; + } + + return createClass_default()(ChartInternal, [{ + key: "beforeInit", + value: function beforeInit() { + var $$ = this; // can do something + + callFn($$.config.onbeforeinit, $$); + } + }, { + key: "afterInit", + value: function afterInit() { + var $$ = this; // can do something + + callFn($$.config.onafterinit, $$); + } + }, { + key: "init", + value: function init() { + var convertedData, + $$ = this, + config = $$.config; + if ($$.initParams(), config.data_url) $$.convertUrlToData(config.data_url, config.data_mimeType, config.data_headers, config.data_keys, $$.initWithData);else if (config.data_json) convertedData = $$.convertJsonToData(config.data_json, config.data_keys);else if (config.data_rows) convertedData = $$.convertRowsToData(config.data_rows);else if (config.data_columns) convertedData = $$.convertColumnsToData(config.data_columns);else throw Error("url or json or rows or columns is required."); + convertedData && $$.initWithData(convertedData); + } + }, { + key: "initParams", + value: function initParams() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated; + $$.datetimeId = "bb-".concat(+new Date()), $$.clipId = "".concat($$.datetimeId, "-clip"), $$.clipIdForXAxis = "".concat($$.clipId, "-xaxis"), $$.clipIdForYAxis = "".concat($$.clipId, "-yaxis"), $$.clipIdForGrid = "".concat($$.clipId, "-grid"), $$.clipPath = $$.getClipPath($$.clipId), $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis), $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis), $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid), $$.dragStart = null, $$.dragging = !1, $$.flowing = !1, $$.cancelClick = !1, $$.mouseover = !1, $$.transiting = !1, $$.color = $$.generateColor(), $$.levelColor = $$.generateLevelColor(), $$.point = $$.generatePoint(), $$.extraLineClasses = $$.generateExtraLineClass(), $$.dataTimeFormat = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_["timeParse"] : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_["utcParse"], $$.axisTimeFormat = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_["timeFormat"] : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_["utcFormat"], $$.defaultAxisTimeFormat = function (d) { + var specifier = d.getMilliseconds() && ".%L" || d.getSeconds() && ".:%S" || d.getMinutes() && "%I:%M" || d.getHours() && "%I %p" || d.getDay() && d.getDate() !== 1 && "%-m/%-d" || d.getDate() !== 1 && "%b %d" || d.getMonth() && "%-m/%-d" || "%Y/%-m/%-d"; + return $$.axisTimeFormat(specifier)(d); + }, $$.hiddenTargetIds = [], $$.hiddenLegendIds = [], $$.focusedTargetIds = [], $$.defocusedTargetIds = [], $$.xOrient = isRotated ? "left" : "bottom", $$.yOrient = isRotated ? config.axis_y_inner ? "top" : "bottom" : config.axis_y_inner ? "right" : "left", $$.y2Orient = isRotated ? config.axis_y2_inner ? "bottom" : "top" : config.axis_y2_inner ? "left" : "right", $$.subXOrient = isRotated ? "left" : "bottom", $$.isLegendRight = config.legend_position === "right", $$.isLegendInset = config.legend_position === "inset", $$.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right", $$.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left", $$.legendStep = 0, $$.legendItemWidth = 0, $$.legendItemHeight = 0, $$.currentMaxTickWidths = { + x: { + size: 0, + domain: "" + }, + y: { + size: 0, + domain: "" + }, + y2: { + size: 0, + domain: "" + } + }, $$.rotated_padding_left = 30, $$.rotated_padding_right = isRotated && !config.axis_x_show ? 0 : 30, $$.rotated_padding_top = 5, $$.withoutFadeIn = {}, $$.inputType = $$.convertInputType(), $$.axes.subx = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]); + } + }, { + key: "initWithData", + value: function initWithData(data) { + var $$ = this, + config = $$.config; + $$.axis = new Axis_Axis($$), config.zoom_enabled && ($$.initZoom(), $$.initZoomBehaviour()); + var bindto = { + element: config.bindto, + classname: "bb" + }; + + if (isObject(config.bindto) && (bindto.element = config.bindto.element || "#chart", bindto.classname = config.bindto.classname || bindto.classname), $$.selectChart = isFunction(bindto.element.node) ? config.bindto.element : Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(bindto.element || []), $$.selectChart.empty() && ($$.selectChart = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(document.body.appendChild(document.createElement("div")))), $$.selectChart.html("").classed(bindto.classname, !0), $$.data.xs = {}, $$.data.targets = $$.convertDataToTargets(data), config.data_filter && ($$.data.targets = $$.data.targets.filter(config.data_filter)), config.data_hide && $$.addHiddenTargetIds(config.data_hide === !0 ? $$.mapToIds($$.data.targets) : config.data_hide), config.legend_hide && $$.addHiddenLegendIds(config.legend_hide === !0 ? $$.mapToIds($$.data.targets) : config.legend_hide), $$.hasType("gauge") && (config.legend_show = !1), $$.updateSizes(), $$.updateScales(), $$.x && ($$.x.domain(sortValue($$.getXDomain($$.data.targets))), $$.subX.domain($$.x.domain()), $$.orgXDomain = $$.x.domain()), $$.y && ($$.y.domain($$.getYDomain($$.data.targets, "y")), $$.subY.domain($$.y.domain())), $$.y2 && ($$.y2.domain($$.getYDomain($$.data.targets, "y2")), $$.subY2 && $$.subY2.domain($$.y2.domain())), $$.svg = $$.selectChart.append("svg").style("overflow", "hidden").style("display", "block"), config.interaction_enabled && $$.inputType) { + var isTouch = $$.inputType === "touch"; + $$.svg.on(isTouch ? "touchstart" : "mouseenter", function () { + return callFn(config.onover, $$); + }).on(isTouch ? "touchend" : "mouseleave", function () { + return callFn(config.onout, $$); + }); + } + + config.svg_classname && $$.svg.attr("class", config.svg_classname), $$.defs = $$.svg.append("defs"), $$.clipChart = $$.appendClip($$.defs, $$.clipId), $$.clipXAxis = $$.appendClip($$.defs, $$.clipIdForXAxis), $$.clipYAxis = $$.appendClip($$.defs, $$.clipIdForYAxis), $$.clipGrid = $$.appendClip($$.defs, $$.clipIdForGrid), isFunction(config.color_tiles) && $$.patterns && $$.patterns.forEach(function (p) { + return $$.defs.append(function () { + return p.node; + }); + }), $$.updateSvgSize(); + // Define regions + var main = $$.svg.append("g").attr("transform", $$.getTranslate("main")); + + // data.onmin/max callback + if ($$.main = main, config.subchart_show && $$.initSubchart(), $$.initTooltip && $$.initTooltip(), $$.initLegend && $$.initLegend(), $$.initTitle && $$.initTitle(), config.data_empty_label_text && main.append("text").attr("class", "".concat(config_classes.text, " ").concat(config_classes.empty)).attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers. + .attr("dominant-baseline", "middle"), $$.initRegion(), config.clipPath || $$.axis.init(), main.append("g").attr("class", config_classes.chart).attr("clip-path", $$.clipPath), $$.initEventRect(), $$.initChartElements(), $$.initGrid(), main.insert("rect", config.zoom_privileged ? null : "g.".concat(config_classes.regions)).attr("class", config_classes.zoomRect).attr("width", $$.width).attr("height", $$.height).style("opacity", "0").on("dblclick.zoom", null), config.axis_x_extent && $$.brush.scale($$.getDefaultExtent()), config.clipPath && $$.axis.init(), $$.updateTargets($$.data.targets), $$.updateDimension(), config.oninit.call($$), $$.redraw({ + withTransition: !1, + withTransform: !0, + withUpdateXDomain: !0, + withUpdateOrgXDomain: !0, + withTransitionForAxis: !1, + initializing: !0 + }), config.data_onmin || config.data_onmax) { + var minMax = $$.getMinMaxData(); + callFn(config.data_onmin, $$, minMax.min), callFn(config.data_onmax, $$, minMax.max); + } // Bind resize event + + + $$.bindResize(), $$.api.element = $$.selectChart.node(); + } + }, { + key: "initChartElements", + value: function initChartElements() { + var $$ = this; + ["Bar", "Line", "Bubble", "Arc", "Gauge", "Pie", "Radar"].forEach(function (v) { + $$["init".concat(v)](); + }), notEmpty($$.config.data_labels) && $$.initText(); + } + }, { + key: "getChartElements", + value: function getChartElements() { + var $$ = this; + return { + chart: $$.selectChart, + svg: $$.svg, + defs: $$.defs, + main: $$.main, + tooltip: $$.tooltip, + legend: $$.legend, + title: $$.title, + grid: $$.grid, + arc: $$.arcs, + bar: { + bars: $$.mainBar + }, + line: { + lines: $$.mainLine, + areas: $$.mainArea, + circles: $$.mainCircle + }, + text: { + texts: $$.mainText + } + }; + } + }, { + key: "smoothLines", + value: function smoothLines(el, type) { + type === "grid" && el.each(function () { + var g = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + _map = ["x1", "x2", "y1", "y2"].map(function (v) { + return Math.ceil(g.attr(v)); + }), + _map2 = slicedToArray_default()(_map, 4), + x1 = _map2[0], + x2 = _map2[1], + y1 = _map2[2], + y2 = _map2[3]; + + g.attr({ + x1: x1, + x2: x2, + y1: y1, + y2: y2 + }); + }); + } + }, { + key: "updateSizes", + value: function updateSizes() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + hasArc = $$.hasArcType(), + legend = { + width: $$.legend ? $$.getLegendWidth() : 0, + height: $$.legend ? $$.getLegendHeight() : 0 + }, + legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legend.height, + xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x"), + subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30, + subchartHeight = config.subchart_show && !hasArc ? config.subchart_size_height + subchartXAxisHeight : 0; + $$.currentWidth = $$.getCurrentWidth(), $$.currentHeight = $$.getCurrentHeight(), $$.margin = isRotated ? { + top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(), + right: hasArc ? 0 : $$.getCurrentPaddingRight(), + bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(), + left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft()) + } : { + top: 5 + $$.getCurrentPaddingTop(), + // for top tick text + right: hasArc ? 0 : $$.getCurrentPaddingRight(), + bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(), + left: hasArc ? 0 : $$.getCurrentPaddingLeft() + }, $$.margin2 = isRotated ? { + top: $$.margin.top, + right: NaN, + bottom: 20 + legendHeightForBottom, + left: $$.rotated_padding_left + } : { + top: $$.currentHeight - subchartHeight - legendHeightForBottom, + right: NaN, + bottom: subchartXAxisHeight + legendHeightForBottom, + left: $$.margin.left + }, $$.margin3 = { + top: 0, + right: NaN, + bottom: 0, + left: 0 + }, $$.updateSizeForLegend && $$.updateSizeForLegend(legend), $$.width = $$.currentWidth - $$.margin.left - $$.margin.right, $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom, $$.width < 0 && ($$.width = 0), $$.height < 0 && ($$.height = 0), $$.width2 = isRotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width, $$.height2 = isRotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom, $$.width2 < 0 && ($$.width2 = 0), $$.height2 < 0 && ($$.height2 = 0), $$.arcWidth = $$.width - ($$.isLegendRight ? legend.width + 10 : 0), $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10), $$.hasType("gauge") && !config.gauge_fullCircle && ($$.arcHeight += $$.height - $$.getGaugeLabelHeight()), $$.updateRadius && $$.updateRadius(), $$.isLegendRight && hasArc && ($$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1); + } + /** + * Update targeted element with given data + * @param {Object} targets Data object formatted as 'target' + * @private + */ + + }, { + key: "updateTargets", + value: function updateTargets(targets) { + var $$ = this; // Text + + $$.updateTargetsForText(targets), $$.updateTargetsForBar(targets), $$.updateTargetsForLine(targets), $$.hasArcType(targets) && ($$.hasType("radar") ? $$.updateTargetsForRadar(targets) : $$.updateTargetsForArc(targets)), $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets), $$.showTargets(); + } + /** + * Display targeted elements + * @private + */ + + }, { + key: "showTargets", + value: function showTargets() { + var $$ = this; + $$.svg.selectAll(".".concat(config_classes.target)).filter(function (d) { + return $$.isTargetToShow(d.id); + }).transition().duration($$.config.transition_duration).style("opacity", "1"); + } + }, { + key: "getWithOption", + value: function getWithOption(options) { + var withOptions = { + Y: !0, + Subchart: !0, + Transition: !0, + EventRect: !0, + Dimension: !0, + TrimXDomain: !0, + Transform: !1, + UpdateXDomain: !1, + UpdateOrgXDomain: !1, + Legend: !1, + UpdateXAxis: "UpdateXDomain", + TransitionForExit: "Transition", + TransitionForAxis: "Transition" + }; + return Object.keys(withOptions).forEach(function (key) { + var defVal = withOptions[key]; + isString(defVal) && (defVal = withOptions[defVal]), withOptions[key] = getOption(options, "with".concat(key), defVal); + }), withOptions; + } + }, { + key: "redraw", + value: function redraw() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + transitionsValue = arguments.length > 1 ? arguments[1] : undefined, + $$ = this, + main = $$.main, + config = $$.config, + targetsToShow = $$.filterTargetsToShow($$.data.targets), + flow = options.flow, + wth = $$.getWithOption(options), + duration = wth.Transition ? config.transition_duration : 0, + durationForExit = wth.TransitionForExit ? duration : 0, + durationForAxis = wth.TransitionForAxis ? duration : 0, + transitions = transitionsValue || $$.axis.generateTransitions(durationForAxis); + options.initializing && $$.brush && $$.brush.initZoom() && (wth.Y = $$.config.zoom_rescale, wth.Subchart = !0, wth.Dimension = !0), options.initializing && config.tooltip_init_show || $$.inputType !== "touch" || $$.hideTooltip(), wth.Legend && config.legend_show ? $$.updateLegend($$.mapToIds($$.data.targets), options, transitions) : wth.Dimension && $$.updateDimension(!0), $$.redrawAxis(targetsToShow, wth, transitions, flow), $$.updateCircleY(), $$.updateXgridFocus(), config.data_empty_label_text && main.select("text.".concat(config_classes.text, ".").concat(config_classes.empty)).attr("x", $$.width / 2).attr("y", $$.height / 2).text(config.data_empty_label_text).transition().style("opacity", targetsToShow.length ? 0 : 1), $$.updateGrid(duration), $$.updateRegion(duration), $$.updateBar(durationForExit), $$.updateLine(durationForExit), $$.updateArea(durationForExit), $$.updateCircle(), $$.hasDataLabel() && $$.updateText(durationForExit), $$.redrawTitle && $$.redrawTitle(), $$.arcs && $$.redrawArc(duration, durationForExit, wth.Transform), $$.radars && $$.redrawRadar(duration, durationForExit), $$.mainText && main.selectAll(".".concat(config_classes.selectedCircles)).filter($$.isBarType.bind($$)).selectAll("circle").remove(), config.interaction_enabled && !flow && wth.EventRect && ($$.redrawEventRect(), $$.bindZoomEvent()), $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart); + } + /** + * Redraw axis + * @param {Object} targetsToShow targets data to be shown + * @param {Object} wth + * @param {Ojbect} transitions + * @param {Object} flow + * @private + */ + + }, { + key: "redrawAxis", + value: function redrawAxis(targetsToShow, wth, transitions, flow) { + var tickValues, + intervalForCulling, + xDomainForZoom, + $$ = this, + config = $$.config, + hasArcType = $$.hasArcType(); + // show/hide if manual culling needed + if ($$.isCategorized() && targetsToShow.length === 0 && $$.x.domain([0, $$.axes.x.selectAll(".tick").size()]), $$.x && targetsToShow.length ? ($$.updateXDomain(targetsToShow, wth.UpdateXDomain, wth.UpdateOrgXDomain, wth.TrimXDomain), !config.axis_x_tick_values && (tickValues = $$.axis.updateXAxisTickValues(targetsToShow))) : $$.xAxis && ($$.xAxis.tickValues([]), $$.subXAxis.tickValues([])), config.zoom_rescale && !flow && (xDomainForZoom = $$.x.orgDomain()), ["y", "y2"].forEach(function (key) { + var axis = $$[key]; + + if (axis) { + var tickValues = config["axis_".concat(key, "_tick_values")], + tickCount = config["axis_".concat(key, "_tick_count")]; + + if (axis.domain($$.getYDomain(targetsToShow, key, xDomainForZoom)), !tickValues && tickCount) { + var domain = axis.domain(); + $$["".concat(key, "Axis")].tickValues($$.axis.generateTickValues(domain, domain.every(function (v) { + return v === 0; + }) ? 1 : tickCount, $$.isTimeSeriesY())); + } + } + }), $$.axis.redraw(transitions, hasArcType), $$.axis.updateLabels(wth.Transition), (wth.UpdateXDomain || wth.UpdateXAxis) && targetsToShow.length) if (config.axis_x_tick_culling && tickValues) { + for (var i = 1; i < tickValues.length; i++) if (tickValues.length / i < config.axis_x_tick_culling_max) { + intervalForCulling = i; + break; + } + + $$.svg.selectAll(".".concat(config_classes.axisX, " .tick text")).each(function (e) { + var index = tickValues.indexOf(e); + index >= 0 && Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).style("display", index % intervalForCulling ? "none" : "block"); + }); + } else $$.svg.selectAll(".".concat(config_classes.axisX, " .tick text")).style("display", "block"); // Update sub domain + + wth.Y && ($$.subY && $$.subY.domain($$.getYDomain(targetsToShow, "y")), $$.subY2 && $$.subY2.domain($$.getYDomain(targetsToShow, "y2"))); + } + /** + * Generate redraw list + * @param {Object} targetsToShow targets data to be shown + * @param {Object} flow + * @param {Object} duration + * @param {Boolean} withSubchart whether or not to show subchart + * @private + */ + + }, { + key: "generateRedrawList", + value: function generateRedrawList(targetsToShow, flow, duration, withSubchart) { + var $$ = this, + config = $$.config, + shape = $$.getDrawShape(); + config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape); + // generate flow + var flowFn = flow && $$.generateFlow({ + targets: targetsToShow, + flow: flow, + duration: flow.duration, + shape: shape, + xv: $$.xv.bind($$) + }), + isTransition = (duration || flowFn) && $$.isTabVisible(), + redrawList = $$.getRedrawList(shape, flow, flowFn, isTransition), + afterRedraw = flow || config.onrendered ? function () { + flowFn && flowFn(), callFn(config.onrendered, $$); + } : null; + if (afterRedraw) // Only use transition when current tab is visible. + if (isTransition) { + // Wait for end of transitions for callback + var waitForDraw = $$.generateWait(); // transition should be derived from one transition + + Object(external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_["transition"])().duration(duration).each(function () { + redrawList.reduce(function (acc, t1) { + return acc.concat(t1); + }, []).forEach(function (t) { + return waitForDraw.add(t); + }); + }).call(waitForDraw, afterRedraw); + } else afterRedraw(); // update fadein condition + + $$.mapToIds($$.data.targets).forEach(function (id) { + $$.withoutFadeIn[id] = !0; + }); + } + /** + * Get the shape draw function + * @return {Object} + * @private + */ + + }, { + key: "getDrawShape", + value: function getDrawShape() { + var $$ = this, + isRotated = $$.config.axis_rotated, + hasRadar = $$.hasType("radar"), + shape = { + type: {}, + indices: {} + }; + + // setup drawer - MEMO: these must be called after axis updated + if ($$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter")) { + var indices = $$.getShapeIndices($$.isLineType); + + if (shape.indices.line = indices, shape.type.line = $$.generateDrawLine ? $$.generateDrawLine(indices, !1) : undefined, $$.hasTypeOf("Area")) { + var _indices = $$.getShapeIndices($$.isAreaType); + + shape.indices.area = _indices, shape.type.area = $$.generateDrawArea ? $$.generateDrawArea(_indices, !1) : undefined; + } + } + + if ($$.hasType("bar")) { + var _indices2 = $$.getShapeIndices($$.isBarType); + + shape.indices.bar = _indices2, shape.type.bar = $$.generateDrawBar ? $$.generateDrawBar(_indices2) : undefined; + } + + return shape.pos = { + xForText: $$.generateXYForText(shape.indices, !0), + yForText: $$.generateXYForText(shape.indices, !1), + // generate circle x/y functions depending on updated params + cx: (hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX).bind($$), + cy: (hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY).bind($$) + }, shape; + } + }, { + key: "getRedrawList", + value: function getRedrawList(shape, flow, flowFn, isTransition) { + var $$ = this, + config = $$.config, + hasArcType = $$.hasArcType(), + _shape$pos = shape.pos, + cx = _shape$pos.cx, + cy = _shape$pos.cy, + xForText = _shape$pos.xForText, + yForText = _shape$pos.yForText, + list = []; + + if (!hasArcType) { + var _shape$type = shape.type, + area = _shape$type.area, + bar = _shape$type.bar, + line = _shape$type.line; + (config.grid_x_lines.length || config.grid_y_lines.length) && list.push($$.redrawGrid(isTransition)), config.regions.length && list.push($$.redrawRegion(isTransition)), $$.hasTypeOf("Line") && (list.push($$.redrawLine(line, isTransition)), $$.hasTypeOf("Area") && list.push($$.redrawArea(area, isTransition))), $$.hasType("bar") && list.push($$.redrawBar(bar, isTransition)), notEmpty(config.data_labels) && list.push($$.redrawText(xForText, yForText, flow, isTransition)); + } + + return (!hasArcType || $$.hasType("radar")) && list.push($$.redrawCircle(cx, cy, isTransition, flowFn)), list; + } + }, { + key: "updateAndRedraw", + value: function updateAndRedraw() { + var transitions, + options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + $$ = this, + config = $$.config; + options.withTransition = getOption(options, "withTransition", !0), options.withTransform = getOption(options, "withTransform", !1), options.withLegend = getOption(options, "withLegend", !1), options.withUpdateXDomain = !0, options.withUpdateOrgXDomain = !0, options.withTransitionForExit = !1, options.withTransitionForTransform = getOption(options, "withTransitionForTransform", options.withTransition), $$.updateSizes(), options.withLegend && config.legend_show || (transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0), $$.updateScales(), $$.updateSvgSize(), $$.transformAll(options.withTransitionForTransform, transitions)), $$.redraw(options, transitions); + } + }, { + key: "redrawWithoutRescale", + value: function redrawWithoutRescale() { + this.redraw({ + withY: !1, + withSubchart: !1, + withEventRect: !1, + withTransitionForAxis: !1 + }); + } + }, { + key: "isTimeSeries", + value: function isTimeSeries() { + return this.config.axis_x_type === "timeseries"; + } + }, { + key: "isCategorized", + value: function isCategorized() { + return this.config.axis_x_type.indexOf("category") >= 0 || this.hasType("radar"); + } + }, { + key: "isCustomX", + value: function isCustomX() { + var $$ = this, + config = $$.config; + return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs)); + } + }, { + key: "isTimeSeriesY", + value: function isTimeSeriesY() { + return this.config.axis_y_type === "timeseries"; + } + }, { + key: "getTranslate", + value: function getTranslate(target) { + var x, + y, + index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0, + $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + padding = 0; + if (index && /^(x|y2?)$/.test(target) && (padding = $$.getAxisSize(target) * index), target === "main") x = asHalfPixel($$.margin.left), y = asHalfPixel($$.margin.top);else if (target === "context") x = asHalfPixel($$.margin2.left), y = asHalfPixel($$.margin2.top);else if (target === "legend") x = $$.margin3.left, y = $$.margin3.top;else if (target === "x") x = isRotated ? -padding : 0, y = isRotated ? 0 : $$.height + padding;else if (target === "y") x = isRotated ? 0 : -padding, y = isRotated ? $$.height + padding : 0;else if (target === "y2") x = isRotated ? 0 : $$.width + padding, y = isRotated ? 1 - padding : 0;else if (target === "subx") x = 0, y = isRotated ? 0 : $$.height2;else if (target === "arc") x = $$.arcWidth / 2, y = $$.arcHeight / 2;else if (target === "radar") { + var diff = ($$.arcWidth - $$.arcHeight) / 2; + x = Math.max(diff, 0) + 4, y = diff < 0 ? Math.abs(diff) : asHalfPixel($$.margin.top); + } + return "translate(".concat(x, ", ").concat(y, ")"); + } + }, { + key: "initialOpacity", + value: function initialOpacity(d) { + return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? "1" : "0"; + } + }, { + key: "initialOpacityForCircle", + value: function initialOpacityForCircle(d) { + return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0"; + } + }, { + key: "opacityForCircle", + value: function opacityForCircle(d) { + var opacity = this.config.point_show ? "1" : "0"; + return isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0"; + } + }, { + key: "opacityForText", + value: function opacityForText() { + return this.hasDataLabel() ? "1" : "0"; + } + }, { + key: "xx", + value: function xx(d) { + var fn = this.config.zoom_enabled && this.zoomScale ? this.zoomScale : this.x; + return d ? fn(d.x) : null; + } + }, { + key: "xv", + value: function xv(d) { + var $$ = this, + value = $$.getBaseValue(d); + return $$.isTimeSeries() ? value = $$.parseDate(value) : $$.isCategorized() && isString(value) && (value = $$.config.axis_x_categories.indexOf(value)), Math.ceil($$.x(value)); + } + }, { + key: "yv", + value: function yv(d) { + var $$ = this, + yScale = d.axis && d.axis === "y2" ? $$.y2 : $$.y; + return Math.ceil(yScale($$.getBaseValue(d))); + } + }, { + key: "subxx", + value: function subxx(d) { + return d ? this.subX(d.x) : null; + } + }, { + key: "transformMain", + value: function transformMain(withTransition, transitions) { + var xAxis, + yAxis, + y2Axis, + $$ = this; + transitions && transitions.axisX ? xAxis = transitions.axisX : (xAxis = $$.main.select(".".concat(config_classes.axisX)), withTransition && (xAxis = xAxis.transition())), transitions && transitions.axisY ? yAxis = transitions.axisY : (yAxis = $$.main.select(".".concat(config_classes.axisY)), withTransition && (yAxis = yAxis.transition())), transitions && transitions.axisY2 ? y2Axis = transitions.axisY2 : (y2Axis = $$.main.select(".".concat(config_classes.axisY2)), withTransition && (y2Axis = y2Axis.transition())), (withTransition ? $$.main.transition() : $$.main).attr("transform", $$.getTranslate("main")), xAxis.attr("transform", $$.getTranslate("x")), yAxis.attr("transform", $$.getTranslate("y")), y2Axis.attr("transform", $$.getTranslate("y2")), $$.main.select(".".concat(config_classes.chartArcs)).attr("transform", $$.getTranslate("arc")); + } + }, { + key: "transformAll", + value: function transformAll(withTransition, transitions) { + var $$ = this; + $$.transformMain(withTransition, transitions), $$.config.subchart_show && $$.transformContext(withTransition, transitions), $$.legend && $$.transformLegend(withTransition); + } + }, { + key: "updateSvgSize", + value: function updateSvgSize() { + var $$ = this, + isRotated = $$.config.axis_rotated, + brush = $$.svg.select(".".concat(config_classes.brush, " .overlay")), + brushSize = { + width: 0, + height: 0 + }; + brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), $$.svg.attr("width", $$.currentWidth).attr("height", $$.currentHeight), $$.svg.selectAll(["#".concat($$.clipId), "#".concat($$.clipIdForGrid)]).select("rect").attr("width", $$.width).attr("height", $$.height), $$.svg.select("#".concat($$.clipIdForXAxis)).select("rect").attr("x", $$.getXAxisClipX.bind($$)).attr("y", $$.getXAxisClipY.bind($$)).attr("width", $$.getXAxisClipWidth.bind($$)).attr("height", $$.getXAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForYAxis)).select("rect").attr("x", $$.getYAxisClipX.bind($$)).attr("y", $$.getYAxisClipY.bind($$)).attr("width", $$.getYAxisClipWidth.bind($$)).attr("height", $$.getYAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForSubchart)).select("rect").attr("width", $$.width).attr("height", brushSize.height), $$.svg.select(".".concat(config_classes.zoomRect)).attr("width", $$.width).attr("height", $$.height), $$.brush && $$.brush.scale($$.subX, brushSize[isRotated ? "width" : "height"]); + } + }, { + key: "updateDimension", + value: function updateDimension(withoutAxis) { + var $$ = this; + withoutAxis || ($$.xAxis && $$.config.axis_rotated ? ($$.xAxis.create($$.axes.x), $$.subXAxis.create($$.axes.subx)) : ($$.yAxis && $$.yAxis.create($$.axes.y), $$.y2Axis && $$.y2Axis.create($$.axes.y2))), $$.updateSizes(), $$.updateScales(withoutAxis), $$.updateSvgSize(), $$.transformAll(!1); + } + }, { + key: "bindResize", + value: function bindResize() { + var $$ = this, + config = $$.config; + $$.resizeFunction = $$.generateResize(), $$.resizeFunction.add(config.onresize.bind($$)), config.resize_auto && $$.resizeFunction.add(function () { + $$.resizeTimeout && (window.clearTimeout($$.resizeTimeout), $$.resizeTimeout = null), $$.resizeTimeout = window.setTimeout($$.api.flush, 100); + }), $$.resizeFunction.add(config.onresized.bind($$)), window.addEventListener("resize", $$.resizeFunction); + } + }, { + key: "generateResize", + value: function generateResize() { + function callResizeFunctions() { + resizeFunctions.forEach(function (f) { + return f(); + }); + } + + var resizeFunctions = []; + return callResizeFunctions.add = function (f) { + return resizeFunctions.push(f); + }, callResizeFunctions.remove = function (f) { + return resizeFunctions.splice(resizeFunctions.indexOf(f), 1); + }, callResizeFunctions; + } + }, { + key: "endall", + value: function endall(transition, callback) { + var n = 0; + transition.each(function () { + return ++n; + }).on("end", function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; + + --n || callback.apply.apply(callback, [this].concat(args)); + }); + } + }, { + key: "generateWait", + value: function generateWait() { + var transitionsToWait = [], + f = function (transition, callback) { + function loop() { + var done = 0; + transitionsToWait.forEach(function (t) { + if (t.empty()) return void done++; + + try { + t.transition(); + } catch (e) { + done++; + } + }), timer && clearTimeout(timer), done === transitionsToWait.length ? callback && callback() : timer = setTimeout(loop, 50); + } + + var timer; + loop(); + }; + + return f.add = function (transition) { + isArray(transition) ? transitionsToWait = transitionsToWait.concat(transition) : transitionsToWait.push(transition); + }, f; + } + }, { + key: "parseDate", + value: function parseDate(date) { + var parsedDate, + $$ = this; + return date instanceof Date ? parsedDate = date : isString(date) ? parsedDate = $$.dataTimeFormat($$.config.data_xFormat)(date) : isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date)), (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '".concat(date, "' to Date object")), parsedDate; + } + }, { + key: "isTabVisible", + value: function isTabVisible() { + return !document[["hidden", "mozHidden", "msHidden", "webkitHidden"].filter(function (v) { + return v in document; + })[0]]; + } + }, { + key: "convertInputType", + value: function convertInputType() { + var $$ = this, + config = $$.config, + isMobile = $$.isMobile(), + hasMouse = config.interaction_inputType_mouse && !isMobile && "onmouseover" in window, + hasTouch = !1; + return config.interaction_inputType_touch && (hasTouch = "ontouchmove" in window || window.DocumentTouch && document instanceof window.DocumentTouch), hasMouse && "mouse" || hasTouch && "touch" || null; + } + }]), ChartInternal; +}(); + + +// CONCATENATED MODULE: ./src/internals/Chart.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + * @license MIT + * @ignore + */ + +/** + * Main chart class. + * - Note: Instantiated via `bb.generate()`. + * @class Chart + * @example + * var chart = bb.generate({ + * data: { + * columns: [ + * ["x", "2015-11-02", "2015-12-01", "2016-01-01", "2016-02-01", "2016-03-01"], + * ["count1", 11, 8, 7, 6, 5 ], + * ["count2", 9, 3, 6, 2, 8 ] + * ]} + * } + * @see {@link bb.generate} for the initialization. +*/ + +/** + * Access primary node elements + * @name Chart#$ + * @type Object + * @property {Object} $ + * @property {d3.selection} $.chart Wrapper element + * @property {d3.selection} $.svg Main svg element + * @property {d3.selection} $.defs Definition element + * @property {d3.selection} $.main Main grouping element + * @property {d3.selection} $.tooltip Tooltip element + * @property {d3.selection} $.legend Legend element + * @property {d3.selection} $.title Title element + * @property {d3.selection} $.grid Grid element + * @property {d3.selection} $.arc Arc element + * @property {Object} $.bar + * @property {d3.selection} $.bar.bars Bar elements + * @property {Object} $.line + * @property {d3.selection} $.line.lines Line elements + * @property {d3.selection} $.line.areas Areas elements + * @property {d3.selection} $.line.circles Data point circle elements + * @property {Object} $.text + * @property {d3.selection} $.text.texts Data label text elements + * @instance + * @memberof Chart + * @example + * var chart = bb.generate({ ... }); + * + * chart.$.chart; // wrapper element + * chart.$.line.circles; // all data point circle elements + */ + +var Chart_Chart = function Chart(config) { + classCallCheck_default()(this, Chart); + + var $$ = new ChartInternal_ChartInternal(this); + // bind "this" to nested API + this.internal = $$, $$.loadConfig(config), $$.beforeInit(config), $$.init(), this.$ = $$.getChartElements(), $$.afterInit(config), function bindThis(fn, target, argThis) { + Object.keys(fn).forEach(function (key) { + target[key] = fn[key].bind(argThis), Object.keys(fn[key]).length && bindThis(fn[key], target[key], argThis); + }); + }(Chart.prototype, this, this); +}; + + +// CONCATENATED MODULE: ./src/config/Options.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + +/** + * Class to set options on generating chart. + * - It's instantiated internally, not exposed for public. + * @class Options + * @see {@link bb.generate} to use these options on generating the chart + */ +var Options_Options = function Options() { + return classCallCheck_default()(this, Options), { + /** + * Specify the CSS selector or the element which the chart will be set to. D3 selection object can be specified also.
+ * If other chart is set already, it will be replaced with the new one (only one chart can be set in one element). + * - **NOTE:** In case of element doesn't exist or not specified, will add a `

` element to the body. + * @name bindto + * @memberof Options + * @property {String|HTMLElement|d3.selection} bindto=#chart Specify the element where chart will be drawn. + * @property {String|HTMLElement|d3.selection} bindto.element=#chart Specify the element where chart will be drawn. + * @property {String} [bindto.classname=bb] Specify the class name of bind element.
+ * **NOTE:** When class name isn't `bb`, then you also need to update the default CSS to be rendered correctly. + * @default #chart + * @example + * bindto: "#myContainer" + * + * // or HTMLElement + * bindto: document.getElementById("myContainer") + * + * // or D3 selection object + * bindto: d3.select("#myContainer") + * + * // or to change default classname + * bindto: { + * element: "#chart", + * classname: "bill-board" // ex)
+ * } + */ + bindto: "#chart", + + /** + * Set 'clip-path' attribute for chart element + * - **NOTE:** + * > When is false, chart node element is positioned after the axis node in DOM tree hierarchy. + * > Is to make chart element positioned over axis element. + * @name clipPath + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.clipPath) + * @example + * // don't set 'clip-path' attribute + * clipPath: false + */ + clipPath: !0, + + /** + * Set svg element's class name + * @name svg + * @memberof Options + * @type {Object} + * @property {String} [svg.classname] class name for svg element + * @example + * svg: { + * classname: "test_class" + * } + */ + svg_classname: undefined, + + /** + * The desired size of the chart element. + * If value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to. + * @name size + * @memberof Options + * @type {Object} + * @property {Number} [size.width] width of the chart element + * @property {Number} [size.height] height of the chart element + * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.ChartSize) + * @example + * size: { + * width: 640, + * height: 480 + * } + */ + size_width: undefined, + size_height: undefined, + + /** + * The padding of the chart element. + * @name padding + * @memberof Options + * @type {Object} + * @property {Number} [padding.top] padding on the top of chart + * @property {Number} [padding.right] padding on the right of chart + * @property {Number} [padding.bottom] padding on the bottom of chart + * @property {Number} [padding.left] padding on the left of chart + * @example + * padding: { + * top: 20, + * right: 20, + * bottom: 20, + * left: 20 + * } + */ + padding_left: undefined, + padding_right: undefined, + padding_top: undefined, + padding_bottom: undefined, + + /** + * Set chart resize options + * @name resize + * @memberof Options + * @type {Object} + * @property {Boolean} [resize.auto=true] Set chart resize automatically on viewport changes. + * @example + * resize: { + * auto: false + * } + */ + resize_auto: !0, + + /** + * Set zoom options + * @name zoom + * @memberof Options + * @type {Object} + * @property {Boolean} [zoom.enabled=false] Enable zooming. + * @property {String} [zoom.enabled.type='wheel'] Set zoom interaction type. + * - **Available types:** + * - wheel + * - drag + * @property {Boolean} [zoom.rescale=false] Enable to rescale after zooming.
+ * If true set, y domain will be updated according to the zoomed region. + * @property {Array} [zoom.extent=[1, 10]] Change zoom extent. + * @property {Number} [zoom.x.min] Set x Axis minimum zoom range + * @property {Number} [zoom.x.max] Set x Axis maximum zoom range + * @property {Function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.
+ * Specified function receives the zoom event. + * @property {Function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.
+ * Specified function receives the zoomed domain. + * @property {Function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.
+ * Specified function receives the zoomed domain. + * @property {Boolean|Object} [zoom.resetButton=true] Set to display zoom reset button for 'drag' type zoom + * @property {String} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button. + * @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom) + * @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom) + * @example + * zoom: { + * enabled: { + * type: "drag" + * }, + * rescale: true, + * extent: [1, 100] // enable more zooming + * x: { + * min: -1, // set min range + * max: 10 // set max range + * }, + * onzoomstart: function(event) { ... }, + * onzoom: function(domain) { ... }, + * onzoomend: function(domain) { ... }, + * + * // show reset button when is zoomed-in + * resetButton: true, + * + * // customized text value for reset zoom button + * resetButton: { + * text: "Unzoom" + * } + * } + */ + zoom_enabled: undefined, + zoom_extent: undefined, + zoom_privileged: !1, + zoom_rescale: !1, + zoom_onzoom: undefined, + zoom_onzoomstart: undefined, + zoom_onzoomend: undefined, + zoom_resetButton: !0, + zoom_x_min: undefined, + zoom_x_max: undefined, + + /** + * Interaction options + * @name interaction + * @memberof Options + * @type {Object} + * @property {Boolean} [interaction.enabled=true] Indicate if the chart should have interactions.
+ * If `false` is set, all of interactions (showing/hiding tooltip, selection, mouse events, etc) will be disabled. + * @property {Boolean} [interaction.brighten=true] Make brighter for the selected area (ex. 'pie' type data selected area) + * @property {Boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction + * @property {Boolean} [interaction.inputType.touch=true] enable or disable touch interaction + * @property {Boolean|Number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling. + * @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch) + * @example + * interaction: { + * enabled: false, + * brighten: false, + * inputType: { + * mouse: true, + * touch: false + * + * // or declare preventDefault explicitly. + * // In this case touch inputType is enabled by default + * touch: { + * preventDefault: true + * + * // or threshold pixel value (pixel moved from touchstart to touchmove) + * preventDefault: 5 + * } + * } + * } + */ + interaction_enabled: !0, + interaction_brighten: !0, + interaction_inputType_mouse: !0, + interaction_inputType_touch: {}, + + /** + * Set a callback to execute when mouse/touch enters the chart. + * @name onover + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onover: function() { + * ... + * } + */ + onover: function onover() {}, + + /** + * Set a callback to execute when mouse/touch leaves the chart. + * @name onout + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onout: function() { + * ... + * } + */ + onout: function onout() {}, + + /** + * Set a callback to execute when user resizes the screen. + * @name onresize + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onresize: function() { + * ... + * } + */ + onresize: function onresize() {}, + + /** + * SSet a callback to execute when screen resize finished. + * @name onresized + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onresized: function() { + * ... + * } + */ + onresized: function onresized() {}, + + /** + * Set a callback to execute before the chart is initialized + * @name onbeforeinit + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onbeforeinit: function() { + * ... + * } + */ + onbeforeinit: undefined, + + /** + * Set a callback to execute when the chart is initialized. + * @name oninit + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * oninit: function() { + * ... + * } + */ + oninit: function oninit() {}, + + /** + * Set a callback to execute after the chart is initialized + * @name onafterinit + * @memberof Options + * @type {Function} + * @default function(){} + * @example + * onafterinit: function() { + * ... + * } + */ + onafterinit: undefined, + + /** + * Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is redrawed. + * @name onrendered + * @memberof Options + * @type {Function} + * @default undefined + * @example + * onrendered: function() { + * ... + * } + */ + onrendered: undefined, + + /** + * Set duration of transition (in milliseconds) for chart animation.

+ * - **NOTE:** If `0 `or `null` set, transition will be skipped. So, this makes initial rendering faster especially in case you have a lot of data. + * @name transition + * @memberof Options + * @type {Object} + * @property {Number} [transition.duration=350] duration in milliseconds + * @example + * transition: { + * duration: 500 + * } + */ + transition_duration: 350, + + /** + * Specify the key of x values in the data.

+ * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names. + * @name data․x + * @memberof Options + * @type {String} + * @default undefined + * @example + * data: { + * x: "date" + * } + */ + data_x: undefined, + + /** + * Specify the keys of the x values for each data.

+ * This option can be used if we want to show the data that has different x values. + * @name data․xs + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * xs: { + * data1: "x1", + * data2: "x2" + * } + * } + */ + data_xs: {}, + + /** + * Set a format to parse string specifed as x. + * @name data․xFormat + * @memberof Options + * @type {String} + * @default %Y-%m-%d + * @example + * data: { + * xFormat: "%Y-%m-%d %H:%M:%S" + * } + * @see [D3's time specifier](https://npm.runkit.com/d3-time-format) + */ + data_xFormat: "%Y-%m-%d", + + /** + * Set localtime format to parse x axis. + * @name data․xLocaltime + * @memberof Options + * @type {Boolean} + * @default true + * @example + * data: { + * xLocaltime: false + * } + */ + data_xLocaltime: !0, + + /** + * Sort on x axis. + * @name data․xSort + * @memberof Options + * @type {Boolean} + * @default true + * @example + * data: { + * xSort: false + * } + */ + data_xSort: !0, + + /** + * Converts data id value + * @name data․idConverter + * @memberof Options + * @type {Function} + * @default function(id) { return id; } + * @example + * data: { + * idConverter: function(id) { + * // when id is 'data1', converts to be 'data2' + * // 'data2' should be given as the initial data value + * if (id === "data1") { + * return "data2"; + * } else { + * return id; + * } + * } + * } + */ + data_idConverter: function data_idConverter(id) { + return id; + }, + + /** + * Set custom data name. + * @name data․names + * @memberof Options + * @type {Object} + * @default {} + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataName) + * @example + * data: { + * names: { + * data1: "Data Name 1", + * data2: "Data Name 2" + * } + * } + */ + data_names: {}, + + /** + * Set custom data class.

+ * If this option is specified, the element g for the data has an additional class that has the prefix 'bb-target-' (eg. bb-target-additional-data1-class). + * @name data․classes + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * classes: { + * data1: "additional-data1-class", + * data2: "additional-data2-class" + * } + * } + */ + data_classes: {}, + + /** + * Set groups for the data for stacking. + * @name data․groups + * @memberof Options + * @type {Array} + * @default [] + * @example + * data: { + * groups: [ + * ["data1", "data2"], + * ["data3"] + * ] + * } + */ + data_groups: [], + + /** + * Set y axis the data related to. y and y2 can be used. + * @name data․axes + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * axes: { + * data1: "y", + * data2: "y2" + * } + * } + */ + data_axes: {}, + + /** + * Set chart type at once.

+ * If this option is specified, the type will be applied to every data. This setting can be overwritten by data.types.

+ * **Available Values:** + * - area + * - area-line-range + * - area-spline + * - area-spline-range + * - area-step + * - bar + * - bubble + * - donut + * - gauge + * - line + * - pie + * - radar + * - scatter + * - spline + * - step + * @name data․type + * @memberof Options + * @type {String} + * @default line + * @example + * data: { + * type: "bar" + * } + */ + data_type: undefined, + + /** + * Set chart type for each data.
+ * This setting overwrites data.type setting. + * - **NOTE:** `radar` type can't be combined with other types. + * @name data․types + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * types: { + * data1: "bar", + * data2: "spline" + * } + * } + */ + data_types: {}, + + /** + * Set labels options + * @name data․labels + * @memberof Options + * @type {Object} + * @property {Boolean} [data.labels=false] Show or hide labels on each data points + * @property {Function} [data.labels.format={}] Set formatter function for data labels.
+ * The formatter function receives 4 arguments such as v, id, i, j and it must return a string that will be shown as the label. The arguments are:
+ * - `v` is the value of the data point where the label is shown. + * - `id` is the id of the data where the label is shown. + * - `i` is the index of the data point where the label is shown. + * - `j` is the sub index of the data point where the label is shown.

+ * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$')) + * @property {Number} [data.labels.position.x=0] x coordinate position, relative the original. + * @property {NUmber} [data.labels.position.y=0] y coordinate position, relative the original. + * @memberof Options + * @type {Object} + * @default {} + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataLabel) + * @see [Demo: labels format](https://naver.github.io/billboard.js/demo/#Data.DataLabelFormat) + * @see [Demo: labels position](https://naver.github.io/billboard.js/demo/#Data.DataLabelPosition) + * @example + * data: { + * labels: true, + * + * // or set specific options + * labels: { + * format: function(v, id, i, j) { ... }, + * + * // it's possible to set for each data + * format: { + * data1: function(v, id, i, j) { ... }, + * ... + * }, + * position: { + * x: -10, + * y: 10 + * } + * } + * } + */ + data_labels: {}, + data_labels_position: {}, + + /** + * This option changes the order of stacking data and pieces of pie/donut. + * - If `null` specified, it will be the order the data loaded. + * - If function specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)

+ * + * **Available Values:** + * - `desc`: In descending order + * - `asc`: In ascending order + * - `null`: It keeps the data load order + * - `function(data1, data2) { ... }`: Array.sort compareFunction + * @name data․order + * @memberof Options + * @type {String|Function|null} + * @default desc + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder) + * @example + * data: { + * // in descending order (default) + * order: "desc" + * + * // in ascending order + * order: "asc" + * + * // keeps data input order + * order: null + * + * // specifying sort function + * order: function(a, b) { + * // param data passed format + * { + * id: "data1", id_org: "data1", values: [ + * {x: 5, value: 250, id: "data1", index: 5, name: "data1"}, + * ... + * ] + * } + * } + * } + */ + data_order: "desc", + + /** + * Define regions for each data.
+ * The values must be an array for each data and it should include an object that has `start`, `end` and `style`. + * - The object type should be as: + * - start {Number}: Start data point number. If not set, the start will be the first data point. + * - [end] {Number}: End data point number. If not set, the end will be the last data point. + * - [style.dasharray="2 2"] {Object}: The first number specifies a distance for the filled area, and the second a distance for the unfilled area. + * - **NOTE:** Currently this option supports only line chart and dashed style. If this option specified, the line will be dashed only in the regions. + * @name data․regions + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * regions: { + * data1: [{ + * start: 1, + * end: 2, + * style: { + * dasharray: "5 2" + * } + * }, { + * start: 3 + * }], + * ... + * } + * } + */ + data_regions: {}, + + /** + * Set color converter function.

+ * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00'). + * @name data․color + * @memberof Options + * @type {Function} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor) + * @example + * data: { + * color: function(color, d) { ... } + * } + */ + data_color: undefined, + + /** + * Set color for each data. + * @name data․colors + * @memberof Options + * @type {Object} + * @default {} + * @example + * data: { + * colors: { + * data1: "#ff0000", + * data2: function(d) { + * return "#000"; + * } + * ... + * } + * } + */ + data_colors: {}, + + /** + * Hide each data when the chart appears.

+ * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden. + * @name data․hide + * @memberof Options + * @type {Boolean|Array} + * @default false + * @example + * data: { + * // all of data will be hidden + * hide: true + * + * // specified data will be hidden + * hide: ["data1", ...] + * } + */ + data_hide: !1, + + /** + * Filter values to be shown + * The data value is the same as the returned by `.data()`. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter + * @name data․filter + * @memberof Options + * @type {Function} + * @default undefined + * @example + * data: { + * // filter for id value + * filter: function(v) { + * // v: [{id: "data1", id_org: "data1", values: [ + * // {x: 0, value: 130, id: "data2", index: 0}, ...] + * // }, ...] + * return v.id !== "data1"; + * } + */ + data_filter: undefined, + + /** + * Set the stacking to be normalized + * - **NOTE:** + * - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set + * - y Axis will be set in percentage value (0 ~ 100%) + * - Must have postive values + * @name data․stack․normalize + * @memberof Options + * @type {Boolean} + * @default false + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized) + * @example + * data: { + * stack: { + * normalize: true + * } + * } + */ + data_stack_normalize: !1, + + /** + * Set data selection enabled

+ * If this option is set true, we can select the data points and get/set its state of selection by API (e.g. select, unselect, selected). + * @name data․selection․enabled + * @memberof Options + * @type {Boolean} + * @default false + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataSelection) + * @example + * data: { + * selection: { + * enabled: true + * } + * } + */ + data_selection_enabled: !1, + + /** + * Set grouped selection enabled.

+ * If this option set true, multiple data points that have same x value will be selected by one selection. + * @name data․selection․grouped + * @memberof Options + * @type {Boolean} + * @default false + * @example + * data: { + * selection: { + * grouped: true + * } + * } + */ + data_selection_grouped: !1, + + /** + * Set a callback for each data point to determine if it's selectable or not.

+ * The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean. + * @name data․selection․isselectable + * @memberof Options + * @type {Function} + * @default function() { return true; } + * @example + * data: { + * selection: { + * isselectable: function(d) { ... } + * } + * } + */ + data_selection_isselectable: function data_selection_isselectable() { + return !0; + }, + + /** + * Set multiple data points selection enabled.

+ * If this option set true, multile data points can have the selected state at the same time. If false set, only one data point can have the selected state and the others will be unselected when the new data point is selected. + * @name data․selection․multiple + * @memberof Options + * @type {Boolean} + * @default true + * @example + * data: { + * selection: { + * multiple: false + * } + * } + */ + data_selection_multiple: !0, + + /** + * Enable to select data points by dragging. + * If this option set true, data points can be selected by dragging. + * - **NOTE:** If this option set true, scrolling on the chart will be disabled because dragging event will handle the event. + * @name data․selection․draggable + * @memberof Options + * @type {Boolean} + * @default false + * @example + * data: { + * selection: { + * draggable: true + * } + * } + */ + data_selection_draggable: !1, + + /** + * Set a callback for click event on each data point.

+ * This callback will be called when each data point clicked and will receive d and element as the arguments. d is the data clicked and element is the element clicked. In this callback, this will be the Chart object. + * @name data․onclick + * @memberof Options + * @type {Function} + * @default function() {} + * @example + * data: { + * onclick: function(d, element) { ... } + * } + */ + data_onclick: function data_onclick() {}, + + /** + * Set a callback for mouse/touch over event on each data point.

+ * This callback will be called when mouse cursor or via touch moves onto each data point and will receive d as the argument. d is the data where mouse cursor moves onto. In this callback, this will be the Chart object. + * @name data․onover + * @memberof Options + * @type {Function} + * @default function() {} + * @example + * data: { + * onover: function(d) { ... } + * } + */ + data_onover: function data_onover() {}, + + /** + * Set a callback for mouse/touch out event on each data point.

+ * This callback will be called when mouse cursor or via touch moves out each data point and will receive d as the argument. d is the data where mouse cursor moves out. In this callback, this will be the Chart object. + * @name data․onout + * @memberof Options + * @type {Function} + * @default function() {} + * @example + * data: { + * onout: function(d) { ... } + * } + */ + data_onout: function data_onout() {}, + + /** + * Set a callback for on data selection. + * @name data․onselected + * @memberof Options + * @type {Function} + * @default function() {} + * @example + * data: { + * onselected: function(d, element) { + * // d - ex) {x: 4, value: 150, id: "data1", index: 4, name: "data1"} + * // element - + * ... + * } + * } + */ + data_onselected: function data_onselected() {}, + + /** + * Set a callback for on data un-selection. + * @name data․onunselected + * @memberof Options + * @type {Function} + * @default function() {} + * @example + * data: { + * onunselected: function(d, element) { + * // d - ex) {x: 4, value: 150, id: "data1", index: 4, name: "data1"} + * // element - + * ... + * } + * } + */ + data_onunselected: function data_onunselected() {}, + + /** + * Set a callback for minimum data + * - **NOTE:** For 'area-line-range' and 'area-spline-range', `mid` data will be taken for the comparison + * @name data․onmin + * @memberof Options + * @type {Function} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback) + * @example + * onmin: function(data) { + * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ] + * ... + * } + */ + data_onmin: undefined, + + /** + * Set a callback for maximum data + * - **NOTE:** For 'area-line-range' and 'area-spline-range', `mid` data will be taken for the comparison + * @name data․onmax + * @memberof Options + * @type {Function} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback) + * @example + * onmax: function(data) { + * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ] + * ... + * } + */ + data_onmax: undefined, + + /** + * Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as the most browsers will block XMLHTTPRequests. + * @name data․url + * @memberof Options + * @type {String} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.LoadData) + * @example + * data: { + * url: "/data/test.csv" + * } + */ + data_url: undefined, + + /** + * XHR header value + * - **NOTE:** Should be used with `data.url` option + * @name data․headers + * @memberof Options + * @type {String} + * @default undefined + * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader + * @example + * data: { + * url: "/data/test.csv", + * headers: { + * "Content-Type": "text/xml", + * ... + * } + * } + */ + data_headers: undefined, + + /** + * Parse a JSON object for data. See also data.keys. + * @name data․json + * @memberof Options + * @type {Object} + * @default undefined + * @see [data․keys](#.data%25E2%2580%25A4keys) + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.JSONData) + * @example + * data: { + * json: [ + * {name: "www.site1.com", upload: 200, download: 200, total: 400}, + * {name: "www.site2.com", upload: 100, download: 300, total: 400}, + * {name: "www.site3.com", upload: 300, download: 200, total: 500}, + * {name: "www.site4.com", upload: 400, download: 100, total: 500} + * ], + * keys: { + * // x: "name", // it's possible to specify 'x' when category axis + * value: ["upload", "download"] + * } + * } + */ + data_json: undefined, + + /** + * Load data from a multidimensional array, with the first element containing the data names, the following containing related data in that order. + * @name data․rows + * @memberof Options + * @type {Array} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.RowOrientedData) + * @example + * data: { + * rows: [ + * ["A", "B", "C"], + * [90, 120, 300], + * [40, 160, 240], + * [50, 200, 290], + * [120, 160, 230], + * [80, 130, 300], + * [90, 220, 320] + * ] + * } + * + * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain: + * // - an array of [high, mid, low] data following the order + * // - or an object with 'high', 'mid' and 'low' key value + * data: { + * rows: [ + * ["data1", "data2"], + * [ + * // or {high:150, mid: 140, low: 110}, 120 + * [150, 140, 110], 120 + * ], + * [[155, 130, 115], 55], + * [[160, 135, 120], 60] + * ], + * types: { + * data1: "area-line-range", + * data2: "line" + * } + * } + */ + data_rows: undefined, + + /** + * Load data from a multidimensional array, with each element containing an array consisting of a datum name and associated data values. + * @name data․columns + * @memberof Options + * @type {Array} + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.ColumnOrientedData) + * @example + * data: { + * columns: [ + * ["data1", 30, 20, 50, 40, 60, 50], + * ["data2", 200, 130, 90, 240, 130, 220], + * ["data3", 300, 200, 160, 400, 250, 250] + * ] + * } + * + * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain: + * // - an array of [high, mid, low] data following the order + * // - or an object with 'high', 'mid' and 'low' key value + * data: { + * columns: [ + * ["data1", + * [150, 140, 110], // or {high:150, mid: 140, low: 110} + * [150, 140, 110], + * [150, 140, 110] + * ] + * ], + * type: "area-line-range" + * } + */ + data_columns: undefined, + + /** + * Used if loading JSON via data.url. + * @name data․mimeType + * @memberof Options + * @type {String} + * @default undefined + * @example + * data: { + * mimeType: "json" + * } + */ + data_mimeType: undefined, + + /** + * Choose which JSON object keys correspond to desired data. + * @name data․keys + * @memberof Options + * @type {String} + * @default undefined + * @example + * data: { + * json: [ + * {name: "www.site1.com", upload: 200, download: 200, total: 400}, + * {name: "www.site2.com", upload: 100, download: 300, total: 400}, + * {name: "www.site3.com", upload: 300, download: 200, total: 500}, + * {name: "www.site4.com", upload: 400, download: 100, total: 500} + * ], + * keys: { + * // x: "name", // it's possible to specify 'x' when category axis + * value: ["upload", "download"] + * } + * } + */ + data_keys: undefined, + + /** + * Set text displayed when empty data. + * @name data․empty․label․text + * @memberof Options + * @type {String} + * @default "" + * @example + * data: { + * empty: { + * label: { + * text: "No Data" + * } + * } + * } + */ + data_empty_label_text: "", + + /** + * Set subchart options + * @name subchart + * @memberof Options + * @type {Object} + * @property {Boolean} [subchart.show=false] Show sub chart on the bottom of the chart. + * @property {Boolean} [subchart.axis.x.show=true] Show or hide x axis. + * @property {Boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line. + * @property {Boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text. + * @property {Number} [subchart.size.height] Change the height of the subchart. + * @property {Function} [subchart.onbrush] Set callback for brush event.
+ * Specified function receives the current zoomed x domain. + * @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart) + * @example + * subchart: { + * axis: { + * x: { + * show: true, + * tick: { + * show: true, + * text: { + * show: false + * } + * } + * } + * }, + * show: true, + * size: { + * height: 20 + * }, + * onbrush: function(domain) { ... } + * } + */ + subchart_show: !1, + subchart_defzoom: !1, + subchart_size_height: 60, + subchart_axis_x_show: !0, + subchart_axis_x_tick_show: !0, + subchart_axis_x_tick_text_show: !0, + subchart_onbrush: function subchart_onbrush() {}, + + /** + * Set color of the data values + * @name color + * @memberof Options + * @type {Object} + * @property {String|Object|Function} [color.onover] Set the color value for each data point when mouse/touch onover event occurs. + * @property {Array} [color.pattern] custom color pattern + * @property {Function} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement). + * - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.
+ * ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:
+ * - `bb-colorize-pattern-red` + * - `bb-colorize-pattern-fff` + * @property {Object} [color.threshold] color threshold for gauge and tooltip color + * @property {String} [color.threshold.unit] If set to `value`, the threshold will be based on the data value. Otherwise it'll be based on equation of the `threshold.max` option value. + * @property {Array} [color.threshold.values] Threshold values for each steps + * @property {Array} [color.threshold.max=100] The base value to determine threshold step value condition. When the given value is 15 and max 10, then the value for threshold is `15*100/10`. + * @example + * color: { + * pattern: ["#1f77b4", "#aec7e8", ...], + * + * // Set colors' patterns + * // it should return an array of SVGPatternElement + * tiles: function() { + * var pattern = document.createElementNS("http://www.w3.org/2000/svg", "pattern"); + * var g = document.createElementNS("http://www.w3.org/2000/svg", "g"); + * var circle1 = document.createElementNS("http://www.w3.org/2000/svg", "circle"); + * + * pattern.setAttribute("patternUnits", "userSpaceOnUse"); + * pattern.setAttribute("width", "32"); + * pattern.setAttribute("height", "32"); + * + * g.style.fill = "#000"; + * g.style.opacity = "0.2"; + * + * circle1.setAttribute("cx", "3"); + * circle1.setAttribute("cy", "3"); + * circle1.setAttribute("r", "3"); + * + * g.appendChild(circle1); + * pattern.appendChild(g); + * + * return [pattern]; + * }, + * + * // for threshold usage, pattern values should be set for each steps + * pattern: ["grey", "green", "yellow", "orange", "red"], + * threshold: { + * unit: "value", + * values: [10, 20, 30, 40, 50], // when the value is 20, 'green' will be set and the value is 40, 'orange' will be set. + * max: 30 // the equation for max is: value*100/30 + * }, + * + * // set all data to 'red' + * onover: "red", + * + * // set different color for data + * onover: { + * data1: "red", + * data2: "yellow" + * }, + * + * // will pass data object to the callback + * onover: function(d) { + * return d.id === "data1" ? "red" : "green"; + * } + * } + */ + color_pattern: [], + color_tiles: undefined, + color_threshold: {}, + color_onover: undefined, + + /** + * Legend options + * @name legend + * @memberof Options + * @type {Object} + * @property {Boolean} [legend.show=true] Show or hide legend. + * @property {Boolean} [legend.hide=false] Hide legend + * If true given, all legend will be hidden. If string or array given, only the legend that has the id will be hidden. + * @property {String|HTMLElement} [legend.contents.bindto=undefined] Set CSS selector or element reference to bind legend items. + * @property {String|Function} [legend.contents.template=undefined] Set item's template.
+ * - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string: + * - {=COLOR}: data color value + * - {=TITLE}: data title value + * - If set `function` value, will pass following arguments to the given function: + * - title {String}: data's id value + * - color {String}: color string + * - data {Array}: data array + * @property {String} [legend.position=bottom] Change the position of legend.
+ * Available values are: `bottom`, `right` and `inset` are supported. + * @property {Object} [legend.inset={anchor: 'top-left',x: 10,y: 0,step: undefined}] Change inset legend attributes.
+ * This option accepts object that has the keys `anchor`, `x`, `y` and `step`. + * - **anchor** decides the position of the legend: + * - top-left + * - top-right + * - bottom-left + * - bottom-right + * - **x** and **y**: + * - set the position of the legend based on the anchor. + * - **step**: + * - defines the max step the legend has (e.g. If 2 set and legend has 3 legend item, the legend 2 columns). + * @property {Boolean} [legend.equally=false] Set to all items have same width size. + * @property {Boolean} [legend.padding=0] Set padding value + * @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item. + * @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item. + * @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item. + * @property {Number} [legend.item.tile.width=10] Set width of item tile element + * @property {Number} [legend.item.tile.height=10] Set height of item tile element + * @property {Boolean} [legend.usePoint=false] Whether to use custom points in legend. + * @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition) + * @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1) + * @see [Demo: usePoint](https://naver.github.io/billboard.js/demo/#Legend.usePoint) + * @example + * legend: { + * show: true, + * hide: true, + * //or hide: "data1" + * //or hide: ["data1", "data2"] + * contents: { + * bindto: "#legend", //
    + * + * // will be as:
  • data1
  • + * template: "
  • {=TITLE}
  • " + * + * // or using function + * template: function(id, color, data) { + * // if you want omit some legend, return falsy value + * if (title !== "data1") { + * return "

  • + * **Available Values:** + * - timeseries + * - category + * - indexed + * @name axis․x․type + * @memberof Options + * @type {String} + * @default indexed + * @see [Demo: indexed](https://naver.github.io/billboard.js/demo/#Chart.AreaChart) + * @see [Demo: timeseries](https://naver.github.io/billboard.js/demo/#Chart.TimeseriesChart) + * @see [Demo: category](https://naver.github.io/billboard.js/demo/#Data.CategoryData) + * @example + * axis: { + * x: { + * type: "timeseries" + * } + * } + */ + axis_x_type: "indexed", + + /** + * Set how to treat the timezone of x values.
    + * If true, treat x value as localtime. If false, convert to UTC internally. + * @name axis․x․localtime + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * x: { + * localtime: false + * } + * } + */ + axis_x_localtime: !0, + + /** + * Set category names on category axis. + * This must be an array that includes category names in string. If category names are included in the date by data.x option, this is not required. + * @name axis․x․categories + * @memberof Options + * @type {Array} + * @default [] + * @example + * axis: { + * x: { + * categories: ["Category 1", "Category 2", ...] + * } + * } + */ + axis_x_categories: [], + + /** + * Centerise ticks on category axis. + * @name axis․x․tick․centered + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * x: { + * tick: { + * centered: true + * } + * } + * } + */ + axis_x_tick_centered: !1, + + /** + * A function to format tick value. Format string is also available for timeseries data. + * @name axis․x․tick․format + * @memberof Options + * @type {Function} + * @default undefined + * @example + * axis: { + * x: { + * tick: { + * // for timeseries, a 'datetime' object is given as parameter + * format: function(x) { + * return x.getFullYear(); + * } + * + * // for category, index(Number) and categoryName(String) are given as parameter + * format: function(index, categoryName) { + * return categoryName.substr(0, 10); + * } + * } + * } + * } + */ + axis_x_tick_format: undefined, + + /** + * Setting for culling ticks.

    + * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown.

    + * We can change the number of ticks to be shown by axis.x.tick.culling.max. + * @name axis․x․tick․culling + * @memberof Options + * @type {Boolean} + * @default + * - true for indexed axis and timeseries axis + * - false for category axis + * @example + * axis: { + * x: { + * tick: { + * culling: false + * } + * } + * } + */ + axis_x_tick_culling: {}, + + /** + * The number of tick texts will be adjusted to less than this value. + * @name axis․x․tick․culling․max + * @memberof Options + * @type {Number} + * @default 10 + * @example + * axis: { + * x: { + * tick: { + * culling: { + * max: 5 + * } + * } + * } + * } + */ + axis_x_tick_culling_max: 10, + + /** + * The number of x axis ticks to show.

    + * This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value). + * @name axis․x․tick․count + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * x: { + * tick: { + * count: 5 + * } + * } + * } + */ + axis_x_tick_count: undefined, + + /** + * Show or hide x axis tick line. + * @name axis․x․tick․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * x: { + * tick: { + * show: false + * } + * } + * } + */ + axis_x_tick_show: !0, + + /** + * Show or hide x axis tick text. + * @name axis․x․tick․text․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * x: { + * tick: { + * text: { + * show: false + * } + * } + * } + * } + */ + axis_x_tick_text_show: !0, + + /** + * Set the x Axis tick text's position relatively its original position + * @name axis․x․tick․text․position + * @memberof Options + * @type {Object} + * @default {x: 0, y:0} + * @example + * axis: { + * x: { + * tick: { + * text: { + * position: { + * x: 10, + * y: 10 + * } + * } + * } + * } + * } + */ + axis_x_tick_text_position: { + x: 0, + y: 0 + }, + + /** + * Fit x axis ticks.

    + * If true set, the ticks will be positioned nicely. If false set, the ticks will be positioned according to x value of the data points. + * @name axis․x․tick․fit + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * x: { + * tick: { + * fit: false + * } + * } + * } + */ + axis_x_tick_fit: !0, + + /** + * Set the x values of ticks manually.

    + * If this option is provided, the position of the ticks will be determined based on those values. This option works with timeseries data and the x values will be parsed accoding to the type of the value and data.xFormat option. + * @name axis․x․tick․values + * @memberof Options + * @type {Array} + * @default null + * @example + * axis: { + * x: { + * tick: { + * values: [1, 2, 4, 8, 16, 32, ...] + * } + * } + * } + */ + axis_x_tick_values: null, + + /** + * Rotate x axis tick text.
    + * If you set negative value, it will rotate to opposite direction. + * @name axis․x․tick․rotate + * @memberof Options + * @type {Number} + * @default 0 + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.RotateXAxisTickText) + * @example + * axis: { + * x: { + * tick: { + * rotate: 60 + * } + * } + * } + */ + axis_x_tick_rotate: 0, + + /** + * Show x axis outer tick. + * @name axis․x․tick․outer + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * x: { + * tick: { + * outer: false + * } + * } + * } + */ + axis_x_tick_outer: !0, + + /** + * Set tick text to be multiline + * - **NOTE:** + * > When x tick text contains `\n`, it's used as line break and 'axis.x.tick.width' option is ignored. + * @name axis․x․tick․multiline + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.XAxisTickMultiline) + * @example + * axis: { + * x: { + * tick: { + * multiline: false + * } + * } + * } + * @example + * // example of line break with '\n' + * // In this case, 'axis.x.tick.width' is ignored + * data: { + * x: "x", + * columns: [ + * ["x", "long\ntext", "Another\nLong\nText"], + * ... + * ], + * } + */ + axis_x_tick_multiline: !0, + + /** + * Set tick width + * - **NOTE:** + * > When x tick text contains `\n`, this option is ignored. + * @name axis․x․tick․width + * @memberof Options + * @type {Number} + * @default null + * @example + * axis: { + * x: { + * tick: { + * width: 50 + * } + * } + * } + */ + axis_x_tick_width: null, + + /** + * Set to display system tooltip(via 'title' attribute) for tick text + * - **NOTE:** Only available for category axis type (`axis.x.type='category'`) + * @name axis․x․tick․tooltip + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * x: { + * tick: { + * tooltip: true + * } + * } + * } + */ + axis_x_tick_tooltip: !1, + + /** + * Set max value of x axis range. + * @name axis․x․max + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * x: { + * max: 100 + * } + * } + */ + axis_x_max: undefined, + + /** + * Set min value of x axis range. + * @name axis․x․min + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * x: { + * min: -100 + * } + * } + */ + axis_x_min: undefined, + + /** + * Set padding for x axis.

    + * If this option is set, the range of x axis will increase/decrease according to the values. + * If no padding is needed in the rage of x axis, 0 should be set. + * - **NOTE:** + * The padding values aren't based on pixels. It differs according axis types
    + * - **category:** The unit of tick value + * ex. the given value `1`, is same as the width of 1 tick width + * - **timeseries:** Numeric time value + * ex. the given value `1000*60*60*24`, which is numeric time equivalent of a day, is same as the width of 1 tick width + * @name axis․x․padding + * @memberof Options + * @type {Object} + * @default {} + * @example + * axis: { + * x: { + * padding: { + * // when axis type is 'category' + * left: 1, // set left padding width of equivalent value of a tick's width + * right: 0.5 // set right padding width as half of equivalent value of tick's width + * + * // when axis type is 'timeseries' + * left: 1000*60*60*24, // set left padding width of equivalent value of a day tick's width + * right: 1000*60*60*12 // set right padding width as half of equivalent value of a day tick's width + * } + * } + * } + */ + axis_x_padding: {}, + + /** + * Set height of x axis.

    + * The height of x axis can be set manually by this option. If you need more space for x axis, please use this option for that. The unit is pixel. + * @name axis․x․height + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * x: { + * height: 20 + * } + * } + */ + axis_x_height: undefined, + + /** + * Set default extent for subchart and zoom. This can be an array or function that returns an array. + * @name axis․x․extent + * @memberof Options + * @type {Array} + * @default undefined + * @example + * axis: { + * x: { + * // [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner and [x1, y1] is the bottom-right corner + * // https://github.com/d3/d3-brush/blob/master/src/brush.js#L521 + * extent: [ + * [0, 0], [200, 60] + * ] + * } + * } + */ + axis_x_extent: undefined, + + /** + * Set label on x axis.

    + * You can set x axis label and change its position by this option. string and object can be passed and we can change the poisiton by passing object that has position key. Available position differs according to the axis direction (vertical or horizontal). If string set, the position will be the default. + * - **If it's horizontal axis:** + * - inner-right [default] + * - inner-center + * - inner-left + * - outer-right + * - outer-center + * - outer-left + * - **If it's vertical axis:** + * - inner-top [default] + * - inner-middle + * - inner-bottom + * - outer-top + * - outer-middle + * - outer-bottom + * @name axis․x․label + * @memberof Options + * @type {String|Object} + * @default undefined + * @example + * axis: { + * x: { + * label: "Your X Axis" + * } + * } + * + * axis: { + * x: { + * label: { + * text: "Your X Axis", + * position: "outer-center" + * } + * } + * } + */ + axis_x_label: {}, + + /** + * Set additional axes for x Axis. + * - **NOTE:** Axis' scale is based on x Axis value + * + * Each axis object should consist with following options: + * + * | Name | Type | Default | Description | + * | --- | --- | --- | --- | + * | tick.outer | Boolean | true | Show outer tick | + * | tick.format | Function | - | Set formatter for tick text | + * | tick.count | Number | - | Set the number of y axis ticks | + * | tick.values | Array | - | Set tick values manually | + * @name axis․x․axes + * @memberof Options + * @type {Array} + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.MultiAxes) + * @example + * x: { + * axes: [ + * { + * tick: { + * outer: false, + * format: function(x) { + * return x + "%"; + * }, + * count: 2, + * values: [10, 20, 30] + * } + * }, + * ... + * ] + * } + */ + axis_x_axes: [], + + /** + * Set clip-path attribute for y axis element + * @name axis․y․clipPath + * @memberof Options + * @type {Boolean} + * @default true + * @example + * // don't set 'clip-path' attribute + * clipPath: false + */ + axis_y_clipPath: !0, + + /** + * Show or hide y axis. + * @name axis․y․show + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * y: { + * show: false + * } + * } + */ + axis_y_show: !0, + + /** + * Set type of y axis.

    + * **Available Values:** + * - timeseries + * - category + * - indexed + * @name axis․y․type + * @memberof Options + * @type {String} + * @default undefined + * @example + * axis: { + * y: { + * type: "timeseries" + * } + * } + */ + axis_y_type: undefined, + + /** + * Set max value of y axis. + * - **NOTE:** Padding will be added based on this value, so if you don't need the padding, please set axis.y.padding to disable it (e.g. axis.y.padding = 0). + * @name axis․y․max + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y: { + * max: 1000 + * } + * } + */ + axis_y_max: undefined, + + /** + * Set min value of y axis. + * - **NOTE:** + * Padding will be added based on this value, so if you don't need the padding, please set axis.y.padding to disable it (e.g. axis.y.padding = 0). + * @name axis․y․min + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y: { + * min: 1000 + * } + * } + */ + axis_y_min: undefined, + + /** + * Change the direction of y axis.

    + * If true set, the direction will be from the top to the bottom. + * @name axis․y․inverted + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * y: { + * inverted: true + * } + * } + */ + axis_y_inverted: !1, + + /** + * Set center value of y axis. + * @name axis․y․center + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y: { + * center: 0 + * } + * } + */ + axis_y_center: undefined, + + /** + * Show y axis inside of the chart. + * @name axis․y․inner + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * y: { + * inner: true + * } + * } + */ + axis_y_inner: !1, + + /** + * Set label on y axis.

    + * You can set y axis label and change its position by this option. This option works in the same way as axis.x.label. + * @name axis․y․label + * @memberof Options + * @type {String|Object} + * @default {} + * @example + * axis: { + * y: { + * label: "Your Y Axis" + * } + * } + * + * axis: { + * y: { + * label: { + * text: "Your Y Axis", + * position: "outer-middle" + * } + * } + * } + */ + axis_y_label: {}, + + /** + * Set formatter for y axis tick text.

    + * This option accepts d3.format object as well as a function you define. + * @name axis․y․tick․format + * @memberof Options + * @type {Function} + * @default undefined + * @example + * axis: { + * y: { + * tick: { + * format: function(x) { + * return x.getFullYear(); + * } + * } + * } + * } + */ + axis_y_tick_format: undefined, + + /** + * Show y axis outer tick. + * @name axis․y․tick․outer + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * y: { + * tick: { + * outer: false + * } + * } + * } + */ + axis_y_tick_outer: !0, + + /** + * Set y axis tick values manually. + * @name axis․y․tick․values + * @memberof Options + * @type {Array} + * @default null + * @example + * axis: { + * y: { + * tick: { + * values: [100, 1000, 10000] + * } + * } + * } + */ + axis_y_tick_values: null, + axis_y_tick_rotate: 0, + + /** + * Set the number of y axis ticks.

    + * - **NOTE:** The position of the ticks will be calculated precisely, so the values on the ticks will not be rounded nicely. In the case, axis.y.tick.format or axis.y.tick.values will be helpful. + * @name axis․y․tick․count + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y: { + * tick: { + * count: 5 + * } + * } + * } + */ + axis_y_tick_count: undefined, + + /** + * Show or hide y axis tick line. + * @name axis․y․tick․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * y: { + * tick: { + * show: false + * } + * } + * } + */ + axis_y_tick_show: !0, + + /** + * Show or hide y axis tick text. + * @name axis․y․tick․text․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * y: { + * tick: { + * text: { + * show: false + * } + * } + * } + * } + */ + axis_y_tick_text_show: !0, + + /** + * Set the y Axis tick text's position relatively its original position + * @name axis․y․tick․text․position + * @memberof Options + * @type {Object} + * @default {x: 0, y:0} + * @example + * axis: { + * y: { + * tick: { + * text: { + * position: { + * x: 10, + * y: 10 + * } + * } + * } + * } + * } + */ + axis_y_tick_text_position: { + x: 0, + y: 0 + }, + + /** + * Set the number of y axis ticks.

    + * - **NOTE:** The position of the ticks will be calculated precisely, so the values on the ticks will not be rounded nicely. In the case, axis.y.tick.format or axis.y.tick.values will be helpful. + * @name axis․y․tick․time + * @memberof Options + * @private + * @type {Object} + * @property {Function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals) + * @example + * axis: { + * y: { + * tick: { + * time: { + * // ticks at 15-minute intervals + * // https://github.com/d3/d3-scale/blob/master/README.md#time_ticks + * value: d3.timeMinute.every(15) + * } + * } + * } + * } + */ + // @TODO: not fully implemented yet + axis_y_tick_time_value: undefined, + + /** + * Set padding for y axis.

    + * You can set padding for y axis to create more space on the edge of the axis. + * This option accepts object and it can include top and bottom. top, bottom will be treated as pixels. + * + * - **NOTE:** For area and bar type charts, [area.zerobased](#.area) or [bar.zerobased](#.bar) options should be set to 'false` to get padded bottom. + * @name axis․y․padding + * @memberof Options + * @type {Object} + * @default {} + * @example + * axis: { + * y: { + * padding: { + * top: 0, + * bottom: 0 + * } + * } + * } + */ + axis_y_padding: {}, + + /** + * Set default range of y axis.

    + * This option set the default value for y axis when there is no data on init. + * @name axis․y․default + * @memberof Options + * @type {Array} + * @default undefined + * @example + * axis: { + * y: { + * default: [0, 1000] + * } + * } + */ + axis_y_default: undefined, + + /** + * Set additional axes for y Axis. + * - **NOTE:** Axis' scale is based on y Axis value + * + * Each axis object should consist with following options: + * + * | Name | Type | Default | Description | + * | --- | --- | --- | --- | + * | tick.outer | Boolean | true | Show outer tick | + * | tick.format | Function | - | Set formatter for tick text | + * | tick.count | Number | - | Set the number of y axis ticks | + * | tick.values | Array | - | Set tick values manually | + * @name axis․y․axes + * @memberof Options + * @type {Array} + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.MultiAxes) + * @example + * y: { + * axes: [ + * { + * tick: { + * outer: false, + * format: function(x) { + * return x + "%"; + * }, + * count: 2, + * values: [10, 20, 30] + * } + * }, + * ... + * ] + * } + */ + axis_y_axes: [], + + /** + * Show or hide y2 axis. + * @name axis․y2․show + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * y2: { + * show: true + * } + * } + */ + axis_y2_show: !1, + + /** + * Set max value of y2 axis. + * @name axis․y2․max + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y2: { + * max: 1000 + * } + * } + */ + axis_y2_max: undefined, + + /** + * Set min value of y2 axis. + * @name axis․y2․min + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y2: { + * min: -1000 + * } + * } + */ + axis_y2_min: undefined, + + /** + * Change the direction of y2 axis.

    + * If true set, the direction will be from the top to the bottom. + * @name axis․y2․inverted + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * y2: { + * inverted: true + * } + * } + */ + axis_y2_inverted: !1, + + /** + * Set center value of y2 axis. + * @name axis․y2․center + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y2: { + * center: 0 + * } + * } + */ + axis_y2_center: undefined, + + /** + * Show y2 axis inside of the chart. + * @name axis․y2․inner + * @memberof Options + * @type {Boolean} + * @default false + * @example + * axis: { + * y2: { + * inner: true + * } + * } + */ + axis_y2_inner: !1, + + /** + * Set label on y2 axis.

    + * You can set y2 axis label and change its position by this option. This option works in the same way as axis.x.label. + * @name axis․y2․label + * @memberof Options + * @type {String|Object} + * @default {} + * @example + * axis: { + * y2: { + * label: "Your Y2 Axis" + * } + * } + * + * axis: { + * y2: { + * label: { + * text: "Your Y2 Axis", + * position: "outer-middle" + * } + * } + * } + */ + axis_y2_label: {}, + + /** + * Set formatter for y2 axis tick text.

    + * This option works in the same way as axis.y.format. + * @name axis․y2․tick․format + * @memberof Options + * @type {Function} + * @default undefined + * @example + * axis: { + * y2: { + * tick: { + * format: d3.format("$,") + * //or format: function(d) { return "$" + d; } + * } + * } + * } + */ + axis_y2_tick_format: undefined, + + /** + * Show or hide y2 axis outer tick. + * @name axis․y2․tick․outer + * @memberof Options + * @type {Boolean} + * @default true + * @example + * axis: { + * y2: { + * tick: { + * outer: false + * } + * } + * } + */ + axis_y2_tick_outer: !0, + + /** + * Set y2 axis tick values manually. + * @name axis․y2․tick․values + * @memberof Options + * @type {Array} + * @default null + * @example + * axis: { + * y2: { + * tick: { + * values: [100, 1000, 10000] + * } + * } + * } + */ + axis_y2_tick_values: null, + + /** + * Set the number of y2 axis ticks. + * - **NOTE:** This works in the same way as axis.y.tick.count. + * @name axis․y2․tick․count + * @memberof Options + * @type {Number} + * @default undefined + * @example + * axis: { + * y2: { + * tick: { + * count: 5 + * } + * } + * } + */ + axis_y2_tick_count: undefined, + + /** + * Show or hide y2 axis tick line. + * @name axis․y2․tick․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * y2: { + * tick: { + * show: false + * } + * } + * } + */ + axis_y2_tick_show: !0, + + /** + * Show or hide y2 axis tick text. + * @name axis․y2․tick․text․show + * @memberof Options + * @type {Boolean} + * @default true + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.HideTickLineText) + * @example + * axis: { + * y2: { + * tick: { + * text: { + * show: false + * } + * } + * } + * } + */ + axis_y2_tick_text_show: !0, + + /** + * Set the y2 Axis tick text's position relatively its original position + * @name axis․y2․tick․text․position + * @memberof Options + * @type {Object} + * @default {x: 0, y:0} + * @example + * axis: { + * y2: { + * tick: { + * text: { + * position: { + * x: 10, + * y: 10 + * } + * } + * } + * } + * } + */ + axis_y2_tick_text_position: { + x: 0, + y: 0 + }, + + /** + * Set the number of y2 axis ticks. + * - **NOTE:** This works in the same way as axis.y.tick.count. + * @name axis․y2․padding + * @memberof Options + * @type {Object} + * @default {} + * @example + * axis: { + * y2: { + * padding: { + * top: 100, + * bottom: 100 + * } + * } + * } + */ + axis_y2_padding: {}, + + /** + * Set default range of y2 axis.

    + * This option set the default value for y2 axis when there is no data on init. + * @name axis․y2․default + * @memberof Options + * @type {Array} + * @default undefined + * @example + * axis: { + * y2: { + * default: [0, 1000] + * } + * } + */ + axis_y2_default: undefined, + + /** + * Set additional axes for y2 Axis. + * - **NOTE:** Axis' scale is based on y2 Axis value + * + * Each axis object should consist with following options: + * + * | Name | Type | Default | Description | + * | --- | --- | --- | --- | + * | tick.outer | Boolean | true | Show outer tick | + * | tick.format | Function | - | Set formatter for tick text | + * | tick.count | Number | - | Set the number of y axis ticks | + * | tick.values | Array | - | Set tick values manually | + * @name axis․y2․axes + * @memberof Options + * @type {Array} + * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.MultiAxes) + * @example + * y2: { + * axes: [ + * { + * tick: { + * outer: false, + * format: function(x) { + * return x + "%"; + * }, + * count: 2, + * values: [10, 20, 30] + * } + * }, + * ... + * ] + * } + */ + axis_y2_axes: [], + + /** + * Set related options + * @name grid + * @memberof Options + * @type {Object} + * @property {Boolean} [front=false] Set 'grid & focus lines' to be positioned over grid lines and chart elements. + * @property {Boolean} [x.show=false] Show grids along x axis. + * @property {Array} [x.lines=[]] Show additional grid lines along x axis.
    + * This option accepts array including object that has value, text, position and class. text, position and class are optional. For position, start, middle and end (default) are available. + * If x axis is category axis, value can be category name. If x axis is timeseries axis, value can be date string, Date object and unixtime integer. + * @property {Boolean} [y.show=false] Show grids along x axis. + * @property {Array} [y.lines=[]] Show additional grid lines along y axis.
    + * This option accepts array including object that has value, text, position and class. + * @property {Number} [y.ticks=10] Number of y grids to be shown. + * @property {Boolean} [focus.show=true] Show grids when focus. + * @property {Boolean} [lines.front=true] Set grid lines to be positioned over chart elements. + * @default undefined + * @see [Demo](https://naver.github.io/billboard.js/demo/#Grid.GridLines) + * @see [Demo: X Grid Lines](https://naver.github.io/billboard.js/demo/#Grid.OptionalXGridLines) + * @see [Demo: Y Grid Lines](https://naver.github.io/billboard.js/demo/#Grid.OptionalYGridLines) + * @example + * grid: { + * x: { + * show: true, + * lines: [ + * {value: 2, text: "Label on 2"}, + * {value: 5, text: "Label on 5", class: "label-5"} + * {value: 6, text: "Label on 6", position: "start"} + * ] + * }, + * y: { + * show: true, + * lines: [ + * {value: 100, text: "Label on 100"}, + * {value: 200, text: "Label on 200", class: "label-200"} + * {value: 300, text: "Label on 300", position: 'middle'} + * ], + * ticks: 5 + * }, + * front: true, + * focus: { + * show: false + * }, + * lines: { + * front: false + * } + * } + */ + grid_x_show: !1, + grid_x_type: "tick", + grid_x_lines: [], + grid_y_show: !1, + grid_y_lines: [], + grid_y_ticks: 10, + grid_focus_show: !0, + grid_front: !1, + grid_lines_front: !0, + + /** + * Set point options + * @name point + * @memberof Options + * @type {Object} + * @property {Boolean} [point.show=true] Whether to show each point in line. + * @property {Number|Function} [point.r=2.5] The radius size of each point.
    + * - **NOTE:** Disabled for 'bubble' type + * @property {Boolean} [point.focus.expand.enabled=true] Whether to expand each point on focus. + * @property {Boolean} [point.focus.expand.r=point.r*1.75] The radius size of each point on focus.
    + * - **NOTE:** For 'bubble' type, the default is `bubbleSize*1.15` + * @property {Number} [point.select.r=point.r*4] The radius size of each point on selected. + * @property {String} [point.type="circle"] The type of point to be drawn
    + * - **NOTE:** + * - If chart has 'bubble' type, only circle can be used. + * - For IE, non circle point expansions are not supported due to lack of transform support. + * - **Available Values:** + * - circle + * - rectangle + * @property {Array} [point.pattern=[]] The type of point or svg shape as string, to be drawn for each line
    + * - **NOTE:** + * - This is an `experimental` feature and can have some unexpected behaviors. + * - If chart has 'bubble' type, only circle can be used. + * - For IE, non circle point expansions are not supported due to lack of transform support. + * - **Available Values:** + * - circle + * - rectangle + * - svg shape tag interpreted as string
    + * (ex. ``) + * @see [Demo: point type](https://naver.github.io/billboard.js/demo/#Point.RectanglePoints) + * @example + * point: { + * show: false, + * r: 5, + * + * // or customize the radius + * r: function(d) { + * ... + * return r; + * }, + * + * focus: { + * expand: { + * enabled: true, + * r: 1 + * } + * }, + * select: { + * r: 3 + * }, + * + * // valid values are "circle" or "rectangle" + * type: "rectangle", + * + * // or indicate as pattern + * pattern: [ + * "circle", + * "rectangle", + * "" + * ], + * } + */ + point_show: !0, + point_r: 2.5, + point_sensitivity: 10, + point_focus_expand_enabled: !0, + point_focus_expand_r: undefined, + point_pattern: [], + point_select_r: undefined, + point_type: "circle", + + /** + * Set line options + * @name line + * @memberof Options + * @type {Object} + * @property {Boolean} [line.connectNull=false] Set if null data point will be connected or not.
    + * If true set, the region of null data will be connected without any data point. If false set, the region of null data will not be connected and get empty. + * @property {Array} [line.classes=undefined] If set, used to set a css class on each line. + * @property {Boolean} [line.step.type=step] Change step type for step chart.
    + * **Available values:** + * - step + * - step-before + * - step-after + * @property {Boolean|Array} [line.point=true] Set to false to not draw points on linecharts. Or pass an array of line ids to draw points for. + * @example + * line: { + * connectNull: true, + * classes: [ + * "line-class1", + * "line-class2" + * ], + * step: { + * type: "step-after" + * }, + * + * // hide all data points ('point.show=false' also has similar effect) + * point: false, + * + * // show data points for only indicated datas + * point: [ + * "data1", "data3" + * ] + * } + */ + line_connectNull: !1, + line_step_type: "step", + line_classes: undefined, + line_point: !0, + + /** + * Set bar options + * @name bar + * @memberof Options + * @type {Object} + * @property {Number} [bar.padding=0] The padding pixel value between each bar. + * @property {Number} [bar.radius] Set the radius of bar edge in pixel. + * - **NOTE:** Works only for non-stacked bar + * @property {Number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width. + * @property {Number} [bar.width] Change the width of bar chart. + * @property {Number} [bar.width.ratio=0.6] Change the width of bar chart by ratio. + * @property {Number} [bar.width.max] The maximum width value for ratio. + * @property {Number} [bar.width.dataname] Change the width of bar for indicated dataset only. + * - **NOTE:** + * - Works only for non-stacked bar + * - Bars are centered accoding its total width value + * @property {Number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio. + * @property {Number} [bar.width.dataname.max] The maximum width value for ratio. + * @property {Boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart. + * @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding) + * @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius) + * @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth) + * @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant) + * @example + * bar: { + * padding: 1, + * + * // the 'radius' option can be used only for non-stacking bars + * radius: 10, + * // or + * radius: { + * ratio: 0.5 + * } + * + * width: 10, + * + * // or + * width: { + * ratio: 0.2, + * max: 20 + * }, + * + * // or specify width per dataset + * width: { + * data1: 20, + * data2: { + * ratio: 0.2, + * max: 20 + * } + * }, + * + * zerobased: false + * } + */ + bar_padding: 0, + bar_radius: undefined, + bar_radius_ratio: undefined, + bar_width: undefined, + bar_width_ratio: .6, + bar_width_max: undefined, + bar_zerobased: !0, + + /** + * Set bubble options + * @name bubble + * @memberof Options + * @type {Object} + * @property {Number|Function} [bubble.maxR=35] Set the max bubble radius value + * @example + * bubble: { + * // ex) If 100 is the highest value among data bound, the representation bubble of 100 will have radius of 50. + * // And the lesser will have radius relatively from tha max value. + * maxR: 50, + * + * // or set radius callback + * maxR: function(d) { + * // ex. of d param - {x: Fri Oct 06 2017 00:00:00 GMT+0900, value: 80, id: "data2", index: 5} + * ... + * return Math.sqrt(d.value * 2); + * } + * } + */ + bubble_maxR: 35, + + /** + * Set area options + * @name area + * @memberof Options + * @type {Object} + * @property {Boolean} [area.zerobased=true] Set if min or max value will be 0 on area chart. + * @property {Boolean} [area.above=false] + * @example + * area: { + * zerobased: false, + * above: true + * } + */ + area_zerobased: !0, + area_above: !1, + + /** + * Set pie options + * @name pie + * @memberof Options + * @type {Object} + * @property {Boolean} [pie.label.show=true] Show or hide label on each pie piece. + * @property {Function} [pie.label.format] Set formatter for the label on each pie piece. + * @property {Number} [pie.label.threshold=0.05] Set threshold to show/hide labels. + * @property {Number|Function} [pie.label.ratio=undefined] Set ratio of labels position. + * @property {Boolean|Object} [pie.expand=true] Enable or disable expanding pie pieces. + * @property {Number} [pie.expand.duration=50] Set expand transition time in ms. + * @property {Number} [pie.innerRadius=0] Sets the inner radius of pie arc. + * @property {Number} [pie.padAngle=0] Set padding between data. + * @property {Number} [pie.padding=0] Sets the gap between pie arcs. + * @example + * pie: { + * label: { + * show: false, + * format: function(value, ratio, id) { + * return d3.format("$")(value); + * }, + * threshold: 0.1, + * + * // set ratio callback. Should return ratio value + * ratio: function(d, radius, h) { + * ... + * return ratio; + * }, + * // or set ratio number + * ratio: 0.5 + * }, + * + * // disable expand transition for interaction + * expand: false, + * + * // set duration of expand transition to 500ms. + * expand: { + * duration: 500 + * }, + * + * innerRadius: 0, + * padAngle: 0.1, + * padding: 0 + * } + */ + pie_label_show: !0, + pie_label_format: undefined, + pie_label_threshold: .05, + pie_label_ratio: undefined, + pie_expand: {}, + pie_expand_duration: 50, + pie_innerRadius: 0, + pie_padAngle: 0, + pie_padding: 0, + + /** + * Set gauge options + * @name gauge + * @memberof Options + * @type {Object} + * @property {Boolean} [gauge.fullCircle=false] Show full circle as donut. When set to 'true', the max label will not be showed due to start and end points are same location. + * @property {Boolean} [gauge.label.show=true] Show or hide label on gauge. + * @property {Function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character. + * @property {Function} [gauge.label.extents] Set customized min/max label text. + * @property {Boolean} [gauge.expand=true] Enable or disable expanding gauge. + * @property {Number} [gauge.expand.duration=50] Set the expand transition time in milliseconds. + * @property {Number} [gauge.min=0] Set min value of the gauge. + * @property {Number} [gauge.max=100] Set max value of the gauge. + * @property {Number} [gauge.startingAngle=-1 * Math.PI / 2] + * @property {String} [gauge.units] Set units of the gauge. + * @property {Number} [gauge.width] Set width of gauge chart. + * @example + * gauge: { + * fullCircle: false, + * label: { + * show: false, + * format: function(value, ratio) { + * return value; + * + * // to multiline, return with '\n' character + * // return value +"%\nLine1\n2Line2"; + * }, + * extents: function(value, isMax) { + * return (isMax ? "Max:" : "Min:") + value; + * } + * }, + * expand: false, + * + * // or set duration + * expand: { + * duration: 20 + * }, + * min: -100, + * max: 200, + * units: "%", + * width: 10 + * } + */ + gauge_fullCircle: !1, + gauge_label_show: !0, + gauge_label_format: undefined, + gauge_min: 0, + gauge_max: 100, + gauge_startingAngle: -1 * Math.PI / 2, + gauge_label_extents: undefined, + gauge_units: undefined, + gauge_width: undefined, + gauge_expand: {}, + gauge_expand_duration: 50, + + /** + * Set donut options + * @name donut + * @memberof Options + * @type {Object} + * @property {Boolean} [donut.label.show=true] Show or hide label on each donut piece. + * @property {Function} [donut.label.format] Set formatter for the label on each donut piece. + * @property {Number} [donut.label.threshold=0.05] Set threshold to show/hide labels. + * @property {Number|Function} [donut.label.ratio=undefined] Set ratio of labels position. + * @property {Boolean} [donut.expand=true] Enable or disable expanding donut pieces. + * @property {Number} [donut.width] Set width of donut chart. + * @property {String} [donut.title=""] Set title of donut chart. Use `\n` character to enter line break. + * @property {Number} [donut.padAngle=0] Set padding between data. + * @example + * donut: { + * label: { + * show: false, + * format: function(value, ratio, id) { + * return d3.format("$")(value); + * }, + * threshold: 0.1, + * + * // set ratio callback. Should return ratio value + * ratio: function(d, radius, h) { + * ... + * return ratio; + * }, + * // or set ratio number + * ratio: 0.5 + * }, + * expand: false, + * width: 10, + * padAngle: 0.2, + * title: "Donut Title" + * + * // title with line break + * title: "Title1\nTitle2" + * } + */ + donut_label_show: !0, + donut_label_format: undefined, + donut_label_threshold: .05, + donut_label_ratio: undefined, + donut_width: undefined, + donut_title: "", + donut_expand: {}, + donut_expand_duration: 50, + donut_padAngle: 0, + + /** + * Set spline options + * - **Available interpolation type values:** + * - basis (d3.curveBasis) + * - basis-closed (d3.curveBasisClosed) + * - basis-open (d3.curveBasisOpen) + * - bundle (d3.curveBundle) + * - cardinal (d3.curveCardinal) + * - cardinal-closed (d3.curveCardinalClosed) + * - cardinal-open (d3.curveCardinalOpen) + * - catmull-rom (d3.curveCatmullRom) + * - catmull-rom-closed (d3.curveCatmullRomClosed) + * - catmull-rom-open (d3.curveCatmullRomOpen) + * - monotone-x (d3.curveMonotoneX) + * - monotone-y (d3.curveMonotoneY) + * - natural (d3.curveNatural) + * - linear-closed (d3.curveLinearClosed) + * - linear (d3.curveLinear) + * - step (d3.curveStep) + * - step-after (d3.curveStepAfter) + * - step-before (d3.curveStepBefore) + * @name spline + * @memberof Options + * @type {Object} + * @property {String} [spline.interpolation.type="cardinal"] + * @see [Interpolation (d3 v4)](http://bl.ocks.org/emmasaunders/c25a147970def2b02d8c7c2719dc7502) + * @example + * spline: { + * interpolation: { + * type: "cardinal" + * } + * } + */ + spline_interpolation_type: "cardinal", + + /** + * Set radar options + * @name radar + * @memberof Options + * @type {Object} + * @property {Number} [radar.axis.max=undefined] The max value of axis. If not given, it'll take the max value from the given data. + * @property {Boolean} [radar.axis.line.show=true] Show or hide axis line. + * @property {Boolean} [radar.axis.text.show=true] Show or hide axis text. + * @property {Boolean} [radar.direction.clockwise=false] Set the direction to be drawn. + * @property {Number} [radar.level.depth=3] Set the level depth. + * @property {Boolean} [radar.level.show=true] Show or hide level. + * @property {Function} [radar.level.text.format=(x) => (x % 1 === 0 ? x : x.toFixed(2))] Set format function for the level value. + * @property {Boolean} [radar.level.text.show=true] Show or hide level text. + * @property {Number} [radar.size.ratio=0.87] Set size ratio. + * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart) + * @see [Demo: radar axis](https://naver.github.io/billboard.js/demo/#RadarChartOptions.RadarAxis) + * @see [Demo: radar level](https://naver.github.io/billboard.js/demo/#RadarChartOptions.RadarLevel) + * @see [Demo: radar size](https://naver.github.io/billboard.js/demo/#RadarChartOptions.RadarSize) + * @example + * radar: { + * axis: { + * max: 50, + * line: { + * show: false + * }, + * text: { + * show: false + * } + * }, + * direction: { + * clockwise: true + * }, + * level: { + * show: false, + * text: { + * format: function(x) { + * return x + "%"; + * }, + * show: true + * } + * }, + * size: { + * ratio: 0.7 + * } + * } + */ + radar_axis_max: undefined, + radar_axis_line_show: !0, + radar_axis_text_show: !0, + radar_level_depth: 3, + radar_level_show: !0, + radar_level_text_format: function radar_level_text_format(x) { + return x % 1 === 0 ? x : x.toFixed(2); + }, + radar_level_text_show: !0, + radar_size_ratio: .87, + radar_direction_clockwise: !1, + + /** + * Show rectangles inside the chart.

    + * This option accepts array including object that has axis, start, end and class. The keys start, end and class are optional. + * axis must be x, y or y2. start and end should be the value where regions start and end. If not specified, the edge values will be used. If timeseries x axis, date string, Date object and unixtime integer can be used. If class is set, the region element will have it as class. + * @name regions + * @memberof Options + * @type {Array} + * @default [] + * @example + * regions: [ + * { + * axis: "x", + * start: 1, + * end: 4, + * class: "region-1-4" + * } + * ] + */ + regions: [], + + /** + * Tooltip options + * @name tooltip + * @memberof Options + * @type {Object} + * @property {Boolean} [tooltip.show=true] Show or hide tooltip.
    + * @property {Boolean} [tooltip.grouped=true] Set if tooltip is grouped or not for the data points. + * - **NOTE:** The overlapped data points will be displayed as grouped even if set false. + * @property {Boolean} [tooltip.linked=false] Set if tooltips on all visible charts with like x points are shown together when one is shown. + * @property {String} [tooltip.linked.name=""] Groping name for linked tooltip.
    If specified, linked tooltip will be groped interacting to be worked only with the same name. + * @property {Function} [tooltip.format.title] Set format for the title of tooltip.
    + * Specified function receives x of the data point to show. + * @property {Function} [tooltip.format.name] Set format for the name of each data in tooltip.
    + * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge. + * @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip.
    + * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge. + * If undefined returned, the row of that value will be skipped. + * @property {Function} [tooltip.position] Set custom position for the tooltip.
    + * This option can be used to modify the tooltip position by returning object that has top and left. + * @property {Function} [tooltip.contents] Set custom HTML for the tooltip.
    + * Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show. If tooltip.grouped is true, data includes multiple data points. + * @property {Boolean} [tooltip.init.show=false] Show tooltip at the initialization. + * @property {Number} [tooltip.init.x=0] Set x Axis index to be shown at the initialization. + * @property {Object} [tooltip.init.position={top: "0px",left: "50px"}] Set the position of tooltip at the initialization. + * @property {Function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown. + * @property {Function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden. + * @property {Function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown + * @property {Function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden. + * @property {String|Function|null} [tooltip.order=null] Set tooltip data display order.

    + * **Available Values:** + * - `desc`: In descending data value order + * - `asc`: In ascending data value order + * - `null`: It keeps the data display order
    + * **NOTE:** When `data.groups` is set, the order will follow as the stacked graph order.
    + * If want to order as data bound, set any value rather than asc, desc or null. (ex. empty string "") + * - `function(data1, data2) { ... }`: [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters) + * @example + * tooltip: { + * show: true, + * grouped: false, + * format: { + * title: function(x) { return "Data " + x; }, + * name: function(name, ratio, id, index) { return name; }, + * value: function(value, ratio, id, index) { return ratio; } + * }, + * position: function(data, width, height, element) { + * return {top: 0, left: 0} + * }, + * contents: function(d, defaultTitleFormat, defaultValueFormat, color) { + * return ... // formatted html as you want + * }, + * + * // sort tooltip data value display in ascending order + * order: "asc", + * + * // specifying sort function + * order: function(a, b) { + * // param data passed format + * {x: 5, value: 250, id: "data1", index: 5, name: "data1"} + * ... + * }, + * + * // show at the initialization + * init: { + * show: true, + * x: 2, + * position: { + * top: "150px", + * left: "250px" + * } + * }, + * + * // fires prior tooltip is shown + * onshow: function() { ...}, + * // fires prior tooltip is hidden + * onhide: function() { ... }, + * // fires after tooltip is shown + * onshown: function() { ... }, + * // fires after tooltip is hidden + * onhidden: function() { ... }, + * + * // Link any tooltips when multiple charts are on the screen where same x coordinates are available + * // Useful for timeseries correlation + * linked: true, + * + * // Specify name to interact those with the same name only. + * linked: { + * name: "some-group" + * } + * } + */ + tooltip_show: !0, + tooltip_grouped: !0, + tooltip_format_title: undefined, + tooltip_format_name: undefined, + tooltip_format_value: undefined, + tooltip_position: undefined, + tooltip_contents: function tooltip_contents(d, defaultTitleFormat, defaultValueFormat, color) { + return this.getTooltipContent ? this.getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) : ""; + }, + tooltip_init_show: !1, + tooltip_init_x: 0, + tooltip_init_position: { + top: "0px", + left: "50px" + }, + tooltip_linked: !1, + tooltip_linked_name: "", + tooltip_onshow: function tooltip_onshow() {}, + tooltip_onhide: function tooltip_onhide() {}, + tooltip_onshown: function tooltip_onshown() {}, + tooltip_onhidden: function tooltip_onhidden() {}, + tooltip_order: null, + + /** + * Set title options + * @name title + * @memberof Options + * @type {Object} + * @property {String} [title.text] Title text. If contains `\n`, it's used as line break allowing multiline title. + * @property {Number} [title.padding.top=0] Top padding value. + * @property {Number} [title.padding.right=0] Right padding value. + * @property {Number} [title.padding.bottom=0] Bottom padding value. + * @property {Number} [title.padding.left=0] Left padding value. + * @property {String} [title.position=center] Available values are: 'center', 'right' and 'left'. + * @see [Demo](https://naver.github.io/billboard.js/demo/#Title.MultilinedTitle) + * @example + * title: { + * text: "Title Text", + * + * // or Multiline title text + * text: "Main title text\nSub title text", + * + * padding: { + * top: 10, + * right: 10, + * bottom: 10, + * left: 10 + * }, + * position: "center" + * } + */ + title_text: undefined, + title_padding: { + top: 0, + right: 0, + bottom: 0, + left: 0 + }, + title_position: "center" + }; +}; + + +// CONCATENATED MODULE: ./src/config/config.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + getOptions: function getOptions() { + return new Options_Options(); + }, + + /** + * Load configuration option + * @param {Object} config User's generation config value + * @private + */ + loadConfig: function loadConfig(config) { + var target, + keys, + read, + thisConfig = this.config, + find = function () { + var key = keys.shift(); + return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target; + }; + + Object.keys(thisConfig).forEach(function (key) { + target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read); + }); + } +}); +// CONCATENATED MODULE: ./src/internals/scale.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + getScale: function getScale(min, max, forTimeseries) { + return (forTimeseries ? Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleTime"])() : Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleLinear"])()).range([min, max]); + }, + + /** + * Get x Axis scale function + * @param {Number} min + * @param {Number} max + * @param {Number} domain + * @param {Function} offset The offset getter to be sum + * @return {Function} scale + * @private + */ + getX: function getX(min, max, domain, offset) { + var $$ = this, + scale = $$.zoomScale || $$.getScale(min, max, $$.isTimeSeries()); + return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset); + }, + + /** + * Get y Axis scale function + * @param {Number} min + * @param {Number} max + * @param {Number} domain + * @return {Function} scale + * @private + */ + getY: function getY(min, max, domain) { + var scale = this.getScale(min, max, this.isTimeSeriesY()); + return domain && scale.domain(domain), scale; + }, + + /** + * Get customized scale + * @param {d3.scaleLinear|d3.scaleTime} scaleValue + * @param {Function} offsetValue Offset getter to be sum + * @return {} scale + * @private + */ + getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) { + var $$ = this, + offset = offsetValue || function () { + return $$.xAxis.tickOffset(); + }, + scale = function (d, raw) { + var v = scaleValue(d) + offset(); + return raw ? v : Math.ceil(v); + }; + + // copy original scale methods + for (var key in scaleValue) scale[key] = scaleValue[key]; + + return scale.orgDomain = function () { + return scaleValue.domain(); + }, scale.orgScale = function () { + return scaleValue; + }, $$.isCategorized() && (scale.domain = function (domainValue) { + var domain = domainValue; + return arguments.length ? (scaleValue.domain(domain), scale) : (domain = this.orgDomain(), [domain[0], domain[1] + 1]); + }), scale; + }, + getYScale: function getYScale(id) { + return this.axis.getId(id) === "y2" ? this.y2 : this.y; + }, + getSubYScale: function getSubYScale(id) { + return this.axis.getId(id) === "y2" ? this.subY2 : this.subY; + }, + + /** + * Update scale + * @private + * @param {Boolean} isInit - param is given at the init rendering + */ + updateScales: function updateScales(isInit) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated; + // update edges + // update scales + // x Axis + // y Axis + // update for arc + $$.xMin = isRotated ? 1 : 0, $$.xMax = isRotated ? $$.height : $$.width, $$.yMin = isRotated ? 0 : $$.height, $$.yMax = isRotated ? $$.width : 1, $$.subXMin = $$.xMin, $$.subXMax = $$.xMax, $$.subYMin = isRotated ? 0 : $$.height2, $$.subYMax = isRotated ? $$.width2 : 1, $$.x = $$.getX($$.xMin, $$.xMax, $$.x && $$.x.orgDomain(), function () { + return $$.xAxis.tickOffset(); + }), $$.subX = $$.getX($$.xMin, $$.xMax, $$.orgXDomain, function (d) { + return d % 1 ? 0 : $$.subXAxis.tickOffset(); + }), $$.xAxisTickFormat = $$.axis.getXAxisTickFormat(), $$.xAxisTickValues = $$.axis.getXAxisTickValues(), $$.xAxis = $$.axis.getXAxis("x", $$.x, config.axis_x_tick_outer, isInit), $$.subXAxis = $$.axis.getXAxis("subX", $$.subX, config.axis_x_tick_outer, isInit), $$.y = $$.getY($$.yMin, $$.yMax, $$.y ? $$.y.domain() : config.axis_y_default), $$.subY = $$.getY($$.subYMin, $$.subYMax, $$.subY ? $$.subY.domain() : config.axis_y_default), $$.yAxisTickValues = $$.axis.getYAxisTickValues(), $$.yAxis = $$.axis.getYAxis("y", $$.y, config.axis_y_tick_outer, isInit), config.axis_y2_show && ($$.y2 = $$.getY($$.yMin, $$.yMax, $$.y2 ? $$.y2.domain() : config.axis_y2_default), $$.subY2 = $$.getY($$.subYMin, $$.subYMax, $$.subY2 ? $$.subY2.domain() : config.axis_y2_default), $$.y2AxisTickValues = $$.axis.getY2AxisTickValues(), $$.y2Axis = $$.axis.getYAxis("y2", $$.y2, config.axis_y2_tick_outer, isInit)), $$.updateArc && $$.updateArc(); + } +}); +// CONCATENATED MODULE: ./src/internals/domain.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(ChartInternal_ChartInternal.prototype, { + getYDomainMinMax: function getYDomainMinMax(targets, type) { + var $$ = this, + config = $$.config, + isMin = type === "min", + dataGroups = config.data_groups, + ids = $$.mapToIds(targets), + ys = $$.getValuesAsIdKeyed(targets); + return dataGroups.length > 0 && function () { + for (var idsInGroup, _ret, hasValue = $$["has".concat(isMin ? "Negative" : "Positive", "ValueInTargets")](targets), _loop = function (j, _idsInGroup) { + if (_idsInGroup = _idsInGroup.filter(function (v) { + return ids.indexOf(v) >= 0; + }), _idsInGroup.length === 0) return idsInGroup = _idsInGroup, "continue"; + var baseId = _idsInGroup[0], + baseAxisId = $$.axis.getId(baseId); + hasValue && ys[baseId] && (ys[baseId] = ys[baseId].map(function (v) { + return (isMin ? v < 0 : v > 0) ? v : 0; + })); + + for (var id, _ret2, _loop2 = function (k, id) { + if (!ys[id]) return "continue"; + var axisId = $$.axis.getId(id); + ys[id].forEach(function (v, i) { + var val = +v, + meetCondition = isMin ? val > 0 : val < 0; + axisId !== baseAxisId || hasValue && meetCondition || (ys[baseId][i] += val); + }); + }, k = 1; id = _idsInGroup[k]; k++) _ret2 = _loop2(k, id), _ret2 === "continue"; + + idsInGroup = _idsInGroup; + }, j = 0; idsInGroup = dataGroups[j]; j++) _ret = _loop(j, idsInGroup), _ret === "continue"; + }(), getMinMax(type, Object.keys(ys).map(function (key) { + return getMinMax(type, ys[key]); + })); + }, + getYDomainMin: function getYDomainMin(targets) { + return this.getYDomainMinMax(targets, "min"); + }, + getYDomainMax: function getYDomainMax(targets) { + return this.getYDomainMinMax(targets, "max"); + }, + getYDomain: function getYDomain(targets, axisId, xDomain) { + var $$ = this, + config = $$.config; + if ($$.isStackNormalized()) return [0, 100]; + var lengths, + targetsByAxisId = targets.filter(function (t) { + return $$.axis.getId(t.id) === axisId; + }), + yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId, + yMin = axisId === "y2" ? config.axis_y2_min : config.axis_y_min, + yMax = axisId === "y2" ? config.axis_y2_max : config.axis_y_max, + yDomainMin = $$.getYDomainMin(yTargets), + yDomainMax = $$.getYDomainMax(yTargets), + center = axisId === "y2" ? config.axis_y2_center : config.axis_y_center, + isZeroBased = $$.hasType("bar", yTargets) && config.bar_zerobased || $$.hasType("area", yTargets) && config.area_zerobased, + isInverted = axisId === "y2" ? config.axis_y2_inverted : config.axis_y_inverted, + showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated, + showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated; + if (yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin, yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax, yTargets.length === 0) // use current domain if target of axisId is none + return axisId === "y2" ? $$.y2.domain() : $$.y.domain(); + isNaN(yDomainMin) && (yDomainMin = 0), isNaN(yDomainMax) && (yDomainMax = yDomainMin), yDomainMin === yDomainMax && (yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0); + var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0, + isAllNegative = yDomainMin <= 0 && yDomainMax <= 0; + (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) && (isZeroBased = !1), isZeroBased && (isAllPositive && (yDomainMin = 0), isAllNegative && (yDomainMax = 0)); + var domainLength = Math.abs(yDomainMax - yDomainMin), + paddingTop = domainLength * .1, + paddingBottom = domainLength * .1; + + if (isDefined(center)) { + var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); + yDomainMax = center + yDomainAbs, yDomainMin = center - yDomainAbs; + } // add padding for data label + + + if (showHorizontalDataLabel) { + lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "width"); + var diff = diffDomain($$.y.range()), + ratio = [lengths[0] / diff, lengths[1] / diff]; + paddingTop += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])), paddingBottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); + } else showVerticalDataLabel && (lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height"), paddingTop += $$.axis.convertPixelsToAxisPadding(lengths[1], domainLength), paddingBottom += $$.axis.convertPixelsToAxisPadding(lengths[0], domainLength)); + + axisId === "y" && notEmpty(config.axis_y_padding) && (paddingTop = $$.axis.getPadding(config.axis_y_padding, "top", paddingTop, domainLength), paddingBottom = $$.axis.getPadding(config.axis_y_padding, "bottom", paddingBottom, domainLength)), axisId === "y2" && notEmpty(config.axis_y2_padding) && (paddingTop = $$.axis.getPadding(config.axis_y2_padding, "top", paddingTop, domainLength), paddingBottom = $$.axis.getPadding(config.axis_y2_padding, "bottom", paddingBottom, domainLength)), isZeroBased && (isAllPositive && (paddingBottom = yDomainMin), isAllNegative && (paddingTop = -yDomainMax)), isAllPositive && paddingBottom > yDomainMin && (paddingBottom = yDomainMin); + var domain = [yDomainMin - paddingBottom, yDomainMax + paddingTop]; + return isInverted ? domain.reverse() : domain; + }, + getXDomainMinMax: function getXDomainMinMax(targets, type) { + var $$ = this, + value = $$.config["axis_x_".concat(type)]; + return isDefined(value) ? $$.isTimeSeries() ? $$.parseDate(value) : value : getMinMax(type, targets.map(function (t) { + return getMinMax(type, t.values.map(function (v) { + return v.x; + })); + })); + }, + getXDomainMin: function getXDomainMin(targets) { + return this.getXDomainMinMax(targets, "min"); + }, + getXDomainMax: function getXDomainMax(targets) { + return this.getXDomainMinMax(targets, "max"); + }, + getXDomainPadding: function getXDomainPadding(domain) { + var maxDataCount, + padding, + $$ = this, + config = $$.config, + diff = domain[1] - domain[0], + xPadding = config.axis_x_padding; + $$.isCategorized() ? padding = 0 : $$.hasType("bar") ? (maxDataCount = $$.getMaxDataCount(), padding = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5) : padding = diff * .01; + var left = padding, + right = padding; + return isObject(xPadding) && notEmpty(xPadding) ? (left = isValue(xPadding.left) ? xPadding.left : padding, right = isValue(xPadding.right) ? xPadding.right : padding) : isNumber(config.axis_x_padding) && (left = xPadding, right = xPadding), { + left: left, + right: right + }; + }, + getXDomain: function getXDomain(targets) { + var $$ = this, + xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)], + firstX = xDomain[0], + lastX = xDomain[1], + padding = $$.getXDomainPadding(xDomain), + min = 0, + max = 0; + return firstX - lastX !== 0 || $$.isCategorized() || ($$.isTimeSeries() ? (firstX = new Date(firstX.getTime() * .5), lastX = new Date(lastX.getTime() * 1.5)) : (firstX = firstX === 0 ? 1 : firstX * .5, lastX = lastX === 0 ? -1 : lastX * 1.5)), (firstX || firstX === 0) && (min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left), (lastX || lastX === 0) && (max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right), [min, max]; + }, + updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) { + var $$ = this, + config = $$.config, + zoomEnabled = config.zoom_enabled; + + if (withUpdateOrgXDomain && ($$.x.domain(domain || sortValue($$.getXDomain(targets))), $$.orgXDomain = $$.x.domain(), zoomEnabled && $$.zoom.updateScaleExtent(), $$.subX.domain($$.x.domain()), $$.brush && $$.brush.scale($$.subX)), withUpdateXDomain) { + var domainValue = domain || !$$.brush || brushEmpty($$) ? $$.orgXDomain : getBrushSelection($$).map($$.subX.invert); + $$.x.domain(domainValue), zoomEnabled && $$.zoom.updateScaleExtent(); + } // Trim domain when too big by zoom mousemove event + + + return withTrim && $$.x.domain($$.trimXDomain($$.x.orgDomain())), $$.x.domain(); + }, + trimXDomain: function trimXDomain(domain) { + var zoomDomain = this.getZoomDomain(), + min = zoomDomain[0], + max = zoomDomain[1]; + return domain[0] <= min && (domain[1] = +domain[1] + (min - domain[0]), domain[0] = min), max <= domain[1] && (domain[0] = +domain[0] - (domain[1] - max), domain[1] = max), domain; + } +}); +// CONCATENATED MODULE: ./src/data/data.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + isX: function isX(key) { + var $$ = this, + config = $$.config, + dataKey = config.data_x && key === config.data_x, + existValue = notEmpty(config.data_xs) && util_hasValue(config.data_xs, key); + return dataKey || existValue; + }, + isNotX: function isNotX(key) { + return !this.isX(key); + }, + isStackNormalized: function isStackNormalized() { + var config = this.config; + return config.data_stack_normalize && config.data_groups.length; + }, + isGrouped: function isGrouped(id) { + return this.config.data_groups.map(function (v) { + return v.indexOf(id) >= 0; + })[0]; + }, + getXKey: function getXKey(id) { + var $$ = this, + config = $$.config; + return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null; + }, + getXValuesOfXKey: function getXValuesOfXKey(key, targets) { + var xValues, + $$ = this, + ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : []; + return ids.forEach(function (id) { + $$.getXKey(id) === key && (xValues = $$.data.xs[id]); + }), xValues; + }, + + /** + * Get index number based on given x Axis value + * @param {Date|Number|String} x x Axis to be compared + * @param {Array} basedX x Axis list to be based on + * @return {Number} index number + * @private + */ + getIndexByX: function getIndexByX(x, basedX) { + var $$ = this; + return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || { + index: null + }).index; + }, + getXValue: function getXValue(id, i) { + var $$ = this; + return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i; + }, + getOtherTargetXs: function getOtherTargetXs() { + var $$ = this, + idsForX = Object.keys($$.data.xs); + return idsForX.length ? $$.data.xs[idsForX[0]] : null; + }, + getOtherTargetX: function getOtherTargetX(index) { + var xs = this.getOtherTargetXs(); + return xs && index < xs.length ? xs[index] : null; + }, + addXs: function addXs(xs) { + var $$ = this; + Object.keys(xs).forEach(function (id) { + $$.config.data_xs[id] = xs[id]; + }); + }, + hasMultipleX: function hasMultipleX(xs) { + return Object.keys(xs).map(function (id) { + return xs[id]; + }).length > 1; + }, + isMultipleX: function isMultipleX() { + return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType("bubble") || this.hasType("scatter"); + }, + addName: function addName(data) { + var name, + $$ = this; + return data && (name = $$.config.data_names[data.id], data.name = name === undefined ? data.id : name), data; + }, + getAllValuesOnIndex: function getAllValuesOnIndex(index) { + var $$ = this; + return $$.filterTargetsToShow($$.data.targets).map(function (t) { + return $$.addName($$.getValueOnIndex(t.values, index)); + }); + }, + getValueOnIndex: function getValueOnIndex(values, index) { + var valueOnIndex = values.filter(function (v) { + return v.index === index; + }); + return valueOnIndex.length ? valueOnIndex[0] : null; + }, + updateTargetX: function updateTargetX(targets, x) { + var $$ = this; + targets.forEach(function (t) { + t.values.forEach(function (v, i) { + v.x = $$.generateTargetX(x[i], t.id, i); + }), $$.data.xs[t.id] = x; + }); + }, + updateTargetXs: function updateTargetXs(targets, xs) { + var $$ = this; + targets.forEach(function (t) { + xs[t.id] && $$.updateTargetX([t], xs[t.id]); + }); + }, + generateTargetX: function generateTargetX(rawX, id, index) { + var $$ = this, + x = $$.isCategorized() ? index : rawX || index; + return $$.isTimeSeries() ? x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)) : $$.isCustomX() && !$$.isCategorized() && (x = isValue(rawX) ? +rawX : $$.getXValue(id, index)), x; + }, + cloneTarget: function cloneTarget(target) { + return { + id: target.id, + id_org: target.id_org, + values: target.values.map(function (d) { + return { + x: d.x, + value: d.value, + id: d.id + }; + }) + }; + }, + updateXs: function updateXs() { + var $$ = this; + $$.data.targets.length && ($$.xs = [], $$.getMaxDataCountTarget($$.data.targets).values.forEach(function (v) { + $$.xs[v.index] = v.x; + })); + }, + getPrevX: function getPrevX(i) { + var x = this.xs[i - 1]; + return isDefined(x) ? x : null; + }, + getNextX: function getNextX(i) { + var x = this.xs[i + 1]; + return isDefined(x) ? x : null; + }, + + /** + * Get base value isAreaRangeType + * @param data Data object + * @return {Number} + * @private + */ + getBaseValue: function getBaseValue(data) { + var $$ = this, + value = data.value; + return value && $$.isAreaRangeType(data) && (value = $$.getAreaRangeData(data, "mid")), value; + }, + + /** + * Get min/max value from the data + * @private + * @param {Array} data array data to be evaluated + * @return {{min: {Number}, max: {Number}}} + */ + getMinMaxValue: function getMinMaxValue(data) { + var min, + max, + getBaseValue = this.getBaseValue.bind(this); + return (data || this.data.targets.map(function (t) { + return t.values; + })).forEach(function (v, i) { + var value = v.map(getBaseValue).filter(isNumber); + min = Math.min.apply(Math, [i ? min : Infinity].concat(toConsumableArray_default()(value))), max = Math.max.apply(Math, [i ? max : -Infinity].concat(toConsumableArray_default()(value))); + }), { + min: min, + max: max + }; + }, + + /** + * Get the min/max data + * @private + * @return {{min: Array, max: Array}} + */ + getMinMaxData: function getMinMaxData() { + var $$ = this, + cacheKey = "$minMaxData", + minMaxData = $$.getCache(cacheKey); + + if (!minMaxData) { + var data = $$.data.targets.map(function (t) { + return t.values; + }), + minMax = $$.getMinMaxValue(data), + min = [], + max = []; + // update the cached data + data.forEach(function (v) { + var minData = $$.getFilteredDataByValue(v, minMax.min), + maxData = $$.getFilteredDataByValue(v, minMax.max); + minData.length && (min = min.concat(minData)), maxData.length && (max = max.concat(maxData)); + }), $$.addCache(cacheKey, minMaxData = { + min: min, + max: max + }); + } + + return minMaxData; + }, + + /** + * Get sum of data per index + * @private + * @return {Array} + */ + getTotalPerIndex: function getTotalPerIndex() { + var $$ = this, + sum = $$.getCache("$totalPerIndex"); + + if ($$.isStackNormalized() && !sum && (sum = [], $$.data.targets.forEach(function (row) { + row.values.forEach(function (v, i) { + sum[i] || (sum[i] = 0), sum[i] += isNumber(v.value) ? v.value : 0; + }); + })), $$.addCache("$totalPerIndex", sum.slice()), $$.hiddenTargetIds.length) { + var hiddenSum = $$.api.data.values.call($$.api, $$.hiddenTargetIds, !1); + hiddenSum.length && (hiddenSum = hiddenSum.reduce(function (acc, curr) { + return acc.map(function (v, i) { + return (isNumber(v) ? v : 0) + curr[i]; + }); + }), sum = sum.map(function (v, i) { + return v - hiddenSum[i]; + })); + } + + return sum; + }, + + /** + * Get total data sum + * @private + * @return {Number} + */ + getTotalDataSum: function getTotalDataSum() { + var $$ = this, + cacheKey = "$totalDataSum", + totalDataSum = $$.getCache(cacheKey); + + if (!totalDataSum) { + var total = mergeArray($$.data.targets.map(function (t) { + return t.values; + })).map(function (v) { + return v.value; + }).reduce(function (p, c) { + return p + c; + }); + $$.addCache(cacheKey, totalDataSum = total); + } + + return totalDataSum; + }, + + /** + * Get filtered data by value + * @param {Object} data + * @param {Number} value + * @return {Array} filtered array data + * @private + */ + getFilteredDataByValue: function getFilteredDataByValue(data, value) { + var _this = this; + + return data.filter(function (t) { + return _this.getBaseValue(t) === value; + }); + }, + + /** + * Return the max length of the data + * @return {Number} max data length + * @private + */ + getMaxDataCount: function getMaxDataCount() { + return Math.max.apply(Math, toConsumableArray_default()(this.data.targets.map(function (t) { + return t.values.length; + }))); + }, + getMaxDataCountTarget: function getMaxDataCountTarget(targets) { + var maxTarget, + length = targets.length, + max = 0; + return length > 1 ? targets.forEach(function (t) { + t.values.length > max && (maxTarget = t, max = t.values.length); + }) : maxTarget = length ? targets[0] : null, maxTarget; + }, + mapToIds: function mapToIds(targets) { + return targets.map(function (d) { + return d.id; + }); + }, + mapToTargetIds: function mapToTargetIds(ids) { + var $$ = this; + return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets); + }, + hasTarget: function hasTarget(targets, id) { + var ids = this.mapToIds(targets); + + for (var val, i = 0; val = ids[i]; i++) if (val === id) return !0; + + return !1; + }, + isTargetToShow: function isTargetToShow(targetId) { + return this.hiddenTargetIds.indexOf(targetId) < 0; + }, + isLegendToShow: function isLegendToShow(targetId) { + return this.hiddenLegendIds.indexOf(targetId) < 0; + }, + filterTargetsToShow: function filterTargetsToShow(targets) { + var $$ = this; + return targets.filter(function (t) { + return $$.isTargetToShow(t.id); + }); + }, + mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) { + var $$ = this, + xs = [], + xDomain = $$.x.domain(); + return targets && targets.length && (xs = getUnique(mergeArray(targets.map(function (t) { + return t.values.map(function (v) { + return +v.x; + }); + }))), xs = $$.isTimeSeries() ? xs.map(function (x) { + return new Date(+x); + }) : xs.map(function (x) { + return +x; + })), xs = xs.filter(function (t) { + return t >= xDomain[0] && t <= xDomain[1]; + }), sortValue(xs); + }, + addHiddenTargetIds: function addHiddenTargetIds(targetIds) { + this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds); + }, + removeHiddenTargetIds: function removeHiddenTargetIds(targetIds) { + this.hiddenTargetIds = this.hiddenTargetIds.filter(function (id) { + return targetIds.indexOf(id) < 0; + }); + }, + addHiddenLegendIds: function addHiddenLegendIds(targetIds) { + this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds); + }, + removeHiddenLegendIds: function removeHiddenLegendIds(targetIds) { + this.hiddenLegendIds = this.hiddenLegendIds.filter(function (id) { + return targetIds.indexOf(id) < 0; + }); + }, + getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) { + var $$ = this, + ys = {}, + isMultipleX = $$.isMultipleX(), + xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map(function (v) { + return isString(v) ? v : +v; + }) : null; + return targets.forEach(function (t) { + var data = []; + t.values.forEach(function (v) { + var value = v.value; + isArray(value) ? data.push.apply(data, toConsumableArray_default()(value)) : isObject(value) && "high" in value ? data.push.apply(data, toConsumableArray_default()(Object.values(value))) : isMultipleX ? data[$$.getIndexByX(v.x, xs)] = value : data.push(value); + }), ys[t.id] = data; + }), ys; + }, + checkValueInTargets: function checkValueInTargets(targets, checker) { + var values, + ids = Object.keys(targets); + + for (var i = 0; i < ids.length; i++) { + values = targets[ids[i]].values; + + for (var j = 0; j < values.length; j++) if (checker(values[j].value)) return !0; + } + + return !1; + }, + hasNegativeValueInTargets: function hasNegativeValueInTargets(targets) { + return this.checkValueInTargets(targets, function (v) { + return v < 0; + }); + }, + hasPositiveValueInTargets: function hasPositiveValueInTargets(targets) { + return this.checkValueInTargets(targets, function (v) { + return v > 0; + }); + }, + _checkOrder: function _checkOrder(type) { + var config = this.config; + return isString(config.data_order) && config.data_order.toLowerCase() === type; + }, + isOrderDesc: function isOrderDesc() { + return this._checkOrder("desc"); + }, + isOrderAsc: function isOrderAsc() { + return this._checkOrder("asc"); + }, + + /** + * Sort targets data + * @param {Array} targetsValue + * @return {Array} + * @private + */ + orderTargets: function orderTargets(targetsValue) { + var $$ = this, + config = $$.config, + targets = toConsumableArray_default()(targetsValue), + orderAsc = $$.isOrderAsc(), + orderDesc = $$.isOrderDesc(); + + // TODO: accept name array for order + return orderAsc || orderDesc ? targets.sort(function (t1, t2) { + var reducer = function (p, c) { + return p + Math.abs(c.value); + }, + t1Sum = t1.values.reduce(reducer, 0), + t2Sum = t2.values.reduce(reducer, 0); + + return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum; + }) : isFunction(config.data_order) && targets.sort(config.data_order), targets; + }, + filterByX: function filterByX(targets, x) { + return mergeArray(targets.map(function (t) { + return t.values; + })).filter(function (v) { + return v.x - x === 0; + }); + }, + filterRemoveNull: function filterRemoveNull(data) { + var _this2 = this; + + return data.filter(function (d) { + return isValue(_this2.getBaseValue(d)); + }); + }, + filterByXDomain: function filterByXDomain(targets, xDomain) { + return targets.map(function (t) { + return { + id: t.id, + id_org: t.id_org, + values: t.values.filter(function (v) { + return xDomain[0] <= v.x && v.x <= xDomain[1]; + }) + }; + }); + }, + hasDataLabel: function hasDataLabel() { + var dataLabels = this.config.data_labels; + return isBoolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels); + }, + getDataLabelLength: function getDataLabelLength(min, max, key) { + var $$ = this, + lengths = [0, 0]; + return $$.selectChart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) { + return $$.dataLabelFormat(d.id)(d); + }).each(function (d, i) { + lengths[i] = this.getBoundingClientRect()[key] * 1.3; + }).remove(), lengths; + }, + isNoneArc: function isNoneArc(d) { + return this.hasTarget(this.data.targets, d.id); + }, + isArc: function isArc(d) { + return "data" in d && this.hasTarget(this.data.targets, d.data.id); + }, + findSameXOfValues: function findSameXOfValues(values, index) { + var i, + targetX = values[index].x, + sames = []; + + for (i = index - 1; i >= 0 && !(targetX !== values[i].x); i--) sames.push(values[i]); + + for (i = index; i < values.length && !(targetX !== values[i].x); i++) sames.push(values[i]); + + return sames; + }, + findClosestFromTargets: function findClosestFromTargets(targets, pos) { + var $$ = this, + candidates = targets.map(function (target) { + return $$.findClosest(target.values, pos); + }); + // map to array of closest points of each target + // decide closest point and return + return $$.findClosest(candidates, pos); + }, + findClosest: function findClosest(values, pos) { + var closest, + $$ = this, + minDist = $$.config.point_sensitivity; + return values.filter(function (v) { + return v && $$.isBarType(v.id); + }).forEach(function (v) { + var shape = $$.main.select(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(v.id), " .").concat(config_classes.bar, "-").concat(v.index)).node(); + !closest && $$.isWithinBar(shape) && (closest = v); + }), values.filter(function (v) { + return v && !$$.isBarType(v.id); + }).forEach(function (v) { + var d = $$.dist(v, pos); + d < minDist && (minDist = d, closest = v); + }), closest; + }, + dist: function dist(data, pos) { + var $$ = this, + isRotated = $$.config.axis_rotated, + xIndex = isRotated ? 1 : 0, + yIndex = isRotated ? 0 : 1, + y = $$.circleY(data, data.index), + x = $$.x(data.x); + return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2)); + }, + + /** + * Convert data for step type + * @param {Array} values Object data values + * @return {Array} + * @private + */ + convertValuesToStep: function convertValuesToStep(values) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + stepType = config.line_step_type, + isCategorized = $$.isCategorized(), + converted = isArray(values) ? values.concat() : [values]; + if (!isRotated && !isCategorized) return values; // insert & append cloning first/last value to be fully rendered covering on each gap sides + + var id = converted[0].id, + x = converted[0].x - 1, + value = converted[0].value; // insert + + return isCategorized && converted.unshift({ + x: x, + value: value, + id: id + }), stepType === "step-after" && converted.unshift({ + x: x - 1, + value: value, + id: id + }), x = converted.length, value = converted[x - 1].value, isCategorized && converted.push({ + x: x, + value: value, + id: id + }), stepType === "step-before" && converted.push({ + x: x + 1, + value: value, + id: id + }), converted; + }, + convertValuesToRange: function convertValuesToRange(values) { + var converted = isArray(values) ? values.concat() : [values], + ranges = []; + return converted.forEach(function (range) { + var x = range.x, + id = range.id; + ranges.push({ + x: x, + id: id, + value: range.value[0] + }), ranges.push({ + x: x, + id: id, + value: range.value[2] + }); + }), ranges; + }, + updateDataAttributes: function updateDataAttributes(name, attrs) { + var $$ = this, + config = $$.config, + current = config["data_".concat(name)]; + return isUndefined(attrs) ? current : (Object.keys(attrs).forEach(function (id) { + current[id] = attrs[id]; + }), $$.redraw({ + withLegend: !0 + }), current); + }, + getAreaRangeData: function getAreaRangeData(d, type) { + var value = d.value; + + if (isArray(value)) { + var index = ["high", "mid", "low"].indexOf(type); + return index === -1 ? null : value[index]; + } + + return value[type]; + }, + + /** + * Get ratio value + * @param {String} type Ratio for given type + * @param {Object} d Data value object + * @param {Boolean} asPercent Convert the return as percent or not + * @return {Number} Ratio value + * @private + */ + getRatio: function getRatio(type, d, asPercent, totalCache) { + var $$ = this, + config = $$.config, + api = $$.api, + ratio = 0; + if (d && (totalCache || api.data.shown.call(api).length)) if (ratio = d.ratio || d.value, type === "arc") { + var dataValues = api.data.values.bind(api); // if has padAngle set, calculate rate based on value + + if ($$.pie.padAngle()()) { + var total = $$.getTotalDataSum(); + $$.hiddenTargetIds.length && (total -= dataValues($$.hiddenTargetIds).reduce(function (p, c) { + return p + c; + })), ratio = d.value / total; + } else ratio = (d.endAngle - d.startAngle) / (Math.PI * ($$.hasType("gauge") && !config.gauge_fullCircle ? 1 : 2)); + } else if (type === "index") { + if (d.value === 0) return d.ratio = 0, d.ratio; + + var _total = totalCache === undefined ? this.getTotalPerIndex() : totalCache; + + d.ratio = isNumber(d.value) && _total && _total[d.index] > 0 ? d.value / _total[d.index] : 0, ratio = d.ratio; + } else type === "radar" && (ratio = parseFloat(Math.max(d.value, 0)) / $$.maxValue * config.radar_size_ratio); + return asPercent && ratio ? ratio * 100 : ratio; + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"} +var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(17); + +// CONCATENATED MODULE: ./src/data/data.convert.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + convertUrlToData: function convertUrlToData(url) { + var _this = this, + mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "csv", + headers = arguments.length > 2 ? arguments[2] : undefined, + keys = arguments.length > 3 ? arguments[3] : undefined, + done = arguments.length > 4 ? arguments[4] : undefined, + req = new XMLHttpRequest(); + + headers && Object.keys(headers).forEach(function (key) { + req.setRequestHeader(key, headers[key]); + }), req.open("GET", url), req.onreadystatechange = function () { + if (req.readyState === 4) if (req.status === 200) { + var response = req.responseText; + response && done.call(_this, _this["convert".concat(capitalize(mimeType), "ToData")](mimeType === "json" ? JSON.parse(response) : response, keys)); + } else throw new Error("".concat(url, ": Something went wrong loading!")); + }, req.send(); + }, + _convertCsvTsvToData: function _convertCsvTsvToData(parser, xsv) { + var d, + rows = parser.rows(xsv); + return rows.length === 1 ? (d = [{}], rows[0].forEach(function (id) { + d[0][id] = null; + })) : d = parser.parse(xsv), d; + }, + convertCsvToData: function convertCsvToData(xsv) { + return this._convertCsvTsvToData({ + rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["csvParseRows"], + parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["csvParse"] + }, xsv); + }, + convertTsvToData: function convertTsvToData(tsv) { + return this._convertCsvTsvToData({ + rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["tsvParseRows"], + parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["tsvParse"] + }, tsv); + }, + convertJsonToData: function convertJsonToData(json, keysParam) { + var targetKeys, + data, + _this2 = this, + config = this.config, + newRows = []; + + if (isArray(json)) { + var keys = keysParam || config.data_keys; + keys.x ? (targetKeys = keys.value.concat(keys.x), config.data_x = keys.x) : targetKeys = keys.value, newRows.push(targetKeys), json.forEach(function (o) { + var newRow = targetKeys.map(function (key) { + // convert undefined to null because undefined data will be removed in convertDataToTargets() + var v = _this2.findValueInJson(o, key); + + return isUndefined(v) && (v = null), v; + }); + newRows.push(newRow); + }), data = this.convertRowsToData(newRows); + } else Object.keys(json).forEach(function (key) { + var tmp = json[key].concat(); + tmp.unshift(key), newRows.push(tmp); + }), data = this.convertColumnsToData(newRows); + + return data; + }, + findValueInJson: function findValueInJson(object, path) { + if (object[path] !== undefined) return object[path]; + var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"), + pathArray = convertedPath.replace(/^\./, "").split("."), + target = object; // convert indexes to properties (replace [] with .) + + return pathArray.some(function (k) { + return !(target = target && k in target ? target[k] : undefined); + }), target; + }, + convertRowsToData: function convertRowsToData(rows) { + var keys = rows[0], + newRows = []; + + for (var i = 1, len1 = rows.length; i < len1; i++) { + var newRow = {}; + + for (var j = 0, len2 = rows[i].length; j < len2; j++) { + if (isUndefined(rows[i][j])) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!")); + newRow[keys[j]] = rows[i][j]; + } + + newRows.push(newRow); + } + + return newRows; + }, + convertColumnsToData: function convertColumnsToData(columns) { + var newRows = []; + + for (var i = 0, len1 = columns.length; i < len1; i++) { + var key = columns[i][0]; + + for (var j = 1, len2 = columns[i].length; j < len2; j++) { + if (isUndefined(newRows[j - 1]) && (newRows[j - 1] = {}), isUndefined(columns[i][j])) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!")); + newRows[j - 1][key] = columns[i][j]; + } + } + + return newRows; + }, + convertDataToTargets: function convertDataToTargets(data, appendXs) { + var xsData, + _this3 = this, + $$ = this, + config = $$.config, + dataKeys = Object.keys(data[0] || {}), + ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [], + xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : []; + + ids.forEach(function (id) { + var xKey = _this3.getXKey(id); + + _this3.isCustomX() || _this3.isTimeSeries() ? xs.indexOf(xKey) >= 0 ? xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) { + return d[xKey]; + }).filter(isValue).map(function (rawX, i) { + return $$.generateTargetX(rawX, id, i); + })) : config.data_x ? xsData = _this3.getOtherTargetXs() : notEmpty(config.data_xs) && (xsData = $$.getXValuesOfXKey(xKey, $$.data.targets)) : xsData = data.map(function (d, i) { + return i; + }), xsData && (_this3.data.xs[id] = xsData); + }), ids.forEach(function (id) { + if (!xsData) throw new Error("x is not defined for id = \"".concat(id, "\".")); + }); + // convert to target + var targets = ids.map(function (id, index) { + var convertedId = config.data_idConverter(id), + xKey = $$.getXKey(id), + isCategorized = $$.isCustomX() && $$.isCategorized(), + hasCategory = isCategorized && data.map(function (v) { + return v.x; + }).every(function (v) { + return config.axis_x_categories.indexOf(v) > -1; + }); + return { + id: convertedId, + id_org: id, + values: data.map(function (d, i) { + var x, + rawX = d[xKey], + value = d[id]; + return value = value === null || isNaN(value) ? isArray(value) || isObject(value) && value.high ? value : null : +d[id], isCategorized && index === 0 && !isUndefined(rawX) ? (!hasCategory && index === 0 && i === 0 && (config.axis_x_categories = []), x = config.axis_x_categories.indexOf(rawX), x === -1 && (x = config.axis_x_categories.length, config.axis_x_categories.push(rawX))) : x = $$.generateTargetX(rawX, id, i), (isUndefined(d[id]) || $$.data.xs[id].length <= i) && (x = undefined), { + x: x, + value: value, + id: convertedId + }; + }).filter(function (v) { + return isDefined(v.x); + }) + }; + }); // finish targets + + return targets.forEach(function (t) { + config.data_xSort && (t.values = t.values.sort(function (v1, v2) { + var x1 = v1.x || v1.x === 0 ? v1.x : Infinity, + x2 = v2.x || v2.x === 0 ? v2.x : Infinity; + return x1 - x2; + })), t.values.forEach(function (v, i) { + var index = $$.data.targets ? $$.getIndexByX(v.x) : null; + v.index = index === null ? i : index; + }), $$.data.xs[t.id].sort(function (v1, v2) { + return v1 - v2; + }); + }), $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets), $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets), config.data_type && $$.setTargetType($$.mapToIds(targets).filter(function (id) { + return !(id in config.data_types); + }), config.data_type), targets.forEach(function (d) { + return $$.addCache(d.id_org, d, !0); + }), targets; + } +}); +// CONCATENATED MODULE: ./src/data/data.load.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + load: function load(rawTargets, args) { + var $$ = this, + targets = rawTargets; + // Set targets + // Redraw with new targets + targets && (args.filter && (targets = targets.filter(args.filter)), (args.type || args.types) && targets.forEach(function (t) { + var type = args.types && args.types[t.id] || args.type; + $$.setTargetType(t.id, type); + }), $$.data.targets.forEach(function (d) { + for (var i = 0; i < targets.length; i++) if (d.id === targets[i].id) { + d.values = targets[i].values, targets.splice(i, 1); + break; + } + }), $$.data.targets = $$.data.targets.concat(targets)), $$.updateTargets($$.data.targets), $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0, + withLegend: !0 + }), args.done && args.done(); + }, + loadFromArgs: function loadFromArgs(args) { + var data, + $$ = this; + // reset internally cached data + $$.resetCache(), args.data ? data = args.data : args.url ? $$.convertUrlToData(args.url, args.mimeType, args.headers, args.keys, function (d) { + $$.load($$.convertDataToTargets(d), args); + }) : args.json ? data = $$.convertJsonToData(args.json, args.keys) : args.rows ? data = $$.convertRowsToData(args.rows) : args.columns && (data = $$.convertColumnsToData(args.columns)), $$.load(data ? $$.convertDataToTargets(data) : null, args); + }, + unload: function unload(rawTargetIds, customDoneCb) { + var $$ = this, + done = customDoneCb, + targetIds = rawTargetIds; + // If no target, call done and return + return $$.resetCache(), done || (done = function () {}), targetIds = targetIds.filter(function (id) { + return $$.hasTarget($$.data.targets, id); + }), targetIds && targetIds.length !== 0 ? void ($$.svg.selectAll(targetIds.map(function (id) { + return $$.selectorTarget(id); + })).transition().style("opacity", "0").remove().call($$.endall, done), targetIds.forEach(function (id) { + $$.withoutFadeIn[id] = !1, $$.legend && $$.legend.selectAll(".".concat(config_classes.legendItem).concat($$.getTargetSelectorSuffix(id))).remove(), $$.data.targets = $$.data.targets.filter(function (t) { + return t.id !== id; + }); + })) : void done(); + } +}); +// CONCATENATED MODULE: ./src/internals/category.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Category Name + * @private + * @param {Number} index + * @returns {String} gategory Name + */ + categoryName: function categoryName(i) { + var config = this.config; + return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i; + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-drag","commonjs2":"d3-drag","amd":"d3-drag","root":"d3"} +var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack_require__(18); + +// CONCATENATED MODULE: ./src/interactions/interaction.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initialize the area that detects the event. + * Add a container for the zone that detects the event. + * @private + */ + initEventRect: function initEventRect() { + var $$ = this; + $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.eventRects).style("fill-opacity", "0"); + }, + + /** + * Redraws the area that detects the event. + * @private + */ + redrawEventRect: function redrawEventRect() { + var eventRectUpdate, + $$ = this, + config = $$.config, + zoomEnabled = config.zoom_enabled, + isMultipleX = $$.isMultipleX(), + eventRects = $$.main.select(".".concat(config_classes.eventRects)).style("cursor", zoomEnabled && (zoomEnabled === !0 || zoomEnabled.type === "wheel") ? config.axis_rotate ? "ns-resize" : "ew-resize" : null).classed(config_classes.eventRectsMultiple, isMultipleX).classed(config_classes.eventRectsSingle, !isMultipleX); + if (eventRects.selectAll(".".concat(config_classes.eventRect)).remove(), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), isMultipleX) eventRectUpdate = $$.eventRect.data([0]), eventRectUpdate = $$.generateEventRectsForMultipleXs(eventRectUpdate.enter()).merge(eventRectUpdate);else { + // Set data and update $$.eventRect + var maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets); + eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), eventRectUpdate = $$.eventRect.data(function (d) { + return d; + }), eventRectUpdate.exit().remove(), eventRectUpdate = $$.generateEventRectsForSingleX(eventRectUpdate.enter()).merge(eventRectUpdate); + } + $$.updateEventRect(eventRectUpdate), $$.inputType !== "touch" || $$.svg.on("touchstart.eventRect") || $$.hasArcType() || $$.bindTouchOnEventRect(isMultipleX); + }, + bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) { + var startPx, + $$ = this, + config = $$.config, + getEventRect = function () { + var touch = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].changedTouches[0]; + return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(document.elementFromPoint(touch.clientX, touch.clientY)); + }, + getIndex = function (eventRect) { + var index = eventRect && eventRect.attr("class") && eventRect.attr("class").replace(new RegExp("(".concat(config_classes.eventRect, "-?|s)"), "g"), "") * 1; + return (isNaN(index) || index === null) && (index = -1), index; + }, + selectRect = function (context) { + if (isMultipleX) $$.selectRectForMultipleXs(context);else { + var eventRect = getEventRect(), + index = getIndex(eventRect); + $$.callOverOutForTouch(index), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index); + } + }, + preventDefault = config.interaction_inputType_touch.preventDefault, + isPrevented = isBoolean(preventDefault) && preventDefault || !1, + preventThreshold = !isNaN(preventDefault) && preventDefault || null, + preventEvent = function (event) { + var eventType = event.type, + touch = event.changedTouches[0], + currentXY = touch["client".concat(config.axis_rotated ? "Y" : "X")]; + eventType === "touchstart" ? isPrevented ? event.preventDefault() : preventThreshold !== null && (startPx = currentXY) : eventType === "touchmove" && (isPrevented || startPx === !0 || preventThreshold !== null && Math.abs(startPx - currentXY) >= preventThreshold) && (startPx = !0, event.preventDefault()); + }; + + // bind touch events + $$.svg.on("touchstart.eventRect touchmove.eventRect", function () { + var eventRect = getEventRect(); + + if (!eventRect.empty() && eventRect.classed(config_classes.eventRect)) { + if ($$.dragging || $$.flowing || $$.hasArcType()) return; + preventEvent(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"]), selectRect(this); + } else $$.unselectRect(), $$.callOverOutForTouch(); + }).on("touchend.eventRect", function () { + var eventRect = getEventRect(); + !eventRect.empty() && eventRect.classed(config_classes.eventRect) && ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) && $$.cancelClick && ($$.cancelClick = !1); + }); + }, + + /** + * Updates the location and size of the eventRect. + * @private + * @param {Object} d3.select(CLASS.eventRects) object. + */ + updateEventRect: function updateEventRect(eventRectUpdate) { + var x, + y, + w, + h, + $$ = this, + config = $$.config, + xScale = $$.zoomScale || $$.x, + eventRectData = eventRectUpdate || $$.eventRect.data(), + isRotated = config.axis_rotated; + if ($$.isMultipleX()) // TODO: rotated not supported yet + x = 0, y = 0, w = $$.width, h = $$.height;else { + var rectW, rectX; + if ($$.isCategorized()) rectW = $$.getEventRectWidth(), rectX = function (d) { + return xScale(d.x) - rectW / 2; + };else { + $$.updateXs(); + + var getPrevNextX = function (d) { + var index = d.index; + return { + prev: $$.getPrevX(index), + next: $$.getNextX(index) + }; + }; + + rectW = function (d) { + var x = getPrevNextX(d); // if there this is a single data point make the eventRect full width (or height) + + return x.prev === null && x.next === null ? isRotated ? $$.height : $$.width : (x.prev === null && (x.prev = xScale.domain()[0]), x.next === null && (x.next = xScale.domain()[1]), Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2)); + }, rectX = function (d) { + var x = getPrevNextX(d), + thisX = $$.data.xs[d.id][d.index]; + // if there this is a single data point position the eventRect at 0 + return x.prev === null && x.next === null ? 0 : (x.prev === null && (x.prev = xScale.domain()[0]), (xScale(thisX) + xScale(x.prev)) / 2); + }; + } + x = isRotated ? 0 : rectX, y = isRotated ? rectX : 0, w = isRotated ? $$.width : rectW, h = isRotated ? rectW : $$.height; + } + eventRectData.attr("class", $$.classEvent.bind($$)).attr("x", x).attr("y", y).attr("width", w).attr("height", h); + }, + selectRectForSingle: function selectRectForSingle(context, eventRect, index) { + var $$ = this, + config = $$.config, + isSelectionEnabled = config.data_selection_enabled, + isSelectionGrouped = config.data_selection_grouped, + isTooltipGrouped = config.tooltip_grouped, + selectedData = $$.getAllValuesOnIndex(index); + isTooltipGrouped && ($$.showTooltip(selectedData, context), $$.showXGridFocus(selectedData), !isSelectionEnabled || isSelectionGrouped) || $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function () { + Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.EXPANDED, !0), isSelectionEnabled && eventRect.style("cursor", isSelectionGrouped ? "pointer" : null), isTooltipGrouped || ($$.hideXGridFocus(), $$.hideTooltip(), !isSelectionGrouped && $$.expandCirclesBars(index)); + }).filter(function (d) { + return $$.isWithinShape(this, d); + }).call(function (selected) { + var d = selected.data(); + isSelectionEnabled && (isSelectionGrouped || config.data_selection_isselectable(d)) && eventRect.style("cursor", "pointer"), isTooltipGrouped || ($$.showTooltip(d, context), $$.showXGridFocus(d), $$.unexpandCircles(), selected.each(function (d) { + return $$.expandCirclesBars(index, d.id); + })); + }); + }, + expandCirclesBars: function expandCirclesBars(index, id, reset) { + var $$ = this, + config = $$.config; + config.point_focus_expand_enabled && $$.expandCircles(index, id, reset), $$.expandBars(index, id, reset); + }, + selectRectForMultipleXs: function selectRectForMultipleXs(context) { + var $$ = this, + config = $$.config, + targetsToShow = $$.filterTargetsToShow($$.data.targets); + + // do nothing when dragging + if (!($$.dragging || $$.hasArcType(targetsToShow))) { + var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(context), + closest = $$.findClosestFromTargets(targetsToShow, mouse); + if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id) && (config.data_onout.call($$.api, $$.mouseover), $$.mouseover = undefined), !closest) return void $$.unselectRect(); + var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x), + selectedData = sameXData.map(function (d) { + return $$.addName(d); + }); // show tooltip when cursor is close to some point + + $$.showTooltip(selectedData, context), $$.expandCirclesBars(closest.index, closest.id, !0), $$.showXGridFocus(selectedData), ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && ($$.svg.select(".".concat(config_classes.eventRect)).style("cursor", "pointer"), !$$.mouseover && (config.data_onover.call($$.api, closest), $$.mouseover = closest)); + } + }, + + /** + * Unselect EventRect. + * @private + */ + unselectRect: function unselectRect() { + var $$ = this; + $$.svg.select(".".concat(config_classes.eventRect)).style("cursor", null), $$.hideXGridFocus(), $$.hideTooltip(), $$._handleLinkedCharts(!1), $$.unexpandCircles(), $$.unexpandBars(); + }, + + /** + * Handle data.onover/out callback options + * @param {Boolean} isOver + * @param {Number|Object} d + * @private + */ + setOverOut: function setOverOut(isOver, d) { + var $$ = this, + config = $$.config, + isArc = isObject(d); + + // Call event handler + if (isArc || d !== -1) { + var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api); + config.color_onover && $$.setOverColor(isOver, d, isArc), isArc ? callback(d) : (isOver && $$.expandCirclesBars(d, null, !0), !$$.isMultipleX() && $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).each(callback)); + } + }, + + /** + * Call data.onover/out callback for touch event + * @param {Number|Object} d target index or data object for Arc type + * @private + */ + callOverOutForTouch: function callOverOutForTouch(d) { + var $$ = this, + callee = $$.callOverOutForTouch, + last = callee.last; + (isObject(d) && last ? d.id !== last.id : d !== last) && ((last || isNumber(last)) && $$.setOverOut(!1, last), (d || isNumber(d)) && $$.setOverOut(!0, d), callee.last = d); + }, + + /** + * Return draggable selection function + * @return {Function} + * @private + */ + getDraggableSelection: function getDraggableSelection() { + var $$ = this, + config = $$.config; + return config.interaction_enabled && config.data_selection_draggable && $$.drag ? Object(external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_["drag"])().on("drag", function () { + $$.drag(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)); + }).on("start", function () { + $$.dragstart(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)); + }).on("end", function () { + $$.dragend(); + }) : function () {}; + }, + + /** + * Create eventRect for each data on the x-axis. + * Register touch and drag events. + * @private + * @param {Object} d3.select(CLASS.eventRects) object. + * @returns {Object} d3.select(CLASS.eventRects) object. + */ + generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) { + var $$ = this, + config = $$.config, + rect = eventRectEnter.append("rect").attr("class", $$.classEvent.bind($$)).style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (d) { + $$.clickHandlerForSingleX.bind(this)(d, $$); + }).call($$.getDraggableSelection()); + return $$.inputType === "mouse" && rect.on("mouseover", function (d) { + $$.dragging || $$.flowing || $$.hasArcType() || $$.setOverOut(!0, d.index); + }).on("mousemove", function (d) { + // do nothing while dragging/flowing + if (!($$.dragging || $$.flowing || $$.hasArcType())) { + var index = d.index, + eventRect = $$.svg.select(".".concat(config_classes.eventRect, "-").concat(index)); + $$.isStepType(d) && $$.config.line_step_type === "step-after" && Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[0] < $$.x($$.getXValue(d.id, index)) && (index -= 1), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, eventRect, index); + } + }).on("mouseout", function (d) { + !$$.config || $$.hasArcType() || ($$.unselectRect(), $$.setOverOut(!1, d.index)); + }), rect; + }, + clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) { + var $$ = ctx, + config = $$.config; + if ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) return void ($$.cancelClick && ($$.cancelClick = !1)); + var index = d.index; + $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function (d2) { + (config.data_selection_grouped || $$.isWithinShape(this, d2)) && ($$.toggleShape(this, d2, index), config.data_onclick.call($$.api, d2, this)); + }); + }, + + /** + * Create an eventRect, + * Register touch and drag events. + * @private + * @param {Object} d3.select(CLASS.eventRects) object. + * @returns {Object} d3.select(CLASS.eventRects) object. + */ + generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) { + var $$ = this, + rect = eventRectEnter.append("rect").attr("x", 0).attr("y", 0).attr("width", $$.width).attr("height", $$.height).attr("class", config_classes.eventRect).on("click", function () { + $$.clickHandlerForMultipleXS.bind(this)($$); + }).call($$.getDraggableSelection()); + return $$.inputType === "mouse" && rect.on("mouseover mousemove", function () { + $$.selectRectForMultipleXs(this); + }).on("mouseout", function () { + !$$.config || $$.hasArcType() || $$.unselectRect(); + }), rect; + }, + clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) { + var $$ = ctx, + config = $$.config, + targetsToShow = $$.filterTargetsToShow($$.data.targets); + + if (!$$.hasArcType(targetsToShow)) { + var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this), + closest = $$.findClosestFromTargets(targetsToShow, mouse); + !closest || ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && $$.main.selectAll(".".concat(config_classes.shapes).concat($$.getTargetSelectorSuffix(closest.id))).selectAll(".".concat(config_classes.shape, "-").concat(closest.index)).each(function () { + (config.data_selection_grouped || $$.isWithinShape(this, closest)) && ($$.toggleShape(this, closest, closest.index), config.data_onclick.call($$.api, closest, this)); + }); + } // select if selection enabled + + }, + + /** + * Dispatch a mouse event. + * @private + * @param {String} type event type + * @param {Number} index Index of eventRect + * @param {Array} mouse x and y coordinate value + */ + dispatchEvent: function dispatchEvent(type, index, mouse) { + var $$ = this, + isMultipleX = $$.isMultipleX(), + selector = ".".concat(isMultipleX ? config_classes.eventRect : "".concat(config_classes.eventRect, "-").concat(index)), + eventRect = $$.main.select(selector).node(), + _eventRect$getBoundin = eventRect.getBoundingClientRect(), + width = _eventRect$getBoundin.width, + left = _eventRect$getBoundin.left, + top = _eventRect$getBoundin.top, + x = left + (mouse ? mouse[0] : 0) + (isMultipleX ? 0 : width / 2), + y = top + (mouse ? mouse[1] : 0); + + emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](eventRect, type, { + screenX: x, + screenY: y, + clientX: x, + clientY: y + }); + } +}); +// CONCATENATED MODULE: ./src/internals/size.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + getCurrentWidth: function getCurrentWidth() { + var $$ = this; + return $$.config.size_width || $$.getParentWidth(); + }, + getCurrentHeight: function getCurrentHeight() { + var $$ = this, + config = $$.config, + h = config.size_height || $$.getParentHeight(); + return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1); + }, + + /** + * Get Axis size according its position + * @param {String} id Axis id value - x, y or y2 + * @return {number} size Axis size value + * @private + */ + getAxisSize: function getAxisSize(id) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated; + return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id); + }, + getCurrentPaddingTop: function getCurrentPaddingTop() { + var $$ = this, + config = $$.config, + axesLen = config.axis_y2_axes.length, + padding = isValue(config.padding_top) ? config.padding_top : 0; + return $$.title && $$.title.node() && (padding += $$.getTitlePadding()), axesLen && config.axis_rotated && (padding += $$.getHorizontalAxisHeight("y2") * axesLen), padding; + }, + getCurrentPaddingBottom: function getCurrentPaddingBottom() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + axisId = isRotated ? "y" : "x", + axesLen = config["axis_".concat(axisId, "_axes")].length, + padding = isValue(config.padding_bottom) ? config.padding_bottom : 0; + return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0); + }, + getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) { + var padding, + $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + axisId = isRotated ? "x" : "y", + axesLen = config["axis_".concat(axisId, "_axes")].length, + axisWidth = $$.getAxisWidthByAxisId(axisId, withoutRecompute); + return padding = isValue(config.padding_left) ? config.padding_left : isRotated ? config.axis_x_show ? Math.max(ceil10(axisWidth), 40) : 1 : !config.axis_y_show || config.axis_y_inner ? $$.axis.getYAxisLabelPosition().isOuter ? 30 : 1 : ceil10(axisWidth), padding + axisWidth * axesLen; + }, + getCurrentPaddingRight: function getCurrentPaddingRight() { + var padding, + $$ = this, + config = $$.config, + legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0, + axesLen = config.axis_y2_axes.length, + axisWidth = $$.getAxisWidthByAxisId("y2"); + return padding = isValue(config.padding_right) ? config.padding_right + 1 : config.axis_rotated ? 10 + legendWidthOnRight : !config.axis_y2_show || config.axis_y2_inner ? 2 + legendWidthOnRight + ($$.axis.getY2AxisLabelPosition().isOuter ? 20 : 0) : ceil10(axisWidth) + legendWidthOnRight, padding + axisWidth * axesLen; + }, + + /** + * Get the parent rect element's size + * @param {String} key property/attribute name + * @private + */ + getParentRectValue: function getParentRectValue(key) { + for (var v, offsetName = "offset".concat(capitalize(key)), parent = this.selectChart.node(); !v && parent && parent.tagName !== "BODY";) { + try { + v = parent.getBoundingClientRect()[key]; + } catch (e) { + offsetName in parent && (v = parent[offsetName]); + } + + parent = parent.parentNode; + } + + if (key === "width") { + // Sometimes element's width value is incorrect(ex. flex container) + // In this case, use body's offsetWidth instead. + var bodyWidth = document.body.offsetWidth; + v > bodyWidth && (v = bodyWidth); + } + + return v; + }, + getParentWidth: function getParentWidth() { + return this.getParentRectValue("width"); + }, + getParentHeight: function getParentHeight() { + var h = this.selectChart.style("height"); + return h.indexOf("px") > 0 ? parseInt(h, 10) : 0; + }, + getSvgLeft: function getSvgLeft(withoutRecompute) { + var $$ = this, + config = $$.config, + hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner, + leftAxisClass = config.axis_rotated ? config_classes.axisX : config_classes.axisY, + leftAxis = $$.main.select(".".concat(leftAxisClass)).node(), + svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { + right: 0 + }, + chartRect = $$.selectChart.node().getBoundingClientRect(), + hasArc = $$.hasArcType(), + svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute)); + return svgLeft > 0 ? svgLeft : 0; + }, + getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) { + var $$ = this, + position = $$.axis.getLabelPositionById(id); + return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40); + }, + getHorizontalAxisHeight: function getHorizontalAxisHeight(id) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + h = 30; + return id !== "x" || config.axis_x_show ? id === "x" && config.axis_x_height ? config.axis_x_height : id !== "y" || config.axis_y_show ? id !== "y2" || config.axis_y2_show ? ((id === "x" && !isRotated && config.axis_x_tick_rotate || id === "y" && isRotated && config.axis_y_tick_rotate) && (h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - config["axis_".concat(id, "_tick_rotate")]) / 180)), h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id !== "y2" || isRotated ? 0 : -10)) : $$.rotated_padding_top : !config.legend_show || $$.isLegendRight || $$.isLegendInset ? 1 : 10 : 8; // Calculate x/y axis height when tick rotated + }, + getEventRectWidth: function getEventRectWidth() { + return Math.max(0, this.xAxis.tickInterval()); + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-shape","commonjs2":"d3-shape","amd":"d3-shape","root":"d3"} +var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webpack_require__(19); + +// CONCATENATED MODULE: ./src/shape/shape.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +extend(ChartInternal_ChartInternal.prototype, { + getShapeIndices: function getShapeIndices(typeFilter) { + var $$ = this, + config = $$.config, + indices = {}, + i = 0; + return $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) { + for (var groups, j = 0; groups = config.data_groups[j]; j++) if (!(groups.indexOf(d.id) < 0)) for (var _row4, _k4 = 0; _row4 = groups[_k4]; _k4++) if (_row4 in indices) { + indices[d.id] = indices[_row4]; + break; + } + + isUndefined(indices[d.id]) && (indices[d.id] = i++); + }), indices.__max__ = i - 1, indices; + }, + getShapeX: function getShapeX(offset, targetsNum, indices, isSub) { + var $$ = this, + scale = isSub ? $$.subX : $$.zoomScale || $$.x, + barPadding = $$.config.bar_padding, + sum = function (p, c) { + return p + c; + }, + halfWidth = isObjectType(offset) && offset.total.length ? offset.total.reduce(sum) / 2 : 0; + + return function (d) { + var index = d.id in indices ? indices[d.id] : 0, + x = 0; + + if (notEmpty(d.x)) { + var xPos = scale(d.x); + x = halfWidth ? xPos - (offset[d.id] || offset.width) + offset.total.slice(0, index + 1).reduce(sum) - halfWidth : xPos - (isNumber(offset) ? offset : offset.width) * (targetsNum / 2 - index); + } // adjust x position for bar.padding optionq + + + return offset && x && targetsNum > 1 && barPadding && (index && (x += barPadding * index), targetsNum > 2 ? x -= (targetsNum - 1) * barPadding / 2 : targetsNum === 2 && (x -= barPadding / 2)), x; + }; + }, + getShapeY: function getShapeY(isSub) { + var $$ = this, + isStackNormalized = $$.isStackNormalized(); + return function (d) { + return (isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id))(isStackNormalized ? $$.getRatio("index", d, !0) : d.value); + }; + }, + getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) { + var $$ = this, + targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))), + targetIds = targets.map(function (t) { + return t.id; + }), + isStackNormalized = $$.isStackNormalized(); + return function (d, idx) { + var total, + scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id), + y0 = scale(0), + offset = y0, + i = idx, + x2 = +d.x; + return isStackNormalized && (total = $$.getTotalPerIndex()), targets.forEach(function (t) { + if (t.id !== d.id && indices[t.id] === indices[d.id]) { + // Don't know what is this for, but it's degrading performance + // Area-step works fine without it + // var rowValues = isStepType ? $$.convertValuesToStep(t.values) : t.values; + var rowValues = t.values; + + if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && ((isUndefined(rowValues[i]) || +rowValues[i].x !== x2) && (i = -1, rowValues.forEach(function (v, j) { + +v.x === x2 && (i = j); + })), i in rowValues && rowValues[i].value * d.value >= 0)) { + var v = rowValues[i], + value = isStackNormalized ? $$.getRatio("index", v, !0, total) : v.value; + offset += scale(value) - y0; + } + } + }), offset; + }; + }, + isWithinShape: function isWithinShape(that, d) { + var isWithin, + $$ = this, + shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(that); + return $$.isTargetToShow(d.id) ? $$.hasValidPointType(that.nodeName) ? isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5) : that.nodeName === "path" && (isWithin = !shape.classed(config_classes.bar) || $$.isWithinBar(that)) : isWithin = !1, isWithin; + }, + getInterpolate: function getInterpolate(d) { + var $$ = this, + interpolation = $$.getInterpolateType(d); + return { + "basis": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasis"], + "basis-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasisClosed"], + "basis-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasisOpen"], + "bundle": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBundle"], + "cardinal": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinal"], + "cardinal-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinalClosed"], + "cardinal-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinalOpen"], + "catmull-rom": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRom"], + "catmull-rom-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRomClosed"], + "catmull-rom-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRomOpen"], + "monotone-x": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveMonotoneX"], + "monotone-y": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveMonotoneY"], + "natural": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveNatural"], + "linear-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveLinearClosed"], + "linear": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveLinear"], + "step": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStep"], + "step-after": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStepAfter"], + "step-before": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStepBefore"] + }[interpolation]; + }, + getInterpolateType: function getInterpolateType(d) { + var $$ = this, + type = $$.config.spline_interpolation_type, + interpolation = $$.isInterpolationType(type) ? type : "cardinal"; + return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : "linear"; + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"} +var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(20); + +// CONCATENATED MODULE: ./src/shape/arc.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + + +extend(ChartInternal_ChartInternal.prototype, { + initPie: function initPie() { + var $$ = this, + config = $$.config, + padding = config.pie_padding, + padAngle = $$.hasType("pie") && padding ? padding * .01 : config["".concat(config.data_type, "_padAngle")] ? config["".concat(config.data_type, "_padAngle")] : 0; + $$.pie = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["pie"])().padAngle(padAngle).value(function (d) { + return d.values.reduce(function (a, b) { + return a + b.value; + }, 0); + }), config.data_order || $$.pie.sort(null); + }, + updateRadius: function updateRadius() { + var $$ = this, + config = $$.config, + radius = config.pie_innerRadius, + padding = config.pie_padding, + w = config.gauge_width || config.donut_width; + $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2, $$.radius = $$.radiusExpanded * .95, $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : .6; + var innerRadius = radius || (padding ? padding * ($$.innerRadiusRatio + .1) : 0); + $$.innerRadius = $$.hasType("donut") || $$.hasType("gauge") ? $$.radius * $$.innerRadiusRatio : innerRadius; + }, + updateArc: function updateArc() { + var $$ = this; + $$.svgArc = $$.getSvgArc(), $$.svgArcExpanded = $$.getSvgArcExpanded(), $$.svgArcExpandedSub = $$.getSvgArcExpanded(.98); + }, + updateAngle: function updateAngle(dValue) { + var gMin, + gMax, + gTic, + gValue, + $$ = this, + config = $$.config, + d = dValue, + found = !1, + index = 0; + return config ? ($$.pie($$.filterTargetsToShow($$.data.targets)).forEach(function (t) { + found || t.data.id !== d.data.id || (found = !0, d = t, d.index = index), index++; + }), isNaN(d.startAngle) && (d.startAngle = 0), isNaN(d.endAngle) && (d.endAngle = d.startAngle), $$.isGaugeType(d.data) && (gMin = config.gauge_min, gMax = config.gauge_max, gTic = Math.PI * (config.gauge_fullCircle ? 2 : 1) / (gMax - gMin), gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin, d.startAngle = config.gauge_startingAngle, d.endAngle = d.startAngle + gTic * gValue), found ? d : null) : null; + }, + getSvgArc: function getSvgArc() { + var $$ = this, + arc = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["arc"])().outerRadius($$.radius).innerRadius($$.innerRadius), + newArc = function (d, withoutUpdate) { + var path = "M 0 0"; + + if ("value" in d ? d.value > 0 : d.data) { + var updated = !withoutUpdate && $$.updateAngle(d); + withoutUpdate ? path = arc(d) : updated && (path = arc(updated)); + } + + return path; + }; + + return newArc.centroid = arc.centroid, newArc; + }, + getSvgArcExpanded: function getSvgArcExpanded(rate) { + var $$ = this, + arc = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["arc"])().outerRadius($$.radiusExpanded * (rate || 1)).innerRadius($$.innerRadius); + return function (d) { + var updated = $$.updateAngle(d); + return updated ? arc(updated) : "M 0 0"; + }; + }, + getArc: function getArc(d, withoutUpdate, force) { + return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0"; + }, + transformForArcLabel: function transformForArcLabel(d) { + var $$ = this, + config = $$.config, + updated = $$.updateAngle(d), + translate = ""; + + if (updated && !$$.hasType("gauge")) { + var c = this.svgArc.centroid(updated), + x = isNaN(c[0]) ? 0 : c[0], + y = isNaN(c[1]) ? 0 : c[1], + h = Math.sqrt(x * x + y * y), + ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio; + ratio = ratio ? isFunction(ratio) ? ratio(d, $$.radius, h) : ratio : $$.radius && (h ? (36 / $$.radius > .375 ? 1.175 - 36 / $$.radius : .8) * $$.radius / h : 0), translate = "translate(".concat(x * ratio, ",").concat(y * ratio, ")"); + } + + return translate; + }, + convertToArcData: function convertToArcData(d) { + return this.addName({ + id: d.data.id, + value: d.value, + ratio: this.getRatio("arc", d), + index: d.index + }); + }, + textForArcLabel: function textForArcLabel(val) { + var $$ = this, + d = val.node ? val.datum() : val; + if (!$$.shouldShowArcLabel()) return ""; + var updated = $$.updateAngle(d), + value = updated ? updated.value : null, + ratio = $$.getRatio("arc", updated), + id = d.data.id; + if (!$$.hasType("gauge") && !$$.meetsArcLabelThreshold(ratio)) return ""; + var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, id).toString(); + if (val.node) if (text.indexOf("\n") === -1) val.text(text);else { + var multiline = text.split("\n"), + len = multiline.length - 1; + multiline.forEach(function (v, i) { + val.append("tspan").attr("x", 0).attr("dy", "".concat(i === 0 ? -len : 1, "em")).text(v); + }); + } + return text; + }, + textForGaugeMinMax: function textForGaugeMinMax(value, isMax) { + var format = this.getGaugeLabelExtents(); + return format ? format(value, isMax) : value; + }, + expandArc: function expandArc(targetIds) { + var $$ = this; // MEMO: avoid to cancel transition + + if ($$.transiting) { + var interval = setInterval(function () { + $$.transiting || (clearInterval(interval), $$.legend.selectAll(".".concat(config_classes.legendItemFocused)).size() > 0 && $$.expandArc(targetIds)); + }, 10); + return; + } + + var newTargetIds = $$.mapToTargetIds(targetIds); + $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).each(function (d) { + if ($$.shouldExpand(d.data.id) && d.value !== 0) { + var expandDuration = $$.expandDuration(d.data.id); + Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).selectAll("path").transition().duration(expandDuration).attr("d", $$.svgArcExpanded).transition().duration(expandDuration * 2).attr("d", $$.svgArcExpandedSub); + } + }); + }, + unexpandArc: function unexpandArc(targetIds) { + var $$ = this; + + if (!$$.transiting) { + var newTargetIds = $$.mapToTargetIds(targetIds); + $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).selectAll("path").transition().duration(function (d) { + return $$.expandDuration(d.data.id); + }).attr("d", $$.svgArc), $$.svg.selectAll("".concat(config_classes.arc)).style("opacity", "1"); + } + }, + expandDuration: function expandDuration(id) { + var type, + $$ = this, + config = $$.config; + return $$.isDonutType(id) ? type = "donut" : $$.isGaugeType(id) ? type = "gauge" : $$.isPieType(id) && (type = "pie"), type ? config["".concat(type, "_expand_duration")] : 50; + }, + shouldExpand: function shouldExpand(id) { + var $$ = this, + config = $$.config; + return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand; + }, + shouldShowArcLabel: function shouldShowArcLabel() { + var $$ = this, + config = $$.config, + shouldShow = !0; + // when gauge, always true + return $$.hasType("donut") ? shouldShow = config.donut_label_show : $$.hasType("pie") && (shouldShow = config.pie_label_show), shouldShow; + }, + meetsArcLabelThreshold: function meetsArcLabelThreshold(ratio) { + var $$ = this, + config = $$.config, + threshold = $$.hasType("donut") ? config.donut_label_threshold : config.pie_label_threshold; + return ratio >= threshold; + }, + getArcLabelFormat: function getArcLabelFormat() { + var $$ = this, + config = $$.config, + format = config.pie_label_format; + return $$.hasType("gauge") ? format = config.gauge_label_format : $$.hasType("donut") && (format = config.donut_label_format), format; + }, + getGaugeLabelExtents: function getGaugeLabelExtents() { + var config = this.config; + return config.gauge_label_extents; + }, + getArcTitle: function getArcTitle() { + var $$ = this; + return $$.hasType("donut") ? $$.config.donut_title : ""; + }, + updateTargetsForArc: function updateTargetsForArc(targets) { + var $$ = this, + main = $$.main, + classChartArc = $$.classChartArc.bind($$), + classArcs = $$.classArcs.bind($$), + classFocus = $$.classFocus.bind($$), + mainPieUpdate = main.select(".".concat(config_classes.chartArcs)).selectAll(".".concat(config_classes.chartArc)).data($$.pie(targets)).attr("class", function (d) { + return classChartArc(d) + classFocus(d.data); + }), + mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc); + mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate), mainPieEnter.append("text").attr("dy", $$.hasType("gauge") ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", "middle").style("pointer-events", "none"); + }, + initArc: function initArc() { + var $$ = this; + $$.arcs = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartArcs).attr("transform", $$.getTranslate("arc")), $$.setArcTitle(); + }, + + /** + * Set arc title text + * @private + */ + setArcTitle: function setArcTitle() { + var $$ = this, + title = $$.getArcTitle(); + + if (title) { + var multiline = title.split("\n"), + text = $$.arcs.append("text").attr("class", config_classes.chartArcsTitle).style("text-anchor", "middle"); + + // if is multiline text + if (multiline.length > 1) { + var fontSize = +text.style("font-size").replace("px", ""), + height = Math.floor(text.text(".").node().getBBox().height, text.text("")); + multiline.forEach(function (v, i) { + return text.insert("tspan").text(v).attr("x", 0).attr("dy", i ? height : 0); + }), text.attr("y", "-".concat(fontSize * (multiline.length - 2) || fontSize / 2)); + } else text.text(title); + } + }, + redrawArc: function redrawArc(duration, durationForExit, withTransform) { + var $$ = this, + config = $$.config, + main = $$.main, + hasInteraction = config.interaction_enabled, + mainArc = main.selectAll(".".concat(config_classes.arcs)).selectAll(".".concat(config_classes.arc)).data($$.arcData.bind($$)); + // bind arc events + mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove(), mainArc = mainArc.enter().append("path").attr("class", $$.classArc.bind($$)).style("fill", function (d) { + return $$.color(d.data); + }).style("cursor", function (d) { + return hasInteraction && (config.data_selection_isselectable(d) ? "pointer" : null); + }).style("opacity", "0").each(function (d) { + $$.isGaugeType(d.data) && (d.startAngle = config.gauge_startingAngle, d.endAngle = config.gauge_startingAngle), this._current = d; + }).merge(mainArc), mainArc.attr("transform", function (d) { + return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : ""; + }).style("opacity", function (d) { + return d === this._current ? "0" : "1"; + }).each(function () { + $$.transiting = !0; + }).transition().duration(duration).attrTween("d", function (d) { + var updated = $$.updateAngle(d); + if (!updated) return function () { + return "M 0 0"; + }; + isNaN(this._current.startAngle) && (this._current.startAngle = 0), isNaN(this._current.endAngle) && (this._current.endAngle = this._current.startAngle); + var interpolate = Object(external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_["interpolate"])(this._current, updated); + return this._current = interpolate(0), function (t) { + var interpolated = interpolate(t); + // data.id will be updated by interporator + return interpolated.data = d.data, $$.getArc(interpolated, !0); + }; + }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) { + return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id); + }) // Where gauge reading color would receive customization. + .style("opacity", "1").call($$.endall, function () { + $$.transiting = !1; + }), hasInteraction && $$.bindArcEvent(mainArc), $$.redrawArcText(duration); + }, + bindArcEvent: function bindArcEvent(arc) { + function selectArc(_this, arcData, id) { + $$.expandArc(id), $$.api.focus(id), $$.toggleFocusLegend(id, !0), $$.showTooltip([arcData], _this); + } + + function unselectArc(arcData) { + var id = arcData && arcData.id || undefined; + $$.unexpandArc(id), $$.api.revert(), $$.revertLegend(), $$.hideTooltip(); + } + + var $$ = this, + isTouch = $$.inputType === "touch", + isMouse = $$.inputType === "mouse"; + + // touch events + if (arc.on("click", function (d, i) { + var arcData, + updated = $$.updateAngle(d); + updated && (arcData = $$.convertToArcData(updated), $$.toggleShape && $$.toggleShape(this, arcData, i), $$.config.data_onclick.call($$.api, arcData, this)); + }), isMouse && arc.on("mouseover", function (d) { + if (!$$.transiting) // skip while transiting + { + var updated = $$.updateAngle(d), + arcData = updated ? $$.convertToArcData(updated) : null, + id = arcData && arcData.id || undefined; + selectArc(this, arcData, id), $$.setOverOut(!0, arcData); + } + }).on("mouseout", function (d) { + if (!$$.transiting) // skip while transiting + { + var updated = $$.updateAngle(d), + arcData = updated ? $$.convertToArcData(updated) : null; + unselectArc(), $$.setOverOut(!1, arcData); + } + }).on("mousemove", function (d) { + var updated = $$.updateAngle(d), + arcData = updated ? $$.convertToArcData(updated) : null; + $$.showTooltip([arcData], this); + }), isTouch && $$.hasArcType() && !$$.radars) { + var getEventArc = function () { + var touch = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].changedTouches[0], + eventArc = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(document.elementFromPoint(touch.clientX, touch.clientY)); + return eventArc; + }, + handler = function () { + if (!$$.transiting) // skip while transiting + { + var eventArc = getEventArc(), + datum = eventArc.datum(), + updated = datum && datum.data && datum.data.id ? $$.updateAngle(datum) : null, + arcData = updated ? $$.convertToArcData(updated) : null, + id = arcData && arcData.id || undefined; + $$.callOverOutForTouch(arcData), isUndefined(id) ? unselectArc() : selectArc(this, arcData, id); + } + }; + + $$.svg.on("touchstart", handler).on("touchmove", handler); + } + }, + redrawArcText: function redrawArcText(duration) { + var $$ = this, + config = $$.config, + main = $$.main, + gaugeTextValue = main.selectAll(".".concat(config_classes.chartArc)).select("text").style("opacity", "0").attr("class", function (d) { + return $$.isGaugeType(d.data) ? config_classes.gaugeValue : ""; + }); + config.gauge_fullCircle && gaugeTextValue.attr("dy", "".concat(Math.round($$.radius / 14))); + // to handle multiline text for gauge type + var textMethod = !gaugeTextValue.empty() && gaugeTextValue.classed(config_classes.gaugeValue) ? "call" : "text"; + + if (gaugeTextValue[textMethod]($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) { + return $$.isGaugeType(d.data) ? "".concat(Math.round($$.radius / 5), "px") : ""; + }).transition().duration(duration).style("opacity", function (d) { + return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? "1" : "0"; + }), main.select(".".concat(config_classes.chartArcsTitle)).style("opacity", $$.hasType("donut") || $$.hasType("gauge") ? "1" : "0"), $$.hasType("gauge")) { + var endAngle = (config.gauge_fullCircle ? -4 : -1) * config.gauge_startingAngle; + $$.arcs.select(".".concat(config_classes.chartArcsBackground)).attr("d", function () { + var d = { + data: [{ + value: config.gauge_max + }], + startAngle: config.gauge_startingAngle, + endAngle: endAngle + }; + return $$.getArc(d, !0, !0); + }), $$.arcs.select(".".concat(config_classes.chartArcsGaugeUnit)).attr("dy", ".75em").text(config.gauge_label_show ? config.gauge_units : ""), config.gauge_label_show && ($$.arcs.select(".".concat(config_classes.chartArcsGaugeMin)).attr("dx", "".concat(-1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)), "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_min, !1)), !config.gauge_fullCircle && $$.arcs.select(".".concat(config_classes.chartArcsGaugeMax)).attr("dx", "".concat($$.innerRadius + ($$.radius - $$.innerRadius) / 2, "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0))); + } + }, + initGauge: function initGauge() { + var $$ = this, + config = $$.config, + arcs = $$.arcs; + $$.hasType("gauge") && (arcs.append("path").attr("class", config_classes.chartArcsBackground), arcs.append("text").attr("class", config_classes.chartArcsGaugeUnit).style("text-anchor", "middle").style("pointer-events", "none"), config.gauge_label_show && (arcs.append("text").attr("class", config_classes.chartArcsGaugeMin).style("text-anchor", "middle").style("pointer-events", "none"), !config.gauge_fullCircle && arcs.append("text").attr("class", config_classes.chartArcsGaugeMax).style("text-anchor", "middle").style("pointer-events", "none"))); + }, + getGaugeLabelHeight: function getGaugeLabelHeight() { + return this.config.gauge_label_show ? 20 : 0; + } +}); +// CONCATENATED MODULE: ./src/shape/bar.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(ChartInternal_ChartInternal.prototype, { + initBar: function initBar() { + var $$ = this; + $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars); + }, + updateTargetsForBar: function updateTargetsForBar(targets) { + var $$ = this, + config = $$.config, + classChartBar = $$.classChartBar.bind($$), + classBars = $$.classBars.bind($$), + classFocus = $$.classFocus.bind($$), + mainBarUpdate = $$.main.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", function (d) { + return classChartBar(d) + classFocus(d); + }), + mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", "none"); + // Bars for each data + mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) { + return config.data_selection_isselectable(d) ? "pointer" : null; + }); + }, + updateBar: function updateBar(durationForExit) { + var $$ = this, + barData = $$.barData.bind($$), + classBar = $$.classBar.bind($$), + initialOpacity = $$.initialOpacity.bind($$); + $$.mainBar = $$.main.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data(barData), $$.mainBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainBar = $$.mainBar.enter().append("path").attr("class", classBar).style("stroke", $$.color).style("fill", $$.color).merge($$.mainBar).style("opacity", initialOpacity); + }, + redrawBar: function redrawBar(drawBar, withTransition) { + return [(withTransition ? this.mainBar.transition(getRandom()) : this.mainBar).attr("d", drawBar).style("fill", this.color).style("opacity", "1")]; + }, + getBarW: function getBarW(axis, barTargetsNum) { + var result, + $$ = this, + config = $$.config, + tickInterval = axis.tickInterval($$.getMaxDataCount()), + isGrouped = config.data_groups.length, + getWidth = function (id) { + var width = id ? config.bar_width[id] : config.bar_width, + ratio = id ? width.ratio : config.bar_width_ratio, + max = id ? width.max : config.bar_width_max, + w = isNumber(width) ? width : barTargetsNum ? tickInterval * ratio / barTargetsNum : 0; + return max && w > max ? max : w; + }; + + return result = getWidth(), !isGrouped && isObjectType(config.bar_width) && (result = { + width: result, + total: [] + }, $$.filterTargetsToShow($$.data.targets).forEach(function (v) { + config.bar_width[v.id] && (result[v.id] = getWidth(v.id)), result.total.push(result[v.id] || result.width); + })), result; + }, + getBars: function getBars(i, id) { + var $$ = this, + suffix = isValue(i) ? "-".concat(i) : ""; + return (id ? $$.main.selectAll(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.bar).concat(suffix)); + }, + expandBars: function expandBars(i, id, reset) { + var $$ = this; + reset && $$.unexpandBars(), $$.getBars(i, id).classed(config_classes.EXPANDED, !0); + }, + unexpandBars: function unexpandBars(i) { + this.getBars(i).classed(config_classes.EXPANDED, !1); + }, + generateDrawBar: function generateDrawBar(barIndices, isSub) { + var $$ = this, + config = $$.config, + getPoints = $$.generateGetBarPoints(barIndices, isSub), + isRotated = config.axis_rotated, + isGrouped = config.data_groups.length, + barRadius = config.bar_radius, + barRadiusRatio = config.bar_radius_ratio, + getRadius = isNumber(barRadius) && barRadius > 0 ? function () { + return barRadius; + } : isNumber(barRadiusRatio) ? function (w) { + return w * barRadiusRatio; + } : null; + return function (d, i) { + // 4 points that make a bar + var points = getPoints(d, i), + indexX = +isRotated, + indexY = +!indexX, + isNegative = d.value < 0, + pathRadius = ["", ""], + radius = 0; // switch points if axis is rotated, not applicable for sub chart + + if (getRadius && !isGrouped) { + var index = isRotated ? indexY : indexX, + barW = points[2][index] - points[0][index]; + radius = getRadius(barW); + var arc = "a".concat(radius, ",").concat(radius, " ").concat(isNegative ? "1 0 0" : "0 0 1", " "); + pathRadius[+!isRotated] = "".concat(arc).concat(radius, ",").concat(radius), pathRadius[+isRotated] = "".concat(arc).concat([-radius, radius][isRotated ? "sort" : "reverse"]()), isNegative && pathRadius.reverse(); + } // path string data shouldn't be containing new line chars + // https://github.com/naver/billboard.js/issues/530 + + + var path = isRotated ? "H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) : "V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]); + return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z"); + }; + }, + generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) { + var $$ = this, + axis = isSub ? $$.subXAxis : $$.xAxis, + barTargetsNum = barIndices.__max__ + 1, + barW = $$.getBarW(axis, barTargetsNum), + barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub), + barY = $$.getShapeY(!!isSub), + barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub), + yScale = isSub ? $$.getSubYScale : $$.getYScale; + return function (d, i) { + var y0 = yScale.call($$, d.id)(0), + offset = barOffset(d, i) || y0, + width = isNumber(barW) ? barW : barW[d.id] || barW.width, + posX = barX(d), + posY = barY(d); + // 4 points that make a bar + return $$.config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), posY -= y0 - offset, [[posX, offset], [posX, posY], [posX + width, posY], [posX + width, offset]]; + }; + }, + isWithinBar: function isWithinBar(that) { + var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(that), + list = getRectSegList(that), + _list2 = slicedToArray_default()(list, 2), + seg0 = _list2[0], + seg1 = _list2[1], + x = Math.min(seg0.x, seg1.x), + y = Math.min(seg0.y, seg1.y), + offset = 2, + _that$getBBox = that.getBBox(), + width = _that$getBBox.width, + height = _that$getBBox.height; + + return x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset; + } +}); +// CONCATENATED MODULE: ./src/shape/bubble.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initializer + * @private + */ + initBubble: function initBubble() { + var $$ = this, + config = $$.config; + $$.hasType("bubble") && (config.point_show = !0, config.point_type = "circle", config.point_sensitivity = 25); + }, + + /** + * Get user agent's computed value for the total length of the path in user units + * https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getTotalLength + * @return {Number} + * @private + */ + getBaseLength: function getBaseLength() { + var $$ = this, + cacheKey = "$baseLength", + baseLength = $$.getCache(cacheKey); + return baseLength || $$.addCache(cacheKey, baseLength = getMinMax("min", [$$.axes.x.select("path").node().getTotalLength(), $$.axes.y.select("path").node().getTotalLength()])), baseLength; + }, + + /** + * Get the radius value for bubble circle + * @param {Object} d + * @return {Number} + * @private + */ + getBubbleR: function getBubbleR(d) { + var $$ = this, + maxR = $$.config.bubble_maxR; + isFunction(maxR) ? maxR = maxR(d) : !isNumber(maxR) && (maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12); + var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) { + return isObject(d.value) ? d.value.mid : d.value; + })), + maxArea = maxR * maxR * Math.PI, + area = d.value * (maxArea / max); + return Math.sqrt(area / Math.PI); + } +}); +// CONCATENATED MODULE: ./src/shape/line.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +extend(ChartInternal_ChartInternal.prototype, { + initLine: function initLine() { + var $$ = this; + $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines); + }, + updateTargetsForLine: function updateTargetsForLine(targets) { + var $$ = this, + config = $$.config, + classChartLine = $$.classChartLine.bind($$), + classLines = $$.classLines.bind($$), + classAreas = $$.classAreas.bind($$), + classCircles = $$.classCircles.bind($$), + classFocus = $$.classFocus.bind($$), + mainLineUpdate = $$.main.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", function (d) { + return classChartLine(d) + classFocus(d); + }), + mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", "none"); + // Lines for each data + // Areas + // Update date for selected circles + mainLineEnter.append("g").attr("class", classLines), mainLineEnter.append("g").attr("class", classAreas), config.point_show && (config.data_selection_enabled && mainLineEnter.append("g").attr("class", function (d) { + return $$.generateClass(config_classes.selectedCircles, d.id); + }), mainLineEnter.append("g").attr("class", classCircles).style("cursor", function (d) { + return config.data_selection_isselectable(d) ? "pointer" : null; + })), targets.forEach(function (t) { + $$.main.selectAll(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(t.id))).selectAll("".concat(config_classes.selectedCircle)).each(function (d) { + d.value = t.values[d.index].value; + }); + }); + }, + updateLine: function updateLine(durationForExit) { + var $$ = this; + $$.mainLine = $$.main.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.mainLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainLine = $$.mainLine.enter().append("path").attr("class", function (d) { + return "".concat($$.classLine.bind($$)(d), " ").concat($$.extraLineClasses(d) || ""); + }).style("stroke", $$.color).merge($$.mainLine).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) { + return $$.isStepType(d) ? "crispEdges" : ""; + }).attr("transform", null); + }, + redrawLine: function redrawLine(drawLine, withTransition) { + return [(withTransition ? this.mainLine.transition(getRandom()) : this.mainLine).attr("d", drawLine).style("stroke", this.color).style("opacity", "1")]; + }, + + /** + * Get the curve interpolate + * @param {Array} d Data object + * @return {Function} + * @private + */ + getCurve: function getCurve(d) { + var $$ = this, + isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d); + // when is step & rotated, should be computed in different way + // https://github.com/naver/billboard.js/issues/471 + return isRotatedStepType ? function (context) { + var step = $$.getInterpolate(d)(context); // keep the original method + + return step.orgPoint = step.point, step.pointRotated = function (x, y) { + this._point === 1 && (this._point = 2); + var y1 = this._y * (1 - this._t) + y * this._t; + this._context.lineTo(this._x, y1), this._context.lineTo(x, y1), this._x = x, this._y = y; + }, step.point = function (x, y) { + this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y); + }, step; + } : $$.getInterpolate(d); + }, + generateDrawLine: function generateDrawLine(lineIndices, isSub) { + var $$ = this, + config = $$.config, + lineConnectNull = config.line_connectNull, + isRotated = config.axis_rotated, + getPoints = $$.generateGetLinePoints(lineIndices, isSub), + yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, + xValue = function (d) { + return (isSub ? $$.subxx : $$.xx).call($$, d); + }, + yValue = function (d, i) { + return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getBaseValue(d)); + }, + line = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["line"])(); + + line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue), lineConnectNull || (line = line.defined(function (d) { + return $$.getBaseValue(d) !== null; + })); + var x = isSub ? $$.subX : $$.x; + return function (d) { + var path, + y = yScaleGetter.call($$, d.id), + values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, + x0 = 0, + y0 = 0; + + if ($$.isLineType(d)) { + var regions = config.data_regions[d.id]; + regions ? path = $$.lineWithRegions(values, x, y, regions) : ($$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = line.curve($$.getCurve(d))(values)); + } else values[0] && (x0 = x(values[0].x), y0 = y(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0); + + return path || "M 0 0"; + }; + }, + generateGetLinePoints: function generateGetLinePoints(lineIndices, isSubValue) { + // partial duplication of generateGetBarPoints + var $$ = this, + config = $$.config, + lineTargetsNum = lineIndices.__max__ + 1, + isSub = !!isSubValue, + x = $$.getShapeX(0, lineTargetsNum, lineIndices, isSub), + y = $$.getShapeY(isSub), + lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub), + yScale = isSub ? $$.getSubYScale : $$.getYScale; + return function (d, i) { + var y0 = yScale.call($$, d.id)(0), + offset = lineOffset(d, i) || y0, + posX = x(d), + posY = y(d); + config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0); + // 1 point that marks the line position + var point = [posX, posY - (y0 - offset)]; + return [point, point, // from here and below, needed for compatibility + point, point]; + }; + }, + lineWithRegions: function lineWithRegions(d, x, y, _regions) { + var xp, + yp, + diff, + diffx2, + $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + isTimeSeries = $$.isTimeSeries(), + xOffset = $$.isCategorized() ? .5 : 0, + regions = [], + dasharray = "2 2", + isWithinRegions = function (withinX, withinRegions) { + for (var reg, i = 0; reg = withinRegions[i]; i++) if (reg.start < withinX && withinX <= reg.end) return reg.style; + + return !1; + }; + + // Check start/end of regions + if (isDefined(_regions)) { + var getValue = function (v, def) { + return isUndefined(v) ? def : isTimeSeries ? $$.parseDate(v) : v; + }; + + for (var reg, i = 0; reg = _regions[i]; i++) { + var start = getValue(reg.start, d[0].x), + end = getValue(reg.end, d[d.length - 1].x), + style = reg.style || { + dasharray: dasharray + }; + regions[i] = { + start: start, + end: end, + style: style + }; + } + } // Set scales + + + var xValue = isRotated ? function (dt) { + return y(dt.value); + } : function (dt) { + return x(dt.x); + }, + yValue = isRotated ? function (dt) { + return x(dt.x); + } : function (dt) { + return y(dt.value); + }, + generateM = function (points) { + return "M".concat(points[0][0], ",").concat(points[0][1], "L").concat(points[1][0], ",").concat(points[1][1]); + }, + sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) { + var x0 = d0.x.getTime(), + xDiff = d1.x - d0.x, + xv0 = new Date(x0 + xDiff * k), + xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)), + points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]]; + return generateM(points); + } : function (d0, d1, k, otherDiff) { + var points = isRotated ? [[y(yp(k), !0), x(xp(k))], [y(yp(k + otherDiff), !0), x(xp(k + otherDiff))]] : [[x(xp(k), !0), y(yp(k))], [x(xp(k + otherDiff), !0), y(yp(k + otherDiff))]]; + return generateM(points); + }, + path = "M"; + + for (var data, _i = 0; data = d[_i]; _i++) { + var prevData = d[_i - 1], + style = isWithinRegions(data.x, regions); + // Draw as normal + if (isUndefined(regions) || !style) path += "".concat(_i ? "L" : "").concat(xValue(data), ",").concat(yValue(data));else { + try { + style = style.dasharray.split(" "); + } catch (e) { + style = dasharray.split(" "); + } // Draw with region // TODO: Fix for horizotal charts + + + xp = $$.getScale(prevData.x + xOffset, data.x + xOffset, isTimeSeries), yp = $$.getScale(prevData.value, data.value); + var dx = x(data.x) - x(prevData.x), + dy = y(data.value) - y(prevData.value), + dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); + diff = style[0] / dd, diffx2 = diff * style[1]; + + for (var j = diff; j <= 1; j += diffx2) path += sWithRegion(prevData, data, j, diff), j + diffx2 >= 1 && (path += sWithRegion(prevData, data, 1, 0)); + } + } + + return path; + }, + updateArea: function updateArea(durationForExit) { + var $$ = this; + $$.mainArea = $$.main.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.mainArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainArea = $$.mainArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.color).style("opacity", function () { + return $$.orgAreaOpacity = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).style("opacity"), "0"; + }).merge($$.mainArea), $$.mainArea.style("opacity", $$.orgAreaOpacity); + }, + redrawArea: function redrawArea(drawArea, withTransition) { + var $$ = this; + return [(withTransition ? this.mainArea.transition(getRandom()) : this.mainArea).attr("d", drawArea).style("fill", this.color).style("opacity", function (d) { + return $$.isAreaRangeType(d) ? $$.orgAreaOpacity / 1.75 : $$.orgAreaOpacity; + })]; + }, + + /** + * Generate area path data + * @param areaIndices + * @param isSub + * @return {function(*=): (*|string)} + * @private + */ + generateDrawArea: function generateDrawArea(areaIndices, isSub) { + var $$ = this, + config = $$.config, + lineConnectNull = config.line_connectNull, + isRotated = config.axis_rotated, + getPoints = $$.generateGetAreaPoints(areaIndices, isSub), + yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, + xValue = function (d) { + return (isSub ? $$.subxx : $$.xx).call($$, d); + }, + value0 = function (d, i) { + return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "high") : $$.getAreaBaseValue(d.id)); + }, + value1 = function (d, i) { + return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "low") : d.value); + }; + + return function (d) { + var path, + values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, + x0 = 0, + y0 = 0; + + if ($$.isAreaType(d)) { + var area = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["area"])(); + area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1), lineConnectNull || (area = area.defined(function (d) { + return $$.getBaseValue(d) !== null; + })), $$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = area.curve($$.getCurve(d))(values); + } else values[0] && (x0 = $$.x(values[0].x), y0 = $$.getYScale(d.id)(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0); + + return path || "M 0 0"; + }; + }, + getAreaBaseValue: function getAreaBaseValue() { + return 0; + }, + generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) { + // partial duplication of generateGetBarPoints + var $$ = this, + config = $$.config, + areaTargetsNum = areaIndices.__max__ + 1, + x = $$.getShapeX(0, areaTargetsNum, areaIndices, !!isSub), + y = $$.getShapeY(!!isSub), + areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub), + yScale = isSub ? $$.getSubYScale : $$.getYScale; + return function (d, i) { + var y0 = yScale.call($$, d.id)(0), + offset = areaOffset(d, i) || y0, + posX = x(d), + posY = y(d); + // 1 point that marks the area position + return config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), [[posX, offset], [posX, posY - (y0 - offset)], [posX, posY - (y0 - offset)], // needed for compatibility + [posX, offset] // needed for compatibility + ]; + }; + }, + updateCircle: function updateCircle() { + var $$ = this; + $$.config.point_show && ($$.mainCircle = $$.main.selectAll(".".concat(config_classes.circles)).selectAll(".".concat(config_classes.circle)).data(function (d) { + return !$$.isBarType(d) && (!$$.isLineType(d) || $$.shouldDrawPointsForLine(d)) && $$.labelishData(d); + }), $$.mainCircle.exit().remove(), $$.mainCircle = $$.mainCircle.enter().append($$.point("create", this, $$.classCircle.bind($$), $$.pointR.bind($$), $$.color)).merge($$.mainCircle).style("stroke", $$.color).style("opacity", $$.initialOpacityForCircle.bind($$))); + }, + redrawCircle: function redrawCircle(cx, cy, withTransition, flow) { + var $$ = this, + selectedCircles = $$.main.selectAll(".".concat(config_classes.selectedCircle)); + if (!$$.config.point_show) return []; + var mainCircles = []; + $$.mainCircle.each(function (d) { + var fn = $$.point("update", $$, cx, cy, $$.opacityForCircle.bind($$), $$.color, withTransition, flow, selectedCircles).bind(this), + result = fn(d); + mainCircles.push(result); + }); + var posAttr = $$.isCirclePoint() ? "c" : ""; + return [mainCircles, selectedCircles.attr("".concat(posAttr, "x"), cx).attr("".concat(posAttr, "y"), cy)]; + }, + circleX: function circleX(d) { + var $$ = this, + hasValue = isValue(d.x); + return $$.config.zoom_enabled && $$.zoomScale ? hasValue ? $$.zoomScale(d.x) : null : hasValue ? $$.x(d.x) : null; + }, + updateCircleY: function updateCircleY() { + var $$ = this; + + $$.circleY = function (d, i) { + var id = d.id; + return $$.isGrouped(id) ? $$.generateGetLinePoints($$.getShapeIndices($$.isLineType))(d, i)[0][1] : $$.getYScale(id)($$.getBaseValue(d)); + }; + }, + getCircles: function getCircles(i, id) { + var $$ = this, + suffix = isValue(i) ? "-".concat(i) : ""; + return (id ? $$.main.selectAll(".".concat(config_classes.circles).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.circle).concat(suffix)); + }, + expandCircles: function expandCircles(i, id, reset) { + var $$ = this, + r = $$.pointExpandedR.bind($$); + reset && $$.unexpandCircles(); + var circles = $$.getCircles(i, id).classed(config_classes.EXPANDED, !0), + scale = r(circles) / $$.config.point_r, + ratio = 1 - scale; + $$.isCirclePoint() ? circles.attr("r", r) : circles.each(function () { + var point = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this); + if (this.tagName === "circle") point.attr("r", r);else { + var _this$getBBox = this.getBBox(), + width = _this$getBBox.width, + height = _this$getBBox.height, + x = ratio * (+point.attr("x") + width / 2), + y = ratio * (+point.attr("y") + height / 2); + + point.style("transform", "translate(".concat(x, "px, ").concat(y, "px) scale(").concat(scale, ")")); + } + }); + }, + unexpandCircles: function unexpandCircles(i) { + var $$ = this, + r = $$.pointR.bind($$), + circles = $$.getCircles(i).filter(function () { + return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.EXPANDED); + }).classed(config_classes.EXPANDED, !1); + circles.attr("r", r), $$.isCirclePoint() || circles.style("transform", "scale(".concat(r(circles) / $$.config.point_r, ")")); + }, + pointR: function (d) { + var $$ = this, + config = $$.config, + pointR = config.point_r, + r = pointR; + return $$.isStepType(d) ? r = 0 : $$.isBubbleType(d) ? r = $$.getBubbleR(d) : isFunction(pointR) && (r = pointR(d)), r; + }, + pointExpandedR: function pointExpandedR(d) { + var $$ = this, + config = $$.config, + scale = $$.isBubbleType(d) ? 1.15 : 1.75; + return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d); + }, + pointSelectR: function pointSelectR(d) { + var $$ = this, + selectR = $$.config.point_select_r; + return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4; + }, + isWithinCircle: function isWithinCircle(node, r) { + var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(node), + element = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(node), + prefix = this.isCirclePoint() ? "c" : "", + cx = +element.attr("".concat(prefix, "x")), + cy = +element.attr("".concat(prefix, "y")); + + // if node don't have cx/y or x/y attribute value + if (!(cx || cy) && node.nodeType === 1) { + var _ref = node.getBBox ? node.getBBox() : node.getBoundingClientRect(), + x = _ref.x, + y = _ref.y; + + cx = x, cy = y; + } + + return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < r; + }, + isWithinStep: function isWithinStep(that, y) { + return Math.abs(y - Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(that)[1]) < 30; + }, + shouldDrawPointsForLine: function shouldDrawPointsForLine(d) { + var linePoint = this.config.line_point; + return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1; + } +}); +// CONCATENATED MODULE: ./src/shape/point.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + hasValidPointType: function hasValidPointType(type) { + return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type); + }, + hasValidPointDrawMethods: function hasValidPointDrawMethods(type) { + var pointType = type || this.config.point_type; + return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update); + }, + insertPointInfoDefs: function insertPointInfoDefs(point, id) { + var $$ = this, + copyAttr = function (from, target) { + for (var name, attribs = from.attributes, i = 0; name = attribs[i]; i++) name = name.name, target.setAttribute(name, from.getAttribute(name)); + }, + doc = new DOMParser().parseFromString(point, "image/svg+xml"), + node = doc.documentElement, + clone = document.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].svg, node.nodeName.toLowerCase()); + + if (clone.id = id, clone.style.fill = "inherit", clone.style.stroke = "inherit", copyAttr(node, clone), node.childNodes && node.childNodes.length) { + var parent = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(clone); + "innerHTML" in clone ? parent.html(node.innerHTML) : toArray(node.childNodes).forEach(function (v) { + copyAttr(v, parent.append(v.tagName).node()); + }); + } + + $$.defs.node().appendChild(clone); + }, + pointFromDefs: function pointFromDefs(id) { + return this.defs.select("#".concat(id)); + }, + generatePoint: function generatePoint() { + var $$ = this, + config = $$.config, + ids = [], + pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type]; + return function (method, context) { + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key]; + + return function (d) { + var point, + id = d.id || d.data && d.data.id || d, + element = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this); + if (ids.indexOf(id) < 0 && ids.push(id), point = pattern[ids.indexOf(id) % pattern.length], $$.hasValidPointType(point)) point = $$[point];else if (!$$.hasValidPointDrawMethods(point)) { + var pointId = "".concat($$.datetimeId, "-point-").concat(id), + pointFromDefs = $$.pointFromDefs(pointId); + if (pointFromDefs.size() < 1 && $$.insertPointInfoDefs(point, pointId), method === "create") return $$.custom.create.bind(context).apply(void 0, [element, pointId].concat(args)); + if (method === "update") return $$.custom.update.bind(context).apply(void 0, [element].concat(args)); + } + return point[method].bind(context).apply(void 0, [element].concat(args)); + }; + }; + }, + getTransitionName: function getTransitionName() { + return getRandom(); + }, + custom: { + create: function create(element, id, cssClassFn, sizeFn, fillStyleFn) { + return element.append("use").attr("xlink:href", "#".concat(id)).attr("class", cssClassFn).style("fill", fillStyleFn).node(); + }, + update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) { + var $$ = this, + _element$node$getBBox = element.node().getBBox(), + width = _element$node$getBBox.width, + height = _element$node$getBBox.height, + xPosFn2 = function (d) { + return xPosFn(d) - width / 2; + }, + yPosFn2 = function (d) { + return yPosFn(d) - height / 2; + }, + mainCircles = element; + + if (withTransition) { + var transitionName = $$.getTransitionName(); + flow && (mainCircles = element.attr("x", xPosFn2)), mainCircles = element.transition(transitionName).attr("x", xPosFn2).attr("y", yPosFn2).transition(transitionName), selectedCircles.transition($$.getTransitionName()); + } else mainCircles = element.attr("x", xPosFn2).attr("y", yPosFn2); + + return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn); + } + }, + // 'circle' data point + circle: { + create: function create(element, cssClassFn, sizeFn, fillStyleFn) { + return element.append("circle").attr("class", cssClassFn).attr("r", sizeFn).style("fill", fillStyleFn).node(); + }, + update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) { + var $$ = this, + mainCircles = element; + + if ($$.hasType("bubble") && (mainCircles = mainCircles.attr("r", $$.pointR.bind($$))), withTransition) { + var transitionName = $$.getTransitionName(); + flow && (mainCircles = mainCircles.attr("cx", xPosFn)), mainCircles = element.attr("cx") ? mainCircles.transition(transitionName).attr("cx", xPosFn).attr("cy", yPosFn).transition(transitionName) : mainCircles.attr("cx", xPosFn).attr("cy", yPosFn), selectedCircles.transition($$.getTransitionName()); + } else mainCircles = mainCircles.attr("cx", xPosFn).attr("cy", yPosFn); + + return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn); + } + }, + // 'rectangle' data point + rectangle: { + create: function create(element, cssClassFn, sizeFn, fillStyleFn) { + var rectSizeFn = function (d) { + return sizeFn(d) * 2; + }; + + return element.append("rect").attr("class", cssClassFn).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node(); + }, + update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) { + var $$ = this, + r = $$.config.point_r, + rectXPosFn = function (d) { + return xPosFn(d) - r; + }, + rectYPosFn = function (d) { + return yPosFn(d) - r; + }, + mainCircles = element; + + if (withTransition) { + var transitionName = $$.getTransitionName(); + flow && (mainCircles = mainCircles.attr("x", rectXPosFn)), mainCircles = mainCircles.transition(transitionName).attr("x", rectXPosFn).attr("y", rectYPosFn).transition(transitionName), selectedCircles.transition($$.getTransitionName()); + } else mainCircles = mainCircles.attr("x", rectXPosFn).attr("y", rectYPosFn); + + return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn); + } + } +}); +// CONCATENATED MODULE: ./src/shape/radar.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +/** + * Get the position value + * @param {Boolean} isClockwise If the direction is clockwise + * @param {String} type Coordinate type 'x' or 'y' + * @param {Number} edge Number of edge + * @param {Number} pos The indexed position + * @param {Number} range + * @param {Number} ratio + * @return {number} + * @private + */ + +function getPosition(isClockwise, type, edge, pos, range, ratio) { + var index = isClockwise && pos > 0 ? edge - pos : pos, + r = 2 * Math.PI, + func = type === "x" ? Math.sin : Math.cos; + return range * (1 - ratio * func(index * r / edge)); +} // cache key + + +var radar_cacheKey = "$radarPoints"; +extend(ChartInternal_ChartInternal.prototype, { + initRadar: function initRadar() { + var $$ = this, + config = $$.config; + $$.hasType("radar") && ($$.radars = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartRadars), $$.radars.levels = $$.radars.append("g").attr("class", config_classes.levels), $$.radars.axes = $$.radars.append("g").attr("class", config_classes.axis), $$.radars.shapes = $$.radars.append("g").attr("class", config_classes.shapes), $$.maxValue = config.radar_axis_max || $$.getMinMaxData().max[0].value); + }, + getRadarSize: function getRadarSize() { + var $$ = this, + config = $$.config, + padding = config.axis_x_categories.length < 4 ? -20 : 10, + size = (Math.min($$.arcWidth, $$.arcHeight) - padding) / 2; + return [size, size]; + }, + updateTargetsForRadar: function updateTargetsForRadar(targets) { + var $$ = this, + config = $$.config; + isEmpty(config.axis_x_categories) && (config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) { + return v.values.length; + })))), $$.generateRadarPoints(); + }, + getRadarPosition: function getRadarPosition(type, index, range, ratio) { + var $$ = this, + config = $$.config, + _$$$getRadarSize = $$.getRadarSize(), + _$$$getRadarSize2 = slicedToArray_default()(_$$$getRadarSize, 2), + width = _$$$getRadarSize2[0], + height = _$$$getRadarSize2[1], + edge = config.axis_x_categories.length, + isClockwise = config.radar_direction_clockwise, + pos = toArray(type).map(function (v) { + return getPosition(isClockwise, v, edge, index, isDefined(range) ? range : type === "x" ? width : height, isNumber(ratio) ? ratio : config.radar_size_ratio); + }); + + return pos.length === 1 ? pos[0] : pos; + }, + + /** + * Generate data points + * @private + */ + generateRadarPoints: function generateRadarPoints() { + var $$ = this, + targets = $$.data.targets, + _$$$getRadarSize3 = $$.getRadarSize(), + _$$$getRadarSize4 = slicedToArray_default()(_$$$getRadarSize3, 2), + width = _$$$getRadarSize4[0], + height = _$$$getRadarSize4[1], + points = $$.getCache(radar_cacheKey) || {}, + size = points._size; + + size && (size.width === width || size.height === height) || (targets.forEach(function (d) { + points[d.id] = d.values.map(function (v, i) { + return $$.getRadarPosition(["x", "y"], i, undefined, $$.getRatio("radar", v)); + }); + }), points._size = { + width: width, + height: height + }, $$.addCache(radar_cacheKey, points)); + }, + redrawRadar: function redrawRadar(duration, durationForExit) { + var $$ = this, + translate = $$.getTranslate("radar"); + translate && ($$.radars.attr("transform", translate), $$.main.selectAll(".".concat(config_classes.circles)).attr("transform", translate), $$.main.select(".".concat(config_classes.chartTexts)).attr("transform", translate), $$.generateRadarPoints(), $$.updateRadarLevel(), $$.updateRadarAxes(), $$.updateRadarShape(duration, durationForExit)); + }, + generateGetRadarPoints: function generateGetRadarPoints() { + var $$ = this, + points = $$.getCache(radar_cacheKey); + return function (d, i) { + var point = points[d.id][i]; + return [point, point, point, point]; + }; + }, + updateRadarLevel: function updateRadarLevel() { + var $$ = this, + config = $$.config, + _$$$getRadarSize5 = $$.getRadarSize(), + _$$$getRadarSize6 = slicedToArray_default()(_$$$getRadarSize5, 2), + width = _$$$getRadarSize6[0], + height = _$$$getRadarSize6[1], + depth = config.radar_level_depth, + edge = config.axis_x_categories.length, + showText = config.radar_level_text_show, + radarLevels = $$.radars.levels, + levelData = getRange(0, depth), + radius = config.radar_size_ratio * Math.min(width, height), + levelRatio = levelData.map(function (l) { + return radius * ((l + 1) / depth); + }), + levelTextFormat = config.radar_level_text_format, + points = levelData.map(function (v) { + var range = levelRatio[v], + pos = getRange(0, edge).map(function (i) { + return $$.getRadarPosition(["x", "y"], i, range, 1).join(","); + }); + return pos.join(" "); + }), + level = radarLevels.selectAll(".".concat(config_classes.level)).data(levelData); + + level.exit().remove(); + var levelEnter = level.enter().append("g").attr("class", function (d, i) { + return "".concat(config_classes.level, " ").concat(config_classes.level, "-").concat(i); + }); + levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden"), showText && (radarLevels.select("text").empty() && radarLevels.append("text").attr("dx", "-.5em").attr("dy", "-.7em").style("text-anchor", "end").text(function () { + return levelTextFormat(0); + }), levelEnter.append("text").attr("dx", "-.5em").style("text-anchor", "end").text(function (d) { + return levelTextFormat($$.maxValue / levelData.length * (d + 1)); + })), levelEnter.merge(level).attr("transform", function (d) { + return "translate(".concat(width - levelRatio[d], ", ").concat(height - levelRatio[d], ")"); + }).selectAll("polygon").attr("points", function (d) { + return points[d]; + }), showText && radarLevels.selectAll("text").attr("x", function (d) { + return isUndefined(d) ? width : points[d].split(",")[0]; + }).attr("y", function (d) { + return isUndefined(d) ? height : 0; + }); + }, + updateRadarAxes: function updateRadarAxes() { + var $$ = this, + config = $$.config, + _$$$getRadarSize7 = $$.getRadarSize(), + _$$$getRadarSize8 = slicedToArray_default()(_$$$getRadarSize7, 2), + width = _$$$getRadarSize8[0], + height = _$$$getRadarSize8[1], + categories = config.axis_x_categories, + axis = $$.radars.axes.selectAll("g").data(categories); + + axis.exit().remove(); + var axisEnter = axis.enter().append("g").attr("class", function (d, i) { + return "".concat(config_classes.axis, "-").concat(i); + }); + config.radar_axis_line_show && axisEnter.append("line"), config.radar_axis_text_show && axisEnter.append("text"), axis = axisEnter.merge(axis), config.radar_axis_line_show && axis.select("line").attr("x1", width).attr("y1", height).attr("x2", function (d, i) { + return $$.getRadarPosition("x", i); + }).attr("y2", function (d, i) { + return $$.getRadarPosition("y", i); + }), config.radar_axis_text_show && axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").text(function (d) { + return d; + }).datum(function (d, i) { + return { + index: i + }; + }).attr("x", function (d, i) { + return $$.getRadarPosition("x", i, undefined, 1); + }).attr("y", function (d, i) { + return $$.getRadarPosition("y", i, undefined, 1); + }), $$.bindEvent(); + }, + bindEvent: function bindEvent() { + var _this = this, + $$ = this, + config = $$.config; + + if (config.interaction_enabled) { + var isMouse = $$.inputType === "mouse", + getIndex = function () { + var d = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].target).datum(); + return d && Object.keys(d).length === 1 ? d.index : undefined; + }, + hide = function () { + var index = getIndex(), + noIndex = isUndefined(index); + (isMouse || noIndex) && (_this.hideTooltip(), _this.unexpandCircles(), isMouse ? $$.setOverOut(!1, index) : noIndex && $$.callOverOutForTouch()); + }; + + $$.radars.select(".".concat(config_classes.axis)).on(isMouse ? "mouseover " : "touchstart", function () { + if (!$$.transiting) // skip while transiting + { + var index = getIndex(); + $$.selectRectForSingle($$.svg.node(), null, index), isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index); + } + }).on("mouseout", isMouse ? hide : null), isMouse || $$.svg.on("touchstart", hide); + } + }, + updateRadarShape: function updateRadarShape(duration, durationForExit) { + var $$ = this, + targets = $$.data.targets, + points = $$.getCache(radar_cacheKey), + areas = $$.radars.shapes.selectAll("polygon").data(targets), + areasEnter = areas.enter().append("g").attr("class", $$.classChartRadar.bind($$)); + areas.exit().transition().duration(durationForExit).remove(), areasEnter.append("polygon").merge(areas).transition().duration(duration).style("fill", function (d) { + return $$.color(d); + }).style("stroke", function (d) { + return $$.color(d); + }).attr("points", function (d) { + return points[d.id].join(" "); + }); + }, + + /** + * Get data point x coordinate + * @param {Object} d Data object + * @return {Number} + * @private + */ + radarCircleX: function radarCircleX(d) { + return this.getCache(radar_cacheKey)[d.id][d.index][0]; + }, + + /** + * Get data point y coordinate + * @param {Object} d Data object + * @return {Number} + * @private + */ + radarCircleY: function radarCircleY(d) { + return this.getCache(radar_cacheKey)[d.id][d.index][1]; + } +}); +// CONCATENATED MODULE: ./src/internals/text.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initializes the text + * @private + */ + initText: function initText() { + var $$ = this; + $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartTexts), $$.mainText = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]); + }, + + /** + * Update chartText + * @private + * @param {Object} $$.data.targets + */ + updateTargetsForText: function updateTargetsForText(targets) { + var $$ = this, + classChartText = $$.classChartText.bind($$), + classTexts = $$.classTexts.bind($$), + classFocus = $$.classFocus.bind($$), + mainTextUpdate = $$.main.select(".".concat(config_classes.chartTexts)).selectAll(".".concat(config_classes.chartText)).data(targets).attr("class", function (d) { + return classChartText(d) + classFocus(d); + }), + mainTextEnter = mainTextUpdate.enter().append("g").attr("class", classChartText).style("opacity", "0").style("pointer-events", "none"); + mainTextEnter.append("g").attr("class", classTexts); + }, + + /** + * Update text + * @private + * @param {Number} Fade-out transition duration + */ + updateText: function updateText(durationForExit) { + var _this = this, + $$ = this, + config = $$.config, + dataFn = $$.labelishData.bind($$), + classText = $$.classText.bind($$); + + $$.mainText = $$.main.selectAll(".".concat(config_classes.texts)).selectAll(".".concat(config_classes.text)).data(function (d) { + return _this.isRadarType(d) ? d.values : dataFn(d); + }), $$.mainText.exit().transition().duration(durationForExit).style("fill-opacity", "0").remove(), $$.mainText = $$.mainText.enter().append("text").merge($$.mainText).attr("class", classText).attr("text-anchor", function (d) { + return config.axis_rotated ? d.value < 0 ? "end" : "start" : "middle"; + }).style("stroke", "none").style("fill", function (d) { + return $$.color(d); + }).style("fill-opacity", "0").text(function (d, i, j) { + return $$.dataLabelFormat(d.id)(d.value, d.id, i, j); + }); + }, + + /** + * Redraw chartText + * @private + * @param {Number} x Attribute + * @param {Number} y Attribute + * @param {Object} options.flow + * @param {Boolean} indicates transition is enabled + * @returns {Object} $$.mainText + */ + redrawText: function redrawText(xForText, yForText, forFlow, withTransition) { + var $$ = this, + t = getRandom(), + opacityForText = forFlow ? 0 : $$.opacityForText.bind($$); + return [this.mainText.each(function () { + var text = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this); // do not apply transition for newly added text elements + + (withTransition && text.attr("x") ? text.transition(t) : text).attr("x", xForText).attr("y", yForText).style("fill", $$.color).style("fill-opacity", opacityForText); + })]; + }, + + /** + * Gets the getBoundingClientRect value of the element + * @private + * @param {HTMLElement|d3.selection} element + * @param {String} className + * @returns {Object} value of element.getBoundingClientRect() + */ + getTextRect: function getTextRect(element, className) { + var $$ = this, + base = element.node ? element.node() : element; + /text/i.test(base.tagName) || (base = base.querySelector("text")); + var text = base.textContent, + cacheKey = "$".concat(text.replace(/\W/g, "_")), + rect = $$.getCache(cacheKey); + return rect || ($$.svg.append("text").style("visibility", "hidden").style("font", Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(base).style("font")).classed(className, !0).text(text).call(function (v) { + rect = v.node().getBoundingClientRect(); + }).remove(), $$.addCache(cacheKey, rect)), rect; + }, + + /** + * Gets the x or y coordinate of the text + * @param {Object} indices Indices values + * @param {Boolean} forX whether or not to x + * @returns {Number} coordinates + * @private + */ + generateXYForText: function generateXYForText(indices, forX) { + var $$ = this, + points = {}, + getter = forX ? $$.getXForText : $$.getYForText; + return Object.keys(indices).concat("radar").forEach(function (v) { + points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], !1); + }), function (d, i) { + var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isRadarType(d) && "radar" || "line"; + return getter.call($$, points[type](d, i), d, this); + }; + }, + + /** + * Gets the x coordinate of the text + * @private + * @param {Object} points + * @param {Object} data + * @param {HTMLElement} element + * @returns {Number} x coordinate + */ + getXForText: function getXForText(points, d, textElement) { + var xPos, + padding, + $$ = this, + config = $$.config; + return config.axis_rotated ? (padding = $$.isBarType(d) ? 4 : 6, xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1)) : xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : points[0][0], d.value === null && (xPos > $$.width ? xPos = $$.width - textElement.getBoundingClientRect().width : xPos < 0 && (xPos = 4)), xPos + (config.data_labels_position.x || 0); + }, + + /** + * Gets the y coordinate of the text + * @private + * @param {Object} points + * @param {Object} data + * @param {HTMLElement} element + * @returns {Number} y coordinate + */ + getYForText: function getYForText(points, d, textElement) { + var yPos, + $$ = this, + config = $$.config, + r = config.point_r, + baseY = 3; + if (config.axis_rotated) yPos = (points[0][0] + points[2][0] + textElement.getBoundingClientRect().height * .6) / 2;else if (yPos = points[2][1], isNumber(r) && r > 5 && ($$.isLineType(d) || $$.isScatterType(d)) && (baseY += config.point_r / 2.3), d.value < 0 || d.value === 0 && !$$.hasPositiveValue) yPos += textElement.getBoundingClientRect().height, $$.isBarType(d) && $$.isSafari() ? yPos -= baseY : !$$.isBarType(d) && $$.isChrome() && (yPos += baseY);else { + var diff = -baseY * 2; + $$.isBarType(d) ? diff = -baseY : $$.isBubbleType(d) && (diff = baseY), yPos += diff; + } // show labels regardless of the domain if value is null + + if (d.value === null && !config.axis_rotated) { + var boxHeight = textElement.getBoundingClientRect().height; + yPos < boxHeight ? yPos = boxHeight : yPos > this.height && (yPos = this.height - 4); + } + + return yPos + (config.data_labels_position.y || 0); + } +}); +// CONCATENATED MODULE: ./src/internals/type.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + // defined chart types as category + +var TYPES = { + Area: ["area", "area-spline", "area-spline-range", "area-line-range", "area-step"], + AreaRange: ["area-spline-range", "area-line-range"], + Arc: ["pie", "donut", "gauge", "radar"], + Line: ["line", "spline", "area", "area-spline", "area-spline-range", "area-line-range", "step", "area-step"], + Step: ["step", "area-step"], + Spline: ["spline", "area-spline", "area-spline-range"] +}; +extend(ChartInternal_ChartInternal.prototype, { + setTargetType: function setTargetType(targetIds, type) { + var $$ = this, + config = $$.config; + $$.mapToTargetIds(targetIds).forEach(function (id) { + $$.withoutFadeIn[id] = type === config.data_types[id], config.data_types[id] = type; + }), targetIds || (config.data_type = type); + }, + hasType: function hasType(type, targetsValue) { + var $$ = this, + types = $$.config.data_types, + targets = targetsValue || $$.data.targets, + has = !1; + return targets && targets.length ? targets.forEach(function (target) { + var t = types[target.id]; + (t && t.indexOf(type) >= 0 || !t && type === "line") && (has = !0); + }) : Object.keys(types).length ? Object.keys(types).forEach(function (id) { + types[id] === type && (has = !0); + }) : has = $$.config.data_type === type, has; + }, + + /** + * Check if contains given chart types + * @parma {String} type Type key + * @param {Object} targets + * @param {Array} exclude Excluded types + * @return {boolean} + * @private + */ + hasTypeOf: function hasTypeOf(type, targets) { + var _this = this, + exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + return !TYPES[type].filter(function (v) { + return exclude.indexOf(v) === -1; + }).every(function (v) { + return !_this.hasType(v, targets); + }); + }, + + /** + * Check if given data is certain chart type + * @param {Object} d Data object + * @param {String} type chart type + * @return {Boolean} + * @private + */ + isTypeOf: function isTypeOf(d, type) { + var id = isString(d) ? d : d.id, + dataType = this.config.data_types[id]; + return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type; + }, + + /** + * Check if contains arc types chart + * @param {Object} targets + * @param {Array} exclude Excluded types + * @return {boolean} + * @private + */ + hasArcType: function hasArcType(targets, exclude) { + return this.hasTypeOf("Arc", targets, exclude); + }, + isLineType: function isLineType(d) { + var id = isString(d) ? d : d.id; + return !this.config.data_types[id] || this.isTypeOf(id, TYPES.Line); + }, + isStepType: function isStepType(d) { + return this.isTypeOf(d, TYPES.Step); + }, + isSplineType: function isSplineType(d) { + return this.isTypeOf(d, TYPES.Spline); + }, + isAreaType: function isAreaType(d) { + return this.isTypeOf(d, TYPES.Area); + }, + isAreaRangeType: function isAreaRangeType(d) { + return this.isTypeOf(d, TYPES.AreaRange); + }, + isBarType: function isBarType(d) { + return this.isTypeOf(d, "bar"); + }, + isBubbleType: function isBubbleType(d) { + return this.isTypeOf(d, "bubble"); + }, + isScatterType: function isScatterType(d) { + return this.isTypeOf(d, "scatter"); + }, + isPieType: function isPieType(d) { + return this.isTypeOf(d, "pie"); + }, + isGaugeType: function isGaugeType(d) { + return this.isTypeOf(d, "gauge"); + }, + isDonutType: function isDonutType(d) { + return this.isTypeOf(d, "donut"); + }, + isRadarType: function isRadarType(d) { + return this.isTypeOf(d, "radar"); + }, + isArcType: function isArcType(d) { + return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d); + }, + // determine if is 'circle' data point + isCirclePoint: function isCirclePoint() { + var config = this.config, + pattern = config.point_pattern; + return config.point_type === "circle" && (!pattern || isArray(pattern) && pattern.length === 0); + }, + lineData: function lineData(d) { + return this.isLineType(d) ? [d] : []; + }, + arcData: function arcData(d) { + return this.isArcType(d.data) ? [d] : []; + }, + barData: function barData(d) { + return this.isBarType(d) ? d.values : []; + }, + + /** + * Get data adapt for data label showing + * @param {Object} d Data object + * @return {Array} + * @private + */ + labelishData: function labelishData(d) { + return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isRadarType(d) ? d.values : []; + }, + barLineBubbleData: function barLineBubbleData(d) { + return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : []; + }, + // https://github.com/d3/d3-shape#curves + isInterpolationType: function isInterpolationType(type) { + return ["basis", "basis-closed", "basis-open", "bundle", "cardinal", "cardinal-closed", "cardinal-open", "catmull-rom", "catmull-rom-closed", "catmull-rom-open", "linear", "linear-closed", "monotone-x", "monotone-y", "natural"].indexOf(type) >= 0; + } +}); +// CONCATENATED MODULE: ./src/internals/grid.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + // Grid position and text anchor helpers + +var getGridTextAnchor = function (d) { + return isValue(d.position) || "end"; +}, + getGridTextDx = function (d) { + return d.position === "start" ? 4 : d.position === "middle" ? 0 : -4; +}, + getGridTextX = function (isX, width, height) { + return function (d) { + var x = isX ? 0 : width; + return d.position === "start" ? x = isX ? -height : 0 : d.position === "middle" && (x = (isX ? -height : width) / 2), x; + }; +}; + +extend(ChartInternal_ChartInternal.prototype, { + initGrid: function initGrid() { + var $$ = this; + $$.xgrid = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), $$.initGridLines(), $$.initXYFocusGrid(); + }, + initGridLines: function initGridLines() { + var $$ = this, + config = $$.config; + (config.grid_x_lines.length || config.grid_y_lines.length) && ($$.gridLines = $$.main.insert("g", ".".concat(config_classes.chart).concat(config.grid_lines_front ? " + *" : "")).attr("clip-path", $$.clipPathForGrid).attr("class", "".concat(config_classes.grid, " ").concat(config_classes.gridLines)), $$.gridLines.append("g").attr("class", config_classes.xgridLines), $$.gridLines.append("g").attr("class", config_classes.ygridLines), $$.xgridLines = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([])); + }, + updateXGrid: function updateXGrid(withoutUpdate) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + xgridData = $$.generateGridData(config.grid_x_type, $$.x), + tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0, + pos = function (d) { + return $$.x(d) + (tickOffset * isRotated ? -1 : 1); + }; + + $$.xgridAttr = isRotated ? { + "x1": 0, + "x2": $$.width, + "y1": pos, + "y2": pos + } : { + "x1": pos, + "x2": pos, + "y1": 0, + "y2": $$.height + }, $$.xgrid = $$.main.select(".".concat(config_classes.xgrids)).selectAll(".".concat(config_classes.xgrid)).data(xgridData), $$.xgrid.exit().remove(), $$.xgrid = $$.xgrid.enter().append("line").attr("class", config_classes.xgrid).merge($$.xgrid), withoutUpdate || $$.xgrid.each(function () { + var grid = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this); + Object.keys($$.xgridAttr).forEach(function (id) { + grid.attr(id, $$.xgridAttr[id]).style("opacity", function () { + return grid.attr(isRotated ? "y1" : "x1") === (isRotated ? $$.height : 0) ? "0" : "1"; + }); + }); + }); + }, + updateYGrid: function updateYGrid() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks); + $$.ygrid = $$.main.select(".".concat(config_classes.ygrids)).selectAll(".".concat(config_classes.ygrid)).data(gridValues), $$.ygrid.exit().remove(), $$.ygrid = $$.ygrid.enter().append("line").attr("class", config_classes.ygrid).merge($$.ygrid), $$.ygrid.attr("x1", isRotated ? $$.y : 0).attr("x2", isRotated ? $$.y : $$.width).attr("y1", isRotated ? 0 : $$.y).attr("y2", isRotated ? $$.height : $$.y), $$.smoothLines($$.ygrid, "grid"); + }, + updateGrid: function updateGrid(duration) { + var $$ = this; + // hide if arc type + $$.gridLines || $$.initGridLines(), $$.grid.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.main.select("line.".concat(config_classes.xgridFocus)).style("visibility", "hidden"), $$.updateXGridLines(duration), $$.updateYGridLines(duration); + }, + + /** + * Update X Grid lines + * @param {Number} duration + * @private + */ + updateXGridLines: function updateXGridLines(duration) { + var $$ = this, + main = $$.main, + config = $$.config, + isRotated = config.axis_rotated; + config.grid_x_show && $$.updateXGrid(), $$.xgridLines = main.select(".".concat(config_classes.xgridLines)).selectAll(".".concat(config_classes.xgridLine)).data(config.grid_x_lines), $$.xgridLines.exit().transition().duration(duration).style("opacity", "0").remove(); + // enter + var xgridLine = $$.xgridLines.enter().append("g"); + xgridLine.append("line").style("opacity", "0"), xgridLine.append("text").attr("transform", isRotated ? "" : "rotate(-90)").attr("dy", -5).style("opacity", "0"), $$.xgridLines = xgridLine.merge($$.xgridLines), $$.xgridLines.attr("class", function (d) { + return "".concat(config_classes.xgridLine, " ").concat(d.class || "").trim(); + }).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).text(function (d) { + return d.text; + }).transition().style("opacity", "1"); + }, + + /** + * Update Y Grid lines + * @param {Number} duration + * @private + */ + updateYGridLines: function updateYGridLines(duration) { + var $$ = this, + main = $$.main, + config = $$.config, + isRotated = config.axis_rotated; + config.grid_y_show && $$.updateYGrid(), $$.ygridLines = main.select(".".concat(config_classes.ygridLines)).selectAll(".".concat(config_classes.ygridLine)).data(config.grid_y_lines), $$.ygridLines.exit().transition().duration(duration).style("opacity", "0").remove(); + // enter + var ygridLine = $$.ygridLines.enter().append("g"); + ygridLine.append("line").style("opacity", "0"), ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"), $$.ygridLines = ygridLine.merge($$.ygridLines); + // update + var yv = $$.yv.bind($$); + $$.ygridLines.attr("class", function (d) { + return "".concat(config_classes.ygridLine, " ").concat(d.class || "").trim(); + }).select("line").transition().duration(duration).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : $$.width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? $$.height : yv).transition().style("opacity", "1"), $$.ygridLines.select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).attr("dy", -5).attr("x", getGridTextX(isRotated, $$.width, $$.height)).attr("y", yv).text(function (d) { + return d.text; + }).transition().style("opacity", "1"); + }, + redrawGrid: function redrawGrid(withTransition) { + var $$ = this, + isRotated = $$.config.axis_rotated, + xv = $$.xv.bind($$), + lines = $$.xgridLines.select("line"), + texts = $$.xgridLines.select("text"); + return lines = (withTransition ? lines.transition() : lines).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? $$.width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : $$.height), texts = (withTransition ? texts.transition() : texts).attr("x", getGridTextX(!isRotated, $$.width, $$.height)).attr("y", xv).text(function (d) { + return d.text; + }), [(withTransition ? lines.transition() : lines).style("opacity", "1"), (withTransition ? texts.transition() : texts).style("opacity", "1")]; + }, + initXYFocusGrid: function initXYFocusGrid() { + var $$ = this, + config = $$.config, + isFront = config.grid_front, + className = ".".concat(config_classes[isFront && $$.gridLines ? "gridLines" : "chart"]).concat(isFront ? " + *" : ""); + $$.grid = $$.main.insert("g", className).attr("clip-path", $$.clipPathForGrid).attr("class", config_classes.grid), config.grid_x_show && $$.grid.append("g").attr("class", config_classes.xgrids), config.grid_y_show && $$.grid.append("g").attr("class", config_classes.ygrids), config.grid_focus_show && $$.grid.append("g").attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus); + }, + showXGridFocus: function showXGridFocus(selectedData) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + dataToShow = selectedData.filter(function (d) { + return d && isValue($$.getBaseValue(d)); + }), + focusEl = $$.main.selectAll("line.".concat(config_classes.xgridFocus)), + xx = $$.xx.bind($$); + !config.tooltip_show || $$.hasType("bubble") || $$.hasType("scatter") || $$.hasArcType() || (focusEl.style("visibility", "visible").data([dataToShow[0]]).attr(isRotated ? "y1" : "x1", xx).attr(isRotated ? "y2" : "x2", xx), $$.smoothLines(focusEl, "grid")); // Hide when bubble/scatter plot exists + }, + hideXGridFocus: function hideXGridFocus() { + this.main.select("line.".concat(config_classes.xgridFocus)).style("visibility", "hidden"); + }, + updateXgridFocus: function updateXgridFocus() { + var $$ = this, + isRotated = $$.config.axis_rotated; + $$.main.select("line.".concat(config_classes.xgridFocus)).attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? $$.width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : $$.height); + }, + generateGridData: function generateGridData(type, scale) { + var $$ = this, + tickNum = $$.main.select(".".concat(config_classes.axisX)).selectAll(".tick").size(), + gridData = []; + + if (type === "year") { + var xDomain = $$.getXDomain(), + firstYear = xDomain[0].getFullYear(), + lastYear = xDomain[1].getFullYear(); + + for (var i = firstYear; i <= lastYear; i++) gridData.push(new Date("".concat(i, "-01-01 00:00:00"))); + } else gridData = scale.ticks(10), gridData.length > tickNum && (gridData = gridData.filter(function (d) { + return (d + "").indexOf(".") < 0; + })); + + return gridData; + }, + getGridFilterToRemove: function getGridFilterToRemove(params) { + return params ? function (line) { + var found = !1; + return (isArray(params) ? params.concat() : [params]).forEach(function (param) { + ("value" in param && line.value === param.value || "class" in param && line.class === param.class) && (found = !0); + }), found; + } : function () { + return !0; + }; + }, + removeGridLines: function removeGridLines(params, forX) { + var $$ = this, + config = $$.config, + toRemove = $$.getGridFilterToRemove(params), + classLines = forX ? config_classes.xgridLines : config_classes.ygridLines, + classLine = forX ? config_classes.xgridLine : config_classes.ygridLine; + $$.main.select(".".concat(classLines)).selectAll(".".concat(classLine)).filter(toRemove).transition().duration(config.transition_duration).style("opacity", "0").remove(); + var gridLines = "grid_".concat(forX ? "x" : "y", "_lines"); + config[gridLines] = config[gridLines].filter(function toShow(line) { + return !toRemove(line); + }); + } +}); +// CONCATENATED MODULE: ./src/internals/tooltip.js + + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initializes the tooltip + * @private + */ + initTooltip: function initTooltip() { + var $$ = this, + config = $$.config; + + // Show tooltip if needed + if ($$.tooltip = $$.selectChart.style("position", "relative").append("div").attr("class", config_classes.tooltipContainer).style("position", "absolute").style("pointer-events", "none").style("display", "none"), config.tooltip_init_show) { + if ($$.isTimeSeries() && isString(config.tooltip_init_x)) { + var i, + val, + targets = $$.data.targets[0]; + + for (config.tooltip_init_x = $$.parseDate(config.tooltip_init_x), i = 0; (val = targets.values[i]) && val.x - config.tooltip_init_x !== 0; i++); + + config.tooltip_init_x = i; + } + + $$.tooltip.html(config.tooltip_contents.call($$, $$.data.targets.map(function (d) { + return $$.addName(d.values[config.tooltip_init_x]); + }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType(null, ["radar"])), $$.color)), $$.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", "block"); + } + }, + + /** + * Returns the tooltip content(HTML string) + * @param {Object} d data + * @param {Function} defaultTitleFormat Default title format + * @param {Function} defaultValueFormat Default format for each data value in the tooltip. + * @param {Function} color Color function + * @returns {String} html + * @private + */ + getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) { + var $$ = this, + config = $$.config, + titleFormat = config.tooltip_format_title || defaultTitleFormat, + nameFormat = config.tooltip_format_name || function (name) { + return name; + }, + valueFormat = config.tooltip_format_value || ($$.isStackNormalized() ? function (v, ratio) { + return "".concat((ratio * 100).toFixed(2), "%"); + } : defaultValueFormat), + order = config.tooltip_order, + getRowValue = function (row) { + return $$.getBaseValue(row); + }, + getBgColor = $$.levelColor ? function (row) { + return $$.levelColor(row.value); + } : function (row) { + return color(row.id); + }; + + if (order === null && config.data_groups.length) { + // for stacked data, order should aligned with the visually displayed data + var ids = $$.orderTargets($$.data.targets).map(function (i2) { + return i2.id; + }).reverse(); + d.sort(function (a, b) { + var v1 = a ? a.value : null, + v2 = b ? b.value : null; + return v1 > 0 && v2 > 0 && (v1 = a.id ? ids.indexOf(a.id) : null, v2 = b.id ? ids.indexOf(b.id) : null), v1 - v2; + }); + } else if (/^(asc|desc)$/.test(order)) { + d.sort(function (a, b) { + var v1 = a ? getRowValue(a) : null, + v2 = b ? getRowValue(b) : null; + return order === "asc" ? v1 - v2 : v2 - v1; + }); + } else isFunction(order) && d.sort(order); + + var text, row, param, value; + + for (var i = 0, len = d.length; i < len; i++) if ((row = d[i]) && (getRowValue(row) || getRowValue(row) === 0)) { + if (!text) { + var title = sanitise(titleFormat ? titleFormat(row.x) : row.x); + text = "").concat(isValue(title) ? "") : ""); + } + + if (param = [row.ratio, row.id, row.index, d], value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(toConsumableArray_default()(param)))), $$.isAreaRangeType(row)) { + var _map = ["high", "low"].map(function (v) { + return sanitise(valueFormat.apply(void 0, [$$.getAreaRangeData(row, v)].concat(toConsumableArray_default()(param)))); + }), + _map2 = slicedToArray_default()(_map, 2), + high = _map2[0], + low = _map2[1]; + + value = "Mid: ".concat(value, " High: ").concat(high, " Low: ").concat(low); + } + + if (value !== undefined) { + // Skip elements when their name is set to null + if (row.name === null) continue; + var name = sanitise(nameFormat.apply(void 0, [row.name].concat(toConsumableArray_default()(param)))), + bgcolor = getBgColor(row); + text += ""); + } + } + + return "".concat(text, "
    ".concat(title, "
    "), text += $$.patterns ? "") : ""), text += "".concat(name, "").concat(value, "
    "); + }, + + /** + * Returns the position of the tooltip + * @param {Object} dataToShow data + * @param {String} tWidth Width value of tooltip element + * @param {String} tHeight Height value of tooltip element + * @param {HTMLElement} element + * @returns {Object} top, left value + * @private + */ + tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) { + var $$ = this, + config = $$.config, + _d3Mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(element), + _d3Mouse2 = slicedToArray_default()(_d3Mouse, 2), + left = _d3Mouse2[0], + top = _d3Mouse2[1], + svgLeft = $$.getSvgLeft(!0), + chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight(); + + // Determine tooltip position + if (top += 20, $$.hasArcType()) { + var raw = $$.inputType === "touch" || $$.hasType("radar"); + raw || (top += $$.height / 2, left += ($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2); + } else { + var dataScale = $$.x(dataToShow[0].x); + config.axis_rotated ? (top = dataScale + 20, left += svgLeft + 100, chartRight -= svgLeft) : (top -= 5, left = svgLeft + $$.getCurrentPaddingLeft(!0) + 20 + ($$.zoomScale ? left : dataScale)); + } + + var right = left + tWidth; + return right > chartRight && (left = left - tWidth - 50), top + tHeight > $$.currentHeight && (top -= tHeight + 30), top < 0 && (top = 0), left < 0 && (left = 0), { + top: top, + left: left + }; + }, + + /** + * Show the tooltip + * @private + * @param {Object} selectedData + * @param {HTMLElement} element + */ + showTooltip: function showTooltip(selectedData, element) { + var $$ = this, + config = $$.config, + forArc = $$.hasArcType(null, ["radar"]), + dataToShow = selectedData.filter(function (d) { + return d && isValue($$.getBaseValue(d)); + }), + positionFunction = config.tooltip_position || $$.tooltipPosition; + + if (dataToShow.length !== 0 && config.tooltip_show) { + var datum = $$.tooltip.datum(), + dataStr = JSON.stringify(selectedData), + width = datum && datum.width || 0, + height = datum && datum.height || 0; + + if (!datum || datum.current !== dataStr) { + var index = selectedData.concat().sort()[0].index, + html = config.tooltip_contents.call($$, selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color); + callFn(config.tooltip_onshow, $$), $$.tooltip.html(html).style("display", "block").datum({ + index: index, + current: dataStr, + width: width = $$.tooltip.property("offsetWidth"), + height: height = $$.tooltip.property("offsetHeight") + }), callFn(config.tooltip_onshown, $$), $$._handleLinkedCharts(!0, index); + } // Get tooltip dimensions + + + var position = positionFunction.call(this, dataToShow, width, height, element); // Set tooltip position + + $$.tooltip.style("top", "".concat(position.top, "px")).style("left", "".concat(position.left, "px")); + } + }, + + /** + * Hide the tooltip + * @private + */ + hideTooltip: function hideTooltip() { + var $$ = this, + config = $$.config; + // hide tooltip + callFn(config.tooltip_onhide, $$), this.tooltip.style("display", "none").datum(null), callFn(config.tooltip_onhidden, $$); + }, + + /** + * Toggle display for linked chart instances + * @param {Boolean} show true: show, false: hide + * @param {Number} index x Axis index + * @private + */ + _handleLinkedCharts: function _handleLinkedCharts(show, index) { + var $$ = this; + + if ($$.config.tooltip_linked) { + var linkedName = $$.config.tooltip_linked_name; + ($$.api.internal.charts || []).forEach(function (c) { + if (c !== $$.api) { + var _config = c.internal.config, + isLinked = _config.tooltip_linked, + name = _config.tooltip_linked_name, + isInDom = document.body.contains(c.element); + + if (isLinked && linkedName === name && isInDom) { + var data = c.internal.tooltip.data()[0], + isNotSameIndex = index !== (data && data.index); + + // prevent throwing error for non-paired linked indexes + try { + show && isNotSameIndex ? c.tooltip.show({ + index: index + }) : !show && c.tooltip.hide(); + } catch (e) {} + } + } + }); + } + } +}); +// CONCATENATED MODULE: ./src/internals/legend.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initialize the legend. + * @private + */ + initLegend: function initLegend() { + var $$ = this, + config = $$.config; + $$.legendItemTextBox = {}, $$.legendHasRendered = !1, $$.legend = $$.svg.append("g"), config.legend_show ? ($$.legend.attr("transform", $$.getTranslate("legend")), $$.updateLegend()) : ($$.legend.style("visibility", "hidden"), $$.hiddenLegendIds = $$.mapToIds($$.data.targets)); + }, + + /** + * Update legend element + * @param {Array} targetIds ID's of target + * @param {Object} options withTransform : Whether to use the transform property / withTransitionForTransform: Whether transition is used when using the transform property / withTransition : whether or not to transition. + * @param {Object} transitions Return value of the generateTransitions + * @private + */ + updateLegend: function updateLegend(targetIds, options, transitions) { + var $$ = this, + config = $$.config, + optionz = options || { + withTransform: !1, + withTransitionForTransform: !1, + withTransition: !1 + }; + // Update size and scale + // Update g positions + optionz.withTransition = getOption(optionz, "withTransition", !0), optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0), config.legend_contents_bindto && config.legend_contents_template ? $$.updateLegendTemplate() : $$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions), $$.updateSizes(), $$.updateScales(!optionz.withTransition), $$.updateSvgSize(), $$.transformAll(optionz.withTransitionForTransform, transitions), $$.legendHasRendered = !0; + }, + + /** + * Update legend using template option + * @private + */ + updateLegendTemplate: function updateLegendTemplate() { + var $$ = this, + config = $$.config, + wrapper = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(config.legend_contents_bindto), + template = config.legend_contents_template; + + if (!wrapper.empty()) { + var targets = $$.data.targets, + ids = [], + html = ""; + $$.mapToIds(targets).forEach(function (v) { + var content = isFunction(template) ? template.call($$, v, $$.color(v), $$.api.data(v)[0].values) : template.replace(/{=COLOR}/g, $$.color(v)).replace(/{=TITLE}/g, v); + content && (ids.push(v), html += content); + }); + var legendItem = wrapper.html(html).selectAll(function () { + return this.childNodes; + }).data(ids); + $$.setLegendItem(legendItem); + } + }, + + /** + * Update the size of the legend. + * @private + * @param {Obejct} size S + */ + updateSizeForLegend: function updateSizeForLegend(size) { + var $$ = this, + config = $$.config, + width = size.width, + height = size.height, + insetLegendPosition = { + top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - height - $$.getCurrentPaddingBottom() - config.legend_inset_y, + left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : $$.currentWidth - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5 + }; + $$.margin3 = { + top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - height, + right: NaN, + bottom: 0, + left: $$.isLegendRight ? $$.currentWidth - width : $$.isLegendInset ? insetLegendPosition.left : 0 + }; + }, + + /** + * Transform Legend + * @private + * @param {Boolean} whether or not to transition. + */ + transformLegend: function transformLegend(withTransition) { + var $$ = this; + (withTransition ? $$.legend.transition() : $$.legend).attr("transform", $$.getTranslate("legend")); + }, + + /** + * Update the legend step + * @private + * @param {Number} step + */ + updateLegendStep: function updateLegendStep(step) { + this.legendStep = step; + }, + + /** + * Update legend item width + * @private + * @param {Number} width + */ + updateLegendItemWidth: function updateLegendItemWidth(w) { + this.legendItemWidth = w; + }, + + /** + * Update legend item height + * @private + * @param {Number} height + */ + updateLegendItemHeight: function updateLegendItemHeight(h) { + this.legendItemHeight = h; + }, + + /** + * Get the width of the legend + * @private + * @return {Number} width + */ + getLegendWidth: function getLegendWidth() { + var $$ = this; + return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0; + }, + + /** + * Get the height of the legend + * @return {Number} height + * @private + */ + getLegendHeight: function getLegendHeight() { + var $$ = this; + return $$.config.legend_show ? $$.isLegendRight ? $$.currentHeight : Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1) : 0; + }, + + /** + * Get the opacity of the legend + * @private + * @param {Object} d3.Select + * @returns {Number} opacity + */ + opacityForLegend: function opacityForLegend(legendItem) { + return legendItem.classed(config_classes.legendItemHidden) ? null : "1"; + }, + + /** + * Get the opacity of the legend that is unfocused + * @private + * @param {Object} legendItem, d3.Select + * @returns {Number} opacity + */ + opacityForUnfocusedLegend: function opacityForUnfocusedLegend(legendItem) { + return legendItem.classed(config_classes.legendItemHidden) ? null : "0.3"; + }, + + /** + * Toggles the focus of the legend + * @private + * @param {Array} ID's of target + * @param {Boolean} whether or not to focus. + */ + toggleFocusLegend: function toggleFocusLegend(targetIds, focus) { + var $$ = this, + targetIdz = $$.mapToTargetIds(targetIds); + $$.legend.selectAll(".".concat(config_classes.legendItem)).filter(function (id) { + return targetIdz.indexOf(id) >= 0; + }).classed(config_classes.legendItemFocused, focus).transition().duration(100).style("opacity", function () { + var opacity = focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend; + return opacity.call($$, Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this)); + }); + }, + + /** + * Revert the legend to its default state + * @private + */ + revertLegend: function revertLegend() { + var $$ = this; + $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemFocused, !1).transition().duration(100).style("opacity", function () { + return $$.opacityForLegend(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this)); + }); + }, + + /** + * Shows the legend + * @private + * @param {Array} ID's of target + */ + showLegend: function showLegend(targetIds) { + var $$ = this, + config = $$.config; + config.legend_show || (config.legend_show = !0, $$.legend.style("visibility", "visible"), !$$.legendHasRendered && $$.updateLegend()), $$.removeHiddenLegendIds(targetIds), $$.legend.selectAll($$.selectorLegends(targetIds)).style("visibility", "visible").transition().style("opacity", function () { + return $$.opacityForLegend(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this)); + }); + }, + + /** + * Hide the legend + * @private + * @param {Array} ID's of target + */ + hideLegend: function hideLegend(targetIds) { + var $$ = this, + config = $$.config; + config.legend_show && isEmpty(targetIds) && (config.legend_show = !1, $$.legend.style("visibility", "hidden")), $$.addHiddenLegendIds(targetIds), $$.legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden"); + }, + + /** + * Clear the LegendItemTextBox cache. + * @private + */ + clearLegendItemTextBoxCache: function clearLegendItemTextBoxCache() { + this.legendItemTextBox = {}; + }, + + /** + * Set legend item style & bind events + * @private + * @param {d3.selection} item + */ + setLegendItem: function setLegendItem(item) { + var $$ = this, + config = $$.config, + isTouch = $$.inputType === "touch"; + item.attr("class", function (id) { + var node = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + itemClass = !node.empty() && node.attr("class") || ""; + return itemClass + $$.generateClass(config_classes.legendItem, id); + }).style("visibility", function (id) { + return $$.isLegendToShow(id) ? "visible" : "hidden"; + }).style("cursor", "pointer").on("click", function (id) { + callFn(config.legend_item_onclick, $$, id) || (external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].altKey ? ($$.api.hide(), $$.api.show(id)) : ($$.api.toggle(id), !isTouch && $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert())), isTouch && $$.hideTooltip(); + }), isTouch || item.on("mouseout", function (id) { + callFn(config.legend_item_onout, $$, id) || (Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused, !1), $$.api.revert()); + }).on("mouseover", function (id) { + callFn(config.legend_item_onover, $$, id) || (Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused, !0), !$$.transiting && $$.isTargetToShow(id) && $$.api.focus(id)); + }); + }, + + /** + * Update the legend + * @param {Array} targetIds ID's of target + * @param {Object} options withTransform : Whether to use the transform property / withTransitionForTransform: Whether transition is used when using the transform property / withTransition : whether or not to transition. + * @private + */ + updateLegendElement: function updateLegendElement(targetIds, options) { + var xForLegend, + yForLegend, + background, + $$ = this, + config = $$.config, + posMin = 10, + tileWidth = config.legend_item_tile_width + 5, + maxWidth = 0, + maxHeight = 0, + totalLength = 0, + offsets = {}, + widths = {}, + heights = {}, + margins = [0], + steps = {}, + step = 0, + isLegendRightOrInset = $$.isLegendRight || $$.isLegendInset, + targetIdz = targetIds.filter(function (id) { + return !isDefined(config.data_names[id]) || config.data_names[id] !== null; + }), + withTransition = options.withTransition, + getTextBox = function (textElement, id) { + return $$.legendItemTextBox[id] || ($$.legendItemTextBox[id] = $$.getTextRect(textElement, config_classes.legendItem)), $$.legendItemTextBox[id]; + }, + updatePositions = function (textElement, id, index) { + var margin, + isLast = index === targetIdz.length - 1, + box = getTextBox(textElement, id), + itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 : 10) + config.legend_padding, + itemHeight = box.height + 4, + itemLength = isLegendRightOrInset ? itemHeight : itemWidth, + areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(), + updateValues = function (id2, withoutStep) { + withoutStep || (margin = (areaLength - totalLength - itemLength) / 2, margin < posMin && (margin = (areaLength - itemLength) / 2, totalLength = 0, step++)), steps[id2] = step, margins[step] = $$.isLegendInset ? 10 : margin, offsets[id2] = totalLength, totalLength += itemLength; + }; + + if (index === 0 && (totalLength = 0, step = 0, maxWidth = 0, maxHeight = 0), config.legend_show && !$$.isLegendToShow(id)) return widths[id] = 0, heights[id] = 0, steps[id] = 0, void (offsets[id] = 0); + widths[id] = itemWidth, heights[id] = itemHeight, (!maxWidth || itemWidth >= maxWidth) && (maxWidth = itemWidth), (!maxHeight || itemHeight >= maxHeight) && (maxHeight = itemHeight); + var maxLength = isLegendRightOrInset ? maxHeight : maxWidth; + config.legend_equally ? (Object.keys(widths).forEach(function (id2) { + return widths[id2] = maxWidth; + }), Object.keys(heights).forEach(function (id2) { + return heights[id2] = maxHeight; + }), margin = (areaLength - maxLength * targetIdz.length) / 2, margin < posMin ? (totalLength = 0, step = 0, targetIdz.forEach(function (id2) { + return updateValues(id2); + })) : updateValues(id, !0)) : updateValues(id); + }; + + $$.isLegendInset && (step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length, $$.updateLegendStep(step)), $$.isLegendRight ? (xForLegend = function (id) { + return maxWidth * steps[id]; + }, yForLegend = function (id) { + return margins[steps[id]] + offsets[id]; + }) : $$.isLegendInset ? (xForLegend = function (id) { + return maxWidth * steps[id] + 10; + }, yForLegend = function (id) { + return margins[steps[id]] + offsets[id]; + }) : (xForLegend = function (id) { + return margins[steps[id]] + offsets[id]; + }, yForLegend = function (id) { + return maxHeight * steps[id]; + }); + + var xForLegendText = function (id, i) { + return xForLegend(id, i) + 4 + config.legend_item_tile_width; + }, + xForLegendRect = function (id, i) { + return xForLegend(id, i); + }, + x1ForLegendTile = function (id, i) { + return xForLegend(id, i) - 2; + }, + x2ForLegendTile = function (id, i) { + return xForLegend(id, i) - 2 + config.legend_item_tile_width; + }, + yForLegendText = function (id, i) { + return yForLegend(id, i) + 9; + }, + yForLegendRect = function (id, i) { + return yForLegend(id, i) - 5; + }, + yForLegendTile = function (id, i) { + return yForLegend(id, i) + 4; + }, + pos = -200, + l = $$.legend.selectAll(".".concat(config_classes.legendItem)).data(targetIdz).enter().append("g"); + + $$.setLegendItem(l), l.append("text").text(function (id) { + return isDefined(config.data_names[id]) ? config.data_names[id] : id; + }).each(function (id, i) { + updatePositions(this, id, i); + }).style("pointer-events", "none").attr("x", isLegendRightOrInset ? xForLegendText : pos).attr("y", isLegendRightOrInset ? pos : yForLegendText), l.append("rect").attr("class", config_classes.legendItemEvent).style("fill-opacity", "0").attr("x", isLegendRightOrInset ? xForLegendRect : pos).attr("y", isLegendRightOrInset ? pos : yForLegendRect); + var usePoint = $$.config.legend_usePoint; + + if (usePoint) { + var ids = []; + l.append(function (d) { + var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type]; + ids.indexOf(d) === -1 && ids.push(d); + var point = pattern[ids.indexOf(d) % pattern.length]; + return point === "rectangle" && (point = "rect"), document.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].svg, $$.hasValidPointType(point) ? point : "use"); + }).attr("class", config_classes.legendItemPoint).style("fill", function (d) { + return $$.color(d); + }).style("pointer-events", "none").attr("href", function (data, idx, selection) { + var node = selection[idx], + nodeName = node.nodeName.toLowerCase(); + return nodeName === "use" ? "#".concat($$.datetimeId, "-point-").concat(data) : undefined; + }); + } else l.append("line").attr("class", config_classes.legendItemTile).style("stroke", $$.color).style("pointer-events", "none").attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height); // Set background for inset legend + + + background = $$.legend.select(".".concat(config_classes.legendBackground, " rect")), $$.isLegendInset && maxWidth > 0 && background.size() === 0 && (background = $$.legend.insert("g", ".".concat(config_classes.legendItem)).attr("class", config_classes.legendBackground).append("rect")); + var texts = $$.legend.selectAll("text").data(targetIdz).text(function (id) { + return isDefined(config.data_names[id]) ? config.data_names[id] : id; + }) // MEMO: needed for update + .each(function (id, i) { + updatePositions(this, id, i); + }); + (withTransition ? texts.transition() : texts).attr("x", xForLegendText).attr("y", yForLegendText); + var rects = $$.legend.selectAll("rect.".concat(config_classes.legendItemEvent)).data(targetIdz); + + if ((withTransition ? rects.transition() : rects).attr("width", function (id) { + return widths[id]; + }).attr("height", function (id) { + return heights[id]; + }).attr("x", xForLegendRect).attr("y", yForLegendRect), usePoint) { + var tiles = $$.legend.selectAll(".".concat(config_classes.legendItemPoint)).data(targetIdz); + (withTransition ? tiles.transition() : tiles).each(function () { + var radius, + width, + height, + nodeName = this.nodeName.toLowerCase(), + pointR = $$.config.point_r, + x = "x", + y = "y", + xOffset = 2, + yOffset = 2.5; + + if (nodeName === "circle") { + var size = pointR * .2; + x = "cx", y = "cy", radius = pointR + size, xOffset = pointR * 2, yOffset = -size; + } else if (nodeName === "rect") { + var _size = pointR * 2.5; + + width = _size, height = _size, yOffset = 3; + } + + Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).attr(x, function (d) { + return x1ForLegendTile(d) + xOffset; + }).attr(y, function (d) { + return yForLegendTile(d) - yOffset; + }).attr("r", radius).attr("width", width).attr("height", height); + }); + } else { + var _tiles = $$.legend.selectAll("line.".concat(config_classes.legendItemTile)).data(targetIdz); + + (withTransition ? _tiles.transition() : _tiles).style("stroke", $$.color).attr("x1", x1ForLegendTile).attr("y1", yForLegendTile).attr("x2", x2ForLegendTile).attr("y2", yForLegendTile); + } + + background && (withTransition ? background.transition() : background).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10), $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemHidden, function (id) { + return !$$.isTargetToShow(id); + }), $$.updateLegendItemWidth(maxWidth), $$.updateLegendItemHeight(maxHeight), $$.updateLegendStep(step); + } +}); +// CONCATENATED MODULE: ./src/internals/title.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Get the text position + * @param {String} pos right, left or center + * @param {Number} width chart width + * @return {String|Number} text-anchor value or position in pixel + * @private + */ + +var getTextPos = function () { + var position, + pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "left", + width = arguments.length > 1 ? arguments[1] : undefined, + isNum = isNumber(width); + return position = pos.indexOf("center") > -1 ? isNum ? width / 2 : "middle" : pos.indexOf("right") > -1 ? isNum ? width : "end" : isNum ? 0 : "start", position; +}; + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initializes the title + * @private + */ + initTitle: function initTitle() { + var $$ = this; + + if ($$.config.title_text) { + $$.title = $$.svg.append("g"); + var text = $$.title.append("text").style("text-anchor", getTextPos($$.config.title_position)).attr("class", $$.CLASS.title); + $$.config.title_text.split("\n").forEach(function (v, i) { + text.append("tspan").attr("x", 0).attr("dy", "".concat(i ? "1.5" : ".3", "em")).text(v); + }); + } + }, + + /** + * Redraw title + * @private + */ + redrawTitle: function redrawTitle() { + var $$ = this; + + if ($$.title) { + var y = $$.yForTitle.call($$); + /g/i.test($$.title.node().tagName) ? $$.title.attr("transform", "translate(".concat(getTextPos($$.config.title_position, $$.currentWidth), ", ").concat(y, ")")) : $$.title.attr("x", $$.xForTitle.call($$)).attr("y", y); + } + }, + + /** + * Returns the x attribute value of the title + * @private + * @returns {Number} x attribute value + */ + xForTitle: function xForTitle() { + var x, + $$ = this, + config = $$.config, + position = config.title_position || "left"; + return /(right|center)/.test(position) ? (x = $$.currentWidth - $$.getTextRect($$.title, $$.CLASS.title).width, position.indexOf("right") >= 0 ? x -= config.title_padding.right || 0 : position.indexOf("center") >= 0 && (x /= 2)) : x = config.title_padding.left || 0, x; + }, + + /** + * Returns the y attribute value of the title + * @private + * @returns {Number} y attribute value + */ + yForTitle: function yForTitle() { + var $$ = this; + return ($$.config.title_padding.top || 0) + $$.getTextRect($$.title, $$.CLASS.title).height; + }, + + /** + * Get title padding + * @private + * @returns {Number} padding value + */ + getTitlePadding: function getTitlePadding() { + var $$ = this; + return $$.yForTitle() + ($$.config.title_padding.bottom || 0); + } +}); +// CONCATENATED MODULE: ./src/internals/clip.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(ChartInternal_ChartInternal.prototype, { + getClipPath: function getClipPath(id) { + var $$ = this, + config = $$.config; + if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) return null; + var isIE9 = window.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0; + return "url(".concat(isIE9 ? "" : document.URL.split("#")[0], "#").concat(id, ")"); + }, + appendClip: function appendClip(parent, id) { + return parent.append("clipPath").attr("id", id).append("rect"); + }, + getAxisClipX: function getAxisClipX(forHorizontal) { + // axis line width + padding for left + var left = Math.max(30, this.margin.left); + return forHorizontal ? -(1 + left) : -(left - 1); + }, + getAxisClipY: function getAxisClipY(forHorizontal) { + return forHorizontal ? -20 : -this.margin.top; + }, + getXAxisClipX: function getXAxisClipX() { + var $$ = this; + return $$.getAxisClipX(!$$.config.axis_rotated); + }, + getXAxisClipY: function getXAxisClipY() { + var $$ = this; + return $$.getAxisClipY(!$$.config.axis_rotated); + }, + getYAxisClipX: function getYAxisClipX() { + var $$ = this; + return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated); + }, + getYAxisClipY: function getYAxisClipY() { + var $$ = this; + return $$.getAxisClipY($$.config.axis_rotated); + }, + getAxisClipWidth: function getAxisClipWidth(forHorizontal) { + var $$ = this, + left = Math.max(30, $$.margin.left), + right = Math.max(30, $$.margin.right); + // width + axis line width + padding for left/right + return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20; + }, + getAxisClipHeight: function getAxisClipHeight(forHorizontal) { + // less than 20 is not enough to show the axis label 'outer' without legend + return (forHorizontal ? this.margin.bottom : this.margin.top + this.height) + 20; + }, + getXAxisClipWidth: function getXAxisClipWidth() { + var $$ = this; + return $$.getAxisClipWidth(!$$.config.axis_rotated); + }, + getXAxisClipHeight: function getXAxisClipHeight() { + var $$ = this; + return $$.getAxisClipHeight(!$$.config.axis_rotated); + }, + getYAxisClipWidth: function getYAxisClipWidth() { + var $$ = this; + return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0); + }, + getYAxisClipHeight: function getYAxisClipHeight() { + var $$ = this; + return $$.getAxisClipHeight($$.config.axis_rotated); + } +}); +// CONCATENATED MODULE: ./src/internals/region.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + // selection + + + + +extend(ChartInternal_ChartInternal.prototype, { + initRegion: function initRegion() { + var $$ = this; + $$.region = $$.main.append("g").attr("clip-path", $$.clipPath).attr("class", config_classes.regions); + }, + updateRegion: function updateRegion(duration) { + var $$ = this, + config = $$.config; + // hide if arc type + // select element + $$.region.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.mainRegion = $$.main.select(".".concat(config_classes.regions)).selectAll(".".concat(config_classes.region)).data(config.regions), $$.mainRegion.exit().transition().duration(duration).style("opacity", "0").remove(), $$.mainRegion = $$.mainRegion.enter().append("g").merge($$.mainRegion).attr("class", $$.classRegion.bind($$)), $$.mainRegion.append("rect").style("fill-opacity", "0"); + }, + redrawRegion: function redrawRegion(withTransition) { + var $$ = this, + regions = $$.mainRegion.select("rect"); + return regions = (withTransition ? regions.transition() : regions).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$)), [(withTransition ? regions.transition() : regions).style("fill-opacity", function (d) { + return isValue(d.opacity) ? d.opacity : "0.1"; + }).on("end", function () { + Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this.parentNode).selectAll("rect:not([x])").remove(); + })]; + }, + getRegionXY: function getRegionXY(type, d) { + var scale, + $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + isX = type === "x", + key = "start", + pos = 0; + return d.axis === "y" || d.axis === "y2" ? (!isX && (key = "end"), (isX ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], pos = scale(d[key]))) : (isX ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, pos = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), pos; + }, + regionX: function regionX(d) { + return this.getRegionXY("x", d); + }, + regionY: function regionY(d) { + return this.getRegionXY("y", d); + }, + getRegionSize: function getRegionSize(type, d) { + var scale, + $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + isWidth = type === "width", + start = $$[isWidth ? "regionX" : "regionY"](d), + key = "end", + end = $$[type]; + return d.axis === "y" || d.axis === "y2" ? (!isWidth && (key = "start"), (isWidth ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], end = scale(d[key]))) : (isWidth ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, end = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), end < start ? 0 : end - start; + }, + regionWidth: function regionWidth(d) { + return this.getRegionSize("width", d); + }, + regionHeight: function regionHeight(d) { + return this.getRegionSize("height", d); + }, + isRegionOnX: function isRegionOnX(d) { + return !d.axis || d.axis === "x"; + } +}); +// CONCATENATED MODULE: ./src/interactions/drag.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Called when dragging. + * Data points can be selected. + * @private + * @param {Object} mouse Object + */ + drag: function drag(mouse) { + var $$ = this, + config = $$.config, + main = $$.main; + + if (!$$.hasArcType() && config.data_selection_enabled && ( // do nothing if not selectable + !config.zoom_enabled || $$.zoom.altDomain) && config.data_selection_multiple // skip when single selection because drag is used for multiple selection + ) { + var _$$$dragStart = slicedToArray_default()($$.dragStart, 2), + sx = _$$$dragStart[0], + sy = _$$$dragStart[1], + _mouse = slicedToArray_default()(mouse, 2), + mx = _mouse[0], + my = _mouse[1], + minX = Math.min(sx, mx), + maxX = Math.max(sx, mx), + minY = config.data_selection_grouped ? $$.margin.top : Math.min(sy, my), + maxY = config.data_selection_grouped ? $$.height : Math.max(sy, my); + + main.select(".".concat(config_classes.dragarea)).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY), main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).filter(function (d) { + return config.data_selection_isselectable(d); + }).each(function (d, i) { + var toggle, + shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + isSelected = shape.classed(config_classes.SELECTED), + isIncluded = shape.classed(config_classes.INCLUDED), + isWithin = !1; + + if (shape.classed(config_classes.circle)) { + var x = shape.attr("cx") * 1, + y = shape.attr("cy") * 1; + toggle = $$.togglePoint, isWithin = minX < x && x < maxX && minY < y && y < maxY; + } else if (shape.classed(config_classes.bar)) { + var _getPathBox = getPathBox(this), + _x = _getPathBox.x, + y = _getPathBox.y, + width = _getPathBox.width, + height = _getPathBox.height; + + toggle = $$.togglePath, isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY); + } else // line/area selection not supported yet + return; + + isWithin ^ isIncluded && (shape.classed(config_classes.INCLUDED, !isIncluded), shape.classed(config_classes.SELECTED, !isSelected), toggle.call($$, !isSelected, shape, d, i)); + }); + } + }, + + /** + * Called when the drag starts. + * Adds and Shows the drag area. + * @private + * @param {Object} mouse Object + */ + dragstart: function dragstart(mouse) { + var $$ = this, + config = $$.config; + $$.hasArcType() || !config.data_selection_enabled || ($$.dragStart = mouse, $$.main.select(".".concat(config_classes.chart)).append("rect").attr("class", config_classes.dragarea).style("opacity", "0.1"), $$.setDragStatus(!0)); + }, + + /** + * Called when the drag finishes. + * Removes the drag area. + * @private + */ + dragend: function dragend() { + var $$ = this, + config = $$.config; + $$.hasArcType() || !config.data_selection_enabled || ($$.main.select(".".concat(config_classes.dragarea)).transition().duration(100).style("opacity", "0").remove(), $$.main.selectAll(".".concat(config_classes.shape)).classed(config_classes.INCLUDED, !1), $$.setDragStatus(!1)); + }, + setDragStatus: function setDragStatus(isDragging) { + this.dragging = isDragging; + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-color","commonjs2":"d3-color","amd":"d3-color","root":"d3"} +var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(21); + +// CONCATENATED MODULE: ./src/internals/selection.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Select a point + * @private + * @param {Object} target point + * @param {Object} data + * @param {Number} index + */ + selectPoint: function selectPoint(target, d, i) { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + cx = (isRotated ? $$.circleY : $$.circleX).bind($$), + cy = (isRotated ? $$.circleX : $$.circleY).bind($$), + r = $$.pointSelectR.bind($$); + // add selected-circle on low layer g + callFn(config.data_onselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).data([d]).enter().append("circle").attr("class", function () { + return $$.generateClass(config_classes.selectedCircle, i); + }).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", function (d2) { + return $$.pointSelectR(d2) * 1.4; + }).transition().duration(100).attr("r", r); + }, + + /** + * Unelect a point + * @private + * @param {Object} target point + * @param {Object} data + * @param {Number} index + */ + unselectPoint: function unselectPoint(target, d, i) { + var $$ = this; + // remove selected-circle from low layer g + callFn($$.config.data_onunselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).transition().duration(100).attr("r", 0).remove(); + }, + + /** + * Toggles the selection of points + * @private + * @param {Boolean} whether or not to select. + * @param {Object} target point + * @param {Object} data + * @param {Number} index + */ + togglePoint: function togglePoint(selected, target, d, i) { + var method = "".concat(selected ? "" : "un", "selectPoint"); + this[method](target, d, i); + }, + + /** + * Select a path + * @private + * @param {Object} target path + * @param {Object} data + */ + selectPath: function selectPath(target, d) { + var $$ = this, + config = $$.config; + callFn(config.data_onselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () { + return Object(external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_["rgb"])($$.color(d)).brighter(.75); + }); + }, + + /** + * Unelect a path + * @private + * @param {Object} target path + * @param {Object} data + */ + unselectPath: function unselectPath(target, d) { + var $$ = this, + config = $$.config; + callFn(config.data_onunselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () { + return $$.color(d); + }); + }, + + /** + * Toggles the selection of lines + * @private + * @param {Boolean} whether or not to select. + * @param {Object} target shape + * @param {Object} data + * @param {Number} index + */ + togglePath: function togglePath(selected, target, d, i) { + this["".concat(selected ? "" : "un", "selectPath")](target, d, i); + }, + + /** + * Returns the toggle method of the target + * @private + * @param {Object} target shape + * @param {Object} data + * @returns {Function} toggle method + */ + getToggle: function getToggle(that, d) { + var $$ = this; + return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () {} : // circle is hidden in step chart, so treat as within the click area + $$.togglePoint; + }, + + /** + * Toggles the selection of shapes + * @private + * @param {Object} target shape + * @param {Object} data + * @param {Number} index + */ + toggleShape: function toggleShape(that, d, i) { + var toggledShape, + $$ = this, + config = $$.config, + shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(that), + isSelected = shape.classed(config_classes.SELECTED), + toggle = $$.getToggle(that, d).bind($$); + + if (config.data_selection_enabled && config.data_selection_isselectable(d)) { + if (!config.data_selection_multiple) { + var selector = ".".concat(config_classes.shapes); + config.data_selection_grouped && (selector += $$.getTargetSelectorSuffix(d.id)), $$.main.selectAll(selector).selectAll(".".concat(config_classes.shape)).each(function (d, i) { + var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this); + shape.classed(config_classes.SELECTED) && (toggledShape = shape, toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i)); + }); + } + + toggledShape && toggledShape.node() === shape.node() || (shape.classed(config_classes.SELECTED, !isSelected), toggle(!isSelected, shape, d, i)); + } + } +}); +// CONCATENATED MODULE: ./src/interactions/subchart.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initialize the brush. + * @private + */ + initBrush: function initBrush() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + firstUpdate = !0; + $$.brush = isRotated ? Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushY"])() : Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushX"])(), $$.brush.handleSize(10); + + // set "brush" event + var brushHandler = function () { + firstUpdate || $$.redrawForBrush(); + }; + + // set the brush extent + $$.brush.on("start", function () { + $$.inputType === "touch" && $$.hideTooltip(), brushHandler(); + }).on("brush end", brushHandler), $$.brush.update = function () { + var extent = this.extent()(); + return extent[1].filter(function (v) { + return isNaN(v); + }).length === 0 && $$.context && $$.context.select(".".concat(config_classes.brush)).call(this), this; + }, $$.brush.scale = function (scale, height) { + var extent = [[0, 0]]; + // [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner and [x1, y1] is the bottom-right corner + // when extent updates, brush selection also be re-applied + // https://github.com/d3/d3/issues/2918 + scale.range ? extent.push([scale.range()[1], height || config.subchart_size_height]) : scale.constructor === Array && extent.push(scale), isRotated && extent[1].reverse(), this.extent(config.axis_x_extent || extent), this.update(); + }, $$.brush.getSelection = function () { + return $$.context ? $$.context.select(".".concat(config_classes.brush)) : Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])([]); + }, $$.brush.initZoom = function () { + var changed = !1; + + if (firstUpdate && $$.config.subchart_defzoom) { + var extent = this.extent()(), + domain = $$.config.subchart_defzoom(extent); + domain && domain.length && ($$.brush.move.call(this, $$.brush.getSelection(), domain), $$.brushHandlesUpdate(), changed = !0); + } + + return firstUpdate = !1, changed; + }; + }, + + /** + * Initialize the subchart. + * @private + */ + initSubchart: function initSubchart() { + var $$ = this, + config = $$.config, + visibility = config.subchart_show ? "visible" : "hidden", + clipId = "".concat($$.clipId, "-subchart"), + clipPath = $$.getClipPath(clipId); + $$.clipIdForSubchart = clipId, $$.appendClip($$.defs, clipId), $$.initBrush(), $$.context = $$.svg.append("g").attr("transform", $$.getTranslate("context")); + var context = $$.context; + context.style("visibility", visibility), context.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart), $$.hasType("bar") && context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars), context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines), $$.axes.subx = context.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subx")).attr("clip-path", config.axis_rotated ? "" : $$.clipPathForXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden"), context.append("g") // .attr("clip-path", clipPath) + .attr("class", config_classes.brush).call($$.brush); + var brush = context.select(".".concat(config_classes.brush)), + handleW = context.select(".".concat("handle--w")), + handleE = context.select(".".concat("handle--e")); + $$.brushHandleW = brush.insert("line", ":first-child").attr("class", "bb-brush-handle bb-brush-handle--w").attr("stroke-linecap", "round"), $$.brushHandleE = brush.insert("line", ":first-child").attr("class", "bb-brush-handle bb-brush-handle--e").attr("stroke-linecap", "round"), $$.brushHandlesUpdate = function () { + if (handleE.style("display") !== "none") { + var xW = parseInt(handleW.attr("x"), 10) + parseInt(handleW.attr("width") / 2, 10) + 1, + xE = parseInt(handleE.attr("x"), 10) + parseInt(handleE.attr("width") / 2, 10) - 0, + y1 = parseInt(handleW.attr("y"), 10) + 1, + y2 = y1 + parseInt(handleW.attr("height"), 10) - 2; + xW > xE && (xE = (xW + xE) / 2, xW = xE), $$.brushHandleW.attr("x1", xW).attr("x2", xW).attr("y1", y1).attr("y2", y2).style("display", ""), $$.brushHandleE.attr("x1", xE).attr("x2", xE).attr("y1", y1).attr("y2", y2).style("display", ""); + } else $$.brushHandleW.style("display", "none"), $$.brushHandleE.style("display", "none"); + }; + }, + + /** + * Update sub chart + * @private + * @param {Object} $$.data.targets + */ + updateTargetsForSubchart: function updateTargetsForSubchart(targets) { + var $$ = this, + context = $$.context, + config = $$.config, + classChartBar = $$.classChartBar.bind($$), + classBars = $$.classBars.bind($$), + classChartLine = $$.classChartLine.bind($$), + classLines = $$.classLines.bind($$), + classAreas = $$.classAreas.bind($$); + + if (config.subchart_show) { + // -- Bar --// + var contextBarUpdate = context.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", classChartBar), + contextBarEnter = contextBarUpdate.enter().append("g").style("opacity", "0").attr("class", classChartBar).merge(contextBarUpdate); + contextBarEnter.append("g").attr("class", classBars); + // -- Line --// + var contextLineUpdate = context.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", classChartLine), + contextLineEnter = contextLineUpdate.enter().append("g").style("opacity", "0").attr("class", classChartLine).merge(contextLineUpdate); + // Lines for each data + // Area + // -- Brush --// + contextLineEnter.append("g").attr("class", classLines), $$.hasType("area") && contextLineEnter.append("g").attr("class", classAreas), context.selectAll(".".concat(config_classes.brush, " rect")).attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? $$.width2 : $$.height2); + } + }, + + /** + * Update the bar of the sub chart + * @private + * @param {Object} durationForExit + */ + updateBarForSubchart: function updateBarForSubchart(durationForExit) { + var $$ = this; + $$.contextBar = $$.context.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data($$.barData.bind($$)), $$.contextBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextBar = $$.contextBar.enter().append("path").attr("class", $$.classBar.bind($$)).style("stroke", "none").style("fill", $$.color).merge($$.contextBar).style("opacity", $$.initialOpacity.bind($$)); + }, + + /** + * Redraw the bar of the subchart + * @private + * @param {String} path in subchart bar + * @param {Boolean} whether or not to transition. + * @param {Number} transition duration + */ + redrawBarForSubchart: function redrawBarForSubchart(drawBarOnSub, withTransition, duration) { + var contextBar = withTransition ? this.contextBar.transition(getRandom()).duration(duration) : this.contextBar; + contextBar.attr("d", drawBarOnSub).style("opacity", "1"); + }, + + /** + * Update the line of the sub chart + * @private + * @param {Number} Fade-out transition duration + */ + updateLineForSubchart: function updateLineForSubchart(durationForExit) { + var $$ = this; + $$.contextLine = $$.context.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.contextLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextLine = $$.contextLine.enter().append("path").attr("class", $$.classLine.bind($$)).style("stroke", $$.color).merge($$.contextLine).style("opacity", $$.initialOpacity.bind($$)); + }, + + /** + * Redraw the line of the subchart + * @private + * @param {String} path in subchart line + * @param {Boolean} whether or not to transition + * @param {Number} transition duration + */ + redrawLineForSubchart: function redrawLineForSubchart(drawLineOnSub, withTransition, duration) { + var contextLine = withTransition ? this.contextLine.transition(getRandom()).duration(duration) : this.contextLine; + contextLine.attr("d", drawLineOnSub).style("opacity", "1"); + }, + + /** + * Update the area of the sub chart + * @private + * @param {Number} Fade-out transition duration + */ + updateAreaForSubchart: function updateAreaForSubchart(durationForExit) { + var $$ = this; + $$.contextArea = $$.context.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.contextArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextArea = $$.contextArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.color).style("opacity", function () { + return $$.orgAreaOpacity = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).style("opacity"), "0"; + }).merge($$.contextArea).style("opacity", "0"); + }, + + /** + * Redraw the area of the subchart + * @private + * @param {String} path in subchart line + * @param {Boolean} whether or not to transition + * @param {Number} transition duration + */ + redrawAreaForSubchart: function redrawAreaForSubchart(drawAreaOnSub, withTransition, duration) { + var contextArea = withTransition ? this.contextArea.transition(getRandom()).duration(duration) : this.contextArea; + contextArea.attr("d", drawAreaOnSub).style("fill", this.color).style("opacity", this.orgAreaOpacity); + }, + + /** + * Redraw subchart. + * @private + * @param {Boolean} withSubchart whether or not to show subchart + * @param {Number} duration duration + * @param {Object} shape Shape's info + */ + redrawSubchart: function redrawSubchart(withSubchart, duration, shape) { + var $$ = this, + config = $$.config; + $$.context.style("visibility", config.subchart_show ? "visible" : "hidden"), config.subchart_show && (external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"] && external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].type === "zoom" && $$.brush.update(), withSubchart && (!brushEmpty($$) && $$.brush.update(), Object.keys(shape.type).forEach(function (v) { + var name = capitalize(v), + draw = $$["generateDraw".concat(name)](shape.indices[v], !0); + $$["update".concat(name, "ForSubchart")](duration), $$["redraw".concat(name, "ForSubchart")](draw, duration, duration); + })), $$.brushHandlesUpdate && $$.brushHandlesUpdate()); + }, + + /** + * Redraw the brush. + * @private + */ + redrawForBrush: function redrawForBrush() { + var $$ = this, + x = $$.x; + $$.redraw({ + withTransition: !1, + withY: $$.config.zoom_rescale, + withSubchart: !1, + withUpdateXDomain: !0, + withDimension: !1 + }), $$.config.subchart_onbrush.call($$.api, x.orgDomain()); + }, + + /** + * Transform context + * @private + * @param {Boolean} indicates transition is enabled + * @param {Object} The return value of the generateTransitions method of Axis. + */ + transformContext: function transformContext(withTransition, transitions) { + var subXAxis, + $$ = this; + transitions && transitions.axisSubX ? subXAxis = transitions.axisSubX : (subXAxis = $$.context.select(".".concat(config_classes.axisX)), withTransition && (subXAxis = subXAxis.transition())), $$.context.attr("transform", $$.getTranslate("context")), subXAxis.attr("transform", $$.getTranslate("subx")); + }, + + /** + * Get default extent + * @private + * @returns {Array} default extent + */ + getDefaultExtent: function getDefaultExtent() { + var $$ = this, + config = $$.config, + extent = isFunction(config.axis_x_extent) ? config.axis_x_extent($$.getXDomain($$.data.targets)) : config.axis_x_extent; + return $$.isTimeSeries() && (extent = [$$.parseDate(extent[0]), $$.parseDate(extent[1])]), extent; + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-zoom","commonjs2":"d3-zoom","amd":"d3-zoom","root":"d3"} +var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(22); + +// CONCATENATED MODULE: ./src/interactions/zoom.js + + +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Initialize zoom. + * @private + */ + initZoom: function initZoom() { + var $$ = this; + $$.zoomScale = null, $$.generateZoom(); + }, + + /** + * Bind zoom event + * @param {Boolean} bind Weather bind or unbound + * @private + */ + bindZoomEvent: function bindZoomEvent() { + var bind = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0], + $$ = this, + zoomEnabled = $$.config.zoom_enabled; + $$.redrawEventRect(); + var eventRects = $$.main.select(".".concat(config_classes.eventRects)); + zoomEnabled && bind ? $$.bindZoomOnEventRect(eventRects, zoomEnabled.type) : bind === !1 && ($$.api.unzoom(), eventRects.on(".zoom", null).on(".drag", null)); + }, + + /** + * Generate zoom + * @private + */ + generateZoom: function generateZoom() { + var $$ = this, + config = $$.config, + zoom = Object(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_["zoom"])().duration(0).on("start", $$.onZoomStart.bind($$)).on("zoom", $$.onZoom.bind($$)).on("end", $$.onZoomEnd.bind($$)); + // get zoom extent + + /** + * Update scale according zoom transform value + * @param {Object} transform + * @private + */ + zoom.orgScaleExtent = function () { + var extent = config.zoom_extent || [1, 10]; + return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])]; + }, zoom.updateScaleExtent = function () { + var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()), + extent = this.orgScaleExtent(); + return this.scaleExtent([extent[0] * ratio, extent[1] * ratio]), this; + }, zoom.updateTransformScale = function (transform) { + // rescale from the original scale + var newScale = transform.rescaleX($$.x), + domain = $$.trimXDomain(newScale.domain()), + rescale = config.zoom_rescale; + newScale.domain(domain, $$.orgXDomain), $$.zoomScale = $$.getCustomizedScale(newScale), $$.xAxis.scale($$.zoomScale), rescale && $$.x.domain($$.zoomScale.orgDomain()); + }, $$.zoom = zoom; + }, + + /** + * 'start' event listener + * @private + */ + onZoomStart: function onZoomStart() { + var $$ = this, + event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].sourceEvent; + event && ($$.zoom.altDomain = event.altKey ? $$.x.orgDomain() : null, $$.zoom.startEvent = event, callFn($$.config.zoom_onzoomstart, $$.api, event)); + }, + + /** + * 'zoom' event listener + * @private + */ + onZoom: function onZoom() { + var $$ = this, + config = $$.config, + event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"]; + + if (config.zoom_enabled && event.sourceEvent) { + var isMousemove = event.sourceEvent.type === "mousemove", + transform = event.transform; + return $$.zoom.updateTransformScale(transform), $$.filterTargetsToShow($$.data.targets).length === 0 ? void 0 : isMousemove && $$.zoom.altDomain ? ($$.x.domain($$.zoom.altDomain), void transform.scale($$.zoomScale).updateScaleExtent()) : void ($$.isCategorized() && $$.x.orgDomain()[0] === $$.orgXDomain[0] && $$.x.domain([$$.orgXDomain[0] - 1e-10, $$.x.orgDomain()[1]]), $$.redraw({ + withTransition: !1, + withY: config.zoom_rescale, + withSubchart: !1, + withEventRect: !1, + withDimension: !1 + }), $$.cancelClick = isMousemove, callFn(config.zoom_onzoom, $$.api, $$.zoomScale.domain())); + } + }, + + /** + * 'end' event listener + * @private + */ + onZoomEnd: function onZoomEnd() { + var $$ = this, + startEvent = $$.zoom.startEvent; + // if click, do nothing. otherwise, click interaction will be canceled. + !startEvent || event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY || ($$.redrawEventRect(), $$.updateZoom(), callFn($$.config.zoom_onzoomend, $$.api, $$[$$.zoomScale ? "zoomScale" : "subX"].domain())); + }, + + /** + * Get zoom domain + * @returns {Array} zoom domain + * @private + */ + getZoomDomain: function getZoomDomain() { + var $$ = this, + config = $$.config, + _$$$orgXDomain = slicedToArray_default()($$.orgXDomain, 2), + min = _$$$orgXDomain[0], + max = _$$$orgXDomain[1]; + + return isDefined(config.zoom_x_min) && (min = getMinMax("min", [min, config.zoom_x_min])), isDefined(config.zoom_x_max) && (max = getMinMax("max", [max, config.zoom_x_max])), [min, max]; + }, + + /** + * Update zoom + * @param {Boolean} force Force unzoom + * @private + */ + updateZoom: function updateZoom(force) { + var $$ = this; + + if ($$.zoomScale) { + var zoomDomain = $$.zoomScale.domain(), + xDomain = $$.subX.domain(), + delta = .015, + isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta); + (force || isfullyShown) && ($$.xAxis.scale($$.subX), $$.x.domain($$.subX.orgDomain()), $$.zoomScale = null); + } + }, + + /** + * Attach zoom event on + * @private + */ + bindZoomOnEventRect: function bindZoomOnEventRect(eventRects, type) { + var $$ = this, + behaviour = type === "drag" ? $$.zoomBehaviour : $$.zoom; + eventRects.call(behaviour).on("dblclick.zoom", null); + }, + + /** + * Initialize the drag behaviour used for zooming. + * @private + */ + initZoomBehaviour: function initZoomBehaviour() { + var $$ = this, + config = $$.config, + isRotated = config.axis_rotated, + start = 0, + end = 0, + zoomRect = null; + $$.zoomBehaviour = Object(external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_["drag"])().clickDistance(4).on("start", function () { + $$.setDragStatus(!0), zoomRect || (zoomRect = $$.main.append("rect").attr("clip-path", $$.clipPath).attr("class", config_classes.zoomBrush).attr("width", isRotated ? $$.width : 0).attr("height", isRotated ? 0 : $$.height)), start = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[0], end = start, zoomRect.attr("x", start).attr("width", 0), $$.onZoomStart(); + }).on("drag", function () { + end = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[0], zoomRect.attr("x", Math.min(start, end)).attr("width", Math.abs(end - start)); + }).on("end", function () { + var _ref, + scale = $$.zoomScale || $$.x; + + if ($$.setDragStatus(!1), zoomRect.attr("x", 0).attr("width", 0), start > end && (_ref = [end, start], start = _ref[0], end = _ref[1], _ref), start < 0 && (end += Math.abs(start), start = 0), start !== end) $$.api.zoom([start, end].map(function (v) { + return scale.invert(v); + })), $$.onZoomEnd();else if ($$.isMultipleX()) $$.clickHandlerForMultipleXS.bind(this)($$);else { + var _event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].sourceEvent || external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"], + _ref2 = "clientX" in _event ? [_event.clientX, _event.clientY] : [_event.x, _event.y], + _ref3 = slicedToArray_default()(_ref2, 2), + x = _ref3[0], + y = _ref3[1], + target = document.elementFromPoint(x, y); + + $$.clickHandlerForSingleX.bind(target)(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(target).datum(), $$); + } + }); + }, + setZoomResetButton: function setZoomResetButton() { + var $$ = this, + config = $$.config, + resetButton = config.zoom_resetButton; + resetButton && config.zoom_enabled.type === "drag" && ($$.zoom.resetBtn ? $$.zoom.resetBtn.style("display", null) : $$.zoom.resetBtn = $$.selectChart.append("div").classed(config_classes.button, !0).append("span").on("click", $$.api.unzoom.bind($$)).classed(config_classes.buttonZoomReset, !0).text(resetButton.text || "Reset Zoom")); + } +}); +// CONCATENATED MODULE: ./src/internals/color.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + +/** + * Set pattern's background color + * (it adds a element to simulate bg-color) + * @param {SVGPatternElement} pattern SVG pattern element + * @param {String} color Color string + * @param {String} id ID to be set + * @return {{id: string, node: SVGPatternElement}} + * @private + */ + +var colorizePattern = function (pattern, color, id) { + var node = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(pattern.cloneNode(!0)); + return node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color), { + id: id, + node: node.node() + }; +}, + schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; // Replacement of d3.schemeCategory10. +// Contained differently depend on d3 version: v4(d3-scale), v5(d3-scale-chromatic) + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Get color pattern from CSS file + * CSS should be defined as: background-image: url("#00c73c;#fa7171; ..."); + * @return {Array} + * @private + */ + getColorFromCss: function getColorFromCss() { + var body = document.body, + pattern = body["__colorPattern__"]; + + if (!pattern) { + var span = document.createElement("span"); + span.className = config_classes.colorPattern, span.style.display = "none", body.appendChild(span); + var content = window.getComputedStyle(span).backgroundImage; + span.parentNode.removeChild(span), content.indexOf(";") > -1 && (pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) { + return v.trim().replace(/[\"'\s]/g, ""); + }).filter(Boolean), body["__colorPattern__"] = pattern); + } + + return pattern; + }, + generateColor: function generateColor() { + var $$ = this, + config = $$.config, + colors = config.data_colors, + callback = config.data_color, + ids = [], + pattern = notEmpty(config.color_pattern) ? config.color_pattern : Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleOrdinal"])($$.getColorFromCss() || schemeCategory10).range(), + originalColorPattern = pattern; + + if (isFunction(config.color_tiles)) { + var tiles = config.color_tiles(), + colorizedPatterns = pattern.map(function (p, index) { + var color = p.replace(/[#\(\)\s,]/g, ""), + id = "".concat($$.datetimeId, "-pattern-").concat(color, "-").concat(index); + return colorizePattern(tiles[index % tiles.length], p, id); + }); // Add background color to patterns + + pattern = colorizedPatterns.map(function (p) { + return "url(#".concat(p.id, ")"); + }), $$.patterns = colorizedPatterns; + } + + return function (d) { + var color, + id = d.id || d.data && d.data.id || d, + isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !$$.config.data_types[id]; + return isFunction(colors[id]) ? color = colors[id](d) : colors[id] ? color = colors[id] : (ids.indexOf(id) < 0 && ids.push(id), color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length], colors[id] = color), isFunction(callback) ? callback(color, d) : color; + }; + }, + generateLevelColor: function generateLevelColor() { + var $$ = this, + config = $$.config, + colors = config.color_pattern, + threshold = config.color_threshold, + asValue = threshold.unit === "value", + max = threshold.max || 100, + values = threshold.values && threshold.values.length ? threshold.values : []; + return notEmpty(threshold) ? function (value) { + var color = colors[colors.length - 1]; + + for (var v, i = 0; i < values.length; i++) if (v = asValue ? value : value * 100 / max, v < values[i]) { + color = colors[i]; + break; + } + + return color; + } : null; + }, + + /** + * Set the data over color. + * When is out, will restore in its previous color value + * @param {Boolean} isOver true: set overed color, false: restore + * @param {Number|Object} d target index or data object for Arc type + * @private + */ + setOverColor: function setOverColor(isOver, d) { + var $$ = this, + config = $$.config, + onover = config.color_onover, + color = isOver ? onover : $$.color; + isObject(color) ? color = function (d) { + var id = d.id; + return id in onover ? onover[id] : $$.color(id); + } : isString(color) && (color = function () { + return onover; + }), isObject(d) ? $$.main.selectAll(".".concat(config_classes.arc, "-").concat(d.id)).style("fill", color(d)) : $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).each(function (d) { + var val = color(d); + this.style.stroke = val, this.style.fill = val; + }); + } +}); +// CONCATENATED MODULE: ./src/internals/format.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +var getFormat = function ($$, typeValue, v) { + var config = $$.config, + type = "axis_".concat(typeValue, "_tick_format"), + format = config[type] ? config[type] : $$.defaultValueFormat; + return format(v); +}; + +extend(ChartInternal_ChartInternal.prototype, { + getYFormat: function getYFormat(forArc) { + var $$ = this, + formatForY = $$.yFormat, + formatForY2 = $$.y2Format; + return forArc && !$$.hasType("gauge") && (formatForY = $$.defaultArcValueFormat, formatForY2 = $$.defaultArcValueFormat), function (v, ratio, id) { + var format = $$.axis.getId(id) === "y2" ? formatForY2 : formatForY; + return format.call($$, v, ratio); + }; + }, + yFormat: function yFormat(v) { + return getFormat(this, "y", v); + }, + y2Format: function y2Format(v) { + return getFormat(this, "y2", v); + }, + defaultValueFormat: function defaultValueFormat(v) { + return isValue(v) ? +v : ""; + }, + defaultArcValueFormat: function defaultArcValueFormat(v, ratio) { + return "".concat((ratio * 100).toFixed(1), "%"); + }, + dataLabelFormat: function dataLabelFormat(targetId) { + var $$ = this, + dataLabels = $$.config.data_labels, + defaultFormat = function (v) { + return isValue(v) ? +v : ""; + }, + format = defaultFormat; + + return isFunction(dataLabels.format) ? format = dataLabels.format : isObjectType(dataLabels.format) && (dataLabels.format[targetId] ? format = dataLabels.format[targetId] === !0 ? defaultFormat : dataLabels.format[targetId] : format = function () { + return ""; + }), format; + } +}); +// CONCATENATED MODULE: ./src/internals/cache.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(ChartInternal_ChartInternal.prototype, { + /** + * Add cache + * @param {String} key + * @param {*} value + * @param {Boolean} isDataType + * @private + */ + addCache: function addCache(key, value) { + var isDataType = !!(arguments.length > 2 && arguments[2] !== undefined) && arguments[2]; + this.cache[key] = isDataType ? this.cloneTarget(value) : value; + }, + + /** + * Remove cache + * @param {String|Array} key + * @private + */ + removeCache: function removeCache(key) { + var _this = this; + + toArray(key).forEach(function (v) { + return delete _this.cache[v]; + }); + }, + + /** + * Get cahce + * @param {String|Array} key + * @param {Boolean} isDataType + * @return {*} + * @private + */ + getCache: function getCache(key) { + var isDataType = !!(arguments.length > 1 && arguments[1] !== undefined) && arguments[1]; + + if (isDataType) { + var targets = []; + + for (var id, i = 0; id = key[i]; i++) id in this.cache && targets.push(this.cloneTarget(this.cache[id])); + + return targets; + } + + return this.cache[key] || null; + }, + + /** + * reset cached data + * @param {Boolean} all true: reset all data, false: reset only '$' prefixed key data + * @private + */ + resetCache: function resetCache(all) { + var $$ = this; + + for (var x in $$.cache) (all || /^\$/.test(x)) && ($$.cache[x] = null); + } +}); +// CONCATENATED MODULE: ./src/internals/class.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(ChartInternal_ChartInternal.prototype, { + CLASS: config_classes, + generateClass: function generateClass(prefix, targetId) { + return " ".concat(prefix, " ").concat(prefix + this.getTargetSelectorSuffix(targetId)); + }, + classText: function classText(d) { + return this.generateClass(config_classes.text, d.index); + }, + classTexts: function classTexts(d) { + return this.generateClass(config_classes.texts, d.id); + }, + classShape: function classShape(d) { + return this.generateClass(config_classes.shape, d.index); + }, + classShapes: function classShapes(d) { + return this.generateClass(config_classes.shapes, d.id); + }, + generateExtraLineClass: function generateExtraLineClass() { + var $$ = this, + classes = $$.config.line_classes || [], + ids = []; + return function (d) { + var id = d.id || d.data && d.data.id || d; + return ids.indexOf(id) < 0 && ids.push(id), classes[ids.indexOf(id) % classes.length]; + }; + }, + classLine: function classLine(d) { + return this.classShape(d) + this.generateClass(config_classes.line, d.id); + }, + classLines: function classLines(d) { + return this.classShapes(d) + this.generateClass(config_classes.lines, d.id); + }, + classCircle: function classCircle(d) { + return this.classShape(d) + this.generateClass(config_classes.circle, d.index); + }, + classCircles: function classCircles(d) { + return this.classShapes(d) + this.generateClass(config_classes.circles, d.id); + }, + classBar: function classBar(d) { + return this.classShape(d) + this.generateClass(config_classes.bar, d.index); + }, + classBars: function classBars(d) { + return this.classShapes(d) + this.generateClass(config_classes.bars, d.id); + }, + classArc: function classArc(d) { + return this.classShape(d.data) + this.generateClass(config_classes.arc, d.data.id); + }, + classArcs: function classArcs(d) { + return this.classShapes(d.data) + this.generateClass(config_classes.arcs, d.data.id); + }, + classArea: function classArea(d) { + return this.classShape(d) + this.generateClass(config_classes.area, d.id); + }, + classAreas: function classAreas(d) { + return this.classShapes(d) + this.generateClass(config_classes.areas, d.id); + }, + classRegion: function classRegion(d, i) { + return "".concat(this.generateClass(config_classes.region, i), " ").concat("class" in d ? d.class : ""); + }, + classEvent: function classEvent(d) { + return this.generateClass(config_classes.eventRect, d.index); + }, + classTarget: function classTarget(id) { + var additionalClassSuffix = this.config.data_classes[id], + additionalClass = ""; + return additionalClassSuffix && (additionalClass = " ".concat(config_classes.target, "-").concat(additionalClassSuffix)), this.generateClass(config_classes.target, id) + additionalClass; + }, + classFocus: function classFocus(d) { + return this.classFocused(d) + this.classDefocused(d); + }, + classFocused: function classFocused(d) { + return " ".concat(this.focusedTargetIds.indexOf(d.id) >= 0 ? config_classes.focused : ""); + }, + classDefocused: function classDefocused(d) { + return " ".concat(this.defocusedTargetIds.indexOf(d.id) >= 0 ? config_classes.defocused : ""); + }, + classChartText: function classChartText(d) { + return config_classes.chartText + this.classTarget(d.id); + }, + classChartLine: function classChartLine(d) { + return config_classes.chartLine + this.classTarget(d.id); + }, + classChartBar: function classChartBar(d) { + return config_classes.chartBar + this.classTarget(d.id); + }, + classChartArc: function classChartArc(d) { + return config_classes.chartArc + this.classTarget(d.data.id); + }, + classChartRadar: function classChartRadar(d) { + return config_classes.chartRadar + this.classTarget(d.id); + }, + getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) { + return targetId || targetId === 0 ? "-".concat(targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, "-") : ""; + }, + selectorTarget: function selectorTarget(id, prefix) { + return "".concat(prefix || "", ".").concat(config_classes.target + this.getTargetSelectorSuffix(id)); + }, + selectorTargets: function selectorTargets(idsValue, prefix) { + var $$ = this, + ids = idsValue || []; + return ids.length ? ids.map(function (id) { + return $$.selectorTarget(id, prefix); + }) : null; + }, + selectorLegend: function selectorLegend(id) { + return ".".concat(config_classes.legendItem + this.getTargetSelectorSuffix(id)); + }, + selectorLegends: function selectorLegends(ids) { + var $$ = this; + return ids && ids.length ? ids.map(function (id) { + return $$.selectorLegend(id); + }) : null; + } +}); +// CONCATENATED MODULE: ./src/api/api.focus.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(Chart_Chart.prototype, { + /** + * This API highlights specified targets and fade out the others.

    + * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be highlighted. + * @method focus + * @instance + * @memberof Chart + * @param {String|Array} targetIdsValue Target ids to be highlighted. + * @example + * // data1 will be highlighted and the others will be faded out + * chart.focus("data1"); + * + * // data1 and data2 will be highlighted and the others will be faded out + * chart.focus(["data1", "data2"]); + * + * // all targets will be highlighted + * chart.focus(); + */ + focus: function focus(targetIdsValue) { + var $$ = this.internal, + targetIds = $$.mapToTargetIds(targetIdsValue), + candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))); + this.revert(), this.defocus(), candidates.classed(config_classes.focused, !0).classed(config_classes.defocused, !1), $$.hasArcType() && $$.expandArc(targetIds), $$.toggleFocusLegend(targetIds, !0), $$.focusedTargetIds = targetIds, $$.defocusedTargetIds = $$.defocusedTargetIds.filter(function (id) { + return targetIds.indexOf(id) < 0; + }); + }, + + /** + * This API fades out specified targets and reverts the others.

    + * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be faded out. + * @method defocus + * @instance + * @memberof Chart + * @param {String|Array} Target ids to be faded out. + * @example + * // data1 will be faded out and the others will be reverted. + * chart.defocus("data1"); + * + * // data1 and data2 will be faded out and the others will be reverted. + * chart.defocus(["data1", "data2"]); + * + * // all targets will be faded out. + * chart.defocus(); + */ + defocus: function defocus(targetIdsValue) { + var $$ = this.internal, + targetIds = $$.mapToTargetIds(targetIdsValue), + candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))); + candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !0), $$.hasArcType() && $$.unexpandArc(targetIds), $$.toggleFocusLegend(targetIds, !1), $$.focusedTargetIds = $$.focusedTargetIds.filter(function (id) { + return targetIds.indexOf(id) < 0; + }), $$.defocusedTargetIds = targetIds; + }, + + /** + * This API reverts specified targets.

    + * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be reverted. + * @method revert + * @instance + * @memberof Chart + * @param {String|Array} Target ids to be reverted + * @example + * // data1 will be reverted. + * chart.revert("data1"); + * + * // data1 and data2 will be reverted. + * chart.revert(["data1", "data2"]); + * + * // all targets will be reverted. + * chart.revert(); + */ + revert: function revert(targetIdsValue) { + var $$ = this.internal, + targetIds = $$.mapToTargetIds(targetIdsValue), + candidates = $$.svg.selectAll($$.selectorTargets(targetIds)); + // should be for all targets + candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !1), $$.hasArcType() && $$.unexpandArc(targetIds), $$.config.legend_show && ($$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))), $$.legend.selectAll($$.selectorLegends(targetIds)).filter(function () { + return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused); + }).classed(config_classes.legendItemFocused, !1)), $$.focusedTargetIds = [], $$.defocusedTargetIds = []; + } +}); +// CONCATENATED MODULE: ./src/api/api.show.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Show/Hide data series + * @private + */ + _showHide: function _showHide(show, targetIdsValue, options) { + var $$ = this.internal, + targetIds = $$.mapToTargetIds(targetIdsValue); + $$["".concat(show ? "remove" : "add", "HiddenTargetIds")](targetIds); + var targets = $$.svg.selectAll($$.selectorTargets(targetIds)), + opacity = show ? "1" : "0"; + targets.transition().style("opacity", opacity, "important").call($$.endall, function () { + targets.style("opacity", null).style("opacity", opacity); + }), options.withLegend && $$["".concat(show ? "show" : "hide", "Legend")](targetIds), $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0, + withLegend: !0 + }); + }, + + /** + * Show data series on chart + * @method show + * @instance + * @memberof Chart + * @param {String|Array} [targetIdsValue=all] The target id value. + * @param {Object} [options] The object can consist with following members:
    + * + * | Key | Type | default | Description | + * | --- | --- | --- | --- | + * | withLegend | Boolean | false | whether or not display legend | + * + * @example + * // show 'data1' + * chart.show("data1"); + * + * // show 'data1' and 'data3' + * chart.show(["data1", "data3"]); + */ + show: function show(targetIdsValue) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + this._showHide(!0, targetIdsValue, options); + }, + + /** + * Hide data series from chart + * @method hide + * @instance + * @memberof Chart + * @param {String|Array} [targetIdsValue=all] The target id value. + * @param {Object} [options] The object can consist with following members:
    + * + * | Key | Type | default | Description | + * | --- | --- | --- | --- | + * | withLegend | Boolean | false | whether or not display legend | + * + * @example + * // hide 'data1' + * chart.hide("data1"); + * + * // hide 'data1' and 'data3' + * chart.hide(["data1", "data3"]); + */ + hide: function hide(targetIdsValue) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + this._showHide(!1, targetIdsValue, options); + }, + + /** + * Toggle data series on chart. When target data is hidden, it will show. If is shown, it will hide in vice versa. + * @method toggle + * @instance + * @memberof Chart + * @param {String|Array} [targetIdsValue=all] The target id value. + * @param {Object} [options] The object can consist with following members:
    + * + * | Key | Type | default | Description | + * | --- | --- | --- | --- | + * | withLegend | Boolean | false | whether or not display legend | + * + * @example + * // toggle 'data1' + * chart.toggle("data1"); + * + * // toggle 'data1' and 'data3' + * chart.toggle(["data1", "data3"]); + */ + toggle: function toggle(targetIds) { + var _this = this, + options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + $$ = this.internal, + targets = { + show: [], + hide: [] + }; + + // sort show & hide target ids + // perform show & hide task separately + // https://github.com/naver/billboard.js/issues/454 + $$.mapToTargetIds(targetIds).forEach(function (id) { + return targets[$$.isTargetToShow(id) ? "hide" : "show"].push(id); + }), targets.show.length && this.show(targets.show, options), targets.hide.length && setTimeout(function () { + return _this.hide(targets.hide, options); + }, 0); + } +}); +// CONCATENATED MODULE: ./src/api/api.zoom.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +/** + * Zoom by giving x domain. + * - **NOTE:** For `wheel` type zoom, the minimum zoom range will be set as the given domain.
    + * To get the initial state, [.unzoom()](#unzoom) should be called. + * @method zoom + * @instance + * @memberof Chart + * @param {Array} domainValue If domain is given, the chart will be zoomed to the given domain. If no argument is given, the current zoomed domain will be returned. + * @return {Array} domain value in array + * @example + * // Zoom to specified domain + * chart.zoom([10, 20]); + * + * // Get the current zoomed domain + * chart.zoom(); + */ + +var api_zoom_zoom = function (domainValue) { + var resultDomain, + $$ = this.internal, + domain = domainValue; + + if ($$.config.zoom_enabled && domain) { + var isTimeSeries = $$.isTimeSeries(); + + if (isTimeSeries && (domain = domain.map(function (x) { + return $$.parseDate(x); + })), $$.config.subchart_show) { + var xScale = $$.zoomScale || $$.x; + $$.brush.getSelection().call($$.brush.move, [xScale(domain[0]), xScale(domain[1])]), resultDomain = domain; + } else $$.x.domain(domain), $$.zoomScale = $$.x, $$.xAxis.scale($$.zoomScale), resultDomain = $$.zoomScale.orgDomain(); + + $$.redraw({ + withTransition: !0, + withY: $$.config.zoom_rescale, + withDimension: !1 + }), $$.setZoomResetButton(), callFn($$.config.zoom_onzoom, resultDomain); + } else resultDomain = $$.zoomScale ? $$.zoomScale.domain() : $$.x.orgDomain(); + + return resultDomain; +}; + +extend(api_zoom_zoom, { + /** + * Enable and disable zooming. + * @method zoom․enable + * @instance + * @memberof Chart + * @param {String|Boolean} enabled Possible string values are "wheel" or "drag". If enabled is true, "wheel" will be used. If false is given, zooming will be disabled.
    When set to false, the current zooming status will be reset. + * @example + * // Enable zooming using the mouse wheel + * chart.zoom.enable(true); + * // Or + * chart.zoom.enable("wheel"); + * + * // Enable zooming by dragging + * chart.zoom.enable("drag"); + * + * // Disable zooming + * chart.zoom.enable(false); + */ + enable: function enable() { + var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "wheel", + $$ = this.internal, + config = $$.config, + enableType = enabled; + enabled && (enableType = isString(enabled) && /^(drag|wheel)$/.test(enabled) ? { + type: enabled + } : enabled), config.zoom_enabled = enableType, $$.zoom ? enabled === !1 && $$.bindZoomEvent(!1) : ($$.initZoom(), $$.initZoomBehaviour(), $$.bindZoomEvent()), $$.updateAndRedraw(); + }, + + /** + * Set or get x Axis maximum zoom range value + * @method zoom․max + * @instance + * @memberof Chart + * @param {Number} [max] maximum value to set for zoom + * @return {Number} zoom max value + * @example + * // Set maximum range value + * chart.zoom.max(20); + */ + max: function max(_max) { + var $$ = this.internal, + config = $$.config; + return (_max === 0 || _max) && (config.zoom_x_max = getMinMax("max", [$$.orgXDomain[1], _max])), config.zoom_x_max; + }, + + /** + * Set or get x Axis minimum zoom range value + * @method zoom․min + * @instance + * @memberof Chart + * @param {Number} [min] minimum value tp set for zoom + * @return {Number} zoom min value + * @example + * // Set minimum range value + * chart.zoom.min(-1); + */ + min: function min(_min) { + var $$ = this.internal, + config = $$.config; + return (_min === 0 || _min) && (config.zoom_x_min = getMinMax("min", [$$.orgXDomain[0], _min])), config.zoom_x_min; + }, + + /** + * Set zoom range + * @method zoom․range + * @instance + * @memberof Chart + * @param {Object} [range] + * @return {Object} zoom range value + * { + * min: 0, + * max: 100 + * } + * @example + * chart.zoom.range({ + * min: 10, + * max: 100 + * }); + */ + range: function range(_range) { + var zoom = this.zoom; + + if (isObject(_range)) { + var min = _range.min, + max = _range.max; + isDefined(min) && zoom.min(min), isDefined(max) && zoom.max(max); + } + + return { + min: zoom.min(), + max: zoom.max() + }; + } +}), extend(Chart_Chart.prototype, { + zoom: api_zoom_zoom, + + /** + * Unzoom zoomed area + * @method unzoom + * @instance + * @memberof Chart + * @example + * chart.unzoom(); + */ + unzoom: function unzoom() { + var $$ = this.internal, + config = $$.config; + + if ($$.zoomScale) { + config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_["zoomIdentity"]), $$.updateZoom(!0), $$.zoom.resetBtn && $$.zoom.resetBtn.style("display", "none"); + // reset transform + var eventRects = $$.main.select(".".concat(config_classes.eventRects)); + Object(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_["zoomTransform"])(eventRects.node()) !== external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_["zoomIdentity"] && $$.zoom.transform(eventRects, external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_["zoomIdentity"]), $$.redraw({ + withTransition: !0, + withY: config.zoom_rescale + }); + } + } +}); +// CONCATENATED MODULE: ./src/api/api.load.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Load data to the chart.

    + * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be toggles. + * - Note: + * - unload should be used if some data needs to be unloaded simultaneously. + * If you call unload API soon after/before load instead of unload param, chart will not be rendered properly because of cancel of animation.
    + * - done will be called after data loaded, but it's not after rendering. + * It's because rendering will finish after some transition and there is some time lag between loading and rendering + * @method load + * @instance + * @memberof Chart + * @param {Object} args The object can consist with following members:
    + * + * | Key | Description | + * | --- | --- | + * | - url
    - json
    - rows
    - columns | The data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added | + * | data | Data objects to be loaded | + * | names | Same as data.names() | + * | xs | Same as data.xs option | + * | classes | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. | + * | categories | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. | + * | axes | The axes specified by data.axes will be updated. axes must be Object that has target id as keys. | + * | colors | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. | + * | - type
    - types | The type of targets will be updated. type must be String and types must be Object. | + * | unload | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. If absent or false given, unload will not occur. | + * | done | The specified function will be called after data loaded.| + * + * @example + * // Load data1 and unload data2 and data3 + * chart.load({ + * columns: [ + * ["data1", 100, 200, 150, ...], + * ... + * ], + * unload: ["data2", "data3"], + * url: "...", + * done: function() { ... } + * }); + */ + load: function load(args) { + var $$ = this.internal, + config = $$.config; + // update xs if specified + // update names if exists + // update classes if exists + // update axes if exists + // update colors if exists + args.xs && $$.addXs(args.xs), "names" in args && this.data.names(args.names), "classes" in args && Object.keys(args.classes).forEach(function (id) { + config.data_classes[id] = args.classes[id]; + }), "categories" in args && $$.isCategorized() && (config.axis_x_categories = args.categories), "axes" in args && Object.keys(args.axes).forEach(function (id) { + config.data_axes[id] = args.axes[id]; + }), "colors" in args && Object.keys(args.colors).forEach(function (id) { + config.data_colors[id] = args.colors[id]; + }), "unload" in args && args.unload !== !1 ? $$.unload($$.mapToTargetIds(args.unload === !0 ? null : args.unload), function () { + return $$.loadFromArgs(args); + }) : $$.loadFromArgs(args); + }, + + /** + * Unload data to the chart.

    + * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be toggles. + * - Note: + * If you call load API soon after/before unload, unload param of load should be used. Otherwise chart will not be rendered properly because of cancel of animation.
    + * `done` will be called after data loaded, but it's not after rendering. It's because rendering will finish after some transition and there is some time lag between loading and rendering. + * @method unload + * @instance + * @memberof Chart + * @param {Object} args + * | key | Type | Description | + * | --- | --- | --- | + * | ids | String | Array | Target id data to be unloaded. If not given, all data will be unloaded. | + * | done | Fuction | Callback after data is unloaded. | + * @example + * // Unload data2 and data3 + * chart.unload({ + * ids: ["data2", "data3"], + * done: function() { + * // called after the unloaded + * } + * }); + */ + unload: function unload(argsValue) { + var $$ = this.internal, + args = argsValue || {}; + isArray(args) ? args = { + ids: args + } : isString(args) && (args = { + ids: [args] + }); + var ids = $$.mapToTargetIds(args.ids); + $$.unload(ids, function () { + $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0, + withLegend: !0 + }), $$.removeCache(ids), args.done && args.done(); + }); + } +}); +// EXTERNAL MODULE: external {"commonjs":"d3-ease","commonjs2":"d3-ease","amd":"d3-ease","root":"d3"} +var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack_require__(23); + +// CONCATENATED MODULE: ./src/api/api.flow.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + + + + +extend(Chart_Chart.prototype, { + /** + * Flow data to the chart.

    + * By this API, you can append new data points to the chart. + * @method flow + * @instance + * @memberof Chart + * @param {Object} args The object can consist with following members:
    + * + * | Key | Type | Description | + * | --- | --- | --- | + * | json | Object | Data as JSON format (@see [data․json](Options.html#.data%25E2%2580%25A4json)) | + * | rows | Array | Data in array as row format (@see [data․rows](Options.html#.data%25E2%2580%25A4json)) | + * | columns | Array | Data in array as column format (@see [data․columns](Options.html#.data%25E2%2580%25A4columns)) | + * | to | String | The lower x edge will move to that point. If not given, the lower x edge will move by the number of given data points | + * | length | Number | The lower x edge will move by the number of this argument | + * | duration | Number | The duration of the transition will be specified value. If not given, transition.duration will be used as default | + * | done | Function | The specified function will be called when flow ends | + * + * - **NOTE:** + * If json, rows and columns given, the data will be loaded.
    + * If data that has the same target id is given, the chart will be appended.
    + * Otherwise, new target will be added. One of these is required when calling.
    + * If json specified, keys is required as well as data.json. + * @example + * // 2 data points will be apprended to the tail and popped from the head. + * // After that, 4 data points will be appended and no data points will be poppoed. + * chart.flow({ + * columns: [ + * ["x", "2018-01-11", "2018-01-21"], + * ["data1", 500, 200], + * ["data2", 100, 300], + * ["data3", 200, 120] + * ], + * to: "2013-01-11", + * done: function () { + * chart.flow({ + * columns: [ + * ["x", "2018-02-11", "2018-02-12", "2018-02-13", "2018-02-14"], + * ["data1", 200, 300, 100, 250], + * ["data2", 100, 90, 40, 120], + * ["data3", 100, 100, 300, 500] + * ], + * length: 2, + * duration: 1500 + * }); + * } + * }); + */ + flow: function flow(args) { + var data, + domain, + diff, + to, + $$ = this.internal, + notfoundIds = [], + orgDataCount = $$.getMaxDataCount(), + length = 0, + tail = 0; + if (args.json) data = $$.convertJsonToData(args.json, args.keys);else if (args.rows) data = $$.convertRowsToData(args.rows);else if (args.columns) data = $$.convertColumnsToData(args.columns);else return; + var targets = $$.convertDataToTargets(data, !0); // Update/Add data + + $$.data.targets.forEach(function (t) { + var found = !1; + + for (var i = 0; i < targets.length; i++) if (t.id === targets[i].id) { + found = !0, t.values[t.values.length - 1] && (tail = t.values[t.values.length - 1].index + 1), length = targets[i].values.length; + + for (var j = 0; j < length; j++) targets[i].values[j].index = tail + j, $$.isTimeSeries() || (targets[i].values[j].x = tail + j); + + t.values = t.values.concat(targets[i].values), targets.splice(i, 1); + break; + } + + found || notfoundIds.push(t.id); + }), $$.data.targets.forEach(function (t) { + for (var i = 0; i < notfoundIds.length; i++) if (t.id === notfoundIds[i]) { + tail = t.values[t.values.length - 1].index + 1; + + for (var j = 0; j < length; j++) t.values.push({ + id: t.id, + index: tail + j, + x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + j) : tail + j, + value: null + }); + } + }), $$.data.targets.length && targets.forEach(function (t) { + var missing = []; + + for (var i = $$.data.targets[0].values[0].index; i < tail; i++) missing.push({ + id: t.id, + index: i, + x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i, + value: null + }); + + t.values.forEach(function (v) { + v.index += tail, $$.isTimeSeries() || (v.x += tail); + }), t.values = missing.concat(t.values); + }), $$.data.targets = $$.data.targets.concat(targets); + // add remained + // check data count because behavior needs to change when it"s only one + // const dataCount = $$.getMaxDataCount(); + var baseTarget = $$.data.targets[0], + baseValue = baseTarget.values[0]; + // Set targets + // Redraw with new targets + isDefined(args.to) ? (length = 0, to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to, baseTarget.values.forEach(function (v) { + v.x < to && length++; + })) : isDefined(args.length) && (length = args.length), orgDataCount ? orgDataCount === 1 && $$.isTimeSeries() && (diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2, domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)], $$.updateXDomain(null, !0, !0, !1, domain)) : (diff = $$.isTimeSeries() ? baseTarget.values.length > 1 ? baseTarget.values[baseTarget.values.length - 1].x - baseValue.x : baseValue.x - $$.getXDomain($$.data.targets)[0] : 1, domain = [baseValue.x - diff, baseValue.x], $$.updateXDomain(null, !0, !0, !1, domain)), $$.updateTargets($$.data.targets), $$.redraw({ + flow: { + index: baseValue.index, + length: length, + duration: isValue(args.duration) ? args.duration : $$.config.transition_duration, + done: args.done, + orgDataCount: orgDataCount + }, + withLegend: !0, + withTransition: orgDataCount > 1, + withTrimXDomain: !1, + withUpdateXAxis: !0 + }); + } +}), extend(ChartInternal_ChartInternal.prototype, { + /** + * Generate flow + * @memberof ChartInternal + * @private + * @param {Object} args + * @return {Function} + */ + generateFlow: function generateFlow(args) { + var $$ = this, + config = $$.config; + return function () { + var translateX, + targets = args.targets, + flow = args.flow, + _args$shape$type = args.shape.type, + drawBar = _args$shape$type.bar, + drawLine = _args$shape$type.line, + drawArea = _args$shape$type.area, + _args$shape$pos = args.shape.pos, + cx = _args$shape$pos.cx, + cy = _args$shape$pos.cy, + xForText = _args$shape$pos.xForText, + yForText = _args$shape$pos.yForText, + xv = args.xv, + duration = args.duration, + scaleX = 1, + flowIndex = flow.index, + flowLength = flow.length, + flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex), + flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength), + orgDomain = $$.x.domain(), + durationForFlow = flow.duration || duration, + done = flow.done || function () {}, + wait = $$.generateWait(), + xgrid = $$.xgrid || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + xgridLines = $$.xgridLines || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainRegion = $$.mainRegion || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainText = $$.mainText || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainBar = $$.mainBar || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainLine = $$.mainLine || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainArea = $$.mainArea || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), + mainCircle = $$.mainCircle || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]); + + $$.flowing = !0, $$.data.targets.forEach(function (d) { + d.values.splice(0, flowLength); + }); + // update x domain to generate axis elements for flow + var domain = $$.updateXDomain(targets, !0, !0); // update elements related to x scale + + $$.updateXGrid && $$.updateXGrid(!0), flow.orgDataCount ? flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x) ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : $$.isTimeSeries() ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : translateX = $$.x(flowStart.x) - $$.x(flowEnd.x) : $$.data.targets[0].values.length === 1 ? $$.isTimeSeries() ? (flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0), flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1), translateX = $$.x(flowStart.x) - $$.x(flowEnd.x)) : translateX = diffDomain(domain) / 2 : translateX = $$.x(orgDomain[0]) - $$.x(domain[0]), scaleX = diffDomain(orgDomain) / diffDomain(domain); + var transform = "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)"); + $$.hideXGridFocus(); + var gt = Object(external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_["transition"])().ease(external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_["easeLinear"]).duration(durationForFlow); + wait.add([$$.axes.x.transition(gt).call(function (g) { + return $$.xAxis.setTransition(gt).create(g); + }), mainBar.transition(gt).attr("transform", transform), mainLine.transition(gt).attr("transform", transform), mainArea.transition(gt).attr("transform", transform), mainCircle.transition(gt).attr("transform", transform), mainText.transition(gt).attr("transform", transform), mainRegion.filter($$.isRegionOnX).transition(gt).attr("transform", transform), xgrid.transition(gt).attr("transform", transform), xgridLines.transition(gt).attr("transform", transform)]), gt.call(wait, function () { + var shapes = [], + texts = [], + eventRects = []; + + // remove flowed elements + if (flowLength) { + for (var index, i = 0; i < flowLength; i++) index = flowIndex + i, shapes.push(".".concat(config_classes.shape, "-").concat(index)), texts.push(".".concat(config_classes.text, "-").concat(index)), eventRects.push(".".concat(config_classes.eventRect, "-").concat(index)); + + $$.svg.selectAll(".".concat(config_classes.shapes)).selectAll(shapes).remove(), $$.svg.selectAll(".".concat(config_classes.texts)).selectAll(texts).remove(), $$.svg.selectAll(".".concat(config_classes.eventRects)).selectAll(eventRects).remove(), $$.svg.select(".".concat(config_classes.xgrid)).remove(); + } // draw again for removing flowed elements and reverting attr + + + if (xgrid.size() && xgrid.attr("transform", null).attr($$.xgridAttr), xgridLines.attr("transform", null), xgridLines.select("line").attr("x1", config.axis_rotated ? 0 : xv).attr("x2", config.axis_rotated ? $$.width : xv), xgridLines.select("text").attr("x", config.axis_rotated ? $$.width : 0).attr("y", xv), mainBar.attr("transform", null).attr("d", drawBar), mainLine.attr("transform", null).attr("d", drawLine), mainArea.attr("transform", null).attr("d", drawArea), mainCircle.attr("transform", null), $$.isCirclePoint()) mainCircle.attr("cx", cx).attr("cy", cy);else { + var xFunc = function (d) { + return cx(d) - config.point_r; + }, + yFunc = function (d) { + return cy(d) - config.point_r; + }; + + mainCircle.attr("x", xFunc).attr("y", yFunc).attr("cx", cx) // when pattern is used, it possibly contain 'circle' also. + .attr("cy", cy); + } + mainText.attr("transform", null).attr("x", xForText).attr("y", yForText).style("fill-opacity", $$.opacityForText.bind($$)), mainRegion.attr("transform", null), mainRegion.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$)), config.interaction_enabled && $$.redrawEventRect(), done(), $$.flowing = !1; + }); + }; + } +}); +// CONCATENATED MODULE: ./src/api/api.selection.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + + +extend(Chart_Chart.prototype, { + /** + * Get selected data points.

    + * By this API, you can get selected data points information. To use this API, data.selection.enabled needs to be set true. + * @method selected + * @instance + * @memberof Chart + * @param {String} [targetId] You can filter the result by giving target id that you want to get. If not given, all of data points will be returned. + * @return {Array} dataPoint Array of the data points.
    ex.) `[{x: 1, value: 200, id: "data1", index: 1, name: "data1"}, ...]` + * @example + * // all selected data points will be returned. + * chart.selected(); + * // --> ex.) [{x: 1, value: 200, id: "data1", index: 1, name: "data1"}, ... ] + * + * // all selected data points of data1 will be returned. + * chart.selected("data1"); + */ + selected: function selected(targetId) { + var $$ = this.internal, + dataPoint = []; + return $$.main.selectAll(".".concat(config_classes.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll(".".concat(config_classes.shape)).filter(function () { + return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.SELECTED); + }).each(function (d) { + return dataPoint.push(d); + }), dataPoint; + }, + + /** + * Set data points to be selected. (`[data.selection.enabled](Options.html#.data%25E2%2580%25A4selection%25E2%2580%25A4enabled) option should be set true to use this method)` + * @method select + * @instance + * @memberof Chart + * @param {String|Array} [ids] id value to get selected. + * @param {Array} [indices] The index array of data points. If falsy value given, will select all data points. + * @param {Boolean} [resetOther] Unselect already selected. + * @example + * // select all data points + * chart.select(); + * + * // select all from 'data2' + * chart.select("data2"); + * + * // select all from 'data1' and 'data2' + * chart.select(["data1", "data2"]); + * + * // select from 'data1', indices 2 and unselect others selected + * chart.select("data1", [2], true); + * + * // select from 'data1', indices 0, 3 and 5 + * chart.select("data1", [0, 3, 5]); + */ + select: function select(ids, indices, resetOther) { + var $$ = this.internal, + config = $$.config; + config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) { + var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + id = d.data ? d.data.id : d.id, + toggle = $$.getToggle(this, d).bind($$), + isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, + isTargetIndex = !indices || indices.indexOf(i) >= 0, + isSelected = shape.classed(config_classes.SELECTED); + // line/area selection not supported yet + shape.classed(config_classes.line) || shape.classed(config_classes.area) || (isTargetId && isTargetIndex ? config.data_selection_isselectable(d) && !isSelected && toggle(!0, shape.classed(config_classes.SELECTED, !0), d, i) : isDefined(resetOther) && resetOther && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i)); + }); + }, + + /** + * Set data points to be un-selected. + * @method unselect + * @instance + * @memberof Chart + * @param {String|Array} [ids] id value to be unselected. + * @param {Array} [indices] The index array of data points. If falsy value given, will select all data points. + * @example + * // unselect all data points + * chart.unselect(); + * + * // unselect all from 'data1' + * chart.unselect("data1"); + * + * // unselect from 'data1', indices 2 + * chart.unselect("data1", [2]); + */ + unselect: function unselect(ids, indices) { + var $$ = this.internal, + config = $$.config; + config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) { + var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), + id = d.data ? d.data.id : d.id, + toggle = $$.getToggle(this, d).bind($$), + isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, + isTargetIndex = !indices || indices.indexOf(i) >= 0, + isSelected = shape.classed(config_classes.SELECTED); + // line/area selection not supported yet + shape.classed(config_classes.line) || shape.classed(config_classes.area) || isTargetId && isTargetIndex && config.data_selection_isselectable(d) && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i); + }); + } +}); +// CONCATENATED MODULE: ./src/api/api.transform.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Change the type of the chart. + * @private + * @param {String|Array} targetIds + * @param {String} type + * @param {Object} optionsForRedraw + */ + +function transformTo(targetIds, type, optionsForRedraw) { + var $$ = this, + options = optionsForRedraw || { + withTransitionForAxis: !$$.hasArcType() + }; + // this is needed when transforming to arc + options.withTransitionForTransform = !1, $$.transiting = !1, $$.setTargetType(targetIds, type), $$.updateTargets($$.data.targets), $$.updateAndRedraw(options); +} + +extend(Chart_Chart.prototype, { + /** + * Change the type of the chart. + * @method transform + * @instance + * @memberof Chart + * @param {String} type Specify the type to be transformed. The types listed in data.type can be used. + * @param {String|Array} targetIds Specify targets to be transformed. If not given, all targets will be the candidate. + * @example + * // all targets will be bar chart. + * chart.transform("bar"); + * + * // only data1 will be bar chart. + * chart.transform("bar", "data1"); + * + * // only data1 and data2 will be bar chart. + * chart.transform("bar", ["data1", "data2"]); + */ + transform: function transform(type, targetIds) { + var $$ = this.internal, + options = ["pie", "donut"].indexOf(type) >= 0 ? { + withTransform: !0 + } : null; + transformTo.bind($$)(targetIds, type, options); + } +}); +// CONCATENATED MODULE: ./src/api/api.group.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Update groups for the targets. + * @method groups + * @instance + * @memberof Chart + * @param {Array} groups This argument needs to be an Array that includes one or more Array that includes target ids to be grouped. + * @return {Array} Grouped data names array + * @example + * // data1 and data2 will be a new group. + * chart.groups([ + * ["data1", "data2"] + * ]); + */ + groups: function groups(_groups) { + var $$ = this.internal, + config = $$.config; + return isUndefined(_groups) ? config.data_groups : (config.data_groups = _groups, $$.redraw(), config.data_groups); + } +}); +// CONCATENATED MODULE: ./src/api/api.grid.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Update x grid lines. + * @method xgrids + * @instance + * @memberof Chart + * @param {Array} grids X grid lines will be replaced with this argument. The format of this argument is the same as grid.x.lines. + * @example + * // Show 2 x grid lines + * chart.xgrids([ + * {value: 1, text: "Label 1"}, + * {value: 4, text: "Label 4"} + * ]); + */ + +var xgrids = function (grids) { + var $$ = this.internal, + config = $$.config; + return grids ? (config.grid_x_lines = grids, $$.redrawWithoutRescale(), config.grid_x_lines) : config.grid_x_lines; +}; + +extend(xgrids, { + /** + * Add x grid lines.
    + * This API adds new x grid lines instead of replacing like xgrids. + * @method xgrids․add + * @instance + * @memberof Chart + * @param {Array|Object} grids New x grid lines will be added. The format of this argument is the same as grid.x.lines and it's possible to give an Object if only one line will be added. + * @example + * // Add a new x grid line + * chart.xgrids.add( + * {value: 4, text: "Label 4"} + * ); + * + * // Add new x grid lines + * chart.xgrids.add([ + * {value: 2, text: "Label 2"}, + * {value: 4, text: "Label 4"} + * ]); + */ + add: function add(grids) { + return this.xgrids(this.internal.config.grid_x_lines.concat(grids || [])); + }, + + /** + * Remove x grid lines.
    + * This API removes x grid lines. + * @method xgrids․remove + * @instance + * @memberof Chart + * @param {Object} params This argument should include value or class. If value is given, the x grid lines that have specified x value will be removed. If class is given, the x grid lines that have specified class will be removed. If args is not given, all of x grid lines will be removed. + * @example + * // x grid line on x = 2 will be removed + * chart.xgrids.remove({value: 2}); + * + * // x grid lines that have 'grid-A' will be removed + * chart.xgrids.remove({ + * class: "grid-A" + * }); + * + * // all of x grid lines will be removed + * chart.xgrids.remove(); + */ + remove: function remove(params) { + // TODO: multiple + this.internal.removeGridLines(params, !0); + } +}); + +/** + * Update y grid lines. + * @method ygrids + * @instance + * @memberof Chart + * @param {Array} grids Y grid lines will be replaced with this argument. The format of this argument is the same as grid.y.lines. + * @example + * // Show 2 y grid lines + * chart.ygrids([ + * {value: 100, text: "Label 1"}, + * {value: 400, text: "Label 4"} + * ]); + */ +var ygrids = function (grids) { + var $$ = this.internal, + config = $$.config; + return grids ? (config.grid_y_lines = grids, $$.redrawWithoutRescale(), config.grid_y_lines) : config.grid_y_lines; +}; + +extend(ygrids, { + /** + * Add y grid lines.
    + * This API adds new y grid lines instead of replacing like ygrids. + * @method ygrids․add + * @instance + * @memberof Chart + * @param {Array|Object} grids New y grid lines will be added. The format of this argument is the same as grid.y.lines and it's possible to give an Object if only one line will be added. + * @example + * // Add a new x grid line + * chart.ygrids.add( + * {value: 400, text: "Label 4"} + * ); + * + * // Add new x grid lines + * chart.ygrids.add([ + * {value: 200, text: "Label 2"}, + * {value: 400, text: "Label 4"} + * ]); + */ + add: function add(grids) { + return this.ygrids(this.internal.config.grid_y_lines.concat(grids || [])); + }, + + /** + * Remove y grid lines.
    + * This API removes x grid lines. + * @method ygrids․remove + * @instance + * @memberof Chart + * @param {Object} params This argument should include value or class. If value is given, the y grid lines that have specified y value will be removed. If class is given, the y grid lines that have specified class will be removed. If args is not given, all of y grid lines will be removed. + * @example + * // y grid line on y = 200 will be removed + * chart.ygrids.remove({value: 200}); + * + * // y grid lines that have 'grid-A' will be removed + * chart.ygrids.remove({ + * class: "grid-A" + * }); + * + * // all of y grid lines will be removed + * chart.ygrids.remove(); + */ + remove: function remove(params) { + // TODO: multiple + this.internal.removeGridLines(params, !1); + } +}), extend(Chart_Chart.prototype, { + xgrids: xgrids, + ygrids: ygrids +}); +// CONCATENATED MODULE: ./src/api/api.region.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +/** + * Update regions. + * @method regions + * @instance + * @memberof Chart + * @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as regions. + * @return {Array} regions + * @example + * // Show 2 regions + * chart.regions([ + * {axis: "x", start: 5, class: "regionX"}, + * {axis: "y", end: 50, class: "regionY"} + * ]); + */ + +var api_region_regions = function (_regions) { + var $$ = this.internal, + config = $$.config; + return _regions ? (config.regions = _regions, $$.redrawWithoutRescale(), _regions) : config.regions; +}; + +extend(api_region_regions, { + /** + * Add new region.

    + * This API adds new region instead of replacing like regions. + * @method regions․add + * @instance + * @memberof Chart + * @param {Array|Object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added. + * @return {Array} regions + * @example + * // Add a new region + * chart.regions.add( + * {axis: "x", start: 5, class: "regionX"} + * ); + * + * // Add new regions + * chart.regions.add([ + * {axis: "x", start: 5, class: "regionX"}, + * {axis: "y", end: 50, class: "regionY"} + *]); + */ + add: function add(regions) { + var $$ = this.internal, + config = $$.config; + return regions ? (config.regions = config.regions.concat(regions), $$.redrawWithoutRescale(), config.regions) : config.regions; + }, + + /** + * Remove regions.

    + * This API removes regions. + * @method regions․remove + * @instance + * @memberof Chart + * @param {Object} regions This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be removed. + * @return {Array} regions Removed regions + * @example + * // regions that have 'region-A' or 'region-B' will be removed. + * chart.regions.remove({ + * classes: [ + * "region-A", "region-B" + * ] + * }); + * + * // all of regions will be removed. + * chart.regions.remove(); + */ + remove: function remove(optionsValue) { + var $$ = this.internal, + config = $$.config, + options = optionsValue || {}, + duration = getOption(options, "duration", config.transition_duration), + classes = getOption(options, "classes", [config_classes.region]), + regions = $$.main.select(".".concat(config_classes.regions)).selectAll(classes.map(function (c) { + return ".".concat(c); + })); + return (duration ? regions.transition().duration(duration) : regions).style("opacity", "0").remove(), regions = config.regions, Object.keys(options).length ? (regions = regions.filter(function (region) { + var found = !1; + return !region.class || (region.class.split(" ").forEach(function (c) { + classes.indexOf(c) >= 0 && (found = !0); + }), !found); + }), config.regions = regions) : config.regions = [], regions; + } +}), extend(Chart_Chart.prototype, { + regions: api_region_regions +}); +// CONCATENATED MODULE: ./src/api/api.data.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Get data loaded in the chart. + * @method data + * @instance + * @memberof Chart + * @param {String|Array} targetIds If this argument is given, this API returns the specified target data. If this argument is not given, all of data will be returned. + * @return {Array} Data objects + * @example + * // Get only data1 data + * chart.data("data1"); + * // --> [{id: "data1", id_org: "data1", values: Array(6)}, ...] + * + * // Get data1 and data2 data + * chart.data(["data1", "data2"]); + * + * // Get all data + * chart.data(); + */ + +var api_data_data = function (targetIds) { + var targets = this.internal.data.targets; + return isUndefined(targetIds) ? targets : targets.filter(function (t) { + return targetIds.indexOf(t.id) >= 0; + }); +}; + +extend(api_data_data, { + /** + * Get data shown in the chart. + * @method data․shown + * @instance + * @memberof Chart + * @param {String|Array} targetIds If this argument is given, this API filters the data with specified target ids. If this argument is not given, all shown data will be returned. + * @return {Array} Data objects + * @example + * // Get shown data by filtering to include only data1 data + * chart.data.shown("data1"); + * // --> [{id: "data1", id_org: "data1", values: Array(6)}, ...] + * + * // Get shown data by filtering to include data1 and data2 data + * chart.data.shown(["data1", "data2"]); + * + * // Get all shown data + * chart.data.shown(); + */ + shown: function shown(targetIds) { + return this.internal.filterTargetsToShow(this.data(targetIds)); + }, + + /** + * Get values of the data loaded in the chart. + * @method data․values + * @instance + * @memberof Chart + * @param {String|Array} targetIds This API returns the values of specified target. If this argument is not given, null will be retruned + * @return {Array} Data values + * @example + * // Get data1 values + * chart.data.values("data1"); + * // --> [10, 20, 30, 40] + */ + values: function (targetId) { + var flat = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1], + values = null; + + if (targetId) { + var targets = this.data(targetId); + targets && isArray(targets) && (values = [], targets.forEach(function (v) { + var dataValue = v.values.map(function (d) { + return d.value; + }); + flat ? values = values.concat(dataValue) : values.push(dataValue); + })); + } + + return values; + }, + + /** + * Get and set names of the data loaded in the chart. + * @method data․names + * @instance + * @memberof Chart + * @param {Object} names If this argument is given, the names of data will be updated. If not given, the current names will be returned. The format of this argument is the same as + * @return {Object} Corresponding names according its key value, if specified names values. + * @example + * // Get current names + * chart.data.names(); + * // --> {data1: "test1", data2: "test2"} + * + * // Update names + * chart.data.names({ + * data1: "New Name 1", + * data2: "New Name 2" + *}); + */ + names: function names(_names) { + return this.internal.clearLegendItemTextBoxCache(), this.internal.updateDataAttributes("names", _names); + }, + + /** + * Get and set colors of the data loaded in the chart. + * @method data․colors + * @instance + * @memberof Chart + * @param {Object} colors If this argument is given, the colors of data will be updated. If not given, the current colors will be returned. The format of this argument is the same as [data.colors](./Options.html#.data%25E2%2580%25A4colors). + * @return {Object} Corresponding data color value according its key value. + * @example + * // Get current colors + * chart.data.colors(); + * // --> {data1: "#00c73c", data2: "#fa7171"} + * + * // Update colors + * chart.data.colors({ + * data1: "#FFFFFF", + * data2: "#000000" + * }); + */ + colors: function colors(_colors) { + return this.internal.updateDataAttributes("colors", _colors); + }, + + /** + * Get and set axes of the data loaded in the chart. + * @method data․axes + * @instance + * @memberof Chart + * @param {Object} axes If this argument is given, the axes of data will be updated. If not given, the current axes will be returned. The format of this argument is the same as + * @return {Object} Corresponding axes value for data, if specified axes value. + * @example + * // Get current axes + * chart.data.axes(); + * // --> {data1: "y"} + * + * // Update axes + * chart.data.axes({ + * data1: "y", + * data2: "y2" + * }); + */ + axes: function axes(_axes) { + return this.internal.updateDataAttributes("axes", _axes); + }, + + /** + * Get the minimum data value bound to the chart + * @method data․min + * @instance + * @memberof Chart + * @return {Array} Data objects + * @example + * // Get current axes + * chart.data.min(); + * // --> [{x: 0, value: 30, id: "data1", index: 0}, ...] + */ + min: function min() { + return this.internal.getMinMaxData().min; + }, + + /** + * Get the maximum data value bound to the chart + * @method data․max + * @instance + * @memberof Chart + * @return {Array} Data objects + * @example + * // Get current axes + * chart.data.max(); + * // --> [{x: 3, value: 400, id: "data1", index: 3}, ...] + */ + max: function max() { + return this.internal.getMinMaxData().max; + } +}), extend(Chart_Chart.prototype, { + data: api_data_data +}); +// CONCATENATED MODULE: ./src/api/api.category.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Set specified category name on category axis. + * @method category + * @instance + * @memberof Chart + * @param {Number} i index of category to be changed + * @param {String} category category value to be changed + * @example + * chart.category(2, "Category 3"); + */ + category: function category(i, _category) { + var $$ = this.internal, + config = $$.config; + return arguments.length > 1 && (config.axis_x_categories[i] = _category, $$.redraw()), config.axis_x_categories[i]; + }, + + /** + * Set category names on category axis. + * @method categories + * @instance + * @memberof Chart + * @param {Array} categories This must be an array that includes category names in string. If category names are included in the date by data.x option, this is not required. + * @example + * chart.categories([ + * "Category 1", "Category 2", ... + * ]); + */ + categories: function categories(_categories) { + var $$ = this.internal, + config = $$.config; + return arguments.length ? (config.axis_x_categories = _categories, $$.redraw(), config.axis_x_categories) : config.axis_x_categories; + } +}); +// CONCATENATED MODULE: ./src/api/api.color.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Get the color + * @method color + * @instance + * @memberof Chart + * @param {String} id id to get the color + * @example + * chart.color("data1"); + */ + color: function color(id) { + return this.internal.color(id); // more patterns + } +}); +// CONCATENATED MODULE: ./src/api/api.x.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +extend(Chart_Chart.prototype, { + /** + * Get and set x values for the chart. + * @method x + * @instance + * @memberof Chart + * @param {Array} x If x is given, x values of every target will be updated. If no argument is given, current x values will be returned as an Object whose keys are the target ids. + * @return {Object} xs + * @example + * // Get current x values + * chart.x(); + * + * // Update x values for all targets + * chart.x([100, 200, 300, 400, ...]); + */ + x: function x(_x) { + var $$ = this.internal, + isCategorized = $$.isCustomX() && $$.isCategorized(); + return isArray(_x) && (isCategorized ? $$.api.categories(_x) : ($$.updateTargetX($$.data.targets, _x), $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0 + }))), isCategorized ? $$.api.categories() : $$.data.xs; + }, + + /** + * Get and set x values for the chart. + * @method xs + * @instance + * @memberof Chart + * @param {Array} xs If xs is given, specified target's x values will be updated. If no argument is given, current x values will be returned as an Object whose keys are the target ids. + * @return {Object} xs + * @example + * // Get current x values + * chart.xs(); + * + * // Update x values for all targets + * chart.xs({ + * data1: [10, 20, 30, 40, ...], + * data2: [100, 200, 300, 400, ...] + * }); + */ + xs: function xs(_xs) { + var $$ = this.internal; + return isObject(_xs) && ($$.updateTargetXs($$.data.targets, _xs), $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0 + })), $$.data.xs; + } +}); +// CONCATENATED MODULE: ./src/api/api.axis.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Set the min/max value + * @param {Chart} $$ + * @param {String} type + * @param {Object} value + * @return {undefined} + * @private + */ + +var setMinMax = function ($$, type, value) { + var config = $$.config, + axisX = "axis_x_".concat(type), + axisY = "axis_y_".concat(type), + axisY2 = "axis_y2_".concat(type); + return isDefined(value) && (isObjectType(value) ? (isValue(value.x) && (config[axisX] = value.x), isValue(value.y) && (config[axisY] = value.y), isValue(value.y2) && (config[axisY2] = value.y2)) : (config[axisY] = value, config[axisY2] = value), $$.redraw({ + withUpdateOrgXDomain: !0, + withUpdateXDomain: !0 + })), undefined; +}, + api_axis_getMinMax = function ($$, type) { + var config = $$.config; + return { + x: config["axis_x_".concat(type)], + y: config["axis_y_".concat(type)], + y2: config["axis_y2_".concat(type)] + }; +}, + api_axis_axis = extend(function () {}, { + /** + * Get and set axis labels. + * @method axis․labels + * @instance + * @memberof Chart + * @param {Object} labels specified axis' label to be updated. + * @example + * // Update axis' label + * chart.axis.labels({ + * x: "New X Axis Label", + * y: "New Y Axis Label" + * }); + */ + labels: function labels(_labels) { + var $$ = this.internal; + arguments.length && (Object.keys(_labels).forEach(function (axisId) { + $$.axis.setLabelText(axisId, _labels[axisId]); + }), $$.axis.updateLabels()); + }, + + /** + * Get and set axis min value. + * @method axis․min + * @instance + * @memberof Chart + * @param {Object} min If min is given, specified axis' min value will be updated.
    + * If no argument is given, the min values set on generating option for each axis will be returned. + * If not set any min values on generation, it will return `undefined`. + * @example + * // Update axis' min + * chart.axis.min({ + * x: -10, + * y: 1000, + * y2: 100 + * }); + */ + min: function min(_min) { + var $$ = this.internal; + return arguments.length ? setMinMax($$, "min", _min) : api_axis_getMinMax($$, "min"); + }, + + /** + * Get and set axis max value. + * @method axis․max + * @instance + * @memberof Chart + * @param {Object} max If max is given, specified axis' max value will be updated.
    + * If no argument is given, the max values set on generating option for each axis will be returned. + * If not set any max values on generation, it will return `undefined`. + * @example + * // Update axis' label + * chart.axis.max({ + * x: 100, + * y: 1000, + * y2: 10000 + * }); + */ + max: function max(_max) { + var $$ = this.internal; + return arguments.length ? setMinMax($$, "max", _max) : api_axis_getMinMax($$, "max"); + }, + + /** + * Get and set axis min and max value. + * @method axis․range + * @instance + * @memberof Chart + * @param {Object} range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned. + * @example + * // Update axis' label + * chart.axis.range({ + * min: { + * x: -10, + * y: -1000, + * y2: -10000 + * }, + * max: { + * x: 100, + * y: 1000, + * y2: 10000 + * }, + * }); + */ + range: function range(_range) { + var axis = this.axis; + if (arguments.length) isDefined(_range.max) && axis.max(_range.max), isDefined(_range.min) && axis.min(_range.min);else return { + max: axis.max(), + min: axis.min() + }; + return undefined; + } +}); +/** + * Get the min/max value + * @param {Chart} $$ + * @param {String} type + * @return {{x, y, y2}} + * @private + */ + + +extend(Chart_Chart.prototype, { + axis: api_axis_axis +}); +// CONCATENATED MODULE: ./src/api/api.legend.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Define legend + * @ignore + */ + +var legend = extend(function () {}, { + /** + * Show legend for each target. + * @method legend․show + * @instance + * @memberof Chart + * @param {String|Array} targetIds + * - If targetIds is given, specified target's legend will be shown. + * - If only one target is the candidate, String can be passed. + * - If no argument is given, all of target's legend will be shown. + * @example + * // Show legend for data1. + * chart.legend.show("data1"); + * + * // Show legend for data1 and data2. + * chart.legend.show(["data1", "data2"]); + * + * // Show all legend. + * chart.legend.show(); + */ + show: function show(targetIds) { + var $$ = this.internal; + $$.showLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({ + withLegend: !0 + }); + }, + + /** + * Hide legend for each target. + * @method legend․hide + * @instance + * @memberof Chart + * @param {String|Array} targetIds + * - If targetIds is given, specified target's legend will be hidden. + * - If only one target is the candidate, String can be passed. + * - If no argument is given, all of target's legend will be hidden. + * @example + * // Hide legend for data1. + * chart.legend.hide("data1"); + * + * // Hide legend for data1 and data2. + * chart.legend.hide(["data1", "data2"]); + * + * // Hide all legend. + * chart.legend.hide(); + */ + hide: function hide(targetIds) { + var $$ = this.internal; + $$.hideLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({ + withLegend: !0 + }); + } +}); +extend(Chart_Chart.prototype, { + legend: legend +}); +// CONCATENATED MODULE: ./src/internals/browser.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + +/** + * Window object + * @module + * @ignore + */ + +/* eslint-disable no-new-func */ + +var win = isDefined(window) && window.Math === Math ? window : isDefined(self) && (self.Math === Math ? self : Function("return this")()), + browser_doc = win.document; +/* eslint-enable no-new-func */ + + +// CONCATENATED MODULE: ./src/api/api.chart.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +extend(Chart_Chart.prototype, { + /** + * Resize the chart. + * @method resize + * @instance + * @memberof Chart + * @param {Object} size This argument should include width and height in pixels. + * @example + * // Resize to 640x480 + * chart.resize({ + * width: 640, + * height: 480 + * }); + */ + resize: function resize(size) { + var config = this.internal.config; + config.size_width = size ? size.width : null, config.size_height = size ? size.height : null, this.flush(); + }, + + /** + * Force to redraw. + * @method flush + * @instance + * @memberof Chart + * @param {Boolean} [soft] For soft redraw. + * @example + * chart.flush(); + * + * // for soft redraw + * chart.flush(true); + */ + flush: function flush(soft) { + var $$ = this.internal; // reset possible zoom scale + + $$.zoomScale = null, soft ? $$.redraw({ + withTransform: !0, + withUpdateXDomain: !0, + withUpdateOrgXDomain: !0, + withLegend: !0 + }) : $$.updateAndRedraw({ + withLegend: !0, + withTransition: !1, + withTransitionForTransform: !1 + }); + }, + + /** + * Reset the chart object and remove element and events completely. + * @method destroy + * @instance + * @memberof Chart + * @example + * chart.destroy(); + */ + destroy: function destroy() { + var _this = this, + $$ = this.internal; + + return notEmpty($$) && ($$.charts.splice($$.charts.indexOf(this), 1), isDefined($$.resizeTimeout) && win.clearTimeout($$.resizeTimeout), win.removeEventListener("resize", $$.resizeFunction), $$.selectChart.classed("bb", !1).html(""), Object.keys(this).forEach(function (key) { + key === "internal" && Object.keys($$).forEach(function (k) { + $$[k] = null; + }), _this[key] = null, delete _this[key]; + })), null; + }, + + /** + * Get or set single config option value. + * @method config + * @instance + * @memberof Chart + * @param {String} name The option key name. + * @param {*} [value] The value accepted for indicated option. + * @param {Boolean} [redraw] Set to redraw with the new option changes. + * - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only. + * @example + * // Getter + * chart.config("gauge.max"); + * + * // Setter + * chart.config("gauge.max", 100); + * + * // Setter & redraw with the new option + * chart.config("gauge.max", 100, true); + */ + config: function config(name, value, redraw) { + var res, + $$ = this.internal, + key = name && name.replace(/\./g, "_"); + return key in $$.config && (isDefined(value) ? ($$.config[key] = value, res = value, redraw && this.flush(!0)) : res = $$.config[key]), res; + } +}); +// CONCATENATED MODULE: ./src/api/api.tooltip.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +/** + * Define tooltip + * @ignore + */ + +var tooltip = extend(function () {}, { + /** + * Show tooltip + * @method tooltip․show + * @instance + * @memberof Chart + * @param {Object} args The object can consist with following members:
    + * + * | Key | Type | Description | + * | --- | --- | --- | + * | index | Number | Determine focus by index | + * | x | Number | Date | Determine focus by x Axis index | + * | mouse | Array | Determine x and y coordinate value relative the targeted x Axis element.
    It should be used along with `data`, `index` or `x` value. The default value is set as `[0,0]` | + * | data | Object | When [data.xs](Options.html#.data%25E2%2580%25A4xs) option is used or [tooltip.grouped](Options.html#.tooltip) set to 'false', `should be used giving this param`.

    **Key:**
    - x {Number | Date}: x Axis value
    - index {Number}: x Axis index (useless for data.xs)
    - id {String}: Axis id. 'y' or 'y2'(default 'y')
    - value {Number}: The corresponding value for tooltip. | + * + * @example + * // show the 2nd x Axis coordinate tooltip + * chart.tooltip.show({ + * index: 1 + * }); + * + * // show tooltip for the 3rd x Axis in x:50 and y:100 coordinate relative the x Axis element. + * chart.tooltip.show({ + * data: {x: 2}, + * mouse: [50, 100] + * }); + * + * // show tooltip for timeseries x axis + * chart.tooltip.show({ + * x: new Date("2018-01-02 00:00") + * }); + * + * // when data.xs is used + * chart.tooltip.show({ + * data: { + * x: 3, // x Axis value + * id: "y", // axis id. 'y' or 'y2' (default 'y') + * value: 500 // data value + * } + * }); + * + * // when data.xs isn't used, but tooltip.grouped=false is set + * chart.tooltip.show({ + * data: { + * index: 3, // or 'x' key value + * id: "y", // axis id. 'y' or 'y2' (default 'y') + * value: 500 // data value + * } + * }); + */ + show: function show() { + var index, + mouse, + args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + $$ = this.internal; + + // determine focus data + if (args.mouse && (mouse = args.mouse), args.data) { + var y = $$.getYScale(args.data.id)(args.data.value); + $$.isMultipleX() ? mouse = [$$.x(args.data.x), y] : (!$$.config.tooltip_grouped && (mouse = [0, y]), index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x)); + } else isDefined(args.x) ? index = $$.getIndexByX(args.x) : isDefined(args.index) && (index = args.index); // emulate events to show + + + ($$.inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(function (eventName) { + $$.dispatchEvent(eventName, index, mouse); + }); + }, + + /** + * Hide tooltip + * @method tooltip․hide + * @instance + * @memberof Chart + */ + hide: function hide() { + var $$ = this.internal; + $$.hideTooltip(), $$.hideXGridFocus(), $$.unexpandCircles(), $$.unexpandBars(); + } +}); +extend(Chart_Chart.prototype, { + tooltip: tooltip +}); +// CONCATENATED MODULE: ./src/internals/ua.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + +var ua = window.navigator.userAgent; +extend(ChartInternal_ChartInternal.prototype, { + isSafari: function isSafari() { + return ua.indexOf("Safari") > -1 && !this.isChrome(); + }, + isChrome: function isChrome() { + return ua.indexOf("Chrome") > -1; + }, + isMobile: function isMobile() { + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent + return ua.indexOf("Mobi") > -1; + } +}); +// CONCATENATED MODULE: ./src/api/api.export.js +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ + + + +/** + * Encode to base64 + * @param {String} str + * @return {String} + * @private + * @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding + */ + +var b64EncodeUnicode = function (str) { + return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) { + return String.fromCharCode("0x".concat(p)); + })); +}, + nodeToSvgDataUrl = function (node, size) { + var clone = node.cloneNode(!0), + styleSheets = toArray(document.styleSheets), + cssRules = getCssRules(styleSheets), + cssText = cssRules.filter(function (r) { + return r.cssText; + }).map(function (r) { + return r.cssText; + }); + clone.setAttribute("xmlns", external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].xhtml); + var nodeXml = new XMLSerializer().serializeToString(clone), + dataStr = "\n\t\t\t\n\t\t\t\t\n\t\t\t\t").concat(nodeXml.replace(/(url\()[^#]+/g, "$1"), "\n\t\t\t").replace("/\n/g", "%0A"); // foreignObject not supported in IE11 and below + // https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx + + return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr)); +}; +/** + * Convert svg node to data url + * @param {HTMLElement} node + * @return {String} + * @private + */ + + +extend(Chart_Chart.prototype, { + /** + * Export chart as an image. + * - **NOTE:** + * - IE11 and below not work properly due to the lack of the feature(
    foreignObject) support + * - The basic CSS file(ex. billboard.css) should be at same domain as API call context to get correct styled export image. + * @method export + * @instance + * @memberof Chart + * @param {String} [mimeType=image/png] The desired output image format. (ex. 'image/png' for png, 'image/jpeg' for jpeg format) + * @param {Function} [callback] The callback to be invoked when export is ready. + * @return {String} dataURI + * @example + * chart.export(); + * // --> "data:image/svg+xml;base64,PHN..." + * + * // Initialize the download automatically + * chart.export("image/png", dataUrl => { + * const link = document.createElement("a"); + * + * link.download = `${Date.now()}.png`; + * link.href = dataUrl; + * link.innerHTML = "Download chart as image"; + * + * document.body.appendChild(link); + * }); + */ + export: function _export(mimeType, callback) { + var $$ = this.internal, + size = { + width: $$.currentWidth, + height: $$.currentHeight + }, + svgDataUrl = nodeToSvgDataUrl(this.element, size); + + if (isFunction(callback)) { + var img = new Image(); + img.crosssOrigin = "Anonymous", img.onload = function () { + var canvas = document.createElement("canvas"), + ctx = canvas.getContext("2d"); + canvas.width = size.width, canvas.height = size.height, ctx.drawImage(img, 0, 0), callback(canvas.toDataURL(mimeType)); + }, img.src = svgDataUrl; + } + + return svgDataUrl; + } +}); +// EXTERNAL MODULE: ./src/scss/billboard.scss +var billboard = __webpack_require__(24); + +// CONCATENATED MODULE: ./src/core.js +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return bb; }); +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard project is licensed under the MIT license + */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // base CSS + + +/** + * @namespace bb + * @version 1.7.1-snapshot + */ + +var bb = { + /** + * Version information + * @property {String} version version + * @example + * bb.version; // "1.0.0" + * @memberof bb + */ + version: "1.7.1-snapshot", + + /** + * Generate chart + * @param {Options} options chart options + * @memberof bb + * @return {Chart} + * @see {@link Options} for different generation options + * @see {@link Chart} for different methods API + * @example + * + *
    + * @example + * // generate chart with options + * var chart = bb.generate({ + * "bindto": "#LineChart" + * "data": { + * "columns": [ + * ["data1", 30, 200, 100, 400, 150, 250], + * ["data2", 50, 20, 10, 40, 15, 25] + * ] + * } + * }); + * + * // call some API + * // ex) get the data of 'data1' + * chart.data("data1"); + */ + generate: function generate(config) { + var inst = new Chart_Chart(config); + return inst.internal.charts = this.instance, this.instance.push(inst), inst; + }, + + /** + * An array containing instance created + * @property {Array} instance instance array + * @example + * // generate charts + * var chart1 = bb.generate(...); + * var chart2 = bb.generate(...); + * + * bb.instance; // [ chart1, chart2, ... ] + * @memberof bb + */ + instance: [], + + /** + * Internal chart object + * @private + */ + chart: { + fn: Chart_Chart.prototype, + internal: { + fn: ChartInternal_ChartInternal.prototype, + axis: { + fn: Axis_Axis.prototype + } + } + } +}; + +/* harmony default export */ var core = __webpack_exports__["default"] = (bb); + +/***/ }) +/******/ ]); +}); +//# sourceMappingURL=billboard.js.map \ No newline at end of file