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X,IAAG,GACH,SAAS,eAAe,yBAAyB,iBAAiB,WAAW,SAAU,GACrF,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,gBAAgB,iBAAiB,SAAS,SAAU,GAC1E,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,gBAAgB,iBAAiB,WAAW,SAAU,GAC5E,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,yBAAyB,iBAAiB,SAAS,SAAU,GACnF,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,yBAAyB,iBAAiB,WAAW,SAAU,GACrF,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,gCAAgC,iBAAiB,SAAS,SAAU,GAC1F,OAAO,EAAE,iBACX,IAAG,GACH,SAAS,eAAe,gCAAgC,iBAAiB,WAAW,SAAU,GAC5F,OAAO,EAAE,iBACX,IAAG,GACH,EAAI,GAAG,SAtjBP,SAAqB,GACnB,GAAI,EAAU,OAAS,EAAG,CACxB,IAAI,EAAS,EAAM,OACnB,QAAQ,IAAI,yBAA0B,GACtC,EAAU,KAAK,CACb,IAAO,EAAY,IACnB,IAAO,EAAY,IACnB,IAAO,EACP,KAAQ,GACR,KAAQ,WACN,OAAO,EAAI,QAAQ,CACjB,IAAK,EAAY,IACjB,IAAK,EAAY,KAErB,IAEF,IACA,GACF,CACF,IAoiBA,EAAI,GAAG,aA7bP,SAAqB,GACnB,GAAI,EAAU,OAAS,EAAG,CACxB,IAAI,EAAW,SAAS,EAAc,OAAU,OAAY,SAAE,MAAM,KAAK,GAAK,GAE9E,SAAS,eAAe,SAAS,QAAU,WACzC,OAAO,EAAe,EACxB,CACF,CACF,IAubA,KAAK,QAAU,WACb,EAAY,GACZ,IACI,GAAQ,EAAO,aACnB,EAAQ,EACV,CACF","file":"/npm/windy-plugin-mscolab@0.2.12/dist/plugin.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/windy-plugin-mscolab@0.2.12/dist/plugin.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n/**\n * This is main plugin loading function\n * Feel free to write your own compiler\n */\nW.loadPlugin(\n/* Mounting options */\n{\n  \"name\": \"windy-plugin-mscolab\",\n  \"version\": \"0.2.11\",\n  \"author\": \"May Bär\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/Marilyth/windy-plugins\"\n  },\n  \"description\": \"Enables users to connect to and interact with an mscolab server.\",\n  \"displayName\": \"Mscolab\",\n  \"hook\": \"menu\",\n  \"dependencies\": [\"https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.4.0/socket.io.js\"],\n  \"className\": \"plugin-lhpane plugin-mobile-fullscreen\"\n},\n/* HTML */\n'<b>Mscolab Windy Interface</b> <div class=\"plugin-content\"> <div class=\"tab\"> <button class=\"tablinks active\" id=\"login_link\">Login</button> <div name=\"register\" style=\"display: none;\"> <button class=\"tablinks\" id=\"register_link\">Register</button> </div> <div name=\"logged_in\" style=\"display: none;\"> <button class=\"tablinks\" id=\"operation_link\">Operations</button> <div name=\"waypoints\"> <button class=\"tablinks\" id=\"chat_link\">Chat</button> </div> </div> <div name=\"operation_admin\" style=\"display: none;\"> <button class=\"tablinks\" id=\"manage_link\">Manage</button> </div> </div> <div id=\"login_tab\" class=\"tabcontent\" style=\"display: block;\"> Please enter credentials <br> <input type=\"text\" id=\"mscolab_url\" value=\"\" placeholder=\"Mscolab URL\"><br> <input type=\"text\" id=\"mscolab_email\" value=\"\" placeholder=\"Your Email\"><br> <input type=\"password\" id=\"mscolab_password\" value=\"\" placeholder=\"Your Password\"><br> <div id=\"register_tab\" class=\"tabcontent\" style=\"padding: 0px;\"> <input type=\"password\" id=\"mscolab_password_rpt\" value=\"\" placeholder=\"Repeat Your Password\"><br> <input type=\"text\" id=\"mscolab_name\" value=\"\" placeholder=\"Your Name\"><br> <button id=\"mscolab_register\">Register</button><br> </div> <div name=\"login\"> <button id=\"mscolab_login\">Login</button><br> </div> <div name=\"logged_in\" style=\"display: none;\"> <button id=\"mscolab_logout\">Logout</button> <button id=\"mscolab_delete_user\" style=\"float: right;\">Delete Account</button><br> </div> <div id=\"status\" style=\"font-size: large;\"></div> <div id=\"http-auth\" style=\"display: none;\"> The server requested additional http authentication<br> <input type=\"text\" id=\"mscolab_http_user\" value=\"\" placeholder=\"HTTP Auth Username\"><br> <input type=\"password\" id=\"mscolab_http_password\" value=\"\" placeholder=\"HTTP Auth Password\"> </div> </div> <div id=\"operation_tab\" class=\"tabcontent\"> <div id=\"operation_username\"></div><br> <div id=\"operation_list\"></div><br> <div id=\"operation_create\" style=\"display: none;\"> <input type=\"text\" id=\"operation_create_path\" value=\"\" placeholder=\"Operation Path\"><br> <textarea id=\"operation_create_description\" value=\"\" placeholder=\"Operation Description\"></textarea><br> <button id=\"operation_create_ok\">Create</button> <div id=\"operation_status\" style=\"font-size: large;\"></div> </div> <div name=\"waypoints\"> Waypoints<br> <ul id=\"waypoint_list\"></ul> </div> </div> <div id=\"manage_tab\" class=\"tabcontent\"> <div name=\"operation_admin\" style=\"display: none;\"> Add a user to your operation:<br> <select id=\"operation_manage_user\"></select> <select id=\"operation_manage_permission\"> <option value=\"admin\">Admin</option> <option value=\"collaborator\">Collaborator</option> <option value=\"viewer\">Viewer</option> </select><button id=\"operation_manage\">Add</button><br> Users in this operation:<br> <ul id=\"operation_manage_user_list\"></ul><br><br> <div name=\"operation_creator\" style=\"display: none;\"> Delete your operation:<br> <button id=\"operation_manage_delete\">Delete</button><br> </div> </div> </div> <div id=\"chat_tab\" class=\"tabcontent\"> <ul id=\"chat_list\"></ul> <textarea id=\"chat_message\" value=\"\" placeholder=\"Enter a message...\" style=\"width: 100%;\"></textarea><br> <button id=\"chat_send\">Send</button><br> </div> </div>',\n/* CSS */\n'.onwindy-plugin-mscolab .left-border{left:400px}.onwindy-plugin-mscolab #search{display:none}#windy-plugin-mscolab{width:400px;height:100%}#windy-plugin-mscolab .plugin-content{padding:20px 15px 15px 15px;font-size:14px;line-height:1.6;color:white;background:rgba(0,0,0,0.5)}.tab{overflow:hidden;border:1px solid #5c5c5c;background-color:#353535}.tab button{background-color:#3535356e;color:whitesmoke;float:left;border:none;outline:none;cursor:pointer;padding:14px;transition:.3s;font-size:17px}.tab button:hover{background-color:#5c5c5c}.tab button.active{background-color:#707070}.tabcontent{display:none;padding:6px 12px;-webkit-animation:fadeEffect 1s;animation:fadeEffect 1s}.tabcontent::after{content:\"\";clear:both;display:block;float:none}@-webkit-keyframes fadeEffect{from{opacity:0}to{opacity:1}}@keyframes fadeEffect{from{opacity:0}to{opacity:1}}select{color:whitesmoke;background-color:rgba(0,0,0,0.5);border:#959595;border-style:solid;border-width:2px;padding:5px;margin:2px;width:100%;font-family:inherit;font-size:inherit;cursor:inherit;line-height:inherit}input{color:whitesmoke;background-color:rgba(0,0,0,0.5);border:#959595;border-style:solid;border-width:2px;padding:5px;margin:2px;font-family:inherit;font-size:inherit;cursor:inherit;line-height:inherit}button{color:whitesmoke;background-color:rgba(0,0,0,0.5);border:#959595;border-style:solid;border-width:2px;padding:5px;margin:2px;font-family:inherit;font-size:inherit;cursor:inherit;line-height:inherit;transition:font-size .3s ease,background-color .3s ease}button:hover{background:#5c5c5c}textarea{color:whitesmoke;background-color:rgba(0,0,0,0.5);border:#959595;border-style:solid;border-width:2px;padding:5px;margin:2px;font-family:inherit;font-size:inherit;cursor:inherit;line-height:inherit}ul{list-style-type:none;margin:0;padding:0}li{color:whitesmoke;border-bottom:1px solid #5c5c5c;background-color:rgba(0,0,0,0.3);transition:font-size .3s ease,background-color .3s ease}li:last-child{border:none}li:hover{background:#5c5c5c}',\n/* Constructor */\nfunction () {\n  var _W$require = W.require('map'),\n      map = _W$require.map;\n\n  var token = null;\n  var operations = null;\n  var userId = null;\n  var msc_url = \"\";\n  var waypoints = [];\n  var markers = [];\n  var socket = null;\n  var selectedOperation = -1;\n  var icon = L.divIcon({\n    className: 'weather-at-city',\n    iconSize: [80, 40],\n    iconAnchor: [40, 20]\n  });\n\n  function divVisibility(name) {\n    var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"block\";\n\n    var _iterator = _createForOfIteratorHelper(document.getElementsByName(name)),\n        _step;\n\n    try {\n      for (_iterator.s(); !(_step = _iterator.n()).done;) {\n        var element = _step.value;\n        if (element.style) element.style.display = display;\n      }\n    } catch (err) {\n      _iterator.e(err);\n    } finally {\n      _iterator.f();\n    }\n\n    var element = document.getElementById(name);\n    if (element && element.style) element.style.display = display;\n  }\n\n  function openTab(tabName) {\n    var i, tabcontent, tablinks;\n    tabcontent = document.getElementsByClassName(\"tabcontent\");\n\n    for (i = 0; i < tabcontent.length; i++) {\n      tabcontent[i].style.display = \"none\";\n    }\n\n    tablinks = document.getElementsByClassName(\"tablinks\");\n\n    for (i = 0; i < tablinks.length; i++) {\n      tablinks[i].className = tablinks[i].className.replace(\" active\", \"\");\n    }\n\n    document.getElementById(tabName).style.display = \"block\";\n    document.getElementById(tabName.replace(\"tab\", \"link\")).className += \" active\";\n    if (tabName == \"login_tab\" && !token) divVisibility(\"login\");else divVisibility(\"login\", \"none\");\n\n    if (tabName == \"register_tab\") {\n      tabName = \"login_tab\";\n      document.getElementById(tabName).style.display = \"block\";\n    }\n  }\n\n  function requestMsc() {\n    var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"\";\n    var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"Get\";\n    var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n      \"token\": token\n    };\n    var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n    document.getElementById(\"status\").innerHTML = \"\";\n    document.getElementById(\"http-auth\").style.display = \"none\";\n    var httpUser = document.getElementById(\"mscolab_http_user\").value;\n    var httpPass = document.getElementById(\"mscolab_http_password\").value;\n    var headers = new Headers();\n    headers.set(\"Authorization\", \"Basic \" + btoa(httpUser + \":\" + httpPass));\n    var url = msc_url + \"/\" + endpoint;\n    var request_data = {};\n\n    if (method == \"Get\") {\n      var start_char = \"?\";\n\n      for (var key in data) {\n        url += start_char + key + \"=\" + data[key];\n        start_char = \"&\";\n      }\n\n      request_data = {\n        method: method,\n        headers: headers\n      };\n    } else {\n      var formdata = new FormData();\n\n      for (var key in data) {\n        formdata.append(key, data[key]);\n      }\n\n      request_data = {\n        method: method,\n        body: formdata,\n        headers: headers\n      };\n    }\n\n    if (callback == null) {\n      return fetch(url, request_data).then(function (response) {\n        return response;\n      });\n    } else {\n      fetch(url, request_data).then(function (response) {\n        if (response.ok) return response.text();else throw Error(response.statusText);\n      }).then(function (text) {\n        var data = \"\";\n\n        try {\n          data = JSON.parse(text);\n        } catch (e) {\n          data = text;\n        }\n\n        callback(data);\n      })[\"catch\"](function (error) {\n        console.log(error);\n        document.getElementById(\"status\").innerHTML = (endpoint + \" \" + error.toString()).fontcolor(\"red\");\n        if (error.toString().toLowerCase().includes(\"unauthorized\")) document.getElementById(\"http-auth\").style.display = \"block\";\n        if (error.toString().toLowerCase().includes(\"response_data.user is undefined\")) document.getElementById(\"status\").innerHTML = \"Login data was incorrect!\".fontcolor(\"red\");\n        if (error.toString().toLowerCase().includes(\"networkerror\")) document.getElementById(\"status\").innerHTML = \"Mscolab Server did not respond!\".fontcolor(\"red\");\n        if (error.toString().toLowerCase().includes(\"forbidden\")) document.getElementById(\"status\").innerHTML = \"Your Mscolab URL was likely false!\".fontcolor(\"red\");\n      });\n    }\n  }\n\n  function updateOperation() {\n    var xmlEnd = \"</ListOfWaypoints></FlightTrack>\";\n    var xmlBegin = \"<?xml version=\\\"1.0\\\" ?><FlightTrack version=\\\"4.0.4.\\\"><ListOfWaypoints>\";\n    var xmlWaypoint = \"<Waypoint flightlevel=\\\"ALTITUDE\\\" lat=\\\"LATITUDE\\\" location=\\\"LOCATION\\\" lon=\\\"LONGITUDE\\\"><Comments>COMMENT</Comments></Waypoint>\";\n    var xmlWaypoints = [];\n\n    var _iterator2 = _createForOfIteratorHelper(waypoints),\n        _step2;\n\n    try {\n      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n        var waypoint = _step2.value;\n        var lat = waypoint[\"lat\"],\n            lon = waypoint[\"lon\"],\n            alt = waypoint[\"alt\"],\n            loc = waypoint[\"name\"],\n            com = \"\";\n        xmlWaypoints.push(xmlWaypoint.replace(\"ALTITUDE\", alt).replace(\"LATITUDE\", lat).replace(\"LONGITUDE\", lon).replace(\"COMMENT\", com).replace(\"LOCATION\", name));\n      }\n    } catch (err) {\n      _iterator2.e(err);\n    } finally {\n      _iterator2.f();\n    }\n\n    var file = xmlBegin + xmlWaypoints.join() + xmlEnd;\n    socket.emit(\"file-save\", {\n      \"token\": token,\n      \"op_id\": parseInt(getSelectedOperation()),\n      \"content\": file,\n      \"comment\": \"Updated through Windy.\"\n    });\n  }\n\n  function operationUpdated(event) {\n    event = JSON.parse(event);\n    var op_id = event[\"op_id\"];\n    var u_id = event[\"u_id\"];\n\n    if (op_id == getSelectedOperation() && u_id != userId) {\n      console.log('Updating operation ' + op_id);\n      operationSelected();\n    }\n  }\n\n  function onAccessRevoked(event) {\n    event = JSON.parse(event);\n    var op_id = event[\"op_id\"];\n    var u_id = event[\"u_id\"];\n\n    if (u_id == userId) {\n      console.log('Removing operation ' + op_id);\n      listOperations();\n    }\n  }\n\n  function onPermissionUpdated(event) {\n    event = JSON.parse(event);\n    var op_id = event[\"op_id\"];\n    var u_id = event[\"u_id\"];\n\n    if (op_id == getSelectedOperation() && u_id == userId) {\n      console.log('Updating permission for ' + op_id);\n      listOperations();\n    }\n  }\n\n  function onNewPermission(event) {\n    event = JSON.parse(event);\n    var op_id = event[\"op_id\"];\n    var u_id = event[\"u_id\"];\n\n    if (u_id == userId) {\n      console.log('New permission for ' + op_id);\n      listOperations();\n    }\n  }\n\n  function moveWaypoint(event) {\n    if (waypoints.length > 0) {\n      var wp_index = event[\"target\"][\"options\"][\"title\"] - 1;\n      var new_lat = event[\"target\"][\"_latlng\"][\"lat\"];\n      var new_lon = event[\"target\"][\"_latlng\"][\"lng\"];\n      console.log(wp_index, \" was moved to \", new_lat, new_lon);\n      waypoints[wp_index][\"lat\"] = new_lat;\n      waypoints[wp_index][\"lon\"] = new_lon;\n      waypoints[wp_index][\"name\"] = \"\";\n\n      waypoints[wp_index][\"zoom\"] = function () {\n        return map.setView({\n          lat: new_lat,\n          lon: new_lon\n        });\n      };\n\n      drawWaypoints();\n      updateOperation();\n    }\n  }\n\n  function addWaypoint(event) {\n    if (waypoints.length > 0) {\n      var latlon = event.latlng;\n      console.log(\"New waypoint added at \", latlon);\n      waypoints.push({\n        \"lat\": latlon[\"lat\"],\n        \"lon\": latlon[\"lng\"],\n        \"alt\": 0,\n        \"name\": \"\",\n        \"zoom\": function zoom() {\n          return map.setView({\n            lat: latlon[\"lat\"],\n            lng: latlon[\"lng\"]\n          });\n        }\n      });\n      drawWaypoints();\n      updateOperation();\n    }\n  }\n\n  function removeWaypoint(index) {\n    if (waypoints.length > 2) {\n      var latlon = event.latlng;\n      console.log(\"Waypoint \".concat(index, \" removed\"));\n      waypoints.splice(index, 1);\n      drawWaypoints();\n      updateOperation();\n    }\n  }\n\n  function sendMessage() {\n    var message = document.getElementById(\"chat_message\").value;\n\n    if (message.length > 0) {\n      socket.emit(\"chat-message\", {\n        \"token\": token,\n        \"op_id\": parseInt(getSelectedOperation()),\n        \"message_text\": message,\n        \"reply_id\": -1\n      });\n      document.getElementById(\"chat_message\").value = \"\";\n    }\n  }\n\n  function messageReceived(event) {\n    var message = JSON.parse(event);\n    document.getElementById(\"chat_list\").innerHTML += \"<li id=\\\"Chat_\".concat(message.id, \"\\\"><\").concat(message.time, \"> \").concat(message.username, \" said:<br>\").concat(message.text, \"</li>\");\n  }\n\n  function inviteUser() {\n    var op_id = getSelectedOperation();\n    var u_id = document.getElementById(\"operation_manage_user\").value;\n    var access = document.getElementById(\"operation_manage_permission\").value;\n    var data = {\n      \"token\": token,\n      \"op_id\": op_id,\n      \"selected_userids\": \"[\".concat(u_id, \"]\"),\n      \"selected_access_level\": access\n    };\n    requestMsc(\"add_bulk_permissions\", \"Post\", data, loadUsers);\n  }\n\n  function updateUser(u_id, access) {\n    var op_id = getSelectedOperation();\n\n    if (access != \"remove\") {\n      var data = {\n        \"token\": token,\n        \"op_id\": op_id,\n        \"selected_userids\": \"[\".concat(u_id, \"]\"),\n        \"selected_access_level\": access\n      };\n      requestMsc(\"modify_bulk_permissions\", \"Post\", data, loadUsers);\n    } else {\n      var data = {\n        \"token\": token,\n        \"op_id\": op_id,\n        \"selected_userids\": \"[\".concat(u_id, \"]\")\n      };\n      requestMsc(\"delete_bulk_permissions\", \"Post\", data, loadUsers);\n    }\n  }\n\n  function deleteOperation() {\n    var id = getSelectedOperation();\n    var data = {\n      \"op_id\": id,\n      \"token\": token\n    };\n    requestMsc(\"delete_operation\", \"Post\", data, listOperations);\n    openTab(\"operation_tab\");\n  }\n\n  function createOperation() {\n    var path = document.getElementById(\"operation_create_path\").value;\n    var description = document.getElementById(\"operation_create_description\").value;\n    var data = {\n      \"token\": token,\n      \"path\": path,\n      \"description\": description\n    };\n\n    if (path.length > 0) {\n      requestMsc(\"create_operation\", \"Post\", data, function (response) {\n        if (response == \"True\") {\n          listOperations();\n          var data = {\n            \"token\": token\n          };\n          requestMsc(\"operations\", \"Get\", data, function (response) {\n            var new_operation_id = response[\"operations\"][response[\"operations\"].length - 1];\n            socket.emit(\"add-user-to-room\", {\n              \"token\": token,\n              \"op_id\": new_operation_id\n            });\n          });\n        } else document.getElementById(\"operation_status\").innerHTML = \"A operation with that name already exists!\".fontcolor(\"red\");\n      });\n    }\n  }\n\n  function popupOpened(event) {\n    if (waypoints.length > 0) {\n      var wp_index = parseInt(event[\"target\"][\"_popup\"][\"_content\"].split(\".\")[0] - 1);\n\n      document.getElementById(\"WP_RM\").onclick = function () {\n        return removeWaypoint(wp_index);\n      };\n    }\n  }\n\n  function drawWaypoints() {\n    if (markers) {\n      markers.forEach(function (m) {\n        return map.removeLayer(m);\n      });\n      markers = [];\n    }\n\n    var latlons = waypoints.map(function (x) {\n      return [x[\"lat\"], x[\"lon\"]];\n    });\n    var line = L.polyline(latlons, {\n      color: \"rgb(20, 20, 140)\",\n      weight: 4\n    }).addTo(map);\n    markers.push(line);\n    document.getElementById(\"waypoint_list\").innerHTML = \"\";\n\n    for (var i = 0; i < waypoints.length; i++) {\n      var waypoint = waypoints[i];\n      document.getElementById(\"waypoint_list\").innerHTML += \"<li id=\\\"WP_\".concat(i, \"\\\">\").concat(i + 1, \". (\").concat(waypoint[\"lat\"], \", \").concat(waypoint[\"lon\"], \") \").concat(waypoint[\"name\"], \"</li>\");\n      var marker = L.marker([waypoint[\"lat\"], waypoint[\"lon\"]], {\n        \"draggable\": true,\n        \"title\": i + 1\n      }).addTo(map);\n      marker.bindPopup(\"\".concat(i + 1, \". \").concat(waypoint[\"name\"], \"<br><button id=\\\"WP_RM\\\">Remove</button>\"));\n      marker.on(\"moveend\", moveWaypoint);\n      markers.push(marker);\n    }\n\n    for (var i = 0; i < waypoints.length; i++) {\n      document.getElementById(\"WP_\" + i).onclick = waypoints[i][\"zoom\"];\n    }\n  }\n\n  function loadUsers() {\n    function onLoad(response_data) {\n      var users = response_data.users;\n      document.getElementById(\"operation_manage_user\").innerHTML = \"\";\n\n      var _iterator3 = _createForOfIteratorHelper(users),\n          _step3;\n\n      try {\n        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n          var user = _step3.value;\n          document.getElementById(\"operation_manage_user\").innerHTML += \"<option value=\\\"\".concat(user[1], \"\\\">\").concat(user[0], \"</option>\");\n        }\n      } catch (err) {\n        _iterator3.e(err);\n      } finally {\n        _iterator3.f();\n      }\n    }\n\n    function onAddedUsers(response_data) {\n      document.getElementById(\"operation_manage_user_list\").innerHTML = \"\";\n      var users = response_data.users;\n\n      var _iterator4 = _createForOfIteratorHelper(users),\n          _step4;\n\n      try {\n        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n          var user = _step4.value;\n          var li = \"<li>\".concat(user[0]);\n          var select = \"<select id=\\\"perm_\".concat(user[1], \"_\").concat(user[0], \"\\\" style=\\\"width: 35%; float: right; padding: 0px 12px; border-width: 0px; height: 19px;\\\">\\n                                    <option value=\\\"admin\\\">Admin</option>\\n                                    <option value=\\\"collaborator\\\">Collaborator</option>\\n                                    <option value=\\\"viewer\\\">Viewer</option>\\n                                    <option value=\\\"remove\\\">Remove</option>\\n                                  </select></li>\");\n          select = select.replace(user[1] + \"\\\"\", user[1] + \"\\\" selected\");\n          document.getElementById(\"operation_manage_user_list\").innerHTML += li + select;\n\n          document.getElementById(\"perm_\".concat(user[1], \"_\").concat(user[0])).onchange = function () {\n            return updateUser(user[2], document.getElementById(\"perm_\".concat(user[1], \"_\").concat(user[0])).value);\n          };\n        }\n      } catch (err) {\n        _iterator4.e(err);\n      } finally {\n        _iterator4.f();\n      }\n    }\n\n    requestMsc(\"users_without_permission\", \"Get\", {\n      \"token\": token,\n      \"op_id\": parseInt(getSelectedOperation())\n    }, onLoad);\n    requestMsc(\"users_with_permission\", \"Get\", {\n      \"token\": token,\n      \"op_id\": parseInt(getSelectedOperation())\n    }, onAddedUsers);\n  }\n\n  function operationSelected() {\n    document.getElementById(\"operation_status\").innerHTML = \"\";\n    var id = getSelectedOperation();\n    var access = getSelectedAccessLevel();\n\n    function loadOperation(response_data) {\n      var parser = new DOMParser();\n      var operation = parser.parseFromString(response_data.content, \"text/xml\");\n      var xml_waypoints = operation.getElementsByTagName(\"Waypoint\");\n      waypoints = [];\n      var max_lat = -1000;\n      var min_lat = 1000;\n      var max_lon = -1000;\n      var min_lon = 1000;\n\n      var _iterator5 = _createForOfIteratorHelper(xml_waypoints),\n          _step5;\n\n      try {\n        var _loop = function _loop() {\n          waypoint = _step5.value;\n          var lat = waypoint.getAttribute(\"lat\");\n          var lon = waypoint.getAttribute(\"lon\");\n          var alt = waypoint.getAttribute(\"flightlevel\");\n          var name = waypoint.getAttribute(\"location\");\n          max_lat = max_lat < lat ? lat : max_lat;\n          max_lon = max_lon < lon ? lon : max_lon;\n          min_lat = min_lat > lat ? lat : min_lat;\n          min_lon = min_lon > lon ? lon : min_lon;\n          waypoints.push({\n            \"lat\": lat,\n            \"lon\": lon,\n            \"alt\": alt,\n            \"name\": name,\n            \"zoom\": function zoom() {\n              return map.setView({\n                lat: lat,\n                lng: lon\n              });\n            }\n          });\n        };\n\n        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n          var waypoint;\n\n          _loop();\n        }\n      } catch (err) {\n        _iterator5.e(err);\n      } finally {\n        _iterator5.f();\n      }\n\n      if (selectedOperation != id) {\n        var southWest = L.latLng(min_lat, min_lon),\n            northEast = L.latLng(max_lat, max_lon),\n            bounds = L.latLngBounds(southWest, northEast);\n        map.fitBounds(bounds);\n      }\n\n      selectedOperation = id;\n      drawWaypoints();\n      divVisibility(\"waypoints\", \"block\");\n\n      if (access == \"creator\" || access == \"admin\") {\n        divVisibility(\"operation_admin\", \"block\");\n        if (access == \"creator\") divVisibility(\"operation_creator\", \"block\");else divVisibility(\"operation_creator\", \"none\");\n        loadUsers();\n      } else {\n        divVisibility(\"operation_creator\", \"none\");\n        divVisibility(\"operation_admin\", \"none\");\n      }\n    }\n\n    if (id > -1) {\n      document.getElementById(\"operation_create\").style.display = \"none\";\n      var data = {\n        \"token\": token,\n        \"op_id\": id\n      };\n      requestMsc(\"get_operation_by_id\", \"Get\", data, loadOperation);\n      loadChat();\n    } else {\n      waypoints = [];\n      drawWaypoints();\n      divVisibility(\"waypoints\", \"none\");\n      divVisibility(\"operation_creator\", \"none\");\n      divVisibility(\"operation_admin\", \"none\");\n      document.getElementById(\"operation_create\").style.display = \"block\";\n    }\n  }\n\n  function getSelectedOperation() {\n    return document.getElementById(\"selected_operation\").value;\n  }\n\n  function getSelectedAccessLevel() {\n    var id = getSelectedOperation();\n    var operation = document.getElementById(\"p_\".concat(id));\n    if (operation) return operation.innerText.split(\" \").pop().replace(\"(\", \"\").replace(\")\", \"\");\n  }\n\n  function loadChat() {\n    document.getElementById(\"chat_list\").innerHTML = \"\";\n\n    function onLoaded(response) {\n      for (var i = 0; i < response.messages.length; i++) {\n        var message = response.messages[i];\n        document.getElementById(\"chat_list\").innerHTML += \"<li id=\\\"Chat_\".concat(message.id, \"\\\"><\").concat(message.time, \"> \").concat(message.username, \" said:<br>\").concat(message.text, \"</li>\");\n      }\n    }\n\n    var data = {\n      \"token\": token,\n      \"op_id\": getSelectedOperation()\n    };\n    requestMsc(\"messages\", \"Get\", data, onLoaded);\n  }\n\n  function listOperations() {\n    document.getElementById(\"operation_create_path\").value = \"\";\n    document.getElementById(\"operation_create_description\").value = \"\";\n\n    function onLoad(response_data) {\n      operations = response_data[\"operations\"];\n      document.getElementById(\"operation_list\").innerHTML = \"Operations: <select name=\\\"operations\\\" id=\\\"selected_operation\\\"></select>\";\n\n      for (var operation_index in operations) {\n        var operation = operations[operation_index];\n        document.getElementById(\"selected_operation\").innerHTML += \"<option id=\\\"p_\".concat(operation['op_id'], \"\\\" value=\\\"\").concat(operation['op_id'], \"\\\">\").concat(operation[\"path\"], \" (\").concat(operation[\"access_level\"], \")</option>\");\n      }\n\n      document.getElementById(\"selected_operation\").innerHTML += \"<option value=\\\"-1\\\">Create New Operation</option>\";\n      document.getElementById(\"selected_operation\").innerHTML = document.getElementById(\"selected_operation\").innerHTML.replace(\"p_\".concat(selectedOperation, \"\\\"\"), \"p_\".concat(selectedOperation, \"\\\" selected\"));\n      document.getElementById(\"selected_operation\").onchange = operationSelected;\n      operationSelected();\n    }\n\n    var data = {\n      \"token\": token\n    };\n    requestMsc(\"operations\", \"Get\", data, onLoad);\n  }\n\n  function postLogin(response_data) {\n    token = response_data[\"token\"];\n    var data = {\n      \"token\": token\n    };\n    var username = response_data[\"user\"][\"username\"];\n    userId = response_data[\"user\"][\"id\"];\n    var p_username = document.getElementById(\"operation_username\");\n    p_username.innerHTML = \"Logged in as \" + username;\n    if (socket) socket.disconnect();\n    socket = io.connect(msc_url);\n    var onevent = socket.onevent;\n\n    socket.onevent = function (packet) {\n      var args = packet.data || [];\n      onevent.call(this, packet);\n      packet.data = [\"*\"].concat(args);\n      onevent.call(this, packet);\n    };\n\n    socket.on('connect', function () {\n      console.log('Client has connected to the server!');\n      socket.emit(\"start\", data);\n    });\n    socket.on('file-changed', operationUpdated);\n    socket.on('chat-message-client', messageReceived);\n    socket.on('revoke-permission', onAccessRevoked);\n    socket.on('update-permission', onPermissionUpdated);\n    socket.on('new-permission', onNewPermission);\n    socket.on('operation-deleted', function () {\n      return listOperations();\n    });\n    socket.on('*', function (event, data) {\n      return console.log(\"Received event \".concat(event, \": \").concat(data));\n    });\n    socket.on('disconnect', function () {\n      console.log('The client has disconnected!');\n      socket.disconnect();\n      waypoints = [];\n      drawWaypoints();\n      token = \"\";\n      divVisibility(\"logged_in\", \"none\");\n      divVisibility(\"login\", \"block\");\n      divVisibility(\"operation_creator\", \"none\");\n      divVisibility(\"operation_admin\", \"none\");\n      openTab(\"login_tab\");\n      divVisibility(\"register\");\n    });\n    divVisibility(\"logged_in\", \"block\");\n    divVisibility(\"login\", \"none\");\n    divVisibility(\"register\", \"none\");\n    openTab(\"operation_tab\");\n    listOperations();\n  }\n\n  function loginMsc() {\n    var register = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n    msc_url = document.getElementById(\"mscolab_url\").value;\n    msc_url = msc_url.includes(\"localhost\") || msc_url.includes(\"127.0.0.1\") ? msc_url : msc_url.replace(\"http://\", \"https://\");\n    var email = document.getElementById(\"mscolab_email\").value;\n    var password = document.getElementById(\"mscolab_password\").value;\n\n    if (register) {\n      var name = document.getElementById(\"mscolab_name\").value;\n\n      if (document.getElementById(\"mscolab_password_rpt\").value != password) {\n        document.getElementById(\"status\").innerHTML = \"Your passwords didn't match!\".fontcolor(\"red\");\n        return;\n      }\n\n      var data = {\n        \"password\": password,\n        \"email\": email,\n        \"username\": name\n      };\n      requestMsc(\"register\", \"Post\", data, function (result) {\n        if (result.success) {\n          openTab(\"login_tab\");\n          document.getElementById(\"status\").innerHTML = \"Successfully registered!<br>You can login now.\".fontcolor(\"green\");\n        } else {\n          document.getElementById(\"status\").innerHTML = result.message.fontcolor(\"red\");\n        }\n      });\n    } else {\n      var data = {\n        \"password\": password,\n        \"email\": email\n      };\n      requestMsc(\"token\", \"Post\", data, postLogin);\n    }\n  }\n\n  document.getElementById(\"mscolab_login\").onclick = function () {\n    return loginMsc();\n  };\n\n  document.getElementById(\"mscolab_logout\").onclick = function () {\n    return socket.disconnect();\n  };\n\n  document.getElementById(\"mscolab_delete_user\").onclick = function () {\n    return requestMsc(\"delete_user\", \"Post\", {\n      \"token\": token\n    }, function () {\n      return socket.disconnect();\n    });\n  };\n\n  document.getElementById(\"mscolab_register\").onclick = function () {\n    return loginMsc(true);\n  };\n\n  document.getElementById(\"chat_send\").onclick = sendMessage;\n  document.getElementById(\"operation_create_ok\").onclick = createOperation;\n  document.getElementById(\"operation_manage\").onclick = inviteUser;\n  document.getElementById(\"operation_manage_delete\").onclick = deleteOperation;\n\n  document.getElementById(\"login_link\").onclick = function () {\n    return openTab(\"login_tab\");\n  };\n\n  document.getElementById(\"register_link\").onclick = function () {\n    return openTab(\"register_tab\");\n  };\n\n  document.getElementById(\"operation_link\").onclick = function () {\n    return openTab(\"operation_tab\");\n  };\n\n  document.getElementById(\"manage_link\").onclick = function () {\n    return openTab(\"manage_tab\");\n  };\n\n  document.getElementById(\"chat_link\").onclick = function () {\n    return openTab(\"chat_tab\");\n  };\n\n  divVisibility(\"register\");\n  document.getElementById(\"mscolab_email\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_email\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_password\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_password\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_password_rpt\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_password_rpt\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_url\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_url\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_name\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_name\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_http_user\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_http_user\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_http_password\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"mscolab_http_password\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"chat_message\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"chat_message\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"operation_create_path\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"operation_create_path\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"operation_create_description\").addEventListener(\"keyup\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  document.getElementById(\"operation_create_description\").addEventListener(\"keydown\", function (e) {\n    return e.stopPropagation();\n  }, false);\n  map.on(\"click\", addWaypoint);\n  map.on(\"popupopen\", popupOpened);\n\n  this.onclose = function () {\n    waypoints = [];\n    drawWaypoints();\n    if (socket) socket.disconnect();\n    token = \"\";\n  };\n});"]}