// ==UserScript==
// @license MIT
// @name MPP Assistant by RoxasYTB
// @namespace http://tampermonkey.net/
// @version 1.6
// @description For Multiplayer Piano
// @author RoxasYTB
// @match *://multiplayerpiano.net/*
// @match *://multiplayerpiano.org/*
// @match *://mppclone.com/*
// @match *://mpp.terrium.net/*
// @match *://piano.ourworldofpixels.com/*
// @grant none
// ==/UserScript==
(function () {
//MIDI PLAYER
console.clear(),
console.log(
"%c Piano Assistant by Roxas !",
"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 = {
en: {
play: "Play",
pause: "Pause",
stop: "Stop",
fix: "Fix",
options: {
sustain: "Sustain",
sustainTitle: "Keep notes sustained",
loop: "Loop",
loopTitle: "Restart the song at it's end",
asynchrony: "Asynchrony",
asynchronyTitle: "Add or remove a random asynchrony to the notes",
notequota: "NoteQuota",
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",
},
sliders: {
velocityIncrement: "Velocity Increment",
speed: "Song Speed",
},
origin: {
octave: "Origin Octave",
transpose: "Origin Pitch",
},
text: {
noMidiLoad: "No midi file loaded",
chooseMidi: "Choose a midi file",
error: {
midiPlayError: "Unable to play midi file",
midiLoadError: "Unable to load midi file",
},
tracks: "Tracks",
notes: "Notes",
notePerSecond: "Amount of notes per second requested by " + PJSMP_mp__moduleName + "\nDisable sustain for less requests",
openWindow: "Open program window",
closeWindow: "Minimize program window",
playing: "Now playing",
thxTo: "English translation by NaN-NaN-senpai(BR)",
},
},
fr: {
play: "Jouer",
pause: "Pause",
stop: "Stop",
fix: "Réini.",
options: {
sustain: "Sustain",
sustainTitle: "Garde les notes plus longtemps",
loop: "En boucle",
loopTitle: "Recommence la musique",
asynchrony: "Désynchro",
asynchronyTitle: "Désynchronise vos notes",
notequota: "Note Quota",
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",
},
sliders: {
velocityIncrement: "Puissance",
speed: "Vitesse",
},
origin: {
octave: "Octave d'origine",
transpose: "Note d'origine",
},
text: {
noMidiLoad: "Pas de MIDI chargé",
chooseMidi: "Choix du fichier MIDI",
error: {
midiPlayError: "Ne peut pas jouer le fichier",
midiLoadError: "Ne peut pas charger le fichier",
},
tracks: "Tracks",
notes: "Notes",
notePerSecond: "Quantité de notes par seconde demandées par " + PJSMP_mp__moduleName + "\nDésactiver le maintien pour moins de requêtes",
openWindow: "Ouvrir la fenêtre du programe",
closeWindow: "Minimiser",
playing: "En train de jouer",
thxTo: "Traduction francaise par RoxasYTB",
},
},
}),
(window.PJSMP_mp__translate = (e) => {
var t,
n,
r = window.PJSMP_mp__debugLenguage || navigator.language || navigator.userLanguage,
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)];
return (
e
.replace(/\./g, " ")
.split(" ")
.forEach((e) => {
(t = (null == t ? o : t)[e]), (n = (null == n ? PJSMP_mp__translations.en : n)[e]);
}),
null == t ? n : t
);
}),
(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 ? 0.5 : t) + ")"
)),
(window.PJSMP_mp__colors = {
on: "rgba(11, 133, 0, 1)",
off: "rgba(255, 34, 31, 1)",
darkerOn: "rgba(11, 50, 0, 1)",
darkerOff: "rgba(90, 14, 11, 1)",
darkerBg: "rgba(20, 20, 20, .7)",
secondBg: "rgba(157, 154, 150, 0.35)",
bgColor: PJSMP_mp__convertHex(PJSMP_mp__playerColor),
bgColor2: PJSMP_mp__convertHex(PJSMP_mp__playerColor, 0.9),
}),
MPP.client.on("a", function (e) {
if (["player version", "player v", "pjsmp version", "pjsmp v", "pjsmp module", "pjsmp m"].includes(e.a.toLowerCase())) {
var t = "(" + (String(new Date().getHours()).padStart(2, "0") + ":" + String(new Date().getMinutes()).padStart(2, "0")) + "): ";
MPP.chat.send(t + "using " + PJSMP_mp__moduleName + " - v" + PJSMP_mp__version);
}
}),
(window.PJSMP_mp__setBtnTextColor = (e, t, n) => {
(e.style.color = t), (e.style.textShadow = "0px 0px " + ("number" != typeof n ? "5px" : n + "px") + " " + t);
}),
(window.PJSMP_mp__controllers = {
sustain: {
state: !0,
},
loop: {
state: !1,
},
asynchrony: {
state: !1,
},
notequota: {
state: !1,
},
velocityIncrement: {
state: !1,
value: 0,
default: 0,
},
speed: {
state: !1,
value: 1,
default: 1,
},
originOctave: {
state: !0,
value: 0,
default: 0,
},
originTranspose: {
state: !0,
value: 0,
default: 0,
},
}),
(window.PJSMP_mp__windowMinimized = !1),
(window.PJSMP_mp__NPS = 0);
var PJSMP_mp__NPS_interval = setInterval(() => {
var e = PJSMP_mp__NPS * (PJSMP_mp__controllers.sustain.state ? 2 : 1);
(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);
}, 100);
if (!document.querySelector("#PJSMP_mp__mainContainer")) {
var PJSMP_mp__mainContainer = document.createElement("div");
(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)");
var PJSMP_mp__CSS = document.createElement("style");
(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);
var PJSMP_mp__window = document.createElement("div");
(PJSMP_mp__window.id = "PJSMP_mp__window"), (PJSMP_mp__window.className = "PJSMP_mp__window"), (PJSMP_mp__window.style.background = PJSMP_mp__colors.bgColor);
var PJSMP_mp__fileDropContainer = document.createElement("div");
PJSMP_mp__fileDropContainer.id = "PJSMP_mp__fileDropContainer";
var PJSMP_mp__fileDropContainer_textContainer = document.createElement("div");
PJSMP_mp__fileDropContainer_textContainer.id = "PJSMP_mp__fileDropContainer_textContainer";
var PJSMP_mp__fileDropContainer_textContainer_text = document.createElement("p");
(PJSMP_mp__fileDropContainer_textContainer_text.id = "PJSMP_mp__fileDropContainer_textContainer_text"), (PJSMP_mp__fileDropContainer_textContainer_text.innerHTML = PJSMP_mp__translate("text.noMidiLoad"));
var PJSMP_mp__inputFile = document.createElement("input");
(PJSMP_mp__inputFile.id = "PJSMP_mp__inputFile"), (PJSMP_mp__inputFile.type = "file"), (PJSMP_mp__inputFile.accept = "audio/midi");
var PJSMP_mp__fileDropBtn = document.createElement("button");
(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"));
var PJSMP_mp__playBtn = document.createElement("button");
(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);
var PJSMP_mp__stopBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer = document.createElement("div");
(PJSMP_mp__basicControllersContainer.id = "PJSMP_mp__basicControllersContainer"), (PJSMP_mp__basicControllersContainer.style = "float :right;height: 60px;");
var PJSMP_mp__basicControllersContainer_options = document.createElement("div");
(PJSMP_mp__basicControllersContainer_options.id = "PJSMP_mp__basicControllersContainer_options"),
(PJSMP_mp__basicControllersContainer_options.style.float = "right"),
(PJSMP_mp__basicControllersContainer_options.style.marginRight = "5px");
var PJSMP_mp__basicControllersContainer_sustainBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_loopBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_asynchronyBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_notequotaBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_inputRangeContainer = document.createElement("div");
(PJSMP_mp__basicControllersContainer_inputRangeContainer.className = "inputRangeContainer"),
(PJSMP_mp__basicControllersContainer_inputRangeContainer.style = "transform: rotate(90deg);position: relative;left: -50px;zoom: 0.87;top: -65px;");
var PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer = document.createElement("div");
(PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.className = "inputRangeSubContainer"), (PJSMP_mp__basicControllersSubContainer_volumeEncrementContainer.title = PJSMP_mp__translate("sliders.velocityIncrement"));
var PJSMP_mp__basicControllersContainer_volumeEncrementInput = document.createElement("input");
(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);
var PJSMP_mp__basicControllersContainer_volumeEncrementInputNumber = document.createElement("input");
(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);
var PJSMP_mp__basicControllersContainer_volumeEncrementFixBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_volumeEncrementSwitchBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersSubContainer_speedContainer = document.createElement("div");
(PJSMP_mp__basicControllersSubContainer_speedContainer.className = "inputRangeSubContainer"), (PJSMP_mp__basicControllersSubContainer_speedContainer.title = PJSMP_mp__translate("sliders.speed"));
var PJSMP_mp__basicControllersContainer_speedInput = document.createElement("input");
(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);
var PJSMP_mp__basicControllersContainer_speedInputNumber = document.createElement("input");
(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);
var PJSMP_mp__basicControllersContainer_speedFixBtn = document.createElement("button");
(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);
var PJSMP_mp__basicControllersContainer_speedSwitchBtn = document.createElement("button");
(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);
var PJSMP_mp__infoContainer = document.createElement("div");
(PJSMP_mp__infoContainer.id = "PJSMP_mp__infoContainer"), (PJSMP_mp__infoContainer.style.opacity = "0"), (PJSMP_mp__infoContainer.style.transition = "2s");
var PJSMP_mp__infoContainer_duration = document.createElement("span");
(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);
var PJSMP_mp__originContainer = document.createElement("div");
PJSMP_mp__originContainer.id = "PJSMP_mp__originContainer";
var PJSMP_mp__originContainer_controllerOctave = document.createElement("div");
(PJSMP_mp__originContainer_controllerOctave.className = "oringinController"), (PJSMP_mp__originContainer_controllerOctave.title = PJSMP_mp__translate("origin.octave"));
var PJSMP_mp__originContainer_octaveSwitcher = document.createElement("button");
(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);
var PJSMP_mp__originContainer_octaveFix = document.createElement("button");
(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);
var PJSMP_mp__originContainer_octaveInput = document.createElement("input");
(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);
var PJSMP_mp__originContainer_controllerTranspose = document.createElement("div");
(PJSMP_mp__originContainer_controllerTranspose.className = "oringinController"), (PJSMP_mp__originContainer_controllerTranspose.title = PJSMP_mp__translate("origin.transpose"));
var PJSMP_mp__originContainer_transposeSwitcher = document.createElement("button");
(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);
var PJSMP_mp__originContainer_transposeFix = document.createElement("button");
(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);
var PJSMP_mp__originContainer_transposeInput = document.createElement("input");
(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);
var PJSMP_mp__NPSContainer = document.createElement("div");
PJSMP_mp__NPSContainer.id = "PJSMP_mp__NPSContainer";
var PJSMP_mp__NPSContainer_text = document.createElement("span");
(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);
var PJSMP_mp__bottomName = document.createElement("div");
(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()");
var PJSMP_mp__bottomName_text = document.createElement("span");
(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);
var PJSMP_mp__dragAndDrop = document.createElement("div");
(PJSMP_mp__dragAndDrop.id = "PJSMP_mp__dragAndDrop"), (PJSMP_mp__dragAndDrop.title = PJSMP_mp__moduleFullName);
var PJSMP_mp__dragAndDrop_text = document.createElement("span");
(PJSMP_mp__dragAndDrop_text.id = "PJSMP_mp__dragAndDrop_text"), (PJSMP_mp__dragAndDrop_text.innerHTML = PJSMP_mp__moduleName);
var PJSMP_mp__dragAndDrop_ocBtn = document.createElement("button");
(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);
}
(window.PJSMP_mp__dragElement = (e) => {
var t = 0,
n = 0,
r = 0,
o = 0;
function i(i) {
(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");
}
function a() {
(document.onmouseup = null), (document.onmousemove = null);
}
document.getElementById("PJSMP_mp__dragAndDrop").onmousedown = function (e) {
(e = e || window.event).preventDefault(), (r = e.clientX), (o = e.clientY), (document.onmouseup = a), (document.onmousemove = i);
};
}),
PJSMP_mp__dragElement(document.querySelector("#PJSMP_mp__mainContainer")),
(window.PJSMP_mp__minimizeWindow = (e) => {
(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) + ")");
var t = document.querySelector("#PJSMP_mp__window").style;
document.querySelector("#PJSMP_mp__dragAndDrop").style.transition = ".5s";
var n = document.querySelector("#PJSMP_mp__mainContainer").style;
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"));
}),
(window.PJSMP_mp__openChangelog = () => {
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>"
);
}),
(window.PJSMP_mp__optionsBtnHandler = (e, t) => {
(t.state = !t.state), PJSMP_mp__setBtnTextColor(e, t.state ? PJSMP_mp__colors.on : PJSMP_mp__colors.off);
}),
(window.PJSMP_mp__originControllersHandler = (e, t) => {
"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));
}),
(window.PJSMP_mp__sliderHandler = (e, t) => {
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));
else if ("range" == e.type) (t.value = parseFloat(e.value)), (e.parentElement.children[1].value = e.value);
else if ("number" == e.type) {
t.value = parseFloat(e.value);
var n = e.parentElement.children[0];
n.value = t.value < n.min ? n.min : t.value > n.max ? n.max : t.value;
}
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());
}),
(window.PJSMP_mp__playPauseButtonClick = (e) => {
"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"))));
}),
(window.PJSMP_mp__stopButtonClick = () => {
PJSMP_mp__stopFunction(), document.querySelector("#PJSMP_mp__playBtn").innerHTML == PJSMP_mp__translate("pause") && (document.querySelector("#PJSMP_mp__playBtn").innerHTML = PJSMP_mp__translate("play"));
}),
(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) => {
e.tracks.forEach((e) => {
"undefined" == typeof PJSMP_mtc__renderTrack ? PJSMP_mp__renderTrack(e, t) : PJSMP_mtc__renderTrack(e, t);
}),
(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);
}),
(window.PJSMP_mp__playPauseFunction = (e, t) => {
"undefined" != typeof PJSMP_mp__midiJSONobject &&
("play" == e
? (PJSMP_mp__renderMidi(PJSMP_mp__midiJSONobject, t),
(PJSMP_mp__stopInterval = setTimeout(() => {
PJSMP_mp__stopButtonClick(), PJSMP_mp__controllers.loop.state && PJSMP_mp__playPauseButtonClick(document.querySelector("#PJSMP_mp__playBtn"));
}, PJSMP_mp__calcSpeed(PJSMP_mp__endTime - PJSMP_mp__pauseActualNote))))
: "pause" == e &&
((PJSMP_mp__pauseActualNote = PJSMP_mp__actualNote),
PJSMP_mp__notesArr.forEach((e) => {
clearInterval(e);
}),
(PJSMP_mp__notesArr = []),
clearInterval(PJSMP_mp__stopInterval)));
}),
(window.PJSMP_mp__stopFunction = (e, t) => {
PJSMP_mp__notesArr.forEach((e) => {
clearInterval(e);
}),
PJSMP_mp__resetVars(),
PJSMP_mp__setDurationInfo();
}),
(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 = {
doOnce: !0,
}),
(window.PJSMP_mp__renderTrack = (e, t) => {
try {
e.notes
.filter((e) => e.time >= PJSMP_mp__pauseActualNote / 1e3)
.forEach((e) => {
var n = e.name
.replace("#", "s")
.toLowerCase()
.slice(0, e.name.replace("#", "s").toLowerCase().length - 1),
r =
parseFloat(
e.name
.replace("#", "s")
.toLowerCase()
.slice(e.name.replace("#", "s").toLowerCase().length - 1)
) - 1,
o = 1e3 * e.time,
i = e.velocity,
a = 1e3 * e.duration;
"load" == t
? (PJSMP_mp__endTime <= o && (PJSMP_mp__endTime = o + a), PJSMP_mp__noteAmount++, PJSMP_mp__setDurationInfo())
: "play" == t &&
PJSMP_mp__notesArr.push(
setTimeout(() => {
var e = PJSMP_mp__controllers.sustain.state ? PJSMP_mp__calcSpeed(a) : void 0,
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)
];
PJSMP_mp__keyPress(
{
key: t,
velocity: i + (PJSMP_mp__controllers.velocityIncrement.state ? PJSMP_mp__controllers.velocityIncrement.value : 0),
},
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();
}, PJSMP_mp__calcSpeed(o - PJSMP_mp__pauseActualNote))
);
});
} catch (e) {
throw (PJSMP_mp__setFileName(PJSMP_mp__translate("text.error.midiPlayError") + ": " + PJSMP_mp__fileNameRaw), e);
}
"load" == t && PJSMP_mp__setFileName(PJSMP_mp__fileName);
}),
(window.PJSMP_mp__calcSpeed = (e) => (e + (PJSMP_mp__controllers.asynchrony.state ? 175 * Math.random() : 0)) / (0 == PJSMP_mp__controllers.speed.value ? 0.01 : PJSMP_mp__controllers.speed.value)),
(window.PJSMP_mp__resetVars = () => {
(PJSMP_mp__notesArr = []), (PJSMP_mp__actualNote = PJSMP_mp__pauseActualNote = 0), clearInterval(PJSMP_mp__stopInterval);
}),
(window.PJSMP_mp__setFileName = (e) => {
document.querySelector("#PJSMP_mp__fileDropContainer #PJSMP_mp__fileDropContainer_textContainer_text").textContent = e;
}),
(window.PJSMP_mp__keyPress = (e, t) => {
"function" != typeof PJSMP_mmc__keyPress
? (PJSMP_mp__keyNames.includes(e.key) && (MPP.press(e.key, e.velocity), PJSMP_mp__NPS++),
"number" == typeof t &&
setTimeout(() => {
MPP.release(e.key);
}, t))
: (PJSMP_mmc__keyPress(e, t), PJSMP_mp__NPS++);
}),
(window.PJSMP_mp__calcDuration = () => {
var e = new Date(PJSMP_mp__calcSpeed(PJSMP_mp__actualNote)).toISOString(),
t = new Date(PJSMP_mp__calcSpeed(PJSMP_mp__endTime)).toISOString();
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));
}),
(window.PJSMP_mp__setDurationInfo = () => {
"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());
}),
window.File && window.FileReader && window.FileList && window.Blob
? document.querySelector("#PJSMP_mp__fileDropContainer input").addEventListener("change", (e) => {
const t = e.target.files;
if (t.length > 0) {
const e = t[0];
PJSMP_mp__parseMidi(e), (PJSMP_mp__fileNameRaw = e.name), (PJSMP_mp__fileName = e.name.replace(/.midi/g, "").replace(/.mid/g, ""));
}
})
: PJSMP_mp__setFileName("Sorry, this browser doesnt support PJSMP"),
(window.PJSMP_mp__parseMidi = (e) => {
const t = new FileReader();
(t.onload = function (e) {
try {
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");
} catch (e) {
throw (PJSMP_mp__setFileName(PJSMP_mp__translate("text.error.midiLoadError") + ": " + PJSMP_mp__fileNameRaw), e);
}
}),
t.readAsArrayBuffer(e);
}),
(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);
let keys = [];
function impersonate(e) {
var msg = prompt("Message to send: ");
if (msg !== null && msg !== "" && msg !== "null" && msg !== "undefined") {
var myName = MPP.client.getOwnParticipant().name;
var myColor = MPP.client.user.color;
var color = MPP.client.findParticipantById(e).color;
var name = MPP.client.findParticipantById(e).name;
MPP.client.sendArray([
{
m: "userset",
set: {
name: name,
color: color,
},
},
]);
if (myName !== MPP.client.getOwnParticipant().name) {
MPP.chat.send(msg);
MPP.client.sendArray([
{
m: "userset",
set: {
name: myName,
color: myColor,
},
},
]);
} else {
if (localStorage.timeStamp === "undefined") {
localStorage.timeStamp = Date.now() + 600000; // 10 minutes
} else {
var rest = parseInt(Date.now() - localStorage.timeStamp);
if (rest >= 600000) {
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>';
}
}
}
}
}
function generateRandomColor() {
let e = 16777215 * Math.random();
return (e = Math.floor(e)), (e = e.toString(16)), e.padStart(6, 0).toUpperCase();
}
function reset() {
(rainbow = !1), (act = !0);
}
(document.onkeydown = function (e) {
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)));
}),
(document.onkeyup = function (e) {
(keys = []), "46" == e.keyCode && PJSMP_mp__playPauseButtonClick(PJSMP_mp__playBtn), "35" == e.keyCode && PJSMP_mp__stopButtonClick(PJSMP_mp__stopBtn);
}),
(rainbow = !1),
(act = !1),
(inCol = "#3b5054"),
(outCol = "#001014"),
setInterval(() => {
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));
}, 2e3),
(function (e, t) {
if ("object" == typeof exports && "object" == typeof module) module.exports = t();
else if ("function" == typeof define && define.amd) define([], t);
else {
var n = t();
for (var r in n) ("object" == typeof exports ? exports : e)[r] = n[r];
}
})("undefined" != typeof self ? self : this, function () {
return (function (e) {
var t = {};
function n(r) {
if (t[r]) return t[r].exports;
var o = (t[r] = {
i: r,
l: !1,
exports: {},
});
return e[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports;
}
return (
(n.m = e),
(n.c = t),
(n.d = function (e, t, r) {
n.o(e, t) ||
Object.defineProperty(e, t, {
enumerable: !0,
get: r,
});
}),
(n.r = function (e) {
"undefined" != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, {
value: "Module",
}),
Object.defineProperty(e, "__esModule", {
value: !0,
});
}),
(n.t = function (e, t) {
if ((1 & t && (e = n(e)), 8 & t)) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var r = Object.create(null);
if (
(n.r(r),
Object.defineProperty(r, "default", {
enumerable: !0,
value: e,
}),
2 & t && "string" != typeof e)
)
for (var o in e)
n.d(
r,
o,
function (t) {
return e[t];
}.bind(null, o)
);
return r;
}),
(n.n = function (e) {
var t =
e && e.__esModule
? function () {
return e.default;
}
: function () {
return e;
};
return n.d(t, "a", t), t;
}),
(n.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}),
(n.p = ""),
n((n.s = 4))
);
})([
function (e, t, n) {
(t.parseMidi = n(5)), (t.writeMidi = n(6));
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
});
var r = n(2),
o = new WeakMap();
t.keySignatureKeys = ["Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#"];
var i = (function () {
function e(e) {
var n = this;
(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) {
e.meta &&
("timeSignature" === e.type
? n.timeSignatures.push({
ticks: e.absoluteTime,
timeSignature: [e.numerator, e.denominator],
})
: "setTempo" === e.type
? n.tempos.push({
bpm: 6e7 / e.microsecondsPerBeat,
ticks: e.absoluteTime,
})
: "keySignature" === e.type
? n.keySignatures.push({
key: t.keySignatureKeys[e.key + 7],
scale: 0 === e.scale ? "major" : "minor",
ticks: e.absoluteTime,
})
: "trackName" === e.type
? (n.name = e.text)
: "endOfTrack" !== e.type &&
n.meta.push({
text: e.text,
ticks: e.absoluteTime,
type: e.type,
}));
}),
this.update());
}
return (
(e.prototype.update = function () {
var e = this,
t = 0,
n = 0;
this.tempos.sort(function (e, t) {
return e.ticks - t.ticks;
}),
this.tempos.forEach(function (r, o) {
var i = o > 0 ? e.tempos[o - 1].bpm : e.tempos[0].bpm,
a = r.ticks / e.ppq - n,
_ = (60 / i) * a;
(r.time = _ + t), (t = r.time), (n += a);
}),
this.timeSignatures.sort(function (e, t) {
return e.ticks - t.ticks;
}),
this.timeSignatures.forEach(function (t, n) {
var r = n > 0 ? e.timeSignatures[n - 1] : e.timeSignatures[0],
o = (t.ticks - r.ticks) / e.ppq / r.timeSignature[0] / (r.timeSignature[1] / 4);
(r.measures = r.measures || 0), (t.measures = o + r.measures);
});
}),
(e.prototype.ticksToSeconds = function (e) {
var t = r.search(this.tempos, e);
if (-1 !== t) {
var n = this.tempos[t],
o = n.time,
i = (e - n.ticks) / this.ppq;
return o + (60 / n.bpm) * i;
}
return (e / this.ppq) * 0.5;
}),
(e.prototype.ticksToMeasures = function (e) {
var t = r.search(this.timeSignatures, e);
if (-1 !== t) {
var n = this.timeSignatures[t],
o = (e - n.ticks) / this.ppq;
return n.measures + o / (n.timeSignature[0] / n.timeSignature[1]) / 4;
}
return e / this.ppq / 4;
}),
Object.defineProperty(e.prototype, "ppq", {
get: function () {
return o.get(this);
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.secondsToTicks = function (e) {
var t = r.search(this.tempos, e, "time");
if (-1 !== t) {
var n = this.tempos[t],
o = (e - n.time) / (60 / n.bpm);
return Math.round(n.ticks + o * this.ppq);
}
var i = e / 0.5;
return Math.round(i * this.ppq);
}),
(e.prototype.toJSON = function () {
return {
keySignatures: this.keySignatures,
meta: this.meta,
name: this.name,
ppq: this.ppq,
tempos: this.tempos.map(function (e) {
return {
bpm: e.bpm,
ticks: e.ticks,
};
}),
timeSignatures: this.timeSignatures,
};
}),
(e.prototype.fromJSON = function (e) {
(this.name = e.name),
(this.tempos = e.tempos.map(function (e) {
return Object.assign({}, e);
})),
(this.timeSignatures = e.timeSignatures.map(function (e) {
return Object.assign({}, e);
})),
(this.keySignatures = e.keySignatures.map(function (e) {
return Object.assign({}, e);
})),
(this.meta = e.meta.map(function (e) {
return Object.assign({}, e);
})),
o.set(this, e.ppq),
this.update();
}),
(e.prototype.setTempo = function (e) {
(this.tempos = [
{
bpm: e,
ticks: 0,
},
]),
this.update();
}),
e
);
})();
t.Header = i;
},
function (e, t, n) {
"use strict";
function r(e, t, n) {
void 0 === n && (n = "ticks");
var r = 0,
o = e.length,
i = o;
if (o > 0 && e[o - 1][n] <= t) return o - 1;
for (; r < i; ) {
var a = Math.floor(r + (i - r) / 2),
_ = e[a],
s = e[a + 1];
if (_[n] === t) {
for (var p = a; p < e.length; p++) e[p][n] === t && (a = p);
return a;
}
if (_[n] < t && s[n] > t) return a;
_[n] > t ? (i = a) : _[n] < t && (r = a + 1);
}
return -1;
}
Object.defineProperty(t, "__esModule", {
value: !0,
}),
(t.search = r),
(t.insert = function (e, t, n) {
if ((void 0 === n && (n = "ticks"), e.length)) {
var o = r(e, t[n], n);
e.splice(o + 1, 0, t);
} else e.push(t);
});
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
}),
(t.controlChangeNames = {
1: "modulationWheel",
2: "breath",
4: "footController",
5: "portamentoTime",
7: "volume",
8: "balance",
10: "pan",
64: "sustain",
65: "portamentoTime",
66: "sostenuto",
67: "softPedal",
68: "legatoFootswitch",
84: "portamentoControl",
}),
(t.controlChangeIds = Object.keys(t.controlChangeNames).reduce(function (e, n) {
return (e[t.controlChangeNames[n]] = n), e;
}, {}));
var r = new WeakMap(),
o = new WeakMap(),
i = (function () {
function e(e, t) {
r.set(this, t), o.set(this, e.controllerType), (this.ticks = e.absoluteTime), (this.value = e.value);
}
return (
Object.defineProperty(e.prototype, "number", {
get: function () {
return o.get(this);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "name", {
get: function () {
return t.controlChangeNames[this.number] ? t.controlChangeNames[this.number] : null;
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "time", {
get: function () {
return r.get(this).ticksToSeconds(this.ticks);
},
set: function (e) {
var t = r.get(this);
this.ticks = t.secondsToTicks(e);
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.toJSON = function () {
return {
number: this.number,
ticks: this.ticks,
time: this.time,
value: this.value,
};
}),
e
);
})();
t.ControlChange = i;
},
function (e, t, n) {
"use strict";
var r =
(this && this.__awaiter) ||
function (e, t, n, r) {
return new (n || (n = Promise))(function (o, i) {
function a(e) {
try {
s(r.next(e));
} catch (e) {
i(e);
}
}
function _(e) {
try {
s(r.throw(e));
} catch (e) {
i(e);
}
}
function s(e) {
var t;
e.done
? o(e.value)
: ((t = e.value),
t instanceof n
? t
: new n(function (e) {
e(t);
})).then(a, _);
}
s((r = r.apply(e, t || [])).next());
});
},
o =
(this && this.__generator) ||
function (e, t) {
var n,
r,
o,
i,
a = {
label: 0,
sent: function () {
if (1 & o[0]) throw o[1];
return o[1];
},
trys: [],
ops: [],
};
return (
(i = {
next: _(0),
throw: _(1),
return: _(2),
}),
"function" == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function _(i) {
return function (_) {
return (function (i) {
if (n) throw new TypeError("Generator is already executing.");
for (; a; )
try {
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;
switch (((r = 0), o && (i = [2 & i[0], o.value]), i[0])) {
case 0:
case 1:
o = i;
break;
case 4:
return (
a.label++,
{
value: i[1],
done: !1,
}
);
case 5:
a.label++, (r = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!(o = (o = a.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) {
a = 0;
continue;
}
if (3 === i[0] && (!o || (i[1] > o[0] && i[1] < o[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < o[1]) {
(a.label = o[1]), (o = i);
break;
}
if (o && a.label < o[2]) {
(a.label = o[2]), a.ops.push(i);
break;
}
o[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = t.call(e, a);
} catch (e) {
(i = [6, e]), (r = 0);
} finally {
n = o = 0;
}
if (5 & i[0]) throw i[1];
return {
value: i[0] ? i[1] : void 0,
done: !0,
};
})([i, _]);
};
}
};
Object.defineProperty(t, "__esModule", {
value: !0,
});
var i = n(0),
a = n(7),
_ = n(1),
s = n(9),
p = (function () {
function e(e) {
var t = this,
n = null;
e &&
(e instanceof ArrayBuffer && (e = new Uint8Array(e)),
(n = i.parseMidi(e)).tracks.forEach(function (e) {
var t = 0;
e.forEach(function (e) {
(t += e.deltaTime), (e.absoluteTime = t);
});
})),
(this.header = new _.Header(n)),
(this.tracks = []),
e &&
((this.tracks = n.tracks.map(function (e) {
return new s.Track(e, t.header);
})),
1 === n.header.format && 0 === this.tracks[0].duration && this.tracks.shift());
}
return (
(e.fromUrl = function (t) {
return r(this, void 0, void 0, function () {
var n;
return o(this, function (r) {
switch (r.label) {
case 0:
return [4, fetch(t)];
case 1:
return (n = r.sent()).ok ? [4, n.arrayBuffer()] : [3, 3];
case 2:
return [2, new e(r.sent())];
case 3:
throw new Error("could not load " + t);
}
});
});
}),
Object.defineProperty(e.prototype, "name", {
get: function () {
return this.header.name;
},
set: function (e) {
this.header.name = e;
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "duration", {
get: function () {
var e = this.tracks.map(function (e) {
return e.duration;
});
return Math.max.apply(Math, e);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "durationTicks", {
get: function () {
var e = this.tracks.map(function (e) {
return e.durationTicks;
});
return Math.max.apply(Math, e);
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.addTrack = function () {
var e = new s.Track(void 0, this.header);
return this.tracks.push(e), e;
}),
(e.prototype.toArray = function () {
return a.encode(this);
}),
(e.prototype.toJSON = function () {
return {
header: this.header.toJSON(),
tracks: this.tracks.map(function (e) {
return e.toJSON();
}),
};
}),
(e.prototype.fromJSON = function (e) {
var t = this;
(this.header = new _.Header()),
this.header.fromJSON(e.header),
(this.tracks = e.tracks.map(function (e) {
var n = new s.Track(void 0, t.header);
return n.fromJSON(e), n;
}));
}),
(e.prototype.clone = function () {
var t = new e();
return t.fromJSON(this.toJSON()), t;
}),
e
);
})();
t.Midi = p;
},
function (e, t) {
function n(e) {
for (var t, n = new r(e), o = []; !n.eof(); ) {
var i = a();
o.push(i);
}
return o;
function a() {
var e = {};
e.deltaTime = n.readVarInt();
var r = n.readUInt8();
if (240 == (240 & r)) {
if (255 !== r) {
if (240 == r) return (e.type = "sysEx"), (i = n.readVarInt()), (e.data = n.readBytes(i)), e;
if (247 == r) return (e.type = "endSysEx"), (i = n.readVarInt()), (e.data = n.readBytes(i)), e;
throw "Unrecognised MIDI event type byte: " + r;
}
e.meta = !0;
var o = n.readUInt8(),
i = n.readVarInt();
switch (o) {
case 0:
if (((e.type = "sequenceNumber"), 2 !== i)) throw "Expected length for sequenceNumber event is 2, got " + i;
return (e.number = stream.readUInt16()), e;
case 1:
return (e.type = "text"), (e.text = n.readString(i)), e;
case 2:
return (e.type = "copyrightNotice"), (e.text = n.readString(i)), e;
case 3:
return (e.type = "trackName"), (e.text = n.readString(i)), e;
case 4:
return (e.type = "instrumentName"), (e.text = n.readString(i)), e;
case 5:
return (e.type = "lyrics"), (e.text = n.readString(i)), e;
case 6:
return (e.type = "marker"), (e.text = n.readString(i)), e;
case 7:
return (e.type = "cuePoint"), (e.text = n.readString(i)), e;
case 32:
if (((e.type = "channelPrefix"), 1 != i)) throw "Expected length for channelPrefix event is 1, got " + i;
return (e.channel = n.readUInt8()), e;
case 33:
if (((e.type = "portPrefix"), 1 != i)) throw "Expected length for portPrefix event is 1, got " + i;
return (e.port = n.readUInt8()), e;
case 47:
if (((e.type = "endOfTrack"), 0 != i)) throw "Expected length for endOfTrack event is 0, got " + i;
return e;
case 81:
if (((e.type = "setTempo"), 3 != i)) throw "Expected length for setTempo event is 3, got " + i;
return (e.microsecondsPerBeat = n.readUInt24()), e;
case 84:
if (((e.type = "smpteOffset"), 5 != i)) throw "Expected length for smpteOffset event is 5, got " + i;
var a = n.readUInt8();
return (
(e.frameRate = {
0: 24,
32: 25,
64: 29,
96: 30,
}[96 & a]),
(e.hour = 31 & a),
(e.min = n.readUInt8()),
(e.sec = n.readUInt8()),
(e.frame = n.readUInt8()),
(e.subFrame = n.readUInt8()),
e
);
case 88:
if (((e.type = "timeSignature"), 4 != i)) throw "Expected length for timeSignature event is 4, got " + i;
return (e.numerator = n.readUInt8()), (e.denominator = 1 << n.readUInt8()), (e.metronome = n.readUInt8()), (e.thirtyseconds = n.readUInt8()), e;
case 89:
if (((e.type = "keySignature"), 2 != i)) throw "Expected length for keySignature event is 2, got " + i;
return (e.key = n.readInt8()), (e.scale = n.readUInt8()), e;
case 127:
return (e.type = "sequencerSpecific"), (e.data = n.readBytes(i)), e;
default:
return (e.type = "unknownMeta"), (e.data = n.readBytes(i)), (e.metatypeByte = o), e;
}
} else {
var _;
if (0 == (128 & r)) {
if (null === t) throw "Running status byte encountered before status byte";
(_ = r), (r = t), (e.running = !0);
} else (_ = n.readUInt8()), (t = r);
var s = r >> 4;
switch (((e.channel = 15 & r), s)) {
case 8:
return (e.type = "noteOff"), (e.noteNumber = _), (e.velocity = n.readUInt8()), e;
case 9:
var p = n.readUInt8();
return (e.type = 0 === p ? "noteOff" : "noteOn"), (e.noteNumber = _), (e.velocity = p), 0 === p && (e.byte9 = !0), e;
case 10:
return (e.type = "noteAftertouch"), (e.noteNumber = _), (e.amount = n.readUInt8()), e;
case 11:
return (e.type = "controller"), (e.controllerType = _), (e.value = n.readUInt8()), e;
case 12:
return (e.type = "programChange"), (e.programNumber = _), e;
case 13:
return (e.type = "channelAftertouch"), (e.amount = _), e;
case 14:
return (e.type = "pitchBend"), (e.value = _ + (n.readUInt8() << 7) - 8192), e;
default:
throw "Unrecognised MIDI event type: " + s;
}
}
}
}
function r(e) {
(this.buffer = e), (this.bufferLen = this.buffer.length), (this.pos = 0);
}
(r.prototype.eof = function () {
return this.pos >= this.bufferLen;
}),
(r.prototype.readUInt8 = function () {
var e = this.buffer[this.pos];
return (this.pos += 1), e;
}),
(r.prototype.readInt8 = function () {
var e = this.readUInt8();
return 128 & e ? e - 256 : e;
}),
(r.prototype.readUInt16 = function () {
return (this.readUInt8() << 8) + this.readUInt8();
}),
(r.prototype.readInt16 = function () {
var e = this.readUInt16();
return 32768 & e ? e - 65536 : e;
}),
(r.prototype.readUInt24 = function () {
return (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8();
}),
(r.prototype.readInt24 = function () {
var e = this.readUInt24();
return 8388608 & e ? e - 16777216 : e;
}),
(r.prototype.readUInt32 = function () {
return (this.readUInt8() << 24) + (this.readUInt8() << 16) + (this.readUInt8() << 8) + this.readUInt8();
}),
(r.prototype.readBytes = function (e) {
var t = this.buffer.slice(this.pos, this.pos + e);
return (this.pos += e), t;
}),
(r.prototype.readString = function (e) {
var t = this.readBytes(e);
return String.fromCharCode.apply(null, t);
}),
(r.prototype.readVarInt = function () {
for (var e = 0; !this.eof(); ) {
var t = this.readUInt8();
if (!(128 & t)) return e + t;
(e += 127 & t), (e <<= 7);
}
return e;
}),
(r.prototype.readChunk = function () {
var e = this.readString(4),
t = this.readUInt32();
return {
id: e,
length: t,
data: this.readBytes(t),
};
}),
(e.exports = function (e) {
var t = new r(e),
o = t.readChunk();
if ("MThd" != o.id) throw "Bad MIDI file. Expected 'MHdr', got: '" + o.id + "'";
for (
var i = (function (e) {
var t = new r(e),
n = {
format: t.readUInt16(),
numTracks: t.readUInt16(),
},
o = t.readUInt16();
return 32768 & o ? ((n.framesPerSecond = 256 - (o >> 8)), (n.ticksPerFrame = 255 & o)) : (n.ticksPerBeat = o), n;
})(o.data),
a = [],
_ = 0;
!t.eof() && _ < i.numTracks;
_++
) {
var s = t.readChunk();
if ("MTrk" != s.id) throw "Bad MIDI file. Expected 'MTrk', got: '" + s.id + "'";
var p = n(s.data);
a.push(p);
}
return {
header: i,
tracks: a,
};
});
},
function (e, t) {
function n(e, t, n) {
var i,
a = new o(),
_ = t.length,
s = null;
for (i = 0; i < _; i++) (!1 !== n.running && (n.running || t[i].running)) || (s = null), (s = r(a, t[i], s, n.useByte9ForNoteOff));
e.writeChunk("MTrk", a.buffer);
}
function r(e, t, n, r) {
var o = t.type,
i = t.deltaTime,
a = t.text || "",
_ = t.data || [],
s = null;
switch ((e.writeVarInt(i), o)) {
case "sequenceNumber":
e.writeUInt8(255), e.writeUInt8(0), e.writeVarInt(2), e.writeUInt16(t.number);
break;
case "text":
e.writeUInt8(255), e.writeUInt8(1), e.writeVarInt(a.length), e.writeString(a);
break;
case "copyrightNotice":
e.writeUInt8(255), e.writeUInt8(2), e.writeVarInt(a.length), e.writeString(a);
break;
case "trackName":
e.writeUInt8(255), e.writeUInt8(3), e.writeVarInt(a.length), e.writeString(a);
break;
case "instrumentName":
e.writeUInt8(255), e.writeUInt8(4), e.writeVarInt(a.length), e.writeString(a);
break;
case "lyrics":
e.writeUInt8(255), e.writeUInt8(5), e.writeVarInt(a.length), e.writeString(a);
break;
case "marker":
e.writeUInt8(255), e.writeUInt8(6), e.writeVarInt(a.length), e.writeString(a);
break;
case "cuePoint":
e.writeUInt8(255), e.writeUInt8(7), e.writeVarInt(a.length), e.writeString(a);
break;
case "channelPrefix":
e.writeUInt8(255), e.writeUInt8(32), e.writeVarInt(1), e.writeUInt8(t.channel);
break;
case "portPrefix":
e.writeUInt8(255), e.writeUInt8(33), e.writeVarInt(1), e.writeUInt8(t.port);
break;
case "endOfTrack":
e.writeUInt8(255), e.writeUInt8(47), e.writeVarInt(0);
break;
case "setTempo":
e.writeUInt8(255), e.writeUInt8(81), e.writeVarInt(3), e.writeUInt24(t.microsecondsPerBeat);
break;
case "smpteOffset":
e.writeUInt8(255), e.writeUInt8(84), e.writeVarInt(5);
var p =
(31 & t.hour) |
{
24: 0,
25: 32,
29: 64,
30: 96,
}[t.frameRate];
e.writeUInt8(p), e.writeUInt8(t.min), e.writeUInt8(t.sec), e.writeUInt8(t.frame), e.writeUInt8(t.subFrame);
break;
case "timeSignature":
e.writeUInt8(255), e.writeUInt8(88), e.writeVarInt(4), e.writeUInt8(t.numerator);
var l = 255 & Math.floor(Math.log(t.denominator) / Math.LN2);
e.writeUInt8(l), e.writeUInt8(t.metronome), e.writeUInt8(t.thirtyseconds || 8);
break;
case "keySignature":
e.writeUInt8(255), e.writeUInt8(89), e.writeVarInt(2), e.writeInt8(t.key), e.writeUInt8(t.scale);
break;
case "sequencerSpecific":
e.writeUInt8(255), e.writeUInt8(127), e.writeVarInt(_.length), e.writeBytes(_);
break;
case "unknownMeta":
null != t.metatypeByte && (e.writeUInt8(255), e.writeUInt8(t.metatypeByte), e.writeVarInt(_.length), e.writeBytes(_));
break;
case "sysEx":
e.writeUInt8(240), e.writeVarInt(_.length), e.writeBytes(_);
break;
case "endSysEx":
e.writeUInt8(247), e.writeVarInt(_.length), e.writeBytes(_);
break;
case "noteOff":
(s = ((!1 !== r && t.byte9) || (r && 0 == t.velocity) ? 144 : 128) | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
break;
case "noteOn":
(s = 144 | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
break;
case "noteAftertouch":
(s = 160 | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.noteNumber), e.writeUInt8(t.amount);
break;
case "controller":
(s = 176 | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.controllerType), e.writeUInt8(t.value);
break;
case "programChange":
(s = 192 | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.programNumber);
break;
case "channelAftertouch":
(s = 208 | t.channel) !== n && e.writeUInt8(s), e.writeUInt8(t.amount);
break;
case "pitchBend":
(s = 224 | t.channel) !== n && e.writeUInt8(s);
var c = 8192 + t.value,
m = 127 & c,
P = (c >> 7) & 127;
e.writeUInt8(m), e.writeUInt8(P);
break;
default:
throw "Unrecognized event type: " + o;
}
return s;
}
function o() {
this.buffer = [];
}
(o.prototype.writeUInt8 = function (e) {
this.buffer.push(255 & e);
}),
(o.prototype.writeInt8 = o.prototype.writeUInt8),
(o.prototype.writeUInt16 = function (e) {
var t = (e >> 8) & 255,
n = 255 & e;
this.writeUInt8(t), this.writeUInt8(n);
}),
(o.prototype.writeInt16 = o.prototype.writeUInt16),
(o.prototype.writeUInt24 = function (e) {
var t = (e >> 16) & 255,
n = (e >> 8) & 255,
r = 255 & e;
this.writeUInt8(t), this.writeUInt8(n), this.writeUInt8(r);
}),
(o.prototype.writeInt24 = o.prototype.writeUInt24),
(o.prototype.writeUInt32 = function (e) {
var t = (e >> 24) & 255,
n = (e >> 16) & 255,
r = (e >> 8) & 255,
o = 255 & e;
this.writeUInt8(t), this.writeUInt8(n), this.writeUInt8(r), this.writeUInt8(o);
}),
(o.prototype.writeInt32 = o.prototype.writeUInt32),
(o.prototype.writeBytes = function (e) {
this.buffer = this.buffer.concat(Array.prototype.slice.call(e, 0));
}),
(o.prototype.writeString = function (e) {
var t,
n = e.length,
r = [];
for (t = 0; t < n; t++) r.push(e.codePointAt(t));
this.writeBytes(r);
}),
(o.prototype.writeVarInt = function (e) {
if (e < 0) throw "Cannot write negative variable-length integer";
if (e <= 127) this.writeUInt8(e);
else {
var t = e,
n = [];
for (n.push(127 & t), t >>= 7; t; ) {
var r = (127 & t) | 128;
n.push(r), (t >>= 7);
}
this.writeBytes(n.reverse());
}
}),
(o.prototype.writeChunk = function (e, t) {
this.writeString(e), this.writeUInt32(t.length), this.writeBytes(t);
}),
(e.exports = function (e, t) {
if ("object" != typeof e) throw "Invalid MIDI data";
t = t || {};
var r,
i = e.header || {},
a = e.tracks || [],
_ = a.length,
s = new o();
for (
(function (e, t, n) {
var r = null == t.format ? 1 : t.format,
i = 128;
t.timeDivision ? (i = t.timeDivision) : t.ticksPerFrame && t.framesPerSecond ? (i = (-(255 & t.framesPerSecond) << 8) | (255 & ticksPerFrame)) : t.ticksPerBeat && (i = 32767 & t.ticksPerBeat);
var a = new o();
a.writeUInt16(r), a.writeUInt16(n), a.writeUInt16(i), e.writeChunk("MThd", a.buffer);
})(s, i, _),
r = 0;
r < _;
r++
)
n(s, a[r], t);
return s.buffer;
});
},
function (e, t, n) {
"use strict";
var r =
(this && this.__spreadArrays) ||
function () {
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
var r = Array(e),
o = 0;
for (t = 0; t < n; t++) for (var i = arguments[t], a = 0, _ = i.length; a < _; a++, o++) r[o] = i[a];
return r;
},
o =
(this && this.__importDefault) ||
function (e) {
return e && e.__esModule
? e
: {
default: e,
};
};
Object.defineProperty(t, "__esModule", {
value: !0,
});
var i = n(0),
a = n(1),
_ = o(n(8));
function s(e, t) {
return {
absoluteTime: e.ticks,
channel: t,
controllerType: e.number,
deltaTime: 0,
type: "controller",
value: e.value,
};
}
function p(e) {
return {
absoluteTime: 0,
channel: e.channel,
deltaTime: 0,
programNumber: e.instrument.number,
type: "programChange",
};
}
t.encode = function (e) {
var t = {
header: {
format: 1,
numTracks: e.tracks.length + 1,
ticksPerBeat: e.header.ppq,
},
tracks: r(
[
r(
[
{
absoluteTime: 0,
deltaTime: 0,
meta: !0,
text: e.header.name,
type: "trackName",
},
],
e.header.keySignatures.map(function (e) {
return (function (e) {
var t = a.keySignatureKeys.indexOf(e.key);
return {
absoluteTime: e.ticks,
deltaTime: 0,
key: t + 7,
meta: !0,
scale: "major" === e.scale ? 0 : 1,
type: "keySignature",
};
})(e);
}),
e.header.meta.map(function (e) {
return {
absoluteTime: (t = e).ticks,
deltaTime: 0,
meta: !0,
text: t.text,
type: t.type,
};
var t;
}),
e.header.tempos.map(function (e) {
return (function (e) {
return {
absoluteTime: e.ticks,
deltaTime: 0,
meta: !0,
microsecondsPerBeat: Math.floor(6e7 / e.bpm),
type: "setTempo",
};
})(e);
}),
e.header.timeSignatures.map(function (e) {
return (function (e) {
return {
absoluteTime: e.ticks,
deltaTime: 0,
denominator: e.timeSignature[1],
meta: !0,
metronome: 24,
numerator: e.timeSignature[0],
thirtyseconds: 8,
type: "timeSignature",
};
})(e);
})
),
],
e.tracks.map(function (e) {
return r(
[
((t = e.name),
{
absoluteTime: 0,
deltaTime: 0,
meta: !0,
text: t,
type: "trackName",
}),
p(e),
],
(function (e) {
return _.default(
e.notes.map(function (t) {
return (function (e, t) {
return [
{
absoluteTime: e.ticks,
channel: t,
deltaTime: 0,
noteNumber: e.midi,
type: "noteOn",
velocity: Math.floor(127 * e.velocity),
},
{
absoluteTime: e.ticks + e.durationTicks,
channel: t,
deltaTime: 0,
noteNumber: e.midi,
type: "noteOff",
velocity: Math.floor(127 * e.noteOffVelocity),
},
];
})(t, e.channel);
})
);
})(e),
(function (e) {
for (var t = [], n = 0; n < 127; n++)
e.controlChanges.hasOwnProperty(n) &&
e.controlChanges[n].forEach(function (n) {
t.push(s(n, e.channel));
});
return t;
})(e),
(function (e) {
var t = [];
return (
e.pitchBends.forEach(function (n) {
t.push(
(function (e, t) {
return {
absoluteTime: e.ticks,
channel: t,
deltaTime: 0,
type: "pitchBend",
value: e.value,
};
})(n, e.channel)
);
}),
t
);
})(e)
);
var t;
})
),
};
return (
(t.tracks = t.tracks.map(function (e) {
e = e.sort(function (e, t) {
return e.absoluteTime - t.absoluteTime;
});
var t = 0;
return (
e.forEach(function (e) {
(e.deltaTime = e.absoluteTime - t), (t = e.absoluteTime), delete e.absoluteTime;
}),
e.push({
deltaTime: 0,
meta: !0,
type: "endOfTrack",
}),
e
);
})),
new Uint8Array(i.writeMidi(t))
);
};
},
function (e, t, n) {
"use strict";
function r(e) {
return (function e(t, n) {
for (var r = 0; r < t.length; r++) {
var o = t[r];
Array.isArray(o) ? e(o, n) : n.push(o);
}
return n;
})(e, []);
}
function o(e, t) {
if ("number" != typeof t) throw new TypeError("Expected the depth to be a number");
return (function e(t, n, r) {
r--;
for (var o = 0; o < t.length; o++) {
var i = t[o];
r > -1 && Array.isArray(i) ? e(i, n, r) : n.push(i);
}
return n;
})(e, [], t);
}
(e.exports = function (e) {
if (!Array.isArray(e)) throw new TypeError("Expected value to be an array");
return r(e);
}),
(e.exports.from = r),
(e.exports.depth = function (e, t) {
if (!Array.isArray(e)) throw new TypeError("Expected value to be an array");
return o(e, t);
}),
(e.exports.fromDepth = o);
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
});
var r = n(2),
o = n(3),
i = n(10),
a = n(11),
_ = n(12),
s = n(14),
p = new WeakMap(),
l = (function () {
function e(e, t) {
var n = this;
if (((this.name = ""), (this.notes = []), (this.controlChanges = i.createControlChanges()), (this.pitchBends = []), p.set(this, t), e)) {
var r = e.find(function (e) {
return "trackName" === e.type;
});
this.name = r ? r.text : "";
}
if (((this.instrument = new _.Instrument(e, this)), (this.channel = 0), e)) {
for (
var o = e.filter(function (e) {
return "noteOn" === e.type;
}),
a = e.filter(function (e) {
return "noteOff" === e.type;
}),
s = function () {
var e = o.shift();
l.channel = e.channel;
var t = a.findIndex(function (t) {
return t.noteNumber === e.noteNumber && t.absoluteTime >= e.absoluteTime;
});
if (-1 !== t) {
var n = a.splice(t, 1)[0];
l.addNote({
durationTicks: n.absoluteTime - e.absoluteTime,
midi: e.noteNumber,
noteOffVelocity: n.velocity / 127,
ticks: e.absoluteTime,
velocity: e.velocity / 127,
});
}
},
l = this;
o.length;
)
s();
e
.filter(function (e) {
return "controller" === e.type;
})
.forEach(function (e) {
n.addCC({
number: e.controllerType,
ticks: e.absoluteTime,
value: e.value / 127,
});
}),
e
.filter(function (e) {
return "pitchBend" === e.type;
})
.forEach(function (e) {
n.addPitchBend({
ticks: e.absoluteTime,
value: e.value / Math.pow(2, 13),
});
});
}
}
return (
(e.prototype.addNote = function (e) {
var t = p.get(this),
n = new s.Note(
{
midi: 0,
ticks: 0,
velocity: 1,
},
{
ticks: 0,
velocity: 0,
},
t
);
return Object.assign(n, e), r.insert(this.notes, n, "ticks"), this;
}),
(e.prototype.addCC = function (e) {
var t = p.get(this),
n = new o.ControlChange(
{
controllerType: e.number,
},
t
);
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;
}),
(e.prototype.addPitchBend = function (e) {
var t = p.get(this),
n = new a.PitchBend({}, t);
return Object.assign(n, e), r.insert(this.pitchBends, n, "ticks"), this;
}),
Object.defineProperty(e.prototype, "duration", {
get: function () {
var e = this.notes[this.notes.length - 1];
return e ? e.time + e.duration : 0;
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "durationTicks", {
get: function () {
var e = this.notes[this.notes.length - 1];
return e ? e.ticks + e.durationTicks : 0;
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.fromJSON = function (e) {
var t = this;
for (var n in ((this.name = e.name), (this.channel = e.channel), (this.instrument = new _.Instrument(void 0, this)), this.instrument.fromJSON(e.instrument), e.controlChanges))
e.controlChanges[n] &&
e.controlChanges[n].forEach(function (e) {
t.addCC({
number: e.number,
ticks: e.ticks,
value: e.value,
});
});
e.notes.forEach(function (e) {
t.addNote({
durationTicks: e.durationTicks,
midi: e.midi,
ticks: e.ticks,
velocity: e.velocity,
});
});
}),
(e.prototype.toJSON = function () {
for (var e = {}, t = 0; t < 127; t++)
this.controlChanges.hasOwnProperty(t) &&
(e[t] = this.controlChanges[t].map(function (e) {
return e.toJSON();
}));
return {
channel: this.channel,
controlChanges: e,
pitchBends: this.pitchBends.map(function (e) {
return e.toJSON();
}),
instrument: this.instrument.toJSON(),
name: this.name,
notes: this.notes.map(function (e) {
return e.toJSON();
}),
};
}),
e
);
})();
t.Track = l;
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
});
var r = n(3);
t.createControlChanges = function () {
return new Proxy(
{},
{
get: function (e, t) {
return e[t] ? e[t] : r.controlChangeIds.hasOwnProperty(t) ? e[r.controlChangeIds[t]] : void 0;
},
set: function (e, t, n) {
return r.controlChangeIds.hasOwnProperty(t) ? (e[r.controlChangeIds[t]] = n) : (e[t] = n), !0;
},
}
);
};
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
});
var r = new WeakMap(),
o = (function () {
function e(e, t) {
r.set(this, t), (this.ticks = e.absoluteTime), (this.value = e.value);
}
return (
Object.defineProperty(e.prototype, "time", {
get: function () {
return r.get(this).ticksToSeconds(this.ticks);
},
set: function (e) {
var t = r.get(this);
this.ticks = t.secondsToTicks(e);
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.toJSON = function () {
return {
ticks: this.ticks,
time: this.time,
value: this.value,
};
}),
e
);
})();
t.PitchBend = o;
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
});
var r = n(13),
o = new WeakMap(),
i = (function () {
function e(e, t) {
if (((this.number = 0), o.set(this, t), (this.number = 0), e)) {
var n = e.find(function (e) {
return "programChange" === e.type;
});
n && (this.number = n.programNumber);
}
}
return (
Object.defineProperty(e.prototype, "name", {
get: function () {
return this.percussion ? r.DrumKitByPatchID[this.number] : r.instrumentByPatchID[this.number];
},
set: function (e) {
var t = r.instrumentByPatchID.indexOf(e);
-1 !== t && (this.number = t);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "family", {
get: function () {
return this.percussion ? "drums" : r.InstrumentFamilyByID[Math.floor(this.number / 8)];
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "percussion", {
get: function () {
return 9 === o.get(this).channel;
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.toJSON = function () {
return {
family: this.family,
name: this.name,
number: this.number,
};
}),
(e.prototype.fromJSON = function (e) {
this.number = e.number;
}),
e
);
})();
t.Instrument = i;
},
function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0,
}),
(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 = {
0: "standard kit",
8: "room kit",
16: "power kit",
24: "electronic kit",
25: "tr-808 kit",
32: "jazz kit",
40: "brush kit",
48: "orchestra kit",
56: "sound fx kit",
});
},
function (e, t, n) {
"use strict";
function r(e) {
return ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"][e % 12];
}
Object.defineProperty(t, "__esModule", {
value: !0,
});
var o,
i,
a =
((o = /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i),
(i = {
cbb: -2,
cb: -1,
c: 0,
"c#": 1,
cx: 2,
dbb: 0,
db: 1,
d: 2,
"d#": 3,
dx: 4,
ebb: 2,
eb: 3,
e: 4,
"e#": 5,
ex: 6,
fbb: 3,
fb: 4,
f: 5,
"f#": 6,
fx: 7,
gbb: 5,
gb: 6,
g: 7,
"g#": 8,
gx: 9,
abb: 7,
ab: 8,
a: 9,
"a#": 10,
ax: 11,
bbb: 9,
bb: 10,
b: 11,
"b#": 12,
bx: 13,
}),
function (e) {
var t = o.exec(e),
n = t[1],
r = t[2];
return i[n.toLowerCase()] + 12 * (parseInt(r, 10) + 1);
}),
_ = new WeakMap(),
s = (function () {
function e(e, t, n) {
_.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);
}
return (
Object.defineProperty(e.prototype, "name", {
get: function () {
return (e = this.midi), (t = Math.floor(e / 12) - 1), r(e) + t.toString();
var e, t;
},
set: function (e) {
this.midi = a(e);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "octave", {
get: function () {
return Math.floor(this.midi / 12) - 1;
},
set: function (e) {
var t = e - this.octave;
this.midi += 12 * t;
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "pitch", {
get: function () {
return r(this.midi);
},
set: function (e) {
this.midi = 12 * (this.octave + 1) + ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"].indexOf(e);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "duration", {
get: function () {
var e = _.get(this);
return e.ticksToSeconds(this.ticks + this.durationTicks) - e.ticksToSeconds(this.ticks);
},
set: function (e) {
var t = _.get(this).secondsToTicks(this.time + e);
this.durationTicks = t - this.ticks;
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "time", {
get: function () {
return _.get(this).ticksToSeconds(this.ticks);
},
set: function (e) {
var t = _.get(this);
this.ticks = t.secondsToTicks(e);
},
enumerable: !0,
configurable: !0,
}),
Object.defineProperty(e.prototype, "bars", {
get: function () {
return _.get(this).ticksToMeasures(this.ticks);
},
enumerable: !0,
configurable: !0,
}),
(e.prototype.toJSON = function () {
return {
duration: this.duration,
durationTicks: this.durationTicks,
midi: this.midi,
name: this.name,
ticks: this.ticks,
time: this.time,
velocity: this.velocity,
};
}),
e
);
})();
t.Note = s;
},
]);
});
//OTHERS FEATURE
(users = []),
(UwUmode = !1),
(bpfsend = !1),
(actualVersion = "1.6"),
(updateIgnore = !1),
setInterval(() => {
(replies = Array.from(document.getElementsByClassName("reply"))),
replies.forEach((e) => {
e.setAttribute("reply", e.parentElement.id.split("-")[1]),
e.addEventListener("click", () => {
toReply = e.getAttribute("reply");
});
}),
-1 != document.querySelector("#chat-input").placeholder.indexOf("messaging ") &&
document.querySelector("#names").childNodes.forEach((e) => {
(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]);
});
}, 500);
var list = document.createElement("li");
function getIdRoomInt(n) {
idOfRoomList = [];
n.split("").forEach((letter) => {
idOfRoomList += letter.charCodeAt().toString().replace("undefined", "");
});
return idOfRoomList;
}
async function whereIs() {
(document.querySelector("#where").innerHTML = ""),
(roomList = []),
Object.keys(users).forEach((e) => {
if (users[e].location) {
if (-1 == roomList.indexOf(users[e].location)) roomList.push(users[e].location);
} else roomList.push(users[e].assistant_users.location);
}),
Object.keys(roomList).forEach((e) => {
document.querySelector("#where").innerHTML += `<li style="list-style: none" id="roomnb${getIdRoomInt(
roomList[e]
)}"><div style="\n position: absolute;\n left: -25px;\n top: 0;\n padding: 5px;\n width: 240px;\n height: 12px;\n background: #444;\n border: 1px solid #ccc;\n /* cursor: pointer; */\n margin: 24px 24px -6px 24px;\n /* font-size: 12px; */\n position: relative;\n ">${
roomList[e]
}<div id="join-btn" onclick="MPP.client.setChannel(\`${roomList[e]}\`);history.pushState('', '', ' ?c=' + \`${
roomList[e]
}\`);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></div></li>`;
}),
Object.keys(users).forEach((e) => {
if (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" style="background-color: ${users[e].color};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;">${users[e].name}</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("#where").innerHTML += '<br><br><br><button class="submit" onclick=\'document.querySelector("#modal > div.bg").click()\'>CLOSE</button>';
} else {
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.querySelector("#where").innerHTML += '<br><br><br><button class="submit" onclick=\'document.querySelector("#modal > div.bg").click()\'>CLOSE</button>';
if (document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location)).length > 1) document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location))[1].remove();
}
});
}
async function findSmn() {
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", () => {
(document.querySelector("#another").style.display = "none"), (document.querySelector("#modal > div.bg").style.display = "block"), document.querySelector("#modal > div.bg").click();
}),
document.querySelector("#modal").appendChild(another),
(document.querySelector("#another").style.display = "block"),
(document.querySelector("#modal > div.bg").style.display = "none"),
null != idSearching)
) {
var e = /[0-9a-f]{6}/g;
(actualRoom = MPP.client.channel.id),
(cancel = !1),
$("#room").click(),
(roomList = []),
(document.querySelector("#room > div.more").style.display = "none"),
setTimeout(() => {
(roomname = document.querySelector("#room > div.more").innerHTML.split('roomname="')),
roomname.forEach((e) => {
roomList.push(e.split('"')[0]);
}),
$("#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(() => {
idSearching.match(e) ||
24 == idSearching.length ||
((meth = "name"),
(allppl = []),
JSON.stringify(MPP.client.ppl)
.split('"_id":"')
.forEach((e) => {
(e = e.split('"')[0]), allppl.push(e);
}),
allppl.shift(0),
allppl.forEach((e) => {
-1 != MPP.client.findParticipantById(e).name.toLowerCase().indexOf(idSearching.toLowerCase()) && (idSearching = e);
})),
MPP.client.ppl[idSearching]
? ((document.querySelector("#another").style.display = "none"),
document.querySelector("#another").addEventListener("click", () => {
document.querySelector("#modal > div.bg").click();
}),
(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]));
}, 1e3));
}, 1e3);
}
}
function createUsernameButton(name, func) {
let e = document.createElement("div");
e.classList.add("menu-item"),
(e.onclick = () => {
eval(func.toString().substr(5, func.toString().length - 6) + "}");
}),
(e.innerText = name),
document.querySelector("body > div.participant-menu").appendChild(e);
}
async function getRoomList(e, t) {
for (j = 0; j < newObj.a[roomList[t]].length - 1; j++)
"23d812420e5e49774cc704fb" != newObj.a[roomList[t]][j]._id &&
(document.querySelector(
`#room${t}`
).innerHTML += `<ul style="\n margin: 10px;\n position: relative;\n left: -20px;\n "><span class="message" style="color: white;display:flex"><span class="mention" style="background-color:${
newObj.a[roomList[t]][j].color
};padding: 4px;border-radius: 3px;position: relative;top: 5px;display:block;min-width: 180px;">${
newObj.a[roomList[t]][j].name
}</span><span style="\n position: relative;\n top: 6px;\n left: 10px;\n ">(${newObj.a[roomList[t]][j]._id})</span></span> </ul>`);
setTimeout(() => {
-1 == document.querySelector(`#room${t}`).innerHTML.indexOf('class="message"') && (document.querySelector(`#room${t}`).outerHTML = "");
}, 5e3);
}
async function listPpl() {
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", () => {
(document.querySelector("#another").style.display = "none"), (document.querySelector("#modal > div.bg").style.display = "block"), document.querySelector("#modal > div.bg").click();
}),
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", {
method: "GET",
}).then((e) => e.json())),
(roomList = Object.keys(lolWhy.a)),
(document.querySelector("#listEveryone").innerHTML = ""),
Object.keys(lolWhy.a).forEach((e) => {
"" != e.replace(/[^a-zA-Z0-9]/g, "") &&
(document.querySelector("#listEveryone").innerHTML += `<li><div id="room${e.replace(
/[^a-zA-Z0-9]/g,
""
)}" style="\n position: absolute;\n left: -25px;\n top: 0;\n padding: 5px;\n width: 240px;\n height: 12px;\n background: #444;\n border: 1px solid #ccc;\n /* cursor: pointer; */\n margin: 4px 24px;\n /* font-size: 12px; */\n position: relative;\n display:inline-block;\n margin-top: 30px;\n ">${e}<div id="join-btn" onclick="MPP.client.setChannel(\`${e}\`);history.pushState('', '', ' ?c=' + \`${e}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\n position: relative;\n left: 255px;\n top: -25px;\n ">Join this room</div></div></li>`);
}),
Object.keys(lolWhy.a).forEach((e) => {
Object.keys(lolWhy.a[e]).forEach((t) => {
"23d812420e5e49774cc704fb" != lolWhy.a[e][t]._id &&
(document.querySelector(
"#room" + e.replace(/[^a-zA-Z0-9]/g, "")
).innerHTML += ` <ul style="\n margin: 10px;\n position: relative;\n left: -20px;\n inline-size: max-content;"><span class="message" style="color: white;"><span class="mention" style="background-color: ${lolWhy.a[e][t].color};padding: 4px;border-radius: 3px;position: relative;top: 5px;">${lolWhy.a[e][t].name}</span><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> </ul>`);
});
}),
(list.innerHTML +=
'<br><br><br><button class="submit" onclick="document.querySelector("#modal > div.bg").click()" style="\n position: relative;\n bottom: -10px;\n right: -380px;\n ">CLOSE</button>');
}
function UwU(e) {
if (1 == UwUmode) {
const t = ["(¬‿¬)", "(´∩。• ᵕ •。∩`)", "(*≧ω≦)", "ʕ•ᴥ•ʔ", "UwU", "O.O", ">.<", "(˶˃ᆺ˂˶)", "⸜(。˃ ᵕ ˂ )⸝", "(≧ヮ≦)", "•⩊•"];
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");
}
return e;
}
function UwUOnOff(e) {
-1 != e.innerText.indexOf("En") ? ((e.innerText = "Disable UωU mode"), (UwUmode = !0)) : ((e.innerText = "Enable UωU mode"), (UwUmode = !1));
}
function encodedecode(e) {
-1 != e.innerText.indexOf("n")
? ((e.innerText = "Decode"),
(MPP.chat.send = (e) => {
if ("You can chat with this thing." == document.querySelector("#chat-input").placeholder)
MPP.client.sendArray([
{
m: "a",
message: encode(UwU(e)),
},
]);
else
for (once = !1, i = 0; i < document.querySelector("#chat > ul").children.length; i++) {
if (
-1 != document.querySelector("#chat-input").placeholder.indexOf(MPP.client.findParticipantById(document.querySelector("#chat > ul").children[i].title).name) &&
0 == once &&
(-1 != document.querySelector("#chat-input").placeholder.indexOf("Direct messaging") &&
((once = !0),
MPP.client.sendArray([
{
m: "dm",
_id: idToDM,
message: encode(UwU(e)),
},
])),
-1 != document.querySelector("#chat-input").placeholder.indexOf("Replying to") && -1 == document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
)
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "a",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
message: encode(UwU(e)),
},
]),
MPP.chat.cancelReply());
if (-1 != document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "dm",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
_id: document.querySelector("#chat > ul").children[i].title,
message: encode(UwU(e)),
},
]),
MPP.chat.cancelReply());
}
}))
: ((e.innerText = "Encode"),
(MPP.chat.send = (e) => {
if ("You can chat with this thing." == document.querySelector("#chat-input").placeholder)
MPP.client.sendArray([
{
m: "a",
message: UwU(e),
},
]);
else
for (once = !1, i = 0; i < document.querySelector("#chat > ul").children.length; i++) {
if (
-1 != document.querySelector("#chat-input").placeholder.indexOf(MPP.client.findParticipantById(document.querySelector("#chat > ul").children[i].title).name) &&
0 == once &&
(-1 != document.querySelector("#chat-input").placeholder.indexOf("Direct messaging") &&
((once = !0),
MPP.client.sendArray([
{
m: "dm",
_id: idToDM,
message: UwU(e),
},
])),
-1 != document.querySelector("#chat-input").placeholder.indexOf("Replying to") && -1 == document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
)
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "a",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
message: UwU(e),
},
]),
MPP.chat.cancelReply());
if (-1 != document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "dm",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
_id: document.querySelector("#chat > ul").children[i].title,
message: UwU(e),
},
]),
MPP.chat.cancelReply());
}
}));
}
function rgbToHex(e, t, n) {
return "#" + ((1 << 24) | (e << 16) | (t << 8) | n).toString(16).slice(1);
}
function openclosemidiplayer(e) {
-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"));
}
function dec() {
getSelection().anchorNode.data = decode(getSelection().anchorNode.data);
}
(list.innerHTML = ""),
setInterval(() => {
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);
}),
setInterval(() => {
"65cc3012e78cd44b5bd2bfd5" == MPP.client.participantId &&
document.querySelector(`#assistant-nametag-${idSelected}`) &&
createUsernameButton("Set Tag", () => {
(idToMove = document.querySelector("body > div.participant-menu > div:nth-child(1)").innerHTML),
document.querySelector("#rename2") ||
((rename2 = document.createElement("div")),
(rename2.id = "rename2"),
(rename2.classList = "dialog"),
(rename2.style.display = "block"),
(rename2.innerHTML =
'<p><input type="text" name="id" style="display:none"><input type="text" name="name" placeholder="His Fancy New Name" maxlength="40" class="text"> <input type="color" name="color" placeholder="" maxlength="7" class="color"></p>\n <button class="submit">SET TAG</button>\n '),
document.querySelector("#modals").appendChild(rename2)),
(document.querySelector("#modal").style.display = "block"),
(document.querySelector("#rename2").style.display = "block"),
(document.querySelector("#rename2 > p > input[type=text]:nth-child(1)").value = idToMove),
(document.querySelector("#rename2 > p > input.text").value = JSON.parse(decode(users[idToMove].tags)).text),
(document.querySelector("#rename2 > p > input.color").value = JSON.parse(decode(users[idToMove].tags)).color),
document.querySelector("#rename2 > button").addEventListener("click", () => {
MPP.client.sendArray([
{
m: "custom",
data: {
event: "settag",
target: idToMove,
text: document.querySelector("#rename2 > p > input.text").value,
color: document.querySelector("#rename2 > p > input.color").value,
tag: false,
},
target: {
mode: "subscribed",
global: "true",
},
},
]),
document.querySelector("#modal > div.bg").click();
});
});
}),
(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),
(MPP.chat.send = (e) => {
if ("You can chat with this thing." == document.querySelector("#chat-input").placeholder)
MPP.client.sendArray([
{
m: "a",
message: UwU(e),
},
]);
else
for (once = !1, i = 0; i < document.querySelector("#chat > ul").children.length; i++) {
if (
-1 != document.querySelector("#chat-input").placeholder.indexOf(MPP.client.findParticipantById(document.querySelector("#chat > ul").children[i].title).name) &&
0 == once &&
(-1 != document.querySelector("#chat-input").placeholder.indexOf("Direct messaging") &&
((once = !0),
MPP.client.sendArray([
{
m: "dm",
_id: idToDM,
message: UwU(e),
},
])),
-1 != document.querySelector("#chat-input").placeholder.indexOf("Replying to") && -1 == document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
)
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "a",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
message: UwU(e),
},
]),
MPP.chat.cancelReply());
if (-1 != document.querySelector("#chat-input").placeholder.indexOf("in a DM"))
for (i = 0; i < document.querySelector("#chat > ul").children.length; i++)
"" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
"unset" != document.querySelector("#chat > ul").children[i].style.backgroundColor &&
(MPP.client.sendArray([
{
m: "dm",
reply_to: document.querySelector("#chat > ul").children[i].id.split("-")[1],
_id: document.querySelector("#chat > ul").children[i].title,
message: UwU(e),
},
]),
MPP.chat.cancelReply());
}
});
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(""));
function decode(e) {
return e
.split("")
.map((e) => (DICT.find((t) => t[0] === e) || [, e])[1])
.join("");
}
function encode(e) {
return e
.split("")
.map((e) => (DICT.find((t) => t[1] === e) || [e])[0])
.join("");
}
function createUsernameButton(name, func) {
if (document.querySelector("body > div.participant-menu") && -1 == document.querySelector("body > div.participant-menu").innerHTML.indexOf(name) && -1 != "65cc3012e78cd44b5bd2bfd5".indexOf(MPP.client.participantId)) {
let e = document.createElement("div");
e.classList.add("menu-item"),
(e.onclick = () => {
eval(func.toString().substr(5, func.toString().length - 6) + "}");
}),
(e.innerText = name),
document.querySelector("body > div.participant-menu").appendChild(e);
}
}
function rename(e, t) {
MPP.client.sendArray([
{
m: "userset",
set: {
name: e,
color: t,
},
},
]);
}
let encodeButton = document.createElement("div");
encodeButton.classList.add("ugly-button"),
(encodeButton.id = "client-encode-btn"),
(encodeButton.style = "position: relative;top: 4px;left: 779px;"),
(encodeButton.onclick = () => {
encodedecode(encodeButton);
}),
(encodeButton.innerText = "Encode"),
document.querySelector("#bottom > div.relative").appendChild(encodeButton);
let midiPlayerButton = document.createElement("div");
midiPlayerButton.classList.add("ugly-button"),
(midiPlayerButton.id = "client-encode-btn"),
(midiPlayerButton.style = "position: relative;top: 8px;left: 900px;"),
(midiPlayerButton.onclick = () => {
openclosemidiplayer(midiPlayerButton);
}),
(midiPlayerButton.innerText = "Open Midi Player"),
document.querySelector("#bottom > div.relative").appendChild(midiPlayerButton);
let decodeButton = document.createElement("div");
decodeButton.classList.add("ugly-button"),
(decodeButton.id = "client-decode-btn"),
(decodeButton.style = "position: relative;top: -44px;left: 900px;width: 140px;"),
(decodeButton.onclick = () => {
dec();
}),
(decodeButton.innerText = "Decode selected text"),
document.querySelector("#bottom > div.relative").appendChild(decodeButton);
let whereButton = document.createElement("div");
if (
(whereButton.classList.add("ugly-button"),
(whereButton.id = "client-where-btn"),
(whereButton.style = "display: block;z-index:2;position: relative;top: -40px;left: 1020px;width: fit-content;"),
(whereButton.onclick = () => {
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();
}),
(whereButton.innerText = "Locate Assistant Users"),
document.querySelector("#bottom > div.relative").appendChild(whereButton),
"8956941e9807fc3991035dcf" != MPP.client.participantId)
) {
let e = document.createElement("div");
e.classList.add("ugly-button"),
(e.id = "client-find-btn"),
(e.style = "display: block;position: relative;top: -64px;left: 420px;display:none;"),
(e.onclick = () => {
document.querySelector("#find") ||
((find = document.createElement("div")), (find.id = "find"), (find.classList = "dialog"), (find.style = "display: block;font-size: 12px;width: auto;height: auto;min-width: 380px;top: 50%;z-index:2;")),
document.querySelector("#modals").appendChild(find),
(document.querySelector("#modal").style.display = "block"),
(document.querySelector("#find").style.display = "block"),
(find.innerHTML =
'Please type here an id or a name (or a part of name):<br><p><input type="text" name="name" placeholder="Id or name" maxlength="40" class="text"> </p><br><br>\n <button class="submit" onclick=\'idSearching=document.querySelector("#find > p > input").value;findSmn()\'>SEARCH</button>\n\n '),
(idSearching = null),
findSmn();
}),
(e.innerText = "Find someone"),
document.querySelector("#bottom > div.relative").appendChild(e);
let t = document.createElement("div");
t.classList.add("ugly-button"),
(t.id = "client-list-btn"),
(t.style = style = "display: block;position: relative;top: -92px;left: 1056px;"),
(t.onclick = () => {
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();
}),
(t.innerText = "List everyone"),
document.querySelector("#bottom > div.relative").appendChild(t);
}
let uwuButton = document.createElement("div");
function convert(e) {
function t(e) {
return ("0" + parseInt(e).toString(16)).slice(-2);
}
return "#" + t((e = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))[1]) + t(e[2]) + t(e[3]);
}
uwuButton.classList.add("ugly-button"),
(uwuButton.id = "client-uwu-btn"),
(uwuButton.style = style = "display: block;z-index: 2;position: relative;top: -87px;left: 420px;width: fit-content;font-size: 11.2px;"),
(uwuButton.onclick = () => {
UwUOnOff(uwuButton);
}),
(uwuButton.innerText = "Enable UωU Mode"),
document.querySelector("#bottom > div.relative").appendChild(uwuButton),
localStorage.tag ||
(localStorage.tag = encode(
JSON.stringify({
color: "#c177ff",
text: "ASSISTANT USER",
})
)),
(tags = []),
MPP.client.on("custom", (e) => {
Object.keys(users).forEach((e) => {
document.querySelectorAll("#cursors > div").forEach((n) => {
n.children[0].children[0] &&
document.querySelector(`#namediv-${e}`) &&
document.querySelector(`#namediv-${e}`).style.backgroundColor == n.children[0].style.backgroundColor &&
document.querySelector(`#nametext-${e}`).innerText == n.children[0].children[0].innerText &&
document.querySelector(`#assistant-nametag-${e}`) &&
(n.children[0].innerHTML = `<span class="curtag" id="nametag-cursor-${e}" style="background-color: ${document.querySelector(`#assistant-nametag-${e}`).style.background};">${
document.querySelector(`#assistant-nametag-${e}`).innerText
}</span><span class="nametext">${document.querySelector(`#nametext-${e}`).innerText}</span>`);
}),
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));
});
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: black;position: absolute;top: 4px;"></div><div class="nametag" id="assistant-nametag-${e.p}" title="This is an assistant user." style="background:black"></div><div class="nametext" id="nametext-${e.p}"></div>`,
document.querySelector(`#assistant-nametagk-${e.p}`).innerText=tag.text,
document.querySelector(`#assistant-nametagmask-${e.p}`).innerText=tag.text,
document.querySelector(`#assistant-nametag-${e.p}`).style.backgroundColor=tag.color,
document.querySelector(`#assistant-nametagmask-${e.p}`).style.backgroundColor=tag.color,
document.querySelector(`#nametext-${e.p}`).style.backgroundColor=users[e.p].name
)
: 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 &&
e.data.tag == "false" &&
(localStorage.tag = encode(
JSON.stringify({
color: e.data.color,
text: e.data.text,
})
)),
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", () => {
open("https://update.gf.qytechs.cn/scripts/484154/MPP%20Assistant%20by%20RoxasYTB.user.js"), document.querySelector(".bg").click();
}),
(document.querySelector("#modal").style.display = "block"),
(document.querySelector(".bg").style.display = "block"),
(document.querySelector(motd).style.display = "block")));
if (e.data.event == "settag" && e.data.tag != false && MPP.client.participantId == e.data.target && e.p == "65cc3012e78cd44b5bd2bfd5") {
console.log(e.data);
MPP.client.sendArray([
{
m: "userset",
set: {
name: e.data.text,
color: e.data.color,
},
},
]);
}
});
setInterval(() => {
(now = new Date().getTime()),
Object.keys(users).forEach((e) => {
if (users[e].expiresAt < now + 1000) {
delete users[e];
if (document.querySelector(`#assistant-nametag-${e}`) && !users[e]) {
document.querySelector(`#assistant-nametag-${e}`).remove();
document.querySelector(`#assistant-nametagmask-${e}`).remove();
}
if (document.querySelector(`#nametag-cursor-${e}`) && !users[e]) {
document.querySelector(`#nametag-cursor-${e}`).remove();
}
}
});
}, 3000),
setInterval(() => {
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: ${
document.querySelector(`#namediv-${MPP.client.participantId}`).style.backgroundColor
};position: absolute;top: 4px;">${ownTag.text}</div><div class="nametag" id="assistant-nametag-${MPP.client.participantId}" title="This is an assistant user." style="background:${ownTag.color}">${
ownTag.text
}</div>` + document.querySelector(`#namediv-${MPP.client.participantId}`).innerHTML)
: ((document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).innerText = ownTag.text),
(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)),
(users[MPP.client.participantId] = {
assistant_users: {
version: actualVersion,
id: MPP.client.participantId,
expiresAt: new Date().getTime() + 3e3,
tags: localStorage.tag,
location: MPP.client.channel.id,
name: MPP.client.getOwnParticipant().name,
color: MPP.client.getOwnParticipant().color,
},
}),
MPP.client.sendArray([
{
m: "+custom",
},
{
m: "custom",
data: users[MPP.client.participantId],
target: {
mode: "subscribed",
global: "true",
},
},
]));
document.querySelectorAll("#room>ul").forEach((e) => {
e.remove();
});
}, 2e3);
})();