You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

529 lines
62 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// main.ts
__export(exports, {
default: () => MultiSelect
});
var import_obsidian5 = __toModule(require("obsidian"));
// src/settings/settings.ts
var DEFAULT_SETTINGS = {
queries: []
};
// src/queries/Query.ts
var Query = class {
constructor(name = "", description = "", id = "", dataviewJSQuery = null) {
this.name = name;
this.description = description;
this.id = id;
this.dataviewJSQuery = dataviewJSQuery;
}
static copyQuery(target, source) {
target.id = source.id;
target.name = source.name;
target.description = source.description;
target.dataviewJSQuery = source.dataviewJSQuery;
}
};
var Query_default = Query;
// src/queries/queryResultsModal.ts
var import_obsidian = __toModule(require("obsidian"));
var QueryResultModal = class extends import_obsidian.Modal {
constructor(app, plugin, query, cursorPosition, file) {
super(app);
this.plugin = plugin;
this.query = query;
this.cursorPosition = cursorPosition;
this.results = [];
this.selectedResults = [];
this.selectedAlias = {};
this.file = file;
this.prepend = "";
this.append = ", ";
}
onOpen() {
var _a;
const getResults = (api) => {
return new Function("dv", `return ${this.query.dataviewJSQuery}`)(api);
};
const valueGrid = this.contentEl.createDiv({
cls: "modal-results-grid"
});
if (this.app.plugins.enabledPlugins.has("dataview")) {
const api = (_a = this.app.plugins.plugins.dataview) == null ? void 0 : _a.api;
if (api) {
this.results = getResults(api);
} else
this.plugin.registerEvent(this.app.metadataCache.on("dataview:api-ready", (api2) => this.results = getResults(api2)));
}
this.populateValuesGrid(valueGrid, this.results.map((p) => p.file.path));
}
buildAliasesList(destFile) {
const frontmatter = this.app.metadataCache.getFileCache(destFile).frontmatter;
return (0, import_obsidian.parseFrontMatterAliases)(frontmatter);
}
buildValueToggler(valueGrid, destFile, aliases) {
const valueSelectorContainer = valueGrid.createDiv({
cls: "value-selector-container"
});
const valueTogglerLine = valueSelectorContainer.createDiv({
cls: "value-toggler-line"
});
const valueTogglerContainer = valueTogglerLine.createDiv({
cls: "value-selector-toggler"
});
const valueToggler = new import_obsidian.ToggleComponent(valueTogglerContainer);
valueToggler.onChange((value) => {
if (value && !this.selectedResults.includes(destFile.path)) {
this.selectedResults.push(destFile.path);
}
if (!value) {
this.selectedResults.remove(destFile.path);
delete this.selectedAlias[destFile.basename];
}
});
const valueLabel = valueTogglerLine.createDiv({
cls: "value-selector-label"
});
valueLabel.setText(destFile.basename);
valueLabel.onClickEvent((e) => valueToggler.setValue(!valueToggler.getValue()));
if (aliases) {
const aliasesSelectorContainer = valueTogglerLine.createDiv({
cls: "value-selector-aliases"
});
(0, import_obsidian.setIcon)(aliasesSelectorContainer, "three-horizontal-bars");
const aliasesListContainer = valueSelectorContainer.createDiv({
cls: "aliases-list-container"
});
aliasesListContainer.style.display = "none";
aliasesSelectorContainer.onClickEvent((e) => {
if (aliasesListContainer.style.display === "none") {
this.buildAliasSelector(aliasesListContainer, valueLabel, aliases, destFile.basename);
aliasesListContainer.style.display = "inline-block";
} else {
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
}
});
}
}
buildAliasSelector(aliasesListContainer, valueLabel, aliases, basename) {
aliases.forEach((alias) => {
if (!Object.keys(this.selectedAlias).includes(basename) || this.selectedAlias[basename] !== alias) {
const aliasContainer = aliasesListContainer.createDiv();
aliasContainer.innerHTML = `<span>\u2022 ${alias}</span>`;
aliasContainer.onClickEvent((e) => {
valueLabel.setText(alias);
this.selectedAlias[basename] = alias;
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
});
}
});
if (Object.keys(this.selectedAlias).includes(basename) && this.selectedAlias[basename] !== null) {
const aliasContainer = aliasesListContainer.createDiv();
aliasContainer.innerHTML = `<span>\u2022 ${basename}</span>`;
aliasContainer.onClickEvent((e) => {
valueLabel.setText(basename);
this.selectedAlias[basename] = null;
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
});
}
}
buildMarkDownLink(path) {
const destFile = this.app.metadataCache.getFirstLinkpathDest(path, this.file.path);
const link = this.app.fileManager.generateMarkdownLink(destFile, this.file.path, null, this.selectedAlias[destFile.basename]);
return link;
}
buildNewLine() {
const leaf = this.app.workspace.activeLeaf;
if (leaf.view instanceof import_obsidian.MarkdownView && leaf.view.editor) {
const editor = leaf.view.editor;
const lineAtCursor = editor.getLine(this.cursorPosition.line);
const startLine = lineAtCursor.substr(0, this.cursorPosition.ch);
const content = this.selectedResults.map((r) => this.buildMarkDownLink(r)).map((l) => this.prepend + l).join(this.append);
const endLine = lineAtCursor.substr(this.cursorPosition.ch, lineAtCursor.length - this.cursorPosition.ch);
editor.setLine(this.cursorPosition.line, startLine + content + endLine);
}
}
populateValuesGrid(valueGrid, filePaths) {
filePaths.forEach((filePath) => {
const destFile = this.app.metadataCache.getFirstLinkpathDest(filePath, this.file.path);
this.buildValueToggler(valueGrid, destFile, this.buildAliasesList(destFile));
});
const divider = this.contentEl.createDiv();
divider.innerHTML = "<hr>";
const helper = this.contentEl.createDiv({
cls: "separator-helper-label"
});
helper.setText("prepend/append strings to the links");
const footer = this.contentEl.createDiv({
cls: "value-grid-footer"
});
const separatorContainer = footer.createDiv({
cls: "separator-container"
});
const prepend = new import_obsidian.TextComponent(separatorContainer);
prepend.inputEl.size = 10;
prepend.setValue(this.prepend);
const linkLabel = separatorContainer.createDiv({
cls: "separator-link-label"
});
linkLabel.setText(" [[Link]] ");
prepend.onChange((value) => this.prepend = value);
const append = new import_obsidian.TextAreaComponent(separatorContainer);
append.inputEl.cols = 3;
append.inputEl.rows = 2;
append.setValue(this.append);
append.onChange((value) => this.append = value);
const buttonsContainer = footer.createDiv({
cls: "buttons-container"
});
const saveButton = new import_obsidian.ButtonComponent(buttonsContainer);
saveButton.setIcon("checkmark");
saveButton.onClick(() => {
console.log(this.selectedResults, this.selectedAlias);
this.buildNewLine();
this.close();
});
const cancelButton = new import_obsidian.ExtraButtonComponent(buttonsContainer);
cancelButton.setIcon("cross");
cancelButton.onClick(() => this.close());
}
};
// src/settings/settingTab.ts
var import_obsidian4 = __toModule(require("obsidian"));
// src/settings/QuerySetting.ts
var import_obsidian3 = __toModule(require("obsidian"));
// src/settings/QuerySettingModal.ts
var import_obsidian2 = __toModule(require("obsidian"));
var QuerySettingsModal = class extends import_obsidian2.Modal {
constructor(app, plugin, parentSettingContainer, parentSetting, query) {
super(app);
this.saved = false;
this.new = true;
this.plugin = plugin;
this.parentSetting = parentSetting;
this.initialQuery = new Query_default();
this.parentSettingContainer = parentSettingContainer;
if (query) {
this.new = false;
this.query = query;
this.initialQuery.name = query.name;
this.initialQuery.id = query.id;
this.initialQuery.description = query.description;
} else {
let newId = 1;
this.plugin.initialQueries.forEach((query2) => {
if (parseInt(query2.id) && parseInt(query2.id) >= newId) {
newId = parseInt(query2.id) + 1;
}
});
this.query = new Query_default();
this.query.id = newId.toString();
this.initialQuery.id = newId.toString();
}
}
onOpen() {
if (this.query.name == "") {
this.titleEl.setText(`Add a query`);
} else {
this.titleEl.setText(`Manage query ${this.query.name}`);
}
this.createForm();
}
onClose() {
Object.assign(this.query, this.initialQuery);
if (!this.new) {
this.parentSetting.setTextContentWithname();
} else if (this.saved) {
new QuerySetting(this.parentSettingContainer, this.query, this.app, this.plugin);
}
}
createNameInputContainer(parentNode) {
const queryNameContainerLabel = parentNode.createDiv();
queryNameContainerLabel.setText(`Query Name:`);
const input = new import_obsidian2.TextComponent(parentNode);
const name = this.query.name;
input.setValue(name);
input.setPlaceholder("Name of the query");
input.onChange((value) => {
this.query.name = value;
this.titleEl.setText(`Manage ${this.query.name}`);
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createDescriptionInputContainer(parentNode) {
const queryDescriptionContainerLabel = parentNode.createDiv();
queryDescriptionContainerLabel.setText(`Query Description:`);
const input = new import_obsidian2.TextComponent(parentNode);
const description = this.query.description;
input.setValue(description);
input.setPlaceholder("Description of the query");
input.onChange((value) => {
this.query.description = value;
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createDataviewJSInputContainer(parentNode) {
const queryDataviewJSQueryContainerLabel = parentNode.createDiv();
queryDataviewJSQueryContainerLabel.setText(`DataviewJS query:`);
const input = new import_obsidian2.TextAreaComponent(parentNode);
const dataviewJSQuery = this.query.dataviewJSQuery;
input.inputEl.cols = 100;
input.inputEl.rows = 15;
input.setPlaceholder(`Dataviewjs syntax to query pages
Example:
dv.pages("#SomeTag").where(p => p.field === "some value").sort(p => condition, 'asc')`);
input.setValue(dataviewJSQuery != null ? dataviewJSQuery : "");
input.onChange((value) => {
this.query.dataviewJSQuery = value;
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createForm() {
const div = this.contentEl.createDiv({
cls: "frontmatter-prompt-div"
});
const mainDiv = div.createDiv({
cls: "frontmatter-prompt-form"
});
const nameContainer = mainDiv.createDiv();
const descriptionContainer = mainDiv.createDiv();
const dataviewJSQueryContainer = mainDiv.createDiv();
this.namePromptComponent = this.createNameInputContainer(nameContainer);
this.descriptionPromptComponent = this.createDescriptionInputContainer(descriptionContainer);
this.queryPromptComponent = this.createDataviewJSInputContainer(dataviewJSQueryContainer);
mainDiv.createDiv().createEl("hr");
const footerEl = this.contentEl.createDiv();
const footerButtons = new import_obsidian2.Setting(footerEl);
footerButtons.addButton((b) => this.createSaveButton(b));
footerButtons.addExtraButton((b) => this.createCancelButton(b));
}
createSaveButton(b) {
b.setTooltip("Save").setIcon("checkmark").onClick(() => __async(this, null, function* () {
let error = false;
if (/^[#>-]/.test(this.query.name)) {
QuerySettingsModal.setValidationError(this.namePromptComponent, this.namePromptComponent.inputEl, "Query name cannot start with #, >, -");
error = true;
}
if (this.query.name == "") {
QuerySettingsModal.setValidationError(this.namePromptComponent, this.namePromptComponent.inputEl, "Property name can not be Empty");
error = true;
}
if (error) {
new import_obsidian2.Notice("Fix errors before saving.");
return;
}
this.saved = true;
const currentExistingQuery = this.plugin.initialQueries.filter((q) => q.id == this.query.id)[0];
if (currentExistingQuery) {
this.plugin.initialQueries.remove(currentExistingQuery);
this.app.commands.removeCommand(`${this.plugin.manifest.id}:multiSelect-${currentExistingQuery.name}`);
}
this.plugin.initialQueries.push(this.query);
this.plugin.addMultiSelectQueryCommand(this.query);
this.initialQuery = this.query;
this.plugin.saveSettings();
this.close();
}));
return b;
}
createCancelButton(b) {
b.setIcon("cross").setTooltip("Cancel").onClick(() => {
this.saved = false;
if (this.initialQuery.name != "") {
Object.assign(this.query, this.initialQuery);
}
this.close();
});
return b;
}
static setValidationError(textInput, insertAfter, message) {
textInput.inputEl.addClass("is-invalid");
if (message) {
let mDiv = textInput.inputEl.parentElement.querySelector(".invalid-feedback");
if (!mDiv) {
mDiv = createDiv({ cls: "invalid-feedback" });
}
mDiv.innerText = message;
mDiv.insertAfter(insertAfter);
}
}
static removeValidationError(textInput) {
if (textInput.inputEl.hasClass("is-invalid")) {
textInput.inputEl.removeClass("is-invalid");
textInput.inputEl.parentElement.removeChild(textInput.inputEl.parentElement.lastElementChild);
}
}
};
// src/settings/QuerySetting.ts
var QuerySetting = class extends import_obsidian3.Setting {
constructor(containerEl, query, app, plugin) {
super(containerEl);
this.containerEl = containerEl;
this.query = query;
this.app = app;
this.plugin = plugin;
this.setTextContentWithname();
this.addEditButton();
this.addDeleteButton();
}
setTextContentWithname() {
this.setName(this.query.name);
this.setDesc(this.query.description);
}
addEditButton() {
this.addButton((b) => {
b.setIcon("pencil").setTooltip("Edit").onClick(() => {
let modal = new QuerySettingsModal(this.app, this.plugin, this.containerEl, this, this.query);
modal.open();
});
});
}
addDeleteButton() {
this.addButton((b) => {
b.setIcon("trash").setTooltip("Delete").onClick(() => {
const currentExistingQuery = this.plugin.initialQueries.filter((p) => p.id == this.query.id)[0];
if (currentExistingQuery) {
this.plugin.initialQueries.remove(currentExistingQuery);
this.app.commands.removeCommand(`${this.plugin.manifest.id}:multiSelect-${currentExistingQuery.name}`);
}
this.settingEl.parentElement.removeChild(this.settingEl);
this.plugin.saveSettings();
});
});
}
};
// src/settings/settingTab.ts
var MultiSelectSettingTab = class extends import_obsidian4.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Settings for Multi Select." });
new import_obsidian4.Setting(containerEl).setName("Add New Query").setDesc("Add a new query to select files from result.").addButton((button) => {
let b = button.setTooltip("Add New Query").setButtonText("+").onClick(() => __async(this, null, function* () {
let modal = new QuerySettingsModal(this.app, this.plugin, containerEl);
modal.open();
}));
return b;
});
this.plugin.initialQueries.forEach((savedQuery) => {
const query = new Query_default();
Object.assign(query, savedQuery);
new QuerySetting(containerEl, query, this.app, this.plugin);
});
}
};
// main.ts
var MultiSelect = class extends import_obsidian5.Plugin {
constructor() {
super(...arguments);
this.initialQueries = [];
}
addMultiSelectQueryCommand(query) {
this.addCommand({
id: `multiSelect-${query.name}`,
name: `Multi Select from ${query.name}`,
callback: () => {
const leaf = this.app.workspace.activeLeaf;
if (leaf.view instanceof import_obsidian5.MarkdownView && leaf.view.editor) {
const queryResultModal = new QueryResultModal(this.app, this, query, leaf.view.editor.getCursor(), leaf.view.file);
queryResultModal.open();
}
}
});
}
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.settings.queries.forEach((savedQuery) => {
const query = new Query_default();
Object.assign(query, savedQuery);
this.initialQueries.push(query);
});
this.addSettingTab(new MultiSelectSettingTab(this.app, this));
this.settings.queries.forEach((query) => {
this.addMultiSelectQueryCommand(query);
});
});
}
onunload() {
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
this.settings.queries = this.initialQueries;
yield this.saveData(this.settings);
});
}
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsibWFpbi50cyIsICJzcmMvc2V0dGluZ3Mvc2V0dGluZ3MudHMiLCAic3JjL3F1ZXJpZXMvUXVlcnkudHMiLCAic3JjL3F1ZXJpZXMvcXVlcnlSZXN1bHRzTW9kYWwudHMiLCAic3JjL3NldHRpbmdzL3NldHRpbmdUYWIudHMiLCAic3JjL3NldHRpbmdzL1F1ZXJ5U2V0dGluZy50cyIsICJzcmMvc2V0dGluZ3MvUXVlcnlTZXR0aW5nTW9kYWwudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IE1hcmtkb3duVmlldywgUGx1Z2luIH0gZnJvbSAnb2JzaWRpYW4nO1xyXG5pbXBvcnQgeyBNdWx0aVNlbGVjdFNldHRpbmdzLCBERUZBVUxUX1NFVFRJTkdTIH0gZnJvbSBcInNyYy9zZXR0aW5ncy9zZXR0aW5nc1wiXHJcbmltcG9ydCBRdWVyeSBm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GlmIChhbGlhc2VzKSB7XG4gICAgICAgICAgICBjb25zdCBhbGlhc2VzU2VsZWN0b3JDb250YWluZXIgPSB2YWx1ZVRvZ2dsZXJMaW5lLmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgY2xzOiBcInZhbHVlLXNlbGVjdG9yLWFsaWFzZXNcIlxuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIHNldEljb24oYWxpYXNlc1NlbGVjdG9yQ29udGFpbmVyLCBcInRocmVlLWhvcml6b250YWwtYmFyc1wiKVxuICAgICAgICAgICAgY29uc3QgYWxpYXNlc0xpc3RDb250YWluZXIgPSB2YWx1ZVNlbGVjdG9yQ29udGFpbmVyLmNyZWF0ZURpdih7XG4gICAgICAgICAgICAgICAgY2xzOiBcImFsaWFzZXMtbGlzdC1jb250YWluZXJcIlxuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIGFsaWFzZXNMaXN0Q29udGFpbmVyLnN0eWxlLmRpc3BsYXkgPSBcIm5vbmVcIlxuICAgICAgICAgICAgYWxpYXNlc1NlbGVjdG9yQ29udGFpbmVyLm9uQ2xpY2tFdmVudChlID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoYWxpYXNlc0xpc3RDb250YWluZXIuc3R5bGUuZGlzcGxheSA9PT0gXCJub25lXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5idWlsZEFsaWFzU2VsZWN0b3IoYWxpYXNlc0xpc3RDb250YWluZXIsIHZhbHVlTGFiZWwsIGFsaWFzZXMsIGRlc3RGaWxlLmJhc2VuYW1lKVxuICAgICAgICAgICAgICAgICAgICBhbGlhc2VzTGlzdENvbnRhaW5lci5zdHlsZS5kaXNwbGF5ID0gXCJpbmxpbmUtYmxvY2tcIlxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGFsaWFzZXNMaXN0Q29udGFpbmVyLmlubmVySFRNTCA9ICcnXG4gICAgICAgICAgICAgICAgICAgIGFsaWFzZX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cmVhdGVFbCgnaDInLCB7IHRleHQ6ICdTZXR0aW5ncyBmb3IgTXVsdGkgU2VsZWN0LicgfSk7XG5cbiAgICAgICAgLyogQWRkIG5ldyBxdWVyeSovXG4gICAgICAgIG5ldyBTZXR0aW5nKGNvbnRhaW5lckVsKVxuICAgICAgICAgICAgLnNldE5hbWUoXCJBZGQgTmV3IFF1ZXJ5XCIpXG4gICAgICAgICAgICAuc2V0RGVzYyhcIkFkZCBhIG5ldyBxdWVyeSB0byBzZWxlY3QgZmlsZXMgZnJvbSByZXN1bHQuXCIpXG4gICAgICAgICAgICAuYWRkQnV0dG9uKChidXR0b246IEJ1dHRvbkNvbXBvbmVudCk6IEJ1dHRvbkNvbXBvbmVudCA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IGIgPSBidXR0b25cbiAgICAgICAgICAgICAgICAgICAgLnNldFRvb2x0aXAoXCJBZGQgTmV3IFF1ZXJ5XCIpXG4gICAgICAgICAgICAgICAgICAgIC5zZXRCdXR0b25UZXh0KFwiK1wiKVxuICAgICAgICAgICAgICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbW9kYWwgPSBuZXcgUXVlcnlTZXR0aW5nTW9kYWwodGhpcy5hcHAsIHRoaXMucGx1Z2luLCBjb250YWluZXJFbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RhbC5vcGVuKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGI7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAvKiBNYW5hZ2VkIHByb3BlcnRpZXMgdGhhdCBjdXJyZW50bHkgaGF2ZSBwcmVzZXQgdmFsdWVzICovXG4gICAgICAgIHRoaXMucGx1Z2luLmluaXRpYWxRdWVyaWVzLmZvckVhY2goc2F2ZWRRdWVyeSA9PiB7XG4gICAgICAgICAgICBjb25zdCBxdWVyeSA9IG5ldyBRdWVyeSgpX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gICAgc2V0VGV4dENvbnRlbnRXaXRobmFtZSgpOiB2b2lkIHtcbiAgICAgICAgdGhpcy5zZXROYW1lKHRoaXMucXVlcnkubmFtZSlcbiAgICAgICAgdGhpcy5zZXREZXNjKHRoaXMucXVlcnkuZGVzY3JpcHRpb24pXG4gICAgfVxuXG5cbiAgICBhZGRFZGl0QnV0dG9uKCk6IHZvaWQge1xuICAgICAgICB0aGlzLmFkZEJ1dHRvbigoYikgPT4ge1xuICAgICAgICAgICAgYi5zZXRJY29uKFwicGVuY2lsXCIpXG4gICAgICAgICAgICAgICAgLnNldFRvb2x0aXAoXCJFZGl0XCIpXG4gICAgICAgICAgICAgICAgLm9uQ2xpY2soKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgbW9kYWwgPSBuZXcgUXVlcnlTZXR0aW5nTW9kYWwodGhpcy5hcHAsIHRoaXMucGx1Z2luLCB0aGlzLmNvbnRhaW5lckVsLCB0aGlzLCB0aGlzLnF1ZXJ5KTtcbiAgICAgICAgICAgICAgICAgICAgbW9kYWwub3BlbigpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICB9KVxuICAgIH1cblxuICAgIGFkZERlbGV0ZUJ1dHRvbigpOiB2b2lkIHtcbiAgICAgICAgdGhpcy5hZGRCdXR0b24oKGIpID0+IHtcbiAgICAgICAgICAgIGIuc2V0SWNvbihcInRyYXNoXCIpXG4gICAgICAgICAgICAgICAgLnNldFRvb2x0aXAoXCJEZWxldGVcIilcbiAgICAgICAgICAgICAgICAub25DbGljaygoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIC8vcmVtb3ZlIHRoZSBjb21tYW5kXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRFeGlzdGluZ1F1ZXJ5ID0gdGhpcy5wbHVnaW4uaW5pdGlhbFF1ZXJpZXMuZmlsdGVyKHAgPT4gcC5pZCA9PSB0aGlzLnF1ZXJ5LmlkKVswXVxuICAgICAgICAgICAgICAgICAgICBp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VCdXR0b24oYjogQnV0dG9uQ29tcG9uZW50KTogQnV0dG9uQ29tcG9uZW50IHtcbiAgICAgICAgYi5zZXRUb29sdGlwKFwiU2F2ZVwiKVxuICAgICAgICAgICAgLnNldEljb24oXCJjaGVja21hcmtcIilcbiAgICAgICAgICAgIC5vbkNsaWNrKGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgZXJyb3IgPSBmYWxzZVxuICAgICAgICAgICAgICAgIGlmICgvXlsjPi1dLy50ZXN0KHRoaXMucXVlcnkubmFtZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgUXVlcnlTZXR0aW5nc01vZGFsLnNldFZhbGlkYXRpb25FcnJvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmFtZVByb21wdENvbXBvbmVudCwgdGhpcy5uYW1lUHJvbXB0Q29tcG9uZW50LmlucHV0RWwsXG4gICAgICAgICAgICAgICAgICAgICAgICBcIlF1ZXJ5IG5hbWUgY2Fubm90IHN0YXJ0IHdpdGggIywgPiwgLVwiXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMucXVlcnkubmFtZSA9PSBcIlwiKSB7XG4gICAgICAgICAgICAgICAgICAgIFF1ZXJ5U2V0dGluZ3NNb2RhbC5zZXRWYWxpZGF0aW9uRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm5hbWVQcm9tcHRDb21wb25lbnQsIHRoaXMubmFtZVByb21wdENvbXBvbmVudC5pbnB1dEVsLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJQcm9wZXJ0eSBuYW1lIGNhbiBub3QgYmUgRW1wdHlcIlxuICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICBlcnJvciA9IHRydWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIG5ldyBOb3RpY2UoXCJGaXggZXJyb3JzIGJlZm9yZSBzYXZpbmcuXCIpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMuc2F2ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRFeGlzdGluZ1F1ZXJ5ID0gdGhpcy5wbHVnaW4uaW5pdGlhbFF1ZXJpZXMuZmlsdGVyKHEgPT4gcS5pZCA9PSB0aGlzLnF1ZXJ5LmlkKVswXVxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50RXhpc3RpbmdRdWVyeSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnBsdWdpbi5pbml0aWFsUXVlcmllcy5yZW1vdmUoY3VycmVudEV4aXN0aW5nUXVlcnkpXG4gICAgICAgICAgICAgICAgICAgIC8vQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmFwcC5jb21tYW5kcy5yZW1vdmVDb21tYW5kKFxuICAgICAgICAgICAgICAgICAgICAgICAgYCR7dGhpcy5wbHVnaW4ubWFuaWZlc3QuaWR9Om11bHRpU2VsZWN0LSR7Y3VycmVudEV4aXN0aW5nUXVlcnkubmFtZX1gXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMucGx1Z2luLmluaXRpYWxRdWVyaWVzLnB1c2godGhpcy5xdWVyeSlcbiAgICAgICAgICAgICAgICB0aGlzLnBsdWdpbi5hZGRNdWx0aVNlbGVjdFF1ZXJ5Q29tbWFuZCh0aGlzLnF1ZXJ5KVxuICAgICAgICAgICAgICAgIHRoaXMuaW5pdGlhbFF1ZXJ5ID0gdGhpcy5xdWVyeVxuICAgICAgICAgICAgICAgIHRoaXMucGx1Z2luLnNhdmVTZXR0aW5ncygpXG4gICAgIC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