1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
(()=>{"use strict";var t={144:(t,e,n)=>{n.d(e,{Z:()=>a});var o=n(81),i=n.n(o),r=n(645),s=n.n(r)()(i());s.push([t.id,".twitch-note-container{position:fixed;z-index:1000000;min-width:420px;max-width:95vw;min-height:240px;max-height:50vh;background:var(--color-background-base);border:var(--border-width-default) solid var(--color-border-base) !important}.twitch-note-header{width:100%;height:32px;line-height:32px;border-bottom:var(--border-width-default) solid var(--color-border-base) !important;position:relative;cursor:move}.twitch-note-title{color:var(--color-text-alt) !important;font-size:var(--font-size-6) !important;font-weight:var(--font-weight-semibold) !important;text-transform:uppercase !important;padding-left:calc((32px - var(--font-size-6))/2)}.twitch-note-close-button{position:absolute;right:5px;top:5px;width:22px;height:22px;line-height:22px;text-align:center;aspect-ratio:1;color:var(--color-text-alt) !important;font-size:var(--font-size-6) !important;font-weight:var(--font-weight-semibold) !important;text-transform:uppercase !important;cursor:pointer}.twitch-note-content{position:absolute;top:32px;left:0;right:0;bottom:32px;background:rgba(0,0,0,0);color:var(--color-text-base) !important;font-family:var(--font-base);vertical-align:baseline;outline:none;overflow:auto;padding:calc((32px - var(--font-size-6))/2)}.twitch-note-save-button{position:absolute;bottom:0;left:0;right:0;height:32px;border-top:var(--border-width-default) solid var(--color-border-base) !important;cursor:pointer;color:var(--color-text-alt) !important;font-size:var(--font-size-6) !important;font-weight:var(--font-weight-semibold) !important;text-transform:uppercase !important;text-align:center;line-height:32px}.twitch-notes-settings-button{z-index:var(--z-index-default) !important;position:relative !important;background-color:var(--color-background-button-primary-default);color:var(--color-text-button-primary);text-decoration:none;cursor:pointer;display:inline-flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;vertical-align:middle;overflow:hidden;white-space:nowrap;user-select:none;font-weight:var(--font-weight-semibold);border-radius:var(--border-radius-medium);font-size:var(--button-text-default);height:var(--button-size-default);padding:0 var(--button-padding-x)}.twitch-notes-settings-container{border:0;font:inherit;padding:0;vertical-align:baseline;position:fixed;z-index:var(--z-index-balloon);inset:auto 0 0 auto;margin:0 69px 48px 0}.twitch-notes-settings-balloon{display:inline-block;max-width:90vw;min-width:0;white-space:nowrap;border-radius:.6rem !important;background-color:var(--color-background-base) !important;box-shadow:var(--shadow-elevation-2) !important;color:inherit !important}.twitch-notes-settings-popover{white-space:normal;width:32rem}.twitch-notes-settings-header{display:flex !important;-webkit-box-align:center !important;align-items:center !important;position:relative !important;padding-left:1rem !important;padding-right:1rem !important;background-color:var(--color-background-base) !important;min-height:4rem}.twitch-notes-settings-header-left-element{left:0 !important;margin-right:.5rem !important;width:3rem}.twitch-notes-settings-header-center-element{-webkit-box-align:center !important;align-items:center !important;display:flex !important;text-align:center !important;-webkit-box-flex:1 !important;flex-grow:1 !important;-webkit-box-pack:center !important;justify-content:center !important}.twitch-notes-settings-header-center-element-content{line-height:1.5;color:var(--color-text-alt) !important;font-size:var(--font-size-5) !important;font-weight:var(--font-weight-semibold) !important}.twitch-notes-settings-header-right-element{right:0 !important;margin-left:.5rem !important}.twitch-notes-settings-close-button{cursor:default;text-transform:none;text-indent:0;text-shadow:none;letter-spacing:normal;text-rendering:auto;appearance:auto;writing-mode:horizontal-tb !important;box-sizing:border-box;margin:0;font:inherit;border:none;font-size:var(--button-text-default);font-weight:var(--font-weight-semibold);vertical-align:middle;overflow:hidden;text-decoration:none;white-space:nowrap;position:relative;display:inline-flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;user-select:none;border-radius:var(--border-radius-medium);height:calc(var(--button-size-default) - 1rem);width:calc(var(--button-size-default) - 1rem);background-color:var(--color-background-button-text-default);color:var(--color-fill-button-icon)}.twitch-notes-settings-scrollable-area{display:flex;overflow:hidden;z-index:0;height:100%;position:relative;max-height:478px}.twitch-notes-settings-content{box-sizing:content-box;min-width:100%;overflow-x:hidden;overflow-y:auto;max-height:inherit !important;margin:1rem;padding-bottom:0 !important}.twitch-notes-settings-option-line{position:relative !important;width:calc(100% - 2rem) !important}.twitch-notes-settings-option-line-button{border-radius:var(--border-radius-medium);display:block;width:100%;color:inherit}.twitch-notes-settings-option-line-button:hover{cursor:pointer;text-decoration:none;color:inherit;background-color:var(--color-background-interactable-hover)}.twitch-notes-settings-option-line-button-container{display:flex !important;-webkit-box-align:center !important;align-items:center !important;position:relative !important;padding:.5rem !important}.twitch-notes-settings-option-line-button-container-content{-webkit-box-flex:1 !important;flex-grow:1 !important}.twitch-note-settings-separator{border-top:1px solid var(--color-border-base);margin-top:1rem !important;margin-left:.5rem !important;margin-right:.5rem !important;padding-bottom:1rem !important}.twitch-notes-x-button{position:absolute;left:0;width:100%;min-height:100%;top:0;fill:currentcolor}.twitch-notes-blurred-background{position:fixed;inset:0 0 0 0;z-index:2000000;background:rgba(0,0,0,.4);backdrop-filter:blur(2px)}.twitch-notes-center-floating-container{background:var(--color-background-base);border:var(--border-width-default) solid var(--color-border-base) !important;padding:4rem 2rem 2rem;position:fixed;top:50vh;left:50vw;transform:translate(-50%, -50%);max-height:90vh;max-width:90vw;overflow:auto}.twitch-notes-user-list-user{padding:1rem;border-bottom:var(--border-width-default) solid var(--color-border-base) !important;cursor:pointer}.twitch-notes-user-list-user[data-active]{background:rgba(119,44,232,.2)}",""]);const a=s},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",o=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),o&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),o&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,o,i,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(o)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var d=0;d<t.length;d++){var c=[].concat(t[d]);o&&s[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),i&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=i):c[4]="".concat(i)),e.push(c))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],d=o.base?l[0]+o.base:l[0],c=r[d]||0,u="".concat(d," ").concat(c);r[d]=c+1;var p=n(u),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var m=i(h,o);o.byIndex=a,e.splice(a,0,{identifier:u,updater:m,references:1})}s.push(u)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var r=o(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=o(t,i),d=0;d<r.length;d++){var c=n(r[d]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}r=l}}},569:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,i&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={id:o,exports:{}};return t[o](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nc=void 0,(()=>{var t=n(379),e=n.n(t),o=n(795),i=n.n(o),r=n(569),s=n.n(r),a=n(565),l=n.n(a),d=n(216),c=n.n(d),u=n(589),p=n.n(u),h=n(144),m={};m.styleTagTransform=p(),m.setAttributes=l(),m.insert=s().bind(null,"head"),m.domAPI=i(),m.insertStyleElement=c(),e()(h.Z,m),h.Z&&h.Z.locals&&h.Z.locals;var f,v=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),g=function(){function t(t,e){if(this.element=document.createElement(t),e.id?this.setId(e.id):this.setId(t+"-generated-id-"+Math.floor(1e7*Math.random())),e.class)if("string"==typeof e.class)this.addClass(e.class);else for(var n=0,o=e.class;n<o.length;n++){var i=o[n];this.addClass(i)}if(e.attributes)for(var r in e.attributes)this.addAttribute(r,e.attributes[r]);e.css&&this.setStyle(e.css),e.body&&("string"==typeof e.body?this.setBody(e.body):this.appendChild(e.body)),e.customBody&&this.appendCustomChild(e.customBody)}return t.prototype.setId=function(t){return this.element.id=t,this},t.prototype.addClass=function(t){return this.element.classList.add(t),this},t.prototype.addAttribute=function(t,e){return this.element.setAttribute(t,e),this},t.prototype.setStyle=function(t){for(var e in t)this.element.style[e]=t[e]||"";return this},t.prototype.setBody=function(t){return this.element.innerHTML=t,this},t.prototype.appendBody=function(t){return this.element.innerHTML+=t,this},t.prototype.appendChild=function(t){return this.element.appendChild(t),this},t.prototype.appendCustomChild=function(t){return this.element.appendChild(t.getElement()),this},t.prototype.getElement=function(){return this.element},t.prototype.setClickListener=function(t){return this.element.addEventListener("click",(function(){return t()})),this},t.prototype.setChangeListener=function(t){return this.element.addEventListener("change",(function(){return t()})),this},t.prototype.setMouseMoveListener=function(t){return this.element.addEventListener("mousemove",(function(){return t()})),this},t.prototype.setMouseDownListener=function(t){return this.element.addEventListener("mousedown",(function(){return t()})),this},t.prototype.setMouseUpListener=function(t){return this.element.addEventListener("mouseup",(function(){return t()})),this},t.prototype.remove=function(){this.element.remove()},t.prototype.show=function(){return this.setStyle({display:"unset"}),this},t.prototype.hide=function(){return this.setStyle({display:"none"}),this},t}(),w=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"div",{class:e,body:n})||this}return v(e,t),e}(g),b=function(t){function e(e){return void 0===e&&(e=""),t.call(this,"input",{class:e})||this}return v(e,t),e}(g),C=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"p",{class:e,body:n})||this}return v(e,t),e}(g),y=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"button",{class:e,body:n})||this}return v(e,t),e}(g),x=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"a",{class:e,body:n})||this}return v(e,t),e}(g),S=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"span",{class:e,body:n})||this}return v(e,t),e}(g),L=function(t){function e(e,n){return void 0===e&&(e=""),void 0===n&&(n=""),t.call(this,"img",{class:e,body:n})||this}return v(e,t),e}(g),k="twitch-note-all-users-list",E="twitch-note-";const N=function(){function t(){}return t.getSavedUserList=function(){return JSON.parse(localStorage.getItem(k)||"[]")},t.getNote=function(t){return localStorage.getItem(E+t)||""},t.addUserToSavedList=function(t){var e=this.getSavedUserList();e.includes(t)||(e.push(t),localStorage.setItem(k,JSON.stringify(e)))},t.removeUserFromSavedList=function(t){var e=this.getSavedUserList();(e=e.filter((function(e){return e!==t}))).length?localStorage.setItem(k,JSON.stringify(e)):localStorage.removeItem(k)},t.saveNote=function(t,e){this.addUserToSavedList(t),localStorage.setItem(E+t,e)},t.deleteNote=function(t){this.removeUserFromSavedList(t),localStorage.removeItem(E+t)},t.exportNotes=function(){var t=this,e={users:this.getSavedUserList(),notes:this.getSavedUserList().map((function(e){return{user:e,note:t.getNote(e)}})),settings:{}},n=JSON.stringify(e),o=new Blob([n],{type:"text/json"}),i=window.document.createElement("a");i.href=window.URL.createObjectURL(o),i.download="twitch-notes-"+Date.now()+".json",document.body.appendChild(i),i.click(),document.body.removeChild(i)},t.clearData=function(){for(var t=0,e=this.getSavedUserList();t<e.length;t++){var n=e[t];this.deleteNote(n)}},t.inputData={users:[],notes:[],settings:{}},t}(),M={activeContainer:"",containers:{},addContainer:function(t,e){this.containers[t]||(this.containers[t]=e)},removeContainer:function(t){this.containers[t]&&(this.containers[t].remove(),delete this.containers[t])}};var T=function(){return T=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},T.apply(this,arguments)};const F=function(){function t(){}return t.setupListeners=function(){t.listenersSetUp||(document.addEventListener("mousemove",t.handleMouseMove),document.addEventListener("mouseup",t.handleMouseUp),t.listenersSetUp=!0)},t.handleMouseUp=function(){M.activeContainer="",t.isMouseDown=!1},t.updateMousePosition=function(e,n){t.lastMousePosition=T({},this.mousePosition),t.mousePosition={x:e,y:n}},t.handleMouseMove=function(e){if(t.isMouseDown&&M.activeContainer){var n=t.mousePosition.x-t.lastMousePosition.x,o=t.mousePosition.y-t.lastMousePosition.y;M.containers[M.activeContainer].setStyle({top:parseInt(M.containers[M.activeContainer].getElement().style.top)+o+"px",left:parseInt(M.containers[M.activeContainer].getElement().style.left)+n+"px"})}t.updateMousePosition(e.clientX,e.clientY)},t.isMouseDown=!1,t.mousePosition={x:0,y:0},t.lastMousePosition={x:0,y:0},t.listenersSetUp=!1,t}();function z(){var t=document.querySelector(".twitch-notes-settings-container");if(!t){var e=new w("twitch-notes-settings-container"),n=new w("twitch-notes-settings-balloon"),o=new w("twitch-notes-settings-popover"),i=new w("twitch-notes-settings-header"),r=new w("twitch-notes-settings-header-left-element"),s=new w("twitch-notes-settings-header-center-element"),a=new C("twitch-notes-settings-header-center-element-content","Twitch Notes Settings"),l=new w("twitch-notes-settings-header-right-element"),d=new y("twitch-notes-settings-close-button",'<svg width="100%" height="100%" viewBox="0 0 20 20" x="0px" y="0px" class="twitch-notes-x-button">\n <g>\n <path d="M8.5 10L4 5.5 5.5 4 10 8.5 14.5 4 16 5.5 11.5 10l4.5 4.5-1.5 1.5-4.5-4.5L5.5 16 4 14.5 8.5 10z"></path>\n </g>\n </svg>'),c=new w("twitch-notes-settings-scrollable-area"),u=new w("twitch-notes-settings-content"),p=B("Export Notes"),h=B("Import Notes"),m=B("Clear Data"),f=B("View All Notes");return e.appendCustomChild(n),n.appendCustomChild(o),o.appendCustomChild(i),i.appendCustomChild(r),i.appendCustomChild(s),s.appendCustomChild(a),i.appendCustomChild(l),l.appendCustomChild(d),o.appendCustomChild(c),c.appendCustomChild(u),u.appendCustomChild(p),u.appendCustomChild(h),u.appendCustomChild(m),u.appendCustomChild(new w("twitch-note-settings-separator")),u.appendCustomChild(f),d.setClickListener((function(){return z()})),p.setClickListener((function(){N.exportNotes(),z()})),h.setClickListener((function(){!function(){var t=new w("twitch-notes-blurred-background"),e=new w("twitch-notes-center-floating-container","<strong>WARNING!</strong> <em>This action might override existing data!</em><br /><br />"),n=new w("","Select exported twitch notes file<br /><br />"),o=new b("twitch-notes-file-input");o.addAttribute("type","file").addAttribute("accept","json");var i=new y("twitch-notes-settings-close-button",'<svg width="100%" height="100%" viewBox="0 0 20 20" x="0px" y="0px" class="twitch-notes-x-button">\n <g>\n <path d="M8.5 10L4 5.5 5.5 4 10 8.5 14.5 4 16 5.5 11.5 10l4.5 4.5-1.5 1.5-4.5-4.5L5.5 16 4 14.5 8.5 10z"></path>\n </g>\n </svg>');i.setStyle({position:"absolute",top:"1rem",right:"1rem"}),n.appendCustomChild(o),i.setClickListener((function(){t.remove()})),o.setChangeListener((function(){var i;if(null===(i=null==o?void 0:o.getElement())||void 0===i?void 0:i.files){var r=o.getElement().files.item(0);if(r){var s=new FileReader;s.readAsText(r,"UTF-8"),s.onload=function(o){var i;(null===(i=null==o?void 0:o.target)||void 0===i?void 0:i.result)&&(N.inputData=JSON.parse(o.target.result.toString()),N.inputData&&(n.setStyle({display:"none"}),D(e,t)))},s.onerror=function(){console.error("error reading file")}}}})),e.appendCustomChild(i),e.appendCustomChild(n),t.appendCustomChild(e),document.body.appendChild(t.getElement())}(),z()})),m.setClickListener((function(){!function(){var t=new w("twitch-notes-blurred-background"),e=new w("twitch-notes-center-floating-container","<strong>This action will delete all saved notes!</strong><br /><br /><em>Consider exporting notes before performing this action in case you will need to use notes again</em>"),n=new w;n.setStyle({height:"24px"});var o=new y("twitch-notes-settings-button","DELETE ALL NOTES");o.setStyle({background:"red"}),o.setClickListener((function(){N.clearData(),t.remove()}));var i=new y("twitch-notes-settings-button","Cancel");i.setClickListener((function(){t.remove()})),e.appendCustomChild(n),e.appendCustomChild(o),e.appendCustomChild(i),t.appendCustomChild(e),document.body.appendChild(t.getElement())}(),z()})),f.setClickListener((function(){!function(){var t="",e=new w("twitch-notes-blurred-background"),n=new S("","Note saved!");n.setStyle({color:"green",marginLeft:"2rem"}),n.hide();var o=new w("twitch-notes-center-floating-container");o.setStyle({padding:"0",paddingTop:"1rem",width:"100%",maxWidth:"800px",height:"calc(320px + 5rem)",maxHeight:"90vh"});var i=new y("twitch-notes-settings-close-button",'<svg width="100%" height="100%" viewBox="0 0 20 20" x="0px" y="0px" class="twitch-notes-x-button">\n <g>\n <path d="M8.5 10L4 5.5 5.5 4 10 8.5 14.5 4 16 5.5 11.5 10l4.5 4.5-1.5 1.5-4.5-4.5L5.5 16 4 14.5 8.5 10z"></path>\n </g>\n </svg>');i.setStyle({position:"absolute",top:"1rem",right:"1rem"});var r=new w("twitch-note-title","Notes:");r.setStyle({borderBottom:"1px solid #FFFFFF19",paddingBottom:"1rem"}),o.appendCustomChild(r);var s=new w;s.setStyle({display:"flex",flexDirection:"row",flexWrap:"no-wrap",width:"100%",height:"320px"}),o.appendCustomChild(s),i.setClickListener((function(){e.remove()})),o.appendCustomChild(i);var a=new w;a.setStyle({borderRight:"1px solid #FFFFFF19",height:"320px",minWidth:"240px",overflowY:"auto",overflowX:"hidden"});var l=new w;l.setStyle({height:"320px",padding:"1rem",width:"100%",opacity:"0"});var d=new w;d.setStyle({marginBottom:"3rem",border:"1px solid #FFFFFF19",height:"calc(320px - 7rem)",width:"100%",padding:"6px",outline:"none",overflowY:"auto",overflowX:"hidden"}),d.addAttribute("contentEditable","true");var c=new y("twitch-notes-settings-button","Save Note");c.setStyle({position:"absolute",bottom:"1rem",left:"1rem"}),c.setClickListener((function(){t&&(N.saveNote(t,d.getElement().innerHTML),n.setStyle({display:"inline-block"}))}));for(var u=function(e){var o=new w("twitch-notes-user-list-user",e);o.setClickListener((function(){for(var i,r=document.getElementsByClassName("twitch-notes-user-list-user"),s=0;s<r.length;s++)null===(i=r.item(s))||void 0===i||i.removeAttribute("data-active");n.hide(),o.addAttribute("data-active","true"),l.setStyle({opacity:"1"}),d.getElement().innerHTML=N.getNote(e),t=e})),a.appendCustomChild(o)},p=0,h=N.getSavedUserList();p<h.length;p++)u(h[p]);l.appendCustomChild(d),l.appendCustomChild(c),l.appendCustomChild(n),s.appendCustomChild(a),s.appendCustomChild(l),e.appendCustomChild(o),document.body.appendChild(e.getElement())}(),z()})),void document.body.appendChild(e.getElement())}t.remove()}function D(t,e){for(var n,o,i,r=[],s=[],a=[],l=function(t){N.getNote(t)?(null===(n=N.inputData.notes.find((function(e){return e.user===t})))||void 0===n?void 0:n.resolved)||N.getNote(t)!==(null===(o=N.inputData.notes.find((function(e){return e.user===t})))||void 0===o?void 0:o.note)?s.push(t):a.push(t):r.push(t)},d=0,c=N.inputData.users;d<c.length;d++)l(c[d]);var u=new w;if(s.length){var p=new w("","<strong>Note conflicts found for:</strong><br />");p.setStyle({marginTop:"1rem"});for(var h=function(n){var o=new w("",n+" "),r=null===(i=N.inputData.notes.find((function(t){return t.user===n})))||void 0===i?void 0:i.resolved;o.setStyle({color:r?"green":"red"});var s=new x("",r?"[update]":"[resolve]");s.setStyle({cursor:"pointer"}),s.setClickListener((function(){!function(t,e,n,o){var i=new w("twitch-notes-blurred-background"),r=new w("twitch-notes-center-floating-container","<strong>Select which note to keep for <em>"+t+"</em></strong><br /><em>You can modify notes to merge them and keep updated one</em><br /><br />"),s=new w;s.setStyle({display:"flex",flexDirection:"row",flexWrap:"no-wrap",width:"100%"});var a={minWidth:"320px",padding:"6px",border:"1px solid #FFFFFF19",outline:"none"},l=["contentEditable","true"],d=new w,c=new C("","<strong>Locally saved note</strong>");d.appendCustomChild(c);var u=new w;u.setStyle(a),u.addAttribute.apply(u,l),u.setId("local-value-container");var p=new y("twitch-notes-settings-button","Save this");p.setClickListener((function(){var r,s=(null===(r=document.getElementById("local-value-container"))||void 0===r?void 0:r.innerHTML)||"";N.inputData.notes=N.inputData.notes.map((function(e){return e.user===t?{user:e.user,note:s,resolved:!0}:e})),i.remove(),e.remove(),D(n,o)})),d.appendCustomChild(u),d.appendBody("<br />"),d.appendCustomChild(p);var h=new w,m=new C("","<strong>Imported note</strong>");h.appendCustomChild(m);var f=new w("",N.inputData.notes.filter((function(e){return e.user===t}))[0].note||"");f.setId("import-value-container"),f.setStyle(a),f.addAttribute.apply(f,l);var v=new y("twitch-notes-settings-button","Save this");v.setClickListener((function(){var r,s=(null===(r=document.getElementById("import-value-container"))||void 0===r?void 0:r.innerHTML)||"";N.inputData.notes=N.inputData.notes.map((function(e){return e.user===t?{user:e.user,note:s,resolved:!0}:e})),i.remove(),e.remove(),D(n,o)})),h.appendCustomChild(f),h.appendBody("<br />"),h.appendCustomChild(v),s.appendCustomChild(d),s.appendCustomChild(h),r.appendCustomChild(s),i.appendCustomChild(r),document.body.appendChild(i.getElement())}(n,u,t,e)})),o.appendCustomChild(s),p.appendCustomChild(o)},m=0,f=s;m<f.length;m++)h(f[m]);u.appendCustomChild(p)}if(r.length){var v=new w("","<strong>Note will be added for:</strong><br />"+r.join("<br />"));v.setStyle({marginTop:"1rem",color:"white"}),u.appendCustomChild(v)}if(a.length){var g=new w("","<strong>No changes for:</strong><br />"+a.join("<br />"));g.setStyle({marginTop:"1rem",color:"gray"}),u.appendCustomChild(g)}var b=new w;b.setStyle({height:"24px"}),u.appendCustomChild(b),s=s.filter((function(t){var e;return!(null===(e=N.inputData.notes.find((function(e){return e.user===t})))||void 0===e?void 0:e.resolved)}));var S=new y("twitch-notes-settings-button","Complete import");if(S.setStyle({}),s.length>0&&S.setStyle({background:"gray"}),s.length>0&&S.addAttribute("disabled","true"),u.appendCustomChild(S),s.length>0){var L=new w("","<em>Import cannot be completed while there are unresolved conflicts</em>");L.setStyle({color:"gray"}),u.appendCustomChild(L)}else S.setClickListener((function(){for(var t=0,n=N.inputData.notes;t<n.length;t++){var o=n[t];N.saveNote(o.user,o.note)}e.remove(),N.inputData={users:[],notes:[],settings:{}}}));t.appendCustomChild(u)}function B(t){var e=new w("twitch-notes-settings-option-line"),n=new y("twitch-notes-settings-option-line-button"),o=new w("twitch-notes-settings-option-line-button-container"),i=new w("twitch-notes-settings-option-line-button-container-content",t);return o.appendCustomChild(i),n.appendCustomChild(o),e.appendCustomChild(n),e}var I=function(){function t(){this.observer=null}return t.prototype.init=function(t){var e=this;this.chatContainerNode=t,this.startObserver(t),this.addNotesButton(),setTimeout((function(){e.addUserNoteBadges()}),1e3)},t.prototype.startObserver=function(t){var e=this;this.observer&&this.observer.disconnect();var n=!1;this.observer=new MutationObserver((function(t){if(!n)for(var o=0,i=t;o<i.length;o++)"childList"===i[o].type&&(n=!0,e.addUserNoteBadges(),n=!1)})),this.observer.observe(t,{attributes:!0,childList:!0,subtree:!0})},t.prototype.addNotesButton=function(){var t=this,e=document.querySelector(".".concat("chat-input__buttons-container"));if(e){var n=new w;n.setStyle({marginLeft:"0.5rem !important"});var o=new w;n.setStyle({display:"inline-flex !important"});var i=new y("twitch-notes-settings-button","Notes");i.setClickListener((function(){z()})),o.appendCustomChild(i),n.appendCustomChild(o),e.lastChild?e.lastChild.insertBefore(n.getElement(),e.lastChild.lastChild):e.appendChild(n.getElement())}else setTimeout((function(){return t.addNotesButton()}),100)},t.prototype.addUserNoteBadges=function(){for(var t=document.getElementsByClassName("chat-line__message"),e=function(e){var n=t.item(e);if(!n)return"continue";var o=n.querySelector(".chat-author__display-name");if(!o)return"continue";var i=n.querySelector(".chat-line__username-container");if(!i)return"continue";var r=o.getAttribute("data-a-user");if(r&&!i.querySelector(".twitch-note")){var s=new S("twitch-note");s.setStyle({cursor:"pointer"}),s.setClickListener((function(){!function(t){if(!M.containers[t]){var e=new w("twitch-note-container");e.setStyle({left:F.mousePosition.x+"px",top:F.mousePosition.y+10+"px"});var n=new w("twitch-note-header");n.setMouseDownListener((function(){M.activeContainer=t,F.isMouseDown=!0}));var o=new S("twitch-note-close-button",'<svg width="100%" height="100%" viewBox="0 0 20 20" x="0px" y="0px" class="twitch-notes-x-button">\n <g>\n <path d="M8.5 10L4 5.5 5.5 4 10 8.5 14.5 4 16 5.5 11.5 10l4.5 4.5-1.5 1.5-4.5-4.5L5.5 16 4 14.5 8.5 10z"></path>\n </g>\n </svg>');o.setClickListener((function(){M.removeContainer(t)}));var i=new S("twitch-note-title",t),r=new w("twitch-note-content",N.getNote(t));r.addAttribute("contentEditable","true");var s=new w("twitch-note-save-button","SAVE");s.setClickListener((function(){N.saveNote(t,r.getElement().innerHTML),M.removeContainer(t)})),n.appendCustomChild(o),n.appendCustomChild(i),e.appendCustomChild(n),e.appendCustomChild(r),e.appendCustomChild(s),document.body.appendChild(e.getElement()),M.addContainer(t,e)}}(r)}));var a=new L;a.setStyle({height:"18px",paddingRight:"4px"}),a.addAttribute("src","https://cdn.rdarius.lt/icons/32-id-card.png"),s.appendCustomChild(a),i.insertBefore(s.getElement(),i.firstChild)}},n=0;n<t.length;n++)e(n)},t}(),A=new I,U=!1,O="";setInterval((function(){var t=window.location.href;if(O!==t)return O=t,void(U=!1);var e=document.querySelector(".".concat("chat-scrollable-area__message-container"));e?(U||(A.init(e),F.setupListeners()),U=!0):U=!1}),1e3)})()})(); |