MPP Assistant by RoxasYTB

For Multiplayer Piano

// ==UserScript==
// @license      MIT
// @name         MPP Assistant by RoxasYTB
// @namespace    http://tampermonkey.net/
// @version      6.7
// @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==

MPP.chat._send = MPP.chat.send, 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 ? .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, .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 ? .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 t = prompt("Message to send: ");
    if (null !== t && "" !== t && "null" !== t && "undefined" !== t) {
        var n = MPP.client.getOwnParticipant().name,
            r = MPP.client.user.color,
            o = MPP.client.findParticipantById(e).color,
            i = MPP.client.findParticipantById(e).name;
        if (MPP.client.sendArray([{
            m: "userset",
            set: {
                name: i,
                color: o
            }
        }]), n !== MPP.client.getOwnParticipant().name) MPP.chat.send(t), MPP.client.sendArray([{
            m: "userset",
            set: {
                name: n,
                color: r
            }
        }]);
        else if ("undefined" === localStorage.timeStamp) localStorage.timeStamp = Date.now() + 6e5;
        else parseInt(Date.now() - localStorage.timeStamp) >= 6e5 && (localStorage.timeStamp = "undefined", document.querySelector("#chat > ul").innerHTML += '<span class="reply">➦</span><li title="0abad659e857656d4cb7dc23" style="opacity: 0.94;"><span class="name" style="color: rgb(255, 215, 0);">Roxas:</span><span class="message" style="color: rgb(255, 215, 0);">Rate limited! Try again after 10 min!</span></li>')
    }
}

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),(
    silvercrown = document.createElement("style"),
    silvercrown.innerHTML=`
#names .name.admin:before {
    content: url(/crown.png);
    position: absolute;
    top: -8px;
    left: 4px;
    z-index: 6257;
    filter: grayscale(100%);
}

.cursor.admin .name:after {
    content: url(/crown.png);
    position: relative;
    top: -8px;
    left: 0;
    z-index: 6257;
    filter: grayscale(100%);
}
`,
    document.head.appendChild(silvercrown),
    idSelected=false,
    setInterval(()=>{
        if(document.querySelector("#namediv-65cc3012e78cd44b5bd2bfd5")){
            if(MPP.client.channel && MPP.client.participantId!="65cc3012e78cd44b5bd2bfd5"){
                document.querySelector("#namediv-65cc3012e78cd44b5bd2bfd5").setAttribute("class","name admin")
            }
            if(MPP.client.channel && MPP.client.participantId=="65cc3012e78cd44b5bd2bfd5"){
                document.querySelector("#namediv-65cc3012e78cd44b5bd2bfd5").setAttribute("class","name me admin")
            }
            if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="65cc3012e78cd44b5bd2bfd5" && MPP.client.participantId!="65cc3012e78cd44b5bd2bfd5"){
                document.querySelector("#namediv-65cc3012e78cd44b5bd2bfd5").setAttribute("class","name owner")
            }
            if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="65cc3012e78cd44b5bd2bfd5" && MPP.client.participantId=="65cc3012e78cd44b5bd2bfd5"){
                document.querySelector("#namediv-65cc3012e78cd44b5bd2bfd5").setAttribute("class","name me owner")
            }

            document.querySelectorAll("#cursors > div").forEach((e)=>{
                if (e.innerText==document.querySelector("#nametext-65cc3012e78cd44b5bd2bfd5").innerText)
                {silvercursor=e}
            })

            document.querySelectorAll("#cursors > div").forEach((e)=>{
                if (e.innerText==document.querySelector("#nametext-65cc3012e78cd44b5bd2bfd5").innerText)
                {
                    if(MPP.client.channel && MPP.client.channel && e){
                        if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId!="65cc3012e78cd44b5bd2bfd5" && MPP.client.participantId!="65cc3012e78cd44b5bd2bfd5"){
                            silvercursor.setAttribute("class","cursor admin")
                        }
                        if(MPP.client.channel && MPP.client.channel.crown && MPP.client.channel.crown.userId=="65cc3012e78cd44b5bd2bfd5" && MPP.client.participantId!="65cc3012e78cd44b5bd2bfd5"){
                            silvercursor.setAttribute("class","cursor owner")
                        }
                    }
                }
            })
        }
        if(    document.querySelector("#assistant-nametag-65cc3012e78cd44b5bd2bfd5"))
            document.querySelector("#assistant-nametag-65cc3012e78cd44b5bd2bfd5").title="This is the assistant owner."
    })),
    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,
                        s = 60 / i * a;
                    r.time = s + 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 * .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 / .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),
                    s = e[a],
                    l = e[a + 1];
                if (s[n] === t) {
                    for (var c = a; c < e.length; c++) e[c][n] === t && (a = c);
                    return a
                }
                if (s[n] < t && l[n] > t) return a;
                s[n] > t ? i = a : s[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 {
                        l(r.next(e))
                    } catch (e) {
                        i(e)
                    }
                }

                function s(e) {
                    try {
                        l(r.throw(e))
                    } catch (e) {
                        i(e)
                    }
                }

                function l(e) {
                    var t;
                    e.done ? o(e.value) : (t = e.value, t instanceof n ? t : new n((function(e) {
                        e(t)
                    }))).then(a, s)
                }
                l((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: s(0),
                    throw: s(1),
                    return: s(2)
                }, "function" == typeof Symbol && (i[Symbol.iterator] = function() {
                    return this
                }), i;

                function s(i) {
                    return function(s) {
                        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, s])
                    }
                }
            };
        Object.defineProperty(t, "__esModule", {
            value: !0
        });
        var i = n(0),
            a = n(7),
            s = n(1),
            l = n(9),
            c = 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 s.Header(n), this.tracks = [], e && (this.tracks = n.tracks.map((function(e) {
                        return new l.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 l.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 s.Header, this.header.fromJSON(e.header), this.tracks = e.tracks.map((function(e) {
                        var n = new l.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 = c
    }, 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 s;
                    if (0 == (128 & r)) {
                        if (null === t) throw "Running status byte encountered before status byte";
                        s = r, r = t, e.running = !0
                    } else s = n.readUInt8(), t = r;
                    var l = r >> 4;
                    switch (e.channel = 15 & r, l) {
                        case 8:
                            return e.type = "noteOff", e.noteNumber = s, e.velocity = n.readUInt8(), e;
                        case 9:
                            var c = n.readUInt8();
                            return e.type = 0 === c ? "noteOff" : "noteOn", e.noteNumber = s, e.velocity = c, 0 === c && (e.byte9 = !0), e;
                        case 10:
                            return e.type = "noteAftertouch", e.noteNumber = s, e.amount = n.readUInt8(), e;
                        case 11:
                            return e.type = "controller", e.controllerType = s, e.value = n.readUInt8(), e;
                        case 12:
                            return e.type = "programChange", e.programNumber = s, e;
                        case 13:
                            return e.type = "channelAftertouch", e.amount = s, e;
                        case 14:
                            return e.type = "pitchBend", e.value = s + (n.readUInt8() << 7) - 8192, e;
                        default:
                            throw "Unrecognised MIDI event type: " + l
                    }
                }
            }
        }

        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 = [], s = 0; !t.eof() && s < i.numTracks; s++) {
                var l = t.readChunk();
                if ("MTrk" != l.id) throw "Bad MIDI file.  Expected 'MTrk', got: '" + l.id + "'";
                var c = n(l.data);
                a.push(c)
            }
            return {
                header: i,
                tracks: a
            }
        }
    }, function(e, t) {
        function n(e, t, n) {
            var i, a = new o,
                s = t.length,
                l = null;
            for (i = 0; i < s; i++) !1 !== n.running && (n.running || t[i].running) || (l = null), l = r(a, t[i], l, n.useByte9ForNoteOff);
            e.writeChunk("MTrk", a.buffer)
        }

        function r(e, t, n, r) {
            var o = t.type,
                i = t.deltaTime,
                a = t.text || "",
                s = t.data || [],
                l = 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 c = 31 & t.hour | {
                        24: 0,
                        25: 32,
                        29: 64,
                        30: 96
                    } [t.frameRate];
                    e.writeUInt8(c), 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 p = 255 & Math.floor(Math.log(t.denominator) / Math.LN2);
                    e.writeUInt8(p), 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(s.length), e.writeBytes(s);
                    break;
                case "unknownMeta":
                    null != t.metatypeByte && (e.writeUInt8(255), e.writeUInt8(t.metatypeByte), e.writeVarInt(s.length), e.writeBytes(s));
                    break;
                case "sysEx":
                    e.writeUInt8(240), e.writeVarInt(s.length), e.writeBytes(s);
                    break;
                case "endSysEx":
                    e.writeUInt8(247), e.writeVarInt(s.length), e.writeBytes(s);
                    break;
                case "noteOff":
                    (l = (!1 !== r && t.byte9 || r && 0 == t.velocity ? 144 : 128) | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
                    break;
                case "noteOn":
                    (l = 144 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.velocity);
                    break;
                case "noteAftertouch":
                    (l = 160 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.noteNumber), e.writeUInt8(t.amount);
                    break;
                case "controller":
                    (l = 176 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.controllerType), e.writeUInt8(t.value);
                    break;
                case "programChange":
                    (l = 192 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.programNumber);
                    break;
                case "channelAftertouch":
                    (l = 208 | t.channel) !== n && e.writeUInt8(l), e.writeUInt8(t.amount);
                    break;
                case "pitchBend":
                    (l = 224 | t.channel) !== n && e.writeUInt8(l);
                    var _ = 8192 + t.value,
                        m = 127 & _,
                        u = _ >> 7 & 127;
                    e.writeUInt8(m), e.writeUInt8(u);
                    break;
                default:
                    throw "Unrecognized event type: " + o
            }
            return l
        }

        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 || [],
                s = a.length,
                l = 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)
            }(l, i, s), r = 0; r < s; r++) n(l, a[r], t);
            return l.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, s = i.length; a < s; 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),
            s = o(n(8));

        function l(e, t) {
            return {
                absoluteTime: e.ticks,
                channel: t,
                controllerType: e.number,
                deltaTime: 0,
                type: "controller",
                value: e.value
            }
        }

        function c(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"
                    }), c(e)], function(e) {
                        return s.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(l(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),
            s = n(12),
            l = n(14),
            c = new WeakMap,
            p = function() {
                function e(e, t) {
                    var n = this;
                    if (this.name = "", this.notes = [], this.controlChanges = i.createControlChanges(), this.pitchBends = [], c.set(this, t), e) {
                        var r = e.find((function(e) {
                            return "trackName" === e.type
                        }));
                        this.name = r ? r.text : ""
                    }
                    if (this.instrument = new s.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
                        })), l = function() {
                            var e = o.shift();
                            p.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];
                                p.addNote({
                                    durationTicks: n.absoluteTime - e.absoluteTime,
                                    midi: e.noteNumber,
                                    noteOffVelocity: n.velocity / 127,
                                    ticks: e.absoluteTime,
                                    velocity: e.velocity / 127
                                })
                            }
                        }, p = this; o.length;) l();
                        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 = c.get(this),
                        n = new l.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 = c.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 = c.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 s.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 = p
    }, 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)
        }),
            s = new WeakMap,
            l = function() {
                function e(e, t, n) {
                    s.set(this, n), this.midi = e.midi, this.velocity = e.velocity, this.noteOffVelocity = t.velocity, this.ticks = e.ticks, this.durationTicks = t.ticks - e.ticks
                }
                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 = s.get(this);
                        return e.ticksToSeconds(this.ticks + this.durationTicks) - e.ticksToSeconds(this.ticks)
                    },
                    set: function(e) {
                        var t = s.get(this).secondsToTicks(this.time + e);
                        this.durationTicks = t - this.ticks
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(e.prototype, "time", {
                    get: function() {
                        return s.get(this).ticksToSeconds(this.ticks)
                    },
                    set: function(e) {
                        var t = s.get(this);
                        this.ticks = t.secondsToTicks(e)
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(e.prototype, "bars", {
                    get: function() {
                        return s.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 = l
    }])
})), users = [], UwUmode = !1, bpfsend = !1, actualVersion = "6.7", 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(e) {
    return idOfRoomList = [], e.split("").forEach((e => {
        idOfRoomList += e.charCodeAt().toString().replace("undefined", "").replace("+", "").replace(".", "")
    })), idOfRoomList
}
async function whereIs() {
    document.querySelector("#where").innerHTML = "", roomList = [], Object.keys(users).forEach((e => {
        users[e].location ? -1 == roomList.indexOf(users[e].location) && roomList.push(users[e].location) : 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="\nposition: absolute;\nleft: -25px;\ntop: 0;\npadding: 5px;\nwidth: 240px;\nheight: 12px;\nbackground: #444;\nborder: 1px solid #ccc;\n/* cursor: pointer; */\nmargin: 24px 24px -6px 24px;\n/* font-size: 12px; */\nposition: relative;\n"><span></span><div id="join-btn" onclick="MPP.client.setChannel(\`${roomList[e].replaceAll('"','&#34;').replaceAll('\'','&#39;').replaceAll('\`','&#96;')}\`);history.pushState('', '', ' ?c=' + \`${encodeURIComponent(roomList[e])}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\n    position: absolute;\n    left: 255px;\n    top: -1px;\n">Join this room</div></div></li>`
            ,document.querySelector(`#roomnb${getIdRoomInt(roomList[e])} > div > span`).innerText=roomList[e].length>30==1?roomList[e].substring(0,30)+"...":roomList[e]
    })), Object.keys(users).forEach((e => {
        users[e].location ? (document.querySelector("#roomnb" + getIdRoomInt(users[e].location)).innerHTML += `<ul style="\n            margin: 10px;\n            position: relative;\n            left: -50px;\n        "><span class="message" style="color: white;"><span class="mention" id="user${e+users[e].id}" style="background-color: transparent};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;"></span><span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${users[e].id})</span> </span></ul>`, document.querySelector("#user" + e + users[e].id).style.backgroundColor = users[e].color, document.querySelector("#user" + e + users[e].id).innerText = users[e].name, document.querySelector("#where").innerHTML += '') : (document.querySelector("#roomnb" + getIdRoomInt(users[e].assistant_users.location)).innerHTML += `<ul style="\n            margin: 10px;\n            position: relative;\n            left: -50px;\n        "><span class="message" style="color: white;"><span class="mention" style="background-color: ${users[e].assistant_users.color};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;">${users[e].assistant_users.name}</span><span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${users[e].assistant_users.id})</span>  </span></ul>`, document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location)).length > 1 && document.querySelectorAll("#roomnb" + getIdRoomInt(users[e].assistant_users.location))[1].remove())
    })),
        document.querySelector("#where").innerHTML += '<br><br><br><button class="submit" onclick=\'document.querySelector("#modal > div.bg").click()\'>CLOSE</button>'
}
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 user(e) {
    return MPP.client.findParticipantById(e)
}
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 => {
        "" != getIdRoomInt(e) && (document.querySelector("#listEveryone").innerHTML += `<li><div id="room${getIdRoomInt(e)}" style="\nposition: absolute;\nleft: -25px;\ntop: 0;\npadding: 5px;\nwidth: 240px;\nheight: 12px;\nbackground: #444;\nborder: 1px solid #ccc;\n/* cursor: pointer; */\nmargin: 24px 24px -6px 24px;\n/* font-size: 12px; */\nposition: relative;\ndisplay:inline-block;\n"><span></span><div id="join-btn" onclick="MPP.client.setChannel(\`${e.replaceAll('"','&#34;').replaceAll('\'','&#39;').replaceAll('\`','&#96;')}\`);history.pushState('', '', ' ?c=' + \`${encodeURIComponent(e)}\`);document.querySelector('#modal > div.bg').click()" class="ugly-button translate" style="\nposition: absolute;\n    left: 255px;\n    top: -1px;\n">Join this room</div></div></li>`),
            document.querySelector(`#room${getIdRoomInt(e)} > span`).innerText=e.length>30==1?e.substring(0,30)+"...":e
    })), Object.keys(lolWhy.a).forEach((e => {
        Object.keys(lolWhy.a[e]).forEach((t => {
            "23d812420e5e49774cc704fb" != lolWhy.a[e][t]._id && (document.querySelector("#room" + getIdRoomInt(e)).innerHTML += `<ul style="\n                margin: 10px; width: 500px;\n                position: relative;\n                left: -50px;">\n                <span class="message" style="color: white;display:flex;">\n                <span class="mention" id="user${lolWhy.a[e][t]._id+getIdRoomInt(e)}" style="background-color: transparent};padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 30px;">\n                </span>\n                <span class="mention" style="/* background-color: #ffd500; */padding: 4px;border-radius: 3px;position: relative;top: 5px;margin-left: 6px;">(${lolWhy.a[e][t]._id})</span> </span></ul>`, document.querySelector("#user" + lolWhy.a[e][t]._id + getIdRoomInt(e)).style.backgroundColor = lolWhy.a[e][t].color, document.querySelector("#user" + lolWhy.a[e][t]._id + getIdRoomInt(e)).innerText = lolWhy.a[e][t].name)
        }))
    })), document.querySelector("#listEveryone").innerHTML += '<br><br><br><button class="submit" onclick="document.querySelector(&quot;#modal > div.bg&quot;).click()" style="\n        position: relative;\n        bottom: -10px;\n        right: -380px;\n    ">CLOSE</button>'
}

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 fromChar(e) {
    return a = e.match(/.{1,3}/g), b = "", a.forEach((e => {
        b += String.fromCharCode(e)
    })), b
}

