INITIAL_RENDERING_TEMPLATE = """
""" SAMPLES_RENDERING_TEMPLATE = """
""" INVALID_FORMAT_MSG = """

Invalid file format: {extension}

Please upload the file in one of the following formats: """ ERROR_FORMAT_MSG = """

Error:

{message} """ IFRAME_TEMPLATE = """""" STARTUP_JS = """ () => { window.selected_elements = {} function handleMessage(event) { // console.log("New message: ", event.data) let atom = event.data.data["atom"]; let add = event.data.data["add"]; console.log("add: ", add, " atom: ", atom); window.selected_elements[atom] = add; } window.addEventListener("message", handleMessage); console.log("Listener Added"); } """ RETURN_SELECTION_JS = """ (input_file, n_steps, n_atoms, samples, hidden) => { let selected = [] for (const [atom, add] of Object.entries(window.selected_elements)) { if (add) { console.log("Adding atom ", atom); selected.push(String(atom)); window.parent.postMessage({ name: "atom_selection", data: {"atom": parseInt(atom), "add": false} }, "*"); } } console.log("Finished parsing"); return [input_file, n_steps, n_atoms, samples, selected.join(",")]; } """