From 3d9e6163e7e08763eb92b364d684e8e4a3e3e178 Mon Sep 17 00:00:00 2001 From: Matt Wiseley Date: Wed, 5 Jul 2023 09:57:58 -0400 Subject: [PATCH] Use fixed format for editable timestamps --- src/settings.ts | 2 + src/tracker.ts | 54 ++++++++++++++----- .../plugins/simple-time-tracker/main | 52 +++++++++++++----- .../plugins/simple-time-tracker/main.js | 52 +++++++++++++----- 4 files changed, 123 insertions(+), 37 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index e699e5e..6a6c955 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,5 +1,6 @@ export const defaultSettings: SimpleTimeTrackerSettings = { timestampFormat: "YY-MM-DD HH:mm:ss", + editableTimestampFormat: "YYYY-MM-DD HH:mm:ss", csvDelimiter: ",", fineGrainedDurations: true }; @@ -7,6 +8,7 @@ export const defaultSettings: SimpleTimeTrackerSettings = { export interface SimpleTimeTrackerSettings { timestampFormat: string; + editableTimestampFormat: string; csvDelimiter: string; fineGrainedDurations: boolean; diff --git a/src/tracker.ts b/src/tracker.ts index f0ea101..564a92d 100644 --- a/src/tracker.ts +++ b/src/tracker.ts @@ -202,8 +202,12 @@ function formatTimestamp(timestamp: number, settings: SimpleTimeTrackerSettings) return moment.unix(timestamp).format(settings.timestampFormat); } -function unFormatTimestamp(formatted: string, settings: SimpleTimeTrackerSettings): number { - return moment(formatted, settings.timestampFormat).unix(); +function formatEditableTimestamp(timestamp: number, settings: SimpleTimeTrackerSettings) { + return moment.unix(timestamp).format(settings.editableTimestampFormat); +} + +function unformatEditableTimestamp(formatted: string, settings: SimpleTimeTrackerSettings): number { + return moment(formatted, settings.editableTimestampFormat).unix(); } function formatDuration(totalTime: number, settings: SimpleTimeTrackerSettings): string { @@ -294,7 +298,7 @@ class EditableField { this.box.inputEl.show(); } endEdit(): string { - let value = this.box.getValue() + const value = this.box.getValue(); this.label.setText(value); this.box.inputEl.hide(); this.label.hidden = false; @@ -302,16 +306,38 @@ class EditableField { } } +class EditableTimestampField extends EditableField { + settings: SimpleTimeTrackerSettings; + constructor(row: HTMLTableRowElement, indent: number, value: string, settings: SimpleTimeTrackerSettings) { + const timestamp = Number(value); + value = timestamp > 0 ? formatTimestamp(timestamp, settings) : ""; + super(row, indent, value); + this.settings = settings; + } + beginEdit(value: string) { + value = formatEditableTimestamp(Number(value), this.settings); + super.beginEdit(value); + } + endEdit(): string { + const value = this.box.getValue(); + const timestamp = unformatEditableTimestamp(value, this.settings); + const displayValue = formatTimestamp(timestamp, this.settings); + this.label.setText(displayValue); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } + getTimestamp(): number { + return unformatEditableTimestamp(this.box.getValue(), this.settings); + } +} + function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableElement, newSegmentNameBox: TextComponent, running: boolean, file: string, getSectionInfo: () => MarkdownSectionInformation, settings: SimpleTimeTrackerSettings, indent: number) { let row = table.createEl("tr"); let nameField = new EditableField(row, indent, entry.name); - - let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; - let startField = new EditableField(row, indent, startValue); - - let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; - let endField = new EditableField(row, indent, endValue); + let startField = new EditableTimestampField(row, indent, String(entry.startTime), settings); + let endField = new EditableTimestampField(row, indent, String(entry.endTime), settings); row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); @@ -333,14 +359,16 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle .onClick(async () => { if (nameField.editing()) { entry.name = nameField.endEdit(); - entry.startTime = unFormatTimestamp(startField.endEdit(), settings); - entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + startField.endEdit(); + entry.startTime = startField.getTimestamp(); + endField.endEdit(); + entry.endTime = endField.getTimestamp(); await saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); } else { nameField.beginEdit(entry.name); - startField.beginEdit(formatTimestamp(entry.startTime, settings)); - endField.beginEdit(formatTimestamp(entry.endTime, settings)); + startField.beginEdit(String(entry.startTime)); + endField.beginEdit(String(entry.endTime)); editButton.setIcon("lucide-check"); } }); diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/main b/test-vault/.obsidian/plugins/simple-time-tracker/main index a868cec..6235b4d 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main @@ -72,6 +72,7 @@ var import_obsidian3 = __toModule(require("obsidian")); // src/settings.ts var defaultSettings = { timestampFormat: "YY-MM-DD HH:mm:ss", + editableTimestampFormat: "YYYY-MM-DD HH:mm:ss", csvDelimiter: ",", fineGrainedDurations: true }; @@ -268,8 +269,11 @@ function setCountdownValues(tracker, current, total, currentDiv, settings) { function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } -function unFormatTimestamp(formatted, settings) { - return (0, import_obsidian2.moment)(formatted, settings.timestampFormat).unix(); +function formatEditableTimestamp(timestamp, settings) { + return import_obsidian2.moment.unix(timestamp).format(settings.editableTimestampFormat); +} +function unformatEditableTimestamp(formatted, settings) { + return (0, import_obsidian2.moment)(formatted, settings.editableTimestampFormat).unix(); } function formatDuration(totalTime, settings) { let ret = ""; @@ -349,20 +353,42 @@ var EditableField = class { this.box.inputEl.show(); } endEdit() { - let value = this.box.getValue(); + const value = this.box.getValue(); this.label.setText(value); this.box.inputEl.hide(); this.label.hidden = false; return value; } }; +var EditableTimestampField = class extends EditableField { + constructor(row, indent, value, settings) { + const timestamp = Number(value); + value = timestamp > 0 ? formatTimestamp(timestamp, settings) : ""; + super(row, indent, value); + this.settings = settings; + } + beginEdit(value) { + value = formatEditableTimestamp(Number(value), this.settings); + super.beginEdit(value); + } + endEdit() { + const value = this.box.getValue(); + const timestamp = unformatEditableTimestamp(value, this.settings); + const displayValue = formatTimestamp(timestamp, this.settings); + this.label.setText(displayValue); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } + getTimestamp() { + return unformatEditableTimestamp(this.box.getValue(), this.settings); + } +}; function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, file, getSectionInfo, settings, indent) { let row = table.createEl("tr"); let nameField = new EditableField(row, indent, entry.name); - let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; - let startField = new EditableField(row, indent, startValue); - let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; - let endField = new EditableField(row, indent, endValue); + let startField = new EditableTimestampField(row, indent, String(entry.startTime), settings); + let endField = new EditableTimestampField(row, indent, String(entry.endTime), settings); row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { @@ -374,14 +400,16 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, let editButton = new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setTooltip("Edit").setIcon("lucide-pencil").onClick(() => __async(this, null, function* () { if (nameField.editing()) { entry.name = nameField.endEdit(); - entry.startTime = unFormatTimestamp(startField.endEdit(), settings); - entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + startField.endEdit(); + entry.startTime = startField.getTimestamp(); + endField.endEdit(); + entry.endTime = endField.getTimestamp(); yield saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); } else { nameField.beginEdit(entry.name); - startField.beginEdit(formatTimestamp(entry.startTime, settings)); - endField.beginEdit(formatTimestamp(entry.endTime, settings)); + startField.beginEdit(String(entry.startTime)); + endField.beginEdit(String(entry.endTime)); editButton.setIcon("lucide-check"); } })); @@ -426,4 +454,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiLCAic3JjL3RyYWNrZXIudHMiXSwKICAic291cmNlc0NvbnRlbn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GVyKSk7XG4gICAgICAgICAgICAgICAgdC5vbkNoYW5nZShhc3luYyB2ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wbHVnaW4uc2V0dGluZ3MuY3N2RGVsaW1pdGVyID0gdi5sZW5ndGggPyB2IDogZGVmYXVsdFNldHRpbmdzLmNzdkRlbGltaXRlcjtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5wbHVnaW4uc2F2ZVNldHRpbmdzKCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICBuZXcgU2V0dGluZyh0aGlzLmNvbnRhaW5lckVsKVxuICAgICAgICAgICAgLnNldE5hbWUoXCJGaW5lLUdyYWluZWQgRHVyYXRpb25zXCIpXG4gICAgICAgICAgICAuc2V0RGVzYyhcIldoZXRoZXIgZHVyYXRpb25zIHNob3VsZCBpbmNsdWRlIGRheXMsIG1vbnRocyBhbmQgeWVhcnMuIElmIHRoaXMgaXMgZGlzYWJsZWQsIGFkZGl0aW9uYWwgdGltZSB1bml0cyB3aWxsIGJlIGRpc3BsYXllZCBhcyBwYXJ0IG9mIHRoZSBob3Vycy5cIilcbiAgICAgICAgICAgIC5hZGRUb2dnbGUodCA9PiB7XG4gICAgICAgICAgICAgICAgdC5zZXRWYWx1ZSh0aGlzLnBsdWdpbi5zZXR0aW5ncy5maW5lR3JhaW5lZER1cmF0aW9ucyk7XG4gICAgICAgICAgICAgICAgdC5vbkNoYW5nZShhc3luYyB2ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wbHVnaW4uc2V0dGluZ3MuZmluZUdyYWluZWREdXJhdGlvbnMgPSB2O1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnBsdWdpbi5zYXZlU2V0dGluZ3MoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuY29udGFpbmVyRWwuY3JlYXRlRWwoXCJoclw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jcmVhdGVFbChcInRyXCIpLmFwcGVuZChcbiAgICAgICAgICAgIGNyZWF0ZUVsKFwidGhcIiwge3RleHQ6IFwiU2VnbWVudFwifSksXG4gICAgICAgICAgICBjcmVhdGVFbChcInRoXCIsIHt0ZXh0OiBcIlN0YXJ0IHRpbWVcIn0pLFxuICAgICAgICAgICAgY3JlYXRlRWwoXCJ0aFwiLCB7dGV4dDogXCJFbmQgdGltZVwifSksXG4gICAgICAgICAgICBjcmVhdGVFbChcInRoXCIsIHt0ZXh0OiBcIkR1cmF0aW9uXCJ9KSxcbiAgICAgICAgICAgIGNyZWF0ZUVsKFwidGhcIikpO1xuXG4gICAgICAgIGZvciAobGV0IGVudHJ5IG9mIHRyYWNrZXIuZW50cmllcylcbiAgICAgICAgICAgIGFkZEVkaXRhYmxlVGFibGVSb3codHJhY2tlciwgZW50cnksIHRhYmxlLCBuZXdTZWdtZW50TmFtZUJveCwgcnVubmluZywgZmlsZSwgZ2V0U2VjdGlvbkluZm8sIHNldHRpbmdzLCAwKTtcblxuICAgICAgICAvLyBhZGQgY29weSBidXR0b25zXG4gICAgICAgIGxldCBidXR0b25zID0gZWxlbWVudC5jcmVhdGVFbChcImRpdlwiLCB7Y2xzOiBcInNpbXBsZS10aW1lLXRyYWNrZXItYm90dG9tXCJ9KTtcbiAgICAgICAgbmV3IEJ1dHRvbkNvbXBvbmVudChidXR0b25zKVxuICAgICAgICAgICAgLnNldEJ1dHRvblRleHQoXCJDb3B5IGFzIHRhYmxlXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA9PiBuYXZpZ2F0b3IuY2xpcGJvYXJkLndyaXRlVGV4dChjcmVhdGVNYXJrZG93blRhYmxlKHRyYWNrZXIsIHNldHRpbmdzKSkpO1xuICAgICAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGJ1dHRvbnMpXG4gICAgICAgICAgICAuc2V0QnV0dG9uVGV4dChcIkNvcHkgYXMgQ1NWXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA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iZXIge1xuICAgIHJldHVybiBtb21lbnQoZm9ybWF0dGVkLCBzZXR0aW5ncy5lZGl0YWJsZVRpbWVzdGFtcEZvcm1hdCkudW5peCgpO1xufVxuXG5mdW5jdGlvbiBmb3JtYXREdXJhdGlvbih0b3RhbFRpbWU6IG51bWJlciwgc2V0dGluZ3M6IFNpbXBsZVRpbWVUcmFja2VyU2V0dGluZ3MpOiBzdHJpbmcge1xuICAgIGxldCByZXQgPSBcIlwiO1xuICAgIGxldCBkdXJhdGlvbiA9IG1vbWVudC5kdXJhdGlvbih0b3RhbFRpbWUpO1xuICAgIGxldCBob3VyczogbnVtYmVyO1xuICAgIGlmIChzZXR0aW5ncy5maW5lR3JhaW5lZER1cmF0aW9ucykge1xuICAgICAgICBpZiAoZHVyYXRpb24ueWVhcnMoKSA+IDApXG4gICAgICAgICAgICByZXQgKz0gZHVyYXRpb24ueWVhcnMoKSArIFwieSBcIjtcbiAgICAgICAgaWYgKGR1cmF0aW9uLm1vbnRocygpID4gMClcbiAgICAgICAgICAgIHJldCArPSBkdXJhdGlvbi5tb250aHMoKSArIFwiTSBcIjtcbiAgICAgICAgaWYgKGR1cmF0aW9uLmRheXMoKSA+IDApXG4gICAgICAgICAgICByZXQgKz0gZHVyYXRpb24uZGF5cygpICsgXCJkIFwiO1xuICAgICAgICBob3VycyA9IGR1cmF0aW9uLmhvdXJzKCk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgaG91cnMgPSBNYXRoLmZsb29yKGR1cmF0aW9uLmFzSG91cnMoKSk7XG4gICAgfVxuICAgIGlmIChob3VycyA+IDApXG4gICAgICAgIHJldCArPSBob3VycyArIFwiaCBcIjtcbiAgICBpZiAoZHVyYXRpb24ubWludXRlcygpID4gMClcbiAgICAgICAgcmV0ICs9IGR1cmF0aW9uLm1pbnV0ZXMoKSArIFwibSBcIjtcbiAgICByZXQgKz0gZHVyYXRpb24uc2Vjb25kcygpICsgXCJzXCI7XG4gICAgcmV0dXJuIHJldDtcbn1cblxu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BUSxNQUFZO0FBQ2pCLGdCQUFZLFFBQVEsU0FBUztBQUM3QixVQUFNLFlBQVksU0FBUyxLQUFLLEtBQUssTUFBTTtBQUFBO0FBR25ELE1BQUksTUFBTSxZQUFZO0FBQ2xCLGFBQVMsT0FBTyxNQUFNO0FBQ2xCLDBCQUFvQixTQUFTLEtBQUssT0FBTyxtQkFBbUIsU0FBUyxNQUFNLGdCQUFnQixVQUFVLFNBQVM7QUFBQTtBQUFBOzs7QUg1WDFILDRDQUFxRCx3QkFBTztBQUFBLEVBSWxELFNBQXdCO0FBQUE7QUFDMUIsWUFBTSxLQUFLO0FBRVgsV0FBSyxjQUFjLElBQUksNkJBQTZCLEtBQUssS0FBSztBQUU5RCxXQUFLLG1DQUFtQyx1QkFBdUIsQ0FBQyxHQUFHLEdBQUcsTUFBTTtBQUN4RSxZQUFJLFVBQW1CLFlBQVk7QUFDbkMsVUFBRTtBQUNGLHVCQUFlLFNBQVMsR0FBRyxFQUFFLFlBQVksTUFBTSxFQUFFLGVBQWUsSUFBSSxLQUFLO0FBQUE7QUFHN0UsV0FBSyxXQUFXO0FBQUEsUUFDWixJQUFJO0FBQUEsUUFDSixNQUFNO0FBQUEsUUFDTixnQkFBZ0IsQ0FBQyxHQUFHLE1BQU07QUFDdEIsWUFBRSxpQkFBaUI7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBS3pCLGVBQThCO0FBQUE7QUFDaEMsV0FBSyxXQUFXLE9BQU8sT0FBTyxJQUFJLGlCQUFpQixNQUFNLEtBQUs7QUFBQTtBQUFBO0FBQUEsRUFHNUQsZUFBOEI7QUFBQTtBQUNoQyxZQUFNLEtBQUssU0FBUyxLQUFLO0FBQUE7QUFBQTtBQUFBOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/main.js b/test-vault/.obsidian/plugins/simple-time-tracker/main.js index a868cec..6235b4d 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main.js +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main.js @@ -72,6 +72,7 @@ var import_obsidian3 = __toModule(require("obsidian")); // src/settings.ts var defaultSettings = { timestampFormat: "YY-MM-DD HH:mm:ss", + editableTimestampFormat: "YYYY-MM-DD HH:mm:ss", csvDelimiter: ",", fineGrainedDurations: true }; @@ -268,8 +269,11 @@ function setCountdownValues(tracker, current, total, currentDiv, settings) { function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } -function unFormatTimestamp(formatted, settings) { - return (0, import_obsidian2.moment)(formatted, settings.timestampFormat).unix(); +function formatEditableTimestamp(timestamp, settings) { + return import_obsidian2.moment.unix(timestamp).format(settings.editableTimestampFormat); +} +function unformatEditableTimestamp(formatted, settings) { + return (0, import_obsidian2.moment)(formatted, settings.editableTimestampFormat).unix(); } function formatDuration(totalTime, settings) { let ret = ""; @@ -349,20 +353,42 @@ var EditableField = class { this.box.inputEl.show(); } endEdit() { - let value = this.box.getValue(); + const value = this.box.getValue(); this.label.setText(value); this.box.inputEl.hide(); this.label.hidden = false; return value; } }; +var EditableTimestampField = class extends EditableField { + constructor(row, indent, value, settings) { + const timestamp = Number(value); + value = timestamp > 0 ? formatTimestamp(timestamp, settings) : ""; + super(row, indent, value); + this.settings = settings; + } + beginEdit(value) { + value = formatEditableTimestamp(Number(value), this.settings); + super.beginEdit(value); + } + endEdit() { + const value = this.box.getValue(); + const timestamp = unformatEditableTimestamp(value, this.settings); + const displayValue = formatTimestamp(timestamp, this.settings); + this.label.setText(displayValue); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } + getTimestamp() { + return unformatEditableTimestamp(this.box.getValue(), this.settings); + } +}; function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, file, getSectionInfo, settings, indent) { let row = table.createEl("tr"); let nameField = new EditableField(row, indent, entry.name); - let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; - let startField = new EditableField(row, indent, startValue); - let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; - let endField = new EditableField(row, indent, endValue); + let startField = new EditableTimestampField(row, indent, String(entry.startTime), settings); + let endField = new EditableTimestampField(row, indent, String(entry.endTime), settings); row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { @@ -374,14 +400,16 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, let editButton = new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setTooltip("Edit").setIcon("lucide-pencil").onClick(() => __async(this, null, function* () { if (nameField.editing()) { entry.name = nameField.endEdit(); - entry.startTime = unFormatTimestamp(startField.endEdit(), settings); - entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + startField.endEdit(); + entry.startTime = startField.getTimestamp(); + endField.endEdit(); + entry.endTime = endField.getTimestamp(); yield saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); } else { nameField.beginEdit(entry.name); - startField.beginEdit(formatTimestamp(entry.startTime, settings)); - endField.beginEdit(formatTimestamp(entry.endTime, settings)); + startField.beginEdit(String(entry.startTime)); + endField.beginEdit(String(entry.endTime)); editButton.setIcon("lucide-check"); } })); @@ -426,4 +454,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiLCAic3JjL3RyYWNrZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IFBsdWdpbiB9IGZyb20gXCJvYnNpZGlhblwiO1xuaW1wb3J0IHsgZGVmYXVsdFNldHRpbmdzLCBTaW1wbGVUaW1lVHJhY2tlclNldHRpbmdzIH0gZnJvbSBcIi4vc2V0dGluZ3NcIjtcbmltcG9ydCB7IFNpbXBsZVRpbWVUc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1hdHRlZCwgc2V0dGluZ3MudGltZXN0YW1wRm9ybWF0KS51bml4KCk7XG59XG5cbmZ1bmN0aW9uIGZvcm1hdER1cmF0aW9uKHRvdGFsVGltZTogbnVtYmVyLCBzZXR0aW5nczogU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5ncyk6IHN0cmluZyB7XG4gICAgbGV0IHJldCA9IFwiXCI7XG4gICAgbGV0IGR1cmF0aW9uID0gbW9tZW50LmR1cmF0aW9uKHRvdGFsVGltZSk7XG4gICAgbGV0IGhvdXJzOiBudW1iZXI7XG4gICAgaWYgKHNldHRpbmdzLmZpbmVHcmFpbmVkRHVyYXRpb25zKSB7XG4gICAgICAgIGlmIChkdXJhdGlvbi55ZWFycygpID4gMClcbiAgICAgICAgICAgIHJldCArPSBkdXJhdGlvbi55ZWFycygpICsgXCJ5IFwiO1xuICAgICAgICBpZiAoZHVyYXRpb24ubW9udGhzKCkgPiAwKVxuICAgICAgICAgICAgcmV0ICs9IGR1cmF0aW9uLm1vbnRocygpICsgXCJNIFwiO1xuICAgICAgICBpZiAoZHVyYXRpb24uZGF5cygpID4gMClcbiAgICAgICAgICAgIHJldCArPSBkdXJhdGlvbi5kYXlzKCkgKyBcImQgXCI7XG4gICAgICAgIGhvdXJzID0gZHVyYXRpb24uaG91cnMoKTtcbiAgICB9IGVsc2Uge1xuICAgICAgICBob3VycyA9IE1hdGguZmxvb3IoZHVyYXRpb24uYXNIb3VycygpKTtcbiAgICB9XG4gICAgaWYgKGhvdXJzID4gMClcbiAgICAgICAgcmV0ICs9IGhvdXJzICsgXCJoIFwiO1xuICAgIGlmIChkdXJhdGlvbi5taW51dGVzKCkgPiAwKVxuICAgICAgICByZXQgKz0gZHVyYXRpb24ubWludXRlcygpICsgXCJtIFwiO1xuICAgIHJldCArPSBkdXJhdGlvbi5zZWNvbmRzKCkgKyBcInNcIjtcbiAgICByZXR1cm4gcmV0O1xufVxuXG5mdW5jdGlvbiBjcmVhdGVNYXJrZG93blRhYmxlKHR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cnVubmluZyA9IGlzUnVubmluZyh0cmFja2VyKTtcbiAgICBsZXQgYnRuID0gbmV3IEJ1dHRvbkNvbXBvbmVudChlbGVtZW50KVxuICAgICAgICAuc2V0Q2xhc3MoXCJjbGlja2FibGUtaWNvblwiKVxuICAgICAgICAuc2V0SWNvbihgbHVjaWRlLSR7cnVubmluZyA/IFwic3RvcFwiIDogXCJwbGF5XCJ9LWNpcmNsZWApXG4gICAgICAgIC5zZXRUb29sdGlwKHJ1bm5pbmcgPyBcIkVuZFwiIDogXCJTdGFydFwiKVxuICAgICAgICAub25DbGljayhhc3luYyAoKSA9PiB7XG4gICAgICAgICAgICBpZiAocnVubmluZykge1xuICAgICAgICAgICAgICAgIGVuZFJ1bm5pbmdFbnRyeSh0cmFja2VyKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgc3RhcnROZXdFbnRyeSh0cmFja2VyLCBuZXdTZWdtZW50TmFtZUJveC5nZXRWYWx1ZSgpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGF3YWl0IHNhdmVUcmFja2VyKHRyYWNrZXIsIHRoaXMuYXBwLCBmaWxlLCBnZXRTZWN0aW9uSW5mbygpKTtcbiAgICAgICAgfSk7XG4gICAgYnRuLmJ1dHRvbkVsLmFkZENsYXNzKFwic2ltcGxlLXRpbWUtdHJhY2tlci1idG5cIik7XG4gICAgbGV0IG5ld1NlZ21lbnROYW1lQm94ID0gbmV3IFRleHRDb21wb25lbnQoZWxlbWVudClcbiAgICAgICAgLnNldFBsYWNlaG9sZGVyKFwiU2VnbWVudCBuYW1lXCIpXG4gICAgICAgIC5zZXREaXNhYmxlZChydW5uaW5nKTtcbiAgICBuZXdTZWdtZW50TmFtZUJveC5pbnB1dEVsLmFkZENsYXNzKFwic2ltcGxlLXRpbWUtdHJhY2tlci10eHRcIik7XG5cbiAgICAvLyBhZGQgdGltZXJzXG4gICAgbGV0IHRpbWVyID0gZWxlbWVudC5jcmVhdGVEaXYo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YXRlRWwoXCJ0aFwiLCB7dGV4dDogXCJFbmQgdGltZVwifSksXG4gICAgICAgICAgICBjcmVhdGVFbChcInRoXCIsIHt0ZXh0OiBcIkR1cmF0aW9uXCJ9KSxcbiAgICAgICAgICAgIGNyZWF0ZUVsKFwidGhcIikpO1xuXG4gICAgICAgIGZvciAobGV0IGVudHJ5IG9mIHRyYWNrZXIuZW50cmllcylcbiAgICAgICAgICAgIGFkZEVkaXRhYmxlVGFibGVSb3codHJhY2tlciwgZW50cnksIHRhYmxlLCBuZXdTZWdtZW50TmFtZUJveCwgcnVubmluZywgZmlsZSwgZ2V0U2VjdGlvbkluZm8sIHNldHRpbmdzLCAwKTtcblxuICAgICAgICAvLyBhZGQgY29weSBidXR0b25zXG4gICAgICAgIGxldCBidXR0b25zID0gZWxlbWVudC5jcmVhdGVFbChcImRpdlwiLCB7Y2xzOiBcInNpbXBsZS10aW1lLXRyYWNrZXItYm90dG9tXCJ9KTtcbiAgICAgICAgbmV3IEJ1dHRvbkNvbXBvbmVudChidXR0b25zKVxuICAgICAgICAgICAgLnNldEJ1dHRvblRleHQoXCJDb3B5IGFzIHRhYmxlXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA9PiBuYXZpZ2F0b3IuY2xpcGJvYXJkLndyaXRlVGV4dChjcmVhdGVNYXJrZG93blRhYmxlKHRyYWNrZXIsIHNldHRpbmdzKSkpO1xuICAgICAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGJ1dHRvbnMpXG4gICAgICAgICAgICAuc2V0QnV0dG9uVGV4dChcIkNvcHkgYXMgQ1NWXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA9PiBuYXZpZ2F0b3IuY2xpcGJvYXJkLndyaXRlVGV4dChjcmVhdGVDc3YodHJhY2tlciwgc2V0dGluZ3MpKSk7XG4gICAgfVxuXG5cbiAgICBzZXRDb3VudGRvd25WYWx1ZXModHJhY2tlciwgY3VycmVudCwgdG90YWwsIGN1cnJlbnREaXYsIHNldHRpbmdz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RpbWVUcmFja2VyU2V0dGluZ3MpOiBzdHJpbmcge1xuICAgIGxldCByZXQgPSBcIlwiO1xuICAgIGxldCBkdXJhdGlvbiA9IG1vbWVudC5kdXJhdGlvbih0b3RhbFRpbWUpO1xuICAgIGxldCBob3VyczogbnVtYmVyO1xuICAgIGlmIChzZXR0aW5ncy5maW5lR3JhaW5lZER1cmF0aW9ucykge1xuICAgICAgICBpZiAoZHVyYXRpb24ueWVhcnMoKSA+IDApXG4gICAgICAgICAgICByZXQgKz0gZHVyYXRpb24ueWVhcnMoKSArIFwieSBcIjtcbiAgICAgICAgaWYgKGR1cmF0aW9uLm1vbnRocygpID4gMClcbiAgICAgICAgICAgIHJldCArPSBkdXJhdGlvbi5tb250aHMoKSArIFwiTSBcIjtcbiAgICAgICAgaWYgKGR1cmF0aW9uLmRheXMoKSA+IDApXG4gICAgICAgICAgICByZXQgKz0gZHVyYXRpb24uZGF5cygpICsgXCJkIFwiO1xuICAgICAgICBob3VycyA9IGR1cmF0aW9uLmhvdXJzKCk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgaG91cnMgPSBNYXRoLmZsb29yKGR1cmF0aW9uLmFzSG91cnMoKSk7XG4gICAgfVxuICAgIGlmIChob3VycyA+IDApXG4gICAgICAgIHJldCArPSBob3VycyArIFwiaCBcIjtcbiAgICBpZiAoZHVyYXRpb24ubWludXRlcygpID4gMClcbiAgICAgICAgcmV0ICs9IGR1cmF0aW9uLm1pbnV0ZXMoKSArIFwibSBcIjtcbiAgICByZXQgKz0gZHVyYXRpb24uc2Vjb25kcygpICsgXCJzXCI7XG4gICAgcmV0dXJuIHJldDtcbn1cblxuZnVuY3Rpb24gY3JlYXRlTWFya2Rvd25UYWJsZSh0cmFja2VyOiBUcmFja2VyLCBzZXR0aW5nczogU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5ncyk6IHN0cmluZyB7XG4gICAgbGV0IHRhYmxlID0gW1tcIlNlZ21lbnRcIiwgXCJTdGFydCB0aW1lXCIsI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