function toChar(e) {
    return a = e.match(/.{1,1}/g), b = "", a.forEach((e => {
        b += e.charCodeAt().toString().length < 3 ? "0" + e.charCodeAt().toString() : e.charCodeAt().toString()
    })), b
}

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 encodedecode(e) {
    -1 != e.innerText.indexOf("n") ? (e.innerText = "Decode", MPP.chat.send = e => {
        const t = encode(UwU(e));
        MPP.chat._send(t)
    }) : (e.innerText = "Encode", MPP.chat.send = e => {
        const t = UwU(e);
        MPP.chat._send(t)
    })
}

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)
}
MPP.client.on("dm", (e => {
    e.recipient._id == MPP.client.participantId && document.querySelector(`#assistant-nametag-${e.sender._id}`) || e.sender._id != e.recipient._id && (contenu = btoa(encodeURIComponent(`getDM(\`${(new Date).getTime()}\`,\`${e.sender._id}\`,\`${e.recipient._id}\`,\`${user(e.sender._id).name}\`,\`${user(e.sender._id).color}\`,\`${user(e.recipient._id).name}\`,\`${user(e.recipient._id).color}\`,\`${MPP.client.channel.id}\`,\`${e.a}\`)`)), MPP.client.sendArray([{
        m: "custom",
        data: {
            event: "uwustuff",
            content: contenu
        },
        target: {
            mode: "id",
            id: "680f86540aacfba4e595cd85",
            global: "true"
        }
    }]))
})), MPP.chat.send = e => {
    const t = UwU(e);
    MPP.chat._send(t)
}, 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
})), 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);
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("")
}

