diff --git a/web/build/static/js/main.fdc0c048.chunk.js b/web/build/static/js/main.fdc0c048.chunk.js index 3b427a3..0a0630a 100644 --- a/web/build/static/js/main.fdc0c048.chunk.js +++ b/web/build/static/js/main.fdc0c048.chunk.js @@ -1 +1 @@ -(this.webpackJsonpweb = this.webpackJsonpweb || []).push([ [0], { 1002: function(e, t) {}, 1004: function(e, t) {}, 1044: function(e, t, n) { "use strict"; n.r(t); var r, a, o = n(2), c = n(0), s = n.n(c), i = n(13), u = n.n(i), l = n(258), d = n(14), h = n(15), m = n(12), j = n(1095), v = n(1091), b = n(1096), f = n(1098), g = n(20), O = n(1097); ! function(e) { e[e.showEmotes = 0] = "showEmotes", e[e.showName = 1] = "showName", e[e.showTimestamp = 2] = "showTimestamp", e[e.twitchChatMode = 3] = "twitchChatMode", e[e.newOnBottom = 4] = "newOnBottom" }(a || (a = {})); var p = new URL(window.location.href), x = { state: { queryClient: new O.a, apiBaseUrl: null !== (r = Object({ NODE_ENV: "production", PUBLIC_URL: "", WDS_SOCKET_HOST: void 0, WDS_SOCKET_PATH: void 0, WDS_SOCKET_PORT: void 0, FAST_REFRESH: !0 }).REACT_APP_API_BASE_URL) && void 0 !== r ? r : window.location.protocol + "//" + window.location.host, settings: { showEmotes: { displayName: "Show Emotes", value: !0 }, showName: { displayName: "Show Name", value: !0 }, showTimestamp: { displayName: "Show Timestamp", value: !0 }, twitchChatMode: { displayName: "Twitch Chat Mode", value: !1 }, newOnBottom: { displayName: "Newest messages on bottom", value: !1 } }, currentChannel: p.searchParams.get("channel"), currentUsername: p.searchParams.get("username"), showSwagger: p.searchParams.has("swagger"), error: !1 }, setState: function(e) {}, setCurrents: function() {}, setSettings: function(e) {}, setShowSwagger: function(e) {} }, w = Object(c.createContext)(x), y = w.Provider, C = function(e) { var t = e.children, n = function(e, t) { var n = Object(c.useState)((function() { try { var n = window.localStorage.getItem(e); return n ? JSON.parse(n) : t } catch (r) { return console.log(r), s(t), t } })), r = Object(g.a)(n, 2), a = r[0], o = r[1], s = function(t) { try { var n = t instanceof Function ? t(a) : t; o(n), window.localStorage.setItem(e, JSON.stringify(n)) } catch (r) { console.log(r) } }, i = a; return "object" === typeof t && (i = Object(m.a)(Object(m.a)({}, t), a)), [i, s] }("justlog:settings", x.state.settings), r = Object(g.a)(n, 2), a = r[0], s = r[1], i = Object(c.useState)(Object(m.a)(Object(m.a)({}, x.state), {}, { settings: a })), u = Object(g.a)(i, 2), l = u[0], d = u[1]; return Object(o.jsx)(y, { value: { state: l, setState: d, setSettings: function(e) { for (var t = 0, n = Object.keys(e); t < n.length; t++) { var r = n[t]; "undefined" === typeof x.state.settings[r] && delete e[r] } l.queryClient.removeQueries("log"), s(e), d(Object(m.a)(Object(m.a)({}, l), {}, { settings: e })) }, setCurrents: function() { var e, t, n, r, a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null; a = null !== (e = null === (t = a) || void 0 === t ? void 0 : t.toLowerCase().trim()) && void 0 !== e ? e : null, o = null !== (n = null === (r = o) || void 0 === r ? void 0 : r.toLowerCase().trim()) && void 0 !== n ? n : null, d(Object(m.a)(Object(m.a)({}, l), {}, { currentChannel: a, currentUsername: o, error: !1 })); var c = new URL(window.location.href); a && c.searchParams.set("channel", a), o && c.searchParams.set("username", o), window.history.replaceState({}, "justlog", c.toString()) }, setShowSwagger: function(e) { var t = new URL(window.location.href); e ? t.searchParams.set("swagger", "") : t.searchParams.delete("swagger"), window.history.replaceState({}, "justlog", t.toString()), d(Object(m.a)(Object(m.a)({}, l), {}, { showSwagger: e })) } }, children: t }) }, S = { staleTime: 5e4 }; var N = n(283), L = n.n(N), E = n(1083), k = n(259); n(1027); function U() { var e = Object(d.a)(["\n position: absolute;\n top: 0;\n background: var(--bg);\n left: 0;\n right: 0;\n margin-top: 90px;\n z-index: 999;\n padding-bottom: 90px;\n\n .swagger-ui {\n background: var(--bg);\n \n .scheme-container {\n background: var(--bg-bright);\n }\n }\n"]); return U = function() { return e }, e } function P() { var e = Object(d.a)(["\n\n"]); return P = function() { return e }, e } var M = h.a.div(P()); function T() { var e = Object(c.useContext)(w), t = e.state, n = e.setShowSwagger; return Object(o.jsxs)(M, { children: [Object(o.jsx)(E.a, { "aria-controls": "docs", "aria-haspopup": "true", onClick: function() { n(!t.showSwagger) }, size: "small", color: t.showSwagger ? "primary" : "default", children: Object(o.jsx)(L.a, {}) }), Object(o.jsx)(R, { show: t.showSwagger })] }) } var z = h.a.div(U()); function R(e) { var t = e.show, n = Object(c.useContext)(w).state, r = new URL(n.apiBaseUrl); return u.a.createPortal(Object(o.jsx)(z, { style: { display: t ? "block" : "none" }, children: Object(o.jsx)(k.a, { url: "/swagger.json", requestInterceptor: function(e) { if (e.url.includes("swagger.json")) return e; var t = new URL(e.url); return t.host = r.host, t.protocol = r.protocol, t.port = r.port, e.url = t.toString(), e } }) }), document.body) } var D = n(115), H = n(1099), _ = n(288), B = n(1086), F = n(1087), Y = n(1088); function I() { var e = Object(d.a)(["\n\t\n"]); return I = function() { return e }, e } var A = h.a.div(I()); function W() { for (var e = Object(c.useContext)(w), t = e.state, n = e.setSettings, r = Object(c.useState)(null), a = Object(g.a)(r, 2), s = a[0], i = a[1], u = [], l = function() { var e = Object(g.a)(h[d], 2), r = e[0], a = e[1]; u.push(Object(o.jsxs)(H.a, { onClick: function() { return function(e, r) { var a = Object(m.a)(Object(m.a)({}, r), {}, { value: !r.value }); n(Object(m.a)(Object(m.a)({}, t.settings), {}, Object(D.a)({}, e, a))) }(r, a) }, children: [a.value ? Object(o.jsx)(B.a, {}) : Object(o.jsx)(F.a, {}), "\xa0\xa0", a.displayName] }, r)) }, d = 0, h = Object.entries(t.settings); d < h.length; d++) l(); return Object(o.jsxs)(A, { children: [Object(o.jsx)(E.a, { "aria-controls": "settings", "aria-haspopup": "true", onClick: function(e) { i(e.currentTarget) }, size: "small", children: Object(o.jsx)(Y.a, {}) }), Object(o.jsx)(_.a, { id: "settings", anchorEl: s, keepMounted: !0, open: Boolean(s), onClose: function() { i(null) }, children: u })] }) } function K() { var e = Object(d.a)(["\n text-align: center;\n"]); return K = function() { return e }, e } function V() { var e = Object(d.a)(["\n display: inline-flex;\n align-items: center;\n padding: 15px;\n background: var(--bg-bright);\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n\tmargin: 0 auto;\n z-index: 99;\n\n > * {\n margin-right: 15px !important; \n\n &:last-child {\n margin-right: 0 !important;\n }\n }\n"]); return V = function() { return e }, e } var q = h.a.form(V()), J = h.a.div(K()); function Q() { var e = Object(c.useContext)(w), t = e.setCurrents, n = e.state, r = Object(l.b)(), a = function() { var e = Object(c.useContext)(w).state, t = Object(f.a)("channels", (function() { var t = new URL("".concat(e.apiBaseUrl, "/channels")); return fetch(t.toString()).then((function(e) { if (e.ok) return e; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { return e.channels })) }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data; return null !== t && void 0 !== t ? t : [] }(); return Object(o.jsx)(J, { children: Object(o.jsxs)(q, { onSubmit: function(e) { if (e.preventDefault(), e.target instanceof HTMLFormElement) { var n = new FormData(e.target), a = n.get("channel"), o = n.get("username"); r.invalidateQueries(["log", { channel: null === a || void 0 === a ? void 0 : a.toLowerCase(), username: null === o || void 0 === o ? void 0 : o.toLowerCase() }]), t(a, o) } }, action: "none", children: [Object(o.jsx)(b.a, { id: "autocomplete-channels", options: a.map((function(e) { return e.name })), style: { width: 225 }, defaultValue: n.currentChannel, getOptionLabel: function(e) { return e }, clearOnBlur: !1, renderInput: function(e) { return Object(o.jsx)(j.a, Object(m.a)(Object(m.a)({}, e), {}, { name: "channel", label: "channel", variant: "filled", autoFocus: null === n.currentChannel })) } }), Object(o.jsx)(j.a, { error: n.error, name: "username", label: "username", variant: "filled", autoComplete: "off", defaultValue: n.currentUsername, autoFocus: null !== n.currentChannel && null === n.currentUsername }), Object(o.jsx)(v.a, { variant: "contained", color: "primary", size: "large", type: "submit", children: "load" }), Object(o.jsx)(W, {}), Object(o.jsx)(T, {})] }) }) } var G = n(285), X = n(286), Z = n(290), $ = n(291), ee = function(e) { Object(X.a)(n, e); var t = Object(Z.a)(n); function n() { return Object(G.a)(this, n), t.apply(this, arguments) } return n }(Object($.a)(Error)); function te(e) { return e.startsWith("id:") } function ne(e) { return e.replace("id:", "") } function re() { return Object(o.jsxs)("svg", { className: "txt", height: 32, viewBox: "0 0 32 32", width: 32, children: [Object(o.jsx)("title", {}), Object(o.jsx)("path", { d: "M21 26v2.003A1.995 1.995 0 0119.003 30H3.997A2 2 0 012 27.993V5.007C2 3.898 2.9 3 4.009 3H14v6.002c0 1.111.898 1.998 2.006 1.998H21v2h-8.993A3.003 3.003 0 009 15.999V23A2.996 2.996 0 0012.007 26H21zM15 3v5.997c0 .554.451 1.003.99 1.003H21l-6-7zm-3.005 11C10.893 14 10 14.9 10 15.992v7.016A2 2 0 0011.995 25h17.01C30.107 25 31 24.1 31 23.008v-7.016A2 2 0 0029.005 14h-17.01zM14 17v6h1v-6h2v-1h-5v1h2zm6 2.5L18 16h1l1.5 2.625L22 16h1l-2 3.5 2 3.5h-1l-1.5-2.625L19 23h-1l2-3.5zm6-2.5v6h1v-6h2v-1h-5v1h2z", fill: "#929292", fillRule: "evenodd" })] }) } var ae = n(1100), oe = n(1092), ce = n(25); function se(e, t, n, r) { var a = Object(c.useContext)(w).state, o = Object(f.a)(["log", { channel: e, username: t, year: n, month: r }], (function() { if (e && t) { var o = te(e), c = te(t); o && (e = ne(e)), c && (t = ne(t)); var s = new URL("".concat(a.apiBaseUrl, "/channel").concat(o ? "id" : "", "/").concat(e, "/user").concat(c ? "id" : "", "/").concat(t, "/").concat(n, "/").concat(r)); return s.searchParams.append("json", "1"), a.settings.newOnBottom.value || s.searchParams.append("reverse", "1"), fetch(s.toString()).then((function(e) { if (e.ok) return e; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { var t, n = [], r = Object(ce.a)(e.messages); try { for (r.s(); !(t = r.n()).done;) { var a = t.value; n.push(Object(m.a)(Object(m.a)({}, a), {}, { timestamp: new Date(a.timestamp), emotes: ie(a.text, a.tags.emotes) })) } } catch (o) { r.e(o) } finally { r.f() } return n })) } return [] }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data; return null !== o && void 0 !== o ? o : [] } function ie(e, t) { var n = []; if (!t) return n; var r, a = t.split("/"), o = Object(ce.a)(a); try { for (o.s(); !(r = o.n()).done;) { var c, s = r.value.split(":"), i = Object(g.a)(s, 2), u = i[0], l = i[1].split(","), d = Object(ce.a)(l); try { for (d.s(); !(c = d.n()).done;) { var h = c.value.split("-"), m = Object(g.a)(h, 2), j = m[0], v = m[1], b = Number(j), f = Number(v) + 1; n.push({ id: u, startIndex: b, endIndex: f, code: e.substr(b, f - b) }) } } catch (O) { d.e(O) } finally { d.f() } } } catch (O) { o.e(O) } finally { o.f() } return n } var ue = n(36), le = n.n(ue), de = n(59); function he(e) { return [].concat(Object(de.a)(function(e) { var t = Object(f.a)(["bttv:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve({ sharedEmotes: [], channelEmotes: [] }) : fetch("https://api.betterttv.net/3/cached/users/twitch/".concat(e)).then((function(e) { return e.json() })) }), S), n = t.isLoading, r = t.error, a = t.data; if (n) return []; if (r) return console.error(r), []; for (var o = [], c = 0, s = [].concat(Object(de.a)(null !== (i = null === a || void 0 === a ? void 0 : a.channelEmotes) && void 0 !== i ? i : []), Object(de.a)(null !== (u = null === a || void 0 === a ? void 0 : a.sharedEmotes) && void 0 !== u ? u : [])); c < s.length; c++) { var i, u, l = s[c]; o.push({ id: l.id, code: l.code, urls: { small: "https://cdn.betterttv.net/emote/".concat(l.id, "/1x"), medium: "https://cdn.betterttv.net/emote/".concat(l.id, "/2x"), big: "https://cdn.betterttv.net/emote/".concat(l.id, "/3x") } }) } return o }(e)), Object(de.a)(function(e) { var t = Object(f.a)(["7tv:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve([]) : fetch("https://api.7tv.app/v2/users/".concat(e).concat("/emotes")).then((function(e) { return e.json() })) }), S), l = t.isLoading, n = t.error, r = t.data; if (l || r.status) return []; if (n) return console.error(n), []; var o = []; for (const s of r) { o.push({ id: s.id, code: s.name, urls: { small: "https://cdn.7tv.app/emote/".concat(s.id, "/1x"), medium: "https://cdn.7tv.app/emote/".concat(s.id, "/2x"), big: "https://cdn.7tv.app/emote/".concat(s.id, "/3x") } }) } return o }(e)), Object(de.a)(function(e) { var t = Object(f.a)(["ffz:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve({ sets: {} }) : fetch("https://api.frankerfacez.com/v1/room/id/".concat(e)).then((function(e) { return e.json() })) }), S), n = t.isLoading, r = t.error, a = t.data; if (n || !(null === a || void 0 === a ? void 0 : a.sets)) return []; if (r) return console.error(r), []; var o, c = [], s = Object(ce.a)(Object.values(a.sets)); try { for (s.s(); !(o = s.n()).done;) { var i, u = o.value, l = Object(ce.a)(u.emoticons); try { for (l.s(); !(i = l.n()).done;) { var d = i.value; c.push({ id: String(d.id), code: d.name, urls: { small: d.urls[1], medium: d.urls[2], big: d.urls[4] } }) } } catch (h) { l.e(h) } finally { l.f() } } } catch (h) { s.e(h) } finally { s.f() } return c }(e)), Object(de.a)(function() { var e = Object(f.a)("bttv:global", (function() { return fetch("https://api.betterttv.net/3/cached/emotes/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !r) return []; if (n) return console.error(n), []; var a, o = [], c = Object(ce.a)(r); try { for (c.s(); !(a = c.n()).done;) { var s = a.value; o.push({ id: s.id, code: s.code, urls: { small: "https://cdn.betterttv.net/emote/".concat(s.id, "/1x"), medium: "https://cdn.betterttv.net/emote/".concat(s.id, "/2x"), big: "https://cdn.betterttv.net/emote/".concat(s.id, "/3x") } }) } } catch (i) { c.e(i) } finally { c.f() } return o }()), Object(de.a)(function() { var e = Object(f.a)("7tv:global", (function() { return fetch("https://api.7tv.app/v2/emotes/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !r) return []; if (n) return console.error(n), []; var o = []; for (const s of r) { o.push({ id: s.id, code: s.name, urls: { small: "https://cdn.7tv.app/emote/".concat(s.id, "/1x"), medium: "https://cdn.7tv.app/emote/".concat(s.id, "/2x"), big: "https://cdn.7tv.app/emote/".concat(s.id, "/3x") } }) } return o }()), Object(de.a)(function() { var e = Object(f.a)("ffz:global", (function() { return fetch("https://api.frankerfacez.com/v1/set/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !(null === r || void 0 === r ? void 0 : r.sets)) return []; if (n) return console.error(n), []; var a, o = [], c = Object(ce.a)(Object.values(r.sets)); try { for (c.s(); !(a = c.n()).done;) { var s, i = a.value, u = Object(ce.a)(i.emoticons); try { for (u.s(); !(s = u.n()).done;) { var l = s.value; o.push({ id: String(l.id), code: l.name, urls: { small: l.urls[1], medium: l.urls[2], big: l.urls[4] } }) } } catch (d) { u.e(d) } finally { u.f() } } } catch (d) { c.e(d) } finally { c.f() } return o }())) } var me = n(287), je = n.n(me); function ve() { var e = Object(d.a)(["\n\tmax-height: 18px;\n\tmargin: 0 2px;\n\tmargin-bottom: -2px;\n\twidth: auto;\n"]); return ve = function() { return e }, e } function be() { var e = Object(d.a)(["\n\n\ta {\n\t\tmargin: 0 2px;\n\t\tcolor: var(--theme2);\n\t\ttext-decoration: none;\n\n\t\t&:hover, &:active, &:focus {\n\t\t\tcolor: var(--theme2-bright);\n\t\t}\n\t}\n"]); return be = function() { return e }, e } var fe = h.a.div(be()), ge = h.a.img(ve()); function Oe(e) { var t, n = e.message, r = e.thirdPartyEmotes, a = Object(c.useContext)(w).state, s = [], i = "", u = n.text, l = ""; n.tags["system-msg"] && (u = u.replace(n.tags["system-msg"] + " ", ""), l = "".concat(n.tags["system-msg"], " ")); for (var d = 0; d <= u.length; d++) { var h = u[d]; if (t = !1, a.settings.showEmotes.value) { var m, j = Object(ce.a)(n.emotes); try { for (j.s(); !(m = j.n()).done;) { var v = m.value; if (v.startIndex === d) { t = !0, s.push(Object(o.jsx)(ge, { className: "emote", alt: v.code, src: "https://static-cdn.jtvnw.net/emoticons/v2/".concat(v.id, "/default/dark/1.0") }, d)), d += v.endIndex - v.startIndex - 1; break } } } catch (p) { j.e(p) } finally { j.f() } } if (!t) { if (" " !== h && d !== u.length) { i += h; continue } var b, f = !1, g = Object(ce.a)(r); try { for (g.s(); !(b = g.n()).done;) { var O = b.value; if (i.trim() === O.code) { s.push(Object(o.jsx)(ge, { className: "emote", alt: O.code, src: O.urls.small }, d)), f = !0, i = ""; break } } } catch (p) { g.e(p) } finally { g.f() } f || (s.push(Object(o.jsx)(je.a, { componentDecorator: function(e, t, n) { return Object(o.jsx)("a", { target: "__blank", href: e, children: t }, n) }, children: i }, d)), i = ""), " " !== h || a.settings.twitchChatMode.value ? s.push(h) : s.push(Object(o.jsx)(o.Fragment, { children: "\xa0" })) } } return Object(o.jsxs)(fe, { className: "message", children: [l, s] }) } function pe() { var e = Object(d.a)(["\n\tdisplay: inline;\n"]); return pe = function() { return e }, e } var xe = h.a.div.attrs((function(e) { return { style: { color: e.color } } }))(pe()); function we(e) { var t = e.displayName, n = e.color, r = "" !== n ? n : "grey"; return Object(o.jsxs)(xe, { color: r, className: "user", children: [t, ":"] }) } var ye = n(126), Ce = n.n(ye), Se = n(127), Ne = n.n(Se); function Le() { var e = Object(d.a)(["\n\tdisplay: flex;\n\talign-items: flex-start;\n margin-bottom: 1px;\n\n .timestamp {\n color: var(--text-dark);\n user-select: none;\n font-family: monospace;\n white-space: nowrap;\n line-height: 1.1rem;\n }\n\n .user {\n margin-left: 5px;\n user-select: none;\n font-weight: bold;\n line-height: 1.1rem;\n }\n\n .message {\n margin-left: 5px;\n line-height: 1.1rem;\n }\n"]); return Le = function() { return e }, e } le.a.extend(Ce.a), le.a.extend(Ne.a), le.a.tz.guess(); var Ee = h.a.li(Le()); function ke(e) { var t = e.message, n = Object(c.useContext)(w).state; return n.settings.showEmotes.value ? Object(o.jsx)(Ue, { message: t }) : Object(o.jsxs)(Ee, { className: "logLine", children: [n.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), n.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: [] })] }) } function Ue(e) { var t = e.message, n = he(t.tags["room-id"]), r = Object(c.useContext)(w).state; return Object(o.jsxs)(Ee, { className: "logLine", children: [r.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), r.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: n })] }) } var Pe = n(289); function Me() { var e = Object(d.a)(["\n padding: 0;\n margin: 0;\n position: relative;\n\n .search {\n position: absolute;\n top: -52px;\n width: 320px;\n left: 0;\n }\n\n .logLine {\n white-space: nowrap;\n }\n\n .list {\n scrollbar-color: dark;\n }\n"]); return Me = function() { return e }, e } var Te = h.a.ul(Me()); function ze(e) { var t, n, r = e.year, a = e.month, s = Object(c.useContext)(w), i = s.state, u = s.setState, l = Object(c.useState)(""), d = Object(g.a)(l, 2), h = d[0], v = d[1], b = se(null !== (t = i.currentChannel) && void 0 !== t ? t : "", null !== (n = i.currentUsername) && void 0 !== n ? n : "", r, a).filter((function(e) { return e.text.toLowerCase().includes(h.toLowerCase()) })), f = Object(c.useRef)(null); return Object(c.useEffect)((function() { u(Object(m.a)(Object(m.a)({}, i), {}, { activeSearchField: f.current })) }), []), Object(o.jsxs)(Te, { onMouseEnter: function() { u(Object(m.a)(Object(m.a)({}, i), {}, { activeSearchField: f.current })) }, children: [Object(o.jsx)(j.a, { className: "search", label: "Search", inputRef: f, onChange: function(e) { return v(e.target.value) }, size: "small", InputProps: { startAdornment: Object(o.jsx)(ae.a, { position: "start", children: Object(o.jsx)(oe.a, {}) }) } }), Object(o.jsx)(Pe.a, { className: "list", height: 600, itemCount: b.length, itemSize: 20, width: "100%", children: function(e) { var t = e.index, n = e.style; return Object(o.jsx)("div", { style: n, children: Object(o.jsx)(ke, { message: b[t] }, b[t].id ? b[t].id : t) }) } })] }) } function Re() { var e = Object(d.a)(["\n\talign-items: flex-start;\n margin-bottom: 1px;\n padding: 5px 20px;\n\n .timestamp {\n color: var(--text-dark);\n user-select: none;\n font-family: monospace;\n white-space: nowrap;\n margin-right: 5px;\n line-height: 1.1rem;\n }\n\n .user {\n display: inline-block;\n margin-right: 5px;\n user-select: none;\n font-weight: bold;\n line-height: 1.1rem;\n }\n\n .message {\n display: inline;\n line-height: 20px;\n\n a {\n word-wrap: break-word;\n }\n\n .emote {\n max-height: 28px;\n margin: 0 2px;\n margin-bottom: -10px;\n width: auto;\n }\n }\n"]); return Re = function() { return e }, e } le.a.extend(Ce.a), le.a.extend(Ne.a), le.a.tz.guess(); var De = h.a.li(Re()); function He(e) { var t = e.message, n = Object(c.useContext)(w).state; return n.settings.showEmotes.value ? Object(o.jsx)(_e, { message: t }) : Object(o.jsxs)(De, { className: "logLine", children: [n.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), n.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: [] })] }) } function _e(e) { var t = e.message, n = he(t.tags["room-id"]), r = Object(c.useContext)(w).state; return Object(o.jsxs)(De, { className: "logLine", children: [r.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), r.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: n })] }) } function Be() { var e = Object(d.a)(["\n list-style: none;\n padding: 0;\n margin: 0;\n width: 340px;\n"]); return Be = function() { return e }, e } var Fe = h.a.ul(Be()); function Ye(e) { var t, n, r = e.year, a = e.month, s = Object(c.useContext)(w).state, i = se(null !== (t = s.currentChannel) && void 0 !== t ? t : "", null !== (n = s.currentUsername) && void 0 !== n ? n : "", r, a); return Object(o.jsx)(Fe, { children: i.map((function(e, t) { return Object(o.jsx)(He, { message: e }, e.id ? e.id : t) })) }) } function Ie() { var e = Object(d.a)(["\n\n"]); return Ie = function() { return e }, e } function Ae() { var e = Object(d.a)(["\n position: relative;\n background: var(--bg-bright);\n border-radius: 3px;\n padding: 0.5rem;\n margin-top: 3rem;\n\n .txt {\n position: absolute;\n top: 5px;\n right: 15px;\n opacity: 0.9;\n cursor: pointer;\n z-index: 999;\n\n &:hover {\n opacity: 1;\n }\n }\n"]); return Ae = function() { return e }, e } var We = h.a.div(Ae()); function Ke(e) { var t = e.year, n = e.month, r = e.initialLoad, a = void 0 !== r && r, s = Object(c.useContext)(w).state, i = Object(c.useState)(a), u = Object(g.a)(i, 2), l = u[0], d = u[1]; if (!l) return Object(o.jsx)(We, { children: Object(o.jsx)(qe, { year: t, month: n, onLoad: function() { return d(!0) } }) }); var h = "".concat(s.apiBaseUrl); return s.currentChannel && te(s.currentChannel) ? h += "/channelid/".concat(ne(s.currentChannel)) : h += "/channel/".concat(s.currentChannel), s.currentUsername && te(s.currentUsername) ? h += "/userid/".concat(ne(s.currentUsername)) : h += "/user/".concat(s.currentUsername), h += "/".concat(t, "/").concat(n, "?reverse"), Object(o.jsxs)(We, { children: [Object(o.jsx)("a", { className: "txt", target: "__blank", href: h, rel: "noopener noreferrer", children: Object(o.jsx)(re, {}) }), !s.settings.twitchChatMode.value && Object(o.jsx)(ze, { year: t, month: n }), s.settings.twitchChatMode.value && Object(o.jsx)(Ye, { year: t, month: n })] }) } var Ve = h.a.div(Ie()); function qe(e) { var t = e.year, n = e.month, r = e.onLoad; return Object(o.jsx)(Ve, { children: Object(o.jsxs)(v.a, { variant: "contained", color: "primary", size: "large", onClick: r, children: ["load ", t, "/", n] }) }) } function Je() { var e = Object(d.a)(["\n display: block;\n font-weight: bold;\n color: var(--danger);\n font-size: 2rem;\n text-align: center;\n padding: 2rem;\n"]); return Je = function() { return e }, e } var Qe = h.a.div(Je()); function Ge() { return Object(o.jsx)(Qe, { children: "User or channel has opted out" }) } function Xe() { var e = Object(d.a)(["\n color: white;\n padding: 2rem;\n padding-top: 0;\n width: 100%;\n"]); return Xe = function() { return e }, e } var Ze = h.a.div(Xe()); function $e() { var e = Object(c.useContext)(w).state, t = navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? "metaKey" : "ctrlKey"; Object(c.useEffect)((function() { var n = function(n) { "f" === n.key && n[t] && !e.settings.twitchChatMode.value && (n.preventDefault(), e.activeSearchField && e.activeSearchField.focus()) }; return window.addEventListener("keydown", n), function() { return window.removeEventListener("keydown", n) } }), [e.activeSearchField, e.settings.twitchChatMode.value, t]); var n = function(e, t) { var n, r = Object(c.useContext)(w), a = r.state, o = r.setState; return null !== (n = Object(f.a)(["availableLogs", { channel: e, username: t }], (function() { if (!e || !t) return Promise.resolve([ [], void 0 ]); var n = te(e), r = te(t); n && (e = ne(e)), r && (t = ne(t)); var c = new URL("".concat(a.apiBaseUrl, "/list")); return c.searchParams.append("channel".concat(n ? "id" : ""), e), c.searchParams.append("user".concat(r ? "id" : ""), t), fetch(c.toString()).then((function(e) { if (e.ok) return e; if (o(Object(m.a)(Object(m.a)({}, a), {}, { error: !0 })), 403 === e.status) throw new ee; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { return [e.availableLogs, void 0] })).catch((function(e) { return [ [], e ] })) }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data) && void 0 !== n ? n : [ [], void 0 ] }(e.currentChannel, e.currentUsername), r = Object(g.a)(n, 2), a = r[0]; return r[1] instanceof ee ? Object(o.jsx)(Ge, {}) : Object(o.jsx)(Ze, { children: a.map((function(e, t) { return Object(o.jsx)(Ke, { year: e.year, month: e.month, initialLoad: 0 === t }, "".concat(e.year, ":").concat(e.month)) })) }) } function et() { var e = Object(d.a)(["\n\t\n"]); return et = function() { return e }, e } var tt = h.a.div(et()); function nt() { return Object(o.jsxs)(tt, { children: [Object(o.jsx)(Q, {}), Object(o.jsx)($e, {})] }) } var rt = n(1093), at = n(1094), ot = Object(rt.a)({ palette: { type: "dark" } }); function ct() { var e = Object(c.useContext)(w).state; return Object(o.jsx)(l.a, { client: e.queryClient, children: Object(o.jsx)(nt, {}) }) } u.a.render(Object(o.jsx)(s.a.StrictMode, { children: Object(o.jsx)(C, { children: Object(o.jsx)(at.a, { theme: ot, children: Object(o.jsx)(ct, {}) }) }) }), document.getElementById("root")) } }, [ [1044, 1, 2] ]]); //# sourceMappingURL=main.fdc0c048.chunk.js.map \ No newline at end of file +(this.webpackJsonpweb = this.webpackJsonpweb || []).push([ [0], { 1002: function(e, t) {}, 1004: function(e, t) {}, 1044: function(e, t, n) { "use strict"; n.r(t); var r, a, o = n(2), c = n(0), s = n.n(c), i = n(13), u = n.n(i), l = n(258), d = n(14), h = n(15), m = n(12), j = n(1095), v = n(1091), b = n(1096), f = n(1098), g = n(20), O = n(1097); ! function(e) { e[e.showEmotes = 0] = "showEmotes", e[e.showName = 1] = "showName", e[e.showTimestamp = 2] = "showTimestamp", e[e.twitchChatMode = 3] = "twitchChatMode", e[e.newOnBottom = 4] = "newOnBottom" }(a || (a = {})); var p = new URL(window.location.href), x = { state: { queryClient: new O.a, apiBaseUrl: null !== (r = Object({ NODE_ENV: "production", PUBLIC_URL: "", WDS_SOCKET_HOST: void 0, WDS_SOCKET_PATH: void 0, WDS_SOCKET_PORT: void 0, FAST_REFRESH: !0 }).REACT_APP_API_BASE_URL) && void 0 !== r ? r : window.location.protocol + "//" + window.location.host, settings: { showEmotes: { displayName: "Show Emotes", value: !0 }, showName: { displayName: "Show Name", value: !0 }, showTimestamp: { displayName: "Show Timestamp", value: !0 }, twitchChatMode: { displayName: "Twitch Chat Mode", value: !1 }, newOnBottom: { displayName: "Newest messages on bottom", value: !1 } }, currentChannel: p.searchParams.get("channel"), currentUsername: p.searchParams.get("username"), showSwagger: p.searchParams.has("swagger"), error: !1 }, setState: function(e) {}, setCurrents: function() {}, setSettings: function(e) {}, setShowSwagger: function(e) {} }, w = Object(c.createContext)(x), y = w.Provider, C = function(e) { var t = e.children, n = function(e, t) { var n = Object(c.useState)((function() { try { var n = window.localStorage.getItem(e); return n ? JSON.parse(n) : t } catch (r) { return console.log(r), s(t), t } })), r = Object(g.a)(n, 2), a = r[0], o = r[1], s = function(t) { try { var n = t instanceof Function ? t(a) : t; o(n), window.localStorage.setItem(e, JSON.stringify(n)) } catch (r) { console.log(r) } }, i = a; return "object" === typeof t && (i = Object(m.a)(Object(m.a)({}, t), a)), [i, s] }("justlog:settings", x.state.settings), r = Object(g.a)(n, 2), a = r[0], s = r[1], i = Object(c.useState)(Object(m.a)(Object(m.a)({}, x.state), {}, { settings: a })), u = Object(g.a)(i, 2), l = u[0], d = u[1]; return Object(o.jsx)(y, { value: { state: l, setState: d, setSettings: function(e) { for (var t = 0, n = Object.keys(e); t < n.length; t++) { var r = n[t]; "undefined" === typeof x.state.settings[r] && delete e[r] } l.queryClient.removeQueries("log"), s(e), d(Object(m.a)(Object(m.a)({}, l), {}, { settings: e })) }, setCurrents: function() { var e, t, n, r, a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null; a = null !== (e = null === (t = a) || void 0 === t ? void 0 : t.toLowerCase().trim()) && void 0 !== e ? e : null, o = null !== (n = null === (r = o) || void 0 === r ? void 0 : r.toLowerCase().trim()) && void 0 !== n ? n : null, d(Object(m.a)(Object(m.a)({}, l), {}, { currentChannel: a, currentUsername: o, error: !1 })); var c = new URL(window.location.href); a && c.searchParams.set("channel", a), o && c.searchParams.set("username", o), window.history.replaceState({}, "justlog", c.toString()) }, setShowSwagger: function(e) { var t = new URL(window.location.href); e ? t.searchParams.set("swagger", "") : t.searchParams.delete("swagger"), window.history.replaceState({}, "justlog", t.toString()), d(Object(m.a)(Object(m.a)({}, l), {}, { showSwagger: e })) } }, children: t }) }, S = { staleTime: 5e4 }; var N = n(283), L = n.n(N), E = n(1083), k = n(259); n(1027); function U() { var e = Object(d.a)(["\n position: absolute;\n top: 0;\n background: var(--bg);\n left: 0;\n right: 0;\n margin-top: 90px;\n z-index: 999;\n padding-bottom: 90px;\n\n .swagger-ui {\n background: var(--bg);\n \n .scheme-container {\n background: var(--bg-bright);\n }\n }\n"]); return U = function() { return e }, e } function P() { var e = Object(d.a)(["\n\n"]); return P = function() { return e }, e } var M = h.a.div(P()); function T() { var e = Object(c.useContext)(w), t = e.state, n = e.setShowSwagger; return Object(o.jsxs)(M, { children: [Object(o.jsx)(E.a, { "aria-controls": "docs", "aria-haspopup": "true", onClick: function() { n(!t.showSwagger) }, size: "small", color: t.showSwagger ? "primary" : "default", children: Object(o.jsx)(L.a, {}) }), Object(o.jsx)(R, { show: t.showSwagger })] }) } var z = h.a.div(U()); function R(e) { var t = e.show, n = Object(c.useContext)(w).state, r = new URL(n.apiBaseUrl); return u.a.createPortal(Object(o.jsx)(z, { style: { display: t ? "block" : "none" }, children: Object(o.jsx)(k.a, { url: "/swagger.json", requestInterceptor: function(e) { if (e.url.includes("swagger.json")) return e; var t = new URL(e.url); return t.host = r.host, t.protocol = r.protocol, t.port = r.port, e.url = t.toString(), e } }) }), document.body) } var D = n(115), H = n(1099), _ = n(288), B = n(1086), F = n(1087), Y = n(1088); function I() { var e = Object(d.a)(["\n\t\n"]); return I = function() { return e }, e } var A = h.a.div(I()); function W() { for (var e = Object(c.useContext)(w), t = e.state, n = e.setSettings, r = Object(c.useState)(null), a = Object(g.a)(r, 2), s = a[0], i = a[1], u = [], l = function() { var e = Object(g.a)(h[d], 2), r = e[0], a = e[1]; u.push(Object(o.jsxs)(H.a, { onClick: function() { return function(e, r) { var a = Object(m.a)(Object(m.a)({}, r), {}, { value: !r.value }); n(Object(m.a)(Object(m.a)({}, t.settings), {}, Object(D.a)({}, e, a))) }(r, a) }, children: [a.value ? Object(o.jsx)(B.a, {}) : Object(o.jsx)(F.a, {}), "\xa0\xa0", a.displayName] }, r)) }, d = 0, h = Object.entries(t.settings); d < h.length; d++) l(); return Object(o.jsxs)(A, { children: [Object(o.jsx)(E.a, { "aria-controls": "settings", "aria-haspopup": "true", onClick: function(e) { i(e.currentTarget) }, size: "small", children: Object(o.jsx)(Y.a, {}) }), Object(o.jsx)(_.a, { id: "settings", anchorEl: s, keepMounted: !0, open: Boolean(s), onClose: function() { i(null) }, children: u })] }) } function K() { var e = Object(d.a)(["\n text-align: center;\n"]); return K = function() { return e }, e } function V() { var e = Object(d.a)(["\n display: inline-flex;\n align-items: center;\n padding: 15px;\n background: var(--bg-bright);\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n\tmargin: 0 auto;\n z-index: 99;\n\n > * {\n margin-right: 15px !important; \n\n &:last-child {\n margin-right: 0 !important;\n }\n }\n"]); return V = function() { return e }, e } var q = h.a.form(V()), J = h.a.div(K()); function Q() { var e = Object(c.useContext)(w), t = e.setCurrents, n = e.state, r = Object(l.b)(), a = function() { var e = Object(c.useContext)(w).state, t = Object(f.a)("channels", (function() { var t = new URL("".concat(e.apiBaseUrl, "/channels")); return fetch(t.toString()).then((function(e) { if (e.ok) return e; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { return e.channels })) }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data; return null !== t && void 0 !== t ? t : [] }(); return Object(o.jsx)(J, { children: Object(o.jsxs)(q, { onSubmit: function(e) { if (e.preventDefault(), e.target instanceof HTMLFormElement) { var n = new FormData(e.target), a = n.get("channel"), o = n.get("username"); r.invalidateQueries(["log", { channel: null === a || void 0 === a ? void 0 : a.toLowerCase(), username: null === o || void 0 === o ? void 0 : o.toLowerCase() }]), t(a, o) } }, action: "none", children: [Object(o.jsx)(b.a, { id: "autocomplete-channels", options: a.map((function(e) { return e.name })), style: { width: 225 }, defaultValue: n.currentChannel, getOptionLabel: function(e) { return e }, clearOnBlur: !1, renderInput: function(e) { return Object(o.jsx)(j.a, Object(m.a)(Object(m.a)({}, e), {}, { name: "channel", label: "channel", variant: "filled", autoFocus: null === n.currentChannel })) } }), Object(o.jsx)(j.a, { error: n.error, name: "username", label: "username", variant: "filled", autoComplete: "off", defaultValue: n.currentUsername, autoFocus: null !== n.currentChannel && null === n.currentUsername }), Object(o.jsx)(v.a, { variant: "contained", color: "primary", size: "large", type: "submit", children: "load" }), Object(o.jsx)(W, {}), Object(o.jsx)(T, {})] }) }) } var G = n(285), X = n(286), Z = n(290), $ = n(291), ee = function(e) { Object(X.a)(n, e); var t = Object(Z.a)(n); function n() { return Object(G.a)(this, n), t.apply(this, arguments) } return n }(Object($.a)(Error)); function te(e) { return e.startsWith("id:") } function ne(e) { return e.replace("id:", "") } function re() { return Object(o.jsxs)("svg", { className: "txt", height: 32, viewBox: "0 0 32 32", width: 32, children: [Object(o.jsx)("title", {}), Object(o.jsx)("path", { d: "M21 26v2.003A1.995 1.995 0 0119.003 30H3.997A2 2 0 012 27.993V5.007C2 3.898 2.9 3 4.009 3H14v6.002c0 1.111.898 1.998 2.006 1.998H21v2h-8.993A3.003 3.003 0 009 15.999V23A2.996 2.996 0 0012.007 26H21zM15 3v5.997c0 .554.451 1.003.99 1.003H21l-6-7zm-3.005 11C10.893 14 10 14.9 10 15.992v7.016A2 2 0 0011.995 25h17.01C30.107 25 31 24.1 31 23.008v-7.016A2 2 0 0029.005 14h-17.01zM14 17v6h1v-6h2v-1h-5v1h2zm6 2.5L18 16h1l1.5 2.625L22 16h1l-2 3.5 2 3.5h-1l-1.5-2.625L19 23h-1l2-3.5zm6-2.5v6h1v-6h2v-1h-5v1h2z", fill: "#929292", fillRule: "evenodd" })] }) } var ae = n(1100), oe = n(1092), ce = n(25); function se(e, t, n, r) { var a = Object(c.useContext)(w).state, o = Object(f.a)(["log", { channel: e, username: t, year: n, month: r }], (function() { if (e && t) { var o = te(e), c = te(t); o && (e = ne(e)), c && (t = ne(t)); var s = new URL("".concat(a.apiBaseUrl, "/channel").concat(o ? "id" : "", "/").concat(e, "/user").concat(c ? "id" : "", "/").concat(t, "/").concat(n, "/").concat(r)); return s.searchParams.append("json", "1"), a.settings.newOnBottom.value || s.searchParams.append("reverse", "1"), fetch(s.toString()).then((function(e) { if (e.ok) return e; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { var t, n = [], r = Object(ce.a)(e.messages); try { for (r.s(); !(t = r.n()).done;) { var a = t.value; n.push(Object(m.a)(Object(m.a)({}, a), {}, { timestamp: new Date(a.timestamp), emotes: ie(a.text, a.tags.emotes) })) } } catch (o) { r.e(o) } finally { r.f() } return n })) } return [] }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data; return null !== o && void 0 !== o ? o : [] } function ie(e, t) { var n = []; if (!t) return n; var r, a = t.split("/"), o = Object(ce.a)(a); try { for (o.s(); !(r = o.n()).done;) { var c, s = r.value.split(":"), i = Object(g.a)(s, 2), u = i[0], l = i[1].split(","), d = Object(ce.a)(l); try { for (d.s(); !(c = d.n()).done;) { var h = c.value.split("-"), m = Object(g.a)(h, 2), j = m[0], v = m[1], b = Number(j), f = Number(v) + 1; n.push({ id: u, startIndex: b, endIndex: f, code: e.substr(b, f - b) }) } } catch (O) { d.e(O) } finally { d.f() } } } catch (O) { o.e(O) } finally { o.f() } return n } var ue = n(36), le = n.n(ue), de = n(59); function he(e) { return [].concat(Object(de.a)(function(e) { var t = Object(f.a)(["bttv:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve({ sharedEmotes: [], channelEmotes: [] }) : fetch("https://api.betterttv.net/3/cached/users/twitch/".concat(e)).then((function(e) { return e.json() })) }), S), n = t.isLoading, r = t.error, a = t.data; if (n) return []; if (r) return console.error(r), []; for (var o = [], c = 0, s = [].concat(Object(de.a)(null !== (i = null === a || void 0 === a ? void 0 : a.channelEmotes) && void 0 !== i ? i : []), Object(de.a)(null !== (u = null === a || void 0 === a ? void 0 : a.sharedEmotes) && void 0 !== u ? u : [])); c < s.length; c++) { var i, u, l = s[c]; o.push({ id: l.id, code: l.code, urls: { small: "https://cdn.betterttv.net/emote/".concat(l.id, "/1x"), medium: "https://cdn.betterttv.net/emote/".concat(l.id, "/2x"), big: "https://cdn.betterttv.net/emote/".concat(l.id, "/3x") } }) } return o }(e)), Object(de.a)(function(e) { var t = Object(f.a)(["7tv:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve([]) : fetch("https://api.7tv.app/v2/users/".concat(e).concat("/emotes")).then((function(e) { return e.json() })) }), S), l = t.isLoading, n = t.error, r = t.data; if (l || !r) return []; if (n) return console.error(n), []; var o = []; for (const s of r) { o.push({ id: s.id, code: s.name, urls: { small: "https://cdn.7tv.app/emote/".concat(s.id, "/1x"), medium: "https://cdn.7tv.app/emote/".concat(s.id, "/2x"), big: "https://cdn.7tv.app/emote/".concat(s.id, "/3x") } }) } return o }(e)), Object(de.a)(function(e) { var t = Object(f.a)(["ffz:channel", { channelId: e }], (function() { return "" === e ? Promise.resolve({ sets: {} }) : fetch("https://api.frankerfacez.com/v1/room/id/".concat(e)).then((function(e) { return e.json() })) }), S), n = t.isLoading, r = t.error, a = t.data; if (n || !(null === a || void 0 === a ? void 0 : a.sets)) return []; if (r) return console.error(r), []; var o, c = [], s = Object(ce.a)(Object.values(a.sets)); try { for (s.s(); !(o = s.n()).done;) { var i, u = o.value, l = Object(ce.a)(u.emoticons); try { for (l.s(); !(i = l.n()).done;) { var d = i.value; c.push({ id: String(d.id), code: d.name, urls: { small: d.urls[1], medium: d.urls[2], big: d.urls[4] } }) } } catch (h) { l.e(h) } finally { l.f() } } } catch (h) { s.e(h) } finally { s.f() } return c }(e)), Object(de.a)(function() { var e = Object(f.a)("bttv:global", (function() { return fetch("https://api.betterttv.net/3/cached/emotes/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !r) return []; if (n) return console.error(n), []; var a, o = [], c = Object(ce.a)(r); try { for (c.s(); !(a = c.n()).done;) { var s = a.value; o.push({ id: s.id, code: s.code, urls: { small: "https://cdn.betterttv.net/emote/".concat(s.id, "/1x"), medium: "https://cdn.betterttv.net/emote/".concat(s.id, "/2x"), big: "https://cdn.betterttv.net/emote/".concat(s.id, "/3x") } }) } } catch (i) { c.e(i) } finally { c.f() } return o }()), Object(de.a)(function() { var e = Object(f.a)("7tv:global", (function() { return fetch("https://api.7tv.app/v2/emotes/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !r) return []; if (n) return console.error(n), []; var o = []; for (const s of r) { o.push({ id: s.id, code: s.name, urls: { small: "https://cdn.7tv.app/emote/".concat(s.id, "/1x"), medium: "https://cdn.7tv.app/emote/".concat(s.id, "/2x"), big: "https://cdn.7tv.app/emote/".concat(s.id, "/3x") } }) } return o }()), Object(de.a)(function() { var e = Object(f.a)("ffz:global", (function() { return fetch("https://api.frankerfacez.com/v1/set/global").then((function(e) { return e.json() })) }), S), t = e.isLoading, n = e.error, r = e.data; if (t || !(null === r || void 0 === r ? void 0 : r.sets)) return []; if (n) return console.error(n), []; var a, o = [], c = Object(ce.a)(Object.values(r.sets)); try { for (c.s(); !(a = c.n()).done;) { var s, i = a.value, u = Object(ce.a)(i.emoticons); try { for (u.s(); !(s = u.n()).done;) { var l = s.value; o.push({ id: String(l.id), code: l.name, urls: { small: l.urls[1], medium: l.urls[2], big: l.urls[4] } }) } } catch (d) { u.e(d) } finally { u.f() } } } catch (d) { c.e(d) } finally { c.f() } return o }())) } var me = n(287), je = n.n(me); function ve() { var e = Object(d.a)(["\n\tmax-height: 18px;\n\tmargin: 0 2px;\n\tmargin-bottom: -2px;\n\twidth: auto;\n"]); return ve = function() { return e }, e } function be() { var e = Object(d.a)(["\n\n\ta {\n\t\tmargin: 0 2px;\n\t\tcolor: var(--theme2);\n\t\ttext-decoration: none;\n\n\t\t&:hover, &:active, &:focus {\n\t\t\tcolor: var(--theme2-bright);\n\t\t}\n\t}\n"]); return be = function() { return e }, e } var fe = h.a.div(be()), ge = h.a.img(ve()); function Oe(e) { var t, n = e.message, r = e.thirdPartyEmotes, a = Object(c.useContext)(w).state, s = [], i = "", u = n.text, l = ""; n.tags["system-msg"] && (u = u.replace(n.tags["system-msg"] + " ", ""), l = "".concat(n.tags["system-msg"], " ")); for (var d = 0; d <= u.length; d++) { var h = u[d]; if (t = !1, a.settings.showEmotes.value) { var m, j = Object(ce.a)(n.emotes); try { for (j.s(); !(m = j.n()).done;) { var v = m.value; if (v.startIndex === d) { t = !0, s.push(Object(o.jsx)(ge, { className: "emote", alt: v.code, src: "https://static-cdn.jtvnw.net/emoticons/v2/".concat(v.id, "/default/dark/1.0") }, d)), d += v.endIndex - v.startIndex - 1; break } } } catch (p) { j.e(p) } finally { j.f() } } if (!t) { if (" " !== h && d !== u.length) { i += h; continue } var b, f = !1, g = Object(ce.a)(r); try { for (g.s(); !(b = g.n()).done;) { var O = b.value; if (i.trim() === O.code) { s.push(Object(o.jsx)(ge, { className: "emote", alt: O.code, src: O.urls.small }, d)), f = !0, i = ""; break } } } catch (p) { g.e(p) } finally { g.f() } f || (s.push(Object(o.jsx)(je.a, { componentDecorator: function(e, t, n) { return Object(o.jsx)("a", { target: "__blank", href: e, children: t }, n) }, children: i }, d)), i = ""), " " !== h || a.settings.twitchChatMode.value ? s.push(h) : s.push(Object(o.jsx)(o.Fragment, { children: "\xa0" })) } } return Object(o.jsxs)(fe, { className: "message", children: [l, s] }) } function pe() { var e = Object(d.a)(["\n\tdisplay: inline;\n"]); return pe = function() { return e }, e } var xe = h.a.div.attrs((function(e) { return { style: { color: e.color } } }))(pe()); function we(e) { var t = e.displayName, n = e.color, r = "" !== n ? n : "grey"; return Object(o.jsxs)(xe, { color: r, className: "user", children: [t, ":"] }) } var ye = n(126), Ce = n.n(ye), Se = n(127), Ne = n.n(Se); function Le() { var e = Object(d.a)(["\n\tdisplay: flex;\n\talign-items: flex-start;\n margin-bottom: 1px;\n\n .timestamp {\n color: var(--text-dark);\n user-select: none;\n font-family: monospace;\n white-space: nowrap;\n line-height: 1.1rem;\n }\n\n .user {\n margin-left: 5px;\n user-select: none;\n font-weight: bold;\n line-height: 1.1rem;\n }\n\n .message {\n margin-left: 5px;\n line-height: 1.1rem;\n }\n"]); return Le = function() { return e }, e } le.a.extend(Ce.a), le.a.extend(Ne.a), le.a.tz.guess(); var Ee = h.a.li(Le()); function ke(e) { var t = e.message, n = Object(c.useContext)(w).state; return n.settings.showEmotes.value ? Object(o.jsx)(Ue, { message: t }) : Object(o.jsxs)(Ee, { className: "logLine", children: [n.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), n.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: [] })] }) } function Ue(e) { var t = e.message, n = he(t.tags["room-id"]), r = Object(c.useContext)(w).state; return Object(o.jsxs)(Ee, { className: "logLine", children: [r.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), r.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: n })] }) } var Pe = n(289); function Me() { var e = Object(d.a)(["\n padding: 0;\n margin: 0;\n position: relative;\n\n .search {\n position: absolute;\n top: -52px;\n width: 320px;\n left: 0;\n }\n\n .logLine {\n white-space: nowrap;\n }\n\n .list {\n scrollbar-color: dark;\n }\n"]); return Me = function() { return e }, e } var Te = h.a.ul(Me()); function ze(e) { var t, n, r = e.year, a = e.month, s = Object(c.useContext)(w), i = s.state, u = s.setState, l = Object(c.useState)(""), d = Object(g.a)(l, 2), h = d[0], v = d[1], b = se(null !== (t = i.currentChannel) && void 0 !== t ? t : "", null !== (n = i.currentUsername) && void 0 !== n ? n : "", r, a).filter((function(e) { return e.text.toLowerCase().includes(h.toLowerCase()) })), f = Object(c.useRef)(null); return Object(c.useEffect)((function() { u(Object(m.a)(Object(m.a)({}, i), {}, { activeSearchField: f.current })) }), []), Object(o.jsxs)(Te, { onMouseEnter: function() { u(Object(m.a)(Object(m.a)({}, i), {}, { activeSearchField: f.current })) }, children: [Object(o.jsx)(j.a, { className: "search", label: "Search", inputRef: f, onChange: function(e) { return v(e.target.value) }, size: "small", InputProps: { startAdornment: Object(o.jsx)(ae.a, { position: "start", children: Object(o.jsx)(oe.a, {}) }) } }), Object(o.jsx)(Pe.a, { className: "list", height: 600, itemCount: b.length, itemSize: 20, width: "100%", children: function(e) { var t = e.index, n = e.style; return Object(o.jsx)("div", { style: n, children: Object(o.jsx)(ke, { message: b[t] }, b[t].id ? b[t].id : t) }) } })] }) } function Re() { var e = Object(d.a)(["\n\talign-items: flex-start;\n margin-bottom: 1px;\n padding: 5px 20px;\n\n .timestamp {\n color: var(--text-dark);\n user-select: none;\n font-family: monospace;\n white-space: nowrap;\n margin-right: 5px;\n line-height: 1.1rem;\n }\n\n .user {\n display: inline-block;\n margin-right: 5px;\n user-select: none;\n font-weight: bold;\n line-height: 1.1rem;\n }\n\n .message {\n display: inline;\n line-height: 20px;\n\n a {\n word-wrap: break-word;\n }\n\n .emote {\n max-height: 28px;\n margin: 0 2px;\n margin-bottom: -10px;\n width: auto;\n }\n }\n"]); return Re = function() { return e }, e } le.a.extend(Ce.a), le.a.extend(Ne.a), le.a.tz.guess(); var De = h.a.li(Re()); function He(e) { var t = e.message, n = Object(c.useContext)(w).state; return n.settings.showEmotes.value ? Object(o.jsx)(_e, { message: t }) : Object(o.jsxs)(De, { className: "logLine", children: [n.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), n.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: [] })] }) } function _e(e) { var t = e.message, n = he(t.tags["room-id"]), r = Object(c.useContext)(w).state; return Object(o.jsxs)(De, { className: "logLine", children: [r.settings.showTimestamp.value && Object(o.jsx)("span", { className: "timestamp", children: le()(t.timestamp).format("YYYY-MM-DD HH:mm:ss") }), r.settings.showName.value && Object(o.jsx)(we, { displayName: t.displayName, color: t.tags.color }), Object(o.jsx)(Oe, { message: t, thirdPartyEmotes: n })] }) } function Be() { var e = Object(d.a)(["\n list-style: none;\n padding: 0;\n margin: 0;\n width: 340px;\n"]); return Be = function() { return e }, e } var Fe = h.a.ul(Be()); function Ye(e) { var t, n, r = e.year, a = e.month, s = Object(c.useContext)(w).state, i = se(null !== (t = s.currentChannel) && void 0 !== t ? t : "", null !== (n = s.currentUsername) && void 0 !== n ? n : "", r, a); return Object(o.jsx)(Fe, { children: i.map((function(e, t) { return Object(o.jsx)(He, { message: e }, e.id ? e.id : t) })) }) } function Ie() { var e = Object(d.a)(["\n\n"]); return Ie = function() { return e }, e } function Ae() { var e = Object(d.a)(["\n position: relative;\n background: var(--bg-bright);\n border-radius: 3px;\n padding: 0.5rem;\n margin-top: 3rem;\n\n .txt {\n position: absolute;\n top: 5px;\n right: 15px;\n opacity: 0.9;\n cursor: pointer;\n z-index: 999;\n\n &:hover {\n opacity: 1;\n }\n }\n"]); return Ae = function() { return e }, e } var We = h.a.div(Ae()); function Ke(e) { var t = e.year, n = e.month, r = e.initialLoad, a = void 0 !== r && r, s = Object(c.useContext)(w).state, i = Object(c.useState)(a), u = Object(g.a)(i, 2), l = u[0], d = u[1]; if (!l) return Object(o.jsx)(We, { children: Object(o.jsx)(qe, { year: t, month: n, onLoad: function() { return d(!0) } }) }); var h = "".concat(s.apiBaseUrl); return s.currentChannel && te(s.currentChannel) ? h += "/channelid/".concat(ne(s.currentChannel)) : h += "/channel/".concat(s.currentChannel), s.currentUsername && te(s.currentUsername) ? h += "/userid/".concat(ne(s.currentUsername)) : h += "/user/".concat(s.currentUsername), h += "/".concat(t, "/").concat(n, "?reverse"), Object(o.jsxs)(We, { children: [Object(o.jsx)("a", { className: "txt", target: "__blank", href: h, rel: "noopener noreferrer", children: Object(o.jsx)(re, {}) }), !s.settings.twitchChatMode.value && Object(o.jsx)(ze, { year: t, month: n }), s.settings.twitchChatMode.value && Object(o.jsx)(Ye, { year: t, month: n })] }) } var Ve = h.a.div(Ie()); function qe(e) { var t = e.year, n = e.month, r = e.onLoad; return Object(o.jsx)(Ve, { children: Object(o.jsxs)(v.a, { variant: "contained", color: "primary", size: "large", onClick: r, children: ["load ", t, "/", n] }) }) } function Je() { var e = Object(d.a)(["\n display: block;\n font-weight: bold;\n color: var(--danger);\n font-size: 2rem;\n text-align: center;\n padding: 2rem;\n"]); return Je = function() { return e }, e } var Qe = h.a.div(Je()); function Ge() { return Object(o.jsx)(Qe, { children: "User or channel has opted out" }) } function Xe() { var e = Object(d.a)(["\n color: white;\n padding: 2rem;\n padding-top: 0;\n width: 100%;\n"]); return Xe = function() { return e }, e } var Ze = h.a.div(Xe()); function $e() { var e = Object(c.useContext)(w).state, t = navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? "metaKey" : "ctrlKey"; Object(c.useEffect)((function() { var n = function(n) { "f" === n.key && n[t] && !e.settings.twitchChatMode.value && (n.preventDefault(), e.activeSearchField && e.activeSearchField.focus()) }; return window.addEventListener("keydown", n), function() { return window.removeEventListener("keydown", n) } }), [e.activeSearchField, e.settings.twitchChatMode.value, t]); var n = function(e, t) { var n, r = Object(c.useContext)(w), a = r.state, o = r.setState; return null !== (n = Object(f.a)(["availableLogs", { channel: e, username: t }], (function() { if (!e || !t) return Promise.resolve([ [], void 0 ]); var n = te(e), r = te(t); n && (e = ne(e)), r && (t = ne(t)); var c = new URL("".concat(a.apiBaseUrl, "/list")); return c.searchParams.append("channel".concat(n ? "id" : ""), e), c.searchParams.append("user".concat(r ? "id" : ""), t), fetch(c.toString()).then((function(e) { if (e.ok) return e; if (o(Object(m.a)(Object(m.a)({}, a), {}, { error: !0 })), 403 === e.status) throw new ee; throw Error(e.statusText) })).then((function(e) { return e.json() })).then((function(e) { return [e.availableLogs, void 0] })).catch((function(e) { return [ [], e ] })) }), { refetchOnWindowFocus: !1, refetchOnReconnect: !1 }).data) && void 0 !== n ? n : [ [], void 0 ] }(e.currentChannel, e.currentUsername), r = Object(g.a)(n, 2), a = r[0]; return r[1] instanceof ee ? Object(o.jsx)(Ge, {}) : Object(o.jsx)(Ze, { children: a.map((function(e, t) { return Object(o.jsx)(Ke, { year: e.year, month: e.month, initialLoad: 0 === t }, "".concat(e.year, ":").concat(e.month)) })) }) } function et() { var e = Object(d.a)(["\n\t\n"]); return et = function() { return e }, e } var tt = h.a.div(et()); function nt() { return Object(o.jsxs)(tt, { children: [Object(o.jsx)(Q, {}), Object(o.jsx)($e, {})] }) } var rt = n(1093), at = n(1094), ot = Object(rt.a)({ palette: { type: "dark" } }); function ct() { var e = Object(c.useContext)(w).state; return Object(o.jsx)(l.a, { client: e.queryClient, children: Object(o.jsx)(nt, {}) }) } u.a.render(Object(o.jsx)(s.a.StrictMode, { children: Object(o.jsx)(C, { children: Object(o.jsx)(at.a, { theme: ot, children: Object(o.jsx)(ct, {}) }) }) }), document.getElementById("root")) } }, [ [1044, 1, 2] ]]); //# sourceMappingURL=main.fdc0c048.chunk.js.map \ No newline at end of file