2 lines
No EOL
24 KiB
JavaScript
2 lines
No EOL
24 KiB
JavaScript
(this.webpackJsonpweb=this.webpackJsonpweb||[]).push([[0],{1003:function(e,t){},1005:function(e,t){},1045:function(e,t,n){"use strict";n.r(t);var a,r,o=n(2),c=n(0),s=n.n(c),i=n(13),u=n.n(i),l=n(259),d=n(14),h=n(15),m=n(12),j=n(1096),v=n(1092),b=n(1097),f=n(1099),g=n(20),O=n(1098);!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"}(r||(r={}));var p=new URL(window.location.href),x={state:{queryClient:new O.a,apiBaseUrl:null!==(a=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!==a?a: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(a){return console.log(a),s(t),t}})),a=Object(g.a)(n,2),r=a[0],o=a[1],s=function(t){try{var n=t instanceof Function?t(r):t;o(n),window.localStorage.setItem(e,JSON.stringify(n))}catch(a){console.log(a)}},i=r;return"object"===typeof t&&(i=Object(m.a)(Object(m.a)({},t),r)),[i,s]}("justlog:settings",x.state.settings),a=Object(g.a)(n,2),r=a[0],s=a[1],i=Object(c.useState)(Object(m.a)(Object(m.a)({},x.state),{},{settings:r})),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 a=n[t];"undefined"===typeof x.state.settings[a]&&delete e[a]}l.queryClient.removeQueries("log"),s(e),d(Object(m.a)(Object(m.a)({},l),{},{settings:e}))},setCurrents:function(){var e,t,n,a,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;r=null!==(e=null===(t=r)||void 0===t?void 0:t.toLowerCase().trim())&&void 0!==e?e:null,o=null!==(n=null===(a=o)||void 0===a?void 0:a.toLowerCase().trim())&&void 0!==n?n:null,d(Object(m.a)(Object(m.a)({},l),{},{currentChannel:r,currentUsername:o,error:!1}));var c=new URL(window.location.href);r&&c.searchParams.set("channel",r),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(284),L=n.n(N),E=n(1084),k=n(260);n(1028);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,a=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=a.host,t.protocol=a.protocol,t.port=a.port,e.url=t.toString(),e}})}),document.body)}var D=n(115),H=n(1100),_=n(289),B=n(1087),F=n(1088),Y=n(1089);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,a=Object(c.useState)(null),r=Object(g.a)(a,2),s=r[0],i=r[1],u=[],l=function(){var e=Object(g.a)(h[d],2),a=e[0],r=e[1];u.push(Object(o.jsxs)(H.a,{onClick:function(){return function(e,a){var r=Object(m.a)(Object(m.a)({},a),{},{value:!a.value});n(Object(m.a)(Object(m.a)({},t.settings),{},Object(D.a)({},e,r)))}(a,r)},children:[r.value?Object(o.jsx)(B.a,{}):Object(o.jsx)(F.a,{}),"\xa0\xa0",r.displayName]},a))},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,a=Object(l.b)(),r=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),r=n.get("channel"),o=n.get("username");a.invalidateQueries(["log",{channel:null===r||void 0===r?void 0:r.toLowerCase(),username:null===o||void 0===o?void 0:o.toLowerCase()}]),t(r,o)}},action:"none",children:[Object(o.jsx)(b.a,{id:"autocomplete-channels",options:r.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(286),X=n(287),Z=n(291),$=n(292),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 ae(){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 re=n(1101),oe=n(1093),ce=n(25),se=n(126),ie=n.n(se);function ue(e,t,n,a){var r=Object(c.useContext)(w).state,o=Object(f.a)(["log",{channel:e,username:t,year:n,month:a}],(function(){if(e&&t){var o=te(e),c=te(t);o&&(e=ne(e)),c&&(t=ne(t));var s=new URL("".concat(r.apiBaseUrl,"/channel").concat(o?"id":"","/").concat(e,"/user").concat(c?"id":"","/").concat(t,"/").concat(n,"/").concat(a));return s.searchParams.append("json","1"),r.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=[],a=Object(ce.a)(e.messages);try{for(a.s();!(t=a.n()).done;){var r=t.value;n.push(Object(m.a)(Object(m.a)({},r),{},{timestamp:new Date(r.timestamp),emotes:le(r.text,r.tags.emotes)}))}}catch(o){a.e(o)}finally{a.f()}return n}))}return[]}),{refetchOnWindowFocus:!1,refetchOnReconnect:!1}).data;return null!==o&&void 0!==o?o:[]}function le(e,t){var n=[];if(!t)return n;var a,r=t.split("/"),o=Object(ce.a)(r);try{for(o.s();!(a=o.n()).done;){var c,s=a.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:ie.a.substr(e,b,f-b+1)})}}catch(O){d.e(O)}finally{d.f()}}}catch(O){o.e(O)}finally{o.f()}return n}var de=n(36),he=n.n(de),me=n(59);function je(e){return[].concat(Object(me.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,a=t.error,r=t.data;if(n)return[];if(a)return console.error(a),[];for(var o=[],c=0,s=[].concat(Object(me.a)(null!==(i=null===r||void 0===r?void 0:r.channelEmotes)&&void 0!==i?i:[]),Object(me.a)(null!==(u=null===r||void 0===r?void 0:r.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(me.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,a=t.error,r=t.data;if(n||!(null===r||void 0===r?void 0:r.sets))return[];if(a)return console.error(a),[];var o,c=[],s=Object(ce.a)(Object.values(r.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(me.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,a=e.data;if(t||!a)return[];if(n)return console.error(n),[];var r,o=[],c=Object(ce.a)(a);try{for(c.s();!(r=c.n()).done;){var s=r.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(me.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,a=e.data;if(t||!(null===a||void 0===a?void 0:a.sets))return[];if(n)return console.error(n),[];var r,o=[],c=Object(ce.a)(Object.values(a.sets));try{for(c.s();!(r=c.n()).done;){var s,i=r.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 ve=n(288),be=n.n(ve);function fe(){var e=Object(d.a)(["\n\tmax-height: 18px;\n\tmargin: 0 2px;\n\tmargin-bottom: -2px;\n\twidth: auto;\n"]);return fe=function(){return e},e}function ge(){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 ge=function(){return e},e}var Oe=h.a.div(ge()),pe=h.a.img(fe());function xe(e){var t,n=e.message,a=e.thirdPartyEmotes,r=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=ie()(u),h=0;h<=d.length;h++){var m=d[h];if(t=!1,r.settings.showEmotes.value){var j,v=Object(ce.a)(n.emotes);try{for(v.s();!(j=v.n()).done;){var b=j.value;if(b.startIndex===h){t=!0,s.push(Object(o.jsx)(pe,{className:"emote",alt:b.code,src:"https://static-cdn.jtvnw.net/emoticons/v2/".concat(b.id,"/default/dark/1.0")},h)),h+=b.endIndex-b.startIndex-1;break}}}catch(x){v.e(x)}finally{v.f()}}if(!t){if(" "!==m&&h!==d.length){i+=m;continue}var f,g=!1,O=Object(ce.a)(a);try{for(O.s();!(f=O.n()).done;){var p=f.value;if(i.trim()===p.code){s.push(Object(o.jsx)(pe,{className:"emote",alt:p.code,src:p.urls.small},h)),g=!0,i="";break}}}catch(x){O.e(x)}finally{O.f()}g||(s.push(Object(o.jsx)(be.a,{componentDecorator:function(e,t,n){return Object(o.jsx)("a",{target:"__blank",href:e,children:t},n)},children:i},h)),i="")," "!==m||r.settings.twitchChatMode.value?s.push(m):s.push(Object(o.jsx)(o.Fragment,{children:"\xa0"}))}}return Object(o.jsxs)(Oe,{className:"message",children:[l,s]})}function we(){var e=Object(d.a)(["\n\tdisplay: inline;\n"]);return we=function(){return e},e}var ye=h.a.div.attrs((function(e){return{style:{color:e.color}}}))(we());function Ce(e){var t=e.displayName,n=e.color,a=""!==n?n:"grey";return Object(o.jsxs)(ye,{color:a,className:"user",children:[t,":"]})}var Se=n(127),Ne=n.n(Se),Le=n(128),Ee=n.n(Le);function ke(){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 ke=function(){return e},e}he.a.extend(Ne.a),he.a.extend(Ee.a),he.a.tz.guess();var Ue=h.a.li(ke());function Pe(e){var t=e.message,n=Object(c.useContext)(w).state;return n.settings.showEmotes.value?Object(o.jsx)(Me,{message:t}):Object(o.jsxs)(Ue,{className:"logLine",children:[n.settings.showTimestamp.value&&Object(o.jsx)("span",{className:"timestamp",children:he()(t.timestamp).format("YYYY-MM-DD HH:mm:ss")}),n.settings.showName.value&&Object(o.jsx)(Ce,{displayName:t.displayName,color:t.tags.color}),Object(o.jsx)(xe,{message:t,thirdPartyEmotes:[]})]})}function Me(e){var t=e.message,n=je(t.tags["room-id"]),a=Object(c.useContext)(w).state;return Object(o.jsxs)(Ue,{className:"logLine",children:[a.settings.showTimestamp.value&&Object(o.jsx)("span",{className:"timestamp",children:he()(t.timestamp).format("YYYY-MM-DD HH:mm:ss")}),a.settings.showName.value&&Object(o.jsx)(Ce,{displayName:t.displayName,color:t.tags.color}),Object(o.jsx)(xe,{message:t,thirdPartyEmotes:n})]})}var Te=n(290);function ze(){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 ze=function(){return e},e}var Re=h.a.ul(ze());function De(e){var t,n,a=e.year,r=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=ue(null!==(t=i.currentChannel)&&void 0!==t?t:"",null!==(n=i.currentUsername)&&void 0!==n?n:"",a,r).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)(Re,{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)(re.a,{position:"start",children:Object(o.jsx)(oe.a,{})})}}),Object(o.jsx)(Te.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)(Pe,{message:b[t]},b[t].id?b[t].id:t)})}})]})}function He(){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 He=function(){return e},e}he.a.extend(Ne.a),he.a.extend(Ee.a),he.a.tz.guess();var _e=h.a.li(He());function Be(e){var t=e.message,n=Object(c.useContext)(w).state;return n.settings.showEmotes.value?Object(o.jsx)(Fe,{message:t}):Object(o.jsxs)(_e,{className:"logLine",children:[n.settings.showTimestamp.value&&Object(o.jsx)("span",{className:"timestamp",children:he()(t.timestamp).format("YYYY-MM-DD HH:mm:ss")}),n.settings.showName.value&&Object(o.jsx)(Ce,{displayName:t.displayName,color:t.tags.color}),Object(o.jsx)(xe,{message:t,thirdPartyEmotes:[]})]})}function Fe(e){var t=e.message,n=je(t.tags["room-id"]),a=Object(c.useContext)(w).state;return Object(o.jsxs)(_e,{className:"logLine",children:[a.settings.showTimestamp.value&&Object(o.jsx)("span",{className:"timestamp",children:he()(t.timestamp).format("YYYY-MM-DD HH:mm:ss")}),a.settings.showName.value&&Object(o.jsx)(Ce,{displayName:t.displayName,color:t.tags.color}),Object(o.jsx)(xe,{message:t,thirdPartyEmotes:n})]})}function Ye(){var e=Object(d.a)(["\n list-style: none;\n padding: 0;\n margin: 0;\n width: 340px;\n"]);return Ye=function(){return e},e}var Ie=h.a.ul(Ye());function Ae(e){var t,n,a=e.year,r=e.month,s=Object(c.useContext)(w).state,i=ue(null!==(t=s.currentChannel)&&void 0!==t?t:"",null!==(n=s.currentUsername)&&void 0!==n?n:"",a,r);return Object(o.jsx)(Ie,{children:i.map((function(e,t){return Object(o.jsx)(Be,{message:e},e.id?e.id:t)}))})}function We(){var e=Object(d.a)(["\n\n"]);return We=function(){return e},e}function Ke(){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 Ke=function(){return e},e}var Ve=h.a.div(Ke());function qe(e){var t=e.year,n=e.month,a=e.initialLoad,r=void 0!==a&&a,s=Object(c.useContext)(w).state,i=Object(c.useState)(r),u=Object(g.a)(i,2),l=u[0],d=u[1];if(!l)return Object(o.jsx)(Ve,{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)(Ve,{children:[Object(o.jsx)("a",{className:"txt",target:"__blank",href:h,rel:"noopener noreferrer",children:Object(o.jsx)(ae,{})}),!s.settings.twitchChatMode.value&&Object(o.jsx)(De,{year:t,month:n}),s.settings.twitchChatMode.value&&Object(o.jsx)(Ae,{year:t,month:n})]})}var Je=h.a.div(We());function Qe(e){var t=e.year,n=e.month,a=e.onLoad;return Object(o.jsx)(Je,{children:Object(o.jsxs)(v.a,{variant:"contained",color:"primary",size:"large",onClick:a,children:["load ",t,"/",n]})})}function Ge(){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 Ge=function(){return e},e}var Xe=h.a.div(Ge());function Ze(){return Object(o.jsx)(Xe,{children:"User or channel has opted out"})}function $e(){var e=Object(d.a)(["\n color: white;\n padding: 2rem;\n padding-top: 0;\n width: 100%;\n"]);return $e=function(){return e},e}var et=h.a.div($e());function tt(){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,a=Object(c.useContext)(w),r=a.state,o=a.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),a=te(t);n&&(e=ne(e)),a&&(t=ne(t));var c=new URL("".concat(r.apiBaseUrl,"/list"));return c.searchParams.append("channel".concat(n?"id":""),e),c.searchParams.append("user".concat(a?"id":""),t),fetch(c.toString()).then((function(e){if(e.ok)return e;if(o(Object(m.a)(Object(m.a)({},r),{},{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),a=Object(g.a)(n,2),r=a[0];return a[1]instanceof ee?Object(o.jsx)(Ze,{}):Object(o.jsx)(et,{children:r.map((function(e,t){return Object(o.jsx)(qe,{year:e.year,month:e.month,initialLoad:0===t},"".concat(e.year,":").concat(e.month))}))})}function nt(){var e=Object(d.a)(["\n\t\n"]);return nt=function(){return e},e}var at=h.a.div(nt());function rt(){return Object(o.jsxs)(at,{children:[Object(o.jsx)(Q,{}),Object(o.jsx)(tt,{})]})}var ot=n(1094),ct=n(1095),st=Object(ot.a)({palette:{type:"dark"}});function it(){var e=Object(c.useContext)(w).state;return Object(o.jsx)(l.a,{client:e.queryClient,children:Object(o.jsx)(rt,{})})}u.a.render(Object(o.jsx)(s.a.StrictMode,{children:Object(o.jsx)(C,{children:Object(o.jsx)(ct.a,{theme:st,children:Object(o.jsx)(it,{})})})}),document.getElementById("root"))}},[[1045,1,2]]]);
|
|
//# sourceMappingURL=main.b632c989.chunk.js.map
|