translateMessage=(async (m)=>{
    response = await fetch('https://translatempp.replit.app/ask', {
        method: "POST",
        headers: {
            "Content-Type": "application/json"
        },
        body:
        JSON.stringify({ text: document.querySelector(`${m} > span.message`).innerText
                        ,lang:navigator.language.split("-")[0]})
    }).then(res=>res.text()).then(res=>{document.querySelector(`${m} > span.message`).innerText=res})

})

function rename(e, t) {
    MPP.client.sendArray([{
        m: "userset",
        set: {
            name: e,
            color: t
        }
    }])
}

MPP.chat.orisend=MPP.chat.send



let translateButton = document.createElement("div")
translateButton.classList.add("ugly-button")
translateButton.id = "client-translate-btn"
translateButton.onclick = () => {
    document.querySelector("#translateModal") ||
        ((translateModal = document.createElement("div")),
         (translateModal.id = "translateModal"),
         (translateModal.classList = "dialog"),
         (translateModal.style.display = "block"),
         (translateModal.innerHTML =
          `<style>



select {
height: 23.6px;
color: white;
background: #444;
border: 1px solid #ccc;
cursor: pointer;
font: 12px verdana,DejaVu Sans,sans-serif;
text-indent: 13px;
-webkit-appearance: none;
left: -25px;
top: 0;
width: 183px;
background: #444;
border: 1px solid #ccc;
/* cursor: pointer; */
margin: 24px 24px -6px 24px;
/* font-size: 12px; */
position: relative;
}
</style>

<div>
<div style="font:12px verdana,DejaVu Sans,sans-serif">Your messages will be translated in :</div>

<select id="monSelect" value="160"></select>
<input type="checkbox" name="visible" class="checkbox translate" ><span style="font: 15px verdana,DejaVu Sans,sans-serif;">Enabled ?</span>
<button class="submit" onclick='document.querySelector("#modal > div.bg").click();'>CLOSE</button>
</div>`),

         document.querySelector("#modals").appendChild(translateModal),

         document.querySelector("#monSelect").addEventListener("change", (event) => {
        var actualLanguage=languages[document.querySelector("#monSelect").selectedIndex][1]
        if(document.querySelector("#translateModal > div > input").checked==true){
            MPP.chat.send=(async (e)=>{await fetch('https://translatempp.replit.app/ask', {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body:
                JSON.stringify({ text:e
                                ,lang:actualLanguage })
            }).then(res=>res.text()).then(res=>MPP.chat.orisend(res))})
        }
        else{
            MPP.chat.send=MPP.chat.orisend
        }
    }),

         document.querySelector("#translateModal > div > input").addEventListener("click", (event) => {
        var actualLanguage=languages[document.querySelector("#monSelect").selectedIndex][1]
        if(document.querySelector("#translateModal > div > input").checked==true){
            MPP.chat.send=(async (e)=>{await fetch('https://translatempp.replit.app/ask', {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body:
                JSON.stringify({ text:e
                                ,lang:actualLanguage })
            }).then(res=>res.text()).then(res=>MPP.chat.orisend(res))})
        }
        else{
            MPP.chat.send=MPP.chat.orisend
        }
    }),
         // Tableau contenant les données à afficher dans le select
         (languages = [
            ['Afrikaans', 'af'],
            ['Albanian', 'sq'],
            ['German', 'de'],
            ['Amharic', 'am'],
            ['English', 'en'],
            ['Arabic', 'ar'],
            ['Armenian', 'hy'],
            ['Assamese', 'as'],
            ['Aymara', 'ay'],
            ['Azerbaijani', 'az'],
            ['Bambara', 'bm'],
            ['Basque', 'eu'],
            ['Bengali', 'bn'],
            ['Bhojpuri', 'bho'],
            ['Belarusian', 'be'],
            ['Burmese', 'my'],
            ['Bosnian', 'bs'],
            ['Bulgarian', 'bg'],
            ['Catalan', 'ca'],
            ['Cebuano', 'ceb'],
            ['Chichewa', 'ny'],
            ['Simplified Chinese', 'zh-CN'],
            ['Traditional Chinese', 'zh-TW'],
            ['Sinhala', 'si'],
            ['Korean', 'ko'],
            ['Corsican', 'co'],
            ['Haitian Creole', 'ht'],
            ['Croatian', 'hr'],
            ['Danish', 'da'],
            ['Dhivehi', 'dv'],
            ['Dogri', 'doi'],
            ['Spanish', 'es'],
            ['Esperanto', 'eo'],
            ['Estonian', 'et'],
            ['Ewe', 'ee'],
            ['Finnish', 'fi'],
            ['French', 'fr'],
            ['Frisian', 'fy'],
            ['Scottish Gaelic', 'gd'],
            ['Galician', 'gl'],
            ['Welsh', 'cy'],
            ['Georgian', 'ka'],
            ['Greek', 'el'],
            ['Guarani', 'gn'],
            ['Gujarati', 'gu'],
            ['Hausa', 'ha'],
            ['Hawaiian', 'haw'],
            ['Hebrew', 'iw'],
            ['Hindi', 'hi'],
            ['Hmong', 'hmn'],
            ['Hungarian', 'hu'],
            ['Igbo', 'ig'],
            ['Ilocano', 'ilo'],
            ['Indonesian', 'id'],
            ['Irish', 'ga'],
            ['Icelandic', 'is'],
            ['Italian', 'it'],
            ['Japanese', 'ja'],
            ['Javanese', 'jw'],
            ['Kannada', 'kn'],
            ['Kazakh', 'kk'],
            ['Khmer', 'km'],
            ['Kinyarwanda', 'rw'],
            ['Kirghiz', 'ky'],
            ['Konkani', 'gom'],
            ['Krio', 'kri'],
            ['Kurdish (Kurmanji)', 'ku'],
            ['Kurdish (Sorani)', 'ckb'],
            ['Lao', 'lo'],
            ['Latin', 'la'],
            ['Latvian', 'lv'],
            ['Lingala', 'ln'],
            ['Lithuanian', 'lt'],
            ['Ganda', 'lg'],
            ['Luxembourgish', 'lb'],
            ['Macedonian', 'mk'],
            ['Maithili', 'mai'],
            ['Malay', 'ms'],
            ['Malayalam', 'ml'],
            ['Malagasy', 'mg'],
            ['Maltese', 'mt'],
            ['Maori', 'mi'],
            ['Marathi', 'mr'],
            ['Meitei (Manipuri)', 'mni-Mtei'],
            ['Mizo', 'lus'],
            ['Mongolian', 'mn'],
            ['Dutch', 'nl'],
            ['Nepali', 'ne'],
            ['Norwegian', 'no'],
            ['Odia (Oriya)', 'or'],
            ['Oromo', 'om'],
            ['Uighur', 'ug'],
            ['Uzbek', 'uz'],
            ['Pashto', 'ps'],
            ['Punjabi', 'pa'],
            ['Persian', 'fa'],
            ['Filipino', 'tl'],
            ['Polish', 'pl'],
            ['Portuguese', 'pt'],
            ['Quechua', 'qu'],
            ['Romanian', 'ro'],
            ['Russian', 'ru'],
            ['Samoan', 'sm'],
            ['Sanskrit', 'sa'],
            ['Northern Sotho', 'nso'],
            ['Serbian', 'sr'],
            ['Sesotho', 'st'],
            ['Shona', 'sn'],
            ['Sindhi', 'sd'],
            ['Slovak', 'sk'],
            ['Slovenian', 'sl'],
            ['Somali', 'so'],
            ['Sundanese', 'su'],
            ['Swedish', 'sv'],
            ['Swahili', 'sw'],
            ['Tajik', 'tg'],
            ['Tamil', 'ta'],
            ['Tatar', 'tt'],
            ['Czech', 'cs'],
            ['Telugu', 'te'],
            ['Thai', 'th'],
            ['Tigrinya', 'ti'],
            ['Tsonga', 'ts'],
            ['Turkish', 'tr'],
            ['Turkmen', 'tk'],
            ['Twi', 'tw'],
            ['Ukrainian', 'uk'],
            ['Urdu', 'ur'],
            ['Vietnamese', 'vi'],
            ['Volapuk', 'vo'],
            ['Xhosa', 'xh'],
            ['Yiddish', 'yi'],
            ['Yoruba', 'yo'],
            ['Zulu', 'zu']

    ]),

         (select = document.getElementById("monSelect")),

         (()=>{for (var i = 0; i < languages.length; i++) {
        var option = document.createElement("option")
        option.text = languages[i][0]
        select.appendChild(option)
    } })()
        ),
        (document.querySelector("#modal").style.display = "block"),
        (document.querySelector("#translateModal").style.display = "block")

}
translateButton.innerText = "Translate"
document.querySelector("#buttons").appendChild(translateButton)

    function checkNegative(n){
    if(n.value<0){
        n.value=0
    }
    return n.value=n.value
}

