From 4391c5f81ce379c874ee4c51fcb80f4d8b393966 Mon Sep 17 00:00:00 2001 From: francoismg Date: Thu, 18 Jul 2024 05:54:59 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20preview=20for=20PR=2012=20=F0=9F=9B=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr-preview/pr-12/components/FileComponent.js | 1 - .../pr-12/components/SettingsComponent.js | 158 ++- .../file_type/FITSSettingsComponent.js | 189 ++- .../inputs/ArithmeticColumnInput.js | 244 ++++ .../pr-12/containers/RegistryContainer.js | 11 + .../pr-12/data_processors/DataPreProcessor.js | 75 +- pr-preview/pr-12/dist/astrovis/astrovis.js | 1075 +++++++++++++++-- .../pr-12/errors/NoEventSubscriberError.js | 6 + .../events/ArithmeticColumnChangeEvent.js | 49 + .../pr-12/events/FileRegistryChangeEvent.js | 17 +- pr-preview/pr-12/index.html | 82 ++ pr-preview/pr-12/main.js | 6 + .../registries/EventSubscribersRegistry.js | 5 +- pr-preview/pr-12/registries/FileRegistry.js | 29 + pr-preview/pr-12/utils/ColumnUtils.js | 19 + pr-preview/pr-12/utils/ExpressionBlock.js | 47 + pr-preview/pr-12/utils/ExpressionParser.js | 79 ++ pr-preview/pr-12/visualizations/D3Graph.js | 111 +- pr-preview/pr-12/webpack.dev.js | 2 +- pr-preview/pr-12/wrappers/BokehWrapper.js | 80 +- pr-preview/pr-12/wrappers/D3Wrapper.js | 9 +- .../pr-12/wrappers/FITSReaderWrapper.js | 69 +- 22 files changed, 2122 insertions(+), 241 deletions(-) create mode 100644 pr-preview/pr-12/components/inputs/ArithmeticColumnInput.js create mode 100644 pr-preview/pr-12/errors/NoEventSubscriberError.js create mode 100644 pr-preview/pr-12/events/ArithmeticColumnChangeEvent.js create mode 100644 pr-preview/pr-12/utils/ColumnUtils.js create mode 100644 pr-preview/pr-12/utils/ExpressionBlock.js create mode 100644 pr-preview/pr-12/utils/ExpressionParser.js diff --git a/pr-preview/pr-12/components/FileComponent.js b/pr-preview/pr-12/components/FileComponent.js index 9fe6283..432b5b1 100644 --- a/pr-preview/pr-12/components/FileComponent.js +++ b/pr-preview/pr-12/components/FileComponent.js @@ -271,7 +271,6 @@ export class FileComponent extends HTMLElement { handleSelectChangeEvent(event) { event.stopPropagation(); - } _setContainer() { diff --git a/pr-preview/pr-12/components/SettingsComponent.js b/pr-preview/pr-12/components/SettingsComponent.js index 02039db..4c76343 100644 --- a/pr-preview/pr-12/components/SettingsComponent.js +++ b/pr-preview/pr-12/components/SettingsComponent.js @@ -3,6 +3,9 @@ import {SettingsChangedEvent} from "../events/SettingsChangedEvent"; import {VisualizationGenerationEvent} from "../events/VisualizationGenerationEvent"; import {FileRegistry} from "../registries/FileRegistry"; import {WrapperContainer} from "../containers/WrapperContainer"; +import {ColumnUtils} from "../utils/ColumnUtils"; +import {RegistryContainer} from "../containers/RegistryContainer"; +import {FileRegistryChangeEvent} from "../events/FileRegistryChangeEvent"; export class SettingsComponent extends HTMLElement { @@ -50,6 +53,7 @@ export class SettingsComponent extends HTMLElement { this.handleHDUsChangeEvent = this.handleHDUsChangeEvent.bind(this); this.handleGenerateEvent = this.handleGenerateEvent.bind(this); this.handleFileChangeEvent = this.handleFileChangeEvent.bind(this); + this.handleArithmeticColumnChangeEvent = this.handleArithmeticColumnChangeEvent.bind(this); this._setupExternalListeners(); this._setupInnerListeners(); @@ -68,12 +72,14 @@ export class SettingsComponent extends HTMLElement { this.addEventListener('select-data-type-change', this.handleDataTypeChangeEvent); this.addEventListener('select-hdus-change', this.handleHDUsChangeEvent); this.addEventListener('button-generate-click', this.handleGenerateEvent); + this.addEventListener('arithmetic-column-change', this.handleArithmeticColumnChangeEvent); } _setupInnerElementsListeners() { this._setSelectLibraryListener(); this._setSelectDataTypeListener() this._setSelectHDUsListener(); + this._setSelectAxisListener(); this._setGenerateButtonListener(); this._setCalculationRadioListeners(); } @@ -177,7 +183,12 @@ export class SettingsComponent extends HTMLElement { if(file.type === 'fits') { let fits_reader_wrapper = WrapperContainer.getFITSReaderWrapper(); - fits_reader_wrapper.setFile(file.file); + if(file.product_type !== 'spectrum') { + fits_reader_wrapper.setFile(file.file); + } else { + fits_reader_wrapper.setFileFromFileObject(file); + } + let fits_columns = fits_reader_wrapper.getAllColumns(); fits_columns.forEach((fits_column) => { @@ -215,9 +226,15 @@ export class SettingsComponent extends HTMLElement { } this._setSelectGroupAxis(select_options); + + select_options.unshift(this._createGenericColumnOptionsGroup()); this._setSelectGroupErrorBars(select_options); } + handleArithmeticColumnChangeEvent(event) { + //this._setSelectAxis() + } + _setContainer() { this.container = document.getElementById(this.container_id) } @@ -292,6 +309,21 @@ export class SettingsComponent extends HTMLElement { return opt_group } + _createGenericColumnOptionsGroup() { + let opt_group = document.createElement("optgroup"); + opt_group.label = "Genereic columns"; + opt_group.className += "generic"; + + let option = document.createElement("option"); + + option.text = 'None'; + option.value = `none`; + + opt_group.appendChild(option); + + return opt_group; + } + _setSelectAxis(columns) { this._resetSelectAxis(); @@ -448,6 +480,117 @@ export class SettingsComponent extends HTMLElement { }); } + _setSelectAxisListener() { + let select_axis_x = document.getElementById(SettingsComponent.select_axis_x_id); + let select_axis_y = document.getElementById(SettingsComponent.select_axis_y_id); + + let select_error_bar_x = document.getElementById(SettingsComponent.select_error_bar_x_id); + let select_error_bar_y = document.getElementById(SettingsComponent.select_error_bar_y_id); + + select_axis_x.addEventListener('change', (e) => { + let column_id = e.target.value; + + let data_type = document.getElementById(SettingsComponent.select_data_type_id).value; + + if(data_type === 'light-curve') { + + let column_descriptor = ColumnUtils.getColumnSettings(column_id) + + let file_object = FileRegistry.getFileById(column_descriptor.file_id); + + let frw = WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file_object.file); + + let columns_name= frw.getAllColumns(); + + if(column_descriptor.column_name.toUpperCase() === 'RATE' && + columns_name.some(column => { + return column.name.toUpperCase() === 'ERROR' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_x.options).forEach((option) => { + let option_column_descriptor = ColumnUtils.getColumnSettings(option.value); + + if(option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'ERROR') + + select_error_bar_x.value = option.value; + }) + } + + if(column_descriptor.column_name.toUpperCase() === 'TIME' && + columns_name.some(column => { + return column.name.toUpperCase() === 'TIMEDEL' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_x.options).forEach((option) => { + let option_column_descriptor = ColumnUtils.getColumnSettings(option.value); + + if (option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'TIMEDEL') + + select_error_bar_x.value = option.value; + }) + } + } + + }) + + select_axis_y.addEventListener('change', (e) => { + let column_id = e.target.value; + + let data_type = document.getElementById(SettingsComponent.select_data_type_id).value; + + if(data_type === 'light-curve') { + + let column_descriptor= ColumnUtils.getColumnSettings(column_id) + + let file_object = FileRegistry.getFileById(column_descriptor.file_id); + + let frw= WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file_object.file); + + let columns_name= frw.getAllColumns(); + + if(column_descriptor.column_name.toUpperCase() === 'RATE' && + columns_name.some(column => { + return column.name.toUpperCase() === 'ERROR' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_y.options).forEach((option) => { + let option_column_descriptor = ColumnUtils.getColumnSettings(option.value); + + if(option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'ERROR') + + select_error_bar_y.value = option.value; + }) + } + + if(column_descriptor.column_name.toUpperCase() === 'TIME' && + columns_name.some(column => { + return column.name.toUpperCase() === 'TIMEDEL' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_y.options).forEach((option) => { + let option_column_descriptor = ColumnUtils.getColumnSettings(option.value); + + if (option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'TIMEDEL') + + select_error_bar_y.value = option.value; + }) + } + } + + }) + + } + _setCalculationRadioListeners() { let radio_buttons = document.querySelectorAll('.' + SettingsComponent.calculation_radio_class); radio_buttons.forEach(radio_button => { @@ -526,8 +669,17 @@ export class SettingsComponent extends HTMLElement { if(values['has-error-bars-checkbox'].checked === true) { let error_bars = {}; - error_bars.x = values['select-axis-x-error-bar'].value; - error_bars.y = values['select-axis-y-error-bar'].value; + if(values['select-axis-x-error-bar'] !== undefined) { + error_bars.x = values['select-axis-x-error-bar'].value; + } else { + delete error_bars.x + } + + if(values['select-axis-y-error-bar'] !== undefined) { + error_bars.y = values['select-axis-y-error-bar'].value; + } else { + delete error_bars.y + } this.settings_object.setErrorBarsSettings(error_bars); } diff --git a/pr-preview/pr-12/components/file_type/FITSSettingsComponent.js b/pr-preview/pr-12/components/file_type/FITSSettingsComponent.js index 260a3e0..11697f3 100644 --- a/pr-preview/pr-12/components/file_type/FITSSettingsComponent.js +++ b/pr-preview/pr-12/components/file_type/FITSSettingsComponent.js @@ -1,6 +1,7 @@ import {WrapperContainer} from "../../containers/WrapperContainer"; import {FileRegistry} from "../../registries/FileRegistry"; import {FileRegistryChangeEvent} from "../../events/FileRegistryChangeEvent"; +import {RegistryContainer} from "../../containers/RegistryContainer"; export class FITSSettingsComponent extends HTMLElement { @@ -14,6 +15,11 @@ export class FITSSettingsComponent extends HTMLElement { add_to_plot_btn_id = "add-to-plot"; remove_from_plot_btn_id = "remove-from-plot"; + save_btn_id = 'save-file-settings'; + + product_type_select_id = 'product-type-select'; + arf_file_select_id = 'arf-file-select'; + rmf_file_select_id = 'rmf-file-select'; container = '
' + '
' + @@ -76,6 +82,13 @@ export class FITSSettingsComponent extends HTMLElement { '
\n' + '
File settings
\n' + '
\n' + + ' ' + ' \n' + @@ -122,7 +135,7 @@ export class FITSSettingsComponent extends HTMLElement { '
\n' + '
\n' + '\n' + - ' \n' + + ' \n' + ' \n' + ' \n' + '
\n' + @@ -134,6 +147,7 @@ export class FITSSettingsComponent extends HTMLElement { setupComponent() { this.setHDUSelect(); this.setupActionButtons(); + this.setProductSettings(); let select_hdu = document.getElementById(this.select_hdu_id); let hdu_index = select_hdu.value; @@ -172,6 +186,10 @@ export class FITSSettingsComponent extends HTMLElement { setupInnerElementListeners() { this.setHDUSelectListener(); + this.setSaveButtonListener(); + //this.setProductTypeSelectListener(); + //this.setARFFileSelectListener(); + //this.setRMFFileSelectListener(); } setupActionButtons() { @@ -193,7 +211,12 @@ export class FITSSettingsComponent extends HTMLElement { this.is_current = true; let frce = new FileRegistryChangeEvent(); - frce.dispatchToSubscribers(); + + try { + frce.dispatchToSubscribers(); + } catch(e) { + console.log("No subsribers for event : " + FileRegistryChangeEvent.name); + } this.resetContainerForCurrentFile(); @@ -205,12 +228,31 @@ export class FITSSettingsComponent extends HTMLElement { this.is_current = false; let frce = new FileRegistryChangeEvent(); - frce.dispatchToSubscribers(); + + try { + frce.dispatchToSubscribers(); + } catch(e) { + console.log("No subscribers for specified event : " + FileRegistryChangeEvent.name); + } this.resetContainerForCurrentFile(); }); } + setProductSettings() { + let product_type = null; + let rmf_file = null; + let arf_file = null; + + if(this.file.product_type) product_type = this.file.product_type; + if(this.file.rmf_file) rmf_file = this.file.rmf_file; + if(this.file.arf_file) arf_file = this.file.arf_file; + + //this.setProductTypeSelect(product_type); + //this.setRMFFileSelect(rmf_file); + //this.setARFFileSelect(arf_file); + } + setTables(hdu_index) { this.resetTables(); @@ -294,8 +336,149 @@ export class FITSSettingsComponent extends HTMLElement { } + setSaveButtonListener() { + let save_settings_btn = document.getElementById(this.save_btn_id); + + save_settings_btn.addEventListener('click', (event) => { + let product_type_select = document.getElementById(this.product_type_select_id); + + if(product_type_select.value === 'spectrum') { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + let arf_file_select = document.getElementById(this.arf_file_select_id); + + let rmf_file_id = rmf_file_select.value; + let arf_file_id = arf_file_select.value; + + FileRegistry.setFileMetadata(this.file.id, { + rmf_file: rmf_file_id, + arf_file: arf_file_id + }); + } + + }) + + } + + setProductTypeSelect(value = null) { + let product_type_select = document.getElementById(this.product_type_select_id); + + if(value) { + product_type_select.value = 'none'; + } else { + product_type_select.value = value; + } + } + + setProductTypeSelectListener() { + let product_type_select = document.getElementById(this.product_type_select_id); + + product_type_select.addEventListener('change', (event) => { + if(product_type_select.value === 'spectrum') { + this.setProductSettingsVisibility('spectrum'); + } else if(product_type_select.value === 'lightcurve') { + this.setProductSettingsVisibility('lightcurve'); + } else { + this.setProductSettingsVisibility(); + } + }) + + } + + setRMFFileSelect(value = null) { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + + let file_options = this.getFilesOptionsList(); + + file_options.forEach((option) => { + rmf_file_select.appendChild(option) + }); + + if(!value) { + rmf_file_select.value = 'none'; + } else { + rmf_file_select.value = value; + } + } + + setRMFFileSelectListener() { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + + } + + setARFFileSelect(value = null) { + let arf_file_select = document.getElementById(this.arf_file_select_id); + + let file_options = this.getFilesOptionsList(); + + file_options.forEach((option) => { + arf_file_select.appendChild(option) + }); + + if(!value) { + arf_file_select.value = 'none'; + } else { + arf_file_select.value = value; + } + } + + setARFFileSelectListener() { + let arf_file_select = document.getElementById(this.arf_file_select_id); + + } + + setProductSettingsVisibility(settings = null) { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + let arf_file_select = document.getElementById(this.arf_file_select_id); + + rmf_file_select.style.display = 'none'; + arf_file_select.style.display = 'none'; + + let spectrum_elements = document.getElementsByClassName('spectrum-settings'); + + for (let i = 0; i < spectrum_elements.length; i++) { + spectrum_elements[i].style.display = 'none'; + } + + if(!settings) { + + } else if(settings === 'spectrum') { + rmf_file_select.style.display = 'block'; + arf_file_select.style.display = 'block'; + + for (let i = 0; i < spectrum_elements.length; i++) { + spectrum_elements[i].style.display = 'block'; + } + } else if(settings === 'lightcurve') { + + } + } + resetContainerForCurrentFile() { this.setupComponent(); } + getFilesOptionsList() { + let file_options = []; + let file_list = FileRegistry.getAllFiles(); + + let option = document.createElement("option"); + + option.setAttribute('selected', 'true'); + + option.value = 'none'; + option.text = 'None'; + + file_options.push(option); + + file_list.forEach((file) => { + option = document.createElement("option"); + + option.value = file.id; + option.text = file.file_name; + + file_options.push(option); + }) + + return file_options; + } } \ No newline at end of file diff --git a/pr-preview/pr-12/components/inputs/ArithmeticColumnInput.js b/pr-preview/pr-12/components/inputs/ArithmeticColumnInput.js new file mode 100644 index 0000000..cf21c92 --- /dev/null +++ b/pr-preview/pr-12/components/inputs/ArithmeticColumnInput.js @@ -0,0 +1,244 @@ +import {FileRegistry} from "../../registries/FileRegistry"; +import {WrapperContainer} from "../../containers/WrapperContainer"; + +export class ArithmeticColumnInput extends HTMLElement { + + static column_display_id = 'column-display-list'; + static column_create_button_id = 'column-edit-button'; + static column_main_input_id = 'column-main-input'; + static column_list_id = 'column-input-list'; + static input_expression = 'input-expression'; + + static button_commands = ['C', '<--', '-->', 'V'] + + column_display = ""; + column_create_button = ""; + column_main_input = "
" + + "
" + + "
" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "
" + + "
    " + + "
    " + + "
    " + + "
    " + + display_formula = ''; + inner_formula = ''; + + constructor() { + super(); + + this.innerHTML = this.column_display + this.column_main_input + this.column_create_button; + + this.handleFileChangeEvent = this.handleFileChangeEvent.bind(this); + + + this._setupInnerElementsListeners(); + this._setupExternalListeners(); + } + + _setupExternalListeners() { + this.addEventListener('file-registry-change', this.handleFileChangeEvent); + } + + _setupInnerElementsListeners() { + this._setCreateButtonListener(); + this._setKeyboardListener(); + } + + _setCreateButtonListener() { + let create_button = document.getElementById(ArithmeticColumnInput.column_create_button_id); + + create_button.addEventListener('click', (e) => { + let display_main_input = document.getElementById(ArithmeticColumnInput.column_main_input_id); + display_main_input.classList.toggle('visible'); + }) + } + + handleFileChangeEvent(event) { + let current_file_list = FileRegistry.getCurrentFilesList(); + let columns = []; + + this._resetColumnInput(); + + current_file_list.forEach((file) => { + + if(file.type === 'fits') { + let fits_reader_wrapper = WrapperContainer.getFITSReaderWrapper(); + + fits_reader_wrapper.setFile(file.file); + let fits_columns = fits_reader_wrapper.getAllColumns(); + + fits_columns.forEach((fits_column) => { + let column = {...fits_column, file_id: file.id}; + columns.push(column); + }) + + } + }) + + let columns_by_file = columns.reduce((acc, column) => { + if (!acc[column.file_id]) { + acc[column.file_id] = []; + } + acc[column.file_id].push(column); + return acc; + }, {}); + + let li_group_list = []; + + let i = 1; + for (let file_id in columns_by_file) { + if (columns_by_file.hasOwnProperty(file_id)) { + let file = FileRegistry.getFileById(file_id); + let file_name = file.file_name; + + let frw = WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file.file); + + li_group_list.push(this.createColumnsList(columns_by_file[file_id], frw)); + } + i++; + } + + this.setColumnInput(li_group_list); + this._setColumnInputListener(); + } + + executeCommand(command) { + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + switch (command) { + + case 'C': + input_display.value = ''; + + break; + + case 'V': + this.addColumnToDisplay(input_display.value); + + break; + + case '<--': + + break; + + case '-->': + + break; + + } + } + + createColumnsList(file_columns, fits_reader_wrapper) { + + let li_group = []; + + file_columns.forEach(column => { + let li = document.createElement("li"); + + let hdu_type = fits_reader_wrapper.getHeaderCardValueByNameFromHDU(column.hdu_index, 'XTENSION'); + let hdu_extname = fits_reader_wrapper.getHeaderCardValueByNameFromHDU(column.hdu_index, 'EXTNAME'); + let name = hdu_type+'-'+hdu_extname+' '+column.name; + + if(column.is_from_header) { + name += '(HEADER)'; + } + + if(column.is_processed) { + li.innerHTML = name; + li.setAttribute('dataset-id',`${column.from_file}.${column.hdu_index}$${column.name}`); + } else { + li.innerHTML = name; + li.setAttribute('data-id',`${column.file_id}.${column.hdu_index}$${column.name}`); + } + + li_group.push(li); + }); + + return li_group; + } + + setColumnInput(li_group_list) { + let ul_columns = document.getElementById(ArithmeticColumnInput.column_list_id); + + li_group_list.forEach((li_group) => { + li_group.forEach((li) => { + ul_columns.appendChild(li); + }) + }) + } + + _setKeyboardListener() { + let buttons = document.querySelectorAll('div.button-grid button'); + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + buttons.forEach((button) => { + button.addEventListener('click', (e) => { + let operator = button.textContent; + + if(!ArithmeticColumnInput.button_commands.includes(operator)) { + input_display.value += operator; + } else { + this.executeCommand(operator); + } + }); + }); + } + + _resetColumnInput() { + let column_list = document.getElementById(ArithmeticColumnInput.column_list_id); + column_list.innerHTML = ''; + } + + _setColumnInputListener() { + let lis = document.querySelectorAll('ul#column-input-list li'); + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + lis.forEach(function(li) { + li.addEventListener('click', (e) => { + let column_id = li.getAttribute('data-id'); + input_display.value += column_id; + }); + }); + } + + addColumnToDisplay(expression) { + let column_display = document.getElementById(ArithmeticColumnInput.column_display_id); + + let li_expression = document.createElement('li'); + li_expression.innerHTML = expression+' '; + li_expression.setAttribute('data-column', expression); + + column_display.appendChild(li_expression); + } + +} \ No newline at end of file diff --git a/pr-preview/pr-12/containers/RegistryContainer.js b/pr-preview/pr-12/containers/RegistryContainer.js index 0f1f0ba..7c69bff 100644 --- a/pr-preview/pr-12/containers/RegistryContainer.js +++ b/pr-preview/pr-12/containers/RegistryContainer.js @@ -1,7 +1,10 @@ import { EventSubscribersRegistry } from '../registries/EventSubscribersRegistry.js' +import {FileRegistry} from "../registries/FileRegistry"; export class RegistryContainer { + static file_registry = null; + constructor() { } @@ -10,6 +13,14 @@ export class RegistryContainer { return new EventSubscribersRegistry(); } + getFileRegistry() { + return RegistryContainer.file_registry; + } + + static setFileRegistry(file_registry) { + RegistryContainer.file_registry = file_registry; + } + static getRegistryContainer() { return new RegistryContainer(); } diff --git a/pr-preview/pr-12/data_processors/DataPreProcessor.js b/pr-preview/pr-12/data_processors/DataPreProcessor.js index 4281d15..a0e58f9 100644 --- a/pr-preview/pr-12/data_processors/DataPreProcessor.js +++ b/pr-preview/pr-12/data_processors/DataPreProcessor.js @@ -50,7 +50,7 @@ export class DataPreProcessor { if(error_bar.column_name === SpectrumProcessor.E_MID_LOG) { column_data.forEach(col_data => { - console.log(col_data); + }) } @@ -99,6 +99,9 @@ export class DataPreProcessor { processErrorBarDataJSON(dataset, axis, error_bars) { + console.log(error_bars); + console.log(dataset); + let error_bar_x_values = []; let error_bar_y_values = []; @@ -108,34 +111,56 @@ export class DataPreProcessor { let error_bar_x_column = error_bars.x; let error_bar_y_column = error_bars.y; + let error_bars_object = {}; + dataset.forEach(function(datapoint){ - let error_bar_x = [ - { - bound: parseFloat(datapoint[axis_y]) - parseFloat(datapoint[error_bar_y_column]), - [axis_x]: parseFloat(datapoint[axis_x]) - }, - { - bound: parseFloat(datapoint[axis_y]) + parseFloat(datapoint[error_bar_y_column]), - [axis_x]: parseFloat(datapoint[axis_x]) - } - ] - - let error_bar_y = [ - { - bound: parseFloat(datapoint[axis_x]) - parseFloat(datapoint[error_bar_x_column]), - [axis_y]: parseFloat(datapoint[axis_y]) - }, - { - bound: parseFloat(datapoint[axis_x]) + parseFloat(datapoint[error_bar_x_column]), - [axis_y]: parseFloat(datapoint[axis_y]) - } - ] - error_bar_x_values.push(error_bar_x); - error_bar_y_values.push(error_bar_y); + if(error_bars.x) { + + console.log("X"); + console.log(datapoint[axis_x]); + console.log(error_bar_x_column); + + let error_bar_x = [ + { + bound: parseFloat(datapoint[axis_x]) - parseFloat(datapoint[error_bar_x_column]), + [axis_y]: parseFloat(datapoint[axis_y]) + }, + { + bound: parseFloat(datapoint[axis_x]) + parseFloat(datapoint[error_bar_x_column]), + [axis_y]: parseFloat(datapoint[axis_y]) + } + ] + + error_bar_x_values.push(error_bar_x); + } + + if(error_bars.y) { + + console.log("Y"); + console.log(datapoint[axis_x]); + console.log(error_bar_y_column); + + let error_bar_y = [ + { + bound: parseFloat(datapoint[axis_y]) - parseFloat(datapoint[error_bar_y_column]), + [axis_x]: parseFloat(datapoint[axis_x]) + }, + { + bound: parseFloat(datapoint[axis_y]) + parseFloat(datapoint[error_bar_y_column]), + [axis_x]: parseFloat(datapoint[axis_x]) + } + ] + + error_bar_y_values.push(error_bar_y); + } + }) - return { x: error_bar_x_values, y: error_bar_y_values } + if(error_bars.x) error_bars_object.x = error_bar_x_values; + if(error_bars.y) error_bars_object.y = error_bar_y_values; + + return error_bars_object; } getSpectrumProcessedColumn(hdu_index, column_name, fits_reader_wrapper) { diff --git a/pr-preview/pr-12/dist/astrovis/astrovis.js b/pr-preview/pr-12/dist/astrovis/astrovis.js index 25bbbb6..0d83f31 100644 --- a/pr-preview/pr-12/dist/astrovis/astrovis.js +++ b/pr-preview/pr-12/dist/astrovis/astrovis.js @@ -299,7 +299,6 @@ class FileComponent extends HTMLElement { handleSelectChangeEvent(event) { event.stopPropagation(); - } _setContainer() { @@ -329,6 +328,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _events_VisualizationGenerationEvent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/VisualizationGenerationEvent */ "./events/VisualizationGenerationEvent.js"); /* harmony import */ var _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../registries/FileRegistry */ "./registries/FileRegistry.js"); /* harmony import */ var _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../containers/WrapperContainer */ "./containers/WrapperContainer.js"); +/* harmony import */ var _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/ColumnUtils */ "./utils/ColumnUtils.js"); +/* harmony import */ var _containers_RegistryContainer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../containers/RegistryContainer */ "./containers/RegistryContainer.js"); +/* harmony import */ var _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events/FileRegistryChangeEvent */ "./events/FileRegistryChangeEvent.js"); + + + @@ -381,6 +386,7 @@ class SettingsComponent extends HTMLElement { this.handleHDUsChangeEvent = this.handleHDUsChangeEvent.bind(this); this.handleGenerateEvent = this.handleGenerateEvent.bind(this); this.handleFileChangeEvent = this.handleFileChangeEvent.bind(this); + this.handleArithmeticColumnChangeEvent = this.handleArithmeticColumnChangeEvent.bind(this); this._setupExternalListeners(); this._setupInnerListeners(); @@ -399,12 +405,14 @@ class SettingsComponent extends HTMLElement { this.addEventListener('select-data-type-change', this.handleDataTypeChangeEvent); this.addEventListener('select-hdus-change', this.handleHDUsChangeEvent); this.addEventListener('button-generate-click', this.handleGenerateEvent); + this.addEventListener('arithmetic-column-change', this.handleArithmeticColumnChangeEvent); } _setupInnerElementsListeners() { this._setSelectLibraryListener(); this._setSelectDataTypeListener() this._setSelectHDUsListener(); + this._setSelectAxisListener(); this._setGenerateButtonListener(); this._setCalculationRadioListeners(); } @@ -508,7 +516,12 @@ class SettingsComponent extends HTMLElement { if(file.type === 'fits') { let fits_reader_wrapper = _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_4__.WrapperContainer.getFITSReaderWrapper(); - fits_reader_wrapper.setFile(file.file); + if(file.product_type !== 'spectrum') { + fits_reader_wrapper.setFile(file.file); + } else { + fits_reader_wrapper.setFileFromFileObject(file); + } + let fits_columns = fits_reader_wrapper.getAllColumns(); fits_columns.forEach((fits_column) => { @@ -546,9 +559,15 @@ class SettingsComponent extends HTMLElement { } this._setSelectGroupAxis(select_options); + + select_options.unshift(this._createGenericColumnOptionsGroup()); this._setSelectGroupErrorBars(select_options); } + handleArithmeticColumnChangeEvent(event) { + //this._setSelectAxis() + } + _setContainer() { this.container = document.getElementById(this.container_id) } @@ -623,6 +642,21 @@ class SettingsComponent extends HTMLElement { return opt_group } + _createGenericColumnOptionsGroup() { + let opt_group = document.createElement("optgroup"); + opt_group.label = "Genereic columns"; + opt_group.className += "generic"; + + let option = document.createElement("option"); + + option.text = 'None'; + option.value = `none`; + + opt_group.appendChild(option); + + return opt_group; + } + _setSelectAxis(columns) { this._resetSelectAxis(); @@ -779,6 +813,117 @@ class SettingsComponent extends HTMLElement { }); } + _setSelectAxisListener() { + let select_axis_x = document.getElementById(SettingsComponent.select_axis_x_id); + let select_axis_y = document.getElementById(SettingsComponent.select_axis_y_id); + + let select_error_bar_x = document.getElementById(SettingsComponent.select_error_bar_x_id); + let select_error_bar_y = document.getElementById(SettingsComponent.select_error_bar_y_id); + + select_axis_x.addEventListener('change', (e) => { + let column_id = e.target.value; + + let data_type = document.getElementById(SettingsComponent.select_data_type_id).value; + + if(data_type === 'light-curve') { + + let column_descriptor = _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(column_id) + + let file_object = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_3__.FileRegistry.getFileById(column_descriptor.file_id); + + let frw = _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_4__.WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file_object.file); + + let columns_name= frw.getAllColumns(); + + if(column_descriptor.column_name.toUpperCase() === 'RATE' && + columns_name.some(column => { + return column.name.toUpperCase() === 'ERROR' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_x.options).forEach((option) => { + let option_column_descriptor = _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(option.value); + + if(option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'ERROR') + + select_error_bar_x.value = option.value; + }) + } + + if(column_descriptor.column_name.toUpperCase() === 'TIME' && + columns_name.some(column => { + return column.name.toUpperCase() === 'TIMEDEL' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_x.options).forEach((option) => { + let option_column_descriptor = _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(option.value); + + if (option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'TIMEDEL') + + select_error_bar_x.value = option.value; + }) + } + } + + }) + + select_axis_y.addEventListener('change', (e) => { + let column_id = e.target.value; + + let data_type = document.getElementById(SettingsComponent.select_data_type_id).value; + + if(data_type === 'light-curve') { + + let column_descriptor= _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(column_id) + + let file_object = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_3__.FileRegistry.getFileById(column_descriptor.file_id); + + let frw= _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_4__.WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file_object.file); + + let columns_name= frw.getAllColumns(); + + if(column_descriptor.column_name.toUpperCase() === 'RATE' && + columns_name.some(column => { + return column.name.toUpperCase() === 'ERROR' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_y.options).forEach((option) => { + let option_column_descriptor = _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(option.value); + + if(option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'ERROR') + + select_error_bar_y.value = option.value; + }) + } + + if(column_descriptor.column_name.toUpperCase() === 'TIME' && + columns_name.some(column => { + return column.name.toUpperCase() === 'TIMEDEL' && parseInt(column.hdu_index) === parseInt(column_descriptor.hdu_index) + })) { + + Array.from(select_error_bar_y.options).forEach((option) => { + let option_column_descriptor = _utils_ColumnUtils__WEBPACK_IMPORTED_MODULE_5__.ColumnUtils.getColumnSettings(option.value); + + if (option_column_descriptor.file_id === column_descriptor.file_id && + option_column_descriptor.hdu_index === column_descriptor.hdu_index && + option_column_descriptor.column_name.toUpperCase() === 'TIMEDEL') + + select_error_bar_y.value = option.value; + }) + } + } + + }) + + } + _setCalculationRadioListeners() { let radio_buttons = document.querySelectorAll('.' + SettingsComponent.calculation_radio_class); radio_buttons.forEach(radio_button => { @@ -857,8 +1002,17 @@ class SettingsComponent extends HTMLElement { if(values['has-error-bars-checkbox'].checked === true) { let error_bars = {}; - error_bars.x = values['select-axis-x-error-bar'].value; - error_bars.y = values['select-axis-y-error-bar'].value; + if(values['select-axis-x-error-bar'] !== undefined) { + error_bars.x = values['select-axis-x-error-bar'].value; + } else { + delete error_bars.x + } + + if(values['select-axis-y-error-bar'] !== undefined) { + error_bars.y = values['select-axis-y-error-bar'].value; + } else { + delete error_bars.y + } this.settings_object.setErrorBarsSettings(error_bars); } @@ -1003,6 +1157,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../containers/WrapperContainer */ "./containers/WrapperContainer.js"); /* harmony import */ var _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../registries/FileRegistry */ "./registries/FileRegistry.js"); /* harmony import */ var _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../events/FileRegistryChangeEvent */ "./events/FileRegistryChangeEvent.js"); +/* harmony import */ var _containers_RegistryContainer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../containers/RegistryContainer */ "./containers/RegistryContainer.js"); + @@ -1019,6 +1175,11 @@ class FITSSettingsComponent extends HTMLElement { add_to_plot_btn_id = "add-to-plot"; remove_from_plot_btn_id = "remove-from-plot"; + save_btn_id = 'save-file-settings'; + + product_type_select_id = 'product-type-select'; + arf_file_select_id = 'arf-file-select'; + rmf_file_select_id = 'rmf-file-select'; container = '
    ' + '
    ' + @@ -1081,6 +1242,13 @@ class FITSSettingsComponent extends HTMLElement { '
    \n' + '
    File settings
    \n' + '
    \n' + + ' ' + ' \n' + @@ -1127,7 +1295,7 @@ class FITSSettingsComponent extends HTMLElement { '
    \n' + '
    \n' + '\n' + - ' \n' + + ' \n' + ' \n' + ' \n' + '
    \n' + @@ -1139,6 +1307,7 @@ class FITSSettingsComponent extends HTMLElement { setupComponent() { this.setHDUSelect(); this.setupActionButtons(); + this.setProductSettings(); let select_hdu = document.getElementById(this.select_hdu_id); let hdu_index = select_hdu.value; @@ -1177,6 +1346,10 @@ class FITSSettingsComponent extends HTMLElement { setupInnerElementListeners() { this.setHDUSelectListener(); + this.setSaveButtonListener(); + //this.setProductTypeSelectListener(); + //this.setARFFileSelectListener(); + //this.setRMFFileSelectListener(); } setupActionButtons() { @@ -1198,7 +1371,12 @@ class FITSSettingsComponent extends HTMLElement { this.is_current = true; let frce = new _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_2__.FileRegistryChangeEvent(); - frce.dispatchToSubscribers(); + + try { + frce.dispatchToSubscribers(); + } catch(e) { + console.log("No subsribers for event : " + _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_2__.FileRegistryChangeEvent.name); + } this.resetContainerForCurrentFile(); @@ -1210,12 +1388,31 @@ class FITSSettingsComponent extends HTMLElement { this.is_current = false; let frce = new _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_2__.FileRegistryChangeEvent(); - frce.dispatchToSubscribers(); + + try { + frce.dispatchToSubscribers(); + } catch(e) { + console.log("No subscribers for specified event : " + _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_2__.FileRegistryChangeEvent.name); + } this.resetContainerForCurrentFile(); }); } + setProductSettings() { + let product_type = null; + let rmf_file = null; + let arf_file = null; + + if(this.file.product_type) product_type = this.file.product_type; + if(this.file.rmf_file) rmf_file = this.file.rmf_file; + if(this.file.arf_file) arf_file = this.file.arf_file; + + //this.setProductTypeSelect(product_type); + //this.setRMFFileSelect(rmf_file); + //this.setARFFileSelect(arf_file); + } + setTables(hdu_index) { this.resetTables(); @@ -1299,10 +1496,410 @@ class FITSSettingsComponent extends HTMLElement { } + setSaveButtonListener() { + let save_settings_btn = document.getElementById(this.save_btn_id); + + save_settings_btn.addEventListener('click', (event) => { + let product_type_select = document.getElementById(this.product_type_select_id); + + if(product_type_select.value === 'spectrum') { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + let arf_file_select = document.getElementById(this.arf_file_select_id); + + let rmf_file_id = rmf_file_select.value; + let arf_file_id = arf_file_select.value; + + _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_1__.FileRegistry.setFileMetadata(this.file.id, { + rmf_file: rmf_file_id, + arf_file: arf_file_id + }); + } + + }) + + } + + setProductTypeSelect(value = null) { + let product_type_select = document.getElementById(this.product_type_select_id); + + if(value) { + product_type_select.value = 'none'; + } else { + product_type_select.value = value; + } + } + + setProductTypeSelectListener() { + let product_type_select = document.getElementById(this.product_type_select_id); + + product_type_select.addEventListener('change', (event) => { + if(product_type_select.value === 'spectrum') { + this.setProductSettingsVisibility('spectrum'); + } else if(product_type_select.value === 'lightcurve') { + this.setProductSettingsVisibility('lightcurve'); + } else { + this.setProductSettingsVisibility(); + } + }) + + } + + setRMFFileSelect(value = null) { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + + let file_options = this.getFilesOptionsList(); + + file_options.forEach((option) => { + rmf_file_select.appendChild(option) + }); + + if(!value) { + rmf_file_select.value = 'none'; + } else { + rmf_file_select.value = value; + } + } + + setRMFFileSelectListener() { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + + } + + setARFFileSelect(value = null) { + let arf_file_select = document.getElementById(this.arf_file_select_id); + + let file_options = this.getFilesOptionsList(); + + file_options.forEach((option) => { + arf_file_select.appendChild(option) + }); + + if(!value) { + arf_file_select.value = 'none'; + } else { + arf_file_select.value = value; + } + } + + setARFFileSelectListener() { + let arf_file_select = document.getElementById(this.arf_file_select_id); + + } + + setProductSettingsVisibility(settings = null) { + let rmf_file_select = document.getElementById(this.rmf_file_select_id); + let arf_file_select = document.getElementById(this.arf_file_select_id); + + rmf_file_select.style.display = 'none'; + arf_file_select.style.display = 'none'; + + let spectrum_elements = document.getElementsByClassName('spectrum-settings'); + + for (let i = 0; i < spectrum_elements.length; i++) { + spectrum_elements[i].style.display = 'none'; + } + + if(!settings) { + + } else if(settings === 'spectrum') { + rmf_file_select.style.display = 'block'; + arf_file_select.style.display = 'block'; + + for (let i = 0; i < spectrum_elements.length; i++) { + spectrum_elements[i].style.display = 'block'; + } + } else if(settings === 'lightcurve') { + + } + } + resetContainerForCurrentFile() { this.setupComponent(); } + getFilesOptionsList() { + let file_options = []; + let file_list = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_1__.FileRegistry.getAllFiles(); + + let option = document.createElement("option"); + + option.setAttribute('selected', 'true'); + + option.value = 'none'; + option.text = 'None'; + + file_options.push(option); + + file_list.forEach((file) => { + option = document.createElement("option"); + + option.value = file.id; + option.text = file.file_name; + + file_options.push(option); + }) + + return file_options; + } +} + +/***/ }), + +/***/ "./components/inputs/ArithmeticColumnInput.js": +/*!****************************************************!*\ + !*** ./components/inputs/ArithmeticColumnInput.js ***! + \****************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ArithmeticColumnInput: () => (/* binding */ ArithmeticColumnInput) +/* harmony export */ }); +/* harmony import */ var _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../registries/FileRegistry */ "./registries/FileRegistry.js"); +/* harmony import */ var _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../containers/WrapperContainer */ "./containers/WrapperContainer.js"); + + + +class ArithmeticColumnInput extends HTMLElement { + + static column_display_id = 'column-display-list'; + static column_create_button_id = 'column-edit-button'; + static column_main_input_id = 'column-main-input'; + static column_list_id = 'column-input-list'; + static input_expression = 'input-expression'; + + static button_commands = ['C', '<--', '-->', 'V'] + + column_display = "
      "; + column_create_button = ""; + column_main_input = "
      " + + "
      " + + "
      " + + "
      " + + "
      " + + "" + + "" + + "" + + "" + + "
      " + + "
      " + + "" + + "" + + "" + + "" + + "
      " + + "
      " + + "" + + "" + + "" + + "" + + "
      " + + "
      " + + "" + + "" + + "" + + "" + + "" + + "
      " + + "
      " + + "
      " + + "
        " + + "
        " + + "
        " + + "
        " + + display_formula = ''; + inner_formula = ''; + + constructor() { + super(); + + this.innerHTML = this.column_display + this.column_main_input + this.column_create_button; + + this.handleFileChangeEvent = this.handleFileChangeEvent.bind(this); + + + this._setupInnerElementsListeners(); + this._setupExternalListeners(); + } + + _setupExternalListeners() { + this.addEventListener('file-registry-change', this.handleFileChangeEvent); + } + + _setupInnerElementsListeners() { + this._setCreateButtonListener(); + this._setKeyboardListener(); + } + + _setCreateButtonListener() { + let create_button = document.getElementById(ArithmeticColumnInput.column_create_button_id); + + create_button.addEventListener('click', (e) => { + let display_main_input = document.getElementById(ArithmeticColumnInput.column_main_input_id); + display_main_input.classList.toggle('visible'); + }) + } + + handleFileChangeEvent(event) { + let current_file_list = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_0__.FileRegistry.getCurrentFilesList(); + let columns = []; + + this._resetColumnInput(); + + current_file_list.forEach((file) => { + + if(file.type === 'fits') { + let fits_reader_wrapper = _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_1__.WrapperContainer.getFITSReaderWrapper(); + + fits_reader_wrapper.setFile(file.file); + let fits_columns = fits_reader_wrapper.getAllColumns(); + + fits_columns.forEach((fits_column) => { + let column = {...fits_column, file_id: file.id}; + columns.push(column); + }) + + } + }) + + let columns_by_file = columns.reduce((acc, column) => { + if (!acc[column.file_id]) { + acc[column.file_id] = []; + } + acc[column.file_id].push(column); + return acc; + }, {}); + + let li_group_list = []; + + let i = 1; + for (let file_id in columns_by_file) { + if (columns_by_file.hasOwnProperty(file_id)) { + let file = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_0__.FileRegistry.getFileById(file_id); + let file_name = file.file_name; + + let frw = _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_1__.WrapperContainer.getFITSReaderWrapper(); + frw.setFile(file.file); + + li_group_list.push(this.createColumnsList(columns_by_file[file_id], frw)); + } + i++; + } + + this.setColumnInput(li_group_list); + this._setColumnInputListener(); + } + + executeCommand(command) { + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + switch (command) { + + case 'C': + input_display.value = ''; + + break; + + case 'V': + this.addColumnToDisplay(input_display.value); + + break; + + case '<--': + + break; + + case '-->': + + break; + + } + } + + createColumnsList(file_columns, fits_reader_wrapper) { + + let li_group = []; + + file_columns.forEach(column => { + let li = document.createElement("li"); + + let hdu_type = fits_reader_wrapper.getHeaderCardValueByNameFromHDU(column.hdu_index, 'XTENSION'); + let hdu_extname = fits_reader_wrapper.getHeaderCardValueByNameFromHDU(column.hdu_index, 'EXTNAME'); + let name = hdu_type+'-'+hdu_extname+' '+column.name; + + if(column.is_from_header) { + name += '(HEADER)'; + } + + if(column.is_processed) { + li.innerHTML = name; + li.setAttribute('dataset-id',`${column.from_file}.${column.hdu_index}$${column.name}`); + } else { + li.innerHTML = name; + li.setAttribute('data-id',`${column.file_id}.${column.hdu_index}$${column.name}`); + } + + li_group.push(li); + }); + + return li_group; + } + + setColumnInput(li_group_list) { + let ul_columns = document.getElementById(ArithmeticColumnInput.column_list_id); + + li_group_list.forEach((li_group) => { + li_group.forEach((li) => { + ul_columns.appendChild(li); + }) + }) + } + + _setKeyboardListener() { + let buttons = document.querySelectorAll('div.button-grid button'); + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + buttons.forEach((button) => { + button.addEventListener('click', (e) => { + let operator = button.textContent; + + if(!ArithmeticColumnInput.button_commands.includes(operator)) { + input_display.value += operator; + } else { + this.executeCommand(operator); + } + }); + }); + } + + _resetColumnInput() { + let column_list = document.getElementById(ArithmeticColumnInput.column_list_id); + column_list.innerHTML = ''; + } + + _setColumnInputListener() { + let lis = document.querySelectorAll('ul#column-input-list li'); + let input_display = document.getElementById(ArithmeticColumnInput.input_expression); + + lis.forEach(function(li) { + li.addEventListener('click', (e) => { + let column_id = li.getAttribute('data-id'); + input_display.value += column_id; + }); + }); + } + + addColumnToDisplay(expression) { + let column_display = document.getElementById(ArithmeticColumnInput.column_display_id); + + let li_expression = document.createElement('li'); + li_expression.innerHTML = expression+' '; + li_expression.setAttribute('data-column', expression); + + column_display.appendChild(li_expression); + } + } /***/ }), @@ -1361,10 +1958,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ RegistryContainer: () => (/* binding */ RegistryContainer) /* harmony export */ }); /* harmony import */ var _registries_EventSubscribersRegistry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../registries/EventSubscribersRegistry.js */ "./registries/EventSubscribersRegistry.js"); +/* harmony import */ var _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../registries/FileRegistry */ "./registries/FileRegistry.js"); + class RegistryContainer { + static file_registry = null; + constructor() { } @@ -1373,6 +1974,14 @@ class RegistryContainer { return new _registries_EventSubscribersRegistry_js__WEBPACK_IMPORTED_MODULE_0__.EventSubscribersRegistry(); } + getFileRegistry() { + return RegistryContainer.file_registry; + } + + static setFileRegistry(file_registry) { + RegistryContainer.file_registry = file_registry; + } + static getRegistryContainer() { return new RegistryContainer(); } @@ -1607,7 +2216,7 @@ class DataPreProcessor { if(error_bar.column_name === _SpectrumProcessor__WEBPACK_IMPORTED_MODULE_2__.SpectrumProcessor.E_MID_LOG) { column_data.forEach(col_data => { - console.log(col_data); + }) } @@ -1656,6 +2265,9 @@ class DataPreProcessor { processErrorBarDataJSON(dataset, axis, error_bars) { + console.log(error_bars); + console.log(dataset); + let error_bar_x_values = []; let error_bar_y_values = []; @@ -1665,34 +2277,56 @@ class DataPreProcessor { let error_bar_x_column = error_bars.x; let error_bar_y_column = error_bars.y; + let error_bars_object = {}; + dataset.forEach(function(datapoint){ - let error_bar_x = [ - { - bound: parseFloat(datapoint[axis_y]) - parseFloat(datapoint[error_bar_y_column]), - [axis_x]: parseFloat(datapoint[axis_x]) - }, - { - bound: parseFloat(datapoint[axis_y]) + parseFloat(datapoint[error_bar_y_column]), - [axis_x]: parseFloat(datapoint[axis_x]) - } - ] - let error_bar_y = [ - { - bound: parseFloat(datapoint[axis_x]) - parseFloat(datapoint[error_bar_x_column]), - [axis_y]: parseFloat(datapoint[axis_y]) - }, - { - bound: parseFloat(datapoint[axis_x]) + parseFloat(datapoint[error_bar_x_column]), - [axis_y]: parseFloat(datapoint[axis_y]) - } - ] + if(error_bars.x) { + + console.log("X"); + console.log(datapoint[axis_x]); + console.log(error_bar_x_column); + + let error_bar_x = [ + { + bound: parseFloat(datapoint[axis_x]) - parseFloat(datapoint[error_bar_x_column]), + [axis_y]: parseFloat(datapoint[axis_y]) + }, + { + bound: parseFloat(datapoint[axis_x]) + parseFloat(datapoint[error_bar_x_column]), + [axis_y]: parseFloat(datapoint[axis_y]) + } + ] + + error_bar_x_values.push(error_bar_x); + } + + if(error_bars.y) { + + console.log("Y"); + console.log(datapoint[axis_x]); + console.log(error_bar_y_column); + + let error_bar_y = [ + { + bound: parseFloat(datapoint[axis_y]) - parseFloat(datapoint[error_bar_y_column]), + [axis_x]: parseFloat(datapoint[axis_x]) + }, + { + bound: parseFloat(datapoint[axis_y]) + parseFloat(datapoint[error_bar_y_column]), + [axis_x]: parseFloat(datapoint[axis_x]) + } + ] + + error_bar_y_values.push(error_bar_y); + } - error_bar_x_values.push(error_bar_x); - error_bar_y_values.push(error_bar_y); }) - return { x: error_bar_x_values, y: error_bar_y_values } + if(error_bars.x) error_bars_object.x = error_bar_x_values; + if(error_bars.y) error_bars_object.y = error_bar_y_values; + + return error_bars_object; } getSpectrumProcessedColumn(hdu_index, column_name, fits_reader_wrapper) { @@ -2231,6 +2865,25 @@ class InvalidURLError extends Error { /***/ }), +/***/ "./errors/NoEventSubscriberError.js": +/*!******************************************!*\ + !*** ./errors/NoEventSubscriberError.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NoEventSubscriberError: () => (/* binding */ NoEventSubscriberError) +/* harmony export */ }); +class NoEventSubscriberError extends Error { + constructor(message) { + super(message); + this.name = "NoEventSubscriberError"; + } +} + +/***/ }), + /***/ "./errors/NoEventToDispatchError.js": /*!******************************************!*\ !*** ./errors/NoEventToDispatchError.js ***! @@ -2376,13 +3029,15 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ FileRegistryChangeEvent: () => (/* binding */ FileRegistryChangeEvent) /* harmony export */ }); /* harmony import */ var _containers_RegistryContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../containers/RegistryContainer */ "./containers/RegistryContainer.js"); +/* harmony import */ var _errors_NoEventSubscriberError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../errors/NoEventSubscriberError */ "./errors/NoEventSubscriberError.js"); + class FileRegistryChangeEvent { static defaultOptions = { bubbles: true, - composed: false + composed: true }; static name = "file-registry-change"; @@ -2419,10 +3074,16 @@ class FileRegistryChangeEvent { let subscribers_id = esr.getSubscribersForEvent(FileRegistryChangeEvent.name); let subscriber_element = null; - subscribers_id.forEach((subscriber_id) => { - subscriber_element = document.getElementById(subscriber_id); - subscriber_element.dispatchEvent(this.event); - }) + try { + subscribers_id.forEach((subscriber_id) => { + subscriber_element = document.getElementById(subscriber_id); + subscriber_element.dispatchEvent(this.event); + }) + } catch(e) { + if(subscribers_id.length <= 0) { + throw new _errors_NoEventSubscriberError__WEBPACK_IMPORTED_MODULE_1__.NoEventSubscriberError(); + } + } } } @@ -2544,8 +3205,9 @@ class EventSubscribersRegistry { 'fits-loaded': ['settings-component', 'file-component'], 'configuration': ['settings-component'], 'file-loaded': ['file-component'], - 'file-selected': ['settings-component'], - 'file-registry-change': ['settings-component', 'file-component'] + 'file-selected': ['settings-component', 'arithmetic-column-component'], + 'file-registry-change': ['settings-component', 'file-component', 'arithmetic-column-component'], + //'arithmetic-column-change': ['settings-component'] } constructor() { @@ -2612,6 +3274,10 @@ class FileRegistry { FileRegistry.file_counter++; } + static _addToAvailableFiles(file) { + FileRegistry.available_files.push(file); + } + static moveToAvailableFiles(file) { FileRegistry.available_files.push(file); } @@ -2632,6 +3298,15 @@ class FileRegistry { FileRegistry.moveToAvailableFiles(file); } + static getAllFiles() { + let available_files = FileRegistry.getAvailableFilesList(); + let current_files = FileRegistry.getCurrentFilesList(); + + let files = available_files.concat(current_files); + + return files; + } + static getFileById(file_id) { let file_array = [...FileRegistry.available_files, ...FileRegistry.current_files]; @@ -2656,6 +3331,22 @@ class FileRegistry { return is_current; } + static setFileMetadata(file_id, metadata) { + let files = FileRegistry.getAllFiles(); + + let file = files.filter(file => file.id !== parseInt(file_id)); + + file = { ...file, ...metadata }; + + if(FileRegistry.isFileCurrent(file_id)) { + FileRegistry.removeFromCurrentFiles(file_id); + FileRegistry.addToCurrentFiles(file); + } else { + FileRegistry.removeFromAvailableFiles(file_id); + FileRegistry._addToAvailableFiles(file); + } + } + static sendRegistryChangeEvent() { let frce = new _events_FileRegistryChangeEvent__WEBPACK_IMPORTED_MODULE_0__.FileRegistryChangeEvent(); frce.dispatchToSubscribers(); @@ -2903,6 +3594,38 @@ class VisualizationSettings { /***/ }), +/***/ "./utils/ColumnUtils.js": +/*!******************************!*\ + !*** ./utils/ColumnUtils.js ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ColumnUtils: () => (/* binding */ ColumnUtils) +/* harmony export */ }); +class ColumnUtils { + + static getColumnSettings(column_settings) { + let settings = column_settings.split('$'); + + let column_location = settings[0].split('.'); + let column_name = settings[1] || ''; + + let file_id = column_location[0]; + let hdu_index = column_location.length > 1 ? column_location[1] : ''; + + return { + file_id: file_id, + hdu_index: hdu_index, + column_name: column_name + }; + } + +} + +/***/ }), + /***/ "./utils/ObjectUtils.js": /*!******************************!*\ !*** ./utils/ObjectUtils.js ***! @@ -3298,10 +4021,12 @@ class D3Graph { this.x_scale_type = scales['x']; this.y_scale_type = scales['y']; - if (error_bars) { + if(error_bars) { this.has_error_bars = true; this.error_bars = error_bars; + console.log(error_bars); + this.x_axis_data_col_error_bar = axis['x'].value; this.y_axis_data_col_error_bar = axis['y'].value; @@ -3482,34 +4207,35 @@ class D3Graph { this.error_bars = error_bars; - let error_bar_x = {x: error_bars.x}; - - let line_error_bar_x = d3.line() - .x(d => this.x_scale(d[this.x_axis_data_col])) - .y(d => this.y_scale(d.bound)); + if(error_bars.y) { + let line_error_bar_x = d3.line() + .x(d => this.x_scale(d[this.x_axis_data_col])) + .y(d => this.y_scale(d.bound)); - error_bars.x.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_x(error_bar)); - }) + error_bars.y.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_x(error_bar)); + }) + } - let line_error_bar_y = d3.line() - .x(d => this.x_scale(d.bound)) - .y(d => this.y_scale(d[this.y_axis_data_col])); - - error_bars.y.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_y(error_bar)); - }) + if(error_bars.x) { + let line_error_bar_y = d3.line() + .x(d => this.x_scale(d.bound)) + .y(d => this.y_scale(d[this.y_axis_data_col])); + error_bars.x.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_y(error_bar)); + }) + } } _setAxisLine() { @@ -3588,31 +4314,35 @@ class D3Graph { if(this.has_error_bars) { - let line_error_bar_x = d3.line() - .x(d => rescaled_x(d[this.x_axis_data_col])) - .y(d => rescaled_y(d.bound)); - - this.error_bars.x.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_x(error_bar)); - }) - - let line_error_bar_y = d3.line() - .x(d => rescaled_x(d.bound)) - .y(d => rescaled_y(d[this.y_axis_data_col])); + if(this.error_bars.y) { + let line_error_bar_x = d3.line() + .x(d => rescaled_x(d[this.x_axis_data_col])) + .y(d => rescaled_y(d.bound)); + + this.error_bars.y.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_x(error_bar)); + }) + } - this.error_bars.y.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_y(error_bar)); - }) + if(this.error_bars.x) { + let line_error_bar_y = d3.line() + .x(d => rescaled_x(d.bound)) + .y(d => rescaled_y(d[this.y_axis_data_col])); + + this.error_bars.x.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_y(error_bar)); + }) + } } } @@ -3753,10 +4483,7 @@ class BokehWrapper { let processed_data = dpp.getProcessedDataset(dataset_settings); - let processed_json_data = dpp.datasetToJSONData(processed_data); - let data_type = this.settings_object.getDataTypeSettings(); - let hdu = this.settings_object.getHDUsSettings(); let scales = this.settings_object.getScalesSettings(); @@ -3771,6 +4498,25 @@ class BokehWrapper { let data = {x: processed_data.axis[0].data, y: processed_data.axis[1].data}; if(error_bars) { + + console.log(processed_data.error_bars); + + let error_bars_object = {}; + + processed_data.error_bars.forEach((error_bar) => { + error_bar.data = error_bar.data.map(value => !isFinite(value) ? 0 : value); + error_bar.data = error_bar.data.map(value => isNaN(value) ? 0 : value); + + error_bars_object[error_bar.axis] = error_bar.column_name; + + if(error_bar.axis === 'x') { + data.dx = error_bar.data; + } else if(error_bar.axis === 'y') { + data.dy = error_bar.data; + } + }) + + /* error_bars = {x: processed_data.error_bars[0].column_name, y: processed_data.error_bars[1].column_name}; processed_data.error_bars[0].data = processed_data.error_bars[0].data.map(value => !isFinite(value) ? 0 : value); @@ -3778,6 +4524,7 @@ class BokehWrapper { data.dx = processed_data.error_bars[0].data.map(value => isNaN(value) ? 0 : value); data.dy = processed_data.error_bars[1].data.map(value => isNaN(value) ? 0 : value); + */ let asymmetric_uncertainties = false; @@ -3791,7 +4538,6 @@ class BokehWrapper { } let ranges = this.settings_object.getRangesSettings(); - let has_custom_range = false; let custom_range_data = null; if(ranges != null) { @@ -3813,29 +4559,6 @@ class BokehWrapper { } } - getProcessedData(data_type, hdu_index, axis, error_bars) { - let data = null; - - let dpc = _containers_DataProcessorContainer__WEBPACK_IMPORTED_MODULE_1__.DataProcessorContainer.getDataProcessorContainer(); - let data_processor; - - let frw = _containers_WrapperContainer__WEBPACK_IMPORTED_MODULE_3__.WrapperContainer.getFITSReaderWrapper(); - - if(data_type === 'light-curve') { - data_processor = dpc.getLightCurveProcessor(frw, hdu_index); - } else if(data_type === 'spectrum') { - data_processor = dpc.getSpectrumProcessor(frw, hdu_index); - } - - data = data_processor.processDataRawJSON(axis, error_bars); - - if(error_bars) { - data = this._processErrorBarData(data); - } - - return data; - } - _getColumnSettings(column_settings) { let settings = column_settings.split('$'); @@ -3860,6 +4583,38 @@ class BokehWrapper { div_factor = 1; } + if(data.dx) { + let x_low = []; + let x_up = []; + + for(let i in data.dx) { + x_low[i] = data.x[i] - data.dx[i] / div_factor; + x_up[i] = data.x[i] + data.dx[i] / div_factor; + } + + data.x_low = x_low; + data.x_up = x_up; + + delete data.dx; + } + + if(data.dy) { + let y_low = []; + let y_up = []; + + for(let i in data.dy) { + y_low[i] = data.y[i] - data.dy[i]; + y_up[i] = data.y[i] + data.dy[i]; + } + + data.y_low = y_low; + data.y_up = y_up; + + delete data.dy; + + } + + /* let y_low = [], y_up = [], x_low = [], x_up = []; for (let i in data.dy) { @@ -3876,6 +4631,7 @@ class BokehWrapper { delete data.dy; delete data.dx; + */ return data; } @@ -4009,8 +4765,13 @@ class D3Wrapper { axis = {x: processed_data.axis[0].column_name, y: processed_data.axis[1].column_name}; if(has_error_bars) { - error_bars = {x: processed_data.error_bars[0].column_name, y: processed_data.error_bars[1].column_name}; - error_bars = dpp.processErrorBarDataJSON(processed_json_data, axis, error_bars) + let error_bars_object = {}; + + processed_data.error_bars.forEach((error_bar) => { + error_bars_object[error_bar.axis] = error_bar.column_name; + }) + + error_bars = dpp.processErrorBarDataJSON(processed_json_data, axis, error_bars_object) } if(ranges != null) { @@ -4097,6 +4858,7 @@ class FITSReaderWrapper { constructor(file_path = null) { if(file_path) { + console.log(file_path); if (FITSReaderWrapper.is_path_valid(file_path)) { this.file_path = file_path; this._getFile() @@ -4152,6 +4914,12 @@ class FITSReaderWrapper { this.file = file; } + setFileFromFileObject(file_object) { + this.file = file_object.file; + this.arf_file = file_object.arf_file_id; + this.rmf_file = file_object.rmf_file_id; + } + getHDU(hdu_index) { if(hdu_index >= 0 && hdu_index < this.file.hdus.length) { return this.file.hdus[hdu_index]; @@ -4423,6 +5191,15 @@ class FITSReaderWrapper { frw.setFile(ancrfile.file); } + } else if(this.arf_file) { + + let ancrfile = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_2__.FileRegistry.getFileById(this.arf_file); + + if(ancrfile !== undefined) { + let frw = new FITSReaderWrapper(); + frw.setFile(ancrfile.file); + } + } if(hdu.header.get('RESPFILE') !== null) { @@ -4478,8 +5255,59 @@ class FITSReaderWrapper { }) } - } + } else if(this.rmf_file) { + let respfile = _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_2__.FileRegistry.getFileById(this.rmf_file); + + if(respfile !== undefined) { + let frw = new FITSReaderWrapper(); + + frw.setFile(respfile.file); + + let hdus_index = frw.getTabularHDUs(); + + let has_e_min_max = false; + hdus_index.forEach((hdu_index) => { + let columns_name = frw.getColumnsNameFromHDU(hdu_index); + if (columns_name.includes("E_MIN") && columns_name.includes("E_MAX")) { + has_e_min_max = true; + let e_min_max_hdus_index = hdu_index; + + let column = { + name: 'E_HALF_WIDTH', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + column = { + name: 'E_MID', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + column = { + name: 'E_MID_LOG', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + } + }) + + } + } } }) @@ -4595,6 +5423,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _components_file_type_CSVSettingsComponent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/file_type/CSVSettingsComponent.js */ "./components/file_type/CSVSettingsComponent.js"); /* harmony import */ var _visualizations_D3Graph__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./visualizations/D3Graph */ "./visualizations/D3Graph.js"); /* harmony import */ var _visualizations_BokehGraph__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./visualizations/BokehGraph */ "./visualizations/BokehGraph.js"); +/* harmony import */ var _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./registries/FileRegistry */ "./registries/FileRegistry.js"); +/* harmony import */ var _containers_RegistryContainer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./containers/RegistryContainer */ "./containers/RegistryContainer.js"); +/* harmony import */ var _components_inputs_ArithmeticColumnInput__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/inputs/ArithmeticColumnInput */ "./components/inputs/ArithmeticColumnInput.js"); + + + @@ -4623,11 +5457,14 @@ _containers_WrapperContainer_js__WEBPACK_IMPORTED_MODULE_3__.WrapperContainer.se _containers_VisualizationContainer_js__WEBPACK_IMPORTED_MODULE_4__.VisualizationContainer.setBokehVisualization(new _visualizations_BokehGraph__WEBPACK_IMPORTED_MODULE_11__.BokehGraph()); _containers_VisualizationContainer_js__WEBPACK_IMPORTED_MODULE_4__.VisualizationContainer.setD3Visualization(new _visualizations_D3Graph__WEBPACK_IMPORTED_MODULE_10__.D3Graph()); +_containers_RegistryContainer__WEBPACK_IMPORTED_MODULE_13__.RegistryContainer.setFileRegistry(new _registries_FileRegistry__WEBPACK_IMPORTED_MODULE_12__.FileRegistry()); + customElements.define('file-component', _components_FileComponent_js__WEBPACK_IMPORTED_MODULE_5__.FileComponent); customElements.define('settings-component', _components_SettingsComponent_js__WEBPACK_IMPORTED_MODULE_6__.SettingsComponent); customElements.define('visualization-component', _components_VisualizationComponent_js__WEBPACK_IMPORTED_MODULE_7__.VisualizationComponent); customElements.define('fits-component', _components_file_type_FITSSettingsComponent_js__WEBPACK_IMPORTED_MODULE_8__.FITSSettingsComponent); customElements.define('csv-component', _components_file_type_CSVSettingsComponent_js__WEBPACK_IMPORTED_MODULE_9__.CSVSettingsComponent); +customElements.define('arithmetic-column-component', _components_inputs_ArithmeticColumnInput__WEBPACK_IMPORTED_MODULE_14__.ArithmeticColumnInput); })(); @@ -4635,4 +5472,4 @@ customElements.define('csv-component', _components_file_type_CSVSettingsComponen /******/ })() ; }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN0cm92aXMuanMiLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7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0gdHlwZV9pbnB1dC52YWx1ZTtcblxuICAgICAgICBmaWxlX2lucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIGZ1bmN0aW9uKGV2ZW50KSB7XG4gICAgICAgICAgICBsZXQgZmlsZSA9IGV2ZW50LnRhcmdldC5maWxlc1swXTtcblxuICAgICAgICAgICAgaWYoZmlsZV90eXBlID09PSAnZml0cycpIHtcbiAgICAgICAgICAgICAgICBmaWxlLmFycmF5QnVmZmVyKCkudGhlbihhcnJheUJ1ZmZlciA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBmaXRzX3JlYWRlcl93cmFwcGVyID0gV3JhcHBlckNvbnRhaW5lci5nZXRGSVRTUmVhZGVyV3JhcHBlcigpO1xuXG4gICAgICAgICAgICAgICAgICAgIGZpdHNfcmVhZGVyX3dyYXBwZXIuaW5pdGlhbGl6ZUZyb21CdWZmZXIoYXJyYXlCdWZmZXIsIGZpbGUubmFtZSk7XG5cbiAgICAgICAgICAgICAgICB9KS5jYXRjaChlcnJvciA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ0Vycm9yIHJlYWRpbmcgZmlsZSBhcyBBcnJheUJ1ZmZlcjonLCBlcnJvcik7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYoZmlsZV90eXBlID09PSAnY3N2Jykge1xuICAgICAgICAgICAgICAgIGxldCByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpO1xuICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbihldmVudCkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY3N2X2ZpbGUgPSBldmVudC50YXJnZXQucmVzdWx0O1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgfSk7XG5cbiAgICB9XG5cbiAgICBfc2V0RmlsZXNMaXN0c0xpc3RlbmVycygpIHtcbiAgICAgICAgbG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Y2goKTtcblxuICAgIH1cblxuICAgIGhhbmRsZUZpbGVDaGFuZ2VFdmVudChldmVudCkge1xuICAgICAgICBsZXQgY3VycmVudF9maWxlX2xpc3QgPSBGaWxlUmVnaXN0cnkuZ2V0Q3VycmVudEZpbGVzTGlzdCgpO1xuICAgICAgICBsZXQgY29sdW1ucyA9IFtdO1xuXG4gICAgICAgIGN1cnJlbnRfZmlsZV9saXN0LmZvckVhY2goKGZpbGUpID0+IHtcblxuICAgICAgICAgICAgaWYoZmlsZS50eXBlID09PSAnZml0cycpIHtcbiAgICAgICAgICAgICAgICBsZXQgZml0c19yZWFkZXJfd3JhcHBlciA9IFdyYXBwZXJDb250YWluZXIuZ2V0RklUU1JlYWRlcldyYXBwZXIoKTtcblxuICAgICAgICAgICAgICAgIGZpdHNfcmVhZGVyX3dyYXBwZXIuc2V0RmlsZShmaWxlLmZpbGUpO1xuICAgICAgICAgICAgICAgIGxldCBmaXRzX2NvbHVtbnMgPSBmaXRzX3JlYWRlcl93cmFwcGVyLmdldEFsbENvbHVtbnMoKTtcblxuICAgICAgICAgICAgICAgIGZpdHNfY29sdW1ucy5mb3JFYWNoKChmaXRzX2NvbHVtbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY29sdW1uID0gey4uLmZpdHNfY29sdW1uLCBmaWxlX2lkOiBmaWxlLmlkfTtcbiAgICAgICAgICAgICAgICAgICAgY29sdW1ucy5wdXNoKGNvbHVtbik7XG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgfSBlbHNlIGlmKGZpbGUudHlwZSA9PT0gJ2NzdicpIHtcblxuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuXG4gICAgICAgIGxldCBjb2x1bW5zX2J5X2ZpbGUgPSBjb2x1bW5zLnJlZHVjZSgoYWNjLCBjb2x1bW4pID0+IHtcbiAgICAgICAgICAgIGlmICghYWNjW2NvbHVtbi5maWxlX2lkXSkge1xuICAgICAgICAgICAgICAgIGFjY1tjb2x1bW4u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dGVuZXIoJ2NoYW5nZScsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgIGNvbnN0IGN1c3RvbV9jaGFuZ2VfZXZlbnQgPSBuZXcgQ3VzdG9tRXZlbnQoJ3NlbGVjdC1saWJyYXJ5LWNoYW5nZScsIHtcbiAgICAgICAgICAgICAgICBidWJibGVzOiBmYWxzZSxcbiAgICAgICAgICAgICAgICBjb21wb3NlOiBmYWxzZSxcbiAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiB0cnVlLFxuICAgICAgICAgICAgICAgIGRldGFpbDoge1xuICAgICAgICAgICAgICAgICAgICBsaWJyYXJ5OiBzZWxlY3RfbGlicmFyeS52YWx1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQoY3VzdG9tX2NoYW5nZV9ldmVudCk7XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIF9zZXRTZWxlY3REYXRhVHlwZUxpc3RlbmVyKCkge1xuICAgICAgICBsZXQgc2VsZWN0X2RhdGFfdHlwZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKFNldHRpbmdzQ29tcG9uZW50LnNlbGVjdF9kYXRhX3R5cGVfaWQpO1xuXG4gICAgICAgIHNlbGVjdF9kYXRhX3R5cGUuYWRkRXZlbnRMaXN0ZW5lcignY2hhbmdlJywgKGV2ZW50KSA9PiB7XG4gICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgY29uc3QgY3VzdG9tX2NoYW5nZV9ldmVudCA9IG5ldyBDdXN0b21FdmVudCgnc2VsZWN0LWRhdGEtdHlwZS1jaGFuZ2UnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogZmFsc2UsXG4gICAgICAgICAgICAgICAgY29tcG9zZTogZmFsc2UsXG4gICAgICAgICAgICAgICAg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B7fTtcblxuICAgICAgICBkYXRhX3R5cGUudHlwZSA9IHZhbHVlc1snc2VsZWN0LWRhdGEtdHlwZSddLnZhbHVlO1xuICAgICAgICB0aGlzLnNldHRpbmdzX29iamVjdC5zZXREYXRhVHlwZVNldHRpbmdzKGRhdGFfdHlwZSk7XG5cbiAgICAgICAgaWYodmFsdWVzWydzZWxlY3QtYXhpcy14J10gJiYgdmFsdWVzWydzZWxlY3QtYXhpcy15J10pIHtcbiAgICAgICAgICAgIGxldCBheGlzID0ge307XG4gICAgICAgICAgICBsZXQgc2NhbGVzID0ge307XG5cbiAgICAgICAgICAgIGF4aXMueCA9IHZhbHVlc1snc2VsZWN0LWF4aXMteCddLnZhbHVlO1xuICAgICAgICAgICAgYXhpcy55ID0gdmFsdWVzWydzZWxlY3QtYXhpcy15J10udmFsdWU7XG5cbiAgICAgICAgICAgIHNjYWxlcy54ID0gdmFsdWVzWydzZWxlY3QtYXhpcy14LXNjYWxlJ10udmFsdWU7XG4gICAgICAgICAgICBzY2FsZXMueSA9IHZhbHVlc1snc2VsZWN0LWF4aXMteS1zY2FsZSddLnZhbHVlO1xuXG4gICAgICAgICAgICB0aGlzLnNldHRpbmdzX29iamVjdC5zZXRBeGlzU2V0dGluZ3MoYXhpcyk7XG4gICAgICAgICAgICB0aGlzLnNldHRpbmdzX29iamVjdC5zZXRTY2FsZXNTZXR0aW5ncyhzY2FsZXMpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYodmFsdWVzWydoYXMtZXJyb3ItYmFycy1jaGVja2JveCddKSB7XG4gICAgICAgICAgICBpZih2YWx1ZXNbJ2hhcy1lcnJvci1iYXJzLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGxldCBlcnJvcl9iYXJzID0ge307XG5cbiAgICAgICAgICAgICAgICBlcnJvcl9iYXJzLnggPSB2YWx1ZXNbJ3NlbGVjdC1heGlzLXgtZXJyb3ItYmFyJ10udmFsdWU7XG4gICAgICAgICAgICAgICAgZXJyb3JfYmFycy55ID0gdmFsdWVzWydzZWxlY3QtYXhpcy15LWVycm9yLWJhciddLnZhbHVlO1xuXG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0aW5nc19vYmplY3Quc2V0RXJyb3JCYXJzU2V0dGluZ3MoZXJyb3JfYmFycyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZih2YWx1ZXNbJ2hhcy14LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSB8fCB2YWx1ZXNbJ2hhcy15LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuXG4gICAgICAgICAgICBsZXQgcmFuZ2VzID0ge1xuICAgICAgICAgICAgICAgIHg6IHt9LFxuICAgICAgICAgICAgICAgIHk6IHt9XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBpZih2YWx1ZXNbJ2hhcy14LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIHJhbmdlc1sneCddLmxvd2VyX2JvdW5kID0gdmFsdWVzWyd4LWxvd2VyLWJvdW5kJ10udmFsdWU7XG4gICAgICAgICAgICAgICAgcmFuZ2VzWyd4J10udXBwZXJfYm91bmQgPSB2YWx1ZXNbJ3gtaGlnaGVyLWJvdW5kJ10udmFsdWU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJhbmdlc1sneCddID0gbnVsbDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYodmFsdWVzWydoYXMteS1yYW5nZS1jaGVja2JveCddLmNoZWNrZWQgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICByYW5nZXNbJ3knXS5sb3dlcl9ib3VuZCA9IHZhbHVlc1sneS1sb3dlci1ib3VuZCddLnZhbHVlO1xuICAgICAgICAgICAgICAgIHJhbmdlc1sneSddLnVwcGVyX2Jvd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RoZWFkPicgK1xuICAgICAgICAnICAgIDx0cj4nICtcbiAgICAgICAgJyAgICAgICAgPHRoIHNjb3BlPVwiY29sXCI+IzwvdGg+JyArXG4gICAgICAgICcgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPk5hbWU8L3RoPicgK1xuICAgICAgICAnICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5WYWx1ZTwvdGg+JyArXG4gICAgICAgICcgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPkNvbW1lbnQ8L3RoPicgK1xuICAgICAgICAnICAgIDwvdHI+JyArXG4gICAgICAgICcgICAgPC90aGVhZD4nICtcbiAgICAgICAgJyAgICA8dGJvZHkgY2xhc3M9XCJ0YWJsZS1ncm91cC1kaXZpZGVyXCI+JyArXG4gICAgICAgICcgICAgPC90Ym9keT4nICtcbiAgICAgICAgJzwvdGFibGU+J1xuXG4gICAgZGF0YV9jb2x1bW4gPSAnPGRpdiBjbGFzcz1cInJpZ2h0LWNvbHVtblwiPicgK1xuICAgICAgICAnPGRpdiBjbGFzcz1cImNhcmQtaGVhZGVyXCI+RGF0YTwvZGl2PicgK1xuICAgICAgICAnPGRpdiBjbGFzcz1cImNhcmQtYm9keVwiPicgK1xuICAgICAgICAnICAgPGRpdiBpZD1cImRhdGEtaGR1LWZpbGVcIj4nICtcbiAgICAgICAgJyAgIDwvZGl2PicgK1xuICAgICAgICAnPC9kaXY+JztcblxuICAgIHRhYmxlX2RhdGEgPSAnPHRhYmxlIGlkPVwidGFibGUtZGF0YVwiIGNsYXNzPVwidGFibGUgdGFibGUtc3RyaXBlZFwiPicgK1xuICAgICAgICAnICAgIDx0aGVhZD4nICtcbiAgICAgICAgJyAgICAgICA8dHI+JyArXG4gICAgICAgICcgICAgICAgPC90cj4nICtcbiAgICAgICAgJyAgICA8L3RoZWFkPicgK1xuICAgICAgICAnICAgIDx0Ym9keSBjbGFzcz1cInRhYmxlLWdyb3VwLWRpdmlkZXJcIj4nICtcbiAgICAgICAgJyAgICA8L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+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHNlbGVjdCBpZD1cInNlbGVjdC1oZHUtZmlsZVwiIGNsYXNzPVwiZm9ybS1zZWxlY3RcIj5cXG4nICtcbiAgICAgICAgICAgICdcXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3NlbGVjdD5cXG4nICtcbiAgICAgICAgICAgICdcXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiaW5uZXItcm93XCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJsZWZ0LWNvbHVtblwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmRcIj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiY2FyZC1oZWFkZXJcIj5IZWFkZXI8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiY2FyZC1ib2R5XCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9XCJoZWFkZXItaGR1LWZpbGVcIiBjbGFzcz1cImZpbGUtZGF0YS1jb250YWluZXJcIj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0YWJsZSBpZD1cInRhYmxlLWhlYWRlci1kYXRhXCIgY2xhc3M9XCJ0YWJsZSB0YWJsZS1zdHJpcGVkXCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRoZWFkPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0cj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRoIHNjb3BlPVwiY29sXCI+IzwvdGg+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPk5hbWU8L3RoPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5WYWx1ZTwvdGg+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPkNvbW1lbnQ8L3RoPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdHI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC90aGVhZD5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGJvZHkgY2xhc3M9XCJ0YWJsZS1ncm91cC1kaXZpZGVyXCI+XFxuJyArXG4gICAgICAgICAgICAnXFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC90Ym9keT5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdGFibGU+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwicmlnaHQtY29sdW1uXCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiY2FyZFwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJjYXJkLWhlYWRlclwiPkRhdGE8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiY2FyZC1ib2R5XCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgaWQ9XCJkYXRhLWhkdS1maWxlXCIgY2xhc3M9XCJmaWxlLWRhdGEtY29udGFpbmVyXCI+XFxuJyArXG4gICAgICAgICAgICAnPHRhYmxlIGlkPVwidGFibGUtZGF0YVwiIGNsYXNzPVwidGFibGUgdGFibGUtc3RyaXBlZFwiPicgK1xuICAgICAgICAgICAgICAgICcgICAgPHRoZWFkPicgK1xuICAgICAgICAgICAgICAgICcgICAgICAgPHRyPicgK1xuICAgICAgICAgICAgICAgICAgICAnICAgICAgIDwvdHI+JyArXG4gICAgICAgICAgICAgICAgJyAgICA8L3RoZWFkPicgK1xuICAgICAgICAgICAgICAgICcgICAgPHRib2R5IGNsYXNzPVwidGFibGUtZ3JvdXAtZGl2aWRlclwiPicgK1xuICAgICAgICAgICAgICAgICcgICAgPC90Ym9keT4nICtcbiAgICAgICAgICAgICAgICAnPC90YWJsZT4nK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICdcXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8IS0tIGJ1dHRvbiBjbGFzcz1cImJ0biBidG4tc3VjY2Vzc1wiIGlkPVwic2F2ZS1maWxlLXNldHRpbmdzXCI+U2F2ZSBjaGFuZ2VzPC9idXR0b24gLS0+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiBjbGFzcz1cImJ0biBidG4tcHJpbWFyeVwiIGlkPVwiYWRkLXRvLXBsb3RcIj5BZGQgdG8gcGxvdDwvYnV0dG9uPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9XCJidG4gYnRuLWRhbmdlclwiIGlkPVwicmVtb3ZlLWZyb20tcGxvdFwiPlJlbW92ZSBmcm9tIHBsb3Q8L2J1dHRvbj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj4nXG5cbiAgICB9XG5cbiAgICBzZXR1cENvbXBvbmVudCgpIHtcbiAgICAgICAgdGhpcy5zZXRIRFVTZWxlY3QoKTtcbiAgICAgICAgdGhpcy5zZXR1cEFjdGlvbkJ1dHRvbnMoKTtcblxuICAgICAgICBsZXQgc2VsZWN0X2hkdSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRoaXMuc2VsZWN0X2hkdV9pZCk7XG4gICAgICAgIGxldCBoZHVfaW5kZXggPSBzZWxlY3RfaGR1LnZhbHVlO1xuXG4gICAgICAgIHRoaXMuc2V0VGFibGVzKGhkdV9pbmRleCk7XG5cbiAgICAgICAgdGhpcy5zZXR1cElubmVyRWxlbWVudExpc3RlbmVycygpO1xuICAgIH1cblxuICAgIHNldEhEVVNlbGVjdCgpIHtcblxuICAgICAgICBsZXQgc2VsZWN0X2hkdSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRoaXMuc2VsZWN0X2hkdV9pZCk7XG5cbiAgICAgICAgc2VsZWN0X2hkdS5pbm5lckhUTUwgPSAnJztcblxuICAgICAgICBsZXQgZnJ3ID0gV3JhcHBlckNvbnRhaW5lci5nZXRGSVRTUmVhZGVyV3JhcHBlcigpO1xuICAgICAgICBmcncuc2V0RmlsZSh0aGlzLmZpbGUuZmlsZSk7XG5cbiAgICAgICAgbGV0IGhkdXMgPSBmcncuZ2V0SERVcygpO1xuXG4gICAgICAgIGxldCBvcHRpb25zID0gW107XG4gICAgICAgIGhkdXMuZm9yRWFjaCgoaGR1KSA9PiB7XG4gICAgICAgICAgICBsZXQgb3B0aW9uID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChcIm9wdGlvblwiKTtcblxuICAgICAgICAgICAgb3B0aW9uLnZhbHVlID0gaGR1LmluZGV4O1xuICAgICAgICAgICAgb3B0aW9uLnRleHQgPSBoZHUubmFtZSArICcgJyArIGhkdS5leHRuYW1lO1xuXG4gICAgICAgICAgICBvcHRpb25zLnB1c2gob3B0aW9uKTtcbiAgICAgICAgfSlcblxuICAgICAgICBvcHRpb25zLmZvckVhY2goKG9wdGlvbikgPT4ge1xuICAgICAgICAgICAgc2VsZWN0X2hkdS5hZGQob3B0aW9uKTtcbiAgICAgICAgfSlcblxuICAgIH1cblxuICAgIHNldHVwSW5uZXJFbGVtZW50TGlzdGVuZXJzKCkge1xuICAgICAgICB0aGlzLnNldEhEVVNlbGVjdExpc3RlbmVyKCk7XG4gICAgfVxuXG4gICAgc2V0dXBBY3Rpb25CdXR0b25zKCkge1xuXG4gICAgICAgIGxldCBhZGRfdG9fcGxvdF9idG4gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCh0aGlzLmFkZF90b19wbG90X2J0bl9pZCk7XG4gICAgICAgIGxldCByZW1vdmVfZnJvbV9wbG90X2J0biAgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCh0aGlzLnJlbW92ZV9mcm9tX3Bsb3RfYnRuX2lkKTtcblxuICAgICAgICBpZih0aGlzLmlzX2N1cnJlbnQpIHtcbiAgICAgICAgICAgIGFkZF90b19wbG90X2J0bi5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnO1xuICAgICAgICAgICAgcmVtb3ZlX2Zyb21fcGxvdF9idG4uc3R5bGUuZGlzcGxheSA9ICdpbml0aWFsJztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGFkZF90b19wbG90X2J0bi5zdHlsZS5kaXNwbGF5ID0gJ2luaXRpYWwnO1xuICAgICAgICAgICAgcmVtb3ZlX2Zyb21fcGxvdF9idG4uc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgICAgfVxuXG4gICAgICAgIGFkZF90b19wbG90X2J0bi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgRmlsZVJlZ2lzdHJ5LmFkZFRvQ3VycmVudEZpbGVzKHRoaXMuZmlsZSk7XG5cbiAgICAgICAgICAgIHRoaXMuaXNfY3VycmVudCA9IHRydWU7XG5cbiAgICAgICAgICAgIGxldCBmcmNlID0gbmV3IEZpbGVSZWdpc3RyeUNoYW5nZUV2ZW50KCk7XG4gICAgICAgICAgICBmcmNlLmRpc3BhdGNoVG9TdWJzY3JpYmVycygpO1xuXG4gICAgICAgICAgICB0aGlzLnJlc2V0Q29udGFpbmVyRm9yQ3VycmVudEZpbGUoKTtcblxuICAgICAgICB9KTtcblxuICAgICAgICByZW1vdmVfZnJvbV9wbG90X2J0bi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgRmlsZVJlZ2lzdHJ5LnJlbW92ZUZyb21DdXJyZW50RmlsZXModGhpcy5maWxlLmlkKTtcblxuICAgICAgICAgICAgdGhpcy5pc19jdXJyZW50ID0gZmFsc2U7XG5cbiAgICAgICAgICAgIGxldCBmcmNlID0gbmV3IEZpbGVSZWdpc3RyeUNoYW5nZUV2ZW50KCk7XG4gICAgICAgICAgICBmcmNlLmRpc3BhdGNoVG9TdW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29udGVudCA9IGNhcmQuaW5kZXg7XG4gICAgICAgICAgICBjYXJkX2NlbGwudGV4dENvbnRlbnQgPSBjYXJkLmNhcmRfbmFtZTtcbiAgICAgICAgICAgIG5hbWVfY2VsbC50ZXh0Q29udGVudCA9IGNhcmQudmFsdWU7XG4gICAgICAgICAgICBkZXNjcmlwdGlvbl9jZWxsLnRleHRDb250ZW50ID0gY2FyZC5jb21tZW50O1xuICAgICAgICB9KTtcblxuXG4gICAgICAgIHRyeSB7XG5cbiAgICAgICAgICAgIGxldCBoZHVfY29sdW1uc19uYW1lID0gZnJ3LmdldENvbHVtbnNOYW1lRnJvbUhEVShoZHVfaW5kZXgpO1xuICAgICAgICAgICAgbGV0IGhkdV9kYXRhID0gZnJ3LmdldENvbHVtbnNKU09ORGF0YUZyb21IRFUoaGR1X2luZGV4KVxuXG4gICAgICAgICAgICBsZXQgaGVhZGVyX3JvdyA9IHRhYmxlX2RhdGEudEhlYWQuaW5zZXJ0Um93KCk7XG4gICAgICAgICAgICB0Ym9keSA9IHRhYmxlX2RhdGEucXVlcnlTZWxlY3RvcigndGJvZHknKTtcblxuICAgICAgICAgICAgaGR1X2NvbHVtbnNfbmFtZS5mb3JFYWNoKChjb2x1bW4pID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgaGVhZGVyX2NlbGwgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCd0aCcpO1xuICAgICAgICAgICAgICAgIGhlYWRlcl9jZWxsLnRleHRDb250ZW50ID0gY29sdW1uO1xuICAgICAgICAgICAgICAgIGhlYWRlcl9yb3cuYXBwZW5kQ2hpbGQoaGVhZGVyX2NlbGwpO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIGhkdV9kYXRhLmZvckVhY2goZGF0YV9wb2ludCA9PiB7XG5cbiAgICAgICAgICAgICAgICBjb25zdCByb3cgPSB0Ym9keS5pbnNlcnRSb3coKTtcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBrZXkgaW4gZGF0YV9wb2ludCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0Lmhhc093blByb3BlcnR5LmNhbGwoZGF0YV9wb2ludCwga2V5KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNlbGwgPSByb3cuaW5zZXJ0Q2VsbCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2VsbC50ZXh0Q29udGVudCA9IGRhdGFfcG9pbnRba2V5XTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgIH0gY2F0Y2goZSkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coXCJEQVRBIFBBUlNJTkcgRVJST1JcIik7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICByZXNldFRhYmxlcygpIHtcbiAgICAgICAgbGV0IHRhYmxlX2hlYWRlciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRoaXMudGFibGVfaGVhZGVyX2lkKTtcbiAgICAgICAgbGV0IHRhYmxlX2RhdGEgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCh0aGlzLnRhYmxlX2RhdGFfaWQpO1xuXG4gICAgICAgIGxldCB0Ym9keSA9IHRhYmxlX2hlYWRlci5xdWVyeVNlbGVjdG9yKCd0Ym9keScpO1xuICAgICAgICB0Ym9keS5pbm5lckhUTUwgPSAnJztcblxuICAgICAgICB0Ym9keSA9IHRhYmxlX2RhdGEucXVlcnlTZWxlY3RvcigndGJvZHknKTtcbiAgICAgICAgbGV0IHRoZWFkID0gdGFibGVfZGF0YS5xdWVyeVNlbGVjdG9yKCd0aGVhZCcpO1xuXG4gICAgICAgIHRib2R5LmlubmVySFRNTCA9ICcnO1xuICAgICAgICB0aGVhZC5pbm5lckhUTUwgPSAnPHRyPjwvdHI+JztcbiAgICB9XG5cbiAgICBzZXRIRFVTZWxlY3RMaXN0ZW5lcigpIHtcblxuICAgICAgICBsZXQgc2VsZWN0X2Vs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lvbigpIHtcbiAgICAgICAgaWYoVmlzdWFsaXphdGlvbkNvbnRhaW5lci5ib2tlaF92aXN1YWxpemF0aW9uICE9PSBudWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gVmlzdWFsaXphdGlvbkNvbnRhaW5lci5ib2tlaF92aXN1YWxpemF0aW9uO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBCb2tlaEdyYXBoKFZpc3VhbGl6YXRpb25Db250YWluZXIudmlzdWFsaXphdGlvbl9jb250YWluZXIpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgc3RhdGljIGdldEQzVmlzdWFsaXphdGlvbigpIHtcbiAgICAgICAgaWYoVmlzdWFsaXphdGlvbkNvbnRhaW5lci5kM192aXN1YWxpemF0aW9uICE9PSBudWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gVmlzdWFsaXphdGlvbkNvbnRhaW5lci5kM192aXN1YWxpemF0aW9uO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBEM0dyYXBoKFZpc3VhbGl6YXRpb25Db250YWluZXIudmlzdWFsaXphdGlvbl9jb250YWluZXIpO1xuICAgICAgICB9XG4gICAgfVxuXG59IiwiaW1wb3J0IHsgRklUU1JlYWRlcldyYXBwZXIgfSBmcm9tICcuLi93cmFwcGVycy9GSVRTUmVhZGVyV3JhcHBlci5qcydcbmltcG9ydCB7IEJva2VoV3JhcHBlciB9IGZyb20gJy4uL3dyYXBwZXJzL0Jva2VoV3JhcHBlci5qcydcbmltcG9ydCB7IEQzV3JhcHBlciB9IGZyb20gJy4uL3dyYXBwZXJzL0QzV3JhcHBlci5qcydcblxuZXhwb3J0IGNsYXNzIFdyYXBwZXJDb250YWluZXIge1xuXG4gICAgc3RhdGljIGZpdHNfcmVhZGVyX3dyYXBwZXIgPSBudWxsO1xuICAgIHN0YXRpYyBib2tlaF93cmFwcGVyID0gbnVsbDtcbiAgICBzdGF0aWMgZDNf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vYmplY3QgPSBGaWxlUmVnaXN0cnkuZ2V0RmlsZUJ5SWQoZXJyb3JfYmFyLmZpbGVfaWQpO1xuXG4gICAgICAgICAgICAgICAgbGV0IGZydyA9IFdyYXBwZXJDb250YWluZXIuZ2V0RklUU1JlYWRlcldyYXBwZXIoKTtcbiAgICAgICAgICAgICAgICBmcncuc2V0RmlsZShmaWxlX29iamVjdC5maWxlKTtcblxuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5fZGF0YTtcblxuICAgICAgICAgICAgICAgIGlmKGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0LmRhdGFfdHlwZS50eXBlID09PSAnc3BlY3RydW0nICYmXG4gICAgICAgICAgICAgICAgICAgIFNwZWN0cnVtUHJvY2Vzc29yLnByb2Nlc3NlZF9jb2x1bW5zX25hbWUuaW5jbHVkZXMoZXJyb3JfYmFyLmNvbHVtbl9uYW1lKSkge1xuXG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbl9kYXRhID0gdGhpcy5nZXRTcGVjdHJ1bVByb2Nlc3NlZENvbHVtbihlcnJvcl9iYXIuaGR1X2luZGV4LCBlcnJvcl9iYXIuY29sdW1uX25hbWUsIGZydylcblxuICAgICAgICAgICAgICAgICAgICBpZihlcnJvcl9iYXIuY29sdW1uX25hbWUgPT09IFNwZWN0cnVtUHJvY2Vzc29yLkVfTUlEX0xPRykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uX2RhdGEuZm9yRWFjaChjb2xfZGF0YSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coY29sX2RhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uX2RhdGEgPSBmcncuZ2V0Q29sdW1uRGF0YUZyb21IRFUoZXJyb3JfYmFyLmhkdV9pbmRleCwgZXJyb3JfYmFyLmNvbHVtbl9uYW1lKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBlcnJvcl9iYXIuZGF0YSA9IGNvbHVtbl9kYXRhO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgfVxuXG4gICAgICAgIGRhdGFzZXQgPSBkYXRhc2V0X3NldHRpbmdzX29iamVjdDtcblxuICAgICAgICByZXR1cm4gZGF0YXNldDtcbiAgICB9XG5cbiAgICBkYXRhc2V0VG9KU09ORGF0YShkYXRhc2V0X3NldHRpbmdzX29iamVjdCkge1xuICAgICAgICBsZXQgcm93cyA9IFtdO1xuXG4gICAgICAgIGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0LmF4aXMuZm9yRWFjaCgoYXhpcykgPT4ge1xuXG4gICAgICAgICAgICBheGlzLmRhdGEuZm9yRWFjaCgodmFsdWUsIGluZGV4KSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKCFyb3dzW2luZGV4XSkge1xuICAgICAgICAgICAgICAgICAgICByb3dzW2luZGV4XSA9IHt9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByb3dzW2luZGV4XVtheGlzLmNvbHVtbl9uYW1lXSA9IHZhbHVlO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgfSlcblxuICAgICAgICBpZihkYXRhc2V0X3NldHRpbmdzX29iamVjdC5oYXNPd25Qcm9wZXJ0eSgnZXJyb3JfYmFycycpKSB7XG4gICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzX29iamVjdC5lcnJvcl9iYXJzLmZvckVhY2goKGVycm9yX2JhcikgPT4ge1xuXG4gICAgICAgICAgICAgICAgZXJyb3JfYmFyLmRhdGEuZm9yRWFjaCgodmFsdWUsIGluZGV4KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghcm93c1tpbmRleF0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJvd3NbaW5kZXhdID0ge307XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcm93c1tpbmRleF1bZXJyb3JfYmFyLmNvbHVtbl9uYW1lXSA9IHZhbHVlO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHJvd3M7XG4gICAgfVxuXG4gICAgcHJvY2Vzc0Vycm9yQmFyRGF0YUpTT04oZGF0YXNldCwgYXhpcywgZXJyb3JfYmFycykge1xuXG4gICAgICAgIGxldCBlcnJvcl9iYXJfeF92YWx1ZXMgPSBbXTtcbiAgICAgICAgbGV0IGVycm9yX2Jhcl95X3ZhbHVlcyA9IFtdO1xuXG4gICAgICAgIGxldCBheGlzX3ggPSBheGlzLng7XG4gICAgICAgIGxldCBheGlzX3kgPSBheGlzLnk7XG5cbiAgICAgICAgbGV0IGVycm9yX2Jhcl94X2NvbHVtbiA9IGVycm9yX2JhcnMueDtcbiAgICAgICAgbGV0IGVycm9yX2Jhcl95X2NvbHVtbiA9IGVycm9yX2JhcnMueTtcblxuICAgICAgICBkYXRhc2V0LmZvckVhY2goZnVuY3Rpb24oZGF0YXBvaW50KXtcbiAgICAgICAgICAgIGxldCBlcnJvcl9iYXJfeCA9IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIGJvdW5kOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3ldKSAtIHBhcnNlRmxvYXQoZGF0YXBvaW50W2Vycm9yX2Jhcl95X2NvbHVtbl0pLFxuICAgICAgICAgICAgICAgICAgICBbYXhpc194XTogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc194XSlcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgYm91bmQ6IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pICsgcGFyc2VGbG9hdChkYXRhcG9pbnRbZXJyb3JfYmFyX3lfY29sdW1uXSksXG4gICAgICAgICAgICAgICAgICAgIFtheGlzX3hdOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cblxuICAgICAgICAgICAgbGV0IGVycm9yX2Jhcl95ID0gW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgYm91bmQ6IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeF0pIC0gcGFyc2VGbG9hdChkYXRhcG9pbnRbZXJyb3JfYmFyX3hfY29sdW1uXSksXG4gICAgICAgICAgICAgICAgICAgIFtheGlzX3ldOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3ldKVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc194XSkgKyBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeF9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgW2F4aXNfeV06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuXG4gICAgICAgICAgICBlcnJvcl9iYXJfeF92YWx1ZXMucHVzaChlcnJvcl9iYXJfeCk7XG4gICAgICAgICAgICBlcnJvcl9iYXJfeV92YWx1ZXMucHVzaChlcnJvcl9iYXJfeSk7XG4gICAgICAgIH0pXG5cbiAgICAgICAgcmV0dXJuIHsgeDogZXJyb3JfYmFyX3hfdmFsdWVzLCB5OiBlcnJvcl9iYXJfeV92YWx1ZXMgfVxuICAgIH1cblxuICAgIGdldFNwZWN0cnVtUHJvY2Vzc2VkQ29sdW1uKGhkdV9pbmRleCwgY29sdW1uX25hbWUsIGZpdHNfcmVhZGVyX3dyYXBwZXIpIHtcbiAgICAgICAgbGV0IHByb2Nlc3NlZF9jb2x1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9yX2JhcnMpIHtcbiAgICAgICAgICAgIHByb2Nlc3NlZF9kYXRhLnhfbG93ID0gW107XG4gICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS54X3VwID0gW107XG4gICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS55X2xvdyA9IFtdO1xuICAgICAgICAgICAgcHJvY2Vzc2VkX2RhdGEueV91cCA9IFtdO1xuICAgICAgICB9XG5cbiAgICAgICAgbGV0IHRlbXBfeCA9IFtdO1xuICAgICAgICBsZXQgdGVtcF95ID0gW107XG5cbiAgICAgICAgZGF0YS54LmZvckVhY2goKGRhdGFfcG9pbnQpID0+IHtcblxuICAgICAgICAgICAgbGV0IHRlbXBfZGF0YV9vYmplY3QgPSB7fTtcbiAgICAgICAgICAgIHRlbXBfZGF0YV9vYmplY3QudmFsdWUgPSBkYXRhX3BvaW50O1xuXG4gICAgICAgICAgICBpZiAocmFuZ2VzLnggPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3ggPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChkYXRhX3BvaW50ID49IHJhbmdlcy54Lmxvd2VyX2JvdW5kICYmIGRhdGFfcG9pbnQgPD0gcmFuZ2VzLngudXBwZXJfYm91bmQpIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3ggPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3ggPSBmYWxzZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGVtcF94LnB1c2godGVtcF9kYXRhX29iamVjdCk7XG4gICAgICAgIH0pXG5cbiAgICAgICAgZGF0YS55LmZvckVhY2goKGRhdGFfcG9pbnQpID0+IHtcblxuICAgICAgICAgICAgbGV0IHRlbXBfZGF0YV9vYmplY3QgPSB7fTtcbiAgICAgICAgICAgIHRlbXBfZGF0YV9vYmplY3QudmFsdWUgPSBkYXRhX3BvaW50O1xuXG4gICAgICAgICAgICBpZiAocmFuZ2VzLnkgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3kgPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChkYXRhX3BvaW50ID49IHJhbmdlcy55Lmxvd2VyX2JvdW5kICYmIGRhdGFfcG9pbnQgPD0gcmFuZ2VzLnkudXBwZXJfYm91bmQpIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3kgPSB0cnVlO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0ZW1wX2RhdGFfb2JqZWN0Lm1hdGNoX3JhbmdlX3kgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGVtcF95LnB1c2godGVtcF9kYXRhX29iamVjdClcbiAgICAgICAgfSlcblxuICAgICAgICB0ZW1wX3guZm9yRWFjaCgoZGF0YV9wb2ludF94LCBpKSA9PiB7XG4gICAgICAgICAgICBsZXQgZGF0YV9wb2ludF95ID0gdGVtcF95W2ldO1xuXG4gICAgICAgICAgICBpZihkYXRhX3BvaW50X3gubWF0Y2hfcmFuZ2VfeCArIGRhdGFfcG9pbnRfeS5tYXRjaF9yYW5nZV95ID09IDIpIHtcbiAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS54LnB1c2goZGF0YV9wb2ludF94LnZhbHVlKTtcbiAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS55LnB1c2goZGF0YV9wb2ludF95LnZhbHVlKTtcblxuICAgICAgICAgICAgICAgIGlmKGhhc19lcnJvcl9iYXJzKSB7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3NlZF9kYXRhLnlfbG93LnB1c2goZGF0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Vycm9yX2Jhcl94X3ZhbHVlcyA9IFtdO1xuICAgICAgICBsZXQgZXJyb3JfYmFyX3lfdmFsdWVzID0gW107XG5cbiAgICAgICAgbGV0IGF4aXNfeCA9IGF4aXMueDtcbiAgICAgICAgbGV0IGF4aXNfeSA9IGF4aXMueTtcblxuICAgICAgICBsZXQgZXJyb3JfYmFyX3hfY29sdW1uID0gZXJyb3JfYmFycy54O1xuICAgICAgICBsZXQgZXJyb3JfYmFyX3lfY29sdW1uID0gZXJyb3JfYmFycy55O1xuXG4gICAgICAgIGRhdGEuZm9yRWFjaChmdW5jdGlvbihkYXRhcG9pbnQpe1xuICAgICAgICAgICAgbGV0IGVycm9yX2Jhcl94ID0gW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgYm91bmQ6IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pIC0gcGFyc2VGbG9hdChkYXRhcG9pbnRbZXJyb3JfYmFyX3lfY29sdW1uXSksXG4gICAgICAgICAgICAgICAgICAgIFtheGlzX3hdOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSkgKyBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeV9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgW2F4aXNfeF06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeF0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuXG4gICAgICAgICAgICBsZXQgZXJyb3JfYmFyX3kgPSBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc194XSkgLSBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeF9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgW2F4aXNfeV06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIGJvdW5kOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKSArIHBhcnNlRmxvYXQoZGF0YXBvaW50W2Vycm9yX2Jhcl94X2NvbHVtbl0pLFxuICAgICAgICAgICAgICAgICAgICBbYXhpc195XTogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG5cbiAgICAgICAgICAgIGVycm9yX2Jhcl94X3ZhbHVlcy5wdXNoKGVycm9yX2Jhcl94KTtcbiAgICAgICAgICAgIGVycm9yX2Jhcl95X3ZhbHVlcy5wdXNoKGVycm9yX2Jhcl95KTtcbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4ge3g6IGVycm9yX2Jhcl94X3ZhbHVlcywgeTogZXJyb3JfYmFyX3lfdmFsdWVzfVxuICAgIH1cblxuICAgIF9jaGVja0NvbHVtbnMocmVxdWlyZWRfbmJfY29sdW1ucykge1xuICAgICAgICBsZXQgaXNfY2hlY2tlZCA9IHRydWU7XG5cbiAgICAgICAgbGV0IGNvbHVtbnNfbnVtYmVyID0gdGhpcy5maXRzX3JlYWRlcl93cmFwcGVyLmdldE51bWJlck9mQ29sdW1uRnJvbUhEVSh0aGlzLmhkdV9pbmRleClcbiAgICAgICAgbGV0IGNvbHVtbnNfbmFtZSA9IHRoaXMuZml0c19yZWFkZXJfd3JhcHBlci5nZXRDb2x1bW5zTmFtZUZyb21IRFUodGhpcy5oZHVfaW5kZXgpXG5cbiAgICAgICAgaWYoY29sdW1uc19udW1iZXIgPCByZXF1aXJlZF9uYl9jb2x1bW5zIHx8ICFjb2x1bW5zX25hbWUuaW5jbHVkZXMoT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NfY3VycmVudCA9IHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaXNfY3VycmVudDtcbiAgICB9XG5cbiAgICBzdGF0aWMgc2VuZFJlZ2lzdHJ5Q2hhbmdlRXZlbnQoKSB7XG4gICAgICAgIGxldCBmcmNlID0gbmV3IEZpbGVSZWdpc3RyeUNoYW5nZUV2ZW50KCk7XG4gICAgICAgIGZyY2UuZGlzcGF0Y2hUb1N1YnNjcmliZXJzKCk7XG4gICAgfVxuXG59IiwiaW1wb3J0IHtPYmplY3RVdGlsc30gZnJvbSBcIi4uL3V0aWxzL09iamVjdFV0aWxzXCI7XG5cbmV4cG9ydCBjbGFzcyBTZXR0aW5nc0NvbmZpZ3VyYXRpb24ge1xuXG4gICAgc3RhdGljIGRlZmF1bHRfY29uZmlndXJhdGlvbiA9IHtcbiAgICAgICAgJ2xpYnJhcnktc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiB0cnVlLFxuICAgICAgICAgICAgc2VsZWN0ZWQ6ICdub25lJ1xuICAgICAgICB9LFxuICAgICAgICAnYm9rZWgtc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiBmYWxzZSxcbiAgICAgICAgICAgICdib2tlaC1vcHRpb25zJzoge1xuICAgICAgICAgICAgICAgIHRvb2xzOiB7XG4gICAgICAgICAgICAgICAgICAgIGRpc3BsYXkgOiBmYWxzZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgJ2QzLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogZmFsc2UsXG4gICAgICAgICAgICAnZDMtb3B0aW9ucyc6IHtcblxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAnZGF0YS10eXBlLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogdHJ1ZSxcbiAgICAgICAgICAgIHNlbGVjdGVkOiAnZ2VuZXJpYydcbiAgICAgICAgfSxcbiAgICAgICAgJ2xpZ2h0LWN1cnZlLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogZmFsc2UsXG4gICAgICAgICAgICAnbGlnaHQtY3VydmUtb3B0aW9ucyc6IHtcblxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAnc3BlY3RydW0tc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiBmYWxzZSxcbiAgICAgICAgICAgICdzcGVjdHJ1bS1vcHRpb25zJzoge1xuXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgICdoZHVzLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgJ2F4aXMtc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgICdlcnJvci1iYXJzLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogdHJ1ZVxuICAgICAgICB9LFxuICAgICAgICAnYmlubmluZy1zZXR0aW5ncyc6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgJ2FkZGl0aW9uYWwtZGF0YXNldC1zZXR0aW5ncyc6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IHRydWVcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbmZpZ3VyYXRpb24gPSBudWxsO1xuXG4gICAgY29uc3RydWN0b3IoY29uZmlndXJhdGlvbl9vYmplY3QgPSBudWxsKSB7XG4gICAgICAgIGlmKGNvbmZpZ3VyYXRpb25fb2JqZWN0KSB7XG4gICAgICAgICAgICB0aGlzLmNvbmZpZ3VyYXRpb24gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KFNldHRpbmdzQ29uZmlndXJhdGlvbi5kZWZhdWx0X2NvbmZpZ3VyYXRpb24pKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuY29uZmlndXJhdGlvbiA9IEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoY29uZmlndXJhdGlvbl9vYmplY3QpKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldENvbmZpZ3VyYXRpb25PYmplY3Qod3JhcHBlcl9jb25maWd1cmF0aW9uKSB7XG4gICAgICAgIGxldCBjb25maWd1cmF0aW9uID0gbnVsbDtcblxuICAgICAgICBjb25maWd1cmF0aW9uID0gT2JqZWN0VXRpbHMuZGVlcF9tZXJnZShTZXR0aW5nc0NvbmZpZ3VyYXRpb24uZGVmYXVsdF9jb25maWd1cmF0aW9uLCB3cmFwcGVyX2NvbmZpZ3VyYXRpb24pO1xuXG4gICAgICAgIHJldHVybiBjb25maWd1cmF0aW9uO1xuICAgIH1cblxuICAgIHN0YXRpYyBnZXRDb25maWd1cmF0aW9uT2JqZWN0KHdyYXBwZXJfY29uZmlndXJhdGlvbikge1xuICAgICAgICBsZXQgY29uZmlndXJhdGlvbiA9IG51bGw7XG5cbiAgICAgICAgY29uZmlndXJhdGlvbiA9IE9iamVjdFV0aWxzLmRlZXBfbWVyZ2UoU2V0dGluZ3NDb25maWd1cmF0aW9uLmRlZmF1bHRfY29uZmlndXJhdGlvbiwgd3JhcHBlcl9jb25maWd1cmF0aW9uKTtcblxuICAgICAgICByZXR1cm4gY29uZmlndXJhdGlvbjtcbiAgICB9XG5cbn0iLCJleHBvcnQgY2xhc3MgVmlzdWFsaXphdGlvblNldHRpbmdzIHtcblxuICAgIHN0YXRpYyBkZWZhdWx0X3NldHRpbmdzID0ge1xuICAgICAgICBsaWJyYXJ5OiAnJyxcbiAgICAgICAgZGF0YV90eXBlOiAnJyxcbiAgICAgICAgYXhpczoge30sXG4gICAgICAgIHNjYWxlczoge30sXG4gICAgICAgIGVycm9yX2JhcnM6IHt9XG4gICAgfVxuXG4gICAgc2V0dGluZ3MgPSB7fTtcbl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TZXR0aW5ncygpIHtcbiAgICAgICAgaWYodGhpcy5zZXR0aW5nc19kYXRhX3R5cGUpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzX2RhdGFfdHlwZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZ2V0TGlnaHRDdXJ2ZVNldHRpbmdzKCkge1xuXG4gICAgfVxuXG4gICAgZ2V0U3BlY3RydW1TZXR0aW5ncygpIHtcblxuICAgIH1cblxuICAgIHNldEhEVXNTZXR0aW5ncyhoZHVzKSB7XG4gICAgICAgIHRoaXMuc2V0dGluZ3NfaGR1cyA9IGhkdXM7XG4gICAgfVxuXG4gICAgZ2V0SERVc1NldHRpbmdzKCkge1xuICAgICAgICBpZih0aGlzLnNldHRpbmdzX2hkdXMgIT09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzX2hkdXM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldEF4aXNTZXR0aW5ncyhheGlzKSB7XG4gICAgICAgIHRoaXMuc2V0dGluZ3NfYXhpcyA9IGF4aXM7XG4gICAgfVxuXG4gICAgZ2V0QXhpc1NldHRpbmdzKCkge1xuICAgICAgICBpZih0aGlzLnNldHRpbmdzX2F4aXMpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzX2F4aXM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldFNjYWxlc1NldHRpbmdzKHNjYWxlcykge1xuICAgICAgICB0aGlzLnNldHRpbmdzX3NjYWxlcyA9IHNjYWxlcztcbiAgICB9XG5cbiAgICBnZXRTY2FsZXNTZXR0aW5ncygpIHtcbiAgICAgICAgaWYodGhpcy5zZXR0aW5nc19zY2FsZXMpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzX3NjYWxlcztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgc2V0RXJyb3JCYXJzU2V0dGluZ3MoZXJyb3JfYmFycykge1xuICAgICAgICB0aGlzLnNldHRpbmdzX2Vycm9yX2JhcnMgPSBlcnJvcl9iYXJzO1xuICAgIH1cblxuICAgIGdldEVycm9yQmFyc1NldHRpbmdzKCkge1xuICAgICAgICBpZih0aGlzLnNldHRpbmdzX2Vycm9yX2JhcnMpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzX2Vycm9yX2JhcnM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldFJhbmdlc1NldHRpbmdzKHJhbmdlcykge1xuICAgICAgICB0aGlzLnNldHRpbmdzX3JhbmdlcyA9IHJhbmdlcztcbiAgICB9XG5cbiAgICBnZXRSYW5nZXNTZXR0aW5ncygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuc2V0dGluZ3NfcmFuZ2VzO1xuICAgIH1cblxuICAgIGdldEFkZGl0aW9uYWxEYXRhc2V0c1NldHRpbmdzKCkge1xuXG4gICAgfVxuXG4gICAgcmVzZXQoKSB7XG4gICAgICAgIHRoaXMuc2V0dGluZ3NfbGlicmFyeSA9IG51bGw7XG4gICAgICAgIHRoaXMuc2V0dGluZ3NfZGF0YV90eXBlID0gbnVsbDtcbiAgICAgICAgdGhpcy5zZXR0aW5nc19oZHVzID0gbnVsbDtcbiAgICAgICAgdGhpcy5zZXR0aW5nc19heGlzID0gbnVsbDtcbiAgICAgICAgdGhpcy5zZXR0aW5nc19zY2FsZXMgPSBudWxsO1xuICAgICAgICB0aGlzLnNldHRpbmdzX2Vycm9yX2JhcnMgPSBudWxsO1xuICAgIH1cbn0iLCJleHBvcnQgY2xhc3MgT2JqZWN0VXRpbHMge1xuXG4gICAgc3RhdGljIGRlZXBfbWVyZ2UoYmFzZV9vYmplY3QsIG1lcmdpbmdfb2JqZWN0KSB7XG4gICAgICAgIGxldCBtZXJnZWRfb2JqZWN0ID0ge307XG5cbiAgICAgICAgZm9yIChsZXQga2V5IGluIGJhc2Vfb2JqZWN0KSB7XG4gICAgICAgICAgICBpZiAoYmFzZV9vYmplY3QuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICAgIG1lcmdlZF9vYmplY3Rba2V5XSA9IGJhc2Vfb2JqZWN0W2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGxldCBrZXkgaW4gbWVyZ2luZ19vYmplY3QpIHtcbiAgICAgICAgICAgIGlmIChtZXJnaW5nX29iamVjdC5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgICAgICAgICAgaWYoQXJyYXkuaXNBcnJheShtZXJnaW5nX29iamVjdFtrZXldKSkge1xuXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtZXJnZWRfb2JqZWN0Lmhhc093blByb3BlcnR5KGtleSkgJiYgdHlwZW9mIG1lcmdpbmdfb2JqZWN0W2tleV0gPT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lcmdlZF9vYmplY3Rba2V5XSA9IE9iamVjdFV0aWxzLmRlZXBfbWVyZ2UobWVyZ2VkX29iamVjdFtrZXldLCBtZXJnaW5nX29iamVjdFtrZXldKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBtZXJnZWRfb2JqZWN0W2tleV0gPSBtZXJnaW5nX29iamVjdFtrZXldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBtZXJnZWRfb2JqZ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AgICAgXCJwb2x5X3NlbGVjdFwiLFxuICAgICAgICBcInRhcFwiLFxuICAgICAgICBcImV4YW1pbmUsXCIsXG4gICAgICAgIFwidW5kb1wiLFxuICAgICAgICBcInJlZG9cIl07XG5cbiAgICBzdGF0aWMgZGVmYXVsdF90b29sX2FycmF5ID0gW1xuICAgICAgICBcInBhblwiLFxuICAgICAgICBcImJveF96b29tXCIsXG4gICAgICAgIFwid2hlZWxfem9vbVwiLFxuICAgICAgICBcImhvdmVyXCIsXG4gICAgICAgIFwiY3Jvc3NoYWlyXCIsXG4gICAgICAgIFwicmVzZXRcIixcbiAgICAgICAgXCJzYXZlXCJdO1xuXG4gICAgc3RhdGljIGRlZmF1bHRfdG9vbF9zdHJpbmcgPSBcInBhbixib3hfem9vbSx3aGVlbF96b29tLGhvdmVyLGNyb3NzaGFpcixyZXNldCxzYXZlXCI7XG5cbiAgICB0b29sX2FycmF5ID0gW107XG4gICAgdG9vbF9zdHJpbmcgPSBcIlwiO1xuXG4gICAgaGFzX2RhdGFfdGFibGUgPSBmYWxzZTtcblxuICAgIGNvbnN0cnVjdG9yKGNvbnRhaW5lcl9pZCA9ICcjdmlzdWFsaXphdGlvbi1jb250YWluZXInKSB7XG4gICAgICAgIHRoaXMuY29udGFpbmVyX2lkID0gY29udGFpbmVyX2lkO1xuICAgICAgICB0aGlzLl9zZXRDb250YWluZXIoKTtcbiAgICB9XG5cbiAgICBfc2V0Q29udGFpbmVyKCkge1xuICAgICAgICB0aGlzLmNvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRoaXMuY29udGFpbmVyX2lkKTtcbiAgICB9XG5cbiAgICBpbml0aWFsaXplU2V0dGluZ3MoZGF0YSwgbGFiZWxzLCBzY2FsZXMsIHRpdGxlLCBlcnJvcl9iYXJzID0gbnVsbCwgY3VzdG9tX3JhbmdlID0gbnVsbCkge1xuICAgICAgICB0aGlzLnNldHVwU291cmNlKGRhdGEpO1xuXG4gICAgICAgIGlmKGVycm9yX2JhcnMpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0dXBQbG90KHRpdGxlLCBkYXRhWyd5X2xvdyddLCBkYXRhWyd5X3VwJ10pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYoY3VzdG9tX3JhbmdlKSB7XG4gICAgICAgICAgICAgICAgbGV0IHhfbG93ID0gW107XG4gICAgICAgICAgICAgICAgbGV0IHhfdXAgPSBbXTtcblxuICAgICAgICAgICAgICAgIGxldCB5X2xvdyA9IFtdO1xuICAgICAgICAgICAgICAgIGxldCB5X3VwID0gW107XG5cbiAgICAgICAgICAgICAgICBpZihjdXN0b21fcmFuZ2UueCAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBjdXN0b21fcmFuZ2UueC5sb3dlcl9ib3VuZCAhPT0gbnVsbCA/IHhfbG93LnB1c2goY3VzdG9tX3JhbmdlLngubG93ZXJfYm91bmQpIDogeF9sb3cgPSBkYXRhWyd4J107XG4gICAgICAgICAgICAgICAgICAgIGN1c3RvbV9yYW5nZS54LnVwcGVyX2JvdW5kICE9PSBudWxsID8geF91cC5wdXNoKGN1c3RvbV9yYW5nZS54LnVwcGVyX2JvdW5kKSA6IHhfdXAgPSBkYXRhWyd4J107XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgeF9sb3cgPSBkYXRhWyd4J107XG4gICAgICAgICAgICAgICAgICAgIHhfdXAgPSBkYXRhWyd4J107XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYoY3VzdG9tX3JhbmdlLnkgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tX3JhbmdlLnkubG93ZXJfYm91bmQgIT09IG51bGwgPyB5X2xvdy5wdXNoKGN1c3RvbV9yYW5nZS55Lmxvd2VyX2JvdW5kKSA6IHlfbG93ID0gZGF0YVsneSddO1xuICAgICAgICAgICAgICAgICAgICBjdXN0b21fcmFuZ2UueS51cHBlcl9ib3VuZCAhPT0gbnVsbCA/IHlfdXAucHVzaChjdXN0b21fcmFuZ2UueS51cHBlcl9ib3VuZCkgOiB5X3VwID0gZGF0YVsneSddO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHlfbG93ID0gZGF0YVsneSddO1xuICAgICAgICAgICAgICAgICAgICB5X3VwID0gZGF0YVsneSddO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuc2V0dXBQbG90KHRpdGxlLCB5X2xvdywgeV91cCwgeF9sb3csIHhfdXApXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuc2V0dXBQbG90KHRpdGxlLCBkYXRhWyd5J10sIGRhdGFbJ3knXSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuc2V0dXBEYXRhKCk7XG4gICAgICAgIHRoaXMuc2V0dXBTY2FsZXMoc2NhbGVzKTtcbiAgICAgICAgdGhpcy5zZXR1cExhYmVscyhsYWJlbHMpO1xuXG4gICAgICAgIGlmKGVycm9yX2JhcnMpIHtcbiAgICAgICAgICAgIHRoaXMuc2V0dXBFcnJvckJhcnMoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGluaXRpYWxpemVHcmFwaCgpIHtcblxuICAgICAgICBpZih0aGlzLmhhc19kYXRhX3RhYmxlKSB7XG4gICAgICAgICAgICBCb2tlaEdyYXBoLnBsdC5zaG93KG5ldyBCb2tlaC5Db2x1bW4oe2NoaWxkcmVuOiBbcCwgZGF0YV90YWJsZV19KSwgXCIjZ3JhcGgtY29udGFpbmVyXCIpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgQm9rZWhHcmFwaC5wbHQuc2hvdyh0aGlzLnBsb3QsIHRoaXMuY29udGFpbmVyX2lkKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldHVwUGxvdCh0aX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gICAgIHNpemU6IDQsXG4gICAgICAgICAgICBmaWxsX2NvbG9yOiBcIm5hdnlcIixcbiAgICAgICAgICAgIGxpbmVfY29sb3I6IG51bGwsXG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIHNldHVwRXJyb3JCYXJzKCkge1xuICAgICAgICB0aGlzLnlfZXJyb3JfYmFyID0gbmV3IEJva2VoLldoaXNrZXIoe1xuICAgICAgICAgICAgZGltZW5zaW9uOiBcImhlaWdodFwiLFxuICAgICAgICAgICAgc291cmNlOiB0aGlzLnNvdXJjZSxcbiAgICAgICAgICAgIGJhc2U6IHtmaWVsZDogXCJ4XCJ9LFxuICAgICAgICAgICAgbG93ZXI6IHtmaWVsZDogXCJ5X2xvd1wifSxcbiAgICAgICAgICAgIHVwcGVyOiB7ZmllbGQ6IFwieV91cFwifSxcbiAgICAgICAgICAgIGxpbmVfY29sb3I6IFwibmF2eVwiLFxuICAgICAgICAgICAgbG93ZXJfaGVhZDogbnVsbCxcbiAgICAgICAgICAgIHVwcGVyX2hlYWQ6IG51bGwsXG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMueF9lcnJvcl9iYXIgPSBuZXcgQm9rZWguV2hpc2tlcih7XG4gICAgICAgICAgICBkaW1lbnNpb246IFwid2lkdGhcIixcbiAgICAgICAgICAgIHNvdXJjZTogdGhpcy5zb3VyY2UsXG4gICAgICAgICAgICBiYXNlOiB7ZmllbGQ6IFwieVwifSxcbiAgICAgICAgICAgIGxvd2VyOiB7ZmllbGQ6IFwieF9sb3dcIn0sXG4gICAgICAgICAgICB1cHBlcjoge2ZpZWxkOiBcInhfdXBcIn0sXG4gICAgICAgICAgICBsaW5lX2NvbG9yOiBcIm5hdnlcIixcbiAgICAgICAgICAgIGxvd2VyX2hlYWQ6IG51bGwsXG4gICAgICAgICAgICB1cHBlcl9oZWFkOiBudWxsLFxuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLnBsb3QuYWRkX2xheW91dCh0aGlzLnlfZXJyb3Jf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cbiAgICAgICAgdGhpcy5fdXBkYXRlQ2hhcnQgPSB0aGlzLl91cGRhdGVDaGFydC5iaW5kKHRoaXMpO1xuXG4gICAgICAgIHRoaXMuaW5pdGlhbGl6ZWQgPSBmYWxzZTtcbiAgICB9XG5cbiAgICBfc2V0Q29udGFpbmVyKCkge1xuICAgICAgICB0aGlzLmNvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHRoaXMuY29udGFpbmVyX2lkKTtcbiAgICB9XG5cbiAgICBpbml0aWFsaXplU2V0dGluZ3MoZGF0YSxcbiAgICAgICAgICAgICAgICAgICAgICAgYXhpcyxcbiAgICAgICAgICAgICAgICAgICAgICAgc2NhbGVzID0gRDNHcmFwaC5kZWZhdWx0X3NjYWxlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfYmFycyA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgICAgIGhhc19saW5lID0gZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgICAgIGFkZGl0aW9uYWxfcGxvdHMgPSBudWxsKSB7XG5cbiAgICAgICAgbGV0IGlzX3NldCA9IGZhbHNlO1xuXG4gICAgICAgIHRyeSB7XG5cbiAgICAgICAgICAgIHRoaXMuZGF0YXNldCA9IGRhdGE7XG5cbiAgICAgICAgICAgIHRoaXMueF9heGlzX2RhdGFfY29sID0gYXhpc1sneCddO1xuICAgICAgICAgICAgdGhpcy55X2F4aXNfZGF0YV9jb2wgPSBheGlzWyd5J107XG5cbiAgICAgICAgICAgIHRoaXMueF9zY2FsZV90eXBlID0gc2NhbGVzWyd4J107XG4gICAgICAgICAgICB0aGlzLnlfc2NhbGVfdHlwZSA9IHNjYWxlc1sneSddO1xuXG4gICAgICAgICAgICBpZiAoZXJyb3JfYmFycykge1xuICAgICAgICAgICAgICAgIHRoaXMuaGFzX2Vycm9yX2JhcnMgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JfYmFycyA9IGVycm9yX2JhcnM7XG5cbiAgICAgICAgICAgICAgICB0aGlzLnhfYXhpc19kYXRhX2NvbF9lcnJvcl9iYXIgPSBheGlzWyd4J10udmFsdWU7XG4gICAgICAgICAgICAgICAgdGhpcy55X2F4aXNfZGF0YV9jb2xfZXJyb3JfYmFyID0gYXhpc1sneSddLnZhbHVlO1xuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuaGFzX2Vycm9yX2JhcnMgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxfcGxvdHMpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmhhc19tdWx0aXBsZV9wbG90cyA9IHRydWU7XG4gICAgICAgICAgICAgICAgdGhpcy5hZGRpdGlvbmFsX3Bsb3RzID0gW107XG5cbiAgICAgICAgICAgICAgICBsZXQgYWRkaXRpb25hbF9wbG90c190ZW1wID0gW107XG4gICAgICAgICAgICAgICAgYWRkaXRpb25hbF9wbG90cy5mb3JFYWNoKGZ1bmN0aW9uIChwbG90KSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZGl0aW9uYWxfcGxvdHNfdGVtcC5wdXNoKHBsb3QpO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgdGhpcy5hZGRpdGlvbmFsX3Bsb3RzID0gYWRkaXRpb25hbF9wbG90c190ZW1wO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmhhc19saW5lID0gaGFzX2xpbmU7XG5cbiAgICAgICAgICAgIGlzX3NldCA9IHRydWU7XG5cbiAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhcIkVycm9yIGR1cmluZyBncmFwaCBzZXR0aW5ncyBwcm9jZXNzXCIpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaXNfc2V0O1xuICAgIH1cblxuICAgIGluaXRpYWxpemVHcmFwaCgpIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRoaXMuX3NldFNWR0NvbnRhaW5lcigpO1xuXG4gICAgICAgICAgICB0aGlzLl9zZXRYU2NhbGUoKTtcbiAgICAgICAgICAgIHRoaXMuX3NldFlTY2FsZSgpO1xuXG4gICAgICAgICAgICB0aGlzLl9zZXRYQXhpcygpO1xuICAgICAgICAgICAgdGhpcy5fc2V0WEF4aXNMYWJlbCgpO1xuXG4gICAgICAgICAgICB0aGlzLl9zZXRZQXhpcygpO1xuICAgICAgICAgICAgdGhpcy5fc2V0WUF4aXNMYWJlbCgpXG5cbiAgICAgICAgICAgIHRoaXMuX3NldERhdGFQbG90KCk7XG5cbiAgICAgICAgICAgIHRoaXMuX3NldFpvb21CZWhhdmlvcigpO1xuXG4gICAgICAgICAgICBpZih0aGlzLmhhc19lcnJvcl9iYXJzKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fc2V0RXJyb3JCYXJzKHRoaXMuZXJyb3JfYmFycyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmKHRoaXMuaGFzX2xpbmUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLl9zZXRBeGlzTGluZSgpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZih0aGlzLmhhc19tdWx0aXBsZV9wbG90cykge1xuICAgICAgICAgICAgICAgIHRoaXMuX3NldEFkZGl0aW9uYWxQbG90cygpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmluaXRpYWxpemVkID0gdHJ1ZTtcbiAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhcIkVycm9yIGR1cmluZyBncmFwaCBpbml0aWFsaXphdGlvblwiKTtcbiAgICAgICAgICAgIHRoaXMuaW5pdGlhbGl6ZWQgPSBmYWxzZTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLmluaXRpYWxpemVkO1xuICAgIH1cblxuICAgIF9zZXRTVkdDb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nNlbGVjdEFsbChcIi50aWNrIGxpbmVcIikuY2xvbmUoKVxuICAgICAgICAgICAgICAgIC5hdHRyKFwieDJcIiwgdGhpcy53aWR0aClcbiAgICAgICAgICAgICAgICAuYXR0cihcInN0cm9rZS1vcGFjaXR5XCIsIDAuMikpO1xuICAgIH1cblxuICAgIF9zZXRYQXhpc0xhYmVsKCkge1xuICAgICAgICB0aGlzLnhfYXhpcy5zZWxlY3QoXCIudGljazpsYXN0LW9mLXR5cGUgdGV4dFwiKS5jbG9uZSgpXG4gICAgICAgICAgICAuYXR0cihcImlkXCIsIFwieC1sYWJlbFwiKVxuICAgICAgICAgICAgLmF0dHIoXCJ5XCIsIC0xMSlcbiAgICAgICAgICAgIC5hdHRyKFwieFwiLCAyKVxuICAgICAgICAgICAgLmF0dHIoXCJ0ZXh0LWFuY2hvclwiLCBcInN0YXJ0XCIpXG4gICAgICAgICAgICAuYXR0cihcImZvbnQtd2VpZ2h0XCIsIFwiYm9sZFwiKVxuICAgICAgICAgICAgLnRleHQodGhpcy54X2F4aXNfZGF0YV9jb2wpO1xuICAgIH1cblxuICAgIF9zZXRZQXhpc0xhYmVsKCkge1xuICAgICAgICB0aGlzLnlfYXhpcy5zZWxlY3QoXCIudGljazpsYXN0LW9mLXR5cGUgdGV4dFwiKS5jbG9uZSgpXG4gICAgICAgICAgICAuYXR0cihcImlkXCIsIFwieS1sYWJlbFwiKVxuICAgICAgICAgICAgLmF0dHIoXCJ4XCIsIDMpXG4gICAgICAgICAgICAuYXR0cihcInlcIiwgLTUpXG4gICAgICAgICAgICAuYXR0cihcInRleHQtYW5jaG9yXCIsIFwic3RhcnRcIilcbiAgICAgICAgICAgIC5hdHRyKFwiZm9udC13ZWlnaHRcIiwgXCJib2xkXCIpXG4gICAgICAgICAgICAudGV4dCh0aGlzLnlfYXhpc19kYXRhX2NvbCk7XG4gICAgfVxuXG4gICAgX3NldERhdGFQbG90KCkge1xuXG4gICAgICAgIGxldCB4ID0gdGhpcy54X3NjYWx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fSApXG4gICAgICAgICAgICAuYXR0cihcInJcIiwgNClcbiAgICAgICAgICAgIC5zdHlsZShcImZpbGxcIiwgXCJ0cmFuc3BhcmVudFwiKVxuICAgICAgICAgICAgLnN0eWxlKFwic3Ryb2tlXCIsIFwiYmxhY2tcIilcbiAgICAgICAgICAgIC5zdHlsZShcIm9wYWNpdHlcIiwgMSlcbiAgICB9XG5cbiAgICBfc2V0QWRkaXRpb25hbFBsb3RzKCkge1xuICAgICAgICBsZXQgcGxvdDtcbiAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IHRoaXMuYWRkaXRpb25hbF9wbG90cy5sZW5ndGgsIGkrKzspIHtcbiAgICAgICAgICAgIHBsb3QgPSB0aGlzLmFkZGl0aW9uYWxfcGxvdHNbaV07XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBfc2V0RXJyb3JCYXJzKGVycm9yX2JhcnMpIHtcblxuICAgICAgICB0aGlzLmVycm9yX2JhcnMgPSBlcnJvcl9iYXJzO1xuXG4gICAgICAgIGxldCBlcnJvcl9iYXJfeCA9IHt4OiBlcnJvcl9iYXJzLnh9O1xuXG4gICAgICAgIGxldCBsaW5lX2Vycm9yX2Jhcl94ID0gZDMubGluZSgpXG4gICAgICAgICAgICAueChkID0+IHRoaXMueF9zY2FsZShkW3RoaXMueF9heGlzX2RhdGFfY29sXSkpXG4gICAgICAgICAgICAueShkID0+IHRoaXMueV9zY2FsZShkLmJvdW5kKSk7XG5cbiAgICAgICAgZXJyb3JfYmFycy54LmZvckVhY2goKGVycm9yX2JhcikgPT4ge1xuICAgICAgICAgICAgZDMuc2VsZWN0KCcjZGF0YS1wbG90JykuYXBwZW5kKFwicGF0aFwiKVxuICAgICAgICAgICAgICAgIC5hdHRyKFwiY2xhc3NcIiwgXCJlcnJvci1iYXIteFwiKVxuICAgICAgICAgICAgICAgIC5hdHRyKFwiZmlsbFwiLCBcIm5vbmVcIilcbiAgICAgICAgICAgICAgICAuYXR0cihcInN0cm9rZVwiLCBcInN0ZWVsYmx1ZVwiKVxuICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlLXdpZHRoXCIsIDEuNSlcbiAgICAgICAgICAgICAgICAuYXR0cihcImRcIiwgbGluZV9lcnJvcl9iYXJfeChlcnJvcl9iYXIpKTtcbiAgICAgICAgfSlcblxuICAgICAgICBsZXQgbGluZV9lcnJvcl9iYXJfeSA9IGQzLmxpbmUoKVxuICAgICAgICAgICAgLngoZCA9PiB0aGlzLnhfc2NhbGUoZC5ib3VuZCkpXG4gICAgICAgICAgICAueShkID0+IHRoaXMueV9zY2FsZShkW3RoaXMueV9heGlzX2RhdGFfY29sXSkpO1xuXG4gICAgICAgIGVycm9yX2JhcnMueS5mb3JFYWNoKChlcnJvcl9iYXIpID0+IHtcbiAgICAgICAgICAgIGQzLnNlbGVjdCgnI2RhdGEtcGxvdCcpLmFwcGVuZChcInBhdGhcIilcbiAgICAgICAgICAgICAgICAuYXR0cihcImNsYXNzXCIsIFwiZXJyb3ItYmFyLXhcIilcbiAgICAgICAgICAgICAgICAuYXR0cihcImZpbGxcIiwgXCJub25lXCIpXG4gICAgICAgICAgICAgICAgLmF0dHIoXCJzdHJva2VcIiwgXCJzdGVlbGJsdWVcIilcbiAgICAgICAgICAgICAgICAuYXR0cihcInN0cm9rZS13aWR0aFwiLCAxLjUpXG4gICAgICAgICAgICAgICAgLmF0dHIoXCJkXCIsIGxpbmVfZXJyb3JfYmFyX3koZXJyb3JfYmFyKSk7XG4gICAgICAgIH0pXG5cbiAgICB9XG5cbiAgICBfc2V0QXhpc0xpbmUoKSB7XG4gICAgICAgIGxldCBsaW5lID0gZDMubGluZSgpXG4gICAgICAgICAgICAuY3VydmUoZDMuY3VydmVDYXRtdWxsUm9tKVxuICAgICAgICAgICAgLngoZCA9PiB0aGlzLnhfYXhpcyhkW3RoaXMueF9heGlzX2RhdGFfY29sXSkpXG4gICAgICAgICAgICAueShkID0+IHRoaXMueV9heGlzKGRbdGhpcy55X2F4aXNfZGF0YV9jb2xdKSk7XG5cbiAgICAgICAgdGhpcy5saW5lX2NvbnRhaW5lciA9IHRoaXMuc3ZnLmFwcGVuZChcImdcIilcbiAgICAgICAgICAgIC5hdHRyKFwiaWRcIiwgXCJwYXRoLWNvbnRhaW5lclwiKVxuICAgICAgICAgICAgLmF0dHIoXCJjbGlwLXBhdGhcIiwgXCJ1cmwoI2NsaXApXCIpO1xuXG4gICAgICAgIHRoaXMucGF0aCA9IHRoaXMubGluZV9jb250YWluZXIuYXBwZW5kKFwicGF0aFwiKVxuICAgICAgICAgICAgLmF0dHIoXCJpZFwiLCBcInBhdGhcIilcbiAgICAgICAgICAgIC5hdHRyKFwiZmlsbFwiLCBcIm5vbmVcIikuYXR0cihcInN0cm9rZVwiLCBcInN0ZWVsYmx1ZVwiKVxuICAgICAgICAgICAgLmF0dHIoXCJkXCIsIGxpbmUoZGF0YSkpO1xuICAgIH1cblxuICAgIF9zZXRab29tQmVoYXZpb3IoKSB7XG5cbiAgICAgICAgdGhpcy56b29tID0gZDMuem9vbSgpXG4gICAgICAgICAgICAuc2NhbGVFeHRlbnQoWy41LCAyMF0pXG4gICAgICAgICAgICAuZXh0ZW50KFtbMCwgMF0sIFt0aGlzLndpZHRoLCB0aGlzLmhlaWdodF1dKVxuICAgICAgICAgICAgLm9uKFwiem9vbVwiLCB0aGlzLl91cGRhdGVDaGFydCk7XG5cbiAgICAgICAgdGhpcy56b29tX3JlY3QgPSB0aGlzLnN2Zy5hcHBlbmQoXCJyZWN0XCIpXG4gICAgICAgICAgICAuYXR0cihcIndpZHRoXCIsIHRoaXMud2lkdGgpXG4gICAgICAgICAgICAuYXR0cihcImhlaWdodFwiLCB0aGlzLmhlaWdodClcbiAgICAgICAgICAgIC5zdHlsZShcImZpbGxcIiwgXCJub25lXCIpXG4gICAgICAgICAgICAuc3R5bGUoXCJwb2ludGVyLWV2ZW50c1wiLCBcImFsbFwiKVxuICAgICAgICAgICAgLmF0dHIoJ3RyYW5zZm9ybScsICd0cmFuc2x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X2JhcnMpIHtcblxuICAgICAgICAgICAgbGV0IGxpbmVfZXJyb3JfYmFyX3ggPSBkMy5saW5lKClcbiAgICAgICAgICAgICAgICAueChkID0+IHJlc2NhbGVkX3goZFt0aGlzLnhfYXhpc19kYXRhX2NvbF0pKVxuICAgICAgICAgICAgICAgIC55KGQgPT4gcmVzY2FsZWRfeShkLmJvdW5kKSk7XG5cbiAgICAgICAgICAgIHRoaXMuZXJyb3JfYmFycy54LmZvckVhY2goKGVycm9yX2JhcikgPT4ge1xuICAgICAgICAgICAgICAgIGQzLnNlbGVjdCgnI2RhdGEtcGxvdCcpLmFwcGVuZChcInBhdGhcIilcbiAgICAgICAgICAgICAgICAgICAgLmF0dHIoXCJjbGFzc1wiLCBcImVycm9yLWJhci14XCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwiZmlsbFwiLCBcIm5vbmVcIilcbiAgICAgICAgICAgICAgICAgICAgLmF0dHIoXCJzdHJva2VcIiwgXCJzdGVlbGJsdWVcIilcbiAgICAgICAgICAgICAgICAgICAgLmF0dHIoXCJzdHJva2Utd2lkdGhcIiwgMS41KVxuICAgICAgICAgICAgICAgICAgICAuYXR0cihcImRcIiwgbGluZV9lcnJvcl9iYXJfeChlcnJvcl9iYXIpKTtcbiAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIGxldCBsaW5lX2Vycm9yX2Jhcl95ID0gZDMubGluZSgpXG4gICAgICAgICAgICAgICAgLngoZCA9PiByZXNjYWxlZF94KGQuYm91bmQpKVxuICAgICAgICAgICAgICAgIC55KGQgPT4gcmVzY2FsZWRfeShkW3RoaXMueV9heGlzX2RhdGFfY29sXSkpO1xuXG4gICAgICAgICAgICB0aGlzLmVycm9yX2JhcnMueS5mb3JFYWNoKChlcnJvcl9iYXIpID0+IHtcbiAgICAgICAgICAgICAgICBkMy5zZWxlY3QoJyNkYXRhLXBsb3QnKS5hcHBlbmQoXCJwYXRoXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRy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zQ29uZmlndXJhdGlvblwiO1xuXG5leHBvcnQgY2xhc3MgQm9rZWhXcmFwcGVyIHtcblxuICAgIHN0YXRpYyBjb250YWluZXJfaWQgPSAndmlzdWFsaXphdGlvbi1jb250YWluZXInO1xuXG4gICAgc3RhdGljIGxpYnJhcnkgPSAnYm9rZWgnO1xuXG4gICAgc3RhdGljIHRpdGxlID0ge1xuICAgICAgICAnbGlnaHQtY3VydmUnOiAnTGlnaHQgY3VydmUnLFxuICAgICAgICAnc3BlY3RydW0nOiAnc3BlY3RydW0nXG4gICAgfVxuXG4gICAgc3RhdGljIHNwZWNpZmljX3NldHRpbmdzID0ge1xuICAgICAgICAnYm9rZWgtc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiB0cnVlLFxuICAgICAgICAgICAgJ2Jva2VoLW9wdGlvbnMnOiB7XG4gICAgICAgICAgICAgICAgdG9vbHM6IHtcbiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogZmFsc2VcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgY29udGFpbmVyID0gbnVsbDtcblxuICAgIGNvbmZpZ3VyYXRpb25fb2JqZWN0ID0gbnVsbDtcblxuICAgIGNvbnN0cnVjdG9yKCkge1xuICAgICAgICB0aGlzLl9zZXRDb250YWluZXIoKTtcbiAgICAgICAgdGhpcy5fc2V0dXBMaXN0ZW5lcnMoKTtcbiAgICB9XG5cbiAgICBfc2V0Q29udGFpbmVyKCkge1xuICAgICAgICB0aGlzLmNvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKEJva2VoV3JhcHBlci5jb250YWluZXJfaWQpO1xuICAgIH1cblxuICAgIF9yZXNldENvbnRhaW5lcigpIHtcbiAgICAgICAgdGhpcy5jb250YWluZXIuaW5uZXJIVE1MID0gXCJcIjtcbiAgICB9XG5cbiAgICBfc2V0dXBMaXN0ZW5lcnMoKSB7XG4gICAgICA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EVycm9yQmFyc1NldHRpbmdzKCk7XG4gICAgICAgICAgICBsZXQgaGFzX2Vycm9yX2JhcnMgPSBmYWxzZTtcblxuICAgICAgICAgICAgaWYoZXJyb3JfYmFycyAhPT0gbnVsbCkge1xuXG4gICAgICAgICAgICAgICAgbGV0IGVycm9yX2JhcnNfc2V0dGluZ3MgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IobGV0IGF4aXNfY29sdW1uIGluIGVycm9yX2JhcnMpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGF4aXNfY29sdW1uX29iamVjdCA9IHRoaXMuX2dldENvbHVtblNldHRpbmdzKGVycm9yX2JhcnNbYXhpc19jb2x1bW5dKTtcbiAgICAgICAgICAgICAgICAgICAgYXhpc19jb2x1bW5fb2JqZWN0ID0gey4uLmF4aXNfY29sdW1uX29iamVjdCwgLi4ue2F4aXM6IGF4aXNfY29sdW1ufX1cblxuICAgICAgICAgICAgICAgICAgICBlcnJvcl9iYXJzX3NldHRpbmdzLnB1c2goYXhpc19jb2x1bW5fb2JqZWN0KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzLmVycm9yX2JhcnMgPSBlcnJvcl9iYXJzX3NldHRpbmdzO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBsZXQgZHBwID0gRGF0YVByb2Nlc3NvckNvbnRhaW5lci5nZXREYXRhUHJvY2Vzc29yQ29udGFpbmVyKCkuZ2V0RGF0YVByZVByb2Nlc3NvcigpO1xuXG4gICAgICAgICAgICBsZXQgcHJvY2Vzc2VkX2RhdGEgPSBkcHAuZ2V0UHJvY2Vzc2VkRGF0YXNldChkYXRhc2V0X3NldHRpbmdzKTtcblxuICAgICAgICAgICAgbGV0IHByb2Nlc3NlZF9qc29uX2RhdGEgPSBkcHAuZGF0YXNldFRvSlNPTkRhdGEocHJvY2Vzc2VkX2RhdGEpO1xuXG4gICAgICAgICAgICBsZXQgZGF0YV90eX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PSB0aGlzLnNldHRpbmdzX29iamVjdC5nZXRFcnJvckJhcnNTZXR0aW5ncygpO1xuICAgICAgICAgICAgbGV0IHJhbmdlcyA9IHRoaXMuc2V0dGluZ3Nfb2JqZWN0LmdldFJhbmdlc1NldHRpbmdzKCk7XG5cbiAgICAgICAgICAgIGxldCBoYXNfZXJyb3JfYmFycyA9IGZhbHNlO1xuXG4gICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzLmRhdGFfdHlwZSA9IGRhdGFfdHlwZTtcblxuICAgICAgICAgICAgbGV0IGF4aXNfc2V0dGluZ3MgPSBbXTtcbiAgICAgICAgICAgIGZvcihsZXQgYXhpc19jb2x1bW4gaW4gYXhpcykge1xuICAgICAgICAgICAgICAgIGxldCBheGlzX2NvbHVtbl9vYmplY3QgPSB0aGlzLl9nZXRDb2x1bW5TZXR0aW5ncyhheGlzW2F4aXNfY29sdW1uXSk7XG4gICAgICAgICAgICAgICAgYXhpc19jb2x1bW5fb2JqZWN0ID0gey4uLmF4aXNfY29sdW1uX29iamVjdCwgLi4ue2F4aXM6IGF4aXNfY29sdW1ufX1cblxuICAgICAgICAgICAgICAgIGF4aXNfc2V0dGluZ3MucHVzaChheGlzX2NvbHVtbl9vYmplY3QpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzLmF4aXMgPSBheGlzX3NldHRpbmdzO1xuXG4gICAgICAgICAgICBpZihlcnJvcl9iYXJzICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaGFzX2Vycm9yX2JhcnMgPSB0cnVlO1xuXG4gICAgICAgICAgICAgICAgbGV0IGVycm9yX2JhcnNfc2V0dGluZ3MgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IobGV0IGF4aXNfY29sdW1uIGluIGVycm9yX2JhcnMpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGF4aXNfY29sdW1uX29iamVjdCA9IHRoaXMuX2dldENvbHVtblNldHRpbmdzKGVycm9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ICAgICB0aGlzLmZpbGUgPSB3aW5kb3cuRklUU1JlYWRlci5wYXJzZUZJVFMoYXJyYXlCdWZmZXIpO1xuXG4gICAgICAgICAgICB0aGlzLnNlbmRGSVRTTG9hZGVkRXZlbnRzKCk7XG5cbiAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICBjb25zb2xlLmxvZyhcIkVycm9yIGluaXRpYWxpemluZyBpbnRlcmZhY2VcIilcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldEZpbGVQYXRoKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5maWxlX3BhdGg7XG4gICAgfVxuXG4gICAgc2V0RmlsZShmaWxlKSB7XG4gICAgICAgIHRoaXMuZmlsZSA9IGZpbGU7XG4gICAgfVxuXG4gICAgZ2V0SERVKGhkdV9pbmRleCkge1xuICAgICAgICBpZihoZHVfaW5kZXggPj0gMCAmJiBoZHVfaW5kZXggPCB0aGlzLmZpbGUuaGR1cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbGUuaGR1c1toZHVfaW5kZXhdO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBnZXRIRFVzKCkge1xuXG4gICAgICAgIGxldCBIRFVzID0gW107XG4gICAgICAgIGxldCBoZHVfb2JqZWN0O1xuICAgICAgICBsZXQgdHlwZTtcbiAgICAgICAgbGV0IGV4dG5hbWUgPSAnJztcblxuICAgICAgICB0aGlzLmZpbGUuaGR1cy5mb3JFYWNoKGZ1bmN0aW9uKGhkdSwgaW5kZXgpIHtcblxuICAgICAgICAgICAgaWYgKGhkdS5oZWFkZXIucHJpbWFyeSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIHR5cGUgPSBcIlBSSU1BUllcIjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdHlwZSA9IGhkdS5oZWFkZXIuZ2V0KCdYVEVOU0lPTicpO1xuICAgICAgICAgICAgICAgIGV4dG5hbWUgPSBoZHUuaGVhZGVyLmdldCgnRVhUTkFNRScpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBoZHVfb2JqZWN0ID0ge1xuICAgICAgICAgICAgICAgIFwibmFtZVwiOiB0eXBlLFxuICAgICAgICAgICAgICAgIFwiaW5kZXhcIjogaW5kZXgsXG4gICAgICAgICAgICAgICAgXCJleHRuYW1lXCI6IGV4dG5hbWVcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIEhEVXMucHVzaChoZHVfb2JqZWN0KTtcbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4gSERVcztcbiAgICB9XG5cbiAgICBnZXRUYWJ1bGFySERVcygpIHtcbiAgICAgICAgbGV0IHRhYnVsYXJfaGR1c19pbmRleCA9IFtdO1xuXG4gICAgICAgIHRoaXMuZmlsZS5oZHVzLmZvckVhY2goZnVuY3Rpb24oaGR1LCBpbmRleCkge1xuICAgICAgICAgICAgaWYgKGhkdS5oZWFkZXIucHJpbWFyeSAhPT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGlmKGhkdS5oZWFkZXIuZ2V0KCdYVEVOU0lPTicpID09PSBcIlRBQkxFXCIgfHwgaGR1LmhlYWRlci5nZXQoJ1hURU5TSU9OJykgPT09IFwiQklOVEFCTEVcIikge1xuICAgICAgICAgICAgICAgICAgICB0YWJ1bGFyX2hkdXNfaW5kZXgucHVzaChpbmRleCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiB0YWJ1bGFyX2hkdXNfaW5kZXg7XG4gICAgfVxuXG4gICAgZ2V0TnVtYmVyT2ZDb2x1bW5Gcm9tSERVKGhkdV9pbmRleCkge1xuICAgICAgICBsZXQgaGR1ID0gdGhpcy5maWxlLmdldEhEVShoZHVfaW5kZXgpO1xuXG4gICAgICAgIGxldCBoZWFkZXIgP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Bjb2x1bW47XG5cbiAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uX25hbWUpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBIRFVOb3RUYWJ1bGFyRXJyb3IoXCJTZWxlY3RlZCBIRFUgaXMgbm90IHRhYnVsYXJcIik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gY29sdW1ucztcbiAgICB9XG5cbiAgICBnZXRDb2x1bW5zSlNPTkRhdGFGcm9tSERVKGhkdV9pbmRleCkge1xuXG4gICAgICAgIGxldCBoZHUgPSB0aGlzLmZpbGUuZ2V0SERVKGhkdV9pbmRleCk7XG5cbiAgICAgICAgbGV0IGhlYWRlciA9IGhkdS5oZWFkZXI7XG4gICAgICAgIGxldCBkYXRhID0gaGR1LmRhdGE7XG5cbiAgICAgICAgbGV0IHR5cGUgPSBoZHUuaGVhZGVyLmdldCgnWFRFTlNJT04nKTtcblxuICAgICAgICBsZXQgY29sdW1uc19kYXRhX2pzb24gPSBbXTtcbiAgICAgICAgbGV0IHJhd19jb2x1bW5zX2RhdGFfYXJyYXkgPSBbXTtcbiAgICAgICAgbGV0IGNvbHVtbl9kYXRhO1xuXG4gICAgICAgIGlmKHR5cGUgPT09IEZJVFNSZWFkZXJXcmFwcGVyLkJJTlRBQkxFIHx8IHR5cGUgPT09IEZJVFNSZWFkZXJXcmFwcGVyLlRBQkxFKSB7XG4gICAgICAgICAgICBkYXRhLmNvbHVtbnMuZm9yRWFjaChmdW5jdGlvbihjb2x1bW4pIHtcblxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGRhdGEuZ2V0Q29sdW1uKGNvbHVtbiwgZnVuY3Rpb24gKGNvbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uX2RhdGEgPSBjb2w7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgfSBjYXRjaChlKSB7XG5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByYXdfY29sdW1uc19kYXRhX2FycmF5W2NvbHVtbl0gPSBjb2x1bW5fZGF0YTtcbiAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIGxldCBjb2x1bW5fbmFtZXMgPSBPYmplY3Qua2V5cyhyYXdfY29sdW1uc19kYXRhX2FycmF5KTtcblxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCByYXdfY29sdW1uc19kYXRhX2FycmF5W2NvbHVtbl9uYW1lc1swXV0ubGVuZ3RoOyBpKyspIHtcblxuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5fanNvbl9kYXRhX29iamVjdCA9IHt9O1xuXG4gICAgICAgICAgICAgICAgY29sdW1uX25hbWVzLmZvckVhY2goKGNvbHVtbl9uYW1lKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbl9qc29uX2RhdGFfb2JqZWN0W2NvbHVtbl9uYW1lXSA9IHJhd19jb2x1bW5zX2RhdGFfYXJyYXlbY29sdW1uX25hbWVdW2ldO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgY29sdW1uc19kYXRhX2pzb24ucHVzaChjb2x1bW5fanNvbl9kYXRhX29iamVjdCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBIRFVOb3RUYWJ1bGFyRXJyb3IoXCJTZWxlY3RlZCBIRFUgaXMgbm90IHRhYnVsYXJcIik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gY29sdW1uc19kYXRhX2pzb247XG4gICAgfVxuXG4gICAgZ2V0Q29sdW1uRGF0YUZyb21IRFUoaGR1X2luZGV4LCBjb2x1bW5fbmFtZSkge1xuICAgICAgICBsZXQgaGR1ID0gdGhpcy5maWxlLmdldEhEVShoZHVfaW5kZXgpO1xuXG4gICAgICAgIGxldCBoZ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GR1LCBpbmRleCkgPT4ge1xuXG4gICAgICAgICAgICBpZih0aGlzLl9pc0hEVVRhYnVsYXIoaGR1KSkge1xuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5zX25hbWUgPSB0aGlzLmdldENvbHVtbnNOYW1lRnJvbUhEVShpbmRleCk7XG5cbiAgICAgICAgICAgICAgICBjb2x1bW5zX25hbWUuZm9yRWFjaCgoY29sdW1uX25hbWUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGNvbHVtbl9uYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBpbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiBmYWxzZVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgY29sdW1ucy5wdXNoKGNvbHVtbik7XG4gICAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICAgIGlmKGhkdS5oZWFkZXIuZ2V0KCdUSU1FREVMJykgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdUSU1FREVMJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhkdV9pbmRleDogaW5kZXgsXG4gICAgICAgICAgICAgICAgICAgICAgICBpc19mcm9tX2hlYWRlcjogdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgY29sdW1ucy5wdXNoKGNvbHVtbik7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYoaGR1LmhlYWRlci5nZXQoJ0FOQ1JGSUxFJykgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFuY3JmaWxlID0gRmlsZVJlZ2lzdHJ5LmdldEZpbGVCeU5hbWUoXG4gICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdVdGlscy5jbGVhbkZpbGVOYW1lKGhkdS5oZWFkZXIuZ2V0KCdBTkNSRklMRScpKVxuICAgICAgICAgICAgICAgICAgICApO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmKGFuY3JmaWxlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmcncgPSBuZXcgRklUU1JlYWRlcldyYXBwZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZydy5zZXRGaWxlKGFuY3JmaWxlLmZpbGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZihoZHUuaGVhZGVyLmdldCgnUkVTUEZJTEUnKSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgcmVzcGZpbGUgPSBGaWxlUmVnaXN0cnkuZ2V0RmlsZUJ5TmFtZShcbiAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZ1V0aWxzLmNsZWFuRmlsZU5hbWUoaGR1LmhlYWRlci5nZXQoJ1JFU1BGSUxFJykpXG4gICAgICAgICAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYocmVzcGZpbGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZydyA9IG5ldyBGSVRTUmVhZGVyV3JhcHBlcigpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBmcncuc2V0RmlsZShyZXNwZmlsZS5maWxlKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhkdXNfaW5kZXggPSBmcncuZ2V0VGFidWxhckhEVXMoKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhhc19lX21pbl9tYXggPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhkdXNfaW5kZXguZm9yRWFjaCgoaGR1X2luZGV4KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbnNfbmFtZSA9IGZydy5nZXRDb2x1bW5zTmFtZUZyb21IRFUoaGR1X2luZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29sdW1uc19uYW1lLmluY2x1ZGVzKFwiRV9NSU5cIikgJiYgY29sdW1uc19uYW1lLmluY2x1ZGVzKFwiRV9NQVhcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzX2VfbWluX21heCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBlX21pbl9tYXhfaGR1c19pbmRleCA9IGhkdV9pbmRleDtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgY29sdW1uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0VfSEFMRl9XSURUSCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZHVfaW5kZXg6IGhkdV9pbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3Byb2Nlc3NlZDogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fZmlsZTogcmVzcGZpbGUuaWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdFX01JRCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZHVfaW5kZXg6IGhkdV9pbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3Byb2Nlc3NlZDogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fZmlsZTogcmVzcGZpbGUuaWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdFX01JRF9MT0cnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBoZHVfaW5kZXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19mcm9tX2hlYWRlcjogZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19wcm9jZXNzZWQ6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX2ZpbGU6IHJlc3BmaWxlLmlkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiBjb2x1bW5zO1xuICAgIH1cblxuICAgIHNlbmRGSVRTTG9hZGVkRXZlbnRzKCkge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PT0gXCJ0cnVlXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgYnV0dG9uLnJlbW92ZUF0dHJpYnV0ZShcImFyaWEtY3VycmVudFwiKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGVhckZpbGVTZXR0aW5nc1BhbmVsKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYnV0dG9uLnNldEF0dHJpYnV0ZShcImFyaWEtY3VycmVudFwiLCBcInRydWVcIik7XG5cbiAgICAgICAgICAgICAgICAgICAgbGV0IGZpbGUgPSBGaWxlUmVnaXN0cnkuZ2V0RmlsZUJ5SWQoYnV0dG9uLmdldEF0dHJpYnV0ZShcImRhdGEtaWRcIikpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldEZpbGVTZXR0aW5nc1BhbmVsKGZpbGUpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGxldCBidXR0b25zX3RvX2ZpbHRlciA9IEFycmF5LmZyb20oYnV0dG9ucyk7XG5cbiAgICAgICAgICAgICAgICBsZXQgZmlsdGVyZWRfYnV0dG9ucyA9IGJ1dHRvbnNfdG9fZmlsdGVyLmZpbHRlcihsaXN0X2J1dHRvbiA9PiBsaXN0X2J1dHRvbiAhPT0gYnV0dG9uKTtcblxuICAgICAgICAgICAgICAgIGZpbHRlcmVkX2J1dHRvbnMuZm9yRWFjaChmaWx0ZXJlZF9idXR0b24gPT4ge1xuICAgICAgICAgICAgICAgICAgICBmaWx0ZXJlZF9idXR0b24uY2xhc3NMaXN0LnJlbW92ZSgnYWN0aXZlJyk7XG4gICAgICAgICAgICAgICAgICAgIGZpbHRlcmVkX2J1dHRvbi5yZW1vdmVBdHRyaWJ1dGUoJ2FyaWEtY3VycmVudCcpO1xuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBfc2V0RmlsZVNldHRpbmdzQ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gICAgICAgICAgIGlmKGZpbGUudHlwZSA9PT0gJ2ZpdHMnKSB7XG4gICAgICAgICAgICAgICAgbGV0IGZpdHNfcmVhZGVyX3dyYXBwZXIgPSBXcmFwcGVyQ29udGFpbmVyLmdldEZJVFNSZWFkZXJXcmFwcGVyKCk7XG5cbiAgICAgICAgICAgICAgICBpZihmaWxlLnByb2R1Y3RfdHlwZSAhPT0gJ3NwZWN0cnVtJykge1xuICAgICAgICAgICAgICAgICAgICBmaXRzX3JlYWRlcl93cmFwcGVyLnNldEZpbGUoZmlsZS5maWxlKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBmaXRzX3JlYWRlcl93cmFwcGVyLnNldEZpbGVGcm9tRmlsZU9iamVjdChmaWxlKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBsZXQgZml0c19jb2x1bW5zID0gZml0c19yZWFkZXJfd3JhcHBlci5nZXRBbGxDb2x1bW5zKCk7XG5cbiAgICAgICAgICAgICAgICBmaXRzX2NvbHVtbnMuZm9yRWFjaCgoZml0c19jb2x1bW4pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbiA9IHsuLi5maXRzX2NvbHVtbiwgZmlsZV9pZDogZmlsZS5pZH07XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIH0gZWxzZSBpZihmaWxlLnR5cGUgPT09ICdjc3YnKSB7XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcblxuICAgICAgICBsZXQgY29sdW1uc19ieV9maWxlID0gY29sdW1ucy5yZWR1Y2UoKGFjYywgY29sdW1uKSA9PiB7XG4gICAgICAgICAgICBpZiAoIWFjY1tjb2x1bW4uZmlsZV9pZF0pIHtcbiAgICAgICAgICAgICAgICBhY2NbY29sdW1uLmZpbGVfaWRdID0gW107XG4gICAgICAgICA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hUTUwgPSAnJztcbiAgICB9XG5cbiAgICBfY3JlYXRlQ29sdW1uc09wdGlvbnMoY29sdW1ucykge1xuICAgICAgICBsZXQgb3B0aW9ucyA9IFtdO1xuICAgICAgICBsZXQgb3B0aW9uO1xuXG4gICAgICAgIGNvbHVtbnMuZm9yRWFjaChmdW5jdGlvbihjb2x1bW4pIHtcblxuICAgICAgICAgICAgb3B0aW9uID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChcIm9wdGlvblwiKTtcblxuICAgICAgICAgICAgb3B0aW9uLnZhbHVlID0gY29sdW1uO1xuICAgICAgICAgICAgb3B0aW9uLnRleHQgPSBjb2x1bW47XG5cbiAgICAgICAgICAgIG9wdGlvbnMucHVzaChvcHRpb24pO1xuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiBvcHRpb25zO1xuICAgIH1cblxuICAgIF9zZXRTZWxlY3RMaWJyYXJ5TGlzdGVuZXIoKSB7XG4gICAgICAgIGxldCBzZWxlY3RfbGlicmFyeSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKFNldHRpbmdzQ29tcG9uZW50LnNlbGVjdF9saWJyYXJ5X2lkKTtcblxuICAgICAgICBzZWxlY3RfbGlicmFyeS5hZGRFdmVudExpc3RlbmVyKCdjaGFuZ2UnLCAoZXZlbnQpID0+IHtcbiAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICBjb25zdCBjdXN0b21fY2hhbmdlX2V2ZW50ID0gbmV3IEN1c3RvbUV2ZW50KCdzZWxlY3QtbGlicmFyeS1jaGFuZ2UnLCB7XG4gICAgICAgICAgICAgICAgYnViYmxlczogZmFsc2UsXG4gICAgICAgICAgICAgICAgY29tcG9zZTogZmFsc2UsXG4gICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogdHJ1ZSxcbiAgICAgICAgICAgICAgICBkZXRhaWw6IHtcbiAgICAgICAgICAgICAgICAgICAgbGlicmFyeTogc2VsZWN0X2xpYnJ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JfYmFyX3kgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChTZXR0aW5nc0NvbXBvbmVudC5zZWxlY3RfZXJyb3JfYmFyX3lfaWQpO1xuXG4gICAgICAgIHNlbGVjdF9heGlzX3guYWRkRXZlbnRMaXN0ZW5lcignY2hhbmdlJywgKGUpID0+IHtcbiAgICAgICAgICAgIGxldCBjb2x1bW5faWQgPSBlLnRhcmdldC52YWx1ZTtcblxuICAgICAgICAgICAgbGV0IGRhdGFfdHlwZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKFNldHRpbmdzQ29tcG9uZW50LnNlbGVjdF9kYXRhX3R5cGVfaWQpLnZhbHVlO1xuXG4gICAgICAgICAgICBpZihkYXRhX3R5cGUgPT09ICdsaWdodC1jdXJ2ZScpIHtcblxuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5fZGVzY3JpcHRvciA9IENvbHVtblV0aWxzLmdldENvbHVtblNldHRpbmdzKGNvbHVtbl9pZClcblxuICAgICAgICAgICAgICAgIGxldCBmaWxlX29iamVjdCA9IEZpbGVSZWdpc3RyeS5nZXRGaWxlQnlJZChjb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkKTtcblxuICAgICAgICAgICAgICAgIGxldCBmcncgPSBXcmFwcGVyQ29udGFpbmVyLmdldEZJVFNSZWFkZXJXcmFwcGVyKCk7XG4gICAgICAgICAgICAgICAgZnJ3LnNldEZpbGUoZmlsZV9vYmplY3QuZmlsZSk7XG5cbiAgICAgICAgICAgICAgICBsZXQgY29sdW1uc19uYW1lPSBmcncuZ2V0QWxsQ29sdW1ucygpO1xuXG4gICAgICAgICAgICAgICAgaWYoY29sdW1uX2Rlc2NyaXB0b3IuY29sdW1uX25hbWUudG9VcHBlckNhc2UoKSA9PT0gJ1JBVEUnICYmXG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbnNfbmFtZS5zb21lKGNvbHVtbiA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uLm5hbWUudG9VcHBlckNhc2UoKSA9PT0gJ0VSUk9SJyAmJiBwYXJzZUludChjb2x1bW4uaGR1X2luZGV4KSA9PT0gcGFyc2VJbnQoY29sdW1uX2Rlc2NyaXB0b3IuaGR1X2luZGV4KVxuICAgICAgICAgICAgICAgICAgICB9KSkge1xuXG4gICAgICAgICAgICAgICAgICAgIEFycmF5LmZyb20oc2VsZWN0X2Vycm9yX2Jhcl94Lm9wdGlvbnMpLmZvckVhY2goKG9wdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9wdGlvbl9jb2x1bW5fZGVzY3JpcHRvciA9IENvbHVtblV0aWxzLmdldENvbHVtblNldHRpbmdzKG9wdGlvbi52YWx1ZSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKG9wdGlvbl9jb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkID09PSBjb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmhkdV9pbmRleCA9PT0gY29sdW1uX2Rlc2NyaXB0b3IuaGR1X2luZGV4ICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmNvbHVtbl9uYW1lLnRvVXBwZXJDYXNlKCkgPT09ICdFUlJPUicpXG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RfZXJyb3JfYmFyX3gudmFsdWUgPSBvcHRpb24udmFsdWU7XG4gICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYoY29sdW1uX2Rlc2NyaXB0b3IuY29sdW1uX25hbWUudG9VcHBlckNhc2UoKSA9PT0gJ1RJTUUnICYmXG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbnNfbmFtZS5zb21lKGNvbHVtbiA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uLm5hbWUudG9VcHBlckNhc2UoKSA9PT0gJ1RJTUVERUwnICYmIHBhcnNlSW50KGNvbHVtbi5oZHVfaW5kZXgpID09PSBwYXJzZUludChjb2x1bW5fZGVzY3JpcHRvci5oZHVfaW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIH0pKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgQXJyYXkuZnJvbShzZWxlY3RfZXJyb3JfYmFyX3gub3B0aW9ucykuZm9yRWFjaCgob3B0aW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yID0gQ29sdW1uVXRpbHMuZ2V0Q29sdW1uU2V0dGluZ3Mob3B0aW9uLnZhbHVlKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbl9jb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkID09PSBjb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmhkdV9pbmRleCA9PT0gY29sdW1uX2Rlc2NyaXB0b3IuaGR1X2luZGV4ICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmNvbHVtbl9uYW1lLnRvVXBwZXJDYXNlKCkgPT09ICdUSU1FREVMJylcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdF9lcnJvcl9iYXJfeC52YWx1ZSA9IG9wdGlvbi52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgfSlcblxuICAgICAgICBzZWxlY3RfYXhpc195LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIChlKSA9PiB7XG4gICAgICAgICAgICBsZXQgY29sdW1uX2lkID0gZS50YXJnZXQudmFsdWU7XG5cbiAgICAgICAgICAgIGxldCBkYXRhX3R5cGUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChTZXR0aW5nc0NvbXBvbmVudC5zZWxlY3RfZGF0YV90eXBlX2lkKS52YWx1ZTtcblxuICAgICAgICAgICAgaWYoZGF0YV90eXBlID09PSAnbGlnaHQtY3VydmUnKSB7XG5cbiAgICAgICAgICAgICAgICBsZXQgY29sdW1uX2Rlc2NyaXB0b3I9IENvbHVtblV0aWxzLmdldENvbHVtblNldHRpbmdzKGNvbHVtbl9pZClcblxuICAgICAgICAgICAgICAgIGxldCBmaWxlX29iamVjdCA9IEZpbGVSZWdpc3RyeS5nZXRGaWxlQnlJZChjb2x1bW5fZGVzY3JpcHRvci5maWxlX2lkKTtcblxuICAgICAgICAgICAgICAgIGxldCBmcnc9IFdyYXBwZXJDb250YWluZXIuZ2V0RklUU1JlYWRlcldyYXBwZXIoKTtcbiAgICAgICAgICAgICAgICBmcncuc2V0RmlsZShmaWxlX29iamVjdC5maWxlKTtcblxuICAgICAgICAgICAgICAgIGxldCBjb2x1bW5zX25hbWU9IGZydy5nZXRBbGxDb2x1bW5zKCk7XG5cbiAgICAgICAgICAgICAgICBpZihjb2x1bW5fZGVzY3JpcHRvci5jb2x1bW5fbmFtZS50b1VwcGVyQ2FzZSgpID09PSAnUkFURScgJiZcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uc19uYW1lLnNvbWUoY29sdW1uID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2x1bW4ubmFtZS50b1VwcGVyQ2FzZSgpID09PSAnRVJST1InICYmIHBhcnNlSW50KGNvbHVtbi5oZHVfaW5kZXgpID09PSBwYXJzZUludChjb2x1bW5fZGVzY3JpcHRvci5oZHVfaW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIH0pKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgQXJyYXkuZnJvbShzZWxlY3RfZXJyb3JfYmFyX3kub3B0aW9ucykuZm9yRWFjaCgob3B0aW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yID0gQ29sdW1uVXRpbHMuZ2V0Q29sdW1uU2V0dGluZ3Mob3B0aW9uLnZhbHVlKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYob3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmZpbGVfaWQgPT09IGNvbHVtbl9kZXNjcmlwdG9yLmZpbGVfaWQgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25fY29sdW1uX2Rlc2NyaXB0b3IuaGR1X2luZGV4ID09PSBjb2x1bW5fZGVzY3JpcHRvci5oZHVfaW5kZXggJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25fY29sdW1uX2Rlc2NyaXB0b3IuY29sdW1uX25hbWUudG9VcHBlckNhc2UoKSA9PT0gJ0VSUk9SJylcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdF9lcnJvcl9iYXJfeS52YWx1ZSA9IG9wdGlvbi52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZihjb2x1bW5fZGVzY3JpcHRvci5jb2x1bW5fbmFtZS50b1VwcGVyQ2FzZSgpID09PSAnVElNRScgJiZcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uc19uYW1lLnNvbWUoY29sdW1uID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb2x1bW4ubmFtZS50b1VwcGVyQ2FzZSgpID09PSAnVElNRURFTCcgJiYgcGFyc2VJbnQoY29sdW1uLmhkdV9pbmRleCkgPT09IHBhcnNlSW50KGNvbHVtbl9kZXNjcmlwdG9yLmhkdV9pbmRleClcbiAgICAgICAgICAgICAgICAgICAgfSkpIHtcblxuICAgICAgICAgICAgICAgICAgICBBcnJheS5mcm9tKHNlbGVjdF9lcnJvcl9iYXJfeS5vcHRpb25zKS5mb3JFYWNoKChvcHRpb24pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvcHRpb25fY29sdW1uX2Rlc2NyaXB0b3IgPSBDb2x1bW5VdGlscy5nZXRDb2x1bW5TZXR0aW5ncyhvcHRpb24udmFsdWUpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW9uX2NvbHVtbl9kZXNjcmlwdG9yLmZpbGVfaWQgPT09IGNvbHVtbl9kZXNjcmlwdG9yLmZpbGVfaWQgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25fY29sdW1uX2Rlc2NyaXB0b3IuaGR1X2luZGV4ID09PSBjb2x1bW5fZGVzY3JpcHRvci5oZHVfaW5kZXggJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25fY29sdW1uX2Rlc2NyaXB0b3IuY29sdW1uX25hbWUudG9VcHBlckNhc2UoKSA9PT0gJ1RJTUVERUwnKVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0X2Vycm9yX2Jhcl95LnZhbHVlID0gb3B0aW9uLnZhbHVlO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICB9KVxuXG4gICAgfVxuXG4gICAgX3NldENhbGN1bGF0aW9uUmFkaW9MaXN0ZW5lcnMoKSB7XG4gICAgICAgIGxldCByYWRpb19idXR0b25zID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgnLicgKyBTZXR0aW5nc0NvbXBvbmVudC5jYWxjdWxhdGlvbl9yYWRpb19jbGFzcyk7XG4gICAgICAgIHJhZGlvX2J1dHRvbnMuZm9yRWFjaChyYWRpb19idXR0b24gPT4ge1xuICAgICAgICAgICAgcmFkaW9fYnV0dG9uLmFkZEV2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Xhpcy15J10pIHtcbiAgICAgICAgICAgIGxldCBheGlzID0ge307XG4gICAgICAgICAgICBsZXQgc2NhbGVzID0ge307XG5cbiAgICAgICAgICAgIGF4aXMueCA9IHZhbHVlc1snc2VsZWN0LWF4aXMteCddLnZhbHVlO1xuICAgICAgICAgICAgYXhpcy55ID0gdmFsdWVzWydzZWxlY3QtYXhpcy15J10udmFsdWU7XG5cbiAgICAgICAgICAgIHNjYWxlcy54ID0gdmFsdWVzWydzZWxlY3QtYXhpcy14LXNjYWxlJ10udmFsdWU7XG4gICAgICAgICAgICBzY2FsZXMueSA9IHZhbHVlc1snc2VsZWN0LWF4aXMteS1zY2FsZSddLnZhbHVlO1xuXG4gICAgICAgICAgICB0aGlzLnNldHRpbmdzX29iamVjdC5zZXRBeGlzU2V0dGluZ3MoYXhpcyk7XG4gICAgICAgICAgICB0aGlzLnNldHRpbmdzX29iamVjdC5zZXRTY2FsZXNTZXR0aW5ncyhzY2FsZXMpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYodmFsdWVzWydoYXMtZXJyb3ItYmFycy1jaGVja2JveCddKSB7XG4gICAgICAgICAgICBpZih2YWx1ZXNbJ2hhcy1lcnJvci1iYXJzLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGxldCBlcnJvcl9iYXJzID0ge307XG5cbiAgICAgICAgICAgICAgICBpZih2YWx1ZXNbJ3NlbGVjdC1heGlzLXgtZXJyb3ItYmFyJ10gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBlcnJvcl9iYXJzLnggPSB2YWx1ZXNbJ3NlbGVjdC1heGlzLXgtZXJyb3ItYmFyJ10udmFsdWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGVycm9yX2JhcnMueFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKHZhbHVlc1snc2VsZWN0LWF4aXMteS1lcnJvci1iYXInXSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yX2JhcnMueSA9IHZhbHVlc1snc2VsZWN0LWF4aXMteS1lcnJvci1iYXInXS52YWx1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgZXJyb3JfYmFycy55XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGhpcy5zZXR0aW5nc19vYmplY3Quc2V0RXJyb3JCYXJzU2V0dGluZ3MoZXJyb3JfYmFycyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZih2YWx1ZXNbJ2hhcy14LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSB8fCB2YWx1ZXNbJ2hhcy15LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuXG4gICAgICAgICAgICBsZXQgcmFuZ2VzID0ge1xuICAgICAgICAgICAgICAgIHg6IHt9LFxuICAgICAgICAgICAgICAgIHk6IHt9XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBpZih2YWx1ZXNbJ2hhcy14LXJhbmdlLWNoZWNrYm94J10uY2hlY2tlZCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIHJhbmdlc1sneCddLmxvd2VyX2JvdW5kID0gdmFsdWVzWyd4LWxvd2VyLWJvdW5kJ10udmFsdWU7XG4gICAgICAgICAgICAgICAgcmFuZ2VzWyd4J10udXBwZXJfYm91bmQgPSB2YWx1ZXNbJ3gtaGlnaGVyLWJvdW5kJ10udmFsdWU7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJhbmdlc1sneCddID0gbnVsbDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYodmFsdWVzWydoYXMteS1yYW5nZS1jaGVja2JveCddLmNoZWNrZ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gIGlubmVyX2NvbnRhaW5lciA9ICc8ZGl2IGNsYXNzPVwiaW5uZXItcm93XCI+PC9kaXY+JztcblxuICAgIGhlYWRlcl9jb2x1bW4gPSAnPGRpdiBjbGFzcz1cImxlZnQtY29sdW1uXCI+JyArXG4gICAgICAgICc8ZGl2IGNsYXNzPVwiY2FyZC1oZWFkZXJcIj5IZWFkZXI8L2Rpdj4nICtcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJjYXJkLWJvZHlcIj4nICtcbiAgICAgICAgJzxkaXYgaWQ9XCJoZWFkZXItaGR1LWZpbGVcIj4nICtcbiAgICAgICAgJzwvZGl2PicgK1xuICAgICAgICAnPC9kaXY+JztcblxuICAgIHRhYmxlX2hlYWRlciA9ICc8dGFibGUgaWQ9XCJ0YWJsZS1oZWFkZXItZGF0YVwiIGNsYXNzPVwidGFibGUgdGFibGUtc3RyaXBlZFwiPicgK1xuICAgICAgICAnICAgIDx0aGVhZD4nICtcbiAgICAgICAgJyAgICA8dHI+JyArXG4gICAgICAgICcgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPiM8L3RoPicgK1xuICAgICAgICAnICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5OYW1lPC90aD4nICtcbiAgICAgICAgJyAgICAgICAgPHRoIHNjb3BlPVwiY29sXCI+VmFsdWU8L3RoPicgK1xuICAgICAgICAnICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5Db21tZW50PC90aD4nICtcbiAgICAgICAgJyAgICA8L3RyPicgK1xuICAgICAgICAnICAgIDwvdGhlYWQ+JyArXG4gICAgICAgICcgICAgPHRib2R5IGNsYXNzPVwidGFibGUtZ3JvdXAtZGl2aWRlclwiPicgK1xuICAgICAgICAnICAgIDwvdGJvZHk+JyArXG4gICAgICAgICc8L3RhYmxlPidcblxuICAgIGRhdGFfY29sdW1uID0gJzxkaXYgY2xhc3M9XCJyaWdodC1jb2x1bW5cIj4nICtcbiAgICAgICAgJzxkaXYgY2xhc3M9XCJjYXJkLW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ICAgJyA8c2VsZWN0IGlkPVwiYXJmLWZpbGUtc2VsZWN0XCIgY2xhc3M9XCJmb3JtLXNlbGVjdCBzcGVjdHJ1bS1zZXR0aW5nc1wiPjwvc2VsZWN0PicgK1xuICAgICAgICAgICAgJyA8bGFiZWwgZm9yPVwicHJvZHVjdC10eXBlLXNlbGVjdFwiIGNsYXNzPVwic3BlY3RydW0tc2V0dGluZ3NcIj5STUYgZmlsZSA6PC9sYWJlbD4nICtcbiAgICAgICAgICAgICcgPHNlbGVjdCBpZD1cInJtZi1maWxlLXNlbGVjdFwiIGNsYXNzPVwiZm9ybS1zZWxlY3Qgc3BlY3RydW0tc2V0dGluZ3NcIj48L3NlbGVjdD4nICtcbiAgICAgICAgICAgICcgPGxhYmVsIGZvcj1cInNlbGVjdC1oZHUtZmlsZVwiPkhEVSA6PC9sYWJlbC0tPicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9XCJzZWxlY3QtaGR1LWZpbGVcIiBjbGFzcz1cImZvcm0tc2VsZWN0XCI+XFxuJyArXG4gICAgICAgICAgICAnXFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9zZWxlY3Q+XFxuJyArXG4gICAgICAgICAgICAnXFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImlubmVyLXJvd1wiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwibGVmdC1jb2x1bW5cIj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJjYXJkXCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmQtaGVhZGVyXCI+SGVhZGVyPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmQtYm9keVwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwiaGVhZGVyLWhkdS1maWxlXCIgY2xhc3M9XCJmaWxlLWRhdGEtY29udGFpbmVyXCI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGFibGUgaWQ9XCJ0YWJsZS1oZWFkZXItZGF0YVwiIGNsYXNzPVwidGFibGUgdGFibGUtc3RyaXBlZFwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0aGVhZD5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dHI+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0aCBzY29wZT1cImNvbFwiPiM8L3RoPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5OYW1lPC90aD5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRoIHNjb3BlPVwiY29sXCI+VmFsdWU8L3RoPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGggc2NvcGU9XCJjb2xcIj5Db21tZW50PC90aD5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3RyPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdGhlYWQ+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRib2R5IGNsYXNzPVwidGFibGUtZ3JvdXAtZGl2aWRlclwiPlxcbicgK1xuICAgICAgICAgICAgJ1xcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdGJvZHk+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L3RhYmxlPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInJpZ2h0LWNvbHVtblwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmRcIj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiY2FyZC1oZWFkZXJcIj5EYXRhPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImNhcmQtYm9keVwiPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGlkPVwiZGF0YS1oZHUtZmlsZVwiIGNsYXNzPVwiZmlsZS1kYXRhLWNvbnRhaW5lclwiPlxcbicgK1xuICAgICAgICAgICAgJzx0YWJsZSBpZD1cInRhYmxlLWRhdGFcIiBjbGFzcz1cInRhYmxlIHRhYmxlLXN0cmlwZWRcIj4nICtcbiAgICAgICAgICAgICAgICAnICAgIDx0aGVhZD4nICtcbiAgICAgICAgICAgICAgICAnICAgICAgIDx0cj4nICtcbiAgICAgICAgICAgICAgICAgICAgJyAgICAgICA8L3RyPicgK1xuICAgICAgICAgICAgICAgICcgICAgPC90aGVhZD4nICtcbiAgICAgICAgICAgICAgICAnICAgIDx0Ym9keSBjbGFzcz1cInRhYmxlLWdyb3VwLWRpdmlkZXJcIj4nICtcbiAgICAgICAgICAgICAgICAnICAgIDwvdGJvZHk+JyArXG4gICAgICAgICAgICAgICAgJzwvdGFibGU+JytcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XFxuJyArXG4gICAgICAgICAgICAnXFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiBjbGFzcz1cImJ0biBidG4tc3VjY2Vzc1wiIGlkPVwic2F2ZS1maWxlLXNldHRpbmdzXCI+U2F2ZSBjaGFuZ2VzPC9idXR0b24+XFxuJyArXG4gICAgICAgICAgICAnICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiBjbGFzcz1cImJ0biBidG4tcHJpbWFyeVwiIGlkPVwiYWRkLXRvLXBsb3RcIj5BZGQgdG8gcGxvdDwvYnV0dG9uPlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9XCJidG4gYnRuLWRhbmdlclwiIGlkPVwicmVtb3ZlLWZyb20tcGxvdFwiPlJlbW92ZSBmcm9tIHBsb3Q8L2J1dHRvbj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxcbicgK1xuICAgICAgICAgICAgJyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cXG4nICtcbiAgICAgICAgICAgICcgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj4nXG5cbiAgICB9XG5cbiAgICBzZXR1cENvbXBvbmVudCgpIHtcbiAgICAgICAgdGhpcy5zZXRIRFVTZWxlY3QoKTtcbiAgICAgICAgdG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dV9pbmRleCk7XG4gICAgICAgICAgICBsZXQgaGR1X2RhdGEgPSBmcncuZ2V0Q29sdW1uc0pTT05EYXRhRnJvbUhEVShoZHVfaW5kZXgpXG5cbiAgICAgICAgICAgIGxldCBoZWFkZXJfcm93ID0gdGFibGVfZGF0YS50SGVhZC5pbnNlcnRSb3coKTtcbiAgICAgICAgICAgIHRib2R5ID0gdGFibGVfZGF0YS5xdWVyeVNlbGVjdG9yKCd0Ym9keScpO1xuXG4gICAgICAgICAgICBoZHVfY29sdW1uc19uYW1lLmZvckVhY2goKGNvbHVtbikgPT4ge1xuICAgICAgICAgICAgICAgIGxldCBoZWFkZXJfY2VsbCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3RoJyk7XG4gICAgICAgICAgICAgICAgaGVhZGVyX2NlbGwudGV4dENvbnRlbnQgPSBjb2x1bW47XG4gICAgICAgICAgICAgICAgaGVhZGVyX3Jvdy5hcHBlbmRDaGlsZChoZWFkZXJfY2VsbCk7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgaGR1X2RhdGEuZm9yRWFjaChkYXRhX3BvaW50ID0+IHtcblxuICAgICAgICAgICAgICAgIGNvbnN0IHJvdyA9IHRib2R5Lmluc2VydFJvdygpO1xuICAgICAgICAgICAgICAgIGZvciAobGV0IGtleSBpbiBkYXRhX3BvaW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuaGFzT3duUHJvcGVydHkuY2FsbChkYXRhX3BvaW50LCBrZXkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY2VsbCA9IHJvdy5pbnNlcnRDZWxsKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBjZWxsLnRleHRDb250ZW50ID0gZGF0YV9wb2ludFtrZXldO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICBjb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Rlcl93cmFwcGVyLnNldEZpbGUoZmlsZS5maWxlKTtcbiAgICAgICAgICAgICAgICBsZXQgZml0c19jb2x1bW5zID0gZml0c19yZWFkZXJfd3JhcHBlci5nZXRBbGxDb2x1bW5zKCk7XG5cbiAgICAgICAgICAgICAgICBmaXRzX2NvbHVtbnMuZm9yRWFjaCgoZml0c19jb2x1bW4pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbiA9IHsuLi5maXRzX2NvbHVtbiwgZmlsZV9pZDogZmlsZS5pZH07XG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcblxuICAgICAgICBsZXQgY29sdW1uc19ieV9maWxlID0gY29sdW1ucy5yZWR1Y2UoKGFjYywgY29sdW1uKSA9PiB7XG4gICAgICAgICAgICBpZiAoIWFjY1tjb2x1bW4uZmlsZV9pZF0pIHtcbiAgICAgICAgICAgICAgICBhY2NbY29sdW1uLmZpbGVfaWRdID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBhY2NbY29sdW1uLmZpbGVfaWRdLnB1c2goY29sdW1uKTtcbiAgICAgICAgICAgIHJldHVybiBhY2M7XG4gICAgICAgIH0sIHt9KTtcblxuICAgICAgICBsZXQgbGlfZ3JvdXBfbGlzdCA9IFtdO1xuXG4gICAgICAgIGxldCBpID0gMTtcbiAgICAgICAgZm9yIChsZXQgZmlsZV9pZCBpbiBjb2x1bW5zX2J5X2ZpbGUpIHtcbiAgICAgICAgICAgIGlmIChjb2x1bW5zX2J5X2ZpbGUuaGFzT3duUHJvcGVydHkoZmlsZV9pZCkpIHtcbiAgICAgICAgICAgICAgICBsZXQgZmlsZSA9IEZpbGVSZWdpc3RyeS5nZXRGaWxlQnlJZChmaWxlX2lkKTtcbiAgICAgICAgICAgICAgICBsZXQgZmlsZV9uYW1lID0gZmlsZS5maWxlX25hbWU7XG5cbiAgICAgICAgICAgICAgICBsZXQgZnJ3ID0gV3JhcHBlckNvbnRhaW5lci5nZXRGSVRTUmVhZGVyV3JhcHBlcigpO1xuICAgICAgICAgICAgICAgIGZydy5zZXRGaWxlKGZpbGUuZmlsZSk7XG5cbiAgICAgICAgICAgICAgICBsaV9ncm91cF9saXN0LnB1c2godGhpcy5jcmVhdGVDb2x1bW5zTGlzdChjb2x1bW5zX2J5X2ZpbGVbZmlsZV9pZF0sIGZydykpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaSsrO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5zZXRDb2x1bW5JbnB1dChsaV9ncm91cF9saXN0KTtcbiAgICAgICAgdGhpcy5fc2V0Q29sdW1uSW5wdXRMaXN0ZW5lcigpO1xuICAgIH1cblxuICAgIGV4ZWN1dGVDb21tYW5kKGNvbW1hbmQpIHtcbiAgICAgICAgbGV0IGlucHV0X2Rpc3BsYXkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChBcml0aG1ldGljQ29sdW1uSW5wdXQuaW5wdXRfZXhwcmVzc2lvbik7XG5cbiAgICAgICAgc3dpdGNoIChjb21tYW5kKSB7XG5cbiAgICAgICAgICAgIGNhc2UgJ0MnOlxuICAgICAgICAgICAgICAgIGlucHV0X2Rpc3BsYXkudmFsdWUgPSAnJztcblxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICBjYXNlICdWJzpcbiAgICAgICAgICAgICAgICB0aGlzLmFkZENvbHVtblRvRGlzcGxheShpbnB1dF9kaXNwbGF5LnZhbHVlKTtcblxuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICBjYXNlICc8LS0nOlxuXG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgJy0tPic6XG5cbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY3JlYXRlQ29sdW1uc0xpc3QoZmlsZV9jb2x1bW5zLCBmaXRzX3JlYWRlcl93cmFwcGVyKSB7XG5cbiAgICAgICAgbGV0IGxpX2dyb3VwID0gW107XG5cbiAgICAgICAgZmlsZV9jb2x1bW5zLmZvckVhY2goY29sdW1uID0+IHtcbiAgICAgICAgICAgIGxldCBsaSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoXCJsaVwiKTtcblxuICAgICAgICAgICAgbGV0IGhkdV90eXBlID0gZml0c19yZWFkZXJfd3JhcHBlci5nZXRIZWFkZXJDYXJkVmFsdWVCeU5hbWVGcm9tSERVKGNvbHVtbi5oZHVfaW5kZXgsICdYVEVOU0lPTicpO1xuICAgICAgICAgICAgbGV0IGhkdV9leHRuYW1lID0gZml0c19yZWFkZXJfd3JhcHBlci5nZXRIZWFkZXJDYXJkVmFsdWVCeU5hbWVGcm9tSERVKGNvbHVtbi5oZHVfaW5kZXgsICdFWFROQU1FJyk7XG4gICAgICAgICAgICBsZXQgbmFtZSA9IGhkdV90eXBlKyctJytoZHVfZXh0bmFtZSsnICcrY29sdW1uLm5hbWU7XG5cbiAgICAgICAgICAgIGlmKGNvbHVtbi5pc19mcm9tX2hlYWRlcikge1xuICAgICAgICAgICAgICAgIG5hbWUgKz0gJyhIRUFERVIpJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYoY29sdW1uLmlzX3Byb2Nlc3NlZCkge1xuICAgICAgICAgICAgICAgIGxpLmlubmVySFRNTCA9IG5hbWU7XG4gICAgICAgICAgICAgICAgbGkuc2V0QXR0cmlidXRlKCdkYXRhc2V0LWlkJyxgJHtjb2x1bW4uZnJvbV9maWxlfS4ke2NvbHVtbi5oZHVfaW5kZXh9JCR7Y29sdW1uLm5hbWV9YCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxpLmlubmVySFRNTCA9IG5hbWU7XG4gICAgICAgICAgICAgICAgbGkuc2V0QXR0cmlidXRlKCdkYXRhLWlkJyxgJH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d3JhcHBlcikge1xuICAgICAgICBXcmFwcGVyQ29udGFpbmVyLmQzX3dyYXBwZXIgPSBkM193cmFwcGVyO1xuICAgIH1cblxuICAgIHN0YXRpYyBnZXRGSVRTUmVhZGVyV3JhcHBlcigpIHtcbiAgICAgICAgaWYoV3JhcHBlckNvbnRhaW5lci5maXRzX3JlYWRlcl93cmFwcGVyICE9PSBudWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gV3JhcHBlckNvbnRhaW5lci5maXRzX3JlYWRlcl93cmFwcGVyO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBGSVRTUmVhZGVyV3JhcHBlcignJyk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzdGF0aWMgZ2V0Qm9rZWhXcmFwcGVyKCkge1xuICAgICAgICBpZihXcmFwcGVyQ29udGFpbmVyLmJva2VoX3dyYXBwZXIgIT09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBXcmFwcGVyQ29udGFpbmVyLmJva2VoX3dyYXBwZXI7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IEJva2VoV3JhcHBlcihXcmFwcGVyQ29udGFpbmVyLnZpc3VhbGl6YXRpb25fY29udGFpbmVyKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHN0YXRpYyBnZXREM1dyYXBwZXIoKSB7XG4gICAgICAgIGlmKFdyYXBwZXJDb250YWluZXIuZDNfd3JhcHBlciAhPT0gbnVsbCkge1xuICAgICAgICAgICAgcmV0dXJuIFdyYXBwZXJDb250YWluZXIuZDNfd3JhcHBlcjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBuZXcgRDNXcmFwcGVyKFdyYXBwZXJDb250YWluZXIudmlzdWFsaXphdGlvbl9jb250YWluZXIpO1xuICAgICAgICB9XG4gICAgfVxuXG59IiwiaW1wb3J0IHtXcmFwcGVyQ29udGFpbmVyfSBmcm9tIF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kpIHtcblxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5fZGF0YSA9IHRoaXMuZ2V0U3BlY3RydW1Qcm9jZXNzZWRDb2x1bW4oZXJyb3JfYmFyLmhkdV9pbmRleCwgZXJyb3JfYmFyLmNvbHVtbl9uYW1lLCBmcncpXG5cbiAgICAgICAgICAgICAgICAgICAgaWYoZXJyb3JfYmFyLmNvbHVtbl9uYW1lID09PSBTcGVjdHJ1bVByb2Nlc3Nvci5FX01JRF9MT0cpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbl9kYXRhLmZvckVhY2goY29sX2RhdGEgPT4ge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb2x1bW5fZGF0YSA9IGZydy5nZXRDb2x1bW5EYXRhRnJvbUhEVShlcnJvcl9iYXIuaGR1X2luZGV4LCBlcnJvcl9iYXIuY29sdW1uX25hbWUpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGVycm9yX2Jhci5kYXRhID0gY29sdW1uX2RhdGE7XG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG5cbiAgICAgICAgZGF0YXNldCA9IGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0O1xuXG4gICAgICAgIHJldHVybiBkYXRhc2V0O1xuICAgIH1cblxuICAgIGRhdGFzZXRUb0pTT05EYXRhKGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0KSB7XG4gICAgICAgIGxldCByb3dzID0gW107XG5cbiAgICAgICAgZGF0YXNldF9zZXR0aW5nc19vYmplY3QuYXhpcy5mb3JFYWNoKChheGlzKSA9PiB7XG5cbiAgICAgICAgICAgIGF4aXMuZGF0YS5mb3JFYWNoKCh2YWx1ZSwgaW5kZXgpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoIXJvd3NbaW5kZXhdKSB7XG4gICAgICAgICAgICAgICAgICAgIHJvd3NbaW5kZXhdID0ge307XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJvd3NbaW5kZXhdW2F4aXMuY29sdW1uX25hbWVdID0gdmFsdWU7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICB9KVxuXG4gICAgICAgIGlmKGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0Lmhhc093blByb3BlcnR5KCdlcnJvcl9iYXJzJykpIHtcbiAgICAgICAgICAgIGRhdGFzZXRfc2V0dGluZ3Nfb2JqZWN0LmVycm9yX2JhcnMuZm9yRWFjaCgoZXJyb3JfYmFyKSA9PiB7XG5cbiAgICAgICAgICAgICAgICBlcnJvcl9iYXIuZGF0YS5mb3JFYWNoKCh2YWx1ZSwgaW5kZXgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFyb3dzW2luZGV4XSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcm93c1tpbmRleF0gPSB7fTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByb3dzW2luZGV4XVtlcnJvcl9iYXIuY29sdW1uX25hbWVdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIH0pXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcm93cztcbiAgICB9XG5cbiAgICBwcm9jZXNzRXJyb3JCYXJEYXRhSlNPTihkYXRhc2V0LCBheGlzLCBlcnJvcl9iYXJzKSB7XG5cbiAgICAgICAgY29uc29sZS5sb2coZXJyb3JfYmFycyk7XG4gICAgICAgIGNvbnNvbGUubG9nKGRhdGFzZXQpO1xuXG4gICAgICAgIGxldCBlcnJvcl9iYXJfeF92YWx1ZXMgPSBbXTtcbiAgICAgICAgbGV0IGVycm9yX2Jhcl95X3ZhbHVlcyA9IFtdO1xuXG4gICAgICAgIGxldCBheGlzX3ggPSBheGlzLng7XG4gICAgICAgIGxldCBheGlzX3kgPSBheGlzLnk7XG5cbiAgICAgICAgbGV0IGVycm9yX2Jhcl94X2NvbHVtbiA9IGVycm9yX2JhcnMueDtcbiAgICAgICAgbGV0IGVycm9yX2Jhcl95X2NvbHVtbiA9IGVycm9yX2JhcnMueTtcblxuICAgICAgICBsZXQgZXJyb3JfYmFyc19vYmplY3QgPSB7fTtcblxuICAgICAgICBkYXRhc2V0LmZvckVhY2goZnVuY3Rpb24oZGF0YXBvaW50KXtcblxuICAgICAgICAgICAgaWYoZXJyb3JfYmFycy54KSB7XG5cbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhcIlhcIik7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZGF0YXBvaW50W2F4aXNfeF0pO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycm9yX2Jhcl94X2NvbHVtbik7XG5cbiAgICAgICAgICAgICAgICBsZXQgZXJyb3JfYmFyX3ggPSBbXG4gICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKSAtIHBhcnNlRmxvYXQoZGF0YXBvaW50W2Vycm9yX2Jhcl94X2NvbHVtbl0pLFxuICAgICAgICAgICAgICAgICAgICAgICAgW2F4aXNfeV06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKSArIHBhcnNlRmxvYXQoZGF0YXBvaW50W2Vycm9yX2Jhcl94X2NvbHVtbl0pLFxuICAgICAgICAgICAgICAgICAgICAgICAgW2F4aXNfeV06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBdXG5cbiAgICAgICAgICAgICAgICBlcnJvcl9iYXJfeF92YWx1ZXMucHVzaChlcnJvcl9iYXJfeCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmKGVycm9yX2JhcnMueSkge1xuXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coXCJZXCIpO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGRhdGFwb2ludFtheGlzX3hdKTtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvcl9iYXJfeV9jb2x1bW4pO1xuXG4gICAgICAgICAgICAgICAgbGV0IGVycm9yX2Jhcl95ID0gW1xuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSkgLSBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeV9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFtheGlzX3hdOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKVxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSkgKyBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeV9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFtheGlzX3hdOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXVxuXG4gICAgICAgICAgICAgICAgZXJyb3JfYmFyX3lfdmFsdWVzLnB1c2goZXJyb3JfYmFyX3kpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgIH0pXG5cbiAgICAgICAgaWYoZXJyb3JfYmFycy54KSBlcnJvcl9iYXJzX29iamVjdC54ID0gZXJyb3Jf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eCArIGRhdGFfcG9pbnRfeS5tYXRjaF9yYW5nZV95ID09IDIpIHtcbiAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS54LnB1c2goZGF0YV9wb2ludF94LnZhbHVlKTtcbiAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS55LnB1c2goZGF0YV9wb2ludF95LnZhbHVlKTtcblxuICAgICAgICAgICAgICAgIGlmKGhhc19lcnJvcl9iYXJzKSB7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3NlZF9kYXRhLnlfbG93LnB1c2goZGF0YS55X2xvd1tpXSk7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3NlZF9kYXRhLnlfdXAucHVzaChkYXRhLnlfdXBbaV0pO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS54X2xvdy5wdXNoKGRhdGEueF9sb3dbaV0pO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZWRfZGF0YS54X3VwLnB1c2goZGF0YS54X3VwW2ldKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgcmV0dXJuIHByb2Nlc3NlZF9kYXRhO1xuICAgIH1cblxufSIsImV4cG9ydCBjbGFzcyBMaWdodEN1cnZlUHJvY2Vzc29yIHtcblxuICAgIHN0YXRpYyBoZWFkZXJfY2FyZHMgPSBbXG4gICAgICAgICdUSU1FUkVGJyxcbiAgICAgICAgJ1RJTUVERUwnLFxuICAgICAgICAnTUpEUkVGJyxcbiAgICAgICAgJ1RTVEFSVCcsXG4gICAgICAgICdUU1RPUCcsXG4gICAgICAgICdURUxBUFNFJyxcbiAgICAgICAgJ0VfTUlOJyxcbiAgICAgICAgJ0VfTUFYJyxcbiAgICAgICAgJ0VfVU5JVCddXG5cbiAgICBzdGF0aWMgY29sdW1uc19uYW1lcyA9IHtcbiAgICAgICAgdGltZTogJ1RJTUUnLFxuICAgICAgICB0aW1lZGVsOiAnV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gICAgICAgbGlnaHRfY3VydmVfZGF0YS5lcnJvcl9iYXJzID0gdGhpcy5fcHJvY2Vzc0Vycm9yQmFyc0RhdGFKU09OKGVycm9yX2JhcnMsIGF4aXMsIGxpZ2h0X2N1cnZlX2RhdGEubWFpbik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbGlnaHRfY3VydmVfZGF0YTtcbiAgICB9XG5cbiAgICBfcHJvY2Vzc0Vycm9yQmFyc0RhdGFKU09OKGVycm9yX2JhcnMsIGF4aXMsIGRhdGEpIHtcbiAgICAgICAgbGV0IGVycm9yX2Jhcl94X3ZhbHVlcyA9IFtdO1xuICAgICAgICBsZXQgZXJyb3JfYmFyX3lfdmFsdWVzID0gW107XG5cbiAgICAgICAgbGV0IGF4aXNfeCA9IGF4aXMueDtcbiAgICAgICAgbGV0IGF4aXNfeSA9IGF4aXMueTtcblxuICAgICAgICBsZXQgZXJyb3JfYmFyX3hfY29sdW1uID0gZXJyb3JfYmFycy54O1xuICAgICAgICBsZXQgZXJyb3JfYmFyX3lfY29sdW1uID0gZXJyb3JfYmFycy55O1xuXG4gICAgICAgIGRhdGEuZm9yRWFjaChmdW5jdGlvbihkYXRhcG9pbnQpe1xuICAgICAgICAgICAgbGV0IGVycm9yX2Jhcl94ID0gW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgYm91bmQ6IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pIC0gcGFyc2VGbG9hdChkYXRhcG9pbnRbZXJyb3JfYmFyX3lfY29sdW1uXSksXG4gICAgICAgICAgICAgICAgICAgIFtheGlzX3hdOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSkgKyBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeV9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgW2F4aXNfeF06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeF0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuXG4gICAgICAgICAgICBsZXQgZXJyb3JfYmFyX3kgPSBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBib3VuZDogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc194XSkgLSBwYXJzZUZsb2F0KGRhdGFwb2ludFtlcnJvcl9iYXJfeF9jb2x1bW5dKSxcbiAgICAgICAgICAgICAgICAgICAgW2F4aXNfeV06IHBhcnNlRmxvYXQoZGF0YXBvaW50W2F4aXNfeV0pXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIGJvdW5kOiBwYXJzZUZsb2F0KGRhdGFwb2ludFtheGlzX3hdKSArIHBhcnNlRmxvYXQoZGF0YXBvaW50W2Vycm9yX2Jhcl94X2NvbHVtbl0pLFxuICAgICAgICAgICAgICAgICAgICBbYXhpc195XTogcGFyc2VGbG9hdChkYXRhcG9pbnRbYXhpc195XSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG5cbiAgICAgICAgICAgIGVycm9yX2Jhcl94X3ZhbHVlcy5wdXNoKGVycm9yX2Jhcl94KTtcbiAgICAgICAgICAgIGVycm9yX2Jhcl95X3ZhbHVlcy5wdXNoKGVycm9yX2Jhcl95KTtcbiAgICAgICAgfSlcblxuICAgICAgICByZXR1cm4ge3g6IGVycm9yX2Jhcl94X3ZhbHVlcywgeTogZXJyb3JfYmFyX3lfdmFsdWVzfVxuICAgIH1cblxuICAgIF9jaGVja0NvbHVtbnMocmVxdWlyZWRfbmJfY29sdW1ucykge1xuICAgICAgICBsZXQgaXNfY2hlY2tlZCA9IHRydWU7XG5cbiAgICAgICAgbGV0IGNvbHVtbnNfbnVtYmV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c6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IHRydWUsXG4gICAgICAgICAgICBzZWxlY3RlZDogJ2dlbmVyaWMnXG4gICAgICAgIH0sXG4gICAgICAgICdsaWdodC1jdXJ2ZS1zZXR0aW5ncyc6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IGZhbHNlLFxuICAgICAgICAgICAgJ2xpZ2h0LWN1cnZlLW9wdGlvbnMnOiB7XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgJ3NwZWN0cnVtLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogZmFsc2UsXG4gICAgICAgICAgICAnc3BlY3RydW0tb3B0aW9ucyc6IHtcblxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICAnaGR1cy1zZXR0aW5ncyc6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgICdheGlzLXNldHRpbmdzJzoge1xuICAgICAgICAgICAgZGlzcGxheTogdHJ1ZVxuICAgICAgICB9LFxuICAgICAgICAnZXJyb3ItYmFycy1zZXR0aW5ncyc6IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgJ2Jpbm5pbmctc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgICdhZGRpdGlvbmFsLWRhdGFzZXQtc2V0dGluZ3MnOiB7XG4gICAgICAgICAgICBkaXNwbGF5OiB0cnVlXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb25maWd1cmF0aW9uID0gbnVsbDtcblxuICAgIGNvbnN0cnVjdG9yKGNvbmZpZ3VyYXRpb25fb2JqZWN0ID0gbnVsbCkge1xuICAgICAgICBpZihjb25maWd1cmF0aW9uX29iamVjdCkge1xuICAgICAgICAgICAgdGhpcy5jb25maWd1cmF0aW9uID0gSlNPTi5wY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SB7XG4gICAgICAgIHRoaXMuc2V0dGluZ3NfZGF0YV90eXBlID0gZGF0YV90eXBlO1xuICAgIH1cblxuICAgIGdldERhdGFUeXBlU2V0dGluZ3MoKSB7XG4gICAgICAgIGlmKHRoaXMuc2V0dGluZ3NfZGF0YV90eXBlKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZXR0aW5nc19kYXRhX3R5cGU7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldExpZ2h0Q3VydmVTZXR0aW5ncygpIHtcblxuICAgIH1cblxuICAgIGdldFNwZWN0cnVtU2V0dGluZ3MoKSB7XG5cbiAgICB9XG5cbiAgICBzZXRIRFVzU2V0dGluZ3MoaGR1cykge1xuICAgICAgICB0aGlzLnNldHRpbmdzX2hkdXMgPSBoZHVzO1xuICAgIH1cblxuICAgIGdldEhEVXNTZXR0aW5ncygpIHtcbiAgICAgICAgaWYodGhpcy5zZXR0aW5nc19oZHVzICE9PSBudWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZXR0aW5nc19oZHVzO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXRBeGlzU2V0dGluZ3MoYXhpcykge1xuICAgICAgICB0aGlzLnNldHRpbmdzX2F4aXMgPSBheGlzO1xuICAgIH1cblxuICAgIGdldEF4aXNTZXR0aW5ncygpIHtcbiAgICAgICAgaWYodGhpcy5zZXR0aW5nc19heGlzKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZXR0aW5nc19heGlzO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXRTY2FsZXNTZXR0aW5ncyhzY2FsZXMpIHtcbiAgICAgICAgdGhpcy5zZXR0aW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XJnZWRfb2JqZWN0W2tleV0gPSBiYXNlX29iamVjdFtrZXldO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZm9yIChsZXQga2V5IGluIG1lcmdpbmdfb2JqZWN0KSB7XG4gICAgICAgICAgICBpZiAobWVyZ2luZ19vYmplY3QuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICAgIGlmKEFycmF5LmlzQXJyYXkobWVyZ2luZ19vYmplY3Rba2V5XSkpIHtcblxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWVyZ2VkX29iamVjdC5oYXNPd25Qcm9wZXJ0eShrZXkpICYmIHR5cGVvZiBtZXJnaW5nX29iamVjdFtrZXldID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICBtZXJnZWRfb2JqZWN0W2tleV0gPSBPYmplY3RVdGlscy5kZWVwX21lcmdlKG1lcmdlZF9vYmplY3Rba2V5XSwgbWVyZ2luZ19vYmplY3Rba2V5XSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbWVyZ2VkX29iamVjdFtrZXldID0gbWVyZ2luZ19vYmplY3Rba2V5XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbWVyZ2VkX29iamVjdDtcbiAgICB9XG5cbn0iLCJleHBvcnQgY2xhc3MgU3RyaW5nVXRpbHMge1xuXG4gICAgc3RhdGljIGNsZWFuRmlsZU5hbWUoc3RyKSB7XG4gICAgICAgIGlmIChzdHIuc3RhcnRzV2l0aCgnLicpIHx8IHN0ci5zdGFydHNXaXRoKCcvJykpIHtcbiAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHJpbmcoMSk7XG5cbiAgICAgICAgICAgIHJldHVybiBTdHJpbmdVdGlscy5jbGVhbkZpbGVOYW1lKHN0cik7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gc3RyO1xuICAgICAgICB9XG4gICAgfVxuXG59IiwiZXhwb3J0IGNsYXNzIEJva2VoR3JhcGgge1xuXG4gICAgY29udGFpbmVyX2lkID0gbnVsbDtcbiAgICBjb250YWluZXIgPSBudWxsO1xuXG4gICAgc3RhdGljIHBsdCA9IEJva2VoLlBsb3R0aW5nO1xuXG4gICAgc3RhdGljIHNjYWxlX2Z1bmN0aW9ucyA9IHtcbiAgICAgICAgXCJsaW5lYXJcIjogQm9rZWguTGluZWFyU2NhbGUsXG4gICAgICAgIFwibG9nXCI6IEJva2VoLkxvZ1NjYWxlXG4gICAgfVxuXG4gICAgc291cmNlID0gbnVsbDtcblxuICAgIHlfZXJyb3JfYmFyO1xuICAgIHhfZXJyb3JfYmFyO1xuXG4gICAgY29sdW1ucztcbiAgICBkYXRhX3RhYmxlO1xuXG4gICAgc3RhdGljIHN1cHBvcnRlZF90b29sX2FycmF5ID0gW1xuICAgICAgICBcInBhblwiLFxuICAgICAgICBcImJveF96b29tXCIsXG4gICAgICAgIFwid2hlZWxfem9vbVwiLFxuICAgICAgICBcImhvdmVyXCIsXG4gICAgICAgIFwiY3Jvc3NoYWlyXCIsXG4gICAgICAgIFwicmVzZXRcIixcbiAgICAgICAgXCJzYXZlXCIsXG4gICAgICAgIFwibGFzc29fc2VsZWN0XCIsXG4gICAgICAgIFwicG9seV9zZWxlY3RcIixcbiAgICAgICAgXCJ0YXBcIixcbiAgICAgICAgXCJleGFtaW5lLFwiLFxuICAgICAgICBcInVuZG9cIixcbiAgICAgICAgXCJyZWRvXCJdO1xuXG4gICAgc3RhdGljIGRlZmF1bHRfdG9vbF9hcnJheSA9IFtcbiAgICAgICAgXCJwYW5cIixcbiAgICAgICAgXCJib3hfem9vbVwiLFxuICAgICAgICBcIndoZWVsX3pvb21cIixcbiAgICAgICAgXCJob3ZlclwiLFxuICAgICAgICBcImNyb3NzaGFpclwiLFxuICAgICAgICBcInJlc2V0XCIsXG4gICAgICAgIFwic2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AgICAgICAgICAgaWYoY3VzdG9tX3JhbmdlLnggIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tX3JhbmdlLngubG93ZXJfYm91bmQgIT09IG51bGwgPyB4X2xvdy5wdXNoKGN1c3RvbV9yYW5nZS54Lmxvd2VyX2JvdW5kKSA6IHhfbG93ID0gZGF0YVsneCddO1xuICAgICAgICAgICAgICAgICAgICBjdXN0b21fcmFuZ2UueC51cHBlcl9ib3VuZCAhPT0gbnVsbCA/IHhfdXAucHVzaChjdXN0b21fcmFuZ2UueC51cHBlcl9ib3VuZCkgOiB4X3VwID0gZGF0YVsneCddO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHhfbG93ID0gZGF0YVsneCddO1xuICAgICAgICAgICAgICAgICAgICB4X3VwID0gZGF0YVsneCddO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmKGN1c3RvbV9yYW5nZS55ICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGN1c3RvbV9yYW5nZS55Lmxvd2VyX2JvdW5kICE9PSBudWxsID8geV9sb3cucHVzaChjdXN0b21fcmFuZ2UueS5sb3dlcl9ib3VuZCkgOiB5X2xvdyA9IGRhdGFbJ3knXTtcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tX3JhbmdlLnkudXBwZXJfYm91bmQgIT09IG51bGwgPyB5X3VwLnB1c2goY3VzdG9tX3JhbmdlLnkudXBwZXJfYm91bmQpIDogeV91cCA9IGRhdGFbJ3knXTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB5X2xvdyA9IGRhdGFbJ3knXTtcbiAgICAgICAgICAgICAgICAgICAgeV91cCA9IGRhdGFbJ3knXTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLnNldHVwUGxvdCh0aXRsZSwgeV9sb3csIHlfdXAsIHhfbG93LCB4X3VwKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLnNldHVwUGxvdCh0aXRsZSwgZGF0YVsneSddLCBkYXRhWyd5J10pO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLnNldHVwRGF0YSgpO1xuICAgICAgICB0aGlzLnNldHVwU2NhbGVzKHNjYWxlcyk7XG4gICAgICAgIHRoaXMuc2V0dXBMYWJlbHMobGFiZWxzKTtcblxuICAgICAgICBpZihlcnJvcl9iYXJzKSB7XG4gICAgICAgICAgICB0aGlzLnNldHVwRXJyb3JCYXJzKCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBpbml0aWFsaXplR3JhcGgoKSB7XG5cbiAgICAgICAgaWYodGhpcy5oYXNfZGF0YV90YWJsZSkge1xuICAgICAgICAgICAgQm9rZWhHcmFwaC5wbHQuc2hvdyhuZXcgQm9rZWguQ29sdW1uKHtjaGlsZHJlbjogW3AsIGRhdGFfdGFibGVdfSksIFwiI2dyYXBoLWNvbnRhaW5lclwiKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIEJva2VoR3JhcGgucGx0LnNob3codGhpcy5wbG90LCB0aGlzLmNvbnRhaW5lcl9pZCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBzZXR1cFBsb3QodGl0bGUsIHlfcmFuZ2VfbG93LCB5X3JhbmdlX3VwLCB4X3JhbmdlX2xvdyA9IG51bGwsIHhfcmFuZ2VfdXA9IG51bGwpIHtcblxuICAgICAgICBpZih4X3JhbmdlX2xvdykge1xuICAgICAgICAgICAgdGhpcy5wbG90ID0gQm9rZWhHcmFwaC5wbHQuZmlndXJlKHtcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXG4gICAgICAgICAgICAgICAgdG9vbHM6IEJva2VoR3JhcGguZGVmYXVsdF90b29sX3N0cmluZyxcbiAgICAgICAgICAgICAgICB3aWR0aDogODAwLFxuICAgICAgICAgICAgICAgIGhlaWdodDogNjAwLFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnBsb3QgPSBCb2tlaEdyYXBoLnBsdC5maWd1cmUoe1xuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcbiAgICAgICAgICAgICAgICB0b29sczogQm9rZWhHcmFwaC5kZWZhdWx0X3Rvb2xfc3RyaW5nLFxuICAgICAgICAgICAgICAgIHdpZHRoOiA4MDAsXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiA2MDAsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHNldHVwU291cmNlKGRhdGFfc291cmNlcykge1xuICAgICAgICB0aGlzLnNvdXJjZSA9IG5ldyBCb2tlaC5Db2x1bW5EYXRhU291cmNlKHtcbiAgICAgICAgICAgIGRhdGE6IGRhdGFfc291cmNlc1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBzZXR1cERhdGEoKSB7XG4gICAgICAgIGNvbnN0IGNpcmNsZXMgPSB0aGlzLnBsb3QuY2lyY2xlKHsgZmllbGQ6IFwieFwiIH0sIHsgZmllbGQ6IFwieVwiIH0sIHtcbiAgICAgICAgICAgIHNvdXJjZTogdGhpcy5zb3VyY2UsXG4gICAgICAgICAgICBzaXplOiA0LFxuICAgICAgICAgICAgZmlsbF9jb2xvcjogXCJuYXZ5XCIsXG4gICAgICAgICAgICBsaW5lX2NvbG9yOiBudWxsLFxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBzZXR1cEVycm9yQmFycygpIHtcbiAgICAgICAgdGhpcy55X2Vycm9yX2JhciA9IG5ldyBCb2tlaC5XaGlza2VyKHtcbiAgICAgICAgICAgIGRpbWVuc2lvbjogXCJoZWlnaHRcIixcbiAgICAgICAgICAgIHNvdXJjZTogdGhpcy5zb3VyY2UsXG4gICAgICAgICAgICBiYXNlOiB7ZmllbGQ6IFwieFwifSxcbiAgICAgICAgICAgIGxvd2VyOiB7ZmllbGQ6IFwieV9sb3dcIn0sXG4gICAgICAgICAgICB1cHBlcjoge2ZpZWxkOiBcInlfdXBcIn0sXG4gICAgICAgICAgICBsaW5lX2NvbG9yOiBcIm5hdnlcIixcbiAgICAgICAgICAgIGxvd2VyX2hlYWQ6IG51bGwsXG4gICAgICAgICAgICB1cHBlcl9oZWFkOiBudWxsLFxuICAgICAgICB9KTtcblxuICAgICAgICB0aGlzLnhfZXJyb3JfYmFyID0gbmV3IEJva2VoLldoaXNrZXIoe1xuICAgICAgICAgICAgZGltZW5zaW9uOiBcIndpZHRoXCIsXG4gICAgICAgICAgICBzb3VyY2U6IHRoaXMuc291cmNlLFxuICAgICAgICAgICAgYmFzZToge2ZpZWxkOiBcInlcIn0sXG4gICAgICAgICAgICBsb3dlcjoge2ZpZWxkOiBcInhfbG93XCJ9LFxuICAgICAgICAgICAgdXBwZXI6IHtmaWVsZDogXCJ4X3VwXCJ9LFxuICAgICAgICAgICAgbGluZV9jb2xvcjogXCJuYXZ5XCIsXG4gICAgICAgICAgICBsb3dlcl9oZWFkOiBudWxsLFxuICAgICAgICAgICAgdXBwZXJfaGVhZDogbnVsbCxcbiAgICAgICAgfSk7XG5cbiAgICAgICAgdGhpcy5wbG90LmFkZF9sYXlvdXQodGhpcy55X2Vycm9yX2Jhcik7XG4gICAgICAgIHRoaXMucGxvdC5hZGRfbGF5b3V0KHRoaXMueF9lcnJvcl9iYXIpO1xuICAgIH1cblxuICAgIHNldHVwU2NhbGVzIChzY2FsZXMpIHtcbiAgICAgICAgaWYoc2NhbGVzKSB7XG4gICAgICAgICAgICB0aGlzLnBsb3QueF9zY2FsZSA9IG5ldyBCb2tlaEdyYXBoLnNjYWxlX2Z1bmN0aW9uc1tzY2FsZXMueF0oKTtcbiAgICAgICAgICAgIHRoaXMucGxvdC55X3NjYWxlID0gbmV3IEJva2VoR3JhcGguc2NhbGVfZnVuY3Rpb25zW3NjYWxlcy55XSgpO1xuICAgICA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ICAgICAgICAgIHNjYWxlcyA9IEQzR3JhcGguZGVmYXVsdF9zY2FsZXMsXG4gICAgICAgICAgICAgICAgICAgICAgIGVycm9yX2JhcnMgPSBudWxsLFxuICAgICAgICAgICAgICAgICAgICAgICBoYXNfbGluZSA9IGZhbHNlLFxuICAgICAgICAgICAgICAgICAgICAgICBhZGRpdGlvbmFsX3Bsb3RzID0gbnVsbCkge1xuXG4gICAgICAgIGxldCBpc19zZXQgPSBmYWxzZTtcblxuICAgICAgICB0cnkge1xuXG4gICAgICAgICAgICB0aGlzLmRhdGFzZXQgPSBkYXRhO1xuXG4gICAgICAgICAgICB0aGlzLnhfYXhpc19kYXRhX2NvbCA9IGF4aXNbJ3gnXTtcbiAgICAgICAgICAgIHRoaXMueV9heGlzX2RhdGFfY29sID0gYXhpc1sneSddO1xuXG4gICAgICAgICAgICB0aGlzLnhfc2NhbGVfdHlwZSA9IHNjYWxlc1sneCddO1xuICAgICAgICAgICAgdGhpcy55X3NjYWxlX3R5cGUgPSBzY2FsZXNbJ3knXTtcblxuICAgICAgICAgICAgaWYoZXJyb3JfYmFycykge1xuICAgICAgICAgICAgICAgIHRoaXMuaGFzX2Vycm9yX2JhcnMgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JfYmFycyA9IGVycm9yX2JhcnM7XG5cbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvcl9iYXJzKTtcblxuICAgICAgICAgICAgICAgIHRoaXMueF9heGlzX2RhdGFfY29sX2Vycm9yX2JhciA9IGF4aXNbJ3gnXS52YWx1ZTtcbiAgICAgICAgICAgICAgICB0aGlzLnlfYXhpc19kYXRhX2NvbF9lcnJvcl9iYXIgPSBheGlzWyd5J10udmFsdWU7XG5cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5oYXNfZXJyb3JfYmFycyA9IGZhbHNlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoYWRkaXRpb25hbF9wbG90cykge1xuICAgICAgICAgICAgICAgIHRoaXMuaGFzX211bHRpcGxlX3Bsb3RzID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0aGlzLmFkZGl0aW9uYWxfcGxvdHMgPSBbXTtcblxuICAgICAgICAgICAgICAgIGxldCBhZGRpdGlvbmFsX3Bsb3RzX3RlbXAgPSBbXTtcbiAgICAgICAgICAgICAgICBhZGRpdGlvbmFsX3Bsb3RzLmZvckVhY2goZnVuY3Rpb24gKHBsb3QpIHtcbiAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbF9wbG90c190ZW1wLnB1c2gocGxvdCk7XG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICB0aGlzLmFkZGl0aW9uYWxfcGxvdHMgPSBhZGRpdGlvbmFsX3Bsb3RzX3RlbXA7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRoaXMuaGFzX2xpbmUgPSBoYXNfbGluZTtcblxuICAgICAgICAgICAgaXNfc2V0ID0gdHJ1ZTtcblxuICAgICAgICB9IGNhdGNoKGUpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKFwiRXJyb3IgZHVyaW5nIGdyYXBoIHNldHRpbmdzIHByb2Nlc3NcIilcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpc19zZXQ7XG4gICAgfVxuXG4gICAgaW5pdGlhbGl6ZUdyYXBoKCkge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgdGhpcy5fc2V0U1ZHQ29udGFpbmVyKCk7XG5cbiAgICAgICAgICAgIHRoaXMuX3NldFhTY2FsZSgpO1xuICAgICAgICAgICAgdGhpcy5fc2V0WVNjYWxlKCk7XG5cbiAgICAgICAgICAgIHRoaXMuX3NldFhBeGlzKCk7XG4gICAgICAgICAgICB0aGlzLl9zZXRYQXhpc0xhYmVsKCk7XG5cbiAgICAgICAgICAgIHRoaXMuX3NldFlBeGlzKCk7XG4gICAgICAgICAgICB0aGl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dGhcIilcbiAgICAgICAgICAgIC5hdHRyKFwiaWRcIiwgXCJjbGlwXCIpXG4gICAgICAgICAgICAuYXBwZW5kKFwiU1ZHOnJlY3RcIilcbiAgICAgICAgICAgIC5hdHRyKFwid2lkdGhcIiwgdGhpcy53aWR0aCApXG4gICAgICAgICAgICAuYXR0cihcImhlaWdodFwiLCB0aGlzLmhlaWdodCApXG4gICAgICAgICAgICAuYXR0cihcInhcIiwgMClcbiAgICAgICAgICAgIC5hdHRyKFwieVwiLCAwKTtcblxuICAgICAgICB0aGlzLnBsb3QgPSB0aGlzLnN2Zy5hcHBlbmQoJ2cnKVxuICAgICAgICAgICAgLmF0dHIoXCJjbGlwLXBhdGhcIiwgXCJ1cmwoI2NsaXApXCIpXG4gICAgICAgICAgICAuYXR0cihcImlkXCIsIFwiZGF0YS1wbG90XCIpXG5cbiAgICAgICAgdGhpcy5wbG90XG4gICAgICAgICAgICAuc2VsZWN0QWxsKFwiY2lyY2xlXCIpXG4gICAgICAgICAgICAuZGF0YSh0aGlzLmRhdGFzZXQpXG4gICAgICAgICAgICAuZW50ZXIoKVxuICAgICAgICAgICAgLmFwcGVuZChcImNpcmNsZVwiKVxuICAgICAgICAgICAgLmF0dHIoXCJjeFwiLCBmdW5jdGlvbiAoZCkgeyByZXR1cm4geChkW3hfY29sX2RhdGFdKTsgfSApXG4gICAgICAgICAgICAuYXR0cihcImN5XCIsIGZ1bmN0aW9uIChkKSB7IHJldHVybiB5KGRbeV9jb2xfZGF0YV0pOyB9IClcbiAgICAgICAgICAgIC5hdHRyKFwiclwiLCA0KVxuICAgICAgICAgICAgLnN0eWxlKFwiZmlsbFwiLCBcInRyYW5zcGFyZW50XCIpXG4gICAgICAgICAgICAuc3R5bGUoXCJzdHJva2VcIiwgXCJibGFja1wiKVxuICAgICAgICAgICAgLnN0eWxlKFwib3BhY2l0eVwiLCAxKVxuICAgIH1cblxuICAgIF9zZXRBZGRpdGlvbmFsUGxvdHMoKSB7XG4gICAgICAgIGxldCBwbG90O1xuICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgdGhpcy5hZGRpdGlvbmFsX3Bsb3RzLmxlbmd0aCwgaSsrOykge1xuICAgICAgICAgICAgcGxvdCA9IHRoaXMuYWRkaXRpb25hbF9wbG90c1tpXTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIF9zZXRFcnJvckJhcnMoZXJyb3JfYmFycykge1xuXG4gICAgICAgIHRoaXMuZXJyb3JfYmFycyA9IGVycm9yX2JhcnM7XG5cbiAgICAgICAgaWYoZXJyb3JfYmFycy55KSB7XG4gICAgICAgICAgICBsZXQgbGluZV9lcnJvcl9iYXJfeCA9IGQzLmxpbmUoKVxuICAgICAgICAgICAgICAgIC54KGQgPT4gdGhpcy54X3NjYWxlKGRbdGhpcy54X2F4aXNfZGF0YV9jb2xdKSlcbiAgICAgICAgICAgICAgICAueShkID0+IHRoaXMueV9zY2FsZShkLmJvdW5kKSk7XG5cbiAgICAgICAgICAgIGVycm9yX2JhcnMueS5mb3JFYWNoKChlcnJvcl9iYXIpID0+IHtcbiAgICAgICAgICAgICAgICBkMy5zZWxlY3QoJyNkYXRhLXBsb3QnKS5hcHBlbmQoXCJwYXRoXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwiY2xhc3NcIiwgXCJlcnJvci1iYXIteFwiKVxuICAgICAgICAgICAgICAgICAgICAuYXR0cihcImZpbGxcIiwgXCJub25lXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlXCIsIFwic3RlZWxibHVlXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlLXdpZHRoXCIsIDEuNSlcbiAgICAgICAgICAgICAgICAgICAgLmF0dHIoXCJkXCIsIGxpbmVfZXJyb3JfYmFyX3goZXJyb3JfYmFyKSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG5cbiAgICAgICAgaWYoZXJyb3JfYmFycy54KSB7XG4gICAgICAgICAgICBsZXQgbGluZV9lcnJvcl9iYXJfeSA9IGQzLmxpbmUoKVxuICAgICAgICAgICAgICAgIC54KGQgPT4gdGhpcy54X3NjYWxlKGQuYm91bmQpKVxuICAgICAgICAgICAgICAgIC55KGQgPT4gdGhpcy55X3NjYWxlKGRbdGhpcy55X2F4aXNfZGF0YV9jb2xdKSk7XG5cbiAgICAgICAgICAgIGVycm9yX2JhcnMueC5mb3JFYWNoKChlcnJvcl9iYXIpID0+IHtcbiAgICAgICAgICAgICAgICBkMy5zZWxlY3QoJyNkYXRhLXBsb3QnKS5hcHBlbmQoXCJwYXRoXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwiY2xhc3NcIiwgXCJlcnJvci1iYXIteFwiKVxuICAgICAgICAgICAgICAgICAgICAuYXR0cihcImZpbGxcIiwgXCJub25lXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlXCIsIFwic3RlZWxibHVlXCIpXG4gICAgICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlLXdpZHRoXCIsIDEuNSlcbiAgICAgICAgICAgICAgICAgICAgLmF0dHIoXCJkXCIsIGxpbmVfZXJyb3JfYmFyX3koZXJyb3JfYmFyKSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgX3NldEF4aXNMaW5lKCkge1xuICAgICAgICBsZXQgbGluZSA9IGQzLmxpbmUoKVxuICAgICAgICAgICAgLmN1cnZlKGQzLmN1cnZlQ2F0bXVsbFJvbSlcbiAgICAgICAgICAgIC54KGQgPT4gdGhpcy54X2F4aXMoZFt0aGlzLnhfYXhpc19kYXRhX2NvbF0pKVxuICAgICAgICAgICAgLnkoZCA9PiB0aGlzLnlfYXhpcyhkW3RoaXMueV9heGlzX2RhdGFfY29sXSkpO1xuXG4gICAgICAgIHRoaXMubGluZV9jb250YWluZXIgPSB0aGlzLnN2Zy5hcHBlbmQoXCJnXCIpXG4gICAgICAgICAgICAuYXR0cihcImlkXCIsI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pY2sgbGluZVwiKS5jbG9uZSgpXG4gICAgICAgICAgICAuYXR0cihcImNsYXNzXCIsIFwidGljay1saW5lXCIpXG4gICAgICAgICAgICAuYXR0cihcIngyXCIsIHRoaXMud2lkdGgpXG4gICAgICAgICAgICAuYXR0cihcInN0cm9rZS1vcGFjaXR5XCIsIDAuMilcblxuICAgICAgICB0aGlzLl9zZXRYQXhpc0xhYmVsKCk7XG4gICAgICAgIHRoaXMuX3NldFlBeGlzTGFiZWwoKTtcblxuICAgICAgICBsZXQgeF9kYXRhX2NvbCA9IHRoaXMueF9heGlzX2RhdGFfY29sO1xuICAgICAgICBsZXQgeV9kYXRhX2NvbCA9IHRoaXMueV9heGlzX2RhdGFfY29sO1xuXG4gICAgICAgIHRoaXMuc3ZnLnNlbGVjdEFsbChcImNpcmNsZVwiKVxuICAgICAgICAgICAgLmRhdGEodGhpcy5kYXRhc2V0KVxuICAgICAgICAgICAgLnRyYW5zaXRpb24oKVxuICAgICAgICAgICAgLmR1cmF0aW9uKDE1MClcbiAgICAgICAgICAgIC5hdHRyKFwiY3hcIiwgZnVuY3Rpb24gKGQpIHsgcmV0dXJuIHJlc2NhbGVkX3goZFt4X2RhdGFfY29sXSk7IH0gKVxuICAgICAgICAgICAgLmF0dHIoXCJjeVwiLCBmdW5jdGlvbiAoZCkgeyByZXR1cm4gcmVzY2FsZWRfeShkW3lfZGF0YV9jb2xdKTsgfSApXG5cbiAgICAgICAgaWYodGhpcy5oYXNfbGluZSkge1xuICAgICAgICAgICAgdGhpcy5zdmcuc2VsZWN0QWxsKFwicGF0aFwiKS5yZW1vdmUoKTtcbiAgICAgICAgICAgIHRoaXMuX3NldEF4aXNMaW5lKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZih0aGlzLmhhc19lcnJvcl9iYXJzKSB7XG5cbiAgICAgICAgICAgIGlmKHRoaXMuZXJyb3JfYmFycy55KSB7XG4gICAgICAgICAgICAgICAgbGV0IGxpbmVfZXJyb3JfYmFyX3ggPSBkMy5saW5lKClcbiAgICAgICAgICAgICAgICAgICAgLngoZCA9PiByZXNjYWxlZF94KGRbdGhpcy54X2F4aXNfZGF0YV9jb2xdKSlcbiAgICAgICAgICAgICAgICAgICAgLnkoZCA9PiByZXNjYWxlZF95KGQuYm91bmQpKTtcblxuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JfYmFycy55LmZvckVhY2goKGVycm9yX2JhcikgPT4ge1xuICAgICAgICAgICAgICAgICAgICBkMy5zZWxlY3QoJyNkYXRhLXBsb3QnKS5hcHBlbmQoXCJwYXRoXCIpXG4gICAgICAgICAgICAgICAgICAgICAgICAuYXR0cihcImNsYXNzXCIsIFwiZXJyb3ItYmFyLXhcIilcbiAgICAgICAgICAgICAgICAgICAgICAgIC5hdHRyKFwiZmlsbFwiLCBcIm5vbmVcIilcbiAgICAgICAgICAgICAgICAgICAgICAgIC5hdHRyKFwic3Ryb2tlXCIsIFwic3RlZWxibHVlXCIpXG4gICAgICAgICAgICAgICAgICAgICAgICAuYXR0cihcInN0cm9rZS13aWR0aFwiLCAxLjUpXG4gICAgICAgICAgICAgICAgICAgICAgICAuYXR0cihcImRcIiwgbGluZV9lcnJvcl9iYXJfeChlcnJvcl9iYXIpKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZih0aGlzLmVycm9yX2JhcnMueCkge1xuICAgICAgICAgICAgICAgIGxldCBsaW5lX2Vycm9yX2Jhcl95ID0gZDMubGluZSgpXG4gICAgICAgICAgICAgICAgICAgIC54KGQgPT4gcmVzY2FsZWRfeChkLmJvdW5kKSlcbiAgICAgICAgICAgICAgICAgICAgLnkoZCA9PiByZXNjYWxlZF95KGRbdGhpcy55X2F4aXNfZGF0YV9jb2xdKSk7XG5cbiAgICAgICAgICAgICAgICB0aGlzLmVycm9yX2JhcnMueC5mb3JFYWNoKChlcnJvcl9iYXIpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgZDMuc2VsZWN0KCcjZGF0YS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gICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGhhbmRsZVZpc3VhbGl6YXRpb25HZW5lcmF0aW9uRXZlbnQoZXZlbnQpIHtcbiAgICAgICAgdGhpcy5zZXR0aW5nc19vYmplY3QgPSBldmVudC5kZXRhaWwuc2V0dGluZ3Nfb2JqZWN0O1xuXG4gICAgICAgIGxldCBsaWJyYXJ5X3NldHRpbmdzID0gdGhpcy5zZXR0aW5nc19vYmplY3QuZ2V0TGlicmFyeVNldHRpbmdzKCk7XG5cbiAgICAgICAgaWYobGlicmFyeV9zZXR0aW5ncy5saWJyYXJ5ID09PSBCb2tlaFdyYXBwZXIubGlicmFyeSkge1xuXG4gICAgICAgICAgICB0aGlzLl9yZXNldENvbnRhaW5lcigpO1xuXG4gICAgICAgICAgICBsZXQgZGF0YXNldF9zZXR0aW5ncyA9IHt9O1xuXG4gICAgICAgICAgICBsZXQgYXhpcyA9IHRoaXMuc2V0dGluZ3Nfb2JqZWN0LmdldEF4aXNTZXR0aW5ncygpO1xuICAgICAgICAgICAgbGV0IGF4aXNfc2V0dGluZ3MgPSBbXTtcblxuICAgICAgICAgICAgZm9yKGxldCBheGlzX2NvbHVtbiBpbiBheGlzKSB7XG4gICAgICAgICAgICAgICAgbGV0IGF4aXNfY29sdW1uX29iamVjdCA9IHRoaXMuX2dldENvbHVtblNldHRpbmdzKGF4aXNbYXhpc19jb2x1bW5dKTtcbiAgICAgICAgICAgICAgICBheGlzX2NvbHVtbl9vYmplY3QgPSB7Li4uYXhpc19jb2x1bW5fb2JqZWN0LCAuLi57YXhpczogYXhpc19jb2x1bW59fVxuXG4gICAgICAgICAgICAgICAgYXhpc19zZXR0aW5ncy5wdXNoKGF4aXNfY29sdW1uX29iamVjdCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGRhdGFzZXRfc2V0dGluZ3MuYXhpcyA9IGF4aXNfc2V0dGluZ3M7XG4gICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzLmRhdGFfdHlwZSA9IHRoaXMuc2V0dGluZ3Nfb2JqZWN0LmdldERhdGFUeXBlU2V0dGluZ3MoKTtcblxuICAgICAgICAgICAgbGV0IGVycm9yX2JhcnMgPSB0aGlzLnNldHRpbmdzX29iamVjdC5nZXRFcnJvckJhcnNTZXR0aW5ncygpO1xuICAgICAgICAgICAgbGV0IGhhc19lcnJvcl9iYXJzID0gZmFsc2U7XG5cbiAgICAgICAgICAgIGlmKGVycm9yX2JhcnMgIT09IG51bGwpIHtcblxuICAgICAgICAgICAgICAgIGxldCBlcnJvcl9iYXJzX3NldHRpbmdzID0gW107XG4gICAgICAgICAgICAgICAgZm9yKGxldCBheGlzX2NvbHVtbiBpbiBlcnJvcl9iYXJzKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBheGlzX2NvbHVtbl9vYmplY3QgPSB0aGlzLl9nZXRDb2x1bW5TZXR0aW5ncyhlcnJvcl9iYXJzW2F4aXNfY29sdW1uXSk7XG4gICAgICAgICAgICAgICAgICAgIGF4aXNfY29sdW1uX29iamVjdCA9IHsuLi5heGlzX2NvbHVtbl9vYmplY3QsIC4uLntheGlzOiBheGlzX2NvbHVtbn19XG5cbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfYmFyc19zZXR0aW5ncy5wdXNoKGF4aXNfY29sdW1uX29iamVjdCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgZGF0YXNldF9zZXR0aW5ncy5lcnJvcl9iYXJzID0gZXJyb3JfYmFyc19zZXR0aW5ncztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbGV0IGRwcCA9IERhdGFQcm9jZXNzb3JDb250YWluZXIuZ2V0RGF0YVByb2Nlc3NvckNvbnRhaW5lcigpLmdldERhdGFQcmVQcm9jZXNzb3IoKTtcblxuICAgICAgICAgICAgbGV0IHByb2Nlc3NlZF9kYXRhID0gZHBwLmdldFByb2Nlc3NlZERhdGFzZXQoZGF0YXNldF9zZXR0aW5ncyk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Y2F0aW9uWzFdIDogJyc7XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGZpbGVfaWQ6IGZpbGVfaWQsXG4gICAgICAgICAgICBoZHVfaW5kZXg6IGhkdV9pbmRleCxcbiAgICAgICAgICAgIGNvbHVtbl9uYW1lOiBjb2x1bW5fbmFtZVxuICAgICAgICB9O1xuICAgIH1cblxuICAgIF9wcm9jZXNzRXJyb3JCYXJEYXRhKGRhdGEsIGFzeW1ldHJpY191bmNlcnRhaW50aWVzID0gZmFsc2UpIHtcblxuICAgICAgICBsZXQgZGl2X2ZhY3Rvcj0gMjtcblxuICAgICAgICBpZihhc3ltZXRyaWNfdW5jZXJ0YWludGllcykge1xuICAgICAgICAgICAgZGl2X2ZhY3RvciA9IDE7XG4gICAgICAgIH1cblxuICAgICAgICBpZihkYXRhLmR4KSB7XG4gICAgICAgICAgICBsZXQgeF9sb3cgPSBbXTtcbiAgICAgICAgICAgIGxldCB4X3VwID0gW107XG5cbiAgICAgICAgICAgIGZvcihsZXQgaSBpbiBkYXRhLmR4KSB7XG4gICAgICAgICAgICAgICAgeF9sb3dbaV0gPSBkYXRhLnhbaV0gLSBkYXRhLmR4W2ldIC8gZGl2X2ZhY3RvcjtcbiAgICAgICAgICAgICAgICB4X3VwW2ldID0gZGF0YS54W2ldICsgZGF0YS5keFtpXSAvIGRpdl9mYWN0b3I7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGRhdGEueF9sb3cgPSB4X2xvdztcbiAgICAgICAgICAgIGRhdGEueF91cCA9IHhfdXA7XG5cbiAgICAgICAgICAgIGRlbGV0ZSBkYXRhLmR4O1xuICAgICAgICB9XG5cbiAgICAgICAgaWYoZGF0YS5keSkge1xuICAgICAgICAgICAgbGV0IHlfbG93ID0gW107XG4gICAgICAgICAgICBsZXQgeV91cCA9IFtdO1xuXG4gICAgICAgICAgICBmb3IobGV0IGkgaW4gZGF0YS5keSkge1xuICAgICAgICAgICAgICAgIHlfbG93W2ldID0gZGF0YS55W2ldIC0gZGF0YS5keVtpXTtcbiAgICAgICAgICAgICAgICB5X3VwW2ldID0gZGF0YS55W2ldICsgZGF0YS5keVtpXTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZGF0YS55X2xvdyA9IHlfbG93O1xuICAgICAgICAgICAgZGF0YS55X3VwID0geV91cDtcblxuICAgICAgICAgICAgZGVsZXRlIGRhdGEuZHk7XG5cbiAgICAgICAgfVxuXG4gICAgICAgIC8qXG4gICAgICAgIGxldCB5X2xvdyA9IFtdLCB5X3VwID0gW10sIHhfbG93ID0gW10sIHhfdXAgPSBbXTtcblxuICAgICAgICBmb3IgKGxldCBpIGluIGRhdGEuZHkpIHtcbiAgICAgICAgICAgIHlfbG93W2ldID0gZGF0YS55W2ldIC0gZGF0YS5keVtpXTtcbiAgICAgICAgICAgIHlfdXBbaV0gPSBkYXRhLnlbaV0gKyBkYXRhLmR5W2ldO1xuICAgICAgICAgICAgeF9sb3dbaV0gPSBkYXRhLnhbaV0gLSBkYXRhLmR4W2ldIC8gZGl2X2ZhY3RvcjtcbiAgICAgICAgICAgIHhfdXBbaV0gPSBkYXRhLnhbaV0gKyBkYXRhLmR4W2ldIC8gZGl2X2ZhY3RvcjtcbiAgICAgICAgfVxuXG4gICAgICAgIGRhdGEueV9sb3cgPSB5X2xvdztcbiAgICAgICAgZGF0YS55X3VwID0geV91cDtcbiAgICAgICAgZGF0YS54X2xvdyA9IHhfbG93O1xuICAgICAgICBkYXRhLnhfdXAgPSB4X3VwO1xuXG4gICAgICAgIGRlbGV0ZSBkYXRhLmR5O1xuICAgICAgICBkZWxldGUgZGF0YS5keDtcbiAgICAgICAgKi9cblxuICAgICAgICByZXR1cm4gZGF0YTtcbiAgICB9XG5cbiAgICBjcmVhdGVDb25maWd1cmF0aW9uT2JqZWN0KCkge1xuICAgICAgICB0aGlzLmNvbmZpZ3VyYXRpb25fb2JqZWN0ID0gU2V0dGluZ3NDb25maWd1cmF0aW9uLmdldENvbmZp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kYXRhc2V0X3NldHRpbmdzLmRhdGFfdHlwZSA9IGRhdGFfdHlwZTtcblxuICAgICAgICAgICAgbGV0IGF4aXNfc2V0dGluZ3MgPSBbXTtcbiAgICAgICAgICAgIGZvcihsZXQgYXhpc19jb2x1bW4gaW4gYXhpcykge1xuICAgICAgICAgICAgICAgIGxldCBheGlzX2NvbHVtbl9vYmplY3QgPSB0aGlzLl9nZXRDb2x1bW5TZXR0aW5ncyhheGlzW2F4aXNfY29sdW1uXSk7XG4gICAgICAgICAgICAgICAgYXhpc19jb2x1bW5fb2JqZWN0ID0gey4uLmF4aXNfY29sdW1uX29iamVjdCwgLi4ue2F4aXM6IGF4aXNfY29sdW1ufX1cblxuICAgICAgICAgICAgICAgIGF4aXNfc2V0dGluZ3MucHVzaChheGlzX2NvbHVtbl9vYmplY3QpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBkYXRhc2V0X3NldHRpbmdzLmF4aXMgPSBheGlzX3NldHRpbmdzO1xuXG4gICAgICAgICAgICBpZihlcnJvcl9iYXJzICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaGFzX2Vycm9yX2JhcnMgPSB0cnVlO1xuXG4gICAgICAgICAgICAgICAgbGV0IGVycm9yX2JhcnNfc2V0dGluZ3MgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IobGV0IGF4aXNfY29sdW1uIGluIGVycm9yX2JhcnMpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGF4aXNfY29sdW1uX29iamVjdCA9IHRoaXMuX2dldENvbHVtblNldHRpbmdzKGVycm9yX2JhcnNbYXhpc19jb2x1bW5dKTtcbiAgICAgICAgICAgICAgICAgICAgYXhpc19jb2x1bW5fb2JqZWN0ID0gey4uLmF4aXNfY29sdW1uX29iamVjdCwgLi4ue2F4aXM6IGF4aXNfY29sdW1ufX1cblxuICAgICAgICAgICAgICAgICAgICBlcnJvcl9iYXJzX3NldHRpbmdzLnB1c2goYXhpc19jb2x1bW5fb2JqZWN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blxuICAgICAgICAgICAgaWYocmFuZ2VzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBsZXQgY3VzdG9tX3JhbmdlX2RhdGEgPSBudWxsO1xuXG4gICAgICAgICAgICAgICAgaWYoaGFzX2Vycm9yX2JhcnMpIHtcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tX3JhbmdlX2RhdGEgPSBkcHAucHJvY2Vzc0RhdGFGb3JSYW5nZShyYW5nZXMsIHByb2Nlc3NlZF9qc29uX2RhdGEsIGVycm9yX2JhcnMpO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZWRfanNvbl9kYXRhID0gY3VzdG9tX3JhbmdlX2RhdGEuZGF0YTtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfYmFycyA9IGN1c3RvbV9yYW5nZV9kYXRhLmVycm9yX2JhcnM7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY3VzdG9tX3JhbmdlX2RhdGEgPSBkcHAucHJvY2Vzc0RhdGFGb3JSYW5nZShyYW5nZXMsIHByb2Nlc3NlZF9qc29uX2RhdGEpO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZWRfanNvbl9kYXRhID0gY3VzdG9tX3JhbmdlX2RhdGEuZGF0YTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGxldCB2aXN1YWxpemF0aW9uID0gVmlzdWFsaXphdGlvbkNvbnRhaW5lci5nZXREM1Zpc3VhbGl6YXRpb24oKTtcblxuICAgICAgICAgICAgdmlzdWFsaXphdGlvbi5pbml0aWFsaXplU2V0dGluZ3MocHJvY2Vzc2VkX2pzb25fZGF0YSwgYXhpcywgc2NhbGVzLCBlcnJvcl9iYXJzLCBmYWxzZSwgbnVsbCk7XG4gICAgICAgICAgICB2aXN1YWxpemF0aW9uLmluaXRpYWxpemVHcmFwaCgpO1xuICAgICAgICB9XG5cbiAgICB9XG5cbiAgICBfc2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BhdGgpIHtcbiAgICAgICAgaWYoRklUU1JlYWRlcldyYXBwZXIuaXNfcGF0aF92YWxpZChmaWxlX3BhdGgpKSB7XG4gICAgICAgICAgICB0aGlzLmZpbGVfcGF0aCA9IGZpbGVfcGF0aDtcbiAgICAgICAgICAgIHRoaXMuX2dldEZpbGUoKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEludmFsaWRVUkxFcnJvcihcIkludmFsaWQgZmlsZSBwYXRoIDogXCIgKyBmaWxlX3BhdGgpO1xuICAgICAgICB9XG5cbiAgICB9XG5cbiAgICBpbml0aWFsaXplRnJvbUJ1ZmZlcihhcnJheV9idWZmZXIsIGZpbGVfbmFtZSkge1xuICAgICAgICB0aGlzLmZpbGVfcGF0aCA9IGZpbGVfbmFtZTtcbiAgICAgICAgdGhpcy5fcmVhZEZpbGUoYXJyYXlfYnVmZmVyKTtcbiAgICB9XG5cbiAgICBfZ2V0RmlsZSgpIHtcblxuICAgICAgICByZXR1cm4gZmV0Y2godGhpcy5maWxlX3BhdGgpXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlLm9rKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgSFRUUCBlcnJvciwgc3RhdHVzID0gJHtyZXNwb25zZS5zdGF0dXN9YCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiByZXNwb25zZS5hcnJheUJ1ZmZlcigpO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC50aGVuKChidWZmZXIpID0+IHRoaXMuX3JlYWRGaWxlKGJ1ZmZlcikpO1xuICAgIH1cblxuICAgIF9yZWFkRmlsZShhcnJheUJ1ZmZlcikge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgdGhpcy5maWxlID0gd2luZG93LkZJVFNSZWFkZXIucGFyc2VGSVRTKGFycmF5QnVmZmVyKTtcblxuICAgICAgICAgICAgdGhpcy5zZW5kRklUU0xvYWRlZEV2ZW50cygpO1xuXG4gICAgICAgIH0gY2F0Y2goZSkge1xuICAgICAgICAgICAgY29uc29sZS5sb2coXCJFcnJvciBpbml0aWFsaXppbmcgaW50ZXJmYWNlXCIpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBnZXRGaWxlUGF0aCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZmlsZV9wYXRoO1xuICAgIH1cblxuICAgIHNldEZpbGUoZmlsZSkge1xuICAgICAgICB0aGlzLmZpbGUgPSBmaWxlO1xuICAgIH1cblxuICAgIHNldEZpbGVGcm9tRmlsZU9iamVjdChmaWxlX29iamVjdCkge1xuICAgICAgICB0aGlzLmZpbGUgPSBmaWxlX29iamVjdC5maWxlO1xuICAgICAgICB0aGlzLmFyZl9maWxlID0gZmlsZV9vYmplY3QuYXJmX2ZpbGVfaWQ7XG4gICAgICAgIHRoaXMucm1mX2ZpbGUgPSBmaWxlX29iamVjdC5ybWZfZmlsZV9pZDtcbiAgICB9XG5cbiAgICBnZXRIRFUoaGR1X2luZGV4KSB7XG4gICAgICAgIGlmKGhkdV9pbmRleCA+PSAwICYmIGhkdV9pbmRleCA8IHRoaXMuZmlsZS5oZHVzLmxlbmd0aCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsZS5oZHVzW2hkdV9pbmRleF07XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldEhEVXMoKSB7XG5cbiAgICAgICAgbGV0IEhEVXMgPSBbXTtcbiAgICAgICAgbGV0IGhkdV9vYmplY3Q7XG4gICAgICAgIGxldCB0eXBlO1xuICAgICAgICBsZXQgZXh0bmFtZSA9ICcnO1xuXG4gICAgICAgIHRoaXMuZmlsZS5oZHVzLmZvckVhY2goZnVuY3Rpb24oaGR1LCBpbmRleCkge1xuXG4gICAgICAgICAgICBpZiAoaGR1LmhlYWRlci5wcmltYXJ5ID09PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgdHlwZSA9IFwiUFJJTUFSWVwiO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0eXBlID0gaGR1LmhlYWRlci5nZXQoJ1hURU5TSU9OJyk7XG4gICAgICAgICAgICAgICAgZXh0bmFtZSA9IGhkdS5oZWFkZXIuZ2V0KCdFWFROQU1FJyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGhkdV9vYmplY3QgPSB7XG4gICAgICAgICAgICAgICAgXCJuYW1lXCI6IHR5cGUsXG4gICAgICAgICAgICAgICAgXCJpbmRleFwiOiBpbmRleCxcbiAgICAgICAgICAgICAgICBcImV4dG5hbWVcIjogZXh0bmFtZVxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgSERVcy5wdXNoKGhkdV9vYmplY3QpO1xuICAgICAgICB9KVxuXG4gICAgICAgIHJldHVybiBIRFVzO1xuICAgIH1cblxuICAgIGdldFRhYnVsYXJIRFVzKCkge1xuICAgICAgICBsZXQgdGFidWxhcl9oZHVzX2luZGV4ID0gW107XG5cbiAgICAgICAgdGhpcy5maWxlLmhkdXMuZm9yRWFjaChmdW5jdGlvbihoZHUsIGluZGV4KSB7XG4gICAgICAgICAgICBpZiAoaGR1LmhlYWRlci5wcmltYXJ5ICE9PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgaWYoaGR1LmhlYWRlci5nZXQoJ1hURU5TSU9OJykgPT09IFwiVEFCTEVcIiB8fCBoZHUuaGVhZGVyLmdldCgnWFRFTlNJT04nKSA9PT0gXCJCSU5UQUJMRVwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHRhYnVsYXJfaGR1c19pbmRleC5wdXNoKGluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgcmV0dXJuIHRhYnVsYXJfaGR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ZGF0YS5nZXRDb2x1bW4oY29sdW1uLCBmdW5jdGlvbiAoY29sKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5fZGF0YSA9IGNvbDtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9IGNhdGNoKGUpIHtcblxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJhd19jb2x1bW5zX2RhdGFfYXJyYXlbY29sdW1uXSA9IGNvbHVtbl9kYXRhO1xuICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgbGV0IGNvbHVtbl9uYW1lcyA9IE9iamVjdC5rZXlzKHJhd19jb2x1bW5zX2RhdGFfYXJyYXkpO1xuXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJhd19jb2x1bW5zX2RhdGFfYXJyYXlbY29sdW1uX25hbWVzWzBdXS5sZW5ndGg7IGkrKykge1xuXG4gICAgICAgICAgICAgICAgbGV0IGNvbHVtbl9qc29uX2RhdGFfb2JqZWN0ID0ge307XG5cbiAgICAgICAgICAgICAgICBjb2x1bW5fbmFtZXMuZm9yRWFjaCgoY29sdW1uX25hbWUpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uX2pzb25fZGF0YV9vYmplY3RbY29sdW1uX25hbWVdID0gcmF3X2NvbHVtbnNfZGF0YV9hcnJheVtjb2x1bW5fbmFtZV1baV07XG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICBjb2x1bW5zX2RhdGFfanNvbi5wdXNoKGNvbHVtbl9qc29uX2RhdGFfb2JqZWN0KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEhEVU5vdFRhYnVsYXJFcnJvcihcIlNlbGVjdGVkIEhEVSBpcyBub3QgdGFidWxhclwiKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjb2x1bW5zX2RhdGFfanNvbjtcbiAgICB9XG5cbiAgICBnZXRDb2x1bW5EYXRhRnJvbUhEVShoZHVfaW5kZXgsIGNvbHVtbl9uYW1lKSB7XG4gICAgICAgIGxldCBoZHUgPSB0aGlzLmZpbGUuZ2V0SERVKGhkdV9pbmRleCk7XG5cbiAgICAgICAgbGV0IGhlYWRlciA9IGhkdS5oZWFkZXI7XG4gICAgICAgIGxldCBkYXRhID0gaGR1LmRhdGE7XG5cbiAgICAgICAgbGV0IHR5cGUgPSBoZHUuaGVhZGVyLmdldCgnWFRFTlNJT04nKTtcblxuICAgICAgICBsZXQgY29sX2RhdGEgPSBbXTtcbiAgICAgICAgaWYodHlwZSA9PT0gRklUU1JlYWRlcldyYXBwZXIuQklOVEFCTEUgfHwgdHlwZSA9PT0gRklUU1JlYWRlcldyYXBwZXIuVEFCTEUpIHtcblxuICAgICAgICAgICAgZGF0YS5nZXRDb2x1bW4oY29sdW1uX25hbWUsIGZ1bmN0aW9uKGNvbCl7XG4gICAgICAgICAgICAgICAgaWYoY29sWzBdID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGhlYWRlcl9jb2xfZGF0YSA9IGhkdS5oZWFkZXIuZ2V0KGNvbHVtbl9uYW1lKTtcbiAgICAgICAgICAgICAgICAgICAgY29sID0gY29sLm1hcCgoKSA9PiBoZWFkZXJfY29sX2RhdGEpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbF9kYXRhID0gY29sO1xuICAgICAgICAgICAgfSlcblxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEhEVU5vdFRhYnVsYXJFcnJvcihcIlNlbGVjdGVkIEhEVSBpcyBub3QgdGFidWxhclwiKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjb2xfZGF0YTtcbiAgICB9XG5cbiAgICBnZXRIZWFkZXJGcm9tSERVKGhkdV9pbmRleCkge1xuICAgICAgICBsZXQgaGR1ID0gdG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CTEU7XG4gICAgfVxuXG4gICAgZ2V0QWxsQ29sdW1ucygpIHtcbiAgICAgICAgbGV0IGNvbHVtbnMgPSBbXTtcblxuICAgICAgICB0aGlzLmZpbGUuaGR1cy5mb3JFYWNoKChoZHUsIGluZGV4KSA9PiB7XG5cbiAgICAgICAgICAgIGlmKHRoaXMuX2lzSERVVGFidWxhcihoZHUpKSB7XG4gICAgICAgICAgICAgICAgbGV0IGNvbHVtbnNfbmFtZSA9IHRoaXMuZ2V0Q29sdW1uc05hbWVGcm9tSERVKGluZGV4KTtcblxuICAgICAgICAgICAgICAgIGNvbHVtbnNfbmFtZS5mb3JFYWNoKChjb2x1bW5fbmFtZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY29sdW1uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogY29sdW1uX25hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBoZHVfaW5kZXg6IGluZGV4LFxuICAgICAgICAgICAgICAgICAgICAgICAgaXNfZnJvbV9oZWFkZXI6IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgaWYoaGR1LmhlYWRlci5nZXQoJ1RJTUVERUwnKSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY29sdW1uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1RJTUVERUwnLFxuICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBpbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZihoZHUuaGVhZGVyLmdldCgnQU5DUkZJTEUnKSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgYW5jcmZpbGUgPSBGaWxlUmVnaXN0cnkuZ2V0RmlsZUJ5TmFtZShcbiAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZ1V0aWxzLmNsZWFuRmlsZU5hbWUoaGR1LmhlYWRlci5nZXQoJ0FOQ1JGSUxFJykpXG4gICAgICAgICAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYoYW5jcmZpbGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZydyA9IG5ldyBGSVRTUmVhZGVyV3JhcHBlcigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZnJ3LnNldEZpbGUoYW5jcmZpbGUuZmlsZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZih0aGlzLmFyZl9maWxlKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgbGV0IGFuY3JmaWxlID0gRmlsZVJlZ2lzdHJ5LmdldEZpbGVCeUlkKHRoaXMuYXJmX2ZpbGUpO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmKGFuY3JmaWxlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmcncgPSBuZXcgRklUU1JlYWRlcldyYXBwZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZydy5zZXRGaWxlKGFuY3JmaWxlLmZpbGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZihoZHUuaGVhZGVyLmdldCgnUkVTUEZJTEUnKSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgcmVzcGZpbGUgPSBGaWxlUmVnaXN0cnkuZ2V0RmlsZUJ5TmFtZShcbiAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZ1V0aWxzLmNsZWFuRmlsZU5hbWUoaGR1LmhlYWRlci5nZXQoJ1JFU1BGSUxFJykpXG4gICAgICAgICAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYocmVzcGZpbGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGZydyA9IG5ldyBGSVRTUmVhZGVyV3JhcHBlcigpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBmcncuc2V0RmlsZShyZXNwZmlsZS5maWxlKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhkdXNfaW5kZXggPSBmcncuZ2V0VGFidWxhckhEVXMoKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGhhc19lX21pbl9tYXggPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhkdXNfaW5kZXguZm9yRWFjaCgoaGR1X2luZGV4KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbnNfbmFtZSA9IGZydy5nZXRDb2x1bW5zTmFtZUZyb21IRFUoaGR1X2luZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29sdW1uc19uYW1lLmluY2x1ZGVzKFwiRV9NSU5cIikgJiYgY29sdW1uc19uYW1lLmluY2x1ZGVzKFwiRV9NQVhcIikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzX2VfbWluX21heCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBlX21pbl9tYXhfaGR1c19pbmRleCA9IGhkdV9pbmRleDtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgY29sdW1uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0VfSEFMRl9XSURUSCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZHVfaW5kZXg6IGhkdV9pbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3Byb2Nlc3NlZDogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fZmlsZTogcmVzcGZpbGUuaWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdFX01JRCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZHVfaW5kZXg6IGhkdV9pbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Zyb21faGVhZGVyOiBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3Byb2Nlc3NlZDogdHJ1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fZmlsZTogcmVzcGZpbGUuaWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnMucHVzaChjb2x1bW4pO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdFX01JRF9MT0cnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBoZHVfaW5kZXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19mcm9tX2hlYWRlcjogZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19wcm9jZXNzZWQ6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX2ZpbGU6IHJlc3BmaWxlLmlkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmKHRoaXMucm1mX2ZpbGUpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlc3BmaWxlID0gRmlsZVJlZ2lzdHJ5LmdldEZpbGVCeUlkKHRoaXMucm1mX2ZpbGUpO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmKHJlc3BmaWxlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBmcncgPSBuZXcgRklUU1JlYWRlcldyYXBwZXIoKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgZnJ3LnNldEZpbGUocmVzcGZpbGUuZmlsZSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBoZHVzX2luZGV4ID0gZnJ3LmdldFRhYnVsYXJIRFVzKCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBoYXNfZV9taW5fbWF4ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICBoZHVzX2luZGV4LmZvckVhY2goKGhkdV9pbmRleCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjb2x1bW5zX25hbWUgPSBmcncuZ2V0Q29sdW1uc05hbWVGcm9tSERVKGhkdV9pbmRleCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbHVtbnNfbmFtZS5pbmNsdWRlcyhcIkVfTUlOXCIpICYmIGNvbHVtbnNfbmFtZS5pbmNsdWRlcyhcIkVfTUFYXCIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc19lX21pbl9tYXggPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZV9taW5fbWF4X2hkdXNfaW5kZXggPSBoZHVfaW5kZXg7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGNvbHVtbiA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdFX0hBTEZfV0lEVEgnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBoZHVfaW5kZXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19mcm9tX2hlYWRlcjogZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19wcm9jZXNzZWQ6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX2ZpbGU6IHJlc3BmaWxlLmlkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW4gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnRV9NSUQnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGR1X2luZGV4OiBoZHVfaW5kZXgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19mcm9tX2hlYWRlcjogZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19wcm9jZXNzZWQ6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX2ZpbGU6IHJlc3BmaWxlLmlkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2goY29sdW1uKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW4gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnRV9NSURfTE9HJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhkdV9pbmRleDogaGR1X2luZGV4LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfZnJvbV9oZWFkZXI6IGZhbHNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfcHJvY2Vzc2VkOiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9maWxlOiByZXNwZmlsZS5pZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1ucy5wdXNoKGNvbHVtbik7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG5cbiAgICAgICAgcmV0dXJuIGNvbHVtbnM7XG4gICAgfVxuXG4gICAgc2VuZEZJVFNMb2FkZWRFdmVudHMoKSB7XG4gICAgICAgIGxldCBmaWxlbGUgPSBuZXcgRmlsZUxvYWRlZEV2ZW50KHtcbiAgICAgICAgICAgIGZpbGVfbmFtZTogdGhpcy5maWxlX3BhdGgsXG4gICAgICAgICAgICB0eXB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diff --git a/pr-preview/pr-12/errors/NoEventSubscriberError.js b/pr-preview/pr-12/errors/NoEventSubscriberError.js new file mode 100644 index 0000000..6fd7527 --- /dev/null +++ b/pr-preview/pr-12/errors/NoEventSubscriberError.js @@ -0,0 +1,6 @@ +export class NoEventSubscriberError extends Error { + constructor(message) { + super(message); + this.name = "NoEventSubscriberError"; + } +} \ No newline at end of file diff --git a/pr-preview/pr-12/events/ArithmeticColumnChangeEvent.js b/pr-preview/pr-12/events/ArithmeticColumnChangeEvent.js new file mode 100644 index 0000000..1e0c8de --- /dev/null +++ b/pr-preview/pr-12/events/ArithmeticColumnChangeEvent.js @@ -0,0 +1,49 @@ +import {RegistryContainer} from "../containers/RegistryContainer"; + +export class ArithmeticColumnChangeEvent { + + static defaultOptions = { + bubbles: true, + composed: true + }; + + static name = "arithmetic-column-change"; + static main_root_id = 'jsvis-main'; + static main_root_element = null; + + event = null; + + constructor(detail = {}, options = {}) { + + this.detail = { ...detail }; + this.options = { ...ArithmeticColumnChangeEvent.defaultOptions, ...options }; + + this.event = new CustomEvent(ArithmeticColumnChangeEvent.name, { + detail: this.detail, + ...this.options + }); + } + + dispatchToTarget(target) { + target.dispatchEvent(this.event); + } + + dispatchToMainRoot() { + if(ArithmeticColumnChangeEvent.main_root_element === null) { + ArithmeticColumnChangeEvent.main_root_element = document.getElementById(ArithmeticColumnChangeEvent.main_root_id); + } + + document.dispatchEvent(this.event); + } + + dispatchToSubscribers() { + let esr = RegistryContainer.getRegistryContainer().getEventSubscribersRegistry(); + let subscribers_id = esr.getSubscribersForEvent(ArithmeticColumnChangeEvent.name); + + let subscriber_element = null; + subscribers_id.forEach((subscriber_id) => { + subscriber_element = document.getElementById(subscriber_id); + subscriber_element.dispatchEvent(this.event); + }) + } +} diff --git a/pr-preview/pr-12/events/FileRegistryChangeEvent.js b/pr-preview/pr-12/events/FileRegistryChangeEvent.js index f376eb6..4a1763a 100644 --- a/pr-preview/pr-12/events/FileRegistryChangeEvent.js +++ b/pr-preview/pr-12/events/FileRegistryChangeEvent.js @@ -1,10 +1,11 @@ import {RegistryContainer} from "../containers/RegistryContainer"; +import {NoEventSubscriberError} from "../errors/NoEventSubscriberError"; export class FileRegistryChangeEvent { static defaultOptions = { bubbles: true, - composed: false + composed: true }; static name = "file-registry-change"; @@ -41,9 +42,15 @@ export class FileRegistryChangeEvent { let subscribers_id = esr.getSubscribersForEvent(FileRegistryChangeEvent.name); let subscriber_element = null; - subscribers_id.forEach((subscriber_id) => { - subscriber_element = document.getElementById(subscriber_id); - subscriber_element.dispatchEvent(this.event); - }) + try { + subscribers_id.forEach((subscriber_id) => { + subscriber_element = document.getElementById(subscriber_id); + subscriber_element.dispatchEvent(this.event); + }) + } catch(e) { + if(subscribers_id.length <= 0) { + throw new NoEventSubscriberError(); + } + } } } diff --git a/pr-preview/pr-12/index.html b/pr-preview/pr-12/index.html index e1f34de..e6e687f 100644 --- a/pr-preview/pr-12/index.html +++ b/pr-preview/pr-12/index.html @@ -92,6 +92,10 @@ width: 100%; } + .spectrum-settings { + display: none; + } + .column-graph { padding: 20px; box-sizing: border-box; @@ -120,6 +124,71 @@ margin-top: 10px; } + #column-main-input { + width: 690px; + height: auto; + background-color: #FFFFFF; + border: 1px solid #000000; + position: relative; + left: -400px; + display: none; + } + + #column-display-list { + list-style: decimal; + } + + #column-display-list button { + margin-left: 5px; + } + + .column-input-container { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 10px; + width: 100%; + margin: 0 auto; + padding: 20px; + } + + .column-input-keyboard { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 10px; + margin-bottom: 15px; + } + + .button-grid button { + margin-bottom: 5px; + width: 80px; + } + + #input-display { + width: 100%; + height: 40px; + background-color: #FFFFFF; + } + + #input-display input { + width: 100%; + height: 100%; + } + + #column-input-list { + height: 170px; + padding-left: 10px; + padding-right: 10px; + overflow: scroll; + scrollbar-width: thin; + scrollbar-color: rgba(0, 0, 0, 0.5) rgba(0, 0, 0, 0.1); + list-style: none; + border: 1px solid #000000; + } + + #column-input-list li { + cursor: pointer; + } + #select-axis-x-scale { margin-bottom: 10px; } @@ -195,6 +264,10 @@ grid-template-columns: repeat(auto-fit, minmax(50%, 1fr)); } + .visible { + display: block !important; + } + @@ -305,6 +378,15 @@
        HDU Selection
        + +
        +
        +
        Column Creation
        + +
        +
        diff --git a/pr-preview/pr-12/main.js b/pr-preview/pr-12/main.js index ae8a9d2..9409bdf 100644 --- a/pr-preview/pr-12/main.js +++ b/pr-preview/pr-12/main.js @@ -10,6 +10,9 @@ import { FITSSettingsComponent } from './components/file_type/FITSSettingsCompon import { CSVSettingsComponent } from './components/file_type/CSVSettingsComponent.js' import { D3Graph } from "./visualizations/D3Graph"; import { BokehGraph } from "./visualizations/BokehGraph"; +import {FileRegistry} from "./registries/FileRegistry"; +import {RegistryContainer} from "./containers/RegistryContainer"; +import {ArithmeticColumnInput} from "./components/inputs/ArithmeticColumnInput"; let file_path = window.location.href + "_test_files/spiacs_lc_query.fits"; @@ -26,8 +29,11 @@ WrapperContainer.setD3Wrapper(d3_wrapper); VisualizationContainer.setBokehVisualization(new BokehGraph()); VisualizationContainer.setD3Visualization(new D3Graph()); +RegistryContainer.setFileRegistry(new FileRegistry()); + customElements.define('file-component', FileComponent); customElements.define('settings-component', SettingsComponent); customElements.define('visualization-component', VisualizationComponent); customElements.define('fits-component', FITSSettingsComponent); customElements.define('csv-component', CSVSettingsComponent); +customElements.define('arithmetic-column-component', ArithmeticColumnInput); diff --git a/pr-preview/pr-12/registries/EventSubscribersRegistry.js b/pr-preview/pr-12/registries/EventSubscribersRegistry.js index b4683ce..c6e7ec6 100644 --- a/pr-preview/pr-12/registries/EventSubscribersRegistry.js +++ b/pr-preview/pr-12/registries/EventSubscribersRegistry.js @@ -6,8 +6,9 @@ export class EventSubscribersRegistry { 'fits-loaded': ['settings-component', 'file-component'], 'configuration': ['settings-component'], 'file-loaded': ['file-component'], - 'file-selected': ['settings-component'], - 'file-registry-change': ['settings-component', 'file-component'] + 'file-selected': ['settings-component', 'arithmetic-column-component'], + 'file-registry-change': ['settings-component', 'file-component', 'arithmetic-column-component'], + //'arithmetic-column-change': ['settings-component'] } constructor() { diff --git a/pr-preview/pr-12/registries/FileRegistry.js b/pr-preview/pr-12/registries/FileRegistry.js index 7e82dfa..d1379c9 100644 --- a/pr-preview/pr-12/registries/FileRegistry.js +++ b/pr-preview/pr-12/registries/FileRegistry.js @@ -34,6 +34,10 @@ export class FileRegistry { FileRegistry.file_counter++; } + static _addToAvailableFiles(file) { + FileRegistry.available_files.push(file); + } + static moveToAvailableFiles(file) { FileRegistry.available_files.push(file); } @@ -54,6 +58,15 @@ export class FileRegistry { FileRegistry.moveToAvailableFiles(file); } + static getAllFiles() { + let available_files = FileRegistry.getAvailableFilesList(); + let current_files = FileRegistry.getCurrentFilesList(); + + let files = available_files.concat(current_files); + + return files; + } + static getFileById(file_id) { let file_array = [...FileRegistry.available_files, ...FileRegistry.current_files]; @@ -78,6 +91,22 @@ export class FileRegistry { return is_current; } + static setFileMetadata(file_id, metadata) { + let files = FileRegistry.getAllFiles(); + + let file = files.filter(file => file.id !== parseInt(file_id)); + + file = { ...file, ...metadata }; + + if(FileRegistry.isFileCurrent(file_id)) { + FileRegistry.removeFromCurrentFiles(file_id); + FileRegistry.addToCurrentFiles(file); + } else { + FileRegistry.removeFromAvailableFiles(file_id); + FileRegistry._addToAvailableFiles(file); + } + } + static sendRegistryChangeEvent() { let frce = new FileRegistryChangeEvent(); frce.dispatchToSubscribers(); diff --git a/pr-preview/pr-12/utils/ColumnUtils.js b/pr-preview/pr-12/utils/ColumnUtils.js new file mode 100644 index 0000000..61a9726 --- /dev/null +++ b/pr-preview/pr-12/utils/ColumnUtils.js @@ -0,0 +1,19 @@ +export class ColumnUtils { + + static getColumnSettings(column_settings) { + let settings = column_settings.split('$'); + + let column_location = settings[0].split('.'); + let column_name = settings[1] || ''; + + let file_id = column_location[0]; + let hdu_index = column_location.length > 1 ? column_location[1] : ''; + + return { + file_id: file_id, + hdu_index: hdu_index, + column_name: column_name + }; + } + +} \ No newline at end of file diff --git a/pr-preview/pr-12/utils/ExpressionBlock.js b/pr-preview/pr-12/utils/ExpressionBlock.js new file mode 100644 index 0000000..e1189a0 --- /dev/null +++ b/pr-preview/pr-12/utils/ExpressionBlock.js @@ -0,0 +1,47 @@ +import {ExpressionParser} from "./ExpressionParser"; + +export class ExpressionBlock { + + content = null; + + start_pos = null; + stop_pos = null; + + expression_parser = null; + + constructor(block, start, stop) { + this.content = block; + this.start_pos = start; + this.stop_pos = stop; + + this.expression_parser = new ExpressionParser(block); + } + + parseBlock() { + //this.expression_parser.parseExpression(this.content); + + let expression_type = this.isBlockStandard(); + + if(expression_type) { + let result = this.expression_parser.basicExpressionEvaluation(this.content); + } else if(expression_type === false) { + + } else { + + } + } + + isBlockStandard() { + + let expression_type = this.expression_parser.checkExpression(this.content); + + if(expression_type === 'standard') { + return true; + } else if(expression_type === 'custom') { + return false; + } else { + return null; + } + } + +} \ No newline at end of file diff --git a/pr-preview/pr-12/utils/ExpressionParser.js b/pr-preview/pr-12/utils/ExpressionParser.js new file mode 100644 index 0000000..a3cbee4 --- /dev/null +++ b/pr-preview/pr-12/utils/ExpressionParser.js @@ -0,0 +1,79 @@ +export class ExpressionParser { + + static standard_functions = ['Math.sqrt', + 'Math.abs', + 'Math.cos', + 'Math.sin', + 'Math.max', + 'Math.min', + 'Math.pow', + 'Math.log', + 'Math.round' + ]; + + static custom_functions = []; + + expression = null; + blocks = []; + + constructor(expression = null) { + this.expression = expression; + } + + setExpression(expression) { + this.expression = expression; + } + + parseExpression() { + if(this.expression) { + + for(let i = 0; this.expression.length; i++) { + + let curr_char = this.expression[i]; + + } + + } + } + + basicExpressionEvaluation() { + let expression_result = null; + + try { + expression_result = eval(this.expression); + } catch(e) { + + } + + return expression_result; + } + + customExpressionEvaluation() { + + } + + checkExpression() { + + let expression_type = 'standard'; + + const regex_is_operator_number = /[+\-*/0-9.]+/; + + let expression_parts = this.expression.split(/\s+/); + + expression_parts.forEach(part => { + if (!regex_is_operator_number.test(part)) { + if (ExpressionParser.standard_functions.includes(part)) { + + } else if (ExpressionParser.custom_functions.includes(part)) { + expression_type = 'custom'; + } else { + expression_type = null; + return expression_type; + } + } + }); + + return expression_type; + } + +} \ No newline at end of file diff --git a/pr-preview/pr-12/visualizations/D3Graph.js b/pr-preview/pr-12/visualizations/D3Graph.js index 7af566d..905b402 100644 --- a/pr-preview/pr-12/visualizations/D3Graph.js +++ b/pr-preview/pr-12/visualizations/D3Graph.js @@ -83,10 +83,12 @@ export class D3Graph { this.x_scale_type = scales['x']; this.y_scale_type = scales['y']; - if (error_bars) { + if(error_bars) { this.has_error_bars = true; this.error_bars = error_bars; + console.log(error_bars); + this.x_axis_data_col_error_bar = axis['x'].value; this.y_axis_data_col_error_bar = axis['y'].value; @@ -267,34 +269,35 @@ export class D3Graph { this.error_bars = error_bars; - let error_bar_x = {x: error_bars.x}; - - let line_error_bar_x = d3.line() - .x(d => this.x_scale(d[this.x_axis_data_col])) - .y(d => this.y_scale(d.bound)); - - error_bars.x.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_x(error_bar)); - }) - - let line_error_bar_y = d3.line() - .x(d => this.x_scale(d.bound)) - .y(d => this.y_scale(d[this.y_axis_data_col])); - - error_bars.y.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_y(error_bar)); - }) + if(error_bars.y) { + let line_error_bar_x = d3.line() + .x(d => this.x_scale(d[this.x_axis_data_col])) + .y(d => this.y_scale(d.bound)); + + error_bars.y.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_x(error_bar)); + }) + } + if(error_bars.x) { + let line_error_bar_y = d3.line() + .x(d => this.x_scale(d.bound)) + .y(d => this.y_scale(d[this.y_axis_data_col])); + + error_bars.x.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_y(error_bar)); + }) + } } _setAxisLine() { @@ -373,31 +376,35 @@ export class D3Graph { if(this.has_error_bars) { - let line_error_bar_x = d3.line() - .x(d => rescaled_x(d[this.x_axis_data_col])) - .y(d => rescaled_y(d.bound)); - - this.error_bars.x.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_x(error_bar)); - }) - - let line_error_bar_y = d3.line() - .x(d => rescaled_x(d.bound)) - .y(d => rescaled_y(d[this.y_axis_data_col])); + if(this.error_bars.y) { + let line_error_bar_x = d3.line() + .x(d => rescaled_x(d[this.x_axis_data_col])) + .y(d => rescaled_y(d.bound)); + + this.error_bars.y.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_x(error_bar)); + }) + } - this.error_bars.y.forEach((error_bar) => { - d3.select('#data-plot').append("path") - .attr("class", "error-bar-x") - .attr("fill", "none") - .attr("stroke", "steelblue") - .attr("stroke-width", 1.5) - .attr("d", line_error_bar_y(error_bar)); - }) + if(this.error_bars.x) { + let line_error_bar_y = d3.line() + .x(d => rescaled_x(d.bound)) + .y(d => rescaled_y(d[this.y_axis_data_col])); + + this.error_bars.x.forEach((error_bar) => { + d3.select('#data-plot').append("path") + .attr("class", "error-bar-x") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("d", line_error_bar_y(error_bar)); + }) + } } } diff --git a/pr-preview/pr-12/webpack.dev.js b/pr-preview/pr-12/webpack.dev.js index bdadfee..ad160d3 100644 --- a/pr-preview/pr-12/webpack.dev.js +++ b/pr-preview/pr-12/webpack.dev.js @@ -15,7 +15,7 @@ module.exports = { devtool: 'inline-source-map', watch: true, watchOptions: { - aggregateTimeout: 600, + aggregateTimeout: 800, ignored: ['dist/**', '_vendors/**', '_test_files/**', '_old/**'], }, }; \ No newline at end of file diff --git a/pr-preview/pr-12/wrappers/BokehWrapper.js b/pr-preview/pr-12/wrappers/BokehWrapper.js index 5182017..a7931e7 100644 --- a/pr-preview/pr-12/wrappers/BokehWrapper.js +++ b/pr-preview/pr-12/wrappers/BokehWrapper.js @@ -108,10 +108,7 @@ export class BokehWrapper { let processed_data = dpp.getProcessedDataset(dataset_settings); - let processed_json_data = dpp.datasetToJSONData(processed_data); - let data_type = this.settings_object.getDataTypeSettings(); - let hdu = this.settings_object.getHDUsSettings(); let scales = this.settings_object.getScalesSettings(); @@ -126,6 +123,25 @@ export class BokehWrapper { let data = {x: processed_data.axis[0].data, y: processed_data.axis[1].data}; if(error_bars) { + + console.log(processed_data.error_bars); + + let error_bars_object = {}; + + processed_data.error_bars.forEach((error_bar) => { + error_bar.data = error_bar.data.map(value => !isFinite(value) ? 0 : value); + error_bar.data = error_bar.data.map(value => isNaN(value) ? 0 : value); + + error_bars_object[error_bar.axis] = error_bar.column_name; + + if(error_bar.axis === 'x') { + data.dx = error_bar.data; + } else if(error_bar.axis === 'y') { + data.dy = error_bar.data; + } + }) + + /* error_bars = {x: processed_data.error_bars[0].column_name, y: processed_data.error_bars[1].column_name}; processed_data.error_bars[0].data = processed_data.error_bars[0].data.map(value => !isFinite(value) ? 0 : value); @@ -133,6 +149,7 @@ export class BokehWrapper { data.dx = processed_data.error_bars[0].data.map(value => isNaN(value) ? 0 : value); data.dy = processed_data.error_bars[1].data.map(value => isNaN(value) ? 0 : value); + */ let asymmetric_uncertainties = false; @@ -146,7 +163,6 @@ export class BokehWrapper { } let ranges = this.settings_object.getRangesSettings(); - let has_custom_range = false; let custom_range_data = null; if(ranges != null) { @@ -168,29 +184,6 @@ export class BokehWrapper { } } - getProcessedData(data_type, hdu_index, axis, error_bars) { - let data = null; - - let dpc = DataProcessorContainer.getDataProcessorContainer(); - let data_processor; - - let frw = WrapperContainer.getFITSReaderWrapper(); - - if(data_type === 'light-curve') { - data_processor = dpc.getLightCurveProcessor(frw, hdu_index); - } else if(data_type === 'spectrum') { - data_processor = dpc.getSpectrumProcessor(frw, hdu_index); - } - - data = data_processor.processDataRawJSON(axis, error_bars); - - if(error_bars) { - data = this._processErrorBarData(data); - } - - return data; - } - _getColumnSettings(column_settings) { let settings = column_settings.split('$'); @@ -215,6 +208,38 @@ export class BokehWrapper { div_factor = 1; } + if(data.dx) { + let x_low = []; + let x_up = []; + + for(let i in data.dx) { + x_low[i] = data.x[i] - data.dx[i] / div_factor; + x_up[i] = data.x[i] + data.dx[i] / div_factor; + } + + data.x_low = x_low; + data.x_up = x_up; + + delete data.dx; + } + + if(data.dy) { + let y_low = []; + let y_up = []; + + for(let i in data.dy) { + y_low[i] = data.y[i] - data.dy[i]; + y_up[i] = data.y[i] + data.dy[i]; + } + + data.y_low = y_low; + data.y_up = y_up; + + delete data.dy; + + } + + /* let y_low = [], y_up = [], x_low = [], x_up = []; for (let i in data.dy) { @@ -231,6 +256,7 @@ export class BokehWrapper { delete data.dy; delete data.dx; + */ return data; } diff --git a/pr-preview/pr-12/wrappers/D3Wrapper.js b/pr-preview/pr-12/wrappers/D3Wrapper.js index 618064c..b52128e 100644 --- a/pr-preview/pr-12/wrappers/D3Wrapper.js +++ b/pr-preview/pr-12/wrappers/D3Wrapper.js @@ -105,8 +105,13 @@ export class D3Wrapper { axis = {x: processed_data.axis[0].column_name, y: processed_data.axis[1].column_name}; if(has_error_bars) { - error_bars = {x: processed_data.error_bars[0].column_name, y: processed_data.error_bars[1].column_name}; - error_bars = dpp.processErrorBarDataJSON(processed_json_data, axis, error_bars) + let error_bars_object = {}; + + processed_data.error_bars.forEach((error_bar) => { + error_bars_object[error_bar.axis] = error_bar.column_name; + }) + + error_bars = dpp.processErrorBarDataJSON(processed_json_data, axis, error_bars_object) } if(ranges != null) { diff --git a/pr-preview/pr-12/wrappers/FITSReaderWrapper.js b/pr-preview/pr-12/wrappers/FITSReaderWrapper.js index c084eaf..e70ac98 100644 --- a/pr-preview/pr-12/wrappers/FITSReaderWrapper.js +++ b/pr-preview/pr-12/wrappers/FITSReaderWrapper.js @@ -14,6 +14,7 @@ export class FITSReaderWrapper { constructor(file_path = null) { if(file_path) { + console.log(file_path); if (FITSReaderWrapper.is_path_valid(file_path)) { this.file_path = file_path; this._getFile() @@ -69,6 +70,12 @@ export class FITSReaderWrapper { this.file = file; } + setFileFromFileObject(file_object) { + this.file = file_object.file; + this.arf_file = file_object.arf_file_id; + this.rmf_file = file_object.rmf_file_id; + } + getHDU(hdu_index) { if(hdu_index >= 0 && hdu_index < this.file.hdus.length) { return this.file.hdus[hdu_index]; @@ -340,6 +347,15 @@ export class FITSReaderWrapper { frw.setFile(ancrfile.file); } + } else if(this.arf_file) { + + let ancrfile = FileRegistry.getFileById(this.arf_file); + + if(ancrfile !== undefined) { + let frw = new FITSReaderWrapper(); + frw.setFile(ancrfile.file); + } + } if(hdu.header.get('RESPFILE') !== null) { @@ -395,8 +411,59 @@ export class FITSReaderWrapper { }) } - } + } else if(this.rmf_file) { + let respfile = FileRegistry.getFileById(this.rmf_file); + + if(respfile !== undefined) { + let frw = new FITSReaderWrapper(); + + frw.setFile(respfile.file); + + let hdus_index = frw.getTabularHDUs(); + + let has_e_min_max = false; + hdus_index.forEach((hdu_index) => { + let columns_name = frw.getColumnsNameFromHDU(hdu_index); + if (columns_name.includes("E_MIN") && columns_name.includes("E_MAX")) { + has_e_min_max = true; + let e_min_max_hdus_index = hdu_index; + + let column = { + name: 'E_HALF_WIDTH', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + column = { + name: 'E_MID', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + column = { + name: 'E_MID_LOG', + hdu_index: hdu_index, + is_from_header: false, + is_processed: true, + from_file: respfile.id + } + + columns.push(column); + + } + }) + + } + } } })