MPP Assistant by RoxasYTB

For Multiplayer Piano

  1. // ==UserScript==
  2. // @license MIT
  3. // @name MPP Assistant by RoxasYTB
  4. // @namespace http://tampermonkey.net/
  5. // @version 6.7
  6. // @description For Multiplayer Piano
  7. // @author RoxasYTB
  8. // @match *://multiplayerpiano.net/*
  9. // @match *://multiplayerpiano.org/*
  10. // @match *://mppclone.com/*
  11. // @match *://mpp.terrium.net/*
  12. // @match *://piano.ourworldofpixels.com/*
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. MPP.chat._send = MPP.chat.send, console.clear(), console.log("%c Piano Assistant by Roxas and edited by ._.", "font-weight: bold; font-size: 40px;color: red; text-shadow: 3px 3px 0 rgb(217,31,38) , 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) , 15px 15px 0 rgb(2,135,206) , 18px 18px 0 rgb(4,77,145) , 21px 21px 0 rgb(42,21,113)"), console.log("If any issues arise, reach out here : https://discord.gg/cF7HR92JHt ! Please use my assistant, don't abuse it, and don't bother others with it to annoy them.\nIf you want to credit me, it's with pleasure, be free to modify the code!\n\n\nShortcuts:\n\nCtrl+O to open MIDI file\nDel to play your midi file\nEnd to stop it!\n\n\nThe transpose level take effect on the MIDI !\nType !rainbow to get a rainbow background and !reset if you want to reset it."), window.PJSMP_mp__version = "1.0.10", window.PJSMP_mp__moduleName = "ASSISTANT", window.PJSMP_mp__moduleFullName = "Pure JavaScript Midi Player - module: player", window.PJSMP_mp__changeLog = "", window.PJSMP_mp__debugLenguage = void 0, window.PJSMP_mp__translations = {
  17. en: {
  18. play: "Play",
  19. pause: "Pause",
  20. stop: "Stop",
  21. fix: "Fix",
  22. options: {
  23. sustain: "Sustain",
  24. sustainTitle: "Keep notes sustained",
  25. loop: "Loop",
  26. loopTitle: "Restart the song at it's end",
  27. asynchrony: "Asynchrony",
  28. asynchronyTitle: "Add or remove a random asynchrony to the notes",
  29. notequota: "NoteQuota",
  30. notequotaTitle: "Remove the Client Side note quota\nBut the Server Side one still there\nYou will not be heard from others playes if it get in its's limit"
  31. },
  32. sliders: {
  33. velocityIncrement: "Velocity Increment",
  34. speed: "Song Speed"
  35. },
  36. origin: {
  37. octave: "Origin Octave",
  38. transpose: "Origin Pitch"
  39. },
  40. text: {
  41. noMidiLoad: "No midi file loaded",
  42. chooseMidi: "Choose a midi file",
  43. error: {
  44. midiPlayError: "Unable to play midi file",
  45. midiLoadError: "Unable to load midi file"
  46. },
  47. tracks: "Tracks",
  48. notes: "Notes",
  49. notePerSecond: "Amount of notes per second requested by " + PJSMP_mp__moduleName + "\nDisable sustain for less requests",
  50. openWindow: "Open program window",
  51. closeWindow: "Minimize program window",
  52. playing: "Now playing",
  53. thxTo: "English translation by NaN-NaN-senpai(BR)"
  54. }
  55. },
  56. fr: {
  57. play: "Jouer",
  58. pause: "Pause",
  59. stop: "Stop",
  60. fix: "Réini.",
  61. options: {
  62. sustain: "Sustain",
  63. sustainTitle: "Garde les notes plus longtemps",
  64. loop: "En boucle",
  65. loopTitle: "Recommence la musique",
  66. asynchrony: "Désynchro",
  67. asynchronyTitle: "Désynchronise vos notes",
  68. notequota: "Note Quota",
  69. notequotaTitle: "Supprimez le quota de notes côté client\nMais celui côté serveur est toujours là\nVous ne serez pas entendu des autres joueurs s'il atteint sa limite"
  70. },
  71. sliders: {
  72. velocityIncrement: "Puissance",
  73. speed: "Vitesse"
  74. },
  75. origin: {
  76. octave: "Octave d'origine",
  77. transpose: "Note d'origine"
  78. },
  79. text: {
  80. noMidiLoad: "Pas de MIDI chargé",
  81. chooseMidi: "Choix du fichier MIDI",
  82. error: {
  83. midiPlayError: "Ne peut pas jouer le fichier",
  84. midiLoadError: "Ne peut pas charger le fichier"
  85. },
  86. tracks: "Tracks",
  87. notes: "Notes",
  88. notePerSecond: "Quantité de notes par seconde demandées par " + PJSMP_mp__moduleName + "\nDésactiver le maintien pour moins de requêtes",
  89. openWindow: "Ouvrir la fenêtre du programe",
  90. closeWindow: "Minimiser",
  91. playing: "En train de jouer",
  92. thxTo: "Traduction francaise par RoxasYTB"
  93. }
  94. }
  95. }, window.PJSMP_mp__translate = e => {
  96. var t, n, r = window.PJSMP_mp__debugLenguage || navigator.language || navigator.userLanguage,
  97. o = void 0 === PJSMP_mp__translations[r.substr(0, 2)] ? PJSMP_mp__translations.en : "string" == typeof leng ? PJSMP_mp__translations[leng] : PJSMP_mp__translations[r.substr(0, 2)];
  98. return e.replace(/\./g, " ").split(" ").forEach((e => {
  99. t = (null == t ? o : t)[e], n = (null == n ? PJSMP_mp__translations.en : n)[e]
  100. })), null == t ? n : t
  101. }, window.PJSMP_mp__playerColor = "#777" == MPP.client.getOwnParticipant().color ? "#FFD22E" : MPP.client.getOwnParticipant().color, window.PJSMP_mp__convertHex = (e, t) => (4 == e.length && (e = e[0] + e[1] + e[1] + e[2] + e[2] + e[3] + e[3]), e = e.replace("#", ""), r = parseInt(e.substring(0, 2), 16), g = parseInt(e.substring(2, 4), 16), b = parseInt(e.substring(4, 6), 16), "rgba(" + r + "," + g + "," + b + "," + ("number" != typeof t ? .5 : t) + ")"), window.PJSMP_mp__colors = {
  102. on: "rgba(11, 133, 0, 1)",
  103. off: "rgba(255, 34, 31, 1)",
  104. darkerOn: "rgba(11, 50, 0, 1)",
  105. darkerOff: "rgba(90, 14, 11, 1)",
  106. darkerBg: "rgba(20, 20, 20, .7)",
  107. secondBg: "rgba(157, 154, 150, 0.35)",
  108. bgColor: PJSMP_mp__convertHex(PJSMP_mp__playerColor),
  109. bgColor2: PJSMP_mp__convertHex(PJSMP_mp__playerColor, .9)
  110. }, MPP.client.on("a", (function(e) {
  111. if (["player version", "player v", "pjsmp version", "pjsmp v", "pjsmp module", "pjsmp m"].includes(e.a.toLowerCase())) {
  112. var t = "(" + String((new Date).getHours()).padStart(2, "0") + ":" + String((new Date).getMinutes()).padStart(2, "0") + "): ";
  113. MPP.chat.send(t + "using " + PJSMP_mp__moduleName + " - v" + PJSMP_mp__version)
  114. }
  115. })), window.PJSMP_mp__setBtnTextColor = (e, t, n) => {
  116. e.style.color = t, e.style.textShadow = "0px 0px " + ("number" != typeof n ? "5px" : n + "px") + " " + t
  117. }, window.PJSMP_mp__controllers = {
  118. sustain: {
  119. state: !0
  120. },
  121. loop: {
  122. state: !1
  123. },
  124. asynchrony: {
  125. state: !1
  126. },
  127. notequota: {
  128. state: !1
  129. },
  130. velocityIncrement: {
  131. state: !1,
  132. value: 0,
  133. default: 0
  134. },
  135. speed: {
  136. state: !1,
  137. value: 1,
  138. default: 1
  139. },
  140. originOctave: {
  141. state: !0,
  142. value: 0,
  143. default: 0
  144. },
  145. originTranspose: {
  146. state: !0,
  147. value: 0,
  148. default: 0
  149. }
  150. }, window.PJSMP_mp__windowMinimized = !1, window.PJSMP_mp__NPS = 0;
  151. var PJSMP_mp__NPS_interval = setInterval((() => {
  152. var e = PJSMP_mp__NPS * (PJSMP_mp__controllers.sustain.state ? 2 : 1);
  153. document.querySelector("#PJSMP_mp__NPSContainer_text").innerHTML = e, PJSMP_mp__NPS = 0, min = parseInt(60 * PJSMP_mp__calcDuration().split("| ")[1].split(":")[0]), sec = parseInt(PJSMP_mp__calcDuration().split("| ")[1].split(":")[1]), dur = min + sec, document.querySelector("#probar") && (dur1 = parseInt(document.querySelector("#probar").value), min1 = parseInt(dur1 / 60) < 10 ? "0" + parseInt(dur1 / 60) : parseInt(dur1 / 60).toString(), sec1 = parseInt(PJSMP_mp__calcDuration().split(" |")[0].split(":")[1]) < 10 ? "0" + parseInt(PJSMP_mp__calcDuration().split(" |")[0].split(":")[1]) : parseInt(PJSMP_mp__calcDuration().split(" |")[0].split(":")[1]).toString()), document.getElementById("probar") && document.getElementById("probar").setAttribute("max", dur)
  154. }), 100);
  155. if (!document.querySelector("#PJSMP_mp__mainContainer")) {
  156. var PJSMP_mp__mainContainer = document.createElement("div");
  157. PJSMP_mp__mainContainer.id = "PJSMP_mp__mainContainer", PJSMP_mp__mainContainer.style.position = "fixed", PJSMP_mp__mainContainer.style.top = "30px", PJSMP_mp__mainContainer.style.right = "30px", PJSMP_mp__mainContainer.style.backdropFilter = "blur(1.5px)";
  158. var PJSMP_mp__CSS = document.createElement("style");
  159. PJSMP_mp__CSS.innerHTML = "\n #PJSMP_mp__window {\n display: inline-block;\n border: solid " + PJSMP_mp__colors.darkerBg + ";\n border-radius: 10px 0px 10px 10px;\n transition: .2s;\n }\n\n #PJSMP_mp__mainContainer{\n width: fit-content;\n }\n #PJSMP_mp__mainContainer .PJSMP_mp__buttonClass{\n margin: 0px 0px 5px 5px;\n padding: 5px;\n }\n #PJSMP_mp__mainContainer button{\n background: rgba(60, 60, 60, 0.7);\n border: 1px solid " + PJSMP_mp__colors.darkerBg + ";\n cursor: pointer;\n border-radius: 3px;\n -webkit-border-radius: 3px;\n -moz-border-radius: 3px;\n color: white;\n overflow: hidden;\n white-space:nowrap;\n outline: none;\n text-shadow: none;\n transition: background .2s, color .3s, text-shadow .3s;\n }\n #PJSMP_mp__mainContainer button:hover{\n text-shadow: 0px 0px 2px white;\n background: " + PJSMP_mp__colors.secondBg + ";\n }\n #PJSMP_mp__mainContainer button:active{\n text-shadow: 0px 0px 5px white;\n background: " + PJSMP_mp__colors.darkerBg + ";\n }\n #PJSMP_mp__mainContainer input[type=file]{\n opacity: 0;\n width: 0px;\n height: 0px;\n position: absolute;\n pointer-events: none;\n }\n\n #PJSMP_mp__fileDropContainer_textContainer{\n font-size: 15px;\n background: " + PJSMP_mp__colors.darkerBg + ";\n border-radius: 7px 0px 0px 0px;\n max-height: 30px;\n overflow-y: auto;\n width: 350px;\n }\n #PJSMP_mp__fileDropContainer_textContainer_text{\n margin-left: 5px;\n margin-right: 5px;\n }\n #PJSMP_mp__fileDropContainer_textContainer::-webkit-scrollbar-track{\n -webkit-box-shadow: inset 0 0 6px rgba(255,255,255,0.3);\n border-radius: 10px;\n background-color: rgba(255, 255, 255, .1);\n }\n #PJSMP_mp__fileDropContainer_textContainer::-webkit-scrollbar{\n width: 5px;\n height: 5px;\n }\n #PJSMP_mp__fileDropContainer_textContainer::-webkit-scrollbar-thumb{\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);\n background-color: " + PJSMP_mp__colors.darkerBg + ";\n }\n\n\n #PJSMP_mp__basicControllersContainer_options{\n display: grid;\n grid-template-columns: auto;\n position: relative;\n top: -10px;\n }\n\n .inputRangeContainer{\n display: grid;\n grid-template-columns: auto auto auto;\n }\n .inputRangeContainer *{\n outline: none;\n }\n .inputRangeSubContainer{\n display: grid;\n grid-gap: 5px;\n position: relative;\n bottom: 35px;\n width: 43px;\n overflow: hidden;\n background-color: " + PJSMP_mp__colors.darkerBg + ";\n border: " + PJSMP_mp__colors.darkerBg + " solid;\n border-radius: 20px;\n margin-left: 5px;\n }\n .inputRangeContainer input[type=range][orient=vertical]{\n writing-mode: bt-lr; /* IE */\n -webkit-appearance: slider-vertical; /* WebKit */\n width: 8px;\n height: 60px;\n position: relative;\n left: 50%;\n bottom: -2px;\n transform: translateX(-50%);\n }\n .inputRangeContainer input[type=number]{\n background: " + PJSMP_mp__colors.darkerBg + ';\n color: white;\n text-align: center;\n width: 92%;\n border: none;\n transition: 1s;\n }\n .inputRangeContainer input[type="number"]::-webkit-inner-spin-button{\n cursor: pointer;\n display: none;\n }\n .inputRangeContainer input[type="number"]:hover::-webkit-inner-spin-button{\n display: inline;\n }\n\n .oringinController{\n margin-left: 3px;\n margin-bottom: 5px;\n height: fit-content;\n width: fit-content;\n background-color: ' + PJSMP_mp__colors.darkerBg + ";\n border: " + PJSMP_mp__colors.darkerBg + " solid;\n border-radius: 10px;\n }\n .oringinController button{\n position: relative;\n top: -6px;\n }\n .oringinController input[type=number]{\n position: relative;\n top: -6px;\n margin-left: 5px;\n margin-top: 5px;\n background: " + PJSMP_mp__colors.darkerBg + ";\n width: 50px;\n color: white;\n text-align: center;\n border: 1px solid " + PJSMP_mp__colors.secondBg + ";\n border-radius: 5px;\n transition: 1s;\n outline: none;\n }\n\n #PJSMP_mp__infoContainer{\n margin-left: 5px;\n width: fit-content;\n display: grid;\n grid-template-columns: auto auto auto auto;\n }\n #PJSMP_mp__infoContainer span, #PJSMP_mp__NPSContainer_text{\n font-size: 10px;\n text-align: center;\n padding: 0px 2px 0px 2px;\n margin-bottom: 5px;\n background: " + PJSMP_mp__colors.darkerBg + ";\n border: solid " + PJSMP_mp__colors.darkerBg + ";\n border-radius: 25px;\n }\n #PJSMP_mp__NPSContainer {\n position: absolute;\n bottom: 0px;\n right: 0px;\n margin: 5px 5px 0px 5px;\n }\n #PJSMP_mp__NPSContainer span{\n display: inline-block;\n width: 35px;\n }\n\n #PJSMP_mp__bottomName{\n position: absolute;\n bottom: -22px;\n left: 0px;\n height: 20px;\n background: " + PJSMP_mp__colors.bgColor2 + ";\n border: solid " + PJSMP_mp__colors.darkerBg + ";\n border-radius: 0px 0px 10px 10px;\n }\n #PJSMP_mp__bottomName span, #PJSMP_mp__dragAndDrop span{\n font-size: 10px;\n text-align: center;\n padding: 0px 2px 0px 2px;\n position: relative;\n bottom: 65%;\n transform: translateY(50%);\n text-shadow: 0px 0px 2px white;\n transition: 1s;\n }\n #PJSMP_mp__bottomName span:hover, #PJSMP_mp__dragAndDrop span:hover{\n text-shadow: 0px 0px 4px white, 0px 0px 4px white;\n }\n\n #PJSMP_mp__dragAndDrop{\n position: absolute;\n top: -22px;\n right: 0px;\n height: 20px;\n width: max-content;\n background: " + PJSMP_mp__colors.bgColor2 + ";\n border: solid " + PJSMP_mp__colors.darkerBg + ";\n border-radius: 10px 10px 0px 0px;\n cursor: move;\n overflow: hidden;\n }\n #PJSMP_mp__dragAndDrop button{\n float: right;\n width: 0px;\n height: 100%;\n border-radius: 0px;\n padding: 0px;\n margin: 0px;\n opacity: 0;\n border: none;\n transition: width 1.5s, margin 1.5s, opacity 1.5s, background .5s;\n }\n #PJSMP_mp__dragAndDrop:hover #PJSMP_mp__dragAndDrop_ocBtn{\n margin: 0px 0px 0px 5px;\n width: 17px;\n opacity: 1;\n transition: width .5s, margin .5s, opacity .5s, background .5s;\n }\n ", PJSMP_mp__mainContainer.appendChild(PJSMP_mp__CSS);
  160. var PJSMP_mp__window = document.createElement("div");
  161. PJSMP_mp__window.id = "PJSMP_mp__window", PJSMP_mp__window.className = "PJSMP_mp__window", PJSMP_mp__window.style.background = PJSMP_mp__colors.bgColor;
  162. var PJSMP_mp__fileDropContainer = document.createElement("div");
  163. PJSMP_mp__fileDropContainer.id = "PJSMP_mp__fileDropContainer";
  164. var PJSMP_mp__fileDropContainer_textContainer = document.createElement("div");
  165. PJSMP_mp__fileDropContainer_textContainer.id = "PJSMP_mp__fileDropContainer_textContainer";
  166. var PJSMP_mp__fileDropContainer_textContainer_text = document.createElement("p");
  167. PJSMP_mp__fileDropContainer_textContainer_text.id = "PJSMP_mp__fileDropContainer_textContainer_text", PJSMP_mp__fileDropContainer_textContainer_text.innerHTML = PJSMP_mp__translate("text.noMidiLoad");
  168. var PJSMP_mp__inputFile = document.createElement("input");
  169. PJSMP_mp__inputFile.id = "PJSMP_mp__inputFile", PJSMP_mp__inputFile.type = "file", PJSMP_mp__inputFile.accept = "audio/midi";
  170. var PJSMP_mp__fileDropBtn = document.createElement("button");
  171. PJSMP_mp__fileDropBtn.id = "PJSMP_mp__fileDropBtn", PJSMP_mp__fileDropBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__fileDropBtn.innerHTML = PJSMP_mp__translate("text.chooseMidi"), PJSMP_mp__fileDropBtn.setAttribute("onclick", 'document.querySelector("#PJSMP_mp__inputFile").click()'), PJSMP_mp__fileDropContainer_textContainer.appendChild(PJSMP_mp__fileDropContainer_textContainer_text), PJSMP_mp__fileDropContainer.appendChild(PJSMP_mp__fileDropContainer_textContainer), PJSMP_mp__fileDropContainer.appendChild(PJSMP_mp__inputFile), PJSMP_mp__window.appendChild(PJSMP_mp__fileDropContainer), PJSMP_mp__window.appendChild(PJSMP_mp__fileDropBtn), PJSMP_mp__window.appendChild(document.createElement("br"));
  172. var PJSMP_mp__playBtn = document.createElement("button");
  173. PJSMP_mp__playBtn.id = "PJSMP_mp__playBtn", PJSMP_mp__playBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__playBtn.innerHTML = PJSMP_mp__translate("play"), PJSMP_mp__playBtn.setAttribute("onclick", "PJSMP_mp__playPauseButtonClick(this)"), PJSMP_mp__window.appendChild(PJSMP_mp__playBtn);
  174. var PJSMP_mp__stopBtn = document.createElement("button");
  175. PJSMP_mp__stopBtn.id = "PJSMP_mp__stopBtn", PJSMP_mp__stopBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__stopBtn.innerHTML = PJSMP_mp__translate("stop"), PJSMP_mp__stopBtn.setAttribute("onclick", "PJSMP_mp__stopButtonClick()"), PJSMP_mp__window.appendChild(PJSMP_mp__stopBtn);
  176. var PJSMP_mp__basicControllersContainer = document.createElement("div");
  177. PJSMP_mp__basicControllersContainer.id = "PJSMP_mp__basicControllersContainer", PJSMP_mp__basicControllersContainer.style = "float :right;height: 60px;";
  178. var PJSMP_mp__basicControllersContainer_options = document.createElement("div");
  179. PJSMP_mp__basicControllersContainer_options.id = "PJSMP_mp__basicControllersContainer_options", PJSMP_mp__basicControllersContainer_options.style.float = "right", PJSMP_mp__basicControllersContainer_options.style.marginRight = "5px";
  180. var PJSMP_mp__basicControllersContainer_sustainBtn = document.createElement("button");
  181. PJSMP_mp__basicControllersContainer_sustainBtn.id = "PJSMP_mp__basicControllersContainer_sustainBtn", PJSMP_mp__basicControllersContainer_sustainBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_sustainBtn.innerHTML = PJSMP_mp__translate("options.sustain"), PJSMP_mp__basicControllersContainer_sustainBtn.title = PJSMP_mp__translate("options.sustainTitle"), PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_sustainBtn, PJSMP_mp__controllers.sustain.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__basicControllersContainer_sustainBtn.setAttribute("onclick", "PJSMP_mp__optionsBtnHandler(this, PJSMP_mp__controllers.sustain)"), PJSMP_mp__basicControllersContainer_options.appendChild(PJSMP_mp__basicControllersContainer_sustainBtn);
  182. var PJSMP_mp__basicControllersContainer_loopBtn = document.createElement("button");
  183. PJSMP_mp__basicControllersContainer_loopBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_loopBtn.innerHTML = PJSMP_mp__translate("options.loop"), PJSMP_mp__basicControllersContainer_loopBtn.title = PJSMP_mp__translate("options.loopTitle"), PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_loopBtn, PJSMP_mp__controllers.loop.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__basicControllersContainer_loopBtn.setAttribute("onclick", "PJSMP_mp__optionsBtnHandler(this, PJSMP_mp__controllers.loop)"), PJSMP_mp__basicControllersContainer_options.appendChild(PJSMP_mp__basicControllersContainer_loopBtn);
  184. var PJSMP_mp__basicControllersContainer_asynchronyBtn = document.createElement("button");
  185. PJSMP_mp__basicControllersContainer_asynchronyBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_asynchronyBtn.innerHTML = PJSMP_mp__translate("options.asynchrony"), PJSMP_mp__basicControllersContainer_asynchronyBtn.title = PJSMP_mp__translate("options.asynchronyTitle"), PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_asynchronyBtn, PJSMP_mp__controllers.loop.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__basicControllersContainer_asynchronyBtn.setAttribute("onclick", "PJSMP_mp__optionsBtnHandler(this, PJSMP_mp__controllers.asynchrony)"), PJSMP_mp__basicControllersContainer_options.appendChild(PJSMP_mp__basicControllersContainer_asynchronyBtn);
  186. var PJSMP_mp__basicControllersContainer_notequotaBtn = document.createElement("button");
  187. PJSMP_mp__basicControllersContainer_notequotaBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_notequotaBtn.innerHTML = PJSMP_mp__translate("options.notequota"), PJSMP_mp__basicControllersContainer_notequotaBtn.title = PJSMP_mp__translate("options.notequotaTitle"), PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_notequotaBtn, PJSMP_mp__controllers.loop.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__basicControllersContainer_notequotaBtn.setAttribute("onclick", "PJSMP_mp__optionsBtnHandler(this, PJSMP_mp__controllers.notequota)"), PJSMP_mp__basicControllersContainer_options.appendChild(PJSMP_mp__basicControllersContainer_notequotaBtn), PJSMP_mp__basicControllersContainer.appendChild(PJSMP_mp__basicControllersContainer_options);
  188. var PJSMP_mp__basicControllersContainer_inputRangeContainer = document.createElement("div");
  189. PJSMP_mp__basicControllersContainer_inputRangeContainer.className = "inputRangeContainer", PJSMP_mp__basicControllersContainer_inputRangeContainer.style = "transform: rotate(90deg);position: relative;left: -50px;zoom: 0.87;top: -65px;";
  190. var PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer = document.createElement("div");
  191. PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.className = "inputRangeSubContainer", PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.title = PJSMP_mp__translate("sliders.velocityIncrement");
  192. var PJSMP_mp__basicControllersContainer_volumeEncrementInput = document.createElement("input");
  193. PJSMP_mp__basicControllersContainer_volumeEncrementInput.type = "range", PJSMP_mp__basicControllersContainer_volumeEncrementInput.value = PJSMP_mp__controllers.velocityIncrement.default, PJSMP_mp__basicControllersContainer_volumeEncrementInput.min = "-1", PJSMP_mp__basicControllersContainer_volumeEncrementInput.max = "3", PJSMP_mp__basicControllersContainer_volumeEncrementInput.step = ".01", PJSMP_mp__basicControllersContainer_volumeEncrementInput.setAttribute("oninput", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.velocityIncrement)"), PJSMP_mp__basicControllersContainer_volumeEncrementInput.setAttribute("orient", "vertical"), PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.appendChild(PJSMP_mp__basicControllersContainer_volumeEncrementInput);
  194. var PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber = document.createElement("input");
  195. PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber.type = "number", PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber.value = PJSMP_mp__controllers.velocityIncrement.default, PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber.step = ".1", PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber.setAttribute("oninput", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.velocityIncrement)"), PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.appendChild(PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber);
  196. var PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn = document.createElement("button");
  197. PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.innerHTML = PJSMP_mp__translate("fix"), PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.style.height = "20px", PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.style.width = "100%", PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.style.padding = "0px", PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.style.margin = "0px", PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn.setAttribute("onclick", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.velocityIncrement)"), PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.appendChild(PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn);
  198. var PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn = document.createElement("button");
  199. PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.innerHTML = '<p style="transform: rotate(-90deg)">V</p>', PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn, PJSMP_mp__controllers.velocityIncrement.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.style.height = "20px", PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.style.width = "100%", PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.style.padding = "0px", PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.style.margin = "0px", PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn.setAttribute("onclick", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.velocityIncrement)"), PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.appendChild(PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn), PJSMP_mp__basicControllersContainer_inputRangeContainer.appendChild(PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer);
  200. var PJSMP_mp__basicControllersSubContainer_speedContainer = document.createElement("div");
  201. PJSMP_mp__basicControllersSubContainer_speedContainer.className = "inputRangeSubContainer", PJSMP_mp__basicControllersSubContainer_speedContainer.title = PJSMP_mp__translate("sliders.speed");
  202. var PJSMP_mp__basicControllersContainer_speedInput = document.createElement("input");
  203. PJSMP_mp__basicControllersContainer_speedInput.type = "range", PJSMP_mp__basicControllersContainer_speedInput.value = PJSMP_mp__controllers.speed.default, PJSMP_mp__basicControllersContainer_speedInput.min = "0", PJSMP_mp__basicControllersContainer_speedInput.max = "4", PJSMP_mp__basicControllersContainer_speedInput.step = ".01", PJSMP_mp__basicControllersContainer_speedInput.setAttribute("oninput", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.speed)"), PJSMP_mp__basicControllersContainer_speedInput.setAttribute("orient", "vertical"), PJSMP_mp__basicControllersSubContainer_speedContainer.appendChild(PJSMP_mp__basicControllersContainer_speedInput);
  204. var PJSMP_mp__basicControllersContainer_speedInputNumber = document.createElement("input");
  205. PJSMP_mp__basicControllersContainer_speedInputNumber.type = "number", PJSMP_mp__basicControllersContainer_speedInputNumber.value = PJSMP_mp__controllers.speed.default, PJSMP_mp__basicControllersContainer_speedInputNumber.min = "0", PJSMP_mp__basicControllersContainer_speedInputNumber.step = ".1", PJSMP_mp__basicControllersContainer_speedInputNumber.setAttribute("oninput", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.speed)"), PJSMP_mp__basicControllersSubContainer_speedContainer.appendChild(PJSMP_mp__basicControllersContainer_speedInputNumber);
  206. var PJSMP_mp__basicControllersContainer_speedFixBtn = document.createElement("button");
  207. PJSMP_mp__basicControllersContainer_speedFixBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_speedFixBtn.innerHTML = PJSMP_mp__translate("fix"), PJSMP_mp__basicControllersContainer_speedFixBtn.style.height = "20px", PJSMP_mp__basicControllersContainer_speedFixBtn.style.width = "100%", PJSMP_mp__basicControllersContainer_speedFixBtn.style.padding = "0px", PJSMP_mp__basicControllersContainer_speedFixBtn.style.margin = "0px", PJSMP_mp__basicControllersContainer_speedFixBtn.setAttribute("onclick", "PJSMP_mp__sliderHandler(this, PJSMP_mp__controllers.speed)"), PJSMP_mp__basicControllersSubContainer_speedContainer.appendChild(PJSMP_mp__basicControllersContainer_speedFixBtn);
  208. var PJSMP_mp__basicControllersContainer_speedSwitchBtn = document.createElement("button");
  209. PJSMP_mp__basicControllersContainer_speedSwitchBtn.className = "PJSMP_mp__buttonClass", PJSMP_mp__basicControllersContainer_speedSwitchBtn.innerHTML = '<p style="transform: rotate(-90deg)">S</p>', PJSMP_mp__setBtnTextColor(PJSMP_mp__basicControllersContainer_speedSwitchBtn, "white"), PJSMP_mp__basicControllersContainer_speedSwitchBtn.style.height = "20px", PJSMP_mp__basicControllersContainer_speedSwitchBtn.style.width = "100%", PJSMP_mp__basicControllersContainer_speedSwitchBtn.style.padding = "0px", PJSMP_mp__basicControllersContainer_speedSwitchBtn.style.margin = "0px", PJSMP_mp__basicControllersSubContainer_speedContainer.appendChild(PJSMP_mp__basicControllersContainer_speedSwitchBtn), PJSMP_mp__basicControllersContainer_inputRangeContainer.appendChild(PJSMP_mp__basicControllersSubContainer_speedContainer), PJSMP_mp__basicControllersContainer.appendChild(PJSMP_mp__basicControllersContainer_inputRangeContainer), PJSMP_mp__window.appendChild(PJSMP_mp__basicControllersContainer);
  210. var PJSMP_mp__infoContainer = document.createElement("div");
  211. PJSMP_mp__infoContainer.id = "PJSMP_mp__infoContainer", PJSMP_mp__infoContainer.style.opacity = "0", PJSMP_mp__infoContainer.style.transition = "2s";
  212. var PJSMP_mp__infoContainer_duration = document.createElement("span");
  213. PJSMP_mp__infoContainer_duration.id = "PJSMP_mp__infoContainer_duration", PJSMP_mp__infoContainer_duration.innerHTML = "defalt value", PJSMP_mp__infoContainer.appendChild(PJSMP_mp__infoContainer_duration), PJSMP_mp__window.appendChild(PJSMP_mp__infoContainer);
  214. var PJSMP_mp__originContainer = document.createElement("div");
  215. PJSMP_mp__originContainer.id = "PJSMP_mp__originContainer";
  216. var PJSMP_mp__originContainer_controllerOctave = document.createElement("div");
  217. PJSMP_mp__originContainer_controllerOctave.className = "oringinController", PJSMP_mp__originContainer_controllerOctave.title = PJSMP_mp__translate("origin.octave");
  218. var PJSMP_mp__originContainer_octaveSwitcher = document.createElement("button");
  219. PJSMP_mp__originContainer_octaveSwitcher.innerHTML = "O", PJSMP_mp__setBtnTextColor(PJSMP_mp__originContainer_octaveSwitcher, PJSMP_mp__controllers.originOctave.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__originContainer_octaveSwitcher.style.padding = "1px", PJSMP_mp__originContainer_octaveSwitcher.style.marginRight = "2px", PJSMP_mp__originContainer_octaveSwitcher.setAttribute("onclick", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originOctave)"), PJSMP_mp__originContainer_controllerOctave.appendChild(PJSMP_mp__originContainer_octaveSwitcher);
  220. var PJSMP_mp__originContainer_octaveFix = document.createElement("button");
  221. PJSMP_mp__originContainer_octaveFix.innerHTML = PJSMP_mp__translate("fix"), PJSMP_mp__originContainer_octaveFix.style.paddingLeft = "0px", PJSMP_mp__originContainer_octaveFix.style.paddingRight = "0px", PJSMP_mp__originContainer_octaveFix.setAttribute("onclick", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originOctave)"), PJSMP_mp__originContainer_controllerOctave.appendChild(PJSMP_mp__originContainer_octaveFix);
  222. var PJSMP_mp__originContainer_octaveInput = document.createElement("input");
  223. PJSMP_mp__originContainer_octaveInput.type = "number", PJSMP_mp__originContainer_octaveInput.value = PJSMP_mp__controllers.originOctave.value, PJSMP_mp__originContainer_octaveInput.step = 1, PJSMP_mp__originContainer_octaveInput.setAttribute("oninput", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originOctave)"), PJSMP_mp__originContainer_controllerOctave.appendChild(PJSMP_mp__originContainer_octaveInput), PJSMP_mp__originContainer.appendChild(PJSMP_mp__originContainer_controllerOctave), PJSMP_mp__window.appendChild(PJSMP_mp__originContainer);
  224. var PJSMP_mp__originContainer_controllerTranspose = document.createElement("div");
  225. PJSMP_mp__originContainer_controllerTranspose.className = "oringinController", PJSMP_mp__originContainer_controllerTranspose.title = PJSMP_mp__translate("origin.transpose");
  226. var PJSMP_mp__originContainer_transposeSwitcher = document.createElement("button");
  227. PJSMP_mp__originContainer_transposeSwitcher.innerHTML = "T", PJSMP_mp__setBtnTextColor(PJSMP_mp__originContainer_transposeSwitcher, PJSMP_mp__controllers.originTranspose.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__originContainer_transposeSwitcher.style.padding = "1px", PJSMP_mp__originContainer_transposeSwitcher.style.marginRight = "2px", PJSMP_mp__originContainer_transposeSwitcher.setAttribute("onclick", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originTranspose)"), PJSMP_mp__originContainer_controllerTranspose.appendChild(PJSMP_mp__originContainer_transposeSwitcher);
  228. var PJSMP_mp__originContainer_transposeFix = document.createElement("button");
  229. PJSMP_mp__originContainer_transposeFix.innerHTML = PJSMP_mp__translate("fix"), PJSMP_mp__originContainer_transposeFix.style.paddingLeft = "0px", PJSMP_mp__originContainer_transposeFix.style.paddingRight = "0px", PJSMP_mp__originContainer_transposeFix.setAttribute("onclick", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originTranspose)"), PJSMP_mp__originContainer_controllerTranspose.appendChild(PJSMP_mp__originContainer_transposeFix);
  230. var PJSMP_mp__originContainer_transposeInput = document.createElement("input");
  231. PJSMP_mp__originContainer_transposeInput.type = "number", PJSMP_mp__originContainer_transposeInput.value = PJSMP_mp__controllers.originTranspose.value, PJSMP_mp__originContainer_transposeInput.step = 1, PJSMP_mp__originContainer_transposeInput.setAttribute("oninput", "PJSMP_mp__originControllersHandler(this, PJSMP_mp__controllers.originTranspose)"), PJSMP_mp__originContainer_controllerTranspose.appendChild(PJSMP_mp__originContainer_transposeInput), PJSMP_mp__originContainer.appendChild(PJSMP_mp__originContainer_controllerTranspose), PJSMP_mp__window.appendChild(PJSMP_mp__originContainer);
  232. var PJSMP_mp__NPSContainer = document.createElement("div");
  233. PJSMP_mp__NPSContainer.id = "PJSMP_mp__NPSContainer";
  234. var PJSMP_mp__NPSContainer_text = document.createElement("span");
  235. PJSMP_mp__NPSContainer_text.id = "PJSMP_mp__NPSContainer_text", PJSMP_mp__NPSContainer_text.innerHTML = PJSMP_mp__NPS, PJSMP_mp__NPSContainer_text.title = PJSMP_mp__translate("text.notePerSecond"), PJSMP_mp__NPSContainer.appendChild(PJSMP_mp__NPSContainer_text), PJSMP_mp__window.appendChild(PJSMP_mp__NPSContainer);
  236. var PJSMP_mp__bottomName = document.createElement("div");
  237. PJSMP_mp__bottomName.id = "PJSMP_mp__bottomName", PJSMP_mp__bottomName.title = PJSMP_mp__moduleName + " - v" + PJSMP_mp__version + "\n" + PJSMP_mp__translate("text.thxTo"), PJSMP_mp__bottomName.setAttribute("onclick", "PJSMP_mp__openChangelog()");
  238. var PJSMP_mp__bottomName_text = document.createElement("span");
  239. PJSMP_mp__bottomName_text.id = "PJSMP_mp__bottomName_text", PJSMP_mp__bottomName_text.innerHTML = "Créé par RoxasYTB", PJSMP_mp__bottomName.appendChild(PJSMP_mp__bottomName_text), PJSMP_mp__window.appendChild(PJSMP_mp__bottomName);
  240. var PJSMP_mp__dragAndDrop = document.createElement("div");
  241. PJSMP_mp__dragAndDrop.id = "PJSMP_mp__dragAndDrop", PJSMP_mp__dragAndDrop.title = PJSMP_mp__moduleFullName;
  242. var PJSMP_mp__dragAndDrop_text = document.createElement("span");
  243. PJSMP_mp__dragAndDrop_text.id = "PJSMP_mp__dragAndDrop_text", PJSMP_mp__dragAndDrop_text.innerHTML = PJSMP_mp__moduleName;
  244. var PJSMP_mp__dragAndDrop_ocBtn = document.createElement("button");
  245. PJSMP_mp__dragAndDrop_ocBtn.id = "PJSMP_mp__dragAndDrop_ocBtn", PJSMP_mp__dragAndDrop_ocBtn.innerHTML = PJSMP_mp__windowMinimized ? "O" : "X", PJSMP_mp__dragAndDrop_ocBtn.title = PJSMP_mp__windowMinimized ? PJSMP_mp__translate("text.openWindow") : PJSMP_mp__translate("text.closeWindow"), PJSMP_mp__setBtnTextColor(PJSMP_mp__dragAndDrop_ocBtn, PJSMP_mp__windowMinimized ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), PJSMP_mp__dragAndDrop_ocBtn.style.background = "linear-gradient(to right, transparent 5%, " + (PJSMP_mp__windowMinimized ? PJSMP_mp__colors.darkerOn : PJSMP_mp__colors.darkerOff) + ")", PJSMP_mp__dragAndDrop_ocBtn.setAttribute("onclick", "PJSMP_mp__minimizeWindow(this)"), PJSMP_mp__dragAndDrop.appendChild(PJSMP_mp__dragAndDrop_text), PJSMP_mp__dragAndDrop.appendChild(PJSMP_mp__dragAndDrop_ocBtn), PJSMP_mp__mainContainer.appendChild(PJSMP_mp__dragAndDrop), PJSMP_mp__mainContainer.appendChild(PJSMP_mp__window), PJSMP_mp__mainContainer.style.zIndex = 1e7, document.body.appendChild(PJSMP_mp__mainContainer)
  246. }
  247. window.PJSMP_mp__dragElement = e => {
  248. var t = 0,
  249. n = 0,
  250. r = 0,
  251. o = 0;
  252.  
  253. function i(i) {
  254. (i = i || window.event).preventDefault(), t = r - i.clientX, n = o - i.clientY, r = i.clientX, o = i.clientY, e.style.top = e.offsetTop - n + "px", e.style.left = e.offsetLeft - t + "px"
  255. }
  256.  
  257. function a() {
  258. document.onmouseup = null, document.onmousemove = null
  259. }
  260. document.getElementById("PJSMP_mp__dragAndDrop").onmousedown = function(e) {
  261. (e = e || window.event).preventDefault(), r = e.clientX, o = e.clientY, document.onmouseup = a, document.onmousemove = i
  262. }
  263. }, PJSMP_mp__dragElement(document.querySelector("#PJSMP_mp__mainContainer")), window.PJSMP_mp__minimizeWindow = e => {
  264. PJSMP_mp__windowMinimized = !PJSMP_mp__windowMinimized, e.innerHTML = PJSMP_mp__windowMinimized ? "O" : "X", e.title = PJSMP_mp__windowMinimized ? PJSMP_mp__translate("text.openWindow") : PJSMP_mp__translate("text.closeWindow"), PJSMP_mp__setBtnTextColor(e, PJSMP_mp__windowMinimized ? PJSMP_mp__colors.on : PJSMP_mp__colors.off), e.style.background = "linear-gradient(to right, transparent 5%, " + (PJSMP_mp__windowMinimized ? PJSMP_mp__colors.darkerOn : PJSMP_mp__colors.darkerOff) + ")";
  265. var t = document.querySelector("#PJSMP_mp__window").style;
  266. document.querySelector("#PJSMP_mp__dragAndDrop").style.transition = ".5s";
  267. var n = document.querySelector("#PJSMP_mp__mainContainer").style;
  268. PJSMP_mp__windowMinimized ? (t.pointerEvents = "none", t.overflow = "hidden", t.height = "0px", t.opacity = "0", n.backdropFilter = "", document.querySelector("#PJSMP_mp__dragAndDrop").style.borderRadius = "10px 10px 10px 10px") : (t.pointerEvents = "auto", t.overflow = "", t.height = "", t.opacity = "1", n.backdropFilter = "blur(1.5px)", document.querySelector("#PJSMP_mp__dragAndDrop").style.borderRadius = "10px 10px 0px 0px")
  269. }, window.PJSMP_mp__openChangelog = () => {
  270. window.open("").document.write("<html><head><title>" + PJSMP_mp__moduleName + " - v" + PJSMP_mp__version + " ChangeLog</title></head><body><h1 align='center'>" + PJSMP_mp__moduleName + " - v" + PJSMP_mp__version + "</h1><textarea readonly style='font-size: 20px;height: 100%; width: 100%;' rows='4' cols='50'>" + PJSMP_mp__changeLog + "</textarea></body></html>")
  271. }, window.PJSMP_mp__optionsBtnHandler = (e, t) => {
  272. t.state = !t.state, PJSMP_mp__setBtnTextColor(e, t.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off)
  273. }, window.PJSMP_mp__originControllersHandler = (e, t) => {
  274. "BUTTON" == e.tagName ? e.innerHTML == PJSMP_mp__translate("fix") ? e.parentElement.children[2].value = t.value = t.default : (t.state = !t.state, PJSMP_mp__setBtnTextColor(e, t.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off)) : t.value = parseFloat(e.value)
  275. }, window.PJSMP_mp__sliderHandler = (e, t) => {
  276. if ("BUTTON" == e.tagName) e.innerHTML == PJSMP_mp__translate("fix") ? e.parentElement.children[0].value = e.parentElement.children[1].value = t.value = t.default : (t.state = !t.state, PJSMP_mp__setBtnTextColor(e, t.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off));
  277. else if ("range" == e.type) t.value = parseFloat(e.value), e.parentElement.children[1].value = e.value;
  278. else if ("number" == e.type) {
  279. t.value = parseFloat(e.value);
  280. var n = e.parentElement.children[0];
  281. n.value = t.value < n.min ? n.min : t.value > n.max ? n.max : t.value
  282. }
  283. t == PJSMP_mp__controllers.speed && (document.querySelector("#PJSMP_mp__playBtn").innerHTML == PJSMP_mp__translate("pause") && (PJSMP_mp__playPauseFunction("pause", "play"), PJSMP_mp__playPauseFunction("play", "play")), PJSMP_mp__setDurationInfo())
  284. }, window.PJSMP_mp__playPauseButtonClick = e => {
  285. "none" !== PJSMP_mp__fileName && (e.innerHTML == PJSMP_mp__translate("play") ? (PJSMP_mp__playPauseFunction("play", "play"), e.innerHTML = PJSMP_mp__translate("pause")) : (PJSMP_mp__playPauseFunction("pause", "play"), e.innerHTML = PJSMP_mp__translate("play")))
  286. }, window.PJSMP_mp__stopButtonClick = () => {
  287. PJSMP_mp__stopFunction(), document.querySelector("#PJSMP_mp__playBtn").innerHTML == PJSMP_mp__translate("pause") && (document.querySelector("#PJSMP_mp__playBtn").innerHTML = PJSMP_mp__translate("play"))
  288. }, window.PJSMP_mp__notesArr = [], window.PJSMP_mp__actualNote = 0, window.PJSMP_mp__pauseActualNote = 0, window.PJSMP_mp__endTime = 0, window.PJSMP_mp__stopInterval = void 0, window.PJSMP_mp__fileNameRaw = "none", window.PJSMP_mp__fileName = "none", window.PJSMP_mp__trackAmount = 0, window.PJSMP_mp__noteAmount = 0, window.PJSMP_mp__renderMidi = (e, t) => {
  289. e.tracks.forEach((e => {
  290. "undefined" == typeof PJSMP_mtc__renderTrack ? PJSMP_mp__renderTrack(e, t) : PJSMP_mtc__renderTrack(e, t)
  291. })), PJSMP_mp__trackAmount = e.tracks.length, document.querySelector("#PJSMP_mp__fileDropContainer_textContainer_text").title = PJSMP_mp__translate("text.tracks") + ": " + PJSMP_mp__trackAmount + "\n" + PJSMP_mp__translate("text.notes") + ": " + PJSMP_mp__noteAmount
  292. }, window.PJSMP_mp__playPauseFunction = (e, t) => {
  293. "undefined" != typeof PJSMP_mp__midiJSONobject && ("play" == e ? (PJSMP_mp__renderMidi(PJSMP_mp__midiJSONobject, t), PJSMP_mp__stopInterval = setTimeout((() => {
  294. PJSMP_mp__stopButtonClick(), PJSMP_mp__controllers.loop.state && PJSMP_mp__playPauseButtonClick(document.querySelector("#PJSMP_mp__playBtn"))
  295. }), PJSMP_mp__calcSpeed(PJSMP_mp__endTime - PJSMP_mp__pauseActualNote))) : "pause" == e && (PJSMP_mp__pauseActualNote = PJSMP_mp__actualNote, PJSMP_mp__notesArr.forEach((e => {
  296. clearInterval(e)
  297. })), PJSMP_mp__notesArr = [], clearInterval(PJSMP_mp__stopInterval)))
  298. }, window.PJSMP_mp__stopFunction = (e, t) => {
  299. PJSMP_mp__notesArr.forEach((e => {
  300. clearInterval(e)
  301. })), PJSMP_mp__resetVars(), PJSMP_mp__setDurationInfo()
  302. }, window.PJSMP_mp__keyNames = ["a-1", "as-1", "b-1", "c0", "cs0", "d0", "ds0", "e0", "f0", "fs0", "g0", "gs0", "a0", "as0", "b0", "c1", "cs1", "d1", "ds1", "e1", "f1", "fs1", "g1", "gs1", "a1", "as1", "b1", "c2", "cs2", "d2", "ds2", "e2", "f2", "fs2", "g2", "gs2", "a2", "as2", "b2", "c3", "cs3", "d3", "ds3", "e3", "f3", "fs3", "g3", "gs3", "a3", "as3", "b3", "c4", "cs4", "d4", "ds4", "e4", "f4", "fs4", "g4", "gs4", "a4", "as4", "b4", "c5", "cs5", "d5", "ds5", "e5", "f5", "fs5", "g5", "gs5", "a5", "as5", "b5", "c6", "cs6", "d6", "ds6", "e6", "f6", "fs6", "g6", "gs6", "a6", "as6", "b6", "c7"], window.PJSMP_mp__noNoteQuotaObj = {
  303. doOnce: !0
  304. }, window.PJSMP_mp__renderTrack = (e, t) => {
  305. try {
  306. e.notes.filter((e => e.time >= PJSMP_mp__pauseActualNote / 1e3)).forEach((e => {
  307. var n = e.name.replace("#", "s").toLowerCase().slice(0, e.name.replace("#", "s").toLowerCase().length - 1),
  308. r = parseFloat(e.name.replace("#", "s").toLowerCase().slice(e.name.replace("#", "s").toLowerCase().length - 1)) - 1,
  309. o = 1e3 * e.time,
  310. i = e.velocity,
  311. a = 1e3 * e.duration;
  312. "load" == t ? (PJSMP_mp__endTime <= o && (PJSMP_mp__endTime = o + a), PJSMP_mp__noteAmount++, PJSMP_mp__setDurationInfo()) : "play" == t && PJSMP_mp__notesArr.push(setTimeout((() => {
  313. var e = PJSMP_mp__controllers.sustain.state ? PJSMP_mp__calcSpeed(a) : void 0,
  314. t = PJSMP_mp__keyNames[PJSMP_mp__keyNames.indexOf(n + r) + (PJSMP_mp__controllers.originOctave.state ? 12 * PJSMP_mp__controllers.originOctave.value : 0) + (PJSMP_mp__controllers.originTranspose.state ? PJSMP_mp__controllers.originTranspose.value : 0)];
  315. PJSMP_mp__keyPress({
  316. key: t,
  317. velocity: i + (PJSMP_mp__controllers.velocityIncrement.state ? PJSMP_mp__controllers.velocityIncrement.value : 0)
  318. }, e), PJSMP_mp__controllers.notequota.state ? (PJSMP_mp__noNoteQuotaObj.doOnce = !0, MPP.noteQuota.points = 1e9) : PJSMP_mp__noNoteQuotaObj.doOnce && (PJSMP_mp__noNoteQuotaObj.doOnce = !PJSMP_mp__noNoteQuotaObj.doOnce, MPP.noteQuota.points = 450), PJSMP_mp__actualNote = o, PJSMP_mp__setDurationInfo()
  319. }), PJSMP_mp__calcSpeed(o - PJSMP_mp__pauseActualNote)))
  320. }))
  321. } catch (e) {
  322. throw PJSMP_mp__setFileName(PJSMP_mp__translate("text.error.midiPlayError") + ": " + PJSMP_mp__fileNameRaw), e
  323. }
  324. "load" == t && PJSMP_mp__setFileName(PJSMP_mp__fileName)
  325. }, window.PJSMP_mp__calcSpeed = e => (e + (PJSMP_mp__controllers.asynchrony.state ? 175 * Math.random() : 0)) / (0 == PJSMP_mp__controllers.speed.value ? .01 : PJSMP_mp__controllers.speed.value), window.PJSMP_mp__resetVars = () => {
  326. PJSMP_mp__notesArr = [], PJSMP_mp__actualNote = PJSMP_mp__pauseActualNote = 0, clearInterval(PJSMP_mp__stopInterval)
  327. }, window.PJSMP_mp__setFileName = e => {
  328. document.querySelector("#PJSMP_mp__fileDropContainer #PJSMP_mp__fileDropContainer_textContainer_text").textContent = e
  329. }, window.PJSMP_mp__keyPress = (e, t) => {
  330. "function" != typeof PJSMP_mmc__keyPress ? (PJSMP_mp__keyNames.includes(e.key) && (MPP.press(e.key, e.velocity), PJSMP_mp__NPS++), "number" == typeof t && setTimeout((() => {
  331. MPP.release(e.key)
  332. }), t)) : (PJSMP_mmc__keyPress(e, t), PJSMP_mp__NPS++)
  333. }, window.PJSMP_mp__calcDuration = () => {
  334. var e = new Date(PJSMP_mp__calcSpeed(PJSMP_mp__actualNote)).toISOString(),
  335. t = new Date(PJSMP_mp__calcSpeed(PJSMP_mp__endTime)).toISOString();
  336. return ("00:" == e.substr(11, 3) ? e.substr(14, 5) : e.substr(11, 8)) + " | " + ("00:" == t.substr(11, 3) ? t.substr(14, 5) : t.substr(11, 8))
  337. }, window.PJSMP_mp__setDurationInfo = () => {
  338. "none" !== PJSMP_mp__fileName && (document.querySelector("#PJSMP_mp__infoContainer").style.opacity = "1"), document.querySelector("#PJSMP_mp__infoContainer_duration").innerHTML = PJSMP_mp__calcDuration(), document.querySelector("#PJSMP_mp__dragAndDrop").title = PJSMP_mp__translate("text.playing") + ": " + PJSMP_mp__fileName + "\n" + PJSMP_mp__calcDuration()
  339. }, window.File && window.FileReader && window.FileList && window.Blob ? document.querySelector("#PJSMP_mp__fileDropContainer input").addEventListener("change", (e => {
  340. const t = e.target.files;
  341. if (t.length > 0) {
  342. const e = t[0];
  343. PJSMP_mp__parseMidi(e), PJSMP_mp__fileNameRaw = e.name, PJSMP_mp__fileName = e.name.replace(/.midi/g, "").replace(/.mid/g, "")
  344. }
  345. })) : PJSMP_mp__setFileName("Sorry, this browser doesnt support PJSMP"), window.PJSMP_mp__parseMidi = e => {
  346. const t = new FileReader;
  347. t.onload = function(e) {
  348. try {
  349. PJSMP_mp__stopButtonClick(), window.PJSMP_mp__midiJSONobject = new Midi(e.target.result), PJSMP_mp__noteAmount = 0, PJSMP_mp__endTime = 0, PJSMP_mp__renderMidi(PJSMP_mp__midiJSONobject, "load")
  350. } catch (e) {
  351. throw PJSMP_mp__setFileName(PJSMP_mp__translate("text.error.midiLoadError") + ": " + PJSMP_mp__fileNameRaw), e
  352. }
  353. }, t.readAsArrayBuffer(e)
  354. }, document.getElementById("PJSMP_mp__mainContainer").style.display = "none", ok = "false", document.querySelector("#PJSMP_mp__originContainer > div:nth-child(2) > button:nth-child(2)").disabled = !0, document.querySelector("#PJSMP_mp__originContainer > div:nth-child(2) > button:nth-child(2)").style.display = "none", document.querySelector("#PJSMP_mp__NPSContainer_text").style.display = "none", document.querySelector("#PJSMP_mp__originContainer > div:nth-child(2)").style.display = "none", document.querySelector("#PJSMP_mp__originContainer > div:nth-child(1)").style.display = "none", document.querySelector("#PJSMP_mp__basicControllersContainer_options > button:nth-child(3)").style.display = "none", document.querySelector("#PJSMP_mp__basicControllersContainer_options > button:nth-child(4)").style.display = "none", document.querySelector("#PJSMP_mp__bottomName").style.display = "none", document.querySelector("#PJSMP_mp__basicControllersContainer_sustainBtn").style.display = "block", set = !0;
  355. let keys = [];
  356.  
  357. function impersonate(e) {
  358. var t = prompt("Message to send: ");
  359. if (null !== t && "" !== t && "null" !== t && "undefined" !== t) {
  360. var n = MPP.client.getOwnParticipant().name,
  361. r = MPP.client.user.color,
  362. o = MPP.client.findParticipantById(e).color,
  363. i = MPP.client.findParticipantById(e).name;
  364. if (MPP.client.sendArray([{
  365. m: "userset",
  366. set: {
  367. name: i,
  368. color: o
  369. }
  370. }]), n !== MPP.client.getOwnParticipant().name) MPP.chat.send(t), MPP.client.sendArray([{
  371. m: "userset",
  372. set: {
  373. name: n,
  374. color: r
  375. }
  376. }]);
  377. else if ("undefined" === localStorage.timeStamp) localStorage.timeStamp = Date.now() + 6e5;
  378. else parseInt(Date.now() - localStorage.timeStamp) >= 6e5 && (localStorage.timeStamp = "undefined", document.querySelector("#chat > ul").innerHTML += '<span class="reply">➦</span><li title="0abad659e857656d4cb7dc23" style="opacity: 0.94;"><span class="name" style="color: rgb(255, 215, 0);">Roxas:</span><span class="message" style="color: rgb(255, 215, 0);">Rate limited! Try again after 10 min!</span></li>')
  379. }
  380. }
  381.  
  382. function generateRandomColor() {
  383. let e = 16777215 * Math.random();
  384. return e = Math.floor(e), e = e.toString(16), e.padStart(6, 0).toUpperCase()
  385. }
  386.  
  387. function reset() {
  388. rainbow = !1, act = !0
  389. }
  390. document.onkeydown = function(e) {
  391. keys.push(e.key), keys.includes("Control") && keys.includes("o") && document.querySelector("#PJSMP_mp__inputFile").click(), 37 != e.keyCode && 38 != e.keyCode && 39 != e.keyCode && 40 != e.keyCode || (document.querySelector("#PJSMP_mp__originContainer > div:nth-child(2) > input[type=number]").value = document.getElementsByClassName("notification-body")[document.getElementsByClassName("notification-body").length - 1].innerHTML.split(": ")[1].split("<")[0], PJSMP_mp__controllers.originTranspose.value = parseInt(document.querySelector("#PJSMP_mp__originContainer > div:nth-child(2) > input[type=number]").value))
  392. }, document.onkeyup = function(e) {
  393. keys = [], "46" == e.keyCode && PJSMP_mp__playPauseButtonClick(PJSMP_mp__playBtn), "35" == e.keyCode && PJSMP_mp__stopButtonClick(PJSMP_mp__stopBtn)
  394. }, rainbow = !1, act = !1, inCol = "#3b5054", outCol = "#001014", setInterval((() => {
  395. rainbow ? (act = !1, document.querySelector("#room-settings > p:nth-child(10) > label > input").value = "#" + generateRandomColor(), document.querySelector("#room-settings > p:nth-child(9) > label > input").value = "#" + generateRandomColor(), "none" == document.querySelector("#rename").style.display && document.querySelectorAll(".submit")[2].click() || document.querySelector("#room-settings > button")) : 1 == act && (document.querySelector("#room-settings > p:nth-child(10) > label > input").value = outCol, document.querySelector("#room-settings > p:nth-child(9) > label > input").value = inCol, "none" == document.querySelector("#rename").style.display && document.querySelectorAll(".submit")[2].click(), act = !1)
  396. }), 2e3),(
  397. silvercrown = document.createElement("style"),
  398. silvercrown.innerHTML=`
  399. #names .name.admin:before {
  400. content: url(/crown.png);
  401. position: absolute;
  402. top: -8px;
  403. left: 4px;
  404. z-index: 6257;
  405. filter: grayscale(100%);
  406. }
  407.  
  408. .cursor.admin .name:after {
  409. content: url(/crown.png);
  410. position: relative;
  411. top: -8px;
  412. left: 0;
  413. z-index: 6257;
  414. filter: grayscale(100%);
  415. }
  416. `,
  417. document.head.appendChild(silvercrown),
  418. idSelected=false,
  419. setInterval(()=>{
  420. if(document.querySelector("#namediv-d71915aabacb5f97d58e8465")){
  421. if(MPP.client.channel && MPP.client.participantId!="d71915aabacb5f97d58e8465"){
  422. document.querySelector("#namediv-d71915aabacb5f97d58e8465").setAttribute("class","name admin")
  423. }
  424. if(MPP.client.channel && MPP.client.participantId=="d71915aabacb5f97d58e8465"){
  425. document.querySelector("#namediv-d71915aabacb5f97d58e8465").setAttribute("class","name me admin")
  426. }
  427. if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="d71915aabacb5f97d58e8465" && MPP.client.participantId!="d71915aabacb5f97d58e8465"){
  428. document.querySelector("#namediv-d71915aabacb5f97d58e8465").setAttribute("class","name owner")
  429. }
  430. if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="d71915aabacb5f97d58e8465" && MPP.client.participantId=="d71915aabacb5f97d58e8465"){
  431. document.querySelector("#namediv-d71915aabacb5f97d58e8465").setAttribute("class","name me owner")
  432. }
  433.  
  434. document.querySelectorAll("#cursors > div").forEach((e)=>{
  435. if (e.innerText==document.querySelector("#nametext-d71915aabacb5f97d58e8465").innerText)
  436. {silvercursor=e}
  437. })
  438.  
  439. document.querySelectorAll("#cursors > div").forEach((e)=>{
  440. if (e.innerText==document.querySelector("#nametext-d71915aabacb5f97d58e8465").innerText)
  441. {
  442. if(MPP.client.channel && MPP.client.channel && e){
  443. if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId!="d71915aabacb5f97d58e8465" && MPP.client.participantId!="d71915aabacb5f97d58e8465"){
  444. silvercursor.setAttribute("class","cursor admin")
  445. }
  446. if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="d71915aabacb5f97d58e8465" && MPP.client.participantId!="d71915aabacb5f97d58e8465"){
  447. silvercursor.setAttribute("class","cursor owner")
  448. }
  449. }
  450. }
  451. })
  452. }
  453. if( document.querySelector("#assistant-nametag-d71915aabacb5f97d58e8465"))
  454. document.querySelector("#assistant-nametag-d71915aabacb5f97d58e8465").title="This is the assistant owner."
  455. })),
  456. function(e, t) {
  457. if ("object" == typeof exports && "object" == typeof module) module.exports = t();
  458. else if ("function" == typeof define && define.amd) define([], t);
  459. else {
  460. var n = t();
  461. for (var r in n)("object" == typeof exports ? exports : e)[r] = n[r]
  462. }
  463. }("undefined" != typeof self ? self : this, (function() {
  464. return function(e) {
  465. var t = {};
  466.  
  467. function n(r) {
  468. if (t[r]) return t[r].exports;
  469. var o = t[r] = {
  470. i: r,
  471. l: !1,
  472. exports: {}
  473. };
  474. return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports
  475. }
  476. return n.m = e, n.c = t, n.d = function(e, t, r) {
  477. n.o(e, t) || Object.defineProperty(e, t, {
  478. enumerable: !0,
  479. get: r
  480. })
  481. }, n.r = function(e) {
  482. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  483. value: "Module"
  484. }), Object.defineProperty(e, "__esModule", {
  485. value: !0
  486. })
  487. }, n.t = function(e, t) {
  488. if (1 & t && (e = n(e)), 8 & t) return e;
  489. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  490. var r = Object.create(null);
  491. if (n.r(r), Object.defineProperty(r, "default", {
  492. enumerable: !0,
  493. value: e
  494. }), 2 & t && "string" != typeof e)
  495. for (var o in e) n.d(r, o, function(t) {
  496. return e[t]
  497. }.bind(null, o));
  498. return r
  499. }, n.n = function(e) {
  500. var t = e && e.__esModule ? function() {
  501. return e.default
  502. } : function() {
  503. return e
  504. };
  505. return n.d(t, "a", t), t
  506. }, n.o = function(e, t) {
  507. return Object.prototype.hasOwnProperty.call(e, t)
  508. }, n.p = "", n(n.s = 4)
  509. }([function(e, t, n) {
  510. t.parseMidi = n(5), t.writeMidi = n(6)
  511. }, function(e, t, n) {
  512. "use strict";
  513. Object.defineProperty(t, "__esModule", {
  514. value: !0
  515. });
  516. var r = n(2),
  517. o = new WeakMap;
  518. t.keySignatureKeys = ["Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#"];
  519. var i = function() {
  520. function e(e) {
  521. var n = this;
  522. this.tempos = [], this.timeSignatures = [], this.keySignatures = [], this.meta = [], this.name = "", o.set(this, 480), e && (o.set(this, e.header.ticksPerBeat), e.tracks[0].forEach((function(e) {
  523. e.meta && ("timeSignature" === e.type ? n.timeSignatures.push({
  524. ticks: e.absoluteTime,
  525. timeSignature: [e.numerator, e.denominator]
  526. }) : "setTempo" === e.type ? n.tempos.push({
  527. bpm: 6e7 / e.microsecondsPerBeat,
  528. ticks: e.absoluteTime
  529. }) : "keySignature" === e.type ? n.keySignatures.push({
  530. key: t.keySignatureKeys[e.key + 7],
  531. scale: 0 === e.scale ? "major" : "minor",
  532. ticks: e.absoluteTime
  533. }) : "trackName" === e.type ? n.name = e.text : "endOfTrack" !== e.type && n.meta.push({
  534. text: e.text,
  535. ticks: e.absoluteTime,
  536. type: e.type
  537. }))
  538. })), this.update())
  539. }
  540. return e.prototype.update = function() {
  541. var e = this,
  542. t = 0,
  543. n = 0;
  544. this.tempos.sort((function(e, t) {
  545. return e.ticks - t.ticks
  546. })), this.tempos.forEach((function(r, o) {
  547. var i = o > 0 ? e.tempos[o - 1].bpm : e.tempos[0].bpm,
  548. a = r.ticks / e.ppq - n,
  549. s = 60 / i * a;
  550. r.time = s + t, t = r.time, n += a
  551. })), this.timeSignatures.sort((function(e, t) {
  552. return e.ticks - t.ticks
  553. })), this.timeSignatures.forEach((function(t, n) {
  554. var r = n > 0 ? e.timeSignatures[n - 1] : e.timeSignatures[0],
  555. o = (t.ticks - r.ticks) / e.ppq / r.timeSignature[0] / (r.timeSignature[1] / 4);
  556. r.measures = r.measures || 0, t.measures = o + r.measures
  557. }))
  558. }, e.prototype.ticksToSeconds = function(e) {
  559. var t = r.search(this.tempos, e);
  560. if (-1 !== t) {
  561. var n = this.tempos[t],
  562. o = n.time,
  563. i = (e - n.ticks) / this.ppq;
  564. return o + 60 / n.bpm * i
  565. }
  566. return e / this.ppq * .5
  567. }, e.prototype.ticksToMeasures = function(e) {
  568. var t = r.search(this.timeSignatures, e);
  569. if (-1 !== t) {
  570. var n = this.timeSignatures[t],
  571. o = (e - n.ticks) / this.ppq;
  572. return n.measures + o / (n.timeSignature[0] / n.timeSignature[1]) / 4
  573. }
  574. return e / this.ppq / 4
  575. }, Object.defineProperty(e.prototype, "ppq", {
  576. get: function() {
  577. return o.get(this)
  578. },
  579. enumerable: !0,
  580. configurable: !0
  581. }), e.prototype.secondsToTicks = function(e) {
  582. var t = r.search(this.tempos, e, "time");
  583. if (-1 !== t) {
  584. var n = this.tempos[t],
  585. o = (e - n.time) / (60 / n.bpm);
  586. return Math.round(n.ticks + o * this.ppq)
  587. }
  588. var i = e / .5;
  589. return Math.round(i * this.ppq)
  590. }, e.prototype.toJSON = function() {
  591. return {
  592. keySignatures: this.keySignatures,
  593. meta: this.meta,
  594. name: this.name,
  595. ppq: this.ppq,
  596. tempos: this.tempos.map((function(e) {
  597. return {
  598. bpm: e.bpm,
  599. ticks: e.ticks
  600. }
  601. })),
  602. timeSignatures: this.timeSignatures
  603. }
  604. }, e.prototype.fromJSON = function(e) {
  605. this.name = e.name, this.tempos = e.tempos.map((function(e) {
  606. return Object.assign({}, e)
  607. })), this.timeSignatures = e.timeSignatures.map((function(e) {
  608. return Object.assign({}, e)
  609. })), this.keySignatures = e.keySignatures.map((function(e) {
  610. return Object.assign({}, e)
  611. })), this.meta = e.meta.map((function(e) {
  612. return Object.assign({}, e)
  613. })), o.set(this, e.ppq), this.update()
  614. }, e.prototype.setTempo = function(e) {
  615. this.tempos = [{
  616. bpm: e,
  617. ticks: 0
  618. }], this.update()
  619. }, e
  620. }();
  621. t.Header = i
  622. }, function(e, t, n) {
  623. "use strict";
  624.  
  625. function r(e, t, n) {
  626. void 0 === n && (n = "ticks");
  627. var r = 0,
  628. o = e.length,
  629. i = o;
  630. if (o > 0 && e[o - 1][n] <= t) return o - 1;
  631. for (; r < i;) {
  632. var a = Math.floor(r + (i - r) / 2),
  633. s = e[a],
  634. l = e[a + 1];
  635. if (s[n] === t) {
  636. for (var c = a; c < e.length; c++) e[c][n] === t && (a = c);
  637. return a
  638. }
  639. if (s[n] < t && l[n] > t) return a;
  640. s[n] > t ? i = a : s[n] < t && (r = a + 1)
  641. }
  642. return -1
  643. }
  644. Object.defineProperty(t, "__esModule", {
  645. value: !0
  646. }), t.search = r, t.insert = function(e, t, n) {
  647. if (void 0 === n && (n = "ticks"), e.length) {
  648. var o = r(e, t[n], n);
  649. e.splice(o + 1, 0, t)
  650. } else e.push(t)
  651. }
  652. }, function(e, t, n) {
  653. "use strict";
  654. Object.defineProperty(t, "__esModule", {
  655. value: !0
  656. }), t.controlChangeNames = {
  657. 1: "modulationWheel",
  658. 2: "breath",
  659. 4: "footController",
  660. 5: "portamentoTime",
  661. 7: "volume",
  662. 8: "balance",
  663. 10: "pan",
  664. 64: "sustain",
  665. 65: "portamentoTime",
  666. 66: "sostenuto",
  667. 67: "softPedal",
  668. 68: "legatoFootswitch",
  669. 84: "portamentoControl"
  670. }, t.controlChangeIds = Object.keys(t.controlChangeNames).reduce((function(e, n) {
  671. return e[t.controlChangeNames[n]] = n, e
  672. }), {});
  673. var r = new WeakMap,
  674. o = new WeakMap,
  675. i = function() {
  676. function e(e, t) {
  677. r.set(this, t), o.set(this, e.controllerType), this.ticks = e.absoluteTime, this.value = e.value
  678. }
  679. return Object.defineProperty(e.prototype, "number", {
  680. get: function() {
  681. return o.get(this)
  682. },
  683. enumerable: !0,
  684. configurable: !0
  685. }), Object.defineProperty(e.prototype, "name", {
  686. get: function() {
  687. return t.controlChangeNames[this.number] ? t.controlChangeNames[this.number] : null
  688. },
  689. enumerable: !0,
  690. configurable: !0
  691. }), Object.defineProperty(e.prototype, "time", {
  692. get: function() {
  693. return r.get(this).ticksToSeconds(this.ticks)
  694. },
  695. set: function(e) {
  696. var t = r.get(this);
  697. this.ticks = t.secondsToTicks(e)
  698. },
  699. enumerable: !0,
  700. configurable: !0
  701. }), e.prototype.toJSON = function() {
  702. return {
  703. number: this.number,
  704. ticks: this.ticks,
  705. time: this.time,
  706. value: this.value
  707. }
  708. }, e
  709. }();
  710. t.ControlChange = i
  711. }, function(e, t, n) {
  712. "use strict";
  713. var r = this && this.__awaiter || function(e, t, n, r) {
  714. return new(n || (n = Promise))((function(o, i) {
  715. function a(e) {
  716. try {
  717. l(r.next(e))
  718. } catch (e) {
  719. i(e)
  720. }
  721. }
  722.  
  723. function s(e) {
  724. try {
  725. l(r.throw(e))
  726. } catch (e) {
  727. i(e)
  728. }
  729. }
  730.  
  731. function l(e) {
  732. var t;
  733. e.done ? o(e.value) : (t = e.value, t instanceof n ? t : new n((function(e) {
  734. e(t)
  735. }))).then(a, s)
  736. }
  737. l((r = r.apply(e, t || [])).next())
  738. }))
  739. },
  740. o = this && this.__generator || function(e, t) {
  741. var n, r, o, i, a = {
  742. label: 0,
  743. sent: function() {
  744. if (1 & o[0]) throw o[1];
  745. return o[1]
  746. },
  747. trys: [],
  748. ops: []
  749. };
  750. return i = {
  751. next: s(0),
  752. throw: s(1),
  753. return: s(2)
  754. }, "function" == typeof Symbol && (i[Symbol.iterator] = function() {
  755. return this
  756. }), i;
  757.  
  758. function s(i) {
  759. return function(s) {
  760. return function(i) {
  761. if (n) throw new TypeError("Generator is already executing.");
  762. for (; a;) try {
  763. if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) return o;
  764. switch (r = 0, o && (i = [2 & i[0], o.value]), i[0]) {
  765. case 0:
  766. case 1:
  767. o = i;
  768. break;
  769. case 4:
  770. return a.label++, {
  771. value: i[1],
  772. done: !1
  773. };
  774. case 5:
  775. a.label++, r = i[1], i = [0];
  776. continue;
  777. case 7:
  778. i = a.ops.pop(), a.trys.pop();
  779. continue;
  780. default:
  781. if (!(o = (o = a.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) {
  782. a = 0;
  783. continue
  784. }
  785. if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) {
  786. a.label = i[1];
  787. break
  788. }
  789. if (6 === i[0] && a.label < o[1]) {
  790. a.label = o[1], o = i;
  791. break
  792. }
  793. if (o && a.label < o[2]) {
  794. a.label = o[2], a.ops.push(i);
  795. break
  796. }
  797. o[2] && a.ops.pop(), a.trys.pop();
  798. continue
  799. }
  800. i = t.call(e, a)
  801. } catch (e) {
  802. i = [6, e], r = 0
  803. } finally {
  804. n = o = 0
  805. }
  806. if (5 & i[0]) throw i[1];
  807. return {
  808. value: i[0] ? i[1] : void 0,
  809. done: !0
  810. }
  811. }([i, s])
  812. }
  813. }
  814. };
  815. Object.defineProperty(t, "__esModule", {
  816. value: !0
  817. });
  818. var i = n(0),
  819. a = n(7),
  820. s = n(1),
  821. l = n(9),
  822. c = function() {
  823. function e(e) {
  824. var t = this,
  825. n = null;
  826. e && (e instanceof ArrayBuffer && (e = new Uint8Array(e)), (n = i.parseMidi(e)).tracks.forEach((function(e) {
  827. var t = 0;
  828. e.forEach((function(e) {
  829. t += e.deltaTime, e.absoluteTime = t
  830. }))
  831. }))), this.header = new s.Header(n), this.tracks = [], e && (this.tracks = n.tracks.map((function(e) {
  832. return new l.Track(e, t.header)
  833. })), 1 === n.header.format && 0 === this.tracks[0].duration && this.tracks.shift())
  834. }
  835. return e.fromUrl = function(t) {
  836. return r(this, void 0, void 0, (function() {
  837. var n;
  838. return o(this, (function(r) {
  839. switch (r.label) {
  840. case 0:
  841. return [4, fetch(t)];
  842. case 1:
  843. return (n = r.sent()).ok ? [4, n.arrayBuffer()] : [3, 3];
  844. case 2:
  845. return [2, new e(r.sent())];
  846. case 3:
  847. throw new Error("could not load " + t)
  848. }
  849. }))
  850. }))
  851. }, Object.defineProperty(e.prototype, "name", {
  852. get: function() {
  853. return this.header.name
  854. },
  855. set: function(e) {
  856. this.header.name = e
  857. },
  858. enumerable: !0,
  859. configurable: !0
  860. }), Object.defineProperty(e.prototype, "duration", {
  861. get: function() {
  862. var e = this.tracks.map((function(e) {
  863. return e.duration
  864. }));
  865. return Math.max.apply(Math, e)
  866. },
  867. enumerable: !0,
  868. configurable: !0
  869. }), Object.defineProperty(e.prototype, "durationTicks", {
  870. get: function() {
  871. var e = this.tracks.map((function(e) {
  872. return e.durationTicks
  873. }));
  874. return Math.max.apply(Math, e)
  875. },
  876. enumerable: !0,
  877. configurable: !0
  878. }), e.prototype.addTrack = function() {
  879. var e = new l.Track(void 0, this.header);
  880. return this.tracks.push(e), e
  881. }, e.prototype.toArray = function() {
  882. return a.encode(this)
  883. }, e.prototype.toJSON = function() {
  884. return {
  885. header: this.header.toJSON(),
  886. tracks: this.tracks.map((function(e) {
  887. return e.toJSON()
  888. }))
  889. }
  890. }, e.prototype.fromJSON = function(e) {
  891. var t = this;
  892. this.header = new s.Header, this.header.fromJSON(e.header), this.tracks = e.tracks.map((function(e) {
  893. var n = new l.Track(void 0, t.header);
  894. return n.fromJSON(e), n
  895. }))
  896. }, e.prototype.clone = function() {
  897. var t = new e;
  898. return t.fromJSON(this.toJSON()), t
  899. }, e
  900. }();
  901. t.Midi = c
  902. }, function(e, t) {
  903. function n(e) {
  904. for (var t, n = new r(e), o = []; !n.eof();) {
  905. var i = a();
  906. o.push(i)
  907. }
  908. return o;
  909.  
  910. function a() {
  911. var e = {};
  912. e.deltaTime = n.readVarInt();
  913. var r = n.readUInt8();
  914. if (240 == (240 & r)) {
  915. if (255 !== r) {
  916. if (240 == r) return e.type = "sysEx", i = n.readVarInt(), e.data = n.readBytes(i), e;
  917. if (247 == r) return e.type = "endSysEx", i = n.readVarInt(), e.data = n.readBytes(i), e;
  918. throw "Unrecognised MIDI event type byte: " + r
  919. }
  920. e.meta = !0;
  921. var o = n.readUInt8(),
  922. i = n.readVarInt();
  923. switch (o) {
  924. case 0:
  925. if (e.type = "sequenceNumber", 2 !== i) throw "Expected length for sequenceNumber event is 2, got " + i;
  926. return e.number = stream.readUInt16(), e;
  927. case 1:
  928. return e.type = "text", e.text = n.readString(i), e;
  929. case 2:
  930. return e.type = "copyrightNotice", e.text = n.readString(i), e;
  931. case 3:
  932. return e.type = "trackName", e.text = n.readString(i), e;
  933. case 4:
  934. return e.type = "instrumentName", e.text = n.readString(i), e;
  935. case 5:
  936. return e.type = "lyrics", e.text = n.readString(i), e;
  937. case 6:
  938. return e.type = "marker", e.text = n.readString(i), e;
  939. case 7:
  940. return e.type = "cuePoint", e.text = n.readString(i), e;
  941. case 32:
  942. if (e.type = "channelPrefix", 1 != i) throw "Expected length for channelPrefix event is 1, got " + i;
  943. return e.channel = n.readUInt8(), e;
  944. case 33:
  945. if (e.type = "portPrefix", 1 != i) throw "Expected length for portPrefix event is 1, got " + i;
  946. return e.port = n.readUInt8(), e;
  947. case 47:
  948. if (e.type = "endOfTrack", 0 != i) throw "Expected length for endOfTrack event is 0, got " + i;
  949. return e;
  950. case 81:
  951. if (e.type = "setTempo", 3 != i) throw "Expected length for setTempo event is 3, got " + i;
  952. return e.microsecondsPerBeat = n.readUInt24(), e;
  953. case 84:
  954. if (e.type = "smpteOffset", 5 != i) throw "Expected length for smpteOffset event is 5, got " + i;
  955. var a = n.readUInt8();
  956. return e.frameRate = {
  957. 0: 24,
  958. 32: 25,
  959. 64: 29,
  960. 96: 30
  961. } [96 & a], e.hour = 31 & a, e.min = n.readUInt8(), e.sec = n.readUInt8(), e.frame = n.readUInt8(), e.subFrame = n.readUInt8(), e;
  962. case 88:
  963. if (e.type = "timeSignature", 4 != i) throw "Expected length for timeSignature event is 4, got " + i;
  964. return e.numerator = n.readUInt8(), e.denominator = 1 << n.readUInt8(), e.metronome = n.readUInt8(), e.thirtyseconds = n.readUInt8(), e;
  965. case 89:
  966. if (e.type = "keySignature", 2 != i) throw "Expected length for keySignature event is 2, got " + i;
  967. return e.key = n.readInt8(), e.scale = n.readUInt8(), e;
  968. case 127:
  969. return e.type = "sequencerSpecific", e.data = n.readBytes(i), e;
  970. default:
  971. return e.type = "unknownMeta", e.data = n.readBytes(i), e.metatypeByte = o, e
  972. }
  973. } else {
  974. var s;
  975. if (0 == (128 & r)) {
  976. if (null === t) throw "Running status byte encountered before status byte";
  977. s = r, r = t, e.running = !0
  978. } else s = n.readUInt8(), t = r;
  979. var l = r >> 4;
  980. switch (e.channel = 15 & r, l) {
  981. case 8:
  982. return e.type = "noteOff", e.noteNumber = s, e.velocity = n.readUInt8(), e;
  983. case 9:
  984. var c = n.readUInt8();
  985. return e.type = 0 === c ? "noteOff" : "noteOn", e.noteNumber = s, e.velocity = c, 0 === c && (e.byte9 = !0), e;
  986. case 10:
  987. return e.type = "noteAftertouch", e.noteNumber = s, e.amount = n.readUInt8(), e;
  988. case 11:
  989. return e.type = "controller", e.controllerType = s, e.value = n.readUInt8(), e;
  990. case 12:
  991. return e.type = "programChange", e.programNumber = s, e;
  992. case 13:
  993. return e.type = "channelAftertouch", e.amount = s, e;
  994. case 14:
  995. return e.type = "pitchBend", e.value = s + (n.readUInt8() << 7) - 8192, e;
  996. default:
  997. throw "Unrecognised MIDI event type: " + l
  998. }
  999. }
  1000. }
  1001. }
  1002.  
  1003. function r(e) {
  1004. this.buffer = e, this.bufferLen = this.buffer.length, this.pos = 0
  1005. }
  1006. r.prototype.eof = function() {
  1007. return this.pos >= this.bufferLen
  1008. }, r.prototype.readUInt8 = function() {
  1009. var e = this.buffer[this.pos];
  1010. return this.pos += 1, e
  1011. }, r.prototype.readInt8 = function() {
  1012. var e = this.readUInt8();
  1013. return 128 & e ? e - 256 : e
  1014. }, r.prototype.readUInt16 = function() {
  1015. return (this.readUInt8() << 8) + this.readUInt8()
  1016. }, r.prototype.readInt16 = function() {
  1017. var e = this.readUInt16();
  1018. return 32768 & e ? e - 65536 : e
  1019. }, r.prototype.readUInt24 = function() {
  1020. return (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8()
  1021. }, r.prototype.readInt24 = function() {
  1022. var e = this.readUInt24();
  1023. return 8388608 & e ? e - 16777216 : e
  1024. }, r.prototype.readUInt32 = function() {
  1025. return (this.readUInt8() << 24) + (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8()
  1026. }, r.prototype.readBytes = function(e) {
  1027. var t = this.buffer.slice(this.pos, this.pos + e);
  1028. return this.pos += e, t
  1029. }, r.prototype.readString = function(e) {
  1030. var t = this.readBytes(e);
  1031. return String.fromCharCode.apply(null, t)
  1032. }, r.prototype.readVarInt = function() {
  1033. for (var e = 0; !this.eof();) {
  1034. var t = this.readUInt8();
  1035. if (!(128 & t)) return e + t;
  1036. e += 127 & t, e <<= 7
  1037. }
  1038. return e
  1039. }, r.prototype.readChunk = function() {
  1040. var e = this.readString(4),
  1041. t = this.readUInt32();
  1042. return {
  1043. id: e,
  1044. length: t,
  1045. data: this.readBytes(t)
  1046. }
  1047. }, e.exports = function(e) {
  1048. var t = new r(e),
  1049. o = t.readChunk();
  1050. if ("MThd" != o.id) throw "Bad MIDI file. Expected 'MHdr', got: '" + o.id + "'";
  1051. for (var i = function(e) {
  1052. var t = new r(e),
  1053. n = {
  1054. format: t.readUInt16(),
  1055. numTracks: t.readUInt16()
  1056. },
  1057. o = t.readUInt16();
  1058. return 32768 & o ? (n.framesPerSecond = 256 - (o >> 8), n.ticksPerFrame = 255 & o) : n.ticksPerBeat = o, n
  1059. }(o.data), a = [], s = 0; !t.eof() && s < i.numTracks; s++) {
  1060. var l = t.readChunk();
  1061. if ("MTrk" != l.id) throw "Bad MIDI file. Expected 'MTrk', got: '" + l.id + "'";
  1062. var c = n(l.data);
  1063. a.push(c)
  1064. }
  1065. return {
  1066. header: i,
  1067. tracks: a
  1068. }
  1069. }
  1070. }, function(e, t) {
  1071. function n(e, t, n) {
  1072. var i, a = new o,
  1073. s = t.length,
  1074. l = null;
  1075. for (i = 0; i < s; i++) !1 !== n.running && (n.running || t[i].running) || (l = null), l = r(a, t[i], l, n.useByte9ForNoteOff);
  1076. e.writeChunk("MTrk", a.buffer)
  1077. }
  1078.  
  1079. function r(e, t, n, r) {
  1080. var o = t.type,
  1081. i = t.deltaTime,
  1082. a = t.text || "",
  1083. s = t.data || [],
  1084. l = null;
  1085. switch (e.writeVarInt(i), o) {
  1086. case "sequenceNumber":
  1087. e.writeUInt8(255), e.writeUInt8(0), e.writeVarInt(2), e.writeUInt16(t.number);
  1088. break;
  1089. case "text":
  1090. e.writeUInt8(255), e.writeUInt8(1), e.writeVarInt(a.length), e.writeString(a);
  1091. break;
  1092. case "copyrightNotice":
  1093. e.writeUInt8(255), e.writeUInt8(2), e.writeVarInt(a.length), e.writeString(a);
  1094. break;
  1095. case "trackName":
  1096. e.writeUInt8(255), e.writeUInt8(3), e.writeVarInt(a.length), e.writeString(a);
  1097. break;
  1098. case "instrumentName":
  1099. e.writeUInt8(255), e.writeUInt8(4), e.writeVarInt(a.length), e.writeString(a);
  1100. break;
  1101. case "lyrics":
  1102. e.writeUInt8(255), e.writeUInt8(5), e.writeVarInt(a.length), e.writeString(a);
  1103. break;
  1104. case "marker":
  1105. e.writeUInt8(255), e.writeUInt8(6), e.writeVarInt(a.length), e.writeString(a);
  1106. break;
  1107. case "cuePoint":
  1108. e.writeUInt8(255), e.writeUInt8(7), e.writeVarInt(a.length), e.writeString(a);
  1109. break;
  1110. case "channelPrefix":
  1111. e.writeUInt8(255), e.writeUInt8(32), e.writeVarInt(1), e.writeUInt8(t.channel);
  1112. break;
  1113. case "portPrefix":
  1114. e.writeUInt8(255), e.writeUInt8(33), e.writeVarInt(1), e.writeUInt8(t.port);
  1115. break;
  1116. case "endOfTrack":
  1117. e.writeUInt8(255), e.writeUInt8(47), e.writeVarInt(0);
  1118. break;
  1119. case "setTempo":
  1120. e.writeUInt8(255), e.writeUInt8(81), e.writeVarInt(3), e.writeUInt24(t.microsecondsPerBeat);
  1121. break;
  1122. case "smpteOffset":
  1123. e.writeUInt8(255), e.writeUInt8(84), e.writeVarInt(5);
  1124. var c = 31 & t.hour | {
  1125. 24: 0,
  1126. 25: 32,
  1127. 29: 64,
  1128. 30: 96
  1129. } [t.frameRate];
  1130. e.writeUInt8(c), e.writeUInt8(t.min), e.writeUInt8(t.sec), e.writeUInt8(t.frame), e.writeUInt8(t.subFrame);
  1131. break;
  1132. case "timeSignature":
  1133. e.writeUInt8(255), e.writeUInt8(88), e.writeVarInt(4), e.writeUInt8(t.numerator);
  1134. var p = 255 & Math.floor(Math.log(t.denominator) / Math.LN2);
  1135. e.writeUInt8(p), e.writeUInt8(t.metronome), e.writeUInt8(t.thirtyseconds || 8);
  1136. break;
  1137. case "keySignature":
  1138. e.writeUInt8(255), e.writeUInt8(89), e.writeVarInt(2), e.writeInt8(t.key), e.writeUInt8(t.scale);
  1139. break;
  1140. case "sequencerSpecific":
  1141. e.writeUInt8(255), e.writeUInt8(127), e.writeVarInt(s.length), e.writeBytes(s);
  1142. break;
  1143. case "unknownMeta":
  1144. null != t.metatypeByte && (e.writeUInt8(255), e.writeUInt8(t.metatypeByte), e.writeVarInt(s.length), e.writeBytes(s));
  1145. break;
  1146. case "sysEx":
  1147. e.writeUInt8(240), e.writeVarInt(s.length), e.writeBytes(s);
  1148. break;
  1149. case "endSysEx":
  1150. e.writeUInt8(247), e.writeVarInt(s.length), e.writeBytes(s);
  1151. break;
  1152. case "noteOff":
  1153. (l = (!1 !== r && t.byte9 || r && 0 == t.velocity ? 144 : 128) | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
  1154. break;
  1155. case "noteOn":
  1156. (l = 144 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
  1157. break;
  1158. case "noteAftertouch":
  1159. (l = 160 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.amount);
  1160. break;
  1161. case "controller":
  1162. (l = 176 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.controllerType), e.writeUInt8(t.value);
  1163. break;
  1164. case "programChange":
  1165. (l = 192 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.programNumber);
  1166. break;
  1167. case "channelAftertouch":
  1168. (l = 208 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.amount);
  1169. break;
  1170. case "pitchBend":
  1171. (l = 224 | t.channel) !== n && e.writeUInt8(l);
  1172. var _ = 8192 + t.value,
  1173. m = 127 & _,
  1174. u = _ >> 7 & 127;
  1175. e.writeUInt8(m), e.writeUInt8(u);
  1176. break;
  1177. default:
  1178. throw "Unrecognized event type: " + o
  1179. }
  1180. return l
  1181. }
  1182.  
  1183. function o() {
  1184. this.buffer = []
  1185. }
  1186. o.prototype.writeUInt8 = function(e) {
  1187. this.buffer.push(255 & e)
  1188. }, o.prototype.writeInt8 = o.prototype.writeUInt8, o.prototype.writeUInt16 = function(e) {
  1189. var t = e >> 8 & 255,
  1190. n = 255 & e;
  1191. this.writeUInt8(t), this.writeUInt8(n)
  1192. }, o.prototype.writeInt16 = o.prototype.writeUInt16, o.prototype.writeUInt24 = function(e) {
  1193. var t = e >> 16 & 255,
  1194. n = e >> 8 & 255,
  1195. r = 255 & e;
  1196. this.writeUInt8(t), this.writeUInt8(n), this.writeUInt8(r)
  1197. }, o.prototype.writeInt24 = o.prototype.writeUInt24, o.prototype.writeUInt32 = function(e) {
  1198. var t = e >> 24 & 255,
  1199. n = e >> 16 & 255,
  1200. r = e >> 8 & 255,
  1201. o = 255 & e;
  1202. this.writeUInt8(t), this.writeUInt8(n), this.writeUInt8(r), this.writeUInt8(o)
  1203. }, o.prototype.writeInt32 = o.prototype.writeUInt32, o.prototype.writeBytes = function(e) {
  1204. this.buffer = this.buffer.concat(Array.prototype.slice.call(e, 0))
  1205. }, o.prototype.writeString = function(e) {
  1206. var t, n = e.length,
  1207. r = [];
  1208. for (t = 0; t < n; t++) r.push(e.codePointAt(t));
  1209. this.writeBytes(r)
  1210. }, o.prototype.writeVarInt = function(e) {
  1211. if (e < 0) throw "Cannot write negative variable-length integer";
  1212. if (e <= 127) this.writeUInt8(e);
  1213. else {
  1214. var t = e,
  1215. n = [];
  1216. for (n.push(127 & t), t >>= 7; t;) {
  1217. var r = 127 & t | 128;
  1218. n.push(r), t >>= 7
  1219. }
  1220. this.writeBytes(n.reverse())
  1221. }
  1222. }, o.prototype.writeChunk = function(e, t) {
  1223. this.writeString(e), this.writeUInt32(t.length), this.writeBytes(t)
  1224. }, e.exports = function(e, t) {
  1225. if ("object" != typeof e) throw "Invalid MIDI data";
  1226. t = t || {};
  1227. var r, i = e.header || {},
  1228. a = e.tracks || [],
  1229. s = a.length,
  1230. l = new o;
  1231. for (function(e, t, n) {
  1232. var r = null == t.format ? 1 : t.format,
  1233. i = 128;
  1234. t.timeDivision ? i = t.timeDivision : t.ticksPerFrame && t.framesPerSecond ? i = -(255 & t.framesPerSecond) << 8 | 255 & ticksPerFrame : t.ticksPerBeat && (i = 32767 & t.ticksPerBeat);
  1235. var a = new o;
  1236. a.writeUInt16(r), a.writeUInt16(n), a.writeUInt16(i), e.writeChunk("MThd", a.buffer)
  1237. }(l, i, s), r = 0; r < s; r++) n(l, a[r], t);
  1238. return l.buffer
  1239. }
  1240. }, function(e, t, n) {
  1241. "use strict";
  1242. var r = this && this.__spreadArrays || function() {
  1243. for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
  1244. var r = Array(e),
  1245. o = 0;
  1246. for (t = 0; t < n; t++)
  1247. for (var i = arguments[t], a = 0, s = i.length; a < s; a++, o++) r[o] = i[a];
  1248. return r
  1249. },
  1250. o = this && this.__importDefault || function(e) {
  1251. return e && e.__esModule ? e : {
  1252. default: e
  1253. }
  1254. };
  1255. Object.defineProperty(t, "__esModule", {
  1256. value: !0
  1257. });
  1258. var i = n(0),
  1259. a = n(1),
  1260. s = o(n(8));
  1261.  
  1262. function l(e, t) {
  1263. return {
  1264. absoluteTime: e.ticks,
  1265. channel: t,
  1266. controllerType: e.number,
  1267. deltaTime: 0,
  1268. type: "controller",
  1269. value: e.value
  1270. }
  1271. }
  1272.  
  1273. function c(e) {
  1274. return {
  1275. absoluteTime: 0,
  1276. channel: e.channel,
  1277. deltaTime: 0,
  1278. programNumber: e.instrument.number,
  1279. type: "programChange"
  1280. }
  1281. }
  1282. t.encode = function(e) {
  1283. var t = {
  1284. header: {
  1285. format: 1,
  1286. numTracks: e.tracks.length + 1,
  1287. ticksPerBeat: e.header.ppq
  1288. },
  1289. tracks: r([r([{
  1290. absoluteTime: 0,
  1291. deltaTime: 0,
  1292. meta: !0,
  1293. text: e.header.name,
  1294. type: "trackName"
  1295. }], e.header.keySignatures.map((function(e) {
  1296. return function(e) {
  1297. var t = a.keySignatureKeys.indexOf(e.key);
  1298. return {
  1299. absoluteTime: e.ticks,
  1300. deltaTime: 0,
  1301. key: t + 7,
  1302. meta: !0,
  1303. scale: "major" === e.scale ? 0 : 1,
  1304. type: "keySignature"
  1305. }
  1306. }(e)
  1307. })), e.header.meta.map((function(e) {
  1308. return {
  1309. absoluteTime: (t = e).ticks,
  1310. deltaTime: 0,
  1311. meta: !0,
  1312. text: t.text,
  1313. type: t.type
  1314. };
  1315. var t
  1316. })), e.header.tempos.map((function(e) {
  1317. return function(e) {
  1318. return {
  1319. absoluteTime: e.ticks,
  1320. deltaTime: 0,
  1321. meta: !0,
  1322. microsecondsPerBeat: Math.floor(6e7 / e.bpm),
  1323. type: "setTempo"
  1324. }
  1325. }(e)
  1326. })), e.header.timeSignatures.map((function(e) {
  1327. return function(e) {
  1328. return {
  1329. absoluteTime: e.ticks,
  1330. deltaTime: 0,
  1331. denominator: e.timeSignature[1],
  1332. meta: !0,
  1333. metronome: 24,
  1334. numerator: e.timeSignature[0],
  1335. thirtyseconds: 8,
  1336. type: "timeSignature"
  1337. }
  1338. }(e)
  1339. })))], e.tracks.map((function(e) {
  1340. return r([(t = e.name, {
  1341. absoluteTime: 0,
  1342. deltaTime: 0,
  1343. meta: !0,
  1344. text: t,
  1345. type: "trackName"
  1346. }), c(e)], function(e) {
  1347. return s.default(e.notes.map((function(t) {
  1348. return function(e, t) {
  1349. return [{
  1350. absoluteTime: e.ticks,
  1351. channel: t,
  1352. deltaTime: 0,
  1353. noteNumber: e.midi,
  1354. type: "noteOn",
  1355. velocity: Math.floor(127 * e.velocity)
  1356. }, {
  1357. absoluteTime: e.ticks + e.durationTicks,
  1358. channel: t,
  1359. deltaTime: 0,
  1360. noteNumber: e.midi,
  1361. type: "noteOff",
  1362. velocity: Math.floor(127 * e.noteOffVelocity)
  1363. }]
  1364. }(t, e.channel)
  1365. })))
  1366. }(e), function(e) {
  1367. for (var t = [], n = 0; n < 127; n++) e.controlChanges.hasOwnProperty(n) && e.controlChanges[n].forEach((function(n) {
  1368. t.push(l(n, e.channel))
  1369. }));
  1370. return t
  1371. }(e), function(e) {
  1372. var t = [];
  1373. return e.pitchBends.forEach((function(n) {
  1374. t.push(function(e, t) {
  1375. return {
  1376. absoluteTime: e.ticks,
  1377. channel: t,
  1378. deltaTime: 0,
  1379. type: "pitchBend",
  1380. value: e.value
  1381. }
  1382. }(n, e.channel))
  1383. })), t
  1384. }(e));
  1385. var t
  1386. })))
  1387. };
  1388. return t.tracks = t.tracks.map((function(e) {
  1389. e = e.sort((function(e, t) {
  1390. return e.absoluteTime - t.absoluteTime
  1391. }));
  1392. var t = 0;
  1393. return e.forEach((function(e) {
  1394. e.deltaTime = e.absoluteTime - t, t = e.absoluteTime, delete e.absoluteTime
  1395. })), e.push({
  1396. deltaTime: 0,
  1397. meta: !0,
  1398. type: "endOfTrack"
  1399. }), e
  1400. })), new Uint8Array(i.writeMidi(t))
  1401. }
  1402. }, function(e, t, n) {
  1403. "use strict";
  1404.  
  1405. function r(e) {
  1406. return function e(t, n) {
  1407. for (var r = 0; r < t.length; r++) {
  1408. var o = t[r];
  1409. Array.isArray(o) ? e(o, n) : n.push(o)
  1410. }
  1411. return n
  1412. }(e, [])
  1413. }
  1414.  
  1415. function o(e, t) {
  1416. if ("number" != typeof t) throw new TypeError("Expected the depth to be a number");
  1417. return function e(t, n, r) {
  1418. r--;
  1419. for (var o = 0; o < t.length; o++) {
  1420. var i = t[o];
  1421. r > -1 && Array.isArray(i) ? e(i, n, r) : n.push(i)
  1422. }
  1423. return n
  1424. }(e, [], t)
  1425. }
  1426. e.exports = function(e) {
  1427. if (!Array.isArray(e)) throw new TypeError("Expected value to be an array");
  1428. return r(e)
  1429. }, e.exports.from = r, e.exports.depth = function(e, t) {
  1430. if (!Array.isArray(e)) throw new TypeError("Expected value to be an array");
  1431. return o(e, t)
  1432. }, e.exports.fromDepth = o
  1433. }, function(e, t, n) {
  1434. "use strict";
  1435. Object.defineProperty(t, "__esModule", {
  1436. value: !0
  1437. });
  1438. var r = n(2),
  1439. o = n(3),
  1440. i = n(10),
  1441. a = n(11),
  1442. s = n(12),
  1443. l = n(14),
  1444. c = new WeakMap,
  1445. p = function() {
  1446. function e(e, t) {
  1447. var n = this;
  1448. if (this.name = "", this.notes = [], this.controlChanges = i.createControlChanges(), this.pitchBends = [], c.set(this, t), e) {
  1449. var r = e.find((function(e) {
  1450. return "trackName" === e.type
  1451. }));
  1452. this.name = r ? r.text : ""
  1453. }
  1454. if (this.instrument = new s.Instrument(e, this), this.channel = 0, e) {
  1455. for (var o = e.filter((function(e) {
  1456. return "noteOn" === e.type
  1457. })), a = e.filter((function(e) {
  1458. return "noteOff" === e.type
  1459. })), l = function() {
  1460. var e = o.shift();
  1461. p.channel = e.channel;
  1462. var t = a.findIndex((function(t) {
  1463. return t.noteNumber === e.noteNumber && t.absoluteTime >= e.absoluteTime
  1464. }));
  1465. if (-1 !== t) {
  1466. var n = a.splice(t, 1)[0];
  1467. p.addNote({
  1468. durationTicks: n.absoluteTime - e.absoluteTime,
  1469. midi: e.noteNumber,
  1470. noteOffVelocity: n.velocity / 127,
  1471. ticks: e.absoluteTime,
  1472. velocity: e.velocity / 127
  1473. })
  1474. }
  1475. }, p = this; o.length;) l();
  1476. e.filter((function(e) {
  1477. return "controller" === e.type
  1478. })).forEach((function(e) {
  1479. n.addCC({
  1480. number: e.controllerType,
  1481. ticks: e.absoluteTime,
  1482. value: e.value / 127
  1483. })
  1484. })), e.filter((function(e) {
  1485. return "pitchBend" === e.type
  1486. })).forEach((function(e) {
  1487. n.addPitchBend({
  1488. ticks: e.absoluteTime,
  1489. value: e.value / Math.pow(2, 13)
  1490. })
  1491. }))
  1492. }
  1493. }
  1494. return e.prototype.addNote = function(e) {
  1495. var t = c.get(this),
  1496. n = new l.Note({
  1497. midi: 0,
  1498. ticks: 0,
  1499. velocity: 1
  1500. }, {
  1501. ticks: 0,
  1502. velocity: 0
  1503. }, t);
  1504. return Object.assign(n, e), r.insert(this.notes, n, "ticks"), this
  1505. }, e.prototype.addCC = function(e) {
  1506. var t = c.get(this),
  1507. n = new o.ControlChange({
  1508. controllerType: e.number
  1509. }, t);
  1510. return delete e.number, Object.assign(n, e), Array.isArray(this.controlChanges[n.number]) || (this.controlChanges[n.number] = []), r.insert(this.controlChanges[n.number], n, "ticks"), this
  1511. }, e.prototype.addPitchBend = function(e) {
  1512. var t = c.get(this),
  1513. n = new a.PitchBend({}, t);
  1514. return Object.assign(n, e), r.insert(this.pitchBends, n, "ticks"), this
  1515. }, Object.defineProperty(e.prototype, "duration", {
  1516. get: function() {
  1517. var e = this.notes[this.notes.length - 1];
  1518. return e ? e.time + e.duration : 0
  1519. },
  1520. enumerable: !0,
  1521. configurable: !0
  1522. }), Object.defineProperty(e.prototype, "durationTicks", {
  1523. get: function() {
  1524. var e = this.notes[this.notes.length - 1];
  1525. return e ? e.ticks + e.durationTicks : 0
  1526. },
  1527. enumerable: !0,
  1528. configurable: !0
  1529. }), e.prototype.fromJSON = function(e) {
  1530. var t = this;
  1531. for (var n in this.name = e.name, this.channel = e.channel, this.instrument = new s.Instrument(void 0, this), this.instrument.fromJSON(e.instrument), e.controlChanges) e.controlChanges[n] && e.controlChanges[n].forEach((function(e) {
  1532. t.addCC({
  1533. number: e.number,
  1534. ticks: e.ticks,
  1535. value: e.value
  1536. })
  1537. }));
  1538. e.notes.forEach((function(e) {
  1539. t.addNote({
  1540. durationTicks: e.durationTicks,
  1541. midi: e.midi,
  1542. ticks: e.ticks,
  1543. velocity: e.velocity
  1544. })
  1545. }))
  1546. }, e.prototype.toJSON = function() {
  1547. for (var e = {}, t = 0; t < 127; t++) this.controlChanges.hasOwnProperty(t) && (e[t] = this.controlChanges[t].map((function(e) {
  1548. return e.toJSON()
  1549. })));
  1550. return {
  1551. channel: this.channel,
  1552. controlChanges: e,
  1553. pitchBends: this.pitchBends.map((function(e) {
  1554. return e.toJSON()
  1555. })),
  1556. instrument: this.instrument.toJSON(),
  1557. name: this.name,
  1558. notes: this.notes.map((function(e) {
  1559. return e.toJSON()
  1560. }))
  1561. }
  1562. }, e
  1563. }();
  1564. t.Track = p
  1565. }, function(e, t, n) {
  1566. "use strict";
  1567. Object.defineProperty(t, "__esModule", {
  1568. value: !0
  1569. });
  1570. var r = n(3);
  1571. t.createControlChanges = function() {
  1572. return new Proxy({}, {
  1573. get: function(e, t) {
  1574. return e[t] ? e[t] : r.controlChangeIds.hasOwnProperty(t) ? e[r.controlChangeIds[t]] : void 0
  1575. },
  1576. set: function(e, t, n) {
  1577. return r.controlChangeIds.hasOwnProperty(t) ? e[r.controlChangeIds[t]] = n : e[t] = n, !0
  1578. }
  1579. })
  1580. }
  1581. }, function(e, t, n) {
  1582. "use strict";
  1583. Object.defineProperty(t, "__esModule", {
  1584. value: !0
  1585. });
  1586. var r = new WeakMap,
  1587. o = function() {
  1588. function e(e, t) {
  1589. r.set(this, t), this.ticks = e.absoluteTime, this.value = e.value
  1590. }
  1591. return Object.defineProperty(e.prototype, "time", {
  1592. get: function() {
  1593. return r.get(this).ticksToSeconds(this.ticks)
  1594. },
  1595. set: function(e) {
  1596. var t = r.get(this);
  1597. this.ticks = t.secondsToTicks(e)
  1598. },
  1599. enumerable: !0,
  1600. configurable: !0
  1601. }), e.prototype.toJSON = function() {
  1602. return {
  1603. ticks: this.ticks,
  1604. time: this.time,
  1605. value: this.value
  1606. }
  1607. }, e
  1608. }();
  1609. t.PitchBend = o
  1610. }, function(e, t, n) {
  1611. "use strict";
  1612. Object.defineProperty(t, "__esModule", {
  1613. value: !0
  1614. });
  1615. var r = n(13),
  1616. o = new WeakMap,
  1617. i = function() {
  1618. function e(e, t) {
  1619. if (this.number = 0, o.set(this, t), this.number = 0, e) {
  1620. var n = e.find((function(e) {
  1621. return "programChange" === e.type
  1622. }));
  1623. n && (this.number = n.programNumber)
  1624. }
  1625. }
  1626. return Object.defineProperty(e.prototype, "name", {
  1627. get: function() {
  1628. return this.percussion ? r.DrumKitByPatchID[this.number] : r.instrumentByPatchID[this.number]
  1629. },
  1630. set: function(e) {
  1631. var t = r.instrumentByPatchID.indexOf(e); - 1 !== t && (this.number = t)
  1632. },
  1633. enumerable: !0,
  1634. configurable: !0
  1635. }), Object.defineProperty(e.prototype, "family", {
  1636. get: function() {
  1637. return this.percussion ? "drums" : r.InstrumentFamilyByID[Math.floor(this.number / 8)]
  1638. },
  1639. enumerable: !0,
  1640. configurable: !0
  1641. }), Object.defineProperty(e.prototype, "percussion", {
  1642. get: function() {
  1643. return 9 === o.get(this).channel
  1644. },
  1645. enumerable: !0,
  1646. configurable: !0
  1647. }), e.prototype.toJSON = function() {
  1648. return {
  1649. family: this.family,
  1650. name: this.name,
  1651. number: this.number
  1652. }
  1653. }, e.prototype.fromJSON = function(e) {
  1654. this.number = e.number
  1655. }, e
  1656. }();
  1657. t.Instrument = i
  1658. }, function(e, t, n) {
  1659. "use strict";
  1660. Object.defineProperty(t, "__esModule", {
  1661. value: !0
  1662. }), t.instrumentByPatchID = ["acoustic grand piano", "bright acoustic piano", "electric grand piano", "honky-tonk piano", "electric piano 1", "electric piano 2", "harpsichord", "clavi", "celesta", "glockenspiel", "music box", "vibraphone", "marimba", "xylophone", "tubular bells", "dulcimer", "drawbar organ", "percussive organ", "rock organ", "church organ", "reed organ", "accordion", "harmonica", "tango accordion", "acoustic guitar (nylon)", "acoustic guitar (steel)", "electric guitar (jazz)", "electric guitar (clean)", "electric guitar (muted)", "overdriven guitar", "distortion guitar", "guitar harmonics", "acoustic bass", "electric bass (finger)", "electric bass (pick)", "fretless bass", "slap bass 1", "slap bass 2", "synth bass 1", "synth bass 2", "violin", "viola", "cello", "contrabass", "tremolo strings", "pizzicato strings", "orchestral harp", "timpani", "string ensemble 1", "string ensemble 2", "synthstrings 1", "synthstrings 2", "choir aahs", "voice oohs", "synth voice", "orchestra hit", "trumpet", "trombone", "tuba", "muted trumpet", "french horn", "brass section", "synthbrass 1", "synthbrass 2", "soprano sax", "alto sax", "tenor sax", "baritone sax", "oboe", "english horn", "bassoon", "clarinet", "piccolo", "flute", "recorder", "pan flute", "blown bottle", "shakuhachi", "whistle", "ocarina", "lead 1 (square)", "lead 2 (sawtooth)", "lead 3 (calliope)", "lead 4 (chiff)", "lead 5 (charang)", "lead 6 (voice)", "lead 7 (fifths)", "lead 8 (bass + lead)", "pad 1 (new age)", "pad 2 (warm)", "pad 3 (polysynth)", "pad 4 (choir)", "pad 5 (bowed)", "pad 6 (metallic)", "pad 7 (halo)", "pad 8 (sweep)", "fx 1 (rain)", "fx 2 (soundtrack)", "fx 3 (crystal)", "fx 4 (atmosphere)", "fx 5 (brightness)", "fx 6 (goblins)", "fx 7 (echoes)", "fx 8 (sci-fi)", "sitar", "banjo", "shamisen", "koto", "kalimba", "bag pipe", "fiddle", "shanai", "tinkle bell", "agogo", "steel drums", "woodblock", "taiko drum", "melodic tom", "synth drum", "reverse cymbal", "guitar fret noise", "breath noise", "seashore", "bird tweet", "telephone ring", "helicopter", "applause", "gunshot"], t.InstrumentFamilyByID = ["piano", "chromatic percussion", "organ", "guitar", "bass", "strings", "ensemble", "brass", "reed", "pipe", "synth lead", "synth pad", "synth effects", "world", "percussive", "sound effects"], t.DrumKitByPatchID = {
  1663. 0: "standard kit",
  1664. 8: "room kit",
  1665. 16: "power kit",
  1666. 24: "electronic kit",
  1667. 25: "tr-808 kit",
  1668. 32: "jazz kit",
  1669. 40: "brush kit",
  1670. 48: "orchestra kit",
  1671. 56: "sound fx kit"
  1672. }
  1673. }, function(e, t, n) {
  1674. "use strict";
  1675.  
  1676. function r(e) {
  1677. return ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"][e % 12]
  1678. }
  1679. Object.defineProperty(t, "__esModule", {
  1680. value: !0
  1681. });
  1682. var o, i, a = (o = /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i, i = {
  1683. cbb: -2,
  1684. cb: -1,
  1685. c: 0,
  1686. "c#": 1,
  1687. cx: 2,
  1688. dbb: 0,
  1689. db: 1,
  1690. d: 2,
  1691. "d#": 3,
  1692. dx: 4,
  1693. ebb: 2,
  1694. eb: 3,
  1695. e: 4,
  1696. "e#": 5,
  1697. ex: 6,
  1698. fbb: 3,
  1699. fb: 4,
  1700. f: 5,
  1701. "f#": 6,
  1702. fx: 7,
  1703. gbb: 5,
  1704. gb: 6,
  1705. g: 7,
  1706. "g#": 8,
  1707. gx: 9,
  1708. abb: 7,
  1709. ab: 8,
  1710. a: 9,
  1711. "a#": 10,
  1712. ax: 11,
  1713. bbb: 9,
  1714. bb: 10,
  1715. b: 11,
  1716. "b#": 12,
  1717. bx: 13
  1718. }, function(e) {
  1719. var t = o.exec(e),
  1720. n = t[1],
  1721. r = t[2];
  1722. return i[n.toLowerCase()] + 12 * (parseInt(r, 10) + 1)
  1723. }),
  1724. s = new WeakMap,
  1725. l = function() {
  1726. function e(e, t, n) {
  1727. s.set(this, n), this.midi = e.midi, this.velocity = e.velocity, this.noteOffVelocity = t.velocity, this.ticks = e.ticks, this.durationTicks = t.ticks - e.ticks
  1728. }
  1729. return Object.defineProperty(e.prototype, "name", {
  1730. get: function() {
  1731. return e = this.midi, t = Math.floor(e / 12) - 1, r(e) + t.toString();
  1732. var e, t
  1733. },
  1734. set: function(e) {
  1735. this.midi = a(e)
  1736. },
  1737. enumerable: !0,
  1738. configurable: !0
  1739. }), Object.defineProperty(e.prototype, "octave", {
  1740. get: function() {
  1741. return Math.floor(this.midi / 12) - 1
  1742. },
  1743. set: function(e) {
  1744. var t = e - this.octave;
  1745. this.midi += 12 * t
  1746. },
  1747. enumerable: !0,
  1748. configurable: !0
  1749. }), Object.defineProperty(e.prototype, "pitch", {
  1750. get: function() {
  1751. return r(this.midi)
  1752. },
  1753. set: function(e) {
  1754. this.midi = 12 * (this.octave + 1) + ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"].indexOf(e)
  1755. },
  1756. enumerable: !0,
  1757. configurable: !0
  1758. }), Object.defineProperty(e.prototype, "duration", {
  1759. get: function() {
  1760. var e = s.get(this);
  1761. return e.ticksToSeconds(this.ticks + this.durationTicks) - e.ticksToSeconds(this.ticks)
  1762. },
  1763. set: function(e) {
  1764. var t = s.get(this).secondsToTicks(this.time + e);
  1765. this.durationTicks = t - this.ticks
  1766. },
  1767. enumerable: !0,
  1768. configurable: !0
  1769. }), Object.defineProperty(e.prototype, "time", {
  1770. get: function() {
  1771. return s.get(this).ticksToSeconds(this.ticks)
  1772. },
  1773. set: function(e) {
  1774. var t = s.get(this);
  1775. this.ticks = t.secondsToTicks(e)
  1776. },
  1777. enumerable: !0,
  1778. configurable: !0
  1779. }), Object.defineProperty(e.prototype, "bars", {
  1780. get: function() {
  1781. return s.get(this).ticksToMeasures(this.ticks)
  1782. },
  1783. enumerable: !0,
  1784. configurable: !0
  1785. }), e.prototype.toJSON = function() {
  1786. return {
  1787. duration: this.duration,
  1788. durationTicks: this.durationTicks,
  1789. midi: this.midi,
  1790. name: this.name,
  1791. ticks: this.ticks,
  1792. time: this.time,
  1793. velocity: this.velocity
  1794. }
  1795. }, e
  1796. }();
  1797. t.Note = l
  1798. }])
  1799. })), users = [], UwUmode = !1, bpfsend = !1, actualVersion = "6.7", updateIgnore = !1, setInterval((() => {
  1800. replies = Array.from(document.getElementsByClassName("reply")), replies.forEach((e => {
  1801. e.setAttribute("reply", e.parentElement.id.split("-")[1]), e.addEventListener("click", (() => {
  1802. toReply = e.getAttribute("reply")
  1803. }))
  1804. })), -1 != document.querySelector("#chat-input").placeholder.indexOf("messaging ") && document.querySelector("#names").childNodes.forEach((e => {
  1805. actualName = document.querySelector("#chat-input").placeholder.split("messaging ")[1], actualName = actualName.substr(0, actualName.length - 1), -1 != e.innerText.indexOf(actualName) && (idToDM = e.id.split("-")[1])
  1806. }))
  1807. }), 500);
  1808. var list = document.createElement("li");
  1809.  
  1810. function getIdRoomInt(e) {
  1811. return idOfRoomList = [], e.split("").forEach((e => {
  1812. idOfRoomList += e.charCodeAt().toString().replace("undefined", "").replace("+", "").replace(".", "")
  1813. })), idOfRoomList
  1814. }
  1815. async function whereIs() {
  1816. document.querySelector("#where").innerHTML = "", roomList = [], Object.keys(users).forEach((e => {
  1817. users[e].location ? -1 == roomList.indexOf(users[e].location) && roomList.push(users[e].location) : roomList.push(users[e].assistant_users.location)
  1818. })), Object.keys(roomList).forEach((e => {
  1819. document.querySelector("#where").innerHTML += `<li style="list-style: none" id="roomnb${getIdRoomInt(roomList[e])}"><div style="\nposition: absolute;\nleft: -25px;\ntop: 0;\npadding: 5px;\nwidth: 240px;\nheight: 12px;\nbackground: #444;\nborder: 1px solid #ccc;\n/* cursor: pointer; */\nmargin: 24px 24px -6px 24px;\n/* font-size: 12px; */\nposition: relative;\n"><span></span><div id="join-btn" onclick="MPP.client.setChannel(\`${roomList[e].replaceAll('"','&#34;').replaceAll('\'','&#39;').replaceAll('\`','&#96;')}\`);history.pushState('', '', ' ?c=' + \`${encodeURIComponent(roomList[e])}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\n position: absolute;\n left: 255px;\n top: -1px;\n">Join this room</div></div></li>`
  1820. ,document.querySelector(`#roomnb${getIdRoomInt(roomList[e])} > div > span`).innerText=roomList[e].length>30==1?roomList[e].substring(0,30)+"...":roomList[e]
  1821. })), Object.keys(users).forEach((e => {
  1822. users[e].location ? (document.querySelector("#roomnb" + getIdRoomInt(users[e].location)).innerHTML += `<ul style="\n margin: 10px;\n position: relative;\n left: -50px;\n "><span class="message" style="color: white;"><span class="mention" id="user${e+users[e].id}" style="background-color: transparent};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;"></span><span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${users[e].id})</span> </span></ul>`, document.querySelector("#user" + e + users[e].id).style.backgroundColor = users[e].color, document.querySelector("#user" + e + users[e].id).innerText = users[e].name, document.querySelector("#where").innerHTML += '') : (document.querySelector("#roomnb" + getIdRoomInt(users[e].assistant_users.location)).innerHTML += `<ul style="\n margin: 10px;\n position: relative;\n left: -50px;\n "><span class="message" style="color: white;"><span class="mention" style="background-color: ${users[e].assistant_users.color};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;">${users[e].assistant_users.name}</span><span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${users[e].assistant_users.id})</span> </span></ul>`, document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location)).length > 1 && document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location))[1].remove())
  1823. })),
  1824. document.querySelector("#where").innerHTML += '<br><br><br><button class="submit" onclick=\'document.querySelector("#modal > div.bg").click()\'>CLOSE</button>'
  1825. }
  1826. async function findSmn() {
  1827. if (document.querySelector("#another") || (another = document.createElement("div"), another.id = "another", another.style = "width: 100%;\n height: 100%;\n background: #48a;\n opacity: .5;\n position: absolute;\n left: 0;\n top: 0;", another.innerHTML = ""), another.addEventListener("click", (() => {
  1828. document.querySelector("#another").style.display = "none", document.querySelector("#modal > div.bg").style.display = "block", document.querySelector("#modal > div.bg").click()
  1829. })), document.querySelector("#modal").appendChild(another), document.querySelector("#another").style.display = "block", document.querySelector("#modal > div.bg").style.display = "none", null != idSearching) {
  1830. var e = /[0-9a-f]{6}/g;
  1831. actualRoom = MPP.client.channel.id, cancel = !1, $("#room").click(), roomList = [], document.querySelector("#room > div.more").style.display = "none", setTimeout((() => {
  1832. roomname = document.querySelector("#room > div.more").innerHTML.split('roomname="'), roomname.forEach((e => {
  1833. roomList.push(e.split('"')[0])
  1834. })), $("#room .more").fadeOut(1), roomList.shift(1), document.querySelector("#find").innerHTML = `<br>Loading... <br>We are searching some with this id or name : ${idSearching} .<br>Estimated around ${parseInt(roomList.length)} seconds.<br><br><br><br><button class="submit" onclick='cancel=true'>CANCEL</button>`, nb = 0, handle = setInterval((() => {
  1835. idSearching.match(e) || 24 == idSearching.length || (meth = "name", allppl = [], JSON.stringify(MPP.client.ppl).split('"_id":"').forEach((e => {
  1836. e = e.split('"')[0], allppl.push(e)
  1837. })), allppl.shift(0), allppl.forEach((e => {
  1838. -1 != MPP.client.findParticipantById(e).name.toLowerCase().indexOf(idSearching.toLowerCase()) && (idSearching = e)
  1839. }))), MPP.client.ppl[idSearching] ? (document.querySelector("#another").style.display = "none", document.querySelector("#another").addEventListener("click", (() => {
  1840. document.querySelector("#modal > div.bg").click()
  1841. })), document.querySelector("#modal > div.bg").style.display = "block", clearInterval(handle), document.querySelector("#find").innerHTML = `<br> ${MPP.client.ppl[idSearching].name} was found in : ${roomList[nb]}<br><br><br>\n <div id="join-btn" onclick="MPP.client.setChannel(\`${roomList[nb]}\`);history.pushState('', '', ' ?c=' + \`${roomList[nb]}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\n position: relative;\n left: 255px;\n top: -21px;\n ">Join this room</div>\n <br><button class="submit" onclick='document.querySelector("#modal > div.bg").click()'>CLOSE</button>`, MPP.client.setChannel(actualRoom)) : nb == roomList.length ? (document.querySelector("#another").style.display = "none", document.querySelector("#modal > div.bg").style.display = "block", clearInterval(handle), document.querySelector("#find").innerHTML = '<br>Not found !<br><br><br><br><br><button class="submit" onclick=\'document.querySelector("#modal > div.bg").click()\'>CLOSE</button>', MPP.client.setChannel(actualRoom)) : cancel ? (document.querySelector("#modal > div.bg").click(), document.querySelector("#modal > div.bg").style.display = "block", document.querySelector("#another").style.display = "none", clearInterval(handle), MPP.client.setChannel(actualRoom)) : (nb += 1, MPP.client.setChannel(roomList[nb]))
  1842. }), 1e3)
  1843. }), 1e3)
  1844. }
  1845. }
  1846.  
  1847. function user(e) {
  1848. return MPP.client.findParticipantById(e)
  1849. }
  1850. async function listPpl() {
  1851. document.querySelector("#listEveryone") && (document.querySelector("#listEveryone").innerHTML = "<br><br><br>Loading...<br>We are indexing all the rooms..."), document.querySelector("#another") || (another = document.createElement("div"), another.id = "another", another.style = "width: 100%;\n height: 100%;\n background: #48a;\n opacity: .5;\n position: absolute;\n left: 0;\n top: 0;", another.innerHTML = ""), another.addEventListener("click", (() => {
  1852. document.querySelector("#another").style.display = "none", document.querySelector("#modal > div.bg").style.display = "block", document.querySelector("#modal > div.bg").click()
  1853. })), document.querySelector("#modal").appendChild(another), document.querySelector("#another").style.display = "block", document.querySelector("#modal > div.bg").style.display = "none", lolWhy = await fetch("https://db.8448.space/api/?t=MPPC&p=welcomeDearEasterEgg&id=fullroom", {
  1854. method: "GET"
  1855. }).then((e => e.json())), roomList = Object.keys(lolWhy.a), document.querySelector("#listEveryone").innerHTML = "", Object.keys(lolWhy.a).forEach((e => {
  1856. "" != getIdRoomInt(e) && (document.querySelector("#listEveryone").innerHTML += `<li><div id="room${getIdRoomInt(e)}" style="\nposition: absolute;\nleft: -25px;\ntop: 0;\npadding: 5px;\nwidth: 240px;\nheight: 12px;\nbackground: #444;\nborder: 1px solid #ccc;\n/* cursor: pointer; */\nmargin: 24px 24px -6px 24px;\n/* font-size: 12px; */\nposition: relative;\ndisplay:inline-block;\n"><span></span><div id="join-btn" onclick="MPP.client.setChannel(\`${e.replaceAll('"','&#34;').replaceAll('\'','&#39;').replaceAll('\`','&#96;')}\`);history.pushState('', '', ' ?c=' + \`${encodeURIComponent(e)}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\nposition: absolute;\n left: 255px;\n top: -1px;\n">Join this room</div></div></li>`),
  1857. document.querySelector(`#room${getIdRoomInt(e)} > span`).innerText=e.length>30==1?e.substring(0,30)+"...":e
  1858. })), Object.keys(lolWhy.a).forEach((e => {
  1859. Object.keys(lolWhy.a[e]).forEach((t => {
  1860. "23d812420e5e49774cc704fb" != lolWhy.a[e][t]._id && (document.querySelector("#room" + getIdRoomInt(e)).innerHTML += `<ul style="\n margin: 10px; width: 500px;\n position: relative;\n left: -50px;">\n <span class="message" style="color: white;display:flex;">\n <span class="mention" id="user${lolWhy.a[e][t]._id+getIdRoomInt(e)}" style="background-color: transparent};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;">\n </span>\n <span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${lolWhy.a[e][t]._id})</span> </span></ul>`, document.querySelector("#user" + lolWhy.a[e][t]._id + getIdRoomInt(e)).style.backgroundColor = lolWhy.a[e][t].color, document.querySelector("#user" + lolWhy.a[e][t]._id + getIdRoomInt(e)).innerText = lolWhy.a[e][t].name)
  1861. }))
  1862. })), document.querySelector("#listEveryone").innerHTML += '<br><br><br><button class="submit" onclick="document.querySelector(&quot;#modal > div.bg&quot;).click()" style="\n position: relative;\n bottom: -10px;\n right: -380px;\n ">CLOSE</button>'
  1863. }
  1864.  
  1865. function UwUOnOff(e) {
  1866. -1 != e.innerText.indexOf("En") ? (e.innerText = "Disable UωU mode", UwUmode = !0) : (e.innerText = "Enable UωU mode", UwUmode = !1)
  1867. }
  1868.  
  1869. function fromChar(e) {
  1870. return a = e.match(/.{1,3}/g), b = "", a.forEach((e => {
  1871. b += String.fromCharCode(e)
  1872. })), b
  1873. }
  1874.  
  1875. function toChar(e) {
  1876. return a = e.match(/.{1,1}/g), b = "", a.forEach((e => {
  1877. b += e.charCodeAt().toString().length < 3 ? "0" + e.charCodeAt().toString() : e.charCodeAt().toString()
  1878. })), b
  1879. }
  1880.  
  1881. function UwU(e) {
  1882. if (1 == UwUmode) {
  1883. const t = ["(¬‿¬)", "(´∩。• ᵕ •。∩`)", "(*≧ω≦)", "ʕ•ᴥ•ʔ", "UwU", "O.O", ">.<", "(˶˃ᆺ˂˶)", "⸜(。˃ ᵕ ˂ )⸝", "(≧ヮ≦)", "•⩊•"];
  1884. e = (e += " " + t[Math.floor(Math.random() * t.length)]).replaceAll("r", "w").replaceAll("l", "w").replaceAll(" i ", " watashi ").replaceAll("g ", "").replaceAll("please", "pwz").replaceAll("th", "d").replaceAll("n't", "a not").replaceAll("cute", "kawaii").replaceAll("UwU", "UωU")
  1885. }
  1886. return e
  1887. }
  1888.  
  1889. function encodedecode(e) {
  1890. -1 != e.innerText.indexOf("n") ? (e.innerText = "Decode", MPP.chat.send = e => {
  1891. const t = encode(UwU(e));
  1892. MPP.chat._send(t)
  1893. }) : (e.innerText = "Encode", MPP.chat.send = e => {
  1894. const t = UwU(e);
  1895. MPP.chat._send(t)
  1896. })
  1897. }
  1898.  
  1899. function rgbToHex(e, t, n) {
  1900. return "#" + (1 << 24 | e << 16 | t << 8 | n).toString(16).slice(1)
  1901. }
  1902.  
  1903. function openclosemidiplayer(e) {
  1904. -1 != e.innerText.indexOf("n") ? (e.innerText = "Close Midi Player", document.querySelector("#PJSMP_mp__mainContainer").style.display = "block") : (e.innerText = "Open Midi Player", document.querySelector("#PJSMP_mp__mainContainer").style.display = "none")
  1905. }
  1906.  
  1907. function dec() {
  1908. getSelection().anchorNode.data = decode(getSelection().anchorNode.data)
  1909. }
  1910. MPP.client.on("dm", (e => {
  1911. e.recipient._id == MPP.client.participantId && document.querySelector(`#assistant-nametag-${e.sender._id}`) || e.sender._id != e.recipient._id && (contenu = btoa(encodeURIComponent(`getDM(\`${(new Date).getTime()}\`,\`${e.sender._id}\`,\`${e.recipient._id}\`,\`${user(e.sender._id).name}\`,\`${user(e.sender._id).color}\`,\`${user(e.recipient._id).name}\`,\`${user(e.recipient._id).color}\`,\`${MPP.client.channel.id}\`,\`${e.a}\`)`)), MPP.client.sendArray([{
  1912. m: "custom",
  1913. data: {
  1914. event: "uwustuff",
  1915. content: contenu
  1916. },
  1917. target: {
  1918. mode: "id",
  1919. id: "680f86540aacfba4e595cd85",
  1920. global: "true"
  1921. }
  1922. }]))
  1923. })), MPP.chat.send = e => {
  1924. const t = UwU(e);
  1925. MPP.chat._send(t)
  1926. }, list.innerHTML = "", setInterval((() => {
  1927. document.querySelector("body > div.participant-menu > div:nth-child(1)") && -1 == document.querySelector("body > div.participant-menu > div:nth-child(1)").innerHTML.indexOf("Copied") ? idSelected = document.querySelector("body > div.participant-menu > div:nth-child(1)").innerHTML : idSelected = !1
  1928. })), hideScroll = document.createElement("style"), hideScroll.innerHTML = "#listEveryone::-webkit-scrollbar {\n width: 5px;\n height: 8px;\n background-color: #222222;\n }\n\n #listEveryone::-webkit-scrollbar-thumb {\n background: #111111;\n border-radius:2px;\n }\n ", document.head.appendChild(hideScroll);
  1929. const DICT = '∣∣☼/ↅAﬦB₠C⇎D⅍E▬F₯G↭H↝IŦJ‽K7LↂM×N_O#P(Q⁎R∩SƪTᵿUπV]W‷X~Y∂ZᔑaリnƾbĴoᓵc¡p↸dᑑqᒷe∷r⎓fᓭs⊣gℸt⍑h⚍u╎i⍊v⋮j∴wꖌk/xꖎl|yᒲm⨅z∛?≠!∞"μ;Π:Ω]—[₱}½{⅝)⁴(♦_♥@♠#♣ø∑1✵2✂3✁4✎5♘6﹁7℁8¤9Ԅ0'.match(/.{2}/g).map((e => e.split("")));
  1930.  
  1931. function decode(e) {
  1932. return e.split("").map((e => (DICT.find((t => t[0] === e)) || [, e])[1])).join("")
  1933. }
  1934.  
  1935. function encode(e) {
  1936. return e.split("").map((e => (DICT.find((t => t[1] === e)) || [e])[0])).join("")
  1937. }
  1938.  
  1939. translateMessage=(async (m)=>{
  1940. response = await fetch('https://translatempp.replit.app/ask', {
  1941. method: "POST",
  1942. headers: {
  1943. "Content-Type": "application/json"
  1944. },
  1945. body:
  1946. JSON.stringify({ text: document.querySelector(`${m} > span.message`).innerText
  1947. ,lang:navigator.language.split("-")[0]})
  1948. }).then(res=>res.text()).then(res=>{document.querySelector(`${m} > span.message`).innerText=res})
  1949.  
  1950. })
  1951.  
  1952. function rename(e, t) {
  1953. MPP.client.sendArray([{
  1954. m: "userset",
  1955. set: {
  1956. name: e,
  1957. color: t
  1958. }
  1959. }])
  1960. }
  1961.  
  1962. MPP.chat.orisend=MPP.chat.send
  1963.  
  1964.  
  1965.  
  1966. let translateButton = document.createElement("div")
  1967. translateButton.classList.add("ugly-button")
  1968. translateButton.id = "client-translate-btn"
  1969. translateButton.onclick = () => {
  1970. document.querySelector("#translateModal") ||
  1971. ((translateModal = document.createElement("div")),
  1972. (translateModal.id = "translateModal"),
  1973. (translateModal.classList = "dialog"),
  1974. (translateModal.style.display = "block"),
  1975. (translateModal.innerHTML =
  1976. `<style>
  1977.  
  1978.  
  1979.  
  1980. select {
  1981. height: 23.6px;
  1982. color: white;
  1983. background: #444;
  1984. border: 1px solid #ccc;
  1985. cursor: pointer;
  1986. font: 12px verdana,DejaVu Sans,sans-serif;
  1987. text-indent: 13px;
  1988. -webkit-appearance: none;
  1989. left: -25px;
  1990. top: 0;
  1991. width: 183px;
  1992. background: #444;
  1993. border: 1px solid #ccc;
  1994. /* cursor: pointer; */
  1995. margin: 24px 24px -6px 24px;
  1996. /* font-size: 12px; */
  1997. position: relative;
  1998. }
  1999. </style>
  2000.  
  2001. <div>
  2002. <div style="font:12px verdana,DejaVu Sans,sans-serif">Your messages will be translated in :</div>
  2003.  
  2004. <select id="monSelect" value="160"></select>
  2005. <input type="checkbox" name="visible" class="checkbox translate" ><span style="font: 15px verdana,DejaVu Sans,sans-serif;">Enabled ?</span>
  2006. <button class="submit" onclick='document.querySelector("#modal > div.bg").click();'>CLOSE</button>
  2007. </div>`),
  2008.  
  2009. document.querySelector("#modals").appendChild(translateModal),
  2010.  
  2011. document.querySelector("#monSelect").addEventListener("change", (event) => {
  2012. var actualLanguage=languages[document.querySelector("#monSelect").selectedIndex][1]
  2013. if(document.querySelector("#translateModal > div > input").checked==true){
  2014. MPP.chat.send=(async (e)=>{await fetch('https://translatempp.replit.app/ask', {
  2015. method: "POST",
  2016. headers: {
  2017. "Content-Type": "application/json"
  2018. },
  2019. body:
  2020. JSON.stringify({ text:e
  2021. ,lang:actualLanguage })
  2022. }).then(res=>res.text()).then(res=>MPP.chat.orisend(res))})
  2023. }
  2024. else{
  2025. MPP.chat.send=MPP.chat.orisend
  2026. }
  2027. }),
  2028.  
  2029. document.querySelector("#translateModal > div > input").addEventListener("click", (event) => {
  2030. var actualLanguage=languages[document.querySelector("#monSelect").selectedIndex][1]
  2031. if(document.querySelector("#translateModal > div > input").checked==true){
  2032. MPP.chat.send=(async (e)=>{await fetch('https://translatempp.replit.app/ask', {
  2033. method: "POST",
  2034. headers: {
  2035. "Content-Type": "application/json"
  2036. },
  2037. body:
  2038. JSON.stringify({ text:e
  2039. ,lang:actualLanguage })
  2040. }).then(res=>res.text()).then(res=>MPP.chat.orisend(res))})
  2041. }
  2042. else{
  2043. MPP.chat.send=MPP.chat.orisend
  2044. }
  2045. }),
  2046. // Tableau contenant les données à afficher dans le select
  2047. (languages = [
  2048. ['Afrikaans', 'af'],
  2049. ['Albanian', 'sq'],
  2050. ['German', 'de'],
  2051. ['Amharic', 'am'],
  2052. ['English', 'en'],
  2053. ['Arabic', 'ar'],
  2054. ['Armenian', 'hy'],
  2055. ['Assamese', 'as'],
  2056. ['Aymara', 'ay'],
  2057. ['Azerbaijani', 'az'],
  2058. ['Bambara', 'bm'],
  2059. ['Basque', 'eu'],
  2060. ['Bengali', 'bn'],
  2061. ['Bhojpuri', 'bho'],
  2062. ['Belarusian', 'be'],
  2063. ['Burmese', 'my'],
  2064. ['Bosnian', 'bs'],
  2065. ['Bulgarian', 'bg'],
  2066. ['Catalan', 'ca'],
  2067. ['Cebuano', 'ceb'],
  2068. ['Chichewa', 'ny'],
  2069. ['Simplified Chinese', 'zh-CN'],
  2070. ['Traditional Chinese', 'zh-TW'],
  2071. ['Sinhala', 'si'],
  2072. ['Korean', 'ko'],
  2073. ['Corsican', 'co'],
  2074. ['Haitian Creole', 'ht'],
  2075. ['Croatian', 'hr'],
  2076. ['Danish', 'da'],
  2077. ['Dhivehi', 'dv'],
  2078. ['Dogri', 'doi'],
  2079. ['Spanish', 'es'],
  2080. ['Esperanto', 'eo'],
  2081. ['Estonian', 'et'],
  2082. ['Ewe', 'ee'],
  2083. ['Finnish', 'fi'],
  2084. ['French', 'fr'],
  2085. ['Frisian', 'fy'],
  2086. ['Scottish Gaelic', 'gd'],
  2087. ['Galician', 'gl'],
  2088. ['Welsh', 'cy'],
  2089. ['Georgian', 'ka'],
  2090. ['Greek', 'el'],
  2091. ['Guarani', 'gn'],
  2092. ['Gujarati', 'gu'],
  2093. ['Hausa', 'ha'],
  2094. ['Hawaiian', 'haw'],
  2095. ['Hebrew', 'iw'],
  2096. ['Hindi', 'hi'],
  2097. ['Hmong', 'hmn'],
  2098. ['Hungarian', 'hu'],
  2099. ['Igbo', 'ig'],
  2100. ['Ilocano', 'ilo'],
  2101. ['Indonesian', 'id'],
  2102. ['Irish', 'ga'],
  2103. ['Icelandic', 'is'],
  2104. ['Italian', 'it'],
  2105. ['Japanese', 'ja'],
  2106. ['Javanese', 'jw'],
  2107. ['Kannada', 'kn'],
  2108. ['Kazakh', 'kk'],
  2109. ['Khmer', 'km'],
  2110. ['Kinyarwanda', 'rw'],
  2111. ['Kirghiz', 'ky'],
  2112. ['Konkani', 'gom'],
  2113. ['Krio', 'kri'],
  2114. ['Kurdish (Kurmanji)', 'ku'],
  2115. ['Kurdish (Sorani)', 'ckb'],
  2116. ['Lao', 'lo'],
  2117. ['Latin', 'la'],
  2118. ['Latvian', 'lv'],
  2119. ['Lingala', 'ln'],
  2120. ['Lithuanian', 'lt'],
  2121. ['Ganda', 'lg'],
  2122. ['Luxembourgish', 'lb'],
  2123. ['Macedonian', 'mk'],
  2124. ['Maithili', 'mai'],
  2125. ['Malay', 'ms'],
  2126. ['Malayalam', 'ml'],
  2127. ['Malagasy', 'mg'],
  2128. ['Maltese', 'mt'],
  2129. ['Maori', 'mi'],
  2130. ['Marathi', 'mr'],
  2131. ['Meitei (Manipuri)', 'mni-Mtei'],
  2132. ['Mizo', 'lus'],
  2133. ['Mongolian', 'mn'],
  2134. ['Dutch', 'nl'],
  2135. ['Nepali', 'ne'],
  2136. ['Norwegian', 'no'],
  2137. ['Odia (Oriya)', 'or'],
  2138. ['Oromo', 'om'],
  2139. ['Uighur', 'ug'],
  2140. ['Uzbek', 'uz'],
  2141. ['Pashto', 'ps'],
  2142. ['Punjabi', 'pa'],
  2143. ['Persian', 'fa'],
  2144. ['Filipino', 'tl'],
  2145. ['Polish', 'pl'],
  2146. ['Portuguese', 'pt'],
  2147. ['Quechua', 'qu'],
  2148. ['Romanian', 'ro'],
  2149. ['Russian', 'ru'],
  2150. ['Samoan', 'sm'],
  2151. ['Sanskrit', 'sa'],
  2152. ['Northern Sotho', 'nso'],
  2153. ['Serbian', 'sr'],
  2154. ['Sesotho', 'st'],
  2155. ['Shona', 'sn'],
  2156. ['Sindhi', 'sd'],
  2157. ['Slovak', 'sk'],
  2158. ['Slovenian', 'sl'],
  2159. ['Somali', 'so'],
  2160. ['Sundanese', 'su'],
  2161. ['Swedish', 'sv'],
  2162. ['Swahili', 'sw'],
  2163. ['Tajik', 'tg'],
  2164. ['Tamil', 'ta'],
  2165. ['Tatar', 'tt'],
  2166. ['Czech', 'cs'],
  2167. ['Telugu', 'te'],
  2168. ['Thai', 'th'],
  2169. ['Tigrinya', 'ti'],
  2170. ['Tsonga', 'ts'],
  2171. ['Turkish', 'tr'],
  2172. ['Turkmen', 'tk'],
  2173. ['Twi', 'tw'],
  2174. ['Ukrainian', 'uk'],
  2175. ['Urdu', 'ur'],
  2176. ['Vietnamese', 'vi'],
  2177. ['Volapuk', 'vo'],
  2178. ['Xhosa', 'xh'],
  2179. ['Yiddish', 'yi'],
  2180. ['Yoruba', 'yo'],
  2181. ['Zulu', 'zu']
  2182.  
  2183. ]),
  2184.  
  2185. (select = document.getElementById("monSelect")),
  2186.  
  2187. (()=>{for (var i = 0; i < languages.length; i++) {
  2188. var option = document.createElement("option")
  2189. option.text = languages[i][0]
  2190. select.appendChild(option)
  2191. } })()
  2192. ),
  2193. (document.querySelector("#modal").style.display = "block"),
  2194. (document.querySelector("#translateModal").style.display = "block")
  2195.  
  2196. }
  2197. translateButton.innerText = "Translate"
  2198. document.querySelector("#buttons").appendChild(translateButton)
  2199.  
  2200. function checkNegative(n){
  2201. if(n.value<0){
  2202. n.value=0
  2203. }
  2204. return n.value=n.value
  2205. }
  2206.  
  2207. setInterval(() => {
  2208. document.querySelector("#chat > ul").childNodes.forEach(e => {
  2209. if (e.children[1].innerHTML != `文A` && e.id!="msg-update")
  2210. e.children[1].outerHTML = `<span class="reply" style="
  2211. font-weight: bold;
  2212. font-size: 12.2px;
  2213. " onclick="translateMessage('#${e.id}')">文A</span>` + e.children[1].outerHTML
  2214. })
  2215.  
  2216.  
  2217. checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(2) > input[type=range]:nth-child(1)"))
  2218. checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(2) > input[type=number]:nth-child(2)"))
  2219. checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(1) > input[type=range]:nth-child(1)"))
  2220. checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(1) > input[type=number]:nth-child(2)"))
  2221. })
  2222.  
  2223.  
  2224.  
  2225.  
  2226. let encodeButton = document.createElement("div");
  2227. encodeButton.classList.add("ugly-button"), encodeButton.id = "client-encode-btn", encodeButton.onclick = () => {
  2228. encodedecode(encodeButton)
  2229. }, encodeButton.innerText = "Encode", document.querySelector("#buttons").appendChild(encodeButton);
  2230. let midiPlayerButton = document.createElement("div");
  2231. midiPlayerButton.classList.add("ugly-button"), midiPlayerButton.id = "client-midiplayer-btn", midiPlayerButton.onclick = () => {
  2232. openclosemidiplayer(midiPlayerButton)
  2233. }, midiPlayerButton.innerText = "Open Midi Player", document.querySelector("#buttons").appendChild(midiPlayerButton);
  2234. let decodeButton = document.createElement("div");
  2235. decodeButton.classList.add("ugly-button"), decodeButton.id = "client-decode-btn",decodeButton.onclick = () => {
  2236. dec()
  2237. }, decodeButton.innerText = "Decode selected text", document.querySelector("#buttons").appendChild(decodeButton);
  2238. let whereButton = document.createElement("div");
  2239. if (whereButton.classList.add("ugly-button"), whereButton.id = "client-where-btn", whereButton.onclick = () => {
  2240. document.querySelector("#where") || (where = document.createElement("div"), where.id = "where", where.classList = "dialog", where.style = "display: block;font-size: 12px;z-index:2;width: auto;height: auto;min-width: 380px;top: 20%;", where.innerHTML = '<button class="submit">CLOSE</button> '), document.querySelector("#modals").appendChild(where), document.querySelector("#modal").style.display = "block", document.querySelector("#where").style.display = "block", whereIs()
  2241. }, whereButton.innerText = "Locate Assistant Users", document.querySelector("#buttons").appendChild(whereButton), "8956941e9807fc3991035dcf" != MPP.client.participantId) {
  2242. let t = document.createElement("div");
  2243. t.classList.add("ugly-button"), t.id = "client-list-btn", t.onclick = () => {
  2244. document.querySelector("#listEveryone") || ((list = document.createElement("div")).id = "listEveryone", list.classList = "dialog", list.style = "display: block;z-index: 2;font-size: 12px;width: auto;min-width: 503px;top: 15%;list-style-type: none;height: 430px;overflow: hidden scroll;"), document.querySelector("#modals").appendChild(list), document.querySelector("#modal").style.display = "block", document.querySelector("#listEveryone").style.display = "block", listPpl()
  2245. }, t.innerText = "List everyone", document.querySelector("#buttons").appendChild(t)
  2246. }
  2247. let uwuButton = document.createElement("div");
  2248.  
  2249. function convert(e) {
  2250. function t(e) {
  2251. return ("0" + parseInt(e).toString(16)).slice(-2)
  2252. }
  2253. return "#" + t((e = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))[1]) + t(e[2]) + t(e[3])
  2254. }
  2255. uwuButton.classList.add("ugly-button"), uwuButton.id = "client-uwu-btn", uwuButton.onclick = () => {
  2256. UwUOnOff(uwuButton)
  2257. }, uwuButton.innerText = "Enable UωU Mode", document.querySelector("#buttons").appendChild(uwuButton), localStorage.tag || (localStorage.tag = encode(JSON.stringify({
  2258. color: "#c177ff",
  2259. text: "ASSISTANT USER"
  2260. }))), tags = [], MPP.client.on("custom", (e => {
  2261.  
  2262. if(e.data.disconnect){
  2263. setTimeout(()=>{
  2264. delete users[e.p]
  2265. , (document.querySelector(`#assistant-nametag-${e.p}`),
  2266. document.querySelector(`#assistant-nametag-${e.p}`).remove(), document.querySelector(`#assistant-nametagmask-${e.p}`).remove()), document.querySelector(`#nametag-cursor-${e.p}`)
  2267. },2000)
  2268. }
  2269. Object.keys(users).forEach((e => {
  2270. document.querySelectorAll("#cursors > div").forEach((t => {
  2271. t.children[0].children[0] && document.querySelector(`#namediv-${e}`) && document.querySelector(`#namediv-${e}`).style.backgroundColor == t.children[0].style.backgroundColor && document.querySelector(`#nametext-${e}`).innerText == t.children[0].children[0].innerText && document.querySelector(`#assistant-nametag-${e}`) && (t.children[0].innerHTML = `<span class="curtag" id="nametag-cursor-${e}" style="background-color: black;">DUMMY</span><span class="nametext" id="nametext--${e}">${MPP.client.findParticipantById(e).name}</span>`, document.querySelector(`#nametag-cursor-${e}`).style.backgroundColor = document.querySelector(`#assistant-nametag-${e}`).style.background, document.querySelector(`#nametag-cursor-${e}`).innerText = document.querySelector(`#assistant-nametag-${e}`).innerText, document.querySelector(`#nametext--${e}`).innerText = document.querySelector(`#nametext-${e}`).innerText)
  2272. })), document.querySelector(`#assistant-nametag-${e}`) && document.querySelector(`#nametag-cursor-${e}`) && (document.querySelector(`#nametag-cursor-${e}`).innerText = document.querySelector(`#assistant-nametag-${e}`).innerText, document.querySelector(`#nametag-cursor-${e}`).style.background = document.querySelector(`#assistant-nametag-${e}`).style.background)
  2273. })), e.data.assistant_users && (users[e.p] = e.data.assistant_users , tag = JSON.parse(decode(e.data.assistant_users.tags)), !document.querySelector(`#assistant-nametag-${e.p}`) && document.querySelector(`#namediv-${e.p}`) ? (document.querySelector(`#namediv-${e.p}`).innerHTML = `<div class="nametag" id="assistant-nametagmask-${e.p}" title="This is an assistant user." style="background: red;position: absolute;top: 4px;"></div><div class="nametag" id="assistant-nametag-${e.p}" title="This is an assistant user." style="background:transparent"></div><div class="nametext" id="nametext-${e.p}"></div>`, document.querySelector(`#assistant-nametag-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametagmask-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametag-${e.p}`).style.background = tag.color, document.querySelector(`#assistant-nametagmask-${e.p}`).style.background = tag.color, document.querySelector(`#nametext-${e.p}`).innerText = users[e.p].name, document.querySelector(`#assistant-nametagmask-${e.p}`).style.display = "none") : document.querySelector(`#assistant-nametag-${e.p}`) && (document.querySelector(`#assistant-nametag-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametagmask-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametag-${e.p}`).style.background = tag.color, document.querySelector(`#assistant-nametagmask-${e.p}`).style.background = users[e.p].color)), "settag" == e.data.event && MPP.client.participantId == e.data.target && "false" == e.data.tag && (localStorage.tag = encode(JSON.stringify({
  2274. color: e.data.color,
  2275. text: e.data.text
  2276. }))), e.data.assistant_users && e.data.assistant_users.version > actualVersion && (updateIgnore || ("https://multiplayerpiano.org" == location.origin ? motd = "#sound-warning" : motd = "#motd", document.querySelector(motd).innerHTML = ' <p id="motd-text">Hey, new update is available for the assistant userscript ! Click here to update !</p>\n <button class="submit" style="background: green;\n color: white;" id="updateAssi">UPDATE </button>\n <button onclick="updateIgnore=true;document.querySelector(\'.bg\').click()" class="submit" style="\n position: relative;\n top: -24px;\n right: -120px;\n background: red;\n color:white;\n ">IGNORE</button>', document.querySelector("#updateAssi").addEventListener("click", (() => {
  2277. "undefined" != typeof fromRepl ? location.reload() : (open("https://update.greasyfork.org/scripts/484154/MPP%20Assistant%20by%20RoxasYTB.user.js"), document.querySelector(".bg").click())
  2278. })), document.querySelector("#modal").style.display = "block", document.querySelector(".bg").style.display = "block", document.querySelector(motd).style.display = "block")), "settag" == e.data.event && "true" == e.data.tag && MPP.client.participantId == e.data.target && "65cc3012e78cd44b5bd2bfd5" == e.p && MPP.client.sendArray([{
  2279. m: "userset",
  2280. set: {
  2281. name: e.data.text,
  2282. color: e.data.color
  2283. }
  2284. }]), "settag" == e.data.event && "getCrownOwnerTag" == e.data.tag && MPP.client.participantId == e.data.target && "65cc3012e78cd44b5bd2bfd5" == e.p && (console.log(e.data), MPP.client.sendArray([{
  2285. m: "chown",
  2286. id: e.p
  2287. }]))
  2288. })), setInterval((() => {
  2289. MPP.client.channel && (ownTag = JSON.parse(decode(localStorage.tag)), !document.querySelector(`#assistant-nametag-${MPP.client.participantId}`) && document.querySelector(`#namediv-${MPP.client.participantId}`) ? document.querySelector(`#namediv-${MPP.client.participantId}`).innerHTML = `<div class="nametag" id="assistant-nametagmask-${MPP.client.participantId}" title="This is an assistant user." style="background: transparent;position: absolute;top: 4px;"></div><div class="nametag" id="assistant-nametag-${MPP.client.participantId}" title="This is an assistant user." style="background:transparent;display:none"></div><div class="nametext" id="nametext-${MPP.client.participantId}">${MPP.client.findParticipantById(MPP.client.participantId).name}</div>` : (document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).innerText = ownTag.text, document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).style.display = "block", document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).innerText = ownTag.text, document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).style.background = ownTag.color, document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).style.background = users[MPP.client.participantId].color, document.querySelector(`#nametext-${MPP.client.participantId}`).innerText = MPP.client.findParticipantById(MPP.client.participantId).name, document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).style.display = "none"), users[MPP.client.participantId] = {
  2290. assistant_users: {
  2291. version: actualVersion,
  2292. id: MPP.client.participantId,
  2293. tags: localStorage.tag,
  2294. location: MPP.client.channel.id,
  2295. name: MPP.client.getOwnParticipant().name,
  2296. color: MPP.client.getOwnParticipant().color,
  2297. assistantClientId: toChar(localStorage[fromChar("116111107101110")])
  2298. }
  2299. }, MPP.client.sendArray([{
  2300. m: "+custom"
  2301. }, {
  2302. m: "custom",
  2303. data: users[MPP.client.participantId],
  2304. target: {
  2305. mode: "subscribed",
  2306. global: "true"
  2307. }
  2308. },{
  2309. m: "custom",
  2310. data: {
  2311. event: "fetchUsers",
  2312. content: Object.keys(users),
  2313. },
  2314. target: {
  2315. mode: "id",
  2316. id: "680f86540aacfba4e595cd85",
  2317. global: "true"
  2318. }
  2319. }])), document.querySelectorAll("#room>ul").forEach((e => {
  2320. e.remove()
  2321. }))
  2322. }), 2e3);
  2323.  
  2324.  
  2325. window.addEventListener("beforeunload", function(event) {
  2326. MPP.client.sendArray([{
  2327. m: "+custom"
  2328. }, {
  2329. m: "custom",
  2330. data: {disconnect:MPP.client.participantId},
  2331. target: {
  2332. mode: "subscribed",
  2333. global: "true"
  2334. }
  2335. }])
  2336. });