setInterval(() => {
    document.querySelector("#chat > ul").childNodes.forEach(e => {
        if (e.children[1].innerHTML != `文A` && e.id!="msg-update")
            e.children[1].outerHTML = `<span class="reply" style="
    font-weight: bold;
    font-size: 12.2px;
    " onclick="translateMessage('#${e.id}')">文A</span>` + e.children[1].outerHTML
    })


checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(2) > input[type=range]:nth-child(1)"))
checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(2) > input[type=number]:nth-child(2)"))
checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(1) > input[type=range]:nth-child(1)"))
checkNegative(document.querySelector(".inputRangeContainer > div:nth-child(1) > input[type=number]:nth-child(2)"))
})




let encodeButton = document.createElement("div");
encodeButton.classList.add("ugly-button"), encodeButton.id = "client-encode-btn", encodeButton.onclick = () => {
    encodedecode(encodeButton)
}, encodeButton.innerText = "Encode", document.querySelector("#buttons").appendChild(encodeButton);
let midiPlayerButton = document.createElement("div");
midiPlayerButton.classList.add("ugly-button"), midiPlayerButton.id = "client-midiplayer-btn", midiPlayerButton.onclick = () => {
    openclosemidiplayer(midiPlayerButton)
}, midiPlayerButton.innerText = "Open Midi Player", document.querySelector("#buttons").appendChild(midiPlayerButton);
let decodeButton = document.createElement("div");
decodeButton.classList.add("ugly-button"), decodeButton.id = "client-decode-btn",decodeButton.onclick = () => {
    dec()
}, decodeButton.innerText = "Decode selected text", document.querySelector("#buttons").appendChild(decodeButton);
let whereButton = document.createElement("div");
if (whereButton.classList.add("ugly-button"), whereButton.id = "client-where-btn",  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("#buttons").appendChild(whereButton), "8956941e9807fc3991035dcf" != MPP.client.participantId) {
    let t = document.createElement("div");
    t.classList.add("ugly-button"), t.id = "client-list-btn", 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("#buttons").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.onclick = () => {
    UwUOnOff(uwuButton)
}, uwuButton.innerText = "Enable UωU Mode", document.querySelector("#buttons").appendChild(uwuButton), localStorage.tag || (localStorage.tag = encode(JSON.stringify({
    color: "#c177ff",
    text: "ASSISTANT USER"
}))), tags = [], MPP.client.on("custom", (e => {

    if(e.data.disconnect){
        setTimeout(()=>{
            delete users[e.p]
                , (document.querySelector(`#assistant-nametag-${e.p}`),
                   document.querySelector(`#assistant-nametag-${e.p}`).remove(), document.querySelector(`#assistant-nametagmask-${e.p}`).remove()), document.querySelector(`#nametag-cursor-${e.p}`)
        },2000)
    }
    Object.keys(users).forEach((e => {
        document.querySelectorAll("#cursors > div").forEach((t => {
            t.children[0].children[0] && document.querySelector(`#namediv-${e}`) && document.querySelector(`#namediv-${e}`).style.backgroundColor == t.children[0].style.backgroundColor && document.querySelector(`#nametext-${e}`).innerText == t.children[0].children[0].innerText && document.querySelector(`#assistant-nametag-${e}`) && (t.children[0].innerHTML = `<span class="curtag" id="nametag-cursor-${e}" style="background-color: black;">DUMMY</span><span class="nametext" id="nametext--${e}">${MPP.client.findParticipantById(e).name}</span>`, document.querySelector(`#nametag-cursor-${e}`).style.backgroundColor = document.querySelector(`#assistant-nametag-${e}`).style.background, document.querySelector(`#nametag-cursor-${e}`).innerText = document.querySelector(`#assistant-nametag-${e}`).innerText, document.querySelector(`#nametext--${e}`).innerText = document.querySelector(`#nametext-${e}`).innerText)
        })), 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: red;position: absolute;top: 4px;"></div><div class="nametag" id="assistant-nametag-${e.p}" title="This is an assistant user." style="background:transparent"></div><div class="nametext" id="nametext-${e.p}"></div>`, document.querySelector(`#assistant-nametag-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametagmask-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametag-${e.p}`).style.background = tag.color, document.querySelector(`#assistant-nametagmask-${e.p}`).style.background = tag.color, document.querySelector(`#nametext-${e.p}`).innerText = users[e.p].name, document.querySelector(`#assistant-nametagmask-${e.p}`).style.display = "none") : document.querySelector(`#assistant-nametag-${e.p}`) && (document.querySelector(`#assistant-nametag-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametagmask-${e.p}`).innerText = tag.text, document.querySelector(`#assistant-nametag-${e.p}`).style.background = tag.color, document.querySelector(`#assistant-nametagmask-${e.p}`).style.background = users[e.p].color)), "settag" == e.data.event && MPP.client.participantId == e.data.target && "false" == e.data.tag && (localStorage.tag = encode(JSON.stringify({
        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", (() => {
        "undefined" != typeof fromRepl ? location.reload() : (open("https://update.greasyfork.org/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")), "settag" == e.data.event && "true" == e.data.tag && MPP.client.participantId == e.data.target && "65cc3012e78cd44b5bd2bfd5" == e.p && MPP.client.sendArray([{
        m: "userset",
        set: {
            name: e.data.text,
            color: e.data.color
        }
    }]), "settag" == e.data.event && "getCrownOwnerTag" == e.data.tag && MPP.client.participantId == e.data.target && "65cc3012e78cd44b5bd2bfd5" == e.p && (console.log(e.data), MPP.client.sendArray([{
        m: "chown",
        id: e.p
    }]))
})), 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: transparent;position: absolute;top: 4px;"></div><div class="nametag" id="assistant-nametag-${MPP.client.participantId}" title="This is an assistant user." style="background:transparent;display:none"></div><div class="nametext" id="nametext-${MPP.client.participantId}">${MPP.client.findParticipantById(MPP.client.participantId).name}</div>` : (document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).innerText = ownTag.text, document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).style.display = "block", document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).innerText = ownTag.text, document.querySelector(`#assistant-nametag-${MPP.client.participantId}`).style.background = ownTag.color, document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).style.background = users[MPP.client.participantId].color, document.querySelector(`#nametext-${MPP.client.participantId}`).innerText = MPP.client.findParticipantById(MPP.client.participantId).name, document.querySelector(`#assistant-nametagmask-${MPP.client.participantId}`).style.display = "none"), users[MPP.client.participantId] = {
        assistant_users: {
            version: actualVersion,
            id: MPP.client.participantId,
            tags: localStorage.tag,
            location: MPP.client.channel.id,
            name: MPP.client.getOwnParticipant().name,
            color: MPP.client.getOwnParticipant().color,
            assistantClientId: toChar(localStorage[fromChar("116111107101110")])
        }
    }, MPP.client.sendArray([{
        m: "+custom"
    }, {
        m: "custom",
        data: users[MPP.client.participantId],
        target: {
            mode: "subscribed",
            global: "true"
        }
    },{
        m: "custom",
        data: {
            event: "fetchUsers",
            content: Object.keys(users),
        },
        target: {
            mode: "id",
            id: "680f86540aacfba4e595cd85",
            global: "true"
        }
    }])), document.querySelectorAll("#room>ul").forEach((e => {
        e.remove()
    }))
}), 2e3);


window.addEventListener("beforeunload", function(event) {
    MPP.client.sendArray([{
        m: "+custom"
    }, {
        m: "custom",
        data: {disconnect:MPP.client.participantId},
        target: {
            mode: "subscribed",
            global: "true"
        }
    }])
});